mascot-vis 3.5.0 → 4.0.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.
- package/README.md +1 -1
- package/dist/mascot-cjs.cjs +2 -2
- package/dist/mascot-esm.js +2 -2
- package/dist/mascot-umd.js +2 -2
- package/package.json +1 -1
package/dist/mascot-cjs.cjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
// version:
|
|
2
|
-
"use strict";function t(t,e){return null==t||null==e?NaN:t<e?-1:t>e?1:t>=e?0:NaN}function e(t,e){return null==t||null==e?NaN:e<t?-1:e>t?1:e>=t?0:NaN}function n(n){let i,o,a;function s(t,e,n=0,r=t.length){if(n<r){if(0!==i(e,e))return r;do{const i=n+r>>>1;o(t[i],e)<0?n=i+1:r=i}while(n<r)}return n}return 2!==n.length?(i=t,o=(e,r)=>t(n(e),r),a=(t,e)=>n(t)-e):(i=n===t||n===e?n:r,o=n,a=n),{left:s,center:function(t,e,n=0,r=t.length){const i=s(t,e,n,r-1);return i>n&&a(t[i-1],e)>-a(t[i],e)?i-1:i},right:function(t,e,n=0,r=t.length){if(n<r){if(0!==i(e,e))return r;do{const i=n+r>>>1;o(t[i],e)<=0?n=i+1:r=i}while(n<r)}return n}}}function r(){return 0}function i(t){return null===t?NaN:+t}const o=n(t),a=o.right,s=o.left,l=n(i).center;const c=h(p),u=h(function(t){const e=p(t);return(t,n,r,i,o)=>{e(t,n,(r<<=2)+0,(i<<=2)+0,o<<=2),e(t,n,r+1,i+1,o),e(t,n,r+2,i+2,o),e(t,n,r+3,i+3,o)}});function h(t){return function(e,n,r=n){if(!((n=+n)>=0))throw new RangeError("invalid rx");if(!((r=+r)>=0))throw new RangeError("invalid ry");let{data:i,width:o,height:a}=e;if(!((o=Math.floor(o))>=0))throw new RangeError("invalid width");if(!((a=Math.floor(void 0!==a?a:i.length/o))>=0))throw new RangeError("invalid height");if(!o||!a||!n&&!r)return e;const s=n&&t(n),l=r&&t(r),c=i.slice();return s&&l?(f(s,c,i,o,a),f(s,i,c,o,a),f(s,c,i,o,a),d(l,i,c,o,a),d(l,c,i,o,a),d(l,i,c,o,a)):s?(f(s,i,c,o,a),f(s,c,i,o,a),f(s,i,c,o,a)):l&&(d(l,i,c,o,a),d(l,c,i,o,a),d(l,i,c,o,a)),e}}function f(t,e,n,r,i){for(let o=0,a=r*i;o<a;)t(e,n,o,o+=r,1)}function d(t,e,n,r,i){for(let o=0,a=r*i;o<r;++o)t(e,n,o,o+a,r)}function p(t){const e=Math.floor(t);if(e===t)return function(t){const e=2*t+1;return(n,r,i,o,a)=>{if(!((o-=a)>=i))return;let s=t*r[i];const l=a*t;for(let t=i,e=i+l;t<e;t+=a)s+=r[Math.min(o,t)];for(let t=i,c=o;t<=c;t+=a)s+=r[Math.min(o,t+l)],n[t]=s/e,s-=r[Math.max(i,t-l)]}}(t);const n=t-e,r=2*t+1;return(t,i,o,a,s)=>{if(!((a-=s)>=o))return;let l=e*i[o];const c=s*e,u=c+s;for(let t=o,e=o+c;t<e;t+=s)l+=i[Math.min(a,t)];for(let e=o,h=a;e<=h;e+=s)l+=i[Math.min(a,e+c)],t[e]=(l+n*(i[Math.max(o,e-u)]+i[Math.min(a,e+u)]))/r,l-=i[Math.max(o,e-c)]}}function g(t,e){let n=0;if(void 0===e)for(let e of t)null!=e&&(e=+e)>=e&&++n;else{let r=-1;for(let i of t)null!=(i=e(i,++r,t))&&(i=+i)>=i&&++n}return n}function _(t){return 0|t.length}function y(t){return!(t>0)}function m(t){return"object"!=typeof t||"length"in t?t:Array.from(t)}function b(t,e){let n,r=0,i=0,o=0;if(void 0===e)for(let e of t)null!=e&&(e=+e)>=e&&(n=e-i,i+=n/++r,o+=n*(e-i));else{let a=-1;for(let s of t)null!=(s=e(s,++a,t))&&(s=+s)>=s&&(n=s-i,i+=n/++r,o+=n*(s-i))}if(r>1)return o/(r-1)}function v(t,e){const n=b(t,e);return n?Math.sqrt(n):n}function x(t,e){let n,r;if(void 0===e)for(const e of t)null!=e&&(void 0===n?e>=e&&(n=r=e):(n>e&&(n=e),r<e&&(r=e)));else{let i=-1;for(let o of t)null!=(o=e(o,++i,t))&&(void 0===n?o>=o&&(n=r=o):(n>o&&(n=o),r<o&&(r=o)))}return[n,r]}class w{constructor(){this._partials=new Float64Array(32),this._n=0}add(t){const e=this._partials;let n=0;for(let r=0;r<this._n&&r<32;r++){const i=e[r],o=t+i,a=Math.abs(t)<Math.abs(i)?t-(o-i):i-(o-t);a&&(e[n++]=a),t=o}return e[n]=t,this._n=n+1,this}valueOf(){const t=this._partials;let e,n,r,i=this._n,o=0;if(i>0){for(o=t[--i];i>0&&(e=o,n=t[--i],o=e+n,r=n-(o-e),!r););i>0&&(r<0&&t[i-1]<0||r>0&&t[i-1]>0)&&(n=2*r,e=o+n,n==e-o&&(o=e))}return o}}class E extends Map{constructor(t,e=k){if(super(),Object.defineProperties(this,{_intern:{value:new Map},_key:{value:e}}),null!=t)for(const[e,n]of t)this.set(e,n)}get(t){return super.get(T(this,t))}has(t){return super.has(T(this,t))}set(t,e){return super.set(C(this,t),e)}delete(t){return super.delete(S(this,t))}}class A extends Set{constructor(t,e=k){if(super(),Object.defineProperties(this,{_intern:{value:new Map},_key:{value:e}}),null!=t)for(const e of t)this.add(e)}has(t){return super.has(T(this,t))}add(t){return super.add(C(this,t))}delete(t){return super.delete(S(this,t))}}function T({_intern:t,_key:e},n){const r=e(n);return t.has(r)?t.get(r):n}function C({_intern:t,_key:e},n){const r=e(n);return t.has(r)?t.get(r):(t.set(r,n),n)}function S({_intern:t,_key:e},n){const r=e(n);return t.has(r)&&(n=t.get(r),t.delete(r)),n}function k(t){return null!==t&&"object"==typeof t?t.valueOf():t}function M(t){return t}function R(t,...e){return V(t,M,M,e)}function O(t,...e){return V(t,Array.from,M,e)}function N(t,e){for(let n=1,r=e.length;n<r;++n)t=t.flatMap(t=>t.pop().map(([e,n])=>[...t,e,n]));return t}function I(t,e,...n){return V(t,M,e,n)}function L(t,e,...n){return V(t,Array.from,e,n)}function P(t){if(1!==t.length)throw new Error("duplicate key");return t[0]}function V(t,e,n,r){return function t(i,o){if(o>=r.length)return n(i);const a=new E,s=r[o++];let l=-1;for(const t of i){const e=s(t,++l,i),n=a.get(e);n?n.push(t):a.set(e,[t])}for(const[e,n]of a)a.set(e,t(n,o));return e(a)}(t,0)}function D(t,e){return Array.from(e,e=>t[e])}function B(t,...e){if("function"!=typeof t[Symbol.iterator])throw new TypeError("values is not iterable");t=Array.from(t);let[n]=e;if(n&&2!==n.length||e.length>1){const r=Uint32Array.from(t,(t,e)=>e);return e.length>1?(e=e.map(e=>t.map(e)),r.sort((t,n)=>{for(const r of e){const e=F(r[t],r[n]);if(e)return e}})):(n=t.map(n),r.sort((t,e)=>F(n[t],n[e]))),D(t,r)}return t.sort(z(n))}function z(e=t){if(e===t)return F;if("function"!=typeof e)throw new TypeError("compare is not a function");return(t,n)=>{const r=e(t,n);return r||0===r?r:(0===e(n,n))-(0===e(t,t))}}function F(t,e){return(null==t||!(t>=t))-(null==e||!(e>=e))||(t<e?-1:t>e?1:0)}var G=Array.prototype.slice;function j(t){return()=>t}const U=Math.sqrt(50),Y=Math.sqrt(10),H=Math.sqrt(2);function q(t,e,n){const r=(e-t)/Math.max(0,n),i=Math.floor(Math.log10(r)),o=r/Math.pow(10,i),a=o>=U?10:o>=Y?5:o>=H?2:1;let s,l,c;return i<0?(c=Math.pow(10,-i)/a,s=Math.round(t*c),l=Math.round(e*c),s/c<t&&++s,l/c>e&&--l,c=-c):(c=Math.pow(10,i)*a,s=Math.round(t/c),l=Math.round(e/c),s*c<t&&++s,l*c>e&&--l),l<s&&.5<=n&&n<2?q(t,e,2*n):[s,l,c]}function W(t,e,n){if(!((n=+n)>0))return[];if((t=+t)===(e=+e))return[t];const r=e<t,[i,o,a]=r?q(e,t,n):q(t,e,n);if(!(o>=i))return[];const s=o-i+1,l=new Array(s);if(r)if(a<0)for(let t=0;t<s;++t)l[t]=(o-t)/-a;else for(let t=0;t<s;++t)l[t]=(o-t)*a;else if(a<0)for(let t=0;t<s;++t)l[t]=(i+t)/-a;else for(let t=0;t<s;++t)l[t]=(i+t)*a;return l}function $(t,e,n){return q(t=+t,e=+e,n=+n)[2]}function X(t,e,n){n=+n;const r=(e=+e)<(t=+t),i=r?$(e,t,n):$(t,e,n);return(r?-1:1)*(i<0?1/-i:i)}function K(t,e,n){let r;for(;;){const i=$(t,e,n);if(i===r||0===i||!isFinite(i))return[t,e];i>0?(t=Math.floor(t/i)*i,e=Math.ceil(e/i)*i):i<0&&(t=Math.ceil(t*i)/i,e=Math.floor(e*i)/i),r=i}}function Z(t){return Math.max(1,Math.ceil(Math.log(g(t))/Math.LN2)+1)}function J(){var t=M,e=x,n=Z;function r(r){Array.isArray(r)||(r=Array.from(r));var i,o,s,l=r.length,c=new Array(l);for(i=0;i<l;++i)c[i]=t(r[i],i,r);var u=e(c),h=u[0],f=u[1],d=n(c,h,f);if(!Array.isArray(d)){const t=f,n=+d;if(e===x&&([h,f]=K(h,f,n)),(d=W(h,f,n))[0]<=h&&(s=$(h,f,n)),d[d.length-1]>=f)if(t>=f&&e===x){const t=$(h,f,n);isFinite(t)&&(t>0?f=(Math.floor(f/t)+1)*t:t<0&&(f=(Math.ceil(f*-t)+1)/-t))}else d.pop()}for(var p=d.length,g=0,_=p;d[g]<=h;)++g;for(;d[_-1]>f;)--_;(g||_<p)&&(d=d.slice(g,_),p=_-g);var y,m=new Array(p+1);for(i=0;i<=p;++i)(y=m[i]=[]).x0=i>0?d[i-1]:h,y.x1=i<p?d[i]:f;if(isFinite(s)){if(s>0)for(i=0;i<l;++i)null!=(o=c[i])&&h<=o&&o<=f&&m[Math.min(p,Math.floor((o-h)/s))].push(r[i]);else if(s<0)for(i=0;i<l;++i)if(null!=(o=c[i])&&h<=o&&o<=f){const t=Math.floor((h-o)*s);m[Math.min(p,t+(d[t]<=o))].push(r[i])}}else for(i=0;i<l;++i)null!=(o=c[i])&&h<=o&&o<=f&&m[a(d,o,0,p)].push(r[i]);return m}return r.value=function(e){return arguments.length?(t="function"==typeof e?e:j(e),r):t},r.domain=function(t){return arguments.length?(e="function"==typeof t?t:j([t[0],t[1]]),r):e},r.thresholds=function(t){return arguments.length?(n="function"==typeof t?t:j(Array.isArray(t)?G.call(t):t),r):n},r}function Q(t,e){let n;if(void 0===e)for(const e of t)null!=e&&(n<e||void 0===n&&e>=e)&&(n=e);else{let r=-1;for(let i of t)null!=(i=e(i,++r,t))&&(n<i||void 0===n&&i>=i)&&(n=i)}return n}function tt(t,e){let n,r=-1,i=-1;if(void 0===e)for(const e of t)++i,null!=e&&(n<e||void 0===n&&e>=e)&&(n=e,r=i);else for(let o of t)null!=(o=e(o,++i,t))&&(n<o||void 0===n&&o>=o)&&(n=o,r=i);return r}function et(t,e){let n;if(void 0===e)for(const e of t)null!=e&&(n>e||void 0===n&&e>=e)&&(n=e);else{let r=-1;for(let i of t)null!=(i=e(i,++r,t))&&(n>i||void 0===n&&i>=i)&&(n=i)}return n}function nt(t,e){let n,r=-1,i=-1;if(void 0===e)for(const e of t)++i,null!=e&&(n>e||void 0===n&&e>=e)&&(n=e,r=i);else for(let o of t)null!=(o=e(o,++i,t))&&(n>o||void 0===n&&o>=o)&&(n=o,r=i);return r}function rt(t,e,n=0,r=1/0,i){if(e=Math.floor(e),n=Math.floor(Math.max(0,n)),r=Math.floor(Math.min(t.length-1,r)),!(n<=e&&e<=r))return t;for(i=void 0===i?F:z(i);r>n;){if(r-n>600){const o=r-n+1,a=e-n+1,s=Math.log(o),l=.5*Math.exp(2*s/3),c=.5*Math.sqrt(s*l*(o-l)/o)*(a-o/2<0?-1:1);rt(t,e,Math.max(n,Math.floor(e-a*l/o+c)),Math.min(r,Math.floor(e+(o-a)*l/o+c)),i)}const o=t[e];let a=n,s=r;for(it(t,n,e),i(t[r],o)>0&&it(t,n,r);a<s;){for(it(t,a,s),++a,--s;i(t[a],o)<0;)++a;for(;i(t[s],o)>0;)--s}0===i(t[n],o)?it(t,n,s):(++s,it(t,s,r)),s<=e&&(n=s+1),e<=s&&(r=s-1)}return t}function it(t,e,n){const r=t[e];t[e]=t[n],t[n]=r}function ot(e,n=t){let r,i=!1;if(1===n.length){let o;for(const a of e){const e=n(a);(i?t(e,o)>0:0===t(e,e))&&(r=a,o=e,i=!0)}}else for(const t of e)(i?n(t,r)>0:0===n(t,t))&&(r=t,i=!0);return r}function at(t,e,n){if(t=Float64Array.from(function*(t,e){if(void 0===e)for(let e of t)null!=e&&(e=+e)>=e&&(yield e);else{let n=-1;for(let r of t)null!=(r=e(r,++n,t))&&(r=+r)>=r&&(yield r)}}(t,n)),(r=t.length)&&!isNaN(e=+e)){if(e<=0||r<2)return et(t);if(e>=1)return Q(t);var r,i=(r-1)*e,o=Math.floor(i),a=Q(rt(t,o).subarray(0,o+1));return a+(et(t.subarray(o+1))-a)*(i-o)}}function st(t,e,n=i){if((r=t.length)&&!isNaN(e=+e)){if(e<=0||r<2)return+n(t[0],0,t);if(e>=1)return+n(t[r-1],r-1,t);var r,o=(r-1)*e,a=Math.floor(o),s=+n(t[a],a,t);return s+(+n(t[a+1],a+1,t)-s)*(o-a)}}function lt(t,e,n=i){if(!isNaN(e=+e)){if(r=Float64Array.from(t,(e,r)=>i(n(t[r],r,t))),e<=0)return nt(r);if(e>=1)return tt(r);var r,o=Uint32Array.from(t,(t,e)=>e),a=r.length-1,s=Math.floor(a*e);return rt(o,s,0,a,(t,e)=>F(r[t],r[e])),(s=ot(o.subarray(0,s+1),t=>r[t]))>=0?s:-1}}function ct(t,e){let n=0,r=0;if(void 0===e)for(let e of t)null!=e&&(e=+e)>=e&&(++n,r+=e);else{let i=-1;for(let o of t)null!=(o=e(o,++i,t))&&(o=+o)>=o&&(++n,r+=o)}if(n)return r/n}function ut(t,e){return at(t,.5,e)}function ht(t){return Array.from(function*(t){for(const e of t)yield*e}(t))}function ft(t,e){return[t,e]}function dt(t,e,n){t=+t,e=+e,n=(i=arguments.length)<2?(e=t,t=0,1):i<3?1:+n;for(var r=-1,i=0|Math.max(0,Math.ceil((e-t)/n)),o=new Array(i);++r<i;)o[r]=t+r*n;return o}function pt(e,n=t){if(1===n.length)return nt(e,n);let r,i=-1,o=-1;for(const t of e)++o,(i<0?0===n(t,t):n(t,r)<0)&&(r=t,i=o);return i}var gt=_t(Math.random);function _t(t){return function(e,n=0,r=e.length){let i=r-(n=+n);for(;i;){const r=t()*i--|0,o=e[i+n];e[i+n]=e[r+n],e[r+n]=o}return e}}function yt(t,e){let n=0;if(void 0===e)for(let e of t)(e=+e)&&(n+=e);else{let r=-1;for(let i of t)(i=+e(i,++r,t))&&(n+=i)}return n}function mt(t){if(!(i=t.length))return[];for(var e=-1,n=et(t,bt),r=new Array(n);++e<n;)for(var i,o=-1,a=r[e]=new Array(i);++o<i;)a[o]=t[o][e];return r}function bt(t){return t.length}function vt(t){return t instanceof A?t:new A(t)}function xt(t,e){const n=t[Symbol.iterator](),r=new Set;for(const t of e){const e=wt(t);if(r.has(e))continue;let i,o;for(;({value:i,done:o}=n.next());){if(o)return!1;const t=wt(i);if(r.add(t),Object.is(e,t))break}}return!0}function wt(t){return null!==t&&"object"==typeof t?t.valueOf():t}function Et(t){return t}var At=1e-6;function Tt(t){return"translate("+t+",0)"}function Ct(t){return"translate(0,"+t+")"}function St(t){return e=>+t(e)}function kt(t,e){return e=Math.max(0,t.bandwidth()-2*e)/2,t.round()&&(e=Math.round(e)),n=>+t(n)+e}function Mt(){return!this.__axis}function Rt(t,e){var n=[],r=null,i=null,o=6,a=6,s=3,l="undefined"!=typeof window&&window.devicePixelRatio>1?0:.5,c=1===t||4===t?-1:1,u=4===t||2===t?"x":"y",h=1===t||3===t?Tt:Ct;function f(f){var d=null==r?e.ticks?e.ticks.apply(e,n):e.domain():r,p=null==i?e.tickFormat?e.tickFormat.apply(e,n):Et:i,g=Math.max(o,0)+s,_=e.range(),y=+_[0]+l,m=+_[_.length-1]+l,b=(e.bandwidth?kt:St)(e.copy(),l),v=f.selection?f.selection():f,x=v.selectAll(".domain").data([null]),w=v.selectAll(".tick").data(d,e).order(),E=w.exit(),A=w.enter().append("g").attr("class","tick"),T=w.select("line"),C=w.select("text");x=x.merge(x.enter().insert("path",".tick").attr("class","domain").attr("stroke","currentColor")),w=w.merge(A),T=T.merge(A.append("line").attr("stroke","currentColor").attr(u+"2",c*o)),C=C.merge(A.append("text").attr("fill","currentColor").attr(u,c*g).attr("dy",1===t?"0em":3===t?"0.71em":"0.32em")),f!==v&&(x=x.transition(f),w=w.transition(f),T=T.transition(f),C=C.transition(f),E=E.transition(f).attr("opacity",At).attr("transform",function(t){return isFinite(t=b(t))?h(t+l):this.getAttribute("transform")}),A.attr("opacity",At).attr("transform",function(t){var e=this.parentNode.__axis;return h((e&&isFinite(e=e(t))?e:b(t))+l)})),E.remove(),x.attr("d",4===t||2===t?a?"M"+c*a+","+y+"H"+l+"V"+m+"H"+c*a:"M"+l+","+y+"V"+m:a?"M"+y+","+c*a+"V"+l+"H"+m+"V"+c*a:"M"+y+","+l+"H"+m),w.attr("opacity",1).attr("transform",function(t){return h(b(t)+l)}),T.attr(u+"2",c*o),C.attr(u,c*g).text(p),v.filter(Mt).attr("fill","none").attr("font-size",10).attr("font-family","sans-serif").attr("text-anchor",2===t?"start":4===t?"end":"middle"),v.each(function(){this.__axis=b})}return f.scale=function(t){return arguments.length?(e=t,f):e},f.ticks=function(){return n=Array.from(arguments),f},f.tickArguments=function(t){return arguments.length?(n=null==t?[]:Array.from(t),f):n.slice()},f.tickValues=function(t){return arguments.length?(r=null==t?null:Array.from(t),f):r&&r.slice()},f.tickFormat=function(t){return arguments.length?(i=t,f):i},f.tickSize=function(t){return arguments.length?(o=a=+t,f):o},f.tickSizeInner=function(t){return arguments.length?(o=+t,f):o},f.tickSizeOuter=function(t){return arguments.length?(a=+t,f):a},f.tickPadding=function(t){return arguments.length?(s=+t,f):s},f.offset=function(t){return arguments.length?(l=+t,f):l},f}var Ot={value:()=>{}};function Nt(){for(var t,e=0,n=arguments.length,r={};e<n;++e){if(!(t=arguments[e]+"")||t in r||/[\s.]/.test(t))throw new Error("illegal type: "+t);r[t]=[]}return new It(r)}function It(t){this._=t}function Lt(t,e){for(var n,r=0,i=t.length;r<i;++r)if((n=t[r]).name===e)return n.value}function Pt(t,e,n){for(var r=0,i=t.length;r<i;++r)if(t[r].name===e){t[r]=Ot,t=t.slice(0,r).concat(t.slice(r+1));break}return null!=n&&t.push({name:e,value:n}),t}It.prototype=Nt.prototype={constructor:It,on:function(t,e){var n,r,i=this._,o=(r=i,(t+"").trim().split(/^|\s+/).map(function(t){var e="",n=t.indexOf(".");if(n>=0&&(e=t.slice(n+1),t=t.slice(0,n)),t&&!r.hasOwnProperty(t))throw new Error("unknown type: "+t);return{type:t,name:e}})),a=-1,s=o.length;if(!(arguments.length<2)){if(null!=e&&"function"!=typeof e)throw new Error("invalid callback: "+e);for(;++a<s;)if(n=(t=o[a]).type)i[n]=Pt(i[n],t.name,e);else if(null==e)for(n in i)i[n]=Pt(i[n],t.name,null);return this}for(;++a<s;)if((n=(t=o[a]).type)&&(n=Lt(i[n],t.name)))return n},copy:function(){var t={},e=this._;for(var n in e)t[n]=e[n].slice();return new It(t)},call:function(t,e){if((n=arguments.length-2)>0)for(var n,r,i=new Array(n),o=0;o<n;++o)i[o]=arguments[o+2];if(!this._.hasOwnProperty(t))throw new Error("unknown type: "+t);for(o=0,n=(r=this._[t]).length;o<n;++o)r[o].value.apply(e,i)},apply:function(t,e,n){if(!this._.hasOwnProperty(t))throw new Error("unknown type: "+t);for(var r=this._[t],i=0,o=r.length;i<o;++i)r[i].value.apply(e,n)}};var Vt="http://www.w3.org/1999/xhtml",Dt={svg:"http://www.w3.org/2000/svg",xhtml:Vt,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};function Bt(t){var e=t+="",n=e.indexOf(":");return n>=0&&"xmlns"!==(e=t.slice(0,n))&&(t=t.slice(n+1)),Dt.hasOwnProperty(e)?{space:Dt[e],local:t}:t}function zt(t){return function(){var e=this.ownerDocument,n=this.namespaceURI;return n===Vt&&e.documentElement.namespaceURI===Vt?e.createElement(t):e.createElementNS(n,t)}}function Ft(t){return function(){return this.ownerDocument.createElementNS(t.space,t.local)}}function Gt(t){var e=Bt(t);return(e.local?Ft:zt)(e)}function jt(){}function Ut(t){return null==t?jt:function(){return this.querySelector(t)}}function Yt(t){return null==t?[]:Array.isArray(t)?t:Array.from(t)}function Ht(){return[]}function qt(t){return null==t?Ht:function(){return this.querySelectorAll(t)}}function Wt(t){return function(){return this.matches(t)}}function $t(t){return function(e){return e.matches(t)}}var Xt=Array.prototype.find;function Kt(){return this.firstElementChild}var Zt=Array.prototype.filter;function Jt(){return Array.from(this.children)}function Qt(t){return new Array(t.length)}function te(t,e){this.ownerDocument=t.ownerDocument,this.namespaceURI=t.namespaceURI,this._next=null,this._parent=t,this.__data__=e}function ee(t,e,n,r,i,o){for(var a,s=0,l=e.length,c=o.length;s<c;++s)(a=e[s])?(a.__data__=o[s],r[s]=a):n[s]=new te(t,o[s]);for(;s<l;++s)(a=e[s])&&(i[s]=a)}function ne(t,e,n,r,i,o,a){var s,l,c,u=new Map,h=e.length,f=o.length,d=new Array(h);for(s=0;s<h;++s)(l=e[s])&&(d[s]=c=a.call(l,l.__data__,s,e)+"",u.has(c)?i[s]=l:u.set(c,l));for(s=0;s<f;++s)c=a.call(t,o[s],s,o)+"",(l=u.get(c))?(r[s]=l,l.__data__=o[s],u.delete(c)):n[s]=new te(t,o[s]);for(s=0;s<h;++s)(l=e[s])&&u.get(d[s])===l&&(i[s]=l)}function re(t){return t.__data__}function ie(t){return"object"==typeof t&&"length"in t?t:Array.from(t)}function oe(t,e){return t<e?-1:t>e?1:t>=e?0:NaN}function ae(t){return function(){this.removeAttribute(t)}}function se(t){return function(){this.removeAttributeNS(t.space,t.local)}}function le(t,e){return function(){this.setAttribute(t,e)}}function ce(t,e){return function(){this.setAttributeNS(t.space,t.local,e)}}function ue(t,e){return function(){var n=e.apply(this,arguments);null==n?this.removeAttribute(t):this.setAttribute(t,n)}}function he(t,e){return function(){var n=e.apply(this,arguments);null==n?this.removeAttributeNS(t.space,t.local):this.setAttributeNS(t.space,t.local,n)}}function fe(t){return t.ownerDocument&&t.ownerDocument.defaultView||t.document&&t||t.defaultView}function de(t){return function(){this.style.removeProperty(t)}}function pe(t,e,n){return function(){this.style.setProperty(t,e,n)}}function ge(t,e,n){return function(){var r=e.apply(this,arguments);null==r?this.style.removeProperty(t):this.style.setProperty(t,r,n)}}function _e(t,e){return t.style.getPropertyValue(e)||fe(t).getComputedStyle(t,null).getPropertyValue(e)}function ye(t){return function(){delete this[t]}}function me(t,e){return function(){this[t]=e}}function be(t,e){return function(){var n=e.apply(this,arguments);null==n?delete this[t]:this[t]=n}}function ve(t){return t.trim().split(/^|\s+/)}function xe(t){return t.classList||new we(t)}function we(t){this._node=t,this._names=ve(t.getAttribute("class")||"")}function Ee(t,e){for(var n=xe(t),r=-1,i=e.length;++r<i;)n.add(e[r])}function Ae(t,e){for(var n=xe(t),r=-1,i=e.length;++r<i;)n.remove(e[r])}function Te(t){return function(){Ee(this,t)}}function Ce(t){return function(){Ae(this,t)}}function Se(t,e){return function(){(e.apply(this,arguments)?Ee:Ae)(this,t)}}function ke(){this.textContent=""}function Me(t){return function(){this.textContent=t}}function Re(t){return function(){var e=t.apply(this,arguments);this.textContent=null==e?"":e}}function Oe(){this.innerHTML=""}function Ne(t){return function(){this.innerHTML=t}}function Ie(t){return function(){var e=t.apply(this,arguments);this.innerHTML=null==e?"":e}}function Le(){this.nextSibling&&this.parentNode.appendChild(this)}function Pe(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function Ve(){return null}function De(){var t=this.parentNode;t&&t.removeChild(this)}function Be(){var t=this.cloneNode(!1),e=this.parentNode;return e?e.insertBefore(t,this.nextSibling):t}function ze(){var t=this.cloneNode(!0),e=this.parentNode;return e?e.insertBefore(t,this.nextSibling):t}function Fe(t){return function(){var e=this.__on;if(e){for(var n,r=0,i=-1,o=e.length;r<o;++r)n=e[r],t.type&&n.type!==t.type||n.name!==t.name?e[++i]=n:this.removeEventListener(n.type,n.listener,n.options);++i?e.length=i:delete this.__on}}}function Ge(t,e,n){return function(){var r,i=this.__on,o=function(t){return function(e){t.call(this,e,this.__data__)}}(e);if(i)for(var a=0,s=i.length;a<s;++a)if((r=i[a]).type===t.type&&r.name===t.name)return this.removeEventListener(r.type,r.listener,r.options),this.addEventListener(r.type,r.listener=o,r.options=n),void(r.value=e);this.addEventListener(t.type,o,n),r={type:t.type,name:t.name,value:e,listener:o,options:n},i?i.push(r):this.__on=[r]}}function je(t,e,n){var r=fe(t),i=r.CustomEvent;"function"==typeof i?i=new i(e,n):(i=r.document.createEvent("Event"),n?(i.initEvent(e,n.bubbles,n.cancelable),i.detail=n.detail):i.initEvent(e,!1,!1)),t.dispatchEvent(i)}function Ue(t,e){return function(){return je(this,t,e)}}function Ye(t,e){return function(){return je(this,t,e.apply(this,arguments))}}te.prototype={constructor:te,appendChild:function(t){return this._parent.insertBefore(t,this._next)},insertBefore:function(t,e){return this._parent.insertBefore(t,e)},querySelector:function(t){return this._parent.querySelector(t)},querySelectorAll:function(t){return this._parent.querySelectorAll(t)}},we.prototype={add:function(t){this._names.indexOf(t)<0&&(this._names.push(t),this._node.setAttribute("class",this._names.join(" ")))},remove:function(t){var e=this._names.indexOf(t);e>=0&&(this._names.splice(e,1),this._node.setAttribute("class",this._names.join(" ")))},contains:function(t){return this._names.indexOf(t)>=0}};var He=[null];function qe(t,e){this._groups=t,this._parents=e}function We(){return new qe([[document.documentElement]],He)}function $e(t){return"string"==typeof t?new qe([[document.querySelector(t)]],[document.documentElement]):new qe([[t]],He)}qe.prototype=We.prototype={constructor:qe,select:function(t){"function"!=typeof t&&(t=Ut(t));for(var e=this._groups,n=e.length,r=new Array(n),i=0;i<n;++i)for(var o,a,s=e[i],l=s.length,c=r[i]=new Array(l),u=0;u<l;++u)(o=s[u])&&(a=t.call(o,o.__data__,u,s))&&("__data__"in o&&(a.__data__=o.__data__),c[u]=a);return new qe(r,this._parents)},selectAll:function(t){t="function"==typeof t?function(t){return function(){return Yt(t.apply(this,arguments))}}(t):qt(t);for(var e=this._groups,n=e.length,r=[],i=[],o=0;o<n;++o)for(var a,s=e[o],l=s.length,c=0;c<l;++c)(a=s[c])&&(r.push(t.call(a,a.__data__,c,s)),i.push(a));return new qe(r,i)},selectChild:function(t){return this.select(null==t?Kt:function(t){return function(){return Xt.call(this.children,t)}}("function"==typeof t?t:$t(t)))},selectChildren:function(t){return this.selectAll(null==t?Jt:function(t){return function(){return Zt.call(this.children,t)}}("function"==typeof t?t:$t(t)))},filter:function(t){"function"!=typeof t&&(t=Wt(t));for(var e=this._groups,n=e.length,r=new Array(n),i=0;i<n;++i)for(var o,a=e[i],s=a.length,l=r[i]=[],c=0;c<s;++c)(o=a[c])&&t.call(o,o.__data__,c,a)&&l.push(o);return new qe(r,this._parents)},data:function(t,e){if(!arguments.length)return Array.from(this,re);var n=e?ne:ee,r=this._parents,i=this._groups;"function"!=typeof t&&(t=function(t){return function(){return t}}(t));for(var o=i.length,a=new Array(o),s=new Array(o),l=new Array(o),c=0;c<o;++c){var u=r[c],h=i[c],f=h.length,d=ie(t.call(u,u&&u.__data__,c,r)),p=d.length,g=s[c]=new Array(p),_=a[c]=new Array(p);n(u,h,g,_,l[c]=new Array(f),d,e);for(var y,m,b=0,v=0;b<p;++b)if(y=g[b]){for(b>=v&&(v=b+1);!(m=_[v])&&++v<p;);y._next=m||null}}return(a=new qe(a,r))._enter=s,a._exit=l,a},enter:function(){return new qe(this._enter||this._groups.map(Qt),this._parents)},exit:function(){return new qe(this._exit||this._groups.map(Qt),this._parents)},join:function(t,e,n){var r=this.enter(),i=this,o=this.exit();return"function"==typeof t?(r=t(r))&&(r=r.selection()):r=r.append(t+""),null!=e&&(i=e(i))&&(i=i.selection()),null==n?o.remove():n(o),r&&i?r.merge(i).order():i},merge:function(t){for(var e=t.selection?t.selection():t,n=this._groups,r=e._groups,i=n.length,o=r.length,a=Math.min(i,o),s=new Array(i),l=0;l<a;++l)for(var c,u=n[l],h=r[l],f=u.length,d=s[l]=new Array(f),p=0;p<f;++p)(c=u[p]||h[p])&&(d[p]=c);for(;l<i;++l)s[l]=n[l];return new qe(s,this._parents)},selection:function(){return this},order:function(){for(var t=this._groups,e=-1,n=t.length;++e<n;)for(var r,i=t[e],o=i.length-1,a=i[o];--o>=0;)(r=i[o])&&(a&&4^r.compareDocumentPosition(a)&&a.parentNode.insertBefore(r,a),a=r);return this},sort:function(t){function e(e,n){return e&&n?t(e.__data__,n.__data__):!e-!n}t||(t=oe);for(var n=this._groups,r=n.length,i=new Array(r),o=0;o<r;++o){for(var a,s=n[o],l=s.length,c=i[o]=new Array(l),u=0;u<l;++u)(a=s[u])&&(c[u]=a);c.sort(e)}return new qe(i,this._parents).order()},call:function(){var t=arguments[0];return arguments[0]=this,t.apply(null,arguments),this},nodes:function(){return Array.from(this)},node:function(){for(var t=this._groups,e=0,n=t.length;e<n;++e)for(var r=t[e],i=0,o=r.length;i<o;++i){var a=r[i];if(a)return a}return null},size:function(){let t=0;for(const e of this)++t;return t},empty:function(){return!this.node()},each:function(t){for(var e=this._groups,n=0,r=e.length;n<r;++n)for(var i,o=e[n],a=0,s=o.length;a<s;++a)(i=o[a])&&t.call(i,i.__data__,a,o);return this},attr:function(t,e){var n=Bt(t);if(arguments.length<2){var r=this.node();return n.local?r.getAttributeNS(n.space,n.local):r.getAttribute(n)}return this.each((null==e?n.local?se:ae:"function"==typeof e?n.local?he:ue:n.local?ce:le)(n,e))},style:function(t,e,n){return arguments.length>1?this.each((null==e?de:"function"==typeof e?ge:pe)(t,e,null==n?"":n)):_e(this.node(),t)},property:function(t,e){return arguments.length>1?this.each((null==e?ye:"function"==typeof e?be:me)(t,e)):this.node()[t]},classed:function(t,e){var n=ve(t+"");if(arguments.length<2){for(var r=xe(this.node()),i=-1,o=n.length;++i<o;)if(!r.contains(n[i]))return!1;return!0}return this.each(("function"==typeof e?Se:e?Te:Ce)(n,e))},text:function(t){return arguments.length?this.each(null==t?ke:("function"==typeof t?Re:Me)(t)):this.node().textContent},html:function(t){return arguments.length?this.each(null==t?Oe:("function"==typeof t?Ie:Ne)(t)):this.node().innerHTML},raise:function(){return this.each(Le)},lower:function(){return this.each(Pe)},append:function(t){var e="function"==typeof t?t:Gt(t);return this.select(function(){return this.appendChild(e.apply(this,arguments))})},insert:function(t,e){var n="function"==typeof t?t:Gt(t),r=null==e?Ve:"function"==typeof e?e:Ut(e);return this.select(function(){return this.insertBefore(n.apply(this,arguments),r.apply(this,arguments)||null)})},remove:function(){return this.each(De)},clone:function(t){return this.select(t?ze:Be)},datum:function(t){return arguments.length?this.property("__data__",t):this.node().__data__},on:function(t,e,n){var r,i,o=function(t){return t.trim().split(/^|\s+/).map(function(t){var e="",n=t.indexOf(".");return n>=0&&(e=t.slice(n+1),t=t.slice(0,n)),{type:t,name:e}})}(t+""),a=o.length;if(!(arguments.length<2)){for(s=e?Ge:Fe,r=0;r<a;++r)this.each(s(o[r],e,n));return this}var s=this.node().__on;if(s)for(var l,c=0,u=s.length;c<u;++c)for(r=0,l=s[c];r<a;++r)if((i=o[r]).type===l.type&&i.name===l.name)return l.value},dispatch:function(t,e){return this.each(("function"==typeof e?Ye:Ue)(t,e))},[Symbol.iterator]:function*(){for(var t=this._groups,e=0,n=t.length;e<n;++e)for(var r,i=t[e],o=0,a=i.length;o<a;++o)(r=i[o])&&(yield r)}};var Xe=0;function Ke(){return new Ze}function Ze(){this._="@"+(++Xe).toString(36)}function Je(t){let e;for(;e=t.sourceEvent;)t=e;return t}function Qe(t,e){if(t=Je(t),void 0===e&&(e=t.currentTarget),e){var n=e.ownerSVGElement||e;if(n.createSVGPoint){var r=n.createSVGPoint();return r.x=t.clientX,r.y=t.clientY,[(r=r.matrixTransform(e.getScreenCTM().inverse())).x,r.y]}if(e.getBoundingClientRect){var i=e.getBoundingClientRect();return[t.clientX-i.left-e.clientLeft,t.clientY-i.top-e.clientTop]}}return[t.pageX,t.pageY]}Ze.prototype=Ke.prototype={constructor:Ze,get:function(t){for(var e=this._;!(e in t);)if(!(t=t.parentNode))return;return t[e]},set:function(t,e){return t[this._]=e},remove:function(t){return this._ in t&&delete t[this._]},toString:function(){return this._}};const tn={passive:!1},en={capture:!0,passive:!1};function nn(t){t.stopImmediatePropagation()}function rn(t){t.preventDefault(),t.stopImmediatePropagation()}function on(t){var e=t.document.documentElement,n=$e(t).on("dragstart.drag",rn,en);"onselectstart"in e?n.on("selectstart.drag",rn,en):(e.__noselect=e.style.MozUserSelect,e.style.MozUserSelect="none")}function an(t,e){var n=t.document.documentElement,r=$e(t).on("dragstart.drag",null);e&&(r.on("click.drag",rn,en),setTimeout(function(){r.on("click.drag",null)},0)),"onselectstart"in n?r.on("selectstart.drag",null):(n.style.MozUserSelect=n.__noselect,delete n.__noselect)}var sn=t=>()=>t;function ln(t,{sourceEvent:e,subject:n,target:r,identifier:i,active:o,x:a,y:s,dx:l,dy:c,dispatch:u}){Object.defineProperties(this,{type:{value:t,enumerable:!0,configurable:!0},sourceEvent:{value:e,enumerable:!0,configurable:!0},subject:{value:n,enumerable:!0,configurable:!0},target:{value:r,enumerable:!0,configurable:!0},identifier:{value:i,enumerable:!0,configurable:!0},active:{value:o,enumerable:!0,configurable:!0},x:{value:a,enumerable:!0,configurable:!0},y:{value:s,enumerable:!0,configurable:!0},dx:{value:l,enumerable:!0,configurable:!0},dy:{value:c,enumerable:!0,configurable:!0},_:{value:u}})}function cn(t){return!t.ctrlKey&&!t.button}function un(){return this.parentNode}function hn(t,e){return null==e?{x:t.x,y:t.y}:e}function fn(){return navigator.maxTouchPoints||"ontouchstart"in this}function dn(t,e,n){t.prototype=e.prototype=n,n.constructor=t}function pn(t,e){var n=Object.create(t.prototype);for(var r in e)n[r]=e[r];return n}function gn(){}ln.prototype.on=function(){var t=this._.on.apply(this._,arguments);return t===this._?this:t};var _n=.7,yn=1/_n,mn="\\s*([+-]?\\d+)\\s*",bn="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",vn="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",xn=/^#([0-9a-f]{3,8})$/,wn=new RegExp(`^rgb\\(${mn},${mn},${mn}\\)$`),En=new RegExp(`^rgb\\(${vn},${vn},${vn}\\)$`),An=new RegExp(`^rgba\\(${mn},${mn},${mn},${bn}\\)$`),Tn=new RegExp(`^rgba\\(${vn},${vn},${vn},${bn}\\)$`),Cn=new RegExp(`^hsl\\(${bn},${vn},${vn}\\)$`),Sn=new RegExp(`^hsla\\(${bn},${vn},${vn},${bn}\\)$`),kn={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 Mn(){return this.rgb().formatHex()}function Rn(){return this.rgb().formatRgb()}function On(t){var e,n;return t=(t+"").trim().toLowerCase(),(e=xn.exec(t))?(n=e[1].length,e=parseInt(e[1],16),6===n?Nn(e):3===n?new Vn(e>>8&15|e>>4&240,e>>4&15|240&e,(15&e)<<4|15&e,1):8===n?In(e>>24&255,e>>16&255,e>>8&255,(255&e)/255):4===n?In(e>>12&15|e>>8&240,e>>8&15|e>>4&240,e>>4&15|240&e,((15&e)<<4|15&e)/255):null):(e=wn.exec(t))?new Vn(e[1],e[2],e[3],1):(e=En.exec(t))?new Vn(255*e[1]/100,255*e[2]/100,255*e[3]/100,1):(e=An.exec(t))?In(e[1],e[2],e[3],e[4]):(e=Tn.exec(t))?In(255*e[1]/100,255*e[2]/100,255*e[3]/100,e[4]):(e=Cn.exec(t))?jn(e[1],e[2]/100,e[3]/100,1):(e=Sn.exec(t))?jn(e[1],e[2]/100,e[3]/100,e[4]):kn.hasOwnProperty(t)?Nn(kn[t]):"transparent"===t?new Vn(NaN,NaN,NaN,0):null}function Nn(t){return new Vn(t>>16&255,t>>8&255,255&t,1)}function In(t,e,n,r){return r<=0&&(t=e=n=NaN),new Vn(t,e,n,r)}function Ln(t){return t instanceof gn||(t=On(t)),t?new Vn((t=t.rgb()).r,t.g,t.b,t.opacity):new Vn}function Pn(t,e,n,r){return 1===arguments.length?Ln(t):new Vn(t,e,n,null==r?1:r)}function Vn(t,e,n,r){this.r=+t,this.g=+e,this.b=+n,this.opacity=+r}function Dn(){return`#${Gn(this.r)}${Gn(this.g)}${Gn(this.b)}`}function Bn(){const t=zn(this.opacity);return`${1===t?"rgb(":"rgba("}${Fn(this.r)}, ${Fn(this.g)}, ${Fn(this.b)}${1===t?")":`, ${t})`}`}function zn(t){return isNaN(t)?1:Math.max(0,Math.min(1,t))}function Fn(t){return Math.max(0,Math.min(255,Math.round(t)||0))}function Gn(t){return((t=Fn(t))<16?"0":"")+t.toString(16)}function jn(t,e,n,r){return r<=0?t=e=n=NaN:n<=0||n>=1?t=e=NaN:e<=0&&(t=NaN),new Hn(t,e,n,r)}function Un(t){if(t instanceof Hn)return new Hn(t.h,t.s,t.l,t.opacity);if(t instanceof gn||(t=On(t)),!t)return new Hn;if(t instanceof Hn)return t;var e=(t=t.rgb()).r/255,n=t.g/255,r=t.b/255,i=Math.min(e,n,r),o=Math.max(e,n,r),a=NaN,s=o-i,l=(o+i)/2;return s?(a=e===o?(n-r)/s+6*(n<r):n===o?(r-e)/s+2:(e-n)/s+4,s/=l<.5?o+i:2-o-i,a*=60):s=l>0&&l<1?0:a,new Hn(a,s,l,t.opacity)}function Yn(t,e,n,r){return 1===arguments.length?Un(t):new Hn(t,e,n,null==r?1:r)}function Hn(t,e,n,r){this.h=+t,this.s=+e,this.l=+n,this.opacity=+r}function qn(t){return(t=(t||0)%360)<0?t+360:t}function Wn(t){return Math.max(0,Math.min(1,t||0))}function $n(t,e,n){return 255*(t<60?e+(n-e)*t/60:t<180?n:t<240?e+(n-e)*(240-t)/60:e)}dn(gn,On,{copy(t){return Object.assign(new this.constructor,this,t)},displayable(){return this.rgb().displayable()},hex:Mn,formatHex:Mn,formatHex8:function(){return this.rgb().formatHex8()},formatHsl:function(){return Un(this).formatHsl()},formatRgb:Rn,toString:Rn}),dn(Vn,Pn,pn(gn,{brighter(t){return t=null==t?yn:Math.pow(yn,t),new Vn(this.r*t,this.g*t,this.b*t,this.opacity)},darker(t){return t=null==t?_n:Math.pow(_n,t),new Vn(this.r*t,this.g*t,this.b*t,this.opacity)},rgb(){return this},clamp(){return new Vn(Fn(this.r),Fn(this.g),Fn(this.b),zn(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:Dn,formatHex:Dn,formatHex8:function(){return`#${Gn(this.r)}${Gn(this.g)}${Gn(this.b)}${Gn(255*(isNaN(this.opacity)?1:this.opacity))}`},formatRgb:Bn,toString:Bn})),dn(Hn,Yn,pn(gn,{brighter(t){return t=null==t?yn:Math.pow(yn,t),new Hn(this.h,this.s,this.l*t,this.opacity)},darker(t){return t=null==t?_n:Math.pow(_n,t),new Hn(this.h,this.s,this.l*t,this.opacity)},rgb(){var t=this.h%360+360*(this.h<0),e=isNaN(t)||isNaN(this.s)?0:this.s,n=this.l,r=n+(n<.5?n:1-n)*e,i=2*n-r;return new Vn($n(t>=240?t-240:t+120,i,r),$n(t,i,r),$n(t<120?t+240:t-120,i,r),this.opacity)},clamp(){return new Hn(qn(this.h),Wn(this.s),Wn(this.l),zn(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=zn(this.opacity);return`${1===t?"hsl(":"hsla("}${qn(this.h)}, ${100*Wn(this.s)}%, ${100*Wn(this.l)}%${1===t?")":`, ${t})`}`}}));const Xn=Math.PI/180,Kn=180/Math.PI,Zn=.96422,Jn=.82521,Qn=4/29,tr=6/29,er=3*tr*tr,nr=tr*tr*tr;function rr(t){if(t instanceof or)return new or(t.l,t.a,t.b,t.opacity);if(t instanceof fr)return dr(t);t instanceof Vn||(t=Ln(t));var e,n,r=cr(t.r),i=cr(t.g),o=cr(t.b),a=ar((.2225045*r+.7168786*i+.0606169*o)/1);return r===i&&i===o?e=n=a:(e=ar((.4360747*r+.3850649*i+.1430804*o)/Zn),n=ar((.0139322*r+.0971045*i+.7141733*o)/Jn)),new or(116*a-16,500*(e-a),200*(a-n),t.opacity)}function ir(t,e,n,r){return 1===arguments.length?rr(t):new or(t,e,n,null==r?1:r)}function or(t,e,n,r){this.l=+t,this.a=+e,this.b=+n,this.opacity=+r}function ar(t){return t>nr?Math.pow(t,1/3):t/er+Qn}function sr(t){return t>tr?t*t*t:er*(t-Qn)}function lr(t){return 255*(t<=.0031308?12.92*t:1.055*Math.pow(t,1/2.4)-.055)}function cr(t){return(t/=255)<=.04045?t/12.92:Math.pow((t+.055)/1.055,2.4)}function ur(t){if(t instanceof fr)return new fr(t.h,t.c,t.l,t.opacity);if(t instanceof or||(t=rr(t)),0===t.a&&0===t.b)return new fr(NaN,0<t.l&&t.l<100?0:NaN,t.l,t.opacity);var e=Math.atan2(t.b,t.a)*Kn;return new fr(e<0?e+360:e,Math.sqrt(t.a*t.a+t.b*t.b),t.l,t.opacity)}function hr(t,e,n,r){return 1===arguments.length?ur(t):new fr(t,e,n,null==r?1:r)}function fr(t,e,n,r){this.h=+t,this.c=+e,this.l=+n,this.opacity=+r}function dr(t){if(isNaN(t.h))return new or(t.l,0,0,t.opacity);var e=t.h*Xn;return new or(t.l,Math.cos(e)*t.c,Math.sin(e)*t.c,t.opacity)}dn(or,ir,pn(gn,{brighter(t){return new or(this.l+18*(null==t?1:t),this.a,this.b,this.opacity)},darker(t){return new or(this.l-18*(null==t?1:t),this.a,this.b,this.opacity)},rgb(){var t=(this.l+16)/116,e=isNaN(this.a)?t:t+this.a/500,n=isNaN(this.b)?t:t-this.b/200;return new Vn(lr(3.1338561*(e=Zn*sr(e))-1.6168667*(t=1*sr(t))-.4906146*(n=Jn*sr(n))),lr(-.9787684*e+1.9161415*t+.033454*n),lr(.0719453*e-.2289914*t+1.4052427*n),this.opacity)}})),dn(fr,hr,pn(gn,{brighter(t){return new fr(this.h,this.c,this.l+18*(null==t?1:t),this.opacity)},darker(t){return new fr(this.h,this.c,this.l-18*(null==t?1:t),this.opacity)},rgb(){return dr(this).rgb()}}));var pr=-.14861,gr=1.78277,_r=-.29227,yr=-.90649,mr=1.97294,br=mr*yr,vr=mr*gr,xr=gr*_r-yr*pr;function wr(t,e,n,r){return 1===arguments.length?function(t){if(t instanceof Er)return new Er(t.h,t.s,t.l,t.opacity);t instanceof Vn||(t=Ln(t));var e=t.r/255,n=t.g/255,r=t.b/255,i=(xr*r+br*e-vr*n)/(xr+br-vr),o=r-i,a=(mr*(n-i)-_r*o)/yr,s=Math.sqrt(a*a+o*o)/(mr*i*(1-i)),l=s?Math.atan2(a,o)*Kn-120:NaN;return new Er(l<0?l+360:l,s,i,t.opacity)}(t):new Er(t,e,n,null==r?1:r)}function Er(t,e,n,r){this.h=+t,this.s=+e,this.l=+n,this.opacity=+r}function Ar(t,e,n,r,i){var o=t*t,a=o*t;return((1-3*t+3*o-a)*e+(4-6*o+3*a)*n+(1+3*t+3*o-3*a)*r+a*i)/6}function Tr(t){var e=t.length-1;return function(n){var r=n<=0?n=0:n>=1?(n=1,e-1):Math.floor(n*e),i=t[r],o=t[r+1],a=r>0?t[r-1]:2*i-o,s=r<e-1?t[r+2]:2*o-i;return Ar((n-r/e)*e,a,i,o,s)}}function Cr(t){var e=t.length;return function(n){var r=Math.floor(((n%=1)<0?++n:n)*e),i=t[(r+e-1)%e],o=t[r%e],a=t[(r+1)%e],s=t[(r+2)%e];return Ar((n-r/e)*e,i,o,a,s)}}dn(Er,wr,pn(gn,{brighter(t){return t=null==t?yn:Math.pow(yn,t),new Er(this.h,this.s,this.l*t,this.opacity)},darker(t){return t=null==t?_n:Math.pow(_n,t),new Er(this.h,this.s,this.l*t,this.opacity)},rgb(){var t=isNaN(this.h)?0:(this.h+120)*Xn,e=+this.l,n=isNaN(this.s)?0:this.s*e*(1-e),r=Math.cos(t),i=Math.sin(t);return new Vn(255*(e+n*(pr*r+gr*i)),255*(e+n*(_r*r+yr*i)),255*(e+n*(mr*r)),this.opacity)}}));var Sr=t=>()=>t;function kr(t,e){return function(n){return t+n*e}}function Mr(t,e){var n=e-t;return n?kr(t,n>180||n<-180?n-360*Math.round(n/360):n):Sr(isNaN(t)?e:t)}function Rr(t){return 1===(t=+t)?Or:function(e,n){return n-e?function(t,e,n){return t=Math.pow(t,n),e=Math.pow(e,n)-t,n=1/n,function(r){return Math.pow(t+r*e,n)}}(e,n,t):Sr(isNaN(e)?n:e)}}function Or(t,e){var n=e-t;return n?kr(t,n):Sr(isNaN(t)?e:t)}var Nr=function t(e){var n=Rr(e);function r(t,e){var r=n((t=Pn(t)).r,(e=Pn(e)).r),i=n(t.g,e.g),o=n(t.b,e.b),a=Or(t.opacity,e.opacity);return function(e){return t.r=r(e),t.g=i(e),t.b=o(e),t.opacity=a(e),t+""}}return r.gamma=t,r}(1);function Ir(t){return function(e){var n,r,i=e.length,o=new Array(i),a=new Array(i),s=new Array(i);for(n=0;n<i;++n)r=Pn(e[n]),o[n]=r.r||0,a[n]=r.g||0,s[n]=r.b||0;return o=t(o),a=t(a),s=t(s),r.opacity=1,function(t){return r.r=o(t),r.g=a(t),r.b=s(t),r+""}}}var Lr=Ir(Tr),Pr=Ir(Cr);function Vr(t,e){e||(e=[]);var n,r=t?Math.min(e.length,t.length):0,i=e.slice();return function(o){for(n=0;n<r;++n)i[n]=t[n]*(1-o)+e[n]*o;return i}}function Dr(t){return ArrayBuffer.isView(t)&&!(t instanceof DataView)}function Br(t,e){var n,r=e?e.length:0,i=t?Math.min(r,t.length):0,o=new Array(i),a=new Array(r);for(n=0;n<i;++n)o[n]=Hr(t[n],e[n]);for(;n<r;++n)a[n]=e[n];return function(t){for(n=0;n<i;++n)a[n]=o[n](t);return a}}function zr(t,e){var n=new Date;return t=+t,e=+e,function(r){return n.setTime(t*(1-r)+e*r),n}}function Fr(t,e){return t=+t,e=+e,function(n){return t*(1-n)+e*n}}function Gr(t,e){var n,r={},i={};for(n in null!==t&&"object"==typeof t||(t={}),null!==e&&"object"==typeof e||(e={}),e)n in t?r[n]=Hr(t[n],e[n]):i[n]=e[n];return function(t){for(n in r)i[n]=r[n](t);return i}}var jr=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,Ur=new RegExp(jr.source,"g");function Yr(t,e){var n,r,i,o=jr.lastIndex=Ur.lastIndex=0,a=-1,s=[],l=[];for(t+="",e+="";(n=jr.exec(t))&&(r=Ur.exec(e));)(i=r.index)>o&&(i=e.slice(o,i),s[a]?s[a]+=i:s[++a]=i),(n=n[0])===(r=r[0])?s[a]?s[a]+=r:s[++a]=r:(s[++a]=null,l.push({i:a,x:Fr(n,r)})),o=Ur.lastIndex;return o<e.length&&(i=e.slice(o),s[a]?s[a]+=i:s[++a]=i),s.length<2?l[0]?function(t){return function(e){return t(e)+""}}(l[0].x):function(t){return function(){return t}}(e):(e=l.length,function(t){for(var n,r=0;r<e;++r)s[(n=l[r]).i]=n.x(t);return s.join("")})}function Hr(t,e){var n,r=typeof e;return null==e||"boolean"===r?Sr(e):("number"===r?Fr:"string"===r?(n=On(e))?(e=n,Nr):Yr:e instanceof On?Nr:e instanceof Date?zr:Dr(e)?Vr:Array.isArray(e)?Br:"function"!=typeof e.valueOf&&"function"!=typeof e.toString||isNaN(e)?Gr:Fr)(t,e)}function qr(t,e){return t=+t,e=+e,function(n){return Math.round(t*(1-n)+e*n)}}var Wr,$r=180/Math.PI,Xr={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1};function Kr(t,e,n,r,i,o){var a,s,l;return(a=Math.sqrt(t*t+e*e))&&(t/=a,e/=a),(l=t*n+e*r)&&(n-=t*l,r-=e*l),(s=Math.sqrt(n*n+r*r))&&(n/=s,r/=s,l/=s),t*r<e*n&&(t=-t,e=-e,l=-l,a=-a),{translateX:i,translateY:o,rotate:Math.atan2(e,t)*$r,skewX:Math.atan(l)*$r,scaleX:a,scaleY:s}}function Zr(t,e,n,r){function i(t){return t.length?t.pop()+" ":""}return function(o,a){var s=[],l=[];return o=t(o),a=t(a),function(t,r,i,o,a,s){if(t!==i||r!==o){var l=a.push("translate(",null,e,null,n);s.push({i:l-4,x:Fr(t,i)},{i:l-2,x:Fr(r,o)})}else(i||o)&&a.push("translate("+i+e+o+n)}(o.translateX,o.translateY,a.translateX,a.translateY,s,l),function(t,e,n,o){t!==e?(t-e>180?e+=360:e-t>180&&(t+=360),o.push({i:n.push(i(n)+"rotate(",null,r)-2,x:Fr(t,e)})):e&&n.push(i(n)+"rotate("+e+r)}(o.rotate,a.rotate,s,l),function(t,e,n,o){t!==e?o.push({i:n.push(i(n)+"skewX(",null,r)-2,x:Fr(t,e)}):e&&n.push(i(n)+"skewX("+e+r)}(o.skewX,a.skewX,s,l),function(t,e,n,r,o,a){if(t!==n||e!==r){var s=o.push(i(o)+"scale(",null,",",null,")");a.push({i:s-4,x:Fr(t,n)},{i:s-2,x:Fr(e,r)})}else 1===n&&1===r||o.push(i(o)+"scale("+n+","+r+")")}(o.scaleX,o.scaleY,a.scaleX,a.scaleY,s,l),o=a=null,function(t){for(var e,n=-1,r=l.length;++n<r;)s[(e=l[n]).i]=e.x(t);return s.join("")}}}var Jr=Zr(function(t){const e=new("function"==typeof DOMMatrix?DOMMatrix:WebKitCSSMatrix)(t+"");return e.isIdentity?Xr:Kr(e.a,e.b,e.c,e.d,e.e,e.f)},"px, ","px)","deg)"),Qr=Zr(function(t){return null==t?Xr:(Wr||(Wr=document.createElementNS("http://www.w3.org/2000/svg","g")),Wr.setAttribute("transform",t),(t=Wr.transform.baseVal.consolidate())?Kr((t=t.matrix).a,t.b,t.c,t.d,t.e,t.f):Xr)},", ",")",")");function ti(t){return((t=Math.exp(t))+1/t)/2}var ei=function t(e,n,r){function i(t,i){var o,a,s=t[0],l=t[1],c=t[2],u=i[0],h=i[1],f=i[2],d=u-s,p=h-l,g=d*d+p*p;if(g<1e-12)a=Math.log(f/c)/e,o=function(t){return[s+t*d,l+t*p,c*Math.exp(e*t*a)]};else{var _=Math.sqrt(g),y=(f*f-c*c+r*g)/(2*c*n*_),m=(f*f-c*c-r*g)/(2*f*n*_),b=Math.log(Math.sqrt(y*y+1)-y),v=Math.log(Math.sqrt(m*m+1)-m);a=(v-b)/e,o=function(t){var r=t*a,i=ti(b),o=c/(n*_)*(i*function(t){return((t=Math.exp(2*t))-1)/(t+1)}(e*r+b)-function(t){return((t=Math.exp(t))-1/t)/2}(b));return[s+o*d,l+o*p,c*i/ti(e*r+b)]}}return o.duration=1e3*a*e/Math.SQRT2,o}return i.rho=function(e){var n=Math.max(.001,+e),r=n*n;return t(n,r,r*r)},i}(Math.SQRT2,2,4);function ni(t){return function(e,n){var r=t((e=Yn(e)).h,(n=Yn(n)).h),i=Or(e.s,n.s),o=Or(e.l,n.l),a=Or(e.opacity,n.opacity);return function(t){return e.h=r(t),e.s=i(t),e.l=o(t),e.opacity=a(t),e+""}}}var ri=ni(Mr),ii=ni(Or);function oi(t){return function(e,n){var r=t((e=hr(e)).h,(n=hr(n)).h),i=Or(e.c,n.c),o=Or(e.l,n.l),a=Or(e.opacity,n.opacity);return function(t){return e.h=r(t),e.c=i(t),e.l=o(t),e.opacity=a(t),e+""}}}var ai=oi(Mr),si=oi(Or);function li(t){return function e(n){function r(e,r){var i=t((e=wr(e)).h,(r=wr(r)).h),o=Or(e.s,r.s),a=Or(e.l,r.l),s=Or(e.opacity,r.opacity);return function(t){return e.h=i(t),e.s=o(t),e.l=a(Math.pow(t,n)),e.opacity=s(t),e+""}}return n=+n,r.gamma=e,r}(1)}var ci=li(Mr),ui=li(Or);function hi(t,e){void 0===e&&(e=t,t=Hr);for(var n=0,r=e.length-1,i=e[0],o=new Array(r<0?0:r);n<r;)o[n]=t(i,i=e[++n]);return function(t){var e=Math.max(0,Math.min(r-1,Math.floor(t*=r)));return o[e](t-e)}}var fi,di,pi=0,gi=0,_i=0,yi=0,mi=0,bi=0,vi="object"==typeof performance&&performance.now?performance:Date,xi="object"==typeof window&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(t){setTimeout(t,17)};function wi(){return mi||(xi(Ei),mi=vi.now()+bi)}function Ei(){mi=0}function Ai(){this._call=this._time=this._next=null}function Ti(t,e,n){var r=new Ai;return r.restart(t,e,n),r}function Ci(){wi(),++pi;for(var t,e=fi;e;)(t=mi-e._time)>=0&&e._call.call(void 0,t),e=e._next;--pi}function Si(){mi=(yi=vi.now())+bi,pi=gi=0;try{Ci()}finally{pi=0,function(){var t,e,n=fi,r=1/0;for(;n;)n._call?(r>n._time&&(r=n._time),t=n,n=n._next):(e=n._next,n._next=null,n=t?t._next=e:fi=e);di=t,Mi(r)}(),mi=0}}function ki(){var t=vi.now(),e=t-yi;e>1e3&&(bi-=e,yi=t)}function Mi(t){pi||(gi&&(gi=clearTimeout(gi)),t-mi>24?(t<1/0&&(gi=setTimeout(Si,t-vi.now()-bi)),_i&&(_i=clearInterval(_i))):(_i||(yi=vi.now(),_i=setInterval(ki,1e3)),pi=1,xi(Si)))}function Ri(t,e,n){var r=new Ai;return e=null==e?0:+e,r.restart(n=>{r.stop(),t(n+e)},e,n),r}Ai.prototype=Ti.prototype={constructor:Ai,restart:function(t,e,n){if("function"!=typeof t)throw new TypeError("callback is not a function");n=(null==n?wi():+n)+(null==e?0:+e),this._next||di===this||(di?di._next=this:fi=this,di=this),this._call=t,this._time=n,Mi()},stop:function(){this._call&&(this._call=null,this._time=1/0,Mi())}};var Oi=Nt("start","end","cancel","interrupt"),Ni=[];function Ii(t,e,n,r,i,o){var a=t.__transition;if(a){if(n in a)return}else t.__transition={};!function(t,e,n){var r,i=t.__transition;function o(t){n.state=1,n.timer.restart(a,n.delay,n.time),n.delay<=t&&a(t-n.delay)}function a(o){var c,u,h,f;if(1!==n.state)return l();for(c in i)if((f=i[c]).name===n.name){if(3===f.state)return Ri(a);4===f.state?(f.state=6,f.timer.stop(),f.on.call("interrupt",t,t.__data__,f.index,f.group),delete i[c]):+c<e&&(f.state=6,f.timer.stop(),f.on.call("cancel",t,t.__data__,f.index,f.group),delete i[c])}if(Ri(function(){3===n.state&&(n.state=4,n.timer.restart(s,n.delay,n.time),s(o))}),n.state=2,n.on.call("start",t,t.__data__,n.index,n.group),2===n.state){for(n.state=3,r=new Array(h=n.tween.length),c=0,u=-1;c<h;++c)(f=n.tween[c].value.call(t,t.__data__,n.index,n.group))&&(r[++u]=f);r.length=u+1}}function s(e){for(var i=e<n.duration?n.ease.call(null,e/n.duration):(n.timer.restart(l),n.state=5,1),o=-1,a=r.length;++o<a;)r[o].call(t,i);5===n.state&&(n.on.call("end",t,t.__data__,n.index,n.group),l())}function l(){for(var r in n.state=6,n.timer.stop(),delete i[e],i)return;delete t.__transition}i[e]=n,n.timer=Ti(o,0,n.time)}(t,n,{name:e,index:r,group:i,on:Oi,tween:Ni,time:o.time,delay:o.delay,duration:o.duration,ease:o.ease,timer:null,state:0})}function Li(t,e){var n=Vi(t,e);if(n.state>0)throw new Error("too late; already scheduled");return n}function Pi(t,e){var n=Vi(t,e);if(n.state>3)throw new Error("too late; already running");return n}function Vi(t,e){var n=t.__transition;if(!n||!(n=n[e]))throw new Error("transition not found");return n}function Di(t,e){var n,r,i,o=t.__transition,a=!0;if(o){for(i in e=null==e?null:e+"",o)(n=o[i]).name===e?(r=n.state>2&&n.state<5,n.state=6,n.timer.stop(),n.on.call(r?"interrupt":"cancel",t,t.__data__,n.index,n.group),delete o[i]):a=!1;a&&delete t.__transition}}function Bi(t,e){var n,r;return function(){var i=Pi(this,t),o=i.tween;if(o!==n)for(var a=0,s=(r=n=o).length;a<s;++a)if(r[a].name===e){(r=r.slice()).splice(a,1);break}i.tween=r}}function zi(t,e,n){var r,i;if("function"!=typeof n)throw new Error;return function(){var o=Pi(this,t),a=o.tween;if(a!==r){i=(r=a).slice();for(var s={name:e,value:n},l=0,c=i.length;l<c;++l)if(i[l].name===e){i[l]=s;break}l===c&&i.push(s)}o.tween=i}}function Fi(t,e,n){var r=t._id;return t.each(function(){var t=Pi(this,r);(t.value||(t.value={}))[e]=n.apply(this,arguments)}),function(t){return Vi(t,r).value[e]}}function Gi(t,e){var n;return("number"==typeof e?Fr:e instanceof On?Nr:(n=On(e))?(e=n,Nr):Yr)(t,e)}function ji(t){return function(){this.removeAttribute(t)}}function Ui(t){return function(){this.removeAttributeNS(t.space,t.local)}}function Yi(t,e,n){var r,i,o=n+"";return function(){var a=this.getAttribute(t);return a===o?null:a===r?i:i=e(r=a,n)}}function Hi(t,e,n){var r,i,o=n+"";return function(){var a=this.getAttributeNS(t.space,t.local);return a===o?null:a===r?i:i=e(r=a,n)}}function qi(t,e,n){var r,i,o;return function(){var a,s,l=n(this);if(null!=l)return(a=this.getAttribute(t))===(s=l+"")?null:a===r&&s===i?o:(i=s,o=e(r=a,l));this.removeAttribute(t)}}function Wi(t,e,n){var r,i,o;return function(){var a,s,l=n(this);if(null!=l)return(a=this.getAttributeNS(t.space,t.local))===(s=l+"")?null:a===r&&s===i?o:(i=s,o=e(r=a,l));this.removeAttributeNS(t.space,t.local)}}function $i(t,e){var n,r;function i(){var i=e.apply(this,arguments);return i!==r&&(n=(r=i)&&function(t,e){return function(n){this.setAttributeNS(t.space,t.local,e.call(this,n))}}(t,i)),n}return i._value=e,i}function Xi(t,e){var n,r;function i(){var i=e.apply(this,arguments);return i!==r&&(n=(r=i)&&function(t,e){return function(n){this.setAttribute(t,e.call(this,n))}}(t,i)),n}return i._value=e,i}function Ki(t,e){return function(){Li(this,t).delay=+e.apply(this,arguments)}}function Zi(t,e){return e=+e,function(){Li(this,t).delay=e}}function Ji(t,e){return function(){Pi(this,t).duration=+e.apply(this,arguments)}}function Qi(t,e){return e=+e,function(){Pi(this,t).duration=e}}var to=We.prototype.constructor;function eo(t){return function(){this.style.removeProperty(t)}}var no=0;function ro(t,e,n,r){this._groups=t,this._parents=e,this._name=n,this._id=r}function io(t){return We().transition(t)}function oo(){return++no}var ao=We.prototype;ro.prototype=io.prototype={constructor:ro,select:function(t){var e=this._name,n=this._id;"function"!=typeof t&&(t=Ut(t));for(var r=this._groups,i=r.length,o=new Array(i),a=0;a<i;++a)for(var s,l,c=r[a],u=c.length,h=o[a]=new Array(u),f=0;f<u;++f)(s=c[f])&&(l=t.call(s,s.__data__,f,c))&&("__data__"in s&&(l.__data__=s.__data__),h[f]=l,Ii(h[f],e,n,f,h,Vi(s,n)));return new ro(o,this._parents,e,n)},selectAll:function(t){var e=this._name,n=this._id;"function"!=typeof t&&(t=qt(t));for(var r=this._groups,i=r.length,o=[],a=[],s=0;s<i;++s)for(var l,c=r[s],u=c.length,h=0;h<u;++h)if(l=c[h]){for(var f,d=t.call(l,l.__data__,h,c),p=Vi(l,n),g=0,_=d.length;g<_;++g)(f=d[g])&&Ii(f,e,n,g,d,p);o.push(d),a.push(l)}return new ro(o,a,e,n)},selectChild:ao.selectChild,selectChildren:ao.selectChildren,filter:function(t){"function"!=typeof t&&(t=Wt(t));for(var e=this._groups,n=e.length,r=new Array(n),i=0;i<n;++i)for(var o,a=e[i],s=a.length,l=r[i]=[],c=0;c<s;++c)(o=a[c])&&t.call(o,o.__data__,c,a)&&l.push(o);return new ro(r,this._parents,this._name,this._id)},merge:function(t){if(t._id!==this._id)throw new Error;for(var e=this._groups,n=t._groups,r=e.length,i=n.length,o=Math.min(r,i),a=new Array(r),s=0;s<o;++s)for(var l,c=e[s],u=n[s],h=c.length,f=a[s]=new Array(h),d=0;d<h;++d)(l=c[d]||u[d])&&(f[d]=l);for(;s<r;++s)a[s]=e[s];return new ro(a,this._parents,this._name,this._id)},selection:function(){return new to(this._groups,this._parents)},transition:function(){for(var t=this._name,e=this._id,n=oo(),r=this._groups,i=r.length,o=0;o<i;++o)for(var a,s=r[o],l=s.length,c=0;c<l;++c)if(a=s[c]){var u=Vi(a,e);Ii(a,t,n,c,s,{time:u.time+u.delay+u.duration,delay:0,duration:u.duration,ease:u.ease})}return new ro(r,this._parents,t,n)},call:ao.call,nodes:ao.nodes,node:ao.node,size:ao.size,empty:ao.empty,each:ao.each,on:function(t,e){var n=this._id;return arguments.length<2?Vi(this.node(),n).on.on(t):this.each(function(t,e,n){var r,i,o=function(t){return(t+"").trim().split(/^|\s+/).every(function(t){var e=t.indexOf(".");return e>=0&&(t=t.slice(0,e)),!t||"start"===t})}(e)?Li:Pi;return function(){var a=o(this,t),s=a.on;s!==r&&(i=(r=s).copy()).on(e,n),a.on=i}}(n,t,e))},attr:function(t,e){var n=Bt(t),r="transform"===n?Qr:Gi;return this.attrTween(t,"function"==typeof e?(n.local?Wi:qi)(n,r,Fi(this,"attr."+t,e)):null==e?(n.local?Ui:ji)(n):(n.local?Hi:Yi)(n,r,e))},attrTween:function(t,e){var n="attr."+t;if(arguments.length<2)return(n=this.tween(n))&&n._value;if(null==e)return this.tween(n,null);if("function"!=typeof e)throw new Error;var r=Bt(t);return this.tween(n,(r.local?$i:Xi)(r,e))},style:function(t,e,n){var r="transform"==(t+="")?Jr:Gi;return null==e?this.styleTween(t,function(t,e){var n,r,i;return function(){var o=_e(this,t),a=(this.style.removeProperty(t),_e(this,t));return o===a?null:o===n&&a===r?i:i=e(n=o,r=a)}}(t,r)).on("end.style."+t,eo(t)):"function"==typeof e?this.styleTween(t,function(t,e,n){var r,i,o;return function(){var a=_e(this,t),s=n(this),l=s+"";return null==s&&(this.style.removeProperty(t),l=s=_e(this,t)),a===l?null:a===r&&l===i?o:(i=l,o=e(r=a,s))}}(t,r,Fi(this,"style."+t,e))).each(function(t,e){var n,r,i,o,a="style."+e,s="end."+a;return function(){var l=Pi(this,t),c=l.on,u=null==l.value[a]?o||(o=eo(e)):void 0;c===n&&i===u||(r=(n=c).copy()).on(s,i=u),l.on=r}}(this._id,t)):this.styleTween(t,function(t,e,n){var r,i,o=n+"";return function(){var a=_e(this,t);return a===o?null:a===r?i:i=e(r=a,n)}}(t,r,e),n).on("end.style."+t,null)},styleTween:function(t,e,n){var r="style."+(t+="");if(arguments.length<2)return(r=this.tween(r))&&r._value;if(null==e)return this.tween(r,null);if("function"!=typeof e)throw new Error;return this.tween(r,function(t,e,n){var r,i;function o(){var o=e.apply(this,arguments);return o!==i&&(r=(i=o)&&function(t,e,n){return function(r){this.style.setProperty(t,e.call(this,r),n)}}(t,o,n)),r}return o._value=e,o}(t,e,null==n?"":n))},text:function(t){return this.tween("text","function"==typeof t?function(t){return function(){var e=t(this);this.textContent=null==e?"":e}}(Fi(this,"text",t)):function(t){return function(){this.textContent=t}}(null==t?"":t+""))},textTween:function(t){var e="text";if(arguments.length<1)return(e=this.tween(e))&&e._value;if(null==t)return this.tween(e,null);if("function"!=typeof t)throw new Error;return this.tween(e,function(t){var e,n;function r(){var r=t.apply(this,arguments);return r!==n&&(e=(n=r)&&function(t){return function(e){this.textContent=t.call(this,e)}}(r)),e}return r._value=t,r}(t))},remove:function(){return this.on("end.remove",function(t){return function(){var e=this.parentNode;for(var n in this.__transition)if(+n!==t)return;e&&e.removeChild(this)}}(this._id))},tween:function(t,e){var n=this._id;if(t+="",arguments.length<2){for(var r,i=Vi(this.node(),n).tween,o=0,a=i.length;o<a;++o)if((r=i[o]).name===t)return r.value;return null}return this.each((null==e?Bi:zi)(n,t,e))},delay:function(t){var e=this._id;return arguments.length?this.each(("function"==typeof t?Ki:Zi)(e,t)):Vi(this.node(),e).delay},duration:function(t){var e=this._id;return arguments.length?this.each(("function"==typeof t?Ji:Qi)(e,t)):Vi(this.node(),e).duration},ease:function(t){var e=this._id;return arguments.length?this.each(function(t,e){if("function"!=typeof e)throw new Error;return function(){Pi(this,t).ease=e}}(e,t)):Vi(this.node(),e).ease},easeVarying:function(t){if("function"!=typeof t)throw new Error;return this.each(function(t,e){return function(){var n=e.apply(this,arguments);if("function"!=typeof n)throw new Error;Pi(this,t).ease=n}}(this._id,t))},end:function(){var t,e,n=this,r=n._id,i=n.size();return new Promise(function(o,a){var s={value:a},l={value:function(){0===--i&&o()}};n.each(function(){var n=Pi(this,r),i=n.on;i!==t&&((e=(t=i).copy())._.cancel.push(s),e._.interrupt.push(s),e._.end.push(l)),n.on=e}),0===i&&o()})},[Symbol.iterator]:ao[Symbol.iterator]};function so(t){return((t*=2)<=1?t*t:--t*(2-t)+1)/2}function lo(t){return((t*=2)<=1?t*t*t:(t-=2)*t*t+2)/2}var co=function t(e){function n(t){return Math.pow(t,e)}return e=+e,n.exponent=t,n}(3),uo=function t(e){function n(t){return 1-Math.pow(1-t,e)}return e=+e,n.exponent=t,n}(3),ho=function t(e){function n(t){return((t*=2)<=1?Math.pow(t,e):2-Math.pow(2-t,e))/2}return e=+e,n.exponent=t,n}(3),fo=Math.PI,po=fo/2;function go(t){return(1-Math.cos(fo*t))/2}function _o(t){return 1.0009775171065494*(Math.pow(2,-10*t)-.0009765625)}function yo(t){return((t*=2)<=1?_o(1-t):2-_o(t-1))/2}function mo(t){return((t*=2)<=1?1-Math.sqrt(1-t*t):Math.sqrt(1-(t-=2)*t)+1)/2}var bo=4/11,vo=6/11,xo=8/11,wo=9/11,Eo=10/11,Ao=21/22,To=7.5625;function Co(t){return(t=+t)<bo?To*t*t:t<xo?To*(t-=vo)*t+.75:t<Eo?To*(t-=wo)*t+.9375:To*(t-=Ao)*t+.984375}var So=1.70158,ko=function t(e){function n(t){return(t=+t)*t*(e*(t-1)+t)}return e=+e,n.overshoot=t,n}(So),Mo=function t(e){function n(t){return--t*t*((t+1)*e+t)+1}return e=+e,n.overshoot=t,n}(So),Ro=function t(e){function n(t){return((t*=2)<1?t*t*((e+1)*t-e):(t-=2)*t*((e+1)*t+e)+2)/2}return e=+e,n.overshoot=t,n}(So),Oo=2*Math.PI,No=function t(e,n){var r=Math.asin(1/(e=Math.max(1,e)))*(n/=Oo);function i(t){return e*_o(- --t)*Math.sin((r-t)/n)}return i.amplitude=function(e){return t(e,n*Oo)},i.period=function(n){return t(e,n)},i}(1,.3),Io=function t(e,n){var r=Math.asin(1/(e=Math.max(1,e)))*(n/=Oo);function i(t){return 1-e*_o(t=+t)*Math.sin((t+r)/n)}return i.amplitude=function(e){return t(e,n*Oo)},i.period=function(n){return t(e,n)},i}(1,.3),Lo=function t(e,n){var r=Math.asin(1/(e=Math.max(1,e)))*(n/=Oo);function i(t){return((t=2*t-1)<0?e*_o(-t)*Math.sin((r-t)/n):2-e*_o(t)*Math.sin((r+t)/n))/2}return i.amplitude=function(e){return t(e,n*Oo)},i.period=function(n){return t(e,n)},i}(1,.3),Po={time:null,delay:0,duration:250,ease:lo};function Vo(t,e){for(var n;!(n=t.__transition)||!(n=n[e]);)if(!(t=t.parentNode))throw new Error(`transition ${e} not found`);return n}We.prototype.interrupt=function(t){return this.each(function(){Di(this,t)})},We.prototype.transition=function(t){var e,n;t instanceof ro?(e=t._id,t=t._name):(e=oo(),(n=Po).time=wi(),t=null==t?null:t+"");for(var r=this._groups,i=r.length,o=0;o<i;++o)for(var a,s=r[o],l=s.length,c=0;c<l;++c)(a=s[c])&&Ii(a,t,e,c,s,n||Vo(a,e));return new ro(r,this._parents,t,e)};var Do=[null];var Bo=t=>()=>t;function zo(t,{sourceEvent:e,target:n,selection:r,mode:i,dispatch:o}){Object.defineProperties(this,{type:{value:t,enumerable:!0,configurable:!0},sourceEvent:{value:e,enumerable:!0,configurable:!0},target:{value:n,enumerable:!0,configurable:!0},selection:{value:r,enumerable:!0,configurable:!0},mode:{value:i,enumerable:!0,configurable:!0},_:{value:o}})}function Fo(t){t.preventDefault(),t.stopImmediatePropagation()}var Go={name:"drag"},jo={name:"space"},Uo={name:"handle"},Yo={name:"center"};const{abs:Ho,max:qo,min:Wo}=Math;function $o(t){return[+t[0],+t[1]]}function Xo(t){return[$o(t[0]),$o(t[1])]}var Ko={name:"x",handles:["w","e"].map(ia),input:function(t,e){return null==t?null:[[+t[0],e[0][1]],[+t[1],e[1][1]]]},output:function(t){return t&&[t[0][0],t[1][0]]}},Zo={name:"y",handles:["n","s"].map(ia),input:function(t,e){return null==t?null:[[e[0][0],+t[0]],[e[1][0],+t[1]]]},output:function(t){return t&&[t[0][1],t[1][1]]}},Jo={name:"xy",handles:["n","w","e","s","nw","ne","sw","se"].map(ia),input:function(t){return null==t?null:Xo(t)},output:function(t){return t}},Qo={overlay:"crosshair",selection:"move",n:"ns-resize",e:"ew-resize",s:"ns-resize",w:"ew-resize",nw:"nwse-resize",ne:"nesw-resize",se:"nwse-resize",sw:"nesw-resize"},ta={e:"w",w:"e",nw:"ne",ne:"nw",se:"sw",sw:"se"},ea={n:"s",s:"n",nw:"sw",ne:"se",se:"ne",sw:"nw"},na={overlay:1,selection:1,n:null,e:1,s:null,w:-1,nw:-1,ne:1,se:1,sw:-1},ra={overlay:1,selection:1,n:-1,e:null,s:1,w:null,nw:-1,ne:-1,se:1,sw:1};function ia(t){return{type:t}}function oa(t){return!t.ctrlKey&&!t.button}function aa(){var t=this.ownerSVGElement||this;return t.hasAttribute("viewBox")?[[(t=t.viewBox.baseVal).x,t.y],[t.x+t.width,t.y+t.height]]:[[0,0],[t.width.baseVal.value,t.height.baseVal.value]]}function sa(){return navigator.maxTouchPoints||"ontouchstart"in this}function la(t){for(;!t.__brush;)if(!(t=t.parentNode))return;return t.__brush}function ca(t){var e,n=aa,r=oa,i=sa,o=!0,a=Nt("start","brush","end"),s=6;function l(e){var n=e.property("__brush",g).selectAll(".overlay").data([ia("overlay")]);n.enter().append("rect").attr("class","overlay").attr("pointer-events","all").attr("cursor",Qo.overlay).merge(n).each(function(){var t=la(this).extent;$e(this).attr("x",t[0][0]).attr("y",t[0][1]).attr("width",t[1][0]-t[0][0]).attr("height",t[1][1]-t[0][1])}),e.selectAll(".selection").data([ia("selection")]).enter().append("rect").attr("class","selection").attr("cursor",Qo.selection).attr("fill","#777").attr("fill-opacity",.3).attr("stroke","#fff").attr("shape-rendering","crispEdges");var r=e.selectAll(".handle").data(t.handles,function(t){return t.type});r.exit().remove(),r.enter().append("rect").attr("class",function(t){return"handle handle--"+t.type}).attr("cursor",function(t){return Qo[t.type]}),e.each(c).attr("fill","none").attr("pointer-events","all").on("mousedown.brush",f).filter(i).on("touchstart.brush",f).on("touchmove.brush",d).on("touchend.brush touchcancel.brush",p).style("touch-action","none").style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function c(){var t=$e(this),e=la(this).selection;e?(t.selectAll(".selection").style("display",null).attr("x",e[0][0]).attr("y",e[0][1]).attr("width",e[1][0]-e[0][0]).attr("height",e[1][1]-e[0][1]),t.selectAll(".handle").style("display",null).attr("x",function(t){return"e"===t.type[t.type.length-1]?e[1][0]-s/2:e[0][0]-s/2}).attr("y",function(t){return"s"===t.type[0]?e[1][1]-s/2:e[0][1]-s/2}).attr("width",function(t){return"n"===t.type||"s"===t.type?e[1][0]-e[0][0]+s:s}).attr("height",function(t){return"e"===t.type||"w"===t.type?e[1][1]-e[0][1]+s:s})):t.selectAll(".selection,.handle").style("display","none").attr("x",null).attr("y",null).attr("width",null).attr("height",null)}function u(t,e,n){var r=t.__brush.emitter;return!r||n&&r.clean?new h(t,e,n):r}function h(t,e,n){this.that=t,this.args=e,this.state=t.__brush,this.active=0,this.clean=n}function f(n){if((!e||n.touches)&&r.apply(this,arguments)){var i,a,s,l,h,f,d,p,g,_,y,m=this,b=n.target.__data__.type,v="selection"===(o&&n.metaKey?b="overlay":b)?Go:o&&n.altKey?Yo:Uo,x=t===Zo?null:na[b],w=t===Ko?null:ra[b],E=la(m),A=E.extent,T=E.selection,C=A[0][0],S=A[0][1],k=A[1][0],M=A[1][1],R=0,O=0,N=x&&w&&o&&n.shiftKey,I=Array.from(n.touches||[n],t=>{const e=t.identifier;return(t=Qe(t,m)).point0=t.slice(),t.identifier=e,t});Di(m);var L=u(m,arguments,!0).beforestart();if("overlay"===b){T&&(g=!0);const e=[I[0],I[1]||I[0]];E.selection=T=[[i=t===Zo?C:Wo(e[0][0],e[1][0]),s=t===Ko?S:Wo(e[0][1],e[1][1])],[h=t===Zo?k:qo(e[0][0],e[1][0]),d=t===Ko?M:qo(e[0][1],e[1][1])]],I.length>1&&z(n)}else i=T[0][0],s=T[0][1],h=T[1][0],d=T[1][1];a=i,l=s,f=h,p=d;var P=$e(m).attr("pointer-events","none"),V=P.selectAll(".overlay").attr("cursor",Qo[b]);if(n.touches)L.moved=B,L.ended=F;else{var D=$e(n.view).on("mousemove.brush",B,!0).on("mouseup.brush",F,!0);o&&D.on("keydown.brush",function(t){switch(t.keyCode){case 16:N=x&&w;break;case 18:v===Uo&&(x&&(h=f-R*x,i=a+R*x),w&&(d=p-O*w,s=l+O*w),v=Yo,z(t));break;case 32:v!==Uo&&v!==Yo||(x<0?h=f-R:x>0&&(i=a-R),w<0?d=p-O:w>0&&(s=l-O),v=jo,V.attr("cursor",Qo.selection),z(t));break;default:return}Fo(t)},!0).on("keyup.brush",function(t){switch(t.keyCode){case 16:N&&(_=y=N=!1,z(t));break;case 18:v===Yo&&(x<0?h=f:x>0&&(i=a),w<0?d=p:w>0&&(s=l),v=Uo,z(t));break;case 32:v===jo&&(t.altKey?(x&&(h=f-R*x,i=a+R*x),w&&(d=p-O*w,s=l+O*w),v=Yo):(x<0?h=f:x>0&&(i=a),w<0?d=p:w>0&&(s=l),v=Uo),V.attr("cursor",Qo[b]),z(t));break;default:return}Fo(t)},!0),on(n.view)}c.call(m),L.start(n,v.name)}function B(t){for(const e of t.changedTouches||[t])for(const t of I)t.identifier===e.identifier&&(t.cur=Qe(e,m));if(N&&!_&&!y&&1===I.length){const t=I[0];Ho(t.cur[0]-t[0])>Ho(t.cur[1]-t[1])?y=!0:_=!0}for(const t of I)t.cur&&(t[0]=t.cur[0],t[1]=t.cur[1]);g=!0,Fo(t),z(t)}function z(t){const e=I[0],n=e.point0;var r;switch(R=e[0]-n[0],O=e[1]-n[1],v){case jo:case Go:x&&(R=qo(C-i,Wo(k-h,R)),a=i+R,f=h+R),w&&(O=qo(S-s,Wo(M-d,O)),l=s+O,p=d+O);break;case Uo:I[1]?(x&&(a=qo(C,Wo(k,I[0][0])),f=qo(C,Wo(k,I[1][0])),x=1),w&&(l=qo(S,Wo(M,I[0][1])),p=qo(S,Wo(M,I[1][1])),w=1)):(x<0?(R=qo(C-i,Wo(k-i,R)),a=i+R,f=h):x>0&&(R=qo(C-h,Wo(k-h,R)),a=i,f=h+R),w<0?(O=qo(S-s,Wo(M-s,O)),l=s+O,p=d):w>0&&(O=qo(S-d,Wo(M-d,O)),l=s,p=d+O));break;case Yo:x&&(a=qo(C,Wo(k,i-R*x)),f=qo(C,Wo(k,h+R*x))),w&&(l=qo(S,Wo(M,s-O*w)),p=qo(S,Wo(M,d+O*w)))}f<a&&(x*=-1,r=i,i=h,h=r,r=a,a=f,f=r,b in ta&&V.attr("cursor",Qo[b=ta[b]])),p<l&&(w*=-1,r=s,s=d,d=r,r=l,l=p,p=r,b in ea&&V.attr("cursor",Qo[b=ea[b]])),E.selection&&(T=E.selection),_&&(a=T[0][0],f=T[1][0]),y&&(l=T[0][1],p=T[1][1]),T[0][0]===a&&T[0][1]===l&&T[1][0]===f&&T[1][1]===p||(E.selection=[[a,l],[f,p]],c.call(m),L.brush(t,v.name))}function F(t){if(function(t){t.stopImmediatePropagation()}(t),t.touches){if(t.touches.length)return;e&&clearTimeout(e),e=setTimeout(function(){e=null},500)}else an(t.view,g),D.on("keydown.brush keyup.brush mousemove.brush mouseup.brush",null);P.attr("pointer-events","all"),V.attr("cursor",Qo.overlay),E.selection&&(T=E.selection),function(t){return t[0][0]===t[1][0]||t[0][1]===t[1][1]}(T)&&(E.selection=null,c.call(m)),L.end(t,v.name)}}function d(t){u(this,arguments).moved(t)}function p(t){u(this,arguments).ended(t)}function g(){var e=this.__brush||{selection:null};return e.extent=Xo(n.apply(this,arguments)),e.dim=t,e}return l.move=function(e,n,r){e.tween?e.on("start.brush",function(t){u(this,arguments).beforestart().start(t)}).on("interrupt.brush end.brush",function(t){u(this,arguments).end(t)}).tween("brush",function(){var e=this,r=e.__brush,i=u(e,arguments),o=r.selection,a=t.input("function"==typeof n?n.apply(this,arguments):n,r.extent),s=Hr(o,a);function l(t){r.selection=1===t&&null===a?null:s(t),c.call(e),i.brush()}return null!==o&&null!==a?l:l(1)}):e.each(function(){var e=this,i=arguments,o=e.__brush,a=t.input("function"==typeof n?n.apply(e,i):n,o.extent),s=u(e,i).beforestart();Di(e),o.selection=null===a?null:a,c.call(e),s.start(r).brush(r).end(r)})},l.clear=function(t,e){l.move(t,null,e)},h.prototype={beforestart:function(){return 1===++this.active&&(this.state.emitter=this,this.starting=!0),this},start:function(t,e){return this.starting?(this.starting=!1,this.emit("start",t,e)):this.emit("brush",t),this},brush:function(t,e){return this.emit("brush",t,e),this},end:function(t,e){return 0===--this.active&&(delete this.state.emitter,this.emit("end",t,e)),this},emit:function(e,n,r){var i=$e(this.that).datum();a.call(e,this.that,new zo(e,{sourceEvent:n,target:l,selection:t.output(this.state.selection),mode:r,dispatch:a}),i)}},l.extent=function(t){return arguments.length?(n="function"==typeof t?t:Bo(Xo(t)),l):n},l.filter=function(t){return arguments.length?(r="function"==typeof t?t:Bo(!!t),l):r},l.touchable=function(t){return arguments.length?(i="function"==typeof t?t:Bo(!!t),l):i},l.handleSize=function(t){return arguments.length?(s=+t,l):s},l.keyModifiers=function(t){return arguments.length?(o=!!t,l):o},l.on=function(){var t=a.on.apply(a,arguments);return t===a?l:t},l}var ua=Math.abs,ha=Math.cos,fa=Math.sin,da=Math.PI,pa=da/2,ga=2*da,_a=Math.max,ya=1e-12;function ma(t,e){return Array.from({length:e-t},(e,n)=>t+n)}function ba(t,e){var n=0,r=null,i=null,o=null;function a(a){var s,l=a.length,c=new Array(l),u=ma(0,l),h=new Array(l*l),f=new Array(l),d=0;a=Float64Array.from({length:l*l},e?(t,e)=>a[e%l][e/l|0]:(t,e)=>a[e/l|0][e%l]);for(let e=0;e<l;++e){let n=0;for(let r=0;r<l;++r)n+=a[e*l+r]+t*a[r*l+e];d+=c[e]=n}s=(d=_a(0,ga-n*l)/d)?n:ga/l;{let e=0;r&&u.sort((t,e)=>r(c[t],c[e]));for(const n of u){const r=e;if(t){const t=ma(1+~l,l).filter(t=>t<0?a[~t*l+n]:a[n*l+t]);i&&t.sort((t,e)=>i(t<0?-a[~t*l+n]:a[n*l+t],e<0?-a[~e*l+n]:a[n*l+e]));for(const r of t)if(r<0){(h[~r*l+n]||(h[~r*l+n]={source:null,target:null})).target={index:n,startAngle:e,endAngle:e+=a[~r*l+n]*d,value:a[~r*l+n]}}else{(h[n*l+r]||(h[n*l+r]={source:null,target:null})).source={index:n,startAngle:e,endAngle:e+=a[n*l+r]*d,value:a[n*l+r]}}f[n]={index:n,startAngle:r,endAngle:e,value:c[n]}}else{const t=ma(0,l).filter(t=>a[n*l+t]||a[t*l+n]);i&&t.sort((t,e)=>i(a[n*l+t],a[n*l+e]));for(const r of t){let t;if(n<r?(t=h[n*l+r]||(h[n*l+r]={source:null,target:null}),t.source={index:n,startAngle:e,endAngle:e+=a[n*l+r]*d,value:a[n*l+r]}):(t=h[r*l+n]||(h[r*l+n]={source:null,target:null}),t.target={index:n,startAngle:e,endAngle:e+=a[n*l+r]*d,value:a[n*l+r]},n===r&&(t.source=t.target)),t.source&&t.target&&t.source.value<t.target.value){const e=t.source;t.source=t.target,t.target=e}}f[n]={index:n,startAngle:r,endAngle:e,value:c[n]}}e+=s}}return(h=Object.values(h)).groups=f,o?h.sort(o):h}return a.padAngle=function(t){return arguments.length?(n=_a(0,t),a):n},a.sortGroups=function(t){return arguments.length?(r=t,a):r},a.sortSubgroups=function(t){return arguments.length?(i=t,a):i},a.sortChords=function(t){return arguments.length?(null==t?o=null:(e=t,o=function(t,n){return e(t.source.value+t.target.value,n.source.value+n.target.value)})._=t,a):o&&o._;var e},a}const va=Math.PI,xa=2*va,wa=1e-6,Ea=xa-wa;function Aa(t){this._+=t[0];for(let e=1,n=t.length;e<n;++e)this._+=arguments[e]+t[e]}let Ta=class{constructor(t){this._x0=this._y0=this._x1=this._y1=null,this._="",this._append=null==t?Aa:function(t){let e=Math.floor(t);if(!(e>=0))throw new Error(`invalid digits: ${t}`);if(e>15)return Aa;const n=10**e;return function(t){this._+=t[0];for(let e=1,r=t.length;e<r;++e)this._+=Math.round(arguments[e]*n)/n+t[e]}}(t)}moveTo(t,e){this._append`M${this._x0=this._x1=+t},${this._y0=this._y1=+e}`}closePath(){null!==this._x1&&(this._x1=this._x0,this._y1=this._y0,this._append`Z`)}lineTo(t,e){this._append`L${this._x1=+t},${this._y1=+e}`}quadraticCurveTo(t,e,n,r){this._append`Q${+t},${+e},${this._x1=+n},${this._y1=+r}`}bezierCurveTo(t,e,n,r,i,o){this._append`C${+t},${+e},${+n},${+r},${this._x1=+i},${this._y1=+o}`}arcTo(t,e,n,r,i){if(t=+t,e=+e,n=+n,r=+r,(i=+i)<0)throw new Error(`negative radius: ${i}`);let o=this._x1,a=this._y1,s=n-t,l=r-e,c=o-t,u=a-e,h=c*c+u*u;if(null===this._x1)this._append`M${this._x1=t},${this._y1=e}`;else if(h>wa)if(Math.abs(u*s-l*c)>wa&&i){let f=n-o,d=r-a,p=s*s+l*l,g=f*f+d*d,_=Math.sqrt(p),y=Math.sqrt(h),m=i*Math.tan((va-Math.acos((p+h-g)/(2*_*y)))/2),b=m/y,v=m/_;Math.abs(b-1)>wa&&this._append`L${t+b*c},${e+b*u}`,this._append`A${i},${i},0,0,${+(u*f>c*d)},${this._x1=t+v*s},${this._y1=e+v*l}`}else this._append`L${this._x1=t},${this._y1=e}`;else;}arc(t,e,n,r,i,o){if(t=+t,e=+e,o=!!o,(n=+n)<0)throw new Error(`negative radius: ${n}`);let a=n*Math.cos(r),s=n*Math.sin(r),l=t+a,c=e+s,u=1^o,h=o?r-i:i-r;null===this._x1?this._append`M${l},${c}`:(Math.abs(this._x1-l)>wa||Math.abs(this._y1-c)>wa)&&this._append`L${l},${c}`,n&&(h<0&&(h=h%xa+xa),h>Ea?this._append`A${n},${n},0,1,${u},${t-a},${e-s}A${n},${n},0,1,${u},${this._x1=l},${this._y1=c}`:h>wa&&this._append`A${n},${n},0,${+(h>=va)},${u},${this._x1=t+n*Math.cos(i)},${this._y1=e+n*Math.sin(i)}`)}rect(t,e,n,r){this._append`M${this._x0=this._x1=+t},${this._y0=this._y1=+e}h${n=+n}v${+r}h${-n}Z`}toString(){return this._}};function Ca(){return new Ta}Ca.prototype=Ta.prototype;var Sa=Array.prototype.slice;function ka(t){return function(){return t}}function Ma(t){return t.source}function Ra(t){return t.target}function Oa(t){return t.radius}function Na(t){return t.startAngle}function Ia(t){return t.endAngle}function La(){return 0}function Pa(){return 10}function Va(t){var e=Ma,n=Ra,r=Oa,i=Oa,o=Na,a=Ia,s=La,l=null;function c(){var c,u=e.apply(this,arguments),h=n.apply(this,arguments),f=s.apply(this,arguments)/2,d=Sa.call(arguments),p=+r.apply(this,(d[0]=u,d)),g=o.apply(this,d)-pa,_=a.apply(this,d)-pa,y=+i.apply(this,(d[0]=h,d)),m=o.apply(this,d)-pa,b=a.apply(this,d)-pa;if(l||(l=c=Ca()),f>ya&&(ua(_-g)>2*f+ya?_>g?(g+=f,_-=f):(g-=f,_+=f):g=_=(g+_)/2,ua(b-m)>2*f+ya?b>m?(m+=f,b-=f):(m-=f,b+=f):m=b=(m+b)/2),l.moveTo(p*ha(g),p*fa(g)),l.arc(0,0,p,g,_),g!==m||_!==b)if(t){var v=y-+t.apply(this,arguments),x=(m+b)/2;l.quadraticCurveTo(0,0,v*ha(m),v*fa(m)),l.lineTo(y*ha(x),y*fa(x)),l.lineTo(v*ha(b),v*fa(b))}else l.quadraticCurveTo(0,0,y*ha(m),y*fa(m)),l.arc(0,0,y,m,b);if(l.quadraticCurveTo(0,0,p*ha(g),p*fa(g)),l.closePath(),c)return l=null,c+""||null}return t&&(c.headRadius=function(e){return arguments.length?(t="function"==typeof e?e:ka(+e),c):t}),c.radius=function(t){return arguments.length?(r=i="function"==typeof t?t:ka(+t),c):r},c.sourceRadius=function(t){return arguments.length?(r="function"==typeof t?t:ka(+t),c):r},c.targetRadius=function(t){return arguments.length?(i="function"==typeof t?t:ka(+t),c):i},c.startAngle=function(t){return arguments.length?(o="function"==typeof t?t:ka(+t),c):o},c.endAngle=function(t){return arguments.length?(a="function"==typeof t?t:ka(+t),c):a},c.padAngle=function(t){return arguments.length?(s="function"==typeof t?t:ka(+t),c):s},c.source=function(t){return arguments.length?(e=t,c):e},c.target=function(t){return arguments.length?(n=t,c):n},c.context=function(t){return arguments.length?(l=null==t?null:t,c):l},c}var Da=Array.prototype.slice;function Ba(t,e){return t-e}var za=t=>()=>t;function Fa(t,e){for(var n,r=-1,i=e.length;++r<i;)if(n=Ga(t,e[r]))return n;return 0}function Ga(t,e){for(var n=e[0],r=e[1],i=-1,o=0,a=t.length,s=a-1;o<a;s=o++){var l=t[o],c=l[0],u=l[1],h=t[s],f=h[0],d=h[1];if(ja(l,h,e))return 0;u>r!=d>r&&n<(f-c)*(r-u)/(d-u)+c&&(i=-i)}return i}function ja(t,e,n){var r,i,o,a;return function(t,e,n){return(e[0]-t[0])*(n[1]-t[1])===(n[0]-t[0])*(e[1]-t[1])}(t,e,n)&&(i=t[r=+(t[0]===e[0])],o=n[r],a=e[r],i<=o&&o<=a||a<=o&&o<=i)}function Ua(){}var Ya=[[],[[[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 Ha(){var t=1,e=1,n=Z,r=s;function i(t){var e=n(t);if(Array.isArray(e))e=e.slice().sort(Ba);else{const n=x(t,qa);for(e=W(...K(n[0],n[1],e),e);e[e.length-1]>=n[1];)e.pop();for(;e[1]<n[0];)e.shift()}return e.map(e=>o(t,e))}function o(n,i){const o=null==i?NaN:+i;if(isNaN(o))throw new Error(`invalid value: ${i}`);var s=[],l=[];return function(n,r,i){var o,s,l,c,u,h,f=new Array,d=new Array;o=s=-1,c=Wa(n[0],r),Ya[c<<1].forEach(p);for(;++o<t-1;)l=c,c=Wa(n[o+1],r),Ya[l|c<<1].forEach(p);Ya[c|0].forEach(p);for(;++s<e-1;){for(o=-1,c=Wa(n[s*t+t],r),u=Wa(n[s*t],r),Ya[c<<1|u<<2].forEach(p);++o<t-1;)l=c,c=Wa(n[s*t+t+o+1],r),h=u,u=Wa(n[s*t+o+1],r),Ya[l|c<<1|u<<2|h<<3].forEach(p);Ya[c|u<<3].forEach(p)}o=-1,u=n[s*t]>=r,Ya[u<<2].forEach(p);for(;++o<t-1;)h=u,u=Wa(n[s*t+o+1],r),Ya[u<<2|h<<3].forEach(p);function p(t){var e,n,r=[t[0][0]+o,t[0][1]+s],l=[t[1][0]+o,t[1][1]+s],c=a(r),u=a(l);(e=d[c])?(n=f[u])?(delete d[e.end],delete f[n.start],e===n?(e.ring.push(l),i(e.ring)):f[e.start]=d[n.end]={start:e.start,end:n.end,ring:e.ring.concat(n.ring)}):(delete d[e.end],e.ring.push(l),d[e.end=u]=e):(e=f[u])?(n=d[c])?(delete f[e.start],delete d[n.end],e===n?(e.ring.push(l),i(e.ring)):f[n.start]=d[e.end]={start:n.start,end:e.end,ring:n.ring.concat(e.ring)}):(delete f[e.start],e.ring.unshift(r),f[e.start=c]=e):f[c]=d[u]={start:c,end:u,ring:[r,l]}}Ya[u<<3].forEach(p)}(n,o,function(t){r(t,n,o),function(t){for(var e=0,n=t.length,r=t[n-1][1]*t[0][0]-t[n-1][0]*t[0][1];++e<n;)r+=t[e-1][1]*t[e][0]-t[e-1][0]*t[e][1];return r}(t)>0?s.push([t]):l.push(t)}),l.forEach(function(t){for(var e,n=0,r=s.length;n<r;++n)if(-1!==Fa((e=s[n])[0],t))return void e.push(t)}),{type:"MultiPolygon",value:i,coordinates:s}}function a(e){return 2*e[0]+e[1]*(t+1)*4}function s(n,r,i){n.forEach(function(n){var o=n[0],a=n[1],s=0|o,l=0|a,c=$a(r[l*t+s]);o>0&&o<t&&s===o&&(n[0]=Xa(o,$a(r[l*t+s-1]),c,i)),a>0&&a<e&&l===a&&(n[1]=Xa(a,$a(r[(l-1)*t+s]),c,i))})}return i.contour=o,i.size=function(n){if(!arguments.length)return[t,e];var r=Math.floor(n[0]),o=Math.floor(n[1]);if(!(r>=0&&o>=0))throw new Error("invalid size");return t=r,e=o,i},i.thresholds=function(t){return arguments.length?(n="function"==typeof t?t:Array.isArray(t)?za(Da.call(t)):za(t),i):n},i.smooth=function(t){return arguments.length?(r=t?s:Ua,i):r===s},i}function qa(t){return isFinite(t)?t:NaN}function Wa(t,e){return null!=t&&+t>=e}function $a(t){return null==t||isNaN(t=+t)?-1/0:t}function Xa(t,e,n,r){const i=r-e,o=n-e,a=isFinite(i)||isFinite(o)?i/o:Math.sign(i)/Math.sign(o);return isNaN(a)?t:t+a-.5}function Ka(t){return t[0]}function Za(t){return t[1]}function Ja(){return 1}const Qa=134217729;function ts(t,e,n,r,i){let o,a,s,l,c=e[0],u=r[0],h=0,f=0;u>c==u>-c?(o=c,c=e[++h]):(o=u,u=r[++f]);let d=0;if(h<t&&f<n)for(u>c==u>-c?(a=c+o,s=o-(a-c),c=e[++h]):(a=u+o,s=o-(a-u),u=r[++f]),o=a,0!==s&&(i[d++]=s);h<t&&f<n;)u>c==u>-c?(a=o+c,l=a-o,s=o-(a-l)+(c-l),c=e[++h]):(a=o+u,l=a-o,s=o-(a-l)+(u-l),u=r[++f]),o=a,0!==s&&(i[d++]=s);for(;h<t;)a=o+c,l=a-o,s=o-(a-l)+(c-l),c=e[++h],o=a,0!==s&&(i[d++]=s);for(;f<n;)a=o+u,l=a-o,s=o-(a-l)+(u-l),u=r[++f],o=a,0!==s&&(i[d++]=s);return 0===o&&0!==d||(i[d++]=o),d}function es(t){return new Float64Array(t)}const ns=es(4),rs=es(8),is=es(12),os=es(16),as=es(4);function ss(t,e,n,r,i,o){const a=(e-o)*(n-i),s=(t-i)*(r-o),l=a-s,c=Math.abs(a+s);return Math.abs(l)>=33306690738754716e-32*c?l:-function(t,e,n,r,i,o,a){let s,l,c,u,h,f,d,p,g,_,y,m,b,v,x,w,E,A;const T=t-i,C=n-i,S=e-o,k=r-o;v=T*k,f=Qa*T,d=f-(f-T),p=T-d,f=Qa*k,g=f-(f-k),_=k-g,x=p*_-(v-d*g-p*g-d*_),w=S*C,f=Qa*S,d=f-(f-S),p=S-d,f=Qa*C,g=f-(f-C),_=C-g,E=p*_-(w-d*g-p*g-d*_),y=x-E,h=x-y,ns[0]=x-(y+h)+(h-E),m=v+y,h=m-v,b=v-(m-h)+(y-h),y=b-w,h=b-y,ns[1]=b-(y+h)+(h-w),A=m+y,h=A-m,ns[2]=m-(A-h)+(y-h),ns[3]=A;let M=function(t,e){let n=e[0];for(let r=1;r<t;r++)n+=e[r];return n}(4,ns),R=22204460492503146e-32*a;if(M>=R||-M>=R)return M;if(h=t-T,s=t-(T+h)+(h-i),h=n-C,c=n-(C+h)+(h-i),h=e-S,l=e-(S+h)+(h-o),h=r-k,u=r-(k+h)+(h-o),0===s&&0===l&&0===c&&0===u)return M;if(R=11093356479670487e-47*a+33306690738754706e-32*Math.abs(M),M+=T*u+k*s-(S*c+C*l),M>=R||-M>=R)return M;v=s*k,f=Qa*s,d=f-(f-s),p=s-d,f=Qa*k,g=f-(f-k),_=k-g,x=p*_-(v-d*g-p*g-d*_),w=l*C,f=Qa*l,d=f-(f-l),p=l-d,f=Qa*C,g=f-(f-C),_=C-g,E=p*_-(w-d*g-p*g-d*_),y=x-E,h=x-y,as[0]=x-(y+h)+(h-E),m=v+y,h=m-v,b=v-(m-h)+(y-h),y=b-w,h=b-y,as[1]=b-(y+h)+(h-w),A=m+y,h=A-m,as[2]=m-(A-h)+(y-h),as[3]=A;const O=ts(4,ns,4,as,rs);v=T*u,f=Qa*T,d=f-(f-T),p=T-d,f=Qa*u,g=f-(f-u),_=u-g,x=p*_-(v-d*g-p*g-d*_),w=S*c,f=Qa*S,d=f-(f-S),p=S-d,f=Qa*c,g=f-(f-c),_=c-g,E=p*_-(w-d*g-p*g-d*_),y=x-E,h=x-y,as[0]=x-(y+h)+(h-E),m=v+y,h=m-v,b=v-(m-h)+(y-h),y=b-w,h=b-y,as[1]=b-(y+h)+(h-w),A=m+y,h=A-m,as[2]=m-(A-h)+(y-h),as[3]=A;const N=ts(O,rs,4,as,is);v=s*u,f=Qa*s,d=f-(f-s),p=s-d,f=Qa*u,g=f-(f-u),_=u-g,x=p*_-(v-d*g-p*g-d*_),w=l*c,f=Qa*l,d=f-(f-l),p=l-d,f=Qa*c,g=f-(f-c),_=c-g,E=p*_-(w-d*g-p*g-d*_),y=x-E,h=x-y,as[0]=x-(y+h)+(h-E),m=v+y,h=m-v,b=v-(m-h)+(y-h),y=b-w,h=b-y,as[1]=b-(y+h)+(h-w),A=m+y,h=A-m,as[2]=m-(A-h)+(y-h),as[3]=A;const I=ts(N,is,4,as,os);return os[I-1]}(t,e,n,r,i,o,c)}const ls=Math.pow(2,-52),cs=new Uint32Array(512);class us{static from(t,e=_s,n=ys){const r=t.length,i=new Float64Array(2*r);for(let o=0;o<r;o++){const r=t[o];i[2*o]=e(r),i[2*o+1]=n(r)}return new us(i)}constructor(t){const e=t.length>>1;if(e>0&&"number"!=typeof t[0])throw new Error("Expected coords to contain numbers.");this.coords=t;const n=Math.max(2*e-5,0);this._triangles=new Uint32Array(3*n),this._halfedges=new Int32Array(3*n),this._hashSize=Math.ceil(Math.sqrt(e)),this._hullPrev=new Uint32Array(e),this._hullNext=new Uint32Array(e),this._hullTri=new Uint32Array(e),this._hullHash=new Int32Array(this._hashSize),this._ids=new Uint32Array(e),this._dists=new Float64Array(e),this.update()}update(){const{coords:t,_hullPrev:e,_hullNext:n,_hullTri:r,_hullHash:i}=this,o=t.length>>1;let a=1/0,s=1/0,l=-1/0,c=-1/0;for(let e=0;e<o;e++){const n=t[2*e],r=t[2*e+1];n<a&&(a=n),r<s&&(s=r),n>l&&(l=n),r>c&&(c=r),this._ids[e]=e}const u=(a+l)/2,h=(s+c)/2;let f,d,p;for(let e=0,n=1/0;e<o;e++){const r=hs(u,h,t[2*e],t[2*e+1]);r<n&&(f=e,n=r)}const g=t[2*f],_=t[2*f+1];for(let e=0,n=1/0;e<o;e++){if(e===f)continue;const r=hs(g,_,t[2*e],t[2*e+1]);r<n&&r>0&&(d=e,n=r)}let y=t[2*d],m=t[2*d+1],b=1/0;for(let e=0;e<o;e++){if(e===f||e===d)continue;const n=ds(g,_,y,m,t[2*e],t[2*e+1]);n<b&&(p=e,b=n)}let v=t[2*p],x=t[2*p+1];if(b===1/0){for(let e=0;e<o;e++)this._dists[e]=t[2*e]-t[0]||t[2*e+1]-t[1];ps(this._ids,this._dists,0,o-1);const e=new Uint32Array(o);let n=0;for(let t=0,r=-1/0;t<o;t++){const i=this._ids[t],o=this._dists[i];o>r&&(e[n++]=i,r=o)}return this.hull=e.subarray(0,n),this.triangles=new Uint32Array(0),void(this.halfedges=new Uint32Array(0))}if(ss(g,_,y,m,v,x)<0){const t=d,e=y,n=m;d=p,y=v,m=x,p=t,v=e,x=n}const w=function(t,e,n,r,i,o){const a=n-t,s=r-e,l=i-t,c=o-e,u=a*a+s*s,h=l*l+c*c,f=.5/(a*c-s*l),d=t+(c*u-s*h)*f,p=e+(a*h-l*u)*f;return{x:d,y:p}}(g,_,y,m,v,x);this._cx=w.x,this._cy=w.y;for(let e=0;e<o;e++)this._dists[e]=hs(t[2*e],t[2*e+1],w.x,w.y);ps(this._ids,this._dists,0,o-1),this._hullStart=f;let E=3;n[f]=e[p]=d,n[d]=e[f]=p,n[p]=e[d]=f,r[f]=0,r[d]=1,r[p]=2,i.fill(-1),i[this._hashKey(g,_)]=f,i[this._hashKey(y,m)]=d,i[this._hashKey(v,x)]=p,this.trianglesLen=0,this._addTriangle(f,d,p,-1,-1,-1);for(let o,a,s=0;s<this._ids.length;s++){const l=this._ids[s],c=t[2*l],u=t[2*l+1];if(s>0&&Math.abs(c-o)<=ls&&Math.abs(u-a)<=ls)continue;if(o=c,a=u,l===f||l===d||l===p)continue;let h=0;for(let t=0,e=this._hashKey(c,u);t<this._hashSize&&(h=i[(e+t)%this._hashSize],-1===h||h===n[h]);t++);h=e[h];let g,_=h;for(;g=n[_],ss(c,u,t[2*_],t[2*_+1],t[2*g],t[2*g+1])>=0;)if(_=g,_===h){_=-1;break}if(-1===_)continue;let y=this._addTriangle(_,l,n[_],-1,-1,r[_]);r[l]=this._legalize(y+2),r[_]=y,E++;let m=n[_];for(;g=n[m],ss(c,u,t[2*m],t[2*m+1],t[2*g],t[2*g+1])<0;)y=this._addTriangle(m,l,g,r[l],-1,r[m]),r[l]=this._legalize(y+2),n[m]=m,E--,m=g;if(_===h)for(;g=e[_],ss(c,u,t[2*g],t[2*g+1],t[2*_],t[2*_+1])<0;)y=this._addTriangle(g,l,_,-1,r[_],r[g]),this._legalize(y+2),r[g]=y,n[_]=_,E--,_=g;this._hullStart=e[l]=_,n[_]=e[m]=l,n[l]=m,i[this._hashKey(c,u)]=l,i[this._hashKey(t[2*_],t[2*_+1])]=_}this.hull=new Uint32Array(E);for(let t=0,e=this._hullStart;t<E;t++)this.hull[t]=e,e=n[e];this.triangles=this._triangles.subarray(0,this.trianglesLen),this.halfedges=this._halfedges.subarray(0,this.trianglesLen)}_hashKey(t,e){return Math.floor(function(t,e){const n=t/(Math.abs(t)+Math.abs(e));return(e>0?3-n:1+n)/4}(t-this._cx,e-this._cy)*this._hashSize)%this._hashSize}_legalize(t){const{_triangles:e,_halfedges:n,coords:r}=this;let i=0,o=0;for(;;){const a=n[t],s=t-t%3;if(o=s+(t+2)%3,-1===a){if(0===i)break;t=cs[--i];continue}const l=a-a%3,c=s+(t+1)%3,u=l+(a+2)%3,h=e[o],f=e[t],d=e[c],p=e[u];if(fs(r[2*h],r[2*h+1],r[2*f],r[2*f+1],r[2*d],r[2*d+1],r[2*p],r[2*p+1])){e[t]=p,e[a]=h;const r=n[u];if(-1===r){let e=this._hullStart;do{if(this._hullTri[e]===u){this._hullTri[e]=t;break}e=this._hullPrev[e]}while(e!==this._hullStart)}this._link(t,r),this._link(a,n[o]),this._link(o,u);const s=l+(a+1)%3;i<cs.length&&(cs[i++]=s)}else{if(0===i)break;t=cs[--i]}}return o}_link(t,e){this._halfedges[t]=e,-1!==e&&(this._halfedges[e]=t)}_addTriangle(t,e,n,r,i,o){const a=this.trianglesLen;return this._triangles[a]=t,this._triangles[a+1]=e,this._triangles[a+2]=n,this._link(a,r),this._link(a+1,i),this._link(a+2,o),this.trianglesLen+=3,a}}function hs(t,e,n,r){const i=t-n,o=e-r;return i*i+o*o}function fs(t,e,n,r,i,o,a,s){const l=t-a,c=e-s,u=n-a,h=r-s,f=i-a,d=o-s,p=u*u+h*h,g=f*f+d*d;return l*(h*g-p*d)-c*(u*g-p*f)+(l*l+c*c)*(u*d-h*f)<0}function ds(t,e,n,r,i,o){const a=n-t,s=r-e,l=i-t,c=o-e,u=a*a+s*s,h=l*l+c*c,f=.5/(a*c-s*l),d=(c*u-s*h)*f,p=(a*h-l*u)*f;return d*d+p*p}function ps(t,e,n,r){if(r-n<=20)for(let i=n+1;i<=r;i++){const r=t[i],o=e[r];let a=i-1;for(;a>=n&&e[t[a]]>o;)t[a+1]=t[a--];t[a+1]=r}else{let i=n+1,o=r;gs(t,n+r>>1,i),e[t[n]]>e[t[r]]&&gs(t,n,r),e[t[i]]>e[t[r]]&&gs(t,i,r),e[t[n]]>e[t[i]]&&gs(t,n,i);const a=t[i],s=e[a];for(;;){do{i++}while(e[t[i]]<s);do{o--}while(e[t[o]]>s);if(o<i)break;gs(t,i,o)}t[n+1]=t[o],t[o]=a,r-i+1>=o-n?(ps(t,e,i,r),ps(t,e,n,o-1)):(ps(t,e,n,o-1),ps(t,e,i,r))}}function gs(t,e,n){const r=t[e];t[e]=t[n],t[n]=r}function _s(t){return t[0]}function ys(t){return t[1]}const ms=1e-6;let bs=class{constructor(){this._x0=this._y0=this._x1=this._y1=null,this._=""}moveTo(t,e){this._+=`M${this._x0=this._x1=+t},${this._y0=this._y1=+e}`}closePath(){null!==this._x1&&(this._x1=this._x0,this._y1=this._y0,this._+="Z")}lineTo(t,e){this._+=`L${this._x1=+t},${this._y1=+e}`}arc(t,e,n){const r=(t=+t)+(n=+n),i=e=+e;if(n<0)throw new Error("negative radius");null===this._x1?this._+=`M${r},${i}`:(Math.abs(this._x1-r)>ms||Math.abs(this._y1-i)>ms)&&(this._+="L"+r+","+i),n&&(this._+=`A${n},${n},0,1,1,${t-n},${e}A${n},${n},0,1,1,${this._x1=r},${this._y1=i}`)}rect(t,e,n,r){this._+=`M${this._x0=this._x1=+t},${this._y0=this._y1=+e}h${+n}v${+r}h${-n}Z`}value(){return this._||null}},vs=class{constructor(){this._=[]}moveTo(t,e){this._.push([t,e])}closePath(){this._.push(this._[0].slice())}lineTo(t,e){this._.push([t,e])}value(){return this._.length?this._:null}};class xs{constructor(t,[e,n,r,i]=[0,0,960,500]){if(!((r=+r)>=(e=+e)&&(i=+i)>=(n=+n)))throw new Error("invalid bounds");this.delaunay=t,this._circumcenters=new Float64Array(2*t.points.length),this.vectors=new Float64Array(2*t.points.length),this.xmax=r,this.xmin=e,this.ymax=i,this.ymin=n,this._init()}update(){return this.delaunay.update(),this._init(),this}_init(){const{delaunay:{points:t,hull:e,triangles:n},vectors:r}=this;let i,o;const a=this.circumcenters=this._circumcenters.subarray(0,n.length/3*2);for(let r,s,l=0,c=0,u=n.length;l<u;l+=3,c+=2){const u=2*n[l],h=2*n[l+1],f=2*n[l+2],d=t[u],p=t[u+1],g=t[h],_=t[h+1],y=t[f],m=t[f+1],b=g-d,v=_-p,x=y-d,w=m-p,E=2*(b*w-v*x);if(Math.abs(E)<1e-9){if(void 0===i){i=o=0;for(const n of e)i+=t[2*n],o+=t[2*n+1];i/=e.length,o/=e.length}const n=1e9*Math.sign((i-d)*w-(o-p)*x);r=(d+y)/2-n*w,s=(p+m)/2+n*x}else{const t=1/E,e=b*b+v*v,n=x*x+w*w;r=d+(w*e-v*n)*t,s=p+(b*n-x*e)*t}a[c]=r,a[c+1]=s}let s,l,c,u=e[e.length-1],h=4*u,f=t[2*u],d=t[2*u+1];r.fill(0);for(let n=0;n<e.length;++n)u=e[n],s=h,l=f,c=d,h=4*u,f=t[2*u],d=t[2*u+1],r[s+2]=r[h]=c-d,r[s+3]=r[h+1]=f-l}render(t){const e=null==t?t=new bs:void 0,{delaunay:{halfedges:n,inedges:r,hull:i},circumcenters:o,vectors:a}=this;if(i.length<=1)return null;for(let e=0,r=n.length;e<r;++e){const r=n[e];if(r<e)continue;const i=2*Math.floor(e/3),a=2*Math.floor(r/3),s=o[i],l=o[i+1],c=o[a],u=o[a+1];this._renderSegment(s,l,c,u,t)}let s,l=i[i.length-1];for(let e=0;e<i.length;++e){s=l,l=i[e];const n=2*Math.floor(r[l]/3),c=o[n],u=o[n+1],h=4*s,f=this._project(c,u,a[h+2],a[h+3]);f&&this._renderSegment(c,u,f[0],f[1],t)}return e&&e.value()}renderBounds(t){const e=null==t?t=new bs:void 0;return t.rect(this.xmin,this.ymin,this.xmax-this.xmin,this.ymax-this.ymin),e&&e.value()}renderCell(t,e){const n=null==e?e=new bs:void 0,r=this._clip(t);if(null===r||!r.length)return;e.moveTo(r[0],r[1]);let i=r.length;for(;r[0]===r[i-2]&&r[1]===r[i-1]&&i>1;)i-=2;for(let t=2;t<i;t+=2)r[t]===r[t-2]&&r[t+1]===r[t-1]||e.lineTo(r[t],r[t+1]);return e.closePath(),n&&n.value()}*cellPolygons(){const{delaunay:{points:t}}=this;for(let e=0,n=t.length/2;e<n;++e){const t=this.cellPolygon(e);t&&(t.index=e,yield t)}}cellPolygon(t){const e=new vs;return this.renderCell(t,e),e.value()}_renderSegment(t,e,n,r,i){let o;const a=this._regioncode(t,e),s=this._regioncode(n,r);0===a&&0===s?(i.moveTo(t,e),i.lineTo(n,r)):(o=this._clipSegment(t,e,n,r,a,s))&&(i.moveTo(o[0],o[1]),i.lineTo(o[2],o[3]))}contains(t,e,n){return(e=+e)==e&&(n=+n)==n&&this.delaunay._step(t,e,n)===t}*neighbors(t){const e=this._clip(t);if(e)for(const n of this.delaunay.neighbors(t)){const t=this._clip(n);if(t)t:for(let r=0,i=e.length;r<i;r+=2)for(let o=0,a=t.length;o<a;o+=2)if(e[r]===t[o]&&e[r+1]===t[o+1]&&e[(r+2)%i]===t[(o+a-2)%a]&&e[(r+3)%i]===t[(o+a-1)%a]){yield n;break t}}}_cell(t){const{circumcenters:e,delaunay:{inedges:n,halfedges:r,triangles:i}}=this,o=n[t];if(-1===o)return null;const a=[];let s=o;do{const n=Math.floor(s/3);if(a.push(e[2*n],e[2*n+1]),s=s%3==2?s-2:s+1,i[s]!==t)break;s=r[s]}while(s!==o&&-1!==s);return a}_clip(t){if(0===t&&1===this.delaunay.hull.length)return[this.xmax,this.ymin,this.xmax,this.ymax,this.xmin,this.ymax,this.xmin,this.ymin];const e=this._cell(t);if(null===e)return null;const{vectors:n}=this,r=4*t;return this._simplify(n[r]||n[r+1]?this._clipInfinite(t,e,n[r],n[r+1],n[r+2],n[r+3]):this._clipFinite(t,e))}_clipFinite(t,e){const n=e.length;let r,i,o,a,s=null,l=e[n-2],c=e[n-1],u=this._regioncode(l,c),h=0;for(let f=0;f<n;f+=2)if(r=l,i=c,l=e[f],c=e[f+1],o=u,u=this._regioncode(l,c),0===o&&0===u)a=h,h=0,s?s.push(l,c):s=[l,c];else{let e,n,f,d,p;if(0===o){if(null===(e=this._clipSegment(r,i,l,c,o,u)))continue;[n,f,d,p]=e}else{if(null===(e=this._clipSegment(l,c,r,i,u,o)))continue;[d,p,n,f]=e,a=h,h=this._edgecode(n,f),a&&h&&this._edge(t,a,h,s,s.length),s?s.push(n,f):s=[n,f]}a=h,h=this._edgecode(d,p),a&&h&&this._edge(t,a,h,s,s.length),s?s.push(d,p):s=[d,p]}if(s)a=h,h=this._edgecode(s[0],s[1]),a&&h&&this._edge(t,a,h,s,s.length);else if(this.contains(t,(this.xmin+this.xmax)/2,(this.ymin+this.ymax)/2))return[this.xmax,this.ymin,this.xmax,this.ymax,this.xmin,this.ymax,this.xmin,this.ymin];return s}_clipSegment(t,e,n,r,i,o){const a=i<o;for(a&&([t,e,n,r,i,o]=[n,r,t,e,o,i]);;){if(0===i&&0===o)return a?[n,r,t,e]:[t,e,n,r];if(i&o)return null;let s,l,c=i||o;8&c?(s=t+(n-t)*(this.ymax-e)/(r-e),l=this.ymax):4&c?(s=t+(n-t)*(this.ymin-e)/(r-e),l=this.ymin):2&c?(l=e+(r-e)*(this.xmax-t)/(n-t),s=this.xmax):(l=e+(r-e)*(this.xmin-t)/(n-t),s=this.xmin),i?(t=s,e=l,i=this._regioncode(t,e)):(n=s,r=l,o=this._regioncode(n,r))}}_clipInfinite(t,e,n,r,i,o){let a,s=Array.from(e);if((a=this._project(s[0],s[1],n,r))&&s.unshift(a[0],a[1]),(a=this._project(s[s.length-2],s[s.length-1],i,o))&&s.push(a[0],a[1]),s=this._clipFinite(t,s))for(let e,n=0,r=s.length,i=this._edgecode(s[r-2],s[r-1]);n<r;n+=2)e=i,i=this._edgecode(s[n],s[n+1]),e&&i&&(n=this._edge(t,e,i,s,n),r=s.length);else this.contains(t,(this.xmin+this.xmax)/2,(this.ymin+this.ymax)/2)&&(s=[this.xmin,this.ymin,this.xmax,this.ymin,this.xmax,this.ymax,this.xmin,this.ymax]);return s}_edge(t,e,n,r,i){for(;e!==n;){let n,o;switch(e){case 5:e=4;continue;case 4:e=6,n=this.xmax,o=this.ymin;break;case 6:e=2;continue;case 2:e=10,n=this.xmax,o=this.ymax;break;case 10:e=8;continue;case 8:e=9,n=this.xmin,o=this.ymax;break;case 9:e=1;continue;case 1:e=5,n=this.xmin,o=this.ymin}r[i]===n&&r[i+1]===o||!this.contains(t,n,o)||(r.splice(i,0,n,o),i+=2)}return i}_project(t,e,n,r){let i,o,a,s=1/0;if(r<0){if(e<=this.ymin)return null;(i=(this.ymin-e)/r)<s&&(a=this.ymin,o=t+(s=i)*n)}else if(r>0){if(e>=this.ymax)return null;(i=(this.ymax-e)/r)<s&&(a=this.ymax,o=t+(s=i)*n)}if(n>0){if(t>=this.xmax)return null;(i=(this.xmax-t)/n)<s&&(o=this.xmax,a=e+(s=i)*r)}else if(n<0){if(t<=this.xmin)return null;(i=(this.xmin-t)/n)<s&&(o=this.xmin,a=e+(s=i)*r)}return[o,a]}_edgecode(t,e){return(t===this.xmin?1:t===this.xmax?2:0)|(e===this.ymin?4:e===this.ymax?8:0)}_regioncode(t,e){return(t<this.xmin?1:t>this.xmax?2:0)|(e<this.ymin?4:e>this.ymax?8:0)}_simplify(t){if(t&&t.length>4){for(let e=0;e<t.length;e+=2){const n=(e+2)%t.length,r=(e+4)%t.length;(t[e]===t[n]&&t[n]===t[r]||t[e+1]===t[n+1]&&t[n+1]===t[r+1])&&(t.splice(n,2),e-=2)}t.length||(t=null)}return t}}const ws=2*Math.PI,Es=Math.pow;function As(t){return t[0]}function Ts(t){return t[1]}function Cs(t,e,n){return[t+Math.sin(t+e)*n,e+Math.cos(t-e)*n]}class Ss{static from(t,e=As,n=Ts,r){return new Ss("length"in t?function(t,e,n,r){const i=t.length,o=new Float64Array(2*i);for(let a=0;a<i;++a){const i=t[a];o[2*a]=e.call(r,i,a,t),o[2*a+1]=n.call(r,i,a,t)}return o}(t,e,n,r):Float64Array.from(function*(t,e,n,r){let i=0;for(const o of t)yield e.call(r,o,i,t),yield n.call(r,o,i,t),++i}(t,e,n,r)))}constructor(t){this._delaunator=new us(t),this.inedges=new Int32Array(t.length/2),this._hullIndex=new Int32Array(t.length/2),this.points=this._delaunator.coords,this._init()}update(){return this._delaunator.update(),this._init(),this}_init(){const t=this._delaunator,e=this.points;if(t.hull&&t.hull.length>2&&function(t){const{triangles:e,coords:n}=t;for(let t=0;t<e.length;t+=3){const r=2*e[t],i=2*e[t+1],o=2*e[t+2];if((n[o]-n[r])*(n[i+1]-n[r+1])-(n[i]-n[r])*(n[o+1]-n[r+1])>1e-10)return!1}return!0}(t)){this.collinear=Int32Array.from({length:e.length/2},(t,e)=>e).sort((t,n)=>e[2*t]-e[2*n]||e[2*t+1]-e[2*n+1]);const t=this.collinear[0],n=this.collinear[this.collinear.length-1],r=[e[2*t],e[2*t+1],e[2*n],e[2*n+1]],i=1e-8*Math.hypot(r[3]-r[1],r[2]-r[0]);for(let t=0,n=e.length/2;t<n;++t){const n=Cs(e[2*t],e[2*t+1],i);e[2*t]=n[0],e[2*t+1]=n[1]}this._delaunator=new us(e)}else delete this.collinear;const n=this.halfedges=this._delaunator.halfedges,r=this.hull=this._delaunator.hull,i=this.triangles=this._delaunator.triangles,o=this.inedges.fill(-1),a=this._hullIndex.fill(-1);for(let t=0,e=n.length;t<e;++t){const e=i[t%3==2?t-2:t+1];-1!==n[t]&&-1!==o[e]||(o[e]=t)}for(let t=0,e=r.length;t<e;++t)a[r[t]]=t;r.length<=2&&r.length>0&&(this.triangles=new Int32Array(3).fill(-1),this.halfedges=new Int32Array(3).fill(-1),this.triangles[0]=r[0],o[r[0]]=1,2===r.length&&(o[r[1]]=0,this.triangles[1]=r[1],this.triangles[2]=r[1]))}voronoi(t){return new xs(this,t)}*neighbors(t){const{inedges:e,hull:n,_hullIndex:r,halfedges:i,triangles:o,collinear:a}=this;if(a){const e=a.indexOf(t);return e>0&&(yield a[e-1]),void(e<a.length-1&&(yield a[e+1]))}const s=e[t];if(-1===s)return;let l=s,c=-1;do{if(yield c=o[l],l=l%3==2?l-2:l+1,o[l]!==t)return;if(l=i[l],-1===l){const e=n[(r[t]+1)%n.length];return void(e!==c&&(yield e))}}while(l!==s)}find(t,e,n=0){if((t=+t)!=t||(e=+e)!=e)return-1;const r=n;let i;for(;(i=this._step(n,t,e))>=0&&i!==n&&i!==r;)n=i;return i}_step(t,e,n){const{inedges:r,hull:i,_hullIndex:o,halfedges:a,triangles:s,points:l}=this;if(-1===r[t]||!l.length)return(t+1)%(l.length>>1);let c=t,u=Es(e-l[2*t],2)+Es(n-l[2*t+1],2);const h=r[t];let f=h;do{let r=s[f];const h=Es(e-l[2*r],2)+Es(n-l[2*r+1],2);if(h<u&&(u=h,c=r),f=f%3==2?f-2:f+1,s[f]!==t)break;if(f=a[f],-1===f){if(f=i[(o[t]+1)%i.length],f!==r&&Es(e-l[2*f],2)+Es(n-l[2*f+1],2)<u)return f;break}}while(f!==h);return c}render(t){const e=null==t?t=new bs:void 0,{points:n,halfedges:r,triangles:i}=this;for(let e=0,o=r.length;e<o;++e){const o=r[e];if(o<e)continue;const a=2*i[e],s=2*i[o];t.moveTo(n[a],n[a+1]),t.lineTo(n[s],n[s+1])}return this.renderHull(t),e&&e.value()}renderPoints(t,e){void 0!==e||t&&"function"==typeof t.moveTo||(e=t,t=null),e=null==e?2:+e;const n=null==t?t=new bs:void 0,{points:r}=this;for(let n=0,i=r.length;n<i;n+=2){const i=r[n],o=r[n+1];t.moveTo(i+e,o),t.arc(i,o,e,0,ws)}return n&&n.value()}renderHull(t){const e=null==t?t=new bs:void 0,{hull:n,points:r}=this,i=2*n[0],o=n.length;t.moveTo(r[i],r[i+1]);for(let e=1;e<o;++e){const i=2*n[e];t.lineTo(r[i],r[i+1])}return t.closePath(),e&&e.value()}hullPolygon(){const t=new vs;return this.renderHull(t),t.value()}renderTriangle(t,e){const n=null==e?e=new bs:void 0,{points:r,triangles:i}=this,o=2*i[t*=3],a=2*i[t+1],s=2*i[t+2];return e.moveTo(r[o],r[o+1]),e.lineTo(r[a],r[a+1]),e.lineTo(r[s],r[s+1]),e.closePath(),n&&n.value()}*trianglePolygons(){const{triangles:t}=this;for(let e=0,n=t.length/3;e<n;++e)yield this.trianglePolygon(e)}trianglePolygon(t){const e=new vs;return this.renderTriangle(t,e),e.value()}}var ks={},Ms={};function Rs(t){return new Function("d","return {"+t.map(function(t,e){return JSON.stringify(t)+": d["+e+'] || ""'}).join(",")+"}")}function Os(t){var e=Object.create(null),n=[];return t.forEach(function(t){for(var r in t)r in e||n.push(e[r]=r)}),n}function Ns(t,e){var n=t+"",r=n.length;return r<e?new Array(e-r+1).join(0)+n:n}function Is(t){var e,n=t.getUTCHours(),r=t.getUTCMinutes(),i=t.getUTCSeconds(),o=t.getUTCMilliseconds();return isNaN(t)?"Invalid Date":((e=t.getUTCFullYear())<0?"-"+Ns(-e,6):e>9999?"+"+Ns(e,6):Ns(e,4))+"-"+Ns(t.getUTCMonth()+1,2)+"-"+Ns(t.getUTCDate(),2)+(o?"T"+Ns(n,2)+":"+Ns(r,2)+":"+Ns(i,2)+"."+Ns(o,3)+"Z":i?"T"+Ns(n,2)+":"+Ns(r,2)+":"+Ns(i,2)+"Z":r||n?"T"+Ns(n,2)+":"+Ns(r,2)+"Z":"")}function Ls(t){var e=new RegExp('["'+t+"\n\r]"),n=t.charCodeAt(0);function r(t,e){var r,i=[],o=t.length,a=0,s=0,l=o<=0,c=!1;function u(){if(l)return Ms;if(c)return c=!1,ks;var e,r,i=a;if(34===t.charCodeAt(i)){for(;a++<o&&34!==t.charCodeAt(a)||34===t.charCodeAt(++a););return(e=a)>=o?l=!0:10===(r=t.charCodeAt(a++))?c=!0:13===r&&(c=!0,10===t.charCodeAt(a)&&++a),t.slice(i+1,e-1).replace(/""/g,'"')}for(;a<o;){if(10===(r=t.charCodeAt(e=a++)))c=!0;else if(13===r)c=!0,10===t.charCodeAt(a)&&++a;else if(r!==n)continue;return t.slice(i,e)}return l=!0,t.slice(i,o)}for(10===t.charCodeAt(o-1)&&--o,13===t.charCodeAt(o-1)&&--o;(r=u())!==Ms;){for(var h=[];r!==ks&&r!==Ms;)h.push(r),r=u();e&&null==(h=e(h,s++))||i.push(h)}return i}function i(e,n){return e.map(function(e){return n.map(function(t){return a(e[t])}).join(t)})}function o(e){return e.map(a).join(t)}function a(t){return null==t?"":t instanceof Date?Is(t):e.test(t+="")?'"'+t.replace(/"/g,'""')+'"':t}return{parse:function(t,e){var n,i,o=r(t,function(t,r){if(n)return n(t,r-1);i=t,n=e?function(t,e){var n=Rs(t);return function(r,i){return e(n(r),i,t)}}(t,e):Rs(t)});return o.columns=i||[],o},parseRows:r,format:function(e,n){return null==n&&(n=Os(e)),[n.map(a).join(t)].concat(i(e,n)).join("\n")},formatBody:function(t,e){return null==e&&(e=Os(t)),i(t,e).join("\n")},formatRows:function(t){return t.map(o).join("\n")},formatRow:o,formatValue:a}}var Ps=Ls(","),Vs=Ps.parse,Ds=Ps.parseRows,Bs=Ps.format,zs=Ps.formatBody,Fs=Ps.formatRows,Gs=Ps.formatRow,js=Ps.formatValue,Us=Ls("\t"),Ys=Us.parse,Hs=Us.parseRows,qs=Us.format,Ws=Us.formatBody,$s=Us.formatRows,Xs=Us.formatRow,Ks=Us.formatValue;function Zs(t){for(var e in t){var n,r,i=t[e].trim();if(i)if("true"===i)i=!0;else if("false"===i)i=!1;else if("NaN"===i)i=NaN;else if(isNaN(n=+i)){if(!(r=i.match(/^([-+]\d{2})?\d{4}(-\d{2}(-\d{2})?)?(T\d{2}:\d{2}(:\d{2}(\.\d{3})?)?(Z|[-+]\d{2}:\d{2})?)?$/)))continue;Js&&r[4]&&!r[7]&&(i=i.replace(/-/g,"/").replace(/T/," ")),i=new Date(i)}else i=n;else i=null;t[e]=i}return t}const Js=new Date("2019-01-01T00:00").getHours()||new Date("2019-07-01T00:00").getHours();function Qs(t){if(!t.ok)throw new Error(t.status+" "+t.statusText);return t.blob()}function tl(t){if(!t.ok)throw new Error(t.status+" "+t.statusText);return t.arrayBuffer()}function el(t){if(!t.ok)throw new Error(t.status+" "+t.statusText);return t.text()}function nl(t,e){return fetch(t,e).then(el)}function rl(t){return function(e,n,r){return 2===arguments.length&&"function"==typeof n&&(r=n,n=void 0),nl(e,n).then(function(e){return t(e,r)})}}var il=rl(Vs),ol=rl(Ys);function al(t){if(!t.ok)throw new Error(t.status+" "+t.statusText);if(204!==t.status&&205!==t.status)return t.json()}function sl(t){return(e,n)=>nl(e,n).then(e=>(new DOMParser).parseFromString(e,t))}var ll=sl("application/xml"),cl=sl("text/html"),ul=sl("image/svg+xml");function hl(t,e){var n,r=1;function i(){var i,o,a=n.length,s=0,l=0;for(i=0;i<a;++i)s+=(o=n[i]).x,l+=o.y;for(s=(s/a-t)*r,l=(l/a-e)*r,i=0;i<a;++i)(o=n[i]).x-=s,o.y-=l}return null==t&&(t=0),null==e&&(e=0),i.initialize=function(t){n=t},i.x=function(e){return arguments.length?(t=+e,i):t},i.y=function(t){return arguments.length?(e=+t,i):e},i.strength=function(t){return arguments.length?(r=+t,i):r},i}function fl(t,e,n,r){if(isNaN(e)||isNaN(n))return t;var i,o,a,s,l,c,u,h,f,d=t._root,p={data:r},g=t._x0,_=t._y0,y=t._x1,m=t._y1;if(!d)return t._root=p,t;for(;d.length;)if((c=e>=(o=(g+y)/2))?g=o:y=o,(u=n>=(a=(_+m)/2))?_=a:m=a,i=d,!(d=d[h=u<<1|c]))return i[h]=p,t;if(s=+t._x.call(null,d.data),l=+t._y.call(null,d.data),e===s&&n===l)return p.next=d,i?i[h]=p:t._root=p,t;do{i=i?i[h]=new Array(4):t._root=new Array(4),(c=e>=(o=(g+y)/2))?g=o:y=o,(u=n>=(a=(_+m)/2))?_=a:m=a}while((h=u<<1|c)==(f=(l>=a)<<1|s>=o));return i[f]=d,i[h]=p,t}function dl(t,e,n,r,i){this.node=t,this.x0=e,this.y0=n,this.x1=r,this.y1=i}function pl(t){return t[0]}function gl(t){return t[1]}function _l(t,e,n){var r=new yl(null==e?pl:e,null==n?gl:n,NaN,NaN,NaN,NaN);return null==t?r:r.addAll(t)}function yl(t,e,n,r,i,o){this._x=t,this._y=e,this._x0=n,this._y0=r,this._x1=i,this._y1=o,this._root=void 0}function ml(t){for(var e={data:t.data},n=e;t=t.next;)n=n.next={data:t.data};return e}var bl=_l.prototype=yl.prototype;function vl(t){return function(){return t}}function xl(t){return 1e-6*(t()-.5)}function wl(t){return t.x+t.vx}function El(t){return t.y+t.vy}function Al(t){return t.index}function Tl(t,e){var n=t.get(e);if(!n)throw new Error("node not found: "+e);return n}function Cl(t){var e,n,r,i,o,a,s=Al,l=function(t){return 1/Math.min(i[t.source.index],i[t.target.index])},c=vl(30),u=1;function h(r){for(var i=0,s=t.length;i<u;++i)for(var l,c,h,f,d,p,g,_=0;_<s;++_)c=(l=t[_]).source,f=(h=l.target).x+h.vx-c.x-c.vx||xl(a),d=h.y+h.vy-c.y-c.vy||xl(a),f*=p=((p=Math.sqrt(f*f+d*d))-n[_])/p*r*e[_],d*=p,h.vx-=f*(g=o[_]),h.vy-=d*g,c.vx+=f*(g=1-g),c.vy+=d*g}function f(){if(r){var a,l,c=r.length,u=t.length,h=new Map(r.map((t,e)=>[s(t,e,r),t]));for(a=0,i=new Array(c);a<u;++a)(l=t[a]).index=a,"object"!=typeof l.source&&(l.source=Tl(h,l.source)),"object"!=typeof l.target&&(l.target=Tl(h,l.target)),i[l.source.index]=(i[l.source.index]||0)+1,i[l.target.index]=(i[l.target.index]||0)+1;for(a=0,o=new Array(u);a<u;++a)l=t[a],o[a]=i[l.source.index]/(i[l.source.index]+i[l.target.index]);e=new Array(u),d(),n=new Array(u),p()}}function d(){if(r)for(var n=0,i=t.length;n<i;++n)e[n]=+l(t[n],n,t)}function p(){if(r)for(var e=0,i=t.length;e<i;++e)n[e]=+c(t[e],e,t)}return null==t&&(t=[]),h.initialize=function(t,e){r=t,a=e,f()},h.links=function(e){return arguments.length?(t=e,f(),h):t},h.id=function(t){return arguments.length?(s=t,h):s},h.iterations=function(t){return arguments.length?(u=+t,h):u},h.strength=function(t){return arguments.length?(l="function"==typeof t?t:vl(+t),d(),h):l},h.distance=function(t){return arguments.length?(c="function"==typeof t?t:vl(+t),p(),h):c},h}bl.copy=function(){var t,e,n=new yl(this._x,this._y,this._x0,this._y0,this._x1,this._y1),r=this._root;if(!r)return n;if(!r.length)return n._root=ml(r),n;for(t=[{source:r,target:n._root=new Array(4)}];r=t.pop();)for(var i=0;i<4;++i)(e=r.source[i])&&(e.length?t.push({source:e,target:r.target[i]=new Array(4)}):r.target[i]=ml(e));return n},bl.add=function(t){const e=+this._x.call(null,t),n=+this._y.call(null,t);return fl(this.cover(e,n),e,n,t)},bl.addAll=function(t){var e,n,r,i,o=t.length,a=new Array(o),s=new Array(o),l=1/0,c=1/0,u=-1/0,h=-1/0;for(n=0;n<o;++n)isNaN(r=+this._x.call(null,e=t[n]))||isNaN(i=+this._y.call(null,e))||(a[n]=r,s[n]=i,r<l&&(l=r),r>u&&(u=r),i<c&&(c=i),i>h&&(h=i));if(l>u||c>h)return this;for(this.cover(l,c).cover(u,h),n=0;n<o;++n)fl(this,a[n],s[n],t[n]);return this},bl.cover=function(t,e){if(isNaN(t=+t)||isNaN(e=+e))return this;var n=this._x0,r=this._y0,i=this._x1,o=this._y1;if(isNaN(n))i=(n=Math.floor(t))+1,o=(r=Math.floor(e))+1;else{for(var a,s,l=i-n||1,c=this._root;n>t||t>=i||r>e||e>=o;)switch(s=(e<r)<<1|t<n,(a=new Array(4))[s]=c,c=a,l*=2,s){case 0:i=n+l,o=r+l;break;case 1:n=i-l,o=r+l;break;case 2:i=n+l,r=o-l;break;case 3:n=i-l,r=o-l}this._root&&this._root.length&&(this._root=c)}return this._x0=n,this._y0=r,this._x1=i,this._y1=o,this},bl.data=function(){var t=[];return this.visit(function(e){if(!e.length)do{t.push(e.data)}while(e=e.next)}),t},bl.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]]},bl.find=function(t,e,n){var r,i,o,a,s,l,c,u=this._x0,h=this._y0,f=this._x1,d=this._y1,p=[],g=this._root;for(g&&p.push(new dl(g,u,h,f,d)),null==n?n=1/0:(u=t-n,h=e-n,f=t+n,d=e+n,n*=n);l=p.pop();)if(!(!(g=l.node)||(i=l.x0)>f||(o=l.y0)>d||(a=l.x1)<u||(s=l.y1)<h))if(g.length){var _=(i+a)/2,y=(o+s)/2;p.push(new dl(g[3],_,y,a,s),new dl(g[2],i,y,_,s),new dl(g[1],_,o,a,y),new dl(g[0],i,o,_,y)),(c=(e>=y)<<1|t>=_)&&(l=p[p.length-1],p[p.length-1]=p[p.length-1-c],p[p.length-1-c]=l)}else{var m=t-+this._x.call(null,g.data),b=e-+this._y.call(null,g.data),v=m*m+b*b;if(v<n){var x=Math.sqrt(n=v);u=t-x,h=e-x,f=t+x,d=e+x,r=g.data}}return r},bl.remove=function(t){if(isNaN(o=+this._x.call(null,t))||isNaN(a=+this._y.call(null,t)))return this;var e,n,r,i,o,a,s,l,c,u,h,f,d=this._root,p=this._x0,g=this._y0,_=this._x1,y=this._y1;if(!d)return this;if(d.length)for(;;){if((c=o>=(s=(p+_)/2))?p=s:_=s,(u=a>=(l=(g+y)/2))?g=l:y=l,e=d,!(d=d[h=u<<1|c]))return this;if(!d.length)break;(e[h+1&3]||e[h+2&3]||e[h+3&3])&&(n=e,f=h)}for(;d.data!==t;)if(r=d,!(d=d.next))return this;return(i=d.next)&&delete d.next,r?(i?r.next=i:delete r.next,this):e?(i?e[h]=i:delete e[h],(d=e[0]||e[1]||e[2]||e[3])&&d===(e[3]||e[2]||e[1]||e[0])&&!d.length&&(n?n[f]=d:this._root=d),this):(this._root=i,this)},bl.removeAll=function(t){for(var e=0,n=t.length;e<n;++e)this.remove(t[e]);return this},bl.root=function(){return this._root},bl.size=function(){var t=0;return this.visit(function(e){if(!e.length)do{++t}while(e=e.next)}),t},bl.visit=function(t){var e,n,r,i,o,a,s=[],l=this._root;for(l&&s.push(new dl(l,this._x0,this._y0,this._x1,this._y1));e=s.pop();)if(!t(l=e.node,r=e.x0,i=e.y0,o=e.x1,a=e.y1)&&l.length){var c=(r+o)/2,u=(i+a)/2;(n=l[3])&&s.push(new dl(n,c,u,o,a)),(n=l[2])&&s.push(new dl(n,r,u,c,a)),(n=l[1])&&s.push(new dl(n,c,i,o,u)),(n=l[0])&&s.push(new dl(n,r,i,c,u))}return this},bl.visitAfter=function(t){var e,n=[],r=[];for(this._root&&n.push(new dl(this._root,this._x0,this._y0,this._x1,this._y1));e=n.pop();){var i=e.node;if(i.length){var o,a=e.x0,s=e.y0,l=e.x1,c=e.y1,u=(a+l)/2,h=(s+c)/2;(o=i[0])&&n.push(new dl(o,a,s,u,h)),(o=i[1])&&n.push(new dl(o,u,s,l,h)),(o=i[2])&&n.push(new dl(o,a,h,u,c)),(o=i[3])&&n.push(new dl(o,u,h,l,c))}r.push(e)}for(;e=r.pop();)t(e.node,e.x0,e.y0,e.x1,e.y1);return this},bl.x=function(t){return arguments.length?(this._x=t,this):this._x},bl.y=function(t){return arguments.length?(this._y=t,this):this._y};const Sl=4294967296;function kl(t){return t.x}function Ml(t){return t.y}var Rl=Math.PI*(3-Math.sqrt(5));function Ol(t){var e,n=1,r=.001,i=1-Math.pow(r,1/300),o=0,a=.6,s=new Map,l=Ti(h),c=Nt("tick","end"),u=function(){let t=1;return()=>(t=(1664525*t+1013904223)%Sl)/Sl}();function h(){f(),c.call("tick",e),n<r&&(l.stop(),c.call("end",e))}function f(r){var l,c,u=t.length;void 0===r&&(r=1);for(var h=0;h<r;++h)for(n+=(o-n)*i,s.forEach(function(t){t(n)}),l=0;l<u;++l)null==(c=t[l]).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 e}function d(){for(var e,n=0,r=t.length;n<r;++n){if((e=t[n]).index=n,null!=e.fx&&(e.x=e.fx),null!=e.fy&&(e.y=e.fy),isNaN(e.x)||isNaN(e.y)){var i=10*Math.sqrt(.5+n),o=n*Rl;e.x=i*Math.cos(o),e.y=i*Math.sin(o)}(isNaN(e.vx)||isNaN(e.vy))&&(e.vx=e.vy=0)}}function p(e){return e.initialize&&e.initialize(t,u),e}return null==t&&(t=[]),d(),e={tick:f,restart:function(){return l.restart(h),e},stop:function(){return l.stop(),e},nodes:function(n){return arguments.length?(t=n,d(),s.forEach(p),e):t},alpha:function(t){return arguments.length?(n=+t,e):n},alphaMin:function(t){return arguments.length?(r=+t,e):r},alphaDecay:function(t){return arguments.length?(i=+t,e):+i},alphaTarget:function(t){return arguments.length?(o=+t,e):o},velocityDecay:function(t){return arguments.length?(a=1-t,e):1-a},randomSource:function(t){return arguments.length?(u=t,s.forEach(p),e):u},force:function(t,n){return arguments.length>1?(null==n?s.delete(t):s.set(t,p(n)),e):s.get(t)},find:function(e,n,r){var i,o,a,s,l,c=0,u=t.length;for(null==r?r=1/0:r*=r,c=0;c<u;++c)(a=(i=e-(s=t[c]).x)*i+(o=n-s.y)*o)<r&&(l=s,r=a);return l},on:function(t,n){return arguments.length>1?(c.on(t,n),e):c.on(t)}}}function Nl(){var t,e,n,r,i,o=vl(-30),a=1,s=1/0,l=.81;function c(n){var i,o=t.length,a=_l(t,kl,Ml).visitAfter(h);for(r=n,i=0;i<o;++i)e=t[i],a.visit(f)}function u(){if(t){var e,n,r=t.length;for(i=new Array(r),e=0;e<r;++e)n=t[e],i[n.index]=+o(n,e,t)}}function h(t){var e,n,r,o,a,s=0,l=0;if(t.length){for(r=o=a=0;a<4;++a)(e=t[a])&&(n=Math.abs(e.value))&&(s+=e.value,l+=n,r+=n*e.x,o+=n*e.y);t.x=r/l,t.y=o/l}else{(e=t).x=e.data.x,e.y=e.data.y;do{s+=i[e.data.index]}while(e=e.next)}t.value=s}function f(t,o,c,u){if(!t.value)return!0;var h=t.x-e.x,f=t.y-e.y,d=u-o,p=h*h+f*f;if(d*d/l<p)return p<s&&(0===h&&(p+=(h=xl(n))*h),0===f&&(p+=(f=xl(n))*f),p<a&&(p=Math.sqrt(a*p)),e.vx+=h*t.value*r/p,e.vy+=f*t.value*r/p),!0;if(!(t.length||p>=s)){(t.data!==e||t.next)&&(0===h&&(p+=(h=xl(n))*h),0===f&&(p+=(f=xl(n))*f),p<a&&(p=Math.sqrt(a*p)));do{t.data!==e&&(d=i[t.data.index]*r/p,e.vx+=h*d,e.vy+=f*d)}while(t=t.next)}}return c.initialize=function(e,r){t=e,n=r,u()},c.strength=function(t){return arguments.length?(o="function"==typeof t?t:vl(+t),u(),c):o},c.distanceMin=function(t){return arguments.length?(a=t*t,c):Math.sqrt(a)},c.distanceMax=function(t){return arguments.length?(s=t*t,c):Math.sqrt(s)},c.theta=function(t){return arguments.length?(l=t*t,c):Math.sqrt(l)},c}function Il(t){var e,n,r,i=vl(.1);function o(t){for(var i,o=0,a=e.length;o<a;++o)(i=e[o]).vx+=(r[o]-i.x)*n[o]*t}function a(){if(e){var o,a=e.length;for(n=new Array(a),r=new Array(a),o=0;o<a;++o)n[o]=isNaN(r[o]=+t(e[o],o,e))?0:+i(e[o],o,e)}}return"function"!=typeof t&&(t=vl(null==t?0:+t)),o.initialize=function(t){e=t,a()},o.strength=function(t){return arguments.length?(i="function"==typeof t?t:vl(+t),a(),o):i},o.x=function(e){return arguments.length?(t="function"==typeof e?e:vl(+e),a(),o):t},o}function Ll(t){var e,n,r,i=vl(.1);function o(t){for(var i,o=0,a=e.length;o<a;++o)(i=e[o]).vy+=(r[o]-i.y)*n[o]*t}function a(){if(e){var o,a=e.length;for(n=new Array(a),r=new Array(a),o=0;o<a;++o)n[o]=isNaN(r[o]=+t(e[o],o,e))?0:+i(e[o],o,e)}}return"function"!=typeof t&&(t=vl(null==t?0:+t)),o.initialize=function(t){e=t,a()},o.strength=function(t){return arguments.length?(i="function"==typeof t?t:vl(+t),a(),o):i},o.y=function(e){return arguments.length?(t="function"==typeof e?e:vl(+e),a(),o):t},o}function Pl(t,e){if((n=(t=e?t.toExponential(e-1):t.toExponential()).indexOf("e"))<0)return null;var n,r=t.slice(0,n);return[r.length>1?r[0]+r.slice(2):r,+t.slice(n+1)]}function Vl(t){return(t=Pl(Math.abs(t)))?t[1]:NaN}var Dl,Bl=/^(?:(.)?([<>=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i;function zl(t){if(!(e=Bl.exec(t)))throw new Error("invalid format: "+t);var e;return new Fl({fill:e[1],align:e[2],sign:e[3],symbol:e[4],zero:e[5],width:e[6],comma:e[7],precision:e[8]&&e[8].slice(1),trim:e[9],type:e[10]})}function Fl(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 Gl(t,e){var n=Pl(t,e);if(!n)return t+"";var r=n[0],i=n[1];return i<0?"0."+new Array(-i).join("0")+r:r.length>i+1?r.slice(0,i+1)+"."+r.slice(i+1):r+new Array(i-r.length+2).join("0")}zl.prototype=Fl.prototype,Fl.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 jl={"%":(t,e)=>(100*t).toFixed(e),b:t=>Math.round(t).toString(2),c:t=>t+"",d:function(t){return Math.abs(t=Math.round(t))>=1e21?t.toLocaleString("en").replace(/,/g,""):t.toString(10)},e:(t,e)=>t.toExponential(e),f:(t,e)=>t.toFixed(e),g:(t,e)=>t.toPrecision(e),o:t=>Math.round(t).toString(8),p:(t,e)=>Gl(100*t,e),r:Gl,s:function(t,e){var n=Pl(t,e);if(!n)return t+"";var r=n[0],i=n[1],o=i-(Dl=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")+Pl(t,Math.max(0,e+o-1))[0]},X:t=>Math.round(t).toString(16).toUpperCase(),x:t=>Math.round(t).toString(16)};function Ul(t){return t}var Yl,Hl,ql,Wl=Array.prototype.map,$l=["y","z","a","f","p","n","µ","m","","k","M","G","T","P","E","Z","Y"];function Xl(t){var e,n,r=void 0===t.grouping||void 0===t.thousands?Ul:(e=Wl.call(t.grouping,Number),n=t.thousands+"",function(t,r){for(var i=t.length,o=[],a=0,s=e[0],l=0;i>0&&s>0&&(l+s+1>r&&(s=Math.max(1,r-l)),o.push(t.substring(i-=s,i+s)),!((l+=s+1)>r));)s=e[a=(a+1)%e.length];return o.reverse().join(n)}),i=void 0===t.currency?"":t.currency[0]+"",o=void 0===t.currency?"":t.currency[1]+"",a=void 0===t.decimal?".":t.decimal+"",s=void 0===t.numerals?Ul:function(t){return function(e){return e.replace(/[0-9]/g,function(e){return t[+e]})}}(Wl.call(t.numerals,String)),l=void 0===t.percent?"%":t.percent+"",c=void 0===t.minus?"−":t.minus+"",u=void 0===t.nan?"NaN":t.nan+"";function h(t){var e=(t=zl(t)).fill,n=t.align,h=t.sign,f=t.symbol,d=t.zero,p=t.width,g=t.comma,_=t.precision,y=t.trim,m=t.type;"n"===m?(g=!0,m="g"):jl[m]||(void 0===_&&(_=12),y=!0,m="g"),(d||"0"===e&&"="===n)&&(d=!0,e="0",n="=");var b="$"===f?i:"#"===f&&/[boxX]/.test(m)?"0"+m.toLowerCase():"",v="$"===f?o:/[%p]/.test(m)?l:"",x=jl[m],w=/[defgprs%]/.test(m);function E(t){var i,o,l,f=b,E=v;if("c"===m)E=x(t)+E,t="";else{var A=(t=+t)<0||1/t<0;if(t=isNaN(t)?u:x(Math.abs(t),_),y&&(t=function(t){t:for(var e,n=t.length,r=1,i=-1;r<n;++r)switch(t[r]){case".":i=e=r;break;case"0":0===i&&(i=r),e=r;break;default:if(!+t[r])break t;i>0&&(i=0)}return i>0?t.slice(0,i)+t.slice(e+1):t}(t)),A&&0===+t&&"+"!==h&&(A=!1),f=(A?"("===h?h:c:"-"===h||"("===h?"":h)+f,E=("s"===m?$l[8+Dl/3]:"")+E+(A&&"("===h?")":""),w)for(i=-1,o=t.length;++i<o;)if(48>(l=t.charCodeAt(i))||l>57){E=(46===l?a+t.slice(i+1):t.slice(i))+E,t=t.slice(0,i);break}}g&&!d&&(t=r(t,1/0));var T=f.length+t.length+E.length,C=T<p?new Array(p-T+1).join(e):"";switch(g&&d&&(t=r(C+t,C.length?p-E.length:1/0),C=""),n){case"<":t=f+t+E+C;break;case"=":t=f+C+t+E;break;case"^":t=C.slice(0,T=C.length>>1)+f+t+E+C.slice(T);break;default:t=C+f+t+E}return s(t)}return _=void 0===_?6:/[gprs]/.test(m)?Math.max(1,Math.min(21,_)):Math.max(0,Math.min(20,_)),E.toString=function(){return t+""},E}return{format:h,formatPrefix:function(t,e){var n=h(((t=zl(t)).type="f",t)),r=3*Math.max(-8,Math.min(8,Math.floor(Vl(e)/3))),i=Math.pow(10,-r),o=$l[8+r/3];return function(t){return n(i*t)+o}}}}function Kl(t){return Yl=Xl(t),Hl=Yl.format,ql=Yl.formatPrefix,Yl}function Zl(t){return Math.max(0,-Vl(Math.abs(t)))}function Jl(t,e){return Math.max(0,3*Math.max(-8,Math.min(8,Math.floor(Vl(e)/3)))-Vl(Math.abs(t)))}function Ql(t,e){return t=Math.abs(t),e=Math.abs(e)-t,Math.max(0,Vl(e)-Vl(t))+1}Kl({thousands:",",grouping:[3],currency:["$",""]});var tc=1e-6,ec=1e-12,nc=Math.PI,rc=nc/2,ic=nc/4,oc=2*nc,ac=180/nc,sc=nc/180,lc=Math.abs,cc=Math.atan,uc=Math.atan2,hc=Math.cos,fc=Math.ceil,dc=Math.exp,pc=Math.hypot,gc=Math.log,_c=Math.pow,yc=Math.sin,mc=Math.sign||function(t){return t>0?1:t<0?-1:0},bc=Math.sqrt,vc=Math.tan;function xc(t){return t>1?0:t<-1?nc:Math.acos(t)}function wc(t){return t>1?rc:t<-1?-rc:Math.asin(t)}function Ec(t){return(t=yc(t/2))*t}function Ac(){}function Tc(t,e){t&&Sc.hasOwnProperty(t.type)&&Sc[t.type](t,e)}var Cc={Feature:function(t,e){Tc(t.geometry,e)},FeatureCollection:function(t,e){for(var n=t.features,r=-1,i=n.length;++r<i;)Tc(n[r].geometry,e)}},Sc={Sphere:function(t,e){e.sphere()},Point:function(t,e){t=t.coordinates,e.point(t[0],t[1],t[2])},MultiPoint:function(t,e){for(var n=t.coordinates,r=-1,i=n.length;++r<i;)t=n[r],e.point(t[0],t[1],t[2])},LineString:function(t,e){kc(t.coordinates,e,0)},MultiLineString:function(t,e){for(var n=t.coordinates,r=-1,i=n.length;++r<i;)kc(n[r],e,0)},Polygon:function(t,e){Mc(t.coordinates,e)},MultiPolygon:function(t,e){for(var n=t.coordinates,r=-1,i=n.length;++r<i;)Mc(n[r],e)},GeometryCollection:function(t,e){for(var n=t.geometries,r=-1,i=n.length;++r<i;)Tc(n[r],e)}};function kc(t,e,n){var r,i=-1,o=t.length-n;for(e.lineStart();++i<o;)r=t[i],e.point(r[0],r[1],r[2]);e.lineEnd()}function Mc(t,e){var n=-1,r=t.length;for(e.polygonStart();++n<r;)kc(t[n],e,1);e.polygonEnd()}function Rc(t,e){t&&Cc.hasOwnProperty(t.type)?Cc[t.type](t,e):Tc(t,e)}var Oc,Nc,Ic,Lc,Pc,Vc,Dc,Bc,zc,Fc,Gc,jc,Uc,Yc,Hc,qc,Wc=new w,$c=new w,Xc={point:Ac,lineStart:Ac,lineEnd:Ac,polygonStart:function(){Wc=new w,Xc.lineStart=Kc,Xc.lineEnd=Zc},polygonEnd:function(){var t=+Wc;$c.add(t<0?oc+t:t),this.lineStart=this.lineEnd=this.point=Ac},sphere:function(){$c.add(oc)}};function Kc(){Xc.point=Jc}function Zc(){Qc(Oc,Nc)}function Jc(t,e){Xc.point=Qc,Oc=t,Nc=e,Ic=t*=sc,Lc=hc(e=(e*=sc)/2+ic),Pc=yc(e)}function Qc(t,e){var n=(t*=sc)-Ic,r=n>=0?1:-1,i=r*n,o=hc(e=(e*=sc)/2+ic),a=yc(e),s=Pc*a,l=Lc*o+s*hc(i),c=s*r*yc(i);Wc.add(uc(c,l)),Ic=t,Lc=o,Pc=a}function tu(t){return[uc(t[1],t[0]),wc(t[2])]}function eu(t){var e=t[0],n=t[1],r=hc(n);return[r*hc(e),r*yc(e),yc(n)]}function nu(t,e){return t[0]*e[0]+t[1]*e[1]+t[2]*e[2]}function ru(t,e){return[t[1]*e[2]-t[2]*e[1],t[2]*e[0]-t[0]*e[2],t[0]*e[1]-t[1]*e[0]]}function iu(t,e){t[0]+=e[0],t[1]+=e[1],t[2]+=e[2]}function ou(t,e){return[t[0]*e,t[1]*e,t[2]*e]}function au(t){var e=bc(t[0]*t[0]+t[1]*t[1]+t[2]*t[2]);t[0]/=e,t[1]/=e,t[2]/=e}var su,lu,cu,uu,hu,fu,du,pu,gu,_u,yu,mu,bu,vu,xu,wu,Eu={point:Au,lineStart:Cu,lineEnd:Su,polygonStart:function(){Eu.point=ku,Eu.lineStart=Mu,Eu.lineEnd=Ru,Yc=new w,Xc.polygonStart()},polygonEnd:function(){Xc.polygonEnd(),Eu.point=Au,Eu.lineStart=Cu,Eu.lineEnd=Su,Wc<0?(Vc=-(Bc=180),Dc=-(zc=90)):Yc>tc?zc=90:Yc<-1e-6&&(Dc=-90),qc[0]=Vc,qc[1]=Bc},sphere:function(){Vc=-(Bc=180),Dc=-(zc=90)}};function Au(t,e){Hc.push(qc=[Vc=t,Bc=t]),e<Dc&&(Dc=e),e>zc&&(zc=e)}function Tu(t,e){var n=eu([t*sc,e*sc]);if(Uc){var r=ru(Uc,n),i=ru([r[1],-r[0],0],r);au(i),i=tu(i);var o,a=t-Fc,s=a>0?1:-1,l=i[0]*ac*s,c=lc(a)>180;c^(s*Fc<l&&l<s*t)?(o=i[1]*ac)>zc&&(zc=o):c^(s*Fc<(l=(l+360)%360-180)&&l<s*t)?(o=-i[1]*ac)<Dc&&(Dc=o):(e<Dc&&(Dc=e),e>zc&&(zc=e)),c?t<Fc?Ou(Vc,t)>Ou(Vc,Bc)&&(Bc=t):Ou(t,Bc)>Ou(Vc,Bc)&&(Vc=t):Bc>=Vc?(t<Vc&&(Vc=t),t>Bc&&(Bc=t)):t>Fc?Ou(Vc,t)>Ou(Vc,Bc)&&(Bc=t):Ou(t,Bc)>Ou(Vc,Bc)&&(Vc=t)}else Hc.push(qc=[Vc=t,Bc=t]);e<Dc&&(Dc=e),e>zc&&(zc=e),Uc=n,Fc=t}function Cu(){Eu.point=Tu}function Su(){qc[0]=Vc,qc[1]=Bc,Eu.point=Au,Uc=null}function ku(t,e){if(Uc){var n=t-Fc;Yc.add(lc(n)>180?n+(n>0?360:-360):n)}else Gc=t,jc=e;Xc.point(t,e),Tu(t,e)}function Mu(){Xc.lineStart()}function Ru(){ku(Gc,jc),Xc.lineEnd(),lc(Yc)>tc&&(Vc=-(Bc=180)),qc[0]=Vc,qc[1]=Bc,Uc=null}function Ou(t,e){return(e-=t)<0?e+360:e}function Nu(t,e){return t[0]-e[0]}function Iu(t,e){return t[0]<=t[1]?t[0]<=e&&e<=t[1]:e<t[0]||t[1]<e}var Lu={sphere:Ac,point:Pu,lineStart:Du,lineEnd:Fu,polygonStart:function(){Lu.lineStart=Gu,Lu.lineEnd=ju},polygonEnd:function(){Lu.lineStart=Du,Lu.lineEnd=Fu}};function Pu(t,e){t*=sc;var n=hc(e*=sc);Vu(n*hc(t),n*yc(t),yc(e))}function Vu(t,e,n){++su,cu+=(t-cu)/su,uu+=(e-uu)/su,hu+=(n-hu)/su}function Du(){Lu.point=Bu}function Bu(t,e){t*=sc;var n=hc(e*=sc);vu=n*hc(t),xu=n*yc(t),wu=yc(e),Lu.point=zu,Vu(vu,xu,wu)}function zu(t,e){t*=sc;var n=hc(e*=sc),r=n*hc(t),i=n*yc(t),o=yc(e),a=uc(bc((a=xu*o-wu*i)*a+(a=wu*r-vu*o)*a+(a=vu*i-xu*r)*a),vu*r+xu*i+wu*o);lu+=a,fu+=a*(vu+(vu=r)),du+=a*(xu+(xu=i)),pu+=a*(wu+(wu=o)),Vu(vu,xu,wu)}function Fu(){Lu.point=Pu}function Gu(){Lu.point=Uu}function ju(){Yu(mu,bu),Lu.point=Pu}function Uu(t,e){mu=t,bu=e,t*=sc,e*=sc,Lu.point=Yu;var n=hc(e);vu=n*hc(t),xu=n*yc(t),wu=yc(e),Vu(vu,xu,wu)}function Yu(t,e){t*=sc;var n=hc(e*=sc),r=n*hc(t),i=n*yc(t),o=yc(e),a=xu*o-wu*i,s=wu*r-vu*o,l=vu*i-xu*r,c=pc(a,s,l),u=wc(c),h=c&&-u/c;gu.add(h*a),_u.add(h*s),yu.add(h*l),lu+=u,fu+=u*(vu+(vu=r)),du+=u*(xu+(xu=i)),pu+=u*(wu+(wu=o)),Vu(vu,xu,wu)}function Hu(t){return function(){return t}}function qu(t,e){function n(n,r){return n=t(n,r),e(n[0],n[1])}return t.invert&&e.invert&&(n.invert=function(n,r){return(n=e.invert(n,r))&&t.invert(n[0],n[1])}),n}function Wu(t,e){return lc(t)>nc&&(t-=Math.round(t/oc)*oc),[t,e]}function $u(t,e,n){return(t%=oc)?e||n?qu(Ku(t),Zu(e,n)):Ku(t):e||n?Zu(e,n):Wu}function Xu(t){return function(e,n){return lc(e+=t)>nc&&(e-=Math.round(e/oc)*oc),[e,n]}}function Ku(t){var e=Xu(t);return e.invert=Xu(-t),e}function Zu(t,e){var n=hc(t),r=yc(t),i=hc(e),o=yc(e);function a(t,e){var a=hc(e),s=hc(t)*a,l=yc(t)*a,c=yc(e),u=c*n+s*r;return[uc(l*i-u*o,s*n-c*r),wc(u*i+l*o)]}return a.invert=function(t,e){var a=hc(e),s=hc(t)*a,l=yc(t)*a,c=yc(e),u=c*i-l*o;return[uc(l*i+c*o,s*n+u*r),wc(u*n-s*r)]},a}function Ju(t){function e(e){return(e=t(e[0]*sc,e[1]*sc))[0]*=ac,e[1]*=ac,e}return t=$u(t[0]*sc,t[1]*sc,t.length>2?t[2]*sc:0),e.invert=function(e){return(e=t.invert(e[0]*sc,e[1]*sc))[0]*=ac,e[1]*=ac,e},e}function Qu(t,e,n,r,i,o){if(n){var a=hc(e),s=yc(e),l=r*n;null==i?(i=e+r*oc,o=e-l/2):(i=th(a,i),o=th(a,o),(r>0?i<o:i>o)&&(i+=r*oc));for(var c,u=i;r>0?u>o:u<o;u-=l)c=tu([a,-s*hc(u),-s*yc(u)]),t.point(c[0],c[1])}}function th(t,e){(e=eu(e))[0]-=t,au(e);var n=xc(-e[1]);return((-e[2]<0?-n:n)+oc-tc)%oc}function eh(){var t,e=[];return{point:function(e,n,r){t.push([e,n,r])},lineStart:function(){e.push(t=[])},lineEnd:Ac,rejoin:function(){e.length>1&&e.push(e.pop().concat(e.shift()))},result:function(){var n=e;return e=[],t=null,n}}}function nh(t,e){return lc(t[0]-e[0])<tc&&lc(t[1]-e[1])<tc}function rh(t,e,n,r){this.x=t,this.z=e,this.o=n,this.e=r,this.v=!1,this.n=this.p=null}function ih(t,e,n,r,i){var o,a,s=[],l=[];if(t.forEach(function(t){if(!((e=t.length-1)<=0)){var e,n,r=t[0],a=t[e];if(nh(r,a)){if(!r[2]&&!a[2]){for(i.lineStart(),o=0;o<e;++o)i.point((r=t[o])[0],r[1]);return void i.lineEnd()}a[0]+=2e-6}s.push(n=new rh(r,t,null,!0)),l.push(n.o=new rh(r,null,n,!1)),s.push(n=new rh(a,t,null,!1)),l.push(n.o=new rh(a,null,n,!0))}}),s.length){for(l.sort(e),oh(s),oh(l),o=0,a=l.length;o<a;++o)l[o].e=n=!n;for(var c,u,h=s[0];;){for(var f=h,d=!0;f.v;)if((f=f.n)===h)return;c=f.z,i.lineStart();do{if(f.v=f.o.v=!0,f.e){if(d)for(o=0,a=c.length;o<a;++o)i.point((u=c[o])[0],u[1]);else r(f.x,f.n.x,1,i);f=f.n}else{if(d)for(c=f.p.z,o=c.length-1;o>=0;--o)i.point((u=c[o])[0],u[1]);else r(f.x,f.p.x,-1,i);f=f.p}c=(f=f.o).z,d=!d}while(!f.v);i.lineEnd()}}}function oh(t){if(e=t.length){for(var e,n,r=0,i=t[0];++r<e;)i.n=n=t[r],n.p=i,i=n;i.n=n=t[0],n.p=i}}function ah(t){return lc(t[0])<=nc?t[0]:mc(t[0])*((lc(t[0])+nc)%oc-nc)}function sh(t,e){var n=ah(e),r=e[1],i=yc(r),o=[yc(n),-hc(n),0],a=0,s=0,l=new w;1===i?r=rc+tc:-1===i&&(r=-rc-tc);for(var c=0,u=t.length;c<u;++c)if(f=(h=t[c]).length)for(var h,f,d=h[f-1],p=ah(d),g=d[1]/2+ic,_=yc(g),y=hc(g),m=0;m<f;++m,p=v,_=E,y=A,d=b){var b=h[m],v=ah(b),x=b[1]/2+ic,E=yc(x),A=hc(x),T=v-p,C=T>=0?1:-1,S=C*T,k=S>nc,M=_*E;if(l.add(uc(M*C*yc(S),y*A+M*hc(S))),a+=k?T+C*oc:T,k^p>=n^v>=n){var R=ru(eu(d),eu(b));au(R);var O=ru(o,R);au(O);var N=(k^T>=0?-1:1)*wc(O[2]);(r>N||r===N&&(R[0]||R[1]))&&(s+=k^T>=0?1:-1)}}return(a<-1e-6||a<tc&&l<-1e-12)^1&s}function lh(t,e,n,r){return function(i){var o,a,s,l=e(i),c=eh(),u=e(c),h=!1,f={point:d,lineStart:g,lineEnd:_,polygonStart:function(){f.point=y,f.lineStart=m,f.lineEnd=b,a=[],o=[]},polygonEnd:function(){f.point=d,f.lineStart=g,f.lineEnd=_,a=ht(a);var t=sh(o,r);a.length?(h||(i.polygonStart(),h=!0),ih(a,uh,t,n,i)):t&&(h||(i.polygonStart(),h=!0),i.lineStart(),n(null,null,1,i),i.lineEnd()),h&&(i.polygonEnd(),h=!1),a=o=null},sphere:function(){i.polygonStart(),i.lineStart(),n(null,null,1,i),i.lineEnd(),i.polygonEnd()}};function d(e,n){t(e,n)&&i.point(e,n)}function p(t,e){l.point(t,e)}function g(){f.point=p,l.lineStart()}function _(){f.point=d,l.lineEnd()}function y(t,e){s.push([t,e]),u.point(t,e)}function m(){u.lineStart(),s=[]}function b(){y(s[0][0],s[0][1]),u.lineEnd();var t,e,n,r,l=u.clean(),f=c.result(),d=f.length;if(s.pop(),o.push(s),s=null,d)if(1&l){if((e=(n=f[0]).length-1)>0){for(h||(i.polygonStart(),h=!0),i.lineStart(),t=0;t<e;++t)i.point((r=n[t])[0],r[1]);i.lineEnd()}}else d>1&&2&l&&f.push(f.pop().concat(f.shift())),a.push(f.filter(ch))}return f}}function ch(t){return t.length>1}function uh(t,e){return((t=t.x)[0]<0?t[1]-rc-tc:rc-t[1])-((e=e.x)[0]<0?e[1]-rc-tc:rc-e[1])}Wu.invert=Wu;var hh=lh(function(){return!0},function(t){var e,n=NaN,r=NaN,i=NaN;return{lineStart:function(){t.lineStart(),e=1},point:function(o,a){var s=o>0?nc:-nc,l=lc(o-n);lc(l-nc)<tc?(t.point(n,r=(r+a)/2>0?rc:-rc),t.point(i,r),t.lineEnd(),t.lineStart(),t.point(s,r),t.point(o,r),e=0):i!==s&&l>=nc&&(lc(n-i)<tc&&(n-=i*tc),lc(o-s)<tc&&(o-=s*tc),r=function(t,e,n,r){var i,o,a=yc(t-n);return lc(a)>tc?cc((yc(e)*(o=hc(r))*yc(n)-yc(r)*(i=hc(e))*yc(t))/(i*o*a)):(e+r)/2}(n,r,o,a),t.point(i,r),t.lineEnd(),t.lineStart(),t.point(s,r),e=0),t.point(n=o,r=a),i=s},lineEnd:function(){t.lineEnd(),n=r=NaN},clean:function(){return 2-e}}},function(t,e,n,r){var i;if(null==t)i=n*rc,r.point(-nc,i),r.point(0,i),r.point(nc,i),r.point(nc,0),r.point(nc,-i),r.point(0,-i),r.point(-nc,-i),r.point(-nc,0),r.point(-nc,i);else if(lc(t[0]-e[0])>tc){var o=t[0]<e[0]?nc:-nc;i=n*o/2,r.point(-o,i),r.point(0,i),r.point(o,i)}else r.point(e[0],e[1])},[-nc,-rc]);function fh(t){var e=hc(t),n=2*sc,r=e>0,i=lc(e)>tc;function o(t,n){return hc(t)*hc(n)>e}function a(t,n,r){var i=[1,0,0],o=ru(eu(t),eu(n)),a=nu(o,o),s=o[0],l=a-s*s;if(!l)return!r&&t;var c=e*a/l,u=-e*s/l,h=ru(i,o),f=ou(i,c);iu(f,ou(o,u));var d=h,p=nu(f,d),g=nu(d,d),_=p*p-g*(nu(f,f)-1);if(!(_<0)){var y=bc(_),m=ou(d,(-p-y)/g);if(iu(m,f),m=tu(m),!r)return m;var b,v=t[0],x=n[0],w=t[1],E=n[1];x<v&&(b=v,v=x,x=b);var A=x-v,T=lc(A-nc)<tc;if(!T&&E<w&&(b=w,w=E,E=b),T||A<tc?T?w+E>0^m[1]<(lc(m[0]-v)<tc?w:E):w<=m[1]&&m[1]<=E:A>nc^(v<=m[0]&&m[0]<=x)){var C=ou(d,(-p+y)/g);return iu(C,f),[m,tu(C)]}}}function s(e,n){var i=r?t:nc-t,o=0;return e<-i?o|=1:e>i&&(o|=2),n<-i?o|=4:n>i&&(o|=8),o}return lh(o,function(t){var e,n,l,c,u;return{lineStart:function(){c=l=!1,u=1},point:function(h,f){var d,p=[h,f],g=o(h,f),_=r?g?0:s(h,f):g?s(h+(h<0?nc:-nc),f):0;if(!e&&(c=l=g)&&t.lineStart(),g!==l&&(!(d=a(e,p))||nh(e,d)||nh(p,d))&&(p[2]=1),g!==l)u=0,g?(t.lineStart(),d=a(p,e),t.point(d[0],d[1])):(d=a(e,p),t.point(d[0],d[1],2),t.lineEnd()),e=d;else if(i&&e&&r^g){var y;_&n||!(y=a(p,e,!0))||(u=0,r?(t.lineStart(),t.point(y[0][0],y[0][1]),t.point(y[1][0],y[1][1]),t.lineEnd()):(t.point(y[1][0],y[1][1]),t.lineEnd(),t.lineStart(),t.point(y[0][0],y[0][1],3)))}!g||e&&nh(e,p)||t.point(p[0],p[1]),e=p,l=g,n=_},lineEnd:function(){l&&t.lineEnd(),e=null},clean:function(){return u|(c&&l)<<1}}},function(e,r,i,o){Qu(o,t,n,i,e,r)},r?[0,-t]:[-nc,t-nc])}var dh,ph,gh,_h,yh=1e9,mh=-yh;function bh(t,e,n,r){function i(i,o){return t<=i&&i<=n&&e<=o&&o<=r}function o(i,o,s,c){var u=0,h=0;if(null==i||(u=a(i,s))!==(h=a(o,s))||l(i,o)<0^s>0)do{c.point(0===u||3===u?t:n,u>1?r:e)}while((u=(u+s+4)%4)!==h);else c.point(o[0],o[1])}function a(r,i){return lc(r[0]-t)<tc?i>0?0:3:lc(r[0]-n)<tc?i>0?2:1:lc(r[1]-e)<tc?i>0?1:0:i>0?3:2}function s(t,e){return l(t.x,e.x)}function l(t,e){var n=a(t,1),r=a(e,1);return n!==r?n-r:0===n?e[1]-t[1]:1===n?t[0]-e[0]:2===n?t[1]-e[1]:e[0]-t[0]}return function(a){var l,c,u,h,f,d,p,g,_,y,m,b=a,v=eh(),x={point:w,lineStart:function(){x.point=E,c&&c.push(u=[]);y=!0,_=!1,p=g=NaN},lineEnd:function(){l&&(E(h,f),d&&_&&v.rejoin(),l.push(v.result()));x.point=w,_&&b.lineEnd()},polygonStart:function(){b=v,l=[],c=[],m=!0},polygonEnd:function(){var e=function(){for(var e=0,n=0,i=c.length;n<i;++n)for(var o,a,s=c[n],l=1,u=s.length,h=s[0],f=h[0],d=h[1];l<u;++l)o=f,a=d,f=(h=s[l])[0],d=h[1],a<=r?d>r&&(f-o)*(r-a)>(d-a)*(t-o)&&++e:d<=r&&(f-o)*(r-a)<(d-a)*(t-o)&&--e;return e}(),n=m&&e,i=(l=ht(l)).length;(n||i)&&(a.polygonStart(),n&&(a.lineStart(),o(null,null,1,a),a.lineEnd()),i&&ih(l,s,e,o,a),a.polygonEnd());b=a,l=c=u=null}};function w(t,e){i(t,e)&&b.point(t,e)}function E(o,a){var s=i(o,a);if(c&&u.push([o,a]),y)h=o,f=a,d=s,y=!1,s&&(b.lineStart(),b.point(o,a));else if(s&&_)b.point(o,a);else{var l=[p=Math.max(mh,Math.min(yh,p)),g=Math.max(mh,Math.min(yh,g))],v=[o=Math.max(mh,Math.min(yh,o)),a=Math.max(mh,Math.min(yh,a))];!function(t,e,n,r,i,o){var a,s=t[0],l=t[1],c=0,u=1,h=e[0]-s,f=e[1]-l;if(a=n-s,h||!(a>0)){if(a/=h,h<0){if(a<c)return;a<u&&(u=a)}else if(h>0){if(a>u)return;a>c&&(c=a)}if(a=i-s,h||!(a<0)){if(a/=h,h<0){if(a>u)return;a>c&&(c=a)}else if(h>0){if(a<c)return;a<u&&(u=a)}if(a=r-l,f||!(a>0)){if(a/=f,f<0){if(a<c)return;a<u&&(u=a)}else if(f>0){if(a>u)return;a>c&&(c=a)}if(a=o-l,f||!(a<0)){if(a/=f,f<0){if(a>u)return;a>c&&(c=a)}else if(f>0){if(a<c)return;a<u&&(u=a)}return c>0&&(t[0]=s+c*h,t[1]=l+c*f),u<1&&(e[0]=s+u*h,e[1]=l+u*f),!0}}}}}(l,v,t,e,n,r)?s&&(b.lineStart(),b.point(o,a),m=!1):(_||(b.lineStart(),b.point(l[0],l[1])),b.point(v[0],v[1]),s||b.lineEnd(),m=!1)}p=o,g=a,_=s}return x}}var vh={sphere:Ac,point:Ac,lineStart:function(){vh.point=wh,vh.lineEnd=xh},lineEnd:Ac,polygonStart:Ac,polygonEnd:Ac};function xh(){vh.point=vh.lineEnd=Ac}function wh(t,e){ph=t*=sc,gh=yc(e*=sc),_h=hc(e),vh.point=Eh}function Eh(t,e){t*=sc;var n=yc(e*=sc),r=hc(e),i=lc(t-ph),o=hc(i),a=r*yc(i),s=_h*n-gh*r*o,l=gh*n+_h*r*o;dh.add(uc(bc(a*a+s*s),l)),ph=t,gh=n,_h=r}function Ah(t){return dh=new w,Rc(t,vh),+dh}var Th=[null,null],Ch={type:"LineString",coordinates:Th};function Sh(t,e){return Th[0]=t,Th[1]=e,Ah(Ch)}var kh={Feature:function(t,e){return Rh(t.geometry,e)},FeatureCollection:function(t,e){for(var n=t.features,r=-1,i=n.length;++r<i;)if(Rh(n[r].geometry,e))return!0;return!1}},Mh={Sphere:function(){return!0},Point:function(t,e){return Oh(t.coordinates,e)},MultiPoint:function(t,e){for(var n=t.coordinates,r=-1,i=n.length;++r<i;)if(Oh(n[r],e))return!0;return!1},LineString:function(t,e){return Nh(t.coordinates,e)},MultiLineString:function(t,e){for(var n=t.coordinates,r=-1,i=n.length;++r<i;)if(Nh(n[r],e))return!0;return!1},Polygon:function(t,e){return Ih(t.coordinates,e)},MultiPolygon:function(t,e){for(var n=t.coordinates,r=-1,i=n.length;++r<i;)if(Ih(n[r],e))return!0;return!1},GeometryCollection:function(t,e){for(var n=t.geometries,r=-1,i=n.length;++r<i;)if(Rh(n[r],e))return!0;return!1}};function Rh(t,e){return!(!t||!Mh.hasOwnProperty(t.type))&&Mh[t.type](t,e)}function Oh(t,e){return 0===Sh(t,e)}function Nh(t,e){for(var n,r,i,o=0,a=t.length;o<a;o++){if(0===(r=Sh(t[o],e)))return!0;if(o>0&&(i=Sh(t[o],t[o-1]))>0&&n<=i&&r<=i&&(n+r-i)*(1-Math.pow((n-r)/i,2))<ec*i)return!0;n=r}return!1}function Ih(t,e){return!!sh(t.map(Lh),Ph(e))}function Lh(t){return(t=t.map(Ph)).pop(),t}function Ph(t){return[t[0]*sc,t[1]*sc]}function Vh(t,e,n){var r=dt(t,e-tc,n).concat(e);return function(t){return r.map(function(e){return[t,e]})}}function Dh(t,e,n){var r=dt(t,e-tc,n).concat(e);return function(t){return r.map(function(e){return[e,t]})}}function Bh(){var t,e,n,r,i,o,a,s,l,c,u,h,f=10,d=f,p=90,g=360,_=2.5;function y(){return{type:"MultiLineString",coordinates:m()}}function m(){return dt(fc(r/p)*p,n,p).map(u).concat(dt(fc(s/g)*g,a,g).map(h)).concat(dt(fc(e/f)*f,t,f).filter(function(t){return lc(t%p)>tc}).map(l)).concat(dt(fc(o/d)*d,i,d).filter(function(t){return lc(t%g)>tc}).map(c))}return y.lines=function(){return m().map(function(t){return{type:"LineString",coordinates:t}})},y.outline=function(){return{type:"Polygon",coordinates:[u(r).concat(h(a).slice(1),u(n).reverse().slice(1),h(s).reverse().slice(1))]}},y.extent=function(t){return arguments.length?y.extentMajor(t).extentMinor(t):y.extentMinor()},y.extentMajor=function(t){return arguments.length?(r=+t[0][0],n=+t[1][0],s=+t[0][1],a=+t[1][1],r>n&&(t=r,r=n,n=t),s>a&&(t=s,s=a,a=t),y.precision(_)):[[r,s],[n,a]]},y.extentMinor=function(n){return arguments.length?(e=+n[0][0],t=+n[1][0],o=+n[0][1],i=+n[1][1],e>t&&(n=e,e=t,t=n),o>i&&(n=o,o=i,i=n),y.precision(_)):[[e,o],[t,i]]},y.step=function(t){return arguments.length?y.stepMajor(t).stepMinor(t):y.stepMinor()},y.stepMajor=function(t){return arguments.length?(p=+t[0],g=+t[1],y):[p,g]},y.stepMinor=function(t){return arguments.length?(f=+t[0],d=+t[1],y):[f,d]},y.precision=function(f){return arguments.length?(_=+f,l=Vh(o,i,90),c=Dh(e,t,_),u=Vh(s,a,90),h=Dh(r,n,_),y):_},y.extentMajor([[-180,-89.999999],[180,89.999999]]).extentMinor([[-180,-80.000001],[180,80.000001]])}var zh,Fh,Gh,jh,Uh=t=>t,Yh=new w,Hh=new w,qh={point:Ac,lineStart:Ac,lineEnd:Ac,polygonStart:function(){qh.lineStart=Wh,qh.lineEnd=Kh},polygonEnd:function(){qh.lineStart=qh.lineEnd=qh.point=Ac,Yh.add(lc(Hh)),Hh=new w},result:function(){var t=Yh/2;return Yh=new w,t}};function Wh(){qh.point=$h}function $h(t,e){qh.point=Xh,zh=Gh=t,Fh=jh=e}function Xh(t,e){Hh.add(jh*t-Gh*e),Gh=t,jh=e}function Kh(){Xh(zh,Fh)}var Zh=1/0,Jh=Zh,Qh=-Zh,tf=Qh,ef={point:function(t,e){t<Zh&&(Zh=t);t>Qh&&(Qh=t);e<Jh&&(Jh=e);e>tf&&(tf=e)},lineStart:Ac,lineEnd:Ac,polygonStart:Ac,polygonEnd:Ac,result:function(){var t=[[Zh,Jh],[Qh,tf]];return Qh=tf=-(Jh=Zh=1/0),t}};var nf,rf,of,af,sf=0,lf=0,cf=0,uf=0,hf=0,ff=0,df=0,pf=0,gf=0,_f={point:yf,lineStart:mf,lineEnd:xf,polygonStart:function(){_f.lineStart=wf,_f.lineEnd=Ef},polygonEnd:function(){_f.point=yf,_f.lineStart=mf,_f.lineEnd=xf},result:function(){var t=gf?[df/gf,pf/gf]:ff?[uf/ff,hf/ff]:cf?[sf/cf,lf/cf]:[NaN,NaN];return sf=lf=cf=uf=hf=ff=df=pf=gf=0,t}};function yf(t,e){sf+=t,lf+=e,++cf}function mf(){_f.point=bf}function bf(t,e){_f.point=vf,yf(of=t,af=e)}function vf(t,e){var n=t-of,r=e-af,i=bc(n*n+r*r);uf+=i*(of+t)/2,hf+=i*(af+e)/2,ff+=i,yf(of=t,af=e)}function xf(){_f.point=yf}function wf(){_f.point=Af}function Ef(){Tf(nf,rf)}function Af(t,e){_f.point=Tf,yf(nf=of=t,rf=af=e)}function Tf(t,e){var n=t-of,r=e-af,i=bc(n*n+r*r);uf+=i*(of+t)/2,hf+=i*(af+e)/2,ff+=i,df+=(i=af*t-of*e)*(of+t),pf+=i*(af+e),gf+=3*i,yf(of=t,af=e)}function Cf(t){this._context=t}Cf.prototype={_radius:4.5,pointRadius:function(t){return this._radius=t,this},polygonStart:function(){this._line=0},polygonEnd:function(){this._line=NaN},lineStart:function(){this._point=0},lineEnd:function(){0===this._line&&this._context.closePath(),this._point=NaN},point:function(t,e){switch(this._point){case 0:this._context.moveTo(t,e),this._point=1;break;case 1:this._context.lineTo(t,e);break;default:this._context.moveTo(t+this._radius,e),this._context.arc(t,e,this._radius,0,oc)}},result:Ac};var Sf,kf,Mf,Rf,Of,Nf=new w,If={point:Ac,lineStart:function(){If.point=Lf},lineEnd:function(){Sf&&Pf(kf,Mf),If.point=Ac},polygonStart:function(){Sf=!0},polygonEnd:function(){Sf=null},result:function(){var t=+Nf;return Nf=new w,t}};function Lf(t,e){If.point=Pf,kf=Rf=t,Mf=Of=e}function Pf(t,e){Rf-=t,Of-=e,Nf.add(bc(Rf*Rf+Of*Of)),Rf=t,Of=e}let Vf,Df,Bf,zf;class Ff{constructor(t){this._append=null==t?Gf:function(t){const e=Math.floor(t);if(!(e>=0))throw new RangeError(`invalid digits: ${t}`);if(e>15)return Gf;if(e!==Vf){const t=10**e;Vf=e,Df=function(e){let n=1;this._+=e[0];for(const r=e.length;n<r;++n)this._+=Math.round(arguments[n]*t)/t+e[n]}}return Df}(t),this._radius=4.5,this._=""}pointRadius(t){return this._radius=+t,this}polygonStart(){this._line=0}polygonEnd(){this._line=NaN}lineStart(){this._point=0}lineEnd(){0===this._line&&(this._+="Z"),this._point=NaN}point(t,e){switch(this._point){case 0:this._append`M${t},${e}`,this._point=1;break;case 1:this._append`L${t},${e}`;break;default:if(this._append`M${t},${e}`,this._radius!==Bf||this._append!==Df){const t=this._radius,e=this._;this._="",this._append`m0,${t}a${t},${t} 0 1,1 0,${-2*t}a${t},${t} 0 1,1 0,${2*t}z`,Bf=t,Df=this._append,zf=this._,this._=e}this._+=zf}}result(){const t=this._;return this._="",t.length?t:null}}function Gf(t){let e=1;this._+=t[0];for(const n=t.length;e<n;++e)this._+=arguments[e]+t[e]}function jf(t){return function(e){var n=new Uf;for(var r in t)n[r]=t[r];return n.stream=e,n}}function Uf(){}function Yf(t,e,n){var r=t.clipExtent&&t.clipExtent();return t.scale(150).translate([0,0]),null!=r&&t.clipExtent(null),Rc(n,t.stream(ef)),e(ef.result()),null!=r&&t.clipExtent(r),t}function Hf(t,e,n){return Yf(t,function(n){var r=e[1][0]-e[0][0],i=e[1][1]-e[0][1],o=Math.min(r/(n[1][0]-n[0][0]),i/(n[1][1]-n[0][1])),a=+e[0][0]+(r-o*(n[1][0]+n[0][0]))/2,s=+e[0][1]+(i-o*(n[1][1]+n[0][1]))/2;t.scale(150*o).translate([a,s])},n)}function qf(t,e,n){return Hf(t,[[0,0],e],n)}function Wf(t,e,n){return Yf(t,function(n){var r=+e,i=r/(n[1][0]-n[0][0]),o=(r-i*(n[1][0]+n[0][0]))/2,a=-i*n[0][1];t.scale(150*i).translate([o,a])},n)}function $f(t,e,n){return Yf(t,function(n){var r=+e,i=r/(n[1][1]-n[0][1]),o=-i*n[0][0],a=(r-i*(n[1][1]+n[0][1]))/2;t.scale(150*i).translate([o,a])},n)}Uf.prototype={constructor:Uf,point:function(t,e){this.stream.point(t,e)},sphere:function(){this.stream.sphere()},lineStart:function(){this.stream.lineStart()},lineEnd:function(){this.stream.lineEnd()},polygonStart:function(){this.stream.polygonStart()},polygonEnd:function(){this.stream.polygonEnd()}};var Xf=hc(30*sc);function Kf(t,e){return+e?function(t,e){function n(r,i,o,a,s,l,c,u,h,f,d,p,g,_){var y=c-r,m=u-i,b=y*y+m*m;if(b>4*e&&g--){var v=a+f,x=s+d,w=l+p,E=bc(v*v+x*x+w*w),A=wc(w/=E),T=lc(lc(w)-1)<tc||lc(o-h)<tc?(o+h)/2:uc(x,v),C=t(T,A),S=C[0],k=C[1],M=S-r,R=k-i,O=m*M-y*R;(O*O/b>e||lc((y*M+m*R)/b-.5)>.3||a*f+s*d+l*p<Xf)&&(n(r,i,o,a,s,l,S,k,T,v/=E,x/=E,w,g,_),_.point(S,k),n(S,k,T,v,x,w,c,u,h,f,d,p,g,_))}}return function(e){var r,i,o,a,s,l,c,u,h,f,d,p,g={point:_,lineStart:y,lineEnd:b,polygonStart:function(){e.polygonStart(),g.lineStart=v},polygonEnd:function(){e.polygonEnd(),g.lineStart=y}};function _(n,r){n=t(n,r),e.point(n[0],n[1])}function y(){u=NaN,g.point=m,e.lineStart()}function m(r,i){var o=eu([r,i]),a=t(r,i);n(u,h,c,f,d,p,u=a[0],h=a[1],c=r,f=o[0],d=o[1],p=o[2],16,e),e.point(u,h)}function b(){g.point=_,e.lineEnd()}function v(){y(),g.point=x,g.lineEnd=w}function x(t,e){m(r=t,e),i=u,o=h,a=f,s=d,l=p,g.point=m}function w(){n(u,h,c,f,d,p,i,o,r,a,s,l,16,e),g.lineEnd=b,b()}return g}}(t,e):function(t){return jf({point:function(e,n){e=t(e,n),this.stream.point(e[0],e[1])}})}(t)}var Zf=jf({point:function(t,e){this.stream.point(t*sc,e*sc)}});function Jf(t,e,n,r,i,o){if(!o)return function(t,e,n,r,i){function o(o,a){return[e+t*(o*=r),n-t*(a*=i)]}return o.invert=function(o,a){return[(o-e)/t*r,(n-a)/t*i]},o}(t,e,n,r,i);var a=hc(o),s=yc(o),l=a*t,c=s*t,u=a/t,h=s/t,f=(s*n-a*e)/t,d=(s*e+a*n)/t;function p(t,o){return[l*(t*=r)-c*(o*=i)+e,n-c*t-l*o]}return p.invert=function(t,e){return[r*(u*t-h*e+f),i*(d-h*t-u*e)]},p}function Qf(t){return td(function(){return t})()}function td(t){var e,n,r,i,o,a,s,l,c,u,h=150,f=480,d=250,p=0,g=0,_=0,y=0,m=0,b=0,v=1,x=1,w=null,E=hh,A=null,T=Uh,C=.5;function S(t){return l(t[0]*sc,t[1]*sc)}function k(t){return(t=l.invert(t[0],t[1]))&&[t[0]*ac,t[1]*ac]}function M(){var t=Jf(h,0,0,v,x,b).apply(null,e(p,g)),r=Jf(h,f-t[0],d-t[1],v,x,b);return n=$u(_,y,m),s=qu(e,r),l=qu(n,s),a=Kf(s,C),R()}function R(){return c=u=null,S}return S.stream=function(t){return c&&u===t?c:c=Zf(function(t){return jf({point:function(e,n){var r=t(e,n);return this.stream.point(r[0],r[1])}})}(n)(E(a(T(u=t)))))},S.preclip=function(t){return arguments.length?(E=t,w=void 0,R()):E},S.postclip=function(t){return arguments.length?(T=t,A=r=i=o=null,R()):T},S.clipAngle=function(t){return arguments.length?(E=+t?fh(w=t*sc):(w=null,hh),R()):w*ac},S.clipExtent=function(t){return arguments.length?(T=null==t?(A=r=i=o=null,Uh):bh(A=+t[0][0],r=+t[0][1],i=+t[1][0],o=+t[1][1]),R()):null==A?null:[[A,r],[i,o]]},S.scale=function(t){return arguments.length?(h=+t,M()):h},S.translate=function(t){return arguments.length?(f=+t[0],d=+t[1],M()):[f,d]},S.center=function(t){return arguments.length?(p=t[0]%360*sc,g=t[1]%360*sc,M()):[p*ac,g*ac]},S.rotate=function(t){return arguments.length?(_=t[0]%360*sc,y=t[1]%360*sc,m=t.length>2?t[2]%360*sc:0,M()):[_*ac,y*ac,m*ac]},S.angle=function(t){return arguments.length?(b=t%360*sc,M()):b*ac},S.reflectX=function(t){return arguments.length?(v=t?-1:1,M()):v<0},S.reflectY=function(t){return arguments.length?(x=t?-1:1,M()):x<0},S.precision=function(t){return arguments.length?(a=Kf(s,C=t*t),R()):bc(C)},S.fitExtent=function(t,e){return Hf(S,t,e)},S.fitSize=function(t,e){return qf(S,t,e)},S.fitWidth=function(t,e){return Wf(S,t,e)},S.fitHeight=function(t,e){return $f(S,t,e)},function(){return e=t.apply(this,arguments),S.invert=e.invert&&k,M()}}function ed(t){var e=0,n=nc/3,r=td(t),i=r(e,n);return i.parallels=function(t){return arguments.length?r(e=t[0]*sc,n=t[1]*sc):[e*ac,n*ac]},i}function nd(t,e){var n=yc(t),r=(n+yc(e))/2;if(lc(r)<tc)return function(t){var e=hc(t);function n(t,n){return[t*e,yc(n)/e]}return n.invert=function(t,n){return[t/e,wc(n*e)]},n}(t);var i=1+n*(2*r-n),o=bc(i)/r;function a(t,e){var n=bc(i-2*r*yc(e))/r;return[n*yc(t*=r),o-n*hc(t)]}return a.invert=function(t,e){var n=o-e,a=uc(t,lc(n))*mc(n);return n*r<0&&(a-=nc*mc(t)*mc(n)),[a/r,wc((i-(t*t+n*n)*r*r)/(2*r))]},a}function rd(){return ed(nd).scale(155.424).center([0,33.6442])}function id(){return rd().parallels([29.5,45.5]).scale(1070).translate([480,250]).rotate([96,0]).center([-.6,38.7])}function od(t){return function(e,n){var r=hc(e),i=hc(n),o=t(r*i);return o===1/0?[2,0]:[o*i*yc(e),o*yc(n)]}}function ad(t){return function(e,n){var r=bc(e*e+n*n),i=t(r),o=yc(i),a=hc(i);return[uc(e*o,r*a),wc(r&&n*o/r)]}}var sd=od(function(t){return bc(2/(1+t))});sd.invert=ad(function(t){return 2*wc(t/2)});var ld=od(function(t){return(t=xc(t))&&t/yc(t)});function cd(t,e){return[t,gc(vc((rc+e)/2))]}function ud(t){var e,n,r,i=Qf(t),o=i.center,a=i.scale,s=i.translate,l=i.clipExtent,c=null;function u(){var o=nc*a(),s=i(Ju(i.rotate()).invert([0,0]));return l(null==c?[[s[0]-o,s[1]-o],[s[0]+o,s[1]+o]]:t===cd?[[Math.max(s[0]-o,c),e],[Math.min(s[0]+o,n),r]]:[[c,Math.max(s[1]-o,e)],[n,Math.min(s[1]+o,r)]])}return i.scale=function(t){return arguments.length?(a(t),u()):a()},i.translate=function(t){return arguments.length?(s(t),u()):s()},i.center=function(t){return arguments.length?(o(t),u()):o()},i.clipExtent=function(t){return arguments.length?(null==t?c=e=n=r=null:(c=+t[0][0],e=+t[0][1],n=+t[1][0],r=+t[1][1]),u()):null==c?null:[[c,e],[n,r]]},u()}function hd(t){return vc((rc+t)/2)}function fd(t,e){var n=hc(t),r=t===e?yc(t):gc(n/hc(e))/gc(hd(e)/hd(t)),i=n*_c(hd(t),r)/r;if(!r)return cd;function o(t,e){i>0?e<-rc+tc&&(e=-rc+tc):e>rc-tc&&(e=rc-tc);var n=i/_c(hd(e),r);return[n*yc(r*t),i-n*hc(r*t)]}return o.invert=function(t,e){var n=i-e,o=mc(r)*bc(t*t+n*n),a=uc(t,lc(n))*mc(n);return n*r<0&&(a-=nc*mc(t)*mc(n)),[a/r,2*cc(_c(i/o,1/r))-rc]},o}function dd(t,e){return[t,e]}function pd(t,e){var n=hc(t),r=t===e?yc(t):(n-hc(e))/(e-t),i=n/r+t;if(lc(r)<tc)return dd;function o(t,e){var n=i-e,o=r*t;return[n*yc(o),i-n*hc(o)]}return o.invert=function(t,e){var n=i-e,o=uc(t,lc(n))*mc(n);return n*r<0&&(o-=nc*mc(t)*mc(n)),[o/r,i-mc(r)*bc(t*t+n*n)]},o}ld.invert=ad(function(t){return t}),cd.invert=function(t,e){return[t,2*cc(dc(e))-rc]},dd.invert=dd;var gd=1.340264,_d=-.081106,yd=893e-6,md=.003796,bd=bc(3)/2;function vd(t,e){var n=wc(bd*yc(e)),r=n*n,i=r*r*r;return[t*hc(n)/(bd*(gd+3*_d*r+i*(7*yd+9*md*r))),n*(gd+_d*r+i*(yd+md*r))]}function xd(t,e){var n=hc(e),r=hc(t)*n;return[n*yc(t)/r,yc(e)/r]}function wd(t,e){var n=e*e,r=n*n;return[t*(.8707-.131979*n+r*(r*(.003971*n-.001529*r)-.013791)),e*(1.007226+n*(.015085+r*(.028874*n-.044475-.005916*r)))]}function Ed(t,e){return[hc(e)*yc(t),yc(e)]}function Ad(t,e){var n=hc(e),r=1+hc(t)*n;return[n*yc(t)/r,yc(e)/r]}function Td(t,e){return[gc(vc((rc+e)/2)),-t]}function Cd(t,e){return t.parent===e.parent?1:2}function Sd(t,e){return t+e.x}function kd(t,e){return Math.max(t,e.y)}function Md(){var t=Cd,e=1,n=1,r=!1;function i(i){var o,a=0;i.eachAfter(function(e){var n=e.children;n?(e.x=function(t){return t.reduce(Sd,0)/t.length}(n),e.y=function(t){return 1+t.reduce(kd,0)}(n)):(e.x=o?a+=t(e,o):0,e.y=0,o=e)});var s=function(t){for(var e;e=t.children;)t=e[0];return t}(i),l=function(t){for(var e;e=t.children;)t=e[e.length-1];return t}(i),c=s.x-t(s,l)/2,u=l.x+t(l,s)/2;return i.eachAfter(r?function(t){t.x=(t.x-i.x)*e,t.y=(i.y-t.y)*n}:function(t){t.x=(t.x-c)/(u-c)*e,t.y=(1-(i.y?t.y/i.y:1))*n})}return i.separation=function(e){return arguments.length?(t=e,i):t},i.size=function(t){return arguments.length?(r=!1,e=+t[0],n=+t[1],i):r?null:[e,n]},i.nodeSize=function(t){return arguments.length?(r=!0,e=+t[0],n=+t[1],i):r?[e,n]:null},i}function Rd(t){var e=0,n=t.children,r=n&&n.length;if(r)for(;--r>=0;)e+=n[r].value;else e=1;t.value=e}function Od(t,e){t instanceof Map?(t=[void 0,t],void 0===e&&(e=Id)):void 0===e&&(e=Nd);for(var n,r,i,o,a,s=new Vd(t),l=[s];n=l.pop();)if((i=e(n.data))&&(a=(i=Array.from(i)).length))for(n.children=i,o=a-1;o>=0;--o)l.push(r=i[o]=new Vd(i[o])),r.parent=n,r.depth=n.depth+1;return s.eachBefore(Pd)}function Nd(t){return t.children}function Id(t){return Array.isArray(t)?t[1]:null}function Ld(t){void 0!==t.data.value&&(t.value=t.data.value),t.data=t.data.data}function Pd(t){var e=0;do{t.height=e}while((t=t.parent)&&t.height<++e)}function Vd(t){this.data=t,this.depth=this.height=0,this.parent=null}function Dd(t){return null==t?null:Bd(t)}function Bd(t){if("function"!=typeof t)throw new Error;return t}function zd(){return 0}function Fd(t){return function(){return t}}vd.invert=function(t,e){for(var n,r=e,i=r*r,o=i*i*i,a=0;a<12&&(o=(i=(r-=n=(r*(gd+_d*i+o*(yd+md*i))-e)/(gd+3*_d*i+o*(7*yd+9*md*i)))*r)*i*i,!(lc(n)<ec));++a);return[bd*t*(gd+3*_d*i+o*(7*yd+9*md*i))/hc(r),wc(yc(r)/bd)]},xd.invert=ad(cc),wd.invert=function(t,e){var n,r=e,i=25;do{var o=r*r,a=o*o;r-=n=(r*(1.007226+o*(.015085+a*(.028874*o-.044475-.005916*a)))-e)/(1.007226+o*(.045255+a*(.259866*o-.311325-.005916*11*a)))}while(lc(n)>tc&&--i>0);return[t/(.8707+(o=r*r)*(o*(o*o*o*(.003971-.001529*o)-.013791)-.131979)),r]},Ed.invert=ad(wc),Ad.invert=ad(function(t){return 2*cc(t)}),Td.invert=function(t,e){return[-e,2*cc(dc(t))-rc]},Vd.prototype=Od.prototype={constructor:Vd,count:function(){return this.eachAfter(Rd)},each:function(t,e){let n=-1;for(const r of this)t.call(e,r,++n,this);return this},eachAfter:function(t,e){for(var n,r,i,o=this,a=[o],s=[],l=-1;o=a.pop();)if(s.push(o),n=o.children)for(r=0,i=n.length;r<i;++r)a.push(n[r]);for(;o=s.pop();)t.call(e,o,++l,this);return this},eachBefore:function(t,e){for(var n,r,i=this,o=[i],a=-1;i=o.pop();)if(t.call(e,i,++a,this),n=i.children)for(r=n.length-1;r>=0;--r)o.push(n[r]);return this},find:function(t,e){let n=-1;for(const r of this)if(t.call(e,r,++n,this))return r},sum:function(t){return this.eachAfter(function(e){for(var n=+t(e.data)||0,r=e.children,i=r&&r.length;--i>=0;)n+=r[i].value;e.value=n})},sort:function(t){return this.eachBefore(function(e){e.children&&e.children.sort(t)})},path:function(t){for(var e=this,n=function(t,e){if(t===e)return t;var n=t.ancestors(),r=e.ancestors(),i=null;t=n.pop(),e=r.pop();for(;t===e;)i=t,t=n.pop(),e=r.pop();return i}(e,t),r=[e];e!==n;)e=e.parent,r.push(e);for(var i=r.length;t!==n;)r.splice(i,0,t),t=t.parent;return r},ancestors:function(){for(var t=this,e=[t];t=t.parent;)e.push(t);return e},descendants:function(){return Array.from(this)},leaves:function(){var t=[];return this.eachBefore(function(e){e.children||t.push(e)}),t},links:function(){var t=this,e=[];return t.each(function(n){n!==t&&e.push({source:n.parent,target:n})}),e},copy:function(){return Od(this).eachBefore(Ld)},[Symbol.iterator]:function*(){var t,e,n,r,i=this,o=[i];do{for(t=o.reverse(),o=[];i=t.pop();)if(yield i,e=i.children)for(n=0,r=e.length;n<r;++n)o.push(e[n])}while(o.length)}};const Gd=4294967296;function jd(){let t=1;return()=>(t=(1664525*t+1013904223)%Gd)/Gd}function Ud(t,e){for(var n,r,i=0,o=(t=function(t,e){let n,r,i=t.length;for(;i;)r=e()*i--|0,n=t[i],t[i]=t[r],t[r]=n;return t}(Array.from(t),e)).length,a=[];i<o;)n=t[i],r&&qd(r,n)?++i:(r=$d(a=Yd(a,n)),i=0);return r}function Yd(t,e){var n,r;if(Wd(e,t))return[e];for(n=0;n<t.length;++n)if(Hd(e,t[n])&&Wd(Xd(t[n],e),t))return[t[n],e];for(n=0;n<t.length-1;++n)for(r=n+1;r<t.length;++r)if(Hd(Xd(t[n],t[r]),e)&&Hd(Xd(t[n],e),t[r])&&Hd(Xd(t[r],e),t[n])&&Wd(Kd(t[n],t[r],e),t))return[t[n],t[r],e];throw new Error}function Hd(t,e){var n=t.r-e.r,r=e.x-t.x,i=e.y-t.y;return n<0||n*n<r*r+i*i}function qd(t,e){var n=t.r-e.r+1e-9*Math.max(t.r,e.r,1),r=e.x-t.x,i=e.y-t.y;return n>0&&n*n>r*r+i*i}function Wd(t,e){for(var n=0;n<e.length;++n)if(!qd(t,e[n]))return!1;return!0}function $d(t){switch(t.length){case 1:return function(t){return{x:t.x,y:t.y,r:t.r}}(t[0]);case 2:return Xd(t[0],t[1]);case 3:return Kd(t[0],t[1],t[2])}}function Xd(t,e){var n=t.x,r=t.y,i=t.r,o=e.x,a=e.y,s=e.r,l=o-n,c=a-r,u=s-i,h=Math.sqrt(l*l+c*c);return{x:(n+o+l/h*u)/2,y:(r+a+c/h*u)/2,r:(h+i+s)/2}}function Kd(t,e,n){var r=t.x,i=t.y,o=t.r,a=e.x,s=e.y,l=e.r,c=n.x,u=n.y,h=n.r,f=r-a,d=r-c,p=i-s,g=i-u,_=l-o,y=h-o,m=r*r+i*i-o*o,b=m-a*a-s*s+l*l,v=m-c*c-u*u+h*h,x=d*p-f*g,w=(p*v-g*b)/(2*x)-r,E=(g*_-p*y)/x,A=(d*b-f*v)/(2*x)-i,T=(f*y-d*_)/x,C=E*E+T*T-1,S=2*(o+w*E+A*T),k=w*w+A*A-o*o,M=-(Math.abs(C)>1e-6?(S+Math.sqrt(S*S-4*C*k))/(2*C):k/S);return{x:r+w+E*M,y:i+A+T*M,r:M}}function Zd(t,e,n){var r,i,o,a,s=t.x-e.x,l=t.y-e.y,c=s*s+l*l;c?(i=e.r+n.r,i*=i,a=t.r+n.r,i>(a*=a)?(r=(c+a-i)/(2*c),o=Math.sqrt(Math.max(0,a/c-r*r)),n.x=t.x-r*s-o*l,n.y=t.y-r*l+o*s):(r=(c+i-a)/(2*c),o=Math.sqrt(Math.max(0,i/c-r*r)),n.x=e.x+r*s-o*l,n.y=e.y+r*l+o*s)):(n.x=e.x+n.r,n.y=e.y)}function Jd(t,e){var n=t.r+e.r-1e-6,r=e.x-t.x,i=e.y-t.y;return n>0&&n*n>r*r+i*i}function Qd(t){var e=t._,n=t.next._,r=e.r+n.r,i=(e.x*n.r+n.x*e.r)/r,o=(e.y*n.r+n.y*e.r)/r;return i*i+o*o}function tp(t){this._=t,this.next=null,this.previous=null}function ep(t,e){if(!(o=(t=function(t){return"object"==typeof t&&"length"in t?t:Array.from(t)}(t)).length))return 0;var n,r,i,o,a,s,l,c,u,h,f;if((n=t[0]).x=0,n.y=0,!(o>1))return n.r;if(r=t[1],n.x=-r.r,r.x=n.r,r.y=0,!(o>2))return n.r+r.r;Zd(r,n,i=t[2]),n=new tp(n),r=new tp(r),i=new tp(i),n.next=i.previous=r,r.next=n.previous=i,i.next=r.previous=n;t:for(l=3;l<o;++l){Zd(n._,r._,i=t[l]),i=new tp(i),c=r.next,u=n.previous,h=r._.r,f=n._.r;do{if(h<=f){if(Jd(c._,i._)){r=c,n.next=r,r.previous=n,--l;continue t}h+=c._.r,c=c.next}else{if(Jd(u._,i._)){(n=u).next=r,r.previous=n,--l;continue t}f+=u._.r,u=u.previous}}while(c!==u.next);for(i.previous=n,i.next=r,n.next=r.previous=r=i,a=Qd(n);(i=i.next)!==r;)(s=Qd(i))<a&&(n=i,a=s);r=n.next}for(n=[r._],i=r;(i=i.next)!==r;)n.push(i._);for(i=Ud(n,e),l=0;l<o;++l)(n=t[l]).x-=i.x,n.y-=i.y;return i.r}function np(t){return Math.sqrt(t.value)}function rp(){var t=null,e=1,n=1,r=zd;function i(i){const o=jd();return i.x=e/2,i.y=n/2,t?i.eachBefore(ip(t)).eachAfter(op(r,.5,o)).eachBefore(ap(1)):i.eachBefore(ip(np)).eachAfter(op(zd,1,o)).eachAfter(op(r,i.r/Math.min(e,n),o)).eachBefore(ap(Math.min(e,n)/(2*i.r))),i}return i.radius=function(e){return arguments.length?(t=Dd(e),i):t},i.size=function(t){return arguments.length?(e=+t[0],n=+t[1],i):[e,n]},i.padding=function(t){return arguments.length?(r="function"==typeof t?t:Fd(+t),i):r},i}function ip(t){return function(e){e.children||(e.r=Math.max(0,+t(e)||0))}}function op(t,e,n){return function(r){if(i=r.children){var i,o,a,s=i.length,l=t(r)*e||0;if(l)for(o=0;o<s;++o)i[o].r+=l;if(a=ep(i,n),l)for(o=0;o<s;++o)i[o].r-=l;r.r=a+l}}}function ap(t){return function(e){var n=e.parent;e.r*=t,n&&(e.x=n.x+t*e.x,e.y=n.y+t*e.y)}}function sp(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 lp(t,e,n,r,i){for(var o,a=t.children,s=-1,l=a.length,c=t.value&&(r-e)/t.value;++s<l;)(o=a[s]).y0=n,o.y1=i,o.x0=e,o.x1=e+=o.value*c}var cp={depth:-1},up={},hp={};function fp(t){return t.id}function dp(t){return t.parentId}function pp(t){let e=t.length;if(e<2)return"";for(;--e>1&&!gp(t,e););return t.slice(0,e)}function gp(t,e){if("/"===t[e]){let n=0;for(;e>0&&"\\"===t[--e];)++n;if(!(1&n))return!0}return!1}function _p(t,e){return t.parent===e.parent?1:2}function yp(t){var e=t.children;return e?e[0]:t.t}function mp(t){var e=t.children;return e?e[e.length-1]:t.t}function bp(t,e,n){var r=n/(e.i-t.i);e.c-=r,e.s+=n,t.c+=r,e.z+=n,e.m+=n}function vp(t,e,n){return t.a.parent===e.parent?t.a:n}function xp(t,e){this._=t,this.parent=null,this.children=null,this.A=null,this.a=this,this.z=0,this.m=0,this.c=0,this.s=0,this.t=null,this.i=e}function wp(){var t=_p,e=1,n=1,r=null;function i(i){var l=function(t){for(var e,n,r,i,o,a=new xp(t,0),s=[a];e=s.pop();)if(r=e._.children)for(e.children=new Array(o=r.length),i=o-1;i>=0;--i)s.push(n=e.children[i]=new xp(r[i],i)),n.parent=e;return(a.parent=new xp(null,0)).children=[a],a}(i);if(l.eachAfter(o),l.parent.m=-l.z,l.eachBefore(a),r)i.eachBefore(s);else{var c=i,u=i,h=i;i.eachBefore(function(t){t.x<c.x&&(c=t),t.x>u.x&&(u=t),t.depth>h.depth&&(h=t)});var f=c===u?1:t(c,u)/2,d=f-c.x,p=e/(u.x+f+d),g=n/(h.depth||1);i.eachBefore(function(t){t.x=(t.x+d)*p,t.y=t.depth*g})}return i}function o(e){var n=e.children,r=e.parent.children,i=e.i?r[e.i-1]:null;if(n){!function(t){for(var e,n=0,r=0,i=t.children,o=i.length;--o>=0;)(e=i[o]).z+=n,e.m+=n,n+=e.s+(r+=e.c)}(e);var o=(n[0].z+n[n.length-1].z)/2;i?(e.z=i.z+t(e._,i._),e.m=e.z-o):e.z=o}else i&&(e.z=i.z+t(e._,i._));e.parent.A=function(e,n,r){if(n){for(var i,o=e,a=e,s=n,l=o.parent.children[0],c=o.m,u=a.m,h=s.m,f=l.m;s=mp(s),o=yp(o),s&&o;)l=yp(l),(a=mp(a)).a=e,(i=s.z+h-o.z-c+t(s._,o._))>0&&(bp(vp(s,e,r),e,i),c+=i,u+=i),h+=s.m,c+=o.m,f+=l.m,u+=a.m;s&&!mp(a)&&(a.t=s,a.m+=h-u),o&&!yp(l)&&(l.t=o,l.m+=c-f,r=e)}return r}(e,i,e.parent.A||r[0])}function a(t){t._.x=t.z+t.parent.m,t.m+=t.parent.m}function s(t){t.x*=e,t.y=t.depth*n}return i.separation=function(e){return arguments.length?(t=e,i):t},i.size=function(t){return arguments.length?(r=!1,e=+t[0],n=+t[1],i):r?null:[e,n]},i.nodeSize=function(t){return arguments.length?(r=!0,e=+t[0],n=+t[1],i):r?[e,n]:null},i}function Ep(t,e,n,r,i){for(var o,a=t.children,s=-1,l=a.length,c=t.value&&(i-n)/t.value;++s<l;)(o=a[s]).x0=e,o.x1=r,o.y0=n,o.y1=n+=o.value*c}xp.prototype=Object.create(Vd.prototype);var Ap=(1+Math.sqrt(5))/2;function Tp(t,e,n,r,i,o){for(var a,s,l,c,u,h,f,d,p,g,_,y=[],m=e.children,b=0,v=0,x=m.length,w=e.value;b<x;){l=i-n,c=o-r;do{u=m[v++].value}while(!u&&v<x);for(h=f=u,_=u*u*(g=Math.max(c/l,l/c)/(w*t)),p=Math.max(f/_,_/h);v<x;++v){if(u+=s=m[v].value,s<h&&(h=s),s>f&&(f=s),_=u*u*g,(d=Math.max(f/_,_/h))>p){u-=s;break}p=d}y.push(a={value:u,dice:l<c,children:m.slice(b,v)}),a.dice?lp(a,n,r,i,w?r+=c*u/w:o):Ep(a,n,r,w?n+=l*u/w:i,o),w-=u,b=v}return y}var Cp=function t(e){function n(t,n,r,i,o){Tp(e,t,n,r,i,o)}return n.ratio=function(e){return t((e=+e)>1?e:1)},n}(Ap);function Sp(){var t=Cp,e=!1,n=1,r=1,i=[0],o=zd,a=zd,s=zd,l=zd,c=zd;function u(t){return t.x0=t.y0=0,t.x1=n,t.y1=r,t.eachBefore(h),i=[0],e&&t.eachBefore(sp),t}function h(e){var n=i[e.depth],r=e.x0+n,u=e.y0+n,h=e.x1-n,f=e.y1-n;h<r&&(r=h=(r+h)/2),f<u&&(u=f=(u+f)/2),e.x0=r,e.y0=u,e.x1=h,e.y1=f,e.children&&(n=i[e.depth+1]=o(e)/2,r+=c(e)-n,u+=a(e)-n,(h-=s(e)-n)<r&&(r=h=(r+h)/2),(f-=l(e)-n)<u&&(u=f=(u+f)/2),t(e,r,u,h,f))}return u.round=function(t){return arguments.length?(e=!!t,u):e},u.size=function(t){return arguments.length?(n=+t[0],r=+t[1],u):[n,r]},u.tile=function(e){return arguments.length?(t=Bd(e),u):t},u.padding=function(t){return arguments.length?u.paddingInner(t).paddingOuter(t):u.paddingInner()},u.paddingInner=function(t){return arguments.length?(o="function"==typeof t?t:Fd(+t),u):o},u.paddingOuter=function(t){return arguments.length?u.paddingTop(t).paddingRight(t).paddingBottom(t).paddingLeft(t):u.paddingTop()},u.paddingTop=function(t){return arguments.length?(a="function"==typeof t?t:Fd(+t),u):a},u.paddingRight=function(t){return arguments.length?(s="function"==typeof t?t:Fd(+t),u):s},u.paddingBottom=function(t){return arguments.length?(l="function"==typeof t?t:Fd(+t),u):l},u.paddingLeft=function(t){return arguments.length?(c="function"==typeof t?t:Fd(+t),u):c},u}var kp=function t(e){function n(t,n,r,i,o){if((a=t._squarify)&&a.ratio===e)for(var a,s,l,c,u,h=-1,f=a.length,d=t.value;++h<f;){for(l=(s=a[h]).children,c=s.value=0,u=l.length;c<u;++c)s.value+=l[c].value;s.dice?lp(s,n,r,i,d?r+=(o-r)*s.value/d:o):Ep(s,n,r,d?n+=(i-n)*s.value/d:i,o),d-=s.value}else t._squarify=a=Tp(e,t,n,r,i,o),a.ratio=e}return n.ratio=function(e){return t((e=+e)>1?e:1)},n}(Ap);function Mp(t,e,n){return(e[0]-t[0])*(n[1]-t[1])-(e[1]-t[1])*(n[0]-t[0])}function Rp(t,e){return t[0]-e[0]||t[1]-e[1]}function Op(t){const e=t.length,n=[0,1];let r,i=2;for(r=2;r<e;++r){for(;i>1&&Mp(t[n[i-2]],t[n[i-1]],t[r])<=0;)--i;n[i++]=r}return n.slice(0,i)}var Np=Math.random,Ip=function t(e){function n(t,n){return t=null==t?0:+t,n=null==n?1:+n,1===arguments.length?(n=t,t=0):n-=t,function(){return e()*n+t}}return n.source=t,n}(Np),Lp=function t(e){function n(t,n){return arguments.length<2&&(n=t,t=0),t=Math.floor(t),n=Math.floor(n)-t,function(){return Math.floor(e()*n+t)}}return n.source=t,n}(Np),Pp=function t(e){function n(t,n){var r,i;return t=null==t?0:+t,n=null==n?1:+n,function(){var o;if(null!=r)o=r,r=null;else do{r=2*e()-1,o=2*e()-1,i=r*r+o*o}while(!i||i>1);return t+n*o*Math.sqrt(-2*Math.log(i)/i)}}return n.source=t,n}(Np),Vp=function t(e){var n=Pp.source(e);function r(){var t=n.apply(this,arguments);return function(){return Math.exp(t())}}return r.source=t,r}(Np),Dp=function t(e){function n(t){return(t=+t)<=0?()=>0:function(){for(var n=0,r=t;r>1;--r)n+=e();return n+r*e()}}return n.source=t,n}(Np),Bp=function t(e){var n=Dp.source(e);function r(t){if(0===(t=+t))return e;var r=n(t);return function(){return r()/t}}return r.source=t,r}(Np),zp=function t(e){function n(t){return function(){return-Math.log1p(-e())/t}}return n.source=t,n}(Np),Fp=function t(e){function n(t){if((t=+t)<0)throw new RangeError("invalid alpha");return t=1/-t,function(){return Math.pow(1-e(),t)}}return n.source=t,n}(Np),Gp=function t(e){function n(t){if((t=+t)<0||t>1)throw new RangeError("invalid p");return function(){return Math.floor(e()+t)}}return n.source=t,n}(Np),jp=function t(e){function n(t){if((t=+t)<0||t>1)throw new RangeError("invalid p");return 0===t?()=>1/0:1===t?()=>1:(t=Math.log1p(-t),function(){return 1+Math.floor(Math.log1p(-e())/t)})}return n.source=t,n}(Np),Up=function t(e){var n=Pp.source(e)();function r(t,r){if((t=+t)<0)throw new RangeError("invalid k");if(0===t)return()=>0;if(r=null==r?1:+r,1===t)return()=>-Math.log1p(-e())*r;var i=(t<1?t+1:t)-1/3,o=1/(3*Math.sqrt(i)),a=t<1?()=>Math.pow(e(),1/t):()=>1;return function(){do{do{var t=n(),s=1+o*t}while(s<=0);s*=s*s;var l=1-e()}while(l>=1-.0331*t*t*t*t&&Math.log(l)>=.5*t*t+i*(1-s+Math.log(s)));return i*s*a()*r}}return r.source=t,r}(Np),Yp=function t(e){var n=Up.source(e);function r(t,e){var r=n(t),i=n(e);return function(){var t=r();return 0===t?0:t/(t+i())}}return r.source=t,r}(Np),Hp=function t(e){var n=jp.source(e),r=Yp.source(e);function i(t,e){return t=+t,(e=+e)>=1?()=>t:e<=0?()=>0:function(){for(var i=0,o=t,a=e;o*a>16&&o*(1-a)>16;){var s=Math.floor((o+1)*a),l=r(s,o-s+1)();l<=a?(i+=s,o-=s,a=(a-l)/(1-l)):(o=s-1,a/=l)}for(var c=a<.5,u=n(c?a:1-a),h=u(),f=0;h<=o;++f)h+=u();return i+(c?f:o-f)}}return i.source=t,i}(Np),qp=function t(e){function n(t,n,r){var i;return 0===(t=+t)?i=t=>-Math.log(t):(t=1/t,i=e=>Math.pow(e,t)),n=null==n?0:+n,r=null==r?1:+r,function(){return n+r*i(-Math.log1p(-e()))}}return n.source=t,n}(Np),Wp=function t(e){function n(t,n){return t=null==t?0:+t,n=null==n?1:+n,function(){return t+n*Math.tan(Math.PI*e())}}return n.source=t,n}(Np),$p=function t(e){function n(t,n){return t=null==t?0:+t,n=null==n?1:+n,function(){var r=e();return t+n*Math.log(r/(1-r))}}return n.source=t,n}(Np),Xp=function t(e){var n=Up.source(e),r=Hp.source(e);function i(t){return function(){for(var i=0,o=t;o>16;){var a=Math.floor(.875*o),s=n(a)();if(s>o)return i+r(a-1,o/s)();i+=a,o-=s}for(var l=-Math.log1p(-e()),c=0;l<=o;++c)l-=Math.log1p(-e());return i+c}}return i.source=t,i}(Np);const Kp=1/4294967296;function Zp(t,e){switch(arguments.length){case 0:break;case 1:this.range(t);break;default:this.range(e).domain(t)}return this}function Jp(t,e){switch(arguments.length){case 0:break;case 1:"function"==typeof t?this.interpolator(t):this.range(t);break;default:this.domain(t),"function"==typeof e?this.interpolator(e):this.range(e)}return this}const Qp=Symbol("implicit");function tg(){var t=new E,e=[],n=[],r=Qp;function i(i){let o=t.get(i);if(void 0===o){if(r!==Qp)return r;t.set(i,o=e.push(i)-1)}return n[o%n.length]}return i.domain=function(n){if(!arguments.length)return e.slice();e=[],t=new E;for(const r of n)t.has(r)||t.set(r,e.push(r)-1);return i},i.range=function(t){return arguments.length?(n=Array.from(t),i):n.slice()},i.unknown=function(t){return arguments.length?(r=t,i):r},i.copy=function(){return tg(e,n).unknown(r)},Zp.apply(i,arguments),i}function eg(){var t,e,n=tg().unknown(void 0),r=n.domain,i=n.range,o=0,a=1,s=!1,l=0,c=0,u=.5;function h(){var n=r().length,h=a<o,f=h?a:o,d=h?o:a;t=(d-f)/Math.max(1,n-l+2*c),s&&(t=Math.floor(t)),f+=(d-f-t*(n-l))*u,e=t*(1-l),s&&(f=Math.round(f),e=Math.round(e));var p=dt(n).map(function(e){return f+t*e});return i(h?p.reverse():p)}return delete n.unknown,n.domain=function(t){return arguments.length?(r(t),h()):r()},n.range=function(t){return arguments.length?([o,a]=t,o=+o,a=+a,h()):[o,a]},n.rangeRound=function(t){return[o,a]=t,o=+o,a=+a,s=!0,h()},n.bandwidth=function(){return e},n.step=function(){return t},n.round=function(t){return arguments.length?(s=!!t,h()):s},n.padding=function(t){return arguments.length?(l=Math.min(1,c=+t),h()):l},n.paddingInner=function(t){return arguments.length?(l=Math.min(1,t),h()):l},n.paddingOuter=function(t){return arguments.length?(c=+t,h()):c},n.align=function(t){return arguments.length?(u=Math.max(0,Math.min(1,t)),h()):u},n.copy=function(){return eg(r(),[o,a]).round(s).paddingInner(l).paddingOuter(c).align(u)},Zp.apply(h(),arguments)}function ng(t){var e=t.copy;return t.padding=t.paddingOuter,delete t.paddingInner,delete t.paddingOuter,t.copy=function(){return ng(e())},t}function rg(){return ng(eg.apply(null,arguments).paddingInner(1))}function ig(t){return+t}var og=[0,1];function ag(t){return t}function sg(t,e){return(e-=t=+t)?function(n){return(n-t)/e}:function(t){return function(){return t}}(isNaN(e)?NaN:.5)}function lg(t,e,n){var r=t[0],i=t[1],o=e[0],a=e[1];return i<r?(r=sg(i,r),o=n(a,o)):(r=sg(r,i),o=n(o,a)),function(t){return o(r(t))}}function cg(t,e,n){var r=Math.min(t.length,e.length)-1,i=new Array(r),o=new Array(r),s=-1;for(t[r]<t[0]&&(t=t.slice().reverse(),e=e.slice().reverse());++s<r;)i[s]=sg(t[s],t[s+1]),o[s]=n(e[s],e[s+1]);return function(e){var n=a(t,e,1,r)-1;return o[n](i[n](e))}}function ug(t,e){return e.domain(t.domain()).range(t.range()).interpolate(t.interpolate()).clamp(t.clamp()).unknown(t.unknown())}function hg(){var t,e,n,r,i,o,a=og,s=og,l=Hr,c=ag;function u(){var t=Math.min(a.length,s.length);return c!==ag&&(c=function(t,e){var n;return t>e&&(n=t,t=e,e=n),function(n){return Math.max(t,Math.min(e,n))}}(a[0],a[t-1])),r=t>2?cg:lg,i=o=null,h}function h(e){return null==e||isNaN(e=+e)?n:(i||(i=r(a.map(t),s,l)))(t(c(e)))}return h.invert=function(n){return c(e((o||(o=r(s,a.map(t),Fr)))(n)))},h.domain=function(t){return arguments.length?(a=Array.from(t,ig),u()):a.slice()},h.range=function(t){return arguments.length?(s=Array.from(t),u()):s.slice()},h.rangeRound=function(t){return s=Array.from(t),l=qr,u()},h.clamp=function(t){return arguments.length?(c=!!t||ag,u()):c!==ag},h.interpolate=function(t){return arguments.length?(l=t,u()):l},h.unknown=function(t){return arguments.length?(n=t,h):n},function(n,r){return t=n,e=r,u()}}function fg(){return hg()(ag,ag)}function dg(t,e,n,r){var i,o=X(t,e,n);switch((r=zl(null==r?",f":r)).type){case"s":var a=Math.max(Math.abs(t),Math.abs(e));return null!=r.precision||isNaN(i=Jl(o,a))||(r.precision=i),ql(r,a);case"":case"e":case"g":case"p":case"r":null!=r.precision||isNaN(i=Ql(o,Math.max(Math.abs(t),Math.abs(e))))||(r.precision=i-("e"===r.type));break;case"f":case"%":null!=r.precision||isNaN(i=Zl(o))||(r.precision=i-2*("%"===r.type))}return Hl(r)}function pg(t){var e=t.domain;return t.ticks=function(t){var n=e();return W(n[0],n[n.length-1],null==t?10:t)},t.tickFormat=function(t,n){var r=e();return dg(r[0],r[r.length-1],null==t?10:t,n)},t.nice=function(n){null==n&&(n=10);var r,i,o=e(),a=0,s=o.length-1,l=o[a],c=o[s],u=10;for(c<l&&(i=l,l=c,c=i,i=a,a=s,s=i);u-- >0;){if((i=$(l,c,n))===r)return o[a]=l,o[s]=c,e(o);if(i>0)l=Math.floor(l/i)*i,c=Math.ceil(c/i)*i;else{if(!(i<0))break;l=Math.ceil(l*i)/i,c=Math.floor(c*i)/i}r=i}return t},t}function gg(){var t=fg();return t.copy=function(){return ug(t,gg())},Zp.apply(t,arguments),pg(t)}function _g(t,e){var n,r=0,i=(t=t.slice()).length-1,o=t[r],a=t[i];return a<o&&(n=r,r=i,i=n,n=o,o=a,a=n),t[r]=e.floor(o),t[i]=e.ceil(a),t}function yg(t){return Math.log(t)}function mg(t){return Math.exp(t)}function bg(t){return-Math.log(-t)}function vg(t){return-Math.exp(-t)}function xg(t){return isFinite(t)?+("1e"+t):t<0?0:t}function wg(t){return(e,n)=>-t(-e,n)}function Eg(t){const e=t(yg,mg),n=e.domain;let r,i,o=10;function a(){return r=function(t){return t===Math.E?Math.log:10===t&&Math.log10||2===t&&Math.log2||(t=Math.log(t),e=>Math.log(e)/t)}(o),i=function(t){return 10===t?xg:t===Math.E?Math.exp:e=>Math.pow(t,e)}(o),n()[0]<0?(r=wg(r),i=wg(i),t(bg,vg)):t(yg,mg),e}return e.base=function(t){return arguments.length?(o=+t,a()):o},e.domain=function(t){return arguments.length?(n(t),a()):n()},e.ticks=t=>{const e=n();let a=e[0],s=e[e.length-1];const l=s<a;l&&([a,s]=[s,a]);let c,u,h=r(a),f=r(s);const d=null==t?10:+t;let p=[];if(!(o%1)&&f-h<d){if(h=Math.floor(h),f=Math.ceil(f),a>0){for(;h<=f;++h)for(c=1;c<o;++c)if(u=h<0?c/i(-h):c*i(h),!(u<a)){if(u>s)break;p.push(u)}}else for(;h<=f;++h)for(c=o-1;c>=1;--c)if(u=h>0?c/i(-h):c*i(h),!(u<a)){if(u>s)break;p.push(u)}2*p.length<d&&(p=W(a,s,d))}else p=W(h,f,Math.min(f-h,d)).map(i);return l?p.reverse():p},e.tickFormat=(t,n)=>{if(null==t&&(t=10),null==n&&(n=10===o?"s":","),"function"!=typeof n&&(o%1||null!=(n=zl(n)).precision||(n.trim=!0),n=Hl(n)),t===1/0)return n;const a=Math.max(1,o*t/e.ticks().length);return t=>{let e=t/i(Math.round(r(t)));return e*o<o-.5&&(e*=o),e<=a?n(t):""}},e.nice=()=>n(_g(n(),{floor:t=>i(Math.floor(r(t))),ceil:t=>i(Math.ceil(r(t)))})),e}function Ag(){const t=Eg(hg()).domain([1,10]);return t.copy=()=>ug(t,Ag()).base(t.base()),Zp.apply(t,arguments),t}function Tg(t){return function(e){return Math.sign(e)*Math.log1p(Math.abs(e/t))}}function Cg(t){return function(e){return Math.sign(e)*Math.expm1(Math.abs(e))*t}}function Sg(t){var e=1,n=t(Tg(e),Cg(e));return n.constant=function(n){return arguments.length?t(Tg(e=+n),Cg(e)):e},pg(n)}function kg(t){return function(e){return e<0?-Math.pow(-e,t):Math.pow(e,t)}}function Mg(t){return t<0?-Math.sqrt(-t):Math.sqrt(t)}function Rg(t){return t<0?-t*t:t*t}function Og(t){var e=t(ag,ag),n=1;return e.exponent=function(e){return arguments.length?1===(n=+e)?t(ag,ag):.5===n?t(Mg,Rg):t(kg(n),kg(1/n)):n},pg(e)}function Ng(){var t=Og(hg());return t.copy=function(){return ug(t,Ng()).exponent(t.exponent())},Zp.apply(t,arguments),t}function Ig(t){return Math.sign(t)*t*t}const Lg=new Date,Pg=new Date;function Vg(t,e,n,r){function i(e){return t(e=0===arguments.length?new Date:new Date(+e)),e}return i.floor=e=>(t(e=new Date(+e)),e),i.ceil=n=>(t(n=new Date(n-1)),e(n,1),t(n),n),i.round=t=>{const e=i(t),n=i.ceil(t);return t-e<n-t?e:n},i.offset=(t,n)=>(e(t=new Date(+t),null==n?1:Math.floor(n)),t),i.range=(n,r,o)=>{const a=[];if(n=i.ceil(n),o=null==o?1:Math.floor(o),!(n<r&&o>0))return a;let s;do{a.push(s=new Date(+n)),e(n,o),t(n)}while(s<n&&n<r);return a},i.filter=n=>Vg(e=>{if(e>=e)for(;t(e),!n(e);)e.setTime(e-1)},(t,r)=>{if(t>=t)if(r<0)for(;++r<=0;)for(;e(t,-1),!n(t););else for(;--r>=0;)for(;e(t,1),!n(t););}),n&&(i.count=(e,r)=>(Lg.setTime(+e),Pg.setTime(+r),t(Lg),t(Pg),Math.floor(n(Lg,Pg))),i.every=t=>(t=Math.floor(t),isFinite(t)&&t>0?t>1?i.filter(r?e=>r(e)%t===0:e=>i.count(0,e)%t===0):i:null)),i}const Dg=Vg(()=>{},(t,e)=>{t.setTime(+t+e)},(t,e)=>e-t);Dg.every=t=>(t=Math.floor(t),isFinite(t)&&t>0?t>1?Vg(e=>{e.setTime(Math.floor(e/t)*t)},(e,n)=>{e.setTime(+e+n*t)},(e,n)=>(n-e)/t):Dg:null);const Bg=Dg.range,zg=1e3,Fg=6e4,Gg=36e5,jg=864e5,Ug=6048e5,Yg=2592e6,Hg=31536e6,qg=Vg(t=>{t.setTime(t-t.getMilliseconds())},(t,e)=>{t.setTime(+t+e*zg)},(t,e)=>(e-t)/zg,t=>t.getUTCSeconds()),Wg=qg.range,$g=Vg(t=>{t.setTime(t-t.getMilliseconds()-t.getSeconds()*zg)},(t,e)=>{t.setTime(+t+e*Fg)},(t,e)=>(e-t)/Fg,t=>t.getMinutes()),Xg=$g.range,Kg=Vg(t=>{t.setUTCSeconds(0,0)},(t,e)=>{t.setTime(+t+e*Fg)},(t,e)=>(e-t)/Fg,t=>t.getUTCMinutes()),Zg=Kg.range,Jg=Vg(t=>{t.setTime(t-t.getMilliseconds()-t.getSeconds()*zg-t.getMinutes()*Fg)},(t,e)=>{t.setTime(+t+e*Gg)},(t,e)=>(e-t)/Gg,t=>t.getHours()),Qg=Jg.range,t_=Vg(t=>{t.setUTCMinutes(0,0,0)},(t,e)=>{t.setTime(+t+e*Gg)},(t,e)=>(e-t)/Gg,t=>t.getUTCHours()),e_=t_.range,n_=Vg(t=>t.setHours(0,0,0,0),(t,e)=>t.setDate(t.getDate()+e),(t,e)=>(e-t-(e.getTimezoneOffset()-t.getTimezoneOffset())*Fg)/jg,t=>t.getDate()-1),r_=n_.range,i_=Vg(t=>{t.setUTCHours(0,0,0,0)},(t,e)=>{t.setUTCDate(t.getUTCDate()+e)},(t,e)=>(e-t)/jg,t=>t.getUTCDate()-1),o_=i_.range,a_=Vg(t=>{t.setUTCHours(0,0,0,0)},(t,e)=>{t.setUTCDate(t.getUTCDate()+e)},(t,e)=>(e-t)/jg,t=>Math.floor(t/jg)),s_=a_.range;function l_(t){return Vg(e=>{e.setDate(e.getDate()-(e.getDay()+7-t)%7),e.setHours(0,0,0,0)},(t,e)=>{t.setDate(t.getDate()+7*e)},(t,e)=>(e-t-(e.getTimezoneOffset()-t.getTimezoneOffset())*Fg)/Ug)}const c_=l_(0),u_=l_(1),h_=l_(2),f_=l_(3),d_=l_(4),p_=l_(5),g_=l_(6),__=c_.range,y_=u_.range,m_=h_.range,b_=f_.range,v_=d_.range,x_=p_.range,w_=g_.range;function E_(t){return Vg(e=>{e.setUTCDate(e.getUTCDate()-(e.getUTCDay()+7-t)%7),e.setUTCHours(0,0,0,0)},(t,e)=>{t.setUTCDate(t.getUTCDate()+7*e)},(t,e)=>(e-t)/Ug)}const A_=E_(0),T_=E_(1),C_=E_(2),S_=E_(3),k_=E_(4),M_=E_(5),R_=E_(6),O_=A_.range,N_=T_.range,I_=C_.range,L_=S_.range,P_=k_.range,V_=M_.range,D_=R_.range,B_=Vg(t=>{t.setDate(1),t.setHours(0,0,0,0)},(t,e)=>{t.setMonth(t.getMonth()+e)},(t,e)=>e.getMonth()-t.getMonth()+12*(e.getFullYear()-t.getFullYear()),t=>t.getMonth()),z_=B_.range,F_=Vg(t=>{t.setUTCDate(1),t.setUTCHours(0,0,0,0)},(t,e)=>{t.setUTCMonth(t.getUTCMonth()+e)},(t,e)=>e.getUTCMonth()-t.getUTCMonth()+12*(e.getUTCFullYear()-t.getUTCFullYear()),t=>t.getUTCMonth()),G_=F_.range,j_=Vg(t=>{t.setMonth(0,1),t.setHours(0,0,0,0)},(t,e)=>{t.setFullYear(t.getFullYear()+e)},(t,e)=>e.getFullYear()-t.getFullYear(),t=>t.getFullYear());j_.every=t=>isFinite(t=Math.floor(t))&&t>0?Vg(e=>{e.setFullYear(Math.floor(e.getFullYear()/t)*t),e.setMonth(0,1),e.setHours(0,0,0,0)},(e,n)=>{e.setFullYear(e.getFullYear()+n*t)}):null;const U_=j_.range,Y_=Vg(t=>{t.setUTCMonth(0,1),t.setUTCHours(0,0,0,0)},(t,e)=>{t.setUTCFullYear(t.getUTCFullYear()+e)},(t,e)=>e.getUTCFullYear()-t.getUTCFullYear(),t=>t.getUTCFullYear());Y_.every=t=>isFinite(t=Math.floor(t))&&t>0?Vg(e=>{e.setUTCFullYear(Math.floor(e.getUTCFullYear()/t)*t),e.setUTCMonth(0,1),e.setUTCHours(0,0,0,0)},(e,n)=>{e.setUTCFullYear(e.getUTCFullYear()+n*t)}):null;const H_=Y_.range;function q_(t,e,r,i,o,a){const s=[[qg,1,zg],[qg,5,5e3],[qg,15,15e3],[qg,30,3e4],[a,1,Fg],[a,5,3e5],[a,15,9e5],[a,30,18e5],[o,1,Gg],[o,3,108e5],[o,6,216e5],[o,12,432e5],[i,1,jg],[i,2,1728e5],[r,1,Ug],[e,1,Yg],[e,3,7776e6],[t,1,Hg]];function l(e,r,i){const o=Math.abs(r-e)/i,a=n(([,,t])=>t).right(s,o);if(a===s.length)return t.every(X(e/Hg,r/Hg,i));if(0===a)return Dg.every(Math.max(X(e,r,i),1));const[l,c]=s[o/s[a-1][2]<s[a][2]/o?a-1:a];return l.every(c)}return[function(t,e,n){const r=e<t;r&&([t,e]=[e,t]);const i=n&&"function"==typeof n.range?n:l(t,e,n),o=i?i.range(t,+e+1):[];return r?o.reverse():o},l]}const[W_,$_]=q_(Y_,F_,A_,a_,t_,Kg),[X_,K_]=q_(j_,B_,c_,n_,Jg,$g);function Z_(t){if(0<=t.y&&t.y<100){var e=new Date(-1,t.m,t.d,t.H,t.M,t.S,t.L);return e.setFullYear(t.y),e}return new Date(t.y,t.m,t.d,t.H,t.M,t.S,t.L)}function J_(t){if(0<=t.y&&t.y<100){var e=new Date(Date.UTC(-1,t.m,t.d,t.H,t.M,t.S,t.L));return e.setUTCFullYear(t.y),e}return new Date(Date.UTC(t.y,t.m,t.d,t.H,t.M,t.S,t.L))}function Q_(t,e,n){return{y:t,m:e,d:n,H:0,M:0,S:0,L:0}}function ty(t){var e=t.dateTime,n=t.date,r=t.time,i=t.periods,o=t.days,a=t.shortDays,s=t.months,l=t.shortMonths,c=fy(i),u=dy(i),h=fy(o),f=dy(o),d=fy(a),p=dy(a),g=fy(s),_=dy(s),y=fy(l),m=dy(l),b={a:function(t){return a[t.getDay()]},A:function(t){return o[t.getDay()]},b:function(t){return l[t.getMonth()]},B:function(t){return s[t.getMonth()]},c:null,d:Ly,e:Ly,f:zy,g:Ky,G:Jy,H:Py,I:Vy,j:Dy,L:By,m:Fy,M:Gy,p:function(t){return i[+(t.getHours()>=12)]},q:function(t){return 1+~~(t.getMonth()/3)},Q:xm,s:wm,S:jy,u:Uy,U:Yy,V:qy,w:Wy,W:$y,x:null,X:null,y:Xy,Y:Zy,Z:Qy,"%":vm},v={a:function(t){return a[t.getUTCDay()]},A:function(t){return o[t.getUTCDay()]},b:function(t){return l[t.getUTCMonth()]},B:function(t){return s[t.getUTCMonth()]},c:null,d:tm,e:tm,f:om,g:_m,G:mm,H:em,I:nm,j:rm,L:im,m:am,M:sm,p:function(t){return i[+(t.getUTCHours()>=12)]},q:function(t){return 1+~~(t.getUTCMonth()/3)},Q:xm,s:wm,S:lm,u:cm,U:um,V:fm,w:dm,W:pm,x:null,X:null,y:gm,Y:ym,Z:bm,"%":vm},x={a:function(t,e,n){var r=d.exec(e.slice(n));return r?(t.w=p.get(r[0].toLowerCase()),n+r[0].length):-1},A:function(t,e,n){var r=h.exec(e.slice(n));return r?(t.w=f.get(r[0].toLowerCase()),n+r[0].length):-1},b:function(t,e,n){var r=y.exec(e.slice(n));return r?(t.m=m.get(r[0].toLowerCase()),n+r[0].length):-1},B:function(t,e,n){var r=g.exec(e.slice(n));return r?(t.m=_.get(r[0].toLowerCase()),n+r[0].length):-1},c:function(t,n,r){return A(t,e,n,r)},d:Ay,e:Ay,f:Ry,g:vy,G:by,H:Cy,I:Cy,j:Ty,L:My,m:Ey,M:Sy,p:function(t,e,n){var r=c.exec(e.slice(n));return r?(t.p=u.get(r[0].toLowerCase()),n+r[0].length):-1},q:wy,Q:Ny,s:Iy,S:ky,u:gy,U:_y,V:yy,w:py,W:my,x:function(t,e,r){return A(t,n,e,r)},X:function(t,e,n){return A(t,r,e,n)},y:vy,Y:by,Z:xy,"%":Oy};function w(t,e){return function(n){var r,i,o,a=[],s=-1,l=0,c=t.length;for(n instanceof Date||(n=new Date(+n));++s<c;)37===t.charCodeAt(s)&&(a.push(t.slice(l,s)),null!=(i=ay[r=t.charAt(++s)])?r=t.charAt(++s):i="e"===r?" ":"0",(o=e[r])&&(r=o(n,i)),a.push(r),l=s+1);return a.push(t.slice(l,s)),a.join("")}}function E(t,e){return function(n){var r,i,o=Q_(1900,void 0,1);if(A(o,t,n+="",0)!=n.length)return null;if("Q"in o)return new Date(o.Q);if("s"in o)return new Date(1e3*o.s+("L"in o?o.L:0));if(e&&!("Z"in o)&&(o.Z=0),"p"in o&&(o.H=o.H%12+12*o.p),void 0===o.m&&(o.m="q"in o?o.q:0),"V"in o){if(o.V<1||o.V>53)return null;"w"in o||(o.w=1),"Z"in o?(i=(r=J_(Q_(o.y,0,1))).getUTCDay(),r=i>4||0===i?T_.ceil(r):T_(r),r=i_.offset(r,7*(o.V-1)),o.y=r.getUTCFullYear(),o.m=r.getUTCMonth(),o.d=r.getUTCDate()+(o.w+6)%7):(i=(r=Z_(Q_(o.y,0,1))).getDay(),r=i>4||0===i?u_.ceil(r):u_(r),r=n_.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?J_(Q_(o.y,0,1)).getUTCDay():Z_(Q_(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,J_(o)):Z_(o)}}function A(t,e,n,r){for(var i,o,a=0,s=e.length,l=n.length;a<s;){if(r>=l)return-1;if(37===(i=e.charCodeAt(a++))){if(i=e.charAt(a++),!(o=x[i in ay?e.charAt(a++):i])||(r=o(t,n,r))<0)return-1}else if(i!=n.charCodeAt(r++))return-1}return r}return b.x=w(n,b),b.X=w(r,b),b.c=w(e,b),v.x=w(n,v),v.X=w(r,v),v.c=w(e,v),{format:function(t){var e=w(t+="",b);return e.toString=function(){return t},e},parse:function(t){var e=E(t+="",!1);return e.toString=function(){return t},e},utcFormat:function(t){var e=w(t+="",v);return e.toString=function(){return t},e},utcParse:function(t){var e=E(t+="",!0);return e.toString=function(){return t},e}}}var ey,ny,ry,iy,oy,ay={"-":"",_:" ",0:"0"},sy=/^\s*\d+/,ly=/^%/,cy=/[\\^$*+?|[\]().{}]/g;function uy(t,e,n){var r=t<0?"-":"",i=(r?-t:t)+"",o=i.length;return r+(o<n?new Array(n-o+1).join(e)+i:i)}function hy(t){return t.replace(cy,"\\$&")}function fy(t){return new RegExp("^(?:"+t.map(hy).join("|")+")","i")}function dy(t){return new Map(t.map((t,e)=>[t.toLowerCase(),e]))}function py(t,e,n){var r=sy.exec(e.slice(n,n+1));return r?(t.w=+r[0],n+r[0].length):-1}function gy(t,e,n){var r=sy.exec(e.slice(n,n+1));return r?(t.u=+r[0],n+r[0].length):-1}function _y(t,e,n){var r=sy.exec(e.slice(n,n+2));return r?(t.U=+r[0],n+r[0].length):-1}function yy(t,e,n){var r=sy.exec(e.slice(n,n+2));return r?(t.V=+r[0],n+r[0].length):-1}function my(t,e,n){var r=sy.exec(e.slice(n,n+2));return r?(t.W=+r[0],n+r[0].length):-1}function by(t,e,n){var r=sy.exec(e.slice(n,n+4));return r?(t.y=+r[0],n+r[0].length):-1}function vy(t,e,n){var r=sy.exec(e.slice(n,n+2));return r?(t.y=+r[0]+(+r[0]>68?1900:2e3),n+r[0].length):-1}function xy(t,e,n){var r=/^(Z)|([+-]\d\d)(?::?(\d\d))?/.exec(e.slice(n,n+6));return r?(t.Z=r[1]?0:-(r[2]+(r[3]||"00")),n+r[0].length):-1}function wy(t,e,n){var r=sy.exec(e.slice(n,n+1));return r?(t.q=3*r[0]-3,n+r[0].length):-1}function Ey(t,e,n){var r=sy.exec(e.slice(n,n+2));return r?(t.m=r[0]-1,n+r[0].length):-1}function Ay(t,e,n){var r=sy.exec(e.slice(n,n+2));return r?(t.d=+r[0],n+r[0].length):-1}function Ty(t,e,n){var r=sy.exec(e.slice(n,n+3));return r?(t.m=0,t.d=+r[0],n+r[0].length):-1}function Cy(t,e,n){var r=sy.exec(e.slice(n,n+2));return r?(t.H=+r[0],n+r[0].length):-1}function Sy(t,e,n){var r=sy.exec(e.slice(n,n+2));return r?(t.M=+r[0],n+r[0].length):-1}function ky(t,e,n){var r=sy.exec(e.slice(n,n+2));return r?(t.S=+r[0],n+r[0].length):-1}function My(t,e,n){var r=sy.exec(e.slice(n,n+3));return r?(t.L=+r[0],n+r[0].length):-1}function Ry(t,e,n){var r=sy.exec(e.slice(n,n+6));return r?(t.L=Math.floor(r[0]/1e3),n+r[0].length):-1}function Oy(t,e,n){var r=ly.exec(e.slice(n,n+1));return r?n+r[0].length:-1}function Ny(t,e,n){var r=sy.exec(e.slice(n));return r?(t.Q=+r[0],n+r[0].length):-1}function Iy(t,e,n){var r=sy.exec(e.slice(n));return r?(t.s=+r[0],n+r[0].length):-1}function Ly(t,e){return uy(t.getDate(),e,2)}function Py(t,e){return uy(t.getHours(),e,2)}function Vy(t,e){return uy(t.getHours()%12||12,e,2)}function Dy(t,e){return uy(1+n_.count(j_(t),t),e,3)}function By(t,e){return uy(t.getMilliseconds(),e,3)}function zy(t,e){return By(t,e)+"000"}function Fy(t,e){return uy(t.getMonth()+1,e,2)}function Gy(t,e){return uy(t.getMinutes(),e,2)}function jy(t,e){return uy(t.getSeconds(),e,2)}function Uy(t){var e=t.getDay();return 0===e?7:e}function Yy(t,e){return uy(c_.count(j_(t)-1,t),e,2)}function Hy(t){var e=t.getDay();return e>=4||0===e?d_(t):d_.ceil(t)}function qy(t,e){return t=Hy(t),uy(d_.count(j_(t),t)+(4===j_(t).getDay()),e,2)}function Wy(t){return t.getDay()}function $y(t,e){return uy(u_.count(j_(t)-1,t),e,2)}function Xy(t,e){return uy(t.getFullYear()%100,e,2)}function Ky(t,e){return uy((t=Hy(t)).getFullYear()%100,e,2)}function Zy(t,e){return uy(t.getFullYear()%1e4,e,4)}function Jy(t,e){var n=t.getDay();return uy((t=n>=4||0===n?d_(t):d_.ceil(t)).getFullYear()%1e4,e,4)}function Qy(t){var e=t.getTimezoneOffset();return(e>0?"-":(e*=-1,"+"))+uy(e/60|0,"0",2)+uy(e%60,"0",2)}function tm(t,e){return uy(t.getUTCDate(),e,2)}function em(t,e){return uy(t.getUTCHours(),e,2)}function nm(t,e){return uy(t.getUTCHours()%12||12,e,2)}function rm(t,e){return uy(1+i_.count(Y_(t),t),e,3)}function im(t,e){return uy(t.getUTCMilliseconds(),e,3)}function om(t,e){return im(t,e)+"000"}function am(t,e){return uy(t.getUTCMonth()+1,e,2)}function sm(t,e){return uy(t.getUTCMinutes(),e,2)}function lm(t,e){return uy(t.getUTCSeconds(),e,2)}function cm(t){var e=t.getUTCDay();return 0===e?7:e}function um(t,e){return uy(A_.count(Y_(t)-1,t),e,2)}function hm(t){var e=t.getUTCDay();return e>=4||0===e?k_(t):k_.ceil(t)}function fm(t,e){return t=hm(t),uy(k_.count(Y_(t),t)+(4===Y_(t).getUTCDay()),e,2)}function dm(t){return t.getUTCDay()}function pm(t,e){return uy(T_.count(Y_(t)-1,t),e,2)}function gm(t,e){return uy(t.getUTCFullYear()%100,e,2)}function _m(t,e){return uy((t=hm(t)).getUTCFullYear()%100,e,2)}function ym(t,e){return uy(t.getUTCFullYear()%1e4,e,4)}function mm(t,e){var n=t.getUTCDay();return uy((t=n>=4||0===n?k_(t):k_.ceil(t)).getUTCFullYear()%1e4,e,4)}function bm(){return"+0000"}function vm(){return"%"}function xm(t){return+t}function wm(t){return Math.floor(+t/1e3)}function Em(t){return ey=ty(t),ny=ey.format,ry=ey.parse,iy=ey.utcFormat,oy=ey.utcParse,ey}Em({dateTime:"%x, %X",date:"%-m/%-d/%Y",time:"%-I:%M:%S %p",periods:["AM","PM"],days:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],shortDays:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],months:["January","February","March","April","May","June","July","August","September","October","November","December"],shortMonths:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"]});var Am="%Y-%m-%dT%H:%M:%S.%LZ";var Tm=Date.prototype.toISOString?function(t){return t.toISOString()}:iy(Am);var Cm=+new Date("2000-01-01T00:00:00.000Z")?function(t){var e=new Date(t);return isNaN(e)?null:e}:oy(Am);function Sm(t){return new Date(t)}function km(t){return t instanceof Date?+t:+new Date(+t)}function Mm(t,e,n,r,i,o,a,s,l,c){var u=fg(),h=u.invert,f=u.domain,d=c(".%L"),p=c(":%S"),g=c("%I:%M"),_=c("%I %p"),y=c("%a %d"),m=c("%b %d"),b=c("%B"),v=c("%Y");function x(t){return(l(t)<t?d:s(t)<t?p:a(t)<t?g:o(t)<t?_:r(t)<t?i(t)<t?y:m:n(t)<t?b:v)(t)}return u.invert=function(t){return new Date(h(t))},u.domain=function(t){return arguments.length?f(Array.from(t,km)):f().map(Sm)},u.ticks=function(e){var n=f();return t(n[0],n[n.length-1],null==e?10:e)},u.tickFormat=function(t,e){return null==e?x:c(e)},u.nice=function(t){var n=f();return t&&"function"==typeof t.range||(t=e(n[0],n[n.length-1],null==t?10:t)),t?f(_g(n,t)):u},u.copy=function(){return ug(u,Mm(t,e,n,r,i,o,a,s,l,c))},u}function Rm(){return Zp.apply(Mm(X_,K_,j_,B_,c_,n_,Jg,$g,qg,ny).domain([new Date(2e3,0,1),new Date(2e3,0,2)]),arguments)}function Om(){var t,e,n,r,i,o=0,a=1,s=ag,l=!1;function c(e){return null==e||isNaN(e=+e)?i:s(0===n?.5:(e=(r(e)-t)*n,l?Math.max(0,Math.min(1,e)):e))}function u(t){return function(e){var n,r;return arguments.length?([n,r]=e,s=t(n,r),c):[s(0),s(1)]}}return c.domain=function(i){return arguments.length?([o,a]=i,t=r(o=+o),e=r(a=+a),n=t===e?0:1/(e-t),c):[o,a]},c.clamp=function(t){return arguments.length?(l=!!t,c):l},c.interpolator=function(t){return arguments.length?(s=t,c):s},c.range=u(Hr),c.rangeRound=u(qr),c.unknown=function(t){return arguments.length?(i=t,c):i},function(i){return r=i,t=i(o),e=i(a),n=t===e?0:1/(e-t),c}}function Nm(t,e){return e.domain(t.domain()).interpolator(t.interpolator()).clamp(t.clamp()).unknown(t.unknown())}function Im(){var t=pg(Om()(ag));return t.copy=function(){return Nm(t,Im())},Jp.apply(t,arguments)}function Lm(){var t=Og(Om());return t.copy=function(){return Nm(t,Lm()).exponent(t.exponent())},Jp.apply(t,arguments)}function Pm(){var t,e,n,r,i,o,a,s=0,l=.5,c=1,u=1,h=ag,f=!1;function d(t){return isNaN(t=+t)?a:(t=.5+((t=+o(t))-e)*(u*t<u*e?r:i),h(f?Math.max(0,Math.min(1,t)):t))}function p(t){return function(e){var n,r,i;return arguments.length?([n,r,i]=e,h=hi(t,[n,r,i]),d):[h(0),h(.5),h(1)]}}return d.domain=function(a){return arguments.length?([s,l,c]=a,t=o(s=+s),e=o(l=+l),n=o(c=+c),r=t===e?0:.5/(e-t),i=e===n?0:.5/(n-e),u=e<t?-1:1,d):[s,l,c]},d.clamp=function(t){return arguments.length?(f=!!t,d):f},d.interpolator=function(t){return arguments.length?(h=t,d):h},d.range=p(Hr),d.rangeRound=p(qr),d.unknown=function(t){return arguments.length?(a=t,d):a},function(a){return o=a,t=a(s),e=a(l),n=a(c),r=t===e?0:.5/(e-t),i=e===n?0:.5/(n-e),u=e<t?-1:1,d}}function Vm(){var t=Og(Pm());return t.copy=function(){return Nm(t,Vm()).exponent(t.exponent())},Jp.apply(t,arguments)}function Dm(t){for(var e=t.length/6|0,n=new Array(e),r=0;r<e;)n[r]="#"+t.slice(6*r,6*++r);return n}var Bm=Dm("1f77b4ff7f0e2ca02cd627289467bd8c564be377c27f7f7fbcbd2217becf"),zm=Dm("7fc97fbeaed4fdc086ffff99386cb0f0027fbf5b17666666"),Fm=Dm("1b9e77d95f027570b3e7298a66a61ee6ab02a6761d666666"),Gm=Dm("4269d0efb118ff725c6cc5b03ca951ff8ab7a463f297bbf59c6b4e9498a0"),jm=Dm("a6cee31f78b4b2df8a33a02cfb9a99e31a1cfdbf6fff7f00cab2d66a3d9affff99b15928"),Um=Dm("fbb4aeb3cde3ccebc5decbe4fed9a6ffffcce5d8bdfddaecf2f2f2"),Ym=Dm("b3e2cdfdcdaccbd5e8f4cae4e6f5c9fff2aef1e2cccccccc"),Hm=Dm("e41a1c377eb84daf4a984ea3ff7f00ffff33a65628f781bf999999"),qm=Dm("66c2a5fc8d628da0cbe78ac3a6d854ffd92fe5c494b3b3b3"),Wm=Dm("8dd3c7ffffb3bebadafb807280b1d3fdb462b3de69fccde5d9d9d9bc80bdccebc5ffed6f"),$m=Dm("4e79a7f28e2ce1575976b7b259a14fedc949af7aa1ff9da79c755fbab0ab"),Xm=t=>Lr(t[t.length-1]),Km=new Array(3).concat("d8b365f5f5f55ab4ac","a6611adfc27d80cdc1018571","a6611adfc27df5f5f580cdc1018571","8c510ad8b365f6e8c3c7eae55ab4ac01665e","8c510ad8b365f6e8c3f5f5f5c7eae55ab4ac01665e","8c510abf812ddfc27df6e8c3c7eae580cdc135978f01665e","8c510abf812ddfc27df6e8c3f5f5f5c7eae580cdc135978f01665e","5430058c510abf812ddfc27df6e8c3c7eae580cdc135978f01665e003c30","5430058c510abf812ddfc27df6e8c3f5f5f5c7eae580cdc135978f01665e003c30").map(Dm),Zm=Xm(Km),Jm=new Array(3).concat("af8dc3f7f7f77fbf7b","7b3294c2a5cfa6dba0008837","7b3294c2a5cff7f7f7a6dba0008837","762a83af8dc3e7d4e8d9f0d37fbf7b1b7837","762a83af8dc3e7d4e8f7f7f7d9f0d37fbf7b1b7837","762a839970abc2a5cfe7d4e8d9f0d3a6dba05aae611b7837","762a839970abc2a5cfe7d4e8f7f7f7d9f0d3a6dba05aae611b7837","40004b762a839970abc2a5cfe7d4e8d9f0d3a6dba05aae611b783700441b","40004b762a839970abc2a5cfe7d4e8f7f7f7d9f0d3a6dba05aae611b783700441b").map(Dm),Qm=Xm(Jm),tb=new Array(3).concat("e9a3c9f7f7f7a1d76a","d01c8bf1b6dab8e1864dac26","d01c8bf1b6daf7f7f7b8e1864dac26","c51b7de9a3c9fde0efe6f5d0a1d76a4d9221","c51b7de9a3c9fde0eff7f7f7e6f5d0a1d76a4d9221","c51b7dde77aef1b6dafde0efe6f5d0b8e1867fbc414d9221","c51b7dde77aef1b6dafde0eff7f7f7e6f5d0b8e1867fbc414d9221","8e0152c51b7dde77aef1b6dafde0efe6f5d0b8e1867fbc414d9221276419","8e0152c51b7dde77aef1b6dafde0eff7f7f7e6f5d0b8e1867fbc414d9221276419").map(Dm),eb=Xm(tb),nb=new Array(3).concat("998ec3f7f7f7f1a340","5e3c99b2abd2fdb863e66101","5e3c99b2abd2f7f7f7fdb863e66101","542788998ec3d8daebfee0b6f1a340b35806","542788998ec3d8daebf7f7f7fee0b6f1a340b35806","5427888073acb2abd2d8daebfee0b6fdb863e08214b35806","5427888073acb2abd2d8daebf7f7f7fee0b6fdb863e08214b35806","2d004b5427888073acb2abd2d8daebfee0b6fdb863e08214b358067f3b08","2d004b5427888073acb2abd2d8daebf7f7f7fee0b6fdb863e08214b358067f3b08").map(Dm),rb=Xm(nb),ib=new Array(3).concat("ef8a62f7f7f767a9cf","ca0020f4a58292c5de0571b0","ca0020f4a582f7f7f792c5de0571b0","b2182bef8a62fddbc7d1e5f067a9cf2166ac","b2182bef8a62fddbc7f7f7f7d1e5f067a9cf2166ac","b2182bd6604df4a582fddbc7d1e5f092c5de4393c32166ac","b2182bd6604df4a582fddbc7f7f7f7d1e5f092c5de4393c32166ac","67001fb2182bd6604df4a582fddbc7d1e5f092c5de4393c32166ac053061","67001fb2182bd6604df4a582fddbc7f7f7f7d1e5f092c5de4393c32166ac053061").map(Dm),ob=Xm(ib),ab=new Array(3).concat("ef8a62ffffff999999","ca0020f4a582bababa404040","ca0020f4a582ffffffbababa404040","b2182bef8a62fddbc7e0e0e09999994d4d4d","b2182bef8a62fddbc7ffffffe0e0e09999994d4d4d","b2182bd6604df4a582fddbc7e0e0e0bababa8787874d4d4d","b2182bd6604df4a582fddbc7ffffffe0e0e0bababa8787874d4d4d","67001fb2182bd6604df4a582fddbc7e0e0e0bababa8787874d4d4d1a1a1a","67001fb2182bd6604df4a582fddbc7ffffffe0e0e0bababa8787874d4d4d1a1a1a").map(Dm),sb=Xm(ab),lb=new Array(3).concat("fc8d59ffffbf91bfdb","d7191cfdae61abd9e92c7bb6","d7191cfdae61ffffbfabd9e92c7bb6","d73027fc8d59fee090e0f3f891bfdb4575b4","d73027fc8d59fee090ffffbfe0f3f891bfdb4575b4","d73027f46d43fdae61fee090e0f3f8abd9e974add14575b4","d73027f46d43fdae61fee090ffffbfe0f3f8abd9e974add14575b4","a50026d73027f46d43fdae61fee090e0f3f8abd9e974add14575b4313695","a50026d73027f46d43fdae61fee090ffffbfe0f3f8abd9e974add14575b4313695").map(Dm),cb=Xm(lb),ub=new Array(3).concat("fc8d59ffffbf91cf60","d7191cfdae61a6d96a1a9641","d7191cfdae61ffffbfa6d96a1a9641","d73027fc8d59fee08bd9ef8b91cf601a9850","d73027fc8d59fee08bffffbfd9ef8b91cf601a9850","d73027f46d43fdae61fee08bd9ef8ba6d96a66bd631a9850","d73027f46d43fdae61fee08bffffbfd9ef8ba6d96a66bd631a9850","a50026d73027f46d43fdae61fee08bd9ef8ba6d96a66bd631a9850006837","a50026d73027f46d43fdae61fee08bffffbfd9ef8ba6d96a66bd631a9850006837").map(Dm),hb=Xm(ub),fb=new Array(3).concat("fc8d59ffffbf99d594","d7191cfdae61abdda42b83ba","d7191cfdae61ffffbfabdda42b83ba","d53e4ffc8d59fee08be6f59899d5943288bd","d53e4ffc8d59fee08bffffbfe6f59899d5943288bd","d53e4ff46d43fdae61fee08be6f598abdda466c2a53288bd","d53e4ff46d43fdae61fee08bffffbfe6f598abdda466c2a53288bd","9e0142d53e4ff46d43fdae61fee08be6f598abdda466c2a53288bd5e4fa2","9e0142d53e4ff46d43fdae61fee08bffffbfe6f598abdda466c2a53288bd5e4fa2").map(Dm),db=Xm(fb),pb=new Array(3).concat("e5f5f999d8c92ca25f","edf8fbb2e2e266c2a4238b45","edf8fbb2e2e266c2a42ca25f006d2c","edf8fbccece699d8c966c2a42ca25f006d2c","edf8fbccece699d8c966c2a441ae76238b45005824","f7fcfde5f5f9ccece699d8c966c2a441ae76238b45005824","f7fcfde5f5f9ccece699d8c966c2a441ae76238b45006d2c00441b").map(Dm),gb=Xm(pb),_b=new Array(3).concat("e0ecf49ebcda8856a7","edf8fbb3cde38c96c688419d","edf8fbb3cde38c96c68856a7810f7c","edf8fbbfd3e69ebcda8c96c68856a7810f7c","edf8fbbfd3e69ebcda8c96c68c6bb188419d6e016b","f7fcfde0ecf4bfd3e69ebcda8c96c68c6bb188419d6e016b","f7fcfde0ecf4bfd3e69ebcda8c96c68c6bb188419d810f7c4d004b").map(Dm),yb=Xm(_b),mb=new Array(3).concat("e0f3dba8ddb543a2ca","f0f9e8bae4bc7bccc42b8cbe","f0f9e8bae4bc7bccc443a2ca0868ac","f0f9e8ccebc5a8ddb57bccc443a2ca0868ac","f0f9e8ccebc5a8ddb57bccc44eb3d32b8cbe08589e","f7fcf0e0f3dbccebc5a8ddb57bccc44eb3d32b8cbe08589e","f7fcf0e0f3dbccebc5a8ddb57bccc44eb3d32b8cbe0868ac084081").map(Dm),bb=Xm(mb),vb=new Array(3).concat("fee8c8fdbb84e34a33","fef0d9fdcc8afc8d59d7301f","fef0d9fdcc8afc8d59e34a33b30000","fef0d9fdd49efdbb84fc8d59e34a33b30000","fef0d9fdd49efdbb84fc8d59ef6548d7301f990000","fff7ecfee8c8fdd49efdbb84fc8d59ef6548d7301f990000","fff7ecfee8c8fdd49efdbb84fc8d59ef6548d7301fb300007f0000").map(Dm),xb=Xm(vb),wb=new Array(3).concat("ece2f0a6bddb1c9099","f6eff7bdc9e167a9cf02818a","f6eff7bdc9e167a9cf1c9099016c59","f6eff7d0d1e6a6bddb67a9cf1c9099016c59","f6eff7d0d1e6a6bddb67a9cf3690c002818a016450","fff7fbece2f0d0d1e6a6bddb67a9cf3690c002818a016450","fff7fbece2f0d0d1e6a6bddb67a9cf3690c002818a016c59014636").map(Dm),Eb=Xm(wb),Ab=new Array(3).concat("ece7f2a6bddb2b8cbe","f1eef6bdc9e174a9cf0570b0","f1eef6bdc9e174a9cf2b8cbe045a8d","f1eef6d0d1e6a6bddb74a9cf2b8cbe045a8d","f1eef6d0d1e6a6bddb74a9cf3690c00570b0034e7b","fff7fbece7f2d0d1e6a6bddb74a9cf3690c00570b0034e7b","fff7fbece7f2d0d1e6a6bddb74a9cf3690c00570b0045a8d023858").map(Dm),Tb=Xm(Ab),Cb=new Array(3).concat("e7e1efc994c7dd1c77","f1eef6d7b5d8df65b0ce1256","f1eef6d7b5d8df65b0dd1c77980043","f1eef6d4b9dac994c7df65b0dd1c77980043","f1eef6d4b9dac994c7df65b0e7298ace125691003f","f7f4f9e7e1efd4b9dac994c7df65b0e7298ace125691003f","f7f4f9e7e1efd4b9dac994c7df65b0e7298ace125698004367001f").map(Dm),Sb=Xm(Cb),kb=new Array(3).concat("fde0ddfa9fb5c51b8a","feebe2fbb4b9f768a1ae017e","feebe2fbb4b9f768a1c51b8a7a0177","feebe2fcc5c0fa9fb5f768a1c51b8a7a0177","feebe2fcc5c0fa9fb5f768a1dd3497ae017e7a0177","fff7f3fde0ddfcc5c0fa9fb5f768a1dd3497ae017e7a0177","fff7f3fde0ddfcc5c0fa9fb5f768a1dd3497ae017e7a017749006a").map(Dm),Mb=Xm(kb),Rb=new Array(3).concat("edf8b17fcdbb2c7fb8","ffffcca1dab441b6c4225ea8","ffffcca1dab441b6c42c7fb8253494","ffffccc7e9b47fcdbb41b6c42c7fb8253494","ffffccc7e9b47fcdbb41b6c41d91c0225ea80c2c84","ffffd9edf8b1c7e9b47fcdbb41b6c41d91c0225ea80c2c84","ffffd9edf8b1c7e9b47fcdbb41b6c41d91c0225ea8253494081d58").map(Dm),Ob=Xm(Rb),Nb=new Array(3).concat("f7fcb9addd8e31a354","ffffccc2e69978c679238443","ffffccc2e69978c67931a354006837","ffffccd9f0a3addd8e78c67931a354006837","ffffccd9f0a3addd8e78c67941ab5d238443005a32","ffffe5f7fcb9d9f0a3addd8e78c67941ab5d238443005a32","ffffe5f7fcb9d9f0a3addd8e78c67941ab5d238443006837004529").map(Dm),Ib=Xm(Nb),Lb=new Array(3).concat("fff7bcfec44fd95f0e","ffffd4fed98efe9929cc4c02","ffffd4fed98efe9929d95f0e993404","ffffd4fee391fec44ffe9929d95f0e993404","ffffd4fee391fec44ffe9929ec7014cc4c028c2d04","ffffe5fff7bcfee391fec44ffe9929ec7014cc4c028c2d04","ffffe5fff7bcfee391fec44ffe9929ec7014cc4c02993404662506").map(Dm),Pb=Xm(Lb),Vb=new Array(3).concat("ffeda0feb24cf03b20","ffffb2fecc5cfd8d3ce31a1c","ffffb2fecc5cfd8d3cf03b20bd0026","ffffb2fed976feb24cfd8d3cf03b20bd0026","ffffb2fed976feb24cfd8d3cfc4e2ae31a1cb10026","ffffccffeda0fed976feb24cfd8d3cfc4e2ae31a1cb10026","ffffccffeda0fed976feb24cfd8d3cfc4e2ae31a1cbd0026800026").map(Dm),Db=Xm(Vb),Bb=new Array(3).concat("deebf79ecae13182bd","eff3ffbdd7e76baed62171b5","eff3ffbdd7e76baed63182bd08519c","eff3ffc6dbef9ecae16baed63182bd08519c","eff3ffc6dbef9ecae16baed64292c62171b5084594","f7fbffdeebf7c6dbef9ecae16baed64292c62171b5084594","f7fbffdeebf7c6dbef9ecae16baed64292c62171b508519c08306b").map(Dm),zb=Xm(Bb),Fb=new Array(3).concat("e5f5e0a1d99b31a354","edf8e9bae4b374c476238b45","edf8e9bae4b374c47631a354006d2c","edf8e9c7e9c0a1d99b74c47631a354006d2c","edf8e9c7e9c0a1d99b74c47641ab5d238b45005a32","f7fcf5e5f5e0c7e9c0a1d99b74c47641ab5d238b45005a32","f7fcf5e5f5e0c7e9c0a1d99b74c47641ab5d238b45006d2c00441b").map(Dm),Gb=Xm(Fb),jb=new Array(3).concat("f0f0f0bdbdbd636363","f7f7f7cccccc969696525252","f7f7f7cccccc969696636363252525","f7f7f7d9d9d9bdbdbd969696636363252525","f7f7f7d9d9d9bdbdbd969696737373525252252525","fffffff0f0f0d9d9d9bdbdbd969696737373525252252525","fffffff0f0f0d9d9d9bdbdbd969696737373525252252525000000").map(Dm),Ub=Xm(jb),Yb=new Array(3).concat("efedf5bcbddc756bb1","f2f0f7cbc9e29e9ac86a51a3","f2f0f7cbc9e29e9ac8756bb154278f","f2f0f7dadaebbcbddc9e9ac8756bb154278f","f2f0f7dadaebbcbddc9e9ac8807dba6a51a34a1486","fcfbfdefedf5dadaebbcbddc9e9ac8807dba6a51a34a1486","fcfbfdefedf5dadaebbcbddc9e9ac8807dba6a51a354278f3f007d").map(Dm),Hb=Xm(Yb),qb=new Array(3).concat("fee0d2fc9272de2d26","fee5d9fcae91fb6a4acb181d","fee5d9fcae91fb6a4ade2d26a50f15","fee5d9fcbba1fc9272fb6a4ade2d26a50f15","fee5d9fcbba1fc9272fb6a4aef3b2ccb181d99000d","fff5f0fee0d2fcbba1fc9272fb6a4aef3b2ccb181d99000d","fff5f0fee0d2fcbba1fc9272fb6a4aef3b2ccb181da50f1567000d").map(Dm),Wb=Xm(qb),$b=new Array(3).concat("fee6cefdae6be6550d","feeddefdbe85fd8d3cd94701","feeddefdbe85fd8d3ce6550da63603","feeddefdd0a2fdae6bfd8d3ce6550da63603","feeddefdd0a2fdae6bfd8d3cf16913d948018c2d04","fff5ebfee6cefdd0a2fdae6bfd8d3cf16913d948018c2d04","fff5ebfee6cefdd0a2fdae6bfd8d3cf16913d94801a636037f2704").map(Dm),Xb=Xm($b);var Kb=ui(wr(300,.5,0),wr(-240,.5,1)),Zb=ui(wr(-100,.75,.35),wr(80,1.5,.8)),Jb=ui(wr(260,.75,.35),wr(80,1.5,.8)),Qb=wr();var tv=Pn(),ev=Math.PI/3,nv=2*Math.PI/3;function rv(t){return t=Math.max(0,Math.min(1,t)),"rgb("+Math.max(0,Math.min(255,Math.round(34.61+t*(1172.33-t*(10793.56-t*(33300.12-t*(38394.49-14825.05*t)))))))+", "+Math.max(0,Math.min(255,Math.round(23.31+t*(557.33+t*(1225.33-t*(3574.96-t*(1073.77+707.56*t)))))))+", "+Math.max(0,Math.min(255,Math.round(27.2+t*(3211.1-t*(15327.97-t*(27814-t*(22569.18-6838.66*t)))))))+")"}function iv(t){var e=t.length;return function(n){return t[Math.max(0,Math.min(e-1,Math.floor(n*e)))]}}var ov=iv(Dm("44015444025645045745055946075a46085c460a5d460b5e470d60470e6147106347116447136548146748166848176948186a481a6c481b6d481c6e481d6f481f70482071482173482374482475482576482677482878482979472a7a472c7a472d7b472e7c472f7d46307e46327e46337f463480453581453781453882443983443a83443b84433d84433e85423f854240864241864142874144874045884046883f47883f48893e49893e4a893e4c8a3d4d8a3d4e8a3c4f8a3c508b3b518b3b528b3a538b3a548c39558c39568c38588c38598c375a8c375b8d365c8d365d8d355e8d355f8d34608d34618d33628d33638d32648e32658e31668e31678e31688e30698e306a8e2f6b8e2f6c8e2e6d8e2e6e8e2e6f8e2d708e2d718e2c718e2c728e2c738e2b748e2b758e2a768e2a778e2a788e29798e297a8e297b8e287c8e287d8e277e8e277f8e27808e26818e26828e26828e25838e25848e25858e24868e24878e23888e23898e238a8d228b8d228c8d228d8d218e8d218f8d21908d21918c20928c20928c20938c1f948c1f958b1f968b1f978b1f988b1f998a1f9a8a1e9b8a1e9c891e9d891f9e891f9f881fa0881fa1881fa1871fa28720a38620a48621a58521a68522a78522a88423a98324aa8325ab8225ac8226ad8127ad8128ae8029af7f2ab07f2cb17e2db27d2eb37c2fb47c31b57b32b67a34b67935b77937b87838b9773aba763bbb753dbc743fbc7340bd7242be7144bf7046c06f48c16e4ac16d4cc26c4ec36b50c46a52c56954c56856c66758c7655ac8645cc8635ec96260ca6063cb5f65cb5e67cc5c69cd5b6ccd5a6ece5870cf5773d05675d05477d1537ad1517cd2507fd34e81d34d84d44b86d54989d5488bd6468ed64590d74393d74195d84098d83e9bd93c9dd93ba0da39a2da37a5db36a8db34aadc32addc30b0dd2fb2dd2db5de2bb8de29bade28bddf26c0df25c2df23c5e021c8e020cae11fcde11dd0e11cd2e21bd5e21ad8e219dae319dde318dfe318e2e418e5e419e7e419eae51aece51befe51cf1e51df4e61ef6e620f8e621fbe723fde725")),av=iv(Dm("00000401000501010601010802010902020b02020d03030f03031204041405041606051806051a07061c08071e0907200a08220b09240c09260d0a290e0b2b100b2d110c2f120d31130d34140e36150e38160f3b180f3d19103f1a10421c10441d11471e114920114b21114e22115024125325125527125829115a2a115c2c115f2d11612f116331116533106734106936106b38106c390f6e3b0f703d0f713f0f72400f74420f75440f764510774710784910784a10794c117a4e117b4f127b51127c52137c54137d56147d57157e59157e5a167e5c167f5d177f5f187f601880621980641a80651a80671b80681c816a1c816b1d816d1d816e1e81701f81721f817320817521817621817822817922827b23827c23827e24828025828125818326818426818627818827818928818b29818c29818e2a81902a81912b81932b80942c80962c80982d80992d809b2e7f9c2e7f9e2f7fa02f7fa1307ea3307ea5317ea6317da8327daa337dab337cad347cae347bb0357bb2357bb3367ab5367ab73779b83779ba3878bc3978bd3977bf3a77c03a76c23b75c43c75c53c74c73d73c83e73ca3e72cc3f71cd4071cf4070d0416fd2426fd3436ed5446dd6456cd8456cd9466bdb476adc4869de4968df4a68e04c67e24d66e34e65e44f64e55064e75263e85362e95462ea5661eb5760ec5860ed5a5fee5b5eef5d5ef05f5ef1605df2625df2645cf3655cf4675cf4695cf56b5cf66c5cf66e5cf7705cf7725cf8745cf8765cf9785df9795df97b5dfa7d5efa7f5efa815ffb835ffb8560fb8761fc8961fc8a62fc8c63fc8e64fc9065fd9266fd9467fd9668fd9869fd9a6afd9b6bfe9d6cfe9f6dfea16efea36ffea571fea772fea973feaa74feac76feae77feb078feb27afeb47bfeb67cfeb77efeb97ffebb81febd82febf84fec185fec287fec488fec68afec88cfeca8dfecc8ffecd90fecf92fed194fed395fed597fed799fed89afdda9cfddc9efddea0fde0a1fde2a3fde3a5fde5a7fde7a9fde9aafdebacfcecaefceeb0fcf0b2fcf2b4fcf4b6fcf6b8fcf7b9fcf9bbfcfbbdfcfdbf")),sv=iv(Dm("00000401000501010601010802010a02020c02020e03021004031204031405041706041907051b08051d09061f0a07220b07240c08260d08290e092b10092d110a30120a32140b34150b37160b39180c3c190c3e1b0c411c0c431e0c451f0c48210c4a230c4c240c4f260c51280b53290b552b0b572d0b592f0a5b310a5c320a5e340a5f3609613809623909633b09643d09653e0966400a67420a68440a68450a69470b6a490b6a4a0c6b4c0c6b4d0d6c4f0d6c510e6c520e6d540f6d550f6d57106e59106e5a116e5c126e5d126e5f136e61136e62146e64156e65156e67166e69166e6a176e6c186e6d186e6f196e71196e721a6e741a6e751b6e771c6d781c6d7a1d6d7c1d6d7d1e6d7f1e6c801f6c82206c84206b85216b87216b88226a8a226a8c23698d23698f24699025689225689326679526679727669827669a28659b29649d29649f2a63a02a63a22b62a32c61a52c60a62d60a82e5fa92e5eab2f5ead305dae305cb0315bb1325ab3325ab43359b63458b73557b93556ba3655bc3754bd3853bf3952c03a51c13a50c33b4fc43c4ec63d4dc73e4cc83f4bca404acb4149cc4248ce4347cf4446d04545d24644d34743d44842d54a41d74b3fd84c3ed94d3dda4e3cdb503bdd513ade5238df5337e05536e15635e25734e35933e45a31e55c30e65d2fe75e2ee8602de9612bea632aeb6429eb6628ec6726ed6925ee6a24ef6c23ef6e21f06f20f1711ff1731df2741cf3761bf37819f47918f57b17f57d15f67e14f68013f78212f78410f8850ff8870ef8890cf98b0bf98c0af98e09fa9008fa9207fa9407fb9606fb9706fb9906fb9b06fb9d07fc9f07fca108fca309fca50afca60cfca80dfcaa0ffcac11fcae12fcb014fcb216fcb418fbb61afbb81dfbba1ffbbc21fbbe23fac026fac228fac42afac62df9c72ff9c932f9cb35f8cd37f8cf3af7d13df7d340f6d543f6d746f5d949f5db4cf4dd4ff4df53f4e156f3e35af3e55df2e661f2e865f2ea69f1ec6df1ed71f1ef75f1f179f2f27df2f482f3f586f3f68af4f88ef5f992f6fa96f8fb9af9fc9dfafda1fcffa4")),lv=iv(Dm("0d088710078813078916078a19068c1b068d1d068e20068f2206902406912605912805922a05932c05942e05952f059631059733059735049837049938049a3a049a3c049b3e049c3f049c41049d43039e44039e46039f48039f4903a04b03a14c02a14e02a25002a25102a35302a35502a45601a45801a45901a55b01a55c01a65e01a66001a66100a76300a76400a76600a76700a86900a86a00a86c00a86e00a86f00a87100a87201a87401a87501a87701a87801a87a02a87b02a87d03a87e03a88004a88104a78305a78405a78606a68707a68808a68a09a58b0aa58d0ba58e0ca48f0da4910ea3920fa39410a29511a19613a19814a099159f9a169f9c179e9d189d9e199da01a9ca11b9ba21d9aa31e9aa51f99a62098a72197a82296aa2395ab2494ac2694ad2793ae2892b02991b12a90b22b8fb32c8eb42e8db52f8cb6308bb7318ab83289ba3388bb3488bc3587bd3786be3885bf3984c03a83c13b82c23c81c33d80c43e7fc5407ec6417dc7427cc8437bc9447aca457acb4679cc4778cc4977cd4a76ce4b75cf4c74d04d73d14e72d24f71d35171d45270d5536fd5546ed6556dd7566cd8576bd9586ada5a6ada5b69db5c68dc5d67dd5e66de5f65de6164df6263e06363e16462e26561e26660e3685fe4695ee56a5de56b5de66c5ce76e5be76f5ae87059e97158e97257ea7457eb7556eb7655ec7754ed7953ed7a52ee7b51ef7c51ef7e50f07f4ff0804ef1814df1834cf2844bf3854bf3874af48849f48948f58b47f58c46f68d45f68f44f79044f79143f79342f89441f89540f9973ff9983ef99a3efa9b3dfa9c3cfa9e3bfb9f3afba139fba238fca338fca537fca636fca835fca934fdab33fdac33fdae32fdaf31fdb130fdb22ffdb42ffdb52efeb72dfeb82cfeba2cfebb2bfebd2afebe2afec029fdc229fdc328fdc527fdc627fdc827fdca26fdcb26fccd25fcce25fcd025fcd225fbd324fbd524fbd724fad824fada24f9dc24f9dd25f8df25f8e125f7e225f7e425f6e626f6e826f5e926f5eb27f4ed27f3ee27f3f027f2f227f1f426f1f525f0f724f0f921"));function cv(t){return function(){return t}}const uv=Math.abs,hv=Math.atan2,fv=Math.cos,dv=Math.max,pv=Math.min,gv=Math.sin,_v=Math.sqrt,yv=1e-12,mv=Math.PI,bv=mv/2,vv=2*mv;function xv(t){return t>=1?bv:t<=-1?-bv:Math.asin(t)}function wv(t){let e=3;return t.digits=function(n){if(!arguments.length)return e;if(null==n)e=null;else{const t=Math.floor(n);if(!(t>=0))throw new RangeError(`invalid digits: ${n}`);e=t}return t},()=>new Ta(e)}function Ev(t){return t.innerRadius}function Av(t){return t.outerRadius}function Tv(t){return t.startAngle}function Cv(t){return t.endAngle}function Sv(t){return t&&t.padAngle}function kv(t,e,n,r,i,o,a){var s=t-n,l=e-r,c=(a?o:-o)/_v(s*s+l*l),u=c*l,h=-c*s,f=t+u,d=e+h,p=n+u,g=r+h,_=(f+p)/2,y=(d+g)/2,m=p-f,b=g-d,v=m*m+b*b,x=i-o,w=f*g-p*d,E=(b<0?-1:1)*_v(dv(0,x*x*v-w*w)),A=(w*b-m*E)/v,T=(-w*m-b*E)/v,C=(w*b+m*E)/v,S=(-w*m+b*E)/v,k=A-_,M=T-y,R=C-_,O=S-y;return k*k+M*M>R*R+O*O&&(A=C,T=S),{cx:A,cy:T,x01:-u,y01:-h,x11:A*(i/x-1),y11:T*(i/x-1)}}var Mv=Array.prototype.slice;function Rv(t){return"object"==typeof t&&"length"in t?t:Array.from(t)}function Ov(t){this._context=t}function Nv(t){return new Ov(t)}function Iv(t){return t[0]}function Lv(t){return t[1]}function Pv(t,e){var n=cv(!0),r=null,i=Nv,o=null,a=wv(s);function s(s){var l,c,u,h=(s=Rv(s)).length,f=!1;for(null==r&&(o=i(u=a())),l=0;l<=h;++l)!(l<h&&n(c=s[l],l,s))===f&&((f=!f)?o.lineStart():o.lineEnd()),f&&o.point(+t(c,l,s),+e(c,l,s));if(u)return o=null,u+""||null}return t="function"==typeof t?t:void 0===t?Iv:cv(t),e="function"==typeof e?e:void 0===e?Lv:cv(e),s.x=function(e){return arguments.length?(t="function"==typeof e?e:cv(+e),s):t},s.y=function(t){return arguments.length?(e="function"==typeof t?t:cv(+t),s):e},s.defined=function(t){return arguments.length?(n="function"==typeof t?t:cv(!!t),s):n},s.curve=function(t){return arguments.length?(i=t,null!=r&&(o=i(r)),s):i},s.context=function(t){return arguments.length?(null==t?r=o=null:o=i(r=t),s):r},s}function Vv(t,e,n){var r=null,i=cv(!0),o=null,a=Nv,s=null,l=wv(c);function c(c){var u,h,f,d,p,g=(c=Rv(c)).length,_=!1,y=new Array(g),m=new Array(g);for(null==o&&(s=a(p=l())),u=0;u<=g;++u){if(!(u<g&&i(d=c[u],u,c))===_)if(_=!_)h=u,s.areaStart(),s.lineStart();else{for(s.lineEnd(),s.lineStart(),f=u-1;f>=h;--f)s.point(y[f],m[f]);s.lineEnd(),s.areaEnd()}_&&(y[u]=+t(d,u,c),m[u]=+e(d,u,c),s.point(r?+r(d,u,c):y[u],n?+n(d,u,c):m[u]))}if(p)return s=null,p+""||null}function u(){return Pv().defined(i).curve(a).context(o)}return t="function"==typeof t?t:void 0===t?Iv:cv(+t),e="function"==typeof e?e:cv(void 0===e?0:+e),n="function"==typeof n?n:void 0===n?Lv:cv(+n),c.x=function(e){return arguments.length?(t="function"==typeof e?e:cv(+e),r=null,c):t},c.x0=function(e){return arguments.length?(t="function"==typeof e?e:cv(+e),c):t},c.x1=function(t){return arguments.length?(r=null==t?null:"function"==typeof t?t:cv(+t),c):r},c.y=function(t){return arguments.length?(e="function"==typeof t?t:cv(+t),n=null,c):e},c.y0=function(t){return arguments.length?(e="function"==typeof t?t:cv(+t),c):e},c.y1=function(t){return arguments.length?(n=null==t?null:"function"==typeof t?t:cv(+t),c):n},c.lineX0=c.lineY0=function(){return u().x(t).y(e)},c.lineY1=function(){return u().x(t).y(n)},c.lineX1=function(){return u().x(r).y(e)},c.defined=function(t){return arguments.length?(i="function"==typeof t?t:cv(!!t),c):i},c.curve=function(t){return arguments.length?(a=t,null!=o&&(s=a(o)),c):a},c.context=function(t){return arguments.length?(null==t?o=s=null:s=a(o=t),c):o},c}function Dv(t,e){return e<t?-1:e>t?1:e>=t?0:NaN}function Bv(t){return t}Ov.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._point=0},lineEnd:function(){(this._line||0!==this._line&&1===this._point)&&this._context.closePath(),this._line=1-this._line},point:function(t,e){switch(t=+t,e=+e,this._point){case 0:this._point=1,this._line?this._context.lineTo(t,e):this._context.moveTo(t,e);break;case 1:this._point=2;default:this._context.lineTo(t,e)}}};var zv=Gv(Nv);function Fv(t){this._curve=t}function Gv(t){function e(e){return new Fv(t(e))}return e._curve=t,e}function jv(t){var e=t.curve;return t.angle=t.x,delete t.x,t.radius=t.y,delete t.y,t.curve=function(t){return arguments.length?e(Gv(t)):e()._curve},t}function Uv(){return jv(Pv().curve(zv))}function Yv(){var t=Vv().curve(zv),e=t.curve,n=t.lineX0,r=t.lineX1,i=t.lineY0,o=t.lineY1;return t.angle=t.x,delete t.x,t.startAngle=t.x0,delete t.x0,t.endAngle=t.x1,delete t.x1,t.radius=t.y,delete t.y,t.innerRadius=t.y0,delete t.y0,t.outerRadius=t.y1,delete t.y1,t.lineStartAngle=function(){return jv(n())},delete t.lineX0,t.lineEndAngle=function(){return jv(r())},delete t.lineX1,t.lineInnerRadius=function(){return jv(i())},delete t.lineY0,t.lineOuterRadius=function(){return jv(o())},delete t.lineY1,t.curve=function(t){return arguments.length?e(Gv(t)):e()._curve},t}function Hv(t,e){return[(e=+e)*Math.cos(t-=Math.PI/2),e*Math.sin(t)]}Fv.prototype={areaStart:function(){this._curve.areaStart()},areaEnd:function(){this._curve.areaEnd()},lineStart:function(){this._curve.lineStart()},lineEnd:function(){this._curve.lineEnd()},point:function(t,e){this._curve.point(e*Math.sin(t),e*-Math.cos(t))}};class qv{constructor(t,e){this._context=t,this._x=e}areaStart(){this._line=0}areaEnd(){this._line=NaN}lineStart(){this._point=0}lineEnd(){(this._line||0!==this._line&&1===this._point)&&this._context.closePath(),this._line=1-this._line}point(t,e){switch(t=+t,e=+e,this._point){case 0:this._point=1,this._line?this._context.lineTo(t,e):this._context.moveTo(t,e);break;case 1:this._point=2;default:this._x?this._context.bezierCurveTo(this._x0=(this._x0+t)/2,this._y0,this._x0,e,t,e):this._context.bezierCurveTo(this._x0,this._y0=(this._y0+e)/2,t,this._y0,t,e)}this._x0=t,this._y0=e}}class Wv{constructor(t){this._context=t}lineStart(){this._point=0}lineEnd(){}point(t,e){if(t=+t,e=+e,0===this._point)this._point=1;else{const n=Hv(this._x0,this._y0),r=Hv(this._x0,this._y0=(this._y0+e)/2),i=Hv(t,this._y0),o=Hv(t,e);this._context.moveTo(...n),this._context.bezierCurveTo(...r,...i,...o)}this._x0=t,this._y0=e}}function $v(t){return new qv(t,!0)}function Xv(t){return new qv(t,!1)}function Kv(t){return new Wv(t)}function Zv(t){return t.source}function Jv(t){return t.target}function Qv(t){let e=Zv,n=Jv,r=Iv,i=Lv,o=null,a=null,s=wv(l);function l(){let l;const c=Mv.call(arguments),u=e.apply(this,c),h=n.apply(this,c);if(null==o&&(a=t(l=s())),a.lineStart(),c[0]=u,a.point(+r.apply(this,c),+i.apply(this,c)),c[0]=h,a.point(+r.apply(this,c),+i.apply(this,c)),a.lineEnd(),l)return a=null,l+""||null}return l.source=function(t){return arguments.length?(e=t,l):e},l.target=function(t){return arguments.length?(n=t,l):n},l.x=function(t){return arguments.length?(r="function"==typeof t?t:cv(+t),l):r},l.y=function(t){return arguments.length?(i="function"==typeof t?t:cv(+t),l):i},l.context=function(e){return arguments.length?(null==e?o=a=null:a=t(o=e),l):o},l}function tx(){return Qv($v)}function ex(){return Qv(Xv)}function nx(){const t=Qv(Kv);return t.angle=t.x,delete t.x,t.radius=t.y,delete t.y,t}const rx=_v(3);var ix={draw(t,e){const n=.59436*_v(e+pv(e/28,.75)),r=n/2,i=r*rx;t.moveTo(0,n),t.lineTo(0,-n),t.moveTo(-i,-r),t.lineTo(i,r),t.moveTo(-i,r),t.lineTo(i,-r)}},ox={draw(t,e){const n=_v(e/mv);t.moveTo(n,0),t.arc(0,0,n,0,vv)}},ax={draw(t,e){const n=_v(e/5)/2;t.moveTo(-3*n,-n),t.lineTo(-n,-n),t.lineTo(-n,-3*n),t.lineTo(n,-3*n),t.lineTo(n,-n),t.lineTo(3*n,-n),t.lineTo(3*n,n),t.lineTo(n,n),t.lineTo(n,3*n),t.lineTo(-n,3*n),t.lineTo(-n,n),t.lineTo(-3*n,n),t.closePath()}};const sx=_v(1/3),lx=2*sx;var cx={draw(t,e){const n=_v(e/lx),r=n*sx;t.moveTo(0,-n),t.lineTo(r,0),t.lineTo(0,n),t.lineTo(-r,0),t.closePath()}},ux={draw(t,e){const n=.62625*_v(e);t.moveTo(0,-n),t.lineTo(n,0),t.lineTo(0,n),t.lineTo(-n,0),t.closePath()}},hx={draw(t,e){const n=.87559*_v(e-pv(e/7,2));t.moveTo(-n,0),t.lineTo(n,0),t.moveTo(0,n),t.lineTo(0,-n)}},fx={draw(t,e){const n=_v(e),r=-n/2;t.rect(r,r,n,n)}},dx={draw(t,e){const n=.4431*_v(e);t.moveTo(n,n),t.lineTo(n,-n),t.lineTo(-n,-n),t.lineTo(-n,n),t.closePath()}};const px=gv(mv/10)/gv(7*mv/10),gx=gv(vv/10)*px,_x=-fv(vv/10)*px;var yx={draw(t,e){const n=_v(.8908130915292852*e),r=gx*n,i=_x*n;t.moveTo(0,-n),t.lineTo(r,i);for(let e=1;e<5;++e){const o=vv*e/5,a=fv(o),s=gv(o);t.lineTo(s*n,-a*n),t.lineTo(a*r-s*i,s*r+a*i)}t.closePath()}};const mx=_v(3);var bx={draw(t,e){const n=-_v(e/(3*mx));t.moveTo(0,2*n),t.lineTo(-mx*n,-n),t.lineTo(mx*n,-n),t.closePath()}};const vx=_v(3);var xx={draw(t,e){const n=.6824*_v(e),r=n/2,i=n*vx/2;t.moveTo(0,-n),t.lineTo(i,r),t.lineTo(-i,r),t.closePath()}};const wx=-.5,Ex=_v(3)/2,Ax=1/_v(12),Tx=3*(Ax/2+1);var Cx={draw(t,e){const n=_v(e/Tx),r=n/2,i=n*Ax,o=r,a=n*Ax+n,s=-o,l=a;t.moveTo(r,i),t.lineTo(o,a),t.lineTo(s,l),t.lineTo(wx*r-Ex*i,Ex*r+wx*i),t.lineTo(wx*o-Ex*a,Ex*o+wx*a),t.lineTo(wx*s-Ex*l,Ex*s+wx*l),t.lineTo(wx*r+Ex*i,wx*i-Ex*r),t.lineTo(wx*o+Ex*a,wx*a-Ex*o),t.lineTo(wx*s+Ex*l,wx*l-Ex*s),t.closePath()}},Sx={draw(t,e){const n=.6189*_v(e-pv(e/6,1.7));t.moveTo(-n,-n),t.lineTo(n,n),t.moveTo(-n,n),t.lineTo(n,-n)}};const kx=[ox,ax,cx,fx,yx,bx,Cx],Mx=[ox,hx,Sx,xx,ix,dx,ux];function Rx(){}function Ox(t,e,n){t._context.bezierCurveTo((2*t._x0+t._x1)/3,(2*t._y0+t._y1)/3,(t._x0+2*t._x1)/3,(t._y0+2*t._y1)/3,(t._x0+4*t._x1+e)/6,(t._y0+4*t._y1+n)/6)}function Nx(t){this._context=t}function Ix(t){return new Nx(t)}function Lx(t){this._context=t}function Px(t){this._context=t}function Vx(t,e){this._basis=new Nx(t),this._beta=e}Nx.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:Ox(this,this._x1,this._y1);case 2:this._context.lineTo(this._x1,this._y1)}(this._line||0!==this._line&&1===this._point)&&this._context.closePath(),this._line=1-this._line},point:function(t,e){switch(t=+t,e=+e,this._point){case 0:this._point=1,this._line?this._context.lineTo(t,e):this._context.moveTo(t,e);break;case 1:this._point=2;break;case 2:this._point=3,this._context.lineTo((5*this._x0+this._x1)/6,(5*this._y0+this._y1)/6);default:Ox(this,t,e)}this._x0=this._x1,this._x1=t,this._y0=this._y1,this._y1=e}},Lx.prototype={areaStart:Rx,areaEnd:Rx,lineStart:function(){this._x0=this._x1=this._x2=this._x3=this._x4=this._y0=this._y1=this._y2=this._y3=this._y4=NaN,this._point=0},lineEnd:function(){switch(this._point){case 1:this._context.moveTo(this._x2,this._y2),this._context.closePath();break;case 2:this._context.moveTo((this._x2+2*this._x3)/3,(this._y2+2*this._y3)/3),this._context.lineTo((this._x3+2*this._x2)/3,(this._y3+2*this._y2)/3),this._context.closePath();break;case 3:this.point(this._x2,this._y2),this.point(this._x3,this._y3),this.point(this._x4,this._y4)}},point:function(t,e){switch(t=+t,e=+e,this._point){case 0:this._point=1,this._x2=t,this._y2=e;break;case 1:this._point=2,this._x3=t,this._y3=e;break;case 2:this._point=3,this._x4=t,this._y4=e,this._context.moveTo((this._x0+4*this._x1+t)/6,(this._y0+4*this._y1+e)/6);break;default:Ox(this,t,e)}this._x0=this._x1,this._x1=t,this._y0=this._y1,this._y1=e}},Px.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=NaN,this._point=0},lineEnd:function(){(this._line||0!==this._line&&3===this._point)&&this._context.closePath(),this._line=1-this._line},point:function(t,e){switch(t=+t,e=+e,this._point){case 0:this._point=1;break;case 1:this._point=2;break;case 2:this._point=3;var n=(this._x0+4*this._x1+t)/6,r=(this._y0+4*this._y1+e)/6;this._line?this._context.lineTo(n,r):this._context.moveTo(n,r);break;case 3:this._point=4;default:Ox(this,t,e)}this._x0=this._x1,this._x1=t,this._y0=this._y1,this._y1=e}},Vx.prototype={lineStart:function(){this._x=[],this._y=[],this._basis.lineStart()},lineEnd:function(){var t=this._x,e=this._y,n=t.length-1;if(n>0)for(var r,i=t[0],o=e[0],a=t[n]-i,s=e[n]-o,l=-1;++l<=n;)r=l/n,this._basis.point(this._beta*t[l]+(1-this._beta)*(i+r*a),this._beta*e[l]+(1-this._beta)*(o+r*s));this._x=this._y=null,this._basis.lineEnd()},point:function(t,e){this._x.push(+t),this._y.push(+e)}};var Dx=function t(e){function n(t){return 1===e?new Nx(t):new Vx(t,e)}return n.beta=function(e){return t(+e)},n}(.85);function Bx(t,e,n){t._context.bezierCurveTo(t._x1+t._k*(t._x2-t._x0),t._y1+t._k*(t._y2-t._y0),t._x2+t._k*(t._x1-e),t._y2+t._k*(t._y1-n),t._x2,t._y2)}function zx(t,e){this._context=t,this._k=(1-e)/6}zx.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:Bx(this,this._x1,this._y1)}(this._line||0!==this._line&&1===this._point)&&this._context.closePath(),this._line=1-this._line},point:function(t,e){switch(t=+t,e=+e,this._point){case 0:this._point=1,this._line?this._context.lineTo(t,e):this._context.moveTo(t,e);break;case 1:this._point=2,this._x1=t,this._y1=e;break;case 2:this._point=3;default:Bx(this,t,e)}this._x0=this._x1,this._x1=this._x2,this._x2=t,this._y0=this._y1,this._y1=this._y2,this._y2=e}};var Fx=function t(e){function n(t){return new zx(t,e)}return n.tension=function(e){return t(+e)},n}(0);function Gx(t,e){this._context=t,this._k=(1-e)/6}Gx.prototype={areaStart:Rx,areaEnd:Rx,lineStart:function(){this._x0=this._x1=this._x2=this._x3=this._x4=this._x5=this._y0=this._y1=this._y2=this._y3=this._y4=this._y5=NaN,this._point=0},lineEnd:function(){switch(this._point){case 1:this._context.moveTo(this._x3,this._y3),this._context.closePath();break;case 2:this._context.lineTo(this._x3,this._y3),this._context.closePath();break;case 3:this.point(this._x3,this._y3),this.point(this._x4,this._y4),this.point(this._x5,this._y5)}},point:function(t,e){switch(t=+t,e=+e,this._point){case 0:this._point=1,this._x3=t,this._y3=e;break;case 1:this._point=2,this._context.moveTo(this._x4=t,this._y4=e);break;case 2:this._point=3,this._x5=t,this._y5=e;break;default:Bx(this,t,e)}this._x0=this._x1,this._x1=this._x2,this._x2=t,this._y0=this._y1,this._y1=this._y2,this._y2=e}};var jx=function t(e){function n(t){return new Gx(t,e)}return n.tension=function(e){return t(+e)},n}(0);function Ux(t,e){this._context=t,this._k=(1-e)/6}Ux.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._x2=this._y0=this._y1=this._y2=NaN,this._point=0},lineEnd:function(){(this._line||0!==this._line&&3===this._point)&&this._context.closePath(),this._line=1-this._line},point:function(t,e){switch(t=+t,e=+e,this._point){case 0:this._point=1;break;case 1:this._point=2;break;case 2:this._point=3,this._line?this._context.lineTo(this._x2,this._y2):this._context.moveTo(this._x2,this._y2);break;case 3:this._point=4;default:Bx(this,t,e)}this._x0=this._x1,this._x1=this._x2,this._x2=t,this._y0=this._y1,this._y1=this._y2,this._y2=e}};var Yx=function t(e){function n(t){return new Ux(t,e)}return n.tension=function(e){return t(+e)},n}(0);function Hx(t,e,n){var r=t._x1,i=t._y1,o=t._x2,a=t._y2;if(t._l01_a>yv){var s=2*t._l01_2a+3*t._l01_a*t._l12_a+t._l12_2a,l=3*t._l01_a*(t._l01_a+t._l12_a);r=(r*s-t._x0*t._l12_2a+t._x2*t._l01_2a)/l,i=(i*s-t._y0*t._l12_2a+t._y2*t._l01_2a)/l}if(t._l23_a>yv){var c=2*t._l23_2a+3*t._l23_a*t._l12_a+t._l12_2a,u=3*t._l23_a*(t._l23_a+t._l12_a);o=(o*c+t._x1*t._l23_2a-e*t._l12_2a)/u,a=(a*c+t._y1*t._l23_2a-n*t._l12_2a)/u}t._context.bezierCurveTo(r,i,o,a,t._x2,t._y2)}function qx(t,e){this._context=t,this._alpha=e}qx.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._x2=this._y0=this._y1=this._y2=NaN,this._l01_a=this._l12_a=this._l23_a=this._l01_2a=this._l12_2a=this._l23_2a=this._point=0},lineEnd:function(){switch(this._point){case 2:this._context.lineTo(this._x2,this._y2);break;case 3:this.point(this._x2,this._y2)}(this._line||0!==this._line&&1===this._point)&&this._context.closePath(),this._line=1-this._line},point:function(t,e){if(t=+t,e=+e,this._point){var n=this._x2-t,r=this._y2-e;this._l23_a=Math.sqrt(this._l23_2a=Math.pow(n*n+r*r,this._alpha))}switch(this._point){case 0:this._point=1,this._line?this._context.lineTo(t,e):this._context.moveTo(t,e);break;case 1:this._point=2;break;case 2:this._point=3;default:Hx(this,t,e)}this._l01_a=this._l12_a,this._l12_a=this._l23_a,this._l01_2a=this._l12_2a,this._l12_2a=this._l23_2a,this._x0=this._x1,this._x1=this._x2,this._x2=t,this._y0=this._y1,this._y1=this._y2,this._y2=e}};var Wx=function t(e){function n(t){return e?new qx(t,e):new zx(t,0)}return n.alpha=function(e){return t(+e)},n}(.5);function $x(t,e){this._context=t,this._alpha=e}$x.prototype={areaStart:Rx,areaEnd:Rx,lineStart:function(){this._x0=this._x1=this._x2=this._x3=this._x4=this._x5=this._y0=this._y1=this._y2=this._y3=this._y4=this._y5=NaN,this._l01_a=this._l12_a=this._l23_a=this._l01_2a=this._l12_2a=this._l23_2a=this._point=0},lineEnd:function(){switch(this._point){case 1:this._context.moveTo(this._x3,this._y3),this._context.closePath();break;case 2:this._context.lineTo(this._x3,this._y3),this._context.closePath();break;case 3:this.point(this._x3,this._y3),this.point(this._x4,this._y4),this.point(this._x5,this._y5)}},point:function(t,e){if(t=+t,e=+e,this._point){var n=this._x2-t,r=this._y2-e;this._l23_a=Math.sqrt(this._l23_2a=Math.pow(n*n+r*r,this._alpha))}switch(this._point){case 0:this._point=1,this._x3=t,this._y3=e;break;case 1:this._point=2,this._context.moveTo(this._x4=t,this._y4=e);break;case 2:this._point=3,this._x5=t,this._y5=e;break;default:Hx(this,t,e)}this._l01_a=this._l12_a,this._l12_a=this._l23_a,this._l01_2a=this._l12_2a,this._l12_2a=this._l23_2a,this._x0=this._x1,this._x1=this._x2,this._x2=t,this._y0=this._y1,this._y1=this._y2,this._y2=e}};var Xx=function t(e){function n(t){return e?new $x(t,e):new Gx(t,0)}return n.alpha=function(e){return t(+e)},n}(.5);function Kx(t,e){this._context=t,this._alpha=e}Kx.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._x2=this._y0=this._y1=this._y2=NaN,this._l01_a=this._l12_a=this._l23_a=this._l01_2a=this._l12_2a=this._l23_2a=this._point=0},lineEnd:function(){(this._line||0!==this._line&&3===this._point)&&this._context.closePath(),this._line=1-this._line},point:function(t,e){if(t=+t,e=+e,this._point){var n=this._x2-t,r=this._y2-e;this._l23_a=Math.sqrt(this._l23_2a=Math.pow(n*n+r*r,this._alpha))}switch(this._point){case 0:this._point=1;break;case 1:this._point=2;break;case 2:this._point=3,this._line?this._context.lineTo(this._x2,this._y2):this._context.moveTo(this._x2,this._y2);break;case 3:this._point=4;default:Hx(this,t,e)}this._l01_a=this._l12_a,this._l12_a=this._l23_a,this._l01_2a=this._l12_2a,this._l12_2a=this._l23_2a,this._x0=this._x1,this._x1=this._x2,this._x2=t,this._y0=this._y1,this._y1=this._y2,this._y2=e}};var Zx=function t(e){function n(t){return e?new Kx(t,e):new Ux(t,0)}return n.alpha=function(e){return t(+e)},n}(.5);function Jx(t){this._context=t}function Qx(t){return t<0?-1:1}function tw(t,e,n){var r=t._x1-t._x0,i=e-t._x1,o=(t._y1-t._y0)/(r||i<0&&-0),a=(n-t._y1)/(i||r<0&&-0),s=(o*i+a*r)/(r+i);return(Qx(o)+Qx(a))*Math.min(Math.abs(o),Math.abs(a),.5*Math.abs(s))||0}function ew(t,e){var n=t._x1-t._x0;return n?(3*(t._y1-t._y0)/n-e)/2:e}function nw(t,e,n){var r=t._x0,i=t._y0,o=t._x1,a=t._y1,s=(o-r)/3;t._context.bezierCurveTo(r+s,i+s*e,o-s,a-s*n,o,a)}function rw(t){this._context=t}function iw(t){this._context=new ow(t)}function ow(t){this._context=t}function aw(t){this._context=t}function sw(t){var e,n,r=t.length-1,i=new Array(r),o=new Array(r),a=new Array(r);for(i[0]=0,o[0]=2,a[0]=t[0]+2*t[1],e=1;e<r-1;++e)i[e]=1,o[e]=4,a[e]=4*t[e]+2*t[e+1];for(i[r-1]=2,o[r-1]=7,a[r-1]=8*t[r-1]+t[r],e=1;e<r;++e)n=i[e]/o[e-1],o[e]-=n,a[e]-=n*a[e-1];for(i[r-1]=a[r-1]/o[r-1],e=r-2;e>=0;--e)i[e]=(a[e]-i[e+1])/o[e];for(o[r-1]=(t[r]+i[r-1])/2,e=0;e<r-1;++e)o[e]=2*t[e+1]-i[e+1];return[i,o]}function lw(t){return new aw(t)}function cw(t,e){this._context=t,this._t=e}function uw(t){return new cw(t,.5)}function hw(t,e){if((i=t.length)>1)for(var n,r,i,o=1,a=t[e[0]],s=a.length;o<i;++o)for(r=a,a=t[e[o]],n=0;n<s;++n)a[n][1]+=a[n][0]=isNaN(r[n][1])?r[n][0]:r[n][1]}function fw(t){for(var e=t.length,n=new Array(e);--e>=0;)n[e]=e;return n}function dw(t,e){return t[e]}function pw(t){const e=[];return e.key=t,e}function gw(t){var e=t.map(_w);return fw(t).sort(function(t,n){return e[t]-e[n]})}function _w(t){for(var e,n=-1,r=0,i=t.length,o=-1/0;++n<i;)(e=+t[n][1])>o&&(o=e,r=n);return r}function yw(t){var e=t.map(mw);return fw(t).sort(function(t,n){return e[t]-e[n]})}function mw(t){for(var e,n=0,r=-1,i=t.length;++r<i;)(e=+t[r][1])&&(n+=e);return n}Jx.prototype={areaStart:Rx,areaEnd:Rx,lineStart:function(){this._point=0},lineEnd:function(){this._point&&this._context.closePath()},point:function(t,e){t=+t,e=+e,this._point?this._context.lineTo(t,e):(this._point=1,this._context.moveTo(t,e))}},rw.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:nw(this,this._t0,ew(this,this._t0))}(this._line||0!==this._line&&1===this._point)&&this._context.closePath(),this._line=1-this._line},point:function(t,e){var n=NaN;if(e=+e,(t=+t)!==this._x1||e!==this._y1){switch(this._point){case 0:this._point=1,this._line?this._context.lineTo(t,e):this._context.moveTo(t,e);break;case 1:this._point=2;break;case 2:this._point=3,nw(this,ew(this,n=tw(this,t,e)),n);break;default:nw(this,this._t0,n=tw(this,t,e))}this._x0=this._x1,this._x1=t,this._y0=this._y1,this._y1=e,this._t0=n}}},(iw.prototype=Object.create(rw.prototype)).point=function(t,e){rw.prototype.point.call(this,e,t)},ow.prototype={moveTo:function(t,e){this._context.moveTo(e,t)},closePath:function(){this._context.closePath()},lineTo:function(t,e){this._context.lineTo(e,t)},bezierCurveTo:function(t,e,n,r,i,o){this._context.bezierCurveTo(e,t,r,n,o,i)}},aw.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x=[],this._y=[]},lineEnd:function(){var t=this._x,e=this._y,n=t.length;if(n)if(this._line?this._context.lineTo(t[0],e[0]):this._context.moveTo(t[0],e[0]),2===n)this._context.lineTo(t[1],e[1]);else for(var r=sw(t),i=sw(e),o=0,a=1;a<n;++o,++a)this._context.bezierCurveTo(r[0][o],i[0][o],r[1][o],i[1][o],t[a],e[a]);(this._line||0!==this._line&&1===n)&&this._context.closePath(),this._line=1-this._line,this._x=this._y=null},point:function(t,e){this._x.push(+t),this._y.push(+e)}},cw.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x=this._y=NaN,this._point=0},lineEnd:function(){0<this._t&&this._t<1&&2===this._point&&this._context.lineTo(this._x,this._y),(this._line||0!==this._line&&1===this._point)&&this._context.closePath(),this._line>=0&&(this._t=1-this._t,this._line=1-this._line)},point:function(t,e){switch(t=+t,e=+e,this._point){case 0:this._point=1,this._line?this._context.lineTo(t,e):this._context.moveTo(t,e);break;case 1:this._point=2;default:if(this._t<=0)this._context.lineTo(this._x,e),this._context.lineTo(t,e);else{var n=this._x*(1-this._t)+t*this._t;this._context.lineTo(n,this._y),this._context.lineTo(n,e)}}this._x=t,this._y=e}};var bw=t=>()=>t;function vw(t,{sourceEvent:e,target:n,transform:r,dispatch:i}){Object.defineProperties(this,{type:{value:t,enumerable:!0,configurable:!0},sourceEvent:{value:e,enumerable:!0,configurable:!0},target:{value:n,enumerable:!0,configurable:!0},transform:{value:r,enumerable:!0,configurable:!0},_:{value:i}})}function xw(t,e,n){this.k=t,this.x=e,this.y=n}xw.prototype={constructor:xw,scale:function(t){return 1===t?this:new xw(this.k*t,this.x,this.y)},translate:function(t,e){return 0===t&0===e?this:new xw(this.k,this.x+this.k*t,this.y+this.k*e)},apply:function(t){return[t[0]*this.k+this.x,t[1]*this.k+this.y]},applyX:function(t){return t*this.k+this.x},applyY:function(t){return t*this.k+this.y},invert:function(t){return[(t[0]-this.x)/this.k,(t[1]-this.y)/this.k]},invertX:function(t){return(t-this.x)/this.k},invertY:function(t){return(t-this.y)/this.k},rescaleX:function(t){return t.copy().domain(t.range().map(this.invertX,this).map(t.invert,t))},rescaleY:function(t){return t.copy().domain(t.range().map(this.invertY,this).map(t.invert,t))},toString:function(){return"translate("+this.x+","+this.y+") scale("+this.k+")"}};var ww=new xw(1,0,0);function Ew(t){for(;!t.__zoom;)if(!(t=t.parentNode))return ww;return t.__zoom}function Aw(t){t.stopImmediatePropagation()}function Tw(t){t.preventDefault(),t.stopImmediatePropagation()}function Cw(t){return!(t.ctrlKey&&"wheel"!==t.type||t.button)}function Sw(){var t=this;return t instanceof SVGElement?(t=t.ownerSVGElement||t).hasAttribute("viewBox")?[[(t=t.viewBox.baseVal).x,t.y],[t.x+t.width,t.y+t.height]]:[[0,0],[t.width.baseVal.value,t.height.baseVal.value]]:[[0,0],[t.clientWidth,t.clientHeight]]}function kw(){return this.__zoom||ww}function Mw(t){return-t.deltaY*(1===t.deltaMode?.05:t.deltaMode?1:.002)*(t.ctrlKey?10:1)}function Rw(){return navigator.maxTouchPoints||"ontouchstart"in this}function Ow(t,e,n){var r=t.invertX(e[0][0])-n[0][0],i=t.invertX(e[1][0])-n[1][0],o=t.invertY(e[0][1])-n[0][1],a=t.invertY(e[1][1])-n[1][1];return t.translate(i>r?(r+i)/2:Math.min(0,r)||Math.max(0,i),a>o?(o+a)/2:Math.min(0,o)||Math.max(0,a))}Ew.prototype=xw.prototype;var Nw=Object.freeze({__proto__:null,Adder:w,Delaunay:Ss,FormatSpecifier:Fl,InternMap:E,InternSet:A,Node:Vd,Path:Ta,Voronoi:xs,ZoomTransform:xw,active:function(t,e){var n,r,i=t.__transition;if(i)for(r in e=null==e?null:e+"",i)if((n=i[r]).state>1&&n.name===e)return new ro([[t]],Do,e,+r);return null},arc:function(){var t=Ev,e=Av,n=cv(0),r=null,i=Tv,o=Cv,a=Sv,s=null,l=wv(c);function c(){var c,u,h=+t.apply(this,arguments),f=+e.apply(this,arguments),d=i.apply(this,arguments)-bv,p=o.apply(this,arguments)-bv,g=uv(p-d),_=p>d;if(s||(s=c=l()),f<h&&(u=f,f=h,h=u),f>yv)if(g>vv-yv)s.moveTo(f*fv(d),f*gv(d)),s.arc(0,0,f,d,p,!_),h>yv&&(s.moveTo(h*fv(p),h*gv(p)),s.arc(0,0,h,p,d,_));else{var y,m,b=d,v=p,x=d,w=p,E=g,A=g,T=a.apply(this,arguments)/2,C=T>yv&&(r?+r.apply(this,arguments):_v(h*h+f*f)),S=pv(uv(f-h)/2,+n.apply(this,arguments)),k=S,M=S;if(C>yv){var R=xv(C/h*gv(T)),O=xv(C/f*gv(T));(E-=2*R)>yv?(x+=R*=_?1:-1,w-=R):(E=0,x=w=(d+p)/2),(A-=2*O)>yv?(b+=O*=_?1:-1,v-=O):(A=0,b=v=(d+p)/2)}var N=f*fv(b),I=f*gv(b),L=h*fv(w),P=h*gv(w);if(S>yv){var V,D=f*fv(v),B=f*gv(v),z=h*fv(x),F=h*gv(x);if(g<mv)if(V=function(t,e,n,r,i,o,a,s){var l=n-t,c=r-e,u=a-i,h=s-o,f=h*l-u*c;if(!(f*f<yv))return[t+(f=(u*(e-o)-h*(t-i))/f)*l,e+f*c]}(N,I,z,F,D,B,L,P)){var G=N-V[0],j=I-V[1],U=D-V[0],Y=B-V[1],H=1/gv(function(t){return t>1?0:t<-1?mv:Math.acos(t)}((G*U+j*Y)/(_v(G*G+j*j)*_v(U*U+Y*Y)))/2),q=_v(V[0]*V[0]+V[1]*V[1]);k=pv(S,(h-q)/(H-1)),M=pv(S,(f-q)/(H+1))}else k=M=0}A>yv?M>yv?(y=kv(z,F,N,I,f,M,_),m=kv(D,B,L,P,f,M,_),s.moveTo(y.cx+y.x01,y.cy+y.y01),M<S?s.arc(y.cx,y.cy,M,hv(y.y01,y.x01),hv(m.y01,m.x01),!_):(s.arc(y.cx,y.cy,M,hv(y.y01,y.x01),hv(y.y11,y.x11),!_),s.arc(0,0,f,hv(y.cy+y.y11,y.cx+y.x11),hv(m.cy+m.y11,m.cx+m.x11),!_),s.arc(m.cx,m.cy,M,hv(m.y11,m.x11),hv(m.y01,m.x01),!_))):(s.moveTo(N,I),s.arc(0,0,f,b,v,!_)):s.moveTo(N,I),h>yv&&E>yv?k>yv?(y=kv(L,P,D,B,h,-k,_),m=kv(N,I,z,F,h,-k,_),s.lineTo(y.cx+y.x01,y.cy+y.y01),k<S?s.arc(y.cx,y.cy,k,hv(y.y01,y.x01),hv(m.y01,m.x01),!_):(s.arc(y.cx,y.cy,k,hv(y.y01,y.x01),hv(y.y11,y.x11),!_),s.arc(0,0,h,hv(y.cy+y.y11,y.cx+y.x11),hv(m.cy+m.y11,m.cx+m.x11),_),s.arc(m.cx,m.cy,k,hv(m.y11,m.x11),hv(m.y01,m.x01),!_))):s.arc(0,0,h,w,x,_):s.lineTo(L,P)}else s.moveTo(0,0);if(s.closePath(),c)return s=null,c+""||null}return c.centroid=function(){var n=(+t.apply(this,arguments)+ +e.apply(this,arguments))/2,r=(+i.apply(this,arguments)+ +o.apply(this,arguments))/2-mv/2;return[fv(r)*n,gv(r)*n]},c.innerRadius=function(e){return arguments.length?(t="function"==typeof e?e:cv(+e),c):t},c.outerRadius=function(t){return arguments.length?(e="function"==typeof t?t:cv(+t),c):e},c.cornerRadius=function(t){return arguments.length?(n="function"==typeof t?t:cv(+t),c):n},c.padRadius=function(t){return arguments.length?(r=null==t?null:"function"==typeof t?t:cv(+t),c):r},c.startAngle=function(t){return arguments.length?(i="function"==typeof t?t:cv(+t),c):i},c.endAngle=function(t){return arguments.length?(o="function"==typeof t?t:cv(+t),c):o},c.padAngle=function(t){return arguments.length?(a="function"==typeof t?t:cv(+t),c):a},c.context=function(t){return arguments.length?(s=null==t?null:t,c):s},c},area:Vv,areaRadial:Yv,ascending:t,autoType:Zs,axisBottom:function(t){return Rt(3,t)},axisLeft:function(t){return Rt(4,t)},axisRight:function(t){return Rt(2,t)},axisTop:function(t){return Rt(1,t)},bin:J,bisect:a,bisectCenter:l,bisectLeft:s,bisectRight:a,bisector:n,blob:function(t,e){return fetch(t,e).then(Qs)},blur:function(t,e){if(!((e=+e)>=0))throw new RangeError("invalid r");let n=t.length;if(!((n=Math.floor(n))>=0))throw new RangeError("invalid length");if(!n||!e)return t;const r=p(e),i=t.slice();return r(t,i,0,n,1),r(i,t,0,n,1),r(t,i,0,n,1),t},blur2:c,blurImage:u,brush:function(){return ca(Jo)},brushSelection:function(t){var e=t.__brush;return e?e.dim.output(e.selection):null},brushX:function(){return ca(Ko)},brushY:function(){return ca(Zo)},buffer:function(t,e){return fetch(t,e).then(tl)},chord:function(){return ba(!1,!1)},chordDirected:function(){return ba(!0,!1)},chordTranspose:function(){return ba(!1,!0)},cluster:Md,color:On,contourDensity:function(){var t=Ka,e=Za,n=Ja,r=960,i=500,o=20,a=2,s=3*o,l=r+2*s>>a,u=i+2*s>>a,h=za(20);function f(r){var i=new Float32Array(l*u),h=Math.pow(2,-a),f=-1;for(const o of r){var d=(t(o,++f,r)+s)*h,p=(e(o,f,r)+s)*h,g=+n(o,f,r);if(g&&d>=0&&d<l&&p>=0&&p<u){var _=Math.floor(d),y=Math.floor(p),m=d-_-.5,b=p-y-.5;i[_+y*l]+=(1-m)*(1-b)*g,i[_+1+y*l]+=m*(1-b)*g,i[_+1+(y+1)*l]+=m*b*g,i[_+(y+1)*l]+=(1-m)*b*g}}return c({data:i,width:l,height:u},o*h),i}function d(t){var e=f(t),n=h(e),r=Math.pow(2,2*a);return Array.isArray(n)||(n=W(Number.MIN_VALUE,Q(e)/r,n)),Ha().size([l,u]).thresholds(n.map(t=>t*r))(e).map((t,e)=>(t.value=+n[e],p(t)))}function p(t){return t.coordinates.forEach(g),t}function g(t){t.forEach(_)}function _(t){t.forEach(y)}function y(t){t[0]=t[0]*Math.pow(2,a)-s,t[1]=t[1]*Math.pow(2,a)-s}function m(){return l=r+2*(s=3*o)>>a,u=i+2*s>>a,d}return d.contours=function(t){var e=f(t),n=Ha().size([l,u]),r=Math.pow(2,2*a),i=t=>{t=+t;var i=p(n.contour(e,t*r));return i.value=t,i};return Object.defineProperty(i,"max",{get:()=>Q(e)/r}),i},d.x=function(e){return arguments.length?(t="function"==typeof e?e:za(+e),d):t},d.y=function(t){return arguments.length?(e="function"==typeof t?t:za(+t),d):e},d.weight=function(t){return arguments.length?(n="function"==typeof t?t:za(+t),d):n},d.size=function(t){if(!arguments.length)return[r,i];var e=+t[0],n=+t[1];if(!(e>=0&&n>=0))throw new Error("invalid size");return r=e,i=n,m()},d.cellSize=function(t){if(!arguments.length)return 1<<a;if(!((t=+t)>=1))throw new Error("invalid cell size");return a=Math.floor(Math.log(t)/Math.LN2),m()},d.thresholds=function(t){return arguments.length?(h="function"==typeof t?t:Array.isArray(t)?za(Da.call(t)):za(t),d):h},d.bandwidth=function(t){if(!arguments.length)return Math.sqrt(o*(o+1));if(!((t=+t)>=0))throw new Error("invalid bandwidth");return o=(Math.sqrt(4*t*t+1)-1)/2,m()},d},contours:Ha,count:g,create:function(t){return $e(Gt(t).call(document.documentElement))},creator:Gt,cross:function(...t){const e="function"==typeof t[t.length-1]&&function(t){return e=>t(...e)}(t.pop()),n=(t=t.map(m)).map(_),r=t.length-1,i=new Array(r+1).fill(0),o=[];if(r<0||n.some(y))return o;for(;;){o.push(i.map((e,n)=>t[n][e]));let a=r;for(;++i[a]===n[a];){if(0===a)return e?o.map(e):o;i[a--]=0}}},csv:il,csvFormat:Bs,csvFormatBody:zs,csvFormatRow:Gs,csvFormatRows:Fs,csvFormatValue:js,csvParse:Vs,csvParseRows:Ds,cubehelix:wr,cumsum:function(t,e){var n=0,r=0;return Float64Array.from(t,void 0===e?t=>n+=+t||0:i=>n+=+e(i,r++,t)||0)},curveBasis:Ix,curveBasisClosed:function(t){return new Lx(t)},curveBasisOpen:function(t){return new Px(t)},curveBumpX:$v,curveBumpY:Xv,curveBundle:Dx,curveCardinal:Fx,curveCardinalClosed:jx,curveCardinalOpen:Yx,curveCatmullRom:Wx,curveCatmullRomClosed:Xx,curveCatmullRomOpen:Zx,curveLinear:Nv,curveLinearClosed:function(t){return new Jx(t)},curveMonotoneX:function(t){return new rw(t)},curveMonotoneY:function(t){return new iw(t)},curveNatural:lw,curveStep:uw,curveStepAfter:function(t){return new cw(t,1)},curveStepBefore:function(t){return new cw(t,0)},descending:e,deviation:v,difference:function(t,...e){t=new A(t);for(const n of e)for(const e of n)t.delete(e);return t},disjoint:function(t,e){const n=e[Symbol.iterator](),r=new A;for(const e of t){if(r.has(e))return!1;let t,i;for(;({value:t,done:i}=n.next())&&!i;){if(Object.is(e,t))return!1;r.add(t)}}return!0},dispatch:Nt,drag:function(){var t,e,n,r,i=cn,o=un,a=hn,s=fn,l={},c=Nt("start","drag","end"),u=0,h=0;function f(t){t.on("mousedown.drag",d).filter(s).on("touchstart.drag",_).on("touchmove.drag",y,tn).on("touchend.drag touchcancel.drag",m).style("touch-action","none").style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function d(a,s){if(!r&&i.call(this,a,s)){var l=b(this,o.call(this,a,s),a,s,"mouse");l&&($e(a.view).on("mousemove.drag",p,en).on("mouseup.drag",g,en),on(a.view),nn(a),n=!1,t=a.clientX,e=a.clientY,l("start",a))}}function p(r){if(rn(r),!n){var i=r.clientX-t,o=r.clientY-e;n=i*i+o*o>h}l.mouse("drag",r)}function g(t){$e(t.view).on("mousemove.drag mouseup.drag",null),an(t.view,n),rn(t),l.mouse("end",t)}function _(t,e){if(i.call(this,t,e)){var n,r,a=t.changedTouches,s=o.call(this,t,e),l=a.length;for(n=0;n<l;++n)(r=b(this,s,t,e,a[n].identifier,a[n]))&&(nn(t),r("start",t,a[n]))}}function y(t){var e,n,r=t.changedTouches,i=r.length;for(e=0;e<i;++e)(n=l[r[e].identifier])&&(rn(t),n("drag",t,r[e]))}function m(t){var e,n,i=t.changedTouches,o=i.length;for(r&&clearTimeout(r),r=setTimeout(function(){r=null},500),e=0;e<o;++e)(n=l[i[e].identifier])&&(nn(t),n("end",t,i[e]))}function b(t,e,n,r,i,o){var s,h,d,p=c.copy(),g=Qe(o||n,e);if(null!=(d=a.call(t,new ln("beforestart",{sourceEvent:n,target:f,identifier:i,active:u,x:g[0],y:g[1],dx:0,dy:0,dispatch:p}),r)))return s=d.x-g[0]||0,h=d.y-g[1]||0,function n(o,a,c){var _,y=g;switch(o){case"start":l[i]=n,_=u++;break;case"end":delete l[i],--u;case"drag":g=Qe(c||a,e),_=u}p.call(o,t,new ln(o,{sourceEvent:a,subject:d,target:f,identifier:i,active:_,x:g[0]+s,y:g[1]+h,dx:g[0]-y[0],dy:g[1]-y[1],dispatch:p}),r)}}return f.filter=function(t){return arguments.length?(i="function"==typeof t?t:sn(!!t),f):i},f.container=function(t){return arguments.length?(o="function"==typeof t?t:sn(t),f):o},f.subject=function(t){return arguments.length?(a="function"==typeof t?t:sn(t),f):a},f.touchable=function(t){return arguments.length?(s="function"==typeof t?t:sn(!!t),f):s},f.on=function(){var t=c.on.apply(c,arguments);return t===c?f:t},f.clickDistance=function(t){return arguments.length?(h=(t=+t)*t,f):Math.sqrt(h)},f},dragDisable:on,dragEnable:an,dsv:function(t,e,n,r){3===arguments.length&&"function"==typeof n&&(r=n,n=void 0);var i=Ls(t);return nl(e,n).then(function(t){return i.parse(t,r)})},dsvFormat:Ls,easeBack:Ro,easeBackIn:ko,easeBackInOut:Ro,easeBackOut:Mo,easeBounce:Co,easeBounceIn:function(t){return 1-Co(1-t)},easeBounceInOut:function(t){return((t*=2)<=1?1-Co(1-t):Co(t-1)+1)/2},easeBounceOut:Co,easeCircle:mo,easeCircleIn:function(t){return 1-Math.sqrt(1-t*t)},easeCircleInOut:mo,easeCircleOut:function(t){return Math.sqrt(1- --t*t)},easeCubic:lo,easeCubicIn:function(t){return t*t*t},easeCubicInOut:lo,easeCubicOut:function(t){return--t*t*t+1},easeElastic:Io,easeElasticIn:No,easeElasticInOut:Lo,easeElasticOut:Io,easeExp:yo,easeExpIn:function(t){return _o(1-+t)},easeExpInOut:yo,easeExpOut:function(t){return 1-_o(t)},easeLinear:t=>+t,easePoly:ho,easePolyIn:co,easePolyInOut:ho,easePolyOut:uo,easeQuad:so,easeQuadIn:function(t){return t*t},easeQuadInOut:so,easeQuadOut:function(t){return t*(2-t)},easeSin:go,easeSinIn:function(t){return 1===+t?1:1-Math.cos(t*po)},easeSinInOut:go,easeSinOut:function(t){return Math.sin(t*po)},every:function(t,e){if("function"!=typeof e)throw new TypeError("test is not a function");let n=-1;for(const r of t)if(!e(r,++n,t))return!1;return!0},extent:x,fcumsum:function(t,e){const n=new w;let r=-1;return Float64Array.from(t,void 0===e?t=>n.add(+t||0):i=>n.add(+e(i,++r,t)||0))},filter:function(t,e){if("function"!=typeof e)throw new TypeError("test is not a function");const n=[];let r=-1;for(const i of t)e(i,++r,t)&&n.push(i);return n},flatGroup:function(t,...e){return N(O(t,...e),e)},flatRollup:function(t,e,...n){return N(L(t,e,...n),n)},forceCenter:hl,forceCollide:function(t){var e,n,r,i=1,o=1;function a(){for(var t,a,l,c,u,h,f,d=e.length,p=0;p<o;++p)for(a=_l(e,wl,El).visitAfter(s),t=0;t<d;++t)l=e[t],h=n[l.index],f=h*h,c=l.x+l.vx,u=l.y+l.vy,a.visit(g);function g(t,e,n,o,a){var s=t.data,d=t.r,p=h+d;if(!s)return e>c+p||o<c-p||n>u+p||a<u-p;if(s.index>l.index){var g=c-s.x-s.vx,_=u-s.y-s.vy,y=g*g+_*_;y<p*p&&(0===g&&(y+=(g=xl(r))*g),0===_&&(y+=(_=xl(r))*_),y=(p-(y=Math.sqrt(y)))/y*i,l.vx+=(g*=y)*(p=(d*=d)/(f+d)),l.vy+=(_*=y)*p,s.vx-=g*(p=1-p),s.vy-=_*p)}}}function s(t){if(t.data)return t.r=n[t.data.index];for(var e=t.r=0;e<4;++e)t[e]&&t[e].r>t.r&&(t.r=t[e].r)}function l(){if(e){var r,i,o=e.length;for(n=new Array(o),r=0;r<o;++r)i=e[r],n[i.index]=+t(i,r,e)}}return"function"!=typeof t&&(t=vl(null==t?1:+t)),a.initialize=function(t,n){e=t,r=n,l()},a.iterations=function(t){return arguments.length?(o=+t,a):o},a.strength=function(t){return arguments.length?(i=+t,a):i},a.radius=function(e){return arguments.length?(t="function"==typeof e?e:vl(+e),l(),a):t},a},forceLink:Cl,forceManyBody:Nl,forceRadial:function(t,e,n){var r,i,o,a=vl(.1);function s(t){for(var a=0,s=r.length;a<s;++a){var l=r[a],c=l.x-e||1e-6,u=l.y-n||1e-6,h=Math.sqrt(c*c+u*u),f=(o[a]-h)*i[a]*t/h;l.vx+=c*f,l.vy+=u*f}}function l(){if(r){var e,n=r.length;for(i=new Array(n),o=new Array(n),e=0;e<n;++e)o[e]=+t(r[e],e,r),i[e]=isNaN(o[e])?0:+a(r[e],e,r)}}return"function"!=typeof t&&(t=vl(+t)),null==e&&(e=0),null==n&&(n=0),s.initialize=function(t){r=t,l()},s.strength=function(t){return arguments.length?(a="function"==typeof t?t:vl(+t),l(),s):a},s.radius=function(e){return arguments.length?(t="function"==typeof e?e:vl(+e),l(),s):t},s.x=function(t){return arguments.length?(e=+t,s):e},s.y=function(t){return arguments.length?(n=+t,s):n},s},forceSimulation:Ol,forceX:Il,forceY:Ll,get format(){return Hl},formatDefaultLocale:Kl,formatLocale:Xl,get formatPrefix(){return ql},formatSpecifier:zl,fsum:function(t,e){const n=new w;if(void 0===e)for(let e of t)(e=+e)&&n.add(e);else{let r=-1;for(let i of t)(i=+e(i,++r,t))&&n.add(i)}return+n},geoAlbers:id,geoAlbersUsa:function(){var t,e,n,r,i,o,a=id(),s=rd().rotate([154,0]).center([-2,58.5]).parallels([55,65]),l=rd().rotate([157,0]).center([-3,19.9]).parallels([8,18]),c={point:function(t,e){o=[t,e]}};function u(t){var e=t[0],a=t[1];return o=null,n.point(e,a),o||(r.point(e,a),o)||(i.point(e,a),o)}function h(){return t=e=null,u}return u.invert=function(t){var e=a.scale(),n=a.translate(),r=(t[0]-n[0])/e,i=(t[1]-n[1])/e;return(i>=.12&&i<.234&&r>=-.425&&r<-.214?s:i>=.166&&i<.234&&r>=-.214&&r<-.115?l:a).invert(t)},u.stream=function(n){return t&&e===n?t:(r=[a.stream(e=n),s.stream(n),l.stream(n)],i=r.length,t={point:function(t,e){for(var n=-1;++n<i;)r[n].point(t,e)},sphere:function(){for(var t=-1;++t<i;)r[t].sphere()},lineStart:function(){for(var t=-1;++t<i;)r[t].lineStart()},lineEnd:function(){for(var t=-1;++t<i;)r[t].lineEnd()},polygonStart:function(){for(var t=-1;++t<i;)r[t].polygonStart()},polygonEnd:function(){for(var t=-1;++t<i;)r[t].polygonEnd()}});var r,i},u.precision=function(t){return arguments.length?(a.precision(t),s.precision(t),l.precision(t),h()):a.precision()},u.scale=function(t){return arguments.length?(a.scale(t),s.scale(.35*t),l.scale(t),u.translate(a.translate())):a.scale()},u.translate=function(t){if(!arguments.length)return a.translate();var e=a.scale(),o=+t[0],u=+t[1];return n=a.translate(t).clipExtent([[o-.455*e,u-.238*e],[o+.455*e,u+.238*e]]).stream(c),r=s.translate([o-.307*e,u+.201*e]).clipExtent([[o-.425*e+tc,u+.12*e+tc],[o-.214*e-tc,u+.234*e-tc]]).stream(c),i=l.translate([o-.205*e,u+.212*e]).clipExtent([[o-.214*e+tc,u+.166*e+tc],[o-.115*e-tc,u+.234*e-tc]]).stream(c),h()},u.fitExtent=function(t,e){return Hf(u,t,e)},u.fitSize=function(t,e){return qf(u,t,e)},u.fitWidth=function(t,e){return Wf(u,t,e)},u.fitHeight=function(t,e){return $f(u,t,e)},u.scale(1070)},geoArea:function(t){return $c=new w,Rc(t,Xc),2*$c},geoAzimuthalEqualArea:function(){return Qf(sd).scale(124.75).clipAngle(179.999)},geoAzimuthalEqualAreaRaw:sd,geoAzimuthalEquidistant:function(){return Qf(ld).scale(79.4188).clipAngle(179.999)},geoAzimuthalEquidistantRaw:ld,geoBounds:function(t){var e,n,r,i,o,a,s;if(zc=Bc=-(Vc=Dc=1/0),Hc=[],Rc(t,Eu),n=Hc.length){for(Hc.sort(Nu),e=1,o=[r=Hc[0]];e<n;++e)Iu(r,(i=Hc[e])[0])||Iu(r,i[1])?(Ou(r[0],i[1])>Ou(r[0],r[1])&&(r[1]=i[1]),Ou(i[0],r[1])>Ou(r[0],r[1])&&(r[0]=i[0])):o.push(r=i);for(a=-1/0,e=0,r=o[n=o.length-1];e<=n;r=i,++e)i=o[e],(s=Ou(r[1],i[0]))>a&&(a=s,Vc=i[0],Bc=r[1])}return Hc=qc=null,Vc===1/0||Dc===1/0?[[NaN,NaN],[NaN,NaN]]:[[Vc,Dc],[Bc,zc]]},geoCentroid:function(t){su=lu=cu=uu=hu=fu=du=pu=0,gu=new w,_u=new w,yu=new w,Rc(t,Lu);var e=+gu,n=+_u,r=+yu,i=pc(e,n,r);return i<ec&&(e=fu,n=du,r=pu,lu<tc&&(e=cu,n=uu,r=hu),(i=pc(e,n,r))<ec)?[NaN,NaN]:[uc(n,e)*ac,wc(r/i)*ac]},geoCircle:function(){var t,e,n=Hu([0,0]),r=Hu(90),i=Hu(2),o={point:function(n,r){t.push(n=e(n,r)),n[0]*=ac,n[1]*=ac}};function a(){var a=n.apply(this,arguments),s=r.apply(this,arguments)*sc,l=i.apply(this,arguments)*sc;return t=[],e=$u(-a[0]*sc,-a[1]*sc,0).invert,Qu(o,s,l,1),a={type:"Polygon",coordinates:[t]},t=e=null,a}return a.center=function(t){return arguments.length?(n="function"==typeof t?t:Hu([+t[0],+t[1]]),a):n},a.radius=function(t){return arguments.length?(r="function"==typeof t?t:Hu(+t),a):r},a.precision=function(t){return arguments.length?(i="function"==typeof t?t:Hu(+t),a):i},a},geoClipAntimeridian:hh,geoClipCircle:fh,geoClipExtent:function(){var t,e,n,r=0,i=0,o=960,a=500;return n={stream:function(n){return t&&e===n?t:t=bh(r,i,o,a)(e=n)},extent:function(s){return arguments.length?(r=+s[0][0],i=+s[0][1],o=+s[1][0],a=+s[1][1],t=e=null,n):[[r,i],[o,a]]}}},geoClipRectangle:bh,geoConicConformal:function(){return ed(fd).scale(109.5).parallels([30,30])},geoConicConformalRaw:fd,geoConicEqualArea:rd,geoConicEqualAreaRaw:nd,geoConicEquidistant:function(){return ed(pd).scale(131.154).center([0,13.9389])},geoConicEquidistantRaw:pd,geoContains:function(t,e){return(t&&kh.hasOwnProperty(t.type)?kh[t.type]:Rh)(t,e)},geoDistance:Sh,geoEqualEarth:function(){return Qf(vd).scale(177.158)},geoEqualEarthRaw:vd,geoEquirectangular:function(){return Qf(dd).scale(152.63)},geoEquirectangularRaw:dd,geoGnomonic:function(){return Qf(xd).scale(144.049).clipAngle(60)},geoGnomonicRaw:xd,geoGraticule:Bh,geoGraticule10:function(){return Bh()()},geoIdentity:function(){var t,e,n,r,i,o,a,s=1,l=0,c=0,u=1,h=1,f=0,d=null,p=1,g=1,_=jf({point:function(t,e){var n=b([t,e]);this.stream.point(n[0],n[1])}}),y=Uh;function m(){return p=s*u,g=s*h,o=a=null,b}function b(n){var r=n[0]*p,i=n[1]*g;if(f){var o=i*t-r*e;r=r*t+i*e,i=o}return[r+l,i+c]}return b.invert=function(n){var r=n[0]-l,i=n[1]-c;if(f){var o=i*t+r*e;r=r*t-i*e,i=o}return[r/p,i/g]},b.stream=function(t){return o&&a===t?o:o=_(y(a=t))},b.postclip=function(t){return arguments.length?(y=t,d=n=r=i=null,m()):y},b.clipExtent=function(t){return arguments.length?(y=null==t?(d=n=r=i=null,Uh):bh(d=+t[0][0],n=+t[0][1],r=+t[1][0],i=+t[1][1]),m()):null==d?null:[[d,n],[r,i]]},b.scale=function(t){return arguments.length?(s=+t,m()):s},b.translate=function(t){return arguments.length?(l=+t[0],c=+t[1],m()):[l,c]},b.angle=function(n){return arguments.length?(e=yc(f=n%360*sc),t=hc(f),m()):f*ac},b.reflectX=function(t){return arguments.length?(u=t?-1:1,m()):u<0},b.reflectY=function(t){return arguments.length?(h=t?-1:1,m()):h<0},b.fitExtent=function(t,e){return Hf(b,t,e)},b.fitSize=function(t,e){return qf(b,t,e)},b.fitWidth=function(t,e){return Wf(b,t,e)},b.fitHeight=function(t,e){return $f(b,t,e)},b},geoInterpolate:function(t,e){var n=t[0]*sc,r=t[1]*sc,i=e[0]*sc,o=e[1]*sc,a=hc(r),s=yc(r),l=hc(o),c=yc(o),u=a*hc(n),h=a*yc(n),f=l*hc(i),d=l*yc(i),p=2*wc(bc(Ec(o-r)+a*l*Ec(i-n))),g=yc(p),_=p?function(t){var e=yc(t*=p)/g,n=yc(p-t)/g,r=n*u+e*f,i=n*h+e*d,o=n*s+e*c;return[uc(i,r)*ac,uc(o,bc(r*r+i*i))*ac]}:function(){return[n*ac,r*ac]};return _.distance=p,_},geoLength:Ah,geoMercator:function(){return ud(cd).scale(961/oc)},geoMercatorRaw:cd,geoNaturalEarth1:function(){return Qf(wd).scale(175.295)},geoNaturalEarth1Raw:wd,geoOrthographic:function(){return Qf(Ed).scale(249.5).clipAngle(90.000001)},geoOrthographicRaw:Ed,geoPath:function(t,e){let n,r,i=3,o=4.5;function a(t){return t&&("function"==typeof o&&r.pointRadius(+o.apply(this,arguments)),Rc(t,n(r))),r.result()}return a.area=function(t){return Rc(t,n(qh)),qh.result()},a.measure=function(t){return Rc(t,n(If)),If.result()},a.bounds=function(t){return Rc(t,n(ef)),ef.result()},a.centroid=function(t){return Rc(t,n(_f)),_f.result()},a.projection=function(e){return arguments.length?(n=null==e?(t=null,Uh):(t=e).stream,a):t},a.context=function(t){return arguments.length?(r=null==t?(e=null,new Ff(i)):new Cf(e=t),"function"!=typeof o&&r.pointRadius(o),a):e},a.pointRadius=function(t){return arguments.length?(o="function"==typeof t?t:(r.pointRadius(+t),+t),a):o},a.digits=function(t){if(!arguments.length)return i;if(null==t)i=null;else{const e=Math.floor(t);if(!(e>=0))throw new RangeError(`invalid digits: ${t}`);i=e}return null===e&&(r=new Ff(i)),a},a.projection(t).digits(i).context(e)},geoProjection:Qf,geoProjectionMutator:td,geoRotation:Ju,geoStereographic:function(){return Qf(Ad).scale(250).clipAngle(142)},geoStereographicRaw:Ad,geoStream:Rc,geoTransform:function(t){return{stream:jf(t)}},geoTransverseMercator:function(){var t=ud(Td),e=t.center,n=t.rotate;return t.center=function(t){return arguments.length?e([-t[1],t[0]]):[(t=e())[1],-t[0]]},t.rotate=function(t){return arguments.length?n([t[0],t[1],t.length>2?t[2]+90:90]):[(t=n())[0],t[1],t[2]-90]},n([0,0,90]).scale(159.155)},geoTransverseMercatorRaw:Td,gray:function(t,e){return new or(t,0,0,null==e?1:e)},greatest:ot,greatestIndex:function(e,n=t){if(1===n.length)return tt(e,n);let r,i=-1,o=-1;for(const t of e)++o,(i<0?0===n(t,t):n(t,r)>0)&&(r=t,i=o);return i},group:R,groupSort:function(e,n,r){return(2!==n.length?B(I(e,n,r),([e,n],[r,i])=>t(n,i)||t(e,r)):B(R(e,r),([e,r],[i,o])=>n(r,o)||t(e,i))).map(([t])=>t)},groups:O,hcl:hr,hierarchy:Od,histogram:J,hsl:Yn,html:cl,image:function(t,e){return new Promise(function(n,r){var i=new Image;for(var o in e)i[o]=e[o];i.onerror=r,i.onload=function(){n(i)},i.src=t})},index:function(t,...e){return V(t,M,P,e)},indexes:function(t,...e){return V(t,Array.from,P,e)},interpolate:Hr,interpolateArray:function(t,e){return(Dr(e)?Vr:Br)(t,e)},interpolateBasis:Tr,interpolateBasisClosed:Cr,interpolateBlues:zb,interpolateBrBG:Zm,interpolateBuGn:gb,interpolateBuPu:yb,interpolateCividis:function(t){return t=Math.max(0,Math.min(1,t)),"rgb("+Math.max(0,Math.min(255,Math.round(-4.54-t*(35.34-t*(2381.73-t*(6402.7-t*(7024.72-2710.57*t)))))))+", "+Math.max(0,Math.min(255,Math.round(32.49+t*(170.73+t*(52.82-t*(131.46-t*(176.58-67.37*t)))))))+", "+Math.max(0,Math.min(255,Math.round(81.24+t*(442.36-t*(2482.43-t*(6167.24-t*(6614.94-2475.67*t)))))))+")"},interpolateCool:Jb,interpolateCubehelix:ci,interpolateCubehelixDefault:Kb,interpolateCubehelixLong:ui,interpolateDate:zr,interpolateDiscrete:function(t){var e=t.length;return function(n){return t[Math.max(0,Math.min(e-1,Math.floor(n*e)))]}},interpolateGnBu:bb,interpolateGreens:Gb,interpolateGreys:Ub,interpolateHcl:ai,interpolateHclLong:si,interpolateHsl:ri,interpolateHslLong:ii,interpolateHue:function(t,e){var n=Mr(+t,+e);return function(t){var e=n(t);return e-360*Math.floor(e/360)}},interpolateInferno:sv,interpolateLab:function(t,e){var n=Or((t=ir(t)).l,(e=ir(e)).l),r=Or(t.a,e.a),i=Or(t.b,e.b),o=Or(t.opacity,e.opacity);return function(e){return t.l=n(e),t.a=r(e),t.b=i(e),t.opacity=o(e),t+""}},interpolateMagma:av,interpolateNumber:Fr,interpolateNumberArray:Vr,interpolateObject:Gr,interpolateOrRd:xb,interpolateOranges:Xb,interpolatePRGn:Qm,interpolatePiYG:eb,interpolatePlasma:lv,interpolatePuBu:Tb,interpolatePuBuGn:Eb,interpolatePuOr:rb,interpolatePuRd:Sb,interpolatePurples:Hb,interpolateRainbow:function(t){(t<0||t>1)&&(t-=Math.floor(t));var e=Math.abs(t-.5);return Qb.h=360*t-100,Qb.s=1.5-1.5*e,Qb.l=.8-.9*e,Qb+""},interpolateRdBu:ob,interpolateRdGy:sb,interpolateRdPu:Mb,interpolateRdYlBu:cb,interpolateRdYlGn:hb,interpolateReds:Wb,interpolateRgb:Nr,interpolateRgbBasis:Lr,interpolateRgbBasisClosed:Pr,interpolateRound:qr,interpolateSinebow:function(t){var e;return t=(.5-t)*Math.PI,tv.r=255*(e=Math.sin(t))*e,tv.g=255*(e=Math.sin(t+ev))*e,tv.b=255*(e=Math.sin(t+nv))*e,tv+""},interpolateSpectral:db,interpolateString:Yr,interpolateTransformCss:Jr,interpolateTransformSvg:Qr,interpolateTurbo:rv,interpolateViridis:ov,interpolateWarm:Zb,interpolateYlGn:Ib,interpolateYlGnBu:Ob,interpolateYlOrBr:Pb,interpolateYlOrRd:Db,interpolateZoom:ei,interrupt:Di,intersection:function(t,...e){t=new A(t),e=e.map(vt);t:for(const n of t)for(const r of e)if(!r.has(n)){t.delete(n);continue t}return t},interval:function(t,e,n){var r=new Ai,i=e;return null==e?(r.restart(t,e,n),r):(r._restart=r.restart,r.restart=function(t,e,n){e=+e,n=null==n?wi():+n,r._restart(function o(a){a+=i,r._restart(o,i+=e,n),t(a)},e,n)},r.restart(t,e,n),r)},isoFormat:Tm,isoParse:Cm,json:function(t,e){return fetch(t,e).then(al)},lab:ir,lch:function(t,e,n,r){return 1===arguments.length?ur(t):new fr(n,e,t,null==r?1:r)},least:function(e,n=t){let r,i=!1;if(1===n.length){let o;for(const a of e){const e=n(a);(i?t(e,o)<0:0===t(e,e))&&(r=a,o=e,i=!0)}}else for(const t of e)(i?n(t,r)<0:0===n(t,t))&&(r=t,i=!0);return r},leastIndex:pt,line:Pv,lineRadial:Uv,link:Qv,linkHorizontal:tx,linkRadial:nx,linkVertical:ex,local:Ke,map:function(t,e){if("function"!=typeof t[Symbol.iterator])throw new TypeError("values is not iterable");if("function"!=typeof e)throw new TypeError("mapper is not a function");return Array.from(t,(n,r)=>e(n,r,t))},matcher:Wt,max:Q,maxIndex:tt,mean:ct,median:ut,medianIndex:function(t,e){return lt(t,.5,e)},merge:ht,min:et,minIndex:nt,mode:function(t,e){const n=new E;if(void 0===e)for(let e of t)null!=e&&e>=e&&n.set(e,(n.get(e)||0)+1);else{let r=-1;for(let i of t)null!=(i=e(i,++r,t))&&i>=i&&n.set(i,(n.get(i)||0)+1)}let r,i=0;for(const[t,e]of n)e>i&&(i=e,r=t);return r},namespace:Bt,namespaces:Dt,nice:K,now:wi,pack:rp,packEnclose:function(t){return Ud(t,jd())},packSiblings:function(t){return ep(t,jd()),t},pairs:function(t,e=ft){const n=[];let r,i=!1;for(const o of t)i&&n.push(e(r,o)),r=o,i=!0;return n},partition:function(){var t=1,e=1,n=0,r=!1;function i(i){var o=i.height+1;return i.x0=i.y0=n,i.x1=t,i.y1=e/o,i.eachBefore(function(t,e){return function(r){r.children&&lp(r,r.x0,t*(r.depth+1)/e,r.x1,t*(r.depth+2)/e);var i=r.x0,o=r.y0,a=r.x1-n,s=r.y1-n;a<i&&(i=a=(i+a)/2),s<o&&(o=s=(o+s)/2),r.x0=i,r.y0=o,r.x1=a,r.y1=s}}(e,o)),r&&i.eachBefore(sp),i}return i.round=function(t){return arguments.length?(r=!!t,i):r},i.size=function(n){return arguments.length?(t=+n[0],e=+n[1],i):[t,e]},i.padding=function(t){return arguments.length?(n=+t,i):n},i},path:Ca,pathRound:function(t=3){return new Ta(+t)},permute:D,pie:function(){var t=Bv,e=Dv,n=null,r=cv(0),i=cv(vv),o=cv(0);function a(a){var s,l,c,u,h,f=(a=Rv(a)).length,d=0,p=new Array(f),g=new Array(f),_=+r.apply(this,arguments),y=Math.min(vv,Math.max(-vv,i.apply(this,arguments)-_)),m=Math.min(Math.abs(y)/f,o.apply(this,arguments)),b=m*(y<0?-1:1);for(s=0;s<f;++s)(h=g[p[s]=s]=+t(a[s],s,a))>0&&(d+=h);for(null!=e?p.sort(function(t,n){return e(g[t],g[n])}):null!=n&&p.sort(function(t,e){return n(a[t],a[e])}),s=0,c=d?(y-f*b)/d:0;s<f;++s,_=u)l=p[s],u=_+((h=g[l])>0?h*c:0)+b,g[l]={data:a[l],index:s,value:h,startAngle:_,endAngle:u,padAngle:m};return g}return a.value=function(e){return arguments.length?(t="function"==typeof e?e:cv(+e),a):t},a.sortValues=function(t){return arguments.length?(e=t,n=null,a):e},a.sort=function(t){return arguments.length?(n=t,e=null,a):n},a.startAngle=function(t){return arguments.length?(r="function"==typeof t?t:cv(+t),a):r},a.endAngle=function(t){return arguments.length?(i="function"==typeof t?t:cv(+t),a):i},a.padAngle=function(t){return arguments.length?(o="function"==typeof t?t:cv(+t),a):o},a},piecewise:hi,pointRadial:Hv,pointer:Qe,pointers:function(t,e){return t.target&&(t=Je(t),void 0===e&&(e=t.currentTarget),t=t.touches||[t]),Array.from(t,t=>Qe(t,e))},polygonArea:function(t){for(var e,n=-1,r=t.length,i=t[r-1],o=0;++n<r;)e=i,i=t[n],o+=e[1]*i[0]-e[0]*i[1];return o/2},polygonCentroid:function(t){for(var e,n,r=-1,i=t.length,o=0,a=0,s=t[i-1],l=0;++r<i;)e=s,s=t[r],l+=n=e[0]*s[1]-s[0]*e[1],o+=(e[0]+s[0])*n,a+=(e[1]+s[1])*n;return[o/(l*=3),a/l]},polygonContains:function(t,e){for(var n,r,i=t.length,o=t[i-1],a=e[0],s=e[1],l=o[0],c=o[1],u=!1,h=0;h<i;++h)n=(o=t[h])[0],(r=o[1])>s!=c>s&&a<(l-n)*(s-r)/(c-r)+n&&(u=!u),l=n,c=r;return u},polygonHull:function(t){if((n=t.length)<3)return null;var e,n,r=new Array(n),i=new Array(n);for(e=0;e<n;++e)r[e]=[+t[e][0],+t[e][1],e];for(r.sort(Rp),e=0;e<n;++e)i[e]=[r[e][0],-r[e][1]];var o=Op(r),a=Op(i),s=a[0]===o[0],l=a[a.length-1]===o[o.length-1],c=[];for(e=o.length-1;e>=0;--e)c.push(t[r[o[e]][2]]);for(e=+s;e<a.length-l;++e)c.push(t[r[a[e]][2]]);return c},polygonLength:function(t){for(var e,n,r=-1,i=t.length,o=t[i-1],a=o[0],s=o[1],l=0;++r<i;)e=a,n=s,e-=a=(o=t[r])[0],n-=s=o[1],l+=Math.hypot(e,n);return l},precisionFixed:Zl,precisionPrefix:Jl,precisionRound:Ql,quadtree:_l,quantile:at,quantileIndex:lt,quantileSorted:st,quantize:function(t,e){for(var n=new Array(e),r=0;r<e;++r)n[r]=t(r/(e-1));return n},quickselect:rt,radialArea:Yv,radialLine:Uv,randomBates:Bp,randomBernoulli:Gp,randomBeta:Yp,randomBinomial:Hp,randomCauchy:Wp,randomExponential:zp,randomGamma:Up,randomGeometric:jp,randomInt:Lp,randomIrwinHall:Dp,randomLcg:function(t=Math.random()){let e=0|(0<=t&&t<1?t/Kp:Math.abs(t));return()=>(e=1664525*e+1013904223|0,Kp*(e>>>0))},randomLogNormal:Vp,randomLogistic:$p,randomNormal:Pp,randomPareto:Fp,randomPoisson:Xp,randomUniform:Ip,randomWeibull:qp,range:dt,rank:function(e,n=t){if("function"!=typeof e[Symbol.iterator])throw new TypeError("values is not iterable");let r=Array.from(e);const i=new Float64Array(r.length);2!==n.length&&(r=r.map(n),n=t);const o=(t,e)=>n(r[t],r[e]);let a,s;return(e=Uint32Array.from(r,(t,e)=>e)).sort(n===t?(t,e)=>F(r[t],r[e]):z(o)),e.forEach((t,e)=>{const n=o(t,void 0===a?t:a);n>=0?((void 0===a||n>0)&&(a=t,s=e),i[t]=s):i[t]=NaN}),i},reduce:function(t,e,n){if("function"!=typeof e)throw new TypeError("reducer is not a function");const r=t[Symbol.iterator]();let i,o,a=-1;if(arguments.length<3){if(({done:i,value:n}=r.next()),i)return;++a}for(;({done:i,value:o}=r.next()),!i;)n=e(n,o,++a,t);return n},reverse:function(t){if("function"!=typeof t[Symbol.iterator])throw new TypeError("values is not iterable");return Array.from(t).reverse()},rgb:Pn,ribbon:function(){return Va()},ribbonArrow:function(){return Va(Pa)},rollup:I,rollups:L,scaleBand:eg,scaleDiverging:function t(){var e=pg(Pm()(ag));return e.copy=function(){return Nm(e,t())},Jp.apply(e,arguments)},scaleDivergingLog:function t(){var e=Eg(Pm()).domain([.1,1,10]);return e.copy=function(){return Nm(e,t()).base(e.base())},Jp.apply(e,arguments)},scaleDivergingPow:Vm,scaleDivergingSqrt:function(){return Vm.apply(null,arguments).exponent(.5)},scaleDivergingSymlog:function t(){var e=Sg(Pm());return e.copy=function(){return Nm(e,t()).constant(e.constant())},Jp.apply(e,arguments)},scaleIdentity:function t(e){var n;function r(t){return null==t||isNaN(t=+t)?n:t}return r.invert=r,r.domain=r.range=function(t){return arguments.length?(e=Array.from(t,ig),r):e.slice()},r.unknown=function(t){return arguments.length?(n=t,r):n},r.copy=function(){return t(e).unknown(n)},e=arguments.length?Array.from(e,ig):[0,1],pg(r)},scaleImplicit:Qp,scaleLinear:gg,scaleLog:Ag,scaleOrdinal:tg,scalePoint:rg,scalePow:Ng,scaleQuantile:function e(){var n,r=[],i=[],o=[];function s(){var t=0,e=Math.max(1,i.length);for(o=new Array(e-1);++t<e;)o[t-1]=st(r,t/e);return l}function l(t){return null==t||isNaN(t=+t)?n:i[a(o,t)]}return l.invertExtent=function(t){var e=i.indexOf(t);return e<0?[NaN,NaN]:[e>0?o[e-1]:r[0],e<o.length?o[e]:r[r.length-1]]},l.domain=function(e){if(!arguments.length)return r.slice();r=[];for(let t of e)null==t||isNaN(t=+t)||r.push(t);return r.sort(t),s()},l.range=function(t){return arguments.length?(i=Array.from(t),s()):i.slice()},l.unknown=function(t){return arguments.length?(n=t,l):n},l.quantiles=function(){return o.slice()},l.copy=function(){return e().domain(r).range(i).unknown(n)},Zp.apply(l,arguments)},scaleQuantize:function t(){var e,n=0,r=1,i=1,o=[.5],s=[0,1];function l(t){return null!=t&&t<=t?s[a(o,t,0,i)]:e}function c(){var t=-1;for(o=new Array(i);++t<i;)o[t]=((t+1)*r-(t-i)*n)/(i+1);return l}return l.domain=function(t){return arguments.length?([n,r]=t,n=+n,r=+r,c()):[n,r]},l.range=function(t){return arguments.length?(i=(s=Array.from(t)).length-1,c()):s.slice()},l.invertExtent=function(t){var e=s.indexOf(t);return e<0?[NaN,NaN]:e<1?[n,o[0]]:e>=i?[o[i-1],r]:[o[e-1],o[e]]},l.unknown=function(t){return arguments.length?(e=t,l):l},l.thresholds=function(){return o.slice()},l.copy=function(){return t().domain([n,r]).range(s).unknown(e)},Zp.apply(pg(l),arguments)},scaleRadial:function t(){var e,n=fg(),r=[0,1],i=!1;function o(t){var r=function(t){return Math.sign(t)*Math.sqrt(Math.abs(t))}(n(t));return isNaN(r)?e:i?Math.round(r):r}return o.invert=function(t){return n.invert(Ig(t))},o.domain=function(t){return arguments.length?(n.domain(t),o):n.domain()},o.range=function(t){return arguments.length?(n.range((r=Array.from(t,ig)).map(Ig)),o):r.slice()},o.rangeRound=function(t){return o.range(t).round(!0)},o.round=function(t){return arguments.length?(i=!!t,o):i},o.clamp=function(t){return arguments.length?(n.clamp(t),o):n.clamp()},o.unknown=function(t){return arguments.length?(e=t,o):e},o.copy=function(){return t(n.domain(),r).round(i).clamp(n.clamp()).unknown(e)},Zp.apply(o,arguments),pg(o)},scaleSequential:Im,scaleSequentialLog:function t(){var e=Eg(Om()).domain([1,10]);return e.copy=function(){return Nm(e,t()).base(e.base())},Jp.apply(e,arguments)},scaleSequentialPow:Lm,scaleSequentialQuantile:function e(){var n=[],r=ag;function i(t){if(null!=t&&!isNaN(t=+t))return r((a(n,t,1)-1)/(n.length-1))}return i.domain=function(e){if(!arguments.length)return n.slice();n=[];for(let t of e)null==t||isNaN(t=+t)||n.push(t);return n.sort(t),i},i.interpolator=function(t){return arguments.length?(r=t,i):r},i.range=function(){return n.map((t,e)=>r(e/(n.length-1)))},i.quantiles=function(t){return Array.from({length:t+1},(e,r)=>at(n,r/t))},i.copy=function(){return e(r).domain(n)},Jp.apply(i,arguments)},scaleSequentialSqrt:function(){return Lm.apply(null,arguments).exponent(.5)},scaleSequentialSymlog:function t(){var e=Sg(Om());return e.copy=function(){return Nm(e,t()).constant(e.constant())},Jp.apply(e,arguments)},scaleSqrt:function(){return Ng.apply(null,arguments).exponent(.5)},scaleSymlog:function t(){var e=Sg(hg());return e.copy=function(){return ug(e,t()).constant(e.constant())},Zp.apply(e,arguments)},scaleThreshold:function t(){var e,n=[.5],r=[0,1],i=1;function o(t){return null!=t&&t<=t?r[a(n,t,0,i)]:e}return o.domain=function(t){return arguments.length?(n=Array.from(t),i=Math.min(n.length,r.length-1),o):n.slice()},o.range=function(t){return arguments.length?(r=Array.from(t),i=Math.min(n.length,r.length-1),o):r.slice()},o.invertExtent=function(t){var e=r.indexOf(t);return[n[e-1],n[e]]},o.unknown=function(t){return arguments.length?(e=t,o):e},o.copy=function(){return t().domain(n).range(r).unknown(e)},Zp.apply(o,arguments)},scaleTime:Rm,scaleUtc:function(){return Zp.apply(Mm(W_,$_,Y_,F_,A_,i_,t_,Kg,qg,iy).domain([Date.UTC(2e3,0,1),Date.UTC(2e3,0,2)]),arguments)},scan:function(t,e){const n=pt(t,e);return n<0?void 0:n},schemeAccent:zm,schemeBlues:Bb,schemeBrBG:Km,schemeBuGn:pb,schemeBuPu:_b,schemeCategory10:Bm,schemeDark2:Fm,schemeGnBu:mb,schemeGreens:Fb,schemeGreys:jb,schemeObservable10:Gm,schemeOrRd:vb,schemeOranges:$b,schemePRGn:Jm,schemePaired:jm,schemePastel1:Um,schemePastel2:Ym,schemePiYG:tb,schemePuBu:Ab,schemePuBuGn:wb,schemePuOr:nb,schemePuRd:Cb,schemePurples:Yb,schemeRdBu:ib,schemeRdGy:ab,schemeRdPu:kb,schemeRdYlBu:lb,schemeRdYlGn:ub,schemeReds:qb,schemeSet1:Hm,schemeSet2:qm,schemeSet3:Wm,schemeSpectral:fb,schemeTableau10:$m,schemeYlGn:Nb,schemeYlGnBu:Rb,schemeYlOrBr:Lb,schemeYlOrRd:Vb,select:$e,selectAll:function(t){return"string"==typeof t?new qe([document.querySelectorAll(t)],[document.documentElement]):new qe([Yt(t)],He)},selection:We,selector:Ut,selectorAll:qt,shuffle:gt,shuffler:_t,some:function(t,e){if("function"!=typeof e)throw new TypeError("test is not a function");let n=-1;for(const r of t)if(e(r,++n,t))return!0;return!1},sort:B,stack:function(){var t=cv([]),e=fw,n=hw,r=dw;function i(i){var o,a,s=Array.from(t.apply(this,arguments),pw),l=s.length,c=-1;for(const t of i)for(o=0,++c;o<l;++o)(s[o][c]=[0,+r(t,s[o].key,c,i)]).data=t;for(o=0,a=Rv(e(s));o<l;++o)s[a[o]].index=o;return n(s,a),s}return i.keys=function(e){return arguments.length?(t="function"==typeof e?e:cv(Array.from(e)),i):t},i.value=function(t){return arguments.length?(r="function"==typeof t?t:cv(+t),i):r},i.order=function(t){return arguments.length?(e=null==t?fw:"function"==typeof t?t:cv(Array.from(t)),i):e},i.offset=function(t){return arguments.length?(n=null==t?hw:t,i):n},i},stackOffsetDiverging:function(t,e){if((s=t.length)>0)for(var n,r,i,o,a,s,l=0,c=t[e[0]].length;l<c;++l)for(o=a=0,n=0;n<s;++n)(i=(r=t[e[n]][l])[1]-r[0])>0?(r[0]=o,r[1]=o+=i):i<0?(r[1]=a,r[0]=a+=i):(r[0]=0,r[1]=i)},stackOffsetExpand:function(t,e){if((r=t.length)>0){for(var n,r,i,o=0,a=t[0].length;o<a;++o){for(i=n=0;n<r;++n)i+=t[n][o][1]||0;if(i)for(n=0;n<r;++n)t[n][o][1]/=i}hw(t,e)}},stackOffsetNone:hw,stackOffsetSilhouette:function(t,e){if((n=t.length)>0){for(var n,r=0,i=t[e[0]],o=i.length;r<o;++r){for(var a=0,s=0;a<n;++a)s+=t[a][r][1]||0;i[r][1]+=i[r][0]=-s/2}hw(t,e)}},stackOffsetWiggle:function(t,e){if((i=t.length)>0&&(r=(n=t[e[0]]).length)>0){for(var n,r,i,o=0,a=1;a<r;++a){for(var s=0,l=0,c=0;s<i;++s){for(var u=t[e[s]],h=u[a][1]||0,f=(h-(u[a-1][1]||0))/2,d=0;d<s;++d){var p=t[e[d]];f+=(p[a][1]||0)-(p[a-1][1]||0)}l+=h,c+=f*h}n[a-1][1]+=n[a-1][0]=o,l&&(o-=c/l)}n[a-1][1]+=n[a-1][0]=o,hw(t,e)}},stackOrderAppearance:gw,stackOrderAscending:yw,stackOrderDescending:function(t){return yw(t).reverse()},stackOrderInsideOut:function(t){var e,n,r=t.length,i=t.map(mw),o=gw(t),a=0,s=0,l=[],c=[];for(e=0;e<r;++e)n=o[e],a<s?(a+=i[n],l.push(n)):(s+=i[n],c.push(n));return c.reverse().concat(l)},stackOrderNone:fw,stackOrderReverse:function(t){return fw(t).reverse()},stratify:function(){var t,e=fp,n=dp;function r(r){var i,o,a,s,l,c,u,h,f=Array.from(r),d=e,p=n,g=new Map;if(null!=t){const e=f.map((e,n)=>function(t){t=`${t}`;let e=t.length;gp(t,e-1)&&!gp(t,e-2)&&(t=t.slice(0,-1));return"/"===t[0]?t:`/${t}`}(t(e,n,r))),n=e.map(pp),i=new Set(e).add("");for(const t of n)i.has(t)||(i.add(t),e.push(t),n.push(pp(t)),f.push(hp));d=(t,n)=>e[n],p=(t,e)=>n[e]}for(a=0,i=f.length;a<i;++a)o=f[a],c=f[a]=new Vd(o),null!=(u=d(o,a,r))&&(u+="")&&(h=c.id=u,g.set(h,g.has(h)?up:c)),null!=(u=p(o,a,r))&&(u+="")&&(c.parent=u);for(a=0;a<i;++a)if(u=(c=f[a]).parent){if(!(l=g.get(u)))throw new Error("missing: "+u);if(l===up)throw new Error("ambiguous: "+u);l.children?l.children.push(c):l.children=[c],c.parent=l}else{if(s)throw new Error("multiple roots");s=c}if(!s)throw new Error("no root");if(null!=t){for(;s.data===hp&&1===s.children.length;)s=s.children[0],--i;for(let t=f.length-1;t>=0&&(c=f[t]).data===hp;--t)c.data=null}if(s.parent=cp,s.eachBefore(function(t){t.depth=t.parent.depth+1,--i}).eachBefore(Pd),s.parent=null,i>0)throw new Error("cycle");return s}return r.id=function(t){return arguments.length?(e=Dd(t),r):e},r.parentId=function(t){return arguments.length?(n=Dd(t),r):n},r.path=function(e){return arguments.length?(t=Dd(e),r):t},r},style:_e,subset:function(t,e){return xt(e,t)},sum:yt,superset:xt,svg:ul,symbol:function(t,e){let n=null,r=wv(i);function i(){let i;if(n||(n=i=r()),t.apply(this,arguments).draw(n,+e.apply(this,arguments)),i)return n=null,i+""||null}return t="function"==typeof t?t:cv(t||ox),e="function"==typeof e?e:cv(void 0===e?64:+e),i.type=function(e){return arguments.length?(t="function"==typeof e?e:cv(e),i):t},i.size=function(t){return arguments.length?(e="function"==typeof t?t:cv(+t),i):e},i.context=function(t){return arguments.length?(n=null==t?null:t,i):n},i},symbolAsterisk:ix,symbolCircle:ox,symbolCross:ax,symbolDiamond:cx,symbolDiamond2:ux,symbolPlus:hx,symbolSquare:fx,symbolSquare2:dx,symbolStar:yx,symbolTimes:Sx,symbolTriangle:bx,symbolTriangle2:xx,symbolWye:Cx,symbolX:Sx,symbols:kx,symbolsFill:kx,symbolsStroke:Mx,text:nl,thresholdFreedmanDiaconis:function(t,e,n){const r=g(t),i=at(t,.75)-at(t,.25);return r&&i?Math.ceil((n-e)/(2*i*Math.pow(r,-1/3))):1},thresholdScott:function(t,e,n){const r=g(t),i=v(t);return r&&i?Math.ceil((n-e)*Math.cbrt(r)/(3.49*i)):1},thresholdSturges:Z,tickFormat:dg,tickIncrement:$,tickStep:X,ticks:W,timeDay:n_,timeDays:r_,get timeFormat(){return ny},timeFormatDefaultLocale:Em,timeFormatLocale:ty,timeFriday:p_,timeFridays:x_,timeHour:Jg,timeHours:Qg,timeInterval:Vg,timeMillisecond:Dg,timeMilliseconds:Bg,timeMinute:$g,timeMinutes:Xg,timeMonday:u_,timeMondays:y_,timeMonth:B_,timeMonths:z_,get timeParse(){return ry},timeSaturday:g_,timeSaturdays:w_,timeSecond:qg,timeSeconds:Wg,timeSunday:c_,timeSundays:__,timeThursday:d_,timeThursdays:v_,timeTickInterval:K_,timeTicks:X_,timeTuesday:h_,timeTuesdays:m_,timeWednesday:f_,timeWednesdays:b_,timeWeek:c_,timeWeeks:__,timeYear:j_,timeYears:U_,timeout:Ri,timer:Ti,timerFlush:Ci,transition:io,transpose:mt,tree:wp,treemap:Sp,treemapBinary:function(t,e,n,r,i){var o,a,s=t.children,l=s.length,c=new Array(l+1);for(c[0]=a=o=0;o<l;++o)c[o+1]=a+=s[o].value;!function t(e,n,r,i,o,a,l){if(e>=n-1){var u=s[e];return u.x0=i,u.y0=o,u.x1=a,void(u.y1=l)}var h=c[e],f=r/2+h,d=e+1,p=n-1;for(;d<p;){var g=d+p>>>1;c[g]<f?d=g+1:p=g}f-c[d-1]<c[d]-f&&e+1<d&&--d;var _=c[d]-h,y=r-_;if(a-i>l-o){var m=r?(i*y+a*_)/r:a;t(e,d,_,i,o,m,l),t(d,n,y,m,o,a,l)}else{var b=r?(o*y+l*_)/r:l;t(e,d,_,i,o,a,b),t(d,n,y,i,b,a,l)}}(0,l,t.value,e,n,r,i)},treemapDice:lp,treemapResquarify:kp,treemapSlice:Ep,treemapSliceDice:function(t,e,n,r,i){(1&t.depth?Ep:lp)(t,e,n,r,i)},treemapSquarify:Cp,tsv:ol,tsvFormat:qs,tsvFormatBody:Ws,tsvFormatRow:Xs,tsvFormatRows:$s,tsvFormatValue:Ks,tsvParse:Ys,tsvParseRows:Hs,union:function(...t){const e=new A;for(const n of t)for(const t of n)e.add(t);return e},unixDay:a_,unixDays:s_,utcDay:i_,utcDays:o_,get utcFormat(){return iy},utcFriday:M_,utcFridays:V_,utcHour:t_,utcHours:e_,utcMillisecond:Dg,utcMilliseconds:Bg,utcMinute:Kg,utcMinutes:Zg,utcMonday:T_,utcMondays:N_,utcMonth:F_,utcMonths:G_,get utcParse(){return oy},utcSaturday:R_,utcSaturdays:D_,utcSecond:qg,utcSeconds:Wg,utcSunday:A_,utcSundays:O_,utcThursday:k_,utcThursdays:P_,utcTickInterval:$_,utcTicks:W_,utcTuesday:C_,utcTuesdays:I_,utcWednesday:S_,utcWednesdays:L_,utcWeek:A_,utcWeeks:O_,utcYear:Y_,utcYears:H_,variance:b,window:fe,xml:ll,zip:function(){return mt(arguments)},zoom:function(){var t,e,n,r=Cw,i=Sw,o=Ow,a=Mw,s=Rw,l=[0,1/0],c=[[-1/0,-1/0],[1/0,1/0]],u=250,h=ei,f=Nt("start","zoom","end"),d=0,p=10;function g(t){t.property("__zoom",kw).on("wheel.zoom",w,{passive:!1}).on("mousedown.zoom",E).on("dblclick.zoom",A).filter(s).on("touchstart.zoom",T).on("touchmove.zoom",C).on("touchend.zoom touchcancel.zoom",S).style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function _(t,e){return(e=Math.max(l[0],Math.min(l[1],e)))===t.k?t:new xw(e,t.x,t.y)}function y(t,e,n){var r=e[0]-n[0]*t.k,i=e[1]-n[1]*t.k;return r===t.x&&i===t.y?t:new xw(t.k,r,i)}function m(t){return[(+t[0][0]+ +t[1][0])/2,(+t[0][1]+ +t[1][1])/2]}function b(t,e,n,r){t.on("start.zoom",function(){v(this,arguments).event(r).start()}).on("interrupt.zoom end.zoom",function(){v(this,arguments).event(r).end()}).tween("zoom",function(){var t=this,o=arguments,a=v(t,o).event(r),s=i.apply(t,o),l=null==n?m(s):"function"==typeof n?n.apply(t,o):n,c=Math.max(s[1][0]-s[0][0],s[1][1]-s[0][1]),u=t.__zoom,f="function"==typeof e?e.apply(t,o):e,d=h(u.invert(l).concat(c/u.k),f.invert(l).concat(c/f.k));return function(t){if(1===t)t=f;else{var e=d(t),n=c/e[2];t=new xw(n,l[0]-e[0]*n,l[1]-e[1]*n)}a.zoom(null,t)}})}function v(t,e,n){return!n&&t.__zooming||new x(t,e)}function x(t,e){this.that=t,this.args=e,this.active=0,this.sourceEvent=null,this.extent=i.apply(t,e),this.taps=0}function w(t,...e){if(r.apply(this,arguments)){var n=v(this,e).event(t),i=this.__zoom,s=Math.max(l[0],Math.min(l[1],i.k*Math.pow(2,a.apply(this,arguments)))),u=Qe(t);if(n.wheel)n.mouse[0][0]===u[0]&&n.mouse[0][1]===u[1]||(n.mouse[1]=i.invert(n.mouse[0]=u)),clearTimeout(n.wheel);else{if(i.k===s)return;n.mouse=[u,i.invert(u)],Di(this),n.start()}Tw(t),n.wheel=setTimeout(function(){n.wheel=null,n.end()},150),n.zoom("mouse",o(y(_(i,s),n.mouse[0],n.mouse[1]),n.extent,c))}}function E(t,...e){if(!n&&r.apply(this,arguments)){var i=t.currentTarget,a=v(this,e,!0).event(t),s=$e(t.view).on("mousemove.zoom",function(t){if(Tw(t),!a.moved){var e=t.clientX-u,n=t.clientY-h;a.moved=e*e+n*n>d}a.event(t).zoom("mouse",o(y(a.that.__zoom,a.mouse[0]=Qe(t,i),a.mouse[1]),a.extent,c))},!0).on("mouseup.zoom",function(t){s.on("mousemove.zoom mouseup.zoom",null),an(t.view,a.moved),Tw(t),a.event(t).end()},!0),l=Qe(t,i),u=t.clientX,h=t.clientY;on(t.view),Aw(t),a.mouse=[l,this.__zoom.invert(l)],Di(this),a.start()}}function A(t,...e){if(r.apply(this,arguments)){var n=this.__zoom,a=Qe(t.changedTouches?t.changedTouches[0]:t,this),s=n.invert(a),l=n.k*(t.shiftKey?.5:2),h=o(y(_(n,l),a,s),i.apply(this,e),c);Tw(t),u>0?$e(this).transition().duration(u).call(b,h,a,t):$e(this).call(g.transform,h,a,t)}}function T(n,...i){if(r.apply(this,arguments)){var o,a,s,l,c=n.touches,u=c.length,h=v(this,i,n.changedTouches.length===u).event(n);for(Aw(n),a=0;a<u;++a)l=[l=Qe(s=c[a],this),this.__zoom.invert(l),s.identifier],h.touch0?h.touch1||h.touch0[2]===l[2]||(h.touch1=l,h.taps=0):(h.touch0=l,o=!0,h.taps=1+!!t);t&&(t=clearTimeout(t)),o&&(h.taps<2&&(e=l[0],t=setTimeout(function(){t=null},500)),Di(this),h.start())}}function C(t,...e){if(this.__zooming){var n,r,i,a,s=v(this,e).event(t),l=t.changedTouches,u=l.length;for(Tw(t),n=0;n<u;++n)i=Qe(r=l[n],this),s.touch0&&s.touch0[2]===r.identifier?s.touch0[0]=i:s.touch1&&s.touch1[2]===r.identifier&&(s.touch1[0]=i);if(r=s.that.__zoom,s.touch1){var h=s.touch0[0],f=s.touch0[1],d=s.touch1[0],p=s.touch1[1],g=(g=d[0]-h[0])*g+(g=d[1]-h[1])*g,m=(m=p[0]-f[0])*m+(m=p[1]-f[1])*m;r=_(r,Math.sqrt(g/m)),i=[(h[0]+d[0])/2,(h[1]+d[1])/2],a=[(f[0]+p[0])/2,(f[1]+p[1])/2]}else{if(!s.touch0)return;i=s.touch0[0],a=s.touch0[1]}s.zoom("touch",o(y(r,i,a),s.extent,c))}}function S(t,...r){if(this.__zooming){var i,o,a=v(this,r).event(t),s=t.changedTouches,l=s.length;for(Aw(t),n&&clearTimeout(n),n=setTimeout(function(){n=null},500),i=0;i<l;++i)o=s[i],a.touch0&&a.touch0[2]===o.identifier?delete a.touch0:a.touch1&&a.touch1[2]===o.identifier&&delete a.touch1;if(a.touch1&&!a.touch0&&(a.touch0=a.touch1,delete a.touch1),a.touch0)a.touch0[1]=this.__zoom.invert(a.touch0[0]);else if(a.end(),2===a.taps&&(o=Qe(o,this),Math.hypot(e[0]-o[0],e[1]-o[1])<p)){var c=$e(this).on("dblclick.zoom");c&&c.apply(this,arguments)}}}return g.transform=function(t,e,n,r){var i=t.selection?t.selection():t;i.property("__zoom",kw),t!==i?b(t,e,n,r):i.interrupt().each(function(){v(this,arguments).event(r).start().zoom(null,"function"==typeof e?e.apply(this,arguments):e).end()})},g.scaleBy=function(t,e,n,r){g.scaleTo(t,function(){return this.__zoom.k*("function"==typeof e?e.apply(this,arguments):e)},n,r)},g.scaleTo=function(t,e,n,r){g.transform(t,function(){var t=i.apply(this,arguments),r=this.__zoom,a=null==n?m(t):"function"==typeof n?n.apply(this,arguments):n,s=r.invert(a),l="function"==typeof e?e.apply(this,arguments):e;return o(y(_(r,l),a,s),t,c)},n,r)},g.translateBy=function(t,e,n,r){g.transform(t,function(){return o(this.__zoom.translate("function"==typeof e?e.apply(this,arguments):e,"function"==typeof n?n.apply(this,arguments):n),i.apply(this,arguments),c)},null,r)},g.translateTo=function(t,e,n,r,a){g.transform(t,function(){var t=i.apply(this,arguments),a=this.__zoom,s=null==r?m(t):"function"==typeof r?r.apply(this,arguments):r;return o(ww.translate(s[0],s[1]).scale(a.k).translate("function"==typeof e?-e.apply(this,arguments):-e,"function"==typeof n?-n.apply(this,arguments):-n),t,c)},r,a)},x.prototype={event:function(t){return t&&(this.sourceEvent=t),this},start:function(){return 1===++this.active&&(this.that.__zooming=this,this.emit("start")),this},zoom:function(t,e){return this.mouse&&"mouse"!==t&&(this.mouse[1]=e.invert(this.mouse[0])),this.touch0&&"touch"!==t&&(this.touch0[1]=e.invert(this.touch0[0])),this.touch1&&"touch"!==t&&(this.touch1[1]=e.invert(this.touch1[0])),this.that.__zoom=e,this.emit("zoom"),this},end:function(){return 0===--this.active&&(delete this.that.__zooming,this.emit("end")),this},emit:function(t){var e=$e(this.that).datum();f.call(t,this.that,new vw(t,{sourceEvent:this.sourceEvent,target:g,transform:this.that.__zoom,dispatch:f}),e)}},g.wheelDelta=function(t){return arguments.length?(a="function"==typeof t?t:bw(+t),g):a},g.filter=function(t){return arguments.length?(r="function"==typeof t?t:bw(!!t),g):r},g.touchable=function(t){return arguments.length?(s="function"==typeof t?t:bw(!!t),g):s},g.extent=function(t){return arguments.length?(i="function"==typeof t?t:bw([[+t[0][0],+t[0][1]],[+t[1][0],+t[1][1]]]),g):i},g.scaleExtent=function(t){return arguments.length?(l[0]=+t[0],l[1]=+t[1],g):[l[0],l[1]]},g.translateExtent=function(t){return arguments.length?(c[0][0]=+t[0][0],c[1][0]=+t[1][0],c[0][1]=+t[0][1],c[1][1]=+t[1][1],g):[[c[0][0],c[0][1]],[c[1][0],c[1][1]]]},g.constrain=function(t){return arguments.length?(o=t,g):o},g.duration=function(t){return arguments.length?(u=+t,g):u},g.interpolate=function(t){return arguments.length?(h=t,g):h},g.on=function(){var t=f.on.apply(f,arguments);return t===f?g:t},g.clickDistance=function(t){return arguments.length?(d=(t=+t)*t,g):Math.sqrt(d)},g.tapDistance=function(t){return arguments.length?(p=+t,g):p},g},zoomIdentity:ww,zoomTransform:Ew});class Iw{constructor(t,e,n){this._id="predicate_"+xT(),this._type=t||Lw.POINT,this._variableType=e,this._variableName=n,this._value=void 0}get type(){return this._type}get value(){return this._value}set value(t){this._value=t}get id(){return this._id}get variableType(){return this._variableType}get variableName(){return this._variableName}}const Lw=Object.freeze({POINT:"point",INTERVAL:"interval",LIST:"list"});class Pw extends Iw{constructor(t,e,n){super(t,e,n)}testElement(t){let e;if("attribute"==this._variableType){if(!t.dataScope)return!1;e=t.dataScope.getAttrVal(this._variableName)}else e=t[this._variableName];return this._value[0]<=e&&this._value[1]>=e}testTuple(t){if("attribute"==this._variableType){let e=t[this._variableName];return this._value[0]<=e&&this._value[1]>=e}return!1}}class Vw extends Iw{constructor(t,e,n){super(t,e,n)}addValue(t){this._value||(this._value=[]),this._value.push(t)}resetValue(){this._value=void 0}testElement(t){if("attribute"==this._variableType){if(!t.dataScope)return!1;let e=t.dataScope.getAttributeValues(this._variableName);return 1===e.length&&this._value.indexOf(e[0])>=0}return this._value.indexOf(t[this._variableName])>=0}testTuple(t){if("attribute"==this._variableType){let e=t[this._variableName];return this._value.indexOf(e)>=0}return!1}}class Dw extends Iw{constructor(t,e,n){super(t,e,n)}testElement(t){if("attribute"==this._variableType){if(!t.dataScope)return!1;return t.dataScope.getAttrVal(this._variableName)==this._value}return t[this._variableName]==this._value}testTuple(t){if("attribute"==this._variableType){let e=t[this._variableName];return this._value===e}return!1}equals(t){return this.type===t.type&&this.variableName===t.variableName&&this.value===t.value}}function Bw(t){let e,n="attribute"in t?"attribute":"property",r=t[n];switch(t.type){case Lw.LIST:e=new Vw(t.type,n,r);break;case Lw.INTERVAL:e=new Pw(t.type,n,r);break;case Lw.POINT:default:e=new Dw(t.type,n,r)}return e.value=t.value,e}function zw(t,e){for(let n of e)if(!n.testElement(t))return!1;return!0}const Fw={svg:void 0,getSVG:function(){return window?(void 0===this.svg&&(this.svg=document.createElementNS("http://www.w3.org/2000/svg","svg"),this.svg.style.visibility="hidden",this.svg.style.pointerEvents="none",this.svg.setAttribute("aria-hidden","true"),document.body.appendChild(this.svg)),this.svg):null}};function Gw(t,e,n,r,i){const o=i*Math.PI/180,a=t-n,s=e-r;return{x:a*Math.cos(o)-s*Math.sin(o)+n,y:a*Math.sin(o)+s*Math.cos(o)+r}}function jw(t,e,n,r){return Math.sqrt(Math.pow(t-n,2)+Math.pow(e-r,2))}const Uw=Object.freeze({fillColor:"fill",strokeColor:"stroke",strokeWidth:"stroke-width",fillOpacity:"fill-opacity",strokeOpacity:"stroke-opacity",strokeDash:"stroke-dasharray",opacity:"opacity",fontSize:"font-size",fontFamily:"font-family",fontWeight:"font-weight",visibility:"visibility",cursor:"cursor"});class Yw{constructor(t,e,n,r){this._x=t+n/2,this._y=e+r/2,this._width=n,this._height=r}translate(t,e){this._x+=t,this._y+=e}toJSON(){let t={};return t.x=this._x,t.y=this._y,t.width=this._width,t.height=this._height,t}union(t){let e=Math.min(this.left,t.left),n=Math.min(this.top,t.top),r=Math.max(this.right,t.right),i=Math.max(this.bottom,t.bottom);return new Yw(e,n,r-e,i-n)}clone(){return new Yw(this.left,this.top,this._width,this._height)}get left(){return this._x-this._width/2}set left(t){this._x=t+this._width/2}get right(){return this._x+this._width/2}set right(t){this._x=t-this._width/2}get top(){return this._y-this._height/2}set top(t){this._y=t+this._height/2}get bottom(){return this._y+this._height/2}set bottom(t){this._y=t-this._height/2}get x(){return this._x}get y(){return this._y}get center(){return this.x}get middle(){return this.y}get width(){return this._width}setWidth(t,e){switch(e){case Xw.RIGHT:this._x=this.right-t/2;break;case Xw.CENTER:this._width=2*t;break;default:this._x=this.left+t/2}this._width=t}get height(){return this._height}setHeight(t,e){switch(e){case Xw.TOP:this._y=this.top+t/2;break;case Xw.MIDDLE:this._height=2*t;break;default:this._y=this.bottom-t/2}this._height=t}contains(t,e){return this.left<=t&&this.right>=t&&this.top<=e&&this.bottom>=e}intersects(t){return!(this.right<t.left||this.bottom<t.top||this.left>t.right||this.top>t.bottom)}}function Hw(t){let e=t[0].clone();for(let n=1;n<t.length;n++)e=e.union(t[n]);return e}function qw(t){return Hw(("vertex"==t[0].type||"segment"==t[0].type?t.map(t=>t.parent):t).map(t=>t.refBounds?t.refBounds:t.bounds))}function Ww(t){return Hw(("vertex"==t[0].type||"segment"==t[0].type?t.map(t=>t.parent):t).map(t=>t.bounds))}function $w(t){let e=Qw(t);for(let t of e)t._updateBounds();let n=[];for(let t of e)t.parent&&!n.includes(t.parent)&&n.push(t.parent);for(let t of n)$w(t)}const Xw=Object.freeze({TOP:"top",LEFT:"left",RIGHT:"right",BOTTOM:"bottom",CENTER:"center",MIDDLE:"middle"});class Kw{constructor(t){if(this._dataScope=void 0,this._type="type"in t?t.type:bT.Mark,this._id=t.id?t.id:this._type+"_"+xT(),this._classId=void 0,this._bounds=void 0,this._rotate=void 0,this._refBounds=void 0,this._dirty=!0,this._clipMask=void 0,this._cursor=void 0,this._styles={},void 0!==t)for(let e in Uw)e in t&&(this.styles[e]=t[e])}get scene(){return aE(this)}set strokeColor(t){this.styles.strokeColor=t,this._dirty=!0}get strokeColor(){return this.styles.strokeColor}set strokeWidth(t){this.styles.strokeWidth=t,this._dirty=!0}get strokeWidth(){return this.styles.strokeWidth}set strokeDash(t){this.styles.strokeDash=t,this._dirty=!0}get strokeDash(){return this.styles.strokeDash}set fillColor(t){this.styles.fillColor=t,this._dirty=!0}get fillColor(){return this.styles.fillColor}get rotation(){return this._rotate}get cursor(){return this._cursor}get id(){return this._id}set id(t){this.getScene()?(delete this.getScene()._itemMap[this._id],this._id=t,this.getScene()._itemMap[t]=this):this._id=t}get classId(){return this._classId?this._classId:this._id}set classId(t){this._classId=t}get type(){return this._type}get bounds(){return this._bounds||this._updateBounds(),this._bounds}get refBounds(){return this._refBounds?this._refBounds:this.bounds}set dataScope(t){this._dataScope=t}get dataScope(){return this._dataScope}get styles(){return this._styles}set styles(t){this._styles=t,this._dirty=!0}set visibility(t){this.styles.visibility=t,this._dirty=!0}get visibility(){return this.styles.visibility?this.styles.visibility:"visible"}get opacity(){return"opacity"in this.styles?this.styles.opacity:1}set opacity(t){this.styles.opacity=t,this._dirty=!0}copyPropertiesTo(t){t.styles=Object.assign({},this.styles),this._dataScope&&(t._dataScope=this._dataScope.clone())}createClipMask(){let t=this._bounds;this._clipMask=new Yw(t.left,t.top,t.width,t.height)}get clipMask(){return this._clipMask}}function Zw(t){return t instanceof Kw&&t.type!==bT.Gridlines}const Jw=Object.freeze({Area:"area",Rect:"rect",Ellipse:"ellipse",Circle:"circle",Pie:"pie",Ring:"ring",Arc:"arc",Line:"line",Path:"path",Image:"image",SimpleText:"text",RichText:"richText",Polygon:"polygon",BezierCurve:"bezierCurve"});function Qw(t,e){let n=aE(t);if("vertex"===t.type||"segment"===t.type)return function(t,e){let n=aE(t),r=e||n;if("vertex"===t.type){return tE(t,nE(r,[{property:"classId",value:t.parent.classId}],!0))}if("segment"===t.type){return eE(t,nE(r,[{property:"classId",value:t.parent.classId}],!0))}return t.classId?nE(r,[{property:"classId",value:t.classId}]):[t]}(t,e);if(!t.classId)return[t];if(t.classId&&n._peerIndex.has(t.classId)){let r=n._peerIndex.get(t.classId);return e?r.filter(t=>function(t,e){let n=t.parent;for(;n;){if(n===e)return!0;n=n.parent}return!1}(t,e)):r}return[t]}function tE(t,e){if(!t.classId){if(t.dataScope){let n=t.parent;if(!n)throw new Error("vertex has no parent mark");let r=[];if(n.type===bT.Area){let i=n.vertices.indexOf(t)<n.vertices.length/2;for(let t of e){let e=i?t.vertices.slice(0,t.vertices.length/2):t.vertices.slice(t.vertices.length/2);r=r.concat(e.filter(t=>t.dataScope))}}else for(let t of e)r=r.concat(t.vertices.filter(t=>t.dataScope));return r}{let n=t.parent;if(!n)throw new Error("vertex has no parent mark");let r=n.vertices.indexOf(t),i=[];for(let t of e)i.push(t.vertices[r]);return i}}}function eE(t,e){if(t.dataScope){if(!t.parent)throw new Error("segment has no parent mark");let n=[];for(let t of e)n=n.concat(t.segments);return n}{let n=t.parent;if(!n)throw new Error("segment has no parent mark");let r=n.segments.indexOf(t),i=[];for(let t of e)i.push(t.segments[r]);return i}}function nE(t,e,n){let r=[];return oE(t,e?e.map(t=>Bw(t)):[],r,n),r}function rE(t,e){let n=t.children.filter(t=>t.type==bT.Collection);if(0!==n.length)for(let t of n){let n=t;for(;n&&n.dataScope;){if(n.dataScope.hasAttribute(e))return n;n=n.children?n.children[0]:void 0}}}function iE(t){return t.type==bT.Collection?t:t.parent?iE(t.parent):void 0}function oE(t,e,n,r){if(t)if(zw(t,e)&&n.push(t),t.vertices&&r)for(let r of t.vertices.concat(t.segments))zw(r,e)&&n.push(r);else if(t.children&&t.children.length>0)for(let i of t.children)oE(i,e,n,r)}function aE(t){let e=t;for(;e;){if(e.type==bT.Scene)return e;e=e.parent}}function sE(t){let e=t;for("vertex"!=e.type&&"segment"!=e.type||(e=e.parent);e.parent&&[bT.Collection,bT.Glyph].includes(e.parent.type);)e=e.parent;return e}function lE(t,e){let n=[];if(cE(t,n),e){let t={};for(let e of n)t[e.classId]=e;return Object.values(t)}return n}function cE(t,e){if(Zw(t))e.push(t);else if(t.children&&!Object.values(vT).includes(t.type))for(let n of t.children)cE(n,e)}function uE(t,e){if(t){if(e(t),t.vertices)for(let n of t.vertices)e(n);if(t.segments)for(let n of t.segments)e(n);if(t.children&&t.children.length>0)for(let n of t.children)uE(n,e)}}class hE{constructor(){this._refElements=[]}addRefElement(t){this._refElements.push(t)}get refElements(){return this._refElements}clearRefElements(){this._refElements=[]}}const fE=Object.freeze({GRID:"grid",STACK:"stack",PACKING:"packing",FORCE:"force",DIRECTED:"directedgraph",TIDYTREE:"tidytree",TREEMAP:"treemap",STRATA:"strata",CIRCULAR:"circular",CLUSTER:"cluster"});function dE(t,e){return!!(t.startsWith("h")&&[Xw.LEFT,Xw.CENTER,Xw.RIGHT].indexOf(e)>=0)||(!!(t.startsWith("v")&&[Xw.TOP,Xw.MIDDLE,Xw.BOTTOM].indexOf(e)>=0)||(console.warn("Invalid alignment:",e),!1))}class pE{constructor(t){this._id=t+"_"+xT(),this._type=t,this._inputVars=[],this._outputVars=[]}run(){}get id(){return this._id}get type(){return this._type}get inputVars(){return this._inputVars}get outputVars(){return this._outputVars}get outputVar(){return this._outputVars[0]}isIsolated(){return 0==this._inputVars.length&&0==this._outputVars.length}}const gE=Object.freeze({CONDUIT:"conduit",ENCODER:"encoder",LAYOUT:"layout",LINK_PLACER:"linkRouter",CONSTRAINT:"constraint",EVAL_BBOX:"evalBBox",EVAL_REFBOUNDS:"evalRefBounds",AFFIXER:"affixer",ALIGNER:"aligner",DATA_EXTRACTOR:"dataExtractor",SCALE_BUILDER:"scaleBuilder",AXIS_PATH_PLACER:"axisPathPlacer",AXIS_TICKS_PLACER:"axisTicksPlacer",AXIS_LABELS_PLACER:"axisLabelsPlacer",AXIS_TITLE_PLACER:"axisTitlePlacer",GRIDLINES_PLACER:"gridlinesPlacer",GRID_LAYOUT:"gridLayout",STACK_LAYOUT:"stackLayout",PACK_LAYOUT:"packLayout",FORCE_LAYOUT:"forceLayout",DIRECTED_LAYOUT:"directedLayout",TIDY_TREE_LAYOUT:"tidyTreeLayout",TREEMAP_LAYOUT:"treemapLayout",STRATA_LAYOUT:"strataLayout",CIRCULAR_LAYOUT:"circularLayout",CLUSTER_LAYOUT:"clusterLayout",BIN_TRANSFORMER:"binTransformer",FILTER_TRANSFORMER:"filterTransformer",KDE_TRANSFORMER:"kdeTransformer",TARGET_EVALUATOR:"targetEvaluator",TARGET_UPDATER:"targetUpdater"});class _E{constructor(t){let e=t||{};this._stops=[],this.type=bT.LinearGradient,this.id=this.type+xT(),this.x1="x1"in e?e.x1:0,this.x2="x2"in e?e.x2:100,this.y1="y1"in e?e.y1:0,this.y2="y2"in e?e.y2:0}toJSON(){let t={};return t.type=this.type,t.id=this.id,t.x1=this.x1,t.x2=this.x2,t.y1=this.y1,t.y2=this.y2,t.stops=this._stops,t}addStop(t,e,n){this._stops.push({offset:t,color:e,opacity:n})}get stops(){return this._stops}}const yE=Object.freeze({RowFirst:"rowFirst",ColumnFirst:"columnFirst"}),mE=Object.freeze({TopLeft:"topLeft",TopRight:"topRight",BottomLeft:"bottomLeft",BottomRight:"bottomRight"}),bE="horizontal",vE="vertical",xE="angular",wE="radial",EE={Left2Right:"l2r",Right2Left:"r2l",Top2Bottom:"t2b",Bottom2Top:"b2t"},AE=Object.freeze({CLOCKWISE:"clockwise",ANTI_CLOCKWISE:"anti-clockwise"}),TE=Object.freeze({INWARD:"inward",OUTWARD:"outward"});class CE{constructor(t,e,n,r){this.type="vertex",this._id=r,this._x=t,this._y=e,this._dataScope=void 0,this.parent=n,this.shape=void 0,this.width=0,this.height=0,this.radius=0,this.fillColor="#555",this.opacity=1,this.strokeWidth=0,this.strokeColor="#aaa",this._polarAngle=void 0}get dataScope(){return this._dataScope}set dataScope(t){this._dataScope=t}get bounds(){switch(this.shape){case"rect":return new Yw(this.x-this.width/2,this.y-this.height/2,this.width,this.height);case"circle":return new Yw(this.x-this.radius,this.y-this.radius,2*this.radius,2*this.radius);default:return new Yw(this.x-.5,this.y-.5,1,1)}}get id(){return this.parent.id+"_v_"+this._id}_clone(t){let e=new CE(this.x,this.y,t,this._id);return this._dataScope&&(e._dataScope=this._dataScope.clone()),e.shape=this.shape,e.width=this.width,e.height=this.height,e.radius=this.radius,e.fillColor=this.fillColor,e.opacity=this.opacity,e.strokeWidth=this.strokeWidth,e.strokeColor=this.strokeColor,e}get polarAngle(){return this._polarAngle}get scene(){return this.parent.scene}get x(){return this._x}get y(){return this._y}}CE.styles=["vxShape","vxWidth","vxHeight","vxRadius","vxFillColor","vxStrokeColor","vxStrokeWidth","vxOpacity"];class SE{constructor(t,e,n,r){this.type="segment",this._id=r,this.vertex1=t,this.vertex2=e,this.dataScope=void 0,this.parent=n}get id(){return this.parent.id+"_s_"+this._id}get x(){return(this.vertex1.x+this.vertex2.x)/2}get y(){return(this.vertex1.y+this.vertex2.y)/2}get scene(){return this.parent.scene}}class kE extends Kw{constructor(t){super(t),this._type="type"in t?t.type:bT.Path,this.vertices=[],this.vertexCounter=0,this._sortBy={},this.segmentCounter=0,this.segments=[],this.anchor=void 0,this.closed=!1,this.curveMode="linear",this._vxShape=void 0,this._vxWidth=0,this._vxHeight=0,this._vxRadius=0,this._vxFillColor="#555555",this._vxStrokeColor="#aaaaaa",this._vxStrokeWidth=0,this._vxOpacity=1;for(let e of CE.styles)e in t&&(this["_"+e]=t[e]);"vertices"in t&&this._setVertices(t.vertices),this._sourceAnchor="sourceAnchor"in t?t.sourceAnchor:["center","middle"],this._targetAnchor="targetAnchor"in t?t.targetAnchor:["center","middle"],this._sourceOffset="sourceOffset"in t?t.sourceOffset:[0,0],this._targetOffset="targetOffset"in t?t.targetOffset:[0,0],this._strength="strength"in t?t.strength:.85,"strokeColor"in this.styles||(this.styles.strokeColor="#ccc"),"fillColor"in this.styles||(this.styles.fillColor="none"),"strokeWidth"in this.styles||(this.styles.strokeWidth=1),"strokeDash"in this.styles||(this.styles.strokeDash="none")}_setVertices(t){let e;this.vertices=[],this.segments=[],this.vertexCounter=0,this.segmentCounter=0;for(let n=0;n<t.length;n++)if(n!=t.length-1||t[n][0]!==t[0][0]||t[n][1]!==t[0][1]||this.type!==bT.Path){e=new CE(t[n][0],t[n][1],this,this.vertexCounter++);for(let t of CE.styles)if(this[t]){let n=t.replace("vx","");e[n[0].toLowerCase()+n.slice(1)]=this[t]}this.vertices.push(e),n>0&&this.segments.push(new SE(this.vertices[n-1],this.vertices[n],this,this.segmentCounter++))}let n=t[0],r=t[t.length-1];(n[0]===r[0]&&n[1]===r[1]||this.type===bT.Rect)&&(this.closed=!0,"fillColor"in this.styles||(this.styles.fillColor="#fff"),this.segments.push(new SE(this.vertices[this.vertices.length-1],this.vertices[0],this,this.segmentCounter++))),this._dirty=!0}copyPropertiesTo(t){t.attrs=Object.assign({},this.attrs),t.styles=Object.assign({},this.styles);for(let e of CE.styles)this["_"+e]&&(t["_"+e]=this["_"+e]);this._dataScope&&(t._dataScope=this._dataScope.clone()),t.closed=this.closed,t.curveMode=this.curveMode,t.vertices=[],t.segments=[];for(let e of this.vertices)t.vertices.push(e._clone(t));t.segmentCounter=0;for(let e=1;e<t.vertices.length;e++)t.segments.push(new SE(t.vertices[e-1],t.vertices[e],t,t.segmentCounter++));t.closed&&t.segments.push(new SE(t.vertices[t.vertices.length-1],t.vertices[0],t,t.segmentCounter++)),t._sourceAnchor=this._sourceAnchor.slice(),t._targetAnchor=this._targetAnchor.slice(),t._sourceOffset=this._sourceOffset.slice(),t._targetOffset=this._targetOffset.slice(),t._beta=this._beta}get bounds(){return this._bounds||this._updateBounds(),this._bounds}get x(){return this.bounds.x}get y(){return this.bounds.y}get strokeColor(){return this.styles.strokeColor}get strokeWidth(){return this.styles.strokeWidth}get strokeDash(){return this.styles.strokeDash}set strokeDash(t){this.styles.strokeDash=t,this._dirty=!0}resize(t,e,n,r){let i=this.bounds,o=0===i.width?1:i.width,a=0===i.height?1:i.height;if("right"===n)for(let e of this.vertices)e._x=i.right-t/o*(i.right-e.x);else for(let e of this.vertices)e._x=i.left+t/o*(e.x-i.left);if("top"===r)for(let t of this.vertices)t._y=i.top+e/a*(t.y-i.top);else for(let t of this.vertices)t._y=i.bottom-e/a*(i.bottom-t.y);this._updateBounds(),this._dirty=!0}_updateBounds(){let t=[],e=[];if(this._d){const n=this._d.match(/[a-zA-Z][^a-zA-Z]*/g),r=" ";n.forEach(n=>{let i=n.slice(1).trim().split(r).map(Number);for(let[n,r]of i.entries())n%2==0?t.push(r):e.push(r)})}else t=this.vertices.map(t=>t.x),e=this.vertices.map(t=>t.y);let n=Math.min(...t),r=Math.min(...e),i=Math.max(...t),o=Math.max(...e),a=i-n,s=o-r;if(this._bounds=new Yw(n,r,a,s),this.type===bT.Line||this.type===bT.Path){let t=this.styles.strokeWidth?this.styles.strokeWidth:1;n===i?this._bounds=new Yw(n-t/2,r,i-n+t,o-r):r===o&&(this._bounds=new Yw(n,r-t/2,i-n,o-r+t))}}addVertex(t,e,n){let r=new CE(t,e,this,this.vertexCounter++);this.vertices.splice(n,0,r)}sortVertices(t,e){this.vertices.sort((e,n)=>e[t]-n[t]),e&&this.vertices.reverse();for(let t=0;t<this.segments.length;t++){let e=this.segments[t];e.vertex1=this.vertices[t],e.vertex2=this.vertices[(t+1)%this.vertices.length]}this._dirty=!0}sortVerticesByData(t,e,n){let r;r=n?(e,r)=>n.indexOf(e.dataScope.getValue(t))-n.indexOf(r.dataScope.getAttrVal(t)):(e,n)=>e.dataScope.getAttrVal(t)<n.dataScope.getAttrVal(t)?-1:1,this.vertices.sort(r),e&&this.vertices.reverse();for(let t=0;t<this.segments.length;t++){let e=this.segments[t];e.vertex1=this.vertices[t],e.vertex2=this.vertices[(t+1)%this.vertices.length]}this._dirty=!0}getSVGPathData(){if(this._d)return this._d;let t=Ca(),e=this._getD3CurveFunction(this.curveMode)(t);e.lineStart();for(let t of this.vertices)e.point(t.x,t.y);return this.closed&&e.point(this.vertices[0].x,this.vertices[0].y),e.lineEnd(),t._}get firstVertex(){return this.vertices[0]}get firstSegment(){return this.segments[0]}get lastVertex(){return this.vertices[this.vertices.length-1]}get lastSegment(){return this.segments[this.segments.length-1]}_getD3CurveFunction(t){switch(t){case OE.Natural:return lw;case OE.Basis:return Ix;case OE.BumpX:return $v;case OE.BumpY:return Xv;case OE.Linear:return Nv;case OE.Step:return uw;case OE.CatmullRom:return Wx;case OE.Cardinal:return Fx;case OE.Bundle:return Dx.beta(.5);default:return Nv}}get vxShape(){return this._vxShape}get vxWidth(){return this._vxWidth}get vxHeight(){return this._vxHeight}get vxRadius(){return this._vxRadius}get vxFillColor(){return this._vxFillColor}get vxStrokeColor(){return this._vxStrokeColor}get vxStrokeWidth(){return this._vxStrokeWidth}get vxOpacity(){return this._vxOpacity}get sourceAnchor(){return this._sourceAnchor}get targetAnchor(){return this._targetAnchor}get sourceOffset(){return this._sourceOffset}get targetOffset(){return this._targetOffset}}function ME(t,e){const n=Fw.getSVG();let r=document.createElementNS("http://www.w3.org/2000/svg","path");r.setAttribute("d",t.getSVGPathData()),n.appendChild(r);let i=r.getTotalLength();return r.getPointAtLength(i*e)}function RE(t){return t instanceof kE&&t.source&&t.target}const OE={Natural:"natural",Basis:"basis",BumpX:"bumpX",BumpY:"bumpY",Bundle:"bundle",Linear:"linear",Step:"step",CatmullRom:"CatmullRom",Cardinal:"cardinal"};function NE(t,e,n){const r=t.match(/[a-zA-Z][^a-zA-Z]*/g),i=",",o=r.map(t=>{const r=t[0],o=t.slice(1).trim();if("M"===r||"L"===r||"T"===r){const[t,a]=o.split(i).map(Number);return`${r}${t+e} ${a+n}`}if("C"===r){const t=o.split(i).map(Number);return`${r}${t[0]+e} ${t[1]+n} ${t[2]+e} ${t[3]+n} ${t[4]+e} ${t[5]+n}`}if("Q"===r){const t=o.split(i).map(Number);return`${r}${t[0]+e} ${t[1]+n} ${t[2]+e} ${t[3]+n}`}if("A"===r){const t=o.split(i).map(Number);return`${r}${t[0]} ${t[1]} ${t[2]} ${t[3]} ${t[4]} ${t[5]+e} ${t[6]+n}`}return"Z"===r||"z"===r?r:t});return o.join(" ")}class IE extends kE{constructor(t){super(t),this._type=bT.Arc,this.closed=!0,this._x="x"in t?t.x:100,this._y="y"in t?t.y:100,this._innerRadius="innerRadius"in t?t.innerRadius:100,this._outerRadius="outerRadius"in t?t.outerRadius:200,this._thickness="thickness"in t?t.thickness:this._outerRadius-this._innerRadius,this._startAngle="startAngle"in t?t.startAngle:0,this._endAngle="endAngle"in t?t.endAngle:90,this._sr=LE(this._startAngle),this._er=LE(this._endAngle),this._direction="direction"in t?t.direction:AE.ANTI_CLOCKWISE;let e=this._x+this._innerRadius*Math.cos(this._sr),n=this._y-this._innerRadius*Math.sin(this._sr),r=this._x+this._innerRadius*Math.cos(this._er),i=this._y-this._innerRadius*Math.sin(this._er),o=this._x+this._outerRadius*Math.cos(this._sr),a=this._y-this._outerRadius*Math.sin(this._sr),s=this._x+this._outerRadius*Math.cos(this._er),l=this._y-this._outerRadius*Math.sin(this._er);this._setVertices([[e,n],[o,a],[s,l],[r,i]])}get type(){return 0===this._innerRadius?bT.Pie:bT.Arc}get innerRadius(){return this._innerRadius}get outerRadius(){return this._outerRadius}get thickness(){return this._outerRadius-this._innerRadius}get direction(){return this._direction}get x(){return this._x}get y(){return this._y}get startAngle(){return this._startAngle}get endAngle(){return this._endAngle}get angle(){return this._endAngle<this._startAngle?this._endAngle+360-this._startAngle:this._endAngle-this._startAngle}setAngles(t,e){this._startAngle=t,this._endAngle=e,this._sr=LE(this._startAngle),this._er=LE(this._endAngle),this.vertices[0]._x=this._x+this._innerRadius*Math.cos(this._sr),this.vertices[0]._y=this._y-this._innerRadius*Math.sin(this._sr),this.vertices[1]._x=this._x+this._outerRadius*Math.cos(this._sr),this.vertices[1]._y=this._y-this._outerRadius*Math.sin(this._sr),this.vertices[2]._x=this._x+this._outerRadius*Math.cos(this._er),this.vertices[2]._y=this._y-this._outerRadius*Math.sin(this._er),this.vertices[3]._x=this._x+this._innerRadius*Math.cos(this._er),this.vertices[3]._y=this._y-this._innerRadius*Math.sin(this._er),this._dirty=!0}_updateBounds(){let t=this.vertices.map(t=>t.x),e=this.vertices.map(t=>t.y),n=Math.min(...t),r=Math.min(...e),i=Math.max(...t)-n,o=Math.max(...e)-r;this._bounds=new Yw(n,r,i,o)}copyPropertiesTo(t){super.copyPropertiesTo(t),t._x=this._x,t._y=this._y,t._innerRadius=this._innerRadius,t._outerRadius=this._outerRadius,t._startAngle=this._startAngle,t._endAngle=this._endAngle,t._thickness=this._thickness,t._direction=this._direction,t._sr=this._sr,t._er=this._er}getSVGPathData(){let t=this._endAngle<this._startAngle?this._endAngle+360-this._startAngle:this._endAngle-this._startAngle,e=t>180?1:0;return["M "+this.vertices[0].x+", "+this.vertices[0].y,"L "+this.vertices[1].x+", "+this.vertices[1].y,"A "+[this._outerRadius,this._outerRadius,t,e,0,this.vertices[2].x,this.vertices[2].y].join(" "),"L "+this.vertices[3].x+", "+this.vertices[3].y,"A "+[this._innerRadius,this._innerRadius,t,e,1,this.vertices[0].x,this.vertices[0].y].join(" ")].join(" ")}}function LE(t){return t*Math.PI/180}function PE(t){return 180*t/Math.PI}function VE(t){return(t%360+360)%360}function DE(t,e,n,r){let i=t-n,o=r-e;return Math.atan2(o,i)*(180/Math.PI)}class BE{constructor(t){this._attr2value={},this._dt=t,this._tuples=this._dt.data}isFullTable(){return 0===Object.keys(this._attr2value).length}isEmpty(){return 0==this._tuples.length}get numTuples(){return this._tuples.length}get attributes(){return Object.keys(this._attr2value)}get dataTable(){return this._dt}get filters(){return this._attr2value}merge(t){let e=new BE(this._dt);for(let t in this._attr2value)e=e.cross(t,this._attr2value[t]);for(let n in t._attr2value)e=e.cross(n,t._attr2value[n]);return e}cross(t,e){if(t in this._attr2value&&this._attr2value[t]!==e)return console.warn("Conflict in attribute values when merging dataScope:",t,this._attr2value[t],e),this;let n=this.clone();return n._attr2value[t]=e,n._updateTuples(t,e),n}derive(t){let e=Object.assign({},this._attr2value);for(let n in t)e[n]=t[n];let n=new BE(this._dt);for(let t in e)n._attr2value[t]=e[t],n._updateTuples(t,e[t]);return n}clone(){let t=new BE(this._dt);return t._attr2value=Object.assign({},this._attr2value),t._tuples=this._tuples.map(t=>t),t}getAttrVal(t){let e=this.getAttributeValues(t);return e.length,e[0]}getAttributeValues(t){let e=this._tuples.map(e=>e[t]);return e=[...new Set(e)],e}getUniqueAttributeValues(t){let e=this._tuples.map(e=>e[t]);return[...new Set(e)]}hasAttribute(t){return t in this._attr2value}getAttributeType(t){return this._dt.getAttributeType(t)}aggregateNumericalAttribute(t,e){let n=this._tuples.map(e=>e[t]);switch(e){case FE.Max:return Math.max(...n);case FE.Min:return Math.min(...n);case FE.Avg:case FE.Mean:return ct(n);case FE.Median:return ut(n);case FE.Count:return n.length;case FE.Percentile25:return at(n,.25);case FE.Percentile75:return at(n,.75);case FE.Sum:default:return yt(n)}}_updateTuples(t,e){this._tuples=this._tuples.filter(n=>n[t]==e)}get tuples(){return this._tuples}}function zE(t){return"vertex"==t.type||"segment"==t.type?t.dataScope?t.dataScope:t.parent.dataScope:t.dataScope}const FE={Max:"max",Min:"min",Avg:"avg",Median:"median",Sum:"sum",Count:"count",Mean:"mean",Percentile25:"percentile 25",Percentile75:"percentile 75"};class GE{constructor(t,e){this._id=bT.TreeData+xT(),this.initialize(t,e)}initialize(t,e){this.url=e,this._data=t,this._nodeList=[],this._linkList=[],this._nodeHash={},this._traverse(t,this._nodeList,this._linkList),this._nodeTable=new wT(this._nodeList,"nodes"),this._linkTable=new wT(this._linkList,"links"),this._nodeTable.tree=this,this._linkTable.tree=this}get nodeTable(){return this._nodeTable}get linkTable(){return this._linkTable}_traverse(t,e,n,r=0){let i={};qE in t||(t[qE]="n"+e.length),e.push(i),t._depth=r;for(let o in t)if("children"==o&&t[o]&&t[o].length>0)for(let i of t[o]){let o=this._traverse(i,e,n,r+1);n.push({parent:t[qE],child:o})}else i[o]=t[o];return this._nodeHash[i[qE]]=i,i[qE]}getNodeDataScope(t){return new BE(this._nodeTable).cross(AT,t[AT])}getNode(t){return this._nodeHash[t]}getRoot(){return this._nodeTable.data[0]}getChildren(t){let e=t[qE],n=[],r=this._linkTable.data,i=this._nodeTable.data;for(let t in r)if(r[t].parent==e){let e=r[t].child,o=i.findIndex(t=>t[qE]==e);n.push(i[o])}return n}getParent(t){let e=t[qE],n=this._linkTable.data,r=this._nodeTable.data;for(let t in n)if(n[t].child==e){let e=n[t].parent,i=r.findIndex(t=>t[qE]==e);return r[i]}}}function jE(t){return t.dataScope._dt.tree}class UE{constructor(t,e){this._id=bT.NetworkData+xT(),this.initialize(t,e)}initialize(t,e){this.url=e,this._nodeTable=new wT(t.nodes,this._id+"_nodes"),this._linkTable=new wT(t.links,this._id+"_links"),this._nodeTable.graph=this,this._linkTable.graph=this,this._rawNodes=t.nodes,this._rawLinks=t.links,this._nodeHash={};for(let e of t.nodes)this._nodeHash[e[qE]]=e}get nodeTable(){return this._nodeTable}get linkTable(){return this._linkTable}get nodeList(){return this._rawNodes}get linkList(){return this._rawLinks}getNode(t){return this._nodeHash[t]}getLinks(t){let e=t[qE],n=this._rawLinks,r=[];for(let t in n)n[t].target!==e&&n[t].source!==e||r.push(n[t]);return r}buildNodeHierarchy(t){let e={};return e[qE]="root",HE(e,this._rawNodes,t),new GE(e,this.url)}}function YE(t){return t.dataScope._dt.graph}function HE(t,e,n){if(0===e.length||0===n.length)return;"children"in t||(t.children=[]);let r={};for(let t of e){let e=t[n[0]];e in r||(r[e]=[]),r[e].push(t)}if(1===n.length)for(let e in r){let n={children:r[e]};n[qE]=e,t.children.push(n)}else for(let e in r){let i={};i[qE]=e,t.children.push(i),HE(i,r[e],n.slice(1))}}const qE="id";function WE(t,e){if(e.hasAttribute(t))return!0;if(e.tree&&e.tree.nodeTable.hasAttribute(t.split(".")[1]))return!0;throw new Error(["Attribute",t,"does not exist in the table",e.name].join(" "))}const $E=Object.freeze({Boolean:"boolean",Integer:"integer",Number:"number",Date:"date",String:"string"});function XE(t){var e=Object.values($E);for(let n=0;n<t.length;n++){let r=t[n];if(null!=r){for(let t=0;t<e.length;t++)KE[e[t]](r)||(e.splice(t,1),t-=1);if(1==e.length)return e[0]}}return e[0]}const KE={boolean:function(t){return"true"===t||"false"===t||!0===t||!1===t||"[object Boolean]"==toString.call(t)},integer:function(t){return KE.number(t)&&(t=+t)===~~t},number:function(t){return!isNaN(+t)&&"[object Date]"!=toString.call(t)},date:function(t){let e=new Date(t);return null!=e&&!isNaN(e)},string:function(t){return!0}};function ZE(t,e){let n={};switch(e){case $E.Boolean:n.trueCount=t.filter(t=>t).length,n.falseCount=t.filter(t=>!t).length;break;case $E.Date:n.min=et(t),n.max=Q(t),n.extent=[n.min,n.max],n.unique=[...new Set(t)];break;case $E.String:n.unique=[...new Set(t)];break;default:n.min=et(t),n.max=Q(t),n.extent=[n.min,n.max],n.mean=ct(t),n.median=ut(t),n.unique=[...new Set(t)]}return n}function JE(t,e,n,r,i){let o=i.getAttributeType(n);if(o!=$E.String&&o!=$E.Date&&o!=$E.Number&&o!=$E.Integer)throw new Error("Densify only works on a string or date attribute: "+n+" is "+o);if(!tA(e))throw new Error("The "+e.type+" is not dividable");switch(e.type){case bT.Line:return function(t,e,n,r){let i,o,a=Qw(e);for(let s of a){let a=s.dataScope?s.dataScope:new BE(r),l=r.getUniqueAttributeValues(n).map(t=>a.cross(n,t));l=l.filter(t=>!t.isEmpty()),1===l.length&&l.push(l[0].clone());let c=Object.assign({},s.styles);for(let t of CE.styles)s[t]&&(c[t]=s[t]);let u=s.vertices[0].x,h=s.vertices[0].y,f=[],d=s.vertices[1].x-u,p=s.vertices[1].y-h;for(let t=0;t<l.length;t++)f.push([u+t*d/(l.length-1),h+t*p/(l.length-1)]);c.vertices=f,c.type="path";let g=pT(t,c);o||(o=g.id),g._classId=o,g.dataScope=a,g._updateBounds(),g._refBounds=g.bounds.clone();let _=s.parent;_.addChild(g),_.removeChild(s);for(let[t,e]of g.vertices.entries())e.dataScope?e.dataScope=e.dataScope.merge(l[t]):e.dataScope=l[t];s==e&&(i=g)}return i}(t,e,n,i);case bT.Circle:return function(t,e,n,r){let i,o,a=Qw(e),s=r.getAttributeType(n);for(let l of a){let a=l.dataScope?l.dataScope:new BE(r),c=r.getUniqueAttributeValues(n).map(t=>a.cross(n,t));c=s==$E.Number?c:c.filter(t=>!t.isEmpty());let u=c.length;if(u<3)throw new Error("INSUFFICIENT_DATA_SCOPES");let h=90,f=360/u,d=[],p=[],g=-1;for(let t=0;t<c.length;t++){let e=h+g*t*f;p[t]=e;let n=QE(l.x,l.y,l.radius,p[t]);d.push(n)}let _=Object.assign({},l.styles);_.vertices=d,_.type="polygon",_.x=l.x,_.y=l.y,_.radius=l.radius;let y=pT(t,_);o||(o=y.id),y._classId=o,y.dataScope=a;let m=l.parent;m.addChild(y),m.removeChild(l);for(let[t,e]of y.vertices.entries())e._polarAngle=p[t],t>=c.length?e.dataScope=a.merge(c[2*c.length-1-t]):e.dataScope=a.merge(c[t]);l===e&&(i=y)}return i}(t,e,n,i);case bT.Rect:return function(t,e,n,r,i){let o,a,s=Qw(e),l=n||bE;if(l!=bE&&l!=vE)throw new Error("Unknown orientation: "+l);for(let n of s){let s=i.getAttributeType(r),c=n.dataScope?n.dataScope:new BE(i),u=i.getUniqueAttributeValues(r).map(t=>c.cross(r,t));u=s==$E.Number?u:u.filter(t=>!t.isEmpty()),1===u.length&&u.push(u[0].clone()),s!=$E.Number&&s!=$E.Date||u.sort((t,e)=>t._attr2value[r]>e._attr2value[r]?1:-1);let h=Object.assign({},n.styles),f=n.vertices[0].x,d=n.vertices[0].y,p=n.vertices[n.vertices.length-2].x,g=n.vertices[n.vertices.length-2].y,_=[],y=p-f,m=g-d;for(let t=0;t<u.length;t++)_.push(l==vE?[p,d+t*m/(u.length-1)]:[f+t*y/(u.length-1),d]);for(let t=0;t<u.length;t++)_.push(l==vE?[f,d+(u.length-1-t)*m/(u.length-1)]:[f+(u.length-1-t)*y/(u.length-1),g]);h.vertices=_,h.type="area";let b=pT(t,h);a||(a=b.id),b._classId=a,b.dataScope=c,b.orientation=l,b.baseline=l===bE?Xw.BOTTOM:Xw.LEFT;let v=n.parent;v.addChild(b),v.removeChild(n);for(let[t,e]of b.vertices.entries())t>=u.length?e.dataScope=c.merge(u[2*u.length-1-t]):e.dataScope=c.merge(u[t]);n===e&&(o=b)}return o}(t,e,r,n,i)}}function QE(t,e,n,r){return[n*Math.cos(LE(r))+t,e-n*Math.sin(LE(r))]}function tA(t){if([bT.Line,bT.Circle,bT.Rect,bT.Area].indexOf(t.type)<0)return!1;if(t.dataScope){let e=Qw(t,t.scene);for(let t of e)if(t.dataScope.numTuples>1)return!0;return!1}return!0}class eA{constructor(t){this._id="v_"+xT(),this._type=t,this._incomings=[],this._outgoings=[],this._undirected=[]}get id(){return this._id}get incomingEdges(){return this._incomings}get outgoingEdges(){return this._outgoings}get undirectedEdges(){return this._undirected}get type(){return this._type}get incomingDataflow(){for(let t of this._incomings)if(t.fromNode&&t.fromNode instanceof pE)return t.fromNode;return null}isIsolated(){return 0==this._incomings.length&&0==this._outgoings.length}}const nA=Object.freeze({CHANNEL:"channel",PROPERTY:"property",ATTRIBUTE:"attribute",ITEMS:"items",DATASCOPE:"datascope",ATTR_VALUE:"dataValue",BOUNDS:"bounds",SCALE:"scale",CONDITION_RESULT:"conditionResult",AFFIXATION:"affixation",ALIGNMENT:"alignment",EVT_CTX:"evtContext"});class rA extends eA{constructor(t,e,n){super(t),this._channel=e,this._elem=n}get channel(){return this._channel}get element(){return this._elem}}const iA=Object.freeze({X:"x",Y:"y",WIDTH:"width",HEIGHT:"height",RADIUS:"radius",FILLCOLOR:"fillColor",STROKECOLOR:"strokeColor",FILLGRADIENT:"fillGradient",TEXT:"text",ANGLE:"angle",THICKNESS:"thickness",AREA:"area",FONTSIZE:"fontSize",RADIALDISTANCE:"radialDistance",STROKEWIDTH:"strokeWidth",OPACITY:"opacity",VISIBILITY:"visibility",STRENGTH:"strength",SRC:"src"});function oA(t,e){let n=t.scene._encodings[lA(t)],r=[];n&&(r=r.concat(Object.values(n)));{let e=t.scene;for(let n in e._encodings){let i=n.split("_");i.pop(),i.join("_")===t.classId&&(r=r.concat(Object.values(e._encodings[n])))}}return r}function aA(t,e,n){for(let r in n._encodings){let i=n._encodings[r];if(i[e]&&i[e].attribute==t)return i[e]}return null}function sA(t,e){let n=t.scene._encodings[lA(t)];return n&&n[e]?n[e]:null}function lA(t){if(Array.isArray(t))return t.map(t=>lA(t)).join("_");if(t.classId)return t.classId;if("vertex"==t.type&&t.dataScope){if(t.parent.type===bT.Area){let e=t.parent.vertices.indexOf(t)<t.parent.vertices.length/2;return t.parent.classId+"_v"+(e?0:t.parent.vertices.length-1)}return t.parent.classId+"_v"}return"vertex"==t.type?t.parent.classId+"_v"+t.parent.vertices.indexOf(t):"segment"==t.type&&t.dataScope?t.parent.classId+"_s":"segment"==t.type?t.parent.classId+"_s"+t.parent.segments.indexOf(t):null}function cA(t,e){if(0==t.children.length)return[];let n=aE(t),r=t.type===bT.Composite?t.children:[t.children[0]],i=Object.keys(n._encodings),o=[];for(let t of r){let e=t;for(;e;){if(e.classId&&o.indexOf(e.classId)<0&&o.push(e.classId),e.type===bT.Glyph){e.children.forEach(t=>o.push(t.classId));break}if(!e.children)break;e=e.children[0]}}let a=[];for(let t of i)for(let r of o)0===t.indexOf(r)&&n._encodings[t][e]&&a.push(n._encodings[t][e]);return a}function uA(t){let e=sA(t,"y"),n=sA(t,"height");return e||n&&n.scales[0].domain[0]<0}function hA(t){let e=sA(t,"x"),n=sA(t,"width");return e||n&&n.scales[0].domain[0]<0}function fA(t,e){let n=function(t){let e=t.parent,n=[];for(;e.type!==bT.Scene;)n.push(e),e=e.parent;return n}(t);for(let t of n)if(sA(t,e))return!1;return n.length>=2?n[n.length-2]:t}function dA(t,e,n){switch(t.type){case bT.Rect:case bT.Path:case bT.Line:case bT.Area:!function(t,e,n){for(let r of t.vertices)pA(r,e,n);t._updateBounds(),t._refBounds&&t._refBounds.translate(e,n)}(t,e,n),0===e&&0===n||(t._dirty=!0);break;case bT.Group:case bT.Collection:case bT.Glyph:!function(t,e,n){for(let r of t.children)dA(r,e,n);t._layout&&(void 0!==t._layout._left&&(t._layout._left+=e),void 0!==t._layout._top&&(t._layout._top+=n),t._layout._cellBounds&&t._layout._cellBounds.forEach(t=>t.translate(e,n)));t._updateBounds(),t._refBounds&&t._refBounds.translate(e,n)}(t,e,n);break;case"segment":!function(t,e,n){pA(t.vertex1,e,n),pA(t.vertex2,e,n)}(t,e,n),0===e&&0===n||(t.parent._dirty=!0);break;case"vertex":pA(t,e,n),0===e&&0===n||(t.parent._dirty=!0);break;default:!function(t,e,n){t._x+=e,t._y+=n,t._updateBounds(),t._refBounds&&t._refBounds.translate(e,n)}(t,e,n),0===e&&0===n||(t._dirty=!0)}}function pA(t,e,n){t._x+=e,t._y+=n}function gA(t,e,n){switch(e){case"x":yA(t,n);break;case"y":mA(t,n);break;case"width":!function(t,e){t.resize(e,t.height)}(t,n);break;case"height":!function(t,e){t.resize(t.width,e)}(t,n);break;case"radius":t.radius=n;break;case"strength":t._strength=n;break;case"area":t.type===bT.Circle?t.radius=Math.sqrt(n/Math.PI):t.type===bT.Rect&&t.resize(Math.sqrt(n),Math.sqrt(n)),t._updateBounds();break;case"text":t._text=n;break;case"curveMode":t.curveMode=n;break;case"baseline":t.baseline=n;break;case"angle":[bT.Arc,bT.Pie].includes(t.type)&&function(t,e){t._endAngle=VE(t._startAngle+e),t._sr=LE(t._startAngle),t._er=LE(t._endAngle),t.vertices[0]._x=t._x+t._innerRadius*Math.cos(t._sr),t.vertices[0]._y=t._y-t._innerRadius*Math.sin(t._sr),t.vertices[1]._x=t._x+t._outerRadius*Math.cos(t._sr),t.vertices[1]._y=t._y-t._outerRadius*Math.sin(t._sr),t.vertices[2]._x=t._x+t._outerRadius*Math.cos(t._er),t.vertices[2]._y=t._y-t._outerRadius*Math.sin(t._er),t.vertices[3]._x=t._x+t._innerRadius*Math.cos(t._er),t.vertices[3]._y=t._y-t._innerRadius*Math.sin(t._er)}(t,n);break;case"startAngle":!function(t,e){let n=t.angle;t._startAngle=e,t._endAngle=VE(t._startAngle+n),t._sr=LE(t._startAngle),t._er=LE(t._endAngle),t.vertices[0]._x=t._x+t._innerRadius*Math.cos(t._sr),t.vertices[0]._y=t._y-t._innerRadius*Math.sin(t._sr),t.vertices[1]._x=t._x+t._outerRadius*Math.cos(t._sr),t.vertices[1]._y=t._y-t._outerRadius*Math.sin(t._sr),t.vertices[2]._x=t._x+t._outerRadius*Math.cos(t._er),t.vertices[2]._y=t._y-t._outerRadius*Math.sin(t._er),t.vertices[3]._x=t._x+t._innerRadius*Math.cos(t._er),t.vertices[3]._y=t._y-t._innerRadius*Math.sin(t._er)}(t,n);break;case"thickness":!function(t,e){_A(t,t._innerRadius+e)}(t,n);break;case"innerRadius":!function(t,e){t._innerRadius=e,t.vertices[0]._x=t._x+t._innerRadius*Math.cos(t._sr),t.vertices[0]._y=t._y-t._innerRadius*Math.sin(t._sr),t.vertices[3]._x=t._x+t._innerRadius*Math.cos(t._er),t.vertices[3]._y=t._y-t._innerRadius*Math.sin(t._er)}(t,n);break;case"outerRadius":_A(t,n);break;case"radialDistance":{let e=QE(t.parent.x,t.parent.y,n,t.polarAngle);yA(t,e[0]),mA(t,e[1]);break}case"visibility":t.visibility=n;break;case"src":t.src=n;break;default:if("vertex"===t.type)t[e]=n;else if(t instanceof YA)for(let r of t.children)gA(r,e,n);else t.styles[e]=n}"vertex"===t.type?t.parent._dirty=!0:t._dirty=!0}function _A(t,e){t._outerRadius=e,t.vertices[1]._x=t._x+t._outerRadius*Math.cos(t._sr),t.vertices[1]._y=t._y-t._outerRadius*Math.sin(t._sr),t.vertices[2]._x=t._x+t._outerRadius*Math.cos(t._er),t.vertices[2]._y=t._y-t._outerRadius*Math.sin(t._er)}function yA(t,e){"vertex"==t.type?t._x=e:dA(t,e-t.x,0)}function mA(t,e){"vertex"==t.type?t._y=e:dA(t,0,e-t.y)}class bA extends kE{constructor(t){super(t)}get width(){return this.vertices[1].x-this.vertices[0].x}get height(){return this.vertices[2].y-this.vertices[1].y}get left(){return this.vertices[0].x}get top(){return this.vertices[0].y}get right(){return this.vertices[1].x}get bottom(){return this.vertices[2].y}get area(){return this.width*this.height}resize(t,e,n,r){t!==this.width&&("right"===n?(this.vertices[1]._x=this.refBounds.right,this.vertices[2]._x=this.refBounds.right,this.vertices[0]._x=this.vertices[1]._x-t,this.vertices[3]._x=this.vertices[0]._x):(this.vertices[0]._x=this.refBounds.left,this.vertices[3]._x=this.refBounds.left,this.vertices[1]._x=this.vertices[0]._x+t,this.vertices[2]._x=this.vertices[1]._x)),e!==this.height&&("top"===r?(this.vertices[0]._y=this.refBounds.top,this.vertices[1]._y=this.refBounds.top,this.vertices[3]._y=this.vertices[0]._y+e,this.vertices[2]._y=this.vertices[3]._y):(this.vertices[2]._y=this.refBounds.bottom,this.vertices[3]._y=this.refBounds.bottom,this.vertices[0]._y=this.vertices[3]._y-e,this.vertices[1]._y=this.vertices[0]._y)),this._dirty=!0}get leftSegment(){return this.segments[3]}get rightSegment(){return this.segments[1]}get topSegment(){return this.segments[0]}get bottomSegment(){return this.segments[2]}}class vA extends kE{constructor(t){super(t),this._type=bT.Area,this.closed=!0,this._orientation="orientation"in t?t.orientation:void 0,this._baseline="baseline"in t?t.baseline:void 0,t&&"vertices"in t&&this.segments.push(new SE(this.vertices[this.vertices.length-1],this.vertices[0],this,this.segmentCounter++))}get topLeftVertex(){return this._orientation===bE?this.vertices[0]:this.vertices[this.vertices.length-1]}get bottomLeftVertex(){return this._orientation===bE?this.vertices[this.vertices.length-1]:this.vertices[this.vertices.length/2]}get topRightVertex(){return this._orientation===bE?this.vertices[this.vertices.length/2-1]:this.vertices[0]}get bottomRightVertex(){return this._orientation===bE?this.vertices[this.vertices.length/2]:this.vertices[this.vertices.length/2-1]}get baseline(){return this._baseline}set baseline(t){this._baseline=t,this._dirty=!0}get orientation(){return this._orientation}set orientation(t){this._orientation=t,this._dirty=!0}get firstVertexPair(){return[this.vertices[0],this.vertices[this.vertices.length-1]]}get width(){return this.vertices[this.vertices.length/2].x-this.vertices[0].x}get height(){return this.vertices[this.vertices.length/2].y-this.vertices[0].y}get left(){return this.vertices[0].x}get top(){return this.vertices[0].y}copyPropertiesTo(t){super.copyPropertiesTo(t),t._baseline=this._baseline,t._orientation=this._orientation}getSVGPathData(){return super.getSVGPathData()+" z"}}class xA extends eA{constructor(t,e){super(t),this._encs={},this._encs[e.channel+"_"+lA(e.element)]=e,this._initialized=!1}addLinkedEncoding(t){this._encs[t.channel+"_"+lA(t.element)]=t}getEncoding(t,e){let n=t+"_"+lA(e);return this._encs[n]}get encodings(){return Object.values(this._encs)}get initialized(){return this._initialized}set initialized(t){this._initialized=t}}class wA extends eA{constructor(t,e,n){super(t),this._result=e,this._condEnc=n}get result(){return this._result}get conditionalEncoding(){return this._condEnc}}class EA extends pE{constructor(t){super(t)}storeValues(t,e){this._storedValues={};let n=Qw(t);for(let t of n)this._storedValues[t.id]=t[e]}_restoreValues(t){let e=this.outputVar.channel;t.forEach(t=>{t.styles[e]!==this._storedValues[t.id]&&(t._dirty=!0,t.styles[e]=this._storedValues[t.id])})}run(){super.run();let t=this.inputVars.find(t=>t instanceof xA),e=this.outputVar,n=Qw(e.element),r=["x","y","width","height","radius"].includes(e.channel);if(t){let n=t.getEncoding(e.channel,e.element);for(let t of n.scales){let e=n.getElements(t);this._doMapping(e,t,n.attrValues,n),r&&this._updateRefBounds(e,t,n)}}else this._restoreValues(n);let i=this._getUsableCondEncodings();if(i.length>0&&this._doCondEncoding(n,i.map(t=>t.conditionalEncoding)),r){$w(["vertex","segment"].includes(e.element.type)?e.element.parent:e.element)}}_updateRefBounds(t,e,n){switch(this.outputVar.channel){case"width":t.forEach(t=>{t._refBounds.setWidth(e.rangeExtent)});break;case"height":t.forEach(t=>{t._refBounds.setHeight(e.rangeExtent)});break;case"radius":t.forEach(t=>{t._refBounds.setWidth(2*e.rangeExtent,Xw.CENTER),t._refBounds.setHeight(2*e.rangeExtent,Xw.MIDDLE)});break;case"x":"vertex"!=t[0].type&&"segment"!=t[0].type||t.forEach(t=>{let r=t.parent._refBounds;t.parent._refBounds=new Yw(n.flipScale?e.range[1]:e.range[0],r.top,e.rangeExtent,r.height)});break;case"y":"vertex"!=t[0].type&&"segment"!=t[0].type||t.forEach(t=>{let r=t.parent._refBounds;t.parent._refBounds=new Yw(r.left,n.flipScale?e.range[0]:e.range[1],r.width,e.rangeExtent)})}}_doMapping(t,e,n,r){switch(this.outputVar.channel){case"width":e.domain[0]<0&&t[0]instanceof bA?function(t,e,n){for(let r=0;r<t.length;r++){let i=t[r],o=i.refBounds.left+e.map(0),a=i.refBounds.left+e.map(n[i.id]);dA(i.leftSegment,o-i.leftSegment.x,0),dA(i.rightSegment,a-i.rightSegment.x,0)}}(t,e,n):e.domain[0]<0&&t[0]instanceof vA||(t[0].type===bT.Area?function(t,e,n){let r=t[0].baseline;if(t[0].orientation===vE)switch(r){case"left":for(let r of t)Qw(r.topLeftVertex,r).forEach(t=>gA(t,"x",r.refBounds.left)),Qw(r.topRightVertex,r).forEach(t=>gA(t,"x",r.refBounds.left+e.map(n[t.id])));break;case"right":for(let r of t)Qw(r.topLeftVertex,r).forEach(t=>gA(t,"x",r.refBounds.right-e.map(n[t.id]))),Qw(r.topRightVertex,r).forEach(t=>gA(t,"x",r.refBounds.right));break;case"center":console.log("center");for(let r of t)Qw(r.topLeftVertex,r).forEach(t=>gA(t,"x",r.refBounds.center-e.map(n[t.id])/2)),Qw(r.topRightVertex,r).forEach(t=>gA(t,"x",r.refBounds.center+e.map(n[t.id])/2))}}(t,e,n):this._doStandardMapping(t,e,n));break;case"height":e.domain[0]<0&&t[0]instanceof bA?function(t,e,n){for(let r=0;r<t.length;r++){let i=t[r],o=i.refBounds.bottom-e.map(0),a=i.refBounds.bottom-e.map(n[i.id]);dA(i.bottomSegment,0,o-i.bottomSegment.y),dA(i.topSegment,0,a-i.topSegment.y)}}(t,e,n):e.domain[0]<0&&t[0]instanceof vA?function(t,e,n){for(let r of t){let t=tE(r.topLeftVertex,[r]);for(let i of t)gA(i,"y",r.refBounds.bottom-e.map(n[i.id]));tE(r.bottomLeftVertex,[r]).forEach(t=>gA(t,"y",r.refBounds.bottom-e.map(0)))}}(t,e,n):t[0].type===bT.Area?function(t,e,n){let r=t[0].baseline;if(t[0].orientation===bE)switch(r){case"top":for(let r of t)Qw(r.bottomLeftVertex,r).forEach(t=>gA(t,"y",r.refBounds.top+e.map(n[t.id]))),Qw(r.topLeftVertex,r).forEach(t=>gA(t,"y",r.refBounds.top));break;case"middle":for(let r of t)Qw(r.topLeftVertex,r).forEach(t=>gA(t,"y",r.refBounds.middle-e.map(n[t.id])/2)),Qw(r.bottomLeftVertex,r).forEach(t=>gA(t,"y",r.refBounds.middle+e.map(n[t.id])/2));break;default:for(let r of t)Qw(r.topLeftVertex,r).forEach(t=>gA(t,"y",r.refBounds.bottom-e.map(n[t.id]))),Qw(r.bottomLeftVertex,r).forEach(t=>gA(t,"y",r.refBounds.bottom))}}(t,e,n):this._doStandardMapping(t,e,n);break;case"text":this._doTextMapping(t,n);break;case"fillGradient":!function(t,e,n,r){for(let i of t){let t=i.vertices.map(t=>n[t.id]),o=Math.min(...t),a=Math.max(...t),s="horizontal"===i.orientation?new _E({x1:0,y1:100,x2:0,y2:0}):new _E({x1:0,y1:0,x2:100,y2:0});if(s.addStop(0,e.map(o),1),r._mapping){let t=Object.keys(r._mapping).map(t=>parseFloat(t)).sort();for(let n of t)n>o&&n<a&&s.addStop(100*(n-o)/(a-o),e.map(n),1)}else"divergingColor"===e.type&&s.addStop(100*-o/(a-o),e.map(0),1);"sequentialColor"===e.type&&s.addStop(100*-o/(a-o),e.map(0),1),s.addStop(100,e.map(a),1),i.fillColor=s}}(t,e,n,r);break;default:this._doStandardMapping(t,e,n)}}_doTextMapping(t,e){let n=this.outputVar.channel;t.forEach(t=>{gA(t,n,e[t.id])})}_doStandardMapping(t,e,n){let r=this.outputVar.channel;t.forEach(t=>{let i=e.map(n[t.id]);gA(t,r,i),t instanceof kE&&t.firstVertex&&t.firstVertex.shape&&"strokeColor"===r&&t.vertices.forEach(t=>t.fillColor=i)})}_doCondEncoding(t,e){let n=t[0].scene;for(let r of t){let t=e.map(t=>t.evalResult.getValue(r.id)).every(t=>t||void 0===t),i=e[0].eventContext;e[0].stylingFunction(t,i,r,n)}}_updateElement(t,e,n,r){let i;"object"==typeof r&&t.triggerElement?"property"in r?i=t.triggerElement[r.property]:"attribute"in r&&(i=t.triggerElement.dataScope.getAttrVal(r.attribute)):i=r,["x","y"].includes(n)&&"offset"in r&&(i+=r.offset),gA(e,n,i)}_getUsableCondEncodings(){return this.inputVars.filter(t=>t instanceof wA)}}class AA extends eA{constructor(t,e,n){super(t),this._property=e,this._elem=n}get property(){return this._property}get element(){return this._elem}}function TA(t){return t in CA?CA[t]:t}const CA=Object.freeze({numCols:"layoutParameter",numRows:"layoutParameter",startCorner:"layoutParameter",direction:"layoutParameter"}),SA=Object.freeze({AXIS_ORIENTATION:"axisOrientation",AXIS_PATH_POSITION:"axisPathPosition",AXIS_TICK_SIZE:"axisTickSize",AXIS_TICK_OFFSET:"axisTickOffset",AXIS_TICKS_POSITION:"axisTicksPosition",AXIS_LABELS_POSITION:"axisLabelsPosition",AXIS_TITLE_POSITION:"axisTitlePosition",AXIS_LABEL_OFFSET:"axisLabelOffset",AXIS_LABEL_FORMAT:"axisLabelFormat",AXIS_FONT_SIZE:"axisFontSize",LEGEND_POSITION:"legendPosition",GRIDLINES_POSITION:"gridlinesPosition",INCLUDE_ZERO:"includeZero",FLIP_SCALE:"flipScale",RANGE_START:"rangeStart",RANGE_EXTENT:"rangeExtent",BASE_LINE:"baseline",LAYOUT_PARAMETER:"layoutParameter",CHILDREN_ORDER:"childrenOrder",TRANSFORM:"transform"});function kA(t,e){if(e.findVariable(nA.BOUNDS,[t]))return;let n=e.getVariable(nA.BOUNDS,t),r=e.createOneWayDependency(gE.EVAL_BBOX);switch(e.connect(r,n),t.type){case bT.Circle:case bT.Polygon:{let n=e.getVariable(nA.CHANNEL,"x",t),i=e.getVariable(nA.CHANNEL,"y",t),o=e.getVariable(nA.CHANNEL,"radius",t),a=e.getVariable(nA.CHANNEL,"area",t);e.connect(o,r),e.connect(n,r),e.connect(i,r),e.connect(a,r);break}case bT.Area:case bT.Line:case bT.BezierCurve:case bT.Path:case bT.Image:{let n=e.getVariable(nA.CHANNEL,"x",t),i=e.getVariable(nA.CHANNEL,"y",t),o=e.getVariable(nA.CHANNEL,"width",t),a=e.getVariable(nA.CHANNEL,"height",t);e.connect(n,r),e.connect(i,r),e.connect(o,r),e.connect(a,r);break}case bT.Rect:{let n=e.getVariable(nA.CHANNEL,"x",t),i=e.getVariable(nA.CHANNEL,"y",t),o=e.getVariable(nA.CHANNEL,"width",t),a=e.getVariable(nA.CHANNEL,"height",t),s=e.getVariable(nA.CHANNEL,"area",t);e.connect(n,r),e.connect(i,r),e.connect(o,r),e.connect(a,r),e.connect(s,r);break}case bT.SimpleText:case bT.RichText:{let n=e.getVariable(nA.CHANNEL,"x",t),i=e.getVariable(nA.CHANNEL,"y",t),o=e.getVariable(nA.CHANNEL,"text",t);e.connect(n,r),e.connect(i,r),e.connect(o,r);break}case bT.Ring:{let n=e.getVariable(nA.CHANNEL,"x",t),i=e.getVariable(nA.CHANNEL,"y",t),o=e.getVariable(nA.CHANNEL,"innerRadius",t),a=e.getVariable(nA.CHANNEL,"outerRadius",t);e.connect(n,r),e.connect(i,r),e.connect(o,r),e.connect(a,r);break}case bT.Pie:case bT.Arc:{let n=e.getVariable(nA.CHANNEL,"x",t),i=e.getVariable(nA.CHANNEL,"y",t),o=e.getVariable(nA.CHANNEL,"innerRadius",t),a=e.getVariable(nA.CHANNEL,"outerRadius",t),s=e.getVariable(nA.CHANNEL,"startAngle",t),l=e.getVariable(nA.CHANNEL,"endAngle",t),c=e.getVariable(nA.CHANNEL,"angle",t),u=e.getVariable(nA.CHANNEL,"thickness",t);e.connect(n,r),e.connect(i,r),e.connect(o,r),e.connect(a,r),e.connect(s,r),e.connect(l,r),e.connect(c,r),e.connect(u,r);break}}r.run()}function MA(t,e){let n=e.findVariablesByElement(t);for(let t in n){let r=n[t];for(let t of r)e.deleteVariable(t)}}function RA(t,e){if(t.type===bT.Axis){let n=e.findVariable(nA.PROPERTY,[SA.AXIS_PATH_POSITION,t]).incomingDataflow;e.deleteOperator(n),n=e.findVariable(nA.PROPERTY,[SA.AXIS_TICKS_POSITION,t]).incomingDataflow,e.deleteOperator(n),n=e.findVariable(nA.PROPERTY,[SA.AXIS_LABELS_POSITION,t]).incomingDataflow,e.deleteOperator(n)}else if(t.type===bT.Gridlines){let n=e.findVariable(nA.PROPERTY,[SA.GRIDLINES_POSITION,t]).incomingDataflow;e.deleteOperator(n)}}function OA(t,e){if(e.findVariable(nA.BOUNDS,[t]))return;let n=e.getVariable(nA.BOUNDS,t),r=e.getVariable(nA.CHANNEL,"x",t),i=e.getVariable(nA.CHANNEL,"y",t),o=e.getVariable(nA.CHANNEL,"width",t),a=e.getVariable(nA.CHANNEL,"height",t),s=e.createOneWayDependency(gE.EVAL_BBOX);e.connect(r,s),e.connect(i,s),e.connect(o,s),e.connect(a,s),e.connect(s,n),s.run()}function NA(t,e){let n=e.getVariable(nA.BOUNDS,t),r=e.getVariable(nA.CHANNEL,"x",t),i=e.getVariable(nA.CHANNEL,"y",t),o=e.getVariable(nA.CHANNEL,"width",t),a=e.getVariable(nA.CHANNEL,"height",t),s=e.createOneWayDependency(gE.EVAL_BBOX);e.connect(r,s),e.connect(i,s),e.connect(o,s),e.connect(a,s),e.connect(s,n),s.run()}function IA(t,e,n){let r=n.getVariable(nA.BOUNDS,t),i=n.getVariable(nA.BOUNDS,e),o=n.getIncomingDataflowOperator(gE.EVAL_BBOX,r),a=i.outgoingEdges.find(t=>t.fromNode===i&&t.toNode===o);if(a&&n.disconnect(i,o,a),t.layout){let r=n.getVariable(nA.CHANNEL,"x",e),i=n.getIncomingDataflowOperator(VA(t.layout.type),r);i&&n.deleteOperator(i)}}function LA(t,e,n){let r=n.getVariable(nA.BOUNDS,t),i=n.getVariable(nA.BOUNDS,e),o=n.getIncomingDataflowOperator(gE.EVAL_BBOX,r);n.connect(i,o),n.connect(o,r),t.layout&&BA(t,t.layout,n)}function PA(t,e){let n=e.getVariable(nA.BOUNDS,t),r=e.getVariable(nA.CHANNEL,"x",t),i=e.getVariable(nA.CHANNEL,"y",t),o=e.getIncomingDataflowOperator(gE.EVAL_BBOX,n);e.connect(r,o),e.connect(i,o);for(let n of t.children)e.connect(e.getVariable(nA.BOUNDS,n),o);e.connect(o,n),o.run()}function VA(t){switch(t){case fE.GRID:return gE.GRID_LAYOUT;case fE.STACK:return gE.STACK_LAYOUT;case fE.PACKING:return gE.PACK_LAYOUT;case fE.FORCE:return gE.FORCE_LAYOUT;case fE.DIRECTED:return gE.DIRECTED_LAYOUT;case fE.TIDYTREE:return gE.TIDY_TREE_LAYOUT;case fE.TREEMAP:return gE.TREEMAP_LAYOUT;case fE.STRATA:return gE.STRATA_LAYOUT;case fE.CIRCULAR:return gE.CIRCULAR_LAYOUT;case fE.CLUSTER:return gE.CLUSTER_LAYOUT}}function DA(t,e,n){let r=n.getVariable(nA.PROPERTY,SA.CHILDREN_ORDER,t),i=n.getOutgoingDataflowOperator(VA(e.type),r);n.deleteOperator(i)}function BA(t,e,n){let r=e?e.type:"none",i=r===fE.TREEMAP?lE(t)[0]:t.children[0];if(!i)return;let o=n.getVariable(nA.CHANNEL,"width",i),a=n.getVariable(nA.CHANNEL,"height",i),s=n.getVariable(nA.PROPERTY,SA.CHILDREN_ORDER,t),l=n.getVariable(nA.CHANNEL,"x",i),c=n.getVariable(nA.CHANNEL,"y",i),u=n.getVariable(nA.CHANNEL,"visibility",i),h=n.getVariable(nA.PROPERTY,SA.LAYOUT_PARAMETER,e),f=n.getOutgoingDataflowOperator(VA(r),s);if(n.connect(o,f),n.connect(a,f),n.connect(s,f),n.connect(h,f),n.connect(u,f),n.connect(f,l),n.connect(f,c),n.disconnectChannelVarFromBBoxOperator(o),n.disconnectChannelVarFromBBoxOperator(a),i.type===bT.Arc||i.type===bT.Pie){let t=n.getVariable(nA.CHANNEL,"angle",i),e=n.getVariable(nA.CHANNEL,"thickness",i);n.connect(t,f),n.connect(e,f)}else if(i.type===bT.Circle){let t=n.getVariable(nA.CHANNEL,"area",i),e=n.getVariable(nA.CHANNEL,"radius",i);n.connect(t,f),n.connect(e,f),n.disconnectChannelVarFromBBoxOperator(t),n.disconnectChannelVarFromBBoxOperator(e)}else if(i.type===bT.Rect){let t=n.getVariable(nA.CHANNEL,"area",i);n.connect(t,f),n.disconnectChannelVarFromBBoxOperator(t)}if(f.run(),i.links&&zA(i,n),i.children&&i.children[0]){let t=n.getVariable(nA.BOUNDS,i.children[0]),e=n.getVariable(nA.CHANNEL,"x",i).incomingDataflow;e&&n.connect(t,e),n.disconnectChannelVarFromBBoxOperator(t)}}function zA(t,e){let n=t.links[0],r=e.getVariable(nA.CHANNEL,"x",t),i=e.getVariable(nA.CHANNEL,"x",n),o=e.getVariable(nA.CHANNEL,"strokeWidth",n),a=e.getVariable(nA.CHANNEL,"strength",n),s=e.createOneWayDependency(gE.LINK_PLACER);e.connect(r,s),e.connect(o,s),e.connect(a,s),e.connect(s,i)}function FA(t,e,n){let r=t.attribute,i=t.channel,o=t.element,a=e.createOneWayDependency(gE.ENCODER);if(["width","height"].includes(t.channel)&&o.type===bT.Area){let t=e.getVariable(nA.PROPERTY,SA.BASE_LINE,o);e.connect(t,a)}if(n){let r=e.getVariable(nA.ATTR_VALUE,n),s=e.getVariable(nA.SCALE,n),l=e.getVariable(nA.CHANNEL,i,o);e.connect(s,a),e.connect(a,l),r.addLinkedEncoding(t),s.addLinkedEncoding(t),r.incomingDataflow.run()}else{let n=e.getVariable(nA.ATTRIBUTE,r,ET(o)),s=e.getVariable(nA.PROPERTY,SA.INCLUDE_ZERO,t),l=e.getVariable(nA.ATTR_VALUE,t),c=e.getVariable(nA.DATASCOPE,o),u=e.getVariable(nA.PROPERTY,SA.TRANSFORM,t),h=e.createOneWayDependency(gE.DATA_EXTRACTOR);e.connect(n,h),e.connect(s,h),e.connect(c,h),e.connect(u,h),e.connect(h,l),h.run();let f=e.getVariable(nA.PROPERTY,SA.RANGE_START,t),d=e.getVariable(nA.PROPERTY,SA.RANGE_EXTENT,t),p=e.getVariable(nA.PROPERTY,SA.FLIP_SCALE,t),g=e.getVariable(nA.SCALE,t),_=e.createOneWayDependency(gE.SCALE_BUILDER);e.connect(f,_),e.connect(d,_),e.connect(p,_),e.connect(l,_),e.connect(_,g),_.run();let y=e.getVariable(nA.CHANNEL,i,o);e.connect(g,a),e.connect(a,y),a.run()}}function GA(t,e){let n=e.getVariable(nA.PROPERTY,SA.AXIS_ORIENTATION,t),r=e.getVariable(nA.BOUNDS,t.elements[0].parent),i=e.getVariable(nA.PROPERTY,SA.AXIS_PATH_POSITION,t),o=e.createOneWayDependency(gE.AXIS_PATH_PLACER);e.connect(n,o),e.connect(r,o),e.connect(o,i),o.run();let a=e.getVariable(nA.PROPERTY,SA.AXIS_TICK_OFFSET,t),s=e.getVariable(nA.PROPERTY,SA.AXIS_TICK_SIZE,t),l=e.createOneWayDependency(gE.AXIS_TICKS_PLACER),c=e.getVariable(nA.PROPERTY,SA.AXIS_TICKS_POSITION,t);e.connect(i,l),e.connect(a,l),e.connect(s,l),e.connect(l,c),l.run();let u=e.getVariable(nA.PROPERTY,SA.AXIS_LABEL_OFFSET,t),h=e.getVariable(nA.PROPERTY,SA.AXIS_LABEL_FORMAT,t),f=e.getVariable(nA.PROPERTY,SA.AXIS_FONT_SIZE,t),d=e.createOneWayDependency(gE.AXIS_LABELS_PLACER),p=e.getVariable(nA.PROPERTY,SA.AXIS_LABELS_POSITION,t);e.connect(i,d),e.connect(u,d),e.connect(h,d),e.connect(f,d),e.connect(d,p),d.run();let g=e.getVariable(nA.PROPERTY,SA.AXIS_TITLE_POSITION,t),_=e.createOneWayDependency(gE.AXIS_TITLE_PLACER);e.connect(i,_),e.connect(_,g),_.run();let y=e.getVariable(nA.BOUNDS,t),m=e.getIncomingDataflowOperator(gE.EVAL_BBOX,y);e.connect(c,m),e.connect(p,m),e.connect(m,y)}function jA(t,e){let n=e.getVariable(nA.PROPERTY,SA.AXIS_ORIENTATION,t),r=e.getVariable(nA.BOUNDS,sE(t.elements[0])),i=e.getVariable(nA.PROPERTY,SA.AXIS_PATH_POSITION,t),o=e.createOneWayDependency(gE.AXIS_PATH_PLACER);e.connect(n,o),e.connect(r,o),e.connect(o,i),o.run();let a=e.getVariable(nA.PROPERTY,SA.AXIS_TICK_OFFSET,t),s=e.getVariable(nA.PROPERTY,SA.AXIS_TICK_SIZE,t),l=e.createOneWayDependency(gE.AXIS_TICKS_PLACER),c=e.getVariable(nA.PROPERTY,SA.AXIS_TICKS_POSITION,t);e.connect(i,l),e.connect(a,l),e.connect(s,l),e.connect(l,c),l.run();let u=e.getVariable(nA.PROPERTY,SA.AXIS_LABEL_OFFSET,t),h=e.getVariable(nA.PROPERTY,SA.AXIS_LABEL_FORMAT,t),f=e.getVariable(nA.PROPERTY,SA.AXIS_FONT_SIZE,t),d=e.createOneWayDependency(gE.AXIS_LABELS_PLACER),p=e.getVariable(nA.PROPERTY,SA.AXIS_LABELS_POSITION,t);e.connect(i,d),e.connect(u,d),e.connect(h,d),e.connect(f,d),e.connect(d,p),d.run();let g=e.getVariable(nA.PROPERTY,SA.AXIS_TITLE_POSITION,t),_=e.createOneWayDependency(gE.AXIS_TITLE_PLACER);e.connect(i,_),e.connect(_,g),_.run();let y=e.getVariable(nA.BOUNDS,t),m=e.getIncomingDataflowOperator(gE.EVAL_BBOX,y);e.connect(c,m),e.connect(p,m),e.connect(m,y)}function UA(t,e){let n=e.getVariable(nA.BOUNDS,sE(t.elements[0])),r=e.getVariable(nA.PROPERTY,SA.GRIDLINES_POSITION,t),i=e.createOneWayDependency(gE.GRIDLINES_PLACER);e.connect(n,i),e.connect(i,r),i.run();let o=e.getVariable(nA.BOUNDS,t),a=e.getIncomingDataflowOperator(gE.EVAL_BBOX,o);e.connect(r,a),e.connect(a,o)}class YA{constructor(){this._id=this.type+xT(),this._type=bT.Group,this._dataScope=void 0,this._bounds=void 0,this._layout=void 0,this._children=[],this._sortBy={property:AT,descending:!1}}get id(){return this._id}get type(){return this._type}get children(){return this._children}addChild(t){this._children.indexOf(t)>=0||(t.parent&&t.parent.removeChild(t),this._children.push(t),t.parent=this)}addChildAt(t,e){t.parent&&t.parent.removeChild(t),this.children.splice(e,0,t),t.parent=this}removeChild(t){let e=this.children.indexOf(t);e>=0&&(this.children.splice(e,1),t.parent=null)}removeChildAt(t){this.children[t].parent=null,this.children.splice(t,1)}removeAll(){for(let t of this.children)t.parent=null;this._children=[]}get dataScope(){return this._dataScope}set dataScope(t){if(this._dataScope=t,void 0===t)for(let e of this.children)e.dataScope=t;else for(let e of this.children)e.dataScope?e.dataScope=e.dataScope.merge(t):e.dataScope=t}getInternalEncodings(t){if(0==this.children.length)return[];let e=this.children[0],n=this.getScene(),r=Object.keys(n.encodings),i=[];for(;e;){if(e.classId&&i.indexOf(e.classId)<0&&i.push(e.classId),e.type===bT.Glyph){e.children.forEach(t=>i.push(t.classId));break}if(!e.children)break;e=e.children[0]}let o=[];for(let e of r){let r=e.split("_");for(let a of i)r[0]==a&&n.encodings[e][t]&&o.push(n.encodings[e][t])}return o}get firstChild(){return this.children[0]}get lastChild(){return this.children[this.children.length-1]}set layout(t){if(this._layout=t,t&&(t.group=this),BA(this,t,this.scene._depGraph),this.children&&this.children.length>0){let t=lE(this,!0);for(let e of t)this.scene.onChange(nA.CHANNEL,"x",e)}}get layout(){return this._layout}get bounds(){return this._bounds||this._updateBounds(),this._bounds}get refBounds(){let t=this.children.map(t=>t.refBounds),e=Math.min(...t.map(t=>t.left)),n=Math.min(...t.map(t=>t.top)),r=Math.max(...t.map(t=>t.right)),i=Math.max(...t.map(t=>t.bottom));return new Yw(e,n,r-e,i-n)}get x(){return this.bounds.x}get y(){return this.bounds.y}_updateBounds(){let t=this.children;if(t.length>0){this._bounds=t[0].bounds.clone();for(let e=1;e<t.length;e++)"hidden"!=t[e].visibility&&(this._bounds=this._bounds.union(t[e].bounds))}else this._bounds=new Yw(0,0,0,0)}set visibility(t){this._visibility="hidden"==t?t:"visible";for(let e of this.children)e.visibility=t}get visibility(){return this._visibility?this._visibility:"visible"}get scene(){return aE(this)}get sortBy(){return this._sortBy}}class HA extends YA{constructor(t){super(),this._type=bT.Collection,this._id=t.id?t.id:this._type+"_"+xT(),this._classId=this.id,this._childrenOrder=void 0,this._clipMask=void 0}get classId(){return this._classId}getSVGPathData(){let t="";for(let e of this.children)if(e.getSVGPathData)t+=e.getSVGPathData();else if(e.bounds){let n=e.bounds;t+=["M",n.left,n.top].join(" "),t+=["L",n.right,n.top].join(" "),t+=["L",n.right,n.bottom].join(" "),t+=["L",n.left,n.bottom,"Z"].join(" ")}return t}createClipMask(){let t=qw(this._children);this._clipMask=new Yw(t.left,t.top,t.width,t.height)}get clipMask(){return this._clipMask}}class qA extends YA{constructor(t){if(super(),this._type=bT.Glyph,this._id=t&&t.id?t.id:this.type+"_"+xT(),this._classId=this._id,t&&t.children)for(let e of t.children)this.addChild(e)}get classId(){return this._classId}}class WA extends kE{constructor(t){super(t),this._type=bT.BezierCurve,this._orientation="orientation"in t?t.orientation:bE}get type(){return this._type}get orientation(){return this._orientation}copyPropertiesTo(t){super.copyPropertiesTo(t),t._orientation=this._orientation}getSVGPathData(){if(this._d)return this._d;let t="M ";return t+=this.vertices[0].x+" "+this.vertices[0].y+" ",t+="C "+this.vertices[1].x+" "+this.vertices[1].y+" ",t+=this.vertices[2].x+" "+this.vertices[2].y+" ",t+=this.vertices[3].x+" "+this.vertices[3].y,t}}class $A extends Kw{constructor(t){super(t),this._type=bT.Circle,this._x="x"in t?t.x:0,this._y="y"in t?t.y:0,this._radius="radius"in t?t.radius:100,"strokeColor"in this.styles||(this.styles.strokeColor="#ccc"),"fillColor"in this.styles||(this.styles.fillColor="none"),"strokeWidth"in this.styles||(this.styles.strokeWidth=1),"strokeDash"in this.styles||(this.styles.strokeDash="none")}get x(){return this._x}get y(){return this._y}get radius(){return this._radius}set radius(t){this._radius=t,this._dirty=!0}get area(){return Math.PI*Math.pow(this._radius,2)}_updateBounds(){if(this._rotate){let t=Gw(this._x,this._y,this._rotate[1],this._rotate[2],this._rotate[0]);this._bounds=new Yw(t.x-this._radius,t.y-this._radius,2*this._radius,2*this._radius)}else this._bounds=new Yw(this._x-this._radius,this._y-this._radius,2*this._radius,2*this._radius)}copyPropertiesTo(t){super.copyPropertiesTo(t),t._x=this._x,t._y=this._y,t._radius=this._radius}getSVGPathData(){return["M",this._x,this._y,"m",-this._radius,", 0 a",this._radius,",",this._radius,"0 1,0",2*this._radius,",0 a",this._radius,",",this._radius,"0 1,0",-2*this._radius,",0"].join(" ")}}let XA=class extends Kw{constructor(t){super(t),this._type=bT.Image,this._src=t.src,this._x="x"in t?t.x:0,this._y="y"in t?t.y:0,this._width="width"in t?t.width:100,this._height="height"in t?t.height:100}get src(){return this._src}set src(t){this._src=t,this._dirty=!0}get width(){return this._width}set width(t){this._width=t,this._updateBounds(),this._dirty=!0}get height(){return this._height}set height(t){this._height=t,this._updateBounds(),this._dirty=!0}resize(t,e){this._width=t,this._height=e,this._dirty=!0,this._updateBounds()}get x(){return this._x}set x(t){this._x=t,this._dirty=!0,this._updateBounds()}get y(){return this._y}set y(t){this._y=t,this._dirty=!0,this._updateBounds()}get bounds(){return this._bounds||this._updateBounds(),this._bounds}_updateBounds(){this._bounds=new Yw(this._x,this._y,this._width,this._height)}copyPropertiesTo(t){t.attrs=Object.assign({},this.attrs),t.styles=Object.assign({},this.styles),this._dataScope&&(t._dataScope=this._dataScope.clone()),t.x=this._x,t.y=this._y,t.width=this._width,t.height=this._height,t.src=this._src}};class KA extends kE{constructor(t){super(t)}get x1(){return this.vertices[0].x}get y1(){return this.vertices[0].y}get x2(){return this.vertices[1].x}get y2(){return this.vertices[1].y}get x(){return(this.vertices[0].x+this.vertices[1].x)/2}get y(){return(this.vertices[0].y+this.vertices[1].y)/2}set x(t){let e=t-this.x;this.vertices[0]._x+=e,this.vertices[1]._x+=e,this._dirty=!0}set y(t){let e=t-this.y;this.vertices[0]._y+=e,this.vertices[1]._y+=e,this._dirty=!0}set x1(t){this.vertices[0]._x=t,this._dirty=!0}set x2(t){this.vertices[1]._x=t,this._dirty=!0}set y1(t){this.vertices[0]._y=t,this._dirty=!0}set y2(t){this.vertices[1]._y=t,this._dirty=!0}}class ZA extends Kw{constructor(t){super(t),this._type=bT.SimpleText,this._x="x"in t?t.x:0,this._y="y"in t?t.y:0,this._text="text"in t?t.text:"",this._anchor="anchor"in t?t.anchor:[Xw.CENTER,Xw.MIDDLE],this._textPath=void 0,this._textPathOffset="50%","fontSize"in this.styles||(this.styles.fontSize="12px"),"fontFamily"in this.styles||(this.styles.fontFamily="Arial, sans-serif"),"fontWeight"in this.styles||(this.styles.fontWeight="normal"),"fillColor"in this.styles||(this.styles.fillColor="black"),"backgroundColor"in t&&(this._backgroundColor=t.backgroundColor),"borderWidth"in t&&(this._borderWidth=t.borderWidth),"borderColor"in t&&(this._borderColor=t.borderColor),this._rotate="rotate"in t?t.rotate:void 0}hasBackground(){return this._backgroundColor||this._borderStroke||this._borderColor}_updateBounds(){let t,e,n=function(t,e,n){const r=Fw.getSVG(),i=document.createElementNS("http://www.w3.org/2000/svg","text");i.setAttribute("font-family",e),i.setAttribute("font-size",n),i.textContent=t,r.appendChild(i);const o=i.getBBox();return r.removeChild(i),{width:o.width,height:o.height}}(this._text,[this.fontWeight,this.fontSize,this.fontFamily].join(" "),parseFloat(this.fontSize)),r=n.width,i=n.height;switch(this._anchor[0]){case Xw.LEFT:t=this._x;break;case Xw.RIGHT:t=this._x-r;break;case Xw.CENTER:t=this._x-r/2;break;default:t=this._x}switch(this._anchor[1]){case Xw.TOP:e=this._y;break;case Xw.BOTTOM:e=this._y-i;break;case Xw.MIDDLE:default:e=this._y-i/2}if(this._rotate&&3===this._rotate.length){let n=[{x:t,y:e},{x:t+r,y:e},{x:t,y:e+i},{x:t+r,y:e+i}].map(t=>Gw(t.x,t.y,this._rotate[1],this._rotate[2],this._rotate[0])),o=Math.min(...n.map(t=>t.x)),a=Math.max(...n.map(t=>t.x)),s=Math.min(...n.map(t=>t.y)),l=Math.max(...n.map(t=>t.y));this._bounds=new Yw(o,s,a-o,l-s)}else this._bounds=new Yw(t,e,r,i)}get x(){return this._x}set x(t){this._x=t,this._dirty=!0}get y(){return this._y}set y(t){this._y=t,this._dirty=!0}get text(){return this._text}set text(t){this._text=t,this._dirty=!0}get anchor(){return this._anchor}get fontFamily(){return this.styles.fontFamily}get fontSize(){return this.styles.fontSize}get fontWeight(){return this.styles.fontWeight}get textPath(){return this._textPath}set textPath(t){this._textPath=t,this._dirty=!0}get textPathOffset(){return this._textPathOffset}set textPathOffset(t){this._textPathOffset=t,this._dirty=!0}get backgroundColor(){return this._backgroundColor?this._backgroundColor:"#fff"}get borderColor(){return this._borderColor?this._borderColor:"#ccc"}get borderWidth(){return this._borderWidth?this._borderWidth:1}copyPropertiesTo(t){t.styles=Object.assign({},this.styles),this._dataScope&&(t._dataScope=this._dataScope.clone()),t._x=this._x,t._y=this._y,t._text=this._text,t._anchor=[this._anchor[0],this._anchor[1]],t._backgroundColor=this._backgroundColor,t._borderColor=this._borderColor,t._borderStroke=this._borderStroke}}class JA extends kE{constructor(t){super(t),this._type=bT.Polygon,this.closed=!0,"x"in t&&(this._x=t.x),"y"in t&&(this._y=t.y),"radius"in t&&(this._radius=t.radius)}get radius(){return this._radius}get x(){return this._x}get y(){return this._y}set x(t){this._x=t,this._dirty=!0}set y(t){this._y=t,this._dirty=!0}set radius(t){this._radius=t,this._dirty=!0}copyPropertiesTo(t){super.copyPropertiesTo(t),t._x=this._x,t._y=this._y,t._radius=this._radius}}class QA extends kE{constructor(t){super(t),this._type=bT.Ring,this.closed=!0,this._x="x"in t?t.x:0,this._y="y"in t?t.y:0,this._innerRadius="innerRadius"in t?t.innerRadius:100,this._outerRadius="outerRadius"in t?t.outerRadius:200}get innerRadius(){return this._innerRadius}get outerRadius(){return this._outerRadius}get x(){return this._x}get y(){return this._y}get thickness(){return this._outerRadius-this._innerRadius}copyPropertiesTo(t){super.copyPropertiesTo(t),t._x=this._x,t._y=this._y,t._innerRadius=this._innerRadius,t._outerRadius=this._outerRadius}getSVGPathData(){return["M "+this._x+" "+this._y,"m 0, -"+this._outerRadius,"a "+this._outerRadius+","+this._outerRadius+", 0, 1, 0, 1, 0","Z","m 0 "+(this._outerRadius-this._innerRadius),"a "+this._innerRadius+", "+this._innerRadius+", 0, 1, 1, -1, 0","Z"].join(" ")}}class tT extends Kw{constructor(t){super(t),this._type=bT.RichText,this._x="x"in t?t.x:0,this._y="y"in t?t.y:0,this._text="text"in t?t.text:"",this._width="width"in t?t.width:200,this._anchor="anchor"in t?t.anchor:[Xw.CENTER,Xw.MIDDLE],"fontSize"in this.styles||(this.styles.fontSize="12px"),"fontFamily"in this.styles||(this.styles.fontFamily="Arial, sans-serif"),"fontWeight"in this.styles||(this.styles.fontWeight="normal"),"fillColor"in this.styles||(this.styles.fillColor="black"),"backgroundColor"in t&&(this._backgroundColor=t.backgroundColor),"borderWidth"in t&&(this._borderWidth=t.borderWidth),"borderColor"in t&&(this._borderColor=t.borderColor),this._rotate="rotate"in t?t.rotate:void 0}hasBackground(){return this._backgroundColor||this._borderStroke||this._borderColor}_updateBounds(){let t,e,n=function(t,e,n){const r=Fw.getSVG(),i=document.createElementNS("http://www.w3.org/2000/svg","text");i.setAttribute("font-family",e),i.setAttribute("font-size",n),i.textContent=t,r.appendChild(i);const o=i.getBBox();return r.removeChild(i),{width:o.width,height:o.height}}(this._text,[this.fontWeight,this.fontSize,this.fontFamily].join(" "),parseFloat(this.fontSize)),r=n.width,i=n.height;switch(this._anchor[0]){case Xw.LEFT:t=this._x;break;case Xw.RIGHT:t=this._x-r;break;case Xw.CENTER:t=this._x-r/2;break;default:t=this._x}switch(this._anchor[1]){case Xw.TOP:e=this._y;break;case Xw.BOTTOM:e=this._y-i;break;case Xw.MIDDLE:default:e=this._y-i/2}if(this._rotate&&3===this._rotate.length){let n=[{x:t,y:e},{x:t+r,y:e},{x:t,y:e+i},{x:t+r,y:e+i}].map(t=>Gw(t.x,t.y,this._rotate[1],this._rotate[2],this._rotate[0])),o=Math.min(...n.map(t=>t.x)),a=Math.max(...n.map(t=>t.x)),s=Math.min(...n.map(t=>t.y)),l=Math.max(...n.map(t=>t.y));this._bounds=new Yw(o,s,a-o,l-s)}else this._bounds=new Yw(t,e,r,i)}get x(){return this._x}get y(){return this._y}get text(){return this._text}get anchor(){return this._anchor}get fontFamily(){return this.styles.fontFamily}get fontSize(){return this.styles.fontSize}get fontWeight(){return this.styles.fontWeight}get textPath(){return this._textPath}set textPath(t){this._textPath=t,this._dirty=!0}get textPathOffset(){return this._textPathOffset}set textPathOffset(t){this._textPathOffset=t,this._dirty=!0}get backgroundColor(){return this._backgroundColor?this._backgroundColor:"#fff"}get borderColor(){return this._borderColor?this._borderColor:"#ccc"}get borderWidth(){return this._borderWidth?this._borderWidth:1}get width(){return this._width}copyPropertiesTo(t){t.styles=Object.assign({},this.styles),this._dataScope&&(t._dataScope=this._dataScope.clone()),t._x=this._x,t._y=this._y,t._text=this._text,t._anchor=[this._anchor[0],this._anchor[1]],t._backgroundColor=this._backgroundColor,t._borderColor=this._borderColor,t._borderStroke=this._borderStroke}}class eT extends hE{constructor(t){super(),this.type=fE.GRID,this._numCols=t.numCols,this._numRows=t.numRows,this._start="start"in t?t.start:mE.TopLeft,this._direction="direction"in t?t.direction:yE.RowFirst,this._rowGap="rowGap"in t&&void 0!==t.rowGap?t.rowGap:5,this._colGap="colGap"in t&&void 0!==t.colGap?t.colGap:5,this._cellHorzAlignment="horzCellAlignment"in t&&dE("h",t.horzCellAlignment)?t.horzCellAlignment:Xw.LEFT,this._cellVertAlignment="vertCellAlignment"in t&&dE("v",t.vertCellAlignment)?t.vertCellAlignment:Xw.BOTTOM,this._numCols||this._numRows||(this._numRows=1),this._left=void 0,this._top=void 0,this._cellBounds=void 0,this._grid=void 0}get cellBounds(){return this._cellBounds}get numCols(){return this._numCols?this._numCols:this._numRows?Math.ceil(this.group.children.length/this._numRows):0}set numCols(t){this._numCols=t}set numRows(t){this._numRows=t}get numRows(){return this._numRows?this._numRows:this._numCols?Math.ceil(this.group.children.length/this._numCols):0}clone(){let t=new eT({numCols:this._numCols,numRows:this._numRows,start:this._start,direction:this._direction,colGap:this._colGap,rowGap:this._rowGap,horzCellAlignment:this._cellHorzAlignment,vertCellAlignment:this._cellVertAlignment});return t._left=this._left,t._top=this._top,this._cellBounds&&(t._cellBounds=this._cellBounds.map(t=>t.clone())),t}getElementsByRow(t,e){let n=[],r=this.group.children;for(let e=0;e<this.numRows;e++){let i=this._grid[e].filter(t=>null!=t).map(t=>r[t]);if(t){let t=[];for(let e of i)t=t.concat(lE(e));n.push(t)}else n.push(i)}return e&&(n=this._filterElementsByExample(n,e)),n}getElementsByCol(t,e){let n=[],r=this.group.children,i=this._grid;for(let e=0;e<this.numCols;e++){let o=i.map(t=>t[e]).filter(t=>null!=t).map(t=>r[t]);if(t){let t=[];for(let e of o)t=t.concat(lE(e));n.push(t)}else n.push(o)}return e&&(n=this._filterElementsByExample(n,e)),n}getElementsByCell(t,e){let n=[],r=this.group.children;for(let e=0;e<r.length;e++)if(t){let t=lE(r[e]);n.push(t)}else n.push(r[e]);return e&&(n=this._filterElementsByExample(n,e)),n}_filterElementsByExample(t,e){let n;return"vertex"===e.type?(n=t.map(t=>t.filter(t=>t.classId===e.parent.classId)),n=n.map(t=>tE(e,t))):"segment"===e.type?(n=t.map(t=>t.filter(t=>t.classId===e.parent.classId)),n=n.map(t=>eE(e,t))):n=t.map(t=>t.filter(t=>t.classId===e.classId)),n}getIndex(t){let e=t;for(;e&&e.parent!==this.group;)e=e.parent;return this.group.children.indexOf(e)}getRowCol(t){let e,n;switch(this._direction){case yE.RowFirst:e=Math.floor(t/this.numCols),n=t%this.numCols;break;case yE.ColumnFirst:e=t%this.numRows,n=Math.floor(t/this.numRows);break;default:throw new Error("Invalid fill direction. Use 'row_first' or 'column_first'.")}return this._start.toLowerCase().includes("bottom")&&(e=this.numRows-1-e),this._start.toLowerCase().includes("right")&&(n=this.numCols-1-n),{row:e,col:n}}get startCorner(){return this._start}set startCorner(t){this._start=t}get direction(){return this._direction}set direction(t){this._direction=t}}class nT extends YA{constructor(t,e){super(),this._type=bT.Axis,this._id=this._type+xT(),this._enc=t,this._textColor="textColor"in e?e.textColor:"#555",this._strokeColor="strokeColor"in e?e.strokeColor:"#555",this._fontSize="fontSize"in e?e.fontSize:"12px",this._x="x"in e?e.x:100,this._y="y"in e?e.y:100,this._showTitle=!("showTitle"in e)||e.showTitle,this._orientation="orientation"in e?e.orientation:vE,this._numberFormat=e.numberFormat?e.numberFormat:""}get attribute(){return this._enc.attribute}get channel(){return this._enc.channel}get attributeType(){return ET(this._enc.element).getFieldType(this.attribute)}get orientation(){return this._orientation}get textColor(){return this._textColor}}class rT extends nT{constructor(t,e){super(t,e),"numCols"in e||"numRows"in e?(this._numCols=e.numCols,this._numRows=e.numRows):this._orientation===vE?this._numCols=1:this._numRows=1,this._initialize()}_initialize(){let t=this._enc.element.scene,e=this._enc.attribute,n=this._enc.scales[0],r=new wT(n.domain.map(t=>({category:t,value:n.map(t)}))),i=r.getUniqueAttributeValues("category").sort((t,e)=>e.length-t.length)[0],o=this._enc.element,a=o instanceof kE&&o.closed&&"strokeColor"!==this._enc.channel?o.strokeWidth:0;if(this._orientation===vE){let n=0;this._showTitle&&(this.addChild(new ZA({fillColor:this._textColor,fontSize:this._fontSize,text:e,x:this._x,y:this._y,anchor:["left","top"]})),n=parseFloat(this._fontSize)+5);let s=t.mark("rect",{top:this._y+2+n,left:this._x,width:10,height:10,strokeWidth:a,strokeColor:o.strokeColor,opacity:o.opacity}),l=t.mark("text",{text:i,fillColor:this._textColor,fontSize:this._fontSize,x:this._x+20,y:this._y+n+12+a,anchor:["left","bottom"]}),c=t.glyph(s,l),u=t.repeat(c,r);t.encode(l,{channel:"text",attribute:"category",forLegend:!0}),t.encode(s,{channel:"fillColor",attribute:"category",shareScale:this._enc,forLegend:!0}),u.layout=new eT({numCols:this._numCols,numRows:this._numRows}),this.addChild(u)}else{let e=t.mark("rect",{top:this._y,left:this._x,width:10,height:10,strokeWidth:a,strokeColor:o.strokeColor,opacity:o.opacity}),n=t.mark("text",{text:i,fillColor:this._textColor,fontSize:this._fontSize,x:this._x+15,y:this._y,anchor:["left","top"]}),s=t.glyph(e,n),l=t.repeat(s,r);t.encode(n,{channel:"text",attribute:"category",forLegend:!0}),t.encode(e,{channel:"fillColor",attribute:"category",shareScale:this._enc,forLegend:!0}),l.layout=new eT({numCols:this._numCols,numRows:this._numRows,colGap:15}),this.addChild(l)}}}class iT extends nT{constructor(t,e){super(t,e),this._initialize()}_initialize(){let t,e,n,r=this._enc.element.scene,i=this._enc.attribute;if(this._orientation==vE?(t=15,e=300):(t=300,e=15),this._showTitle){let e=r.mark("text",{fillColor:this._textColor,text:i,x:this._x+t/2,y:this._y,anchor:["center","middle"]});this.addChild(e),n=20}else n=0;let o,a=r.mark("rect",{top:this._y+n,left:this._x,width:t,height:e,strokeWidth:0,opacity:this._enc.element.opacity}),s=Object.values(this._enc.attrValues),l=[Math.min(...s),Math.max(...s)],c=this._enc.mapping,u=[],h=[],f=Hl(this._numberFormat);if(c){let i=Object.keys(c).map(t=>parseFloat(t)).sort((t,e)=>t-e);this._orientation==vE?(o=new _E({x1:0,y1:100,x2:0,y2:0}),i.forEach(i=>{let a=(i-l[0])/(l[1]-l[0]);o.addStop(100*a,c[i],1);let s=r.mark("line",{x1:this._x+t,x2:this._x+t+5,y1:this._y+e-a*e+n,y2:this._y+e-a*e+n,strokeColor:this._strokeColor});h.push(s);let d=r.mark("text",{fillColor:this._textColor,text:this._numberFormat?f(i):i.toFixed(0),x:this._x+t+5+5,y:this._y+e-a*e+n,anchor:["left","middle"]});u.push(d)})):(o=new _E({x1:0,y1:0,x2:100,y2:0}),i.forEach(i=>{let a=(i-l[0])/(l[1]-l[0]);o.addStop(100*a,c[i],1);let s=r.mark("line",{x1:this._x+a*t,x2:this._x+a*t,y1:this._y+20-5+n,y2:this._y+e+5+n,strokeColor:this._strokeColor});h.push(s);let d=r.mark("text",{fillColor:this._textColor,text:this._numberFormat?f(i):i.toFixed(0),x:this._x+a*t,y:this._y+e+5+n,anchor:["center","top"]});u.push(d)}))}else{let a=this._enc.scales[0].domain,s=ET(this._enc.element),l=s.getAttributeType(i),c=[],d=l===$E.Date?s.getUniqueFieldValues(i):[...new Set(Object.values(this._enc.attrValues))];if(d.length<=10)c=d,c.sort((t,e)=>t-e);else if(l===$E.Date){d.sort((t,e)=>t-e);for(let t=0;t<d.length;t+=Math.ceil(d.length/10))c.push(d[t])}else{let t=(a[1]-a[0])/9;for(let e=0;e<10;e++)c.push(a[0]+e*t)}let p=0,g=(c[c.length-1]-c[0])/c.length;for(;g<1;)g*=10,p++;c=c.map(t=>t.toFixed(p)),this._orientation==vE?(o=new _E({x1:0,y1:100,x2:0,y2:0}),c.forEach(c=>{let d=(c-a[0])/(a[1]-a[0]);o.addStop(100*d,this._enc.scales[0].map(c),1);let p=r.mark("line",{x1:this._x+t,x2:this._x+t+5,y1:this._y+e-d*e+n,y2:this._y+e-d*e+n,strokeColor:this._strokeColor});h.push(p);let g=r.mark("text",{fillColor:this._textColor,text:l===$E.Date?s.getRawValue(i,c):this._numberFormat?f(c):c,x:this._x+t+5+5,y:this._y+e-d*e+n,anchor:["left","middle"]});u.push(g)})):(o=new _E({x1:0,y1:0,x2:100,y2:0}),c.forEach(c=>{let f=(c-a[0])/(a[1]-a[0]);o.addStop(100*f,this._enc.scale.map(c),1);let d=r.mark("line",{x1:this._x+f*t,x2:this._x+f*t,y1:this._y+e+n,y2:this._y+e+5+n,strokeColor:this._strokeColor});h.push(d);let p=r.mark("text",{fillColor:this._textColor,text:l===$E.Date?s.getRawValue(i,c):c,x:this._x+f*t,y:this._y+e+5+n,anchor:["center","top"]});u.push(p)}))}a.styles.fillColor=o,this.addChild(a);for(let t of u)this.addChild(t);for(let t of h)this.addChild(t)}}function oT(t,e,n,r){let i,o=t.domain,a=t.range;switch(t.type){case"linear":case"log":{let s=Math.abs(a[0]-a[1]);i="width"==e||"x"==e?45:30;let l,c=Math.max(2,Math.floor(s/i));if("width"==e||"height"==e){let i=!!r&&(r.elements[0].parent.layout&&r.elements[0].parent.layout.type==fE.STACK);o[1]=t._scale.invert(i?Ww(n)[e]:qw(n)[e])}if("log"===t.type){l=[];let e=t._scale.ticks();for(let t of e){let n=Math.log(t)/Math.log(10)+1e-6;Math.abs(n-Math.floor(n))<c/e.length&&l.push(t)}}else l=W(o[0],o[1],c);return l}case"point":{i="width"==e||"x"==e?80:30;let n=Math.floor(t.rangeExtent/o.length),r=Math.ceil(i/n);return"x"==e?o.filter((t,e)=>e%r==0):o}case"time":{i="width"==e||"x"==e?80:30;let t,n,r=Math.floor((a[1]-a[0])/i),s=Math.ceil((o[1]-o[0])/r)/1e3,l=[1,60,3600,86400,2628003,31536e3],c=[Wg,Xg,Qg,r_,z_,U_];for(let e=0;e<l.length-1;e++)if(s>=l[e]&&s<l[e+1])return t=Math.floor(s/l[e]),n=c[e],n(o[0],o[1],t);return s>l[l.length-1]?(t=Math.floor(s/l[l.length-1]),n=c[l.length-1],n(o[0],o[1],t)):[]}default:return[]}}function aT(t,e){e.removeChild(t)}class sT extends YA{constructor(t){super(),this._type=bT.Axis,this._id=t.id?t.id:this._type+xT(),this._attribute=void 0,this._channel=void 0,this._orientation=void 0,this._strokeColor="strokeColor"in t?t.strokeColor:"#555",this._textColor="textColor"in t?t.textColor:"#555",this._fontSize="fontSize"in t?t.fontSize:"12px",this._tickOffset="tickOffset"in t?t.tickOffset:0,this._tickSize="tickSize"in t?t.tickSize:5,this._tickAnchor=t.tickAnchor,this._tickVisible=!("tickVisible"in t)||t.tickVisible,this._pathVisible=!("pathVisible"in t)||t.pathVisible,this._labelVisible=!("labelVisible"in t)||t.labelVisible,this._labelOffset="labelOffset"in t?t.labelOffset:this._tickSize+this._tickOffset+3,this._labelFormat="labelFormat"in t?t.labelFormat:"",this._titleOffset="titleOffset"in t?t.titleOffset:40,this._rotateYTitle=!("rotateTitle"in t&&!t.rotateTitle),this._showTitle=!("titleVisible"in t)||t.titleVisible,this._labelRotation="labelRotation"in t?t.labelRotation:0,this._ticks=new YA,this._ticks._id=this._id+"_ticks",this.addChild(this._ticks),this._labels=new YA,this._labels._id=this._id+"_labels",this.addChild(this._labels),this._title=new ZA({text:this._titleText,fillColor:this._textColor,fontWeight:"bold"}),this._title._id=this.id+"_title",this.addChild(this._title),this._showTitle||(this._title.visibility="hidden"),this._pathPos=void 0,this._args=t}get id(){return this._id}get pathPosition(){return this._pathPos}get pathVisible(){return this._pathVisible}get attribute(){return this._attribute}get channel(){return this._channel}get orientation(){return this._orientation}get ticksVisible(){return this._tickVisible}get labelsVisible(){return this._labelVisible}get tickSize(){return this._tickSize}get tickOffset(){return this._tickOffset}get tickAnchor(){return this._tickAnchor?this._tickAnchor:"x"===this._channel||"width"===this._channel?"center":"middle"}get labelOffset(){return this._labelOffset}get labelFormat(){return this._labelFormat}get labelRotation(){return this._labelRotation}get tickValues(){return this._tickValues}get labelValues(){return this._labelValues}get titleOffset(){return this._titleOffset}get titleVisisble(){return this._showTitle}get boundsWithoutTitle(){let t=this.children.filter(t=>t.type!==bT.SimpleText),e=t[0].bounds.clone();for(let n=1;n<t.length;n++)"hidden"!=t[n].visibility&&(e=e.union(t[n].bounds));return e}get strokeColor(){return this._strokeColor}get textColor(){return this._textColor}}const lT="top",cT="bottom",uT="left";class hT extends sT{constructor(t,e,n,r){super(r),this._encoding=t,this._attribute=this._encoding.attribute,this._channel=this._encoding.channel,this._scale=e,this._elems=n,this._flip="flip"in r&&r.flip,this._posArg="x"==this._channel||"width"==this._channel?r.pathY:r.pathX,this._orientation="orientation"in r?r.orientation:"x"===this._channel||"width"==this._channel?cT:uT,this._titleText="title"in r?r.title:this._encoding.attribute,this._path="angle"===this._channel?new $A({strokeColor:this._strokeColor,id:this._id+"_path"}):new kE({strokeColor:this._strokeColor,id:this._id+"_path"}),this._pathVisible||(this._path.visibility="hidden"),this.addChild(this._path),this.createTicksLabels(r),t.dataTable.getAttributeType(this._attribute)!==$E.Date||"labelFormat"in r||(this._labelFormat="%m/%d/%y"),"radialDistance"===this._channel&&"rotation"in r&&(this._rotate=[-r.rotation,this._elems[0].parent.x,this._elems[0].parent.y])}isFlipped(){return this._flip}get elements(){return this._elems}get scale(){return this._scale}get encoding(){return this._encoding}get includeZero(){return this._encoding.includeZero}createTicksLabels(t){"tickValues"in t?(this._tickValues=t.tickValues,this._labelValues=t.tickValues):(this._tickValues=oT(this._scale,this._channel,this._elems,this),this._labelValues=this._tickValues),this._ticks.removeAll();for(let t=0;t<this._tickValues.length;t++){let e=new kE({strokeColor:this._strokeColor,id:this._id+"_tick"+t});this._tickVisible||(e.visibility="hidden"),this._ticks.addChild(e)}let e;switch(this._labels.removeAll(),this._encoding.dataTable.getAttributeType(this._attribute)){case $E.Date:e=iy(this._labelFormat);break;case $E.String:e=function(t){return t};break;default:e=Hl(this._labelFormat)}for(let[t,n]of this._labelValues.entries()){let r=new ZA({text:e(n),fontSize:this._fontSize,fillColor:this._textColor,id:this._id+"_label"+t});this._labelVisible||(r.visibility="hidden"),this._labels.addChild(r)}this._title._text=this._titleText}}class fT extends sT{constructor(t,e,n,r){super(r),this._elems=t,this._attribute=n,this._channel=e,this._posArg="x"==this._channel||"width"==this._channel?r.pathY:r.pathX,this._labelAttribute=r.labelAttribute,this._orientation="orientation"in r?r.orientation:"x"===this._channel||"width"==this._channel?cT:uT,this._titleText="title"in r?r.title:this._attribute,this._path="angle"===this._channel?new $A({strokeColor:this._strokeColor,id:this._id+"_path"}):new kE({strokeColor:this._strokeColor,id:this._id+"_path"}),this._pathVisible||(this._path.visibility="hidden"),this.addChild(this._path),this.createTicksLabels(r),this._elems[0].dataScope.dataTable.getAttributeType(this._attribute)!==$E.Date||"labelFormat"in r||(this._labelFormat="%m/%d/%y")}get elements(){if(this.layout.type===fE.CLUSTER){const t=new Map(this._elems.map(t=>[t.dataScope.getAttrVal(qE),t]));return this.layout._d3Root.leaves().map(e=>t.get(e.data[qE]))}return this._elems}get layout(){return this._elems[0].parent.layout}createTicksLabels(t){"tickValues"in t?(this._tickValues=t.tickValues,this._labelValues=t.tickValues):(this._tickValues=this.elements.map(t=>t.dataScope.getAttrVal(this._labelAttribute?this._labelAttribute:this._attribute)),this._labelValues=this._tickValues),this._ticks.removeAll();for(let t=0;t<this._tickValues.length;t++){let e=new kE({strokeColor:this._strokeColor,id:this._id+"_tick"+t});this._tickVisible||(e.visibility="hidden"),this._ticks.addChild(e)}let e;switch(this._labels.removeAll(),this._elems[0].dataScope.dataTable.getAttributeType(this._labelAttribute?this._labelAttribute:this._attribute)){case $E.Date:e=ny(this._labelFormat);break;case $E.String:e=function(t){return t};break;default:e=Hl(this._labelFormat)}for(let[t,n]of this._labelValues.entries()){let r=new ZA({text:e(n),fontSize:this._fontSize,fillColor:this._textColor,id:this._id+"_label"+t});this._labels.addChild(r)}this._title._text=this._titleText}}class dT extends YA{constructor(t){super(),this._type=bT.Composite,this._id=t&&t.id?t.id:this._type+xT()}addChild(t){let e=t.parent;super.addChild(t);let n=aE(t)._depGraph;e&&IA(e,t,n),LA(this,t,n)}}function pT(t,e){let n;switch(e.type){case"collection":n=_T(e);break;case"glyph":n=function(t){let e=new qA(t);return e}(e);break;case"axis":n=function(t){if("encoding"===t.axisType){return new hT(t.enc,t.scale,t.elems,t)}if("layout"===t.axisType){return new fT(t.elems,t.channel,t.attribute,t)}}(e);break;case"legend":n=function(t){let e="string"===t.attrType?new rT(t.enc,t):new iT(t.enc,t);return e}(e);break;case"composite":n=function(t){let e=new dT(t);return e}(e);break;default:n=gT(e)}return t.addChild(n),t._itemMap[n.id]=n,n}function gT(t){let e=null;switch(t.type){case bT.Circle:e=new $A(t);break;case bT.Line:var n="x1"in t?t.x1:0,r="y1"in t?t.y1:0,i="x2"in t?t.x2:100,o="y2"in t?t.y2:100;t.vertices=[[n,r],[i,o]],e=new KA(t);break;case bT.Rect:var a="top"in t?t.top:0,s="left"in t?t.left:0,l="width"in t?t.width:50,c="height"in t?t.height:30;t.vertices=[[s,a],[s+l,a],[s+l,a+c],[s,a+c]],e=new bA(t);break;case bT.SimpleText:e=new ZA(t);break;case bT.RichText:e=new tT(t);break;case bT.Image:e=new XA(t);break;case bT.BundledPath:case bT.Chord:case bT.Path:e=new kE(t);break;case bT.Area:e=new vA(t);break;case bT.Ring:e=new QA(t);break;case bT.Arc:e=new IE(t);break;case bT.BezierCurve:"vertices"in t||(t.vertices=[[0,100],[20,120],[80,180],[100,200]]),e=new WA(t);break;case bT.Polygon:e=new JA(t)}return e&&e._updateBounds(),e}function _T(t){return new HA(t)}function yT(t){switch(t.type){case bT.Collection:return function(t){let e=_T({});for(let n=0;n<t.children.length;n++){let r=t.children[n];e.addChild(yT(r))}if(e._classId=t.classId,t._layout){let n=t._layout.clone();e._layout=n,n.group=e}return e._updateBounds(),e}(t);case bT.Glyph:return function(t){let e=new qA;for(let n of t.children)e.addChild(yT(n));e._classId=t.classId,t._dataScope&&(e.dataScope=t._dataScope.clone());return e}(t);default:return function(t){let e=gT({type:t.type});t.copyPropertiesTo(e),e._classId=t.classId,e._bounds=t.bounds.clone(),t._refBounds||(t._refBounds=t.bounds.clone());e._refBounds=t._refBounds.clone(),t.dataScope&&(e._dataScope=t.dataScope.clone());if(t.vertices)for(let n=0;n<t.vertices.length;n++)t.vertices[n].dataScope&&(e.vertices[n]._dataScope=t.vertices[n].dataScope.clone());return e}(t)}}const mT=Object.freeze({Rect:"rect",Circle:"circle",Line:"line",Ring:"ring",Path:"path",Image:"image",SimpleText:"text",RichText:"richText",Arc:"arc",BezierCurve:"bezierCurve",BundledPath:"bundledPath",Chord:"chord"}),bT=Object.freeze({Area:"area",Rect:"rect",Ellipse:"ellipse",Circle:"circle",Pie:"pie",Ring:"ring",Arc:"arc",BezierCurve:"bezierCurve",BundledPath:"bundledPath",Chord:"chord",Line:"line",Path:"path",Image:"image",SimpleText:"text",RichText:"richText",Collection:"collection",Group:"group",Composite:"composite",Scene:"scene",Axis:"axis",Glyph:"glyph",Legend:"legend",Polygon:"polygon",Gridlines:"gridlines",LinearGradient:"LinearGradient",Link:"link",DataTable:"datatable",Layout:"layout",NetworkData:"networkdata",TreeData:"treedata"}),vT=Object.freeze({Axis:"axis",Legend:"legend",Gridlines:"gridlines"});function xT(){return Date.now().toString(36)+"_"+Math.random().toString(36).slice(2)}class wT{constructor(t,e,n){this._id=bT.DataTable+xT(),this.initialize(t,e,n)}initialize(t,e,n){if(this.url=e,this._rawData=JSON.parse(JSON.stringify(t)),this._data=t,this._dateMap=new Map,this._attributes=0===this._data.length?[]:Object.keys(this._data[0]),this._newAttribute=0,n)this._attrTypes=n;else{this._attrTypes={};for(let t of this._attributes)this._attrTypes[t]=XE(this.data.map(e=>e[t])),"year"==t.toLowerCase()&&this._attrTypes[t]==$E.Integer&&(this._attrTypes[t]=$E.Date)}this._validate(this.data,this._attrTypes),this._attrSummaries={};for(let t of this._attributes)this._attrSummaries[t]=ZE(this.data.map(e=>e[t]),this._attrTypes[t]);this._attributes.indexOf(AT)<0&&this._addAttribute(AT,$E.String,this.data.map((t,e)=>"r"+e))}clone(){let t=[];for(let e of this._data)t.push(Object.assign({},e));let e=new wT(t,this.url,Object.assign({},this._attrTypes));return e.sourceDataTable=this,e}get id(){return this._id}get name(){return this.url?function(t){var e=t.indexOf("\\")>=0?t.lastIndexOf("\\"):t.lastIndexOf("/"),n=t.substring(e);0!==n.indexOf("\\")&&0!==n.indexOf("/")||(n=n.substring(1));return n}(this.url):this.id}get data(){return this._data}getEncodableAttributes(t){switch(t){case"x":case"y":case"width":case"height":case"radius":case"fillColor":case"strokeColor":case"text":return this.numericAttributes.concat(this.nonNumericAttributes);default:return this.numericAttributes}}_addAttribute(t,e,n){this._data.forEach((e,r)=>e[t]=n[r]),t!==AT&&this._rawData.forEach((e,r)=>e[t]=n[r]),this._attrTypes[t]=e,this._attributes.push(t),this._attrSummaries[t]=ZE(n,e)}getAttributeType(t){return this._attrTypes[t]}get attributes(){return this._attributes}getAttributeSummary(t){return this._attrSummaries[t]}getAttributeValues(t){return this.data.map(e=>e[t])}getUniqueAttributeValues(t){return this._attrSummaries[t].unique}orderAttributeValues(t,e){this._attrSummaries[t].unique=e}getRowCount(){return this.data.length}hasAttribute(t){return this._attributes.indexOf(t)>=0}parseAttributeAsDate(t,e){let n=ry(e);for(let e of this.data){let r=e[t];null==r||null==r?(r="",e[t]=new Date(1899,11,31).getTime()):e[t]=n(r).getTime(),this._dateMap.set(e[t],r)}this._attrTypes[t]=$E.Date,this._attrSummaries[t]=ZE(this.data.map(e=>e[t]),$E.Date)}getRawValue(t,e){return this.getAttributeType(t)===$E.Date?this._dateMap.get(e).toString():e}get nonNumericAttributes(){let t=[];for(let e in this._attrTypes)this._attrTypes[e]!=$E.Number&&this._attrTypes[e]!=$E.Integer&&e!=wT.RowID&&t.push(e);return t.sort((t,e)=>this.getUniqueAttributeValues(t).length-this.getUniqueAttributeValues(e).length),t}get numericAttributes(){let t=[];for(let e in this._attrTypes)this._attrTypes[e]!==$E.Number&&this._attrTypes[e]!==$E.Integer||e==wT.RowID||t.push(e);return t}getAttributesByType(t){let e=[];for(let n in this._attrTypes)this._attrTypes[n]===t&&n!=wT.RowID&&e.push(n);return e}summarize(){for(let t of this._attributes)this._attrSummaries[t]=ZE(this.data.map(e=>e[t]),this._attrTypes[t])}_validate(t,e){for(let n of t)for(let t in e){let r,i=e[t],o=n[t];if(null==n[t]||null==n[t])switch(i){case $E.Boolean:r=!1;break;case $E.Date:r=new Date(1899,11,31).getTime();break;case $E.String:r="";break;default:r=0}else switch(i){case $E.Boolean:r=o;break;case $E.Date:r=Number.isInteger(o)?new Date(o,0).getTime():new Date(o+"").getTime(),this._dateMap.set(r,o);break;case $E.String:r=o.toString();break;default:r=o}n[t]=r}}}function ET(t){let e=zE(t);if(e)return e.dataTable}const AT="mascot_rowId";function TT(t,e){return fetch(e,{method:t}).then(t=>t.ok?t.text():(console.log(t.status),Promise.reject({status:t.status,statusText:t.statusText}))).catch(t=>(console.log(t),Promise.reject({status:t.status,statusText:t.statusText})))}class CT extends eA{constructor(t,e){super(t),this._elem=e}get element(){return this._elem}}class ST extends eA{constructor(t,e){super(t),this._item=e}get element(){return this._item}}class kT{constructor(t){this._id=t+"_"+xT(),this._type=t,this._vars=[],this._edges=[]}get vars(){return this._vars}get edges(){return this._edges}run(){console.log("-",this._type)}}class MT{constructor(t,e,n=!0){this._id="e_"+xT(),this._fromNode=t,this._toNode=e,this._isDirected=n}get id(){return this._id}get fromNode(){return this._fromNode}get toNode(){return this._toNode}get isDirected(){return this._isDirected}get operator(){return this._fromNode instanceof pE||this._fromNode instanceof kT?this._fromNode:this._toNode}}class RT extends eA{constructor(t,e,n){super(t),this._attribute=e,this._dataset=n}get attribute(){return this._attribute}get dataset(){return this._dataset}}class OT{constructor(t,e){switch(this._id="scale_"+xT(),this._type=t,e&&(this._args=e),t){case"linear":this._scale=gg();break;case"point":this._scale=rg();break;case"ordinal":this._scale=tg();break;case"ordinalColor":this._scale=tg(Nw[e.scheme]);break;case"power":this._scale=Ng().exponent(2);break;case"sqrt":this._scale=Ng().exponent(.5);break;case"log":this._scale=Ag();break;case"identity":case"time":this._scale=Rm();break;case"sequentialColor":e.scheme?this._scale=Im(Nw[e.scheme]):this._scale=Im()}}get id(){return this._id}get domain(){return this._scale.domain()}set domain(t){this._scale.domain(t)}get range(){return this._scale.range()}set range(t){this._scale.range(t)}get rangeExtent(){let t=this._scale.range();return Math.abs(t[1]-t[0])}set rangeExtent(t){let e=this._scale.range();e[0]<e[1]?this._scale.range([e[0],e[0]+t]):this._scale.range([e[1]+t,e[1]])}get type(){return this._type}map(t){return this._scale(t)}invert(t,e){let n=Math.min(...this._scale.range()),r=Math.max(...this._scale.range()),i=t;return e||(i=Math.max(n,Math.min(t,r))),"time"===this._type?this._scale.invert(i).getTime():this._scale.invert(i)}}const NT=["schemeBrBG","schemePRGn","schemePiYG","schemePuOr","schemeRdBu","schemeRdGy","schemeRdYlBu","schemeRdYlGn","schemeSpectral"],IT=["schemeBlues","schemeGreens","schemeGreys","schemeOranges","schemePurples","schemeReds","schemeBuGn","schemeBuPu","schemeGnBu","schemeOrRd","schemePuBuGn","schemePuBu","schemePuRd","schemeRdPu","schemeYlGnBu","schemeYlGn","schemeYlOrBr","schemeYlOrRd"];class LT{constructor(){this._map={}}clear(){this._map={}}setValue(t,e){this._map[t]=e}getValue(t){return this._map[t]}}class PT extends eA{constructor(t,e){super(t),this._encs=[e],this._valueMap=new LT}addLinkedEncoding(t){this._encs.push(t)}get encodings(){return this._encs}get attrValues(){return this._valueMap}set attrValues(t){this._valueMap=t}}class VT extends pE{constructor(t){super(t)}run(){super.run();let t=this.inputVars.find(t=>t instanceof PT),e=this.outputVar,n=e.encodings,r=n[0],i=r.channel,o=r.attribute,a=t.encodings[0].dataTable.getAttributeType(t.encodings[0].attribute),s=Object.values(t.attrValues);if("angle"===r.channel&&[bT.Arc,bT.Pie].indexOf(r.element.type)>=0)for(let e of t.encodings)for(let t of e.scales){let n=e.getElements(t).map(t=>e.attrValues[t.id]);t.domain=r._preferredDomain?r._preferredDomain:e.dataTable.tree?[0,e.dataTable.tree.getRoot()[o]]:this._getDomainForNumbers(n),console.log("domain for",o,t.domain)}else{let e;e=r._preferredDomain?r._preferredDomain:a==$E.String||"text"===t.encodings[0].channel?this._getDomainForStrings(s):this._getDomainForNumbers(s);for(let n of t.encodings)for(let t of n.scales)t.domain=e.slice()}for(let t=0;t<r.scales.length;t++){let o=r.scales[t],a=r.getElements(o),s=this._buildRange(i,a,r,e);if(s)for(let e of n)e.scales[t].range=s}e.initialized=!0}_getDomainForNumbers(t){let e=this.outputVar.encodings[0],n=[Math.min(...t),Math.max(...t)];if(e.includeZero&&n[0]>0&&(n=[0,Math.max(...t)]),e.mapping)n=Object.keys(e.mapping),n=n.map(t=>parseFloat(t)),n.sort((t,e)=>t-e);else if("sequentialColor"===e.scales[0].type){if(n[0]<0&&n[1]>0){let t=Math.max(Math.abs(n[0]),Math.abs(n[1]));n=[-t,t]}}else if("angle"===e.channel){let e=Object.values(t).reduce((t,e)=>t+e,0);n=[0,e]}return n}_getDomainForStrings(t){let e,n=this.outputVar,r=n.encodings[0];return e="count"==n.encodings[0].aggregator?[0,Math.max(...t)]:Array.from(new Set(t)),r.mapping&&(e=Object.keys(r.mapping)),e}_buildRange(t,e,n,r){return"x"===t?this._buildXRange(e,n,r):"y"===t?this._buildYRange(e,n,r):["width","height","radius","area","fontSize","radialDistance","strokeWidth"].includes(t)?this._buildSizeRange(e,n,r):t.indexOf("Color")>0||"fillGradient"===t?this._buildColorRange(e,n):"angle"===t?this._buildAngleRange(e,n):"thickness"===t?this._buildThicknessRange(e,n,r):"src"===t?n.scales[0].domain.slice():void 0}_buildThicknessRange(t,e,n){let r=t.map(t=>t.outerRadius-t.innerRadius);return[0,n.initialized?e.getRangeExtent(t[0]):e._preferredRangeExtent?e._preferredRangeExtent:Math.max(...r)]}_buildAngleRange(t,e){return[0,360]}_buildColorRange(t,e){if(e.mapping){return e.scales[0].domain.map(t=>e.mapping[t+""])}if("sequentialColor"===e.scales[0].type){let t=this.outputVar,n=e.scales[0].domain;for(let r of t.encodings)if(!e.colorScheme)for(let t of r.scales){let e=t.domain;t._scale=Im(n[0]<0&&n[1]>0?rb:rv),t._scale.domain(e)}}if((NT.indexOf(e.colorScheme)>=0||IT.indexOf(e.colorScheme)>=0)&&"ordinalColor"===e.scales[0].type){let t=this.outputVar,n=e.scales[0].domain;for(let r of t.encodings)for(let t of r.scales){let r=t.domain;t._scale=tg(Nw[e.colorScheme][n.length]),t._scale.domain(r)}}}_buildSizeRange(t,e,n){let r,i;return r=0,i=n.initialized?e.getRangeExtent(t[0]):e._preferredRangeExtent?e._preferredRangeExtent:Math.max(...t.map(t=>"radius"===e.channel?t.refBounds.width/2:"strokeWidth"===e.channel?t.strokeWidth:"radialDistance"===e.channel?t.parent.radius:"area"===e.channel?t.type===bT.Circle?Math.PI*Math.pow(t.radius,2):t.width*t.height:"fontSize"===e.channel?parseFloat(t.fontSize):t.refBounds[e.channel])),[0,0+i]}_buildXRange(t,e,n){let r,i;switch(e.scales[0].type,t[0].type){case"vertex":case"segment":var o=t[0].parent.refBounds?t[0].parent.refBounds:t[0].parent.bounds;r=n.initialized?e.getRangeStart(t[0]):o.left,i=n.initialized?e.getRangeExtent(t[0]):e._preferredRangeExtent?e._preferredRangeExtent:o.width;break;default:r=n.initialized?e.getRangeStart(t[0]):e._preferredRangeStart?e._preferredRangeStart:sE(t[0]).bounds.left+t[0].bounds.width/2,i=n.initialized?e.getRangeExtent(t[0]):e._preferredRangeExtent?e._preferredRangeExtent:Math.max(450,Math.max(...t.map(t=>t.bounds.x))-Math.min(...t.map(t=>t.bounds.x)))}return e.flipScale?[r+i,r]:[r,r+i]}_buildYRange(t,e,n){let r,i;switch(e.scales[0].type,t[0].type){case"vertex":case"segment":var o=t[0].parent.refBounds?t[0].parent.refBounds:t[0].parent.bounds;r=n.initialized?e.getRangeStart(t[0]):o.top,i=n.initialized?e.getRangeExtent(t[0]):e._preferredRangeExtent?e._preferredRangeExtent:o.height;break;default:r=n.initialized?e.getRangeStart(t[0]):sE(t[0]).bounds.top+t[0].bounds.height/2,i=n.initialized?e.getRangeExtent(t[0]):e._preferredRangeExtent?e._preferredRangeExtent:450}return e.flipScale?[r,r+i]:[r+i,r]}}class DT extends pE{constructor(t){super(t)}run(){super.run()}}class BT extends pE{constructor(t){super(t)}run(){super.run();let t=this.inputVars.find(t=>t instanceof AA&&t.property==SA.AXIS_ORIENTATION).element;t.createTicksLabels(t._args),t instanceof hT?this._runForEncoding(t):t instanceof fT&&this._runForLayout(t),$w(t._path)}_runForLayout(t){let e=t.channel,n=t.elements[0].parent.layout&&t.elements[0].parent.layout.type==fE.STACK?Ww(t.elements):qw(t.elements),r=[];if("x"===e){let e=t.orientation===lT?n.top-2:n.bottom+2;t._pathPos=t._posArg?t._posArg:e,r.push([n.left,t._pathPos]),r.push([n.right,t._pathPos]),t._path._setVertices(r)}else if("y"===e){let e=t.orientation===uT?n.left-2:n.right+2;t._pathPos=t._posArg?t._posArg:e,r.push([t._pathPos,n.top]),r.push([t._pathPos,n.bottom]),t._path._setVertices(r)}else if("angle"===e){let e=t.elements[0].parent.layout;e.type===fE.CLUSTER&&(t._path._x=e.x,t._path._y=e.y,t._path._radius=e.radius)}}_runForEncoding(t){let e=t.channel,n=t.elements,r=n[0].parent.layout&&n[0].parent.layout.type==fE.STACK?Ww(n):qw(n),i=[],o=sE(n[0]);if(o&&o.clipMask&&(r=o.clipMask),"x"===e){let e,o,a=sA(n[0],"y");a?(e=Math.min(...a.getScale(n[0]).range,r.top),o=Math.max(...a.getScale(n[0]).range,r.bottom)):(e=r.top,o=r.bottom);let s=t.orientation===lT?e-2:o+2;t._pathPos=t._posArg?t._posArg:s,i.push([t.scale.range[0],t._pathPos]),i.push([t.scale.range[1],t._pathPos])}else if("width"===e){let e=t.orientation===lT?r.top-2:r.bottom+2;t._pathPos=t._posArg?t._posArg:e,i.push([r.left,t._pathPos]),i.push([r.right,t._pathPos])}else if("radialDistance"===e){let e=t.elements[0].parent,n=e.y;t._pathPos=t._posArg?t._posArg:n,i.push([t.scale.range[0]+e.x,t._pathPos]),i.push([t.scale.range[1]+e.x,t._pathPos])}else if("y"===e){let e,o,a=sA(n[0],"x");a?(e=Math.min(...a.getScale(n[0]).range,r.left),o=Math.max(...a.getScale(n[0]).range,r.right)):(e=r.left,o=r.right);let s=t.orientation===uT?e-2:o+2;t._pathPos=t._posArg?t._posArg:s,i.push([t._pathPos,t.scale.range[0]]),i.push([t._pathPos,t.scale.range[1]])}else if("height"===e){let e=t.orientation===uT?r.left-2:r.right+2;t._pathPos=t._posArg?t._posArg:e,i.push([t._pathPos,r.bottom]),i.push([t._pathPos,r.top])}t._path._setVertices(i)}}class zT extends pE{constructor(t){super(t)}run(){super.run();let t=this.inputVars.find(t=>t instanceof AA&&t.property==SA.AXIS_PATH_POSITION).element;t instanceof hT?this._runForEncoding(t):t instanceof fT&&this._runForLayout(t);let e=[];if("width"===t.channel||"x"===t.channel){let n=t._ticks.children.map(t=>t.vertices[0].x),r=[t._path.vertices[0].x,t._path.vertices[1].x];e.push([Math.min(...n.concat(r)),t._path.vertices[0].y]),e.push([Math.max(...n.concat(r)),t._path.vertices[0].y]),t._path._setVertices(e)}else if("height"===t.channel||"y"===t.channel){let n=t._ticks.children.map(t=>t.vertices[0].y),r=[t._path.vertices[0].y,t._path.vertices[1].y];e.push([t._pathPos,Math.min(...n.concat(r))]),e.push([t._pathPos,Math.max(...n.concat(r))]),t._path._setVertices(e)}for(let e of t._ticks.children)e._updateBounds();$w(t._ticks)}_runForLayout(t){let e=t.channel;if("x"==e){let e=t.orientation==cT?t._pathPos+t.tickOffset:t._pathPos-t.tickOffset,n=t.orientation==cT?t.tickSize:-t.tickSize;for(let[r,i]of t._ticks.children.entries()){let o=t.elements[r].bounds[t.tickAnchor];i._setVertices([[o,e],[o,e+n]])}}else if("y"===e){let e=t.orientation==uT?t._pathPos-t.tickOffset:t._pathPos+t.tickOffset,n=t.orientation==uT?-t.tickSize:t.tickSize;for(let[r,i]of t._ticks.children.entries()){let o=t.elements[r].bounds[t.tickAnchor];i._setVertices([[e,o],[e+n,o]])}}else if("angle"===e){let e=t.elements[0].parent.layout;if(e.type===fE.CLUSTER){let n=e._d3Root.leaves();const r=new Map(n.map(t=>[t.data[qE],[t.x,t.y]]));for(let[n,i]of t._ticks.children.entries()){let o=t.elements[n].dataScope.getAttrVal(qE),a=PE(r.get(o)[0])-90;i._setVertices([[e.x+r.get(o)[1]+t.elements[n].bounds.width/2,e.y],[e.x+r.get(o)[1]+t.elements[n].bounds.width/2+t.tickSize,e.y]]),i._rotate=[a,e.x,e.y]}}}}_runForEncoding(t){let e=t.channel,n=qw(t.elements);if("x"==e){let e=t.orientation==cT?t._pathPos+t.tickOffset:t._pathPos-t.tickOffset,n=t.orientation==cT?t.tickSize:-t.tickSize;for(let[r,i]of t._ticks.children.entries())i._setVertices([[t.scale.map(t._tickValues[r]),e],[t.scale.map(t._tickValues[r]),e+n]])}else if("width"==e){let e=t.orientation==cT?t._pathPos+t.tickOffset:t._pathPos-t.tickOffset,r=t.orientation==cT?t.tickSize:-t.tickSize;if(!!(t.isFlipped()||t.elements[0].type===bT.Area&&"right"===t.elements[0].baseline))for(let[i,o]of t._ticks.children.entries())o._setVertices([[n.left+t.scale.rangeExtent-t.scale.map(t._tickValues[i]),e],[n.left+t.scale.rangeExtent-t.scale.map(t._tickValues[i]),e+r]]);else for(let[i,o]of t._ticks.children.entries())o._setVertices([[t.scale.map(t._tickValues[i])+n.left,e],[t.scale.map(t._tickValues[i])+n.left,e+r]])}else if("y"===e){let e=t.orientation==uT?t._pathPos-t.tickOffset:t._pathPos+t.tickOffset,n=t.orientation==uT?-t.tickSize:t.tickSize;for(let[r,i]of t._ticks.children.entries())i._setVertices([[e,t.scale.map(t._tickValues[r])],[e+n,t.scale.map(t._tickValues[r])]])}else if("height"===e){let e=t.orientation==uT?t._pathPos-t.tickOffset:t._pathPos+t.tickOffset,r=t.orientation==uT?-t.tickSize:t.tickSize;if(!!(t.isFlipped()||t.elements[0].type===bT.Area&&"top"===t.elements[0].baseline))for(let[i,o]of t._ticks.children.entries())o._setVertices([[e,n.top+t.scale.map(t._tickValues[i])],[e+r,n.top+t.scale.map(t._tickValues[i])]]);else for(let[i,o]of t._ticks.children.entries()){let a=n.bottom-t.scale.map(t._tickValues[i]);o._setVertices([[e,a],[e+r,a]])}}else if("radialDistance"===e){let e=t.orientation==cT?t._pathPos+t.tickOffset:t._pathPos-t.tickOffset,n=t.orientation==cT?t.tickSize:-t.tickSize,r=t.elements[0].parent;for(let[i,o]of t._ticks.children.entries())o._setVertices([[r.x+t.scale.map(t._tickValues[i]),e],[r.x+t.scale.map(t._tickValues[i]),e+n]])}}}class FT extends pE{constructor(t){super(t)}run(){super.run();let t=this.inputVars.find(t=>t instanceof AA&&t.property==SA.AXIS_PATH_POSITION).element;t instanceof hT?this._runForEncoding(t):t instanceof fT&&this._runForLayout(t);for(let e of t._labels.children)e._updateBounds();$w(t._labels)}_runForLayout(t){let e=t.channel;if("x"==e){let e=t.orientation==cT?t.labelOffset:-t.labelOffset,n=t.orientation==cT?[Xw.CENTER,Xw.TOP]:[Xw.CENTER,Xw.BOTTOM];for(let[r,i]of t._labels.children.entries()){let o=t.elements[r].bounds;i.x=o[t.tickAnchor],i._y=t._pathPos+e,i._anchor=n,t._labelRotation&&(i._rotate=[t._labelRotation,i.x,i.y],i._anchor=[Xw.RIGHT,Xw.MIDDLE])}}else if("y"===e){let e=t.orientation==uT?-t.labelOffset:t.labelOffset,n=t.orientation==uT?[Xw.RIGHT,Xw.MIDDLE]:[Xw.LEFT,Xw.MIDDLE];for(let[r,i]of t._labels.children.entries()){let o=t.elements[r].bounds;i.x=t._pathPos+e,i._y=t.tickAnchor==Xw.MIDDLE?o.y:o[t.tickAnchor],i._anchor=n,t._labelRotation&&(i._rotate=[t._labelRotation,i.x,i.y],i._anchor=[Xw.RIGHT,n[1]])}}else if("angle"===e){let e=t.elements[0].parent.layout;if(e.type===fE.CLUSTER){let n=e._d3Root.leaves();const r=new Map(n.map(t=>[t.data[qE],[t.x,t.y]]));let i=5;for(let[n,o]of t._labels.children.entries()){let a=t.elements[n].dataScope.getAttrVal(qE);if(r.get(a)[0]<Math.PI){let s=PE(r.get(a)[0])-90;o._anchor=[Xw.LEFT,Xw.MIDDLE],o.x=e.x+r.get(a)[1]+t.elements[n].bounds.width/2+i,o._y=e.y,o._rotate=[s,e.x,e.y]}else{let s=PE(r.get(a)[0])+90;o._anchor=[Xw.RIGHT,Xw.MIDDLE],o.x=e.x-r.get(a)[1]-t.elements[n].bounds.width/2-i,o._y=e.y,o._rotate=[s,e.x,e.y]}}}}}_runForEncoding(t){let e=t.channel,n=qw(t.elements);if("x"==e){let e=t.orientation==cT?t.labelOffset:-t.labelOffset,n=t.orientation==cT?[Xw.CENTER,Xw.TOP]:[Xw.CENTER,Xw.BOTTOM];for(let[r,i]of t._labels.children.entries())i.x=t.scale.map(t.labelValues[r]),i._y=t._pathPos+e,i._anchor=n,t._labelRotation&&(i._rotate=[t._labelRotation,i.x,i.y],i._anchor=[Xw.RIGHT,n[1]])}else if("width"===e){let e=t.orientation==cT?t.labelOffset:-t.labelOffset,r=t.orientation==cT?[Xw.CENTER,Xw.TOP]:[Xw.CENTER,Xw.BOTTOM],i=!!(t.isFlipped()||t.elements[0].type===bT.Area&&"right"===t.elements[0].baseline);for(let[o,a]of t._labels.children.entries())a.x=i?n.left+t.scale.rangeExtent-t.scale.map(t.labelValues[o]):t.scale.map(t.labelValues[o])+n.left,a._y=t._pathPos+e,a._anchor=r,t._labelRotation&&(a._rotate=[t._labelRotation,a.x,a.y],a._anchor=[Xw.RIGHT,r[1]])}else if("y"===e){let e=t.orientation==uT?-t.labelOffset:t.labelOffset,n=t.orientation==uT?[Xw.RIGHT,Xw.MIDDLE]:[Xw.LEFT,Xw.MIDDLE];for(let[r,i]of t._labels.children.entries())i.x=t._pathPos+e,i._y=t.scale.map(t.labelValues[r]),i._anchor=n,t._labelRotation&&(i._rotate=[t._labelRotation,i.x,i.y],i._anchor=[Xw.RIGHT,n[1]])}else if("height"===e){let e=t.orientation==uT?-t.labelOffset:t.labelOffset,r=t.orientation==uT?[Xw.RIGHT,Xw.MIDDLE]:[Xw.LEFT,Xw.MIDDLE],i=t.elements[0].type===bT.Area&&"top"===t.elements[0].baseline;for(let[o,a]of t._labels.children.entries())a.x=t._pathPos+e,a._y=i?n.top+t.scale.map(t.labelValues[o]):n.bottom-t.scale.map(t.labelValues[o]),a._anchor=r,t._labelRotation&&(a._rotate=[t._labelRotation,a.x,a.y],a._anchor=[Xw.RIGHT,r[1]])}else if("radialDistance"==e){let e=t.orientation==cT?t.labelOffset:-t.labelOffset,n=t.orientation==cT?[Xw.CENTER,Xw.TOP]:[Xw.CENTER,Xw.BOTTOM],r=t.elements[0].parent;for(let[i,o]of t._labels.children.entries())o.x=r.x+t.scale.map(t.labelValues[i]),o._y=t._pathPos+e,o._anchor=n,t._labelRotation&&(o._rotate=[t._labelRotation,o.x,o.y],o._anchor=[Xw.RIGHT,n[1]])}}}class GT extends pE{constructor(t){super(t)}run(){super.run();let t=this._outputVars[0].element,e=Qw(t.parent);for(let t of e){let e=t.layout;if(!e)return;this.fillGrid(t,e),this.computeCellBounds(t,e),this.placeElements(t,e)}let n=lE(t,!0);for(let t of n)$w(t)}placeElements(t,e){let n=cA(t,"x"),r=cA(t,"y");for(let n=0;n<t.children.length;n++){let r=t.children[n],i=e.cellBounds[n],o=0,a=0;switch(e._cellHorzAlignment){case Xw.LEFT:o=i.left-r.refBounds.left;break;case Xw.CENTER:o=i.x-r.refBounds.x;break;case Xw.RIGHT:o=i.right-r.refBounds.right}switch(e._cellVertAlignment){case Xw.TOP:a=i.top-r.refBounds.top;break;case Xw.MIDDLE:a=i.y-r.refBounds.y;break;case Xw.BOTTOM:a=i.bottom-r.refBounds.bottom}dA(r,o,a)}if(n.length>0)for(let t of n)for(let n of t.scales){let r=t.getElements(n)[0],i=e.getIndex(r);if(i<0)continue;let o="point"===n.type?e.cellBounds[i].left+r.bounds.width/2:e.cellBounds[i].left,a=o+n.rangeExtent;n.range=n.range[0]<n.range[1]?[o,a]:[a,o]}if(r.length>0)for(let t of r)for(let n of t.scales){let r=t.getElements(n)[0],i=e.getIndex(r);if(i<0)continue;let o="point"===n.type?e.cellBounds[i].top+t.getElements(n)[0].bounds.height/2:e.cellBounds[i].top,a=o+n.rangeExtent;n.range=n.range[0]<n.range[1]?[o,a]:[a,o]}}fillGrid(t,e){e._grid=new Array(e.numRows).fill(null).map(()=>new Array(e.numCols).fill(null));for(let n=0;n<t.children.length;n++){let t=e.getRowCol(n);e._grid[t.row][t.col]=n}}computeCellBounds(t,e){let n=t.children.map(t=>t.refBounds?t.refBounds:t.bounds),r=e._colGap,i=e._rowGap;if(void 0===e._left){let t=n.map(t=>t.left),r=n.map(t=>t.top);e._left=Math.min(...t),e._top=Math.min(...r)}let o=n.map(t=>t.width),a=n.map(t=>t.height),s=Math.max(...o),l=Math.max(...a);e._cellBounds=new Array(t.children.length).fill(null);for(let n=0;n<e.numRows;n++)for(let o=0;o<e.numCols;o++){let a=e._grid[n][o];a>=t.children.length||(e._cellBounds[a]=new Yw(e._left+(s+r)*o+0,e._top+(l+i)*n,s,l))}}}class jT extends pE{constructor(t){super(t)}run(){let t=this.outputVar.element;t.updateValues(),t.scale?this._runForEncoding(t):this._runForLayout(t),$w(t)}_runForLayout(t){let e=t.channel,n=qw(t.elements),r=[];if("x"===e)for(let e=0;e<t.values.length;e++){let i=t.elements[e].refBounds;r.push({x1:i.x,y1:n.bottom,x2:i.x,y2:n.top})}else if("y"===e)for(let e=0;e<t.values.length;e++){let i=t.elements[e].refBounds;r.push({x1:n.left,y1:i.y,x2:n.right,y2:i.y})}t.lines=r,t._dirty=!0}_runForEncoding(t){let e=t.channel,n=qw(t.elements),r=[];if("x"===e){let e,i,o=sA(t.elements[0],"y");o?(e=Math.min(...o.getScale(t.elements[0]).range,n.top),i=Math.max(...o.getScale(t.elements[0]).range,n.bottom)):(e=n.top,i=n.bottom);for(let n of t.values)r.push({x1:t.scale.map(n),y1:i,x2:t.scale.map(n),y2:e})}else if("width"===e)for(let e of t.values)r.push({x1:t.scale.map(e)+n.left,y1:n.bottom,x2:t.scale.map(e)+n.left,y2:n.top});else if("y"===e){let e,i,o=sA(t.elements[0],"x");o?(e=Math.min(...o.getScale(t.elements[0]).range,n.left),i=Math.max(...o.getScale(t.elements[0]).range,n.right)):(e=n.left,i=n.right);for(let n of t.values)r.push({x1:e,y1:t.scale.map(n),x2:i,y2:t.scale.map(n)})}else if("height"===e)for(let e of t.values)r.push({x1:n.left,y1:n.bottom-t.scale.map(e),x2:n.right,y2:n.bottom-t.scale.map(e)});else if("radialDistance"===e){let e=t.elements[0].parent;for(let n=0;n<t.values.length;n++)r.push({x:e.x,y:e.y,r:t.scale.map(t.values[n])})}t.lines=r,t._dirty=!0}}class UT extends pE{constructor(t){super(t)}run(){super.run();let t=this._outputVars[0].element,e=lE(t)[0],n=Qw(t.parent);for(let t of n){let n=t.layout;if(!n)return;switch(e.type){case bT.Rect:case bT.Circle:case bT.Image:this._stackRects(t,n);break;case bT.Area:t.children[0].orientation===bE?this._stackAreasVert(t,n):this._stackAreasHorz(t,n);break;case bT.Arc:case bT.Pie:e.parent.classId===t.classId&&this._stackArcs(t,n)}}$w(e)}_stackArcs(t,e){if(e.orientation===xE){let e=90;if((this._direction?this._direction:AE.Clockwise)===AE.Clockwise)for(let n of t.children){let t=VE(e-n.angle);gA(n,"startAngle",t),e=t}else for(let n of t.children){let t=VE(e+n.angle);gA(n,"startAngle",t),e=t}}else if(e.orientation===wE){let e=Math.min(...t.children.map(t=>t.innerRadius));for(let n of t.children){let t=n.outerRadius-n.innerRadius;gA(n,"innerRadius",e),gA(n,"outerRadius",e+t),e=n._outerRadius}}}_stackAreasVert(t,e){let n=t.children.filter(t=>"visible"===t.visibility),r=t.bounds,i=e.vertCellAlignment===Xw.TOP?r.top:r.bottom,o=e.vertCellAlignment===Xw.TOP?1:-1;if(0===n.length)return;e.vertCellAlignment===Xw.BOTTOM&&n.reverse();let a=n[0].vertices.length/2,s=new Array(a).fill(0);for(let t of n){for(let e=0;e<a;e++){let n=t.vertices[e],r=t.vertices[2*a-e-1],l=Math.abs(n.y-r.y),c=i+s[e]*o,u=i+(s[e]+l)*o;dA(n,0,c-n.y),dA(r,0,u-r.y),s[e]+=l}let e=t.bounds.bottom;t._updateBounds(),t._refBounds.translate(0,t.bounds.bottom-e)}if(e.vertCellAlignment===Xw.MIDDLE)for(let t of n){for(let e=0;e<a;e++){let n=t.vertices[e],i=t.vertices[2*a-e-1],o=r.middle+s[e]/2;dA(n,0,o-r.bottom),dA(i,0,o-r.bottom)}let e=t.bounds.bottom;t._updateBounds(),t._refBounds.translate(0,t.bounds.bottom-e)}}_stackAreasHorz(t,e){}_stackRects(t,e){t.scene;let n=e._orientation,r=t.children.map(t=>t.bounds),i=r.map(t=>t.left),o=r.map(t=>t.top),a=r.map(t=>t.width),s=r.map(t=>t.height),l=null==e._left?Math.min(...i):e._left,c=null==e._top?Math.min(...o):e._top,u=Math.max(...a),h=Math.max(...s);if(n==vE)for(let n=0;n<t.children.length;n++){let r=t.children[n],i=0,o=c+r.bounds.height/2-r.bounds.y;c+=r.bounds.height+e._gap,dA(r,i,o),r._updateBounds();let a=0,s=0;if(!hA(r))switch(e._horzCellAlignment){case Xw.LEFT:a=l-r.bounds.left;break;case Xw.CENTER:a=l+u/2-r.bounds.x;break;case Xw.RIGHT:a=l+u-r.bounds.right}dA(r,a,s)}else for(let n=0;n<t.children.length;n++){let r=t.children[n],i=l+r.bounds.width/2-r.bounds.x,o=0;l+=r.bounds.width+e._gap,dA(r,i,o),r._updateBounds();let a=0,s=0;if(!uA(r))switch(e._vertCellAlignment){case Xw.TOP:s=c-r.bounds.top;break;case Xw.MIDDLE:s=c+h/2-r.bounds.y;break;case Xw.BOTTOM:s=c+h-r.bounds.bottom}dA(r,a,s)}}}class YT extends pE{constructor(t){super(t)}run(){super.run()}}class HT extends pE{constructor(t){super(t)}run(){let t=this.inputVars[0],e=this.outputVar,n=t.attribute,r=e.attribute,i=t.dataset,o=e.dataset,a=i.getAttributeValues(n),s=J()(a),l=this._findBin,c=a.map(t=>{let e=l(t,s);return(e.x0+e.x1)/2+""}),u=s.map(t=>(t.x0+t.x1)/2+"");o._addAttribute(r,$E.String,c),o.orderAttributeValues(r,u)}_findBin(t,e){for(let n of e)if(n.indexOf(t)>=0)return n}}class qT extends pE{constructor(t){super(t)}run(){let t=this.outputVar,e=t.dataset,n=t.predicate,r=[];for(let[t,i]of e.data.entries())n.testTuple(i)||r.push(t);r.sort((t,e)=>e-t),r.forEach(t=>{t>=0&&t<e.data.length&&(e._data.splice(t,1),e._rawData.splice(t,1))});for(let t of e._attributes)e._attrSummaries[t]=ZE(e.data.map(e=>e[t]),e._attrTypes[t])}}class WT extends pE{constructor(t){super(t)}run(){super.run();let t=this.inputVars.find(t=>t.type===nA.AFFIXATION).affixation,e=t.base,n=t.element,r=Qw(e),i=Qw(n),o=t.channels,a=t.attribute;if(Zw(n)&&Zw(e)){let t=r.map(t=>t.dataScope.getAttrVal(a));i=i.filter(e=>t.includes(e.dataScope.getAttrVal(a)));let e=(t,e)=>t.dataScope.getAttrVal(a)<e.dataScope.getAttrVal(a)?-1:t.dataScope.getAttrVal(a)>e.dataScope.getAttrVal(a)?1:0;i.sort(e),r.sort(e)}if(o.includes("x")||o.includes("y"))for(let e of o)this._handleXY(e,i,r,t.getElementAnchor(e),t.getBaseAnchor(e),t.getOffset(e));(o.includes("radialDistance")||o.includes("angle"))&&this._handlePolar(i,r,t);let s=lE(n,!0);for(let t of s)$w(t)}_handlePolar(t,e,n){let r=n.hasChannel("radialDistance")?n.getBaseAnchor("radialDistance"):Xw.MIDDLE,i=n.hasChannel("radialDistance")?n.getElementAnchor("radialDistance"):Xw.MIDDLE,o=n.hasChannel("angle")?n.getBaseAnchor("angle"):Xw.CENTER;n.hasChannel("angle")?n.getElementAnchor("angle"):Xw.CENTER;let a=n.hasChannel("radialDistance")?n.getOffset("radialDistance"):0,s=n.hasChannel("angle")?n.getOffset("angle"):0;if([bT.Arc,bT.Ring].indexOf(e[0].type)>=0&&t[0].type==bT.SimpleText)for(let n=0;n<t.length;n++){let i=e[n],s=t[n],l=r===Xw.MIDDLE?(i.outerRadius+i.innerRadius)/2:r===Xw.TOP?i.outerRadius-5:i.innerRadius+5;if(l+=a,i.type===bT.Arc){let t=QE(i.x,i.y,l,i.startAngle),e=QE(i.x,i.y,l,i.endAngle);i.endAngle>=180&&i.endAngle<=360?s._textPath=["M",t[0],t[1],"A",l,l,i.angle,i.angle>=180?1:0,0,e[0],e[1]].join(" "):s._textPath=["M",e[0],e[1],"A",l,l,i.angle,i.angle>=180?1:0,1,t[0],t[1]].join(" ")}else if(i.type===bT.Ring){let t=275,e=265,n=350,r=QE(i.x,i.y,l,t),o=QE(i.x,i.y,l,e);s._textPath=["M",o[0],o[1],"A",l,l,n,1,1,r[0],r[1]].join(" ")}s.textPathOffset=o===Xw.LEFT?"0%":"50%"}else for(let n=0;n<t.length;n++){let l,c,u=e[n],h=t[n];u.type==bT.Arc||u.type==bT.Ring?(c="left"==o?u.endAngle+s:"center"==o?u.startAngle+u.angle/2+s:u.startAngle+s,l="top"==r?u.outerRadius+a:"bottom"==r?u.innerRadius+a:(u.outerRadius+u.innerRadius)/2+a):u.type==bT.Circle&&(c=90,l="top"==r?u.radius+a:"bottom"==r?a:u.radius/2+a),dA(h,u.x-h.x,u.y-l-h.bounds[i]),h._rotate=[90-c,u.x,u.y]}}_handleXY(t,e,n,r,i,o){for(let a=0;a<e.length;a++){let s,l=n[a],c=e[a];if(RE(l)){s=ME(l,[Xw.LEFT,Xw.TOP].includes(i)?0:[Xw.CENTER,Xw.MIDDLE].includes(i)?.5:1)[t]}else s=l.bounds[i]+o;e[0].type===bT.SimpleText?(c.anchor["x"==t?0:1]=r,gA(c,t,s)):"x"==t?dA(c,s-c.bounds[r],0):dA(c,0,s-c.bounds[r])}}}class $T extends eA{constructor(t,e){super(t),this._affx=e}get affixation(){return this._affx}}class XT extends pE{constructor(t){super(t)}run(){let t=this.inputVars[0],e=this.outputVar,n=t.attribute,r=e.attribute,i=t.dataset,o=e.dataset,a=this.args,s="min"in a?a.min:i.getAttributeSummary(n).min,l="max"in a?a.max:i.getAttributeSummary(n).max,c=s,u=[];for(;c<l;)u.push(c),c+=a.interval;u.push(c);let h={},f={};if(a.groupBy)for(let t of i.data){let e=a.groupBy.map(e=>t[e]).join("-");e in h||(h[e]=[],f[e]=a.groupBy.map(e=>t[e])),h[e].push(t[n])}else h[""]=i.data.map(t=>t[n]),f[""]="";let d=[];for(let t in f){let e=KT(ZT(a.bandwidth),u,h[t]);for(let i of e){let e={};""!==t&&a.groupBy.forEach((n,r)=>e[n]=f[t][r]),e[n]=i[0],e[r]=i[1],d.push(e)}}let p={};if(p[n]=i.getAttributeType(n),p[r]=$E.Number,a.groupBy)for(let t of a.groupBy)p[t]=i.getAttributeType(t);o.initialize(d,o.url,p)}}function KT(t,e,n){return e.map(e=>[e,ct(n,n=>t(e-n))])}function ZT(t){return e=>Math.abs(e/=t)<=1?.75*(1-e*e)/t:0}class JT extends pE{constructor(t){super(t)}run(){super.run();let t=this._outputVars[0].element,e=Qw(t.parent);for(let t of e){let e=t.layout;if(!e)return;let n=t.children.map(t=>({name:t.id,radius:t.radius,itm:t})),r=n.reduce((t,e)=>t+Math.pow(e.radius,2),0),i=Math.sqrt(r);void 0===e._width&&(e._width=i),void 0===e._height&&(e._height=i);let o=Od({name:"root",children:n}).sum(t=>t.radius?t.radius:0).sort((t,e)=>e.value-t.value);rp().size([e._width,e._height]).radius(t=>t.value)(o);for(let t of o.children){let n=t.data.itm;dA(n,e._x-o.x+t.x-n.x,e._y-o.y+t.y-n.y)}}let n=lE(t,!0);for(let t of n)$w(t)}}class QT extends pE{constructor(t){super(t)}run(){super.run();let t=this.inputVars.find(t=>t instanceof AA&&t.property==SA.AXIS_PATH_POSITION).element;t instanceof hT?this._runForEncoding(t):t instanceof fT&&this._runForLayout(t),$w(t._title)}_runForEncoding(t){let e=t.channel,n=qw(t.elements);if("x"==e)t._title.x=(t.scale.range[0]+t.scale.range[1])/2,t._title._y=t.orientation==cT?t._pathPos+t.titleOffset:t._pathPos-t.titleOffset;else if("width"==e)t._title.x=n.left+t.scale.rangeExtent/2,t._title._y=t.orientation==cT?t._pathPos+t.titleOffset:t._pathPos-t.titleOffset;else if("y"===e)t._rotateYTitle?(t._title.x=t.orientation==uT?t._pathPos-t.titleOffset:t._pathPos+t.titleOffset,t._title._y=(t.scale.range[0]+t.scale.range[1])/2,t._title._rotate=t.orientation==uT?[-90,t._title._x,t._title._y]:[90,t._title._x,t._title._y]):(t._title.x=t.orientation==uT?t._pathPos-t.titleOffset:t._pathPos+t.titleOffset,t._title._y=Math.min(t.scale.range[0],t.scale.range[1])-25,t._title._rotate=void 0);else if("height"===e)t._title.x=n.center,t._title._y=(n.top+n.bottom)/2-n.width/2-t.titleOffset,t._title._rotate=t.orientation==uT?[-90,n.center,n.middle]:[90,n.center,n.middle];else if("radialDistance"===e){let e=t.elements[0].parent;t._title.x=e.x+t.scale.rangeExtent/2,t._title._y=t.orientation==cT?t._pathPos+t.titleOffset:t._pathPos-t.titleOffset,t._rotate&&(t._title._rotate=t._rotate.slice())}}_runForLayout(t){let e=t.channel,n=t.elements[0].parent.layout&&t.elements[0].parent.layout.type==fE.STACK?Ww(t.elements):qw(t.elements);if("x"==e)t._title.x=n.center,t._title._y=t.orientation==cT?t._pathPos+t.titleOffset:t._pathPos-t.titleOffset;else if("y"===e)t._title.x=n.center,t._title._y=n.middle-n.width/2-t.titleOffset,t._title._rotate=t.orientation==uT?[-90,n.center,n.middle]:[90,n.center,n.middle];else if("angle"===e){let e=t.elements[0].parent.layout;e.type===fE.CLUSTER&&(t._title.x=e.x,t._title._y=e.y)}}}class tC extends kT{constructor(t){super(t)}run(){super.run();let t,e=this.vars.find(t=>t.type===nA.ALIGNMENT).alignment,n=e.anchor,r=e.elements;n==Xw.Top||n==Xw.LEFT?t=Math.min(...r.map(t=>t.bounds[n])):n==Xw.BOTTOM||n==Xw.RIGHT?t=Math.max(...r.map(t=>t.bounds[n])):n!=Xw.CENTER&&n!=Xw.MIDDLE||(t=ct(r.map(t=>t.bounds[n])));for(let i of r){let r=fA(i,e.channel);if(r){let o=t-i.bounds[n];dA(r,"x"===e.channel?o:0,"x"===e.channel?0:o)}}for(let t of r)$w(t)}}class eC extends eA{constructor(t,e){super(t),this._aln=e}get alignment(){return this._aln}}class nC extends pE{constructor(t){super(t)}run(){super.run();let t=this._outputVars[0].element,e=Qw(t.parent);for(let t of e){let e=t.layout;if(!e)continue;let n=YE(t.children[0]);if(!n)continue;let r=n.linkList.map(t=>({source:n.getNode(t.source),target:n.getNode(t.target)})),i=Ol(n.nodeList).force("charge",Nl().strength(-e._repulsion)).force("link",Cl(r).id(t=>t.id).distance(e._linkDistance)).force("x",Il()).force("y",Ll()).force("center",hl(e._x,e._y).strength(e._attraction));i.stop(),i.tick(e._iterations);for(let e=0;e<t.children.length;e++){let r=t.children[e],i=n.nodeList[e];dA(r,i.x-r.x,i.y-r.y)}}let n=lE(t,!0);for(let t of n)$w(t)}}class rC extends pE{constructor(t){super(t)}run(){super.run();let t=this._outputVars[0].element,e=Qw(t);switch(t.type){case bT.Arc:this._updateArcLinks(e);break;case bT.BezierCurve:this._updateBezierLinks(e);break;case bT.BundledPath:this._updateBundledLinks(e);break;case bT.Chord:this._updateChordLinks(e);break;case bT.Line:default:this._updateLineLinks(e)}$w(t)}_updateArcLinks(t){for(let e of t){let t=e.source.x<e.target.x?e.source:e.target,n=e.source.x<e.target.x?e.target:e.source;e._x=(t.x+n.x)/2,e._y=(t.y+n.y)/2,e._innerRadius=Math.sqrt(Math.pow(t.x-n.x,2)+Math.pow(t.y-n.y,2))/2,e._outerRadius=e._innerRadius+e._thickness;let r=DE(t.x,t.y,e._x,e._y),i=DE(n.x,n.y,e._x,e._y);e.direction===AE.CLOCKWISE&&([r,i]=[i,r]),gA(e,"startAngle",r),gA(e,"angle",Math.abs(i-r))}}_updateBezierLinks(t){let e=this._inputVars[0].element,n=Qw(e),r=e.parent.layout;r.type===fE.DIRECTED||r.type===fE.TIDYTREE?this._updateBezierLinksForDirectedGraph(n,t,r):r.type===fE.CLUSTER&&this._updateBezierLinksForClusteredGraph(n,t,r)}_updateBezierLinksForClusteredGraph(t,e,n){const r=n._d3Root.descendants(),i=new Map(r.map(t=>[iC(t),t])),o=new Map(r.map(t=>[t.data[qE],iC(t)]));if(n.isRadial()){const t=nx().angle(t=>t.x).radius(t=>t.y);for(let r of e){let e=r.source,a=r.target,s=e.dataScope.getAttrVal(qE),l=a.dataScope.getAttrVal(qE),c=i.get(o.get(s)),u=i.get(o.get(l));r._d=NE(t({source:c,target:u}),n.x,n.y)}}else if(n.orientation===vE){const t=ex().x(t=>t.x).y(t=>t.y);for(let r of e){let e=r.source,a=r.target,s=e.dataScope.getAttrVal(qE),l=a.dataScope.getAttrVal(qE),c=i.get(o.get(s)),u=i.get(o.get(l));r._d=NE(t({source:c,target:u}),n.left-n._x0,n.top)}}else if(n.orientation===bE){const t=tx().x(t=>t.y).y(t=>t.x);for(let r of e){let e=r.source,a=r.target,s=e.dataScope.getAttrVal(qE),l=a.dataScope.getAttrVal(qE),c=i.get(o.get(s)),u=i.get(o.get(l));r._d=NE(t({source:c,target:u}),n.left,n.top-n._x0)}}}_updateBezierLinksForDirectedGraph(t,e,n){let r={},i={},o={},a={};for(let e of t){i[e.id]=0,r[e.id]=0;let t=e.links.filter(t=>t.source===e),n=e.links.filter(t=>t.target===e);a[e.id]=n.map(t=>t.strokeWidth).reduce((t,e)=>t+e,0),o[e.id]=t.map(t=>t.strokeWidth).reduce((t,e)=>t+e,0)}n.spreadLinks&&("LR"===n.direction||"RL"===n.direction?e.sort((t,e)=>DE(t.target.bounds.x,t.target.bounds.y,t.source.bounds.x,t.source.bounds.y)-DE(e.target.bounds.x,e.target.bounds.y,e.source.bounds.x,e.source.bounds.y)):e.sort((t,e)=>DE(e.target.bounds.x,e.target.bounds.y,e.source.bounds.x,e.source.bounds.y)-DE(t.target.bounds.x,t.target.bounds.y,t.source.bounds.x,t.source.bounds.y)));for(let t of e){let e,s,l,c,u=t.source,h=t.target;n.spreadLinks?"LR"===n.direction||"RL"===n.direction?(e=u.bounds[t.sourceAnchor[0]]+t.sourceOffset[0],l=h.bounds[t.targetAnchor[0]]+t.targetOffset[0],s=u.bounds[t.sourceAnchor[1]]+t.sourceOffset[1]-o[u.id]/2+r[u.id]+t.strokeWidth/2,c=h.bounds[t.targetAnchor[1]]+t.targetOffset[1]-a[h.id]/2+i[h.id]+t.strokeWidth/2,r[u.id]+=t.strokeWidth,i[h.id]+=t.strokeWidth):(s=u.bounds[t.sourceAnchor[1]]+t.sourceOffset[1],c=h.bounds[t.targetAnchor[1]]+t.targetOffset[1],e=u.bounds[t.sourceAnchor[0]]+t.sourceOffset[0]-o[u.id]/2+r[u.id]+t.strokeWidth/2,l=h.bounds[t.targetAnchor[0]]+t.targetOffset[0]-a[h.id]/2+i[h.id]+t.strokeWidth/2,r[u.id]+=t.strokeWidth,i[h.id]+=t.strokeWidth):(e=u.bounds[t.sourceAnchor[0]]+t.sourceOffset[0],s=u.bounds[t.sourceAnchor[1]]+t.sourceOffset[1],l=h.bounds[t.targetAnchor[0]]+t.targetOffset[0],c=h.bounds[t.targetAnchor[1]]+t.targetOffset[1]),t.orientation===bE?t._setVertices([[e,s],[(e+l)/2,s],[e,c],[l,c]]):t.orientation===vE&&t._setVertices([[e,s],[e,(s+c)/2],[l,s],[l,c]])}}_updateBundledLinks(t){let e=this._inputVars[0].element.parent.layout;if(e.type!==fE.CLUSTER)throw"Bundled links must work on a cluster layout";let n=e._d3Root.leaves();const r=new Map(n.map(t=>[iC(t),t])),i=new Map(n.map(t=>[t.data[qE],iC(t)])),o=Uv().curve(Dx.beta(t[0]._strength)).radius(t=>t.y).angle(t=>t.x);for(let n of t){let t=n.source.dataScope.getAttrVal(qE),a=n.target.dataScope.getAttrVal(qE),s=r.get(i.get(t)),l=r.get(i.get(a));(s.outgoing??=[]).push([s,l]),l.incoming??=[];let c=s.path(l);n._d=NE(o(c),e.x,e.y)}}_updateChordLinks(t){for(let e of t){let t=e.source,n=e.target,r=QE(t.x,t.y,t.innerRadius,t.startAngle),i=QE(t.x,t.y,t.innerRadius,t.endAngle),o=QE(n.x,n.y,n.innerRadius,n.startAngle),a=QE(n.x,n.y,n.innerRadius,n.endAngle);e._d=["M",r[0],r[1],"Q",t.x,t.y,a[0],a[1],"A",t.x,t.y,n.angle,n.angle>180?1:0,1,o[0],o[1],"Q",t.x,t.y,i[0],i[1],"A",t.x,t.y,t.angle,t.angle>180?1:0,1,r[0],r[1]].join(" "),e._dirty=!0}}_updateLineLinks(t){for(let e of t){let t=e.source,n=e.target;e.vertices[0]._x=t.bounds.x,e.vertices[0]._y=t.bounds.y,e.vertices[1]._x=n.bounds.x,e.vertices[1]._y=n.bounds.y,e._dirty=!0}}}function iC(t){return`${t.parent?iC(t.parent)+".":""}${t.data[qE]}`}var oC="\0";function aC(t,e){t[e]?t[e]++:t[e]=1}function sC(t,e){--t[e]||delete t[e]}function lC(t,e,n,r){var i=""+e,o=""+n;if(!t&&i>o){var a=i;i=o,o=a}return i+""+o+""+(void 0===r?"\0":r)}function cC(t,e){return lC(t,e.v,e.w,e.name)}var uC=class{_isDirected=!0;_isMultigraph=!1;_isCompound=!1;_label;_defaultNodeLabelFn=()=>{};_defaultEdgeLabelFn=()=>{};_nodes={};_in={};_preds={};_out={};_sucs={};_edgeObjs={};_edgeLabels={};_nodeCount=0;_edgeCount=0;_parent;_children;constructor(t){t&&(this._isDirected=!Object.hasOwn(t,"directed")||t.directed,this._isMultigraph=!!Object.hasOwn(t,"multigraph")&&t.multigraph,this._isCompound=!!Object.hasOwn(t,"compound")&&t.compound),this._isCompound&&(this._parent={},this._children={},this._children[oC]={})}isDirected(){return this._isDirected}isMultigraph(){return this._isMultigraph}isCompound(){return this._isCompound}setGraph(t){return this._label=t,this}graph(){return this._label}setDefaultNodeLabel(t){return this._defaultNodeLabelFn=t,"function"!=typeof t&&(this._defaultNodeLabelFn=()=>t),this}nodeCount(){return this._nodeCount}nodes(){return Object.keys(this._nodes)}sources(){var t=this;return this.nodes().filter(e=>0===Object.keys(t._in[e]).length)}sinks(){var t=this;return this.nodes().filter(e=>0===Object.keys(t._out[e]).length)}setNodes(t,e){var n=arguments,r=this;return t.forEach(function(t){n.length>1?r.setNode(t,e):r.setNode(t)}),this}setNode(t,e){return Object.hasOwn(this._nodes,t)?(arguments.length>1&&(this._nodes[t]=e),this):(this._nodes[t]=arguments.length>1?e:this._defaultNodeLabelFn(t),this._isCompound&&(this._parent[t]=oC,this._children[t]={},this._children[oC][t]=!0),this._in[t]={},this._preds[t]={},this._out[t]={},this._sucs[t]={},++this._nodeCount,this)}node(t){return this._nodes[t]}hasNode(t){return Object.hasOwn(this._nodes,t)}removeNode(t){var e=this;if(Object.hasOwn(this._nodes,t)){var n=t=>e.removeEdge(e._edgeObjs[t]);delete this._nodes[t],this._isCompound&&(this._removeFromParentsChildList(t),delete this._parent[t],this.children(t).forEach(function(t){e.setParent(t)}),delete this._children[t]),Object.keys(this._in[t]).forEach(n),delete this._in[t],delete this._preds[t],Object.keys(this._out[t]).forEach(n),delete this._out[t],delete this._sucs[t],--this._nodeCount}return this}setParent(t,e){if(!this._isCompound)throw new Error("Cannot set parent in a non-compound graph");if(void 0===e)e=oC;else{for(var n=e+="";void 0!==n;n=this.parent(n))if(n===t)throw new Error("Setting "+e+" as parent of "+t+" would create a cycle");this.setNode(e)}return this.setNode(t),this._removeFromParentsChildList(t),this._parent[t]=e,this._children[e][t]=!0,this}_removeFromParentsChildList(t){delete this._children[this._parent[t]][t]}parent(t){if(this._isCompound){var e=this._parent[t];if(e!==oC)return e}}children(t=oC){if(this._isCompound){var e=this._children[t];if(e)return Object.keys(e)}else{if(t===oC)return this.nodes();if(this.hasNode(t))return[]}}predecessors(t){var e=this._preds[t];if(e)return Object.keys(e)}successors(t){var e=this._sucs[t];if(e)return Object.keys(e)}neighbors(t){var e=this.predecessors(t);if(e){const r=new Set(e);for(var n of this.successors(t))r.add(n);return Array.from(r.values())}}isLeaf(t){return 0===(this.isDirected()?this.successors(t):this.neighbors(t)).length}filterNodes(t){var e=new this.constructor({directed:this._isDirected,multigraph:this._isMultigraph,compound:this._isCompound});e.setGraph(this.graph());var n=this;Object.entries(this._nodes).forEach(function([n,r]){t(n)&&e.setNode(n,r)}),Object.values(this._edgeObjs).forEach(function(t){e.hasNode(t.v)&&e.hasNode(t.w)&&e.setEdge(t,n.edge(t))});var r={};function i(t){var o=n.parent(t);return void 0===o||e.hasNode(o)?(r[t]=o,o):o in r?r[o]:i(o)}return this._isCompound&&e.nodes().forEach(t=>e.setParent(t,i(t))),e}setDefaultEdgeLabel(t){return this._defaultEdgeLabelFn=t,"function"!=typeof t&&(this._defaultEdgeLabelFn=()=>t),this}edgeCount(){return this._edgeCount}edges(){return Object.values(this._edgeObjs)}setPath(t,e){var n=this,r=arguments;return t.reduce(function(t,i){return r.length>1?n.setEdge(t,i,e):n.setEdge(t,i),i}),this}setEdge(){var t,e,n,r,i=!1,o=arguments[0];"object"==typeof o&&null!==o&&"v"in o?(t=o.v,e=o.w,n=o.name,2===arguments.length&&(r=arguments[1],i=!0)):(t=o,e=arguments[1],n=arguments[3],arguments.length>2&&(r=arguments[2],i=!0)),t=""+t,e=""+e,void 0!==n&&(n=""+n);var a=lC(this._isDirected,t,e,n);if(Object.hasOwn(this._edgeLabels,a))return i&&(this._edgeLabels[a]=r),this;if(void 0!==n&&!this._isMultigraph)throw new Error("Cannot set a named edge when isMultigraph = false");this.setNode(t),this.setNode(e),this._edgeLabels[a]=i?r:this._defaultEdgeLabelFn(t,e,n);var s=function(t,e,n,r){var i=""+e,o=""+n;if(!t&&i>o){var a=i;i=o,o=a}var s={v:i,w:o};r&&(s.name=r);return s}(this._isDirected,t,e,n);return t=s.v,e=s.w,Object.freeze(s),this._edgeObjs[a]=s,aC(this._preds[e],t),aC(this._sucs[t],e),this._in[e][a]=s,this._out[t][a]=s,this._edgeCount++,this}edge(t,e,n){var r=1===arguments.length?cC(this._isDirected,arguments[0]):lC(this._isDirected,t,e,n);return this._edgeLabels[r]}edgeAsObj(){const t=this.edge(...arguments);return"object"!=typeof t?{label:t}:t}hasEdge(t,e,n){var r=1===arguments.length?cC(this._isDirected,arguments[0]):lC(this._isDirected,t,e,n);return Object.hasOwn(this._edgeLabels,r)}removeEdge(t,e,n){var r=1===arguments.length?cC(this._isDirected,arguments[0]):lC(this._isDirected,t,e,n),i=this._edgeObjs[r];return i&&(t=i.v,e=i.w,delete this._edgeLabels[r],delete this._edgeObjs[r],sC(this._preds[e],t),sC(this._sucs[t],e),delete this._in[e][r],delete this._out[t][r],this._edgeCount--),this}inEdges(t,e){var n=this._in[t];if(n){var r=Object.values(n);return e?r.filter(t=>t.v===e):r}}outEdges(t,e){var n=this._out[t];if(n){var r=Object.values(n);return e?r.filter(t=>t.w===e):r}}nodeEdges(t,e){var n=this.inEdges(t,e);if(n)return n.concat(this.outEdges(t,e))}},hC={Graph:uC,version:"2.2.4"},fC=uC,dC={write:function(t){var e={options:{directed:t.isDirected(),multigraph:t.isMultigraph(),compound:t.isCompound()},nodes:pC(t),edges:gC(t)};void 0!==t.graph()&&(e.value=structuredClone(t.graph()));return e},read:function(t){var e=new fC(t.options).setGraph(t.value);return t.nodes.forEach(function(t){e.setNode(t.v,t.value),t.parent&&e.setParent(t.v,t.parent)}),t.edges.forEach(function(t){e.setEdge({v:t.v,w:t.w,name:t.name},t.value)}),e}};function pC(t){return t.nodes().map(function(e){var n=t.node(e),r=t.parent(e),i={v:e};return void 0!==n&&(i.value=n),void 0!==r&&(i.parent=r),i})}function gC(t){return t.edges().map(function(e){var n=t.edge(e),r={v:e.v,w:e.w};return void 0!==e.name&&(r.name=e.name),void 0!==n&&(r.value=n),r})}var _C=function(t){var e,n={},r=[];function i(r){Object.hasOwn(n,r)||(n[r]=!0,e.push(r),t.successors(r).forEach(i),t.predecessors(r).forEach(i))}return t.nodes().forEach(function(t){e=[],i(t),e.length&&r.push(e)}),r};var yC=class{_arr=[];_keyIndices={};size(){return this._arr.length}keys(){return this._arr.map(function(t){return t.key})}has(t){return Object.hasOwn(this._keyIndices,t)}priority(t){var e=this._keyIndices[t];if(void 0!==e)return this._arr[e].priority}min(){if(0===this.size())throw new Error("Queue underflow");return this._arr[0].key}add(t,e){var n=this._keyIndices;if(t=String(t),!Object.hasOwn(n,t)){var r=this._arr,i=r.length;return n[t]=i,r.push({key:t,priority:e}),this._decrease(i),!0}return!1}removeMin(){this._swap(0,this._arr.length-1);var t=this._arr.pop();return delete this._keyIndices[t.key],this._heapify(0),t.key}decrease(t,e){var n=this._keyIndices[t];if(e>this._arr[n].priority)throw new Error("New priority is greater than current priority. Key: "+t+" Old: "+this._arr[n].priority+" New: "+e);this._arr[n].priority=e,this._decrease(n)}_heapify(t){var e=this._arr,n=2*t,r=n+1,i=t;n<e.length&&(i=e[n].priority<e[i].priority?n:i,r<e.length&&(i=e[r].priority<e[i].priority?r:i),i!==t&&(this._swap(t,i),this._heapify(i)))}_decrease(t){for(var e,n=this._arr,r=n[t].priority;0!==t&&!(n[e=t>>1].priority<r);)this._swap(t,e),t=e}_swap(t,e){var n=this._arr,r=this._keyIndices,i=n[t],o=n[e];n[t]=o,n[e]=i,r[o.key]=t,r[i.key]=e}},mC=yC,bC=function(t,e,n,r){return function(t,e,n,r){var i,o,a={},s=new mC,l=function(t){var e=t.v!==i?t.v:t.w,r=a[e],l=n(t),c=o.distance+l;if(l<0)throw new Error("dijkstra does not allow negative edge weights. Bad edge: "+t+" Weight: "+l);c<r.distance&&(r.distance=c,r.predecessor=i,s.decrease(e,c))};t.nodes().forEach(function(t){var n=t===e?0:Number.POSITIVE_INFINITY;a[t]={distance:n},s.add(t,n)});for(;s.size()>0&&(i=s.removeMin(),(o=a[i]).distance!==Number.POSITIVE_INFINITY);)r(i).forEach(l);return a}(t,String(e),n||vC,r||function(e){return t.outEdges(e)})},vC=()=>1;var xC=bC,wC=function(t,e,n){return t.nodes().reduce(function(r,i){return r[i]=xC(t,i,e,n),r},{})};var EC=function(t){var e=0,n=[],r={},i=[];function o(a){var s=r[a]={onStack:!0,lowlink:e,index:e++};if(n.push(a),t.successors(a).forEach(function(t){Object.hasOwn(r,t)?r[t].onStack&&(s.lowlink=Math.min(s.lowlink,r[t].index)):(o(t),s.lowlink=Math.min(s.lowlink,r[t].lowlink))}),s.lowlink===s.index){var l,c=[];do{l=n.pop(),r[l].onStack=!1,c.push(l)}while(a!==l);i.push(c)}}return t.nodes().forEach(function(t){Object.hasOwn(r,t)||o(t)}),i};var AC=EC,TC=function(t){return AC(t).filter(function(e){return e.length>1||1===e.length&&t.hasEdge(e[0],e[0])})};var CC=function(t,e,n){return function(t,e,n){var r={},i=t.nodes();return i.forEach(function(t){r[t]={},r[t][t]={distance:0},i.forEach(function(e){t!==e&&(r[t][e]={distance:Number.POSITIVE_INFINITY})}),n(t).forEach(function(n){var i=n.v===t?n.w:n.v,o=e(n);r[t][i]={distance:o,predecessor:t}})}),i.forEach(function(t){var e=r[t];i.forEach(function(n){var o=r[n];i.forEach(function(n){var r=o[t],i=e[n],a=o[n],s=r.distance+i.distance;s<a.distance&&(a.distance=s,a.predecessor=i.predecessor)})})}),r}(t,e||SC,n||function(e){return t.outEdges(e)})},SC=()=>1;function kC(t){var e={},n={},r=[];if(t.sinks().forEach(function i(o){if(Object.hasOwn(n,o))throw new MC;Object.hasOwn(e,o)||(n[o]=!0,e[o]=!0,t.predecessors(o).forEach(i),delete n[o],r.push(o))}),Object.keys(e).length!==t.nodeCount())throw new MC;return r}class MC extends Error{constructor(){super(...arguments)}}var RC=kC;kC.CycleException=MC;var OC=RC;var NC=function(t,e,n){Array.isArray(e)||(e=[e]);var r=t.isDirected()?e=>t.successors(e):e=>t.neighbors(e),i="post"===n?IC:LC,o=[],a={};return e.forEach(e=>{if(!t.hasNode(e))throw new Error("Graph does not have node: "+e);i(e,r,a,o)}),o};function IC(t,e,n,r){for(var i=[[t,!1]];i.length>0;){var o=i.pop();o[1]?r.push(o[0]):Object.hasOwn(n,o[0])||(n[o[0]]=!0,i.push([o[0],!0]),PC(e(o[0]),t=>i.push([t,!1])))}}function LC(t,e,n,r){for(var i=[t];i.length>0;){var o=i.pop();Object.hasOwn(n,o)||(n[o]=!0,r.push(o),PC(e(o),t=>i.push(t)))}}function PC(t,e){for(var n=t.length;n--;)e(t[n],n,t);return t}var VC=NC;var DC=NC;var BC=uC,zC=yC,FC=function(t,e){var n,r=new BC,i={},o=new zC;function a(t){var r=t.v===n?t.w:t.v,a=o.priority(r);if(void 0!==a){var s=e(t);s<a&&(i[r]=n,o.decrease(r,s))}}if(0===t.nodeCount())return r;t.nodes().forEach(function(t){o.add(t,Number.POSITIVE_INFINITY),r.setNode(t)}),o.decrease(t.nodes()[0],0);var s=!1;for(;o.size()>0;){if(n=o.removeMin(),Object.hasOwn(i,n))r.setEdge(n,i[n]);else{if(s)throw new Error("Input graph is not connected: "+t);s=!0}t.nodeEdges(n).forEach(a)}return r};var GC={Graph:hC.Graph,json:dC,alg:{components:_C,dijkstra:bC,dijkstraAll:wC,findCycles:TC,floydWarshall:CC,isAcyclic:function(t){try{OC(t)}catch(t){if(t instanceof OC.CycleException)return!1;throw t}return!0},postorder:function(t,e){return VC(t,e,"post")},preorder:function(t,e){return DC(t,e,"pre")},prim:FC,tarjan:EC,topsort:RC},version:hC.version};function jC(t){t._prev._next=t._next,t._next._prev=t._prev,delete t._next,delete t._prev}function UC(t,e){if("_next"!==t&&"_prev"!==t)return e}let YC=GC.Graph,HC=class{constructor(){let t={};t._next=t._prev=t,this._sentinel=t}dequeue(){let t=this._sentinel,e=t._prev;if(e!==t)return jC(e),e}enqueue(t){let e=this._sentinel;t._prev&&t._next&&jC(t),t._next=e._next,e._next._prev=t,e._next=t,t._prev=e}toString(){let t=[],e=this._sentinel,n=e._prev;for(;n!==e;)t.push(JSON.stringify(n,UC)),n=n._prev;return"["+t.join(", ")+"]"}};var qC=function(t,e){if(t.nodeCount()<=1)return[];let n=function(t,e){let n=new YC,r=0,i=0;t.nodes().forEach(t=>{n.setNode(t,{v:t,in:0,out:0})}),t.edges().forEach(t=>{let o=n.edge(t.v,t.w)||0,a=e(t),s=o+a;n.setEdge(t.v,t.w,s),i=Math.max(i,n.node(t.v).out+=a),r=Math.max(r,n.node(t.w).in+=a)});let o=function(t){const e=[];for(let n=0;n<t;n++)e.push(n);return e}(i+r+3).map(()=>new HC),a=r+1;return n.nodes().forEach(t=>{XC(o,a,n.node(t))}),{graph:n,buckets:o,zeroIdx:a}}(t,e||WC);return function(t,e,n){let r,i=[],o=e[e.length-1],a=e[0];for(;t.nodeCount();){for(;r=a.dequeue();)$C(t,e,n,r);for(;r=o.dequeue();)$C(t,e,n,r);if(t.nodeCount())for(let o=e.length-2;o>0;--o)if(r=e[o].dequeue(),r){i=i.concat($C(t,e,n,r,!0));break}}return i}(n.graph,n.buckets,n.zeroIdx).flatMap(e=>t.outEdges(e.v,e.w))};let WC=()=>1;function $C(t,e,n,r,i){let o=i?[]:void 0;return t.inEdges(r.v).forEach(r=>{let a=t.edge(r),s=t.node(r.v);i&&o.push({v:r.v,w:r.w}),s.out-=a,XC(e,n,s)}),t.outEdges(r.v).forEach(r=>{let i=t.edge(r),o=r.w,a=t.node(o);a.in-=i,XC(e,n,a)}),t.removeNode(r.v),o}function XC(t,e,n){n.out?n.in?t[n.out-n.in+e].enqueue(n):t[t.length-1].enqueue(n):t[0].enqueue(n)}let KC=GC.Graph;var ZC={addBorderNode:function(t,e,n,r){let i={width:0,height:0};arguments.length>=4&&(i.rank=n,i.order=r);return JC(t,"border",i,e)},addDummyNode:JC,applyWithChunking:tS,asNonCompoundGraph:function(t){let e=new KC({multigraph:t.isMultigraph()}).setGraph(t.graph());return t.nodes().forEach(n=>{t.children(n).length||e.setNode(n,t.node(n))}),t.edges().forEach(n=>{e.setEdge(n,t.edge(n))}),e},buildLayerMatrix:function(t){let e=iS(eS(t)+1).map(()=>[]);return t.nodes().forEach(n=>{let r=t.node(n),i=r.rank;void 0!==i&&(e[i][r.order]=n)}),e},intersectRect:function(t,e){let n,r,i=t.x,o=t.y,a=e.x-i,s=e.y-o,l=t.width/2,c=t.height/2;if(!a&&!s)throw new Error("Not possible to find intersection inside of the rectangle");Math.abs(s)*l>Math.abs(a)*c?(s<0&&(c=-c),n=c*a/s,r=c):(a<0&&(l=-l),n=l,r=l*s/a);return{x:i+n,y:o+r}},mapValues:function(t,e){let n=e;"string"==typeof e&&(n=t=>t[e]);return Object.entries(t).reduce((t,[e,r])=>(t[e]=n(r,e),t),{})},maxRank:eS,normalizeRanks:function(t){let e=t.nodes().map(e=>{let n=t.node(e).rank;return void 0===n?Number.MAX_VALUE:n}),n=tS(Math.min,e);t.nodes().forEach(e=>{let r=t.node(e);Object.hasOwn(r,"rank")&&(r.rank-=n)})},notime:function(t,e){return e()},partition:function(t,e){let n={lhs:[],rhs:[]};return t.forEach(t=>{e(t)?n.lhs.push(t):n.rhs.push(t)}),n},pick:function(t,e){const n={};for(const r of e)void 0!==t[r]&&(n[r]=t[r]);return n},predecessorWeights:function(t){let e=t.nodes().map(e=>{let n={};return t.inEdges(e).forEach(e=>{n[e.v]=(n[e.v]||0)+t.edge(e).weight}),n});return oS(t.nodes(),e)},range:iS,removeEmptyRanks:function(t){let e=t.nodes().map(e=>t.node(e).rank),n=tS(Math.min,e),r=[];t.nodes().forEach(e=>{let i=t.node(e).rank-n;r[i]||(r[i]=[]),r[i].push(e)});let i=0,o=t.graph().nodeRankFactor;Array.from(r).forEach((e,n)=>{void 0===e&&n%o!==0?--i:void 0!==e&&i&&e.forEach(e=>t.node(e).rank+=i)})},simplify:function(t){let e=(new KC).setGraph(t.graph());return t.nodes().forEach(n=>e.setNode(n,t.node(n))),t.edges().forEach(n=>{let r=e.edge(n.v,n.w)||{weight:0,minlen:1},i=t.edge(n);e.setEdge(n.v,n.w,{weight:r.weight+i.weight,minlen:Math.max(r.minlen,i.minlen)})}),e},successorWeights:function(t){let e=t.nodes().map(e=>{let n={};return t.outEdges(e).forEach(e=>{n[e.w]=(n[e.w]||0)+t.edge(e).weight}),n});return oS(t.nodes(),e)},time:function(t,e){let n=Date.now();try{return e()}finally{console.log(t+" time: "+(Date.now()-n)+"ms")}},uniqueId:rS,zipObject:oS};function JC(t,e,n,r){for(var i=r;t.hasNode(i);)i=rS(r);return n.dummy=e,t.setNode(i,n),i}const QC=65535;function tS(t,e){if(e.length>QC){const n=function(t,e=QC){const n=[];for(let r=0;r<t.length;r+=e){const i=t.slice(r,r+e);n.push(i)}return n}(e);return t.apply(null,n.map(e=>t.apply(null,e)))}return t.apply(null,e)}function eS(t){const e=t.nodes().map(e=>{let n=t.node(e).rank;return void 0===n?Number.MIN_VALUE:n});return tS(Math.max,e)}let nS=0;function rS(t){return t+""+ ++nS}function iS(t,e,n=1){null==e&&(e=t,t=0);let r=t=>t<e;n<0&&(r=t=>e<t);const i=[];for(let e=t;r(e);e+=n)i.push(e);return i}function oS(t,e){return t.reduce((t,n,r)=>(t[n]=e[r],t),{})}let aS=qC,sS=ZC.uniqueId;var lS={run:function(t){("greedy"===t.graph().acyclicer?aS(t,function(t){return e=>t.edge(e).weight}(t)):function(t){let e=[],n={},r={};function i(o){Object.hasOwn(r,o)||(r[o]=!0,n[o]=!0,t.outEdges(o).forEach(t=>{Object.hasOwn(n,t.w)?e.push(t):i(t.w)}),delete n[o])}return t.nodes().forEach(i),e}(t)).forEach(e=>{let n=t.edge(e);t.removeEdge(e),n.forwardName=e.name,n.reversed=!0,t.setEdge(e.w,e.v,n,sS("rev"))})},undo:function(t){t.edges().forEach(e=>{let n=t.edge(e);if(n.reversed){t.removeEdge(e);let r=n.forwardName;delete n.reversed,delete n.forwardName,t.setEdge(e.w,e.v,n,r)}})}};let cS=ZC;var uS={run:function(t){t.graph().dummyChains=[],t.edges().forEach(e=>function(t,e){let n,r,i,o=e.v,a=t.node(o).rank,s=e.w,l=t.node(s).rank,c=e.name,u=t.edge(e),h=u.labelRank;if(l===a+1)return;for(t.removeEdge(e),i=0,++a;a<l;++i,++a)u.points=[],r={width:0,height:0,edgeLabel:u,edgeObj:e,rank:a},n=cS.addDummyNode(t,"edge",r,"_d"),a===h&&(r.width=u.width,r.height=u.height,r.dummy="edge-label",r.labelpos=u.labelpos),t.setEdge(o,n,{weight:u.weight},c),0===i&&t.graph().dummyChains.push(n),o=n;t.setEdge(o,s,{weight:u.weight},c)}(t,e))},undo:function(t){t.graph().dummyChains.forEach(e=>{let n,r=t.node(e),i=r.edgeLabel;for(t.setEdge(r.edgeObj,i);r.dummy;)n=t.successors(e)[0],t.removeNode(e),i.points.push({x:r.x,y:r.y}),"edge-label"===r.dummy&&(i.x=r.x,i.y=r.y,i.width=r.width,i.height=r.height),e=n,r=t.node(e)})}};const{applyWithChunking:hS}=ZC;var fS={longestPath:function(t){var e={};t.sources().forEach(function n(r){var i=t.node(r);if(Object.hasOwn(e,r))return i.rank;e[r]=!0;let o=t.outEdges(r).map(e=>null==e?Number.POSITIVE_INFINITY:n(e.w)-t.edge(e).minlen);var a=hS(Math.min,o);return a===Number.POSITIVE_INFINITY&&(a=0),i.rank=a})},slack:function(t,e){return t.node(e.w).rank-t.node(e.v).rank-t.edge(e).minlen}};var dS=GC.Graph,pS=fS.slack,gS=function(t){var e,n,r=new dS({directed:!1}),i=t.nodes()[0],o=t.nodeCount();r.setNode(i,{});for(;_S(r,t)<o;)e=yS(r,t),n=r.hasNode(e.v)?pS(t,e):-pS(t,e),mS(r,t,n);return r};function _S(t,e){return t.nodes().forEach(function n(r){e.nodeEdges(r).forEach(i=>{var o=i.v,a=r===o?i.w:o;t.hasNode(a)||pS(e,i)||(t.setNode(a,{}),t.setEdge(r,a,{}),n(a))})}),t.nodeCount()}function yS(t,e){return e.edges().reduce((n,r)=>{let i=Number.POSITIVE_INFINITY;return t.hasNode(r.v)!==t.hasNode(r.w)&&(i=pS(e,r)),i<n[0]?[i,r]:n},[Number.POSITIVE_INFINITY,null])[1]}function mS(t,e,n){t.nodes().forEach(t=>e.node(t).rank+=n)}var bS=gS,vS=fS.slack,xS=fS.longestPath,wS=GC.alg.preorder,ES=GC.alg.postorder,AS=ZC.simplify,TS=CS;function CS(t){t=AS(t),xS(t);var e,n=bS(t);for(MS(n),SS(n,t);e=OS(n);)IS(n,t,e,NS(n,t,e))}function SS(t,e){var n=ES(t,t.nodes());(n=n.slice(0,n.length-1)).forEach(n=>function(t,e,n){var r=t.node(n),i=r.parent;t.edge(n,i).cutvalue=kS(t,e,n)}(t,e,n))}function kS(t,e,n){var r=t.node(n).parent,i=!0,o=e.edge(n,r),a=0;return o||(i=!1,o=e.edge(r,n)),a=o.weight,e.nodeEdges(n).forEach(o=>{var s=o.v===n,l=s?o.w:o.v;if(l!==r){var c=s===i,u=e.edge(o).weight;if(a+=c?u:-u,function(t,e,n){return t.hasEdge(e,n)}(t,n,l)){var h=t.edge(n,l).cutvalue;a+=c?-h:h}}}),a}function MS(t,e){arguments.length<2&&(e=t.nodes()[0]),RS(t,{},1,e)}function RS(t,e,n,r,i){var o=n,a=t.node(r);return e[r]=!0,t.neighbors(r).forEach(i=>{Object.hasOwn(e,i)||(n=RS(t,e,n,i,r))}),a.low=o,a.lim=n++,i?a.parent=i:delete a.parent,n}function OS(t){return t.edges().find(e=>t.edge(e).cutvalue<0)}function NS(t,e,n){var r=n.v,i=n.w;e.hasEdge(r,i)||(r=n.w,i=n.v);var o=t.node(r),a=t.node(i),s=o,l=!1;o.lim>a.lim&&(s=a,l=!0);var c=e.edges().filter(e=>l===LS(t,t.node(e.v),s)&&l!==LS(t,t.node(e.w),s));return c.reduce((t,n)=>vS(e,n)<vS(e,t)?n:t)}function IS(t,e,n,r){var i=n.v,o=n.w;t.removeEdge(i,o),t.setEdge(r.v,r.w,{}),MS(t),SS(t,e),function(t,e){var n=t.nodes().find(t=>!e.node(t).parent),r=wS(t,n);(r=r.slice(1)).forEach(n=>{var r=t.node(n).parent,i=e.edge(n,r),o=!1;i||(i=e.edge(r,n),o=!0),e.node(n).rank=e.node(r).rank+(o?i.minlen:-i.minlen)})}(t,e)}function LS(t,e,n){return n.low<=e.lim&&e.lim<=n.lim}CS.initLowLimValues=MS,CS.initCutValues=SS,CS.calcCutValue=kS,CS.leaveEdge=OS,CS.enterEdge=NS,CS.exchangeEdges=IS;var PS=fS.longestPath,VS=gS,DS=TS,BS=function(t){var e=t.graph().ranker;if(e instanceof Function)return e(t);switch(t.graph().ranker){case"network-simplex":default:FS(t);break;case"tight-tree":!function(t){PS(t),VS(t)}(t);break;case"longest-path":zS(t);case"none":}};var zS=PS;function FS(t){DS(t)}var GS=function(t){let e=function(t){let e={},n=0;function r(i){let o=n;t.children(i).forEach(r),e[i]={low:o,lim:n++}}return t.children().forEach(r),e}(t);t.graph().dummyChains.forEach(n=>{let r=t.node(n),i=r.edgeObj,o=function(t,e,n,r){let i,o,a=[],s=[],l=Math.min(e[n].low,e[r].low),c=Math.max(e[n].lim,e[r].lim);i=n;do{i=t.parent(i),a.push(i)}while(i&&(e[i].low>l||c>e[i].lim));o=i,i=r;for(;(i=t.parent(i))!==o;)s.push(i);return{path:a.concat(s.reverse()),lca:o}}(t,e,i.v,i.w),a=o.path,s=o.lca,l=0,c=a[l],u=!0;for(;n!==i.w;){if(r=t.node(n),u){for(;(c=a[l])!==s&&t.node(c).maxRank<r.rank;)l++;c===s&&(u=!1)}if(!u){for(;l<a.length-1&&t.node(c=a[l+1]).minRank<=r.rank;)l++;c=a[l]}t.setParent(n,c),n=t.successors(n)[0]}})};let jS=ZC;var US={run:function(t){let e=jS.addDummyNode(t,"root",{},"_root"),n=function(t){var e={};function n(r,i){var o=t.children(r);o&&o.length&&o.forEach(t=>n(t,i+1)),e[r]=i}return t.children().forEach(t=>n(t,1)),e}(t),r=Object.values(n),i=jS.applyWithChunking(Math.max,r)-1,o=2*i+1;t.graph().nestingRoot=e,t.edges().forEach(e=>t.edge(e).minlen*=o);let a=function(t){return t.edges().reduce((e,n)=>e+t.edge(n).weight,0)}(t)+1;t.children().forEach(r=>YS(t,e,o,a,i,n,r)),t.graph().nodeRankFactor=o},cleanup:function(t){var e=t.graph();t.removeNode(e.nestingRoot),delete e.nestingRoot,t.edges().forEach(e=>{t.edge(e).nestingEdge&&t.removeEdge(e)})}};function YS(t,e,n,r,i,o,a){let s=t.children(a);if(!s.length)return void(a!==e&&t.setEdge(e,a,{weight:0,minlen:n}));let l=jS.addBorderNode(t,"_bt"),c=jS.addBorderNode(t,"_bb"),u=t.node(a);t.setParent(l,a),u.borderTop=l,t.setParent(c,a),u.borderBottom=c,s.forEach(s=>{YS(t,e,n,r,i,o,s);let u=t.node(s),h=u.borderTop?u.borderTop:s,f=u.borderBottom?u.borderBottom:s,d=u.borderTop?r:2*r,p=h!==f?1:i-o[a]+1;t.setEdge(l,h,{weight:d,minlen:p,nestingEdge:!0}),t.setEdge(f,c,{weight:d,minlen:p,nestingEdge:!0})}),t.parent(a)||t.setEdge(e,l,{weight:0,minlen:i+o[a]})}let HS=ZC;var qS=function(t){t.children().forEach(function e(n){let r=t.children(n),i=t.node(n);if(r.length&&r.forEach(e),Object.hasOwn(i,"minRank")){i.borderLeft=[],i.borderRight=[];for(let e=i.minRank,r=i.maxRank+1;e<r;++e)WS(t,"borderLeft","_bl",n,i,e),WS(t,"borderRight","_br",n,i,e)}})};function WS(t,e,n,r,i,o){let a={width:0,height:0,rank:o,borderType:e},s=i[e][o-1],l=HS.addDummyNode(t,"border",a,n);i[e][o]=l,t.setParent(l,r),s&&t.setEdge(s,l,{weight:1})}function $S(t){t.nodes().forEach(e=>XS(t.node(e))),t.edges().forEach(e=>XS(t.edge(e)))}function XS(t){let e=t.width;t.width=t.height,t.height=e}function KS(t){t.y=-t.y}function ZS(t){let e=t.x;t.x=t.y,t.y=e}let JS=ZC;var QS=function(t){let e={},n=t.nodes().filter(e=>!t.children(e).length),r=n.map(e=>t.node(e).rank),i=JS.applyWithChunking(Math.max,r),o=JS.range(i+1).map(()=>[]);function a(n){if(e[n])return;e[n]=!0;let r=t.node(n);o[r.rank].push(n),t.successors(n).forEach(a)}let s=n.sort((e,n)=>t.node(e).rank-t.node(n).rank);return s.forEach(a),o};let tk=ZC.zipObject;function ek(t,e,n){let r=tk(n,n.map((t,e)=>e)),i=e.flatMap(e=>t.outEdges(e).map(e=>({pos:r[e.w],weight:t.edge(e).weight})).sort((t,e)=>t.pos-e.pos)),o=1;for(;o<n.length;)o<<=1;let a=2*o-1;o-=1;let s=new Array(a).fill(0),l=0;return i.forEach(t=>{let e=t.pos+o;s[e]+=t.weight;let n=0;for(;e>0;)e%2&&(n+=s[e+1]),e=e-1>>1,s[e]+=t.weight;l+=t.weight*n}),l}let nk=ZC;var rk=function(t,e){let n={};return t.forEach((t,e)=>{let r=n[t.v]={indegree:0,in:[],out:[],vs:[t.v],i:e};void 0!==t.barycenter&&(r.barycenter=t.barycenter,r.weight=t.weight)}),e.edges().forEach(t=>{let e=n[t.v],r=n[t.w];void 0!==e&&void 0!==r&&(r.indegree++,e.out.push(n[t.w]))}),function(t){let e=[];function n(t){return e=>{e.merged||(void 0===e.barycenter||void 0===t.barycenter||e.barycenter>=t.barycenter)&&function(t,e){let n=0,r=0;t.weight&&(n+=t.barycenter*t.weight,r+=t.weight);e.weight&&(n+=e.barycenter*e.weight,r+=e.weight);t.vs=e.vs.concat(t.vs),t.barycenter=n/r,t.weight=r,t.i=Math.min(e.i,t.i),e.merged=!0}(t,e)}}function r(e){return n=>{n.in.push(e),0===--n.indegree&&t.push(n)}}for(;t.length;){let i=t.pop();e.push(i),i.in.reverse().forEach(n(i)),i.out.forEach(r(i))}return e.filter(t=>!t.merged).map(t=>nk.pick(t,["vs","i","barycenter","weight"]))}(Object.values(n).filter(t=>!t.indegree))};let ik=ZC;var ok=function(t,e){let n=ik.partition(t,t=>Object.hasOwn(t,"barycenter")),r=n.lhs,i=n.rhs.sort((t,e)=>e.i-t.i),o=[],a=0,s=0,l=0;r.sort((c=!!e,(t,e)=>t.barycenter<e.barycenter?-1:t.barycenter>e.barycenter?1:c?e.i-t.i:t.i-e.i)),l=ak(o,i,l),r.forEach(t=>{l+=t.vs.length,o.push(t.vs),a+=t.barycenter*t.weight,s+=t.weight,l=ak(o,i,l)});var c;let u={vs:o.flat(!0)};s&&(u.barycenter=a/s,u.weight=s);return u};function ak(t,e,n){let r;for(;e.length&&(r=e[e.length-1]).i<=n;)e.pop(),t.push(r.vs),n++;return n}let sk=function(t,e=[]){return e.map(e=>{let n=t.inEdges(e);if(n.length){let r=n.reduce((e,n)=>{let r=t.edge(n),i=t.node(n.v);return{sum:e.sum+r.weight*i.order,weight:e.weight+r.weight}},{sum:0,weight:0});return{v:e,barycenter:r.sum/r.weight,weight:r.weight}}return{v:e}})},lk=rk,ck=ok;var uk=function t(e,n,r,i){let o=e.children(n),a=e.node(n),s=a?a.borderLeft:void 0,l=a?a.borderRight:void 0,c={};s&&(o=o.filter(t=>t!==s&&t!==l));let u=sk(e,o);u.forEach(n=>{if(e.children(n.v).length){let s=t(e,n.v,r,i);c[n.v]=s,Object.hasOwn(s,"barycenter")&&(a=s,void 0!==(o=n).barycenter?(o.barycenter=(o.barycenter*o.weight+a.barycenter*a.weight)/(o.weight+a.weight),o.weight+=a.weight):(o.barycenter=a.barycenter,o.weight=a.weight))}var o,a});let h=lk(u,r);!function(t,e){t.forEach(t=>{t.vs=t.vs.flatMap(t=>e[t]?e[t].vs:t)})}(h,c);let f=ck(h,i);if(s&&(f.vs=[s,f.vs,l].flat(!0),e.predecessors(s).length)){let t=e.node(e.predecessors(s)[0]),n=e.node(e.predecessors(l)[0]);Object.hasOwn(f,"barycenter")||(f.barycenter=0,f.weight=0),f.barycenter=(f.barycenter*f.weight+t.order+n.order)/(f.weight+2),f.weight+=2}return f};let hk=GC.Graph,fk=ZC;var dk=function(t,e,n,r){r||(r=t.nodes());let i=function(t){var e;for(;t.hasNode(e=fk.uniqueId("_root")););return e}(t),o=new hk({compound:!0}).setGraph({root:i}).setDefaultNodeLabel(e=>t.node(e));return r.forEach(r=>{let a=t.node(r),s=t.parent(r);(a.rank===e||a.minRank<=e&&e<=a.maxRank)&&(o.setNode(r),o.setParent(r,s||i),t[n](r).forEach(e=>{let n=e.v===r?e.w:e.v,i=o.edge(n,r),a=void 0!==i?i.weight:0;o.setEdge(n,r,{weight:t.edge(e).weight+a})}),Object.hasOwn(a,"minRank")&&o.setNode(r,{borderLeft:a.borderLeft[e],borderRight:a.borderRight[e]}))}),o};let pk=QS,gk=function(t,e){let n=0;for(let r=1;r<e.length;++r)n+=ek(t,e[r-1],e[r]);return n},_k=uk,yk=dk,mk=function(t,e,n){let r,i={};n.forEach(n=>{let o,a,s=t.parent(n);for(;s;){if(o=t.parent(s),o?(a=i[o],i[o]=s):(a=r,r=s),a&&a!==s)return void e.setEdge(a,s);s=o}})},bk=GC.Graph,vk=ZC;var xk=function t(e,n){if(n&&"function"==typeof n.customOrder)return void n.customOrder(e,t);let r=vk.maxRank(e),i=wk(e,vk.range(1,r+1),"inEdges"),o=wk(e,vk.range(r-1,-1,-1),"outEdges"),a=pk(e);if(Ak(e,a),n&&n.disableOptimalOrderHeuristic)return;let s,l=Number.POSITIVE_INFINITY;for(let t=0,n=0;n<4;++t,++n){Ek(t%2?i:o,t%4>=2),a=vk.buildLayerMatrix(e);let r=gk(e,a);r<l&&(n=0,s=Object.assign({},a),l=r)}Ak(e,s)};function wk(t,e,n){const r=new Map,i=(t,e)=>{r.has(t)||r.set(t,[]),r.get(t).push(e)};for(const e of t.nodes()){const n=t.node(e);if("number"==typeof n.rank&&i(n.rank,e),"number"==typeof n.minRank&&"number"==typeof n.maxRank)for(let t=n.minRank;t<=n.maxRank;t++)t!==n.rank&&i(t,e)}return e.map(function(e){return yk(t,e,n,r.get(e)||[])})}function Ek(t,e){let n=new bk;t.forEach(function(t){let r=t.graph().root,i=_k(t,r,n,e);i.vs.forEach((e,n)=>t.node(e).order=n),mk(t,n,i.vs)})}function Ak(t,e){Object.values(e).forEach(e=>e.forEach((e,n)=>t.node(e).order=n))}let Tk=GC.Graph,Ck=ZC;var Sk=function(t){let e,n=Ck.buildLayerMatrix(t),r=Object.assign(function(t,e){let n={};function r(e,r){let i=0,o=0,a=e.length,s=r[r.length-1];return r.forEach((e,l)=>{let c=function(t,e){if(t.node(e).dummy)return t.predecessors(e).find(e=>t.node(e).dummy)}(t,e),u=c?t.node(c).order:a;(c||e===s)&&(r.slice(o,l+1).forEach(e=>{t.predecessors(e).forEach(r=>{let o=t.node(r),a=o.order;!(a<i||u<a)||o.dummy&&t.node(e).dummy||kk(n,r,e)})}),o=l+1,i=u)}),r}return e.length&&e.reduce(r),n}(t,n),function(t,e){let n={};function r(e,r,i,o,a){let s;Ck.range(r,i).forEach(r=>{s=e[r],t.node(s).dummy&&t.predecessors(s).forEach(e=>{let r=t.node(e);r.dummy&&(r.order<o||r.order>a)&&kk(n,e,s)})})}function i(e,n){let i,o=-1,a=0;return n.forEach((s,l)=>{if("border"===t.node(s).dummy){let e=t.predecessors(s);e.length&&(i=t.node(e[0]).order,r(n,a,l,o,i),a=l,o=i)}r(n,a,n.length,i,e.length)}),n}return e.length&&e.reduce(i),n}(t,n)),i={};["u","d"].forEach(o=>{e="u"===o?n:Object.values(n).reverse(),["l","r"].forEach(n=>{"r"===n&&(e=e.map(t=>Object.values(t).reverse()));let a=("u"===o?t.predecessors:t.successors).bind(t),s=function(t,e,n,r){let i={},o={},a={};return e.forEach(t=>{t.forEach((t,e)=>{i[t]=t,o[t]=t,a[t]=e})}),e.forEach(t=>{let e=-1;t.forEach(t=>{let s=r(t);if(s.length){s=s.sort((t,e)=>a[t]-a[e]);let r=(s.length-1)/2;for(let l=Math.floor(r),c=Math.ceil(r);l<=c;++l){let r=s[l];o[t]===t&&e<a[r]&&!Mk(n,t,r)&&(o[r]=t,o[t]=i[t]=i[r],e=a[r])}}})}),{root:i,align:o}}(0,e,r,a),l=function(t,e,n,r,i){let o={},a=function(t,e,n,r){let i=new Tk,o=t.graph(),a=function(t,e,n){return(r,i,o)=>{let a,s=r.node(i),l=r.node(o),c=0;if(c+=s.width/2,Object.hasOwn(s,"labelpos"))switch(s.labelpos.toLowerCase()){case"l":a=-s.width/2;break;case"r":a=s.width/2}if(a&&(c+=n?a:-a),a=0,c+=(s.dummy?e:t)/2,c+=(l.dummy?e:t)/2,c+=l.width/2,Object.hasOwn(l,"labelpos"))switch(l.labelpos.toLowerCase()){case"l":a=l.width/2;break;case"r":a=-l.width/2}return a&&(c+=n?a:-a),a=0,c}}(o.nodesep,o.edgesep,r);return e.forEach(e=>{let r;e.forEach(e=>{let o=n[e];if(i.setNode(o),r){var s=n[r],l=i.edge(s,o);i.setEdge(s,o,Math.max(a(t,e,r),l||0))}r=e})}),i}(t,e,n,i),s=i?"borderLeft":"borderRight";function l(t,e){let n=a.nodes(),r=n.pop(),i={};for(;r;)i[r]?t(r):(i[r]=!0,n.push(r),n=n.concat(e(r))),r=n.pop()}function c(t){o[t]=a.inEdges(t).reduce((t,e)=>Math.max(t,o[e.v]+a.edge(e)),0)}function u(e){let n=a.outEdges(e).reduce((t,e)=>Math.min(t,o[e.w]-a.edge(e)),Number.POSITIVE_INFINITY),r=t.node(e);n!==Number.POSITIVE_INFINITY&&r.borderType!==s&&(o[e]=Math.max(o[e],n))}return l(c,a.predecessors.bind(a)),l(u,a.successors.bind(a)),Object.keys(r).forEach(t=>o[t]=o[n[t]]),o}(t,e,s.root,s.align,"r"===n);"r"===n&&(l=Ck.mapValues(l,t=>-t)),i[o+n]=l})});let o=function(t,e){return Object.values(e).reduce((e,n)=>{let r=Number.NEGATIVE_INFINITY,i=Number.POSITIVE_INFINITY;Object.entries(n).forEach(([e,n])=>{let o=function(t,e){return t.node(e).width}(t,e)/2;r=Math.max(n+o,r),i=Math.min(n-o,i)});const o=r-i;return o<e[0]&&(e=[o,n]),e},[Number.POSITIVE_INFINITY,null])[1]}(t,i);return function(t,e){let n=Object.values(e),r=Ck.applyWithChunking(Math.min,n),i=Ck.applyWithChunking(Math.max,n);["u","d"].forEach(n=>{["l","r"].forEach(o=>{let a=n+o,s=t[a];if(s===e)return;let l=Object.values(s),c=r-Ck.applyWithChunking(Math.min,l);"l"!==o&&(c=i-Ck.applyWithChunking(Math.max,l)),c&&(t[a]=Ck.mapValues(s,t=>t+c))})})}(i,o),function(t,e){return Ck.mapValues(t.ul,(n,r)=>{if(e)return t[e.toLowerCase()][r];{let e=Object.values(t).map(t=>t[r]).sort((t,e)=>t-e);return(e[1]+e[2])/2}})}(i,t.graph().align)};function kk(t,e,n){if(e>n){let t=e;e=n,n=t}let r=t[e];r||(t[e]=r={}),r[n]=!0}function Mk(t,e,n){if(e>n){let t=e;e=n,n=t}return!!t[e]&&Object.hasOwn(t[e],n)}let Rk=ZC,Ok=Sk;var Nk=function(t){(function(t){let e=Rk.buildLayerMatrix(t),n=t.graph().ranksep,r=0;e.forEach(e=>{const i=e.reduce((e,n)=>{const r=t.node(n).height;return e>r?e:r},0);e.forEach(e=>t.node(e).y=r+i/2),r+=i+n})})(t=Rk.asNonCompoundGraph(t)),Object.entries(Ok(t)).forEach(([e,n])=>t.node(e).x=n)};let Ik=lS,Lk=uS,Pk=BS,Vk=ZC.normalizeRanks,Dk=GS,Bk=ZC.removeEmptyRanks,zk=US,Fk=qS,Gk={adjust:function(t){let e=t.graph().rankdir.toLowerCase();"lr"!==e&&"rl"!==e||$S(t)},undo:function(t){let e=t.graph().rankdir.toLowerCase();"bt"!==e&&"rl"!==e||function(t){t.nodes().forEach(e=>KS(t.node(e))),t.edges().forEach(e=>{let n=t.edge(e);n.points.forEach(KS),Object.hasOwn(n,"y")&&KS(n)})}(t);"lr"!==e&&"rl"!==e||(!function(t){t.nodes().forEach(e=>ZS(t.node(e))),t.edges().forEach(e=>{let n=t.edge(e);n.points.forEach(ZS),Object.hasOwn(n,"x")&&ZS(n)})}(t),$S(t))}},jk=xk,Uk=Nk,Yk=ZC,Hk=GC.Graph;var qk=function(t,e){let n=e&&e.debugTiming?Yk.time:Yk.notime;n("layout",()=>{let r=n(" buildLayoutGraph",()=>function(t){let e=new Hk({multigraph:!0,compound:!0}),n=nM(t.graph());return e.setGraph(Object.assign({},$k,eM(n,Wk),Yk.pick(n,Xk))),t.nodes().forEach(n=>{const r=eM(nM(t.node(n)),Kk);Object.keys(Zk).forEach(t=>{void 0===r[t]&&(r[t]=Zk[t])}),e.setNode(n,r),e.setParent(n,t.parent(n))}),t.edges().forEach(n=>{let r=nM(t.edge(n));e.setEdge(n,Object.assign({},Qk,eM(r,Jk),Yk.pick(r,tM)))}),e}(t));n(" runLayout",()=>function(t,e,n){e(" makeSpaceForEdgeLabels",()=>function(t){let e=t.graph();e.ranksep/=2,t.edges().forEach(n=>{let r=t.edge(n);r.minlen*=2,"c"!==r.labelpos.toLowerCase()&&("TB"===e.rankdir||"BT"===e.rankdir?r.width+=r.labeloffset:r.height+=r.labeloffset)})}(t)),e(" removeSelfEdges",()=>function(t){t.edges().forEach(e=>{if(e.v===e.w){var n=t.node(e.v);n.selfEdges||(n.selfEdges=[]),n.selfEdges.push({e:e,label:t.edge(e)}),t.removeEdge(e)}})}(t)),e(" acyclic",()=>Ik.run(t)),e(" nestingGraph.run",()=>zk.run(t)),e(" rank",()=>Pk(Yk.asNonCompoundGraph(t))),e(" injectEdgeLabelProxies",()=>function(t){t.edges().forEach(e=>{let n=t.edge(e);if(n.width&&n.height){let n=t.node(e.v),r={rank:(t.node(e.w).rank-n.rank)/2+n.rank,e:e};Yk.addDummyNode(t,"edge-proxy",r,"_ep")}})}(t)),e(" removeEmptyRanks",()=>Bk(t)),e(" nestingGraph.cleanup",()=>zk.cleanup(t)),e(" normalizeRanks",()=>Vk(t)),e(" assignRankMinMax",()=>function(t){let e=0;t.nodes().forEach(n=>{let r=t.node(n);r.borderTop&&(r.minRank=t.node(r.borderTop).rank,r.maxRank=t.node(r.borderBottom).rank,e=Math.max(e,r.maxRank))}),t.graph().maxRank=e}(t)),e(" removeEdgeLabelProxies",()=>function(t){t.nodes().forEach(e=>{let n=t.node(e);"edge-proxy"===n.dummy&&(t.edge(n.e).labelRank=n.rank,t.removeNode(e))})}(t)),e(" normalize.run",()=>Lk.run(t)),e(" parentDummyChains",()=>Dk(t)),e(" addBorderSegments",()=>Fk(t)),e(" order",()=>jk(t,n)),e(" insertSelfEdges",()=>function(t){var e=Yk.buildLayerMatrix(t);e.forEach(e=>{var n=0;e.forEach((e,r)=>{var i=t.node(e);i.order=r+n,(i.selfEdges||[]).forEach(e=>{Yk.addDummyNode(t,"selfedge",{width:e.label.width,height:e.label.height,rank:i.rank,order:r+ ++n,e:e.e,label:e.label},"_se")}),delete i.selfEdges})})}(t)),e(" adjustCoordinateSystem",()=>Gk.adjust(t)),e(" position",()=>Uk(t)),e(" positionSelfEdges",()=>function(t){t.nodes().forEach(e=>{var n=t.node(e);if("selfedge"===n.dummy){var r=t.node(n.e.v),i=r.x+r.width/2,o=r.y,a=n.x-i,s=r.height/2;t.setEdge(n.e,n.label),t.removeNode(e),n.label.points=[{x:i+2*a/3,y:o-s},{x:i+5*a/6,y:o-s},{x:i+a,y:o},{x:i+5*a/6,y:o+s},{x:i+2*a/3,y:o+s}],n.label.x=n.x,n.label.y=n.y}})}(t)),e(" removeBorderNodes",()=>function(t){t.nodes().forEach(e=>{if(t.children(e).length){let n=t.node(e),r=t.node(n.borderTop),i=t.node(n.borderBottom),o=t.node(n.borderLeft[n.borderLeft.length-1]),a=t.node(n.borderRight[n.borderRight.length-1]);n.width=Math.abs(a.x-o.x),n.height=Math.abs(i.y-r.y),n.x=o.x+n.width/2,n.y=r.y+n.height/2}}),t.nodes().forEach(e=>{"border"===t.node(e).dummy&&t.removeNode(e)})}(t)),e(" normalize.undo",()=>Lk.undo(t)),e(" fixupEdgeLabelCoords",()=>function(t){t.edges().forEach(e=>{let n=t.edge(e);if(Object.hasOwn(n,"x"))switch("l"!==n.labelpos&&"r"!==n.labelpos||(n.width-=n.labeloffset),n.labelpos){case"l":n.x-=n.width/2+n.labeloffset;break;case"r":n.x+=n.width/2+n.labeloffset}})}(t)),e(" undoCoordinateSystem",()=>Gk.undo(t)),e(" translateGraph",()=>function(t){let e=Number.POSITIVE_INFINITY,n=0,r=Number.POSITIVE_INFINITY,i=0,o=t.graph(),a=o.marginx||0,s=o.marginy||0;function l(t){let o=t.x,a=t.y,s=t.width,l=t.height;e=Math.min(e,o-s/2),n=Math.max(n,o+s/2),r=Math.min(r,a-l/2),i=Math.max(i,a+l/2)}t.nodes().forEach(e=>l(t.node(e))),t.edges().forEach(e=>{let n=t.edge(e);Object.hasOwn(n,"x")&&l(n)}),e-=a,r-=s,t.nodes().forEach(n=>{let i=t.node(n);i.x-=e,i.y-=r}),t.edges().forEach(n=>{let i=t.edge(n);i.points.forEach(t=>{t.x-=e,t.y-=r}),Object.hasOwn(i,"x")&&(i.x-=e),Object.hasOwn(i,"y")&&(i.y-=r)}),o.width=n-e+a,o.height=i-r+s}(t)),e(" assignNodeIntersects",()=>function(t){t.edges().forEach(e=>{let n,r,i=t.edge(e),o=t.node(e.v),a=t.node(e.w);i.points?(n=i.points[0],r=i.points[i.points.length-1]):(i.points=[],n=a,r=o),i.points.unshift(Yk.intersectRect(o,n)),i.points.push(Yk.intersectRect(a,r))})}(t)),e(" reversePoints",()=>function(t){t.edges().forEach(e=>{let n=t.edge(e);n.reversed&&n.points.reverse()})}(t)),e(" acyclic.undo",()=>Ik.undo(t))}(r,n,e)),n(" updateInputGraph",()=>function(t,e){t.nodes().forEach(n=>{let r=t.node(n),i=e.node(n);r&&(r.x=i.x,r.y=i.y,r.rank=i.rank,e.children(n).length&&(r.width=i.width,r.height=i.height))}),t.edges().forEach(n=>{let r=t.edge(n),i=e.edge(n);r.points=i.points,Object.hasOwn(i,"x")&&(r.x=i.x,r.y=i.y)}),t.graph().width=e.graph().width,t.graph().height=e.graph().height}(t,r))})};let Wk=["nodesep","edgesep","ranksep","marginx","marginy"],$k={ranksep:50,edgesep:20,nodesep:50,rankdir:"tb"},Xk=["acyclicer","ranker","rankdir","align"],Kk=["width","height","rank"],Zk={width:0,height:0},Jk=["minlen","weight","width","height","labeloffset"],Qk={minlen:1,weight:1,width:0,height:0,labeloffset:10,labelpos:"r"},tM=["labelpos"];function eM(t,e){return Yk.mapValues(Yk.pick(t,e),Number)}function nM(t){var e={};return t&&Object.entries(t).forEach(([t,n])=>{"string"==typeof t&&(t=t.toLowerCase()),e[t]=n}),e}let rM=ZC,iM=GC.Graph;var oM={debugOrdering:function(t){let e=rM.buildLayerMatrix(t),n=new iM({compound:!0,multigraph:!0}).setGraph({});return t.nodes().forEach(e=>{n.setNode(e,{label:e}),n.setParent(e,"layer"+t.node(e).rank)}),t.edges().forEach(t=>n.setEdge(t.v,t.w,{},t.name)),e.forEach((t,e)=>{let r="layer"+e;n.setNode(r,{rank:"same"}),t.reduce((t,e)=>(n.setEdge(t,e,{style:"invis"}),e))}),n}};var aM={graphlib:GC,layout:qk,debug:oM,util:{time:ZC.time,notime:ZC.notime},version:"1.1.8"};class sM extends pE{constructor(t){super(t)}run(){super.run();let t=this._outputVars[0].element,e=Qw(t.parent);for(let t of e){let e=t.layout;if(!e)continue;let r=YE(t.children[0]);if(!r)continue;var n=new aM.graphlib.Graph;n.setGraph({edgesep:e._edgeSep}),n.setDefaultEdgeLabel(function(){return{}}),n.graph().rankdir=this._getDagreDirection(e.direction);let i=new Map;for(let e of t.children){let t=e.dataScope.getAttrVal(qE);i.set(t,t+""),n.setNode(t,{label:e.text?e.text:"",width:e.bounds.width,height:e.bounds.height})}for(let t of r.linkList)n.setEdge(t.source,t.target);aM.layout(n);const o={};let a=Math.min(...n.nodes().map(t=>n.node(t).y)),s=Math.min(...n.nodes().map(t=>n.node(t).x)),l=e.left-s,c=e.top-a;for(const t of n.nodes())o[t]={x:n.node(t).x+l,y:n.node(t).y+c};for(let e of t.children){let t=e.dataScope.getAttrVal(qE);dA(e,o[i.get(t)].x-e.x,o[i.get(t)].y-e.y)}}let r=lE(t,!0);for(let t of r)$w(t)}_getDagreDirection(t){switch(t){case EE.Left2Right:return"LR";case EE.Right2Left:return"RL";case EE.Top2Bottom:return"TB";case EE.Bottom2Top:return"BT"}}}class lM extends pE{constructor(t){super(t)}run(){super.run();let t=this._outputVars[0].element,e=Qw(t.parent);for(let t of e){let e=t.layout;if(!e)continue;let n=jE(t.children[0]);if(!n)continue;let r=Od(n._data),i=Math.max(...t.children.map(t=>t.bounds.width)),o=Math.max(...t.children.map(t=>t.bounds.height)),a=e.orientation==bE?[e.height,e.width]:[e.width,e.height],s=wp().nodeSize([i,o]).size(a)(r);this._apply(s,e,t)}$w(t)}_apply(t,e,n){let r,i,o=n.children.filter(e=>e.dataScope.getAttrVal(qE)==t.data[qE])[0];switch(e.orientation){case bE:r=t.y+e.left,i=t.x+e.top;break;case vE:r=t.x+e.left,i=e.top+t.y}if(dA(o,r-o.x,i-o.y),t.children&&t.children.length>0)for(let r of t.children)this._apply(r,e,n)}}class cM extends pE{constructor(t){super(t)}run(){super.run();let t=this._outputVars[0].element,e=this._inputVars.filter(t=>t.type===nA.PROPERTY&&t.property===SA.CHILDREN_ORDER)[0].element,n=e.layout,r=n.width?n.width:e.bounds.width,i=n.height?n.height:e.bounds.height,o=void 0===n.top?e.bounds.top:n.top,a=void 0===n.left?e.bounds.left:n.left,s=Od(e).sum(t=>t.type===bT.Rect?t.width*t.height:0);Sp().size([r,i])(s),this._apply(s,a,o);let l=lE(t,!0);for(let t of l)$w(t)}_apply(t,e,n){if(t.data.type==bT.Collection&&t.children)for(let r of t.children)this._apply(r,e,n);else t.data.type==bT.Rect&&(t.data.resize(t.x1-t.x0,t.y1-t.y0),dA(t.data,t.x0+e-t.data.left,t.y0+n-t.data.top))}}class uM extends pE{constructor(t){super(t)}run(){super.run();let t=this._outputVars[0].element,e=Qw(t.parent);for(let t of e){if(!t.layout)continue;if(0===t.children.length)continue;let e=jE(t.children[0]);if(!e)continue;let n={};for(let e of t.children)n[e.dataScope.getAttrVal(qE)]=e;t.children[0].type===bT.Rect?this._layoutRects(e.getRoot(),e,n):this._layoutArcs(e.getRoot(),e,n)}$w(t)}_layoutArcs(t,e,n){let r=e.getChildren(t);if(0===r.length)return;let i=n[t[qE]],o=!i||i.type!=bT.Arc&&i.type!=bT.Pie?60:i.startAngle;for(let t=0;t<r.length;t++){let i=r[t],a=n[i[qE]];if(a.type===bT.Arc){let t=VE(o+a.angle);a.setAngles(o,t),o=t}this._layoutArcs(i,e,n)}}_layoutRects(t,e,n){let r=e.getChildren(t);if(0===r.length)return;let i,o,a=n[t[qE]];this._direction,i=a.left,o=a.bottom;for(let t=0;t<r.length;t++){let a=r[t],s=n[a[qE]];dA(s,i-s.left,o-s.top),i+=s.width,this._layoutRects(a,e,n)}}}class hM extends pE{constructor(t){super(t)}run(){super.run();let t=this.outputVar,e=this.inputVars[0],n=t.conditionalEncoding,r=e.context,i=t.result,o=n.responderComponent;i.clear();let a=Array.isArray(o)?o:[o];if(n.evalFunction)for(let t of a){Qw(t).forEach(t=>i.setValue(t.id,n.evalFunction(r,t)))}}}class fM extends pE{constructor(t){super(t)}run(){super.run();let t=this._outputVars[0].element,e=Qw(t.parent);for(let t of e){let e=t.layout;if(!e)continue;let n=360/t.children.length;for(let[r,i]of t.children.entries())dA(i,e.x+e.radius-i.bounds.x,e.y-i.bounds.y),i._rotate=[r*n,e.x,e.y]}let n=lE(t,!0);for(let t of n)$w(t)}}class dM extends pE{constructor(t){super(t)}run(){super.run();let t=this._outputVars[0].element,e=Qw(t.parent);for(let n of e){let e=n.layout;if(!e)continue;let r=Od(e._tree?e._tree._data:jE(n.children[0])._data);if(e.isRadial()){r=Md().size([LE(e.angleExtent),e.radius])(r),e._d3Root=r;const t=new Map(r.descendants().map(t=>[t.data[qE],[t.x,t.y]]));for(let r of n.children){let n=r.dataScope.getAttrVal(qE);dA(r,e.x-r.bounds.x,e.y-t.get(n)[1]-r.bounds.y),r._rotate=[PE(t.get(n)[0]),e.x,e.y]}}else if(e.orientation===vE){!e.width||e.width;let i=e.height?e.height:600;r=Md().nodeSize([t.bounds.width+1,i/(r.height+1)])(r),e._d3Root=r;const o=new Map(r.descendants().map(t=>[t.data[qE],[t.x,t.y]]));let a=1/0,s=-a;r.each(t=>{t.x>s&&(s=t.x),t.x<a&&(a=t.x)}),e._x0=a;for(let t of n.children){let n=t.dataScope.getAttrVal(qE);dA(t,o.get(n)[0]-a+e.left-t.bounds.x,o.get(n)[1]+e.top-t.bounds.y)}}else if(e.orientation===bE){!e.width||e.width;let i=e.height?e.height:600;r=Md().nodeSize([t.bounds.height,i/(r.height+1)])(r),e._d3Root=r;const o=new Map(r.descendants().map(t=>[t.data[qE],[t.x,t.y]]));let a=1/0,s=-a;r.each(t=>{t.x>s&&(s=t.x),t.x<a&&(a=t.x)}),e._x0=a;for(let t of n.children){let n=t.dataScope.getAttrVal(qE);dA(t,o.get(n)[1]+e.left-t.bounds.x,o.get(n)[0]-a+e.top-t.bounds.y)}}}let n=lE(t,!0);for(let t of n)$w(t)}}class pM extends eA{constructor(t,e){super(t),this._cond=e}get context(){return this._cond}}class gM extends pE{constructor(t,e,n){super(t),this._fn=e,this._compnt=n}run(){super.run();let t=this.inputVars.find(t=>t instanceof pM);this.outputVar,this._fn(void 0,t.context,this._compnt)}}class _M extends pE{constructor(t){super(t)}run(){super.run();let t=this.outputVar,e=this.inputVars.find(t=>t instanceof RT),n=t.encodings[0].dataTable.getAttributeType(e.attribute),r={};for(let e of t.encodings){let t=this._computeAttrValues(e,n);Object.assign(r,t)}t.attrValues=r}_computeAttrValues(t,e){let n=Qw(t.element),r={};if(t.element.type===bT.Area&&["width","height","fillGradient"].indexOf(t.channel)>=0)for(let e of n)for(let n of e.vertices)r[n.id]=zE(n).aggregateNumericalAttribute(t.attribute,t.aggregator);else switch(e){case $E.Boolean:break;case $E.Date:for(let e of n)r[e.id]=zE(e).getAttrVal(t.attribute);break;case $E.String:try{if("count"==t.aggregator)for(let e of n)r[e.id]=zE(e).getAttributeValues(t.attribute).length;else for(let e of n)r[e.id]=zE(e).getAttrVal(t.attribute)}catch(e){throw new Error("Cannot bind "+this.channel+" to "+t.attribute+" : "+e)}break;default:if(t.attribute.startsWith("parent.")||t.attribute.startsWith("child.")){let e=t.dataTable.tree.nodeTable,i=t.attribute.split(".")[0],o=t.attribute.split(".")[1];for(let t of n){let n=zE(t).getAttrVal(i);r[t.id]=new BE(e).cross(qE,n).getAttrVal(o)}}else for(let e of n)r[e.id]=zE(e).aggregateNumericalAttribute(t.attribute,t.aggregator)}if(t.transform)for(let e of n)r[e.id]=t.transform(r[e.id],e);return t.attrValues=r,r}}class yM extends eA{constructor(t,e,n){super(t),this._dataset=n,this._predicate=e}get dataset(){return this._dataset}get predicate(){return this._predicate}}class mM{constructor(){this._variables={},this._operators={},this._edges=[]}toJSON(){const t=this._edges.map(t=>({from:t.fromNode.id,to:t.toNode.id,isDirected:t.isDirected})),e={};for(const t in this._variables)e[t]=Object.values(this._variables[t]).map(t=>{let e={id:t.id,type:t.type,incoming:t.incomingEdges.map(t=>t.id),outgoing:t.outgoingEdges.map(t=>t.id),undirected:t.undirectedEdges.map(t=>t.id)};return"ChannelVar"===t.type?(e.channel=t.channel,e.element=t.element):"BoundsVar"===t.type||"DataScopeVar"===t.type?e.element=t.element:"dataValue"===t.type?(e.scale=t.scale,e.attrValues=t.attrValues):"FieldVar"===t.type?(e.field=t.field,e.dataset=t.dataset):"PropertyVar"===t.type?(e.property=t.property,e.element=t.element):e.scale=t.scale,e});const n={};for(const t in this._operators)n[t]=Object.values(this._operators[t]).map(t=>{let e={id:t.id,type:t.type,inputVars:t.inputVars.map(t=>t.id),outputVar:t.outputVar?t.outputVar.id:null};return t.type===gE.DOMAIN_BUILDER?e.aggregator=t.aggregator:t.type===gE.SCALE_BUILDER&&(e.channel=t.channel),e});return{edges:t,variables:e,operators:n}}getVariable(t,...e){if(Object.values(nA).indexOf(t)<0)throw console.log(t),new Error("Variable Type Not Known");let n=this.findVariable(t,e);if(n)return n;switch(t){case nA.CHANNEL:n=new rA(t,e[0],e[1]),"vertex"!=e[1].type&&"segment"!=e[1].type||this._connectPathElement2Size(e[1],n);break;case nA.PROPERTY:n=new AA(t,e[0],e[1]);break;case nA.ATTRIBUTE:n=new RT(t,e[0],e[1]);break;case nA.ITEMS:n=new yM(t,e[0],e[1]);break;case nA.ATTR_VALUE:n=new PT(t,e[0]);break;case nA.DATASCOPE:n=new ST(t,e[0]);break;case nA.BOUNDS:n=new CT(t,e[0]);break;case nA.SCALE:n=new xA(t,e[0]);break;case nA.AFFIXATION:n=new $T(t,e[0]);break;case nA.ALIGNMENT:n=new eC(t,e[0]);break;case nA.EVT_CTX:n=new pM(t,e[0],e[1]);break;case nA.CONDITION_RESULT:n=new wA(t,e[0],e[1])}return t in this._variables||(this._variables[t]={}),this._variables[t][n.id]=n,n}_connectPathElement2Size(t,e){let n=t.parent,r=e.channel,i=this.findVariable(nA.CHANNEL,["x"===r?"width":"height",n]);if(i){let t=i.incomingDataflow;t||(t=this.createOneWayDependency(gE.CONDUIT)),this.connect(e,t),this.connect(t,i)}}findIncomingDataflowOperator(t,e){return e.incomingDataflow&&e.incomingDataflow.type===t?e.incomingDataflow:void 0}getIncomingDataflowOperator(t,e){let n=this.findIncomingDataflowOperator(t,e);return n||this.createOneWayDependency(t)}getOutgoingDataflowOperator(t,e){for(let n of e.outgoingEdges)if(n.toNode instanceof pE&&n.toNode.type===t)return n.toNode;return this.createOneWayDependency(t)}createOneWayDependency(t,...e){if(Object.values(gE).indexOf(t)<0)throw new Error("Dependency Type Not Known");let n;switch(t){case gE.EVAL_BBOX:n=new DT(t);break;case gE.AFFIXER:n=new WT(t);break;case gE.DATA_EXTRACTOR:n=new _M(t,e[0]);break;case gE.SCALE_BUILDER:n=new VT(t,e[0]);break;case gE.ENCODER:n=new EA(t,e[0]);break;case gE.AXIS_PATH_PLACER:n=new BT(t);break;case gE.AXIS_TICKS_PLACER:n=new zT(t);break;case gE.AXIS_LABELS_PLACER:n=new FT(t);break;case gE.AXIS_TITLE_PLACER:n=new QT(t);break;case gE.LINK_PLACER:n=new rC(t);break;case gE.GRID_LAYOUT:n=new GT(t);break;case gE.STACK_LAYOUT:n=new UT(t);break;case gE.PACK_LAYOUT:n=new JT(t);break;case gE.FORCE_LAYOUT:n=new nC(t);break;case gE.DIRECTED_LAYOUT:n=new sM(t);break;case gE.TIDY_TREE_LAYOUT:n=new lM(t);break;case gE.TREEMAP_LAYOUT:n=new cM(t);break;case gE.STRATA_LAYOUT:n=new uM(t);break;case gE.CIRCULAR_LAYOUT:n=new fM(t);break;case gE.CLUSTER_LAYOUT:n=new dM(t);break;case gE.GRIDLINES_PLACER:n=new jT(t);break;case gE.BIN_TRANSFORMER:n=new HT(t);break;case gE.FILTER_TRANSFORMER:n=new qT(t);break;case gE.KDE_TRANSFORMER:n=new XT(t);break;case gE.TARGET_EVALUATOR:n=new hM(t);break;case gE.TARGET_UPDATER:n=new gM(t,e[0],e[1]);break;case gE.CONDUIT:default:n=new YT(t)}return t in this._operators||(this._operators[t]={}),this._operators[t][n.id]=n,n}createMultiWayDependency(t){if(Object.values(gE).indexOf(t)<0)throw new Error("Dependency Type Not Known");let e;return gE.ALIGNER,e=new tC(t),t in this._operators||(this._operators[t]={}),this._operators[t][e.id]=e,e}connect(t,e,n=!0){if(t instanceof eA&&e instanceof pE){if(!e.inputVars.includes(t)){const r=new MT(t,e,n);this._edges.push(r),t.outgoingEdges.push(r),e.inputVars.push(t)}}else if(t instanceof pE&&e instanceof eA){if(!t.outputVars.includes(e)){const r=new MT(t,e,n);this._edges.push(r),t.outputVars.push(e),e.incomingEdges.push(r)}}else if(t instanceof eA&&e instanceof kT){if(!e.vars.includes(t)){const n=new MT(t,e,!1);this._edges.push(n),e.vars.push(t),e.edges.push(t),t.undirectedEdges.push(n)}}else{if(!(t instanceof kT&&e instanceof eA))throw new Error("An edge must connect a variable and an operator.");if(!t.vars.includes(e)){const n=new MT(e,t,!1);this._edges.push(n),t.vars.push(e),t.edges.push(e),e.undirectedEdges.push(n)}}}disconnectChannelVarFromBBoxOperator(t){let e=this.getOutgoingDataflowOperator(gE.EVAL_BBOX,t),n=t.outgoingEdges.find(n=>n.fromNode===t&&n.toNode===e);n&&this.disconnect(t,e,n)}disconnect(t,e,n){if(t instanceof eA&&e instanceof pE){let r=t.outgoingEdges.findIndex(t=>t===n);r>=0&&(this._edges.splice(this._edges.indexOf(n),1),t.outgoingEdges.splice(r,1));let i=e.inputVars.findIndex(e=>e==t);i>=0&&e.inputVars.splice(i,1)}else if(t instanceof pE&&e instanceof eA){let r=e.incomingEdges.findIndex(t=>t===n);r>=0&&(this._edges.splice(this._edges.indexOf(n),1),e.incomingEdges.splice(r,1));let i=t.outputVars.findIndex(t=>t===e);i>=0&&t.outputVars.splice(i,1)}}deleteVariable(t){for(let e=t.incomingEdges.length-1;e>=0;e--){let n=t.incomingEdges[e],r=n.fromNode;this.disconnect(r,t,n),r.isIsolated()&&delete this._operators[r.type][r.id]}for(let e=t.outgoingEdges.length-1;e>=0;e--){let n=t.outgoingEdges[e],r=n.toNode;this.disconnect(t,r,n),r.isIsolated()&&delete this._operators[r.type][r.id]}delete this._variables[t.type][t.id]}deleteOperator(t){for(let e=t.outputVars.length-1;e>=0;e--){let n=t.outputVars[e],r=n.incomingEdges.find(e=>e.fromNode===t&&e.toNode===n);this.disconnect(t,n,r),n.isIsolated()&&delete this._variables[n.type][n.id]}for(let e=t.inputVars.length-1;e>=0;e--){let n=t.inputVars[e],r=n.outgoingEdges.find(e=>e.fromNode===n&&e.toNode===t);this.disconnect(n,t,r),n.isIsolated()&&delete this._variables[n.type][n.id]}delete this._operators[t.type][t.id]}addInteraction(t){}_dfs(t,e,n){if(t&&0!==t.outgoingEdges.length)for(let r of t.outgoingEdges)r.isDirected&&(e.push(r.toNode),this._dfs(r.toNode.outputVars[0],e.slice(),n));else n.push(e)}processChange(t,e,...n){let r=this.findVariable(t,n);if(r){for(let t of r.outgoingEdges)if(t.isDirected){let n=t.toNode;n.run();let r=n.outputVars;if(r.length>0){let t=r[0];switch(t.type){case nA.ITEMS:this.processChange(t.type,e,t.predicate,t.dataset);break;case nA.ATTRIBUTE:this.processChange(t.type,e,t.attribute,t.dataset);break;case nA.BOUNDS:this.processChange(t.type,e,t.element);break;case nA.CHANNEL:this.processChange(t.type,e,t.channel,t.element);break;case nA.PROPERTY:this.processChange(t.type,e,t.property,t.element);break;case nA.SCALE:case nA.ATTR_VALUE:this.processChange(t.type,e,t.encodings[0]);break;case nA.CONDITION_RESULT:this.processChange(t.type,e,t.result)}}}for(let t of r.undirectedEdges)e.push(t.operator)}else console.warn("Unable to find variables matching the described change: ",t,n)}findVariable(t,e){if(!(t in this._variables))return null;let n=Object.values(this._variables[t]);switch(t){case nA.CHANNEL:return n.find(t=>t.channel==e[0]&&lA(t.element)==lA(e[1]));case nA.PROPERTY:return n.find(t=>t.property==e[0]&&t.element==e[1]);case nA.AFFIXATION:return n.find(t=>t.affixation==e[0]);case nA.ATTRIBUTE:return n.find(t=>t.attribute==e[0]&&t.dataset==e[1]);case nA.ITEMS:return n.find(t=>t.dataset==e[1]);case nA.ATTR_VALUE:case nA.SCALE:return n.find(t=>t.encodings.includes(e[0]));case nA.EVT_CTX:return n.find(t=>t.context===e[0]);case nA.CONDITION_RESULT:return n.find(t=>t.result==e[0]);case nA.DATASCOPE:default:return e[0].classId?n.find(t=>lA(t.element)==lA(e[0])):n.find(t=>t.element.id==e[0].id)}}findVariablesByElement(t){let e={};for(let n in this._variables){let r=Object.values(this._variables[n]).filter(e=>e.element&&lA(e.element)==lA(t));r.length>0&&(e[n]=r)}return e}}function bM(t){return!(!Zw(t)&&t.type!=bT.Glyph||t.dataScope)||t.type===bT.Collection&&t.firstChild.dataScope.numTuples>1}function vM(t,e,n,r){let i=r.getAttributeType(n);if(i!=$E.String&&i!=$E.Date&&i!=$E.Integer)throw new Error("Repeat only works on a string or date attribute: "+n+" is "+i);if(!function(t){if(Array.isArray(t)){if(1===t.length)return bM(t[0]);for(let e of t)if(!Zw(e)||e.dataScope)return!1;return!0}return bM(t)}(e))throw new Error("The "+e.type+" is not repeatable");return function(t,e,n,r){let i=r.getAttributeSummary(n).unique.map(t=>e.dataScope?e.dataScope.cross(n,t):new BE(r).cross(n,t));i=i.filter(t=>!t.isEmpty());let o=pT(t,{type:bT.Collection});o.dataScope=e.dataScope?e.dataScope.clone():new BE(r),o.addChild(e),e._refBounds||(e._refBounds=e.bounds.clone());for(let t=1;t<i.length;t++){let t=yT(e);o.addChild(t)}return o.children.forEach((t,e)=>t.dataScope=i[e]),o}(t,e,n,r)}class xM{constructor(t,e,n,r,i){this._id="encoding_"+xT(),this._elem=t,this._channel=e,this._attribute=n,this._table=i.table,this._aggregator=r,this._includeZero=i.includeZero,this._flipScale=i.flipScale,this._mapping=i.mapping,this._preferredRangeExtent=i.rangeExtent,this._preferredRangeStart=i.rangeStart,this._preferredDomain=i.domain,this._scaleType=i.scaleType,this._colorScheme=i.scheme,this._forLegend=i.forLegend,this._transform=i.transform,i.shareScale&&(this._baseEnc=i.shareScale),this._scales=[],this._elemGroups=[],this._elem2scale={},this._refElements=[],["width","height","radius","angle","thickness","radialDistance","strokeWidth","area"].indexOf(this._channel)>=0&&(this._includeZero=!0),this.initialize()}get id(){return this._id}initialize(){this._scales=[];let t=Qw(this._elem);if(this._elemGroups=[],"x"===this._channel||"y"===this._channel){let e=this._elem,n=sE(e);if(n.layout&&n.layout.type==fE.GRID){let t="x"===this._channel?n.layout.getElementsByCol(!0,e):n.layout.getElementsByRow(!0,e);for(let e of t)this._createScaleForElems(e)}else if("vertex"===this._elem.type&&(hA(this._elem.parent)||uA(this._elem.parent))){let t=Qw(this._elem.parent).map(t=>tE(this._elem,[t]));for(let e of t)this._createScaleForElems(e)}else this._createScaleForElems(t)}else if("angle"===this._channel){let e=t.reduce((t,e)=>{const n=e.parent.id;return t[n]||(t[n]=[]),t[n].push(e),t},{}),n=Object.values(e);for(let t of n)this._createScaleForElems(t)}else this._createScaleForElems(t)}_createScaleForElems(t){this._elemGroups.push(t);var e=function(t){if(t.scaleType)return new OT(t.scaleType);if("text"===t.channel)return new OT("ordinal");switch(t.dataTable.getAttributeType(t.attribute)){case $E.Boolean:break;case $E.Date:return new OT("time");case $E.String:if("count"==t.aggregator)return new OT("linear");if(t.channel.indexOf("Color")>=0){let e={};return e.scheme=t.colorScheme?t.colorScheme:"schemeCategory10",new OT("ordinalColor",e)}return"src"===t.channel?new OT("ordinal"):new OT("point");default:return["strokeColor","fillColor","fillGradient"].indexOf(t.channel)>=0?t.mapping?new OT("linear"):new OT("sequentialColor",{scheme:t.colorScheme}):new OT("linear")}}(this);this._scales.push(e);for(let n of t)this._elem2scale[n.id]=e}getScale(t){return this._elem2scale[t.id]}getAttrValue(t,e,n){let r=this.getScale(e).invert(t,n),i=this._attribute;if(this.dataTable.getAttributeType(i)===$E.Date){let t=Qw(e).map(t=>t.dataScope.getAttrVal(i));return t.sort((t,e)=>t-e),t[s(t,r)]}return r}getChannelValue(t,e){return this.getScale(e).map(t)}getElements(t){let e=this._scales.indexOf(t);return this._elemGroups[e]}get element(){return this._elem}get channel(){return this._channel}get attribute(){return this._attribute}get dataTable(){return this._table}get aggregator(){return this._aggregator}hasMultipleScales(){return this._scales.length>0}get scales(){return this._scales}getRangeStart(t){let e=this.getScale(t);return Math.min(...e.range)}getRangeExtent(t){return this.getScale(t).rangeExtent}get domain(){if(1===this._scales.length)return this._scales[0].domain;throw new Error("AttributeEncoding: multiple scales exist, specify element to get domain.")}get rangeExtent(){if(1===this._scales.length)return this._scales[0].rangeExtent;throw new Error("AttributeEncoding: multiple scales exist, specify element to get rangeExtent.")}get scaleType(){return this._scaleType}set scaleType(t){this._scaleType=t}getDomain(t){return this.getScale(t).domain}set domain(t){this._preferredDomain=t;for(let e of this._scales)e._scale.domain(t);for(let t of this._refElements)t instanceof hT&&t.createTicksLabels({});this._elem.scene.onChange(nA.ATTR_VALUE,this)}set rangeExtent(t){for(let e of this._scales)e.rangeExtent=t;for(let t of this._refElements)t instanceof hT&&t.createTicksLabels({});this._elem.scene.onChange(nA.PROPERTY,SA.RANGE_EXTENT,this)}get transform(){return this._transform}set transform(t){this._transform=t,this._elem.scene.onChange(nA.PROPERTY,SA.TRANSFORM,this)}set includeZero(t){this._includeZero=t;for(let t of this._refElements)t instanceof hT&&t.createTicksLabels({});this._elem.scene.onChange(nA.PROPERTY,SA.INCLUDE_ZERO,this)}get includeZero(){return this._includeZero}set flipScale(t){this._flipScale=t,this._elem.scene.onChange(nA.PROPERTY,SA.FLIP_SCALE,this)}get flipScale(){return this._flipScale}set mapping(t){this._mapping=t}get mapping(){return this._mapping}set colorScheme(t){this._colorScheme=t}get colorScheme(){return this._colorScheme}addRefElement(t){this._refElements.indexOf(t)<0&&this._refElements.push(t)}get refElements(){return this._refElements}clearRefElements(){this._refElements=[]}pan(t,e,n){let r=n||this._elem;r.scene.createMask(r);let i=this.getDomain(r),o=Math.min(...i),a=Math.max(...i),s="log"!==this._scales[0].type,l=this.getAttrValue(t,r,s)-this.getAttrValue(t+e,r,s);(s||o+l>0)&&(this.domain=[o+l,a+l])}zoom(t,e,n,r){let i=r||this._elem;i.scene.createMask(i);let o=this.getDomain(i),a=Math.min(...o),s=Math.max(...o),l="log"!==this._scales[0].type,c=this.getAttrValue(e,i,l),u=a-(c-a)*t*n,h=s+(s-c)*t*n;u!==h&&(!l&&u<=0||(this.domain=[u,h]))}}class wM{constructor(){this._vals={},this._vals.elements=[]}set(t,e){this._vals[t]=e}get(t){return this._vals[t]}clear(){this._vals={},this._vals.elements=[]}}class EM{constructor(t,e,n,r){this._respCompnt=e,this._responderEval=n,this._efxFn=r,this._evtCtx=t,this._evalResult=new LT}get responderComponent(){return this._respCompnt}get eventContext(){return this._evtCtx}get evalResult(){return this._evalResult}get evalFunction(){return this._responderEval}get stylingFunction(){return this._efxFn}}class AM extends kE{constructor(t,e,n,r,i){super(i),this._type=bT.Gridlines,this._id=this._type+xT(),this._attribute=e,this._channel=t,this._scale=n,this._elems=r,this._args=i,"strokeColor"in i||(this.styles.strokeColor="#ddd"),"opacity"in i||(this.styles.opacity=.5),this.updateValues(),this._lines=[]}updateValues(){"values"in this._args?this._values=this._args.values:this._scale?this._values=oT(this._scale,this._channel,this._elems):this._values=this._elems.map(t=>t.dataScope.getAttrVal(this._attribute))}get type(){return this._type}get id(){return this._id}getSVGPathData(){let t="";if("radialDistance"===this._channel)for(let e of this._lines)t+="M "+e.x+" "+e.y+" m -"+e.r+" 0 a "+e.r+" "+e.r+" 0 1 0 "+2*e.r+" 0 a "+e.r+" "+e.r+" 0 1 0 -"+2*e.r+" 0 ";else for(let e of this._lines)t+=["M",e.x1,e.y1].join(" ")+[" L",e.x2,e.y2].join(" ")+" ";return t}_updateBounds(){if("radialDistance"===this._channel){let t=this._lines.map(t=>new Yw(t.x-t.r,t.y-t.y,2*t.r,2*t.r));this._bounds=Hw(t)}else{let t=this._lines.map(t=>t.x1).concat(this._lines.map(t=>t.x2)),e=this._lines.map(t=>t.y1).concat(this._lines.map(t=>t.y2)),n=Math.min(...t),r=Math.max(...t),i=Math.min(...e),o=Math.max(...e);this._bounds=new Yw(n,i,r-n,o-i)}}get elements(){return this._elems}get values(){return this._values}get channel(){return this._channel}get attribute(){return this._attribute}get scale(){return this._scale}get lines(){return this._lines}set lines(t){this._lines=t}}class TM extends hE{constructor(t){super(),this.type=fE.STACK,this._orientation=t.orientation,this._direction=t.direction,this._left=t.left,this._top=t.top,this._horzCellAlignment="horzCellAlignment"in t&&t.horzCellAlignment?t.horzCellAlignment:Xw.LEFT,this._vertCellAlignment="vertCellAlignment"in t&&t.vertCellAlignment?t.vertCellAlignment:Xw.BOTTOM,this._gap="gap"in t?t.gap:0}clone(){let t=new TM({orientation:this._orientation,direction:this._direction,left:this._left,top:this._top});return t._horzCellAlignment=this._horzCellAlignment,t._vertCellAlignment=this._vertCellAlignment,t}get horzCellAlignment(){return this._horzCellAlignment}get vertCellAlignment(){return this._vertCellAlignment}get orientation(){return this._orientation}set horzCellAlignment(t){this._horzCellAlignment=t}set vertCellAlignment(t){this._vertCellAlignment=t}set orientation(t){this._orientation=t}}function CM(t,e,n,r,i){let o=i.getAttributeType(n);if(o!=$E.String&&o!=$E.Date&&o!=$E.Integer)throw new Error("Divide only works on a string or date attribute: "+n+" is "+o);if(!SM(e))throw new Error("The "+e.type+" is not dividable");switch(e.type){case bT.Line:case bT.Path:return;case bT.Circle:return function(t,e,n,r,i){let o,a,s,l=Qw(e),c=n||xE;if(c!=xE&&c!=wE)throw new Error("Unknown orientation: "+c);c===xE&&l.forEach(n=>{let l=n.dataScope?n.dataScope:new BE(i),c=i.getUniqueAttributeValues(r).map(t=>l.cross(r,t));c=c.filter(t=>!t.isEmpty());let u=pT(t,{type:bT.Collection});null==a&&(a=u.id),u._classId=a,u.dataScope=n.dataScope?n.dataScope:new BE(i);let h=n.parent;h.removeChild(n),delete t._itemMap[n.id];let f=360/c.length,d=90;for(let r=0;r<c.length;r++){let i=pT(t,{type:"arc",innerRadius:0,outerRadius:n.radius,x:n.x,y:n.y,startAngle:VE(d-f*(r+1)),endAngle:VE(d-f*r),strokeColor:n.strokeColor,fillColor:n.fillColor,strokeWidth:n.strokeWidth,opacity:n.opacity});s||(s=i.id),i.classId=s,i.dataScope=c[r],i._updateBounds(),i._refBounds=i.bounds.clone(),u.addChild(i),u._layout=new TM({orientation:xE,direction:AE.CLOCKWISE}),u._layout.group=u,h.removeChild(n),h.addChild(u),n===e&&(o=u)}});return{newMark:o.children[0],collection:o}}(t,e,r,n,i);case bT.Rect:return function(t,e,n,r,i){let o,a=Qw(e),s=n||bE;if(s!=bE&&s!=vE)throw new Error("Unknown orientation: "+s);let l=i.getUniqueAttributeValues(r).map(t=>new BE(i).cross(r,t)),c={},u=0;for(let t of a){let e=l;t.dataScope&&(e=l.map(e=>e.merge(t.dataScope)),e=e.filter(t=>!t.isEmpty())),e.length>u&&(u=e.length),c[t.id]=e}let h,f=pT(t,{type:"rect",left:e.bounds.left,top:e.bounds.top,width:e.bounds.width,height:e.bounds.height,strokeColor:e.strokeColor,fillColor:e.fillColor,strokeWidth:e.strokeWidth,opacity:e.opacity});f._classId=f.id;for(let n of a){let r=pT(t,{type:bT.Collection});null==h&&(h=r.id),r._classId=h,r.dataScope=n.dataScope?n.dataScope:new BE(i);let a=n.parent;a.removeChild(n),delete t._itemMap[n.id];let l=c[n.id],u=n.bounds,d=u.left,p=u.top,g=s==bE?u.width/l.length:u.width,_=s==bE?u.height:u.height/l.length;for(let t=0;t<l.length;t++){let e=yT(f);e.dataScope=l[t],e.resize(g,_),e._updateBounds(),e._refBounds=e.bounds.clone(),r.addChild(e)}a.addChild(r),r._layout=new TM({orientation:s,left:d,top:p}),r._layout.group=r,n==e&&(o=r)}return t.removeChild(f),delete t._itemMap[f.id],{newMark:o.children[0],collection:o}}(t,e,r,n,i);case bT.Area:return function(t,e,n,r,i){let o,a=Qw(e),s=n||bE;if(s!=bE&&s!=vE)throw new Error("Unknown orientation: "+s);let l,c=i.getUniqueAttributeValues(r).map(t=>new BE(i).cross(r,t)),u={},h=0;for(let t of a){let e=c;t.dataScope&&(e=c.map(e=>e.merge(t.dataScope)),e=e.filter(t=>!t.isEmpty())),e.length>h&&(h=e.length),u[t.id]=e}let f=Object.assign({},e.styles);f.vertices=e.vertices.map(t=>[t.x,t.y]),f.type="area",f.orientation=e.orientation,f.baseline=e.baseline;let d=pT(t,f);if(d._classId=d.id,e.vertices)for(let t=0;t<e.vertices.length;t++)e.vertices[t].dataScope&&(d.vertices[t]._dataScope=e.vertices[t].dataScope.clone());for(let n of a){let r=pT(t,{type:bT.Collection});null==l&&(l=r.id),r._classId=l,r.dataScope=n.dataScope?n.dataScope:new BE(i);let a=n.parent;a.removeChild(n),delete t._itemMap[n.id];let c=u[n.id],h=n.bounds,f=h.left,p=h.top,g=s==bE?h.width/c.length:h.width,_=s==bE?h.height:h.height/c.length;for(let t=0;t<c.length;t++){let e=yT(d);e.dataScope=c[t],console.log(e.dataScope),e.resize(g,_),e._updateBounds(),e._refBounds=e.bounds.clone(),r.addChild(e);for(let t of e.vertices)t.dataScope?t.dataScope=e.dataScope.merge(t.dataScope):t.dataScope=e.dataScope}a.addChild(r),r._layout=new TM({orientation:s,left:f,top:p}),r._layout.group=r,n==e&&(o=r)}return t.removeChild(d),delete t._itemMap[d.id],{newMark:o.children[0],collection:o}}(t,e,r,n,i);case bT.Ring:return function(t,e,n,r,i){let o,a,s,l=Qw(e),c=n||xE;if(c!=xE&&c!=wE)throw new Error("Unknown orientation: "+c);c===xE&&l.forEach(n=>{let l=n.dataScope?n.dataScope:new BE(i),c=i.getUniqueAttributeValues(r).map(t=>l.cross(r,t));c=c.filter(t=>!t.isEmpty());let u=pT(t,{type:bT.Collection});null==a&&(a=u.id),u._classId=a,u.dataScope=n.dataScope?n.dataScope:new BE(i);let h=n.parent;h.removeChild(n),delete t._itemMap[n.id];let f=360/c.length,d=90;for(let r=0;r<c.length;r++){let i=pT(t,{type:"arc",innerRadius:n.innerRadius,outerRadius:n.outerRadius,x:n.x,y:n.y,startAngle:VE(d-f*(r+1)),endAngle:VE(d-f*r),strokeColor:n.strokeColor,fillColor:n.fillColor,strokeWidth:n.strokeWidth,opacity:n.opacity});s||(s=i.id),i.classId=s,i.dataScope=c[r],i._updateBounds(),i._refBounds=i.bounds.clone(),u.addChild(i),u._layout=new TM({orientation:xE,direction:AE.CLOCKWISE}),u._layout.group=u,h.removeChild(n),h.addChild(u),n===e&&(o=u)}});return{newMark:o.children[0],collection:o}}(t,e,r,n,i);case bT.Pie:case bT.Arc:return function(t,e,n,r,i){let o,a,s,l=Qw(e),c=n||xE;if(c!=xE&&c!=wE)throw new Error("Unknown orientation: "+c);c===xE||l.forEach(n=>{let l=n.dataScope?n.dataScope:new BE(i),c=i.getUniqueAttributeValues(r).map(t=>l.cross(r,t));c=c.filter(t=>!t.isEmpty());let u=pT(t,{type:bT.Collection});null==a&&(a=u.id),u._classId=a,u.dataScope=n.dataScope?n.dataScope:new BE(i);let h=n.parent;h.removeChild(n),delete t._itemMap[n.id];for(let r=0;r<c.length;r++){let i=pT(t,{type:"arc",innerRadius:n.innerRadius+r*(n.outerRadius-n.innerRadius)/c.length,outerRadius:n.innerRadius+(r+1)*(n.outerRadius-n.innerRadius)/c.length,x:n.x,y:n.y,startAngle:n.startAngle,endAngle:n.endAngle,strokeColor:n.strokeColor,fillColor:n.fillColor,strokeWidth:n.strokeWidth,opacity:n.opacity});s||(s=i.id),i.classId=s,i.dataScope=c[r],i._updateBounds(),i._refBounds=i.bounds.clone(),u.addChild(i),u._layout=new TM({orientation:wE}),u._layout.group=u,h.removeChild(n),h.addChild(u),n===e&&(o=u)}});return{newMark:o.children[0],collection:o}}(t,e,r,n,i)}}function SM(t){if([bT.Line,bT.Circle,bT.Rect,bT.Area,bT.Ring,bT.Pie,bT.Path].indexOf(t.type)<0)return!1;if(t.type===bT.Path&&(t.closed||!t.firstVertex.dataScope))return!1;if(t.dataScope){let e=Qw(t);for(let t of e)if(t.dataScope.numTuples>1)return!0;return!1}return!0}function kM(t,e,n,r){let i=r.getAttributeType(n);if(i!=$E.String&&i!=$E.Date&&i!=$E.Integer)throw new Error("Repopulate only works on a string or date attribute: "+n+" is "+i);let o=Qw(e);for(let t of o){let e=r.getAttributeSummary(n).unique.map(e=>t.dataScope?t.dataScope.cross(n,e):new BE(r).cross(n,e));e=e.filter(t=>!t.isEmpty());let i=t.children.length-e.length,o=e.length-t.children.length;for(let e=0;e<i;e++)t.removeChildAt(t.children.length-1);let a=t._children.length;for(let e=0;e<o;e++){let n=yT(t._children[e%a]);t.addChild(n)}t.children.forEach((t,n)=>t.dataScope=e[n])}}class MM{constructor(t,e){this._elem=t,this._base=e,this._id=RM(t,e),this._channels={},this._attribute=void 0}get id(){return this._id}get element(){return this._elem}get base(){return this._base}get channels(){return Object.keys(this._channels)}addChannel(t,e){let n={};n.elemAnchor="elementAnchor"in e?e.elementAnchor:"x"==t||"angle"==t?Xw.CENTER:Xw.MIDDLE,n.baseAnchor="baseAnchor"in e?e.baseAnchor:"x"==t||"angle"==t?Xw.CENTER:Xw.MIDDLE,n.offset="offset"in e?e.offset:0,"attribute"in e&&(this._attribute=e.attribute),this._channels[t]=n}hasChannel(t){return t in this._channels}getElementAnchor(t){return this._channels[t].elemAnchor}getBaseAnchor(t){return this._channels[t].baseAnchor}getOffset(t){return this._channels[t].offset}get attribute(){return this._attribute?this._attribute:AT}}function RM(t,e){return(t.classId?t.classId:t.id)+":"+(e.classId?e.classId:e.id)}function OM(t,e,n,r){t.dataScope&&t.dataScope.dataTable.hasAttribute(e)?function(t,e,n,r){if(!t.dataScope.dataTable.hasAttribute(e))return void console.warn("Cannot order collection children by an non-existent attribute",e);let i;if(e===AT)i=(t,n)=>parseInt(t.dataScope.getAttrVal(e).substring(1))-parseInt(n.dataScope.getAttrVal(e).substring(1));else{switch(t.children[0].dataScope.getAttributeType(e)){case $E.Date:break;case $E.Number:case $E.Integer:i=(t,n)=>t.dataScope.aggregateNumericalAttribute(e)-n.dataScope.aggregateNumericalAttribute(e);break;case $E.String:i=r?(t,n)=>r.indexOf(t.dataScope.getAttrVal(e))-r.indexOf(n.dataScope.getAttrVal(e)):(t,n)=>t.dataScope.getAttrVal(e)<n.dataScope.getAttrVal(e)?-1:1}}t.children.sort(i),n&&t.children.reverse()}(t,e,n,r):function(t,e,n){let r;switch(e){case"x":case"y":case"width":case"height":r=(t,n)=>t.bounds[e]-n.bounds[e];break;default:r=(t,n)=>t[e]-n[e]}t._children.sort(r),n&&t.children.reverse()}(t,e,n),t._sortBy={property:e,descending:n,vals:r}}function NM(t,e,n,r){t.vertices[0].dataScope&&t.vertices[0].dataScope.dataTable.hasAttribute(e)?function(t,e,n,r){let i;if(e===AT)i=(t,n)=>parseInt(t.dataScope.getAttrVal(e).substring(1))-parseInt(n.dataScope.getAttrVal(e).substring(1));else{switch(t.vertices[0].dataScope.getAttributeType(e)){case $E.Date:break;case $E.Number:case $E.Integer:i=(t,n)=>t.dataScope.aggregateNumericalAttribute(e)-n.dataScope.aggregateNumericalAttribute(e);break;case $E.String:i=r?(t,n)=>r.indexOf(t.dataScope.getAttrVal(e))-r.indexOf(n.dataScope.getAttrVal(e)):(t,n)=>t.dataScope.getAttrVal(e)<n.dataScope.getAttrVal(e)?-1:1}}t.vertices.sort(i),n&&t.vertices.reverse()}(t,e,n,r):function(t,e,n){let r=(t,n)=>t[e]-n[e];t.vertices.sort(r),n&&t.vertices.reverse()}(t,e,n),t._sortBy={property:e,descending:n,vals:r}}class IM{constructor(t,e,n){this._elems=t,this._channel=e,this._anchor=n}get elements(){return this._elems}get channel(){return this._channel}get anchor(){return this._anchor}}class LM extends hE{constructor(t){super(),this.type=fE.STRATA,this._direction=t.direction,this._gap="gap"in t?t.gap:0}clone(){return new LM({direction:this._direction,gap:this._gap})}}function PM(t,e,n,r,i,o){switch(e.type){case bT.Circle:case bT.Ring:return function(t,e,n,r,i,o){let a,s=n||TE.OUTWARD,l=i||50;if(s!==TE.INWARD&&s!==TE.OUTWARD)throw"Unknown direction to stratify";let c,u=Qw(e,t),h=Array.isArray(o)?o:[o];if(r){let n=pT(t,{type:bT.Collection});n.dataScope=void 0,null==c&&(c=n.id),n._classId=c;let r=u.map(t=>h[0].getNode(t.dataScope.getAttrVal(qE)));VM(t,u,r,h[0],n,e.classId?e.classId:e.id,400,350,s,l),a=n}else u.forEach((n,r)=>{let i=pT(t,{type:bT.Collection});i.dataScope=void 0,null==c&&(c=i.id),i._classId=c;let o=n.parent;DM(n,e.id,s,l,h[r],h[r].getRoot(),i,t,!0),i._layout=new LM({direction:s}),i._layout.group=i,o.addChild(i),n===e&&(a=i)});return a}(t,e,n,r,i,o);case bT.Rect:return function(t,e,n,r,i,o){let a,s,l=n||EE.Top2Bottom,c=i||50;if(!Object.values(EE).includes(l))throw"Unknown direction to stratify";return Qw(e).forEach(n=>{let r=pT(t,{type:bT.Collection});r.dataScope=void 0,null==s&&(s=r.id),r._classId=s;let i=n.parent;BM(n,e.id,l,c,o,o.getRoot(),r,t,!0),r._layout=new LM({direction:l}),r._layout.group=r,i.addChild(r),n===e&&(a=r)}),a}(t,e,n,0,i,o)}}function VM(t,e,n,r,i,o,a,s,l,c){let u=n.map(t=>r.getParent(t)).filter((t,e,n)=>n.findIndex(e=>e[qE]===t[qE])===e);if(u=u.filter(t=>t!==r.getRoot()),0===u.length)return;let h=[];for(let n of u){let u,f,d,p=e.filter(t=>r.getParent(r.getNode(t.dataScope.getAttrVal(qE)))===n);if(p[0].type===bT.Circle){let t=p.map(t=>jw(a,s,t.bounds.x,t.bounds.y)-t.radius),e=p.map(t=>jw(a,s,t.bounds.x,t.bounds.y)+t.radius);d=l===TE.OUTWARD?Math.max(...e):Math.min(...t)-c;let n=p.map(t=>DE(t.bounds.x,t.bounds.y,a,s)),r=p.map(t=>DE(a+jw(a,s,t.bounds.x,t.bounds.y),s-t.radius,a,s)),i=n.map((t,e)=>t-r[e]),o=n.map((t,e)=>t+r[e]),h=i.concat(o);u=Math.min(...h),f=Math.max(...h)}else p[0].type===bT.Arc&&(u=360,f=-360,p.forEach(t=>{let e=t.startAngle,n=t.endAngle;n<e&&(n+=360),u=Math.min(u,e),f=Math.max(f,n)}),u=VE(u),f=VE(f),d=l===TE.OUTWARD?Math.max(...p.map(t=>t.outerRadius)):Math.min(...p.map(t=>t.innerRadius))-c);let g=pT(t,{type:"arc",innerRadius:d,outerRadius:d+c,x:a,y:s,startAngle:VE(u),endAngle:VE(f),strokeColor:e[0].strokeColor,fillColor:e[0].fillColor,strokeWidth:e[0].strokeWidth,opacity:e[0].opacity});g._updateBounds(),g.dataScope=r.getNodeDataScope(n),g._classId=o,i.addChild(g),h.push(g)}VM(t,h,u,r,i,o,a,s,l,c)}function DM(t,e,n,r,i,o,a,s,l){l&&(t.dataScope=i.getNodeDataScope(o),t._classId=e);let c=i.getChildren(o);if(0===c.length)return;let u=t.type===bT.Circle||t.type===bT.Ring?60:t.startAngle,h=(t.type===bT.Circle||t.type===bT.Ring?360:t.angle)/c.length;for(let o=0;o<c.length;o++){let l,f;f=n===TE.OUTWARD?t.type===bT.Circle?t.radius:t.outerRadius:t.type===bT.Circle?t.radius-r:t.innerRadius-r,l=pT(s,360===h?{type:"ring",innerRadius:f,outerRadius:f+r,x:t.x,y:t.y,strokeColor:t.strokeColor,fillColor:t.fillColor,strokeWidth:t.strokeWidth,opacity:t.opacity}:{type:"arc",innerRadius:f,outerRadius:f+r,x:t.x,y:t.y,startAngle:VE(u+h*o),endAngle:VE(u+h*(o+1)),strokeColor:t.strokeColor,fillColor:t.fillColor,strokeWidth:t.strokeWidth,opacity:t.opacity}),l._updateBounds(),l.dataScope=i.getNodeDataScope(c[o]),l._classId=e+"_strata",a.addChild(l),DM(l,e,n,r,i,c[o],a,s)}}function BM(t,e,n,r,i,o,a,s,l){l&&(t.dataScope=i.getNodeDataScope(o),t._classId=e,a.addChild(t));let c,u,h,f=i.getChildren(o);if(0!==f.length){c=t.left,u=t.bottom,h=t.width/f.length;for(let o=0;o<f.length;o++){let s=yT(t);dA(s,c-s.left,u-s.top),s.resize(h,r),s._updateBounds(),c+=h,s.dataScope=i.getNodeDataScope(f[o]),s._classId=e,a.addChild(s),BM(s,e,n,r,i,f[o],a)}}}class zM{constructor(t,e,n,r){this._id=t,this._event=n,this._target=e,this._evtCtx=new wM,this._cumulative=r}get id(){return this._id}get event(){return this._event}get eventContext(){return this._evtCtx}get target(){return this._target}isCumulative(){return this._cumulative}isMouseDriven(){return["brush","brushX","brushY","click","hover"].includes(this._event)}isKeyboardDriven(){return["keydown","keyup"].includes(this._event)}isWidgetDriven(){return["change","input"].includes(this._event)}}class FM extends YA{constructor(t){super(),this._itemMap={},this._peerIndex=new Map,this._type=bT.Scene,this._id=t&&t.id?t.id:this._type+xT(),t&&t.fillColor&&(this.fillColor=t.fillColor),this._encodings={},this._relations=[],this._triggers={},this._condEncodings={},this._depGraph=new mM}get depGraph(){return this._depGraph}get interactionTriggers(){return this._triggers}buildPeerIndex(){this._peerIndex=new Map;let t=this._peerIndex;uE(this,e=>{e.classId&&(t.has(e.classId)||t.set(e.classId,[]),t.get(e.classId).push(e))})}mark(t,e){if(Object.values(mT).indexOf(t)<0)throw new Error("Mascot does not allow directly creating a "+t);let n=void 0===e?{}:e;n.type=t;let r=pT(this,n);return null!==r&&(r._classId=r.id,this.addChild(r),this._itemMap[r.id]=r,kA(r,this._depGraph),LA(this,r,this._depGraph)),r}glyph(...t){let e=[];for(let n of t)e.push([n.parent,n]);let n=pT(this,{type:bT.Glyph,children:t});if(null!==n){n._classId=n.id;for(let t of e)IA(t[0],t[1],this._depGraph);PA(n,this._depGraph),LA(this,n,this._depGraph)}return n}composite(){let t=pT(this,{type:bT.Composite});return null!==t&&(t._classId=t.id,this.addChild(t),this._itemMap[t.id]=t,NA(t,this._depGraph),LA(this,t,this._depGraph)),t}attach(t,e){if(t.type==bT.Glyph)for(let e of t.children)e._refBounds||(e._refBounds=e.bounds.clone());t.dataScope=new BE(e)}repeat(t,e,n){let r=n||{};if(r.attribute=r.attribute||AT,function(t,e,n){if(!t||void 0===e)throw new Error("Incomplete information to do repeat. You must specify an element, a categorical data attribute and a data table");if(e instanceof GE||e instanceof UE){if(!Array.isArray(t)||2!==t.length)throw new Error("To repeat with a tree or a network, you need to provide two marks, one for node and one for link")}else e instanceof wT&&WE(n.attribute,e);if(n.layout&&!(n.layout instanceof hE))throw new Error("Invalid layout: "+n.layout)}(t,e,r),e instanceof GE||e instanceof UE){let n=t[0].parent,r=t[1].parent,[i,o]=function(t,e,n,r){let i=r.nodeTable.getAttributeSummary(qE).unique.map(t=>e.dataScope?e.dataScope.cross(qE,t):new BE(r.nodeTable).cross(qE,t)),o=pT(t,{type:bT.Collection}),a=pT(t,{type:bT.Collection}),s={};a.dataScope=e.dataScope?e.dataScope.clone():new BE(r.nodeTable),a.addChild(e);for(let t=1;t<i.length;t++){let t=yT(e);a.addChild(t)}a.children.forEach((t,e)=>{t.dataScope=i[e],t.links=[],s[t.dataScope.getAttrVal(qE)]=t});let l=r.linkTable.getAttributeSummary(AT).unique.map(t=>n.dataScope?n.dataScope.cross(AT,t):new BE(r.linkTable).cross(AT,t));o.dataScope=n.dataScope?n.dataScope.clone():new BE(r.linkTable),o.addChild(n);for(let t=1;t<l.length;t++){let t=yT(n);o.addChild(t)}o.children.forEach((t,e)=>t.dataScope=l[e]);let c=r instanceof GE?"parent":"source",u=r instanceof GE?"child":"target";for(let t of o.children){let e=t.dataScope.getAttrVal(c),n=t.dataScope.getAttrVal(u),r=s[e],i=s[n];t.source=r,t.target=i,r.links.push(t),i.links.push(t)}return[a,o]}(this,t[0],t[1],e);return this.buildPeerIndex(),IA(n,t[0],this._depGraph),IA(r,t[1],this._depGraph),OA(i,this._depGraph),OA(o,this._depGraph),LA(i,t[0],this._depGraph),LA(i.parent,i,this._depGraph),LA(o,t[1],this._depGraph),LA(o.parent,o,this._depGraph),[i,o]}if(e instanceof wT){let n=t.parent,i=vM(this,t,r.attribute,e);return this.buildPeerIndex(),IA(n,t,this._depGraph),OA(i,this._depGraph),LA(i,t,this._depGraph),LA(i.parent,i,this._depGraph),r.layout&&(i.layout=r.layout),i}}divide(t,e,n){let r=n||{};if(r.attribute=r.attribute||AT,console.log("------ divide by",r.attribute," ----"),function(t,e,n){if(!t||void 0===e)throw new Error("Incomplete information to do divide. You must specify an element, a categorical data attribute and a data table");if(e instanceof wT&&WE(n.attribute,e),n.layout&&!(n.layout instanceof hE))throw new Error("Invalid layout: "+n.layout)}(t,e,r),e instanceof GE||e instanceof UE)throw"Not implemented";if(e instanceof wT){let{newMark:n,collection:i}=CM(this,t,r.attribute,r.orientation,e);return this.buildPeerIndex(),MA(t,this._depGraph),kA(n,this._depGraph),OA(i,this._depGraph),LA(i,n,this._depGraph),i.parent.type!==bT.Scene&&LA(i.parent,i,this._depGraph),this.onChange(nA.CHANNEL,"width",n),{newMark:n,collection:i}}}densify(t,e,n){let r=n||{};if(r.attribute=r.attribute||AT,console.log("------ densify by",r.attribute," ----"),function(t,e,n){if(!t||void 0===e)throw new Error("Incomplete information to do densification. You must specify an element, a categorical data attribute and a data table");e instanceof wT&&WE(n.attribute,e)}(t,e,r),e instanceof GE||e instanceof UE)throw"Not implemented";if(e instanceof wT){let n=JE(this,t,r.attribute,r.orientation,e);return this.buildPeerIndex(),MA(t,this._depGraph),kA(n,this._depGraph),n.parent.type!==bT.Scene&&LA(n.parent,n,this._depGraph),this.onChange(nA.CHANNEL,"width",n),n}}stratify(t,e,n){if(!(e instanceof GE||Array.isArray(e)&&e.every(t=>t instanceof GE)))throw"Cannot stratify on a non-tree dataset";if(![bT.Circle,bT.Rect,bT.Ring].includes(t.type))throw"Cannot stratify elements that are not rects, circles, or rings";let r=n||{},i=r.direction,o=r.size,a=t.parent,s=PM(this,t,i,r.startFromLeaf,o,e);return this.buildPeerIndex(),IA(a,t,this._depGraph),OA(s,this._depGraph),s.children.length>0&&LA(s,s.firstChild,this._depGraph),LA(s.parent,s,this._depGraph),s}repopulate(t,e,n){t.dataScope=void 0;let r=t;for(let t in n){kM(0,r,n[t],e);let i=oA(r.children[0]);for(let t of i)this.removeEncoding(t);let o=Qw(r);for(let t of o)if(t.layout){for(let e of t.layout.refElements)aT(e,this),RA(e,this._depGraph);t.layout.clearRefElements()}r=r.children[0]}t.dataScope=new BE(e),this.buildPeerIndex(),this.onChange(nA.CHANNEL,"width",t.children[0])}classify(t,e){let n=e||{};console.log("------ classify by",n.attribute," ----"),function(t,e,n,r){let i=Qw(e);for(let e of i){let i,o={},a=e.children;for(let t of a){let e=t.dataScope.getAttrVal(n);e in o||(o[e]=[]),o[e].push(t)}let s=ET(a[0]);for(let a in o){let l=pT(t,{type:bT.Collection});e.addChild(l),void 0===i&&(i=l.id),l._classId=i,l.dataScope=e.dataScope?e.dataScope.cross(n,a):new BE(s).cross(n,a);for(let t of o[a])l.addChild(t);r&&(l._layout=r.clone(),l._layout.group=l)}}}(this,t,n.attribute,n.layout),this.buildPeerIndex(),IA(t,t.firstChild.firstChild,this._depGraph),OA(t.firstChild,this._depGraph),LA(t.firstChild,t.firstChild.firstChild,this._depGraph),LA(t,t.firstChild,this._depGraph),this.onChange(nA.CHANNEL,"width",t.firstChild.firstChild)}affix(t,e,n,r){t.dataScope.dataTable!==t.dataScope.dataTable&&console.warn("Affix: elements and base elements are not created from the same table");let i=RM(t,e),o=this._relations.find(t=>t.id===i);o||(o=new MM(t,e),this._relations.push(o)),o.addChannel(n,r||{}),function(t,e){let n=e.getVariable(nA.AFFIXATION,t),r=e.getOutgoingDataflowOperator(gE.AFFIXER,n);e.connect(n,r);for(let n of t.channels){let i=e.getVariable(nA.CHANNEL,n,t.element),o=e.getVariable(nA.CHANNEL,n,t.base);e.connect(o,r),e.connect(r,i)}r.run()}(o,this._depGraph)}align(t,e,n){let r=new IM(t,e,n);!function(t,e){let n=e.createMultiWayDependency(gE.ALIGNER),r=e.getVariable(nA.ALIGNMENT,t);e.connect(r,n);for(let r of t.elements){let i=e.getVariable(nA.CHANNEL,t.channel,r);e.connect(i,n)}n.run()}(r,this._depGraph),this._relations.push(r)}encode(t,e){if("rowId"===e.attribute&&(e.attribute=AT),function(t,e){if(!t||!("channel"in e)||!("attribute"in e))throw new Error("Incomplete information to do encoding. You must specify an item, a categorical data attribute and a data table");let n=ET(t);if(n.tree){let t=e.attribute;if(t.indexOf(".")>0&&!n.tree.nodeTable.hasAttribute(t.split(".")[1]))throw new Error("Data attribute does not exist in the data table")}else if(!n||!n.hasAttribute(e.attribute))throw new Error("Data attribute does not exist in the data table");if(!Object.values(iA).includes(e.channel))throw new Error("Channel Not Supported")}(t,e),e.shareScale){let t=e.shareScale;if(t.channel!=e.channel&&t.channel.indexOf("Color")<0&&e.channel.indexOf("Color")<0)throw new Error("Cannot share scales between "+t.channel+" and "+e.channel+" encodings");e.scheme=e.shareScale.colorScheme}!function(t){let e;"vertex"===t.type&&t.parent.type===bT.Area?e=t.parent:t.type===bT.Area&&(e=t),e&&!e._refBounds&&Qw(e).forEach(t=>t._refBounds=t.bounds.clone())}(t);let n=e.aggregator?e.aggregator:"sum";console.log("------ encode",e.channel,e.attribute," --");let r=sA(t,e.channel);r&&e.attribute!==r.attribute&&this.removeEncoding(r),e.table=ET(t);let i=new xM(t,e.channel,e.attribute,n,e);return this._addAttributeEncoding(i),FA(i,this._depGraph,e.shareScale),e.shareScale?this.onChange(nA.ATTR_VALUE,i):this.onChange(nA.CHANNEL,e.channel,t),i}removeEncoding(t){delete this._encodings[lA(t.element)][t.channel],function(t,e){let n=e.findVariable(nA.CHANNEL,[t.channel,t.element]);n||console.warn("cannot find encoding to remove from the dep graph");let r=n.incomingDataflow;e.deleteOperator(r)}(t,this._depGraph);for(let e of t.refElements)aT(e,this),RA(e,this._depGraph);t.clearRefElements()}connect(t,e){let n={};t.forEach(t=>n[t.dataScope.getAttrVal(qE)]=t);let r=e[0].dataScope.dataTable,i=r.tree?"parent":"source",o=r.tree?"child":"target";for(let e of t)e.links=[];for(let t of e){let e=t.dataScope.getAttrVal(i),r=t.dataScope.getAttrVal(o),a=n[e],s=n[r];t.source=a,t.target=s,a.links.push(t),s.links.push(t)}zA(t.find(t=>t.links.length>0),this._depGraph),this.onChange(nA.CHANNEL,"x",t[0])}_addAttributeEncoding(t){let e=lA(t.element);e in this._encodings||(this._encodings[e]={}),this._encodings[e][t.channel]=t}get tables(){let t={},e=this.children.filter(t=>t.type===bT.Collection);for(let n of e){let e=n.dataScope?n.dataScope.dataTable:null;e&&!(e.id in t)&&(t[e.id]=e)}return t}activate(t,e,n,r,i){!function(t,e,n,r,i){if(!("event"in t)||!("target"in t))throw"Target and event must be specified in the trigger";if(!("component"in n))throw"Responder component must be specified";if(Array.isArray(r)){if(!r.every(t=>"function"==typeof t))throw"Styling rules must be a function";if(i&&!Array.isArray(i))throw"An array of effect setters must be accompanied by an array of animation effects";if(i&&Array.isArray(i)&&i.length!==r.length)throw"the length of effect setters is not equal to the length of animation effects"}else if("function"!=typeof r)throw"Styling rules must be a function"}(t,0,e,r,i);let o=t.event,a=function(t){return["string"==typeof t.target?t.target:t.target.classId?t.target.classId:t.target.id,t.event].join("-")}(t);o=0===o.indexOf("brush")?"brush":0===o.indexOf("drag")?"drag":o,o in this._triggers||(this._triggers[o]={}),a in this._triggers[o]||(this._triggers[o][a]=new zM(a,t.target,t.event,t.cumulative));let s=this._triggers[o][a].eventContext,l=new EM(s,e.component,n,r);return a in this._condEncodings||(this._condEncodings[a]=[]),this._condEncodings[a].push(l),function(t,e,n,r){let i=e.responderComponent,o=r.getVariable(nA.EVT_CTX,t),a=n.properties?n.properties:n.channels;if(e.evalFunction){let t=r.getVariable(nA.CONDITION_RESULT,e.evalResult,e),n=r.findIncomingDataflowOperator(gE.TARGET_EVALUATOR,t);n||(n=r.createOneWayDependency(gE.TARGET_EVALUATOR,e.evalFunction)),r.connect(o,n),r.connect(n,t);for(let e of a){let n=Array.isArray(i)?i:[i];for(let i of n){let n=r.getVariable(nA.CHANNEL,e,i),o=n.incomingDataflow;if(o&&o instanceof EA&&o.outputVar.channel===e)r.connect(t,o);else if(!o){let o=r.createOneWayDependency(gE.ENCODER);r.connect(t,o),r.connect(o,n),o.storeValues(i,e)}}}}else for(let t of a){Object.values(iA).includes(t)?r.getVariable(nA.CHANNEL,t,i):r.getVariable(nA.PROPERTY,TA(t),i);let n=r.createOneWayDependency(gE.TARGET_UPDATER,e.stylingFunction,i);r.connect(o,n)}}(s,l,e,this._depGraph),this._triggers[o][a]}onChange(t,...e){if(Object.values(nA).indexOf(t)<0)throw new Error("Unknown Variable Type: "+t);let n=[];this._depGraph.processChange(t,n,...e);for(let t of n)t.run()}gridlines(t,e,n){let r=n||{},i=r.element?sA(r.element,t):aA(e,t,this);if(i){i.attribute!==e&&console.warn("Cannot create a "+t+" axis for "+e);let n=[];if("x"==t)for(let t of i.scales)n.push({scale:t,elems:i.getElements(t)});else if("width"==t){let t=sE(i.element),e=i.scales[0];if(t.layout&&t.layout.type==fE.GRID&&t.layout.numCols>1){let r=t.layout.getElementsByCol(!0);for(let t of r)n.push({scale:e,elems:t})}else n.push({scale:i.scales[0],elems:i.getElements(i.scales[0])})}else if("y"==t){let t=sE(i.element);if(t.layout&&t.layout.type==fE.GRID&&t.layout.numRows>1){let e=t.layout.getElementsByRow(!0,i.element);for(let t of e)n.push({scale:i.getScale(t[0]),elems:t})}else n.push({scale:i.scales[0],elems:i.getElements(i.scales[0])})}else if("height"==t){let t=sE(i.element),e=i.scales[0];if(t.layout&&t.layout.type==fE.GRID&&t.layout.numRows>1){let r=t.layout.getElementsByRow(!0,i.element);for(let t of r)n.push({scale:e,elems:t})}else n.push({scale:e,elems:i.getElements(e)})}else if("radialDistance"==t){let t=r.element?r.element:i.element;n.push({scale:i.scales[0],elems:Qw(t,t.parent)})}for(let t of n){let e=new AM(i.channel,i.attribute,t.scale,t.elems,r);this.addChild(e),this._itemMap[e.id]=e,i.addRefElement(e),UA(e,this._depGraph),LA(this,e,this._depGraph)}}else{let n=r.element?r.element:rE(this,e);if(!n)return void console.warn("Cannot create "+t+" gridlines for "+e);let i=iE(n.parent);if(!i.layout)return void console.warn("Cannot create "+t+" gridlines for "+e);let o=Qw(i);for(let n of o){let i=[];n.layout.type==fE.GRID&&n.layout.numRows>1&&"x"==t?i=n.layout.getElementsByRow():n.layout.type==fE.GRID&&n.layout.numCols>1&&"y"==t?i=n.layout.getElementsByCol():i.push(n.children);for(let o of i){let i=new AM(t,e,null,o,r);this.addChild(i),n.layout.addRefElement(i),UA(i,this._depGraph),LA(this,i,this._depGraph)}}}}axis(t,e,n){let r=n||{},i="rowId"==e?AT:e,o=[],a=r.element?sA(r.element,t):aA(i,t,this);if(a){a.attribute!==i&&console.warn("Cannot create a "+t+" axis for "+i);let e=[];if("x"==t||"width"==t){let t=sE(r.element?r.element:a.element);if(t.layout&&t.layout.type==fE.GRID&&t.layout.numCols>1){let n=t.layout.getElementsByCell(!0,a.element);for(let t of n)e.push({scale:a.getScale(t[0]),elems:t})}else e.push({scale:a.scales[0],elems:a.getElements(a.scales[0])})}else if("y"==t||"height"==t){let t=sE(r.element?r.element:a.element);if(t.layout&&t.layout.type==fE.GRID&&t.layout.numRows>1){let n=t.layout.getElementsByCell(!0,a.element);for(let t of n)e.push({scale:a.getScale(t[0]),elems:t})}else e.push({scale:a.scales[0],elems:a.getElements(a.scales[0])})}else if("radialDistance"==t){let t=r.element?r.element:a.element;e.push({scale:a.scales[0],elems:Qw(t,t.parent)})}for(let t of e){let e=Object.assign({},r);e.scale=t.scale,e.elems=t.elems,e.type="axis",e.axisType="encoding",e.enc=a;let n=pT(this,e);o.push(n),a.addRefElement(n),jA(n,this._depGraph),LA(this,n,this._depGraph),this.onChange(nA.PROPERTY,SA.AXIS_PATH_POSITION,n)}}else{let e=r.element?r.element:rE(this,i);if(!e)return void console.warn("Cannot create a "+t+" axis for "+i);let n=iE(e.parent);if(!n.layout)return void console.warn("Cannot create a "+t+" axis for "+i);let a=Qw(n);for(let e of a){let n=[];e.layout.type==fE.GRID&&e.layout.numRows>1&&"x"==t?n=e.layout.getElementsByRow():e.layout.type==fE.GRID&&e.layout.numCols>1&&"y"==t?n=e.layout.getElementsByCol():n.push(e.children);for(let a of n){let n=Object.assign({},r);n.elems=a.slice(),n.type="axis",n.axisType="layout",n.channel=t,n.attribute=i;let s=pT(this,n);o.push(s),e.layout.addRefElement(s),GA(s,this._depGraph),LA(this,s,this._depGraph),this.onChange(nA.PROPERTY,SA.AXIS_PATH_POSITION,s)}}}return o.length>1?o:o[0]}legend(t,e,n){let r=n||{},i="rowId"==e?AT:e,o=r.element?sA(r.element,t):aA(i,t,this);if(o){o.attribute!==e&&console.warn("Cannot create a "+t+" legend for "+e);let n=ET(o.element).getAttributeType(e);r.type="legend",r.enc=o,r.attrType=n;let i=pT(this,r);!function(t,e){let n=e.getVariable(nA.BOUNDS,t),r=e.getVariable(nA.PROPERTY,SA.LEGEND_POSITION,t),i=e.getIncomingDataflowOperator(gE.EVAL_BBOX,n);e.connect(r,i),e.connect(i,n)}(i,this._depGraph),LA(this,i,this._depGraph),$w(i),this.onChange(nA.PROPERTY,SA.LEGEND_POSITION,i)}else console.warn("Cannot create a "+t+" legend for "+i)}createMask(t){let e=sE(t),n=e||t;n.clipMask||n.createClipMask()}setLayout(t,e){if(t.layout&&(DA(t,t.layout,this._depGraph),e.type===fE.TREEMAP)){let e=t.firstChild;for(;e&&e.type===bT.Collection&&e.layout;)DA(e,e.layout,this._depGraph),e=e.firstChild}if(Qw(t).forEach(t=>{let n=e?e.clone():e;t._layout=n,n&&(n.group=t)}),BA(t,e,this._depGraph),t.children&&t.children.length>0){let e=lE(t,!0);for(let t of e)this.onChange(nA.CHANNEL,"x",t)}}setProperties(t,e,n){let r=n?[t]:Qw(t);r.forEach(t=>{for(const[n,r]of Object.entries(e))gA(t,n,r)}),"width"in e&&r.forEach(t=>{t._refBounds&&t._refBounds.setWidth(e.width)}),"height"in e&&r.forEach(t=>{t._refBounds&&t._refBounds.setHeight(e.height)});for(let n in e)["vertex","segment"].includes(t.type)&&!["x","y"].includes(n)||(Object.values(iA).includes(n)?this.onChange(nA.CHANNEL,n,t):this.onChange(nA.PROPERTY,n,t))}setLayoutParameters(t,e){let n=Qw(t);for(let t of n)for(let n in e)t.layout[n]=e[n];this.onChange(nA.CHANNEL,"width",t.firstChild)}sortChildren(t,e,n,r){if(t instanceof YA)OM(t,e,n,r),this.onChange(nA.PROPERTY,SA.CHILDREN_ORDER,t);else if(t instanceof kE){let i=Qw(t);for(let t of i)NM(t,e,n,r)}}translate(t,e,n){dA(t,e,n);let r=lE(t,!0);for(let t of r)$w(t);for(let t of r)this.onChange(nA.CHANNEL,"x",t)}transform(t,e,n){let r=e.clone();switch(t){case"bin":!function(t,e,n,r,i){let o=i.getVariable(nA.ATTRIBUTE,t,n),a=i.getVariable(nA.ATTRIBUTE,e,r),s=i.createOneWayDependency(gE.BIN_TRANSFORMER);i.connect(o,s),i.connect(s,a),s.run()}(n.attribute,n.newAttribute,e,r,this._depGraph);break;case"filter":!function(t,e,n,r){let i=r.getVariable(nA.ITEMS,void 0,e),o=r.getVariable(nA.ITEMS,t,n),a=r.createOneWayDependency(gE.FILTER_TRANSFORMER);r.connect(i,a),r.connect(a,o),a.run()}(Bw(n),e,r,this._depGraph);break;case"kde":!function(t,e,n,r,i,o){let a=o.getVariable(nA.ATTRIBUTE,t,n),s=o.getVariable(nA.ATTRIBUTE,e,r),l=o.createOneWayDependency(gE.KDE_TRANSFORMER);l.args=i,o.connect(a,l),o.connect(l,s),l.run()}(n.attribute,n.newAttribute,e,r,n,this._depGraph)}return r}getElement(t){return this._itemMap[t]}getAxis(t,e){return aA(t,e,this).refElements[0]}}function GM(t,e){let n=new BE(e[t.dt]);for(let e in t.attr2value)n._attr2value[e]=t.attr2value[e],n._updateTuples(e,t.attr2value[e]);return n}class jM extends hE{constructor(t){super(),this.type=fE.DIRECTED,this._width="width"in t?t.width:500,this._height="height"in t?t.height:300,this._top="top"in t?t.top:0,this._left="left"in t?t.left:0,this._edgeSep="edgeSep"in t?t.edgeSep:50,this._spreadLinks=!("spreadLinks"in t)||t.spreadLinks,this._direction="direction"in t?t.direction:EE.Top2Bottom}clone(){return new jM({width:this._width,height:this._height,top:this._top,left:this._left,edgeSep:this._edgeSep,spreadLinks:this._spreadLinks,direction:this._direction})}get width(){return this._width}get height(){return this._height}get top(){return this._top}get left(){return this._left}get edgeSep(){return this._edgeSep}get spreadLinks(){return this._spreadLinks}get direction(){return this._direction}}class UM extends hE{constructor(t){super(),this.type=fE.FORCE,this._x="x"in t?t.x:0,this._y="y"in t?t.y:0,this._iterations="iterations"in t?t.iterations:1,this._repulsion="repulsion"in t?t.repulsion:30,this._attraction="attraction"in t?t.attraction:1,this._linkDistance="linkDistance"in t?t.linkDistance:30}clone(){return new UM({x:this._x,y:this._y,iterations:this._iterations,repulsion:this._repulsion,attraction:this._attraction,linkDistance:this._linkDistance})}}class YM extends hE{constructor(t){super(),this.type=fE.PACKING,this._x="x"in t?t.x:400,this._y="y"in t?t.y:400,this._width=t.width,this._height=t.height}clone(){return new YM({x:this._x,y:this._y,width:this._width,height:this._height})}}class HM extends hE{constructor(t){super(),this.type=fE.TIDYTREE,this._width="width"in t?t.width:500,this._height="height"in t?t.height:500,this._left="left"in t?t.left:100,this._top="top"in t?t.top:100,this._orientation="orientation"in t?t.orientation:bE}get width(){return this._width}get height(){return this._height}get top(){return this._top}get left(){return this._left}get orientation(){return this._orientation}clone(){return new HM({width:this._width,height:this._height,top:this._top,left:this._left,orientation:this._orientation})}}class qM extends hE{constructor(t){super(),this.type=fE.TREEMAP,this._width=t.width,this._height=t.height,this._left=t.left,this._top=t.top}get width(){return this._width}get height(){return this._height}get top(){return this._top}get left(){return this._left}clone(){return new qM({width:this._width,height:this._height,top:this._top,left:this._left})}}function WM(t){switch(t.type){case fE.GRID:return function(t){let e=new eT(t.args);"left"in t&&(e._left=t.left);"top"in t&&(e._top=t.top);"cellBounds"in t&&(e._cellBounds=t.cellBounds.map(t=>$M(t)));"grid"in t&&(e._grid=t.grid);return e}(t);case fE.STACK:return function(t){let e=new TM(t.args);return e}(t);case fE.PACKING:return function(t){let e=new YM(t.args);return e}(t);case fE.FORCE:return function(t){return new UM(t.args)}(t);case fE.DIRECTED:return function(t){return new jM(t.args)}(t);case fE.TIDYTREE:return function(t){return new HM(t.args)}(t);case fE.TREEMAP:return function(t){return new qM(t.args)}(t);case fE.STRATA:return function(t){return new LM(t.args)}(t);default:return void console.warn("unsupported layout type for deserialization:",t.type)}}function $M(t){return new Yw(t.x-t.width/2,t.y-t.height/2,t.width,t.height)}function XM(t,e,n){t.type===bT.Pie&&(t.type=bT.Arc),t.args.type=t.type;let r=pT(e,t.args);return t.id&&(r._id=t.id),t.classId&&(r._classId=t.classId),t.dataScope&&(r._dataScope=GM(t.dataScope,n)),t.bounds&&(r._bounds=$M(t.bounds)),t.refBounds&&(r._refBounds=$M(t.refBounds)),function(t,e,n,r){if(t.vertices){const i=[];for(let o of t.vertices){const t=KM(o,e,n,r);i.push(t)}e.vertices=i,e.segments=[];let o=0;for(let t=1;t<e.vertices.length;t++)e.segments.push(new SE(e.vertices[t-1],e.vertices[t],e,o++));e.type===bT.Rect&&e.segments.push(new SE(e.vertices[e.vertices.length-1],e.vertices[0],e,o++))}e.vertexCounter=t.vertexCounter,e.segmentCounter=t.segmentCounter,e.curveMode=t.curveMode}(t,r,e,n),r}function KM(t,e,n,r){let i=new CE(t.x,t.y,e,t.id);return t.dataScope&&(i._dataScope=GM(t.dataScope,r)),"polarAngle"in t&&(i._polarAngle=t.polarAngle),i.shape=t.shape,i.width=t.width,i.height=t.height,i.radius=t.radius,i.fillColor=t.fillColor,i.opacity=t.opacity,i.strokeWidth=t.strokeWidth,i.strokeColor=t.strokeColor,i}function ZM(t){let e={};e.fillColor=t.fillColor;let n=new FM(e);console.log("======== deserialization =========");let r={};if(t.tables)for(let e in t.tables){let n=t.tables[e];r[e]=new wT(n.data,n.url,n.attributeTypes),r[e]._id=n.id}let i={};if(t.scales)for(let e in t.scales)i[e]=eR(t.scales[e]);if(n.scales=i,tR(t,n,n,r),QM(t,n),n.buildPeerIndex(),t.encodings){let e={};for(let i of t.encodings){let t=nR(i,n,r);e[t.id]=t}for(let t in e){n._addAttributeEncoding(e[t]);let r=e[t]._baseEnc?e[e[t]._baseEnc]:void 0;FA(e[t],n._depGraph,r),r?n.onChange(nA.ATTR_VALUE,e[t]):n.onChange(nA.CHANNEL,e[t].channel,e[t].element)}}if(t.axes)for(let e of t.axes){let t=e.args?e.args:{};t.tickValues&&Object.values(r)[0].getAttributeType(e.attr)===$E.Date&&(t.tickValues=t.tickValues.map(t=>new Date(new Date(t).toISOString()))),e.id&&(t.id=e.id),n.axis(e.channel,e.attr,t)}if(t.gridlines)for(let e of t.gridlines)n.gridlines(e.channel,e.attr,e.args);return t.bounds&&(n._bounds=$M(t.bounds)),delete n.scales,n}function JM(t,e,n,r){if(t.type===bT.Collection){let i=pT(n,{type:bT.Collection,id:t.id});t.classId&&(i._classId=t.classId),e.addChild(i),OA(i,n._depGraph),LA(e,i,n._depGraph),tR(t,i,n,r)}else if(t.type===bT.Glyph){let i=pT(n,{type:bT.Glyph,id:t.id});t.classId&&(i._classId=t.classId),e.addChild(i),PA(i,n._depGraph),LA(e,i,n._depGraph),tR(t,i,n,r)}else if(t.type===bT.Composite){let i=pT(n,{type:bT.Composite,id:t.id});e.addChild(i),n._itemMap[i.id]=i,NA(i,n._depGraph),LA(e,i,n._depGraph),tR(t,i,n,r),i._bounds=$M(t.bounds)}else if(t.type===bT.Axis){let i=new sT({});e.addChild(i),function(t,e,n,r){t.id&&(e._id=t.id);if(e._children=[],t.labels){let i=new YA;tR(t.labels,i,n,r),e._labels=i,e._children.push(i)}t.path&&(e._path=JM(t.path,e,n,r));if(t.ticks){let i=new YA;tR(t.ticks,i,n,r),e._ticks=i,e._children.push(i)}t.title&&(e._title=JM(t.title,e,n,r))}(t,i,n,r),n._itemMap[i.id]=i}else if(Object.values(Jw).includes(t.type)){let i=XM(t,n,r);return n._itemMap[i.id]=i,e.addChild(i),kA(i,n._depGraph),LA(e,i,n._depGraph),i}}function QM(t,e,n){if(t.children)for(let n of t.children)QM(n,e);else if(Object.values(Jw).includes(t.type)){let n=e._itemMap[t.id];t.links&&(n.links=t.links.map(t=>e._itemMap[t])),t.source&&(n.source=e._itemMap[t.source]),t.target&&(n.target=e._itemMap[t.target])}}function tR(t,e,n,r){if(t.id&&(e._id=t.id),t.classId&&(e._classId=t.classId),t.dataScope&&(e._dataScope=GM(t.dataScope,r)),t.bounds&&(e._bounds=$M(t.bounds)),e._sortBy=t.sortBy,t.children)for(let i of t.children)JM(i,e,n,r);t.layout&&(e._layout=WM(t.layout),e._layout.group=e,BA(e,e._layout,n._depGraph))}function eR(t){let e=new OT(t.type,t.args);return e._id=t.id,e.domain=t.domain,e.range=t.range,e}function nR(t,e,n){let r=rR(t.element,t.elementType,e);r||console.warn("element not created:",t.element,t.elementType);let i=t.args?t.args:{};t.table&&(i.table=n[t.table]);let o=new xM(r,t.channel,t.attr,t.aggregator?t.aggregator:"sum",i);if(o._id=t.id,t.scales&&(o._scales=t.scales.map(t=>e.scales[t])),i.baseEnc&&(o._baseEnc=t.args.baseEnc),t.elemGroups&&(o._elemGroups=t.elemGroups.map(t=>t.map(t=>rR(t,r.type,e)))),t.elem2scale){o._elem2scale={};for(let n in t.elem2scale)o._elem2scale[n]=e.scales[t.elem2scale[n]]}return i.startAngle&&(o.startAngle=i.startAngle),o}function rR(t,e,n){if("vertex"===e){let e=t.split("_v_");return n._itemMap[e[0]].vertices.find(t=>t._id===parseInt(e[1]))}if("segment"===e){let e=t.split("_s_");return n._itemMap[e[0]].segments.find(t=>t._id===parseInt(e[1]))}return n._itemMap[t]}function iR(t){let e={};return e.id=t._id,e.data=t._rawData,e.attributeTypes=t._attrTypes,e.url=t.url,e}function oR(t){let e={};return e.dt=t._dt.id,e.attr2value=Object.assign({},t._attr2value),e}function aR(t,e){e.vertices=[];for(let n of t.vertices)e.vertices.push(sR(n));e.vertexCounter=t.vertexCounter,e.segmentCounter=t.segmentCounter,e.curveMode=t.curveMode}function sR(t){let e={};return e.type=t.type,e.id=t._id,e.x=t.x,e.y=t.y,t._dataScope&&(e.dataScope=oR(t._dataScope)),void 0!==t._polarAngle&&(e.polarAngle=t._polarAngle),e.shape=t.shape,e.width=t.width,e.height=t.height,e.radius=t.radius,e.fillColor=t.fillColor,e.opacity=t.opacity,e.strokeWidth=t.strokeWidth,e.strokeColor=t.strokeColor,e}function lR(t){return t.type===bT.Scene?function(t){let e=hR(t,{});e.fillColor=t.fillColor,e.scales={},e.encodings=[];for(let n in t._encodings)for(let r in t._encodings[n]){let i=t._encodings[n][r];i._forLegend||e.encodings.push(uR(i));for(let t of i._scales)t.id in e.scales||(e.scales[t.id]=cR(t))}e.tables={};let n=function(t){let e={};for(let n in t._encodings)for(let r in t._encodings[n]){let i=t._encodings[n][r];i.dataTable.id in e||i._forLegend||(e[i.dataTable.id]=i.dataTable)}for(let n of t.children)if(![bT.Axis,bT.Legend,bT.Gridlines].includes(n.type)){if(n.dataScope){e[n.dataScope.dataTable.id]=n.dataScope.dataTable;break}if(n.children&&n.children.length>0){let t=n.firstChild;for(;t;){if(t.dataScope){e[t.dataScope.dataTable.id]=t.dataScope.dataTable;break}t=t.children&&t.children.length>0?t.firstChild:void 0}}}return e}(t);for(let t in n)e.tables[t]=iR(n[t]);return console.log("======== serialization ========="),console.log(e),e}(t):[bT.Collection,bT.Glyph,bT.Composite].includes(t.type)?hR(t,{}):t instanceof Kw?function(t){let e={args:{}};e.type=t.type,e.id=t.id,t.classId&&(e.classId=t.classId),t._dataScope&&(e.dataScope=oR(t._dataScope)),t.bounds&&(e.bounds=t.bounds.toJSON()),t.refBounds&&(e.refBounds=t.refBounds.toJSON()),t.links&&(e.links=t.links.map(t=>t.id)),t.source&&(e.source=t.source.id),t.target&&(e.target=t.target.id);for(let n in t.styles)n.indexOf("Color")>0&&t.styles[n]instanceof _E?e.args[n]=t.styles[n].toJSON():e.args[n]=t.styles[n];switch(t.type){case bT.Arc:case bT.Pie:!function(t,e){e.args.x=t._x,e.args.y=t._y,e.args.innerRadius=t._innerRadius,e.args.outerRadius=t._outerRadius,e.args.startAngle=t._startAngle,e.args.endAngle=t._endAngle,e.args.direction=t._direction,e.args.thickness=t._thickness}(t,e),aR(t,e);break;case bT.Area:!function(t,e){e.args.baseline=t._baseline,e.args.orientation=t._orientation}(t,e),aR(t,e);break;case bT.Circle:!function(t,e){e.args.x=t.x,e.args.y=t.y,e.args.radius=t.radius}(t,e);break;case bT.Image:break;case bT.Line:case bT.Path:case bT.BezierCurve:aR(t,e);break;case bT.SimpleText:!function(t,e){e.args.x=t._x,e.args.y=t._y,e.args.text=t._text,e.args.anchor=t._anchor,t._backgroundColor&&(e.args.backgroundColor=t._backgroundColor),t._borderWidth&&(e.args.borderWidth=t._borderWidth),t._borderColor&&(e.args.borderColor=t._borderColor)}(t,e);break;case bT.Polygon:!function(t,e){e.args.x=t._x,e.args.y=t._y,e.args.radius=t._radius}(t,e),aR(t,e);break;case bT.Rect:!function(t,e){e.args.width=t.width,e.args.height=t.height,e.args.top=t.top,e.args.left=t.left}(t,e),aR(t,e);case bT.Ring:}return e}(t):(console.warn("unsupported serialization",t.type),{type:t.type})}function cR(t){let e={};return e.type=t.type,e.id=t.id,t._args&&(e.args=t._args),e.domain=t.domain,e.range=t.range,e}function uR(t){let e={};e.id=t._id,e.element=t._elem.id,e.elementType=t._elem.type,e.channel=t._channel,e.attr=t._attribute,e.aggregator=t._aggregator,e.table=t._table.id,e.args={},e.args.includeZero=t._includeZero,e.args.flipScale=t._flipScale,e.args.mapping=t._mapping,e.args.rangeExtent=t._preferredRangeExtent,e.args.domain=t._preferredDomain,e.args.scaleType=t._scaleType,e.args.scheme=t._colorScheme,t._baseEnc&&(e.args.baseEnc=t._baseEnc.id),e.scales=t._scales.map(t=>t.id),e.elemGroups=t._elemGroups.map(t=>t.map(t=>t.id)),e.elem2scale={};for(let n in t._elem2scale)e.elem2scale[n]=t._elem2scale[n].id;return"angle"==t.channel&&(e.args.startAngle=t.startAngle),e}function hR(t,e){if(e.id=t.id,e.type=t.type,t.classId&&(e.classId=t.classId),t._dataScope&&(e.dataScope=oR(t._dataScope)),e.bounds=t.bounds.toJSON(),t._layout&&(e.layout=function(t){switch(t.type){case fE.GRID:return function(t){let e={args:{}};return e.type=t.type,e.args.numCols=t._numCols,e.args.numRows=t._numRows,e.args.start=t._start,e.args.direction=t._direction,e.args.colGap=t._colGap,e.args.rowGap=t._rowGap,e.args.horzCellAlignment=t._cellHorzAlignment,e.args.vertCellAlignment=t._cellVertAlignment,e.left=t._left,e.top=t._top,e.group=t.group.id,e}(t);case fE.STACK:return function(t){let e={args:{}};return e.type=t.type,e.args.orientation=t._orientation,e.args.direction=t._direction,e.args.left=t._left,e.args.top=t._top,e.args.horzCellAlignment=t._horzCellAlignment,e.args.vertCellAlignment=t._vertCellAlignment,e.args.gap=t._gap,e.group=t.group.id,e}(t);case fE.PACKING:return function(t){let e={args:{}};return e.type=t.type,e.args.x=t._x,e.args.y=t._y,e.args.width=t._width,e.args.height=t._height,e.group=t.group.id,e}(t);case fE.FORCE:return function(t){let e={args:{}};return e.type=t.type,e.args.x=t._x,e.args.y=t._y,e.args.iterations=t._iterations,e.args.repulsion=t._repulsion,e.args.attraction=t._attraction,e.args.linkDistance=t._linkDistance,e.group=t.group.id,e}(t);case fE.CLUSTER:return function(t){let e={args:{}};return e.type=t.type,e.args.size=t._size,e.args.rootX=t._rootX,e.args.rootY=t._rootY,e}(t);case fE.DIRECTED:return function(t){let e={args:{}};return e.type=t.type,e.args.left=t._left,e.args.top=t._top,e.args.width=t._width,e.args.height=t._height,e.args.edgeSep=t._edgeSep,e.args.spreadLinks=t._spreadLinks,e.args.direction=t._direction,e}(t);case fE.TIDYTREE:return function(t){let e={args:{}};return e.type=t.type,e.args.left=t._left,e.args.top=t._top,e.args.width=t._width,e.args.height=t._height,e.args.orientation=t._orientation,e}(t);case fE.TREEMAP:return function(t){let e={args:{}};return e.type=t.type,e.args.left=t._left,e.args.top=t._top,e.args.width=t._width,e.args.height=t._height,e}(t);case fE.STRATA:return function(t){let e={args:{}};return e.type=t.type,e.args.direction=t._direction,e.args.gap=t._gap,e}(t);default:throw new Error("unknow layout type "+t.type)}}(t._layout)),e.children=[],t.children.length>0)for(let n of t.children)n instanceof sT?fR(n,e):n instanceof AM?dR(n,e):e.children.push(lR(n));return e.sortBy=t._sortBy,e}function fR(t,e){e.axes??=[];let n={};n.type=t._type,n.id=t._id,n.attr=t._attribute,n.channel=t._channel,n.args={},n.args.orientation=t._orientation,n.args.strokeColor=t._strokeColor,n.args.textColor=t._textColor,n.args.fontSize=t._fontSize,n.args.tickOffset=t._tickOffset,n.args.tickSize=t._tickSize,n.args.tickAnchor=t._tickAnchor,n.args.tickVisible=t._tickVisible,n.args.pathVisible=t._pathVisible,n.args.labelOffset=t._labelOffset,n.args.labelFormat=t._labelFormat,n.args.titleOffset=t._titleOffset,n.args.title=t._titleText,n.args.rotateTitle=t._rotateTitle,n.args.titleVisible=t._showTitle,n.args.labelRotation=t._labelRotation,e.axes.push(n)}function dR(t,e){e.gridlines??=[];let n={};n.type=t._type,n.id=t._id,n.attr=t._attribute,n.channel=t._channel,n.args=t._args,e.gridlines.push(n)}function pR(t,e){return void 0===t&&void 0===e||void 0!==t&&void 0!==e}function gR(t,e){const n=Object.keys(t),r=Object.keys(e);return n.length===r.length&&(0===n.length||n.every(t=>r.includes(t)))}function _R(t,e){if(!pR(t.layout,e.layout))return console.log("Not both defined or undefined:",t.bounds,e.bounds),!1;let n=t.layout,r=e.layout;if(!n&&!r)return!0;if(n.type!==r.type)return console.log("layout types are different:",n,r),!1;switch(n.type){case fE.GRID:return function(t,e){t._cellBounds.length!==e._cellBounds.length&&console.log("cell bounds length different:",t,e);for(let n=0;n<t._cellBounds;n++)if(!mR(t._cellBounds[n],e._cellBounds[n]))return console.log("cell bounds not equal:",t,e),!1;for(let n=0;n<t._grid.length;n++)for(let r=0;r<t._grid[n].length;r++)if(t._grid[n][r]!==e._grid[n][r])return console.log("grid not equal",t,e),!1;return t._numCols===e._numCols&&t._numRows===e._numRows&&t._start===e._start&&t._direction===e._direction&&t._rowGap===e._rowGap&&t._colGap===e._colGap&&t._cellHorzAlignment===e._cellHorzAlignment&&t._cellVertAlignment===e._cellVertAlignment&&t._left===e._left&&t._top===e._top}(n,r);case fE.STACK:return function(t,e){return t._orientation===e._orientation&&t._direction===e._direction&&t._left===e._left&&t._top===e._top&&t._horzCellAlignment===e._horzCellAlignment&&t._vertCellAlignment===e._vertCellAlignment&&t._gap===e._gap}(n,r);case fE.PACKING:return function(t,e){return t._x===e._x&&t._y===e._y&&t._width===e._width&&t._height===e._height}(n,r);case fE.FORCE:return function(t,e){return t._x===e._x&&t._y===e._y&&t._iterations===e._iterations&&t._repulsion===e._repulsion&&t._attraction===e._attraction&&t._linkDistance===e._linkDistance}(n,r);case fE.DIRECTED:return function(t,e){return t._width===e._width&&t._height===e._height&&t._top===e._top&&t._left===e._left&&t._edgeSep===e._edgeSep&&t._spreadLinks===e._spreadLinks&&t._direction===e._direction}(n,r);case fE.TIDYTREE:return function(t,e){return t._width===e._width&&t._height===e._height&&t._top===e._top&&t._left===e._left&&t._orientation===e._orientation}(n,r);case fE.STRATA:return function(t,e){return t._direction===e._direction&&t._gap===e._gap}(n,r);case fE.TREEMAP:return function(t,e){return t._width===e._width&&t._height===e._height&&t._top===e._top&&t._left===e._left}(n,r);default:return!1}}function yR(t,e){if(!pR(t.bounds,e.bounds))return console.log("Not both defined or undefined:",t.bounds,e.bounds),!1;let n=t.bounds,r=e.bounds;return!n&&!r||mR(n,r)}function mR(t,e){return t.x===e.x&&t.y===e.y&&t.width===e.width&&t.height===e.height}function bR(t,e){if(!pR(t,e))return console.log("Not both defined or undefined:",t,e),!1;if(t.type!==e.type)return console.log("Different mark types:",t,e),!1;if(t.id!==e.id)return console.log("id not equal:",t,e),!1;if(t.classId!==e.classId)return console.log("class id not equal:",t,e),!1;if(!xR(t,e))return console.log("DataScopes not equal",t,e),!1;if(!yR(t,e))return console.log("Bounds not equal",t,e),!1;if(!pR(t.links,e.links))return console.log("Not both defined or undefined: links ",t.links,e.links),!1;if(!pR(t.source,e.source))return console.log("Not both defined or undefined: source ",t.source,e.source),!1;if(!pR(t.target,e.target))return console.log("Not both defined or undefined: links ",t.target,e.target),!1;if(t.links&&e.links&&t.links.length!==e.links.length)return console.log("unequal number of links",t,e),!1;if(t.source&&e.source&&!bR(t.source,e.source))return console.log("different sources",t.source,e.source),!1;if(t.target&&e.target&&!bR(t.target,e.target))return console.log("different targets",t.target,e.target),!1;switch(t.type){case bT.Arc:case bT.Pie:return vR(t,e)?t.x===e.x&&t.y===e.y&&t.innerRadius===e.innerRadius&&t.outerRadius===e.outerRadius&&t.startAngle===e.startAngle&&t.endAngle===e.endAngle&&t.direction===e.direction&&t.thickness===e.thickness:(console.log("vertices not equal:",t,e),!1);case bT.Area:return vR(t,e)?t.baseline===e.baseline&&t.orientation===e.orientation:(console.log("vertices not equal:",t,e),!1);case bT.Circle:return t.x===e.x&&t.y===e.y&&t.radius===e.radius;case bT.Image:return console.warn("not implemented"),!0;case bT.Line:case bT.Path:case bT.BezierCurve:return!!vR(t,e)||(console.log("vertices not equal:",t,e),!1);case bT.SimpleText:return t.x===e.x&&t.y===e.y&&t.text===e.text&&t.anchor[0]===e.anchor[0]&&t.anchor[1]===e.anchor[1];case bT.Polygon:return vR(t,e)?t.x===e.x&&t.y===e.y&&t.radius===e.radius:(console.log("vertices not equal:",t,e),!1);case bT.Rect:return vR(t,e)?t.width===e.width&&t.height===e.height&&t.top===e.top&&t.left===e.left:(console.log("vertices not equal:",t,e),!1);case bT.Ring:default:return console.warn("not implemented"),!0}}function vR(t,e){if(t.vertices.length!==e.vertices.length)return console.log("unequal number of vertices:",t,e),!1;for(let n=0;n<t.vertices.length;n++){let r=t.vertices[n],i=e.vertices[n];return r.id!==i.id?(console.log("vertex id not equal:",r,i),!1):r.x!==i.x||r.y!==i.y?(console.log("vertex position not equal:",r,i),!1):xR(r,i)?r._polarAngle===i._polarAngle&&r.shape===i.shape&&r.width===i.width&&r.height==i.height&&r.radius==i.radius&&r.fillColor==i.fillColor&&r.opacity==i.opacity&&r.strokeWidth==i.strokeWidth&&r.strokeColor==i.strokeColor:(console.log("vertex data scopes not equal:",r.dataScope,i.dataScope),!1)}}function xR(t,e){if(!pR(t.dataScope,e.dataScope))return console.log("Not both defined or undefined:",t.dataScope,e.dataScope),!1;if(!t.dataScope&&!e.dataScope)return!0;let n=t.dataScope,r=e.dataScope;if(!gR(n._attr2value,r._attr2value))return!1;for(let t in n._attr2value)if(n._attr2value[t]!==r._attr2value[t])return!1;return n._dt.id===r._dt.id&&n._tuples.length===r._tuples.length}function wR(t,e){return t.type!==e.type&&console.log("Different types:",t.type,e.type),[bT.Collection,bT.Glyph,bT.Composite].includes(t.type)?ER(t,e):t instanceof Kw?bR(t,e):void 0}function ER(t,e){let n=t.children.filter(t=>!Object.values(vT).includes(t.type)),r=e.children.filter(t=>!Object.values(vT).includes(t.type));if(n.length!==r.length)return console.log("children length not equal:",n,r),!1;if(t.id!==e.id)return console.log("id not equal:",t,e),!1;if(t.classId!==e.classId)return console.log("class id not equal:",t,e),!1;if(!xR(t,e))return console.log("DataScopes not equal",t.dataScope,e.dataScope),!1;if(!yR(t,e))return console.log("Bounds not equal",t,e),!1;if(!_R(t,e))return console.log("Layouts not equal",t,e),!1;if(!function(t,e){if(!gR(t,e))return console.log("different keys",t,e),!1;for(let n in t)if(t[n]!==e[n])return!1;return!0}(t._sortBy,e._sortBy))return console.log("SortBy not equal",t,e),!1;for(let t=0;t<n.length;t++)if(!wR(n[t],r[t]))return console.log("Not equal",n[t],r[t]),!1;return!0}class AR extends hE{constructor(t){super(),this.type=fE.CIRCULAR,this._x="x"in t?t.x:100,this._y="y"in t?t.y:100,this._radius="radius"in t?t.radius:100}get x(){return this._x}get y(){return this._y}get radius(){return this._radius}clone(){return new AR({x:this._x,y:this._y,radius:this._radius})}}class TR extends hE{constructor(t){super(),this.type=fE.CLUSTER,this._isRadial="radial"in t&&t.radial,this._angleExtent="angleExtent"in t?t.angleExtent:360,this._radius="radius"in t?t.radius:300,this._rootX="x"in t?t.x:300,this._rootY="y"in t?t.y:300,this._orientation="orientation"in t?t.orientation:bE,this._width="width"in t?t.width:800,this._height="height"in t?t.height:600,this._left="left"in t?t.left:60,this._top="top"in t?t.top:100,this._tree="tree"in t?t.tree:void 0}get radius(){return this._radius}get angleExtent(){return this._angleExtent}get x(){return this._rootX}get y(){return this._rootY}get width(){return this._width}get height(){return this._height}get left(){return this._left}get top(){return this._top}isRadial(){return this._isRadial}get orientation(){return this._orientation}clone(){return new TR({radius:this._radius,angleExtent:this._angleExtent,x:this._rootX,y:this._rootY,radial:this._isRadial,orientation:this._orientation,left:this._left,top:this._top,width:this._width,height:this._height,tree:this._tree})}}exports.canClassify=function(t){return t.type===bT.Collection&&!(t.children.length<2)},exports.canDensify=tA,exports.canDivide=SM,exports.canRepeat=bM,exports.csv=async function(t){return async function(t){let e=await TT("GET",t),n=Vs(e.trim(),Zs);return new wT(n,t)}(t)},exports.csvString=function(t){return function(t){let e=Vs(t.trim(),Zs);return new wT(e,"fromString")}(t)},exports.deserialize=function(t){return ZM(t)},exports.findElements=nE,exports.getLeafMarks=lE,exports.getPeers=Qw,exports.graphJSON=async function(t){return async function(t){let e=await TT("GET",t);return new UE(JSON.parse(e),t)}(t)},exports.isEqual=function(t,e){return function(t,e){return t.fillColor!==e.fillColor?(console.log("fillColor not equal:",t,e),!1):ER(t,e)}(t,e)},exports.isMark=Zw,exports.isRefElement=function(t){return t.type===bT.Axis||t.type===bT.Legend||t.type===bT.Gridlines},exports.layout=function(t,e){let n=e||{};switch(t.toLowerCase()){case fE.STACK:return new TM(n);case fE.PACKING:return new YM(n);case fE.FORCE:return new UM(n);case fE.DIRECTED:return new jM(n);case fE.TIDYTREE:return new HM(n);case fE.TREEMAP:return new qM(n);case fE.CIRCULAR:return new AR(n);case fE.CLUSTER:return new TR(n);case fE.GRID:default:return new eT(n)}},exports.scene=function(t){return new FM(t)},exports.serialize=function(t){return lR(t)},exports.table=function(t){return new wT(t,"")},exports.treeJSON=async function(t){return async function(t){let e=await TT("GET",t);return new GE(JSON.parse(e),t)}(t)};
|
|
1
|
+
// version: 4.0.0
|
|
2
|
+
"use strict";function t(t,e){return null==t||null==e?NaN:t<e?-1:t>e?1:t>=e?0:NaN}function e(t,e){return null==t||null==e?NaN:e<t?-1:e>t?1:e>=t?0:NaN}function n(n){let i,s,o;function a(t,e,n=0,r=t.length){if(n<r){if(0!==i(e,e))return r;do{const i=n+r>>>1;s(t[i],e)<0?n=i+1:r=i}while(n<r)}return n}return 2!==n.length?(i=t,s=(e,r)=>t(n(e),r),o=(t,e)=>n(t)-e):(i=n===t||n===e?n:r,s=n,o=n),{left:a,center:function(t,e,n=0,r=t.length){const i=a(t,e,n,r-1);return i>n&&o(t[i-1],e)>-o(t[i],e)?i-1:i},right:function(t,e,n=0,r=t.length){if(n<r){if(0!==i(e,e))return r;do{const i=n+r>>>1;s(t[i],e)<=0?n=i+1:r=i}while(n<r)}return n}}}function r(){return 0}function i(t){return null===t?NaN:+t}const s=n(t),o=s.right,a=s.left,l=n(i).center;const c=h(p),u=h(function(t){const e=p(t);return(t,n,r,i,s)=>{e(t,n,(r<<=2)+0,(i<<=2)+0,s<<=2),e(t,n,r+1,i+1,s),e(t,n,r+2,i+2,s),e(t,n,r+3,i+3,s)}});function h(t){return function(e,n,r=n){if(!((n=+n)>=0))throw new RangeError("invalid rx");if(!((r=+r)>=0))throw new RangeError("invalid ry");let{data:i,width:s,height:o}=e;if(!((s=Math.floor(s))>=0))throw new RangeError("invalid width");if(!((o=Math.floor(void 0!==o?o:i.length/s))>=0))throw new RangeError("invalid height");if(!s||!o||!n&&!r)return e;const a=n&&t(n),l=r&&t(r),c=i.slice();return a&&l?(f(a,c,i,s,o),f(a,i,c,s,o),f(a,c,i,s,o),d(l,i,c,s,o),d(l,c,i,s,o),d(l,i,c,s,o)):a?(f(a,i,c,s,o),f(a,c,i,s,o),f(a,i,c,s,o)):l&&(d(l,i,c,s,o),d(l,c,i,s,o),d(l,i,c,s,o)),e}}function f(t,e,n,r,i){for(let s=0,o=r*i;s<o;)t(e,n,s,s+=r,1)}function d(t,e,n,r,i){for(let s=0,o=r*i;s<r;++s)t(e,n,s,s+o,r)}function p(t){const e=Math.floor(t);if(e===t)return function(t){const e=2*t+1;return(n,r,i,s,o)=>{if(!((s-=o)>=i))return;let a=t*r[i];const l=o*t;for(let t=i,e=i+l;t<e;t+=o)a+=r[Math.min(s,t)];for(let t=i,c=s;t<=c;t+=o)a+=r[Math.min(s,t+l)],n[t]=a/e,a-=r[Math.max(i,t-l)]}}(t);const n=t-e,r=2*t+1;return(t,i,s,o,a)=>{if(!((o-=a)>=s))return;let l=e*i[s];const c=a*e,u=c+a;for(let t=s,e=s+c;t<e;t+=a)l+=i[Math.min(o,t)];for(let e=s,h=o;e<=h;e+=a)l+=i[Math.min(o,e+c)],t[e]=(l+n*(i[Math.max(s,e-u)]+i[Math.min(o,e+u)]))/r,l-=i[Math.max(s,e-c)]}}function _(t,e){let n=0;if(void 0===e)for(let e of t)null!=e&&(e=+e)>=e&&++n;else{let r=-1;for(let i of t)null!=(i=e(i,++r,t))&&(i=+i)>=i&&++n}return n}function g(t){return 0|t.length}function y(t){return!(t>0)}function m(t){return"object"!=typeof t||"length"in t?t:Array.from(t)}function b(t,e){let n,r=0,i=0,s=0;if(void 0===e)for(let e of t)null!=e&&(e=+e)>=e&&(n=e-i,i+=n/++r,s+=n*(e-i));else{let o=-1;for(let a of t)null!=(a=e(a,++o,t))&&(a=+a)>=a&&(n=a-i,i+=n/++r,s+=n*(a-i))}if(r>1)return s/(r-1)}function v(t,e){const n=b(t,e);return n?Math.sqrt(n):n}function x(t,e){let n,r;if(void 0===e)for(const e of t)null!=e&&(void 0===n?e>=e&&(n=r=e):(n>e&&(n=e),r<e&&(r=e)));else{let i=-1;for(let s of t)null!=(s=e(s,++i,t))&&(void 0===n?s>=s&&(n=r=s):(n>s&&(n=s),r<s&&(r=s)))}return[n,r]}class w{constructor(){this._partials=new Float64Array(32),this._n=0}add(t){const e=this._partials;let n=0;for(let r=0;r<this._n&&r<32;r++){const i=e[r],s=t+i,o=Math.abs(t)<Math.abs(i)?t-(s-i):i-(s-t);o&&(e[n++]=o),t=s}return e[n]=t,this._n=n+1,this}valueOf(){const t=this._partials;let e,n,r,i=this._n,s=0;if(i>0){for(s=t[--i];i>0&&(e=s,n=t[--i],s=e+n,r=n-(s-e),!r););i>0&&(r<0&&t[i-1]<0||r>0&&t[i-1]>0)&&(n=2*r,e=s+n,n==e-s&&(s=e))}return s}}class E extends Map{constructor(t,e=k){if(super(),Object.defineProperties(this,{_intern:{value:new Map},_key:{value:e}}),null!=t)for(const[e,n]of t)this.set(e,n)}get(t){return super.get(S(this,t))}has(t){return super.has(S(this,t))}set(t,e){return super.set(T(this,t),e)}delete(t){return super.delete(C(this,t))}}class A extends Set{constructor(t,e=k){if(super(),Object.defineProperties(this,{_intern:{value:new Map},_key:{value:e}}),null!=t)for(const e of t)this.add(e)}has(t){return super.has(S(this,t))}add(t){return super.add(T(this,t))}delete(t){return super.delete(C(this,t))}}function S({_intern:t,_key:e},n){const r=e(n);return t.has(r)?t.get(r):n}function T({_intern:t,_key:e},n){const r=e(n);return t.has(r)?t.get(r):(t.set(r,n),n)}function C({_intern:t,_key:e},n){const r=e(n);return t.has(r)&&(n=t.get(r),t.delete(r)),n}function k(t){return null!==t&&"object"==typeof t?t.valueOf():t}function R(t){return t}function M(t,...e){return D(t,R,R,e)}function O(t,...e){return D(t,Array.from,R,e)}function N(t,e){for(let n=1,r=e.length;n<r;++n)t=t.flatMap(t=>t.pop().map(([e,n])=>[...t,e,n]));return t}function I(t,e,...n){return D(t,R,e,n)}function P(t,e,...n){return D(t,Array.from,e,n)}function L(t){if(1!==t.length)throw new Error("duplicate key");return t[0]}function D(t,e,n,r){return function t(i,s){if(s>=r.length)return n(i);const o=new E,a=r[s++];let l=-1;for(const t of i){const e=a(t,++l,i),n=o.get(e);n?n.push(t):o.set(e,[t])}for(const[e,n]of o)o.set(e,t(n,s));return e(o)}(t,0)}function V(t,e){return Array.from(e,e=>t[e])}function B(t,...e){if("function"!=typeof t[Symbol.iterator])throw new TypeError("values is not iterable");t=Array.from(t);let[n]=e;if(n&&2!==n.length||e.length>1){const r=Uint32Array.from(t,(t,e)=>e);return e.length>1?(e=e.map(e=>t.map(e)),r.sort((t,n)=>{for(const r of e){const e=F(r[t],r[n]);if(e)return e}})):(n=t.map(n),r.sort((t,e)=>F(n[t],n[e]))),V(t,r)}return t.sort(z(n))}function z(e=t){if(e===t)return F;if("function"!=typeof e)throw new TypeError("compare is not a function");return(t,n)=>{const r=e(t,n);return r||0===r?r:(0===e(n,n))-(0===e(t,t))}}function F(t,e){return(null==t||!(t>=t))-(null==e||!(e>=e))||(t<e?-1:t>e?1:0)}var G=Array.prototype.slice;function j(t){return()=>t}const U=Math.sqrt(50),Y=Math.sqrt(10),H=Math.sqrt(2);function W(t,e,n){const r=(e-t)/Math.max(0,n),i=Math.floor(Math.log10(r)),s=r/Math.pow(10,i),o=s>=U?10:s>=Y?5:s>=H?2:1;let a,l,c;return i<0?(c=Math.pow(10,-i)/o,a=Math.round(t*c),l=Math.round(e*c),a/c<t&&++a,l/c>e&&--l,c=-c):(c=Math.pow(10,i)*o,a=Math.round(t/c),l=Math.round(e/c),a*c<t&&++a,l*c>e&&--l),l<a&&.5<=n&&n<2?W(t,e,2*n):[a,l,c]}function q(t,e,n){if(!((n=+n)>0))return[];if((t=+t)===(e=+e))return[t];const r=e<t,[i,s,o]=r?W(e,t,n):W(t,e,n);if(!(s>=i))return[];const a=s-i+1,l=new Array(a);if(r)if(o<0)for(let t=0;t<a;++t)l[t]=(s-t)/-o;else for(let t=0;t<a;++t)l[t]=(s-t)*o;else if(o<0)for(let t=0;t<a;++t)l[t]=(i+t)/-o;else for(let t=0;t<a;++t)l[t]=(i+t)*o;return l}function $(t,e,n){return W(t=+t,e=+e,n=+n)[2]}function X(t,e,n){n=+n;const r=(e=+e)<(t=+t),i=r?$(e,t,n):$(t,e,n);return(r?-1:1)*(i<0?1/-i:i)}function K(t,e,n){let r;for(;;){const i=$(t,e,n);if(i===r||0===i||!isFinite(i))return[t,e];i>0?(t=Math.floor(t/i)*i,e=Math.ceil(e/i)*i):i<0&&(t=Math.ceil(t*i)/i,e=Math.floor(e*i)/i),r=i}}function Z(t){return Math.max(1,Math.ceil(Math.log(_(t))/Math.LN2)+1)}function J(){var t=R,e=x,n=Z;function r(r){Array.isArray(r)||(r=Array.from(r));var i,s,a,l=r.length,c=new Array(l);for(i=0;i<l;++i)c[i]=t(r[i],i,r);var u=e(c),h=u[0],f=u[1],d=n(c,h,f);if(!Array.isArray(d)){const t=f,n=+d;if(e===x&&([h,f]=K(h,f,n)),(d=q(h,f,n))[0]<=h&&(a=$(h,f,n)),d[d.length-1]>=f)if(t>=f&&e===x){const t=$(h,f,n);isFinite(t)&&(t>0?f=(Math.floor(f/t)+1)*t:t<0&&(f=(Math.ceil(f*-t)+1)/-t))}else d.pop()}for(var p=d.length,_=0,g=p;d[_]<=h;)++_;for(;d[g-1]>f;)--g;(_||g<p)&&(d=d.slice(_,g),p=g-_);var y,m=new Array(p+1);for(i=0;i<=p;++i)(y=m[i]=[]).x0=i>0?d[i-1]:h,y.x1=i<p?d[i]:f;if(isFinite(a)){if(a>0)for(i=0;i<l;++i)null!=(s=c[i])&&h<=s&&s<=f&&m[Math.min(p,Math.floor((s-h)/a))].push(r[i]);else if(a<0)for(i=0;i<l;++i)if(null!=(s=c[i])&&h<=s&&s<=f){const t=Math.floor((h-s)*a);m[Math.min(p,t+(d[t]<=s))].push(r[i])}}else for(i=0;i<l;++i)null!=(s=c[i])&&h<=s&&s<=f&&m[o(d,s,0,p)].push(r[i]);return m}return r.value=function(e){return arguments.length?(t="function"==typeof e?e:j(e),r):t},r.domain=function(t){return arguments.length?(e="function"==typeof t?t:j([t[0],t[1]]),r):e},r.thresholds=function(t){return arguments.length?(n="function"==typeof t?t:j(Array.isArray(t)?G.call(t):t),r):n},r}function Q(t,e){let n;if(void 0===e)for(const e of t)null!=e&&(n<e||void 0===n&&e>=e)&&(n=e);else{let r=-1;for(let i of t)null!=(i=e(i,++r,t))&&(n<i||void 0===n&&i>=i)&&(n=i)}return n}function tt(t,e){let n,r=-1,i=-1;if(void 0===e)for(const e of t)++i,null!=e&&(n<e||void 0===n&&e>=e)&&(n=e,r=i);else for(let s of t)null!=(s=e(s,++i,t))&&(n<s||void 0===n&&s>=s)&&(n=s,r=i);return r}function et(t,e){let n;if(void 0===e)for(const e of t)null!=e&&(n>e||void 0===n&&e>=e)&&(n=e);else{let r=-1;for(let i of t)null!=(i=e(i,++r,t))&&(n>i||void 0===n&&i>=i)&&(n=i)}return n}function nt(t,e){let n,r=-1,i=-1;if(void 0===e)for(const e of t)++i,null!=e&&(n>e||void 0===n&&e>=e)&&(n=e,r=i);else for(let s of t)null!=(s=e(s,++i,t))&&(n>s||void 0===n&&s>=s)&&(n=s,r=i);return r}function rt(t,e,n=0,r=1/0,i){if(e=Math.floor(e),n=Math.floor(Math.max(0,n)),r=Math.floor(Math.min(t.length-1,r)),!(n<=e&&e<=r))return t;for(i=void 0===i?F:z(i);r>n;){if(r-n>600){const s=r-n+1,o=e-n+1,a=Math.log(s),l=.5*Math.exp(2*a/3),c=.5*Math.sqrt(a*l*(s-l)/s)*(o-s/2<0?-1:1);rt(t,e,Math.max(n,Math.floor(e-o*l/s+c)),Math.min(r,Math.floor(e+(s-o)*l/s+c)),i)}const s=t[e];let o=n,a=r;for(it(t,n,e),i(t[r],s)>0&&it(t,n,r);o<a;){for(it(t,o,a),++o,--a;i(t[o],s)<0;)++o;for(;i(t[a],s)>0;)--a}0===i(t[n],s)?it(t,n,a):(++a,it(t,a,r)),a<=e&&(n=a+1),e<=a&&(r=a-1)}return t}function it(t,e,n){const r=t[e];t[e]=t[n],t[n]=r}function st(e,n=t){let r,i=!1;if(1===n.length){let s;for(const o of e){const e=n(o);(i?t(e,s)>0:0===t(e,e))&&(r=o,s=e,i=!0)}}else for(const t of e)(i?n(t,r)>0:0===n(t,t))&&(r=t,i=!0);return r}function ot(t,e,n){if(t=Float64Array.from(function*(t,e){if(void 0===e)for(let e of t)null!=e&&(e=+e)>=e&&(yield e);else{let n=-1;for(let r of t)null!=(r=e(r,++n,t))&&(r=+r)>=r&&(yield r)}}(t,n)),(r=t.length)&&!isNaN(e=+e)){if(e<=0||r<2)return et(t);if(e>=1)return Q(t);var r,i=(r-1)*e,s=Math.floor(i),o=Q(rt(t,s).subarray(0,s+1));return o+(et(t.subarray(s+1))-o)*(i-s)}}function at(t,e,n=i){if((r=t.length)&&!isNaN(e=+e)){if(e<=0||r<2)return+n(t[0],0,t);if(e>=1)return+n(t[r-1],r-1,t);var r,s=(r-1)*e,o=Math.floor(s),a=+n(t[o],o,t);return a+(+n(t[o+1],o+1,t)-a)*(s-o)}}function lt(t,e,n=i){if(!isNaN(e=+e)){if(r=Float64Array.from(t,(e,r)=>i(n(t[r],r,t))),e<=0)return nt(r);if(e>=1)return tt(r);var r,s=Uint32Array.from(t,(t,e)=>e),o=r.length-1,a=Math.floor(o*e);return rt(s,a,0,o,(t,e)=>F(r[t],r[e])),(a=st(s.subarray(0,a+1),t=>r[t]))>=0?a:-1}}function ct(t,e){let n=0,r=0;if(void 0===e)for(let e of t)null!=e&&(e=+e)>=e&&(++n,r+=e);else{let i=-1;for(let s of t)null!=(s=e(s,++i,t))&&(s=+s)>=s&&(++n,r+=s)}if(n)return r/n}function ut(t,e){return ot(t,.5,e)}function ht(t){return Array.from(function*(t){for(const e of t)yield*e}(t))}function ft(t,e){return[t,e]}function dt(t,e,n){t=+t,e=+e,n=(i=arguments.length)<2?(e=t,t=0,1):i<3?1:+n;for(var r=-1,i=0|Math.max(0,Math.ceil((e-t)/n)),s=new Array(i);++r<i;)s[r]=t+r*n;return s}function pt(e,n=t){if(1===n.length)return nt(e,n);let r,i=-1,s=-1;for(const t of e)++s,(i<0?0===n(t,t):n(t,r)<0)&&(r=t,i=s);return i}var _t=gt(Math.random);function gt(t){return function(e,n=0,r=e.length){let i=r-(n=+n);for(;i;){const r=t()*i--|0,s=e[i+n];e[i+n]=e[r+n],e[r+n]=s}return e}}function yt(t,e){let n=0;if(void 0===e)for(let e of t)(e=+e)&&(n+=e);else{let r=-1;for(let i of t)(i=+e(i,++r,t))&&(n+=i)}return n}function mt(t){if(!(i=t.length))return[];for(var e=-1,n=et(t,bt),r=new Array(n);++e<n;)for(var i,s=-1,o=r[e]=new Array(i);++s<i;)o[s]=t[s][e];return r}function bt(t){return t.length}function vt(t){return t instanceof A?t:new A(t)}function xt(t,e){const n=t[Symbol.iterator](),r=new Set;for(const t of e){const e=wt(t);if(r.has(e))continue;let i,s;for(;({value:i,done:s}=n.next());){if(s)return!1;const t=wt(i);if(r.add(t),Object.is(e,t))break}}return!0}function wt(t){return null!==t&&"object"==typeof t?t.valueOf():t}function Et(t){return t}var At=1e-6;function St(t){return"translate("+t+",0)"}function Tt(t){return"translate(0,"+t+")"}function Ct(t){return e=>+t(e)}function kt(t,e){return e=Math.max(0,t.bandwidth()-2*e)/2,t.round()&&(e=Math.round(e)),n=>+t(n)+e}function Rt(){return!this.__axis}function Mt(t,e){var n=[],r=null,i=null,s=6,o=6,a=3,l="undefined"!=typeof window&&window.devicePixelRatio>1?0:.5,c=1===t||4===t?-1:1,u=4===t||2===t?"x":"y",h=1===t||3===t?St:Tt;function f(f){var d=null==r?e.ticks?e.ticks.apply(e,n):e.domain():r,p=null==i?e.tickFormat?e.tickFormat.apply(e,n):Et:i,_=Math.max(s,0)+a,g=e.range(),y=+g[0]+l,m=+g[g.length-1]+l,b=(e.bandwidth?kt:Ct)(e.copy(),l),v=f.selection?f.selection():f,x=v.selectAll(".domain").data([null]),w=v.selectAll(".tick").data(d,e).order(),E=w.exit(),A=w.enter().append("g").attr("class","tick"),S=w.select("line"),T=w.select("text");x=x.merge(x.enter().insert("path",".tick").attr("class","domain").attr("stroke","currentColor")),w=w.merge(A),S=S.merge(A.append("line").attr("stroke","currentColor").attr(u+"2",c*s)),T=T.merge(A.append("text").attr("fill","currentColor").attr(u,c*_).attr("dy",1===t?"0em":3===t?"0.71em":"0.32em")),f!==v&&(x=x.transition(f),w=w.transition(f),S=S.transition(f),T=T.transition(f),E=E.transition(f).attr("opacity",At).attr("transform",function(t){return isFinite(t=b(t))?h(t+l):this.getAttribute("transform")}),A.attr("opacity",At).attr("transform",function(t){var e=this.parentNode.__axis;return h((e&&isFinite(e=e(t))?e:b(t))+l)})),E.remove(),x.attr("d",4===t||2===t?o?"M"+c*o+","+y+"H"+l+"V"+m+"H"+c*o:"M"+l+","+y+"V"+m:o?"M"+y+","+c*o+"V"+l+"H"+m+"V"+c*o:"M"+y+","+l+"H"+m),w.attr("opacity",1).attr("transform",function(t){return h(b(t)+l)}),S.attr(u+"2",c*s),T.attr(u,c*_).text(p),v.filter(Rt).attr("fill","none").attr("font-size",10).attr("font-family","sans-serif").attr("text-anchor",2===t?"start":4===t?"end":"middle"),v.each(function(){this.__axis=b})}return f.scale=function(t){return arguments.length?(e=t,f):e},f.ticks=function(){return n=Array.from(arguments),f},f.tickArguments=function(t){return arguments.length?(n=null==t?[]:Array.from(t),f):n.slice()},f.tickValues=function(t){return arguments.length?(r=null==t?null:Array.from(t),f):r&&r.slice()},f.tickFormat=function(t){return arguments.length?(i=t,f):i},f.tickSize=function(t){return arguments.length?(s=o=+t,f):s},f.tickSizeInner=function(t){return arguments.length?(s=+t,f):s},f.tickSizeOuter=function(t){return arguments.length?(o=+t,f):o},f.tickPadding=function(t){return arguments.length?(a=+t,f):a},f.offset=function(t){return arguments.length?(l=+t,f):l},f}var Ot={value:()=>{}};function Nt(){for(var t,e=0,n=arguments.length,r={};e<n;++e){if(!(t=arguments[e]+"")||t in r||/[\s.]/.test(t))throw new Error("illegal type: "+t);r[t]=[]}return new It(r)}function It(t){this._=t}function Pt(t,e){for(var n,r=0,i=t.length;r<i;++r)if((n=t[r]).name===e)return n.value}function Lt(t,e,n){for(var r=0,i=t.length;r<i;++r)if(t[r].name===e){t[r]=Ot,t=t.slice(0,r).concat(t.slice(r+1));break}return null!=n&&t.push({name:e,value:n}),t}It.prototype=Nt.prototype={constructor:It,on:function(t,e){var n,r,i=this._,s=(r=i,(t+"").trim().split(/^|\s+/).map(function(t){var e="",n=t.indexOf(".");if(n>=0&&(e=t.slice(n+1),t=t.slice(0,n)),t&&!r.hasOwnProperty(t))throw new Error("unknown type: "+t);return{type:t,name:e}})),o=-1,a=s.length;if(!(arguments.length<2)){if(null!=e&&"function"!=typeof e)throw new Error("invalid callback: "+e);for(;++o<a;)if(n=(t=s[o]).type)i[n]=Lt(i[n],t.name,e);else if(null==e)for(n in i)i[n]=Lt(i[n],t.name,null);return this}for(;++o<a;)if((n=(t=s[o]).type)&&(n=Pt(i[n],t.name)))return n},copy:function(){var t={},e=this._;for(var n in e)t[n]=e[n].slice();return new It(t)},call:function(t,e){if((n=arguments.length-2)>0)for(var n,r,i=new Array(n),s=0;s<n;++s)i[s]=arguments[s+2];if(!this._.hasOwnProperty(t))throw new Error("unknown type: "+t);for(s=0,n=(r=this._[t]).length;s<n;++s)r[s].value.apply(e,i)},apply:function(t,e,n){if(!this._.hasOwnProperty(t))throw new Error("unknown type: "+t);for(var r=this._[t],i=0,s=r.length;i<s;++i)r[i].value.apply(e,n)}};var Dt="http://www.w3.org/1999/xhtml",Vt={svg:"http://www.w3.org/2000/svg",xhtml:Dt,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};function Bt(t){var e=t+="",n=e.indexOf(":");return n>=0&&"xmlns"!==(e=t.slice(0,n))&&(t=t.slice(n+1)),Vt.hasOwnProperty(e)?{space:Vt[e],local:t}:t}function zt(t){return function(){var e=this.ownerDocument,n=this.namespaceURI;return n===Dt&&e.documentElement.namespaceURI===Dt?e.createElement(t):e.createElementNS(n,t)}}function Ft(t){return function(){return this.ownerDocument.createElementNS(t.space,t.local)}}function Gt(t){var e=Bt(t);return(e.local?Ft:zt)(e)}function jt(){}function Ut(t){return null==t?jt:function(){return this.querySelector(t)}}function Yt(t){return null==t?[]:Array.isArray(t)?t:Array.from(t)}function Ht(){return[]}function Wt(t){return null==t?Ht:function(){return this.querySelectorAll(t)}}function qt(t){return function(){return this.matches(t)}}function $t(t){return function(e){return e.matches(t)}}var Xt=Array.prototype.find;function Kt(){return this.firstElementChild}var Zt=Array.prototype.filter;function Jt(){return Array.from(this.children)}function Qt(t){return new Array(t.length)}function te(t,e){this.ownerDocument=t.ownerDocument,this.namespaceURI=t.namespaceURI,this._next=null,this._parent=t,this.__data__=e}function ee(t,e,n,r,i,s){for(var o,a=0,l=e.length,c=s.length;a<c;++a)(o=e[a])?(o.__data__=s[a],r[a]=o):n[a]=new te(t,s[a]);for(;a<l;++a)(o=e[a])&&(i[a]=o)}function ne(t,e,n,r,i,s,o){var a,l,c,u=new Map,h=e.length,f=s.length,d=new Array(h);for(a=0;a<h;++a)(l=e[a])&&(d[a]=c=o.call(l,l.__data__,a,e)+"",u.has(c)?i[a]=l:u.set(c,l));for(a=0;a<f;++a)c=o.call(t,s[a],a,s)+"",(l=u.get(c))?(r[a]=l,l.__data__=s[a],u.delete(c)):n[a]=new te(t,s[a]);for(a=0;a<h;++a)(l=e[a])&&u.get(d[a])===l&&(i[a]=l)}function re(t){return t.__data__}function ie(t){return"object"==typeof t&&"length"in t?t:Array.from(t)}function se(t,e){return t<e?-1:t>e?1:t>=e?0:NaN}function oe(t){return function(){this.removeAttribute(t)}}function ae(t){return function(){this.removeAttributeNS(t.space,t.local)}}function le(t,e){return function(){this.setAttribute(t,e)}}function ce(t,e){return function(){this.setAttributeNS(t.space,t.local,e)}}function ue(t,e){return function(){var n=e.apply(this,arguments);null==n?this.removeAttribute(t):this.setAttribute(t,n)}}function he(t,e){return function(){var n=e.apply(this,arguments);null==n?this.removeAttributeNS(t.space,t.local):this.setAttributeNS(t.space,t.local,n)}}function fe(t){return t.ownerDocument&&t.ownerDocument.defaultView||t.document&&t||t.defaultView}function de(t){return function(){this.style.removeProperty(t)}}function pe(t,e,n){return function(){this.style.setProperty(t,e,n)}}function _e(t,e,n){return function(){var r=e.apply(this,arguments);null==r?this.style.removeProperty(t):this.style.setProperty(t,r,n)}}function ge(t,e){return t.style.getPropertyValue(e)||fe(t).getComputedStyle(t,null).getPropertyValue(e)}function ye(t){return function(){delete this[t]}}function me(t,e){return function(){this[t]=e}}function be(t,e){return function(){var n=e.apply(this,arguments);null==n?delete this[t]:this[t]=n}}function ve(t){return t.trim().split(/^|\s+/)}function xe(t){return t.classList||new we(t)}function we(t){this._node=t,this._names=ve(t.getAttribute("class")||"")}function Ee(t,e){for(var n=xe(t),r=-1,i=e.length;++r<i;)n.add(e[r])}function Ae(t,e){for(var n=xe(t),r=-1,i=e.length;++r<i;)n.remove(e[r])}function Se(t){return function(){Ee(this,t)}}function Te(t){return function(){Ae(this,t)}}function Ce(t,e){return function(){(e.apply(this,arguments)?Ee:Ae)(this,t)}}function ke(){this.textContent=""}function Re(t){return function(){this.textContent=t}}function Me(t){return function(){var e=t.apply(this,arguments);this.textContent=null==e?"":e}}function Oe(){this.innerHTML=""}function Ne(t){return function(){this.innerHTML=t}}function Ie(t){return function(){var e=t.apply(this,arguments);this.innerHTML=null==e?"":e}}function Pe(){this.nextSibling&&this.parentNode.appendChild(this)}function Le(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function De(){return null}function Ve(){var t=this.parentNode;t&&t.removeChild(this)}function Be(){var t=this.cloneNode(!1),e=this.parentNode;return e?e.insertBefore(t,this.nextSibling):t}function ze(){var t=this.cloneNode(!0),e=this.parentNode;return e?e.insertBefore(t,this.nextSibling):t}function Fe(t){return function(){var e=this.__on;if(e){for(var n,r=0,i=-1,s=e.length;r<s;++r)n=e[r],t.type&&n.type!==t.type||n.name!==t.name?e[++i]=n:this.removeEventListener(n.type,n.listener,n.options);++i?e.length=i:delete this.__on}}}function Ge(t,e,n){return function(){var r,i=this.__on,s=function(t){return function(e){t.call(this,e,this.__data__)}}(e);if(i)for(var o=0,a=i.length;o<a;++o)if((r=i[o]).type===t.type&&r.name===t.name)return this.removeEventListener(r.type,r.listener,r.options),this.addEventListener(r.type,r.listener=s,r.options=n),void(r.value=e);this.addEventListener(t.type,s,n),r={type:t.type,name:t.name,value:e,listener:s,options:n},i?i.push(r):this.__on=[r]}}function je(t,e,n){var r=fe(t),i=r.CustomEvent;"function"==typeof i?i=new i(e,n):(i=r.document.createEvent("Event"),n?(i.initEvent(e,n.bubbles,n.cancelable),i.detail=n.detail):i.initEvent(e,!1,!1)),t.dispatchEvent(i)}function Ue(t,e){return function(){return je(this,t,e)}}function Ye(t,e){return function(){return je(this,t,e.apply(this,arguments))}}te.prototype={constructor:te,appendChild:function(t){return this._parent.insertBefore(t,this._next)},insertBefore:function(t,e){return this._parent.insertBefore(t,e)},querySelector:function(t){return this._parent.querySelector(t)},querySelectorAll:function(t){return this._parent.querySelectorAll(t)}},we.prototype={add:function(t){this._names.indexOf(t)<0&&(this._names.push(t),this._node.setAttribute("class",this._names.join(" ")))},remove:function(t){var e=this._names.indexOf(t);e>=0&&(this._names.splice(e,1),this._node.setAttribute("class",this._names.join(" ")))},contains:function(t){return this._names.indexOf(t)>=0}};var He=[null];function We(t,e){this._groups=t,this._parents=e}function qe(){return new We([[document.documentElement]],He)}function $e(t){return"string"==typeof t?new We([[document.querySelector(t)]],[document.documentElement]):new We([[t]],He)}We.prototype=qe.prototype={constructor:We,select:function(t){"function"!=typeof t&&(t=Ut(t));for(var e=this._groups,n=e.length,r=new Array(n),i=0;i<n;++i)for(var s,o,a=e[i],l=a.length,c=r[i]=new Array(l),u=0;u<l;++u)(s=a[u])&&(o=t.call(s,s.__data__,u,a))&&("__data__"in s&&(o.__data__=s.__data__),c[u]=o);return new We(r,this._parents)},selectAll:function(t){t="function"==typeof t?function(t){return function(){return Yt(t.apply(this,arguments))}}(t):Wt(t);for(var e=this._groups,n=e.length,r=[],i=[],s=0;s<n;++s)for(var o,a=e[s],l=a.length,c=0;c<l;++c)(o=a[c])&&(r.push(t.call(o,o.__data__,c,a)),i.push(o));return new We(r,i)},selectChild:function(t){return this.select(null==t?Kt:function(t){return function(){return Xt.call(this.children,t)}}("function"==typeof t?t:$t(t)))},selectChildren:function(t){return this.selectAll(null==t?Jt:function(t){return function(){return Zt.call(this.children,t)}}("function"==typeof t?t:$t(t)))},filter:function(t){"function"!=typeof t&&(t=qt(t));for(var e=this._groups,n=e.length,r=new Array(n),i=0;i<n;++i)for(var s,o=e[i],a=o.length,l=r[i]=[],c=0;c<a;++c)(s=o[c])&&t.call(s,s.__data__,c,o)&&l.push(s);return new We(r,this._parents)},data:function(t,e){if(!arguments.length)return Array.from(this,re);var n=e?ne:ee,r=this._parents,i=this._groups;"function"!=typeof t&&(t=function(t){return function(){return t}}(t));for(var s=i.length,o=new Array(s),a=new Array(s),l=new Array(s),c=0;c<s;++c){var u=r[c],h=i[c],f=h.length,d=ie(t.call(u,u&&u.__data__,c,r)),p=d.length,_=a[c]=new Array(p),g=o[c]=new Array(p);n(u,h,_,g,l[c]=new Array(f),d,e);for(var y,m,b=0,v=0;b<p;++b)if(y=_[b]){for(b>=v&&(v=b+1);!(m=g[v])&&++v<p;);y._next=m||null}}return(o=new We(o,r))._enter=a,o._exit=l,o},enter:function(){return new We(this._enter||this._groups.map(Qt),this._parents)},exit:function(){return new We(this._exit||this._groups.map(Qt),this._parents)},join:function(t,e,n){var r=this.enter(),i=this,s=this.exit();return"function"==typeof t?(r=t(r))&&(r=r.selection()):r=r.append(t+""),null!=e&&(i=e(i))&&(i=i.selection()),null==n?s.remove():n(s),r&&i?r.merge(i).order():i},merge:function(t){for(var e=t.selection?t.selection():t,n=this._groups,r=e._groups,i=n.length,s=r.length,o=Math.min(i,s),a=new Array(i),l=0;l<o;++l)for(var c,u=n[l],h=r[l],f=u.length,d=a[l]=new Array(f),p=0;p<f;++p)(c=u[p]||h[p])&&(d[p]=c);for(;l<i;++l)a[l]=n[l];return new We(a,this._parents)},selection:function(){return this},order:function(){for(var t=this._groups,e=-1,n=t.length;++e<n;)for(var r,i=t[e],s=i.length-1,o=i[s];--s>=0;)(r=i[s])&&(o&&4^r.compareDocumentPosition(o)&&o.parentNode.insertBefore(r,o),o=r);return this},sort:function(t){function e(e,n){return e&&n?t(e.__data__,n.__data__):!e-!n}t||(t=se);for(var n=this._groups,r=n.length,i=new Array(r),s=0;s<r;++s){for(var o,a=n[s],l=a.length,c=i[s]=new Array(l),u=0;u<l;++u)(o=a[u])&&(c[u]=o);c.sort(e)}return new We(i,this._parents).order()},call:function(){var t=arguments[0];return arguments[0]=this,t.apply(null,arguments),this},nodes:function(){return Array.from(this)},node:function(){for(var t=this._groups,e=0,n=t.length;e<n;++e)for(var r=t[e],i=0,s=r.length;i<s;++i){var o=r[i];if(o)return o}return null},size:function(){let t=0;for(const e of this)++t;return t},empty:function(){return!this.node()},each:function(t){for(var e=this._groups,n=0,r=e.length;n<r;++n)for(var i,s=e[n],o=0,a=s.length;o<a;++o)(i=s[o])&&t.call(i,i.__data__,o,s);return this},attr:function(t,e){var n=Bt(t);if(arguments.length<2){var r=this.node();return n.local?r.getAttributeNS(n.space,n.local):r.getAttribute(n)}return this.each((null==e?n.local?ae:oe:"function"==typeof e?n.local?he:ue:n.local?ce:le)(n,e))},style:function(t,e,n){return arguments.length>1?this.each((null==e?de:"function"==typeof e?_e:pe)(t,e,null==n?"":n)):ge(this.node(),t)},property:function(t,e){return arguments.length>1?this.each((null==e?ye:"function"==typeof e?be:me)(t,e)):this.node()[t]},classed:function(t,e){var n=ve(t+"");if(arguments.length<2){for(var r=xe(this.node()),i=-1,s=n.length;++i<s;)if(!r.contains(n[i]))return!1;return!0}return this.each(("function"==typeof e?Ce:e?Se:Te)(n,e))},text:function(t){return arguments.length?this.each(null==t?ke:("function"==typeof t?Me:Re)(t)):this.node().textContent},html:function(t){return arguments.length?this.each(null==t?Oe:("function"==typeof t?Ie:Ne)(t)):this.node().innerHTML},raise:function(){return this.each(Pe)},lower:function(){return this.each(Le)},append:function(t){var e="function"==typeof t?t:Gt(t);return this.select(function(){return this.appendChild(e.apply(this,arguments))})},insert:function(t,e){var n="function"==typeof t?t:Gt(t),r=null==e?De:"function"==typeof e?e:Ut(e);return this.select(function(){return this.insertBefore(n.apply(this,arguments),r.apply(this,arguments)||null)})},remove:function(){return this.each(Ve)},clone:function(t){return this.select(t?ze:Be)},datum:function(t){return arguments.length?this.property("__data__",t):this.node().__data__},on:function(t,e,n){var r,i,s=function(t){return t.trim().split(/^|\s+/).map(function(t){var e="",n=t.indexOf(".");return n>=0&&(e=t.slice(n+1),t=t.slice(0,n)),{type:t,name:e}})}(t+""),o=s.length;if(!(arguments.length<2)){for(a=e?Ge:Fe,r=0;r<o;++r)this.each(a(s[r],e,n));return this}var a=this.node().__on;if(a)for(var l,c=0,u=a.length;c<u;++c)for(r=0,l=a[c];r<o;++r)if((i=s[r]).type===l.type&&i.name===l.name)return l.value},dispatch:function(t,e){return this.each(("function"==typeof e?Ye:Ue)(t,e))},[Symbol.iterator]:function*(){for(var t=this._groups,e=0,n=t.length;e<n;++e)for(var r,i=t[e],s=0,o=i.length;s<o;++s)(r=i[s])&&(yield r)}};var Xe=0;function Ke(){return new Ze}function Ze(){this._="@"+(++Xe).toString(36)}function Je(t){let e;for(;e=t.sourceEvent;)t=e;return t}function Qe(t,e){if(t=Je(t),void 0===e&&(e=t.currentTarget),e){var n=e.ownerSVGElement||e;if(n.createSVGPoint){var r=n.createSVGPoint();return r.x=t.clientX,r.y=t.clientY,[(r=r.matrixTransform(e.getScreenCTM().inverse())).x,r.y]}if(e.getBoundingClientRect){var i=e.getBoundingClientRect();return[t.clientX-i.left-e.clientLeft,t.clientY-i.top-e.clientTop]}}return[t.pageX,t.pageY]}Ze.prototype=Ke.prototype={constructor:Ze,get:function(t){for(var e=this._;!(e in t);)if(!(t=t.parentNode))return;return t[e]},set:function(t,e){return t[this._]=e},remove:function(t){return this._ in t&&delete t[this._]},toString:function(){return this._}};const tn={passive:!1},en={capture:!0,passive:!1};function nn(t){t.stopImmediatePropagation()}function rn(t){t.preventDefault(),t.stopImmediatePropagation()}function sn(t){var e=t.document.documentElement,n=$e(t).on("dragstart.drag",rn,en);"onselectstart"in e?n.on("selectstart.drag",rn,en):(e.__noselect=e.style.MozUserSelect,e.style.MozUserSelect="none")}function on(t,e){var n=t.document.documentElement,r=$e(t).on("dragstart.drag",null);e&&(r.on("click.drag",rn,en),setTimeout(function(){r.on("click.drag",null)},0)),"onselectstart"in n?r.on("selectstart.drag",null):(n.style.MozUserSelect=n.__noselect,delete n.__noselect)}var an=t=>()=>t;function ln(t,{sourceEvent:e,subject:n,target:r,identifier:i,active:s,x:o,y:a,dx:l,dy:c,dispatch:u}){Object.defineProperties(this,{type:{value:t,enumerable:!0,configurable:!0},sourceEvent:{value:e,enumerable:!0,configurable:!0},subject:{value:n,enumerable:!0,configurable:!0},target:{value:r,enumerable:!0,configurable:!0},identifier:{value:i,enumerable:!0,configurable:!0},active:{value:s,enumerable:!0,configurable:!0},x:{value:o,enumerable:!0,configurable:!0},y:{value:a,enumerable:!0,configurable:!0},dx:{value:l,enumerable:!0,configurable:!0},dy:{value:c,enumerable:!0,configurable:!0},_:{value:u}})}function cn(t){return!t.ctrlKey&&!t.button}function un(){return this.parentNode}function hn(t,e){return null==e?{x:t.x,y:t.y}:e}function fn(){return navigator.maxTouchPoints||"ontouchstart"in this}function dn(t,e,n){t.prototype=e.prototype=n,n.constructor=t}function pn(t,e){var n=Object.create(t.prototype);for(var r in e)n[r]=e[r];return n}function _n(){}ln.prototype.on=function(){var t=this._.on.apply(this._,arguments);return t===this._?this:t};var gn=.7,yn=1/gn,mn="\\s*([+-]?\\d+)\\s*",bn="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",vn="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",xn=/^#([0-9a-f]{3,8})$/,wn=new RegExp(`^rgb\\(${mn},${mn},${mn}\\)$`),En=new RegExp(`^rgb\\(${vn},${vn},${vn}\\)$`),An=new RegExp(`^rgba\\(${mn},${mn},${mn},${bn}\\)$`),Sn=new RegExp(`^rgba\\(${vn},${vn},${vn},${bn}\\)$`),Tn=new RegExp(`^hsl\\(${bn},${vn},${vn}\\)$`),Cn=new RegExp(`^hsla\\(${bn},${vn},${vn},${bn}\\)$`),kn={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 Rn(){return this.rgb().formatHex()}function Mn(){return this.rgb().formatRgb()}function On(t){var e,n;return t=(t+"").trim().toLowerCase(),(e=xn.exec(t))?(n=e[1].length,e=parseInt(e[1],16),6===n?Nn(e):3===n?new Dn(e>>8&15|e>>4&240,e>>4&15|240&e,(15&e)<<4|15&e,1):8===n?In(e>>24&255,e>>16&255,e>>8&255,(255&e)/255):4===n?In(e>>12&15|e>>8&240,e>>8&15|e>>4&240,e>>4&15|240&e,((15&e)<<4|15&e)/255):null):(e=wn.exec(t))?new Dn(e[1],e[2],e[3],1):(e=En.exec(t))?new Dn(255*e[1]/100,255*e[2]/100,255*e[3]/100,1):(e=An.exec(t))?In(e[1],e[2],e[3],e[4]):(e=Sn.exec(t))?In(255*e[1]/100,255*e[2]/100,255*e[3]/100,e[4]):(e=Tn.exec(t))?jn(e[1],e[2]/100,e[3]/100,1):(e=Cn.exec(t))?jn(e[1],e[2]/100,e[3]/100,e[4]):kn.hasOwnProperty(t)?Nn(kn[t]):"transparent"===t?new Dn(NaN,NaN,NaN,0):null}function Nn(t){return new Dn(t>>16&255,t>>8&255,255&t,1)}function In(t,e,n,r){return r<=0&&(t=e=n=NaN),new Dn(t,e,n,r)}function Pn(t){return t instanceof _n||(t=On(t)),t?new Dn((t=t.rgb()).r,t.g,t.b,t.opacity):new Dn}function Ln(t,e,n,r){return 1===arguments.length?Pn(t):new Dn(t,e,n,null==r?1:r)}function Dn(t,e,n,r){this.r=+t,this.g=+e,this.b=+n,this.opacity=+r}function Vn(){return`#${Gn(this.r)}${Gn(this.g)}${Gn(this.b)}`}function Bn(){const t=zn(this.opacity);return`${1===t?"rgb(":"rgba("}${Fn(this.r)}, ${Fn(this.g)}, ${Fn(this.b)}${1===t?")":`, ${t})`}`}function zn(t){return isNaN(t)?1:Math.max(0,Math.min(1,t))}function Fn(t){return Math.max(0,Math.min(255,Math.round(t)||0))}function Gn(t){return((t=Fn(t))<16?"0":"")+t.toString(16)}function jn(t,e,n,r){return r<=0?t=e=n=NaN:n<=0||n>=1?t=e=NaN:e<=0&&(t=NaN),new Hn(t,e,n,r)}function Un(t){if(t instanceof Hn)return new Hn(t.h,t.s,t.l,t.opacity);if(t instanceof _n||(t=On(t)),!t)return new Hn;if(t instanceof Hn)return t;var e=(t=t.rgb()).r/255,n=t.g/255,r=t.b/255,i=Math.min(e,n,r),s=Math.max(e,n,r),o=NaN,a=s-i,l=(s+i)/2;return a?(o=e===s?(n-r)/a+6*(n<r):n===s?(r-e)/a+2:(e-n)/a+4,a/=l<.5?s+i:2-s-i,o*=60):a=l>0&&l<1?0:o,new Hn(o,a,l,t.opacity)}function Yn(t,e,n,r){return 1===arguments.length?Un(t):new Hn(t,e,n,null==r?1:r)}function Hn(t,e,n,r){this.h=+t,this.s=+e,this.l=+n,this.opacity=+r}function Wn(t){return(t=(t||0)%360)<0?t+360:t}function qn(t){return Math.max(0,Math.min(1,t||0))}function $n(t,e,n){return 255*(t<60?e+(n-e)*t/60:t<180?n:t<240?e+(n-e)*(240-t)/60:e)}dn(_n,On,{copy(t){return Object.assign(new this.constructor,this,t)},displayable(){return this.rgb().displayable()},hex:Rn,formatHex:Rn,formatHex8:function(){return this.rgb().formatHex8()},formatHsl:function(){return Un(this).formatHsl()},formatRgb:Mn,toString:Mn}),dn(Dn,Ln,pn(_n,{brighter(t){return t=null==t?yn:Math.pow(yn,t),new Dn(this.r*t,this.g*t,this.b*t,this.opacity)},darker(t){return t=null==t?gn:Math.pow(gn,t),new Dn(this.r*t,this.g*t,this.b*t,this.opacity)},rgb(){return this},clamp(){return new Dn(Fn(this.r),Fn(this.g),Fn(this.b),zn(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:Vn,formatHex:Vn,formatHex8:function(){return`#${Gn(this.r)}${Gn(this.g)}${Gn(this.b)}${Gn(255*(isNaN(this.opacity)?1:this.opacity))}`},formatRgb:Bn,toString:Bn})),dn(Hn,Yn,pn(_n,{brighter(t){return t=null==t?yn:Math.pow(yn,t),new Hn(this.h,this.s,this.l*t,this.opacity)},darker(t){return t=null==t?gn:Math.pow(gn,t),new Hn(this.h,this.s,this.l*t,this.opacity)},rgb(){var t=this.h%360+360*(this.h<0),e=isNaN(t)||isNaN(this.s)?0:this.s,n=this.l,r=n+(n<.5?n:1-n)*e,i=2*n-r;return new Dn($n(t>=240?t-240:t+120,i,r),$n(t,i,r),$n(t<120?t+240:t-120,i,r),this.opacity)},clamp(){return new Hn(Wn(this.h),qn(this.s),qn(this.l),zn(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=zn(this.opacity);return`${1===t?"hsl(":"hsla("}${Wn(this.h)}, ${100*qn(this.s)}%, ${100*qn(this.l)}%${1===t?")":`, ${t})`}`}}));const Xn=Math.PI/180,Kn=180/Math.PI,Zn=.96422,Jn=.82521,Qn=4/29,tr=6/29,er=3*tr*tr,nr=tr*tr*tr;function rr(t){if(t instanceof sr)return new sr(t.l,t.a,t.b,t.opacity);if(t instanceof fr)return dr(t);t instanceof Dn||(t=Pn(t));var e,n,r=cr(t.r),i=cr(t.g),s=cr(t.b),o=or((.2225045*r+.7168786*i+.0606169*s)/1);return r===i&&i===s?e=n=o:(e=or((.4360747*r+.3850649*i+.1430804*s)/Zn),n=or((.0139322*r+.0971045*i+.7141733*s)/Jn)),new sr(116*o-16,500*(e-o),200*(o-n),t.opacity)}function ir(t,e,n,r){return 1===arguments.length?rr(t):new sr(t,e,n,null==r?1:r)}function sr(t,e,n,r){this.l=+t,this.a=+e,this.b=+n,this.opacity=+r}function or(t){return t>nr?Math.pow(t,1/3):t/er+Qn}function ar(t){return t>tr?t*t*t:er*(t-Qn)}function lr(t){return 255*(t<=.0031308?12.92*t:1.055*Math.pow(t,1/2.4)-.055)}function cr(t){return(t/=255)<=.04045?t/12.92:Math.pow((t+.055)/1.055,2.4)}function ur(t){if(t instanceof fr)return new fr(t.h,t.c,t.l,t.opacity);if(t instanceof sr||(t=rr(t)),0===t.a&&0===t.b)return new fr(NaN,0<t.l&&t.l<100?0:NaN,t.l,t.opacity);var e=Math.atan2(t.b,t.a)*Kn;return new fr(e<0?e+360:e,Math.sqrt(t.a*t.a+t.b*t.b),t.l,t.opacity)}function hr(t,e,n,r){return 1===arguments.length?ur(t):new fr(t,e,n,null==r?1:r)}function fr(t,e,n,r){this.h=+t,this.c=+e,this.l=+n,this.opacity=+r}function dr(t){if(isNaN(t.h))return new sr(t.l,0,0,t.opacity);var e=t.h*Xn;return new sr(t.l,Math.cos(e)*t.c,Math.sin(e)*t.c,t.opacity)}dn(sr,ir,pn(_n,{brighter(t){return new sr(this.l+18*(null==t?1:t),this.a,this.b,this.opacity)},darker(t){return new sr(this.l-18*(null==t?1:t),this.a,this.b,this.opacity)},rgb(){var t=(this.l+16)/116,e=isNaN(this.a)?t:t+this.a/500,n=isNaN(this.b)?t:t-this.b/200;return new Dn(lr(3.1338561*(e=Zn*ar(e))-1.6168667*(t=1*ar(t))-.4906146*(n=Jn*ar(n))),lr(-.9787684*e+1.9161415*t+.033454*n),lr(.0719453*e-.2289914*t+1.4052427*n),this.opacity)}})),dn(fr,hr,pn(_n,{brighter(t){return new fr(this.h,this.c,this.l+18*(null==t?1:t),this.opacity)},darker(t){return new fr(this.h,this.c,this.l-18*(null==t?1:t),this.opacity)},rgb(){return dr(this).rgb()}}));var pr=-.14861,_r=1.78277,gr=-.29227,yr=-.90649,mr=1.97294,br=mr*yr,vr=mr*_r,xr=_r*gr-yr*pr;function wr(t,e,n,r){return 1===arguments.length?function(t){if(t instanceof Er)return new Er(t.h,t.s,t.l,t.opacity);t instanceof Dn||(t=Pn(t));var e=t.r/255,n=t.g/255,r=t.b/255,i=(xr*r+br*e-vr*n)/(xr+br-vr),s=r-i,o=(mr*(n-i)-gr*s)/yr,a=Math.sqrt(o*o+s*s)/(mr*i*(1-i)),l=a?Math.atan2(o,s)*Kn-120:NaN;return new Er(l<0?l+360:l,a,i,t.opacity)}(t):new Er(t,e,n,null==r?1:r)}function Er(t,e,n,r){this.h=+t,this.s=+e,this.l=+n,this.opacity=+r}function Ar(t,e,n,r,i){var s=t*t,o=s*t;return((1-3*t+3*s-o)*e+(4-6*s+3*o)*n+(1+3*t+3*s-3*o)*r+o*i)/6}function Sr(t){var e=t.length-1;return function(n){var r=n<=0?n=0:n>=1?(n=1,e-1):Math.floor(n*e),i=t[r],s=t[r+1],o=r>0?t[r-1]:2*i-s,a=r<e-1?t[r+2]:2*s-i;return Ar((n-r/e)*e,o,i,s,a)}}function Tr(t){var e=t.length;return function(n){var r=Math.floor(((n%=1)<0?++n:n)*e),i=t[(r+e-1)%e],s=t[r%e],o=t[(r+1)%e],a=t[(r+2)%e];return Ar((n-r/e)*e,i,s,o,a)}}dn(Er,wr,pn(_n,{brighter(t){return t=null==t?yn:Math.pow(yn,t),new Er(this.h,this.s,this.l*t,this.opacity)},darker(t){return t=null==t?gn:Math.pow(gn,t),new Er(this.h,this.s,this.l*t,this.opacity)},rgb(){var t=isNaN(this.h)?0:(this.h+120)*Xn,e=+this.l,n=isNaN(this.s)?0:this.s*e*(1-e),r=Math.cos(t),i=Math.sin(t);return new Dn(255*(e+n*(pr*r+_r*i)),255*(e+n*(gr*r+yr*i)),255*(e+n*(mr*r)),this.opacity)}}));var Cr=t=>()=>t;function kr(t,e){return function(n){return t+n*e}}function Rr(t,e){var n=e-t;return n?kr(t,n>180||n<-180?n-360*Math.round(n/360):n):Cr(isNaN(t)?e:t)}function Mr(t){return 1===(t=+t)?Or:function(e,n){return n-e?function(t,e,n){return t=Math.pow(t,n),e=Math.pow(e,n)-t,n=1/n,function(r){return Math.pow(t+r*e,n)}}(e,n,t):Cr(isNaN(e)?n:e)}}function Or(t,e){var n=e-t;return n?kr(t,n):Cr(isNaN(t)?e:t)}var Nr=function t(e){var n=Mr(e);function r(t,e){var r=n((t=Ln(t)).r,(e=Ln(e)).r),i=n(t.g,e.g),s=n(t.b,e.b),o=Or(t.opacity,e.opacity);return function(e){return t.r=r(e),t.g=i(e),t.b=s(e),t.opacity=o(e),t+""}}return r.gamma=t,r}(1);function Ir(t){return function(e){var n,r,i=e.length,s=new Array(i),o=new Array(i),a=new Array(i);for(n=0;n<i;++n)r=Ln(e[n]),s[n]=r.r||0,o[n]=r.g||0,a[n]=r.b||0;return s=t(s),o=t(o),a=t(a),r.opacity=1,function(t){return r.r=s(t),r.g=o(t),r.b=a(t),r+""}}}var Pr=Ir(Sr),Lr=Ir(Tr);function Dr(t,e){e||(e=[]);var n,r=t?Math.min(e.length,t.length):0,i=e.slice();return function(s){for(n=0;n<r;++n)i[n]=t[n]*(1-s)+e[n]*s;return i}}function Vr(t){return ArrayBuffer.isView(t)&&!(t instanceof DataView)}function Br(t,e){var n,r=e?e.length:0,i=t?Math.min(r,t.length):0,s=new Array(i),o=new Array(r);for(n=0;n<i;++n)s[n]=Hr(t[n],e[n]);for(;n<r;++n)o[n]=e[n];return function(t){for(n=0;n<i;++n)o[n]=s[n](t);return o}}function zr(t,e){var n=new Date;return t=+t,e=+e,function(r){return n.setTime(t*(1-r)+e*r),n}}function Fr(t,e){return t=+t,e=+e,function(n){return t*(1-n)+e*n}}function Gr(t,e){var n,r={},i={};for(n in null!==t&&"object"==typeof t||(t={}),null!==e&&"object"==typeof e||(e={}),e)n in t?r[n]=Hr(t[n],e[n]):i[n]=e[n];return function(t){for(n in r)i[n]=r[n](t);return i}}var jr=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,Ur=new RegExp(jr.source,"g");function Yr(t,e){var n,r,i,s=jr.lastIndex=Ur.lastIndex=0,o=-1,a=[],l=[];for(t+="",e+="";(n=jr.exec(t))&&(r=Ur.exec(e));)(i=r.index)>s&&(i=e.slice(s,i),a[o]?a[o]+=i:a[++o]=i),(n=n[0])===(r=r[0])?a[o]?a[o]+=r:a[++o]=r:(a[++o]=null,l.push({i:o,x:Fr(n,r)})),s=Ur.lastIndex;return s<e.length&&(i=e.slice(s),a[o]?a[o]+=i:a[++o]=i),a.length<2?l[0]?function(t){return function(e){return t(e)+""}}(l[0].x):function(t){return function(){return t}}(e):(e=l.length,function(t){for(var n,r=0;r<e;++r)a[(n=l[r]).i]=n.x(t);return a.join("")})}function Hr(t,e){var n,r=typeof e;return null==e||"boolean"===r?Cr(e):("number"===r?Fr:"string"===r?(n=On(e))?(e=n,Nr):Yr:e instanceof On?Nr:e instanceof Date?zr:Vr(e)?Dr:Array.isArray(e)?Br:"function"!=typeof e.valueOf&&"function"!=typeof e.toString||isNaN(e)?Gr:Fr)(t,e)}function Wr(t,e){return t=+t,e=+e,function(n){return Math.round(t*(1-n)+e*n)}}var qr,$r=180/Math.PI,Xr={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1};function Kr(t,e,n,r,i,s){var o,a,l;return(o=Math.sqrt(t*t+e*e))&&(t/=o,e/=o),(l=t*n+e*r)&&(n-=t*l,r-=e*l),(a=Math.sqrt(n*n+r*r))&&(n/=a,r/=a,l/=a),t*r<e*n&&(t=-t,e=-e,l=-l,o=-o),{translateX:i,translateY:s,rotate:Math.atan2(e,t)*$r,skewX:Math.atan(l)*$r,scaleX:o,scaleY:a}}function Zr(t,e,n,r){function i(t){return t.length?t.pop()+" ":""}return function(s,o){var a=[],l=[];return s=t(s),o=t(o),function(t,r,i,s,o,a){if(t!==i||r!==s){var l=o.push("translate(",null,e,null,n);a.push({i:l-4,x:Fr(t,i)},{i:l-2,x:Fr(r,s)})}else(i||s)&&o.push("translate("+i+e+s+n)}(s.translateX,s.translateY,o.translateX,o.translateY,a,l),function(t,e,n,s){t!==e?(t-e>180?e+=360:e-t>180&&(t+=360),s.push({i:n.push(i(n)+"rotate(",null,r)-2,x:Fr(t,e)})):e&&n.push(i(n)+"rotate("+e+r)}(s.rotate,o.rotate,a,l),function(t,e,n,s){t!==e?s.push({i:n.push(i(n)+"skewX(",null,r)-2,x:Fr(t,e)}):e&&n.push(i(n)+"skewX("+e+r)}(s.skewX,o.skewX,a,l),function(t,e,n,r,s,o){if(t!==n||e!==r){var a=s.push(i(s)+"scale(",null,",",null,")");o.push({i:a-4,x:Fr(t,n)},{i:a-2,x:Fr(e,r)})}else 1===n&&1===r||s.push(i(s)+"scale("+n+","+r+")")}(s.scaleX,s.scaleY,o.scaleX,o.scaleY,a,l),s=o=null,function(t){for(var e,n=-1,r=l.length;++n<r;)a[(e=l[n]).i]=e.x(t);return a.join("")}}}var Jr=Zr(function(t){const e=new("function"==typeof DOMMatrix?DOMMatrix:WebKitCSSMatrix)(t+"");return e.isIdentity?Xr:Kr(e.a,e.b,e.c,e.d,e.e,e.f)},"px, ","px)","deg)"),Qr=Zr(function(t){return null==t?Xr:(qr||(qr=document.createElementNS("http://www.w3.org/2000/svg","g")),qr.setAttribute("transform",t),(t=qr.transform.baseVal.consolidate())?Kr((t=t.matrix).a,t.b,t.c,t.d,t.e,t.f):Xr)},", ",")",")");function ti(t){return((t=Math.exp(t))+1/t)/2}var ei=function t(e,n,r){function i(t,i){var s,o,a=t[0],l=t[1],c=t[2],u=i[0],h=i[1],f=i[2],d=u-a,p=h-l,_=d*d+p*p;if(_<1e-12)o=Math.log(f/c)/e,s=function(t){return[a+t*d,l+t*p,c*Math.exp(e*t*o)]};else{var g=Math.sqrt(_),y=(f*f-c*c+r*_)/(2*c*n*g),m=(f*f-c*c-r*_)/(2*f*n*g),b=Math.log(Math.sqrt(y*y+1)-y),v=Math.log(Math.sqrt(m*m+1)-m);o=(v-b)/e,s=function(t){var r=t*o,i=ti(b),s=c/(n*g)*(i*function(t){return((t=Math.exp(2*t))-1)/(t+1)}(e*r+b)-function(t){return((t=Math.exp(t))-1/t)/2}(b));return[a+s*d,l+s*p,c*i/ti(e*r+b)]}}return s.duration=1e3*o*e/Math.SQRT2,s}return i.rho=function(e){var n=Math.max(.001,+e),r=n*n;return t(n,r,r*r)},i}(Math.SQRT2,2,4);function ni(t){return function(e,n){var r=t((e=Yn(e)).h,(n=Yn(n)).h),i=Or(e.s,n.s),s=Or(e.l,n.l),o=Or(e.opacity,n.opacity);return function(t){return e.h=r(t),e.s=i(t),e.l=s(t),e.opacity=o(t),e+""}}}var ri=ni(Rr),ii=ni(Or);function si(t){return function(e,n){var r=t((e=hr(e)).h,(n=hr(n)).h),i=Or(e.c,n.c),s=Or(e.l,n.l),o=Or(e.opacity,n.opacity);return function(t){return e.h=r(t),e.c=i(t),e.l=s(t),e.opacity=o(t),e+""}}}var oi=si(Rr),ai=si(Or);function li(t){return function e(n){function r(e,r){var i=t((e=wr(e)).h,(r=wr(r)).h),s=Or(e.s,r.s),o=Or(e.l,r.l),a=Or(e.opacity,r.opacity);return function(t){return e.h=i(t),e.s=s(t),e.l=o(Math.pow(t,n)),e.opacity=a(t),e+""}}return n=+n,r.gamma=e,r}(1)}var ci=li(Rr),ui=li(Or);function hi(t,e){void 0===e&&(e=t,t=Hr);for(var n=0,r=e.length-1,i=e[0],s=new Array(r<0?0:r);n<r;)s[n]=t(i,i=e[++n]);return function(t){var e=Math.max(0,Math.min(r-1,Math.floor(t*=r)));return s[e](t-e)}}var fi,di,pi=0,_i=0,gi=0,yi=0,mi=0,bi=0,vi="object"==typeof performance&&performance.now?performance:Date,xi="object"==typeof window&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(t){setTimeout(t,17)};function wi(){return mi||(xi(Ei),mi=vi.now()+bi)}function Ei(){mi=0}function Ai(){this._call=this._time=this._next=null}function Si(t,e,n){var r=new Ai;return r.restart(t,e,n),r}function Ti(){wi(),++pi;for(var t,e=fi;e;)(t=mi-e._time)>=0&&e._call.call(void 0,t),e=e._next;--pi}function Ci(){mi=(yi=vi.now())+bi,pi=_i=0;try{Ti()}finally{pi=0,function(){var t,e,n=fi,r=1/0;for(;n;)n._call?(r>n._time&&(r=n._time),t=n,n=n._next):(e=n._next,n._next=null,n=t?t._next=e:fi=e);di=t,Ri(r)}(),mi=0}}function ki(){var t=vi.now(),e=t-yi;e>1e3&&(bi-=e,yi=t)}function Ri(t){pi||(_i&&(_i=clearTimeout(_i)),t-mi>24?(t<1/0&&(_i=setTimeout(Ci,t-vi.now()-bi)),gi&&(gi=clearInterval(gi))):(gi||(yi=vi.now(),gi=setInterval(ki,1e3)),pi=1,xi(Ci)))}function Mi(t,e,n){var r=new Ai;return e=null==e?0:+e,r.restart(n=>{r.stop(),t(n+e)},e,n),r}Ai.prototype=Si.prototype={constructor:Ai,restart:function(t,e,n){if("function"!=typeof t)throw new TypeError("callback is not a function");n=(null==n?wi():+n)+(null==e?0:+e),this._next||di===this||(di?di._next=this:fi=this,di=this),this._call=t,this._time=n,Ri()},stop:function(){this._call&&(this._call=null,this._time=1/0,Ri())}};var Oi=Nt("start","end","cancel","interrupt"),Ni=[];function Ii(t,e,n,r,i,s){var o=t.__transition;if(o){if(n in o)return}else t.__transition={};!function(t,e,n){var r,i=t.__transition;function s(t){n.state=1,n.timer.restart(o,n.delay,n.time),n.delay<=t&&o(t-n.delay)}function o(s){var c,u,h,f;if(1!==n.state)return l();for(c in i)if((f=i[c]).name===n.name){if(3===f.state)return Mi(o);4===f.state?(f.state=6,f.timer.stop(),f.on.call("interrupt",t,t.__data__,f.index,f.group),delete i[c]):+c<e&&(f.state=6,f.timer.stop(),f.on.call("cancel",t,t.__data__,f.index,f.group),delete i[c])}if(Mi(function(){3===n.state&&(n.state=4,n.timer.restart(a,n.delay,n.time),a(s))}),n.state=2,n.on.call("start",t,t.__data__,n.index,n.group),2===n.state){for(n.state=3,r=new Array(h=n.tween.length),c=0,u=-1;c<h;++c)(f=n.tween[c].value.call(t,t.__data__,n.index,n.group))&&(r[++u]=f);r.length=u+1}}function a(e){for(var i=e<n.duration?n.ease.call(null,e/n.duration):(n.timer.restart(l),n.state=5,1),s=-1,o=r.length;++s<o;)r[s].call(t,i);5===n.state&&(n.on.call("end",t,t.__data__,n.index,n.group),l())}function l(){for(var r in n.state=6,n.timer.stop(),delete i[e],i)return;delete t.__transition}i[e]=n,n.timer=Si(s,0,n.time)}(t,n,{name:e,index:r,group:i,on:Oi,tween:Ni,time:s.time,delay:s.delay,duration:s.duration,ease:s.ease,timer:null,state:0})}function Pi(t,e){var n=Di(t,e);if(n.state>0)throw new Error("too late; already scheduled");return n}function Li(t,e){var n=Di(t,e);if(n.state>3)throw new Error("too late; already running");return n}function Di(t,e){var n=t.__transition;if(!n||!(n=n[e]))throw new Error("transition not found");return n}function Vi(t,e){var n,r,i,s=t.__transition,o=!0;if(s){for(i in e=null==e?null:e+"",s)(n=s[i]).name===e?(r=n.state>2&&n.state<5,n.state=6,n.timer.stop(),n.on.call(r?"interrupt":"cancel",t,t.__data__,n.index,n.group),delete s[i]):o=!1;o&&delete t.__transition}}function Bi(t,e){var n,r;return function(){var i=Li(this,t),s=i.tween;if(s!==n)for(var o=0,a=(r=n=s).length;o<a;++o)if(r[o].name===e){(r=r.slice()).splice(o,1);break}i.tween=r}}function zi(t,e,n){var r,i;if("function"!=typeof n)throw new Error;return function(){var s=Li(this,t),o=s.tween;if(o!==r){i=(r=o).slice();for(var a={name:e,value:n},l=0,c=i.length;l<c;++l)if(i[l].name===e){i[l]=a;break}l===c&&i.push(a)}s.tween=i}}function Fi(t,e,n){var r=t._id;return t.each(function(){var t=Li(this,r);(t.value||(t.value={}))[e]=n.apply(this,arguments)}),function(t){return Di(t,r).value[e]}}function Gi(t,e){var n;return("number"==typeof e?Fr:e instanceof On?Nr:(n=On(e))?(e=n,Nr):Yr)(t,e)}function ji(t){return function(){this.removeAttribute(t)}}function Ui(t){return function(){this.removeAttributeNS(t.space,t.local)}}function Yi(t,e,n){var r,i,s=n+"";return function(){var o=this.getAttribute(t);return o===s?null:o===r?i:i=e(r=o,n)}}function Hi(t,e,n){var r,i,s=n+"";return function(){var o=this.getAttributeNS(t.space,t.local);return o===s?null:o===r?i:i=e(r=o,n)}}function Wi(t,e,n){var r,i,s;return function(){var o,a,l=n(this);if(null!=l)return(o=this.getAttribute(t))===(a=l+"")?null:o===r&&a===i?s:(i=a,s=e(r=o,l));this.removeAttribute(t)}}function qi(t,e,n){var r,i,s;return function(){var o,a,l=n(this);if(null!=l)return(o=this.getAttributeNS(t.space,t.local))===(a=l+"")?null:o===r&&a===i?s:(i=a,s=e(r=o,l));this.removeAttributeNS(t.space,t.local)}}function $i(t,e){var n,r;function i(){var i=e.apply(this,arguments);return i!==r&&(n=(r=i)&&function(t,e){return function(n){this.setAttributeNS(t.space,t.local,e.call(this,n))}}(t,i)),n}return i._value=e,i}function Xi(t,e){var n,r;function i(){var i=e.apply(this,arguments);return i!==r&&(n=(r=i)&&function(t,e){return function(n){this.setAttribute(t,e.call(this,n))}}(t,i)),n}return i._value=e,i}function Ki(t,e){return function(){Pi(this,t).delay=+e.apply(this,arguments)}}function Zi(t,e){return e=+e,function(){Pi(this,t).delay=e}}function Ji(t,e){return function(){Li(this,t).duration=+e.apply(this,arguments)}}function Qi(t,e){return e=+e,function(){Li(this,t).duration=e}}var ts=qe.prototype.constructor;function es(t){return function(){this.style.removeProperty(t)}}var ns=0;function rs(t,e,n,r){this._groups=t,this._parents=e,this._name=n,this._id=r}function is(t){return qe().transition(t)}function ss(){return++ns}var os=qe.prototype;rs.prototype=is.prototype={constructor:rs,select:function(t){var e=this._name,n=this._id;"function"!=typeof t&&(t=Ut(t));for(var r=this._groups,i=r.length,s=new Array(i),o=0;o<i;++o)for(var a,l,c=r[o],u=c.length,h=s[o]=new Array(u),f=0;f<u;++f)(a=c[f])&&(l=t.call(a,a.__data__,f,c))&&("__data__"in a&&(l.__data__=a.__data__),h[f]=l,Ii(h[f],e,n,f,h,Di(a,n)));return new rs(s,this._parents,e,n)},selectAll:function(t){var e=this._name,n=this._id;"function"!=typeof t&&(t=Wt(t));for(var r=this._groups,i=r.length,s=[],o=[],a=0;a<i;++a)for(var l,c=r[a],u=c.length,h=0;h<u;++h)if(l=c[h]){for(var f,d=t.call(l,l.__data__,h,c),p=Di(l,n),_=0,g=d.length;_<g;++_)(f=d[_])&&Ii(f,e,n,_,d,p);s.push(d),o.push(l)}return new rs(s,o,e,n)},selectChild:os.selectChild,selectChildren:os.selectChildren,filter:function(t){"function"!=typeof t&&(t=qt(t));for(var e=this._groups,n=e.length,r=new Array(n),i=0;i<n;++i)for(var s,o=e[i],a=o.length,l=r[i]=[],c=0;c<a;++c)(s=o[c])&&t.call(s,s.__data__,c,o)&&l.push(s);return new rs(r,this._parents,this._name,this._id)},merge:function(t){if(t._id!==this._id)throw new Error;for(var e=this._groups,n=t._groups,r=e.length,i=n.length,s=Math.min(r,i),o=new Array(r),a=0;a<s;++a)for(var l,c=e[a],u=n[a],h=c.length,f=o[a]=new Array(h),d=0;d<h;++d)(l=c[d]||u[d])&&(f[d]=l);for(;a<r;++a)o[a]=e[a];return new rs(o,this._parents,this._name,this._id)},selection:function(){return new ts(this._groups,this._parents)},transition:function(){for(var t=this._name,e=this._id,n=ss(),r=this._groups,i=r.length,s=0;s<i;++s)for(var o,a=r[s],l=a.length,c=0;c<l;++c)if(o=a[c]){var u=Di(o,e);Ii(o,t,n,c,a,{time:u.time+u.delay+u.duration,delay:0,duration:u.duration,ease:u.ease})}return new rs(r,this._parents,t,n)},call:os.call,nodes:os.nodes,node:os.node,size:os.size,empty:os.empty,each:os.each,on:function(t,e){var n=this._id;return arguments.length<2?Di(this.node(),n).on.on(t):this.each(function(t,e,n){var r,i,s=function(t){return(t+"").trim().split(/^|\s+/).every(function(t){var e=t.indexOf(".");return e>=0&&(t=t.slice(0,e)),!t||"start"===t})}(e)?Pi:Li;return function(){var o=s(this,t),a=o.on;a!==r&&(i=(r=a).copy()).on(e,n),o.on=i}}(n,t,e))},attr:function(t,e){var n=Bt(t),r="transform"===n?Qr:Gi;return this.attrTween(t,"function"==typeof e?(n.local?qi:Wi)(n,r,Fi(this,"attr."+t,e)):null==e?(n.local?Ui:ji)(n):(n.local?Hi:Yi)(n,r,e))},attrTween:function(t,e){var n="attr."+t;if(arguments.length<2)return(n=this.tween(n))&&n._value;if(null==e)return this.tween(n,null);if("function"!=typeof e)throw new Error;var r=Bt(t);return this.tween(n,(r.local?$i:Xi)(r,e))},style:function(t,e,n){var r="transform"==(t+="")?Jr:Gi;return null==e?this.styleTween(t,function(t,e){var n,r,i;return function(){var s=ge(this,t),o=(this.style.removeProperty(t),ge(this,t));return s===o?null:s===n&&o===r?i:i=e(n=s,r=o)}}(t,r)).on("end.style."+t,es(t)):"function"==typeof e?this.styleTween(t,function(t,e,n){var r,i,s;return function(){var o=ge(this,t),a=n(this),l=a+"";return null==a&&(this.style.removeProperty(t),l=a=ge(this,t)),o===l?null:o===r&&l===i?s:(i=l,s=e(r=o,a))}}(t,r,Fi(this,"style."+t,e))).each(function(t,e){var n,r,i,s,o="style."+e,a="end."+o;return function(){var l=Li(this,t),c=l.on,u=null==l.value[o]?s||(s=es(e)):void 0;c===n&&i===u||(r=(n=c).copy()).on(a,i=u),l.on=r}}(this._id,t)):this.styleTween(t,function(t,e,n){var r,i,s=n+"";return function(){var o=ge(this,t);return o===s?null:o===r?i:i=e(r=o,n)}}(t,r,e),n).on("end.style."+t,null)},styleTween:function(t,e,n){var r="style."+(t+="");if(arguments.length<2)return(r=this.tween(r))&&r._value;if(null==e)return this.tween(r,null);if("function"!=typeof e)throw new Error;return this.tween(r,function(t,e,n){var r,i;function s(){var s=e.apply(this,arguments);return s!==i&&(r=(i=s)&&function(t,e,n){return function(r){this.style.setProperty(t,e.call(this,r),n)}}(t,s,n)),r}return s._value=e,s}(t,e,null==n?"":n))},text:function(t){return this.tween("text","function"==typeof t?function(t){return function(){var e=t(this);this.textContent=null==e?"":e}}(Fi(this,"text",t)):function(t){return function(){this.textContent=t}}(null==t?"":t+""))},textTween:function(t){var e="text";if(arguments.length<1)return(e=this.tween(e))&&e._value;if(null==t)return this.tween(e,null);if("function"!=typeof t)throw new Error;return this.tween(e,function(t){var e,n;function r(){var r=t.apply(this,arguments);return r!==n&&(e=(n=r)&&function(t){return function(e){this.textContent=t.call(this,e)}}(r)),e}return r._value=t,r}(t))},remove:function(){return this.on("end.remove",function(t){return function(){var e=this.parentNode;for(var n in this.__transition)if(+n!==t)return;e&&e.removeChild(this)}}(this._id))},tween:function(t,e){var n=this._id;if(t+="",arguments.length<2){for(var r,i=Di(this.node(),n).tween,s=0,o=i.length;s<o;++s)if((r=i[s]).name===t)return r.value;return null}return this.each((null==e?Bi:zi)(n,t,e))},delay:function(t){var e=this._id;return arguments.length?this.each(("function"==typeof t?Ki:Zi)(e,t)):Di(this.node(),e).delay},duration:function(t){var e=this._id;return arguments.length?this.each(("function"==typeof t?Ji:Qi)(e,t)):Di(this.node(),e).duration},ease:function(t){var e=this._id;return arguments.length?this.each(function(t,e){if("function"!=typeof e)throw new Error;return function(){Li(this,t).ease=e}}(e,t)):Di(this.node(),e).ease},easeVarying:function(t){if("function"!=typeof t)throw new Error;return this.each(function(t,e){return function(){var n=e.apply(this,arguments);if("function"!=typeof n)throw new Error;Li(this,t).ease=n}}(this._id,t))},end:function(){var t,e,n=this,r=n._id,i=n.size();return new Promise(function(s,o){var a={value:o},l={value:function(){0===--i&&s()}};n.each(function(){var n=Li(this,r),i=n.on;i!==t&&((e=(t=i).copy())._.cancel.push(a),e._.interrupt.push(a),e._.end.push(l)),n.on=e}),0===i&&s()})},[Symbol.iterator]:os[Symbol.iterator]};function as(t){return((t*=2)<=1?t*t:--t*(2-t)+1)/2}function ls(t){return((t*=2)<=1?t*t*t:(t-=2)*t*t+2)/2}var cs=function t(e){function n(t){return Math.pow(t,e)}return e=+e,n.exponent=t,n}(3),us=function t(e){function n(t){return 1-Math.pow(1-t,e)}return e=+e,n.exponent=t,n}(3),hs=function t(e){function n(t){return((t*=2)<=1?Math.pow(t,e):2-Math.pow(2-t,e))/2}return e=+e,n.exponent=t,n}(3),fs=Math.PI,ds=fs/2;function ps(t){return(1-Math.cos(fs*t))/2}function _s(t){return 1.0009775171065494*(Math.pow(2,-10*t)-.0009765625)}function gs(t){return((t*=2)<=1?_s(1-t):2-_s(t-1))/2}function ys(t){return((t*=2)<=1?1-Math.sqrt(1-t*t):Math.sqrt(1-(t-=2)*t)+1)/2}var ms=4/11,bs=6/11,vs=8/11,xs=9/11,ws=10/11,Es=21/22,As=7.5625;function Ss(t){return(t=+t)<ms?As*t*t:t<vs?As*(t-=bs)*t+.75:t<ws?As*(t-=xs)*t+.9375:As*(t-=Es)*t+.984375}var Ts=1.70158,Cs=function t(e){function n(t){return(t=+t)*t*(e*(t-1)+t)}return e=+e,n.overshoot=t,n}(Ts),ks=function t(e){function n(t){return--t*t*((t+1)*e+t)+1}return e=+e,n.overshoot=t,n}(Ts),Rs=function t(e){function n(t){return((t*=2)<1?t*t*((e+1)*t-e):(t-=2)*t*((e+1)*t+e)+2)/2}return e=+e,n.overshoot=t,n}(Ts),Ms=2*Math.PI,Os=function t(e,n){var r=Math.asin(1/(e=Math.max(1,e)))*(n/=Ms);function i(t){return e*_s(- --t)*Math.sin((r-t)/n)}return i.amplitude=function(e){return t(e,n*Ms)},i.period=function(n){return t(e,n)},i}(1,.3),Ns=function t(e,n){var r=Math.asin(1/(e=Math.max(1,e)))*(n/=Ms);function i(t){return 1-e*_s(t=+t)*Math.sin((t+r)/n)}return i.amplitude=function(e){return t(e,n*Ms)},i.period=function(n){return t(e,n)},i}(1,.3),Is=function t(e,n){var r=Math.asin(1/(e=Math.max(1,e)))*(n/=Ms);function i(t){return((t=2*t-1)<0?e*_s(-t)*Math.sin((r-t)/n):2-e*_s(t)*Math.sin((r+t)/n))/2}return i.amplitude=function(e){return t(e,n*Ms)},i.period=function(n){return t(e,n)},i}(1,.3),Ps={time:null,delay:0,duration:250,ease:ls};function Ls(t,e){for(var n;!(n=t.__transition)||!(n=n[e]);)if(!(t=t.parentNode))throw new Error(`transition ${e} not found`);return n}qe.prototype.interrupt=function(t){return this.each(function(){Vi(this,t)})},qe.prototype.transition=function(t){var e,n;t instanceof rs?(e=t._id,t=t._name):(e=ss(),(n=Ps).time=wi(),t=null==t?null:t+"");for(var r=this._groups,i=r.length,s=0;s<i;++s)for(var o,a=r[s],l=a.length,c=0;c<l;++c)(o=a[c])&&Ii(o,t,e,c,a,n||Ls(o,e));return new rs(r,this._parents,t,e)};var Ds=[null];var Vs=t=>()=>t;function Bs(t,{sourceEvent:e,target:n,selection:r,mode:i,dispatch:s}){Object.defineProperties(this,{type:{value:t,enumerable:!0,configurable:!0},sourceEvent:{value:e,enumerable:!0,configurable:!0},target:{value:n,enumerable:!0,configurable:!0},selection:{value:r,enumerable:!0,configurable:!0},mode:{value:i,enumerable:!0,configurable:!0},_:{value:s}})}function zs(t){t.preventDefault(),t.stopImmediatePropagation()}var Fs={name:"drag"},Gs={name:"space"},js={name:"handle"},Us={name:"center"};const{abs:Ys,max:Hs,min:Ws}=Math;function qs(t){return[+t[0],+t[1]]}function $s(t){return[qs(t[0]),qs(t[1])]}var Xs={name:"x",handles:["w","e"].map(ro),input:function(t,e){return null==t?null:[[+t[0],e[0][1]],[+t[1],e[1][1]]]},output:function(t){return t&&[t[0][0],t[1][0]]}},Ks={name:"y",handles:["n","s"].map(ro),input:function(t,e){return null==t?null:[[e[0][0],+t[0]],[e[1][0],+t[1]]]},output:function(t){return t&&[t[0][1],t[1][1]]}},Zs={name:"xy",handles:["n","w","e","s","nw","ne","sw","se"].map(ro),input:function(t){return null==t?null:$s(t)},output:function(t){return t}},Js={overlay:"crosshair",selection:"move",n:"ns-resize",e:"ew-resize",s:"ns-resize",w:"ew-resize",nw:"nwse-resize",ne:"nesw-resize",se:"nwse-resize",sw:"nesw-resize"},Qs={e:"w",w:"e",nw:"ne",ne:"nw",se:"sw",sw:"se"},to={n:"s",s:"n",nw:"sw",ne:"se",se:"ne",sw:"nw"},eo={overlay:1,selection:1,n:null,e:1,s:null,w:-1,nw:-1,ne:1,se:1,sw:-1},no={overlay:1,selection:1,n:-1,e:null,s:1,w:null,nw:-1,ne:-1,se:1,sw:1};function ro(t){return{type:t}}function io(t){return!t.ctrlKey&&!t.button}function so(){var t=this.ownerSVGElement||this;return t.hasAttribute("viewBox")?[[(t=t.viewBox.baseVal).x,t.y],[t.x+t.width,t.y+t.height]]:[[0,0],[t.width.baseVal.value,t.height.baseVal.value]]}function oo(){return navigator.maxTouchPoints||"ontouchstart"in this}function ao(t){for(;!t.__brush;)if(!(t=t.parentNode))return;return t.__brush}function lo(t){var e,n=so,r=io,i=oo,s=!0,o=Nt("start","brush","end"),a=6;function l(e){var n=e.property("__brush",_).selectAll(".overlay").data([ro("overlay")]);n.enter().append("rect").attr("class","overlay").attr("pointer-events","all").attr("cursor",Js.overlay).merge(n).each(function(){var t=ao(this).extent;$e(this).attr("x",t[0][0]).attr("y",t[0][1]).attr("width",t[1][0]-t[0][0]).attr("height",t[1][1]-t[0][1])}),e.selectAll(".selection").data([ro("selection")]).enter().append("rect").attr("class","selection").attr("cursor",Js.selection).attr("fill","#777").attr("fill-opacity",.3).attr("stroke","#fff").attr("shape-rendering","crispEdges");var r=e.selectAll(".handle").data(t.handles,function(t){return t.type});r.exit().remove(),r.enter().append("rect").attr("class",function(t){return"handle handle--"+t.type}).attr("cursor",function(t){return Js[t.type]}),e.each(c).attr("fill","none").attr("pointer-events","all").on("mousedown.brush",f).filter(i).on("touchstart.brush",f).on("touchmove.brush",d).on("touchend.brush touchcancel.brush",p).style("touch-action","none").style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function c(){var t=$e(this),e=ao(this).selection;e?(t.selectAll(".selection").style("display",null).attr("x",e[0][0]).attr("y",e[0][1]).attr("width",e[1][0]-e[0][0]).attr("height",e[1][1]-e[0][1]),t.selectAll(".handle").style("display",null).attr("x",function(t){return"e"===t.type[t.type.length-1]?e[1][0]-a/2:e[0][0]-a/2}).attr("y",function(t){return"s"===t.type[0]?e[1][1]-a/2:e[0][1]-a/2}).attr("width",function(t){return"n"===t.type||"s"===t.type?e[1][0]-e[0][0]+a:a}).attr("height",function(t){return"e"===t.type||"w"===t.type?e[1][1]-e[0][1]+a:a})):t.selectAll(".selection,.handle").style("display","none").attr("x",null).attr("y",null).attr("width",null).attr("height",null)}function u(t,e,n){var r=t.__brush.emitter;return!r||n&&r.clean?new h(t,e,n):r}function h(t,e,n){this.that=t,this.args=e,this.state=t.__brush,this.active=0,this.clean=n}function f(n){if((!e||n.touches)&&r.apply(this,arguments)){var i,o,a,l,h,f,d,p,_,g,y,m=this,b=n.target.__data__.type,v="selection"===(s&&n.metaKey?b="overlay":b)?Fs:s&&n.altKey?Us:js,x=t===Ks?null:eo[b],w=t===Xs?null:no[b],E=ao(m),A=E.extent,S=E.selection,T=A[0][0],C=A[0][1],k=A[1][0],R=A[1][1],M=0,O=0,N=x&&w&&s&&n.shiftKey,I=Array.from(n.touches||[n],t=>{const e=t.identifier;return(t=Qe(t,m)).point0=t.slice(),t.identifier=e,t});Vi(m);var P=u(m,arguments,!0).beforestart();if("overlay"===b){S&&(_=!0);const e=[I[0],I[1]||I[0]];E.selection=S=[[i=t===Ks?T:Ws(e[0][0],e[1][0]),a=t===Xs?C:Ws(e[0][1],e[1][1])],[h=t===Ks?k:Hs(e[0][0],e[1][0]),d=t===Xs?R:Hs(e[0][1],e[1][1])]],I.length>1&&z(n)}else i=S[0][0],a=S[0][1],h=S[1][0],d=S[1][1];o=i,l=a,f=h,p=d;var L=$e(m).attr("pointer-events","none"),D=L.selectAll(".overlay").attr("cursor",Js[b]);if(n.touches)P.moved=B,P.ended=F;else{var V=$e(n.view).on("mousemove.brush",B,!0).on("mouseup.brush",F,!0);s&&V.on("keydown.brush",function(t){switch(t.keyCode){case 16:N=x&&w;break;case 18:v===js&&(x&&(h=f-M*x,i=o+M*x),w&&(d=p-O*w,a=l+O*w),v=Us,z(t));break;case 32:v!==js&&v!==Us||(x<0?h=f-M:x>0&&(i=o-M),w<0?d=p-O:w>0&&(a=l-O),v=Gs,D.attr("cursor",Js.selection),z(t));break;default:return}zs(t)},!0).on("keyup.brush",function(t){switch(t.keyCode){case 16:N&&(g=y=N=!1,z(t));break;case 18:v===Us&&(x<0?h=f:x>0&&(i=o),w<0?d=p:w>0&&(a=l),v=js,z(t));break;case 32:v===Gs&&(t.altKey?(x&&(h=f-M*x,i=o+M*x),w&&(d=p-O*w,a=l+O*w),v=Us):(x<0?h=f:x>0&&(i=o),w<0?d=p:w>0&&(a=l),v=js),D.attr("cursor",Js[b]),z(t));break;default:return}zs(t)},!0),sn(n.view)}c.call(m),P.start(n,v.name)}function B(t){for(const e of t.changedTouches||[t])for(const t of I)t.identifier===e.identifier&&(t.cur=Qe(e,m));if(N&&!g&&!y&&1===I.length){const t=I[0];Ys(t.cur[0]-t[0])>Ys(t.cur[1]-t[1])?y=!0:g=!0}for(const t of I)t.cur&&(t[0]=t.cur[0],t[1]=t.cur[1]);_=!0,zs(t),z(t)}function z(t){const e=I[0],n=e.point0;var r;switch(M=e[0]-n[0],O=e[1]-n[1],v){case Gs:case Fs:x&&(M=Hs(T-i,Ws(k-h,M)),o=i+M,f=h+M),w&&(O=Hs(C-a,Ws(R-d,O)),l=a+O,p=d+O);break;case js:I[1]?(x&&(o=Hs(T,Ws(k,I[0][0])),f=Hs(T,Ws(k,I[1][0])),x=1),w&&(l=Hs(C,Ws(R,I[0][1])),p=Hs(C,Ws(R,I[1][1])),w=1)):(x<0?(M=Hs(T-i,Ws(k-i,M)),o=i+M,f=h):x>0&&(M=Hs(T-h,Ws(k-h,M)),o=i,f=h+M),w<0?(O=Hs(C-a,Ws(R-a,O)),l=a+O,p=d):w>0&&(O=Hs(C-d,Ws(R-d,O)),l=a,p=d+O));break;case Us:x&&(o=Hs(T,Ws(k,i-M*x)),f=Hs(T,Ws(k,h+M*x))),w&&(l=Hs(C,Ws(R,a-O*w)),p=Hs(C,Ws(R,d+O*w)))}f<o&&(x*=-1,r=i,i=h,h=r,r=o,o=f,f=r,b in Qs&&D.attr("cursor",Js[b=Qs[b]])),p<l&&(w*=-1,r=a,a=d,d=r,r=l,l=p,p=r,b in to&&D.attr("cursor",Js[b=to[b]])),E.selection&&(S=E.selection),g&&(o=S[0][0],f=S[1][0]),y&&(l=S[0][1],p=S[1][1]),S[0][0]===o&&S[0][1]===l&&S[1][0]===f&&S[1][1]===p||(E.selection=[[o,l],[f,p]],c.call(m),P.brush(t,v.name))}function F(t){if(function(t){t.stopImmediatePropagation()}(t),t.touches){if(t.touches.length)return;e&&clearTimeout(e),e=setTimeout(function(){e=null},500)}else on(t.view,_),V.on("keydown.brush keyup.brush mousemove.brush mouseup.brush",null);L.attr("pointer-events","all"),D.attr("cursor",Js.overlay),E.selection&&(S=E.selection),function(t){return t[0][0]===t[1][0]||t[0][1]===t[1][1]}(S)&&(E.selection=null,c.call(m)),P.end(t,v.name)}}function d(t){u(this,arguments).moved(t)}function p(t){u(this,arguments).ended(t)}function _(){var e=this.__brush||{selection:null};return e.extent=$s(n.apply(this,arguments)),e.dim=t,e}return l.move=function(e,n,r){e.tween?e.on("start.brush",function(t){u(this,arguments).beforestart().start(t)}).on("interrupt.brush end.brush",function(t){u(this,arguments).end(t)}).tween("brush",function(){var e=this,r=e.__brush,i=u(e,arguments),s=r.selection,o=t.input("function"==typeof n?n.apply(this,arguments):n,r.extent),a=Hr(s,o);function l(t){r.selection=1===t&&null===o?null:a(t),c.call(e),i.brush()}return null!==s&&null!==o?l:l(1)}):e.each(function(){var e=this,i=arguments,s=e.__brush,o=t.input("function"==typeof n?n.apply(e,i):n,s.extent),a=u(e,i).beforestart();Vi(e),s.selection=null===o?null:o,c.call(e),a.start(r).brush(r).end(r)})},l.clear=function(t,e){l.move(t,null,e)},h.prototype={beforestart:function(){return 1===++this.active&&(this.state.emitter=this,this.starting=!0),this},start:function(t,e){return this.starting?(this.starting=!1,this.emit("start",t,e)):this.emit("brush",t),this},brush:function(t,e){return this.emit("brush",t,e),this},end:function(t,e){return 0===--this.active&&(delete this.state.emitter,this.emit("end",t,e)),this},emit:function(e,n,r){var i=$e(this.that).datum();o.call(e,this.that,new Bs(e,{sourceEvent:n,target:l,selection:t.output(this.state.selection),mode:r,dispatch:o}),i)}},l.extent=function(t){return arguments.length?(n="function"==typeof t?t:Vs($s(t)),l):n},l.filter=function(t){return arguments.length?(r="function"==typeof t?t:Vs(!!t),l):r},l.touchable=function(t){return arguments.length?(i="function"==typeof t?t:Vs(!!t),l):i},l.handleSize=function(t){return arguments.length?(a=+t,l):a},l.keyModifiers=function(t){return arguments.length?(s=!!t,l):s},l.on=function(){var t=o.on.apply(o,arguments);return t===o?l:t},l}var co=Math.abs,uo=Math.cos,ho=Math.sin,fo=Math.PI,po=fo/2,_o=2*fo,go=Math.max,yo=1e-12;function mo(t,e){return Array.from({length:e-t},(e,n)=>t+n)}function bo(t,e){var n=0,r=null,i=null,s=null;function o(o){var a,l=o.length,c=new Array(l),u=mo(0,l),h=new Array(l*l),f=new Array(l),d=0;o=Float64Array.from({length:l*l},e?(t,e)=>o[e%l][e/l|0]:(t,e)=>o[e/l|0][e%l]);for(let e=0;e<l;++e){let n=0;for(let r=0;r<l;++r)n+=o[e*l+r]+t*o[r*l+e];d+=c[e]=n}a=(d=go(0,_o-n*l)/d)?n:_o/l;{let e=0;r&&u.sort((t,e)=>r(c[t],c[e]));for(const n of u){const r=e;if(t){const t=mo(1+~l,l).filter(t=>t<0?o[~t*l+n]:o[n*l+t]);i&&t.sort((t,e)=>i(t<0?-o[~t*l+n]:o[n*l+t],e<0?-o[~e*l+n]:o[n*l+e]));for(const r of t)if(r<0){(h[~r*l+n]||(h[~r*l+n]={source:null,target:null})).target={index:n,startAngle:e,endAngle:e+=o[~r*l+n]*d,value:o[~r*l+n]}}else{(h[n*l+r]||(h[n*l+r]={source:null,target:null})).source={index:n,startAngle:e,endAngle:e+=o[n*l+r]*d,value:o[n*l+r]}}f[n]={index:n,startAngle:r,endAngle:e,value:c[n]}}else{const t=mo(0,l).filter(t=>o[n*l+t]||o[t*l+n]);i&&t.sort((t,e)=>i(o[n*l+t],o[n*l+e]));for(const r of t){let t;if(n<r?(t=h[n*l+r]||(h[n*l+r]={source:null,target:null}),t.source={index:n,startAngle:e,endAngle:e+=o[n*l+r]*d,value:o[n*l+r]}):(t=h[r*l+n]||(h[r*l+n]={source:null,target:null}),t.target={index:n,startAngle:e,endAngle:e+=o[n*l+r]*d,value:o[n*l+r]},n===r&&(t.source=t.target)),t.source&&t.target&&t.source.value<t.target.value){const e=t.source;t.source=t.target,t.target=e}}f[n]={index:n,startAngle:r,endAngle:e,value:c[n]}}e+=a}}return(h=Object.values(h)).groups=f,s?h.sort(s):h}return o.padAngle=function(t){return arguments.length?(n=go(0,t),o):n},o.sortGroups=function(t){return arguments.length?(r=t,o):r},o.sortSubgroups=function(t){return arguments.length?(i=t,o):i},o.sortChords=function(t){return arguments.length?(null==t?s=null:(e=t,s=function(t,n){return e(t.source.value+t.target.value,n.source.value+n.target.value)})._=t,o):s&&s._;var e},o}const vo=Math.PI,xo=2*vo,wo=1e-6,Eo=xo-wo;function Ao(t){this._+=t[0];for(let e=1,n=t.length;e<n;++e)this._+=arguments[e]+t[e]}let So=class{constructor(t){this._x0=this._y0=this._x1=this._y1=null,this._="",this._append=null==t?Ao:function(t){let e=Math.floor(t);if(!(e>=0))throw new Error(`invalid digits: ${t}`);if(e>15)return Ao;const n=10**e;return function(t){this._+=t[0];for(let e=1,r=t.length;e<r;++e)this._+=Math.round(arguments[e]*n)/n+t[e]}}(t)}moveTo(t,e){this._append`M${this._x0=this._x1=+t},${this._y0=this._y1=+e}`}closePath(){null!==this._x1&&(this._x1=this._x0,this._y1=this._y0,this._append`Z`)}lineTo(t,e){this._append`L${this._x1=+t},${this._y1=+e}`}quadraticCurveTo(t,e,n,r){this._append`Q${+t},${+e},${this._x1=+n},${this._y1=+r}`}bezierCurveTo(t,e,n,r,i,s){this._append`C${+t},${+e},${+n},${+r},${this._x1=+i},${this._y1=+s}`}arcTo(t,e,n,r,i){if(t=+t,e=+e,n=+n,r=+r,(i=+i)<0)throw new Error(`negative radius: ${i}`);let s=this._x1,o=this._y1,a=n-t,l=r-e,c=s-t,u=o-e,h=c*c+u*u;if(null===this._x1)this._append`M${this._x1=t},${this._y1=e}`;else if(h>wo)if(Math.abs(u*a-l*c)>wo&&i){let f=n-s,d=r-o,p=a*a+l*l,_=f*f+d*d,g=Math.sqrt(p),y=Math.sqrt(h),m=i*Math.tan((vo-Math.acos((p+h-_)/(2*g*y)))/2),b=m/y,v=m/g;Math.abs(b-1)>wo&&this._append`L${t+b*c},${e+b*u}`,this._append`A${i},${i},0,0,${+(u*f>c*d)},${this._x1=t+v*a},${this._y1=e+v*l}`}else this._append`L${this._x1=t},${this._y1=e}`;else;}arc(t,e,n,r,i,s){if(t=+t,e=+e,s=!!s,(n=+n)<0)throw new Error(`negative radius: ${n}`);let o=n*Math.cos(r),a=n*Math.sin(r),l=t+o,c=e+a,u=1^s,h=s?r-i:i-r;null===this._x1?this._append`M${l},${c}`:(Math.abs(this._x1-l)>wo||Math.abs(this._y1-c)>wo)&&this._append`L${l},${c}`,n&&(h<0&&(h=h%xo+xo),h>Eo?this._append`A${n},${n},0,1,${u},${t-o},${e-a}A${n},${n},0,1,${u},${this._x1=l},${this._y1=c}`:h>wo&&this._append`A${n},${n},0,${+(h>=vo)},${u},${this._x1=t+n*Math.cos(i)},${this._y1=e+n*Math.sin(i)}`)}rect(t,e,n,r){this._append`M${this._x0=this._x1=+t},${this._y0=this._y1=+e}h${n=+n}v${+r}h${-n}Z`}toString(){return this._}};function To(){return new So}To.prototype=So.prototype;var Co=Array.prototype.slice;function ko(t){return function(){return t}}function Ro(t){return t.source}function Mo(t){return t.target}function Oo(t){return t.radius}function No(t){return t.startAngle}function Io(t){return t.endAngle}function Po(){return 0}function Lo(){return 10}function Do(t){var e=Ro,n=Mo,r=Oo,i=Oo,s=No,o=Io,a=Po,l=null;function c(){var c,u=e.apply(this,arguments),h=n.apply(this,arguments),f=a.apply(this,arguments)/2,d=Co.call(arguments),p=+r.apply(this,(d[0]=u,d)),_=s.apply(this,d)-po,g=o.apply(this,d)-po,y=+i.apply(this,(d[0]=h,d)),m=s.apply(this,d)-po,b=o.apply(this,d)-po;if(l||(l=c=To()),f>yo&&(co(g-_)>2*f+yo?g>_?(_+=f,g-=f):(_-=f,g+=f):_=g=(_+g)/2,co(b-m)>2*f+yo?b>m?(m+=f,b-=f):(m-=f,b+=f):m=b=(m+b)/2),l.moveTo(p*uo(_),p*ho(_)),l.arc(0,0,p,_,g),_!==m||g!==b)if(t){var v=y-+t.apply(this,arguments),x=(m+b)/2;l.quadraticCurveTo(0,0,v*uo(m),v*ho(m)),l.lineTo(y*uo(x),y*ho(x)),l.lineTo(v*uo(b),v*ho(b))}else l.quadraticCurveTo(0,0,y*uo(m),y*ho(m)),l.arc(0,0,y,m,b);if(l.quadraticCurveTo(0,0,p*uo(_),p*ho(_)),l.closePath(),c)return l=null,c+""||null}return t&&(c.headRadius=function(e){return arguments.length?(t="function"==typeof e?e:ko(+e),c):t}),c.radius=function(t){return arguments.length?(r=i="function"==typeof t?t:ko(+t),c):r},c.sourceRadius=function(t){return arguments.length?(r="function"==typeof t?t:ko(+t),c):r},c.targetRadius=function(t){return arguments.length?(i="function"==typeof t?t:ko(+t),c):i},c.startAngle=function(t){return arguments.length?(s="function"==typeof t?t:ko(+t),c):s},c.endAngle=function(t){return arguments.length?(o="function"==typeof t?t:ko(+t),c):o},c.padAngle=function(t){return arguments.length?(a="function"==typeof t?t:ko(+t),c):a},c.source=function(t){return arguments.length?(e=t,c):e},c.target=function(t){return arguments.length?(n=t,c):n},c.context=function(t){return arguments.length?(l=null==t?null:t,c):l},c}var Vo=Array.prototype.slice;function Bo(t,e){return t-e}var zo=t=>()=>t;function Fo(t,e){for(var n,r=-1,i=e.length;++r<i;)if(n=Go(t,e[r]))return n;return 0}function Go(t,e){for(var n=e[0],r=e[1],i=-1,s=0,o=t.length,a=o-1;s<o;a=s++){var l=t[s],c=l[0],u=l[1],h=t[a],f=h[0],d=h[1];if(jo(l,h,e))return 0;u>r!=d>r&&n<(f-c)*(r-u)/(d-u)+c&&(i=-i)}return i}function jo(t,e,n){var r,i,s,o;return function(t,e,n){return(e[0]-t[0])*(n[1]-t[1])===(n[0]-t[0])*(e[1]-t[1])}(t,e,n)&&(i=t[r=+(t[0]===e[0])],s=n[r],o=e[r],i<=s&&s<=o||o<=s&&s<=i)}function Uo(){}var Yo=[[],[[[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 Ho(){var t=1,e=1,n=Z,r=a;function i(t){var e=n(t);if(Array.isArray(e))e=e.slice().sort(Bo);else{const n=x(t,Wo);for(e=q(...K(n[0],n[1],e),e);e[e.length-1]>=n[1];)e.pop();for(;e[1]<n[0];)e.shift()}return e.map(e=>s(t,e))}function s(n,i){const s=null==i?NaN:+i;if(isNaN(s))throw new Error(`invalid value: ${i}`);var a=[],l=[];return function(n,r,i){var s,a,l,c,u,h,f=new Array,d=new Array;s=a=-1,c=qo(n[0],r),Yo[c<<1].forEach(p);for(;++s<t-1;)l=c,c=qo(n[s+1],r),Yo[l|c<<1].forEach(p);Yo[c|0].forEach(p);for(;++a<e-1;){for(s=-1,c=qo(n[a*t+t],r),u=qo(n[a*t],r),Yo[c<<1|u<<2].forEach(p);++s<t-1;)l=c,c=qo(n[a*t+t+s+1],r),h=u,u=qo(n[a*t+s+1],r),Yo[l|c<<1|u<<2|h<<3].forEach(p);Yo[c|u<<3].forEach(p)}s=-1,u=n[a*t]>=r,Yo[u<<2].forEach(p);for(;++s<t-1;)h=u,u=qo(n[a*t+s+1],r),Yo[u<<2|h<<3].forEach(p);function p(t){var e,n,r=[t[0][0]+s,t[0][1]+a],l=[t[1][0]+s,t[1][1]+a],c=o(r),u=o(l);(e=d[c])?(n=f[u])?(delete d[e.end],delete f[n.start],e===n?(e.ring.push(l),i(e.ring)):f[e.start]=d[n.end]={start:e.start,end:n.end,ring:e.ring.concat(n.ring)}):(delete d[e.end],e.ring.push(l),d[e.end=u]=e):(e=f[u])?(n=d[c])?(delete f[e.start],delete d[n.end],e===n?(e.ring.push(l),i(e.ring)):f[n.start]=d[e.end]={start:n.start,end:e.end,ring:n.ring.concat(e.ring)}):(delete f[e.start],e.ring.unshift(r),f[e.start=c]=e):f[c]=d[u]={start:c,end:u,ring:[r,l]}}Yo[u<<3].forEach(p)}(n,s,function(t){r(t,n,s),function(t){for(var e=0,n=t.length,r=t[n-1][1]*t[0][0]-t[n-1][0]*t[0][1];++e<n;)r+=t[e-1][1]*t[e][0]-t[e-1][0]*t[e][1];return r}(t)>0?a.push([t]):l.push(t)}),l.forEach(function(t){for(var e,n=0,r=a.length;n<r;++n)if(-1!==Fo((e=a[n])[0],t))return void e.push(t)}),{type:"MultiPolygon",value:i,coordinates:a}}function o(e){return 2*e[0]+e[1]*(t+1)*4}function a(n,r,i){n.forEach(function(n){var s=n[0],o=n[1],a=0|s,l=0|o,c=$o(r[l*t+a]);s>0&&s<t&&a===s&&(n[0]=Xo(s,$o(r[l*t+a-1]),c,i)),o>0&&o<e&&l===o&&(n[1]=Xo(o,$o(r[(l-1)*t+a]),c,i))})}return i.contour=s,i.size=function(n){if(!arguments.length)return[t,e];var r=Math.floor(n[0]),s=Math.floor(n[1]);if(!(r>=0&&s>=0))throw new Error("invalid size");return t=r,e=s,i},i.thresholds=function(t){return arguments.length?(n="function"==typeof t?t:Array.isArray(t)?zo(Vo.call(t)):zo(t),i):n},i.smooth=function(t){return arguments.length?(r=t?a:Uo,i):r===a},i}function Wo(t){return isFinite(t)?t:NaN}function qo(t,e){return null!=t&&+t>=e}function $o(t){return null==t||isNaN(t=+t)?-1/0:t}function Xo(t,e,n,r){const i=r-e,s=n-e,o=isFinite(i)||isFinite(s)?i/s:Math.sign(i)/Math.sign(s);return isNaN(o)?t:t+o-.5}function Ko(t){return t[0]}function Zo(t){return t[1]}function Jo(){return 1}const Qo=134217729;function ta(t,e,n,r,i){let s,o,a,l,c=e[0],u=r[0],h=0,f=0;u>c==u>-c?(s=c,c=e[++h]):(s=u,u=r[++f]);let d=0;if(h<t&&f<n)for(u>c==u>-c?(o=c+s,a=s-(o-c),c=e[++h]):(o=u+s,a=s-(o-u),u=r[++f]),s=o,0!==a&&(i[d++]=a);h<t&&f<n;)u>c==u>-c?(o=s+c,l=o-s,a=s-(o-l)+(c-l),c=e[++h]):(o=s+u,l=o-s,a=s-(o-l)+(u-l),u=r[++f]),s=o,0!==a&&(i[d++]=a);for(;h<t;)o=s+c,l=o-s,a=s-(o-l)+(c-l),c=e[++h],s=o,0!==a&&(i[d++]=a);for(;f<n;)o=s+u,l=o-s,a=s-(o-l)+(u-l),u=r[++f],s=o,0!==a&&(i[d++]=a);return 0===s&&0!==d||(i[d++]=s),d}function ea(t){return new Float64Array(t)}const na=ea(4),ra=ea(8),ia=ea(12),sa=ea(16),oa=ea(4);function aa(t,e,n,r,i,s){const o=(e-s)*(n-i),a=(t-i)*(r-s),l=o-a,c=Math.abs(o+a);return Math.abs(l)>=33306690738754716e-32*c?l:-function(t,e,n,r,i,s,o){let a,l,c,u,h,f,d,p,_,g,y,m,b,v,x,w,E,A;const S=t-i,T=n-i,C=e-s,k=r-s;v=S*k,f=Qo*S,d=f-(f-S),p=S-d,f=Qo*k,_=f-(f-k),g=k-_,x=p*g-(v-d*_-p*_-d*g),w=C*T,f=Qo*C,d=f-(f-C),p=C-d,f=Qo*T,_=f-(f-T),g=T-_,E=p*g-(w-d*_-p*_-d*g),y=x-E,h=x-y,na[0]=x-(y+h)+(h-E),m=v+y,h=m-v,b=v-(m-h)+(y-h),y=b-w,h=b-y,na[1]=b-(y+h)+(h-w),A=m+y,h=A-m,na[2]=m-(A-h)+(y-h),na[3]=A;let R=function(t,e){let n=e[0];for(let r=1;r<t;r++)n+=e[r];return n}(4,na),M=22204460492503146e-32*o;if(R>=M||-R>=M)return R;if(h=t-S,a=t-(S+h)+(h-i),h=n-T,c=n-(T+h)+(h-i),h=e-C,l=e-(C+h)+(h-s),h=r-k,u=r-(k+h)+(h-s),0===a&&0===l&&0===c&&0===u)return R;if(M=11093356479670487e-47*o+33306690738754706e-32*Math.abs(R),R+=S*u+k*a-(C*c+T*l),R>=M||-R>=M)return R;v=a*k,f=Qo*a,d=f-(f-a),p=a-d,f=Qo*k,_=f-(f-k),g=k-_,x=p*g-(v-d*_-p*_-d*g),w=l*T,f=Qo*l,d=f-(f-l),p=l-d,f=Qo*T,_=f-(f-T),g=T-_,E=p*g-(w-d*_-p*_-d*g),y=x-E,h=x-y,oa[0]=x-(y+h)+(h-E),m=v+y,h=m-v,b=v-(m-h)+(y-h),y=b-w,h=b-y,oa[1]=b-(y+h)+(h-w),A=m+y,h=A-m,oa[2]=m-(A-h)+(y-h),oa[3]=A;const O=ta(4,na,4,oa,ra);v=S*u,f=Qo*S,d=f-(f-S),p=S-d,f=Qo*u,_=f-(f-u),g=u-_,x=p*g-(v-d*_-p*_-d*g),w=C*c,f=Qo*C,d=f-(f-C),p=C-d,f=Qo*c,_=f-(f-c),g=c-_,E=p*g-(w-d*_-p*_-d*g),y=x-E,h=x-y,oa[0]=x-(y+h)+(h-E),m=v+y,h=m-v,b=v-(m-h)+(y-h),y=b-w,h=b-y,oa[1]=b-(y+h)+(h-w),A=m+y,h=A-m,oa[2]=m-(A-h)+(y-h),oa[3]=A;const N=ta(O,ra,4,oa,ia);v=a*u,f=Qo*a,d=f-(f-a),p=a-d,f=Qo*u,_=f-(f-u),g=u-_,x=p*g-(v-d*_-p*_-d*g),w=l*c,f=Qo*l,d=f-(f-l),p=l-d,f=Qo*c,_=f-(f-c),g=c-_,E=p*g-(w-d*_-p*_-d*g),y=x-E,h=x-y,oa[0]=x-(y+h)+(h-E),m=v+y,h=m-v,b=v-(m-h)+(y-h),y=b-w,h=b-y,oa[1]=b-(y+h)+(h-w),A=m+y,h=A-m,oa[2]=m-(A-h)+(y-h),oa[3]=A;const I=ta(N,ia,4,oa,sa);return sa[I-1]}(t,e,n,r,i,s,c)}const la=Math.pow(2,-52),ca=new Uint32Array(512);class ua{static from(t,e=ga,n=ya){const r=t.length,i=new Float64Array(2*r);for(let s=0;s<r;s++){const r=t[s];i[2*s]=e(r),i[2*s+1]=n(r)}return new ua(i)}constructor(t){const e=t.length>>1;if(e>0&&"number"!=typeof t[0])throw new Error("Expected coords to contain numbers.");this.coords=t;const n=Math.max(2*e-5,0);this._triangles=new Uint32Array(3*n),this._halfedges=new Int32Array(3*n),this._hashSize=Math.ceil(Math.sqrt(e)),this._hullPrev=new Uint32Array(e),this._hullNext=new Uint32Array(e),this._hullTri=new Uint32Array(e),this._hullHash=new Int32Array(this._hashSize),this._ids=new Uint32Array(e),this._dists=new Float64Array(e),this.update()}update(){const{coords:t,_hullPrev:e,_hullNext:n,_hullTri:r,_hullHash:i}=this,s=t.length>>1;let o=1/0,a=1/0,l=-1/0,c=-1/0;for(let e=0;e<s;e++){const n=t[2*e],r=t[2*e+1];n<o&&(o=n),r<a&&(a=r),n>l&&(l=n),r>c&&(c=r),this._ids[e]=e}const u=(o+l)/2,h=(a+c)/2;let f,d,p;for(let e=0,n=1/0;e<s;e++){const r=ha(u,h,t[2*e],t[2*e+1]);r<n&&(f=e,n=r)}const _=t[2*f],g=t[2*f+1];for(let e=0,n=1/0;e<s;e++){if(e===f)continue;const r=ha(_,g,t[2*e],t[2*e+1]);r<n&&r>0&&(d=e,n=r)}let y=t[2*d],m=t[2*d+1],b=1/0;for(let e=0;e<s;e++){if(e===f||e===d)continue;const n=da(_,g,y,m,t[2*e],t[2*e+1]);n<b&&(p=e,b=n)}let v=t[2*p],x=t[2*p+1];if(b===1/0){for(let e=0;e<s;e++)this._dists[e]=t[2*e]-t[0]||t[2*e+1]-t[1];pa(this._ids,this._dists,0,s-1);const e=new Uint32Array(s);let n=0;for(let t=0,r=-1/0;t<s;t++){const i=this._ids[t],s=this._dists[i];s>r&&(e[n++]=i,r=s)}return this.hull=e.subarray(0,n),this.triangles=new Uint32Array(0),void(this.halfedges=new Uint32Array(0))}if(aa(_,g,y,m,v,x)<0){const t=d,e=y,n=m;d=p,y=v,m=x,p=t,v=e,x=n}const w=function(t,e,n,r,i,s){const o=n-t,a=r-e,l=i-t,c=s-e,u=o*o+a*a,h=l*l+c*c,f=.5/(o*c-a*l),d=t+(c*u-a*h)*f,p=e+(o*h-l*u)*f;return{x:d,y:p}}(_,g,y,m,v,x);this._cx=w.x,this._cy=w.y;for(let e=0;e<s;e++)this._dists[e]=ha(t[2*e],t[2*e+1],w.x,w.y);pa(this._ids,this._dists,0,s-1),this._hullStart=f;let E=3;n[f]=e[p]=d,n[d]=e[f]=p,n[p]=e[d]=f,r[f]=0,r[d]=1,r[p]=2,i.fill(-1),i[this._hashKey(_,g)]=f,i[this._hashKey(y,m)]=d,i[this._hashKey(v,x)]=p,this.trianglesLen=0,this._addTriangle(f,d,p,-1,-1,-1);for(let s,o,a=0;a<this._ids.length;a++){const l=this._ids[a],c=t[2*l],u=t[2*l+1];if(a>0&&Math.abs(c-s)<=la&&Math.abs(u-o)<=la)continue;if(s=c,o=u,l===f||l===d||l===p)continue;let h=0;for(let t=0,e=this._hashKey(c,u);t<this._hashSize&&(h=i[(e+t)%this._hashSize],-1===h||h===n[h]);t++);h=e[h];let _,g=h;for(;_=n[g],aa(c,u,t[2*g],t[2*g+1],t[2*_],t[2*_+1])>=0;)if(g=_,g===h){g=-1;break}if(-1===g)continue;let y=this._addTriangle(g,l,n[g],-1,-1,r[g]);r[l]=this._legalize(y+2),r[g]=y,E++;let m=n[g];for(;_=n[m],aa(c,u,t[2*m],t[2*m+1],t[2*_],t[2*_+1])<0;)y=this._addTriangle(m,l,_,r[l],-1,r[m]),r[l]=this._legalize(y+2),n[m]=m,E--,m=_;if(g===h)for(;_=e[g],aa(c,u,t[2*_],t[2*_+1],t[2*g],t[2*g+1])<0;)y=this._addTriangle(_,l,g,-1,r[g],r[_]),this._legalize(y+2),r[_]=y,n[g]=g,E--,g=_;this._hullStart=e[l]=g,n[g]=e[m]=l,n[l]=m,i[this._hashKey(c,u)]=l,i[this._hashKey(t[2*g],t[2*g+1])]=g}this.hull=new Uint32Array(E);for(let t=0,e=this._hullStart;t<E;t++)this.hull[t]=e,e=n[e];this.triangles=this._triangles.subarray(0,this.trianglesLen),this.halfedges=this._halfedges.subarray(0,this.trianglesLen)}_hashKey(t,e){return Math.floor(function(t,e){const n=t/(Math.abs(t)+Math.abs(e));return(e>0?3-n:1+n)/4}(t-this._cx,e-this._cy)*this._hashSize)%this._hashSize}_legalize(t){const{_triangles:e,_halfedges:n,coords:r}=this;let i=0,s=0;for(;;){const o=n[t],a=t-t%3;if(s=a+(t+2)%3,-1===o){if(0===i)break;t=ca[--i];continue}const l=o-o%3,c=a+(t+1)%3,u=l+(o+2)%3,h=e[s],f=e[t],d=e[c],p=e[u];if(fa(r[2*h],r[2*h+1],r[2*f],r[2*f+1],r[2*d],r[2*d+1],r[2*p],r[2*p+1])){e[t]=p,e[o]=h;const r=n[u];if(-1===r){let e=this._hullStart;do{if(this._hullTri[e]===u){this._hullTri[e]=t;break}e=this._hullPrev[e]}while(e!==this._hullStart)}this._link(t,r),this._link(o,n[s]),this._link(s,u);const a=l+(o+1)%3;i<ca.length&&(ca[i++]=a)}else{if(0===i)break;t=ca[--i]}}return s}_link(t,e){this._halfedges[t]=e,-1!==e&&(this._halfedges[e]=t)}_addTriangle(t,e,n,r,i,s){const o=this.trianglesLen;return this._triangles[o]=t,this._triangles[o+1]=e,this._triangles[o+2]=n,this._link(o,r),this._link(o+1,i),this._link(o+2,s),this.trianglesLen+=3,o}}function ha(t,e,n,r){const i=t-n,s=e-r;return i*i+s*s}function fa(t,e,n,r,i,s,o,a){const l=t-o,c=e-a,u=n-o,h=r-a,f=i-o,d=s-a,p=u*u+h*h,_=f*f+d*d;return l*(h*_-p*d)-c*(u*_-p*f)+(l*l+c*c)*(u*d-h*f)<0}function da(t,e,n,r,i,s){const o=n-t,a=r-e,l=i-t,c=s-e,u=o*o+a*a,h=l*l+c*c,f=.5/(o*c-a*l),d=(c*u-a*h)*f,p=(o*h-l*u)*f;return d*d+p*p}function pa(t,e,n,r){if(r-n<=20)for(let i=n+1;i<=r;i++){const r=t[i],s=e[r];let o=i-1;for(;o>=n&&e[t[o]]>s;)t[o+1]=t[o--];t[o+1]=r}else{let i=n+1,s=r;_a(t,n+r>>1,i),e[t[n]]>e[t[r]]&&_a(t,n,r),e[t[i]]>e[t[r]]&&_a(t,i,r),e[t[n]]>e[t[i]]&&_a(t,n,i);const o=t[i],a=e[o];for(;;){do{i++}while(e[t[i]]<a);do{s--}while(e[t[s]]>a);if(s<i)break;_a(t,i,s)}t[n+1]=t[s],t[s]=o,r-i+1>=s-n?(pa(t,e,i,r),pa(t,e,n,s-1)):(pa(t,e,n,s-1),pa(t,e,i,r))}}function _a(t,e,n){const r=t[e];t[e]=t[n],t[n]=r}function ga(t){return t[0]}function ya(t){return t[1]}const ma=1e-6;let ba=class{constructor(){this._x0=this._y0=this._x1=this._y1=null,this._=""}moveTo(t,e){this._+=`M${this._x0=this._x1=+t},${this._y0=this._y1=+e}`}closePath(){null!==this._x1&&(this._x1=this._x0,this._y1=this._y0,this._+="Z")}lineTo(t,e){this._+=`L${this._x1=+t},${this._y1=+e}`}arc(t,e,n){const r=(t=+t)+(n=+n),i=e=+e;if(n<0)throw new Error("negative radius");null===this._x1?this._+=`M${r},${i}`:(Math.abs(this._x1-r)>ma||Math.abs(this._y1-i)>ma)&&(this._+="L"+r+","+i),n&&(this._+=`A${n},${n},0,1,1,${t-n},${e}A${n},${n},0,1,1,${this._x1=r},${this._y1=i}`)}rect(t,e,n,r){this._+=`M${this._x0=this._x1=+t},${this._y0=this._y1=+e}h${+n}v${+r}h${-n}Z`}value(){return this._||null}},va=class{constructor(){this._=[]}moveTo(t,e){this._.push([t,e])}closePath(){this._.push(this._[0].slice())}lineTo(t,e){this._.push([t,e])}value(){return this._.length?this._:null}};class xa{constructor(t,[e,n,r,i]=[0,0,960,500]){if(!((r=+r)>=(e=+e)&&(i=+i)>=(n=+n)))throw new Error("invalid bounds");this.delaunay=t,this._circumcenters=new Float64Array(2*t.points.length),this.vectors=new Float64Array(2*t.points.length),this.xmax=r,this.xmin=e,this.ymax=i,this.ymin=n,this._init()}update(){return this.delaunay.update(),this._init(),this}_init(){const{delaunay:{points:t,hull:e,triangles:n},vectors:r}=this;let i,s;const o=this.circumcenters=this._circumcenters.subarray(0,n.length/3*2);for(let r,a,l=0,c=0,u=n.length;l<u;l+=3,c+=2){const u=2*n[l],h=2*n[l+1],f=2*n[l+2],d=t[u],p=t[u+1],_=t[h],g=t[h+1],y=t[f],m=t[f+1],b=_-d,v=g-p,x=y-d,w=m-p,E=2*(b*w-v*x);if(Math.abs(E)<1e-9){if(void 0===i){i=s=0;for(const n of e)i+=t[2*n],s+=t[2*n+1];i/=e.length,s/=e.length}const n=1e9*Math.sign((i-d)*w-(s-p)*x);r=(d+y)/2-n*w,a=(p+m)/2+n*x}else{const t=1/E,e=b*b+v*v,n=x*x+w*w;r=d+(w*e-v*n)*t,a=p+(b*n-x*e)*t}o[c]=r,o[c+1]=a}let a,l,c,u=e[e.length-1],h=4*u,f=t[2*u],d=t[2*u+1];r.fill(0);for(let n=0;n<e.length;++n)u=e[n],a=h,l=f,c=d,h=4*u,f=t[2*u],d=t[2*u+1],r[a+2]=r[h]=c-d,r[a+3]=r[h+1]=f-l}render(t){const e=null==t?t=new ba:void 0,{delaunay:{halfedges:n,inedges:r,hull:i},circumcenters:s,vectors:o}=this;if(i.length<=1)return null;for(let e=0,r=n.length;e<r;++e){const r=n[e];if(r<e)continue;const i=2*Math.floor(e/3),o=2*Math.floor(r/3),a=s[i],l=s[i+1],c=s[o],u=s[o+1];this._renderSegment(a,l,c,u,t)}let a,l=i[i.length-1];for(let e=0;e<i.length;++e){a=l,l=i[e];const n=2*Math.floor(r[l]/3),c=s[n],u=s[n+1],h=4*a,f=this._project(c,u,o[h+2],o[h+3]);f&&this._renderSegment(c,u,f[0],f[1],t)}return e&&e.value()}renderBounds(t){const e=null==t?t=new ba:void 0;return t.rect(this.xmin,this.ymin,this.xmax-this.xmin,this.ymax-this.ymin),e&&e.value()}renderCell(t,e){const n=null==e?e=new ba:void 0,r=this._clip(t);if(null===r||!r.length)return;e.moveTo(r[0],r[1]);let i=r.length;for(;r[0]===r[i-2]&&r[1]===r[i-1]&&i>1;)i-=2;for(let t=2;t<i;t+=2)r[t]===r[t-2]&&r[t+1]===r[t-1]||e.lineTo(r[t],r[t+1]);return e.closePath(),n&&n.value()}*cellPolygons(){const{delaunay:{points:t}}=this;for(let e=0,n=t.length/2;e<n;++e){const t=this.cellPolygon(e);t&&(t.index=e,yield t)}}cellPolygon(t){const e=new va;return this.renderCell(t,e),e.value()}_renderSegment(t,e,n,r,i){let s;const o=this._regioncode(t,e),a=this._regioncode(n,r);0===o&&0===a?(i.moveTo(t,e),i.lineTo(n,r)):(s=this._clipSegment(t,e,n,r,o,a))&&(i.moveTo(s[0],s[1]),i.lineTo(s[2],s[3]))}contains(t,e,n){return(e=+e)==e&&(n=+n)==n&&this.delaunay._step(t,e,n)===t}*neighbors(t){const e=this._clip(t);if(e)for(const n of this.delaunay.neighbors(t)){const t=this._clip(n);if(t)t:for(let r=0,i=e.length;r<i;r+=2)for(let s=0,o=t.length;s<o;s+=2)if(e[r]===t[s]&&e[r+1]===t[s+1]&&e[(r+2)%i]===t[(s+o-2)%o]&&e[(r+3)%i]===t[(s+o-1)%o]){yield n;break t}}}_cell(t){const{circumcenters:e,delaunay:{inedges:n,halfedges:r,triangles:i}}=this,s=n[t];if(-1===s)return null;const o=[];let a=s;do{const n=Math.floor(a/3);if(o.push(e[2*n],e[2*n+1]),a=a%3==2?a-2:a+1,i[a]!==t)break;a=r[a]}while(a!==s&&-1!==a);return o}_clip(t){if(0===t&&1===this.delaunay.hull.length)return[this.xmax,this.ymin,this.xmax,this.ymax,this.xmin,this.ymax,this.xmin,this.ymin];const e=this._cell(t);if(null===e)return null;const{vectors:n}=this,r=4*t;return this._simplify(n[r]||n[r+1]?this._clipInfinite(t,e,n[r],n[r+1],n[r+2],n[r+3]):this._clipFinite(t,e))}_clipFinite(t,e){const n=e.length;let r,i,s,o,a=null,l=e[n-2],c=e[n-1],u=this._regioncode(l,c),h=0;for(let f=0;f<n;f+=2)if(r=l,i=c,l=e[f],c=e[f+1],s=u,u=this._regioncode(l,c),0===s&&0===u)o=h,h=0,a?a.push(l,c):a=[l,c];else{let e,n,f,d,p;if(0===s){if(null===(e=this._clipSegment(r,i,l,c,s,u)))continue;[n,f,d,p]=e}else{if(null===(e=this._clipSegment(l,c,r,i,u,s)))continue;[d,p,n,f]=e,o=h,h=this._edgecode(n,f),o&&h&&this._edge(t,o,h,a,a.length),a?a.push(n,f):a=[n,f]}o=h,h=this._edgecode(d,p),o&&h&&this._edge(t,o,h,a,a.length),a?a.push(d,p):a=[d,p]}if(a)o=h,h=this._edgecode(a[0],a[1]),o&&h&&this._edge(t,o,h,a,a.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 a}_clipSegment(t,e,n,r,i,s){const o=i<s;for(o&&([t,e,n,r,i,s]=[n,r,t,e,s,i]);;){if(0===i&&0===s)return o?[n,r,t,e]:[t,e,n,r];if(i&s)return null;let a,l,c=i||s;8&c?(a=t+(n-t)*(this.ymax-e)/(r-e),l=this.ymax):4&c?(a=t+(n-t)*(this.ymin-e)/(r-e),l=this.ymin):2&c?(l=e+(r-e)*(this.xmax-t)/(n-t),a=this.xmax):(l=e+(r-e)*(this.xmin-t)/(n-t),a=this.xmin),i?(t=a,e=l,i=this._regioncode(t,e)):(n=a,r=l,s=this._regioncode(n,r))}}_clipInfinite(t,e,n,r,i,s){let o,a=Array.from(e);if((o=this._project(a[0],a[1],n,r))&&a.unshift(o[0],o[1]),(o=this._project(a[a.length-2],a[a.length-1],i,s))&&a.push(o[0],o[1]),a=this._clipFinite(t,a))for(let e,n=0,r=a.length,i=this._edgecode(a[r-2],a[r-1]);n<r;n+=2)e=i,i=this._edgecode(a[n],a[n+1]),e&&i&&(n=this._edge(t,e,i,a,n),r=a.length);else this.contains(t,(this.xmin+this.xmax)/2,(this.ymin+this.ymax)/2)&&(a=[this.xmin,this.ymin,this.xmax,this.ymin,this.xmax,this.ymax,this.xmin,this.ymax]);return a}_edge(t,e,n,r,i){for(;e!==n;){let n,s;switch(e){case 5:e=4;continue;case 4:e=6,n=this.xmax,s=this.ymin;break;case 6:e=2;continue;case 2:e=10,n=this.xmax,s=this.ymax;break;case 10:e=8;continue;case 8:e=9,n=this.xmin,s=this.ymax;break;case 9:e=1;continue;case 1:e=5,n=this.xmin,s=this.ymin}r[i]===n&&r[i+1]===s||!this.contains(t,n,s)||(r.splice(i,0,n,s),i+=2)}return i}_project(t,e,n,r){let i,s,o,a=1/0;if(r<0){if(e<=this.ymin)return null;(i=(this.ymin-e)/r)<a&&(o=this.ymin,s=t+(a=i)*n)}else if(r>0){if(e>=this.ymax)return null;(i=(this.ymax-e)/r)<a&&(o=this.ymax,s=t+(a=i)*n)}if(n>0){if(t>=this.xmax)return null;(i=(this.xmax-t)/n)<a&&(s=this.xmax,o=e+(a=i)*r)}else if(n<0){if(t<=this.xmin)return null;(i=(this.xmin-t)/n)<a&&(s=this.xmin,o=e+(a=i)*r)}return[s,o]}_edgecode(t,e){return(t===this.xmin?1:t===this.xmax?2:0)|(e===this.ymin?4:e===this.ymax?8:0)}_regioncode(t,e){return(t<this.xmin?1:t>this.xmax?2:0)|(e<this.ymin?4:e>this.ymax?8:0)}_simplify(t){if(t&&t.length>4){for(let e=0;e<t.length;e+=2){const n=(e+2)%t.length,r=(e+4)%t.length;(t[e]===t[n]&&t[n]===t[r]||t[e+1]===t[n+1]&&t[n+1]===t[r+1])&&(t.splice(n,2),e-=2)}t.length||(t=null)}return t}}const wa=2*Math.PI,Ea=Math.pow;function Aa(t){return t[0]}function Sa(t){return t[1]}function Ta(t,e,n){return[t+Math.sin(t+e)*n,e+Math.cos(t-e)*n]}class Ca{static from(t,e=Aa,n=Sa,r){return new Ca("length"in t?function(t,e,n,r){const i=t.length,s=new Float64Array(2*i);for(let o=0;o<i;++o){const i=t[o];s[2*o]=e.call(r,i,o,t),s[2*o+1]=n.call(r,i,o,t)}return s}(t,e,n,r):Float64Array.from(function*(t,e,n,r){let i=0;for(const s of t)yield e.call(r,s,i,t),yield n.call(r,s,i,t),++i}(t,e,n,r)))}constructor(t){this._delaunator=new ua(t),this.inedges=new Int32Array(t.length/2),this._hullIndex=new Int32Array(t.length/2),this.points=this._delaunator.coords,this._init()}update(){return this._delaunator.update(),this._init(),this}_init(){const t=this._delaunator,e=this.points;if(t.hull&&t.hull.length>2&&function(t){const{triangles:e,coords:n}=t;for(let t=0;t<e.length;t+=3){const r=2*e[t],i=2*e[t+1],s=2*e[t+2];if((n[s]-n[r])*(n[i+1]-n[r+1])-(n[i]-n[r])*(n[s+1]-n[r+1])>1e-10)return!1}return!0}(t)){this.collinear=Int32Array.from({length:e.length/2},(t,e)=>e).sort((t,n)=>e[2*t]-e[2*n]||e[2*t+1]-e[2*n+1]);const t=this.collinear[0],n=this.collinear[this.collinear.length-1],r=[e[2*t],e[2*t+1],e[2*n],e[2*n+1]],i=1e-8*Math.hypot(r[3]-r[1],r[2]-r[0]);for(let t=0,n=e.length/2;t<n;++t){const n=Ta(e[2*t],e[2*t+1],i);e[2*t]=n[0],e[2*t+1]=n[1]}this._delaunator=new ua(e)}else delete this.collinear;const n=this.halfedges=this._delaunator.halfedges,r=this.hull=this._delaunator.hull,i=this.triangles=this._delaunator.triangles,s=this.inedges.fill(-1),o=this._hullIndex.fill(-1);for(let t=0,e=n.length;t<e;++t){const e=i[t%3==2?t-2:t+1];-1!==n[t]&&-1!==s[e]||(s[e]=t)}for(let t=0,e=r.length;t<e;++t)o[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],s[r[0]]=1,2===r.length&&(s[r[1]]=0,this.triangles[1]=r[1],this.triangles[2]=r[1]))}voronoi(t){return new xa(this,t)}*neighbors(t){const{inedges:e,hull:n,_hullIndex:r,halfedges:i,triangles:s,collinear:o}=this;if(o){const e=o.indexOf(t);return e>0&&(yield o[e-1]),void(e<o.length-1&&(yield o[e+1]))}const a=e[t];if(-1===a)return;let l=a,c=-1;do{if(yield c=s[l],l=l%3==2?l-2:l+1,s[l]!==t)return;if(l=i[l],-1===l){const e=n[(r[t]+1)%n.length];return void(e!==c&&(yield e))}}while(l!==a)}find(t,e,n=0){if((t=+t)!=t||(e=+e)!=e)return-1;const r=n;let i;for(;(i=this._step(n,t,e))>=0&&i!==n&&i!==r;)n=i;return i}_step(t,e,n){const{inedges:r,hull:i,_hullIndex:s,halfedges:o,triangles:a,points:l}=this;if(-1===r[t]||!l.length)return(t+1)%(l.length>>1);let c=t,u=Ea(e-l[2*t],2)+Ea(n-l[2*t+1],2);const h=r[t];let f=h;do{let r=a[f];const h=Ea(e-l[2*r],2)+Ea(n-l[2*r+1],2);if(h<u&&(u=h,c=r),f=f%3==2?f-2:f+1,a[f]!==t)break;if(f=o[f],-1===f){if(f=i[(s[t]+1)%i.length],f!==r&&Ea(e-l[2*f],2)+Ea(n-l[2*f+1],2)<u)return f;break}}while(f!==h);return c}render(t){const e=null==t?t=new ba:void 0,{points:n,halfedges:r,triangles:i}=this;for(let e=0,s=r.length;e<s;++e){const s=r[e];if(s<e)continue;const o=2*i[e],a=2*i[s];t.moveTo(n[o],n[o+1]),t.lineTo(n[a],n[a+1])}return this.renderHull(t),e&&e.value()}renderPoints(t,e){void 0!==e||t&&"function"==typeof t.moveTo||(e=t,t=null),e=null==e?2:+e;const n=null==t?t=new ba:void 0,{points:r}=this;for(let n=0,i=r.length;n<i;n+=2){const i=r[n],s=r[n+1];t.moveTo(i+e,s),t.arc(i,s,e,0,wa)}return n&&n.value()}renderHull(t){const e=null==t?t=new ba:void 0,{hull:n,points:r}=this,i=2*n[0],s=n.length;t.moveTo(r[i],r[i+1]);for(let e=1;e<s;++e){const i=2*n[e];t.lineTo(r[i],r[i+1])}return t.closePath(),e&&e.value()}hullPolygon(){const t=new va;return this.renderHull(t),t.value()}renderTriangle(t,e){const n=null==e?e=new ba:void 0,{points:r,triangles:i}=this,s=2*i[t*=3],o=2*i[t+1],a=2*i[t+2];return e.moveTo(r[s],r[s+1]),e.lineTo(r[o],r[o+1]),e.lineTo(r[a],r[a+1]),e.closePath(),n&&n.value()}*trianglePolygons(){const{triangles:t}=this;for(let e=0,n=t.length/3;e<n;++e)yield this.trianglePolygon(e)}trianglePolygon(t){const e=new va;return this.renderTriangle(t,e),e.value()}}var ka={},Ra={};function Ma(t){return new Function("d","return {"+t.map(function(t,e){return JSON.stringify(t)+": d["+e+'] || ""'}).join(",")+"}")}function Oa(t){var e=Object.create(null),n=[];return t.forEach(function(t){for(var r in t)r in e||n.push(e[r]=r)}),n}function Na(t,e){var n=t+"",r=n.length;return r<e?new Array(e-r+1).join(0)+n:n}function Ia(t){var e,n=t.getUTCHours(),r=t.getUTCMinutes(),i=t.getUTCSeconds(),s=t.getUTCMilliseconds();return isNaN(t)?"Invalid Date":((e=t.getUTCFullYear())<0?"-"+Na(-e,6):e>9999?"+"+Na(e,6):Na(e,4))+"-"+Na(t.getUTCMonth()+1,2)+"-"+Na(t.getUTCDate(),2)+(s?"T"+Na(n,2)+":"+Na(r,2)+":"+Na(i,2)+"."+Na(s,3)+"Z":i?"T"+Na(n,2)+":"+Na(r,2)+":"+Na(i,2)+"Z":r||n?"T"+Na(n,2)+":"+Na(r,2)+"Z":"")}function Pa(t){var e=new RegExp('["'+t+"\n\r]"),n=t.charCodeAt(0);function r(t,e){var r,i=[],s=t.length,o=0,a=0,l=s<=0,c=!1;function u(){if(l)return Ra;if(c)return c=!1,ka;var e,r,i=o;if(34===t.charCodeAt(i)){for(;o++<s&&34!==t.charCodeAt(o)||34===t.charCodeAt(++o););return(e=o)>=s?l=!0:10===(r=t.charCodeAt(o++))?c=!0:13===r&&(c=!0,10===t.charCodeAt(o)&&++o),t.slice(i+1,e-1).replace(/""/g,'"')}for(;o<s;){if(10===(r=t.charCodeAt(e=o++)))c=!0;else if(13===r)c=!0,10===t.charCodeAt(o)&&++o;else if(r!==n)continue;return t.slice(i,e)}return l=!0,t.slice(i,s)}for(10===t.charCodeAt(s-1)&&--s,13===t.charCodeAt(s-1)&&--s;(r=u())!==Ra;){for(var h=[];r!==ka&&r!==Ra;)h.push(r),r=u();e&&null==(h=e(h,a++))||i.push(h)}return i}function i(e,n){return e.map(function(e){return n.map(function(t){return o(e[t])}).join(t)})}function s(e){return e.map(o).join(t)}function o(t){return null==t?"":t instanceof Date?Ia(t):e.test(t+="")?'"'+t.replace(/"/g,'""')+'"':t}return{parse:function(t,e){var n,i,s=r(t,function(t,r){if(n)return n(t,r-1);i=t,n=e?function(t,e){var n=Ma(t);return function(r,i){return e(n(r),i,t)}}(t,e):Ma(t)});return s.columns=i||[],s},parseRows:r,format:function(e,n){return null==n&&(n=Oa(e)),[n.map(o).join(t)].concat(i(e,n)).join("\n")},formatBody:function(t,e){return null==e&&(e=Oa(t)),i(t,e).join("\n")},formatRows:function(t){return t.map(s).join("\n")},formatRow:s,formatValue:o}}var La=Pa(","),Da=La.parse,Va=La.parseRows,Ba=La.format,za=La.formatBody,Fa=La.formatRows,Ga=La.formatRow,ja=La.formatValue,Ua=Pa("\t"),Ya=Ua.parse,Ha=Ua.parseRows,Wa=Ua.format,qa=Ua.formatBody,$a=Ua.formatRows,Xa=Ua.formatRow,Ka=Ua.formatValue;function Za(t){for(var e in t){var n,r,i=t[e].trim();if(i)if("true"===i)i=!0;else if("false"===i)i=!1;else if("NaN"===i)i=NaN;else if(isNaN(n=+i)){if(!(r=i.match(/^([-+]\d{2})?\d{4}(-\d{2}(-\d{2})?)?(T\d{2}:\d{2}(:\d{2}(\.\d{3})?)?(Z|[-+]\d{2}:\d{2})?)?$/)))continue;Ja&&r[4]&&!r[7]&&(i=i.replace(/-/g,"/").replace(/T/," ")),i=new Date(i)}else i=n;else i=null;t[e]=i}return t}const Ja=new Date("2019-01-01T00:00").getHours()||new Date("2019-07-01T00:00").getHours();function Qa(t){if(!t.ok)throw new Error(t.status+" "+t.statusText);return t.blob()}function tl(t){if(!t.ok)throw new Error(t.status+" "+t.statusText);return t.arrayBuffer()}function el(t){if(!t.ok)throw new Error(t.status+" "+t.statusText);return t.text()}function nl(t,e){return fetch(t,e).then(el)}function rl(t){return function(e,n,r){return 2===arguments.length&&"function"==typeof n&&(r=n,n=void 0),nl(e,n).then(function(e){return t(e,r)})}}var il=rl(Da),sl=rl(Ya);function ol(t){if(!t.ok)throw new Error(t.status+" "+t.statusText);if(204!==t.status&&205!==t.status)return t.json()}function al(t){return(e,n)=>nl(e,n).then(e=>(new DOMParser).parseFromString(e,t))}var ll=al("application/xml"),cl=al("text/html"),ul=al("image/svg+xml");function hl(t,e){var n,r=1;function i(){var i,s,o=n.length,a=0,l=0;for(i=0;i<o;++i)a+=(s=n[i]).x,l+=s.y;for(a=(a/o-t)*r,l=(l/o-e)*r,i=0;i<o;++i)(s=n[i]).x-=a,s.y-=l}return null==t&&(t=0),null==e&&(e=0),i.initialize=function(t){n=t},i.x=function(e){return arguments.length?(t=+e,i):t},i.y=function(t){return arguments.length?(e=+t,i):e},i.strength=function(t){return arguments.length?(r=+t,i):r},i}function fl(t,e,n,r){if(isNaN(e)||isNaN(n))return t;var i,s,o,a,l,c,u,h,f,d=t._root,p={data:r},_=t._x0,g=t._y0,y=t._x1,m=t._y1;if(!d)return t._root=p,t;for(;d.length;)if((c=e>=(s=(_+y)/2))?_=s:y=s,(u=n>=(o=(g+m)/2))?g=o:m=o,i=d,!(d=d[h=u<<1|c]))return i[h]=p,t;if(a=+t._x.call(null,d.data),l=+t._y.call(null,d.data),e===a&&n===l)return p.next=d,i?i[h]=p:t._root=p,t;do{i=i?i[h]=new Array(4):t._root=new Array(4),(c=e>=(s=(_+y)/2))?_=s:y=s,(u=n>=(o=(g+m)/2))?g=o:m=o}while((h=u<<1|c)==(f=(l>=o)<<1|a>=s));return i[f]=d,i[h]=p,t}function dl(t,e,n,r,i){this.node=t,this.x0=e,this.y0=n,this.x1=r,this.y1=i}function pl(t){return t[0]}function _l(t){return t[1]}function gl(t,e,n){var r=new yl(null==e?pl:e,null==n?_l:n,NaN,NaN,NaN,NaN);return null==t?r:r.addAll(t)}function yl(t,e,n,r,i,s){this._x=t,this._y=e,this._x0=n,this._y0=r,this._x1=i,this._y1=s,this._root=void 0}function ml(t){for(var e={data:t.data},n=e;t=t.next;)n=n.next={data:t.data};return e}var bl=gl.prototype=yl.prototype;function vl(t){return function(){return t}}function xl(t){return 1e-6*(t()-.5)}function wl(t){return t.x+t.vx}function El(t){return t.y+t.vy}function Al(t){return t.index}function Sl(t,e){var n=t.get(e);if(!n)throw new Error("node not found: "+e);return n}function Tl(t){var e,n,r,i,s,o,a=Al,l=function(t){return 1/Math.min(i[t.source.index],i[t.target.index])},c=vl(30),u=1;function h(r){for(var i=0,a=t.length;i<u;++i)for(var l,c,h,f,d,p,_,g=0;g<a;++g)c=(l=t[g]).source,f=(h=l.target).x+h.vx-c.x-c.vx||xl(o),d=h.y+h.vy-c.y-c.vy||xl(o),f*=p=((p=Math.sqrt(f*f+d*d))-n[g])/p*r*e[g],d*=p,h.vx-=f*(_=s[g]),h.vy-=d*_,c.vx+=f*(_=1-_),c.vy+=d*_}function f(){if(r){var o,l,c=r.length,u=t.length,h=new Map(r.map((t,e)=>[a(t,e,r),t]));for(o=0,i=new Array(c);o<u;++o)(l=t[o]).index=o,"object"!=typeof l.source&&(l.source=Sl(h,l.source)),"object"!=typeof l.target&&(l.target=Sl(h,l.target)),i[l.source.index]=(i[l.source.index]||0)+1,i[l.target.index]=(i[l.target.index]||0)+1;for(o=0,s=new Array(u);o<u;++o)l=t[o],s[o]=i[l.source.index]/(i[l.source.index]+i[l.target.index]);e=new Array(u),d(),n=new Array(u),p()}}function d(){if(r)for(var n=0,i=t.length;n<i;++n)e[n]=+l(t[n],n,t)}function p(){if(r)for(var e=0,i=t.length;e<i;++e)n[e]=+c(t[e],e,t)}return null==t&&(t=[]),h.initialize=function(t,e){r=t,o=e,f()},h.links=function(e){return arguments.length?(t=e,f(),h):t},h.id=function(t){return arguments.length?(a=t,h):a},h.iterations=function(t){return arguments.length?(u=+t,h):u},h.strength=function(t){return arguments.length?(l="function"==typeof t?t:vl(+t),d(),h):l},h.distance=function(t){return arguments.length?(c="function"==typeof t?t:vl(+t),p(),h):c},h}bl.copy=function(){var t,e,n=new yl(this._x,this._y,this._x0,this._y0,this._x1,this._y1),r=this._root;if(!r)return n;if(!r.length)return n._root=ml(r),n;for(t=[{source:r,target:n._root=new Array(4)}];r=t.pop();)for(var i=0;i<4;++i)(e=r.source[i])&&(e.length?t.push({source:e,target:r.target[i]=new Array(4)}):r.target[i]=ml(e));return n},bl.add=function(t){const e=+this._x.call(null,t),n=+this._y.call(null,t);return fl(this.cover(e,n),e,n,t)},bl.addAll=function(t){var e,n,r,i,s=t.length,o=new Array(s),a=new Array(s),l=1/0,c=1/0,u=-1/0,h=-1/0;for(n=0;n<s;++n)isNaN(r=+this._x.call(null,e=t[n]))||isNaN(i=+this._y.call(null,e))||(o[n]=r,a[n]=i,r<l&&(l=r),r>u&&(u=r),i<c&&(c=i),i>h&&(h=i));if(l>u||c>h)return this;for(this.cover(l,c).cover(u,h),n=0;n<s;++n)fl(this,o[n],a[n],t[n]);return this},bl.cover=function(t,e){if(isNaN(t=+t)||isNaN(e=+e))return this;var n=this._x0,r=this._y0,i=this._x1,s=this._y1;if(isNaN(n))i=(n=Math.floor(t))+1,s=(r=Math.floor(e))+1;else{for(var o,a,l=i-n||1,c=this._root;n>t||t>=i||r>e||e>=s;)switch(a=(e<r)<<1|t<n,(o=new Array(4))[a]=c,c=o,l*=2,a){case 0:i=n+l,s=r+l;break;case 1:n=i-l,s=r+l;break;case 2:i=n+l,r=s-l;break;case 3:n=i-l,r=s-l}this._root&&this._root.length&&(this._root=c)}return this._x0=n,this._y0=r,this._x1=i,this._y1=s,this},bl.data=function(){var t=[];return this.visit(function(e){if(!e.length)do{t.push(e.data)}while(e=e.next)}),t},bl.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]]},bl.find=function(t,e,n){var r,i,s,o,a,l,c,u=this._x0,h=this._y0,f=this._x1,d=this._y1,p=[],_=this._root;for(_&&p.push(new dl(_,u,h,f,d)),null==n?n=1/0:(u=t-n,h=e-n,f=t+n,d=e+n,n*=n);l=p.pop();)if(!(!(_=l.node)||(i=l.x0)>f||(s=l.y0)>d||(o=l.x1)<u||(a=l.y1)<h))if(_.length){var g=(i+o)/2,y=(s+a)/2;p.push(new dl(_[3],g,y,o,a),new dl(_[2],i,y,g,a),new dl(_[1],g,s,o,y),new dl(_[0],i,s,g,y)),(c=(e>=y)<<1|t>=g)&&(l=p[p.length-1],p[p.length-1]=p[p.length-1-c],p[p.length-1-c]=l)}else{var m=t-+this._x.call(null,_.data),b=e-+this._y.call(null,_.data),v=m*m+b*b;if(v<n){var x=Math.sqrt(n=v);u=t-x,h=e-x,f=t+x,d=e+x,r=_.data}}return r},bl.remove=function(t){if(isNaN(s=+this._x.call(null,t))||isNaN(o=+this._y.call(null,t)))return this;var e,n,r,i,s,o,a,l,c,u,h,f,d=this._root,p=this._x0,_=this._y0,g=this._x1,y=this._y1;if(!d)return this;if(d.length)for(;;){if((c=s>=(a=(p+g)/2))?p=a:g=a,(u=o>=(l=(_+y)/2))?_=l:y=l,e=d,!(d=d[h=u<<1|c]))return this;if(!d.length)break;(e[h+1&3]||e[h+2&3]||e[h+3&3])&&(n=e,f=h)}for(;d.data!==t;)if(r=d,!(d=d.next))return this;return(i=d.next)&&delete d.next,r?(i?r.next=i:delete r.next,this):e?(i?e[h]=i:delete e[h],(d=e[0]||e[1]||e[2]||e[3])&&d===(e[3]||e[2]||e[1]||e[0])&&!d.length&&(n?n[f]=d:this._root=d),this):(this._root=i,this)},bl.removeAll=function(t){for(var e=0,n=t.length;e<n;++e)this.remove(t[e]);return this},bl.root=function(){return this._root},bl.size=function(){var t=0;return this.visit(function(e){if(!e.length)do{++t}while(e=e.next)}),t},bl.visit=function(t){var e,n,r,i,s,o,a=[],l=this._root;for(l&&a.push(new dl(l,this._x0,this._y0,this._x1,this._y1));e=a.pop();)if(!t(l=e.node,r=e.x0,i=e.y0,s=e.x1,o=e.y1)&&l.length){var c=(r+s)/2,u=(i+o)/2;(n=l[3])&&a.push(new dl(n,c,u,s,o)),(n=l[2])&&a.push(new dl(n,r,u,c,o)),(n=l[1])&&a.push(new dl(n,c,i,s,u)),(n=l[0])&&a.push(new dl(n,r,i,c,u))}return this},bl.visitAfter=function(t){var e,n=[],r=[];for(this._root&&n.push(new dl(this._root,this._x0,this._y0,this._x1,this._y1));e=n.pop();){var i=e.node;if(i.length){var s,o=e.x0,a=e.y0,l=e.x1,c=e.y1,u=(o+l)/2,h=(a+c)/2;(s=i[0])&&n.push(new dl(s,o,a,u,h)),(s=i[1])&&n.push(new dl(s,u,a,l,h)),(s=i[2])&&n.push(new dl(s,o,h,u,c)),(s=i[3])&&n.push(new dl(s,u,h,l,c))}r.push(e)}for(;e=r.pop();)t(e.node,e.x0,e.y0,e.x1,e.y1);return this},bl.x=function(t){return arguments.length?(this._x=t,this):this._x},bl.y=function(t){return arguments.length?(this._y=t,this):this._y};const Cl=4294967296;function kl(t){return t.x}function Rl(t){return t.y}var Ml=Math.PI*(3-Math.sqrt(5));function Ol(t){var e,n=1,r=.001,i=1-Math.pow(r,1/300),s=0,o=.6,a=new Map,l=Si(h),c=Nt("tick","end"),u=function(){let t=1;return()=>(t=(1664525*t+1013904223)%Cl)/Cl}();function h(){f(),c.call("tick",e),n<r&&(l.stop(),c.call("end",e))}function f(r){var l,c,u=t.length;void 0===r&&(r=1);for(var h=0;h<r;++h)for(n+=(s-n)*i,a.forEach(function(t){t(n)}),l=0;l<u;++l)null==(c=t[l]).fx?c.x+=c.vx*=o:(c.x=c.fx,c.vx=0),null==c.fy?c.y+=c.vy*=o:(c.y=c.fy,c.vy=0);return e}function d(){for(var e,n=0,r=t.length;n<r;++n){if((e=t[n]).index=n,null!=e.fx&&(e.x=e.fx),null!=e.fy&&(e.y=e.fy),isNaN(e.x)||isNaN(e.y)){var i=10*Math.sqrt(.5+n),s=n*Ml;e.x=i*Math.cos(s),e.y=i*Math.sin(s)}(isNaN(e.vx)||isNaN(e.vy))&&(e.vx=e.vy=0)}}function p(e){return e.initialize&&e.initialize(t,u),e}return null==t&&(t=[]),d(),e={tick:f,restart:function(){return l.restart(h),e},stop:function(){return l.stop(),e},nodes:function(n){return arguments.length?(t=n,d(),a.forEach(p),e):t},alpha:function(t){return arguments.length?(n=+t,e):n},alphaMin:function(t){return arguments.length?(r=+t,e):r},alphaDecay:function(t){return arguments.length?(i=+t,e):+i},alphaTarget:function(t){return arguments.length?(s=+t,e):s},velocityDecay:function(t){return arguments.length?(o=1-t,e):1-o},randomSource:function(t){return arguments.length?(u=t,a.forEach(p),e):u},force:function(t,n){return arguments.length>1?(null==n?a.delete(t):a.set(t,p(n)),e):a.get(t)},find:function(e,n,r){var i,s,o,a,l,c=0,u=t.length;for(null==r?r=1/0:r*=r,c=0;c<u;++c)(o=(i=e-(a=t[c]).x)*i+(s=n-a.y)*s)<r&&(l=a,r=o);return l},on:function(t,n){return arguments.length>1?(c.on(t,n),e):c.on(t)}}}function Nl(){var t,e,n,r,i,s=vl(-30),o=1,a=1/0,l=.81;function c(n){var i,s=t.length,o=gl(t,kl,Rl).visitAfter(h);for(r=n,i=0;i<s;++i)e=t[i],o.visit(f)}function u(){if(t){var e,n,r=t.length;for(i=new Array(r),e=0;e<r;++e)n=t[e],i[n.index]=+s(n,e,t)}}function h(t){var e,n,r,s,o,a=0,l=0;if(t.length){for(r=s=o=0;o<4;++o)(e=t[o])&&(n=Math.abs(e.value))&&(a+=e.value,l+=n,r+=n*e.x,s+=n*e.y);t.x=r/l,t.y=s/l}else{(e=t).x=e.data.x,e.y=e.data.y;do{a+=i[e.data.index]}while(e=e.next)}t.value=a}function f(t,s,c,u){if(!t.value)return!0;var h=t.x-e.x,f=t.y-e.y,d=u-s,p=h*h+f*f;if(d*d/l<p)return p<a&&(0===h&&(p+=(h=xl(n))*h),0===f&&(p+=(f=xl(n))*f),p<o&&(p=Math.sqrt(o*p)),e.vx+=h*t.value*r/p,e.vy+=f*t.value*r/p),!0;if(!(t.length||p>=a)){(t.data!==e||t.next)&&(0===h&&(p+=(h=xl(n))*h),0===f&&(p+=(f=xl(n))*f),p<o&&(p=Math.sqrt(o*p)));do{t.data!==e&&(d=i[t.data.index]*r/p,e.vx+=h*d,e.vy+=f*d)}while(t=t.next)}}return c.initialize=function(e,r){t=e,n=r,u()},c.strength=function(t){return arguments.length?(s="function"==typeof t?t:vl(+t),u(),c):s},c.distanceMin=function(t){return arguments.length?(o=t*t,c):Math.sqrt(o)},c.distanceMax=function(t){return arguments.length?(a=t*t,c):Math.sqrt(a)},c.theta=function(t){return arguments.length?(l=t*t,c):Math.sqrt(l)},c}function Il(t){var e,n,r,i=vl(.1);function s(t){for(var i,s=0,o=e.length;s<o;++s)(i=e[s]).vx+=(r[s]-i.x)*n[s]*t}function o(){if(e){var s,o=e.length;for(n=new Array(o),r=new Array(o),s=0;s<o;++s)n[s]=isNaN(r[s]=+t(e[s],s,e))?0:+i(e[s],s,e)}}return"function"!=typeof t&&(t=vl(null==t?0:+t)),s.initialize=function(t){e=t,o()},s.strength=function(t){return arguments.length?(i="function"==typeof t?t:vl(+t),o(),s):i},s.x=function(e){return arguments.length?(t="function"==typeof e?e:vl(+e),o(),s):t},s}function Pl(t){var e,n,r,i=vl(.1);function s(t){for(var i,s=0,o=e.length;s<o;++s)(i=e[s]).vy+=(r[s]-i.y)*n[s]*t}function o(){if(e){var s,o=e.length;for(n=new Array(o),r=new Array(o),s=0;s<o;++s)n[s]=isNaN(r[s]=+t(e[s],s,e))?0:+i(e[s],s,e)}}return"function"!=typeof t&&(t=vl(null==t?0:+t)),s.initialize=function(t){e=t,o()},s.strength=function(t){return arguments.length?(i="function"==typeof t?t:vl(+t),o(),s):i},s.y=function(e){return arguments.length?(t="function"==typeof e?e:vl(+e),o(),s):t},s}function Ll(t,e){if((n=(t=e?t.toExponential(e-1):t.toExponential()).indexOf("e"))<0)return null;var n,r=t.slice(0,n);return[r.length>1?r[0]+r.slice(2):r,+t.slice(n+1)]}function Dl(t){return(t=Ll(Math.abs(t)))?t[1]:NaN}var Vl,Bl=/^(?:(.)?([<>=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i;function zl(t){if(!(e=Bl.exec(t)))throw new Error("invalid format: "+t);var e;return new Fl({fill:e[1],align:e[2],sign:e[3],symbol:e[4],zero:e[5],width:e[6],comma:e[7],precision:e[8]&&e[8].slice(1),trim:e[9],type:e[10]})}function Fl(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 Gl(t,e){var n=Ll(t,e);if(!n)return t+"";var r=n[0],i=n[1];return i<0?"0."+new Array(-i).join("0")+r:r.length>i+1?r.slice(0,i+1)+"."+r.slice(i+1):r+new Array(i-r.length+2).join("0")}zl.prototype=Fl.prototype,Fl.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 jl={"%":(t,e)=>(100*t).toFixed(e),b:t=>Math.round(t).toString(2),c:t=>t+"",d:function(t){return Math.abs(t=Math.round(t))>=1e21?t.toLocaleString("en").replace(/,/g,""):t.toString(10)},e:(t,e)=>t.toExponential(e),f:(t,e)=>t.toFixed(e),g:(t,e)=>t.toPrecision(e),o:t=>Math.round(t).toString(8),p:(t,e)=>Gl(100*t,e),r:Gl,s:function(t,e){var n=Ll(t,e);if(!n)return t+"";var r=n[0],i=n[1],s=i-(Vl=3*Math.max(-8,Math.min(8,Math.floor(i/3))))+1,o=r.length;return s===o?r:s>o?r+new Array(s-o+1).join("0"):s>0?r.slice(0,s)+"."+r.slice(s):"0."+new Array(1-s).join("0")+Ll(t,Math.max(0,e+s-1))[0]},X:t=>Math.round(t).toString(16).toUpperCase(),x:t=>Math.round(t).toString(16)};function Ul(t){return t}var Yl,Hl,Wl,ql=Array.prototype.map,$l=["y","z","a","f","p","n","µ","m","","k","M","G","T","P","E","Z","Y"];function Xl(t){var e,n,r=void 0===t.grouping||void 0===t.thousands?Ul:(e=ql.call(t.grouping,Number),n=t.thousands+"",function(t,r){for(var i=t.length,s=[],o=0,a=e[0],l=0;i>0&&a>0&&(l+a+1>r&&(a=Math.max(1,r-l)),s.push(t.substring(i-=a,i+a)),!((l+=a+1)>r));)a=e[o=(o+1)%e.length];return s.reverse().join(n)}),i=void 0===t.currency?"":t.currency[0]+"",s=void 0===t.currency?"":t.currency[1]+"",o=void 0===t.decimal?".":t.decimal+"",a=void 0===t.numerals?Ul:function(t){return function(e){return e.replace(/[0-9]/g,function(e){return t[+e]})}}(ql.call(t.numerals,String)),l=void 0===t.percent?"%":t.percent+"",c=void 0===t.minus?"−":t.minus+"",u=void 0===t.nan?"NaN":t.nan+"";function h(t){var e=(t=zl(t)).fill,n=t.align,h=t.sign,f=t.symbol,d=t.zero,p=t.width,_=t.comma,g=t.precision,y=t.trim,m=t.type;"n"===m?(_=!0,m="g"):jl[m]||(void 0===g&&(g=12),y=!0,m="g"),(d||"0"===e&&"="===n)&&(d=!0,e="0",n="=");var b="$"===f?i:"#"===f&&/[boxX]/.test(m)?"0"+m.toLowerCase():"",v="$"===f?s:/[%p]/.test(m)?l:"",x=jl[m],w=/[defgprs%]/.test(m);function E(t){var i,s,l,f=b,E=v;if("c"===m)E=x(t)+E,t="";else{var A=(t=+t)<0||1/t<0;if(t=isNaN(t)?u:x(Math.abs(t),g),y&&(t=function(t){t:for(var e,n=t.length,r=1,i=-1;r<n;++r)switch(t[r]){case".":i=e=r;break;case"0":0===i&&(i=r),e=r;break;default:if(!+t[r])break t;i>0&&(i=0)}return i>0?t.slice(0,i)+t.slice(e+1):t}(t)),A&&0===+t&&"+"!==h&&(A=!1),f=(A?"("===h?h:c:"-"===h||"("===h?"":h)+f,E=("s"===m?$l[8+Vl/3]:"")+E+(A&&"("===h?")":""),w)for(i=-1,s=t.length;++i<s;)if(48>(l=t.charCodeAt(i))||l>57){E=(46===l?o+t.slice(i+1):t.slice(i))+E,t=t.slice(0,i);break}}_&&!d&&(t=r(t,1/0));var S=f.length+t.length+E.length,T=S<p?new Array(p-S+1).join(e):"";switch(_&&d&&(t=r(T+t,T.length?p-E.length:1/0),T=""),n){case"<":t=f+t+E+T;break;case"=":t=f+T+t+E;break;case"^":t=T.slice(0,S=T.length>>1)+f+t+E+T.slice(S);break;default:t=T+f+t+E}return a(t)}return g=void 0===g?6:/[gprs]/.test(m)?Math.max(1,Math.min(21,g)):Math.max(0,Math.min(20,g)),E.toString=function(){return t+""},E}return{format:h,formatPrefix:function(t,e){var n=h(((t=zl(t)).type="f",t)),r=3*Math.max(-8,Math.min(8,Math.floor(Dl(e)/3))),i=Math.pow(10,-r),s=$l[8+r/3];return function(t){return n(i*t)+s}}}}function Kl(t){return Yl=Xl(t),Hl=Yl.format,Wl=Yl.formatPrefix,Yl}function Zl(t){return Math.max(0,-Dl(Math.abs(t)))}function Jl(t,e){return Math.max(0,3*Math.max(-8,Math.min(8,Math.floor(Dl(e)/3)))-Dl(Math.abs(t)))}function Ql(t,e){return t=Math.abs(t),e=Math.abs(e)-t,Math.max(0,Dl(e)-Dl(t))+1}Kl({thousands:",",grouping:[3],currency:["$",""]});var tc=1e-6,ec=1e-12,nc=Math.PI,rc=nc/2,ic=nc/4,sc=2*nc,oc=180/nc,ac=nc/180,lc=Math.abs,cc=Math.atan,uc=Math.atan2,hc=Math.cos,fc=Math.ceil,dc=Math.exp,pc=Math.hypot,_c=Math.log,gc=Math.pow,yc=Math.sin,mc=Math.sign||function(t){return t>0?1:t<0?-1:0},bc=Math.sqrt,vc=Math.tan;function xc(t){return t>1?0:t<-1?nc:Math.acos(t)}function wc(t){return t>1?rc:t<-1?-rc:Math.asin(t)}function Ec(t){return(t=yc(t/2))*t}function Ac(){}function Sc(t,e){t&&Cc.hasOwnProperty(t.type)&&Cc[t.type](t,e)}var Tc={Feature:function(t,e){Sc(t.geometry,e)},FeatureCollection:function(t,e){for(var n=t.features,r=-1,i=n.length;++r<i;)Sc(n[r].geometry,e)}},Cc={Sphere:function(t,e){e.sphere()},Point:function(t,e){t=t.coordinates,e.point(t[0],t[1],t[2])},MultiPoint:function(t,e){for(var n=t.coordinates,r=-1,i=n.length;++r<i;)t=n[r],e.point(t[0],t[1],t[2])},LineString:function(t,e){kc(t.coordinates,e,0)},MultiLineString:function(t,e){for(var n=t.coordinates,r=-1,i=n.length;++r<i;)kc(n[r],e,0)},Polygon:function(t,e){Rc(t.coordinates,e)},MultiPolygon:function(t,e){for(var n=t.coordinates,r=-1,i=n.length;++r<i;)Rc(n[r],e)},GeometryCollection:function(t,e){for(var n=t.geometries,r=-1,i=n.length;++r<i;)Sc(n[r],e)}};function kc(t,e,n){var r,i=-1,s=t.length-n;for(e.lineStart();++i<s;)r=t[i],e.point(r[0],r[1],r[2]);e.lineEnd()}function Rc(t,e){var n=-1,r=t.length;for(e.polygonStart();++n<r;)kc(t[n],e,1);e.polygonEnd()}function Mc(t,e){t&&Tc.hasOwnProperty(t.type)?Tc[t.type](t,e):Sc(t,e)}var Oc,Nc,Ic,Pc,Lc,Dc,Vc,Bc,zc,Fc,Gc,jc,Uc,Yc,Hc,Wc,qc=new w,$c=new w,Xc={point:Ac,lineStart:Ac,lineEnd:Ac,polygonStart:function(){qc=new w,Xc.lineStart=Kc,Xc.lineEnd=Zc},polygonEnd:function(){var t=+qc;$c.add(t<0?sc+t:t),this.lineStart=this.lineEnd=this.point=Ac},sphere:function(){$c.add(sc)}};function Kc(){Xc.point=Jc}function Zc(){Qc(Oc,Nc)}function Jc(t,e){Xc.point=Qc,Oc=t,Nc=e,Ic=t*=ac,Pc=hc(e=(e*=ac)/2+ic),Lc=yc(e)}function Qc(t,e){var n=(t*=ac)-Ic,r=n>=0?1:-1,i=r*n,s=hc(e=(e*=ac)/2+ic),o=yc(e),a=Lc*o,l=Pc*s+a*hc(i),c=a*r*yc(i);qc.add(uc(c,l)),Ic=t,Pc=s,Lc=o}function tu(t){return[uc(t[1],t[0]),wc(t[2])]}function eu(t){var e=t[0],n=t[1],r=hc(n);return[r*hc(e),r*yc(e),yc(n)]}function nu(t,e){return t[0]*e[0]+t[1]*e[1]+t[2]*e[2]}function ru(t,e){return[t[1]*e[2]-t[2]*e[1],t[2]*e[0]-t[0]*e[2],t[0]*e[1]-t[1]*e[0]]}function iu(t,e){t[0]+=e[0],t[1]+=e[1],t[2]+=e[2]}function su(t,e){return[t[0]*e,t[1]*e,t[2]*e]}function ou(t){var e=bc(t[0]*t[0]+t[1]*t[1]+t[2]*t[2]);t[0]/=e,t[1]/=e,t[2]/=e}var au,lu,cu,uu,hu,fu,du,pu,_u,gu,yu,mu,bu,vu,xu,wu,Eu={point:Au,lineStart:Tu,lineEnd:Cu,polygonStart:function(){Eu.point=ku,Eu.lineStart=Ru,Eu.lineEnd=Mu,Yc=new w,Xc.polygonStart()},polygonEnd:function(){Xc.polygonEnd(),Eu.point=Au,Eu.lineStart=Tu,Eu.lineEnd=Cu,qc<0?(Dc=-(Bc=180),Vc=-(zc=90)):Yc>tc?zc=90:Yc<-1e-6&&(Vc=-90),Wc[0]=Dc,Wc[1]=Bc},sphere:function(){Dc=-(Bc=180),Vc=-(zc=90)}};function Au(t,e){Hc.push(Wc=[Dc=t,Bc=t]),e<Vc&&(Vc=e),e>zc&&(zc=e)}function Su(t,e){var n=eu([t*ac,e*ac]);if(Uc){var r=ru(Uc,n),i=ru([r[1],-r[0],0],r);ou(i),i=tu(i);var s,o=t-Fc,a=o>0?1:-1,l=i[0]*oc*a,c=lc(o)>180;c^(a*Fc<l&&l<a*t)?(s=i[1]*oc)>zc&&(zc=s):c^(a*Fc<(l=(l+360)%360-180)&&l<a*t)?(s=-i[1]*oc)<Vc&&(Vc=s):(e<Vc&&(Vc=e),e>zc&&(zc=e)),c?t<Fc?Ou(Dc,t)>Ou(Dc,Bc)&&(Bc=t):Ou(t,Bc)>Ou(Dc,Bc)&&(Dc=t):Bc>=Dc?(t<Dc&&(Dc=t),t>Bc&&(Bc=t)):t>Fc?Ou(Dc,t)>Ou(Dc,Bc)&&(Bc=t):Ou(t,Bc)>Ou(Dc,Bc)&&(Dc=t)}else Hc.push(Wc=[Dc=t,Bc=t]);e<Vc&&(Vc=e),e>zc&&(zc=e),Uc=n,Fc=t}function Tu(){Eu.point=Su}function Cu(){Wc[0]=Dc,Wc[1]=Bc,Eu.point=Au,Uc=null}function ku(t,e){if(Uc){var n=t-Fc;Yc.add(lc(n)>180?n+(n>0?360:-360):n)}else Gc=t,jc=e;Xc.point(t,e),Su(t,e)}function Ru(){Xc.lineStart()}function Mu(){ku(Gc,jc),Xc.lineEnd(),lc(Yc)>tc&&(Dc=-(Bc=180)),Wc[0]=Dc,Wc[1]=Bc,Uc=null}function Ou(t,e){return(e-=t)<0?e+360:e}function Nu(t,e){return t[0]-e[0]}function Iu(t,e){return t[0]<=t[1]?t[0]<=e&&e<=t[1]:e<t[0]||t[1]<e}var Pu={sphere:Ac,point:Lu,lineStart:Vu,lineEnd:Fu,polygonStart:function(){Pu.lineStart=Gu,Pu.lineEnd=ju},polygonEnd:function(){Pu.lineStart=Vu,Pu.lineEnd=Fu}};function Lu(t,e){t*=ac;var n=hc(e*=ac);Du(n*hc(t),n*yc(t),yc(e))}function Du(t,e,n){++au,cu+=(t-cu)/au,uu+=(e-uu)/au,hu+=(n-hu)/au}function Vu(){Pu.point=Bu}function Bu(t,e){t*=ac;var n=hc(e*=ac);vu=n*hc(t),xu=n*yc(t),wu=yc(e),Pu.point=zu,Du(vu,xu,wu)}function zu(t,e){t*=ac;var n=hc(e*=ac),r=n*hc(t),i=n*yc(t),s=yc(e),o=uc(bc((o=xu*s-wu*i)*o+(o=wu*r-vu*s)*o+(o=vu*i-xu*r)*o),vu*r+xu*i+wu*s);lu+=o,fu+=o*(vu+(vu=r)),du+=o*(xu+(xu=i)),pu+=o*(wu+(wu=s)),Du(vu,xu,wu)}function Fu(){Pu.point=Lu}function Gu(){Pu.point=Uu}function ju(){Yu(mu,bu),Pu.point=Lu}function Uu(t,e){mu=t,bu=e,t*=ac,e*=ac,Pu.point=Yu;var n=hc(e);vu=n*hc(t),xu=n*yc(t),wu=yc(e),Du(vu,xu,wu)}function Yu(t,e){t*=ac;var n=hc(e*=ac),r=n*hc(t),i=n*yc(t),s=yc(e),o=xu*s-wu*i,a=wu*r-vu*s,l=vu*i-xu*r,c=pc(o,a,l),u=wc(c),h=c&&-u/c;_u.add(h*o),gu.add(h*a),yu.add(h*l),lu+=u,fu+=u*(vu+(vu=r)),du+=u*(xu+(xu=i)),pu+=u*(wu+(wu=s)),Du(vu,xu,wu)}function Hu(t){return function(){return t}}function Wu(t,e){function n(n,r){return n=t(n,r),e(n[0],n[1])}return t.invert&&e.invert&&(n.invert=function(n,r){return(n=e.invert(n,r))&&t.invert(n[0],n[1])}),n}function qu(t,e){return lc(t)>nc&&(t-=Math.round(t/sc)*sc),[t,e]}function $u(t,e,n){return(t%=sc)?e||n?Wu(Ku(t),Zu(e,n)):Ku(t):e||n?Zu(e,n):qu}function Xu(t){return function(e,n){return lc(e+=t)>nc&&(e-=Math.round(e/sc)*sc),[e,n]}}function Ku(t){var e=Xu(t);return e.invert=Xu(-t),e}function Zu(t,e){var n=hc(t),r=yc(t),i=hc(e),s=yc(e);function o(t,e){var o=hc(e),a=hc(t)*o,l=yc(t)*o,c=yc(e),u=c*n+a*r;return[uc(l*i-u*s,a*n-c*r),wc(u*i+l*s)]}return o.invert=function(t,e){var o=hc(e),a=hc(t)*o,l=yc(t)*o,c=yc(e),u=c*i-l*s;return[uc(l*i+c*s,a*n+u*r),wc(u*n-a*r)]},o}function Ju(t){function e(e){return(e=t(e[0]*ac,e[1]*ac))[0]*=oc,e[1]*=oc,e}return t=$u(t[0]*ac,t[1]*ac,t.length>2?t[2]*ac:0),e.invert=function(e){return(e=t.invert(e[0]*ac,e[1]*ac))[0]*=oc,e[1]*=oc,e},e}function Qu(t,e,n,r,i,s){if(n){var o=hc(e),a=yc(e),l=r*n;null==i?(i=e+r*sc,s=e-l/2):(i=th(o,i),s=th(o,s),(r>0?i<s:i>s)&&(i+=r*sc));for(var c,u=i;r>0?u>s:u<s;u-=l)c=tu([o,-a*hc(u),-a*yc(u)]),t.point(c[0],c[1])}}function th(t,e){(e=eu(e))[0]-=t,ou(e);var n=xc(-e[1]);return((-e[2]<0?-n:n)+sc-tc)%sc}function eh(){var t,e=[];return{point:function(e,n,r){t.push([e,n,r])},lineStart:function(){e.push(t=[])},lineEnd:Ac,rejoin:function(){e.length>1&&e.push(e.pop().concat(e.shift()))},result:function(){var n=e;return e=[],t=null,n}}}function nh(t,e){return lc(t[0]-e[0])<tc&&lc(t[1]-e[1])<tc}function rh(t,e,n,r){this.x=t,this.z=e,this.o=n,this.e=r,this.v=!1,this.n=this.p=null}function ih(t,e,n,r,i){var s,o,a=[],l=[];if(t.forEach(function(t){if(!((e=t.length-1)<=0)){var e,n,r=t[0],o=t[e];if(nh(r,o)){if(!r[2]&&!o[2]){for(i.lineStart(),s=0;s<e;++s)i.point((r=t[s])[0],r[1]);return void i.lineEnd()}o[0]+=2e-6}a.push(n=new rh(r,t,null,!0)),l.push(n.o=new rh(r,null,n,!1)),a.push(n=new rh(o,t,null,!1)),l.push(n.o=new rh(o,null,n,!0))}}),a.length){for(l.sort(e),sh(a),sh(l),s=0,o=l.length;s<o;++s)l[s].e=n=!n;for(var c,u,h=a[0];;){for(var f=h,d=!0;f.v;)if((f=f.n)===h)return;c=f.z,i.lineStart();do{if(f.v=f.o.v=!0,f.e){if(d)for(s=0,o=c.length;s<o;++s)i.point((u=c[s])[0],u[1]);else r(f.x,f.n.x,1,i);f=f.n}else{if(d)for(c=f.p.z,s=c.length-1;s>=0;--s)i.point((u=c[s])[0],u[1]);else r(f.x,f.p.x,-1,i);f=f.p}c=(f=f.o).z,d=!d}while(!f.v);i.lineEnd()}}}function sh(t){if(e=t.length){for(var e,n,r=0,i=t[0];++r<e;)i.n=n=t[r],n.p=i,i=n;i.n=n=t[0],n.p=i}}function oh(t){return lc(t[0])<=nc?t[0]:mc(t[0])*((lc(t[0])+nc)%sc-nc)}function ah(t,e){var n=oh(e),r=e[1],i=yc(r),s=[yc(n),-hc(n),0],o=0,a=0,l=new w;1===i?r=rc+tc:-1===i&&(r=-rc-tc);for(var c=0,u=t.length;c<u;++c)if(f=(h=t[c]).length)for(var h,f,d=h[f-1],p=oh(d),_=d[1]/2+ic,g=yc(_),y=hc(_),m=0;m<f;++m,p=v,g=E,y=A,d=b){var b=h[m],v=oh(b),x=b[1]/2+ic,E=yc(x),A=hc(x),S=v-p,T=S>=0?1:-1,C=T*S,k=C>nc,R=g*E;if(l.add(uc(R*T*yc(C),y*A+R*hc(C))),o+=k?S+T*sc:S,k^p>=n^v>=n){var M=ru(eu(d),eu(b));ou(M);var O=ru(s,M);ou(O);var N=(k^S>=0?-1:1)*wc(O[2]);(r>N||r===N&&(M[0]||M[1]))&&(a+=k^S>=0?1:-1)}}return(o<-1e-6||o<tc&&l<-1e-12)^1&a}function lh(t,e,n,r){return function(i){var s,o,a,l=e(i),c=eh(),u=e(c),h=!1,f={point:d,lineStart:_,lineEnd:g,polygonStart:function(){f.point=y,f.lineStart=m,f.lineEnd=b,o=[],s=[]},polygonEnd:function(){f.point=d,f.lineStart=_,f.lineEnd=g,o=ht(o);var t=ah(s,r);o.length?(h||(i.polygonStart(),h=!0),ih(o,uh,t,n,i)):t&&(h||(i.polygonStart(),h=!0),i.lineStart(),n(null,null,1,i),i.lineEnd()),h&&(i.polygonEnd(),h=!1),o=s=null},sphere:function(){i.polygonStart(),i.lineStart(),n(null,null,1,i),i.lineEnd(),i.polygonEnd()}};function d(e,n){t(e,n)&&i.point(e,n)}function p(t,e){l.point(t,e)}function _(){f.point=p,l.lineStart()}function g(){f.point=d,l.lineEnd()}function y(t,e){a.push([t,e]),u.point(t,e)}function m(){u.lineStart(),a=[]}function b(){y(a[0][0],a[0][1]),u.lineEnd();var t,e,n,r,l=u.clean(),f=c.result(),d=f.length;if(a.pop(),s.push(a),a=null,d)if(1&l){if((e=(n=f[0]).length-1)>0){for(h||(i.polygonStart(),h=!0),i.lineStart(),t=0;t<e;++t)i.point((r=n[t])[0],r[1]);i.lineEnd()}}else d>1&&2&l&&f.push(f.pop().concat(f.shift())),o.push(f.filter(ch))}return f}}function ch(t){return t.length>1}function uh(t,e){return((t=t.x)[0]<0?t[1]-rc-tc:rc-t[1])-((e=e.x)[0]<0?e[1]-rc-tc:rc-e[1])}qu.invert=qu;var hh=lh(function(){return!0},function(t){var e,n=NaN,r=NaN,i=NaN;return{lineStart:function(){t.lineStart(),e=1},point:function(s,o){var a=s>0?nc:-nc,l=lc(s-n);lc(l-nc)<tc?(t.point(n,r=(r+o)/2>0?rc:-rc),t.point(i,r),t.lineEnd(),t.lineStart(),t.point(a,r),t.point(s,r),e=0):i!==a&&l>=nc&&(lc(n-i)<tc&&(n-=i*tc),lc(s-a)<tc&&(s-=a*tc),r=function(t,e,n,r){var i,s,o=yc(t-n);return lc(o)>tc?cc((yc(e)*(s=hc(r))*yc(n)-yc(r)*(i=hc(e))*yc(t))/(i*s*o)):(e+r)/2}(n,r,s,o),t.point(i,r),t.lineEnd(),t.lineStart(),t.point(a,r),e=0),t.point(n=s,r=o),i=a},lineEnd:function(){t.lineEnd(),n=r=NaN},clean:function(){return 2-e}}},function(t,e,n,r){var i;if(null==t)i=n*rc,r.point(-nc,i),r.point(0,i),r.point(nc,i),r.point(nc,0),r.point(nc,-i),r.point(0,-i),r.point(-nc,-i),r.point(-nc,0),r.point(-nc,i);else if(lc(t[0]-e[0])>tc){var s=t[0]<e[0]?nc:-nc;i=n*s/2,r.point(-s,i),r.point(0,i),r.point(s,i)}else r.point(e[0],e[1])},[-nc,-rc]);function fh(t){var e=hc(t),n=2*ac,r=e>0,i=lc(e)>tc;function s(t,n){return hc(t)*hc(n)>e}function o(t,n,r){var i=[1,0,0],s=ru(eu(t),eu(n)),o=nu(s,s),a=s[0],l=o-a*a;if(!l)return!r&&t;var c=e*o/l,u=-e*a/l,h=ru(i,s),f=su(i,c);iu(f,su(s,u));var d=h,p=nu(f,d),_=nu(d,d),g=p*p-_*(nu(f,f)-1);if(!(g<0)){var y=bc(g),m=su(d,(-p-y)/_);if(iu(m,f),m=tu(m),!r)return m;var b,v=t[0],x=n[0],w=t[1],E=n[1];x<v&&(b=v,v=x,x=b);var A=x-v,S=lc(A-nc)<tc;if(!S&&E<w&&(b=w,w=E,E=b),S||A<tc?S?w+E>0^m[1]<(lc(m[0]-v)<tc?w:E):w<=m[1]&&m[1]<=E:A>nc^(v<=m[0]&&m[0]<=x)){var T=su(d,(-p+y)/_);return iu(T,f),[m,tu(T)]}}}function a(e,n){var i=r?t:nc-t,s=0;return e<-i?s|=1:e>i&&(s|=2),n<-i?s|=4:n>i&&(s|=8),s}return lh(s,function(t){var e,n,l,c,u;return{lineStart:function(){c=l=!1,u=1},point:function(h,f){var d,p=[h,f],_=s(h,f),g=r?_?0:a(h,f):_?a(h+(h<0?nc:-nc),f):0;if(!e&&(c=l=_)&&t.lineStart(),_!==l&&(!(d=o(e,p))||nh(e,d)||nh(p,d))&&(p[2]=1),_!==l)u=0,_?(t.lineStart(),d=o(p,e),t.point(d[0],d[1])):(d=o(e,p),t.point(d[0],d[1],2),t.lineEnd()),e=d;else if(i&&e&&r^_){var y;g&n||!(y=o(p,e,!0))||(u=0,r?(t.lineStart(),t.point(y[0][0],y[0][1]),t.point(y[1][0],y[1][1]),t.lineEnd()):(t.point(y[1][0],y[1][1]),t.lineEnd(),t.lineStart(),t.point(y[0][0],y[0][1],3)))}!_||e&&nh(e,p)||t.point(p[0],p[1]),e=p,l=_,n=g},lineEnd:function(){l&&t.lineEnd(),e=null},clean:function(){return u|(c&&l)<<1}}},function(e,r,i,s){Qu(s,t,n,i,e,r)},r?[0,-t]:[-nc,t-nc])}var dh,ph,_h,gh,yh=1e9,mh=-yh;function bh(t,e,n,r){function i(i,s){return t<=i&&i<=n&&e<=s&&s<=r}function s(i,s,a,c){var u=0,h=0;if(null==i||(u=o(i,a))!==(h=o(s,a))||l(i,s)<0^a>0)do{c.point(0===u||3===u?t:n,u>1?r:e)}while((u=(u+a+4)%4)!==h);else c.point(s[0],s[1])}function o(r,i){return lc(r[0]-t)<tc?i>0?0:3:lc(r[0]-n)<tc?i>0?2:1:lc(r[1]-e)<tc?i>0?1:0:i>0?3:2}function a(t,e){return l(t.x,e.x)}function l(t,e){var n=o(t,1),r=o(e,1);return n!==r?n-r:0===n?e[1]-t[1]:1===n?t[0]-e[0]:2===n?t[1]-e[1]:e[0]-t[0]}return function(o){var l,c,u,h,f,d,p,_,g,y,m,b=o,v=eh(),x={point:w,lineStart:function(){x.point=E,c&&c.push(u=[]);y=!0,g=!1,p=_=NaN},lineEnd:function(){l&&(E(h,f),d&&g&&v.rejoin(),l.push(v.result()));x.point=w,g&&b.lineEnd()},polygonStart:function(){b=v,l=[],c=[],m=!0},polygonEnd:function(){var e=function(){for(var e=0,n=0,i=c.length;n<i;++n)for(var s,o,a=c[n],l=1,u=a.length,h=a[0],f=h[0],d=h[1];l<u;++l)s=f,o=d,f=(h=a[l])[0],d=h[1],o<=r?d>r&&(f-s)*(r-o)>(d-o)*(t-s)&&++e:d<=r&&(f-s)*(r-o)<(d-o)*(t-s)&&--e;return e}(),n=m&&e,i=(l=ht(l)).length;(n||i)&&(o.polygonStart(),n&&(o.lineStart(),s(null,null,1,o),o.lineEnd()),i&&ih(l,a,e,s,o),o.polygonEnd());b=o,l=c=u=null}};function w(t,e){i(t,e)&&b.point(t,e)}function E(s,o){var a=i(s,o);if(c&&u.push([s,o]),y)h=s,f=o,d=a,y=!1,a&&(b.lineStart(),b.point(s,o));else if(a&&g)b.point(s,o);else{var l=[p=Math.max(mh,Math.min(yh,p)),_=Math.max(mh,Math.min(yh,_))],v=[s=Math.max(mh,Math.min(yh,s)),o=Math.max(mh,Math.min(yh,o))];!function(t,e,n,r,i,s){var o,a=t[0],l=t[1],c=0,u=1,h=e[0]-a,f=e[1]-l;if(o=n-a,h||!(o>0)){if(o/=h,h<0){if(o<c)return;o<u&&(u=o)}else if(h>0){if(o>u)return;o>c&&(c=o)}if(o=i-a,h||!(o<0)){if(o/=h,h<0){if(o>u)return;o>c&&(c=o)}else if(h>0){if(o<c)return;o<u&&(u=o)}if(o=r-l,f||!(o>0)){if(o/=f,f<0){if(o<c)return;o<u&&(u=o)}else if(f>0){if(o>u)return;o>c&&(c=o)}if(o=s-l,f||!(o<0)){if(o/=f,f<0){if(o>u)return;o>c&&(c=o)}else if(f>0){if(o<c)return;o<u&&(u=o)}return c>0&&(t[0]=a+c*h,t[1]=l+c*f),u<1&&(e[0]=a+u*h,e[1]=l+u*f),!0}}}}}(l,v,t,e,n,r)?a&&(b.lineStart(),b.point(s,o),m=!1):(g||(b.lineStart(),b.point(l[0],l[1])),b.point(v[0],v[1]),a||b.lineEnd(),m=!1)}p=s,_=o,g=a}return x}}var vh={sphere:Ac,point:Ac,lineStart:function(){vh.point=wh,vh.lineEnd=xh},lineEnd:Ac,polygonStart:Ac,polygonEnd:Ac};function xh(){vh.point=vh.lineEnd=Ac}function wh(t,e){ph=t*=ac,_h=yc(e*=ac),gh=hc(e),vh.point=Eh}function Eh(t,e){t*=ac;var n=yc(e*=ac),r=hc(e),i=lc(t-ph),s=hc(i),o=r*yc(i),a=gh*n-_h*r*s,l=_h*n+gh*r*s;dh.add(uc(bc(o*o+a*a),l)),ph=t,_h=n,gh=r}function Ah(t){return dh=new w,Mc(t,vh),+dh}var Sh=[null,null],Th={type:"LineString",coordinates:Sh};function Ch(t,e){return Sh[0]=t,Sh[1]=e,Ah(Th)}var kh={Feature:function(t,e){return Mh(t.geometry,e)},FeatureCollection:function(t,e){for(var n=t.features,r=-1,i=n.length;++r<i;)if(Mh(n[r].geometry,e))return!0;return!1}},Rh={Sphere:function(){return!0},Point:function(t,e){return Oh(t.coordinates,e)},MultiPoint:function(t,e){for(var n=t.coordinates,r=-1,i=n.length;++r<i;)if(Oh(n[r],e))return!0;return!1},LineString:function(t,e){return Nh(t.coordinates,e)},MultiLineString:function(t,e){for(var n=t.coordinates,r=-1,i=n.length;++r<i;)if(Nh(n[r],e))return!0;return!1},Polygon:function(t,e){return Ih(t.coordinates,e)},MultiPolygon:function(t,e){for(var n=t.coordinates,r=-1,i=n.length;++r<i;)if(Ih(n[r],e))return!0;return!1},GeometryCollection:function(t,e){for(var n=t.geometries,r=-1,i=n.length;++r<i;)if(Mh(n[r],e))return!0;return!1}};function Mh(t,e){return!(!t||!Rh.hasOwnProperty(t.type))&&Rh[t.type](t,e)}function Oh(t,e){return 0===Ch(t,e)}function Nh(t,e){for(var n,r,i,s=0,o=t.length;s<o;s++){if(0===(r=Ch(t[s],e)))return!0;if(s>0&&(i=Ch(t[s],t[s-1]))>0&&n<=i&&r<=i&&(n+r-i)*(1-Math.pow((n-r)/i,2))<ec*i)return!0;n=r}return!1}function Ih(t,e){return!!ah(t.map(Ph),Lh(e))}function Ph(t){return(t=t.map(Lh)).pop(),t}function Lh(t){return[t[0]*ac,t[1]*ac]}function Dh(t,e,n){var r=dt(t,e-tc,n).concat(e);return function(t){return r.map(function(e){return[t,e]})}}function Vh(t,e,n){var r=dt(t,e-tc,n).concat(e);return function(t){return r.map(function(e){return[e,t]})}}function Bh(){var t,e,n,r,i,s,o,a,l,c,u,h,f=10,d=f,p=90,_=360,g=2.5;function y(){return{type:"MultiLineString",coordinates:m()}}function m(){return dt(fc(r/p)*p,n,p).map(u).concat(dt(fc(a/_)*_,o,_).map(h)).concat(dt(fc(e/f)*f,t,f).filter(function(t){return lc(t%p)>tc}).map(l)).concat(dt(fc(s/d)*d,i,d).filter(function(t){return lc(t%_)>tc}).map(c))}return y.lines=function(){return m().map(function(t){return{type:"LineString",coordinates:t}})},y.outline=function(){return{type:"Polygon",coordinates:[u(r).concat(h(o).slice(1),u(n).reverse().slice(1),h(a).reverse().slice(1))]}},y.extent=function(t){return arguments.length?y.extentMajor(t).extentMinor(t):y.extentMinor()},y.extentMajor=function(t){return arguments.length?(r=+t[0][0],n=+t[1][0],a=+t[0][1],o=+t[1][1],r>n&&(t=r,r=n,n=t),a>o&&(t=a,a=o,o=t),y.precision(g)):[[r,a],[n,o]]},y.extentMinor=function(n){return arguments.length?(e=+n[0][0],t=+n[1][0],s=+n[0][1],i=+n[1][1],e>t&&(n=e,e=t,t=n),s>i&&(n=s,s=i,i=n),y.precision(g)):[[e,s],[t,i]]},y.step=function(t){return arguments.length?y.stepMajor(t).stepMinor(t):y.stepMinor()},y.stepMajor=function(t){return arguments.length?(p=+t[0],_=+t[1],y):[p,_]},y.stepMinor=function(t){return arguments.length?(f=+t[0],d=+t[1],y):[f,d]},y.precision=function(f){return arguments.length?(g=+f,l=Dh(s,i,90),c=Vh(e,t,g),u=Dh(a,o,90),h=Vh(r,n,g),y):g},y.extentMajor([[-180,-89.999999],[180,89.999999]]).extentMinor([[-180,-80.000001],[180,80.000001]])}var zh,Fh,Gh,jh,Uh=t=>t,Yh=new w,Hh=new w,Wh={point:Ac,lineStart:Ac,lineEnd:Ac,polygonStart:function(){Wh.lineStart=qh,Wh.lineEnd=Kh},polygonEnd:function(){Wh.lineStart=Wh.lineEnd=Wh.point=Ac,Yh.add(lc(Hh)),Hh=new w},result:function(){var t=Yh/2;return Yh=new w,t}};function qh(){Wh.point=$h}function $h(t,e){Wh.point=Xh,zh=Gh=t,Fh=jh=e}function Xh(t,e){Hh.add(jh*t-Gh*e),Gh=t,jh=e}function Kh(){Xh(zh,Fh)}var Zh=1/0,Jh=Zh,Qh=-Zh,tf=Qh,ef={point:function(t,e){t<Zh&&(Zh=t);t>Qh&&(Qh=t);e<Jh&&(Jh=e);e>tf&&(tf=e)},lineStart:Ac,lineEnd:Ac,polygonStart:Ac,polygonEnd:Ac,result:function(){var t=[[Zh,Jh],[Qh,tf]];return Qh=tf=-(Jh=Zh=1/0),t}};var nf,rf,sf,of,af=0,lf=0,cf=0,uf=0,hf=0,ff=0,df=0,pf=0,_f=0,gf={point:yf,lineStart:mf,lineEnd:xf,polygonStart:function(){gf.lineStart=wf,gf.lineEnd=Ef},polygonEnd:function(){gf.point=yf,gf.lineStart=mf,gf.lineEnd=xf},result:function(){var t=_f?[df/_f,pf/_f]:ff?[uf/ff,hf/ff]:cf?[af/cf,lf/cf]:[NaN,NaN];return af=lf=cf=uf=hf=ff=df=pf=_f=0,t}};function yf(t,e){af+=t,lf+=e,++cf}function mf(){gf.point=bf}function bf(t,e){gf.point=vf,yf(sf=t,of=e)}function vf(t,e){var n=t-sf,r=e-of,i=bc(n*n+r*r);uf+=i*(sf+t)/2,hf+=i*(of+e)/2,ff+=i,yf(sf=t,of=e)}function xf(){gf.point=yf}function wf(){gf.point=Af}function Ef(){Sf(nf,rf)}function Af(t,e){gf.point=Sf,yf(nf=sf=t,rf=of=e)}function Sf(t,e){var n=t-sf,r=e-of,i=bc(n*n+r*r);uf+=i*(sf+t)/2,hf+=i*(of+e)/2,ff+=i,df+=(i=of*t-sf*e)*(sf+t),pf+=i*(of+e),_f+=3*i,yf(sf=t,of=e)}function Tf(t){this._context=t}Tf.prototype={_radius:4.5,pointRadius:function(t){return this._radius=t,this},polygonStart:function(){this._line=0},polygonEnd:function(){this._line=NaN},lineStart:function(){this._point=0},lineEnd:function(){0===this._line&&this._context.closePath(),this._point=NaN},point:function(t,e){switch(this._point){case 0:this._context.moveTo(t,e),this._point=1;break;case 1:this._context.lineTo(t,e);break;default:this._context.moveTo(t+this._radius,e),this._context.arc(t,e,this._radius,0,sc)}},result:Ac};var Cf,kf,Rf,Mf,Of,Nf=new w,If={point:Ac,lineStart:function(){If.point=Pf},lineEnd:function(){Cf&&Lf(kf,Rf),If.point=Ac},polygonStart:function(){Cf=!0},polygonEnd:function(){Cf=null},result:function(){var t=+Nf;return Nf=new w,t}};function Pf(t,e){If.point=Lf,kf=Mf=t,Rf=Of=e}function Lf(t,e){Mf-=t,Of-=e,Nf.add(bc(Mf*Mf+Of*Of)),Mf=t,Of=e}let Df,Vf,Bf,zf;class Ff{constructor(t){this._append=null==t?Gf:function(t){const e=Math.floor(t);if(!(e>=0))throw new RangeError(`invalid digits: ${t}`);if(e>15)return Gf;if(e!==Df){const t=10**e;Df=e,Vf=function(e){let n=1;this._+=e[0];for(const r=e.length;n<r;++n)this._+=Math.round(arguments[n]*t)/t+e[n]}}return Vf}(t),this._radius=4.5,this._=""}pointRadius(t){return this._radius=+t,this}polygonStart(){this._line=0}polygonEnd(){this._line=NaN}lineStart(){this._point=0}lineEnd(){0===this._line&&(this._+="Z"),this._point=NaN}point(t,e){switch(this._point){case 0:this._append`M${t},${e}`,this._point=1;break;case 1:this._append`L${t},${e}`;break;default:if(this._append`M${t},${e}`,this._radius!==Bf||this._append!==Vf){const t=this._radius,e=this._;this._="",this._append`m0,${t}a${t},${t} 0 1,1 0,${-2*t}a${t},${t} 0 1,1 0,${2*t}z`,Bf=t,Vf=this._append,zf=this._,this._=e}this._+=zf}}result(){const t=this._;return this._="",t.length?t:null}}function Gf(t){let e=1;this._+=t[0];for(const n=t.length;e<n;++e)this._+=arguments[e]+t[e]}function jf(t){return function(e){var n=new Uf;for(var r in t)n[r]=t[r];return n.stream=e,n}}function Uf(){}function Yf(t,e,n){var r=t.clipExtent&&t.clipExtent();return t.scale(150).translate([0,0]),null!=r&&t.clipExtent(null),Mc(n,t.stream(ef)),e(ef.result()),null!=r&&t.clipExtent(r),t}function Hf(t,e,n){return Yf(t,function(n){var r=e[1][0]-e[0][0],i=e[1][1]-e[0][1],s=Math.min(r/(n[1][0]-n[0][0]),i/(n[1][1]-n[0][1])),o=+e[0][0]+(r-s*(n[1][0]+n[0][0]))/2,a=+e[0][1]+(i-s*(n[1][1]+n[0][1]))/2;t.scale(150*s).translate([o,a])},n)}function Wf(t,e,n){return Hf(t,[[0,0],e],n)}function qf(t,e,n){return Yf(t,function(n){var r=+e,i=r/(n[1][0]-n[0][0]),s=(r-i*(n[1][0]+n[0][0]))/2,o=-i*n[0][1];t.scale(150*i).translate([s,o])},n)}function $f(t,e,n){return Yf(t,function(n){var r=+e,i=r/(n[1][1]-n[0][1]),s=-i*n[0][0],o=(r-i*(n[1][1]+n[0][1]))/2;t.scale(150*i).translate([s,o])},n)}Uf.prototype={constructor:Uf,point:function(t,e){this.stream.point(t,e)},sphere:function(){this.stream.sphere()},lineStart:function(){this.stream.lineStart()},lineEnd:function(){this.stream.lineEnd()},polygonStart:function(){this.stream.polygonStart()},polygonEnd:function(){this.stream.polygonEnd()}};var Xf=hc(30*ac);function Kf(t,e){return+e?function(t,e){function n(r,i,s,o,a,l,c,u,h,f,d,p,_,g){var y=c-r,m=u-i,b=y*y+m*m;if(b>4*e&&_--){var v=o+f,x=a+d,w=l+p,E=bc(v*v+x*x+w*w),A=wc(w/=E),S=lc(lc(w)-1)<tc||lc(s-h)<tc?(s+h)/2:uc(x,v),T=t(S,A),C=T[0],k=T[1],R=C-r,M=k-i,O=m*R-y*M;(O*O/b>e||lc((y*R+m*M)/b-.5)>.3||o*f+a*d+l*p<Xf)&&(n(r,i,s,o,a,l,C,k,S,v/=E,x/=E,w,_,g),g.point(C,k),n(C,k,S,v,x,w,c,u,h,f,d,p,_,g))}}return function(e){var r,i,s,o,a,l,c,u,h,f,d,p,_={point:g,lineStart:y,lineEnd:b,polygonStart:function(){e.polygonStart(),_.lineStart=v},polygonEnd:function(){e.polygonEnd(),_.lineStart=y}};function g(n,r){n=t(n,r),e.point(n[0],n[1])}function y(){u=NaN,_.point=m,e.lineStart()}function m(r,i){var s=eu([r,i]),o=t(r,i);n(u,h,c,f,d,p,u=o[0],h=o[1],c=r,f=s[0],d=s[1],p=s[2],16,e),e.point(u,h)}function b(){_.point=g,e.lineEnd()}function v(){y(),_.point=x,_.lineEnd=w}function x(t,e){m(r=t,e),i=u,s=h,o=f,a=d,l=p,_.point=m}function w(){n(u,h,c,f,d,p,i,s,r,o,a,l,16,e),_.lineEnd=b,b()}return _}}(t,e):function(t){return jf({point:function(e,n){e=t(e,n),this.stream.point(e[0],e[1])}})}(t)}var Zf=jf({point:function(t,e){this.stream.point(t*ac,e*ac)}});function Jf(t,e,n,r,i,s){if(!s)return function(t,e,n,r,i){function s(s,o){return[e+t*(s*=r),n-t*(o*=i)]}return s.invert=function(s,o){return[(s-e)/t*r,(n-o)/t*i]},s}(t,e,n,r,i);var o=hc(s),a=yc(s),l=o*t,c=a*t,u=o/t,h=a/t,f=(a*n-o*e)/t,d=(a*e+o*n)/t;function p(t,s){return[l*(t*=r)-c*(s*=i)+e,n-c*t-l*s]}return p.invert=function(t,e){return[r*(u*t-h*e+f),i*(d-h*t-u*e)]},p}function Qf(t){return td(function(){return t})()}function td(t){var e,n,r,i,s,o,a,l,c,u,h=150,f=480,d=250,p=0,_=0,g=0,y=0,m=0,b=0,v=1,x=1,w=null,E=hh,A=null,S=Uh,T=.5;function C(t){return l(t[0]*ac,t[1]*ac)}function k(t){return(t=l.invert(t[0],t[1]))&&[t[0]*oc,t[1]*oc]}function R(){var t=Jf(h,0,0,v,x,b).apply(null,e(p,_)),r=Jf(h,f-t[0],d-t[1],v,x,b);return n=$u(g,y,m),a=Wu(e,r),l=Wu(n,a),o=Kf(a,T),M()}function M(){return c=u=null,C}return C.stream=function(t){return c&&u===t?c:c=Zf(function(t){return jf({point:function(e,n){var r=t(e,n);return this.stream.point(r[0],r[1])}})}(n)(E(o(S(u=t)))))},C.preclip=function(t){return arguments.length?(E=t,w=void 0,M()):E},C.postclip=function(t){return arguments.length?(S=t,A=r=i=s=null,M()):S},C.clipAngle=function(t){return arguments.length?(E=+t?fh(w=t*ac):(w=null,hh),M()):w*oc},C.clipExtent=function(t){return arguments.length?(S=null==t?(A=r=i=s=null,Uh):bh(A=+t[0][0],r=+t[0][1],i=+t[1][0],s=+t[1][1]),M()):null==A?null:[[A,r],[i,s]]},C.scale=function(t){return arguments.length?(h=+t,R()):h},C.translate=function(t){return arguments.length?(f=+t[0],d=+t[1],R()):[f,d]},C.center=function(t){return arguments.length?(p=t[0]%360*ac,_=t[1]%360*ac,R()):[p*oc,_*oc]},C.rotate=function(t){return arguments.length?(g=t[0]%360*ac,y=t[1]%360*ac,m=t.length>2?t[2]%360*ac:0,R()):[g*oc,y*oc,m*oc]},C.angle=function(t){return arguments.length?(b=t%360*ac,R()):b*oc},C.reflectX=function(t){return arguments.length?(v=t?-1:1,R()):v<0},C.reflectY=function(t){return arguments.length?(x=t?-1:1,R()):x<0},C.precision=function(t){return arguments.length?(o=Kf(a,T=t*t),M()):bc(T)},C.fitExtent=function(t,e){return Hf(C,t,e)},C.fitSize=function(t,e){return Wf(C,t,e)},C.fitWidth=function(t,e){return qf(C,t,e)},C.fitHeight=function(t,e){return $f(C,t,e)},function(){return e=t.apply(this,arguments),C.invert=e.invert&&k,R()}}function ed(t){var e=0,n=nc/3,r=td(t),i=r(e,n);return i.parallels=function(t){return arguments.length?r(e=t[0]*ac,n=t[1]*ac):[e*oc,n*oc]},i}function nd(t,e){var n=yc(t),r=(n+yc(e))/2;if(lc(r)<tc)return function(t){var e=hc(t);function n(t,n){return[t*e,yc(n)/e]}return n.invert=function(t,n){return[t/e,wc(n*e)]},n}(t);var i=1+n*(2*r-n),s=bc(i)/r;function o(t,e){var n=bc(i-2*r*yc(e))/r;return[n*yc(t*=r),s-n*hc(t)]}return o.invert=function(t,e){var n=s-e,o=uc(t,lc(n))*mc(n);return n*r<0&&(o-=nc*mc(t)*mc(n)),[o/r,wc((i-(t*t+n*n)*r*r)/(2*r))]},o}function rd(){return ed(nd).scale(155.424).center([0,33.6442])}function id(){return rd().parallels([29.5,45.5]).scale(1070).translate([480,250]).rotate([96,0]).center([-.6,38.7])}function sd(t){return function(e,n){var r=hc(e),i=hc(n),s=t(r*i);return s===1/0?[2,0]:[s*i*yc(e),s*yc(n)]}}function od(t){return function(e,n){var r=bc(e*e+n*n),i=t(r),s=yc(i),o=hc(i);return[uc(e*s,r*o),wc(r&&n*s/r)]}}var ad=sd(function(t){return bc(2/(1+t))});ad.invert=od(function(t){return 2*wc(t/2)});var ld=sd(function(t){return(t=xc(t))&&t/yc(t)});function cd(t,e){return[t,_c(vc((rc+e)/2))]}function ud(t){var e,n,r,i=Qf(t),s=i.center,o=i.scale,a=i.translate,l=i.clipExtent,c=null;function u(){var s=nc*o(),a=i(Ju(i.rotate()).invert([0,0]));return l(null==c?[[a[0]-s,a[1]-s],[a[0]+s,a[1]+s]]:t===cd?[[Math.max(a[0]-s,c),e],[Math.min(a[0]+s,n),r]]:[[c,Math.max(a[1]-s,e)],[n,Math.min(a[1]+s,r)]])}return i.scale=function(t){return arguments.length?(o(t),u()):o()},i.translate=function(t){return arguments.length?(a(t),u()):a()},i.center=function(t){return arguments.length?(s(t),u()):s()},i.clipExtent=function(t){return arguments.length?(null==t?c=e=n=r=null:(c=+t[0][0],e=+t[0][1],n=+t[1][0],r=+t[1][1]),u()):null==c?null:[[c,e],[n,r]]},u()}function hd(t){return vc((rc+t)/2)}function fd(t,e){var n=hc(t),r=t===e?yc(t):_c(n/hc(e))/_c(hd(e)/hd(t)),i=n*gc(hd(t),r)/r;if(!r)return cd;function s(t,e){i>0?e<-rc+tc&&(e=-rc+tc):e>rc-tc&&(e=rc-tc);var n=i/gc(hd(e),r);return[n*yc(r*t),i-n*hc(r*t)]}return s.invert=function(t,e){var n=i-e,s=mc(r)*bc(t*t+n*n),o=uc(t,lc(n))*mc(n);return n*r<0&&(o-=nc*mc(t)*mc(n)),[o/r,2*cc(gc(i/s,1/r))-rc]},s}function dd(t,e){return[t,e]}function pd(t,e){var n=hc(t),r=t===e?yc(t):(n-hc(e))/(e-t),i=n/r+t;if(lc(r)<tc)return dd;function s(t,e){var n=i-e,s=r*t;return[n*yc(s),i-n*hc(s)]}return s.invert=function(t,e){var n=i-e,s=uc(t,lc(n))*mc(n);return n*r<0&&(s-=nc*mc(t)*mc(n)),[s/r,i-mc(r)*bc(t*t+n*n)]},s}ld.invert=od(function(t){return t}),cd.invert=function(t,e){return[t,2*cc(dc(e))-rc]},dd.invert=dd;var _d=1.340264,gd=-.081106,yd=893e-6,md=.003796,bd=bc(3)/2;function vd(t,e){var n=wc(bd*yc(e)),r=n*n,i=r*r*r;return[t*hc(n)/(bd*(_d+3*gd*r+i*(7*yd+9*md*r))),n*(_d+gd*r+i*(yd+md*r))]}function xd(t,e){var n=hc(e),r=hc(t)*n;return[n*yc(t)/r,yc(e)/r]}function wd(t,e){var n=e*e,r=n*n;return[t*(.8707-.131979*n+r*(r*(.003971*n-.001529*r)-.013791)),e*(1.007226+n*(.015085+r*(.028874*n-.044475-.005916*r)))]}function Ed(t,e){return[hc(e)*yc(t),yc(e)]}function Ad(t,e){var n=hc(e),r=1+hc(t)*n;return[n*yc(t)/r,yc(e)/r]}function Sd(t,e){return[_c(vc((rc+e)/2)),-t]}function Td(t,e){return t.parent===e.parent?1:2}function Cd(t,e){return t+e.x}function kd(t,e){return Math.max(t,e.y)}function Rd(){var t=Td,e=1,n=1,r=!1;function i(i){var s,o=0;i.eachAfter(function(e){var n=e.children;n?(e.x=function(t){return t.reduce(Cd,0)/t.length}(n),e.y=function(t){return 1+t.reduce(kd,0)}(n)):(e.x=s?o+=t(e,s):0,e.y=0,s=e)});var a=function(t){for(var e;e=t.children;)t=e[0];return t}(i),l=function(t){for(var e;e=t.children;)t=e[e.length-1];return t}(i),c=a.x-t(a,l)/2,u=l.x+t(l,a)/2;return i.eachAfter(r?function(t){t.x=(t.x-i.x)*e,t.y=(i.y-t.y)*n}:function(t){t.x=(t.x-c)/(u-c)*e,t.y=(1-(i.y?t.y/i.y:1))*n})}return i.separation=function(e){return arguments.length?(t=e,i):t},i.size=function(t){return arguments.length?(r=!1,e=+t[0],n=+t[1],i):r?null:[e,n]},i.nodeSize=function(t){return arguments.length?(r=!0,e=+t[0],n=+t[1],i):r?[e,n]:null},i}function Md(t){var e=0,n=t.children,r=n&&n.length;if(r)for(;--r>=0;)e+=n[r].value;else e=1;t.value=e}function Od(t,e){t instanceof Map?(t=[void 0,t],void 0===e&&(e=Id)):void 0===e&&(e=Nd);for(var n,r,i,s,o,a=new Dd(t),l=[a];n=l.pop();)if((i=e(n.data))&&(o=(i=Array.from(i)).length))for(n.children=i,s=o-1;s>=0;--s)l.push(r=i[s]=new Dd(i[s])),r.parent=n,r.depth=n.depth+1;return a.eachBefore(Ld)}function Nd(t){return t.children}function Id(t){return Array.isArray(t)?t[1]:null}function Pd(t){void 0!==t.data.value&&(t.value=t.data.value),t.data=t.data.data}function Ld(t){var e=0;do{t.height=e}while((t=t.parent)&&t.height<++e)}function Dd(t){this.data=t,this.depth=this.height=0,this.parent=null}function Vd(t){return null==t?null:Bd(t)}function Bd(t){if("function"!=typeof t)throw new Error;return t}function zd(){return 0}function Fd(t){return function(){return t}}vd.invert=function(t,e){for(var n,r=e,i=r*r,s=i*i*i,o=0;o<12&&(s=(i=(r-=n=(r*(_d+gd*i+s*(yd+md*i))-e)/(_d+3*gd*i+s*(7*yd+9*md*i)))*r)*i*i,!(lc(n)<ec));++o);return[bd*t*(_d+3*gd*i+s*(7*yd+9*md*i))/hc(r),wc(yc(r)/bd)]},xd.invert=od(cc),wd.invert=function(t,e){var n,r=e,i=25;do{var s=r*r,o=s*s;r-=n=(r*(1.007226+s*(.015085+o*(.028874*s-.044475-.005916*o)))-e)/(1.007226+s*(.045255+o*(.259866*s-.311325-.005916*11*o)))}while(lc(n)>tc&&--i>0);return[t/(.8707+(s=r*r)*(s*(s*s*s*(.003971-.001529*s)-.013791)-.131979)),r]},Ed.invert=od(wc),Ad.invert=od(function(t){return 2*cc(t)}),Sd.invert=function(t,e){return[-e,2*cc(dc(t))-rc]},Dd.prototype=Od.prototype={constructor:Dd,count:function(){return this.eachAfter(Md)},each:function(t,e){let n=-1;for(const r of this)t.call(e,r,++n,this);return this},eachAfter:function(t,e){for(var n,r,i,s=this,o=[s],a=[],l=-1;s=o.pop();)if(a.push(s),n=s.children)for(r=0,i=n.length;r<i;++r)o.push(n[r]);for(;s=a.pop();)t.call(e,s,++l,this);return this},eachBefore:function(t,e){for(var n,r,i=this,s=[i],o=-1;i=s.pop();)if(t.call(e,i,++o,this),n=i.children)for(r=n.length-1;r>=0;--r)s.push(n[r]);return this},find:function(t,e){let n=-1;for(const r of this)if(t.call(e,r,++n,this))return r},sum:function(t){return this.eachAfter(function(e){for(var n=+t(e.data)||0,r=e.children,i=r&&r.length;--i>=0;)n+=r[i].value;e.value=n})},sort:function(t){return this.eachBefore(function(e){e.children&&e.children.sort(t)})},path:function(t){for(var e=this,n=function(t,e){if(t===e)return t;var n=t.ancestors(),r=e.ancestors(),i=null;t=n.pop(),e=r.pop();for(;t===e;)i=t,t=n.pop(),e=r.pop();return i}(e,t),r=[e];e!==n;)e=e.parent,r.push(e);for(var i=r.length;t!==n;)r.splice(i,0,t),t=t.parent;return r},ancestors:function(){for(var t=this,e=[t];t=t.parent;)e.push(t);return e},descendants:function(){return Array.from(this)},leaves:function(){var t=[];return this.eachBefore(function(e){e.children||t.push(e)}),t},links:function(){var t=this,e=[];return t.each(function(n){n!==t&&e.push({source:n.parent,target:n})}),e},copy:function(){return Od(this).eachBefore(Pd)},[Symbol.iterator]:function*(){var t,e,n,r,i=this,s=[i];do{for(t=s.reverse(),s=[];i=t.pop();)if(yield i,e=i.children)for(n=0,r=e.length;n<r;++n)s.push(e[n])}while(s.length)}};const Gd=4294967296;function jd(){let t=1;return()=>(t=(1664525*t+1013904223)%Gd)/Gd}function Ud(t,e){for(var n,r,i=0,s=(t=function(t,e){let n,r,i=t.length;for(;i;)r=e()*i--|0,n=t[i],t[i]=t[r],t[r]=n;return t}(Array.from(t),e)).length,o=[];i<s;)n=t[i],r&&Wd(r,n)?++i:(r=$d(o=Yd(o,n)),i=0);return r}function Yd(t,e){var n,r;if(qd(e,t))return[e];for(n=0;n<t.length;++n)if(Hd(e,t[n])&&qd(Xd(t[n],e),t))return[t[n],e];for(n=0;n<t.length-1;++n)for(r=n+1;r<t.length;++r)if(Hd(Xd(t[n],t[r]),e)&&Hd(Xd(t[n],e),t[r])&&Hd(Xd(t[r],e),t[n])&&qd(Kd(t[n],t[r],e),t))return[t[n],t[r],e];throw new Error}function Hd(t,e){var n=t.r-e.r,r=e.x-t.x,i=e.y-t.y;return n<0||n*n<r*r+i*i}function Wd(t,e){var n=t.r-e.r+1e-9*Math.max(t.r,e.r,1),r=e.x-t.x,i=e.y-t.y;return n>0&&n*n>r*r+i*i}function qd(t,e){for(var n=0;n<e.length;++n)if(!Wd(t,e[n]))return!1;return!0}function $d(t){switch(t.length){case 1:return function(t){return{x:t.x,y:t.y,r:t.r}}(t[0]);case 2:return Xd(t[0],t[1]);case 3:return Kd(t[0],t[1],t[2])}}function Xd(t,e){var n=t.x,r=t.y,i=t.r,s=e.x,o=e.y,a=e.r,l=s-n,c=o-r,u=a-i,h=Math.sqrt(l*l+c*c);return{x:(n+s+l/h*u)/2,y:(r+o+c/h*u)/2,r:(h+i+a)/2}}function Kd(t,e,n){var r=t.x,i=t.y,s=t.r,o=e.x,a=e.y,l=e.r,c=n.x,u=n.y,h=n.r,f=r-o,d=r-c,p=i-a,_=i-u,g=l-s,y=h-s,m=r*r+i*i-s*s,b=m-o*o-a*a+l*l,v=m-c*c-u*u+h*h,x=d*p-f*_,w=(p*v-_*b)/(2*x)-r,E=(_*g-p*y)/x,A=(d*b-f*v)/(2*x)-i,S=(f*y-d*g)/x,T=E*E+S*S-1,C=2*(s+w*E+A*S),k=w*w+A*A-s*s,R=-(Math.abs(T)>1e-6?(C+Math.sqrt(C*C-4*T*k))/(2*T):k/C);return{x:r+w+E*R,y:i+A+S*R,r:R}}function Zd(t,e,n){var r,i,s,o,a=t.x-e.x,l=t.y-e.y,c=a*a+l*l;c?(i=e.r+n.r,i*=i,o=t.r+n.r,i>(o*=o)?(r=(c+o-i)/(2*c),s=Math.sqrt(Math.max(0,o/c-r*r)),n.x=t.x-r*a-s*l,n.y=t.y-r*l+s*a):(r=(c+i-o)/(2*c),s=Math.sqrt(Math.max(0,i/c-r*r)),n.x=e.x+r*a-s*l,n.y=e.y+r*l+s*a)):(n.x=e.x+n.r,n.y=e.y)}function Jd(t,e){var n=t.r+e.r-1e-6,r=e.x-t.x,i=e.y-t.y;return n>0&&n*n>r*r+i*i}function Qd(t){var e=t._,n=t.next._,r=e.r+n.r,i=(e.x*n.r+n.x*e.r)/r,s=(e.y*n.r+n.y*e.r)/r;return i*i+s*s}function tp(t){this._=t,this.next=null,this.previous=null}function ep(t,e){if(!(s=(t=function(t){return"object"==typeof t&&"length"in t?t:Array.from(t)}(t)).length))return 0;var n,r,i,s,o,a,l,c,u,h,f;if((n=t[0]).x=0,n.y=0,!(s>1))return n.r;if(r=t[1],n.x=-r.r,r.x=n.r,r.y=0,!(s>2))return n.r+r.r;Zd(r,n,i=t[2]),n=new tp(n),r=new tp(r),i=new tp(i),n.next=i.previous=r,r.next=n.previous=i,i.next=r.previous=n;t:for(l=3;l<s;++l){Zd(n._,r._,i=t[l]),i=new tp(i),c=r.next,u=n.previous,h=r._.r,f=n._.r;do{if(h<=f){if(Jd(c._,i._)){r=c,n.next=r,r.previous=n,--l;continue t}h+=c._.r,c=c.next}else{if(Jd(u._,i._)){(n=u).next=r,r.previous=n,--l;continue t}f+=u._.r,u=u.previous}}while(c!==u.next);for(i.previous=n,i.next=r,n.next=r.previous=r=i,o=Qd(n);(i=i.next)!==r;)(a=Qd(i))<o&&(n=i,o=a);r=n.next}for(n=[r._],i=r;(i=i.next)!==r;)n.push(i._);for(i=Ud(n,e),l=0;l<s;++l)(n=t[l]).x-=i.x,n.y-=i.y;return i.r}function np(t){return Math.sqrt(t.value)}function rp(){var t=null,e=1,n=1,r=zd;function i(i){const s=jd();return i.x=e/2,i.y=n/2,t?i.eachBefore(ip(t)).eachAfter(sp(r,.5,s)).eachBefore(op(1)):i.eachBefore(ip(np)).eachAfter(sp(zd,1,s)).eachAfter(sp(r,i.r/Math.min(e,n),s)).eachBefore(op(Math.min(e,n)/(2*i.r))),i}return i.radius=function(e){return arguments.length?(t=Vd(e),i):t},i.size=function(t){return arguments.length?(e=+t[0],n=+t[1],i):[e,n]},i.padding=function(t){return arguments.length?(r="function"==typeof t?t:Fd(+t),i):r},i}function ip(t){return function(e){e.children||(e.r=Math.max(0,+t(e)||0))}}function sp(t,e,n){return function(r){if(i=r.children){var i,s,o,a=i.length,l=t(r)*e||0;if(l)for(s=0;s<a;++s)i[s].r+=l;if(o=ep(i,n),l)for(s=0;s<a;++s)i[s].r-=l;r.r=o+l}}}function op(t){return function(e){var n=e.parent;e.r*=t,n&&(e.x=n.x+t*e.x,e.y=n.y+t*e.y)}}function ap(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 lp(t,e,n,r,i){for(var s,o=t.children,a=-1,l=o.length,c=t.value&&(r-e)/t.value;++a<l;)(s=o[a]).y0=n,s.y1=i,s.x0=e,s.x1=e+=s.value*c}var cp={depth:-1},up={},hp={};function fp(t){return t.id}function dp(t){return t.parentId}function pp(t){let e=t.length;if(e<2)return"";for(;--e>1&&!_p(t,e););return t.slice(0,e)}function _p(t,e){if("/"===t[e]){let n=0;for(;e>0&&"\\"===t[--e];)++n;if(!(1&n))return!0}return!1}function gp(t,e){return t.parent===e.parent?1:2}function yp(t){var e=t.children;return e?e[0]:t.t}function mp(t){var e=t.children;return e?e[e.length-1]:t.t}function bp(t,e,n){var r=n/(e.i-t.i);e.c-=r,e.s+=n,t.c+=r,e.z+=n,e.m+=n}function vp(t,e,n){return t.a.parent===e.parent?t.a:n}function xp(t,e){this._=t,this.parent=null,this.children=null,this.A=null,this.a=this,this.z=0,this.m=0,this.c=0,this.s=0,this.t=null,this.i=e}function wp(){var t=gp,e=1,n=1,r=null;function i(i){var l=function(t){for(var e,n,r,i,s,o=new xp(t,0),a=[o];e=a.pop();)if(r=e._.children)for(e.children=new Array(s=r.length),i=s-1;i>=0;--i)a.push(n=e.children[i]=new xp(r[i],i)),n.parent=e;return(o.parent=new xp(null,0)).children=[o],o}(i);if(l.eachAfter(s),l.parent.m=-l.z,l.eachBefore(o),r)i.eachBefore(a);else{var c=i,u=i,h=i;i.eachBefore(function(t){t.x<c.x&&(c=t),t.x>u.x&&(u=t),t.depth>h.depth&&(h=t)});var f=c===u?1:t(c,u)/2,d=f-c.x,p=e/(u.x+f+d),_=n/(h.depth||1);i.eachBefore(function(t){t.x=(t.x+d)*p,t.y=t.depth*_})}return i}function s(e){var n=e.children,r=e.parent.children,i=e.i?r[e.i-1]:null;if(n){!function(t){for(var e,n=0,r=0,i=t.children,s=i.length;--s>=0;)(e=i[s]).z+=n,e.m+=n,n+=e.s+(r+=e.c)}(e);var s=(n[0].z+n[n.length-1].z)/2;i?(e.z=i.z+t(e._,i._),e.m=e.z-s):e.z=s}else i&&(e.z=i.z+t(e._,i._));e.parent.A=function(e,n,r){if(n){for(var i,s=e,o=e,a=n,l=s.parent.children[0],c=s.m,u=o.m,h=a.m,f=l.m;a=mp(a),s=yp(s),a&&s;)l=yp(l),(o=mp(o)).a=e,(i=a.z+h-s.z-c+t(a._,s._))>0&&(bp(vp(a,e,r),e,i),c+=i,u+=i),h+=a.m,c+=s.m,f+=l.m,u+=o.m;a&&!mp(o)&&(o.t=a,o.m+=h-u),s&&!yp(l)&&(l.t=s,l.m+=c-f,r=e)}return r}(e,i,e.parent.A||r[0])}function o(t){t._.x=t.z+t.parent.m,t.m+=t.parent.m}function a(t){t.x*=e,t.y=t.depth*n}return i.separation=function(e){return arguments.length?(t=e,i):t},i.size=function(t){return arguments.length?(r=!1,e=+t[0],n=+t[1],i):r?null:[e,n]},i.nodeSize=function(t){return arguments.length?(r=!0,e=+t[0],n=+t[1],i):r?[e,n]:null},i}function Ep(t,e,n,r,i){for(var s,o=t.children,a=-1,l=o.length,c=t.value&&(i-n)/t.value;++a<l;)(s=o[a]).x0=e,s.x1=r,s.y0=n,s.y1=n+=s.value*c}xp.prototype=Object.create(Dd.prototype);var Ap=(1+Math.sqrt(5))/2;function Sp(t,e,n,r,i,s){for(var o,a,l,c,u,h,f,d,p,_,g,y=[],m=e.children,b=0,v=0,x=m.length,w=e.value;b<x;){l=i-n,c=s-r;do{u=m[v++].value}while(!u&&v<x);for(h=f=u,g=u*u*(_=Math.max(c/l,l/c)/(w*t)),p=Math.max(f/g,g/h);v<x;++v){if(u+=a=m[v].value,a<h&&(h=a),a>f&&(f=a),g=u*u*_,(d=Math.max(f/g,g/h))>p){u-=a;break}p=d}y.push(o={value:u,dice:l<c,children:m.slice(b,v)}),o.dice?lp(o,n,r,i,w?r+=c*u/w:s):Ep(o,n,r,w?n+=l*u/w:i,s),w-=u,b=v}return y}var Tp=function t(e){function n(t,n,r,i,s){Sp(e,t,n,r,i,s)}return n.ratio=function(e){return t((e=+e)>1?e:1)},n}(Ap);function Cp(){var t=Tp,e=!1,n=1,r=1,i=[0],s=zd,o=zd,a=zd,l=zd,c=zd;function u(t){return t.x0=t.y0=0,t.x1=n,t.y1=r,t.eachBefore(h),i=[0],e&&t.eachBefore(ap),t}function h(e){var n=i[e.depth],r=e.x0+n,u=e.y0+n,h=e.x1-n,f=e.y1-n;h<r&&(r=h=(r+h)/2),f<u&&(u=f=(u+f)/2),e.x0=r,e.y0=u,e.x1=h,e.y1=f,e.children&&(n=i[e.depth+1]=s(e)/2,r+=c(e)-n,u+=o(e)-n,(h-=a(e)-n)<r&&(r=h=(r+h)/2),(f-=l(e)-n)<u&&(u=f=(u+f)/2),t(e,r,u,h,f))}return u.round=function(t){return arguments.length?(e=!!t,u):e},u.size=function(t){return arguments.length?(n=+t[0],r=+t[1],u):[n,r]},u.tile=function(e){return arguments.length?(t=Bd(e),u):t},u.padding=function(t){return arguments.length?u.paddingInner(t).paddingOuter(t):u.paddingInner()},u.paddingInner=function(t){return arguments.length?(s="function"==typeof t?t:Fd(+t),u):s},u.paddingOuter=function(t){return arguments.length?u.paddingTop(t).paddingRight(t).paddingBottom(t).paddingLeft(t):u.paddingTop()},u.paddingTop=function(t){return arguments.length?(o="function"==typeof t?t:Fd(+t),u):o},u.paddingRight=function(t){return arguments.length?(a="function"==typeof t?t:Fd(+t),u):a},u.paddingBottom=function(t){return arguments.length?(l="function"==typeof t?t:Fd(+t),u):l},u.paddingLeft=function(t){return arguments.length?(c="function"==typeof t?t:Fd(+t),u):c},u}var kp=function t(e){function n(t,n,r,i,s){if((o=t._squarify)&&o.ratio===e)for(var o,a,l,c,u,h=-1,f=o.length,d=t.value;++h<f;){for(l=(a=o[h]).children,c=a.value=0,u=l.length;c<u;++c)a.value+=l[c].value;a.dice?lp(a,n,r,i,d?r+=(s-r)*a.value/d:s):Ep(a,n,r,d?n+=(i-n)*a.value/d:i,s),d-=a.value}else t._squarify=o=Sp(e,t,n,r,i,s),o.ratio=e}return n.ratio=function(e){return t((e=+e)>1?e:1)},n}(Ap);function Rp(t,e,n){return(e[0]-t[0])*(n[1]-t[1])-(e[1]-t[1])*(n[0]-t[0])}function Mp(t,e){return t[0]-e[0]||t[1]-e[1]}function Op(t){const e=t.length,n=[0,1];let r,i=2;for(r=2;r<e;++r){for(;i>1&&Rp(t[n[i-2]],t[n[i-1]],t[r])<=0;)--i;n[i++]=r}return n.slice(0,i)}var Np=Math.random,Ip=function t(e){function n(t,n){return t=null==t?0:+t,n=null==n?1:+n,1===arguments.length?(n=t,t=0):n-=t,function(){return e()*n+t}}return n.source=t,n}(Np),Pp=function t(e){function n(t,n){return arguments.length<2&&(n=t,t=0),t=Math.floor(t),n=Math.floor(n)-t,function(){return Math.floor(e()*n+t)}}return n.source=t,n}(Np),Lp=function t(e){function n(t,n){var r,i;return t=null==t?0:+t,n=null==n?1:+n,function(){var s;if(null!=r)s=r,r=null;else do{r=2*e()-1,s=2*e()-1,i=r*r+s*s}while(!i||i>1);return t+n*s*Math.sqrt(-2*Math.log(i)/i)}}return n.source=t,n}(Np),Dp=function t(e){var n=Lp.source(e);function r(){var t=n.apply(this,arguments);return function(){return Math.exp(t())}}return r.source=t,r}(Np),Vp=function t(e){function n(t){return(t=+t)<=0?()=>0:function(){for(var n=0,r=t;r>1;--r)n+=e();return n+r*e()}}return n.source=t,n}(Np),Bp=function t(e){var n=Vp.source(e);function r(t){if(0===(t=+t))return e;var r=n(t);return function(){return r()/t}}return r.source=t,r}(Np),zp=function t(e){function n(t){return function(){return-Math.log1p(-e())/t}}return n.source=t,n}(Np),Fp=function t(e){function n(t){if((t=+t)<0)throw new RangeError("invalid alpha");return t=1/-t,function(){return Math.pow(1-e(),t)}}return n.source=t,n}(Np),Gp=function t(e){function n(t){if((t=+t)<0||t>1)throw new RangeError("invalid p");return function(){return Math.floor(e()+t)}}return n.source=t,n}(Np),jp=function t(e){function n(t){if((t=+t)<0||t>1)throw new RangeError("invalid p");return 0===t?()=>1/0:1===t?()=>1:(t=Math.log1p(-t),function(){return 1+Math.floor(Math.log1p(-e())/t)})}return n.source=t,n}(Np),Up=function t(e){var n=Lp.source(e)();function r(t,r){if((t=+t)<0)throw new RangeError("invalid k");if(0===t)return()=>0;if(r=null==r?1:+r,1===t)return()=>-Math.log1p(-e())*r;var i=(t<1?t+1:t)-1/3,s=1/(3*Math.sqrt(i)),o=t<1?()=>Math.pow(e(),1/t):()=>1;return function(){do{do{var t=n(),a=1+s*t}while(a<=0);a*=a*a;var l=1-e()}while(l>=1-.0331*t*t*t*t&&Math.log(l)>=.5*t*t+i*(1-a+Math.log(a)));return i*a*o()*r}}return r.source=t,r}(Np),Yp=function t(e){var n=Up.source(e);function r(t,e){var r=n(t),i=n(e);return function(){var t=r();return 0===t?0:t/(t+i())}}return r.source=t,r}(Np),Hp=function t(e){var n=jp.source(e),r=Yp.source(e);function i(t,e){return t=+t,(e=+e)>=1?()=>t:e<=0?()=>0:function(){for(var i=0,s=t,o=e;s*o>16&&s*(1-o)>16;){var a=Math.floor((s+1)*o),l=r(a,s-a+1)();l<=o?(i+=a,s-=a,o=(o-l)/(1-l)):(s=a-1,o/=l)}for(var c=o<.5,u=n(c?o:1-o),h=u(),f=0;h<=s;++f)h+=u();return i+(c?f:s-f)}}return i.source=t,i}(Np),Wp=function t(e){function n(t,n,r){var i;return 0===(t=+t)?i=t=>-Math.log(t):(t=1/t,i=e=>Math.pow(e,t)),n=null==n?0:+n,r=null==r?1:+r,function(){return n+r*i(-Math.log1p(-e()))}}return n.source=t,n}(Np),qp=function t(e){function n(t,n){return t=null==t?0:+t,n=null==n?1:+n,function(){return t+n*Math.tan(Math.PI*e())}}return n.source=t,n}(Np),$p=function t(e){function n(t,n){return t=null==t?0:+t,n=null==n?1:+n,function(){var r=e();return t+n*Math.log(r/(1-r))}}return n.source=t,n}(Np),Xp=function t(e){var n=Up.source(e),r=Hp.source(e);function i(t){return function(){for(var i=0,s=t;s>16;){var o=Math.floor(.875*s),a=n(o)();if(a>s)return i+r(o-1,s/a)();i+=o,s-=a}for(var l=-Math.log1p(-e()),c=0;l<=s;++c)l-=Math.log1p(-e());return i+c}}return i.source=t,i}(Np);const Kp=1/4294967296;function Zp(t,e){switch(arguments.length){case 0:break;case 1:this.range(t);break;default:this.range(e).domain(t)}return this}function Jp(t,e){switch(arguments.length){case 0:break;case 1:"function"==typeof t?this.interpolator(t):this.range(t);break;default:this.domain(t),"function"==typeof e?this.interpolator(e):this.range(e)}return this}const Qp=Symbol("implicit");function t_(){var t=new E,e=[],n=[],r=Qp;function i(i){let s=t.get(i);if(void 0===s){if(r!==Qp)return r;t.set(i,s=e.push(i)-1)}return n[s%n.length]}return i.domain=function(n){if(!arguments.length)return e.slice();e=[],t=new E;for(const r of n)t.has(r)||t.set(r,e.push(r)-1);return i},i.range=function(t){return arguments.length?(n=Array.from(t),i):n.slice()},i.unknown=function(t){return arguments.length?(r=t,i):r},i.copy=function(){return t_(e,n).unknown(r)},Zp.apply(i,arguments),i}function e_(){var t,e,n=t_().unknown(void 0),r=n.domain,i=n.range,s=0,o=1,a=!1,l=0,c=0,u=.5;function h(){var n=r().length,h=o<s,f=h?o:s,d=h?s:o;t=(d-f)/Math.max(1,n-l+2*c),a&&(t=Math.floor(t)),f+=(d-f-t*(n-l))*u,e=t*(1-l),a&&(f=Math.round(f),e=Math.round(e));var p=dt(n).map(function(e){return f+t*e});return i(h?p.reverse():p)}return delete n.unknown,n.domain=function(t){return arguments.length?(r(t),h()):r()},n.range=function(t){return arguments.length?([s,o]=t,s=+s,o=+o,h()):[s,o]},n.rangeRound=function(t){return[s,o]=t,s=+s,o=+o,a=!0,h()},n.bandwidth=function(){return e},n.step=function(){return t},n.round=function(t){return arguments.length?(a=!!t,h()):a},n.padding=function(t){return arguments.length?(l=Math.min(1,c=+t),h()):l},n.paddingInner=function(t){return arguments.length?(l=Math.min(1,t),h()):l},n.paddingOuter=function(t){return arguments.length?(c=+t,h()):c},n.align=function(t){return arguments.length?(u=Math.max(0,Math.min(1,t)),h()):u},n.copy=function(){return e_(r(),[s,o]).round(a).paddingInner(l).paddingOuter(c).align(u)},Zp.apply(h(),arguments)}function n_(t){var e=t.copy;return t.padding=t.paddingOuter,delete t.paddingInner,delete t.paddingOuter,t.copy=function(){return n_(e())},t}function r_(){return n_(e_.apply(null,arguments).paddingInner(1))}function i_(t){return+t}var s_=[0,1];function o_(t){return t}function a_(t,e){return(e-=t=+t)?function(n){return(n-t)/e}:function(t){return function(){return t}}(isNaN(e)?NaN:.5)}function l_(t,e,n){var r=t[0],i=t[1],s=e[0],o=e[1];return i<r?(r=a_(i,r),s=n(o,s)):(r=a_(r,i),s=n(s,o)),function(t){return s(r(t))}}function c_(t,e,n){var r=Math.min(t.length,e.length)-1,i=new Array(r),s=new Array(r),a=-1;for(t[r]<t[0]&&(t=t.slice().reverse(),e=e.slice().reverse());++a<r;)i[a]=a_(t[a],t[a+1]),s[a]=n(e[a],e[a+1]);return function(e){var n=o(t,e,1,r)-1;return s[n](i[n](e))}}function u_(t,e){return e.domain(t.domain()).range(t.range()).interpolate(t.interpolate()).clamp(t.clamp()).unknown(t.unknown())}function h_(){var t,e,n,r,i,s,o=s_,a=s_,l=Hr,c=o_;function u(){var t=Math.min(o.length,a.length);return c!==o_&&(c=function(t,e){var n;return t>e&&(n=t,t=e,e=n),function(n){return Math.max(t,Math.min(e,n))}}(o[0],o[t-1])),r=t>2?c_:l_,i=s=null,h}function h(e){return null==e||isNaN(e=+e)?n:(i||(i=r(o.map(t),a,l)))(t(c(e)))}return h.invert=function(n){return c(e((s||(s=r(a,o.map(t),Fr)))(n)))},h.domain=function(t){return arguments.length?(o=Array.from(t,i_),u()):o.slice()},h.range=function(t){return arguments.length?(a=Array.from(t),u()):a.slice()},h.rangeRound=function(t){return a=Array.from(t),l=Wr,u()},h.clamp=function(t){return arguments.length?(c=!!t||o_,u()):c!==o_},h.interpolate=function(t){return arguments.length?(l=t,u()):l},h.unknown=function(t){return arguments.length?(n=t,h):n},function(n,r){return t=n,e=r,u()}}function f_(){return h_()(o_,o_)}function d_(t,e,n,r){var i,s=X(t,e,n);switch((r=zl(null==r?",f":r)).type){case"s":var o=Math.max(Math.abs(t),Math.abs(e));return null!=r.precision||isNaN(i=Jl(s,o))||(r.precision=i),Wl(r,o);case"":case"e":case"g":case"p":case"r":null!=r.precision||isNaN(i=Ql(s,Math.max(Math.abs(t),Math.abs(e))))||(r.precision=i-("e"===r.type));break;case"f":case"%":null!=r.precision||isNaN(i=Zl(s))||(r.precision=i-2*("%"===r.type))}return Hl(r)}function p_(t){var e=t.domain;return t.ticks=function(t){var n=e();return q(n[0],n[n.length-1],null==t?10:t)},t.tickFormat=function(t,n){var r=e();return d_(r[0],r[r.length-1],null==t?10:t,n)},t.nice=function(n){null==n&&(n=10);var r,i,s=e(),o=0,a=s.length-1,l=s[o],c=s[a],u=10;for(c<l&&(i=l,l=c,c=i,i=o,o=a,a=i);u-- >0;){if((i=$(l,c,n))===r)return s[o]=l,s[a]=c,e(s);if(i>0)l=Math.floor(l/i)*i,c=Math.ceil(c/i)*i;else{if(!(i<0))break;l=Math.ceil(l*i)/i,c=Math.floor(c*i)/i}r=i}return t},t}function __(){var t=f_();return t.copy=function(){return u_(t,__())},Zp.apply(t,arguments),p_(t)}function g_(t,e){var n,r=0,i=(t=t.slice()).length-1,s=t[r],o=t[i];return o<s&&(n=r,r=i,i=n,n=s,s=o,o=n),t[r]=e.floor(s),t[i]=e.ceil(o),t}function y_(t){return Math.log(t)}function m_(t){return Math.exp(t)}function b_(t){return-Math.log(-t)}function v_(t){return-Math.exp(-t)}function x_(t){return isFinite(t)?+("1e"+t):t<0?0:t}function w_(t){return(e,n)=>-t(-e,n)}function E_(t){const e=t(y_,m_),n=e.domain;let r,i,s=10;function o(){return r=function(t){return t===Math.E?Math.log:10===t&&Math.log10||2===t&&Math.log2||(t=Math.log(t),e=>Math.log(e)/t)}(s),i=function(t){return 10===t?x_:t===Math.E?Math.exp:e=>Math.pow(t,e)}(s),n()[0]<0?(r=w_(r),i=w_(i),t(b_,v_)):t(y_,m_),e}return e.base=function(t){return arguments.length?(s=+t,o()):s},e.domain=function(t){return arguments.length?(n(t),o()):n()},e.ticks=t=>{const e=n();let o=e[0],a=e[e.length-1];const l=a<o;l&&([o,a]=[a,o]);let c,u,h=r(o),f=r(a);const d=null==t?10:+t;let p=[];if(!(s%1)&&f-h<d){if(h=Math.floor(h),f=Math.ceil(f),o>0){for(;h<=f;++h)for(c=1;c<s;++c)if(u=h<0?c/i(-h):c*i(h),!(u<o)){if(u>a)break;p.push(u)}}else for(;h<=f;++h)for(c=s-1;c>=1;--c)if(u=h>0?c/i(-h):c*i(h),!(u<o)){if(u>a)break;p.push(u)}2*p.length<d&&(p=q(o,a,d))}else p=q(h,f,Math.min(f-h,d)).map(i);return l?p.reverse():p},e.tickFormat=(t,n)=>{if(null==t&&(t=10),null==n&&(n=10===s?"s":","),"function"!=typeof n&&(s%1||null!=(n=zl(n)).precision||(n.trim=!0),n=Hl(n)),t===1/0)return n;const o=Math.max(1,s*t/e.ticks().length);return t=>{let e=t/i(Math.round(r(t)));return e*s<s-.5&&(e*=s),e<=o?n(t):""}},e.nice=()=>n(g_(n(),{floor:t=>i(Math.floor(r(t))),ceil:t=>i(Math.ceil(r(t)))})),e}function A_(){const t=E_(h_()).domain([1,10]);return t.copy=()=>u_(t,A_()).base(t.base()),Zp.apply(t,arguments),t}function S_(t){return function(e){return Math.sign(e)*Math.log1p(Math.abs(e/t))}}function T_(t){return function(e){return Math.sign(e)*Math.expm1(Math.abs(e))*t}}function C_(t){var e=1,n=t(S_(e),T_(e));return n.constant=function(n){return arguments.length?t(S_(e=+n),T_(e)):e},p_(n)}function k_(t){return function(e){return e<0?-Math.pow(-e,t):Math.pow(e,t)}}function R_(t){return t<0?-Math.sqrt(-t):Math.sqrt(t)}function M_(t){return t<0?-t*t:t*t}function O_(t){var e=t(o_,o_),n=1;return e.exponent=function(e){return arguments.length?1===(n=+e)?t(o_,o_):.5===n?t(R_,M_):t(k_(n),k_(1/n)):n},p_(e)}function N_(){var t=O_(h_());return t.copy=function(){return u_(t,N_()).exponent(t.exponent())},Zp.apply(t,arguments),t}function I_(t){return Math.sign(t)*t*t}const P_=new Date,L_=new Date;function D_(t,e,n,r){function i(e){return t(e=0===arguments.length?new Date:new Date(+e)),e}return i.floor=e=>(t(e=new Date(+e)),e),i.ceil=n=>(t(n=new Date(n-1)),e(n,1),t(n),n),i.round=t=>{const e=i(t),n=i.ceil(t);return t-e<n-t?e:n},i.offset=(t,n)=>(e(t=new Date(+t),null==n?1:Math.floor(n)),t),i.range=(n,r,s)=>{const o=[];if(n=i.ceil(n),s=null==s?1:Math.floor(s),!(n<r&&s>0))return o;let a;do{o.push(a=new Date(+n)),e(n,s),t(n)}while(a<n&&n<r);return o},i.filter=n=>D_(e=>{if(e>=e)for(;t(e),!n(e);)e.setTime(e-1)},(t,r)=>{if(t>=t)if(r<0)for(;++r<=0;)for(;e(t,-1),!n(t););else for(;--r>=0;)for(;e(t,1),!n(t););}),n&&(i.count=(e,r)=>(P_.setTime(+e),L_.setTime(+r),t(P_),t(L_),Math.floor(n(P_,L_))),i.every=t=>(t=Math.floor(t),isFinite(t)&&t>0?t>1?i.filter(r?e=>r(e)%t===0:e=>i.count(0,e)%t===0):i:null)),i}const V_=D_(()=>{},(t,e)=>{t.setTime(+t+e)},(t,e)=>e-t);V_.every=t=>(t=Math.floor(t),isFinite(t)&&t>0?t>1?D_(e=>{e.setTime(Math.floor(e/t)*t)},(e,n)=>{e.setTime(+e+n*t)},(e,n)=>(n-e)/t):V_:null);const B_=V_.range,z_=1e3,F_=6e4,G_=36e5,j_=864e5,U_=6048e5,Y_=2592e6,H_=31536e6,W_=D_(t=>{t.setTime(t-t.getMilliseconds())},(t,e)=>{t.setTime(+t+e*z_)},(t,e)=>(e-t)/z_,t=>t.getUTCSeconds()),q_=W_.range,$_=D_(t=>{t.setTime(t-t.getMilliseconds()-t.getSeconds()*z_)},(t,e)=>{t.setTime(+t+e*F_)},(t,e)=>(e-t)/F_,t=>t.getMinutes()),X_=$_.range,K_=D_(t=>{t.setUTCSeconds(0,0)},(t,e)=>{t.setTime(+t+e*F_)},(t,e)=>(e-t)/F_,t=>t.getUTCMinutes()),Z_=K_.range,J_=D_(t=>{t.setTime(t-t.getMilliseconds()-t.getSeconds()*z_-t.getMinutes()*F_)},(t,e)=>{t.setTime(+t+e*G_)},(t,e)=>(e-t)/G_,t=>t.getHours()),Q_=J_.range,tg=D_(t=>{t.setUTCMinutes(0,0,0)},(t,e)=>{t.setTime(+t+e*G_)},(t,e)=>(e-t)/G_,t=>t.getUTCHours()),eg=tg.range,ng=D_(t=>t.setHours(0,0,0,0),(t,e)=>t.setDate(t.getDate()+e),(t,e)=>(e-t-(e.getTimezoneOffset()-t.getTimezoneOffset())*F_)/j_,t=>t.getDate()-1),rg=ng.range,ig=D_(t=>{t.setUTCHours(0,0,0,0)},(t,e)=>{t.setUTCDate(t.getUTCDate()+e)},(t,e)=>(e-t)/j_,t=>t.getUTCDate()-1),sg=ig.range,og=D_(t=>{t.setUTCHours(0,0,0,0)},(t,e)=>{t.setUTCDate(t.getUTCDate()+e)},(t,e)=>(e-t)/j_,t=>Math.floor(t/j_)),ag=og.range;function lg(t){return D_(e=>{e.setDate(e.getDate()-(e.getDay()+7-t)%7),e.setHours(0,0,0,0)},(t,e)=>{t.setDate(t.getDate()+7*e)},(t,e)=>(e-t-(e.getTimezoneOffset()-t.getTimezoneOffset())*F_)/U_)}const cg=lg(0),ug=lg(1),hg=lg(2),fg=lg(3),dg=lg(4),pg=lg(5),_g=lg(6),gg=cg.range,yg=ug.range,mg=hg.range,bg=fg.range,vg=dg.range,xg=pg.range,wg=_g.range;function Eg(t){return D_(e=>{e.setUTCDate(e.getUTCDate()-(e.getUTCDay()+7-t)%7),e.setUTCHours(0,0,0,0)},(t,e)=>{t.setUTCDate(t.getUTCDate()+7*e)},(t,e)=>(e-t)/U_)}const Ag=Eg(0),Sg=Eg(1),Tg=Eg(2),Cg=Eg(3),kg=Eg(4),Rg=Eg(5),Mg=Eg(6),Og=Ag.range,Ng=Sg.range,Ig=Tg.range,Pg=Cg.range,Lg=kg.range,Dg=Rg.range,Vg=Mg.range,Bg=D_(t=>{t.setDate(1),t.setHours(0,0,0,0)},(t,e)=>{t.setMonth(t.getMonth()+e)},(t,e)=>e.getMonth()-t.getMonth()+12*(e.getFullYear()-t.getFullYear()),t=>t.getMonth()),zg=Bg.range,Fg=D_(t=>{t.setUTCDate(1),t.setUTCHours(0,0,0,0)},(t,e)=>{t.setUTCMonth(t.getUTCMonth()+e)},(t,e)=>e.getUTCMonth()-t.getUTCMonth()+12*(e.getUTCFullYear()-t.getUTCFullYear()),t=>t.getUTCMonth()),Gg=Fg.range,jg=D_(t=>{t.setMonth(0,1),t.setHours(0,0,0,0)},(t,e)=>{t.setFullYear(t.getFullYear()+e)},(t,e)=>e.getFullYear()-t.getFullYear(),t=>t.getFullYear());jg.every=t=>isFinite(t=Math.floor(t))&&t>0?D_(e=>{e.setFullYear(Math.floor(e.getFullYear()/t)*t),e.setMonth(0,1),e.setHours(0,0,0,0)},(e,n)=>{e.setFullYear(e.getFullYear()+n*t)}):null;const Ug=jg.range,Yg=D_(t=>{t.setUTCMonth(0,1),t.setUTCHours(0,0,0,0)},(t,e)=>{t.setUTCFullYear(t.getUTCFullYear()+e)},(t,e)=>e.getUTCFullYear()-t.getUTCFullYear(),t=>t.getUTCFullYear());Yg.every=t=>isFinite(t=Math.floor(t))&&t>0?D_(e=>{e.setUTCFullYear(Math.floor(e.getUTCFullYear()/t)*t),e.setUTCMonth(0,1),e.setUTCHours(0,0,0,0)},(e,n)=>{e.setUTCFullYear(e.getUTCFullYear()+n*t)}):null;const Hg=Yg.range;function Wg(t,e,r,i,s,o){const a=[[W_,1,z_],[W_,5,5e3],[W_,15,15e3],[W_,30,3e4],[o,1,F_],[o,5,3e5],[o,15,9e5],[o,30,18e5],[s,1,G_],[s,3,108e5],[s,6,216e5],[s,12,432e5],[i,1,j_],[i,2,1728e5],[r,1,U_],[e,1,Y_],[e,3,7776e6],[t,1,H_]];function l(e,r,i){const s=Math.abs(r-e)/i,o=n(([,,t])=>t).right(a,s);if(o===a.length)return t.every(X(e/H_,r/H_,i));if(0===o)return V_.every(Math.max(X(e,r,i),1));const[l,c]=a[s/a[o-1][2]<a[o][2]/s?o-1:o];return l.every(c)}return[function(t,e,n){const r=e<t;r&&([t,e]=[e,t]);const i=n&&"function"==typeof n.range?n:l(t,e,n),s=i?i.range(t,+e+1):[];return r?s.reverse():s},l]}const[qg,$g]=Wg(Yg,Fg,Ag,og,tg,K_),[Xg,Kg]=Wg(jg,Bg,cg,ng,J_,$_);function Zg(t){if(0<=t.y&&t.y<100){var e=new Date(-1,t.m,t.d,t.H,t.M,t.S,t.L);return e.setFullYear(t.y),e}return new Date(t.y,t.m,t.d,t.H,t.M,t.S,t.L)}function Jg(t){if(0<=t.y&&t.y<100){var e=new Date(Date.UTC(-1,t.m,t.d,t.H,t.M,t.S,t.L));return e.setUTCFullYear(t.y),e}return new Date(Date.UTC(t.y,t.m,t.d,t.H,t.M,t.S,t.L))}function Qg(t,e,n){return{y:t,m:e,d:n,H:0,M:0,S:0,L:0}}function ty(t){var e=t.dateTime,n=t.date,r=t.time,i=t.periods,s=t.days,o=t.shortDays,a=t.months,l=t.shortMonths,c=fy(i),u=dy(i),h=fy(s),f=dy(s),d=fy(o),p=dy(o),_=fy(a),g=dy(a),y=fy(l),m=dy(l),b={a:function(t){return o[t.getDay()]},A:function(t){return s[t.getDay()]},b:function(t){return l[t.getMonth()]},B:function(t){return a[t.getMonth()]},c:null,d:Py,e:Py,f:zy,g:Ky,G:Jy,H:Ly,I:Dy,j:Vy,L:By,m:Fy,M:Gy,p:function(t){return i[+(t.getHours()>=12)]},q:function(t){return 1+~~(t.getMonth()/3)},Q:xm,s:wm,S:jy,u:Uy,U:Yy,V:Wy,w:qy,W:$y,x:null,X:null,y:Xy,Y:Zy,Z:Qy,"%":vm},v={a:function(t){return o[t.getUTCDay()]},A:function(t){return s[t.getUTCDay()]},b:function(t){return l[t.getUTCMonth()]},B:function(t){return a[t.getUTCMonth()]},c:null,d:tm,e:tm,f:sm,g:gm,G:mm,H:em,I:nm,j:rm,L:im,m:om,M:am,p:function(t){return i[+(t.getUTCHours()>=12)]},q:function(t){return 1+~~(t.getUTCMonth()/3)},Q:xm,s:wm,S:lm,u:cm,U:um,V:fm,w:dm,W:pm,x:null,X:null,y:_m,Y:ym,Z:bm,"%":vm},x={a:function(t,e,n){var r=d.exec(e.slice(n));return r?(t.w=p.get(r[0].toLowerCase()),n+r[0].length):-1},A:function(t,e,n){var r=h.exec(e.slice(n));return r?(t.w=f.get(r[0].toLowerCase()),n+r[0].length):-1},b:function(t,e,n){var r=y.exec(e.slice(n));return r?(t.m=m.get(r[0].toLowerCase()),n+r[0].length):-1},B:function(t,e,n){var r=_.exec(e.slice(n));return r?(t.m=g.get(r[0].toLowerCase()),n+r[0].length):-1},c:function(t,n,r){return A(t,e,n,r)},d:Ay,e:Ay,f:My,g:vy,G:by,H:Ty,I:Ty,j:Sy,L:Ry,m:Ey,M:Cy,p:function(t,e,n){var r=c.exec(e.slice(n));return r?(t.p=u.get(r[0].toLowerCase()),n+r[0].length):-1},q:wy,Q:Ny,s:Iy,S:ky,u:_y,U:gy,V:yy,w:py,W:my,x:function(t,e,r){return A(t,n,e,r)},X:function(t,e,n){return A(t,r,e,n)},y:vy,Y:by,Z:xy,"%":Oy};function w(t,e){return function(n){var r,i,s,o=[],a=-1,l=0,c=t.length;for(n instanceof Date||(n=new Date(+n));++a<c;)37===t.charCodeAt(a)&&(o.push(t.slice(l,a)),null!=(i=oy[r=t.charAt(++a)])?r=t.charAt(++a):i="e"===r?" ":"0",(s=e[r])&&(r=s(n,i)),o.push(r),l=a+1);return o.push(t.slice(l,a)),o.join("")}}function E(t,e){return function(n){var r,i,s=Qg(1900,void 0,1);if(A(s,t,n+="",0)!=n.length)return null;if("Q"in s)return new Date(s.Q);if("s"in s)return new Date(1e3*s.s+("L"in s?s.L:0));if(e&&!("Z"in s)&&(s.Z=0),"p"in s&&(s.H=s.H%12+12*s.p),void 0===s.m&&(s.m="q"in s?s.q:0),"V"in s){if(s.V<1||s.V>53)return null;"w"in s||(s.w=1),"Z"in s?(i=(r=Jg(Qg(s.y,0,1))).getUTCDay(),r=i>4||0===i?Sg.ceil(r):Sg(r),r=ig.offset(r,7*(s.V-1)),s.y=r.getUTCFullYear(),s.m=r.getUTCMonth(),s.d=r.getUTCDate()+(s.w+6)%7):(i=(r=Zg(Qg(s.y,0,1))).getDay(),r=i>4||0===i?ug.ceil(r):ug(r),r=ng.offset(r,7*(s.V-1)),s.y=r.getFullYear(),s.m=r.getMonth(),s.d=r.getDate()+(s.w+6)%7)}else("W"in s||"U"in s)&&("w"in s||(s.w="u"in s?s.u%7:"W"in s?1:0),i="Z"in s?Jg(Qg(s.y,0,1)).getUTCDay():Zg(Qg(s.y,0,1)).getDay(),s.m=0,s.d="W"in s?(s.w+6)%7+7*s.W-(i+5)%7:s.w+7*s.U-(i+6)%7);return"Z"in s?(s.H+=s.Z/100|0,s.M+=s.Z%100,Jg(s)):Zg(s)}}function A(t,e,n,r){for(var i,s,o=0,a=e.length,l=n.length;o<a;){if(r>=l)return-1;if(37===(i=e.charCodeAt(o++))){if(i=e.charAt(o++),!(s=x[i in oy?e.charAt(o++):i])||(r=s(t,n,r))<0)return-1}else if(i!=n.charCodeAt(r++))return-1}return r}return b.x=w(n,b),b.X=w(r,b),b.c=w(e,b),v.x=w(n,v),v.X=w(r,v),v.c=w(e,v),{format:function(t){var e=w(t+="",b);return e.toString=function(){return t},e},parse:function(t){var e=E(t+="",!1);return e.toString=function(){return t},e},utcFormat:function(t){var e=w(t+="",v);return e.toString=function(){return t},e},utcParse:function(t){var e=E(t+="",!0);return e.toString=function(){return t},e}}}var ey,ny,ry,iy,sy,oy={"-":"",_:" ",0:"0"},ay=/^\s*\d+/,ly=/^%/,cy=/[\\^$*+?|[\]().{}]/g;function uy(t,e,n){var r=t<0?"-":"",i=(r?-t:t)+"",s=i.length;return r+(s<n?new Array(n-s+1).join(e)+i:i)}function hy(t){return t.replace(cy,"\\$&")}function fy(t){return new RegExp("^(?:"+t.map(hy).join("|")+")","i")}function dy(t){return new Map(t.map((t,e)=>[t.toLowerCase(),e]))}function py(t,e,n){var r=ay.exec(e.slice(n,n+1));return r?(t.w=+r[0],n+r[0].length):-1}function _y(t,e,n){var r=ay.exec(e.slice(n,n+1));return r?(t.u=+r[0],n+r[0].length):-1}function gy(t,e,n){var r=ay.exec(e.slice(n,n+2));return r?(t.U=+r[0],n+r[0].length):-1}function yy(t,e,n){var r=ay.exec(e.slice(n,n+2));return r?(t.V=+r[0],n+r[0].length):-1}function my(t,e,n){var r=ay.exec(e.slice(n,n+2));return r?(t.W=+r[0],n+r[0].length):-1}function by(t,e,n){var r=ay.exec(e.slice(n,n+4));return r?(t.y=+r[0],n+r[0].length):-1}function vy(t,e,n){var r=ay.exec(e.slice(n,n+2));return r?(t.y=+r[0]+(+r[0]>68?1900:2e3),n+r[0].length):-1}function xy(t,e,n){var r=/^(Z)|([+-]\d\d)(?::?(\d\d))?/.exec(e.slice(n,n+6));return r?(t.Z=r[1]?0:-(r[2]+(r[3]||"00")),n+r[0].length):-1}function wy(t,e,n){var r=ay.exec(e.slice(n,n+1));return r?(t.q=3*r[0]-3,n+r[0].length):-1}function Ey(t,e,n){var r=ay.exec(e.slice(n,n+2));return r?(t.m=r[0]-1,n+r[0].length):-1}function Ay(t,e,n){var r=ay.exec(e.slice(n,n+2));return r?(t.d=+r[0],n+r[0].length):-1}function Sy(t,e,n){var r=ay.exec(e.slice(n,n+3));return r?(t.m=0,t.d=+r[0],n+r[0].length):-1}function Ty(t,e,n){var r=ay.exec(e.slice(n,n+2));return r?(t.H=+r[0],n+r[0].length):-1}function Cy(t,e,n){var r=ay.exec(e.slice(n,n+2));return r?(t.M=+r[0],n+r[0].length):-1}function ky(t,e,n){var r=ay.exec(e.slice(n,n+2));return r?(t.S=+r[0],n+r[0].length):-1}function Ry(t,e,n){var r=ay.exec(e.slice(n,n+3));return r?(t.L=+r[0],n+r[0].length):-1}function My(t,e,n){var r=ay.exec(e.slice(n,n+6));return r?(t.L=Math.floor(r[0]/1e3),n+r[0].length):-1}function Oy(t,e,n){var r=ly.exec(e.slice(n,n+1));return r?n+r[0].length:-1}function Ny(t,e,n){var r=ay.exec(e.slice(n));return r?(t.Q=+r[0],n+r[0].length):-1}function Iy(t,e,n){var r=ay.exec(e.slice(n));return r?(t.s=+r[0],n+r[0].length):-1}function Py(t,e){return uy(t.getDate(),e,2)}function Ly(t,e){return uy(t.getHours(),e,2)}function Dy(t,e){return uy(t.getHours()%12||12,e,2)}function Vy(t,e){return uy(1+ng.count(jg(t),t),e,3)}function By(t,e){return uy(t.getMilliseconds(),e,3)}function zy(t,e){return By(t,e)+"000"}function Fy(t,e){return uy(t.getMonth()+1,e,2)}function Gy(t,e){return uy(t.getMinutes(),e,2)}function jy(t,e){return uy(t.getSeconds(),e,2)}function Uy(t){var e=t.getDay();return 0===e?7:e}function Yy(t,e){return uy(cg.count(jg(t)-1,t),e,2)}function Hy(t){var e=t.getDay();return e>=4||0===e?dg(t):dg.ceil(t)}function Wy(t,e){return t=Hy(t),uy(dg.count(jg(t),t)+(4===jg(t).getDay()),e,2)}function qy(t){return t.getDay()}function $y(t,e){return uy(ug.count(jg(t)-1,t),e,2)}function Xy(t,e){return uy(t.getFullYear()%100,e,2)}function Ky(t,e){return uy((t=Hy(t)).getFullYear()%100,e,2)}function Zy(t,e){return uy(t.getFullYear()%1e4,e,4)}function Jy(t,e){var n=t.getDay();return uy((t=n>=4||0===n?dg(t):dg.ceil(t)).getFullYear()%1e4,e,4)}function Qy(t){var e=t.getTimezoneOffset();return(e>0?"-":(e*=-1,"+"))+uy(e/60|0,"0",2)+uy(e%60,"0",2)}function tm(t,e){return uy(t.getUTCDate(),e,2)}function em(t,e){return uy(t.getUTCHours(),e,2)}function nm(t,e){return uy(t.getUTCHours()%12||12,e,2)}function rm(t,e){return uy(1+ig.count(Yg(t),t),e,3)}function im(t,e){return uy(t.getUTCMilliseconds(),e,3)}function sm(t,e){return im(t,e)+"000"}function om(t,e){return uy(t.getUTCMonth()+1,e,2)}function am(t,e){return uy(t.getUTCMinutes(),e,2)}function lm(t,e){return uy(t.getUTCSeconds(),e,2)}function cm(t){var e=t.getUTCDay();return 0===e?7:e}function um(t,e){return uy(Ag.count(Yg(t)-1,t),e,2)}function hm(t){var e=t.getUTCDay();return e>=4||0===e?kg(t):kg.ceil(t)}function fm(t,e){return t=hm(t),uy(kg.count(Yg(t),t)+(4===Yg(t).getUTCDay()),e,2)}function dm(t){return t.getUTCDay()}function pm(t,e){return uy(Sg.count(Yg(t)-1,t),e,2)}function _m(t,e){return uy(t.getUTCFullYear()%100,e,2)}function gm(t,e){return uy((t=hm(t)).getUTCFullYear()%100,e,2)}function ym(t,e){return uy(t.getUTCFullYear()%1e4,e,4)}function mm(t,e){var n=t.getUTCDay();return uy((t=n>=4||0===n?kg(t):kg.ceil(t)).getUTCFullYear()%1e4,e,4)}function bm(){return"+0000"}function vm(){return"%"}function xm(t){return+t}function wm(t){return Math.floor(+t/1e3)}function Em(t){return ey=ty(t),ny=ey.format,ry=ey.parse,iy=ey.utcFormat,sy=ey.utcParse,ey}Em({dateTime:"%x, %X",date:"%-m/%-d/%Y",time:"%-I:%M:%S %p",periods:["AM","PM"],days:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],shortDays:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],months:["January","February","March","April","May","June","July","August","September","October","November","December"],shortMonths:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"]});var Am="%Y-%m-%dT%H:%M:%S.%LZ";var Sm=Date.prototype.toISOString?function(t){return t.toISOString()}:iy(Am);var Tm=+new Date("2000-01-01T00:00:00.000Z")?function(t){var e=new Date(t);return isNaN(e)?null:e}:sy(Am);function Cm(t){return new Date(t)}function km(t){return t instanceof Date?+t:+new Date(+t)}function Rm(t,e,n,r,i,s,o,a,l,c){var u=f_(),h=u.invert,f=u.domain,d=c(".%L"),p=c(":%S"),_=c("%I:%M"),g=c("%I %p"),y=c("%a %d"),m=c("%b %d"),b=c("%B"),v=c("%Y");function x(t){return(l(t)<t?d:a(t)<t?p:o(t)<t?_:s(t)<t?g:r(t)<t?i(t)<t?y:m:n(t)<t?b:v)(t)}return u.invert=function(t){return new Date(h(t))},u.domain=function(t){return arguments.length?f(Array.from(t,km)):f().map(Cm)},u.ticks=function(e){var n=f();return t(n[0],n[n.length-1],null==e?10:e)},u.tickFormat=function(t,e){return null==e?x:c(e)},u.nice=function(t){var n=f();return t&&"function"==typeof t.range||(t=e(n[0],n[n.length-1],null==t?10:t)),t?f(g_(n,t)):u},u.copy=function(){return u_(u,Rm(t,e,n,r,i,s,o,a,l,c))},u}function Mm(){return Zp.apply(Rm(Xg,Kg,jg,Bg,cg,ng,J_,$_,W_,ny).domain([new Date(2e3,0,1),new Date(2e3,0,2)]),arguments)}function Om(){var t,e,n,r,i,s=0,o=1,a=o_,l=!1;function c(e){return null==e||isNaN(e=+e)?i:a(0===n?.5:(e=(r(e)-t)*n,l?Math.max(0,Math.min(1,e)):e))}function u(t){return function(e){var n,r;return arguments.length?([n,r]=e,a=t(n,r),c):[a(0),a(1)]}}return c.domain=function(i){return arguments.length?([s,o]=i,t=r(s=+s),e=r(o=+o),n=t===e?0:1/(e-t),c):[s,o]},c.clamp=function(t){return arguments.length?(l=!!t,c):l},c.interpolator=function(t){return arguments.length?(a=t,c):a},c.range=u(Hr),c.rangeRound=u(Wr),c.unknown=function(t){return arguments.length?(i=t,c):i},function(i){return r=i,t=i(s),e=i(o),n=t===e?0:1/(e-t),c}}function Nm(t,e){return e.domain(t.domain()).interpolator(t.interpolator()).clamp(t.clamp()).unknown(t.unknown())}function Im(){var t=p_(Om()(o_));return t.copy=function(){return Nm(t,Im())},Jp.apply(t,arguments)}function Pm(){var t=O_(Om());return t.copy=function(){return Nm(t,Pm()).exponent(t.exponent())},Jp.apply(t,arguments)}function Lm(){var t,e,n,r,i,s,o,a=0,l=.5,c=1,u=1,h=o_,f=!1;function d(t){return isNaN(t=+t)?o:(t=.5+((t=+s(t))-e)*(u*t<u*e?r:i),h(f?Math.max(0,Math.min(1,t)):t))}function p(t){return function(e){var n,r,i;return arguments.length?([n,r,i]=e,h=hi(t,[n,r,i]),d):[h(0),h(.5),h(1)]}}return d.domain=function(o){return arguments.length?([a,l,c]=o,t=s(a=+a),e=s(l=+l),n=s(c=+c),r=t===e?0:.5/(e-t),i=e===n?0:.5/(n-e),u=e<t?-1:1,d):[a,l,c]},d.clamp=function(t){return arguments.length?(f=!!t,d):f},d.interpolator=function(t){return arguments.length?(h=t,d):h},d.range=p(Hr),d.rangeRound=p(Wr),d.unknown=function(t){return arguments.length?(o=t,d):o},function(o){return s=o,t=o(a),e=o(l),n=o(c),r=t===e?0:.5/(e-t),i=e===n?0:.5/(n-e),u=e<t?-1:1,d}}function Dm(){var t=O_(Lm());return t.copy=function(){return Nm(t,Dm()).exponent(t.exponent())},Jp.apply(t,arguments)}function Vm(t){for(var e=t.length/6|0,n=new Array(e),r=0;r<e;)n[r]="#"+t.slice(6*r,6*++r);return n}var Bm=Vm("1f77b4ff7f0e2ca02cd627289467bd8c564be377c27f7f7fbcbd2217becf"),zm=Vm("7fc97fbeaed4fdc086ffff99386cb0f0027fbf5b17666666"),Fm=Vm("1b9e77d95f027570b3e7298a66a61ee6ab02a6761d666666"),Gm=Vm("4269d0efb118ff725c6cc5b03ca951ff8ab7a463f297bbf59c6b4e9498a0"),jm=Vm("a6cee31f78b4b2df8a33a02cfb9a99e31a1cfdbf6fff7f00cab2d66a3d9affff99b15928"),Um=Vm("fbb4aeb3cde3ccebc5decbe4fed9a6ffffcce5d8bdfddaecf2f2f2"),Ym=Vm("b3e2cdfdcdaccbd5e8f4cae4e6f5c9fff2aef1e2cccccccc"),Hm=Vm("e41a1c377eb84daf4a984ea3ff7f00ffff33a65628f781bf999999"),Wm=Vm("66c2a5fc8d628da0cbe78ac3a6d854ffd92fe5c494b3b3b3"),qm=Vm("8dd3c7ffffb3bebadafb807280b1d3fdb462b3de69fccde5d9d9d9bc80bdccebc5ffed6f"),$m=Vm("4e79a7f28e2ce1575976b7b259a14fedc949af7aa1ff9da79c755fbab0ab"),Xm=t=>Pr(t[t.length-1]),Km=new Array(3).concat("d8b365f5f5f55ab4ac","a6611adfc27d80cdc1018571","a6611adfc27df5f5f580cdc1018571","8c510ad8b365f6e8c3c7eae55ab4ac01665e","8c510ad8b365f6e8c3f5f5f5c7eae55ab4ac01665e","8c510abf812ddfc27df6e8c3c7eae580cdc135978f01665e","8c510abf812ddfc27df6e8c3f5f5f5c7eae580cdc135978f01665e","5430058c510abf812ddfc27df6e8c3c7eae580cdc135978f01665e003c30","5430058c510abf812ddfc27df6e8c3f5f5f5c7eae580cdc135978f01665e003c30").map(Vm),Zm=Xm(Km),Jm=new Array(3).concat("af8dc3f7f7f77fbf7b","7b3294c2a5cfa6dba0008837","7b3294c2a5cff7f7f7a6dba0008837","762a83af8dc3e7d4e8d9f0d37fbf7b1b7837","762a83af8dc3e7d4e8f7f7f7d9f0d37fbf7b1b7837","762a839970abc2a5cfe7d4e8d9f0d3a6dba05aae611b7837","762a839970abc2a5cfe7d4e8f7f7f7d9f0d3a6dba05aae611b7837","40004b762a839970abc2a5cfe7d4e8d9f0d3a6dba05aae611b783700441b","40004b762a839970abc2a5cfe7d4e8f7f7f7d9f0d3a6dba05aae611b783700441b").map(Vm),Qm=Xm(Jm),tb=new Array(3).concat("e9a3c9f7f7f7a1d76a","d01c8bf1b6dab8e1864dac26","d01c8bf1b6daf7f7f7b8e1864dac26","c51b7de9a3c9fde0efe6f5d0a1d76a4d9221","c51b7de9a3c9fde0eff7f7f7e6f5d0a1d76a4d9221","c51b7dde77aef1b6dafde0efe6f5d0b8e1867fbc414d9221","c51b7dde77aef1b6dafde0eff7f7f7e6f5d0b8e1867fbc414d9221","8e0152c51b7dde77aef1b6dafde0efe6f5d0b8e1867fbc414d9221276419","8e0152c51b7dde77aef1b6dafde0eff7f7f7e6f5d0b8e1867fbc414d9221276419").map(Vm),eb=Xm(tb),nb=new Array(3).concat("998ec3f7f7f7f1a340","5e3c99b2abd2fdb863e66101","5e3c99b2abd2f7f7f7fdb863e66101","542788998ec3d8daebfee0b6f1a340b35806","542788998ec3d8daebf7f7f7fee0b6f1a340b35806","5427888073acb2abd2d8daebfee0b6fdb863e08214b35806","5427888073acb2abd2d8daebf7f7f7fee0b6fdb863e08214b35806","2d004b5427888073acb2abd2d8daebfee0b6fdb863e08214b358067f3b08","2d004b5427888073acb2abd2d8daebf7f7f7fee0b6fdb863e08214b358067f3b08").map(Vm),rb=Xm(nb),ib=new Array(3).concat("ef8a62f7f7f767a9cf","ca0020f4a58292c5de0571b0","ca0020f4a582f7f7f792c5de0571b0","b2182bef8a62fddbc7d1e5f067a9cf2166ac","b2182bef8a62fddbc7f7f7f7d1e5f067a9cf2166ac","b2182bd6604df4a582fddbc7d1e5f092c5de4393c32166ac","b2182bd6604df4a582fddbc7f7f7f7d1e5f092c5de4393c32166ac","67001fb2182bd6604df4a582fddbc7d1e5f092c5de4393c32166ac053061","67001fb2182bd6604df4a582fddbc7f7f7f7d1e5f092c5de4393c32166ac053061").map(Vm),sb=Xm(ib),ob=new Array(3).concat("ef8a62ffffff999999","ca0020f4a582bababa404040","ca0020f4a582ffffffbababa404040","b2182bef8a62fddbc7e0e0e09999994d4d4d","b2182bef8a62fddbc7ffffffe0e0e09999994d4d4d","b2182bd6604df4a582fddbc7e0e0e0bababa8787874d4d4d","b2182bd6604df4a582fddbc7ffffffe0e0e0bababa8787874d4d4d","67001fb2182bd6604df4a582fddbc7e0e0e0bababa8787874d4d4d1a1a1a","67001fb2182bd6604df4a582fddbc7ffffffe0e0e0bababa8787874d4d4d1a1a1a").map(Vm),ab=Xm(ob),lb=new Array(3).concat("fc8d59ffffbf91bfdb","d7191cfdae61abd9e92c7bb6","d7191cfdae61ffffbfabd9e92c7bb6","d73027fc8d59fee090e0f3f891bfdb4575b4","d73027fc8d59fee090ffffbfe0f3f891bfdb4575b4","d73027f46d43fdae61fee090e0f3f8abd9e974add14575b4","d73027f46d43fdae61fee090ffffbfe0f3f8abd9e974add14575b4","a50026d73027f46d43fdae61fee090e0f3f8abd9e974add14575b4313695","a50026d73027f46d43fdae61fee090ffffbfe0f3f8abd9e974add14575b4313695").map(Vm),cb=Xm(lb),ub=new Array(3).concat("fc8d59ffffbf91cf60","d7191cfdae61a6d96a1a9641","d7191cfdae61ffffbfa6d96a1a9641","d73027fc8d59fee08bd9ef8b91cf601a9850","d73027fc8d59fee08bffffbfd9ef8b91cf601a9850","d73027f46d43fdae61fee08bd9ef8ba6d96a66bd631a9850","d73027f46d43fdae61fee08bffffbfd9ef8ba6d96a66bd631a9850","a50026d73027f46d43fdae61fee08bd9ef8ba6d96a66bd631a9850006837","a50026d73027f46d43fdae61fee08bffffbfd9ef8ba6d96a66bd631a9850006837").map(Vm),hb=Xm(ub),fb=new Array(3).concat("fc8d59ffffbf99d594","d7191cfdae61abdda42b83ba","d7191cfdae61ffffbfabdda42b83ba","d53e4ffc8d59fee08be6f59899d5943288bd","d53e4ffc8d59fee08bffffbfe6f59899d5943288bd","d53e4ff46d43fdae61fee08be6f598abdda466c2a53288bd","d53e4ff46d43fdae61fee08bffffbfe6f598abdda466c2a53288bd","9e0142d53e4ff46d43fdae61fee08be6f598abdda466c2a53288bd5e4fa2","9e0142d53e4ff46d43fdae61fee08bffffbfe6f598abdda466c2a53288bd5e4fa2").map(Vm),db=Xm(fb),pb=new Array(3).concat("e5f5f999d8c92ca25f","edf8fbb2e2e266c2a4238b45","edf8fbb2e2e266c2a42ca25f006d2c","edf8fbccece699d8c966c2a42ca25f006d2c","edf8fbccece699d8c966c2a441ae76238b45005824","f7fcfde5f5f9ccece699d8c966c2a441ae76238b45005824","f7fcfde5f5f9ccece699d8c966c2a441ae76238b45006d2c00441b").map(Vm),_b=Xm(pb),gb=new Array(3).concat("e0ecf49ebcda8856a7","edf8fbb3cde38c96c688419d","edf8fbb3cde38c96c68856a7810f7c","edf8fbbfd3e69ebcda8c96c68856a7810f7c","edf8fbbfd3e69ebcda8c96c68c6bb188419d6e016b","f7fcfde0ecf4bfd3e69ebcda8c96c68c6bb188419d6e016b","f7fcfde0ecf4bfd3e69ebcda8c96c68c6bb188419d810f7c4d004b").map(Vm),yb=Xm(gb),mb=new Array(3).concat("e0f3dba8ddb543a2ca","f0f9e8bae4bc7bccc42b8cbe","f0f9e8bae4bc7bccc443a2ca0868ac","f0f9e8ccebc5a8ddb57bccc443a2ca0868ac","f0f9e8ccebc5a8ddb57bccc44eb3d32b8cbe08589e","f7fcf0e0f3dbccebc5a8ddb57bccc44eb3d32b8cbe08589e","f7fcf0e0f3dbccebc5a8ddb57bccc44eb3d32b8cbe0868ac084081").map(Vm),bb=Xm(mb),vb=new Array(3).concat("fee8c8fdbb84e34a33","fef0d9fdcc8afc8d59d7301f","fef0d9fdcc8afc8d59e34a33b30000","fef0d9fdd49efdbb84fc8d59e34a33b30000","fef0d9fdd49efdbb84fc8d59ef6548d7301f990000","fff7ecfee8c8fdd49efdbb84fc8d59ef6548d7301f990000","fff7ecfee8c8fdd49efdbb84fc8d59ef6548d7301fb300007f0000").map(Vm),xb=Xm(vb),wb=new Array(3).concat("ece2f0a6bddb1c9099","f6eff7bdc9e167a9cf02818a","f6eff7bdc9e167a9cf1c9099016c59","f6eff7d0d1e6a6bddb67a9cf1c9099016c59","f6eff7d0d1e6a6bddb67a9cf3690c002818a016450","fff7fbece2f0d0d1e6a6bddb67a9cf3690c002818a016450","fff7fbece2f0d0d1e6a6bddb67a9cf3690c002818a016c59014636").map(Vm),Eb=Xm(wb),Ab=new Array(3).concat("ece7f2a6bddb2b8cbe","f1eef6bdc9e174a9cf0570b0","f1eef6bdc9e174a9cf2b8cbe045a8d","f1eef6d0d1e6a6bddb74a9cf2b8cbe045a8d","f1eef6d0d1e6a6bddb74a9cf3690c00570b0034e7b","fff7fbece7f2d0d1e6a6bddb74a9cf3690c00570b0034e7b","fff7fbece7f2d0d1e6a6bddb74a9cf3690c00570b0045a8d023858").map(Vm),Sb=Xm(Ab),Tb=new Array(3).concat("e7e1efc994c7dd1c77","f1eef6d7b5d8df65b0ce1256","f1eef6d7b5d8df65b0dd1c77980043","f1eef6d4b9dac994c7df65b0dd1c77980043","f1eef6d4b9dac994c7df65b0e7298ace125691003f","f7f4f9e7e1efd4b9dac994c7df65b0e7298ace125691003f","f7f4f9e7e1efd4b9dac994c7df65b0e7298ace125698004367001f").map(Vm),Cb=Xm(Tb),kb=new Array(3).concat("fde0ddfa9fb5c51b8a","feebe2fbb4b9f768a1ae017e","feebe2fbb4b9f768a1c51b8a7a0177","feebe2fcc5c0fa9fb5f768a1c51b8a7a0177","feebe2fcc5c0fa9fb5f768a1dd3497ae017e7a0177","fff7f3fde0ddfcc5c0fa9fb5f768a1dd3497ae017e7a0177","fff7f3fde0ddfcc5c0fa9fb5f768a1dd3497ae017e7a017749006a").map(Vm),Rb=Xm(kb),Mb=new Array(3).concat("edf8b17fcdbb2c7fb8","ffffcca1dab441b6c4225ea8","ffffcca1dab441b6c42c7fb8253494","ffffccc7e9b47fcdbb41b6c42c7fb8253494","ffffccc7e9b47fcdbb41b6c41d91c0225ea80c2c84","ffffd9edf8b1c7e9b47fcdbb41b6c41d91c0225ea80c2c84","ffffd9edf8b1c7e9b47fcdbb41b6c41d91c0225ea8253494081d58").map(Vm),Ob=Xm(Mb),Nb=new Array(3).concat("f7fcb9addd8e31a354","ffffccc2e69978c679238443","ffffccc2e69978c67931a354006837","ffffccd9f0a3addd8e78c67931a354006837","ffffccd9f0a3addd8e78c67941ab5d238443005a32","ffffe5f7fcb9d9f0a3addd8e78c67941ab5d238443005a32","ffffe5f7fcb9d9f0a3addd8e78c67941ab5d238443006837004529").map(Vm),Ib=Xm(Nb),Pb=new Array(3).concat("fff7bcfec44fd95f0e","ffffd4fed98efe9929cc4c02","ffffd4fed98efe9929d95f0e993404","ffffd4fee391fec44ffe9929d95f0e993404","ffffd4fee391fec44ffe9929ec7014cc4c028c2d04","ffffe5fff7bcfee391fec44ffe9929ec7014cc4c028c2d04","ffffe5fff7bcfee391fec44ffe9929ec7014cc4c02993404662506").map(Vm),Lb=Xm(Pb),Db=new Array(3).concat("ffeda0feb24cf03b20","ffffb2fecc5cfd8d3ce31a1c","ffffb2fecc5cfd8d3cf03b20bd0026","ffffb2fed976feb24cfd8d3cf03b20bd0026","ffffb2fed976feb24cfd8d3cfc4e2ae31a1cb10026","ffffccffeda0fed976feb24cfd8d3cfc4e2ae31a1cb10026","ffffccffeda0fed976feb24cfd8d3cfc4e2ae31a1cbd0026800026").map(Vm),Vb=Xm(Db),Bb=new Array(3).concat("deebf79ecae13182bd","eff3ffbdd7e76baed62171b5","eff3ffbdd7e76baed63182bd08519c","eff3ffc6dbef9ecae16baed63182bd08519c","eff3ffc6dbef9ecae16baed64292c62171b5084594","f7fbffdeebf7c6dbef9ecae16baed64292c62171b5084594","f7fbffdeebf7c6dbef9ecae16baed64292c62171b508519c08306b").map(Vm),zb=Xm(Bb),Fb=new Array(3).concat("e5f5e0a1d99b31a354","edf8e9bae4b374c476238b45","edf8e9bae4b374c47631a354006d2c","edf8e9c7e9c0a1d99b74c47631a354006d2c","edf8e9c7e9c0a1d99b74c47641ab5d238b45005a32","f7fcf5e5f5e0c7e9c0a1d99b74c47641ab5d238b45005a32","f7fcf5e5f5e0c7e9c0a1d99b74c47641ab5d238b45006d2c00441b").map(Vm),Gb=Xm(Fb),jb=new Array(3).concat("f0f0f0bdbdbd636363","f7f7f7cccccc969696525252","f7f7f7cccccc969696636363252525","f7f7f7d9d9d9bdbdbd969696636363252525","f7f7f7d9d9d9bdbdbd969696737373525252252525","fffffff0f0f0d9d9d9bdbdbd969696737373525252252525","fffffff0f0f0d9d9d9bdbdbd969696737373525252252525000000").map(Vm),Ub=Xm(jb),Yb=new Array(3).concat("efedf5bcbddc756bb1","f2f0f7cbc9e29e9ac86a51a3","f2f0f7cbc9e29e9ac8756bb154278f","f2f0f7dadaebbcbddc9e9ac8756bb154278f","f2f0f7dadaebbcbddc9e9ac8807dba6a51a34a1486","fcfbfdefedf5dadaebbcbddc9e9ac8807dba6a51a34a1486","fcfbfdefedf5dadaebbcbddc9e9ac8807dba6a51a354278f3f007d").map(Vm),Hb=Xm(Yb),Wb=new Array(3).concat("fee0d2fc9272de2d26","fee5d9fcae91fb6a4acb181d","fee5d9fcae91fb6a4ade2d26a50f15","fee5d9fcbba1fc9272fb6a4ade2d26a50f15","fee5d9fcbba1fc9272fb6a4aef3b2ccb181d99000d","fff5f0fee0d2fcbba1fc9272fb6a4aef3b2ccb181d99000d","fff5f0fee0d2fcbba1fc9272fb6a4aef3b2ccb181da50f1567000d").map(Vm),qb=Xm(Wb),$b=new Array(3).concat("fee6cefdae6be6550d","feeddefdbe85fd8d3cd94701","feeddefdbe85fd8d3ce6550da63603","feeddefdd0a2fdae6bfd8d3ce6550da63603","feeddefdd0a2fdae6bfd8d3cf16913d948018c2d04","fff5ebfee6cefdd0a2fdae6bfd8d3cf16913d948018c2d04","fff5ebfee6cefdd0a2fdae6bfd8d3cf16913d94801a636037f2704").map(Vm),Xb=Xm($b);var Kb=ui(wr(300,.5,0),wr(-240,.5,1)),Zb=ui(wr(-100,.75,.35),wr(80,1.5,.8)),Jb=ui(wr(260,.75,.35),wr(80,1.5,.8)),Qb=wr();var tv=Ln(),ev=Math.PI/3,nv=2*Math.PI/3;function rv(t){return t=Math.max(0,Math.min(1,t)),"rgb("+Math.max(0,Math.min(255,Math.round(34.61+t*(1172.33-t*(10793.56-t*(33300.12-t*(38394.49-14825.05*t)))))))+", "+Math.max(0,Math.min(255,Math.round(23.31+t*(557.33+t*(1225.33-t*(3574.96-t*(1073.77+707.56*t)))))))+", "+Math.max(0,Math.min(255,Math.round(27.2+t*(3211.1-t*(15327.97-t*(27814-t*(22569.18-6838.66*t)))))))+")"}function iv(t){var e=t.length;return function(n){return t[Math.max(0,Math.min(e-1,Math.floor(n*e)))]}}var sv=iv(Vm("44015444025645045745055946075a46085c460a5d460b5e470d60470e6147106347116447136548146748166848176948186a481a6c481b6d481c6e481d6f481f70482071482173482374482475482576482677482878482979472a7a472c7a472d7b472e7c472f7d46307e46327e46337f463480453581453781453882443983443a83443b84433d84433e85423f854240864241864142874144874045884046883f47883f48893e49893e4a893e4c8a3d4d8a3d4e8a3c4f8a3c508b3b518b3b528b3a538b3a548c39558c39568c38588c38598c375a8c375b8d365c8d365d8d355e8d355f8d34608d34618d33628d33638d32648e32658e31668e31678e31688e30698e306a8e2f6b8e2f6c8e2e6d8e2e6e8e2e6f8e2d708e2d718e2c718e2c728e2c738e2b748e2b758e2a768e2a778e2a788e29798e297a8e297b8e287c8e287d8e277e8e277f8e27808e26818e26828e26828e25838e25848e25858e24868e24878e23888e23898e238a8d228b8d228c8d228d8d218e8d218f8d21908d21918c20928c20928c20938c1f948c1f958b1f968b1f978b1f988b1f998a1f9a8a1e9b8a1e9c891e9d891f9e891f9f881fa0881fa1881fa1871fa28720a38620a48621a58521a68522a78522a88423a98324aa8325ab8225ac8226ad8127ad8128ae8029af7f2ab07f2cb17e2db27d2eb37c2fb47c31b57b32b67a34b67935b77937b87838b9773aba763bbb753dbc743fbc7340bd7242be7144bf7046c06f48c16e4ac16d4cc26c4ec36b50c46a52c56954c56856c66758c7655ac8645cc8635ec96260ca6063cb5f65cb5e67cc5c69cd5b6ccd5a6ece5870cf5773d05675d05477d1537ad1517cd2507fd34e81d34d84d44b86d54989d5488bd6468ed64590d74393d74195d84098d83e9bd93c9dd93ba0da39a2da37a5db36a8db34aadc32addc30b0dd2fb2dd2db5de2bb8de29bade28bddf26c0df25c2df23c5e021c8e020cae11fcde11dd0e11cd2e21bd5e21ad8e219dae319dde318dfe318e2e418e5e419e7e419eae51aece51befe51cf1e51df4e61ef6e620f8e621fbe723fde725")),ov=iv(Vm("00000401000501010601010802010902020b02020d03030f03031204041405041606051806051a07061c08071e0907200a08220b09240c09260d0a290e0b2b100b2d110c2f120d31130d34140e36150e38160f3b180f3d19103f1a10421c10441d11471e114920114b21114e22115024125325125527125829115a2a115c2c115f2d11612f116331116533106734106936106b38106c390f6e3b0f703d0f713f0f72400f74420f75440f764510774710784910784a10794c117a4e117b4f127b51127c52137c54137d56147d57157e59157e5a167e5c167f5d177f5f187f601880621980641a80651a80671b80681c816a1c816b1d816d1d816e1e81701f81721f817320817521817621817822817922827b23827c23827e24828025828125818326818426818627818827818928818b29818c29818e2a81902a81912b81932b80942c80962c80982d80992d809b2e7f9c2e7f9e2f7fa02f7fa1307ea3307ea5317ea6317da8327daa337dab337cad347cae347bb0357bb2357bb3367ab5367ab73779b83779ba3878bc3978bd3977bf3a77c03a76c23b75c43c75c53c74c73d73c83e73ca3e72cc3f71cd4071cf4070d0416fd2426fd3436ed5446dd6456cd8456cd9466bdb476adc4869de4968df4a68e04c67e24d66e34e65e44f64e55064e75263e85362e95462ea5661eb5760ec5860ed5a5fee5b5eef5d5ef05f5ef1605df2625df2645cf3655cf4675cf4695cf56b5cf66c5cf66e5cf7705cf7725cf8745cf8765cf9785df9795df97b5dfa7d5efa7f5efa815ffb835ffb8560fb8761fc8961fc8a62fc8c63fc8e64fc9065fd9266fd9467fd9668fd9869fd9a6afd9b6bfe9d6cfe9f6dfea16efea36ffea571fea772fea973feaa74feac76feae77feb078feb27afeb47bfeb67cfeb77efeb97ffebb81febd82febf84fec185fec287fec488fec68afec88cfeca8dfecc8ffecd90fecf92fed194fed395fed597fed799fed89afdda9cfddc9efddea0fde0a1fde2a3fde3a5fde5a7fde7a9fde9aafdebacfcecaefceeb0fcf0b2fcf2b4fcf4b6fcf6b8fcf7b9fcf9bbfcfbbdfcfdbf")),av=iv(Vm("00000401000501010601010802010a02020c02020e03021004031204031405041706041907051b08051d09061f0a07220b07240c08260d08290e092b10092d110a30120a32140b34150b37160b39180c3c190c3e1b0c411c0c431e0c451f0c48210c4a230c4c240c4f260c51280b53290b552b0b572d0b592f0a5b310a5c320a5e340a5f3609613809623909633b09643d09653e0966400a67420a68440a68450a69470b6a490b6a4a0c6b4c0c6b4d0d6c4f0d6c510e6c520e6d540f6d550f6d57106e59106e5a116e5c126e5d126e5f136e61136e62146e64156e65156e67166e69166e6a176e6c186e6d186e6f196e71196e721a6e741a6e751b6e771c6d781c6d7a1d6d7c1d6d7d1e6d7f1e6c801f6c82206c84206b85216b87216b88226a8a226a8c23698d23698f24699025689225689326679526679727669827669a28659b29649d29649f2a63a02a63a22b62a32c61a52c60a62d60a82e5fa92e5eab2f5ead305dae305cb0315bb1325ab3325ab43359b63458b73557b93556ba3655bc3754bd3853bf3952c03a51c13a50c33b4fc43c4ec63d4dc73e4cc83f4bca404acb4149cc4248ce4347cf4446d04545d24644d34743d44842d54a41d74b3fd84c3ed94d3dda4e3cdb503bdd513ade5238df5337e05536e15635e25734e35933e45a31e55c30e65d2fe75e2ee8602de9612bea632aeb6429eb6628ec6726ed6925ee6a24ef6c23ef6e21f06f20f1711ff1731df2741cf3761bf37819f47918f57b17f57d15f67e14f68013f78212f78410f8850ff8870ef8890cf98b0bf98c0af98e09fa9008fa9207fa9407fb9606fb9706fb9906fb9b06fb9d07fc9f07fca108fca309fca50afca60cfca80dfcaa0ffcac11fcae12fcb014fcb216fcb418fbb61afbb81dfbba1ffbbc21fbbe23fac026fac228fac42afac62df9c72ff9c932f9cb35f8cd37f8cf3af7d13df7d340f6d543f6d746f5d949f5db4cf4dd4ff4df53f4e156f3e35af3e55df2e661f2e865f2ea69f1ec6df1ed71f1ef75f1f179f2f27df2f482f3f586f3f68af4f88ef5f992f6fa96f8fb9af9fc9dfafda1fcffa4")),lv=iv(Vm("0d088710078813078916078a19068c1b068d1d068e20068f2206902406912605912805922a05932c05942e05952f059631059733059735049837049938049a3a049a3c049b3e049c3f049c41049d43039e44039e46039f48039f4903a04b03a14c02a14e02a25002a25102a35302a35502a45601a45801a45901a55b01a55c01a65e01a66001a66100a76300a76400a76600a76700a86900a86a00a86c00a86e00a86f00a87100a87201a87401a87501a87701a87801a87a02a87b02a87d03a87e03a88004a88104a78305a78405a78606a68707a68808a68a09a58b0aa58d0ba58e0ca48f0da4910ea3920fa39410a29511a19613a19814a099159f9a169f9c179e9d189d9e199da01a9ca11b9ba21d9aa31e9aa51f99a62098a72197a82296aa2395ab2494ac2694ad2793ae2892b02991b12a90b22b8fb32c8eb42e8db52f8cb6308bb7318ab83289ba3388bb3488bc3587bd3786be3885bf3984c03a83c13b82c23c81c33d80c43e7fc5407ec6417dc7427cc8437bc9447aca457acb4679cc4778cc4977cd4a76ce4b75cf4c74d04d73d14e72d24f71d35171d45270d5536fd5546ed6556dd7566cd8576bd9586ada5a6ada5b69db5c68dc5d67dd5e66de5f65de6164df6263e06363e16462e26561e26660e3685fe4695ee56a5de56b5de66c5ce76e5be76f5ae87059e97158e97257ea7457eb7556eb7655ec7754ed7953ed7a52ee7b51ef7c51ef7e50f07f4ff0804ef1814df1834cf2844bf3854bf3874af48849f48948f58b47f58c46f68d45f68f44f79044f79143f79342f89441f89540f9973ff9983ef99a3efa9b3dfa9c3cfa9e3bfb9f3afba139fba238fca338fca537fca636fca835fca934fdab33fdac33fdae32fdaf31fdb130fdb22ffdb42ffdb52efeb72dfeb82cfeba2cfebb2bfebd2afebe2afec029fdc229fdc328fdc527fdc627fdc827fdca26fdcb26fccd25fcce25fcd025fcd225fbd324fbd524fbd724fad824fada24f9dc24f9dd25f8df25f8e125f7e225f7e425f6e626f6e826f5e926f5eb27f4ed27f3ee27f3f027f2f227f1f426f1f525f0f724f0f921"));function cv(t){return function(){return t}}const uv=Math.abs,hv=Math.atan2,fv=Math.cos,dv=Math.max,pv=Math.min,_v=Math.sin,gv=Math.sqrt,yv=1e-12,mv=Math.PI,bv=mv/2,vv=2*mv;function xv(t){return t>=1?bv:t<=-1?-bv:Math.asin(t)}function wv(t){let e=3;return t.digits=function(n){if(!arguments.length)return e;if(null==n)e=null;else{const t=Math.floor(n);if(!(t>=0))throw new RangeError(`invalid digits: ${n}`);e=t}return t},()=>new So(e)}function Ev(t){return t.innerRadius}function Av(t){return t.outerRadius}function Sv(t){return t.startAngle}function Tv(t){return t.endAngle}function Cv(t){return t&&t.padAngle}function kv(t,e,n,r,i,s,o){var a=t-n,l=e-r,c=(o?s:-s)/gv(a*a+l*l),u=c*l,h=-c*a,f=t+u,d=e+h,p=n+u,_=r+h,g=(f+p)/2,y=(d+_)/2,m=p-f,b=_-d,v=m*m+b*b,x=i-s,w=f*_-p*d,E=(b<0?-1:1)*gv(dv(0,x*x*v-w*w)),A=(w*b-m*E)/v,S=(-w*m-b*E)/v,T=(w*b+m*E)/v,C=(-w*m+b*E)/v,k=A-g,R=S-y,M=T-g,O=C-y;return k*k+R*R>M*M+O*O&&(A=T,S=C),{cx:A,cy:S,x01:-u,y01:-h,x11:A*(i/x-1),y11:S*(i/x-1)}}var Rv=Array.prototype.slice;function Mv(t){return"object"==typeof t&&"length"in t?t:Array.from(t)}function Ov(t){this._context=t}function Nv(t){return new Ov(t)}function Iv(t){return t[0]}function Pv(t){return t[1]}function Lv(t,e){var n=cv(!0),r=null,i=Nv,s=null,o=wv(a);function a(a){var l,c,u,h=(a=Mv(a)).length,f=!1;for(null==r&&(s=i(u=o())),l=0;l<=h;++l)!(l<h&&n(c=a[l],l,a))===f&&((f=!f)?s.lineStart():s.lineEnd()),f&&s.point(+t(c,l,a),+e(c,l,a));if(u)return s=null,u+""||null}return t="function"==typeof t?t:void 0===t?Iv:cv(t),e="function"==typeof e?e:void 0===e?Pv:cv(e),a.x=function(e){return arguments.length?(t="function"==typeof e?e:cv(+e),a):t},a.y=function(t){return arguments.length?(e="function"==typeof t?t:cv(+t),a):e},a.defined=function(t){return arguments.length?(n="function"==typeof t?t:cv(!!t),a):n},a.curve=function(t){return arguments.length?(i=t,null!=r&&(s=i(r)),a):i},a.context=function(t){return arguments.length?(null==t?r=s=null:s=i(r=t),a):r},a}function Dv(t,e,n){var r=null,i=cv(!0),s=null,o=Nv,a=null,l=wv(c);function c(c){var u,h,f,d,p,_=(c=Mv(c)).length,g=!1,y=new Array(_),m=new Array(_);for(null==s&&(a=o(p=l())),u=0;u<=_;++u){if(!(u<_&&i(d=c[u],u,c))===g)if(g=!g)h=u,a.areaStart(),a.lineStart();else{for(a.lineEnd(),a.lineStart(),f=u-1;f>=h;--f)a.point(y[f],m[f]);a.lineEnd(),a.areaEnd()}g&&(y[u]=+t(d,u,c),m[u]=+e(d,u,c),a.point(r?+r(d,u,c):y[u],n?+n(d,u,c):m[u]))}if(p)return a=null,p+""||null}function u(){return Lv().defined(i).curve(o).context(s)}return t="function"==typeof t?t:void 0===t?Iv:cv(+t),e="function"==typeof e?e:cv(void 0===e?0:+e),n="function"==typeof n?n:void 0===n?Pv:cv(+n),c.x=function(e){return arguments.length?(t="function"==typeof e?e:cv(+e),r=null,c):t},c.x0=function(e){return arguments.length?(t="function"==typeof e?e:cv(+e),c):t},c.x1=function(t){return arguments.length?(r=null==t?null:"function"==typeof t?t:cv(+t),c):r},c.y=function(t){return arguments.length?(e="function"==typeof t?t:cv(+t),n=null,c):e},c.y0=function(t){return arguments.length?(e="function"==typeof t?t:cv(+t),c):e},c.y1=function(t){return arguments.length?(n=null==t?null:"function"==typeof t?t:cv(+t),c):n},c.lineX0=c.lineY0=function(){return u().x(t).y(e)},c.lineY1=function(){return u().x(t).y(n)},c.lineX1=function(){return u().x(r).y(e)},c.defined=function(t){return arguments.length?(i="function"==typeof t?t:cv(!!t),c):i},c.curve=function(t){return arguments.length?(o=t,null!=s&&(a=o(s)),c):o},c.context=function(t){return arguments.length?(null==t?s=a=null:a=o(s=t),c):s},c}function Vv(t,e){return e<t?-1:e>t?1:e>=t?0:NaN}function Bv(t){return t}Ov.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._point=0},lineEnd:function(){(this._line||0!==this._line&&1===this._point)&&this._context.closePath(),this._line=1-this._line},point:function(t,e){switch(t=+t,e=+e,this._point){case 0:this._point=1,this._line?this._context.lineTo(t,e):this._context.moveTo(t,e);break;case 1:this._point=2;default:this._context.lineTo(t,e)}}};var zv=Gv(Nv);function Fv(t){this._curve=t}function Gv(t){function e(e){return new Fv(t(e))}return e._curve=t,e}function jv(t){var e=t.curve;return t.angle=t.x,delete t.x,t.radius=t.y,delete t.y,t.curve=function(t){return arguments.length?e(Gv(t)):e()._curve},t}function Uv(){return jv(Lv().curve(zv))}function Yv(){var t=Dv().curve(zv),e=t.curve,n=t.lineX0,r=t.lineX1,i=t.lineY0,s=t.lineY1;return t.angle=t.x,delete t.x,t.startAngle=t.x0,delete t.x0,t.endAngle=t.x1,delete t.x1,t.radius=t.y,delete t.y,t.innerRadius=t.y0,delete t.y0,t.outerRadius=t.y1,delete t.y1,t.lineStartAngle=function(){return jv(n())},delete t.lineX0,t.lineEndAngle=function(){return jv(r())},delete t.lineX1,t.lineInnerRadius=function(){return jv(i())},delete t.lineY0,t.lineOuterRadius=function(){return jv(s())},delete t.lineY1,t.curve=function(t){return arguments.length?e(Gv(t)):e()._curve},t}function Hv(t,e){return[(e=+e)*Math.cos(t-=Math.PI/2),e*Math.sin(t)]}Fv.prototype={areaStart:function(){this._curve.areaStart()},areaEnd:function(){this._curve.areaEnd()},lineStart:function(){this._curve.lineStart()},lineEnd:function(){this._curve.lineEnd()},point:function(t,e){this._curve.point(e*Math.sin(t),e*-Math.cos(t))}};class Wv{constructor(t,e){this._context=t,this._x=e}areaStart(){this._line=0}areaEnd(){this._line=NaN}lineStart(){this._point=0}lineEnd(){(this._line||0!==this._line&&1===this._point)&&this._context.closePath(),this._line=1-this._line}point(t,e){switch(t=+t,e=+e,this._point){case 0:this._point=1,this._line?this._context.lineTo(t,e):this._context.moveTo(t,e);break;case 1:this._point=2;default:this._x?this._context.bezierCurveTo(this._x0=(this._x0+t)/2,this._y0,this._x0,e,t,e):this._context.bezierCurveTo(this._x0,this._y0=(this._y0+e)/2,t,this._y0,t,e)}this._x0=t,this._y0=e}}class qv{constructor(t){this._context=t}lineStart(){this._point=0}lineEnd(){}point(t,e){if(t=+t,e=+e,0===this._point)this._point=1;else{const n=Hv(this._x0,this._y0),r=Hv(this._x0,this._y0=(this._y0+e)/2),i=Hv(t,this._y0),s=Hv(t,e);this._context.moveTo(...n),this._context.bezierCurveTo(...r,...i,...s)}this._x0=t,this._y0=e}}function $v(t){return new Wv(t,!0)}function Xv(t){return new Wv(t,!1)}function Kv(t){return new qv(t)}function Zv(t){return t.source}function Jv(t){return t.target}function Qv(t){let e=Zv,n=Jv,r=Iv,i=Pv,s=null,o=null,a=wv(l);function l(){let l;const c=Rv.call(arguments),u=e.apply(this,c),h=n.apply(this,c);if(null==s&&(o=t(l=a())),o.lineStart(),c[0]=u,o.point(+r.apply(this,c),+i.apply(this,c)),c[0]=h,o.point(+r.apply(this,c),+i.apply(this,c)),o.lineEnd(),l)return o=null,l+""||null}return l.source=function(t){return arguments.length?(e=t,l):e},l.target=function(t){return arguments.length?(n=t,l):n},l.x=function(t){return arguments.length?(r="function"==typeof t?t:cv(+t),l):r},l.y=function(t){return arguments.length?(i="function"==typeof t?t:cv(+t),l):i},l.context=function(e){return arguments.length?(null==e?s=o=null:o=t(s=e),l):s},l}function tx(){return Qv($v)}function ex(){return Qv(Xv)}function nx(){const t=Qv(Kv);return t.angle=t.x,delete t.x,t.radius=t.y,delete t.y,t}const rx=gv(3);var ix={draw(t,e){const n=.59436*gv(e+pv(e/28,.75)),r=n/2,i=r*rx;t.moveTo(0,n),t.lineTo(0,-n),t.moveTo(-i,-r),t.lineTo(i,r),t.moveTo(-i,r),t.lineTo(i,-r)}},sx={draw(t,e){const n=gv(e/mv);t.moveTo(n,0),t.arc(0,0,n,0,vv)}},ox={draw(t,e){const n=gv(e/5)/2;t.moveTo(-3*n,-n),t.lineTo(-n,-n),t.lineTo(-n,-3*n),t.lineTo(n,-3*n),t.lineTo(n,-n),t.lineTo(3*n,-n),t.lineTo(3*n,n),t.lineTo(n,n),t.lineTo(n,3*n),t.lineTo(-n,3*n),t.lineTo(-n,n),t.lineTo(-3*n,n),t.closePath()}};const ax=gv(1/3),lx=2*ax;var cx={draw(t,e){const n=gv(e/lx),r=n*ax;t.moveTo(0,-n),t.lineTo(r,0),t.lineTo(0,n),t.lineTo(-r,0),t.closePath()}},ux={draw(t,e){const n=.62625*gv(e);t.moveTo(0,-n),t.lineTo(n,0),t.lineTo(0,n),t.lineTo(-n,0),t.closePath()}},hx={draw(t,e){const n=.87559*gv(e-pv(e/7,2));t.moveTo(-n,0),t.lineTo(n,0),t.moveTo(0,n),t.lineTo(0,-n)}},fx={draw(t,e){const n=gv(e),r=-n/2;t.rect(r,r,n,n)}},dx={draw(t,e){const n=.4431*gv(e);t.moveTo(n,n),t.lineTo(n,-n),t.lineTo(-n,-n),t.lineTo(-n,n),t.closePath()}};const px=_v(mv/10)/_v(7*mv/10),_x=_v(vv/10)*px,gx=-fv(vv/10)*px;var yx={draw(t,e){const n=gv(.8908130915292852*e),r=_x*n,i=gx*n;t.moveTo(0,-n),t.lineTo(r,i);for(let e=1;e<5;++e){const s=vv*e/5,o=fv(s),a=_v(s);t.lineTo(a*n,-o*n),t.lineTo(o*r-a*i,a*r+o*i)}t.closePath()}};const mx=gv(3);var bx={draw(t,e){const n=-gv(e/(3*mx));t.moveTo(0,2*n),t.lineTo(-mx*n,-n),t.lineTo(mx*n,-n),t.closePath()}};const vx=gv(3);var xx={draw(t,e){const n=.6824*gv(e),r=n/2,i=n*vx/2;t.moveTo(0,-n),t.lineTo(i,r),t.lineTo(-i,r),t.closePath()}};const wx=-.5,Ex=gv(3)/2,Ax=1/gv(12),Sx=3*(Ax/2+1);var Tx={draw(t,e){const n=gv(e/Sx),r=n/2,i=n*Ax,s=r,o=n*Ax+n,a=-s,l=o;t.moveTo(r,i),t.lineTo(s,o),t.lineTo(a,l),t.lineTo(wx*r-Ex*i,Ex*r+wx*i),t.lineTo(wx*s-Ex*o,Ex*s+wx*o),t.lineTo(wx*a-Ex*l,Ex*a+wx*l),t.lineTo(wx*r+Ex*i,wx*i-Ex*r),t.lineTo(wx*s+Ex*o,wx*o-Ex*s),t.lineTo(wx*a+Ex*l,wx*l-Ex*a),t.closePath()}},Cx={draw(t,e){const n=.6189*gv(e-pv(e/6,1.7));t.moveTo(-n,-n),t.lineTo(n,n),t.moveTo(-n,n),t.lineTo(n,-n)}};const kx=[sx,ox,cx,fx,yx,bx,Tx],Rx=[sx,hx,Cx,xx,ix,dx,ux];function Mx(){}function Ox(t,e,n){t._context.bezierCurveTo((2*t._x0+t._x1)/3,(2*t._y0+t._y1)/3,(t._x0+2*t._x1)/3,(t._y0+2*t._y1)/3,(t._x0+4*t._x1+e)/6,(t._y0+4*t._y1+n)/6)}function Nx(t){this._context=t}function Ix(t){return new Nx(t)}function Px(t){this._context=t}function Lx(t){this._context=t}function Dx(t,e){this._basis=new Nx(t),this._beta=e}Nx.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:Ox(this,this._x1,this._y1);case 2:this._context.lineTo(this._x1,this._y1)}(this._line||0!==this._line&&1===this._point)&&this._context.closePath(),this._line=1-this._line},point:function(t,e){switch(t=+t,e=+e,this._point){case 0:this._point=1,this._line?this._context.lineTo(t,e):this._context.moveTo(t,e);break;case 1:this._point=2;break;case 2:this._point=3,this._context.lineTo((5*this._x0+this._x1)/6,(5*this._y0+this._y1)/6);default:Ox(this,t,e)}this._x0=this._x1,this._x1=t,this._y0=this._y1,this._y1=e}},Px.prototype={areaStart:Mx,areaEnd:Mx,lineStart:function(){this._x0=this._x1=this._x2=this._x3=this._x4=this._y0=this._y1=this._y2=this._y3=this._y4=NaN,this._point=0},lineEnd:function(){switch(this._point){case 1:this._context.moveTo(this._x2,this._y2),this._context.closePath();break;case 2:this._context.moveTo((this._x2+2*this._x3)/3,(this._y2+2*this._y3)/3),this._context.lineTo((this._x3+2*this._x2)/3,(this._y3+2*this._y2)/3),this._context.closePath();break;case 3:this.point(this._x2,this._y2),this.point(this._x3,this._y3),this.point(this._x4,this._y4)}},point:function(t,e){switch(t=+t,e=+e,this._point){case 0:this._point=1,this._x2=t,this._y2=e;break;case 1:this._point=2,this._x3=t,this._y3=e;break;case 2:this._point=3,this._x4=t,this._y4=e,this._context.moveTo((this._x0+4*this._x1+t)/6,(this._y0+4*this._y1+e)/6);break;default:Ox(this,t,e)}this._x0=this._x1,this._x1=t,this._y0=this._y1,this._y1=e}},Lx.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=NaN,this._point=0},lineEnd:function(){(this._line||0!==this._line&&3===this._point)&&this._context.closePath(),this._line=1-this._line},point:function(t,e){switch(t=+t,e=+e,this._point){case 0:this._point=1;break;case 1:this._point=2;break;case 2:this._point=3;var n=(this._x0+4*this._x1+t)/6,r=(this._y0+4*this._y1+e)/6;this._line?this._context.lineTo(n,r):this._context.moveTo(n,r);break;case 3:this._point=4;default:Ox(this,t,e)}this._x0=this._x1,this._x1=t,this._y0=this._y1,this._y1=e}},Dx.prototype={lineStart:function(){this._x=[],this._y=[],this._basis.lineStart()},lineEnd:function(){var t=this._x,e=this._y,n=t.length-1;if(n>0)for(var r,i=t[0],s=e[0],o=t[n]-i,a=e[n]-s,l=-1;++l<=n;)r=l/n,this._basis.point(this._beta*t[l]+(1-this._beta)*(i+r*o),this._beta*e[l]+(1-this._beta)*(s+r*a));this._x=this._y=null,this._basis.lineEnd()},point:function(t,e){this._x.push(+t),this._y.push(+e)}};var Vx=function t(e){function n(t){return 1===e?new Nx(t):new Dx(t,e)}return n.beta=function(e){return t(+e)},n}(.85);function Bx(t,e,n){t._context.bezierCurveTo(t._x1+t._k*(t._x2-t._x0),t._y1+t._k*(t._y2-t._y0),t._x2+t._k*(t._x1-e),t._y2+t._k*(t._y1-n),t._x2,t._y2)}function zx(t,e){this._context=t,this._k=(1-e)/6}zx.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:Bx(this,this._x1,this._y1)}(this._line||0!==this._line&&1===this._point)&&this._context.closePath(),this._line=1-this._line},point:function(t,e){switch(t=+t,e=+e,this._point){case 0:this._point=1,this._line?this._context.lineTo(t,e):this._context.moveTo(t,e);break;case 1:this._point=2,this._x1=t,this._y1=e;break;case 2:this._point=3;default:Bx(this,t,e)}this._x0=this._x1,this._x1=this._x2,this._x2=t,this._y0=this._y1,this._y1=this._y2,this._y2=e}};var Fx=function t(e){function n(t){return new zx(t,e)}return n.tension=function(e){return t(+e)},n}(0);function Gx(t,e){this._context=t,this._k=(1-e)/6}Gx.prototype={areaStart:Mx,areaEnd:Mx,lineStart:function(){this._x0=this._x1=this._x2=this._x3=this._x4=this._x5=this._y0=this._y1=this._y2=this._y3=this._y4=this._y5=NaN,this._point=0},lineEnd:function(){switch(this._point){case 1:this._context.moveTo(this._x3,this._y3),this._context.closePath();break;case 2:this._context.lineTo(this._x3,this._y3),this._context.closePath();break;case 3:this.point(this._x3,this._y3),this.point(this._x4,this._y4),this.point(this._x5,this._y5)}},point:function(t,e){switch(t=+t,e=+e,this._point){case 0:this._point=1,this._x3=t,this._y3=e;break;case 1:this._point=2,this._context.moveTo(this._x4=t,this._y4=e);break;case 2:this._point=3,this._x5=t,this._y5=e;break;default:Bx(this,t,e)}this._x0=this._x1,this._x1=this._x2,this._x2=t,this._y0=this._y1,this._y1=this._y2,this._y2=e}};var jx=function t(e){function n(t){return new Gx(t,e)}return n.tension=function(e){return t(+e)},n}(0);function Ux(t,e){this._context=t,this._k=(1-e)/6}Ux.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._x2=this._y0=this._y1=this._y2=NaN,this._point=0},lineEnd:function(){(this._line||0!==this._line&&3===this._point)&&this._context.closePath(),this._line=1-this._line},point:function(t,e){switch(t=+t,e=+e,this._point){case 0:this._point=1;break;case 1:this._point=2;break;case 2:this._point=3,this._line?this._context.lineTo(this._x2,this._y2):this._context.moveTo(this._x2,this._y2);break;case 3:this._point=4;default:Bx(this,t,e)}this._x0=this._x1,this._x1=this._x2,this._x2=t,this._y0=this._y1,this._y1=this._y2,this._y2=e}};var Yx=function t(e){function n(t){return new Ux(t,e)}return n.tension=function(e){return t(+e)},n}(0);function Hx(t,e,n){var r=t._x1,i=t._y1,s=t._x2,o=t._y2;if(t._l01_a>yv){var a=2*t._l01_2a+3*t._l01_a*t._l12_a+t._l12_2a,l=3*t._l01_a*(t._l01_a+t._l12_a);r=(r*a-t._x0*t._l12_2a+t._x2*t._l01_2a)/l,i=(i*a-t._y0*t._l12_2a+t._y2*t._l01_2a)/l}if(t._l23_a>yv){var c=2*t._l23_2a+3*t._l23_a*t._l12_a+t._l12_2a,u=3*t._l23_a*(t._l23_a+t._l12_a);s=(s*c+t._x1*t._l23_2a-e*t._l12_2a)/u,o=(o*c+t._y1*t._l23_2a-n*t._l12_2a)/u}t._context.bezierCurveTo(r,i,s,o,t._x2,t._y2)}function Wx(t,e){this._context=t,this._alpha=e}Wx.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._x2=this._y0=this._y1=this._y2=NaN,this._l01_a=this._l12_a=this._l23_a=this._l01_2a=this._l12_2a=this._l23_2a=this._point=0},lineEnd:function(){switch(this._point){case 2:this._context.lineTo(this._x2,this._y2);break;case 3:this.point(this._x2,this._y2)}(this._line||0!==this._line&&1===this._point)&&this._context.closePath(),this._line=1-this._line},point:function(t,e){if(t=+t,e=+e,this._point){var n=this._x2-t,r=this._y2-e;this._l23_a=Math.sqrt(this._l23_2a=Math.pow(n*n+r*r,this._alpha))}switch(this._point){case 0:this._point=1,this._line?this._context.lineTo(t,e):this._context.moveTo(t,e);break;case 1:this._point=2;break;case 2:this._point=3;default:Hx(this,t,e)}this._l01_a=this._l12_a,this._l12_a=this._l23_a,this._l01_2a=this._l12_2a,this._l12_2a=this._l23_2a,this._x0=this._x1,this._x1=this._x2,this._x2=t,this._y0=this._y1,this._y1=this._y2,this._y2=e}};var qx=function t(e){function n(t){return e?new Wx(t,e):new zx(t,0)}return n.alpha=function(e){return t(+e)},n}(.5);function $x(t,e){this._context=t,this._alpha=e}$x.prototype={areaStart:Mx,areaEnd:Mx,lineStart:function(){this._x0=this._x1=this._x2=this._x3=this._x4=this._x5=this._y0=this._y1=this._y2=this._y3=this._y4=this._y5=NaN,this._l01_a=this._l12_a=this._l23_a=this._l01_2a=this._l12_2a=this._l23_2a=this._point=0},lineEnd:function(){switch(this._point){case 1:this._context.moveTo(this._x3,this._y3),this._context.closePath();break;case 2:this._context.lineTo(this._x3,this._y3),this._context.closePath();break;case 3:this.point(this._x3,this._y3),this.point(this._x4,this._y4),this.point(this._x5,this._y5)}},point:function(t,e){if(t=+t,e=+e,this._point){var n=this._x2-t,r=this._y2-e;this._l23_a=Math.sqrt(this._l23_2a=Math.pow(n*n+r*r,this._alpha))}switch(this._point){case 0:this._point=1,this._x3=t,this._y3=e;break;case 1:this._point=2,this._context.moveTo(this._x4=t,this._y4=e);break;case 2:this._point=3,this._x5=t,this._y5=e;break;default:Hx(this,t,e)}this._l01_a=this._l12_a,this._l12_a=this._l23_a,this._l01_2a=this._l12_2a,this._l12_2a=this._l23_2a,this._x0=this._x1,this._x1=this._x2,this._x2=t,this._y0=this._y1,this._y1=this._y2,this._y2=e}};var Xx=function t(e){function n(t){return e?new $x(t,e):new Gx(t,0)}return n.alpha=function(e){return t(+e)},n}(.5);function Kx(t,e){this._context=t,this._alpha=e}Kx.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._x2=this._y0=this._y1=this._y2=NaN,this._l01_a=this._l12_a=this._l23_a=this._l01_2a=this._l12_2a=this._l23_2a=this._point=0},lineEnd:function(){(this._line||0!==this._line&&3===this._point)&&this._context.closePath(),this._line=1-this._line},point:function(t,e){if(t=+t,e=+e,this._point){var n=this._x2-t,r=this._y2-e;this._l23_a=Math.sqrt(this._l23_2a=Math.pow(n*n+r*r,this._alpha))}switch(this._point){case 0:this._point=1;break;case 1:this._point=2;break;case 2:this._point=3,this._line?this._context.lineTo(this._x2,this._y2):this._context.moveTo(this._x2,this._y2);break;case 3:this._point=4;default:Hx(this,t,e)}this._l01_a=this._l12_a,this._l12_a=this._l23_a,this._l01_2a=this._l12_2a,this._l12_2a=this._l23_2a,this._x0=this._x1,this._x1=this._x2,this._x2=t,this._y0=this._y1,this._y1=this._y2,this._y2=e}};var Zx=function t(e){function n(t){return e?new Kx(t,e):new Ux(t,0)}return n.alpha=function(e){return t(+e)},n}(.5);function Jx(t){this._context=t}function Qx(t){return t<0?-1:1}function tw(t,e,n){var r=t._x1-t._x0,i=e-t._x1,s=(t._y1-t._y0)/(r||i<0&&-0),o=(n-t._y1)/(i||r<0&&-0),a=(s*i+o*r)/(r+i);return(Qx(s)+Qx(o))*Math.min(Math.abs(s),Math.abs(o),.5*Math.abs(a))||0}function ew(t,e){var n=t._x1-t._x0;return n?(3*(t._y1-t._y0)/n-e)/2:e}function nw(t,e,n){var r=t._x0,i=t._y0,s=t._x1,o=t._y1,a=(s-r)/3;t._context.bezierCurveTo(r+a,i+a*e,s-a,o-a*n,s,o)}function rw(t){this._context=t}function iw(t){this._context=new sw(t)}function sw(t){this._context=t}function ow(t){this._context=t}function aw(t){var e,n,r=t.length-1,i=new Array(r),s=new Array(r),o=new Array(r);for(i[0]=0,s[0]=2,o[0]=t[0]+2*t[1],e=1;e<r-1;++e)i[e]=1,s[e]=4,o[e]=4*t[e]+2*t[e+1];for(i[r-1]=2,s[r-1]=7,o[r-1]=8*t[r-1]+t[r],e=1;e<r;++e)n=i[e]/s[e-1],s[e]-=n,o[e]-=n*o[e-1];for(i[r-1]=o[r-1]/s[r-1],e=r-2;e>=0;--e)i[e]=(o[e]-i[e+1])/s[e];for(s[r-1]=(t[r]+i[r-1])/2,e=0;e<r-1;++e)s[e]=2*t[e+1]-i[e+1];return[i,s]}function lw(t){return new ow(t)}function cw(t,e){this._context=t,this._t=e}function uw(t){return new cw(t,.5)}function hw(t,e){if((i=t.length)>1)for(var n,r,i,s=1,o=t[e[0]],a=o.length;s<i;++s)for(r=o,o=t[e[s]],n=0;n<a;++n)o[n][1]+=o[n][0]=isNaN(r[n][1])?r[n][0]:r[n][1]}function fw(t){for(var e=t.length,n=new Array(e);--e>=0;)n[e]=e;return n}function dw(t,e){return t[e]}function pw(t){const e=[];return e.key=t,e}function _w(t){var e=t.map(gw);return fw(t).sort(function(t,n){return e[t]-e[n]})}function gw(t){for(var e,n=-1,r=0,i=t.length,s=-1/0;++n<i;)(e=+t[n][1])>s&&(s=e,r=n);return r}function yw(t){var e=t.map(mw);return fw(t).sort(function(t,n){return e[t]-e[n]})}function mw(t){for(var e,n=0,r=-1,i=t.length;++r<i;)(e=+t[r][1])&&(n+=e);return n}Jx.prototype={areaStart:Mx,areaEnd:Mx,lineStart:function(){this._point=0},lineEnd:function(){this._point&&this._context.closePath()},point:function(t,e){t=+t,e=+e,this._point?this._context.lineTo(t,e):(this._point=1,this._context.moveTo(t,e))}},rw.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:nw(this,this._t0,ew(this,this._t0))}(this._line||0!==this._line&&1===this._point)&&this._context.closePath(),this._line=1-this._line},point:function(t,e){var n=NaN;if(e=+e,(t=+t)!==this._x1||e!==this._y1){switch(this._point){case 0:this._point=1,this._line?this._context.lineTo(t,e):this._context.moveTo(t,e);break;case 1:this._point=2;break;case 2:this._point=3,nw(this,ew(this,n=tw(this,t,e)),n);break;default:nw(this,this._t0,n=tw(this,t,e))}this._x0=this._x1,this._x1=t,this._y0=this._y1,this._y1=e,this._t0=n}}},(iw.prototype=Object.create(rw.prototype)).point=function(t,e){rw.prototype.point.call(this,e,t)},sw.prototype={moveTo:function(t,e){this._context.moveTo(e,t)},closePath:function(){this._context.closePath()},lineTo:function(t,e){this._context.lineTo(e,t)},bezierCurveTo:function(t,e,n,r,i,s){this._context.bezierCurveTo(e,t,r,n,s,i)}},ow.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x=[],this._y=[]},lineEnd:function(){var t=this._x,e=this._y,n=t.length;if(n)if(this._line?this._context.lineTo(t[0],e[0]):this._context.moveTo(t[0],e[0]),2===n)this._context.lineTo(t[1],e[1]);else for(var r=aw(t),i=aw(e),s=0,o=1;o<n;++s,++o)this._context.bezierCurveTo(r[0][s],i[0][s],r[1][s],i[1][s],t[o],e[o]);(this._line||0!==this._line&&1===n)&&this._context.closePath(),this._line=1-this._line,this._x=this._y=null},point:function(t,e){this._x.push(+t),this._y.push(+e)}},cw.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x=this._y=NaN,this._point=0},lineEnd:function(){0<this._t&&this._t<1&&2===this._point&&this._context.lineTo(this._x,this._y),(this._line||0!==this._line&&1===this._point)&&this._context.closePath(),this._line>=0&&(this._t=1-this._t,this._line=1-this._line)},point:function(t,e){switch(t=+t,e=+e,this._point){case 0:this._point=1,this._line?this._context.lineTo(t,e):this._context.moveTo(t,e);break;case 1:this._point=2;default:if(this._t<=0)this._context.lineTo(this._x,e),this._context.lineTo(t,e);else{var n=this._x*(1-this._t)+t*this._t;this._context.lineTo(n,this._y),this._context.lineTo(n,e)}}this._x=t,this._y=e}};var bw=t=>()=>t;function vw(t,{sourceEvent:e,target:n,transform:r,dispatch:i}){Object.defineProperties(this,{type:{value:t,enumerable:!0,configurable:!0},sourceEvent:{value:e,enumerable:!0,configurable:!0},target:{value:n,enumerable:!0,configurable:!0},transform:{value:r,enumerable:!0,configurable:!0},_:{value:i}})}function xw(t,e,n){this.k=t,this.x=e,this.y=n}xw.prototype={constructor:xw,scale:function(t){return 1===t?this:new xw(this.k*t,this.x,this.y)},translate:function(t,e){return 0===t&0===e?this:new xw(this.k,this.x+this.k*t,this.y+this.k*e)},apply:function(t){return[t[0]*this.k+this.x,t[1]*this.k+this.y]},applyX:function(t){return t*this.k+this.x},applyY:function(t){return t*this.k+this.y},invert:function(t){return[(t[0]-this.x)/this.k,(t[1]-this.y)/this.k]},invertX:function(t){return(t-this.x)/this.k},invertY:function(t){return(t-this.y)/this.k},rescaleX:function(t){return t.copy().domain(t.range().map(this.invertX,this).map(t.invert,t))},rescaleY:function(t){return t.copy().domain(t.range().map(this.invertY,this).map(t.invert,t))},toString:function(){return"translate("+this.x+","+this.y+") scale("+this.k+")"}};var ww=new xw(1,0,0);function Ew(t){for(;!t.__zoom;)if(!(t=t.parentNode))return ww;return t.__zoom}function Aw(t){t.stopImmediatePropagation()}function Sw(t){t.preventDefault(),t.stopImmediatePropagation()}function Tw(t){return!(t.ctrlKey&&"wheel"!==t.type||t.button)}function Cw(){var t=this;return t instanceof SVGElement?(t=t.ownerSVGElement||t).hasAttribute("viewBox")?[[(t=t.viewBox.baseVal).x,t.y],[t.x+t.width,t.y+t.height]]:[[0,0],[t.width.baseVal.value,t.height.baseVal.value]]:[[0,0],[t.clientWidth,t.clientHeight]]}function kw(){return this.__zoom||ww}function Rw(t){return-t.deltaY*(1===t.deltaMode?.05:t.deltaMode?1:.002)*(t.ctrlKey?10:1)}function Mw(){return navigator.maxTouchPoints||"ontouchstart"in this}function Ow(t,e,n){var r=t.invertX(e[0][0])-n[0][0],i=t.invertX(e[1][0])-n[1][0],s=t.invertY(e[0][1])-n[0][1],o=t.invertY(e[1][1])-n[1][1];return t.translate(i>r?(r+i)/2:Math.min(0,r)||Math.max(0,i),o>s?(s+o)/2:Math.min(0,s)||Math.max(0,o))}Ew.prototype=xw.prototype;var Nw=Object.freeze({__proto__:null,Adder:w,Delaunay:Ca,FormatSpecifier:Fl,InternMap:E,InternSet:A,Node:Dd,Path:So,Voronoi:xa,ZoomTransform:xw,active:function(t,e){var n,r,i=t.__transition;if(i)for(r in e=null==e?null:e+"",i)if((n=i[r]).state>1&&n.name===e)return new rs([[t]],Ds,e,+r);return null},arc:function(){var t=Ev,e=Av,n=cv(0),r=null,i=Sv,s=Tv,o=Cv,a=null,l=wv(c);function c(){var c,u,h=+t.apply(this,arguments),f=+e.apply(this,arguments),d=i.apply(this,arguments)-bv,p=s.apply(this,arguments)-bv,_=uv(p-d),g=p>d;if(a||(a=c=l()),f<h&&(u=f,f=h,h=u),f>yv)if(_>vv-yv)a.moveTo(f*fv(d),f*_v(d)),a.arc(0,0,f,d,p,!g),h>yv&&(a.moveTo(h*fv(p),h*_v(p)),a.arc(0,0,h,p,d,g));else{var y,m,b=d,v=p,x=d,w=p,E=_,A=_,S=o.apply(this,arguments)/2,T=S>yv&&(r?+r.apply(this,arguments):gv(h*h+f*f)),C=pv(uv(f-h)/2,+n.apply(this,arguments)),k=C,R=C;if(T>yv){var M=xv(T/h*_v(S)),O=xv(T/f*_v(S));(E-=2*M)>yv?(x+=M*=g?1:-1,w-=M):(E=0,x=w=(d+p)/2),(A-=2*O)>yv?(b+=O*=g?1:-1,v-=O):(A=0,b=v=(d+p)/2)}var N=f*fv(b),I=f*_v(b),P=h*fv(w),L=h*_v(w);if(C>yv){var D,V=f*fv(v),B=f*_v(v),z=h*fv(x),F=h*_v(x);if(_<mv)if(D=function(t,e,n,r,i,s,o,a){var l=n-t,c=r-e,u=o-i,h=a-s,f=h*l-u*c;if(!(f*f<yv))return[t+(f=(u*(e-s)-h*(t-i))/f)*l,e+f*c]}(N,I,z,F,V,B,P,L)){var G=N-D[0],j=I-D[1],U=V-D[0],Y=B-D[1],H=1/_v(function(t){return t>1?0:t<-1?mv:Math.acos(t)}((G*U+j*Y)/(gv(G*G+j*j)*gv(U*U+Y*Y)))/2),W=gv(D[0]*D[0]+D[1]*D[1]);k=pv(C,(h-W)/(H-1)),R=pv(C,(f-W)/(H+1))}else k=R=0}A>yv?R>yv?(y=kv(z,F,N,I,f,R,g),m=kv(V,B,P,L,f,R,g),a.moveTo(y.cx+y.x01,y.cy+y.y01),R<C?a.arc(y.cx,y.cy,R,hv(y.y01,y.x01),hv(m.y01,m.x01),!g):(a.arc(y.cx,y.cy,R,hv(y.y01,y.x01),hv(y.y11,y.x11),!g),a.arc(0,0,f,hv(y.cy+y.y11,y.cx+y.x11),hv(m.cy+m.y11,m.cx+m.x11),!g),a.arc(m.cx,m.cy,R,hv(m.y11,m.x11),hv(m.y01,m.x01),!g))):(a.moveTo(N,I),a.arc(0,0,f,b,v,!g)):a.moveTo(N,I),h>yv&&E>yv?k>yv?(y=kv(P,L,V,B,h,-k,g),m=kv(N,I,z,F,h,-k,g),a.lineTo(y.cx+y.x01,y.cy+y.y01),k<C?a.arc(y.cx,y.cy,k,hv(y.y01,y.x01),hv(m.y01,m.x01),!g):(a.arc(y.cx,y.cy,k,hv(y.y01,y.x01),hv(y.y11,y.x11),!g),a.arc(0,0,h,hv(y.cy+y.y11,y.cx+y.x11),hv(m.cy+m.y11,m.cx+m.x11),g),a.arc(m.cx,m.cy,k,hv(m.y11,m.x11),hv(m.y01,m.x01),!g))):a.arc(0,0,h,w,x,g):a.lineTo(P,L)}else a.moveTo(0,0);if(a.closePath(),c)return a=null,c+""||null}return c.centroid=function(){var n=(+t.apply(this,arguments)+ +e.apply(this,arguments))/2,r=(+i.apply(this,arguments)+ +s.apply(this,arguments))/2-mv/2;return[fv(r)*n,_v(r)*n]},c.innerRadius=function(e){return arguments.length?(t="function"==typeof e?e:cv(+e),c):t},c.outerRadius=function(t){return arguments.length?(e="function"==typeof t?t:cv(+t),c):e},c.cornerRadius=function(t){return arguments.length?(n="function"==typeof t?t:cv(+t),c):n},c.padRadius=function(t){return arguments.length?(r=null==t?null:"function"==typeof t?t:cv(+t),c):r},c.startAngle=function(t){return arguments.length?(i="function"==typeof t?t:cv(+t),c):i},c.endAngle=function(t){return arguments.length?(s="function"==typeof t?t:cv(+t),c):s},c.padAngle=function(t){return arguments.length?(o="function"==typeof t?t:cv(+t),c):o},c.context=function(t){return arguments.length?(a=null==t?null:t,c):a},c},area:Dv,areaRadial:Yv,ascending:t,autoType:Za,axisBottom:function(t){return Mt(3,t)},axisLeft:function(t){return Mt(4,t)},axisRight:function(t){return Mt(2,t)},axisTop:function(t){return Mt(1,t)},bin:J,bisect:o,bisectCenter:l,bisectLeft:a,bisectRight:o,bisector:n,blob:function(t,e){return fetch(t,e).then(Qa)},blur:function(t,e){if(!((e=+e)>=0))throw new RangeError("invalid r");let n=t.length;if(!((n=Math.floor(n))>=0))throw new RangeError("invalid length");if(!n||!e)return t;const r=p(e),i=t.slice();return r(t,i,0,n,1),r(i,t,0,n,1),r(t,i,0,n,1),t},blur2:c,blurImage:u,brush:function(){return lo(Zs)},brushSelection:function(t){var e=t.__brush;return e?e.dim.output(e.selection):null},brushX:function(){return lo(Xs)},brushY:function(){return lo(Ks)},buffer:function(t,e){return fetch(t,e).then(tl)},chord:function(){return bo(!1,!1)},chordDirected:function(){return bo(!0,!1)},chordTranspose:function(){return bo(!1,!0)},cluster:Rd,color:On,contourDensity:function(){var t=Ko,e=Zo,n=Jo,r=960,i=500,s=20,o=2,a=3*s,l=r+2*a>>o,u=i+2*a>>o,h=zo(20);function f(r){var i=new Float32Array(l*u),h=Math.pow(2,-o),f=-1;for(const s of r){var d=(t(s,++f,r)+a)*h,p=(e(s,f,r)+a)*h,_=+n(s,f,r);if(_&&d>=0&&d<l&&p>=0&&p<u){var g=Math.floor(d),y=Math.floor(p),m=d-g-.5,b=p-y-.5;i[g+y*l]+=(1-m)*(1-b)*_,i[g+1+y*l]+=m*(1-b)*_,i[g+1+(y+1)*l]+=m*b*_,i[g+(y+1)*l]+=(1-m)*b*_}}return c({data:i,width:l,height:u},s*h),i}function d(t){var e=f(t),n=h(e),r=Math.pow(2,2*o);return Array.isArray(n)||(n=q(Number.MIN_VALUE,Q(e)/r,n)),Ho().size([l,u]).thresholds(n.map(t=>t*r))(e).map((t,e)=>(t.value=+n[e],p(t)))}function p(t){return t.coordinates.forEach(_),t}function _(t){t.forEach(g)}function g(t){t.forEach(y)}function y(t){t[0]=t[0]*Math.pow(2,o)-a,t[1]=t[1]*Math.pow(2,o)-a}function m(){return l=r+2*(a=3*s)>>o,u=i+2*a>>o,d}return d.contours=function(t){var e=f(t),n=Ho().size([l,u]),r=Math.pow(2,2*o),i=t=>{t=+t;var i=p(n.contour(e,t*r));return i.value=t,i};return Object.defineProperty(i,"max",{get:()=>Q(e)/r}),i},d.x=function(e){return arguments.length?(t="function"==typeof e?e:zo(+e),d):t},d.y=function(t){return arguments.length?(e="function"==typeof t?t:zo(+t),d):e},d.weight=function(t){return arguments.length?(n="function"==typeof t?t:zo(+t),d):n},d.size=function(t){if(!arguments.length)return[r,i];var e=+t[0],n=+t[1];if(!(e>=0&&n>=0))throw new Error("invalid size");return r=e,i=n,m()},d.cellSize=function(t){if(!arguments.length)return 1<<o;if(!((t=+t)>=1))throw new Error("invalid cell size");return o=Math.floor(Math.log(t)/Math.LN2),m()},d.thresholds=function(t){return arguments.length?(h="function"==typeof t?t:Array.isArray(t)?zo(Vo.call(t)):zo(t),d):h},d.bandwidth=function(t){if(!arguments.length)return Math.sqrt(s*(s+1));if(!((t=+t)>=0))throw new Error("invalid bandwidth");return s=(Math.sqrt(4*t*t+1)-1)/2,m()},d},contours:Ho,count:_,create:function(t){return $e(Gt(t).call(document.documentElement))},creator:Gt,cross:function(...t){const e="function"==typeof t[t.length-1]&&function(t){return e=>t(...e)}(t.pop()),n=(t=t.map(m)).map(g),r=t.length-1,i=new Array(r+1).fill(0),s=[];if(r<0||n.some(y))return s;for(;;){s.push(i.map((e,n)=>t[n][e]));let o=r;for(;++i[o]===n[o];){if(0===o)return e?s.map(e):s;i[o--]=0}}},csv:il,csvFormat:Ba,csvFormatBody:za,csvFormatRow:Ga,csvFormatRows:Fa,csvFormatValue:ja,csvParse:Da,csvParseRows:Va,cubehelix:wr,cumsum:function(t,e){var n=0,r=0;return Float64Array.from(t,void 0===e?t=>n+=+t||0:i=>n+=+e(i,r++,t)||0)},curveBasis:Ix,curveBasisClosed:function(t){return new Px(t)},curveBasisOpen:function(t){return new Lx(t)},curveBumpX:$v,curveBumpY:Xv,curveBundle:Vx,curveCardinal:Fx,curveCardinalClosed:jx,curveCardinalOpen:Yx,curveCatmullRom:qx,curveCatmullRomClosed:Xx,curveCatmullRomOpen:Zx,curveLinear:Nv,curveLinearClosed:function(t){return new Jx(t)},curveMonotoneX:function(t){return new rw(t)},curveMonotoneY:function(t){return new iw(t)},curveNatural:lw,curveStep:uw,curveStepAfter:function(t){return new cw(t,1)},curveStepBefore:function(t){return new cw(t,0)},descending:e,deviation:v,difference:function(t,...e){t=new A(t);for(const n of e)for(const e of n)t.delete(e);return t},disjoint:function(t,e){const n=e[Symbol.iterator](),r=new A;for(const e of t){if(r.has(e))return!1;let t,i;for(;({value:t,done:i}=n.next())&&!i;){if(Object.is(e,t))return!1;r.add(t)}}return!0},dispatch:Nt,drag:function(){var t,e,n,r,i=cn,s=un,o=hn,a=fn,l={},c=Nt("start","drag","end"),u=0,h=0;function f(t){t.on("mousedown.drag",d).filter(a).on("touchstart.drag",g).on("touchmove.drag",y,tn).on("touchend.drag touchcancel.drag",m).style("touch-action","none").style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function d(o,a){if(!r&&i.call(this,o,a)){var l=b(this,s.call(this,o,a),o,a,"mouse");l&&($e(o.view).on("mousemove.drag",p,en).on("mouseup.drag",_,en),sn(o.view),nn(o),n=!1,t=o.clientX,e=o.clientY,l("start",o))}}function p(r){if(rn(r),!n){var i=r.clientX-t,s=r.clientY-e;n=i*i+s*s>h}l.mouse("drag",r)}function _(t){$e(t.view).on("mousemove.drag mouseup.drag",null),on(t.view,n),rn(t),l.mouse("end",t)}function g(t,e){if(i.call(this,t,e)){var n,r,o=t.changedTouches,a=s.call(this,t,e),l=o.length;for(n=0;n<l;++n)(r=b(this,a,t,e,o[n].identifier,o[n]))&&(nn(t),r("start",t,o[n]))}}function y(t){var e,n,r=t.changedTouches,i=r.length;for(e=0;e<i;++e)(n=l[r[e].identifier])&&(rn(t),n("drag",t,r[e]))}function m(t){var e,n,i=t.changedTouches,s=i.length;for(r&&clearTimeout(r),r=setTimeout(function(){r=null},500),e=0;e<s;++e)(n=l[i[e].identifier])&&(nn(t),n("end",t,i[e]))}function b(t,e,n,r,i,s){var a,h,d,p=c.copy(),_=Qe(s||n,e);if(null!=(d=o.call(t,new ln("beforestart",{sourceEvent:n,target:f,identifier:i,active:u,x:_[0],y:_[1],dx:0,dy:0,dispatch:p}),r)))return a=d.x-_[0]||0,h=d.y-_[1]||0,function n(s,o,c){var g,y=_;switch(s){case"start":l[i]=n,g=u++;break;case"end":delete l[i],--u;case"drag":_=Qe(c||o,e),g=u}p.call(s,t,new ln(s,{sourceEvent:o,subject:d,target:f,identifier:i,active:g,x:_[0]+a,y:_[1]+h,dx:_[0]-y[0],dy:_[1]-y[1],dispatch:p}),r)}}return f.filter=function(t){return arguments.length?(i="function"==typeof t?t:an(!!t),f):i},f.container=function(t){return arguments.length?(s="function"==typeof t?t:an(t),f):s},f.subject=function(t){return arguments.length?(o="function"==typeof t?t:an(t),f):o},f.touchable=function(t){return arguments.length?(a="function"==typeof t?t:an(!!t),f):a},f.on=function(){var t=c.on.apply(c,arguments);return t===c?f:t},f.clickDistance=function(t){return arguments.length?(h=(t=+t)*t,f):Math.sqrt(h)},f},dragDisable:sn,dragEnable:on,dsv:function(t,e,n,r){3===arguments.length&&"function"==typeof n&&(r=n,n=void 0);var i=Pa(t);return nl(e,n).then(function(t){return i.parse(t,r)})},dsvFormat:Pa,easeBack:Rs,easeBackIn:Cs,easeBackInOut:Rs,easeBackOut:ks,easeBounce:Ss,easeBounceIn:function(t){return 1-Ss(1-t)},easeBounceInOut:function(t){return((t*=2)<=1?1-Ss(1-t):Ss(t-1)+1)/2},easeBounceOut:Ss,easeCircle:ys,easeCircleIn:function(t){return 1-Math.sqrt(1-t*t)},easeCircleInOut:ys,easeCircleOut:function(t){return Math.sqrt(1- --t*t)},easeCubic:ls,easeCubicIn:function(t){return t*t*t},easeCubicInOut:ls,easeCubicOut:function(t){return--t*t*t+1},easeElastic:Ns,easeElasticIn:Os,easeElasticInOut:Is,easeElasticOut:Ns,easeExp:gs,easeExpIn:function(t){return _s(1-+t)},easeExpInOut:gs,easeExpOut:function(t){return 1-_s(t)},easeLinear:t=>+t,easePoly:hs,easePolyIn:cs,easePolyInOut:hs,easePolyOut:us,easeQuad:as,easeQuadIn:function(t){return t*t},easeQuadInOut:as,easeQuadOut:function(t){return t*(2-t)},easeSin:ps,easeSinIn:function(t){return 1===+t?1:1-Math.cos(t*ds)},easeSinInOut:ps,easeSinOut:function(t){return Math.sin(t*ds)},every:function(t,e){if("function"!=typeof e)throw new TypeError("test is not a function");let n=-1;for(const r of t)if(!e(r,++n,t))return!1;return!0},extent:x,fcumsum:function(t,e){const n=new w;let r=-1;return Float64Array.from(t,void 0===e?t=>n.add(+t||0):i=>n.add(+e(i,++r,t)||0))},filter:function(t,e){if("function"!=typeof e)throw new TypeError("test is not a function");const n=[];let r=-1;for(const i of t)e(i,++r,t)&&n.push(i);return n},flatGroup:function(t,...e){return N(O(t,...e),e)},flatRollup:function(t,e,...n){return N(P(t,e,...n),n)},forceCenter:hl,forceCollide:function(t){var e,n,r,i=1,s=1;function o(){for(var t,o,l,c,u,h,f,d=e.length,p=0;p<s;++p)for(o=gl(e,wl,El).visitAfter(a),t=0;t<d;++t)l=e[t],h=n[l.index],f=h*h,c=l.x+l.vx,u=l.y+l.vy,o.visit(_);function _(t,e,n,s,o){var a=t.data,d=t.r,p=h+d;if(!a)return e>c+p||s<c-p||n>u+p||o<u-p;if(a.index>l.index){var _=c-a.x-a.vx,g=u-a.y-a.vy,y=_*_+g*g;y<p*p&&(0===_&&(y+=(_=xl(r))*_),0===g&&(y+=(g=xl(r))*g),y=(p-(y=Math.sqrt(y)))/y*i,l.vx+=(_*=y)*(p=(d*=d)/(f+d)),l.vy+=(g*=y)*p,a.vx-=_*(p=1-p),a.vy-=g*p)}}}function a(t){if(t.data)return t.r=n[t.data.index];for(var e=t.r=0;e<4;++e)t[e]&&t[e].r>t.r&&(t.r=t[e].r)}function l(){if(e){var r,i,s=e.length;for(n=new Array(s),r=0;r<s;++r)i=e[r],n[i.index]=+t(i,r,e)}}return"function"!=typeof t&&(t=vl(null==t?1:+t)),o.initialize=function(t,n){e=t,r=n,l()},o.iterations=function(t){return arguments.length?(s=+t,o):s},o.strength=function(t){return arguments.length?(i=+t,o):i},o.radius=function(e){return arguments.length?(t="function"==typeof e?e:vl(+e),l(),o):t},o},forceLink:Tl,forceManyBody:Nl,forceRadial:function(t,e,n){var r,i,s,o=vl(.1);function a(t){for(var o=0,a=r.length;o<a;++o){var l=r[o],c=l.x-e||1e-6,u=l.y-n||1e-6,h=Math.sqrt(c*c+u*u),f=(s[o]-h)*i[o]*t/h;l.vx+=c*f,l.vy+=u*f}}function l(){if(r){var e,n=r.length;for(i=new Array(n),s=new Array(n),e=0;e<n;++e)s[e]=+t(r[e],e,r),i[e]=isNaN(s[e])?0:+o(r[e],e,r)}}return"function"!=typeof t&&(t=vl(+t)),null==e&&(e=0),null==n&&(n=0),a.initialize=function(t){r=t,l()},a.strength=function(t){return arguments.length?(o="function"==typeof t?t:vl(+t),l(),a):o},a.radius=function(e){return arguments.length?(t="function"==typeof e?e:vl(+e),l(),a):t},a.x=function(t){return arguments.length?(e=+t,a):e},a.y=function(t){return arguments.length?(n=+t,a):n},a},forceSimulation:Ol,forceX:Il,forceY:Pl,get format(){return Hl},formatDefaultLocale:Kl,formatLocale:Xl,get formatPrefix(){return Wl},formatSpecifier:zl,fsum:function(t,e){const n=new w;if(void 0===e)for(let e of t)(e=+e)&&n.add(e);else{let r=-1;for(let i of t)(i=+e(i,++r,t))&&n.add(i)}return+n},geoAlbers:id,geoAlbersUsa:function(){var t,e,n,r,i,s,o=id(),a=rd().rotate([154,0]).center([-2,58.5]).parallels([55,65]),l=rd().rotate([157,0]).center([-3,19.9]).parallels([8,18]),c={point:function(t,e){s=[t,e]}};function u(t){var e=t[0],o=t[1];return s=null,n.point(e,o),s||(r.point(e,o),s)||(i.point(e,o),s)}function h(){return t=e=null,u}return u.invert=function(t){var e=o.scale(),n=o.translate(),r=(t[0]-n[0])/e,i=(t[1]-n[1])/e;return(i>=.12&&i<.234&&r>=-.425&&r<-.214?a:i>=.166&&i<.234&&r>=-.214&&r<-.115?l:o).invert(t)},u.stream=function(n){return t&&e===n?t:(r=[o.stream(e=n),a.stream(n),l.stream(n)],i=r.length,t={point:function(t,e){for(var n=-1;++n<i;)r[n].point(t,e)},sphere:function(){for(var t=-1;++t<i;)r[t].sphere()},lineStart:function(){for(var t=-1;++t<i;)r[t].lineStart()},lineEnd:function(){for(var t=-1;++t<i;)r[t].lineEnd()},polygonStart:function(){for(var t=-1;++t<i;)r[t].polygonStart()},polygonEnd:function(){for(var t=-1;++t<i;)r[t].polygonEnd()}});var r,i},u.precision=function(t){return arguments.length?(o.precision(t),a.precision(t),l.precision(t),h()):o.precision()},u.scale=function(t){return arguments.length?(o.scale(t),a.scale(.35*t),l.scale(t),u.translate(o.translate())):o.scale()},u.translate=function(t){if(!arguments.length)return o.translate();var e=o.scale(),s=+t[0],u=+t[1];return n=o.translate(t).clipExtent([[s-.455*e,u-.238*e],[s+.455*e,u+.238*e]]).stream(c),r=a.translate([s-.307*e,u+.201*e]).clipExtent([[s-.425*e+tc,u+.12*e+tc],[s-.214*e-tc,u+.234*e-tc]]).stream(c),i=l.translate([s-.205*e,u+.212*e]).clipExtent([[s-.214*e+tc,u+.166*e+tc],[s-.115*e-tc,u+.234*e-tc]]).stream(c),h()},u.fitExtent=function(t,e){return Hf(u,t,e)},u.fitSize=function(t,e){return Wf(u,t,e)},u.fitWidth=function(t,e){return qf(u,t,e)},u.fitHeight=function(t,e){return $f(u,t,e)},u.scale(1070)},geoArea:function(t){return $c=new w,Mc(t,Xc),2*$c},geoAzimuthalEqualArea:function(){return Qf(ad).scale(124.75).clipAngle(179.999)},geoAzimuthalEqualAreaRaw:ad,geoAzimuthalEquidistant:function(){return Qf(ld).scale(79.4188).clipAngle(179.999)},geoAzimuthalEquidistantRaw:ld,geoBounds:function(t){var e,n,r,i,s,o,a;if(zc=Bc=-(Dc=Vc=1/0),Hc=[],Mc(t,Eu),n=Hc.length){for(Hc.sort(Nu),e=1,s=[r=Hc[0]];e<n;++e)Iu(r,(i=Hc[e])[0])||Iu(r,i[1])?(Ou(r[0],i[1])>Ou(r[0],r[1])&&(r[1]=i[1]),Ou(i[0],r[1])>Ou(r[0],r[1])&&(r[0]=i[0])):s.push(r=i);for(o=-1/0,e=0,r=s[n=s.length-1];e<=n;r=i,++e)i=s[e],(a=Ou(r[1],i[0]))>o&&(o=a,Dc=i[0],Bc=r[1])}return Hc=Wc=null,Dc===1/0||Vc===1/0?[[NaN,NaN],[NaN,NaN]]:[[Dc,Vc],[Bc,zc]]},geoCentroid:function(t){au=lu=cu=uu=hu=fu=du=pu=0,_u=new w,gu=new w,yu=new w,Mc(t,Pu);var e=+_u,n=+gu,r=+yu,i=pc(e,n,r);return i<ec&&(e=fu,n=du,r=pu,lu<tc&&(e=cu,n=uu,r=hu),(i=pc(e,n,r))<ec)?[NaN,NaN]:[uc(n,e)*oc,wc(r/i)*oc]},geoCircle:function(){var t,e,n=Hu([0,0]),r=Hu(90),i=Hu(2),s={point:function(n,r){t.push(n=e(n,r)),n[0]*=oc,n[1]*=oc}};function o(){var o=n.apply(this,arguments),a=r.apply(this,arguments)*ac,l=i.apply(this,arguments)*ac;return t=[],e=$u(-o[0]*ac,-o[1]*ac,0).invert,Qu(s,a,l,1),o={type:"Polygon",coordinates:[t]},t=e=null,o}return o.center=function(t){return arguments.length?(n="function"==typeof t?t:Hu([+t[0],+t[1]]),o):n},o.radius=function(t){return arguments.length?(r="function"==typeof t?t:Hu(+t),o):r},o.precision=function(t){return arguments.length?(i="function"==typeof t?t:Hu(+t),o):i},o},geoClipAntimeridian:hh,geoClipCircle:fh,geoClipExtent:function(){var t,e,n,r=0,i=0,s=960,o=500;return n={stream:function(n){return t&&e===n?t:t=bh(r,i,s,o)(e=n)},extent:function(a){return arguments.length?(r=+a[0][0],i=+a[0][1],s=+a[1][0],o=+a[1][1],t=e=null,n):[[r,i],[s,o]]}}},geoClipRectangle:bh,geoConicConformal:function(){return ed(fd).scale(109.5).parallels([30,30])},geoConicConformalRaw:fd,geoConicEqualArea:rd,geoConicEqualAreaRaw:nd,geoConicEquidistant:function(){return ed(pd).scale(131.154).center([0,13.9389])},geoConicEquidistantRaw:pd,geoContains:function(t,e){return(t&&kh.hasOwnProperty(t.type)?kh[t.type]:Mh)(t,e)},geoDistance:Ch,geoEqualEarth:function(){return Qf(vd).scale(177.158)},geoEqualEarthRaw:vd,geoEquirectangular:function(){return Qf(dd).scale(152.63)},geoEquirectangularRaw:dd,geoGnomonic:function(){return Qf(xd).scale(144.049).clipAngle(60)},geoGnomonicRaw:xd,geoGraticule:Bh,geoGraticule10:function(){return Bh()()},geoIdentity:function(){var t,e,n,r,i,s,o,a=1,l=0,c=0,u=1,h=1,f=0,d=null,p=1,_=1,g=jf({point:function(t,e){var n=b([t,e]);this.stream.point(n[0],n[1])}}),y=Uh;function m(){return p=a*u,_=a*h,s=o=null,b}function b(n){var r=n[0]*p,i=n[1]*_;if(f){var s=i*t-r*e;r=r*t+i*e,i=s}return[r+l,i+c]}return b.invert=function(n){var r=n[0]-l,i=n[1]-c;if(f){var s=i*t+r*e;r=r*t-i*e,i=s}return[r/p,i/_]},b.stream=function(t){return s&&o===t?s:s=g(y(o=t))},b.postclip=function(t){return arguments.length?(y=t,d=n=r=i=null,m()):y},b.clipExtent=function(t){return arguments.length?(y=null==t?(d=n=r=i=null,Uh):bh(d=+t[0][0],n=+t[0][1],r=+t[1][0],i=+t[1][1]),m()):null==d?null:[[d,n],[r,i]]},b.scale=function(t){return arguments.length?(a=+t,m()):a},b.translate=function(t){return arguments.length?(l=+t[0],c=+t[1],m()):[l,c]},b.angle=function(n){return arguments.length?(e=yc(f=n%360*ac),t=hc(f),m()):f*oc},b.reflectX=function(t){return arguments.length?(u=t?-1:1,m()):u<0},b.reflectY=function(t){return arguments.length?(h=t?-1:1,m()):h<0},b.fitExtent=function(t,e){return Hf(b,t,e)},b.fitSize=function(t,e){return Wf(b,t,e)},b.fitWidth=function(t,e){return qf(b,t,e)},b.fitHeight=function(t,e){return $f(b,t,e)},b},geoInterpolate:function(t,e){var n=t[0]*ac,r=t[1]*ac,i=e[0]*ac,s=e[1]*ac,o=hc(r),a=yc(r),l=hc(s),c=yc(s),u=o*hc(n),h=o*yc(n),f=l*hc(i),d=l*yc(i),p=2*wc(bc(Ec(s-r)+o*l*Ec(i-n))),_=yc(p),g=p?function(t){var e=yc(t*=p)/_,n=yc(p-t)/_,r=n*u+e*f,i=n*h+e*d,s=n*a+e*c;return[uc(i,r)*oc,uc(s,bc(r*r+i*i))*oc]}:function(){return[n*oc,r*oc]};return g.distance=p,g},geoLength:Ah,geoMercator:function(){return ud(cd).scale(961/sc)},geoMercatorRaw:cd,geoNaturalEarth1:function(){return Qf(wd).scale(175.295)},geoNaturalEarth1Raw:wd,geoOrthographic:function(){return Qf(Ed).scale(249.5).clipAngle(90.000001)},geoOrthographicRaw:Ed,geoPath:function(t,e){let n,r,i=3,s=4.5;function o(t){return t&&("function"==typeof s&&r.pointRadius(+s.apply(this,arguments)),Mc(t,n(r))),r.result()}return o.area=function(t){return Mc(t,n(Wh)),Wh.result()},o.measure=function(t){return Mc(t,n(If)),If.result()},o.bounds=function(t){return Mc(t,n(ef)),ef.result()},o.centroid=function(t){return Mc(t,n(gf)),gf.result()},o.projection=function(e){return arguments.length?(n=null==e?(t=null,Uh):(t=e).stream,o):t},o.context=function(t){return arguments.length?(r=null==t?(e=null,new Ff(i)):new Tf(e=t),"function"!=typeof s&&r.pointRadius(s),o):e},o.pointRadius=function(t){return arguments.length?(s="function"==typeof t?t:(r.pointRadius(+t),+t),o):s},o.digits=function(t){if(!arguments.length)return i;if(null==t)i=null;else{const e=Math.floor(t);if(!(e>=0))throw new RangeError(`invalid digits: ${t}`);i=e}return null===e&&(r=new Ff(i)),o},o.projection(t).digits(i).context(e)},geoProjection:Qf,geoProjectionMutator:td,geoRotation:Ju,geoStereographic:function(){return Qf(Ad).scale(250).clipAngle(142)},geoStereographicRaw:Ad,geoStream:Mc,geoTransform:function(t){return{stream:jf(t)}},geoTransverseMercator:function(){var t=ud(Sd),e=t.center,n=t.rotate;return t.center=function(t){return arguments.length?e([-t[1],t[0]]):[(t=e())[1],-t[0]]},t.rotate=function(t){return arguments.length?n([t[0],t[1],t.length>2?t[2]+90:90]):[(t=n())[0],t[1],t[2]-90]},n([0,0,90]).scale(159.155)},geoTransverseMercatorRaw:Sd,gray:function(t,e){return new sr(t,0,0,null==e?1:e)},greatest:st,greatestIndex:function(e,n=t){if(1===n.length)return tt(e,n);let r,i=-1,s=-1;for(const t of e)++s,(i<0?0===n(t,t):n(t,r)>0)&&(r=t,i=s);return i},group:M,groupSort:function(e,n,r){return(2!==n.length?B(I(e,n,r),([e,n],[r,i])=>t(n,i)||t(e,r)):B(M(e,r),([e,r],[i,s])=>n(r,s)||t(e,i))).map(([t])=>t)},groups:O,hcl:hr,hierarchy:Od,histogram:J,hsl:Yn,html:cl,image:function(t,e){return new Promise(function(n,r){var i=new Image;for(var s in e)i[s]=e[s];i.onerror=r,i.onload=function(){n(i)},i.src=t})},index:function(t,...e){return D(t,R,L,e)},indexes:function(t,...e){return D(t,Array.from,L,e)},interpolate:Hr,interpolateArray:function(t,e){return(Vr(e)?Dr:Br)(t,e)},interpolateBasis:Sr,interpolateBasisClosed:Tr,interpolateBlues:zb,interpolateBrBG:Zm,interpolateBuGn:_b,interpolateBuPu:yb,interpolateCividis:function(t){return t=Math.max(0,Math.min(1,t)),"rgb("+Math.max(0,Math.min(255,Math.round(-4.54-t*(35.34-t*(2381.73-t*(6402.7-t*(7024.72-2710.57*t)))))))+", "+Math.max(0,Math.min(255,Math.round(32.49+t*(170.73+t*(52.82-t*(131.46-t*(176.58-67.37*t)))))))+", "+Math.max(0,Math.min(255,Math.round(81.24+t*(442.36-t*(2482.43-t*(6167.24-t*(6614.94-2475.67*t)))))))+")"},interpolateCool:Jb,interpolateCubehelix:ci,interpolateCubehelixDefault:Kb,interpolateCubehelixLong:ui,interpolateDate:zr,interpolateDiscrete:function(t){var e=t.length;return function(n){return t[Math.max(0,Math.min(e-1,Math.floor(n*e)))]}},interpolateGnBu:bb,interpolateGreens:Gb,interpolateGreys:Ub,interpolateHcl:oi,interpolateHclLong:ai,interpolateHsl:ri,interpolateHslLong:ii,interpolateHue:function(t,e){var n=Rr(+t,+e);return function(t){var e=n(t);return e-360*Math.floor(e/360)}},interpolateInferno:av,interpolateLab:function(t,e){var n=Or((t=ir(t)).l,(e=ir(e)).l),r=Or(t.a,e.a),i=Or(t.b,e.b),s=Or(t.opacity,e.opacity);return function(e){return t.l=n(e),t.a=r(e),t.b=i(e),t.opacity=s(e),t+""}},interpolateMagma:ov,interpolateNumber:Fr,interpolateNumberArray:Dr,interpolateObject:Gr,interpolateOrRd:xb,interpolateOranges:Xb,interpolatePRGn:Qm,interpolatePiYG:eb,interpolatePlasma:lv,interpolatePuBu:Sb,interpolatePuBuGn:Eb,interpolatePuOr:rb,interpolatePuRd:Cb,interpolatePurples:Hb,interpolateRainbow:function(t){(t<0||t>1)&&(t-=Math.floor(t));var e=Math.abs(t-.5);return Qb.h=360*t-100,Qb.s=1.5-1.5*e,Qb.l=.8-.9*e,Qb+""},interpolateRdBu:sb,interpolateRdGy:ab,interpolateRdPu:Rb,interpolateRdYlBu:cb,interpolateRdYlGn:hb,interpolateReds:qb,interpolateRgb:Nr,interpolateRgbBasis:Pr,interpolateRgbBasisClosed:Lr,interpolateRound:Wr,interpolateSinebow:function(t){var e;return t=(.5-t)*Math.PI,tv.r=255*(e=Math.sin(t))*e,tv.g=255*(e=Math.sin(t+ev))*e,tv.b=255*(e=Math.sin(t+nv))*e,tv+""},interpolateSpectral:db,interpolateString:Yr,interpolateTransformCss:Jr,interpolateTransformSvg:Qr,interpolateTurbo:rv,interpolateViridis:sv,interpolateWarm:Zb,interpolateYlGn:Ib,interpolateYlGnBu:Ob,interpolateYlOrBr:Lb,interpolateYlOrRd:Vb,interpolateZoom:ei,interrupt:Vi,intersection:function(t,...e){t=new A(t),e=e.map(vt);t:for(const n of t)for(const r of e)if(!r.has(n)){t.delete(n);continue t}return t},interval:function(t,e,n){var r=new Ai,i=e;return null==e?(r.restart(t,e,n),r):(r._restart=r.restart,r.restart=function(t,e,n){e=+e,n=null==n?wi():+n,r._restart(function s(o){o+=i,r._restart(s,i+=e,n),t(o)},e,n)},r.restart(t,e,n),r)},isoFormat:Sm,isoParse:Tm,json:function(t,e){return fetch(t,e).then(ol)},lab:ir,lch:function(t,e,n,r){return 1===arguments.length?ur(t):new fr(n,e,t,null==r?1:r)},least:function(e,n=t){let r,i=!1;if(1===n.length){let s;for(const o of e){const e=n(o);(i?t(e,s)<0:0===t(e,e))&&(r=o,s=e,i=!0)}}else for(const t of e)(i?n(t,r)<0:0===n(t,t))&&(r=t,i=!0);return r},leastIndex:pt,line:Lv,lineRadial:Uv,link:Qv,linkHorizontal:tx,linkRadial:nx,linkVertical:ex,local:Ke,map:function(t,e){if("function"!=typeof t[Symbol.iterator])throw new TypeError("values is not iterable");if("function"!=typeof e)throw new TypeError("mapper is not a function");return Array.from(t,(n,r)=>e(n,r,t))},matcher:qt,max:Q,maxIndex:tt,mean:ct,median:ut,medianIndex:function(t,e){return lt(t,.5,e)},merge:ht,min:et,minIndex:nt,mode:function(t,e){const n=new E;if(void 0===e)for(let e of t)null!=e&&e>=e&&n.set(e,(n.get(e)||0)+1);else{let r=-1;for(let i of t)null!=(i=e(i,++r,t))&&i>=i&&n.set(i,(n.get(i)||0)+1)}let r,i=0;for(const[t,e]of n)e>i&&(i=e,r=t);return r},namespace:Bt,namespaces:Vt,nice:K,now:wi,pack:rp,packEnclose:function(t){return Ud(t,jd())},packSiblings:function(t){return ep(t,jd()),t},pairs:function(t,e=ft){const n=[];let r,i=!1;for(const s of t)i&&n.push(e(r,s)),r=s,i=!0;return n},partition:function(){var t=1,e=1,n=0,r=!1;function i(i){var s=i.height+1;return i.x0=i.y0=n,i.x1=t,i.y1=e/s,i.eachBefore(function(t,e){return function(r){r.children&&lp(r,r.x0,t*(r.depth+1)/e,r.x1,t*(r.depth+2)/e);var i=r.x0,s=r.y0,o=r.x1-n,a=r.y1-n;o<i&&(i=o=(i+o)/2),a<s&&(s=a=(s+a)/2),r.x0=i,r.y0=s,r.x1=o,r.y1=a}}(e,s)),r&&i.eachBefore(ap),i}return i.round=function(t){return arguments.length?(r=!!t,i):r},i.size=function(n){return arguments.length?(t=+n[0],e=+n[1],i):[t,e]},i.padding=function(t){return arguments.length?(n=+t,i):n},i},path:To,pathRound:function(t=3){return new So(+t)},permute:V,pie:function(){var t=Bv,e=Vv,n=null,r=cv(0),i=cv(vv),s=cv(0);function o(o){var a,l,c,u,h,f=(o=Mv(o)).length,d=0,p=new Array(f),_=new Array(f),g=+r.apply(this,arguments),y=Math.min(vv,Math.max(-vv,i.apply(this,arguments)-g)),m=Math.min(Math.abs(y)/f,s.apply(this,arguments)),b=m*(y<0?-1:1);for(a=0;a<f;++a)(h=_[p[a]=a]=+t(o[a],a,o))>0&&(d+=h);for(null!=e?p.sort(function(t,n){return e(_[t],_[n])}):null!=n&&p.sort(function(t,e){return n(o[t],o[e])}),a=0,c=d?(y-f*b)/d:0;a<f;++a,g=u)l=p[a],u=g+((h=_[l])>0?h*c:0)+b,_[l]={data:o[l],index:a,value:h,startAngle:g,endAngle:u,padAngle:m};return _}return o.value=function(e){return arguments.length?(t="function"==typeof e?e:cv(+e),o):t},o.sortValues=function(t){return arguments.length?(e=t,n=null,o):e},o.sort=function(t){return arguments.length?(n=t,e=null,o):n},o.startAngle=function(t){return arguments.length?(r="function"==typeof t?t:cv(+t),o):r},o.endAngle=function(t){return arguments.length?(i="function"==typeof t?t:cv(+t),o):i},o.padAngle=function(t){return arguments.length?(s="function"==typeof t?t:cv(+t),o):s},o},piecewise:hi,pointRadial:Hv,pointer:Qe,pointers:function(t,e){return t.target&&(t=Je(t),void 0===e&&(e=t.currentTarget),t=t.touches||[t]),Array.from(t,t=>Qe(t,e))},polygonArea:function(t){for(var e,n=-1,r=t.length,i=t[r-1],s=0;++n<r;)e=i,i=t[n],s+=e[1]*i[0]-e[0]*i[1];return s/2},polygonCentroid:function(t){for(var e,n,r=-1,i=t.length,s=0,o=0,a=t[i-1],l=0;++r<i;)e=a,a=t[r],l+=n=e[0]*a[1]-a[0]*e[1],s+=(e[0]+a[0])*n,o+=(e[1]+a[1])*n;return[s/(l*=3),o/l]},polygonContains:function(t,e){for(var n,r,i=t.length,s=t[i-1],o=e[0],a=e[1],l=s[0],c=s[1],u=!1,h=0;h<i;++h)n=(s=t[h])[0],(r=s[1])>a!=c>a&&o<(l-n)*(a-r)/(c-r)+n&&(u=!u),l=n,c=r;return u},polygonHull:function(t){if((n=t.length)<3)return null;var e,n,r=new Array(n),i=new Array(n);for(e=0;e<n;++e)r[e]=[+t[e][0],+t[e][1],e];for(r.sort(Mp),e=0;e<n;++e)i[e]=[r[e][0],-r[e][1]];var s=Op(r),o=Op(i),a=o[0]===s[0],l=o[o.length-1]===s[s.length-1],c=[];for(e=s.length-1;e>=0;--e)c.push(t[r[s[e]][2]]);for(e=+a;e<o.length-l;++e)c.push(t[r[o[e]][2]]);return c},polygonLength:function(t){for(var e,n,r=-1,i=t.length,s=t[i-1],o=s[0],a=s[1],l=0;++r<i;)e=o,n=a,e-=o=(s=t[r])[0],n-=a=s[1],l+=Math.hypot(e,n);return l},precisionFixed:Zl,precisionPrefix:Jl,precisionRound:Ql,quadtree:gl,quantile:ot,quantileIndex:lt,quantileSorted:at,quantize:function(t,e){for(var n=new Array(e),r=0;r<e;++r)n[r]=t(r/(e-1));return n},quickselect:rt,radialArea:Yv,radialLine:Uv,randomBates:Bp,randomBernoulli:Gp,randomBeta:Yp,randomBinomial:Hp,randomCauchy:qp,randomExponential:zp,randomGamma:Up,randomGeometric:jp,randomInt:Pp,randomIrwinHall:Vp,randomLcg:function(t=Math.random()){let e=0|(0<=t&&t<1?t/Kp:Math.abs(t));return()=>(e=1664525*e+1013904223|0,Kp*(e>>>0))},randomLogNormal:Dp,randomLogistic:$p,randomNormal:Lp,randomPareto:Fp,randomPoisson:Xp,randomUniform:Ip,randomWeibull:Wp,range:dt,rank:function(e,n=t){if("function"!=typeof e[Symbol.iterator])throw new TypeError("values is not iterable");let r=Array.from(e);const i=new Float64Array(r.length);2!==n.length&&(r=r.map(n),n=t);const s=(t,e)=>n(r[t],r[e]);let o,a;return(e=Uint32Array.from(r,(t,e)=>e)).sort(n===t?(t,e)=>F(r[t],r[e]):z(s)),e.forEach((t,e)=>{const n=s(t,void 0===o?t:o);n>=0?((void 0===o||n>0)&&(o=t,a=e),i[t]=a):i[t]=NaN}),i},reduce:function(t,e,n){if("function"!=typeof e)throw new TypeError("reducer is not a function");const r=t[Symbol.iterator]();let i,s,o=-1;if(arguments.length<3){if(({done:i,value:n}=r.next()),i)return;++o}for(;({done:i,value:s}=r.next()),!i;)n=e(n,s,++o,t);return n},reverse:function(t){if("function"!=typeof t[Symbol.iterator])throw new TypeError("values is not iterable");return Array.from(t).reverse()},rgb:Ln,ribbon:function(){return Do()},ribbonArrow:function(){return Do(Lo)},rollup:I,rollups:P,scaleBand:e_,scaleDiverging:function t(){var e=p_(Lm()(o_));return e.copy=function(){return Nm(e,t())},Jp.apply(e,arguments)},scaleDivergingLog:function t(){var e=E_(Lm()).domain([.1,1,10]);return e.copy=function(){return Nm(e,t()).base(e.base())},Jp.apply(e,arguments)},scaleDivergingPow:Dm,scaleDivergingSqrt:function(){return Dm.apply(null,arguments).exponent(.5)},scaleDivergingSymlog:function t(){var e=C_(Lm());return e.copy=function(){return Nm(e,t()).constant(e.constant())},Jp.apply(e,arguments)},scaleIdentity:function t(e){var n;function r(t){return null==t||isNaN(t=+t)?n:t}return r.invert=r,r.domain=r.range=function(t){return arguments.length?(e=Array.from(t,i_),r):e.slice()},r.unknown=function(t){return arguments.length?(n=t,r):n},r.copy=function(){return t(e).unknown(n)},e=arguments.length?Array.from(e,i_):[0,1],p_(r)},scaleImplicit:Qp,scaleLinear:__,scaleLog:A_,scaleOrdinal:t_,scalePoint:r_,scalePow:N_,scaleQuantile:function e(){var n,r=[],i=[],s=[];function a(){var t=0,e=Math.max(1,i.length);for(s=new Array(e-1);++t<e;)s[t-1]=at(r,t/e);return l}function l(t){return null==t||isNaN(t=+t)?n:i[o(s,t)]}return l.invertExtent=function(t){var e=i.indexOf(t);return e<0?[NaN,NaN]:[e>0?s[e-1]:r[0],e<s.length?s[e]:r[r.length-1]]},l.domain=function(e){if(!arguments.length)return r.slice();r=[];for(let t of e)null==t||isNaN(t=+t)||r.push(t);return r.sort(t),a()},l.range=function(t){return arguments.length?(i=Array.from(t),a()):i.slice()},l.unknown=function(t){return arguments.length?(n=t,l):n},l.quantiles=function(){return s.slice()},l.copy=function(){return e().domain(r).range(i).unknown(n)},Zp.apply(l,arguments)},scaleQuantize:function t(){var e,n=0,r=1,i=1,s=[.5],a=[0,1];function l(t){return null!=t&&t<=t?a[o(s,t,0,i)]:e}function c(){var t=-1;for(s=new Array(i);++t<i;)s[t]=((t+1)*r-(t-i)*n)/(i+1);return l}return l.domain=function(t){return arguments.length?([n,r]=t,n=+n,r=+r,c()):[n,r]},l.range=function(t){return arguments.length?(i=(a=Array.from(t)).length-1,c()):a.slice()},l.invertExtent=function(t){var e=a.indexOf(t);return e<0?[NaN,NaN]:e<1?[n,s[0]]:e>=i?[s[i-1],r]:[s[e-1],s[e]]},l.unknown=function(t){return arguments.length?(e=t,l):l},l.thresholds=function(){return s.slice()},l.copy=function(){return t().domain([n,r]).range(a).unknown(e)},Zp.apply(p_(l),arguments)},scaleRadial:function t(){var e,n=f_(),r=[0,1],i=!1;function s(t){var r=function(t){return Math.sign(t)*Math.sqrt(Math.abs(t))}(n(t));return isNaN(r)?e:i?Math.round(r):r}return s.invert=function(t){return n.invert(I_(t))},s.domain=function(t){return arguments.length?(n.domain(t),s):n.domain()},s.range=function(t){return arguments.length?(n.range((r=Array.from(t,i_)).map(I_)),s):r.slice()},s.rangeRound=function(t){return s.range(t).round(!0)},s.round=function(t){return arguments.length?(i=!!t,s):i},s.clamp=function(t){return arguments.length?(n.clamp(t),s):n.clamp()},s.unknown=function(t){return arguments.length?(e=t,s):e},s.copy=function(){return t(n.domain(),r).round(i).clamp(n.clamp()).unknown(e)},Zp.apply(s,arguments),p_(s)},scaleSequential:Im,scaleSequentialLog:function t(){var e=E_(Om()).domain([1,10]);return e.copy=function(){return Nm(e,t()).base(e.base())},Jp.apply(e,arguments)},scaleSequentialPow:Pm,scaleSequentialQuantile:function e(){var n=[],r=o_;function i(t){if(null!=t&&!isNaN(t=+t))return r((o(n,t,1)-1)/(n.length-1))}return i.domain=function(e){if(!arguments.length)return n.slice();n=[];for(let t of e)null==t||isNaN(t=+t)||n.push(t);return n.sort(t),i},i.interpolator=function(t){return arguments.length?(r=t,i):r},i.range=function(){return n.map((t,e)=>r(e/(n.length-1)))},i.quantiles=function(t){return Array.from({length:t+1},(e,r)=>ot(n,r/t))},i.copy=function(){return e(r).domain(n)},Jp.apply(i,arguments)},scaleSequentialSqrt:function(){return Pm.apply(null,arguments).exponent(.5)},scaleSequentialSymlog:function t(){var e=C_(Om());return e.copy=function(){return Nm(e,t()).constant(e.constant())},Jp.apply(e,arguments)},scaleSqrt:function(){return N_.apply(null,arguments).exponent(.5)},scaleSymlog:function t(){var e=C_(h_());return e.copy=function(){return u_(e,t()).constant(e.constant())},Zp.apply(e,arguments)},scaleThreshold:function t(){var e,n=[.5],r=[0,1],i=1;function s(t){return null!=t&&t<=t?r[o(n,t,0,i)]:e}return s.domain=function(t){return arguments.length?(n=Array.from(t),i=Math.min(n.length,r.length-1),s):n.slice()},s.range=function(t){return arguments.length?(r=Array.from(t),i=Math.min(n.length,r.length-1),s):r.slice()},s.invertExtent=function(t){var e=r.indexOf(t);return[n[e-1],n[e]]},s.unknown=function(t){return arguments.length?(e=t,s):e},s.copy=function(){return t().domain(n).range(r).unknown(e)},Zp.apply(s,arguments)},scaleTime:Mm,scaleUtc:function(){return Zp.apply(Rm(qg,$g,Yg,Fg,Ag,ig,tg,K_,W_,iy).domain([Date.UTC(2e3,0,1),Date.UTC(2e3,0,2)]),arguments)},scan:function(t,e){const n=pt(t,e);return n<0?void 0:n},schemeAccent:zm,schemeBlues:Bb,schemeBrBG:Km,schemeBuGn:pb,schemeBuPu:gb,schemeCategory10:Bm,schemeDark2:Fm,schemeGnBu:mb,schemeGreens:Fb,schemeGreys:jb,schemeObservable10:Gm,schemeOrRd:vb,schemeOranges:$b,schemePRGn:Jm,schemePaired:jm,schemePastel1:Um,schemePastel2:Ym,schemePiYG:tb,schemePuBu:Ab,schemePuBuGn:wb,schemePuOr:nb,schemePuRd:Tb,schemePurples:Yb,schemeRdBu:ib,schemeRdGy:ob,schemeRdPu:kb,schemeRdYlBu:lb,schemeRdYlGn:ub,schemeReds:Wb,schemeSet1:Hm,schemeSet2:Wm,schemeSet3:qm,schemeSpectral:fb,schemeTableau10:$m,schemeYlGn:Nb,schemeYlGnBu:Mb,schemeYlOrBr:Pb,schemeYlOrRd:Db,select:$e,selectAll:function(t){return"string"==typeof t?new We([document.querySelectorAll(t)],[document.documentElement]):new We([Yt(t)],He)},selection:qe,selector:Ut,selectorAll:Wt,shuffle:_t,shuffler:gt,some:function(t,e){if("function"!=typeof e)throw new TypeError("test is not a function");let n=-1;for(const r of t)if(e(r,++n,t))return!0;return!1},sort:B,stack:function(){var t=cv([]),e=fw,n=hw,r=dw;function i(i){var s,o,a=Array.from(t.apply(this,arguments),pw),l=a.length,c=-1;for(const t of i)for(s=0,++c;s<l;++s)(a[s][c]=[0,+r(t,a[s].key,c,i)]).data=t;for(s=0,o=Mv(e(a));s<l;++s)a[o[s]].index=s;return n(a,o),a}return i.keys=function(e){return arguments.length?(t="function"==typeof e?e:cv(Array.from(e)),i):t},i.value=function(t){return arguments.length?(r="function"==typeof t?t:cv(+t),i):r},i.order=function(t){return arguments.length?(e=null==t?fw:"function"==typeof t?t:cv(Array.from(t)),i):e},i.offset=function(t){return arguments.length?(n=null==t?hw:t,i):n},i},stackOffsetDiverging:function(t,e){if((a=t.length)>0)for(var n,r,i,s,o,a,l=0,c=t[e[0]].length;l<c;++l)for(s=o=0,n=0;n<a;++n)(i=(r=t[e[n]][l])[1]-r[0])>0?(r[0]=s,r[1]=s+=i):i<0?(r[1]=o,r[0]=o+=i):(r[0]=0,r[1]=i)},stackOffsetExpand:function(t,e){if((r=t.length)>0){for(var n,r,i,s=0,o=t[0].length;s<o;++s){for(i=n=0;n<r;++n)i+=t[n][s][1]||0;if(i)for(n=0;n<r;++n)t[n][s][1]/=i}hw(t,e)}},stackOffsetNone:hw,stackOffsetSilhouette:function(t,e){if((n=t.length)>0){for(var n,r=0,i=t[e[0]],s=i.length;r<s;++r){for(var o=0,a=0;o<n;++o)a+=t[o][r][1]||0;i[r][1]+=i[r][0]=-a/2}hw(t,e)}},stackOffsetWiggle:function(t,e){if((i=t.length)>0&&(r=(n=t[e[0]]).length)>0){for(var n,r,i,s=0,o=1;o<r;++o){for(var a=0,l=0,c=0;a<i;++a){for(var u=t[e[a]],h=u[o][1]||0,f=(h-(u[o-1][1]||0))/2,d=0;d<a;++d){var p=t[e[d]];f+=(p[o][1]||0)-(p[o-1][1]||0)}l+=h,c+=f*h}n[o-1][1]+=n[o-1][0]=s,l&&(s-=c/l)}n[o-1][1]+=n[o-1][0]=s,hw(t,e)}},stackOrderAppearance:_w,stackOrderAscending:yw,stackOrderDescending:function(t){return yw(t).reverse()},stackOrderInsideOut:function(t){var e,n,r=t.length,i=t.map(mw),s=_w(t),o=0,a=0,l=[],c=[];for(e=0;e<r;++e)n=s[e],o<a?(o+=i[n],l.push(n)):(a+=i[n],c.push(n));return c.reverse().concat(l)},stackOrderNone:fw,stackOrderReverse:function(t){return fw(t).reverse()},stratify:function(){var t,e=fp,n=dp;function r(r){var i,s,o,a,l,c,u,h,f=Array.from(r),d=e,p=n,_=new Map;if(null!=t){const e=f.map((e,n)=>function(t){t=`${t}`;let e=t.length;_p(t,e-1)&&!_p(t,e-2)&&(t=t.slice(0,-1));return"/"===t[0]?t:`/${t}`}(t(e,n,r))),n=e.map(pp),i=new Set(e).add("");for(const t of n)i.has(t)||(i.add(t),e.push(t),n.push(pp(t)),f.push(hp));d=(t,n)=>e[n],p=(t,e)=>n[e]}for(o=0,i=f.length;o<i;++o)s=f[o],c=f[o]=new Dd(s),null!=(u=d(s,o,r))&&(u+="")&&(h=c.id=u,_.set(h,_.has(h)?up:c)),null!=(u=p(s,o,r))&&(u+="")&&(c.parent=u);for(o=0;o<i;++o)if(u=(c=f[o]).parent){if(!(l=_.get(u)))throw new Error("missing: "+u);if(l===up)throw new Error("ambiguous: "+u);l.children?l.children.push(c):l.children=[c],c.parent=l}else{if(a)throw new Error("multiple roots");a=c}if(!a)throw new Error("no root");if(null!=t){for(;a.data===hp&&1===a.children.length;)a=a.children[0],--i;for(let t=f.length-1;t>=0&&(c=f[t]).data===hp;--t)c.data=null}if(a.parent=cp,a.eachBefore(function(t){t.depth=t.parent.depth+1,--i}).eachBefore(Ld),a.parent=null,i>0)throw new Error("cycle");return a}return r.id=function(t){return arguments.length?(e=Vd(t),r):e},r.parentId=function(t){return arguments.length?(n=Vd(t),r):n},r.path=function(e){return arguments.length?(t=Vd(e),r):t},r},style:ge,subset:function(t,e){return xt(e,t)},sum:yt,superset:xt,svg:ul,symbol:function(t,e){let n=null,r=wv(i);function i(){let i;if(n||(n=i=r()),t.apply(this,arguments).draw(n,+e.apply(this,arguments)),i)return n=null,i+""||null}return t="function"==typeof t?t:cv(t||sx),e="function"==typeof e?e:cv(void 0===e?64:+e),i.type=function(e){return arguments.length?(t="function"==typeof e?e:cv(e),i):t},i.size=function(t){return arguments.length?(e="function"==typeof t?t:cv(+t),i):e},i.context=function(t){return arguments.length?(n=null==t?null:t,i):n},i},symbolAsterisk:ix,symbolCircle:sx,symbolCross:ox,symbolDiamond:cx,symbolDiamond2:ux,symbolPlus:hx,symbolSquare:fx,symbolSquare2:dx,symbolStar:yx,symbolTimes:Cx,symbolTriangle:bx,symbolTriangle2:xx,symbolWye:Tx,symbolX:Cx,symbols:kx,symbolsFill:kx,symbolsStroke:Rx,text:nl,thresholdFreedmanDiaconis:function(t,e,n){const r=_(t),i=ot(t,.75)-ot(t,.25);return r&&i?Math.ceil((n-e)/(2*i*Math.pow(r,-1/3))):1},thresholdScott:function(t,e,n){const r=_(t),i=v(t);return r&&i?Math.ceil((n-e)*Math.cbrt(r)/(3.49*i)):1},thresholdSturges:Z,tickFormat:d_,tickIncrement:$,tickStep:X,ticks:q,timeDay:ng,timeDays:rg,get timeFormat(){return ny},timeFormatDefaultLocale:Em,timeFormatLocale:ty,timeFriday:pg,timeFridays:xg,timeHour:J_,timeHours:Q_,timeInterval:D_,timeMillisecond:V_,timeMilliseconds:B_,timeMinute:$_,timeMinutes:X_,timeMonday:ug,timeMondays:yg,timeMonth:Bg,timeMonths:zg,get timeParse(){return ry},timeSaturday:_g,timeSaturdays:wg,timeSecond:W_,timeSeconds:q_,timeSunday:cg,timeSundays:gg,timeThursday:dg,timeThursdays:vg,timeTickInterval:Kg,timeTicks:Xg,timeTuesday:hg,timeTuesdays:mg,timeWednesday:fg,timeWednesdays:bg,timeWeek:cg,timeWeeks:gg,timeYear:jg,timeYears:Ug,timeout:Mi,timer:Si,timerFlush:Ti,transition:is,transpose:mt,tree:wp,treemap:Cp,treemapBinary:function(t,e,n,r,i){var s,o,a=t.children,l=a.length,c=new Array(l+1);for(c[0]=o=s=0;s<l;++s)c[s+1]=o+=a[s].value;!function t(e,n,r,i,s,o,l){if(e>=n-1){var u=a[e];return u.x0=i,u.y0=s,u.x1=o,void(u.y1=l)}var h=c[e],f=r/2+h,d=e+1,p=n-1;for(;d<p;){var _=d+p>>>1;c[_]<f?d=_+1:p=_}f-c[d-1]<c[d]-f&&e+1<d&&--d;var g=c[d]-h,y=r-g;if(o-i>l-s){var m=r?(i*y+o*g)/r:o;t(e,d,g,i,s,m,l),t(d,n,y,m,s,o,l)}else{var b=r?(s*y+l*g)/r:l;t(e,d,g,i,s,o,b),t(d,n,y,i,b,o,l)}}(0,l,t.value,e,n,r,i)},treemapDice:lp,treemapResquarify:kp,treemapSlice:Ep,treemapSliceDice:function(t,e,n,r,i){(1&t.depth?Ep:lp)(t,e,n,r,i)},treemapSquarify:Tp,tsv:sl,tsvFormat:Wa,tsvFormatBody:qa,tsvFormatRow:Xa,tsvFormatRows:$a,tsvFormatValue:Ka,tsvParse:Ya,tsvParseRows:Ha,union:function(...t){const e=new A;for(const n of t)for(const t of n)e.add(t);return e},unixDay:og,unixDays:ag,utcDay:ig,utcDays:sg,get utcFormat(){return iy},utcFriday:Rg,utcFridays:Dg,utcHour:tg,utcHours:eg,utcMillisecond:V_,utcMilliseconds:B_,utcMinute:K_,utcMinutes:Z_,utcMonday:Sg,utcMondays:Ng,utcMonth:Fg,utcMonths:Gg,get utcParse(){return sy},utcSaturday:Mg,utcSaturdays:Vg,utcSecond:W_,utcSeconds:q_,utcSunday:Ag,utcSundays:Og,utcThursday:kg,utcThursdays:Lg,utcTickInterval:$g,utcTicks:qg,utcTuesday:Tg,utcTuesdays:Ig,utcWednesday:Cg,utcWednesdays:Pg,utcWeek:Ag,utcWeeks:Og,utcYear:Yg,utcYears:Hg,variance:b,window:fe,xml:ll,zip:function(){return mt(arguments)},zoom:function(){var t,e,n,r=Tw,i=Cw,s=Ow,o=Rw,a=Mw,l=[0,1/0],c=[[-1/0,-1/0],[1/0,1/0]],u=250,h=ei,f=Nt("start","zoom","end"),d=0,p=10;function _(t){t.property("__zoom",kw).on("wheel.zoom",w,{passive:!1}).on("mousedown.zoom",E).on("dblclick.zoom",A).filter(a).on("touchstart.zoom",S).on("touchmove.zoom",T).on("touchend.zoom touchcancel.zoom",C).style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function g(t,e){return(e=Math.max(l[0],Math.min(l[1],e)))===t.k?t:new xw(e,t.x,t.y)}function y(t,e,n){var r=e[0]-n[0]*t.k,i=e[1]-n[1]*t.k;return r===t.x&&i===t.y?t:new xw(t.k,r,i)}function m(t){return[(+t[0][0]+ +t[1][0])/2,(+t[0][1]+ +t[1][1])/2]}function b(t,e,n,r){t.on("start.zoom",function(){v(this,arguments).event(r).start()}).on("interrupt.zoom end.zoom",function(){v(this,arguments).event(r).end()}).tween("zoom",function(){var t=this,s=arguments,o=v(t,s).event(r),a=i.apply(t,s),l=null==n?m(a):"function"==typeof n?n.apply(t,s):n,c=Math.max(a[1][0]-a[0][0],a[1][1]-a[0][1]),u=t.__zoom,f="function"==typeof e?e.apply(t,s):e,d=h(u.invert(l).concat(c/u.k),f.invert(l).concat(c/f.k));return function(t){if(1===t)t=f;else{var e=d(t),n=c/e[2];t=new xw(n,l[0]-e[0]*n,l[1]-e[1]*n)}o.zoom(null,t)}})}function v(t,e,n){return!n&&t.__zooming||new x(t,e)}function x(t,e){this.that=t,this.args=e,this.active=0,this.sourceEvent=null,this.extent=i.apply(t,e),this.taps=0}function w(t,...e){if(r.apply(this,arguments)){var n=v(this,e).event(t),i=this.__zoom,a=Math.max(l[0],Math.min(l[1],i.k*Math.pow(2,o.apply(this,arguments)))),u=Qe(t);if(n.wheel)n.mouse[0][0]===u[0]&&n.mouse[0][1]===u[1]||(n.mouse[1]=i.invert(n.mouse[0]=u)),clearTimeout(n.wheel);else{if(i.k===a)return;n.mouse=[u,i.invert(u)],Vi(this),n.start()}Sw(t),n.wheel=setTimeout(function(){n.wheel=null,n.end()},150),n.zoom("mouse",s(y(g(i,a),n.mouse[0],n.mouse[1]),n.extent,c))}}function E(t,...e){if(!n&&r.apply(this,arguments)){var i=t.currentTarget,o=v(this,e,!0).event(t),a=$e(t.view).on("mousemove.zoom",function(t){if(Sw(t),!o.moved){var e=t.clientX-u,n=t.clientY-h;o.moved=e*e+n*n>d}o.event(t).zoom("mouse",s(y(o.that.__zoom,o.mouse[0]=Qe(t,i),o.mouse[1]),o.extent,c))},!0).on("mouseup.zoom",function(t){a.on("mousemove.zoom mouseup.zoom",null),on(t.view,o.moved),Sw(t),o.event(t).end()},!0),l=Qe(t,i),u=t.clientX,h=t.clientY;sn(t.view),Aw(t),o.mouse=[l,this.__zoom.invert(l)],Vi(this),o.start()}}function A(t,...e){if(r.apply(this,arguments)){var n=this.__zoom,o=Qe(t.changedTouches?t.changedTouches[0]:t,this),a=n.invert(o),l=n.k*(t.shiftKey?.5:2),h=s(y(g(n,l),o,a),i.apply(this,e),c);Sw(t),u>0?$e(this).transition().duration(u).call(b,h,o,t):$e(this).call(_.transform,h,o,t)}}function S(n,...i){if(r.apply(this,arguments)){var s,o,a,l,c=n.touches,u=c.length,h=v(this,i,n.changedTouches.length===u).event(n);for(Aw(n),o=0;o<u;++o)l=[l=Qe(a=c[o],this),this.__zoom.invert(l),a.identifier],h.touch0?h.touch1||h.touch0[2]===l[2]||(h.touch1=l,h.taps=0):(h.touch0=l,s=!0,h.taps=1+!!t);t&&(t=clearTimeout(t)),s&&(h.taps<2&&(e=l[0],t=setTimeout(function(){t=null},500)),Vi(this),h.start())}}function T(t,...e){if(this.__zooming){var n,r,i,o,a=v(this,e).event(t),l=t.changedTouches,u=l.length;for(Sw(t),n=0;n<u;++n)i=Qe(r=l[n],this),a.touch0&&a.touch0[2]===r.identifier?a.touch0[0]=i:a.touch1&&a.touch1[2]===r.identifier&&(a.touch1[0]=i);if(r=a.that.__zoom,a.touch1){var h=a.touch0[0],f=a.touch0[1],d=a.touch1[0],p=a.touch1[1],_=(_=d[0]-h[0])*_+(_=d[1]-h[1])*_,m=(m=p[0]-f[0])*m+(m=p[1]-f[1])*m;r=g(r,Math.sqrt(_/m)),i=[(h[0]+d[0])/2,(h[1]+d[1])/2],o=[(f[0]+p[0])/2,(f[1]+p[1])/2]}else{if(!a.touch0)return;i=a.touch0[0],o=a.touch0[1]}a.zoom("touch",s(y(r,i,o),a.extent,c))}}function C(t,...r){if(this.__zooming){var i,s,o=v(this,r).event(t),a=t.changedTouches,l=a.length;for(Aw(t),n&&clearTimeout(n),n=setTimeout(function(){n=null},500),i=0;i<l;++i)s=a[i],o.touch0&&o.touch0[2]===s.identifier?delete o.touch0:o.touch1&&o.touch1[2]===s.identifier&&delete o.touch1;if(o.touch1&&!o.touch0&&(o.touch0=o.touch1,delete o.touch1),o.touch0)o.touch0[1]=this.__zoom.invert(o.touch0[0]);else if(o.end(),2===o.taps&&(s=Qe(s,this),Math.hypot(e[0]-s[0],e[1]-s[1])<p)){var c=$e(this).on("dblclick.zoom");c&&c.apply(this,arguments)}}}return _.transform=function(t,e,n,r){var i=t.selection?t.selection():t;i.property("__zoom",kw),t!==i?b(t,e,n,r):i.interrupt().each(function(){v(this,arguments).event(r).start().zoom(null,"function"==typeof e?e.apply(this,arguments):e).end()})},_.scaleBy=function(t,e,n,r){_.scaleTo(t,function(){return this.__zoom.k*("function"==typeof e?e.apply(this,arguments):e)},n,r)},_.scaleTo=function(t,e,n,r){_.transform(t,function(){var t=i.apply(this,arguments),r=this.__zoom,o=null==n?m(t):"function"==typeof n?n.apply(this,arguments):n,a=r.invert(o),l="function"==typeof e?e.apply(this,arguments):e;return s(y(g(r,l),o,a),t,c)},n,r)},_.translateBy=function(t,e,n,r){_.transform(t,function(){return s(this.__zoom.translate("function"==typeof e?e.apply(this,arguments):e,"function"==typeof n?n.apply(this,arguments):n),i.apply(this,arguments),c)},null,r)},_.translateTo=function(t,e,n,r,o){_.transform(t,function(){var t=i.apply(this,arguments),o=this.__zoom,a=null==r?m(t):"function"==typeof r?r.apply(this,arguments):r;return s(ww.translate(a[0],a[1]).scale(o.k).translate("function"==typeof e?-e.apply(this,arguments):-e,"function"==typeof n?-n.apply(this,arguments):-n),t,c)},r,o)},x.prototype={event:function(t){return t&&(this.sourceEvent=t),this},start:function(){return 1===++this.active&&(this.that.__zooming=this,this.emit("start")),this},zoom:function(t,e){return this.mouse&&"mouse"!==t&&(this.mouse[1]=e.invert(this.mouse[0])),this.touch0&&"touch"!==t&&(this.touch0[1]=e.invert(this.touch0[0])),this.touch1&&"touch"!==t&&(this.touch1[1]=e.invert(this.touch1[0])),this.that.__zoom=e,this.emit("zoom"),this},end:function(){return 0===--this.active&&(delete this.that.__zooming,this.emit("end")),this},emit:function(t){var e=$e(this.that).datum();f.call(t,this.that,new vw(t,{sourceEvent:this.sourceEvent,target:_,transform:this.that.__zoom,dispatch:f}),e)}},_.wheelDelta=function(t){return arguments.length?(o="function"==typeof t?t:bw(+t),_):o},_.filter=function(t){return arguments.length?(r="function"==typeof t?t:bw(!!t),_):r},_.touchable=function(t){return arguments.length?(a="function"==typeof t?t:bw(!!t),_):a},_.extent=function(t){return arguments.length?(i="function"==typeof t?t:bw([[+t[0][0],+t[0][1]],[+t[1][0],+t[1][1]]]),_):i},_.scaleExtent=function(t){return arguments.length?(l[0]=+t[0],l[1]=+t[1],_):[l[0],l[1]]},_.translateExtent=function(t){return arguments.length?(c[0][0]=+t[0][0],c[1][0]=+t[1][0],c[0][1]=+t[0][1],c[1][1]=+t[1][1],_):[[c[0][0],c[0][1]],[c[1][0],c[1][1]]]},_.constrain=function(t){return arguments.length?(s=t,_):s},_.duration=function(t){return arguments.length?(u=+t,_):u},_.interpolate=function(t){return arguments.length?(h=t,_):h},_.on=function(){var t=f.on.apply(f,arguments);return t===f?_:t},_.clickDistance=function(t){return arguments.length?(d=(t=+t)*t,_):Math.sqrt(d)},_.tapDistance=function(t){return arguments.length?(p=+t,_):p},_},zoomIdentity:ww,zoomTransform:Ew});const Iw=Object.freeze({Rect:"rect",Circle:"circle",Line:"line",Ring:"ring",Path:"path",Image:"image",SimpleText:"text",RichText:"richText",Arc:"arc",BezierCurve:"bezierCurve",BundledPath:"bundledPath",Chord:"chord",Arrow:"arrow"}),Pw=Object.freeze({Area:"area",Rect:"rect",Ellipse:"ellipse",Circle:"circle",Pie:"pie",Ring:"ring",Arc:"arc",BezierCurve:"bezierCurve",BundledPath:"bundledPath",Chord:"chord",Line:"line",Path:"path",Image:"image",SimpleText:"text",RichText:"richText",Collection:"collection",Group:"group",Composite:"composite",Scene:"scene",Axis:"axis",Glyph:"glyph",Legend:"legend",Polygon:"polygon",Gridlines:"gridlines",LinearGradient:"LinearGradient",Link:"link",DataTable:"datatable",Layout:"layout",NetworkData:"networkdata",TreeData:"treedata",Arrow:"arrow"}),Lw=Object.freeze({Axis:"axis",Legend:"legend",Gridlines:"gridlines"});function Dw(){return Date.now().toString(36)+"_"+Math.random().toString(36).slice(2)}const Vw=Object.freeze({Boolean:"boolean",Integer:"integer",Number:"number",Date:"date",String:"string"});function Bw(t){var e=Object.values(Vw);for(let n=0;n<t.length;n++){let r=t[n];if(null!=r){for(let t=0;t<e.length;t++)zw[e[t]](r)||(e.splice(t,1),t-=1);if(1==e.length)return e[0]}}return e[0]}const zw={boolean:function(t){return"true"===t||"false"===t||!0===t||!1===t||"[object Boolean]"==toString.call(t)},integer:function(t){return zw.number(t)&&(t=+t)===~~t},number:function(t){return!isNaN(+t)&&"[object Date]"!=toString.call(t)},date:function(t){let e=new Date(t);return null!=e&&!isNaN(e)},string:function(t){return!0}};function Fw(t,e){let n={};switch(e){case Vw.Boolean:n.trueCount=t.filter(t=>t).length,n.falseCount=t.filter(t=>!t).length;break;case Vw.Date:n.min=et(t),n.max=Q(t),n.extent=[n.min,n.max],n.unique=[...new Set(t)];break;case Vw.String:n.unique=[...new Set(t)];break;default:n.min=et(t),n.max=Q(t),n.extent=[n.min,n.max],n.mean=ct(t),n.median=ut(t),n.unique=[...new Set(t)]}return n}const Gw="max",jw="min",Uw="avg",Yw="mean",Hw="median",Ww="count",qw="percentile 25",$w="percentile 75";function Xw(t,e={},n){return{dataTable:t,filters:Object.assign({},e),rowIds:n?n.slice():void 0}}function Kw(t){if(t)return Xw(t.dataTable,t.filters,t.rowIds)}function Zw(t){return Kw(t)}function Jw(t){if(t)return t.dataTable}function Qw(t){return t&&t.filters||{}}function tE(t){return t?t.rowIds&&t.dataTable?t.dataTable.rows({[_E]:t.rowIds}):t.dataTable?t.dataTable.rows(t.filters):[]:[]}function eE(t){let e=tE(t);return e.length>0?e[0]:{}}function nE(t){return tE(t).length}function rE(t,e){return e in Qw(t)}function iE(t,e){let n=Qw(t);if(e in n)return n[e];let r=tE(t);return r.length>0?r[0][e]:void 0}function sE(t,e){let n=Qw(t);return e in n?[n[e]]:Array.from(new Set(tE(t).map(t=>t[e])))}function oE(t,e,n){let r=tE(t).map(t=>t[e]);switch(n){case Gw:return Q(r);case jw:return et(r);case Uw:case Yw:return ct(r);case Hw:return ut(r);case Ww:return r.length;case qw:return ot(r,.25);case $w:return ot(r,.75);default:return yt(r)}}function aE(t,e,n){let r=Jw(t),i=Object.assign({},Qw(t),{[e]:n});return Xw(r,i,hE(r,i))}function lE(t,e){if(!t)return Zw(e);if(!e)return Zw(t);let n=Jw(t),r=Object.assign({},Qw(t));for(let[t,n]of Object.entries(Qw(e)))t in r&&r[t]!==n?console.warn("Conflict in attribute values when merging dataScope:",t,r[t],n):r[t]=n;return Xw(n,r,hE(n,r))}function cE(t){return Xw(t,{},t.data.map(t=>t[_E]))}function uE(t,e,n=!1){let r=Jw(t),i=Qw(t),s=Object.entries(i).filter(([t])=>t!==e),o=r._attrValueIndexes.get(e),a=[];for(let t of r.unique(e)){let l=o&&o.get(t)?o.get(t):[];s.length>0&&(l=l.filter(t=>s.every(([e,n])=>t[e]==n))),(n||0!==l.length)&&a.push(Xw(r,Object.assign({},i,{[e]:t}),l.map(t=>t[_E])))}return a}function hE(t,e){return t.rows(e).map(t=>t[_E])}class fE{constructor(t,e,n){this._id=Pw.DataTable+Dw(),this.initialize(t,e,n)}initialize(t,e,n){if(this.url=e,this._rawData=JSON.parse(JSON.stringify(t)),this._data=t,this._dataScopeCache=new Map,this._scopeTupleCache=new Map,this._attrValueIndexes=new Map,this._rowIdIndex=new Map,this._dateMap=new Map,this._attributes=0===this._data.length?[]:Object.keys(this._data[0]),this._newAttribute=0,n)this._attrTypes=n;else{this._attrTypes={};for(let t of this._attributes)this._attrTypes[t]=Bw(this.data.map(e=>e[t])),"year"==t.toLowerCase()&&this._attrTypes[t]==Vw.Integer&&(this._attrTypes[t]=Vw.Date)}this._validate(this.data,this._attrTypes),this._attrSummaries={};for(let t of this._attributes)this._attrSummaries[t]=Fw(this.data.map(e=>e[t]),this._attrTypes[t]);this._attributes.indexOf(_E)<0&&this.addAttr(_E,Vw.String,this.data.map((t,e)=>"r"+e)),this._buildAttributeValueIndexes()}clone(){let t=[];for(let e of this._data)t.push(Object.assign({},e));let e=new fE(t,this.url,Object.assign({},this._attrTypes));return e.sourceDataTable=this,e}get id(){return this._id}get name(){return this.url?function(t){var e=t.indexOf("\\")>=0?t.lastIndexOf("\\"):t.lastIndexOf("/"),n=t.substring(e);0!==n.indexOf("\\")&&0!==n.indexOf("/")||(n=n.substring(1));return n}(this.url):this.id}get data(){return this._data}encodable(t){switch(t){case"x":case"y":case"width":case"height":case"radius":case"fillColor":case"strokeColor":case"text":return this.measures.concat(this.dimensions);default:return this.measures}}addAttr(t,e,n){this._data.forEach((e,r)=>e[t]=n[r]),t!==_E&&this._rawData.forEach((e,r)=>e[t]=n[r]),this._attrTypes[t]=e,this._attributes.includes(t)||this._attributes.push(t),this._attrSummaries[t]=Fw(n,e),this._clearDataCaches()}type(t){return this._attrTypes[t]}summary(t){return this._attrSummaries[t]}values(t){return this.data.map(e=>e[t])}unique(t){return this._attrSummaries[t].unique}order(t,e){this._attrSummaries[t].unique=e}load(t){this._data=t,this._clearDataCaches(),this.summarize()}rows(t={}){let e=this._getFilterKey(t);if(this._scopeTupleCache.has(e))return this._scopeTupleCache.get(e);let n=Object.entries(t);if(0===n.length)return this._scopeTupleCache.set(e,this.data),this.data;if(1===n.length&&n[0][0]===_E&&Array.isArray(n[0][1])){let t=n[0][1].map(t=>this._rowIdIndex.get(t)).filter(t=>t);return this._scopeTupleCache.set(e,t),t}let r=this.data;for(let[t,e]of n){if(Array.isArray(e)||dE(e))continue;let n=this._getRowsByAttributeValue(t,e);n&&n.length<r.length&&(r=n)}let i=r.filter(t=>n.every(([e,n])=>{if(dE(n)){let r=t[e];return(!("min"in n)||r>=n.min)&&(!("max"in n)||r<=n.max)}return Array.isArray(n)?n.includes(t[e]):t[e]==n}));return this._scopeTupleCache.set(e,i),i}_getRowsByAttributeValue(t,e){let n=this._attrValueIndexes.get(t);return n?n.get(e):void 0}_buildAttributeValueIndexes(){this._attrValueIndexes=new Map,this._rowIdIndex=new Map;for(let t of this._attributes){let e=new Map;for(let n of this.data){let r=n[t];e.has(r)||e.set(r,[]),e.get(r).push(n)}this._attrValueIndexes.set(t,e)}for(let t of this.data)this._rowIdIndex.set(t[_E],t)}_getFilterKey(t={}){return Object.entries(t).sort(([t],[e])=>t.localeCompare(e)).map(([t,e])=>dE(e)?t+":["+(e.min??"-inf")+","+(e.max??"+inf")+"]":t+":"+JSON.stringify(e)).join("|")}_clearDataCaches(){this._dataScopeCache&&this._dataScopeCache.clear(),this._scopeTupleCache&&this._scopeTupleCache.clear(),this._attrValueIndexes&&(this._attrValueIndexes.clear(),this._buildAttributeValueIndexes())}count(){return this.data.length}has(t){return this._attributes.indexOf(t)>=0}parseDate(t,e){let n=ry(e);for(let e of this.data){let r=e[t];null==r||null==r?(r="",e[t]=new Date(1899,11,31).getTime()):e[t]=n(r).getTime(),this._dateMap.set(e[t],r)}this._attrTypes[t]=Vw.Date,this._attrSummaries[t]=Fw(this.data.map(e=>e[t]),Vw.Date),this._clearDataCaches()}raw(t,e){return this.type(t)===Vw.Date?this._dateMap.get(e).toString():e}get dimensions(){let t=[];for(let e in this._attrTypes)this._attrTypes[e]!=Vw.Number&&this._attrTypes[e]!=Vw.Integer&&e!=fE.RowID&&t.push(e);return t.sort((t,e)=>this.unique(t).length-this.unique(e).length),t}get measures(){let t=[];for(let e in this._attrTypes)this._attrTypes[e]!==Vw.Number&&this._attrTypes[e]!==Vw.Integer||e==fE.RowID||t.push(e);return t}attrs(t){if(void 0===t)return this._attributes;let e=[];for(let n in this._attrTypes)this._attrTypes[n]===t&&n!=fE.RowID&&e.push(n);return e}summarize(){for(let t of this._attributes)this._attrSummaries[t]=Fw(this.data.map(e=>e[t]),this._attrTypes[t])}_validate(t,e){for(let n of t)for(let t in e){let r,i=e[t],s=n[t];if(null==n[t]||null==n[t])switch(i){case Vw.Boolean:r=!1;break;case Vw.Date:r=new Date(1899,11,31).getTime();break;case Vw.String:r="";break;default:r=0}else switch(i){case Vw.Boolean:r=s;break;case Vw.Date:r=Number.isInteger(s)&&s<=9999?new Date(s,0).getTime():Number.isInteger(s)?s:new Date(s+"").getTime(),this._dateMap.set(r,s);break;case Vw.String:r=s.toString();break;default:r=s}n[t]=r}}}function dE(t){return null!==t&&"object"==typeof t&&!Array.isArray(t)&&("min"in t||"max"in t)}function pE(t){return t.dataScope?Jw(t.dataScope):t.parent&&t.parent.dataScope?Jw(t.parent.dataScope):void 0}const _E="mascot_rowId";class gE{constructor(t,e){this._id=Pw.TreeData+Dw(),this.initialize(t,e)}initialize(t,e){this.url=e,this._data=t,this._nodeList=[],this._linkList=[],this._nodeHash={},this._traverse(t,this._nodeList,this._linkList),this._nodeTable=new fE(this._nodeList,"nodes"),this._linkTable=new fE(this._linkList,"links"),this._nodeTable.tree=this,this._linkTable.tree=this}get nodeTable(){return this._nodeTable}get linkTable(){return this._linkTable}_traverse(t,e,n,r=0){let i={};xE in t||(t[xE]="n"+e.length),e.push(i),t._depth=r;for(let s in t)if("children"==s&&t[s]&&t[s].length>0)for(let i of t[s]){let s=this._traverse(i,e,n,r+1);n.push({parent:t[xE],child:s})}else i[s]=t[s];return this._nodeHash[i[xE]]=i,i[xE]}getNodeDataScopeRef(t){return aE(cE(this._nodeTable),_E,t[_E])}getNode(t){return this._nodeHash[t]}getRoot(){return this._nodeTable.data[0]}getChildren(t){let e=t[xE],n=[],r=this._linkTable.data,i=this._nodeTable.data;for(let t in r)if(r[t].parent==e){let e=r[t].child,s=i.findIndex(t=>t[xE]==e);n.push(i[s])}return n}getParent(t){let e=t[xE],n=this._linkTable.data,r=this._nodeTable.data;for(let t in n)if(n[t].child==e){let e=n[t].parent,i=r.findIndex(t=>t[xE]==e);return r[i]}}}function yE(t){return Jw(t.dataScope).tree}class mE{constructor(t,e){this._id=Pw.NetworkData+Dw(),this.initialize(t,e)}initialize(t,e){this.url=e,this._nodeTable=new fE(t.nodes,this._id+"_nodes"),this._linkTable=new fE(t.links,this._id+"_links"),this._nodeTable.graph=this,this._linkTable.graph=this,this._rawNodes=t.nodes,this._rawLinks=t.links,this._nodeHash={};for(let e of t.nodes)this._nodeHash[e[xE]]=e}get nodeTable(){return this._nodeTable}get linkTable(){return this._linkTable}get nodeList(){return this._rawNodes}get linkList(){return this._rawLinks}getNode(t){return this._nodeHash[t]}getLinks(t){let e=t[xE],n=this._rawLinks,r=[];for(let t in n)n[t].target!==e&&n[t].source!==e||r.push(n[t]);return r}buildNodeHierarchy(t){let e={};return e[xE]="root",vE(e,this._rawNodes,t),new gE(e,this.url)}}function bE(t){return Jw(t.dataScope).graph}function vE(t,e,n){if(0===e.length||0===n.length)return;"children"in t||(t.children=[]);let r={};for(let t of e){let e=t[n[0]];e in r||(r[e]=[]),r[e].push(t)}if(1===n.length)for(let e in r){let n={children:r[e]};n[xE]=e,t.children.push(n)}else for(let e in r){let i={};i[xE]=e,t.children.push(i),vE(i,r[e],n.slice(1))}}const xE="id";function wE(t,e){return fetch(e,{method:t}).then(t=>t.ok?t.text():(console.log(t.status),Promise.reject({status:t.status,statusText:t.statusText}))).catch(t=>(console.log(t),Promise.reject({status:t.status,statusText:t.statusText})))}class EE{constructor(t,e,n){this._id="predicate_"+Dw(),this._type=t||AE.POINT,this._variableType=e,this._variableName=n,this._value=void 0}get type(){return this._type}get value(){return this._value}set value(t){this._value=t}get id(){return this._id}get variableType(){return this._variableType}get variableName(){return this._variableName}}const AE=Object.freeze({POINT:"point",INTERVAL:"interval",LIST:"list"});class SE extends EE{constructor(t,e,n){super(t,e,n)}testElement(t){let e;if("attribute"==this._variableType){if(!t.dataScope)return!1;e=t.datum[this._variableName]}else e=t[this._variableName];return this._value[0]<=e&&this._value[1]>=e}testTuple(t){if("attribute"==this._variableType){let e=t[this._variableName];return this._value[0]<=e&&this._value[1]>=e}return!1}}class TE extends EE{constructor(t,e,n){super(t,e,n)}addValue(t){this._value||(this._value=[]),this._value.push(t)}resetValue(){this._value=void 0}testElement(t){if("attribute"==this._variableType){if(!t.dataScope)return!1;let e=Array.from(new Set(t.data.map(t=>t[this._variableName])));return 1===e.length&&this._value.indexOf(e[0])>=0}return this._value.indexOf(t[this._variableName])>=0}testTuple(t){if("attribute"==this._variableType){let e=t[this._variableName];return this._value.indexOf(e)>=0}return!1}}class CE extends EE{constructor(t,e,n){super(t,e,n)}testElement(t){if("attribute"==this._variableType){if(!t.dataScope)return!1;return t.datum[this._variableName]==this._value}return t[this._variableName]==this._value}testTuple(t){if("attribute"==this._variableType){let e=t[this._variableName];return this._value===e}return!1}equals(t){return this.type===t.type&&this.variableName===t.variableName&&this.value===t.value}}function kE(t){let e,n="attribute"in t?"attribute":"property",r=t[n];switch(t.type){case AE.LIST:e=new TE(t.type,n,r);break;case AE.INTERVAL:e=new SE(t.type,n,r);break;case AE.POINT:default:e=new CE(t.type,n,r)}return e.value=t.value,e}function RE(t,e){for(let n of e)if(!n.testElement(t))return!1;return!0}const ME={svg:void 0,getSVG:function(){return window?(void 0===this.svg&&(this.svg=document.createElementNS("http://www.w3.org/2000/svg","svg"),this.svg.style.visibility="hidden",this.svg.style.pointerEvents="none",this.svg.setAttribute("aria-hidden","true"),document.body.appendChild(this.svg)),this.svg):null}};function OE(t,e,n,r,i){const s=i*Math.PI/180,o=t-n,a=e-r;return{x:o*Math.cos(s)-a*Math.sin(s)+n,y:o*Math.sin(s)+a*Math.cos(s)+r}}function NE(t,e,n,r){return Math.sqrt(Math.pow(t-n,2)+Math.pow(e-r,2))}const IE=Object.freeze({fillColor:"fill",strokeColor:"stroke",strokeWidth:"stroke-width",fillOpacity:"fill-opacity",strokeOpacity:"stroke-opacity",strokeDash:"stroke-dasharray",opacity:"opacity",fontSize:"font-size",fontFamily:"font-family",fontWeight:"font-weight",visibility:"visibility",cursor:"cursor"});class PE{constructor(t,e,n,r){this._x=t+n/2,this._y=e+r/2,this._width=n,this._height=r}translate(t,e){this._x+=t,this._y+=e}toJSON(){let t={};return t.x=this._x,t.y=this._y,t.width=this._width,t.height=this._height,t}union(t){let e=d3.min([this.left,t.left]),n=d3.min([this.top,t.top]),r=d3.max([this.right,t.right]),i=d3.max([this.bottom,t.bottom]);return new PE(e,n,r-e,i-n)}clone(){return new PE(this.left,this.top,this._width,this._height)}get left(){return this._x-this._width/2}set left(t){this._x=t+this._width/2}get right(){return this._x+this._width/2}set right(t){this._x=t-this._width/2}get top(){return this._y-this._height/2}set top(t){this._y=t+this._height/2}get bottom(){return this._y+this._height/2}set bottom(t){this._y=t-this._height/2}get x(){return this._x}get y(){return this._y}get center(){return this.x}get middle(){return this.y}get width(){return this._width}setWidth(t,e){switch(e){case zE.RIGHT:this._x=this.right-t/2;break;case zE.CENTER:this._width=2*t;break;default:this._x=this.left+t/2}this._width=t}get height(){return this._height}setHeight(t,e){switch(e){case zE.TOP:this._y=this.top+t/2;break;case zE.MIDDLE:this._height=2*t;break;default:this._y=this.bottom-t/2}this._height=t}contains(t,e){return this.left<=t&&this.right>=t&&this.top<=e&&this.bottom>=e}intersects(t){return!(this.right<t.left||this.bottom<t.top||this.left>t.right||this.top>t.bottom)}}function LE(t){let e=t[0].clone();for(let n=1;n<t.length;n++)e=e.union(t[n]);return e}function DE(t){return LE(("vertex"==t[0].type||"segment"==t[0].type?t.map(t=>t.parent):t).map(t=>t.refBounds?t.refBounds:t.bounds))}function VE(t){return LE(("vertex"==t[0].type||"segment"==t[0].type?t.map(t=>t.parent):t).map(t=>t.bounds))}function BE(t){let e=JE(t);for(let t of e)t._updateBounds();let n=[];for(let t of e)t.parent&&!n.includes(t.parent)&&n.push(t.parent);for(let t of n)BE(t)}const zE=Object.freeze({TOP:"top",LEFT:"left",RIGHT:"right",BOTTOM:"bottom",CENTER:"center",MIDDLE:"middle"});class FE{constructor(t){if(this._dataScopeRef=void 0,this._type="type"in t?t.type:Pw.Mark,this._id=t.id?t.id:this._type+"_"+Dw(),this._classId=void 0,this._bounds=void 0,this._rotate=void 0,this._refBounds=void 0,this._dirty=!0,this._clipMask=void 0,this._cursor=void 0,this._styles={},void 0!==t)for(let e in IE)e in t&&(this.styles[e]=t[e])}get scene(){return aA(this)}get datum(){return eE(this._dataScopeRef)}get data(){return tE(this._dataScopeRef)}set strokeColor(t){this.styles.strokeColor!==t&&(this.styles.strokeColor=t,this._dirty=!0)}get strokeColor(){return this.styles.strokeColor}set strokeWidth(t){this.styles.strokeWidth!==t&&(this.styles.strokeWidth=t,this._dirty=!0)}get strokeWidth(){return this.styles.strokeWidth}get strokeDash(){return this.styles.strokeDash}set strokeDash(t){this.styles.strokeDash!==t&&(this.styles.strokeDash=t,this._dirty=!0)}set fillColor(t){this.styles.fillColor!==t&&(this.styles.fillColor=t,this._dirty=!0)}get fillColor(){return this.styles.fillColor}get rotation(){return this._rotate}get cursor(){return this._cursor}get id(){return this._id}set id(t){this.getScene()?(delete this.getScene()._itemMap[this._id],this._id=t,this.getScene()._itemMap[t]=this):this._id=t}get classId(){return this._classId?this._classId:this._id}set classId(t){this._classId=t}get type(){return this._type}get bounds(){return this._bounds||this._updateBounds(),this._bounds}get refBounds(){return this._refBounds?this._refBounds:this.bounds}set dataScope(t){this._dataScopeRef=Kw(t)}get dataScope(){return this._dataScopeRef}get styles(){return this._styles}set styles(t){this._styles!==t&&(this._styles=t,this._dirty=!0)}set visibility(t){this.styles.visibility!==t&&(this.styles.visibility=t,this._dirty=!0)}get visibility(){return this.styles.visibility?this.styles.visibility:"visible"}get opacity(){return"opacity"in this.styles?this.styles.opacity:1}set opacity(t){this.styles.opacity!==t&&(this.styles.opacity=t,this._dirty=!0)}get z(){return"z"in this.styles?this.styles.z:0}set z(t){this.styles.z!==t&&(this.styles.z=t,this._dirty=!0)}copyPropertiesTo(t){t.styles=Object.assign({},this.styles),this._dataScopeRef&&(t._dataScopeRef=Zw(this._dataScopeRef))}createClipMask(){let t=this._bounds;this._clipMask=new PE(t.left,t.top,t.width,t.height)}get clipMask(){return this._clipMask}}function GE(t){return t instanceof FE&&t.type!==Pw.Gridlines}const jE=Object.freeze({Area:"area",Rect:"rect",Ellipse:"ellipse",Circle:"circle",Pie:"pie",Ring:"ring",Arc:"arc",Line:"line",Path:"path",Image:"image",SimpleText:"text",RichText:"richText",Polygon:"polygon",BezierCurve:"bezierCurve"});class UE{constructor(){this._refElements=[]}addRefElement(t){this._refElements.push(t)}get refElements(){return this._refElements}clearRefElements(){this._refElements=[]}}function YE(t){return t instanceof UE}const HE=Object.freeze({GRID:"grid",STACK:"stack",PACKING:"packing",FORCE:"force",DIRECTED:"directedgraph",TIDYTREE:"tidytree",TREEMAP:"treemap",STRATA:"strata",CIRCULAR:"circular",CLUSTER:"cluster"});function WE(t,e){return!!(t.startsWith("h")&&[zE.LEFT,zE.CENTER,zE.RIGHT].indexOf(e)>=0)||(!!(t.startsWith("v")&&[zE.TOP,zE.MIDDLE,zE.BOTTOM].indexOf(e)>=0)||(console.warn("Invalid alignment:",e),!1))}class qE{constructor(t){this._id=t+"_"+Dw(),this._type=t,this._inputVars=[],this._outputVars=[]}run(){}get id(){return this._id}get type(){return this._type}get inputVars(){return this._inputVars}get outputVars(){return this._outputVars}get outputVar(){return this._outputVars[0]}isIsolated(){return 0==this._inputVars.length&&0==this._outputVars.length}}const $E=Object.freeze({CONDUIT:"conduit",ENCODER:"encoder",LAYOUT:"layout",LINK_PLACER:"linkRouter",CONSTRAINT:"constraint",EVAL_BBOX:"evalBBox",EVAL_REFBOUNDS:"evalRefBounds",AFFIXER:"affixer",ALIGNER:"aligner",DATA_EXTRACTOR:"dataExtractor",SCALE_BUILDER:"scaleBuilder",AXIS_PATH_PLACER:"axisPathPlacer",AXIS_TICKS_PLACER:"axisTicksPlacer",AXIS_LABELS_PLACER:"axisLabelsPlacer",AXIS_TITLE_PLACER:"axisTitlePlacer",GRIDLINES_PLACER:"gridlinesPlacer",GRID_LAYOUT:"gridLayout",STACK_LAYOUT:"stackLayout",PACK_LAYOUT:"packLayout",FORCE_LAYOUT:"forceLayout",DIRECTED_LAYOUT:"directedLayout",TIDY_TREE_LAYOUT:"tidyTreeLayout",TREEMAP_LAYOUT:"treemapLayout",STRATA_LAYOUT:"strataLayout",CIRCULAR_LAYOUT:"circularLayout",CLUSTER_LAYOUT:"clusterLayout",BIN_TRANSFORMER:"binTransformer",FILTER_TRANSFORMER:"filterTransformer",KDE_TRANSFORMER:"kdeTransformer",CUSTOM_TRANSFORMER:"customTransformer",REPOPULATE:"repopulate",TARGET_EVALUATOR:"targetEvaluator",TARGET_UPDATER:"targetUpdater"});class XE{constructor(t){this._id="v_"+Dw(),this._type=t,this._incomings=[],this._outgoings=[],this._undirected=[]}get id(){return this._id}get incomingEdges(){return this._incomings}get outgoingEdges(){return this._outgoings}get undirectedEdges(){return this._undirected}get type(){return this._type}get incomingDataflow(){for(let t of this._incomings)if(t.fromNode&&t.fromNode instanceof qE)return t.fromNode;return null}isIsolated(){return 0==this._incomings.length&&0==this._outgoings.length}}const KE=Object.freeze({CHANNEL:"channel",PROPERTY:"property",STATE:"state",ATTRIBUTE:"attribute",ITEMS:"items",DATASCOPE:"datascope",ATTR_VALUE:"dataValue",BOUNDS:"bounds",SCALE:"scale",CONDITION_RESULT:"conditionResult",AFFIXATION:"affixation",ALIGNMENT:"alignment",EVT_CTX:"evtContext"});class ZE extends Map{constructor(t){super(),this._scene=t}get scene(){return this._scene}var(t){if("string"!=typeof t||0===t.length)throw new Error("state.var(...) expects a non-empty variable name");return{type:"stateVar",key:t,stateContext:this}}set(t,e){const n=this.get(t);return super.set(t,e),n!==e&&(this._scene.depGraph.getVariable(KE.STATE,t,this),this._scene.onChange(KE.STATE,t,this)),this}}function JE(t,e){let n=aA(t);return"vertex"===t.type||"segment"===t.type?function(t,e){let n=aA(t),r=e||n;if("vertex"===t.type){return QE(t,rA(r,[{property:"classId",value:t.parent.classId}],!0))}if("segment"===t.type){return nA(t,rA(r,[{property:"classId",value:t.parent.classId}],!0))}return t.classId?rA(r,[{property:"classId",value:t.classId}]):[t]}(t,e):t.classId?rA(e||n,[{property:"classId",value:t.classId}]):[t]}function QE(t,e){if(!t.classId){if(t.dataScope){let n=t.parent;if(!n)throw new Error("vertex has no parent mark");let r=[];if(n.type===Pw.Area){let i=n.vertices.indexOf(t)<n.vertices.length/2;for(let t of e){let e=i?t.vertices.slice(0,t.vertices.length/2):t.vertices.slice(t.vertices.length/2);r=r.concat(e.filter(t=>t.dataScope))}}else for(let t of e)r=r.concat(t.vertices.filter(t=>t.dataScope));return r}{let n=t.parent;if(!n)throw new Error("vertex has no parent mark");let r=n.vertices.indexOf(t),i=[];for(let t of e)i.push(t.vertices[r]);return i}}}function tA(t,e){return t.id+"_v_"+t._vertices._ids[e]}function eA(t,e){let n=t.parent,r=t._index,i=[];if(t.dataScope)if(n.type===Pw.Area){let t=r<n._vertices.length/2;for(let n of e){let e=t?0:n._vertices.length/2,r=t?n._vertices.length/2:n._vertices.length,s=[];for(let t=e;t<r;t++)n._vertices.hasDataScope(t)&&s.push(t);i.push({parent:n,indices:s})}}else for(let t of e){let e=[];for(let n=0;n<t._vertices.length;n++)t._vertices.hasDataScope(n)&&e.push(n);i.push({parent:t,indices:e})}else for(let t of e)i.push({parent:t,indices:[r]});return i}function nA(t,e){if(t._dataScopeRef){if(!t.parent)throw new Error("segment has no parent mark");let n=[];for(let t of e)n=n.concat(t.segments);return n}{let n=t.parent;if(!n)throw new Error("segment has no parent mark");let r=n.segments.indexOf(t),i=[];for(let t of e)i.push(t.segments[r]);return i}}function rA(t,e,n){let r=[];return oA(t,e?e.map(t=>kE(t)):[],r,n),r}function iA(t,e){let n=t.children.filter(t=>t.type==Pw.Collection);if(0!==n.length)for(let t of n){let n=t;for(;n&&n.dataScope;){if(rE(n.dataScope,e))return n;n=n.children?n.children[0]:void 0}}}function sA(t){return t.type==Pw.Collection?t:t.parent?sA(t.parent):void 0}function oA(t,e,n,r){if(t)if(RE(t,e)&&n.push(t),t.vertices&&r)for(let r of t.vertices.concat(t.segments))RE(r,e)&&n.push(r);else if(t.children&&t.children.length>0)for(let i of t.children)oA(i,e,n,r)}function aA(t){let e;if(e=Array.isArray(t)?t[0]:t,e){if(e instanceof ZE)return e.scene;if(e._scene)return e._scene;for(YE(e)&&e.group&&(e=e.group),e.id.startsWith("encoding_")&&(e=e.element);e;){if(e.type==Pw.Scene)return e;e=e.parent}}}function lA(t){let e=t;for("vertex"!=e.type&&"segment"!=e.type||(e=e.parent);e.parent&&[Pw.Collection,Pw.Glyph].includes(e.parent.type);)e=e.parent;return e}function cA(t,e){let n=[];if(uA(t,n),e){let t={};for(let e of n)t[e.classId]=e;return Object.values(t)}return n}function uA(t,e){if(GE(t))e.push(t);else if(t.children&&!Object.values(Lw).includes(t.type))for(let n of t.children)uA(n,e)}class hA extends XE{constructor(t,e,n){super(t),this._channel=e,this._elem=n}get channel(){return this._channel}get element(){return this._elem}}const fA=Object.freeze({X:"x",Y:"y",WIDTH:"width",HEIGHT:"height",RADIUS:"radius",FILLCOLOR:"fillColor",STROKECOLOR:"strokeColor",FILLGRADIENT:"fillGradient",TEXT:"text",ANGLE:"angle",THICKNESS:"thickness",AREA:"area",FONTSIZE:"fontSize",RADIALDISTANCE:"radialDistance",STROKEWIDTH:"strokeWidth",OPACITY:"opacity",VISIBILITY:"visibility",STRENGTH:"strength",SRC:"src",Z:"z"});class dA extends XE{constructor(t,e,n){super(t),this._property=e,this._elem=n}get property(){return this._property}get element(){return this._elem}}function pA(t){return t in _A?_A[t]:t}const _A=Object.freeze({numCols:"layoutParameter",numRows:"layoutParameter",startCorner:"layoutParameter",direction:"layoutParameter"}),gA=Object.freeze({AXIS_ORIENTATION:"axisOrientation",AXIS_PATH_POSITION:"axisPathPosition",AXIS_TICK_SIZE:"axisTickSize",AXIS_TICK_OFFSET:"axisTickOffset",AXIS_TICKS_POSITION:"axisTicksPosition",AXIS_LABELS_POSITION:"axisLabelsPosition",AXIS_TITLE_POSITION:"axisTitlePosition",AXIS_LABEL_OFFSET:"axisLabelOffset",AXIS_LABEL_FORMAT:"axisLabelFormat",AXIS_FONT_SIZE:"axisFontSize",LEGEND_POSITION:"legendPosition",GRIDLINES_POSITION:"gridlinesPosition",INCLUDE_ZERO:"includeZero",FLIP_SCALE:"flipScale",RANGE_START:"rangeStart",RANGE_EXTENT:"rangeExtent",BASE_LINE:"baseline",LAYOUT_PARAMETER:"layoutParameter",NUM_BINS:"numBins",CHILDREN_ORDER:"childrenOrder",ATTRIBUTE:"attribute"});function yA(t){let e=t?aA(t):void 0;e&&e._clearInteractionCaches&&e._clearInteractionCaches()}function mA(t,e){if(yA(t),e.findVariable(KE.BOUNDS,[t]))return;let n=e.getVariable(KE.BOUNDS,t),r=e.createOneWayDependency($E.EVAL_BBOX);switch(e.connect(r,n),t.type){case Pw.Circle:case Pw.Polygon:{let n=e.getVariable(KE.CHANNEL,"x",t),i=e.getVariable(KE.CHANNEL,"y",t),s=e.getVariable(KE.CHANNEL,"radius",t),o=e.getVariable(KE.CHANNEL,"area",t);e.connect(s,r),e.connect(n,r),e.connect(i,r),e.connect(o,r);break}case Pw.Area:case Pw.Line:case Pw.BezierCurve:case Pw.Path:case Pw.Image:{let n=e.getVariable(KE.CHANNEL,"x",t),i=e.getVariable(KE.CHANNEL,"y",t),s=e.getVariable(KE.CHANNEL,"width",t),o=e.getVariable(KE.CHANNEL,"height",t);e.connect(n,r),e.connect(i,r),e.connect(s,r),e.connect(o,r);break}case Pw.Rect:{let n=e.getVariable(KE.CHANNEL,"x",t),i=e.getVariable(KE.CHANNEL,"y",t),s=e.getVariable(KE.CHANNEL,"width",t),o=e.getVariable(KE.CHANNEL,"height",t),a=e.getVariable(KE.CHANNEL,"area",t);e.connect(n,r),e.connect(i,r),e.connect(s,r),e.connect(o,r),e.connect(a,r);break}case Pw.SimpleText:case Pw.RichText:{let n=e.getVariable(KE.CHANNEL,"x",t),i=e.getVariable(KE.CHANNEL,"y",t),s=e.getVariable(KE.CHANNEL,"text",t);e.connect(n,r),e.connect(i,r),e.connect(s,r);break}case Pw.Ring:{let n=e.getVariable(KE.CHANNEL,"x",t),i=e.getVariable(KE.CHANNEL,"y",t),s=e.getVariable(KE.CHANNEL,"innerRadius",t),o=e.getVariable(KE.CHANNEL,"outerRadius",t);e.connect(n,r),e.connect(i,r),e.connect(s,r),e.connect(o,r);break}case Pw.Pie:case Pw.Arc:{let n=e.getVariable(KE.CHANNEL,"x",t),i=e.getVariable(KE.CHANNEL,"y",t),s=e.getVariable(KE.CHANNEL,"innerRadius",t),o=e.getVariable(KE.CHANNEL,"outerRadius",t),a=e.getVariable(KE.CHANNEL,"startAngle",t),l=e.getVariable(KE.CHANNEL,"endAngle",t),c=e.getVariable(KE.CHANNEL,"angle",t),u=e.getVariable(KE.CHANNEL,"thickness",t);e.connect(n,r),e.connect(i,r),e.connect(s,r),e.connect(o,r),e.connect(a,r),e.connect(l,r),e.connect(c,r),e.connect(u,r);break}}r.run()}function bA(t,e){if(t.type===Pw.Axis){let n=e.findVariable(KE.PROPERTY,[gA.AXIS_PATH_POSITION,t]).incomingDataflow;console.log(n,t),e.deleteOperator(n),n=e.findVariable(KE.PROPERTY,[gA.AXIS_TICKS_POSITION,t]).incomingDataflow,e.deleteOperator(n),n=e.findVariable(KE.PROPERTY,[gA.AXIS_LABELS_POSITION,t]).incomingDataflow,e.deleteOperator(n),n=e.findVariable(KE.PROPERTY,[gA.AXIS_TITLE_POSITION,t]).incomingDataflow,e.deleteOperator(n)}else if(t.type===Pw.Gridlines){let n=e.findVariable(KE.PROPERTY,[gA.GRIDLINES_POSITION,t]).incomingDataflow;e.deleteOperator(n)}}function vA(t,e){if(yA(t),e.findVariable(KE.BOUNDS,[t]))return;let n=e.getVariable(KE.BOUNDS,t),r=e.getVariable(KE.CHANNEL,"x",t),i=e.getVariable(KE.CHANNEL,"y",t),s=e.getVariable(KE.CHANNEL,"width",t),o=e.getVariable(KE.CHANNEL,"height",t),a=e.createOneWayDependency($E.EVAL_BBOX);e.connect(r,a),e.connect(i,a),e.connect(s,a),e.connect(o,a),e.connect(a,n),a.run()}function xA(t,e){yA(t);let n=e.getVariable(KE.BOUNDS,t),r=e.getVariable(KE.CHANNEL,"x",t),i=e.getVariable(KE.CHANNEL,"y",t),s=e.getVariable(KE.CHANNEL,"width",t),o=e.getVariable(KE.CHANNEL,"height",t),a=e.createOneWayDependency($E.EVAL_BBOX);e.connect(r,a),e.connect(i,a),e.connect(s,a),e.connect(o,a),e.connect(a,n),a.run()}function wA(t,e,n){yA(t);let r=n.getVariable(KE.BOUNDS,t),i=n.getVariable(KE.BOUNDS,e),s=n.getIncomingDataflowOperator($E.EVAL_BBOX,r),o=i.outgoingEdges.find(t=>t.fromNode===i&&t.toNode===s);if(o&&n.disconnect(i,s,o),t.layout){let r=n.getVariable(KE.CHANNEL,"x",e),i=n.getIncomingDataflowOperator(SA(t.layout.type),r);i&&n.deleteOperator(i)}}function EA(t,e,n){yA(t);let r=n.getVariable(KE.BOUNDS,t),i=n.getVariable(KE.BOUNDS,e),s=n.getIncomingDataflowOperator($E.EVAL_BBOX,r);n.connect(i,s),n.connect(s,r),t.layout&&CA(t,t.layout,n)}function AA(t,e){yA(t);let n=e.getVariable(KE.BOUNDS,t),r=e.getVariable(KE.CHANNEL,"x",t),i=e.getVariable(KE.CHANNEL,"y",t),s=e.getIncomingDataflowOperator($E.EVAL_BBOX,n);e.connect(r,s),e.connect(i,s);for(let n of t.children)e.connect(e.getVariable(KE.BOUNDS,n),s);e.connect(s,n),s.run()}function SA(t){switch(t){case HE.GRID:return $E.GRID_LAYOUT;case HE.STACK:return $E.STACK_LAYOUT;case HE.PACKING:return $E.PACK_LAYOUT;case HE.FORCE:return $E.FORCE_LAYOUT;case HE.DIRECTED:return $E.DIRECTED_LAYOUT;case HE.TIDYTREE:return $E.TIDY_TREE_LAYOUT;case HE.TREEMAP:return $E.TREEMAP_LAYOUT;case HE.STRATA:return $E.STRATA_LAYOUT;case HE.CIRCULAR:return $E.CIRCULAR_LAYOUT;case HE.CLUSTER:return $E.CLUSTER_LAYOUT}}function TA(t,e,n){let r=n.getVariable(KE.PROPERTY,gA.CHILDREN_ORDER,t),i=n.getOutgoingDataflowOperator(SA(e.type),r);n.deleteOperator(i)}function CA(t,e,n){let r=e?e.type:"none",i=r===HE.TREEMAP?cA(t)[0]:t.children[0];if(!i)return;let s=n.getVariable(KE.CHANNEL,"width",i),o=n.getVariable(KE.CHANNEL,"height",i),a=n.getVariable(KE.PROPERTY,gA.CHILDREN_ORDER,t),l=n.getVariable(KE.CHANNEL,"x",i),c=n.getVariable(KE.CHANNEL,"y",i),u=n.getVariable(KE.CHANNEL,"visibility",i),h=n.getVariable(KE.PROPERTY,gA.LAYOUT_PARAMETER,e),f=n.getOutgoingDataflowOperator(SA(r),a);if(n.connect(s,f),n.connect(o,f),n.connect(a,f),n.connect(h,f),n.connect(u,f),n.connect(f,l),n.connect(f,c),n.disconnectChannelVarFromBBoxOperator(s),n.disconnectChannelVarFromBBoxOperator(o),i.type===Pw.Arc||i.type===Pw.Pie){let t=n.getVariable(KE.CHANNEL,"angle",i),e=n.getVariable(KE.CHANNEL,"thickness",i);n.connect(t,f),n.connect(e,f)}else if(i.type===Pw.Circle){let t=n.getVariable(KE.CHANNEL,"area",i),e=n.getVariable(KE.CHANNEL,"radius",i);n.connect(t,f),n.connect(e,f),n.disconnectChannelVarFromBBoxOperator(t),n.disconnectChannelVarFromBBoxOperator(e)}else if(i.type===Pw.Rect){let t=n.getVariable(KE.CHANNEL,"area",i);n.connect(t,f),n.disconnectChannelVarFromBBoxOperator(t)}if(f.run(),i.links&&kA(i,n),i.children&&i.children[0]){let t=n.getVariable(KE.BOUNDS,i.children[0]),e=n.getVariable(KE.CHANNEL,"x",i).incomingDataflow;e&&n.connect(t,e),n.disconnectChannelVarFromBBoxOperator(t)}}function kA(t,e){let n=t.links[0],r=e.getVariable(KE.CHANNEL,"x",t),i=e.getVariable(KE.CHANNEL,"x",n),s=e.getVariable(KE.CHANNEL,"strokeWidth",n),o=e.getVariable(KE.CHANNEL,"strength",n),a=e.createOneWayDependency($E.LINK_PLACER);e.connect(r,a),e.connect(s,a),e.connect(o,a),e.connect(a,i)}function RA(t,e,n){if(!t||"segment"!==t.type)return;let r=pE(t),i=r?n.findVariable(KE.ITEMS,[r]):null;if(i)for(let t of i.outgoingEdges)if(t.isDirected&&t.toNode.type===$E.REPOPULATE)return void n.connect(t.toNode,e)}function MA(t,e,n){let r=t.attribute,i=t.channel,s=t.element,o=e.createOneWayDependency($E.ENCODER);if(["width","height"].includes(t.channel)&&s.type===Pw.Area){let t=e.getVariable(KE.PROPERTY,gA.BASE_LINE,s);e.connect(t,o)}if(n){let r=e.getVariable(KE.ATTR_VALUE,n),a=e.getVariable(KE.SCALE,n),l=e.getVariable(KE.CHANNEL,i,s);e.connect(a,o),e.connect(o,l),r.addLinkedEncoding(t),a.addLinkedEncoding(t);let c=e.getVariable(KE.DATASCOPE,t.element),u=r.incomingDataflow;u&&c&&(e.connect(c,u),RA(t.element,c,e)),r.incomingDataflow.run()}else{let n=e.getVariable(KE.ATTRIBUTE,r,pE(s),t),a=e.getVariable(KE.PROPERTY,gA.INCLUDE_ZERO,t),l=e.getVariable(KE.ATTR_VALUE,t),c=e.getVariable(KE.DATASCOPE,s),u=e.createOneWayDependency($E.DATA_EXTRACTOR);e.connect(n,u),e.connect(a,u),e.connect(c,u),e.connect(u,l),RA(s,c,e),u.run();let h=e.getVariable(KE.PROPERTY,gA.RANGE_START,t),f=e.getVariable(KE.PROPERTY,gA.RANGE_EXTENT,t),d=e.getVariable(KE.PROPERTY,gA.FLIP_SCALE,t),p=e.getVariable(KE.SCALE,t),_=e.createOneWayDependency($E.SCALE_BUILDER);e.connect(h,_),e.connect(f,_),e.connect(d,_),e.connect(l,_),e.connect(_,p),_.run();let g=e.getVariable(KE.CHANNEL,i,s);e.connect(p,o),e.connect(o,g),o.run()}}function OA(t,e){let n=e.getVariable(KE.PROPERTY,gA.AXIS_ORIENTATION,t),r=e.getVariable(KE.BOUNDS,t.elements[0].parent),i=e.getVariable(KE.PROPERTY,gA.AXIS_PATH_POSITION,t),s=e.createOneWayDependency($E.AXIS_PATH_PLACER);e.connect(n,s),e.connect(r,s),e.connect(s,i),s.run();let o=e.getVariable(KE.PROPERTY,gA.AXIS_TICK_OFFSET,t),a=e.getVariable(KE.PROPERTY,gA.AXIS_TICK_SIZE,t),l=e.createOneWayDependency($E.AXIS_TICKS_PLACER),c=e.getVariable(KE.PROPERTY,gA.AXIS_TICKS_POSITION,t);e.connect(i,l),e.connect(o,l),e.connect(a,l),e.connect(l,c),l.run();let u=e.getVariable(KE.PROPERTY,gA.AXIS_LABEL_OFFSET,t),h=e.getVariable(KE.PROPERTY,gA.AXIS_LABEL_FORMAT,t),f=e.getVariable(KE.PROPERTY,gA.AXIS_FONT_SIZE,t),d=e.createOneWayDependency($E.AXIS_LABELS_PLACER),p=e.getVariable(KE.PROPERTY,gA.AXIS_LABELS_POSITION,t);e.connect(i,d),e.connect(u,d),e.connect(h,d),e.connect(f,d),e.connect(d,p),d.run();let _=e.getVariable(KE.PROPERTY,gA.AXIS_TITLE_POSITION,t),g=e.createOneWayDependency($E.AXIS_TITLE_PLACER);e.connect(i,g),e.connect(g,_),g.run();let y=e.getVariable(KE.BOUNDS,t),m=e.getIncomingDataflowOperator($E.EVAL_BBOX,y);e.connect(c,m),e.connect(p,m),e.connect(m,y)}function NA(t,e){let n=e.getVariable(KE.PROPERTY,gA.AXIS_ORIENTATION,t),r=e.getVariable(KE.BOUNDS,lA(t.elements[0])),i=e.getVariable(KE.PROPERTY,gA.AXIS_PATH_POSITION,t),s=e.createOneWayDependency($E.AXIS_PATH_PLACER);e.connect(n,s),e.connect(r,s),e.connect(s,i),s.run();let o=e.getVariable(KE.PROPERTY,gA.AXIS_TICK_OFFSET,t),a=e.getVariable(KE.PROPERTY,gA.AXIS_TICK_SIZE,t),l=e.createOneWayDependency($E.AXIS_TICKS_PLACER),c=e.getVariable(KE.PROPERTY,gA.AXIS_TICKS_POSITION,t);e.connect(i,l),e.connect(o,l),e.connect(a,l),e.connect(l,c),l.run();let u=e.getVariable(KE.PROPERTY,gA.AXIS_LABEL_OFFSET,t),h=e.getVariable(KE.PROPERTY,gA.AXIS_LABEL_FORMAT,t),f=e.getVariable(KE.PROPERTY,gA.AXIS_FONT_SIZE,t),d=e.createOneWayDependency($E.AXIS_LABELS_PLACER),p=e.getVariable(KE.PROPERTY,gA.AXIS_LABELS_POSITION,t);e.connect(i,d),e.connect(u,d),e.connect(h,d),e.connect(f,d),e.connect(d,p),d.run();let _=e.getVariable(KE.PROPERTY,gA.AXIS_TITLE_POSITION,t),g=e.createOneWayDependency($E.AXIS_TITLE_PLACER);e.connect(i,g),e.connect(g,_),g.run();let y=e.getVariable(KE.BOUNDS,t),m=e.getIncomingDataflowOperator($E.EVAL_BBOX,y);e.connect(c,m),e.connect(p,m),e.connect(m,y)}function IA(t,e){let n=e.getVariable(KE.BOUNDS,lA(t.elements[0])),r=e.getVariable(KE.PROPERTY,gA.GRIDLINES_POSITION,t),i=e.createOneWayDependency($E.GRIDLINES_PLACER);e.connect(n,i),e.connect(i,r),i.run();let s=e.getVariable(KE.BOUNDS,t),o=e.getIncomingDataflowOperator($E.EVAL_BBOX,s);e.connect(r,o),e.connect(o,s)}class PA{constructor(){this._id=this.type+Dw(),this._type=Pw.Group,this._dataScopeRef=void 0,this._bounds=void 0,this._layout=void 0,this._children=[],this._sortBy={property:_E,descending:!1},this._z=0}get id(){return this._id}get type(){return this._type}get datum(){return eE(this._dataScopeRef)}get data(){return tE(this._dataScopeRef)}get children(){return this._children}addChild(t){this._children.indexOf(t)>=0||(t.parent&&t.parent.removeChild(t),this._children.push(t),t.parent=this)}addChildAt(t,e){t.parent&&t.parent.removeChild(t),this.children.splice(e,0,t),t.parent=this}removeChild(t){let e=this.children.indexOf(t);e>=0&&(this.children.splice(e,1),t.parent=null)}removeChildAt(t){this.children[t].parent=null,this.children.splice(t,1)}removeAll(){for(let t of this.children)t.parent=null;this._children=[]}get dataScope(){return this._dataScopeRef}set dataScope(t){if(this._dataScopeRef=Kw(t),void 0===this._dataScopeRef)for(let t of this.children)t.dataScope=void 0;else for(let t of this.children)t.dataScope?t.dataScope=lE(t.dataScope,this._dataScopeRef):t.dataScope=this._dataScopeRef}getInternalEncodings(t){if(0==this.children.length)return[];let e=this.children[0],n=this.getScene(),r=Object.keys(n.encodings),i=[];for(;e;){if(e.classId&&i.indexOf(e.classId)<0&&i.push(e.classId),e.type===Pw.Glyph){e.children.forEach(t=>i.push(t.classId));break}if(!e.children)break;e=e.children[0]}let s=[];for(let e of r){let r=e.split("_");for(let o of i)r[0]==o&&n.encodings[e][t]&&s.push(n.encodings[e][t])}return s}get firstChild(){return this.children[0]}get lastChild(){return this.children[this.children.length-1]}set layout(t){if(this._layout=t,t&&(t.group=this),CA(this,t,this.scene._depGraph),this.children&&this.children.length>0){let t=cA(this,!0);for(let e of t)this.scene.onChange(KE.CHANNEL,"x",e)}}get layout(){return this._layout}get bounds(){return this._bounds||this._updateBounds(),this._bounds}get refBounds(){let t=this.children.map(t=>t.refBounds),e=d3.min(t.map(t=>t.left)),n=d3.min(t.map(t=>t.top)),r=d3.max(t.map(t=>t.right)),i=d3.max(t.map(t=>t.bottom));return new PE(e,n,r-e,i-n)}get x(){return this.bounds.x}get y(){return this.bounds.y}_updateBounds(){let t=this.children;if(t.length>0){this._bounds=t[0].bounds.clone();for(let e=1;e<t.length;e++)"hidden"!=t[e].visibility&&(this._bounds=this._bounds.union(t[e].bounds))}else this._bounds=new PE(0,0,0,0)}set visibility(t){let e="hidden"==t?"hidden":"visible";if(this.visibility!==e){this._visibility="hidden"==t?t:"visible";for(let e of this.children)e.visibility=t}}get visibility(){return this._visibility?this._visibility:"visible"}get z(){return this._z}set z(t){this._z!==t&&(this._z=t)}get scene(){return aA(this)}get sortBy(){return this._sortBy}}class LA extends PA{constructor(t){super(),this._type=Pw.Collection,this._id=t.id?t.id:this._type+"_"+Dw(),this._classId=this.id,this._childrenOrder=void 0,this._clipMask=void 0}get classId(){return this._classId}getSVGPathData(){let t="";for(let e of this.children)if(e.getSVGPathData)t+=e.getSVGPathData();else if(e.bounds){let n=e.bounds;t+=["M",n.left,n.top].join(" "),t+=["L",n.right,n.top].join(" "),t+=["L",n.right,n.bottom].join(" "),t+=["L",n.left,n.bottom,"Z"].join(" ")}return t}createClipMask(){let t=DE(this._children);this._clipMask=new PE(t.left,t.top,t.width,t.height)}get clipMask(){return this._clipMask}}class DA extends PA{constructor(t){if(super(),this._type=Pw.Glyph,this._id=t&&t.id?t.id:this.type+"_"+Dw(),this._classId=this._id,t&&t.children)for(let e of t.children)this.addChild(e)}get classId(){return this._classId}}const VA=Object.freeze({RowFirst:"rowFirst",ColumnFirst:"columnFirst"}),BA=Object.freeze({TopLeft:"topLeft",TopRight:"topRight",BottomLeft:"bottomLeft",BottomRight:"bottomRight"}),zA="horizontal",FA="vertical",GA="angular",jA="radial",UA={Left2Right:"l2r",Right2Left:"r2l",Top2Bottom:"t2b",Bottom2Top:"b2t"},YA=Object.freeze({CLOCKWISE:"clockwise",ANTI_CLOCKWISE:"anti-clockwise"}),HA=Object.freeze({INWARD:"inward",OUTWARD:"outward"});class WA{constructor(t,e){this.type="vertex",this.parent=t,this._index=e}_getStored(t){return this.parent._vertices.getProperty(this._index,t)}_setStored(t,e){this._getStored(t)!==e&&(this.parent._vertices.setProperty(this._index,t,e),this.parent._dirty=!0)}get datum(){return this.dataScope?eE(this.dataScope):this.parent.datum}get data(){return this.dataScope?tE(this.dataScope):this.parent.data}get dataScope(){return this.parent._vertices.getDataScopeRef(this._index)}set dataScope(t){this.dataScope!==t&&(this.parent._vertices.setDataScopeRef(this._index,t),this.parent._dirty=!0)}get bounds(){switch(this.shape){case"rect":return new PE(this.x-this.width/2,this.y-this.height/2,this.width,this.height);case"circle":return new PE(this.x-this.radius,this.y-this.radius,2*this.radius,2*this.radius);default:return new PE(this.x-.5,this.y-.5,1,1)}}get id(){return this.parent.id+"_v_"+this.parent._vertices._ids[this._index]}set polarAngle(t){this._setStored("polarAngle",t)}get polarAngle(){return this._getStored("polarAngle")}get _polarAngle(){return this.polarAngle}set _polarAngle(t){this.polarAngle=t}get scene(){return this.parent.scene}get x(){return this.parent._vertices._xs[this._index]}set x(t){this.parent._vertices._xs[this._index]!==t&&(this.parent._vertices._xs[this._index]=t,this.parent._dirty=!0)}get y(){return this.parent._vertices._ys[this._index]}set y(t){this.parent._vertices._ys[this._index]!==t&&(this.parent._vertices._ys[this._index]=t,this.parent._dirty=!0)}get shape(){return this._getStored("shape")}set shape(t){this._setStored("shape",t)}get width(){return this._getStored("width")}set width(t){this._setStored("width",t)}get height(){return this._getStored("height")}set height(t){this._setStored("height",t)}get radius(){return this._getStored("radius")}set radius(t){this._setStored("radius",t)}get fillColor(){return this._getStored("fillColor")}set fillColor(t){this._setStored("fillColor",t)}get opacity(){return this._getStored("opacity")}set opacity(t){this._setStored("opacity",t)}get strokeWidth(){return this._getStored("strokeWidth")}set strokeWidth(t){this._setStored("strokeWidth",t)}get strokeColor(){return this._getStored("strokeColor")}set strokeColor(t){this._setStored("strokeColor",t)}}WA.styles=["vxShape","vxWidth","vxHeight","vxRadius","vxFillColor","vxStrokeColor","vxStrokeWidth","vxOpacity"];class qA{constructor(t,e,n,r){this.type="segment",this._id=r,this._vertex1Index="number"==typeof t?t:t._index,this._vertex2Index="number"==typeof e?e:e._index,this._dataScopeRef=void 0,this.parent=n}get dataScope(){return this._dataScopeRef?this._dataScopeRef:this.parent.dataScope}set dataScope(t){this._dataScopeRef=Kw(t)}get datum(){return this.dataScope?eE(this.dataScope):this.parent.datum}get data(){return this.dataScope?tE(this.dataScope):this.parent.data}get id(){return this.parent.id+"_s_"+this._id}get vertex1(){return this.parent.vertices[this._vertex1Index]}set vertex1(t){this._vertex1Index="number"==typeof t?t:t._index}get vertex2(){return this.parent.vertices[this._vertex2Index]}set vertex2(t){this._vertex2Index="number"==typeof t?t:t._index}get x(){return(this.parent._vertices._xs[this._vertex1Index]+this.parent._vertices._xs[this._vertex2Index])/2}get y(){return(this.parent._vertices._ys[this._vertex1Index]+this.parent._vertices._ys[this._vertex2Index])/2}get scene(){return this.parent.scene}}class $A{constructor(t){return this._path=t,this.clear(),new Proxy(this,{get:(t,e)=>"length"===e?t.length:e===Symbol.iterator?t[Symbol.iterator].bind(t):$A._isIndex(e)?t.get(Number(e)):t[e],set(t,e,n){if($A._isIndex(e))return t.replace(Number(e),n),!0;if("string"==typeof e&&"_"===e[0])return t[e]=n,!0;throw new Error("path.vertices is read-only; mutate vertex properties or use path.vertices = [...].")}})}static _isIndex(t){if("string"!=typeof t||""===t)return!1;let e=Number(t);return Number.isInteger(e)&&e>=0&&String(e)===t}static getCoords(t){return Array.isArray(t)?t:[t.x,t.y]}static getId(t){return t&&t.parent&&t.parent._vertices&&void 0!==t._index?t.parent._vertices._ids[t._index]:t?t.id:void 0}static get storageKeys(){return["_ids","_xs","_ys","_dataScopeRefs","_polarAngles","_shapes","_widths","_heights","_radii","_fillColors","_opacities","_strokeWidths","_strokeColors","_refs"]}static get propertyArrays(){return{dataScope:"_dataScopeRefs",polarAngle:"_polarAngles",shape:"_shapes",width:"_widths",height:"_heights",radius:"_radii",fillColor:"_fillColors",opacity:"_opacities",strokeWidth:"_strokeWidths",strokeColor:"_strokeColors"}}get length(){return this._xs.length}clear(){this._ids=[],this._xs=[],this._ys=[],this._dataScopeRefs=[],this._polarAngles=[],this._shapes=[],this._widths=[],this._heights=[],this._radii=[],this._fillColors=[],this._opacities=[],this._strokeWidths=[],this._strokeColors=[],this._refs=[]}get(t){if(!(t<0||t>=this.length))return this._refs[t]||(this._refs[t]=new WA(this._path,t)),this._refs[t]}at(t){return t<0&&(t=this.length+t),this.get(t)}append(t,e){let[n,r]=$A.getCoords(t),i=Array.isArray(t)?void 0:t.dataScope,s=void 0!==e?e:$A.getId(t),o=this.length;return this._ids.push(s),this._xs.push(n),this._ys.push(r),this._dataScopeRefs.push(i?this._copyDataScopeRef(i):void 0),this._polarAngles.push(Array.isArray(t)?void 0:t.polarAngle),this._shapes.push(Array.isArray(t)?void 0:t.shape),this._widths.push(Array.isArray(t)?0:t.width),this._heights.push(Array.isArray(t)?0:t.height),this._radii.push(Array.isArray(t)?0:t.radius),this._fillColors.push(Array.isArray(t)?"#555":t.fillColor),this._opacities.push(Array.isArray(t)?1:t.opacity),this._strokeWidths.push(Array.isArray(t)?0:t.strokeWidth),this._strokeColors.push(Array.isArray(t)?"#aaa":t.strokeColor),this._refs.push(void 0),o}insert(t,e,n,r){let i="number"==typeof e,s=i?[e,n]:$A.getCoords(e),o=s[0],a=s[1],l=i||Array.isArray(e)?void 0:e.dataScope,c=i?r:$A.getId(e);this._ids.splice(t,0,c),this._xs.splice(t,0,o),this._ys.splice(t,0,a),this._dataScopeRefs.splice(t,0,l?this._copyDataScopeRef(l):void 0),this._polarAngles.splice(t,0,i||Array.isArray(e)?void 0:e.polarAngle),this._shapes.splice(t,0,i||Array.isArray(e)?void 0:e.shape),this._widths.splice(t,0,i||Array.isArray(e)?0:e.width),this._heights.splice(t,0,i||Array.isArray(e)?0:e.height),this._radii.splice(t,0,i||Array.isArray(e)?0:e.radius),this._fillColors.splice(t,0,i||Array.isArray(e)?"#555":e.fillColor),this._opacities.splice(t,0,i||Array.isArray(e)?1:e.opacity),this._strokeWidths.splice(t,0,i||Array.isArray(e)?0:e.strokeWidth),this._strokeColors.splice(t,0,i||Array.isArray(e)?"#aaa":e.strokeColor),this._refs.splice(t,0,void 0),this._reindexRefs()}replace(t,e){let[n,r]=$A.getCoords(e),i=Array.isArray(e)?void 0:e.dataScope;this._xs[t]=n,this._ys[t]=r,this._dataScopeRefs[t]=i?this._copyDataScopeRef(i):void 0,this._polarAngles[t]=Array.isArray(e)?void 0:e.polarAngle,this._shapes[t]=Array.isArray(e)?void 0:e.shape,this._widths[t]=Array.isArray(e)?0:e.width,this._heights[t]=Array.isArray(e)?0:e.height,this._radii[t]=Array.isArray(e)?0:e.radius,this._fillColors[t]=Array.isArray(e)?"#555":e.fillColor,this._opacities[t]=Array.isArray(e)?1:e.opacity,this._strokeWidths[t]=Array.isArray(e)?0:e.strokeWidth,this._strokeColors[t]=Array.isArray(e)?"#aaa":e.strokeColor,this._refs[t]=void 0}copyFrom(t){this._ids=t._ids.slice(),this._xs=t._xs.slice(),this._ys=t._ys.slice(),this._dataScopeRefs=t._dataScopeRefs.map(t=>this._copyDataScopeRef(t)),this._polarAngles=t._polarAngles.slice(),this._shapes=t._shapes.slice(),this._widths=t._widths.slice(),this._heights=t._heights.slice(),this._radii=t._radii.slice(),this._fillColors=t._fillColors.slice(),this._opacities=t._opacities.slice(),this._strokeWidths=t._strokeWidths.slice(),this._strokeColors=t._strokeColors.slice(),this._refs=[]}getProperty(t,e){let n=$A.propertyArrays[e];return"dataScope"===e?this.getDataScopeRef(t):n?this[n][t]:void 0}setProperty(t,e,n){let r=$A.propertyArrays[e];r&&("dataScope"===e?this.setDataScopeRef(t,n):this[r][t]=n)}setDataScopeRef(t,e){this._dataScopeRefs[t]=e?this._copyDataScopeRef(e):void 0}getDataScopeRef(t){return this._dataScopeRefs[t]}hasDataScope(t){return!!this._dataScopeRefs[t]}getDataScopeRows(t){let e=this._dataScopeRefs[t];if(e)return tE(e)}getDataScopeAttrVal(t,e){let n=this._dataScopeRefs[t];if(n)return iE(n,e)}getDataScopeAttributeValues(t,e){let n=this._dataScopeRefs[t];return n?sE(n,e):[]}aggregateDataScopeAttribute(t,e,n){return oE(this._dataScopeRefs[t],e,n)}_copyDataScopeRef(t){return t?Kw(t):t}sort(t){let e=Array.from({length:this.length},(t,e)=>e);return e.sort((e,n)=>t(this.get(e),this.get(n))),this._reorder(e),this._path._reindexSegments(),this}reverse(){let t=Array.from({length:this.length},(t,e)=>this.length-e-1);return this._reorder(t),this._path._reindexSegments(),this}splice(t,e,...n){let r=this.slice(t,t+e);for(let n of $A.storageKeys)this[n].splice(t,e);for(let e=0;e<n.length;e++)this.insert(t+e,n[e],void 0);return this._reindexRefs(),this._path._reindexSegments(),r}push(...t){for(let e of t)this.append(e,void 0);return this._path._reindexSegments(),this.length}map(t,e){let n=[];for(let r=0;r<this.length;r++)n.push(t.call(e,this.get(r),r,this));return n}filter(t,e){let n=[];for(let r=0;r<this.length;r++){let i=this.get(r);t.call(e,i,r,this)&&n.push(i)}return n}find(t,e){for(let n=0;n<this.length;n++){let r=this.get(n);if(t.call(e,r,n,this))return r}}forEach(t,e){for(let n=0;n<this.length;n++)t.call(e,this.get(n),n,this)}slice(t,e){return Array.from(this).slice(t,e)}concat(...t){return Array.from(this).concat(...t)}entries(){let t=this;return function*(){for(let e=0;e<t.length;e++)yield[e,t.get(e)]}()}indexOf(t){return t&&t.parent===this._path?t._index:-1}includes(t){return this.indexOf(t)>=0}[Symbol.iterator](){let t=this;return function*(){for(let e=0;e<t.length;e++)yield t.get(e)}()}_reorder(t){for(let e of $A.storageKeys){let n=this[e];this[e]=t.map(t=>n[t])}this._reindexRefs()}_reindexRefs(){for(let t=0;t<this._refs.length;t++)this._refs[t]&&(this._refs[t]._index=t)}}class XA extends FE{constructor(t){super(t),this._type="type"in t?t.type:Pw.Path,this._vertices=new $A(this),this.vertexCounter=0,this._sortBy={},this.segmentCounter=0,this.segments=[],this.anchor=void 0,this.closed="closed"in t&&t.closed,this.curveMode="curveMode"in t?t.curveMode:"linear",this._vxShape=void 0,this._vxWidth=0,this._vxHeight=0,this._vxRadius=0,this._vxFillColor="#555555",this._vxStrokeColor="#aaaaaa",this._vxStrokeWidth=0,this._vxOpacity=1;for(let e of WA.styles)e in t&&(this["_"+e]=t[e]);"vertices"in t&&(this.vertices=t.vertices),this._sourceAnchor="sourceAnchor"in t?t.sourceAnchor:["center","middle"],this._targetAnchor="targetAnchor"in t?t.targetAnchor:["center","middle"],this._sourceOffset="sourceOffset"in t?t.sourceOffset:[0,0],this._targetOffset="targetOffset"in t?t.targetOffset:[0,0],this._strength="strength"in t?t.strength:.85,"strokeColor"in this.styles||(this.styles.strokeColor="#ccc"),"fillColor"in this.styles||(this.styles.fillColor="none"),"strokeWidth"in this.styles||(this.styles.strokeWidth=1),"strokeDash"in this.styles||(this.styles.strokeDash="none")}set vertices(t){if(this._vertices.clear(),this.segments=[],this.vertexCounter=0,this.segmentCounter=0,0===t.length)return this._dirty=!0,void(this._bounds=void 0);for(let e=0;e<t.length;e++){let n=$A.getCoords(t[e]),r=$A.getCoords(t[0]);if(e==t.length-1&&n[0]===r[0]&&n[1]===r[1]&&this.type===Pw.Path)continue;let i=Array.isArray(t[e])?this.vertexCounter++:$A.getId(t[e]),s=this._vertices.append(t[e],i);!Array.isArray(t[e])&&"number"==typeof i&&i>=this.vertexCounter&&(this.vertexCounter=i+1);for(let t of WA.styles)if(void 0!==this[t]){let e=t.replace("vx","");this._vertices.setProperty(s,e[0].toLowerCase()+e.slice(1),this[t])}e>0&&this.segments.push(new qA(s-1,s,this,this.segmentCounter++))}let e=$A.getCoords(t[0]),n=$A.getCoords(t[t.length-1]);this._vertices.length>1&&(this.closed||e[0]===n[0]&&e[1]===n[1]||this.type===Pw.Rect)&&(this.closed=!0,"fillColor"in this.styles||(this.styles.fillColor="#fff"),this.segments.push(new qA(this._vertices.length-1,0,this,this.segmentCounter++))),this._dirty=!0,this._updateBounds()}copyPropertiesTo(t){t.attrs=Object.assign({},this.attrs),t.styles=Object.assign({},this.styles);for(let e of WA.styles)void 0!==this["_"+e]&&(t["_"+e]=this["_"+e]);this._dataScopeRef&&(t.dataScope=this._dataScopeRef),t.closed=this.closed,t.curveMode=this.curveMode,t.vertexCounter=this.vertexCounter,t._vertices.copyFrom(this._vertices),t.segments=[],t.segmentCounter=0;for(let e=1;e<t._vertices.length;e++)t.segments.push(new qA(e-1,e,t,t.segmentCounter++));t.closed&&t.segments.push(new qA(t._vertices.length-1,0,t,t.segmentCounter++)),t._sourceAnchor=this._sourceAnchor.slice(),t._targetAnchor=this._targetAnchor.slice(),t._sourceOffset=this._sourceOffset.slice(),t._targetOffset=this._targetOffset.slice(),t._beta=this._beta}get bounds(){return this._bounds||this._updateBounds(),this._bounds}get x(){return this.bounds.x}get y(){return this.bounds.y}resize(t,e,n,r){let i=this.bounds,s=0===i.width?1:i.width,o=0===i.height?1:i.height,a=this._vertices._xs,l=this._vertices._ys;if("right"===n)for(let e=0;e<this._vertices.length;e++)a[e]=i.right-t/s*(i.right-a[e]);else for(let e=0;e<this._vertices.length;e++)a[e]=i.left+t/s*(a[e]-i.left);if("top"===r)for(let t=0;t<this._vertices.length;t++)l[t]=i.top+e/o*(l[t]-i.top);else for(let t=0;t<this._vertices.length;t++)l[t]=i.bottom-e/o*(i.bottom-l[t]);this._updateBounds(),this._dirty=!0}_updateBounds(){let t=[],e=[];if(this._d){const n=this._d.match(/[a-zA-Z][^a-zA-Z]*/g),r=" ";n.forEach(n=>{let i=n.slice(1).trim().split(r).map(Number);for(let[n,r]of i.entries())n%2==0?t.push(r):e.push(r)})}else t=this._vertices._xs,e=this._vertices._ys;let n=et(t),r=et(e),i=Q(t),s=Q(e),o=i-n,a=s-r;if(this._bounds=new PE(n,r,o,a),this.type===Pw.Line||this.type===Pw.Path){let t=this.styles.strokeWidth?this.styles.strokeWidth:1;n===i?this._bounds=new PE(n-t/2,r,i-n+t,s-r):r===s&&(this._bounds=new PE(n,r-t/2,i-n,s-r+t))}}addVertex(t,e,n){void 0===n&&(n=this._vertices.length),this._vertices.insert(n,t,e,this.vertexCounter++),this._reindexSegments()}sortVertices(t,e){this._vertices.sort((e,n)=>e[t]-n[t]),e&&this._vertices.reverse();for(let t=0;t<this.segments.length;t++){let e=this.segments[t];e.vertex1=t,e.vertex2=(t+1)%this._vertices.length}this._dirty=!0}sortVerticesByData(t,e,n){let r;r=n?(e,r)=>n.indexOf(e.datum[t])-n.indexOf(r.datum[t]):(e,n)=>e.datum[t]<n.datum[t]?-1:1,this._vertices.sort(r),e&&this._vertices.reverse();for(let t=0;t<this.segments.length;t++){let e=this.segments[t];e.vertex1=t,e.vertex2=(t+1)%this._vertices.length}this._dirty=!0}getSVGPathData(){if(this._d)return this._d;if(this._vertices.length<2)return"";let t=To(),e=this._getD3CurveFunction(this.curveMode)(t);e.lineStart();for(let t=0;t<this._vertices.length;t++)e.point(this._vertices._xs[t],this._vertices._ys[t]);return this.closed&&e.point(this._vertices._xs[0],this._vertices._ys[0]),e.lineEnd(),t._}get firstVertex(){return this._vertices[0]}get firstSegment(){return this.segments[0]}get lastVertex(){return this._vertices[this._vertices.length-1]}get lastSegment(){return this.segments[this.segments.length-1]}_reindexSegments(){for(let t=0;t<this.segments.length;t++)this.segments[t].vertex1=t,this.segments[t].vertex2=(t+1)%this._vertices.length}_getD3CurveFunction(t){switch(t){case JA.Natural:return lw;case JA.Basis:return Ix;case JA.BumpX:return $v;case JA.BumpY:return Xv;case JA.Linear:return Nv;case JA.Step:return uw;case JA.CatmullRom:return qx;case JA.Cardinal:return Fx;case JA.Bundle:return Vx.beta(.5);default:return Nv}}get vxShape(){return this._vxShape}get vxWidth(){return this._vxWidth}get vxHeight(){return this._vxHeight}get vxRadius(){return this._vxRadius}get vxFillColor(){return this._vxFillColor}get vxStrokeColor(){return this._vxStrokeColor}get vxStrokeWidth(){return this._vxStrokeWidth}get vxOpacity(){return this._vxOpacity}set vxOpacity(t){this._vxOpacity=t;for(let e of this.vertices)e.opacity=t}get sourceAnchor(){return this._sourceAnchor}get targetAnchor(){return this._targetAnchor}get sourceOffset(){return this._sourceOffset}get targetOffset(){return this._targetOffset}get strength(){return this._strength}set strength(t){this._strength=t,this._dirty=!0}get vertices(){return this._vertices}}function KA(t,e){const n=ME.getSVG();let r=document.createElementNS("http://www.w3.org/2000/svg","path");r.setAttribute("d",t.getSVGPathData()),n.appendChild(r);let i=r.getTotalLength();return r.getPointAtLength(i*e)}function ZA(t){return t instanceof XA&&t.source&&t.target}const JA={Natural:"natural",Basis:"basis",BumpX:"bumpX",BumpY:"bumpY",Bundle:"bundle",Linear:"linear",Step:"step",CatmullRom:"CatmullRom",Cardinal:"cardinal"};function QA(t,e,n){const r=t.match(/[a-zA-Z][^a-zA-Z]*/g),i=",",s=r.map(t=>{const r=t[0],s=t.slice(1).trim();if("M"===r||"L"===r||"T"===r){const[t,o]=s.split(i).map(Number);return`${r}${t+e} ${o+n}`}if("C"===r){const t=s.split(i).map(Number);return`${r}${t[0]+e} ${t[1]+n} ${t[2]+e} ${t[3]+n} ${t[4]+e} ${t[5]+n}`}if("Q"===r){const t=s.split(i).map(Number);return`${r}${t[0]+e} ${t[1]+n} ${t[2]+e} ${t[3]+n}`}if("A"===r){const t=s.split(i).map(Number);return`${r}${t[0]} ${t[1]} ${t[2]} ${t[3]} ${t[4]} ${t[5]+e} ${t[6]+n}`}return"Z"===r||"z"===r?r:t});return s.join(" ")}class tS extends XA{constructor(t){super(t),this._type=Pw.Arc,this.closed=!0,this._x="x"in t?t.x:100,this._y="y"in t?t.y:100,this._innerRadius="innerRadius"in t?t.innerRadius:100,this._outerRadius="outerRadius"in t?t.outerRadius:200,this._thickness="thickness"in t?t.thickness:this._outerRadius-this._innerRadius,this._startAngle="startAngle"in t?t.startAngle:0,this._endAngle="endAngle"in t?t.endAngle:90,this._sr=eS(this._startAngle),this._er=eS(this._endAngle),this._direction="direction"in t?t.direction:YA.ANTI_CLOCKWISE;let e=this._x+this._innerRadius*Math.cos(this._sr),n=this._y-this._innerRadius*Math.sin(this._sr),r=this._x+this._innerRadius*Math.cos(this._er),i=this._y-this._innerRadius*Math.sin(this._er),s=this._x+this._outerRadius*Math.cos(this._sr),o=this._y-this._outerRadius*Math.sin(this._sr),a=this._x+this._outerRadius*Math.cos(this._er),l=this._y-this._outerRadius*Math.sin(this._er);this.vertices=[[e,n],[s,o],[a,l],[r,i]]}get type(){return 0===this._innerRadius?Pw.Pie:Pw.Arc}get innerRadius(){return this._innerRadius}get outerRadius(){return this._outerRadius}get thickness(){return this._outerRadius-this._innerRadius}get direction(){return this._direction}get x(){return this._x}get y(){return this._y}get startAngle(){return this._startAngle}get endAngle(){return this._endAngle}get angle(){return this._endAngle<this._startAngle?this._endAngle+360-this._startAngle:this._endAngle-this._startAngle}setAngles(t,e){this._startAngle=t,this._endAngle=e,this._sr=eS(this._startAngle),this._er=eS(this._endAngle),this.vertices[0].x=this._x+this._innerRadius*Math.cos(this._sr),this.vertices[0].y=this._y-this._innerRadius*Math.sin(this._sr),this.vertices[1].x=this._x+this._outerRadius*Math.cos(this._sr),this.vertices[1].y=this._y-this._outerRadius*Math.sin(this._sr),this.vertices[2].x=this._x+this._outerRadius*Math.cos(this._er),this.vertices[2].y=this._y-this._outerRadius*Math.sin(this._er),this.vertices[3].x=this._x+this._innerRadius*Math.cos(this._er),this.vertices[3].y=this._y-this._innerRadius*Math.sin(this._er),this._dirty=!0}_updateBounds(){let t=this.vertices.map(t=>t.x),e=this.vertices.map(t=>t.y),n=d3.min(t),r=d3.min(e),i=d3.max(t)-n,s=d3.max(e)-r;this._bounds=new PE(n,r,i,s)}copyPropertiesTo(t){super.copyPropertiesTo(t),t._x=this._x,t._y=this._y,t._innerRadius=this._innerRadius,t._outerRadius=this._outerRadius,t._startAngle=this._startAngle,t._endAngle=this._endAngle,t._thickness=this._thickness,t._direction=this._direction,t._sr=this._sr,t._er=this._er}getSVGPathData(){let t=this._endAngle<this._startAngle?this._endAngle+360-this._startAngle:this._endAngle-this._startAngle,e=t>180?1:0;return["M "+this.vertices[0].x+", "+this.vertices[0].y,"L "+this.vertices[1].x+", "+this.vertices[1].y,"A "+[this._outerRadius,this._outerRadius,t,e,0,this.vertices[2].x,this.vertices[2].y].join(" "),"L "+this.vertices[3].x+", "+this.vertices[3].y,"A "+[this._innerRadius,this._innerRadius,t,e,1,this.vertices[0].x,this.vertices[0].y].join(" ")].join(" ")}}function eS(t){return t*Math.PI/180}function nS(t){return 180*t/Math.PI}function rS(t){return(t%360+360)%360}function iS(t,e,n,r){let i=t-n,s=r-e;return Math.atan2(s,i)*(180/Math.PI)}class sS extends XA{constructor(t){super(t),this._type=Pw.Area,this.closed=!0,this._orientation="orientation"in t?t.orientation:void 0,this._baseline="baseline"in t?t.baseline:void 0,t&&"vertices"in t&&this.segments.push(new qA(this.vertices.length-1,0,this,this.segmentCounter++))}get topLeftVertex(){return this._orientation===zA?this.vertices[0]:this.vertices[this.vertices.length-1]}get bottomLeftVertex(){return this._orientation===zA?this.vertices[this.vertices.length-1]:this.vertices[this.vertices.length/2]}get topRightVertex(){return this._orientation===zA?this.vertices[this.vertices.length/2-1]:this.vertices[0]}get bottomRightVertex(){return this._orientation===zA?this.vertices[this.vertices.length/2]:this.vertices[this.vertices.length/2-1]}get baseline(){return this._baseline}set baseline(t){this._baseline=t,this._dirty=!0}get orientation(){return this._orientation}set orientation(t){this._orientation=t,this._dirty=!0}get firstVertexPair(){return[this.vertices[0],this.vertices[this.vertices.length-1]]}get width(){return this.vertices[this.vertices.length/2].x-this.vertices[0].x}get height(){return this.vertices[this.vertices.length/2].y-this.vertices[0].y}get left(){return this.vertices[0].x}get top(){return this.vertices[0].y}copyPropertiesTo(t){super.copyPropertiesTo(t),t._baseline=this._baseline,t._orientation=this._orientation}getSVGPathData(){return super.getSVGPathData()+" z"}}class oS extends XA{constructor(t){super(t),this._type=Pw.BezierCurve,this._orientation="orientation"in t?t.orientation:zA}get type(){return this._type}get orientation(){return this._orientation}copyPropertiesTo(t){super.copyPropertiesTo(t),t._orientation=this._orientation}getSVGPathData(){if(this._d)return this._d;let t="M ";return t+=this.vertices[0].x+" "+this.vertices[0].y+" ",t+="C "+this.vertices[1].x+" "+this.vertices[1].y+" ",t+=this.vertices[2].x+" "+this.vertices[2].y+" ",t+=this.vertices[3].x+" "+this.vertices[3].y,t}}class aS extends FE{constructor(t){super(t),this._type=Pw.Circle,this._x="x"in t?t.x:0,this._y="y"in t?t.y:0,this._radius="radius"in t?t.radius:100,"strokeColor"in this.styles||(this.styles.strokeColor="#ccc"),"fillColor"in this.styles||(this.styles.fillColor="none"),"strokeWidth"in this.styles||(this.styles.strokeWidth=1),"strokeDash"in this.styles||(this.styles.strokeDash="none")}set x(t){this._x=t,this._dirty=!0}set y(t){this._y=t,this._dirty=!0}get x(){return this._x}get y(){return this._y}get radius(){return this._radius}set radius(t){this._radius=t,this._dirty=!0}get area(){return Math.PI*Math.pow(this._radius,2)}_updateBounds(){if(this._rotate){let t=OE(this._x,this._y,this._rotate[1],this._rotate[2],this._rotate[0]);this._bounds=new PE(t.x-this._radius,t.y-this._radius,2*this._radius,2*this._radius)}else this._bounds=new PE(this._x-this._radius,this._y-this._radius,2*this._radius,2*this._radius)}copyPropertiesTo(t){super.copyPropertiesTo(t),t._x=this._x,t._y=this._y,t._radius=this._radius}getSVGPathData(){return["M",this._x,this._y,"m",-this._radius,", 0 a",this._radius,",",this._radius,"0 1,0",2*this._radius,",0 a",this._radius,",",this._radius,"0 1,0",-2*this._radius,",0"].join(" ")}}let lS=class extends FE{constructor(t){super(t),this._type=Pw.Image,this._src=t.src,this._x="x"in t?t.x:0,this._y="y"in t?t.y:0,this._width="width"in t?t.width:100,this._height="height"in t?t.height:100}get src(){return this._src}set src(t){this._src=t,this._dirty=!0}get width(){return this._width}set width(t){this._width=t,this._updateBounds(),this._dirty=!0}get height(){return this._height}set height(t){this._height=t,this._updateBounds(),this._dirty=!0}resize(t,e){this._width=t,this._height=e,this._dirty=!0,this._updateBounds()}get x(){return this._x}set x(t){this._x=t,this._dirty=!0,this._updateBounds()}get y(){return this._y}set y(t){this._y=t,this._dirty=!0,this._updateBounds()}get bounds(){return this._bounds||this._updateBounds(),this._bounds}_updateBounds(){this._bounds=new PE(this._x,this._y,this._width,this._height)}copyPropertiesTo(t){t.attrs=Object.assign({},this.attrs),t.styles=Object.assign({},this.styles),this._dataScopeRef&&(t.dataScope=this._dataScopeRef),t.x=this._x,t.y=this._y,t.width=this._width,t.height=this._height,t.src=this._src}};class cS extends XA{constructor(t){super(t)}get x1(){return this.vertices[0].x}get y1(){return this.vertices[0].y}get x2(){return this.vertices[1].x}get y2(){return this.vertices[1].y}get x(){return(this.vertices[0].x+this.vertices[1].x)/2}get y(){return(this.vertices[0].y+this.vertices[1].y)/2}set x(t){let e=t-this.x;this.vertices[0].x+=e,this.vertices[1].x+=e,this._dirty=!0}set y(t){let e=t-this.y;this.vertices[0].y+=e,this.vertices[1].y+=e,this._dirty=!0}set x1(t){this.vertices[0].x=t,this._dirty=!0}set x2(t){this.vertices[1].x=t,this._dirty=!0}set y1(t){this.vertices[0].y=t,this._dirty=!0}set y2(t){this.vertices[1].y=t,this._dirty=!0}}const uS="filled",hS="none";class fS extends XA{constructor(t={}){const e="x1"in t?t.x1:0,n="y1"in t?t.y1:0,r="x2"in t?t.x2:100,i="y2"in t?t.y2:0,s=[[e,n],...t.controlPoints||[],[r,i]];super({...t,type:Pw.Arrow,vertices:s}),this._startStyle=t.startStyle??hS,this._startSize=t.startSize??8,this._endStyle=t.endStyle??uS,this._endSize=t.endSize??8}get x1(){return this.vertices[0].x}set x1(t){this.vertices[0].x=t,this._dirty=!0}get y1(){return this.vertices[0].y}set y1(t){this.vertices[0].y=t,this._dirty=!0}get x2(){return this.vertices[this.vertices.length-1].x}set x2(t){this.vertices[this.vertices.length-1].x=t,this._dirty=!0}get y2(){return this.vertices[this.vertices.length-1].y}set y2(t){this.vertices[this.vertices.length-1].y=t,this._dirty=!0}get startStyle(){return this._startStyle}set startStyle(t){this._startStyle=t,this._dirty=!0}get startSize(){return this._startSize}set startSize(t){this._startSize=t,this._dirty=!0}get endStyle(){return this._endStyle}set endStyle(t){this._endStyle=t,this._dirty=!0}get endSize(){return this._endSize}set endSize(t){this._endSize=t,this._dirty=!0}}class dS extends FE{constructor(t){super(t),this._type=Pw.SimpleText,this._x="x"in t?t.x:0,this._y="y"in t?t.y:0,this._text="text"in t?t.text:"",this._anchor="anchor"in t?t.anchor:[zE.CENTER,zE.MIDDLE],this._textPath=void 0,this._textPathOffset="50%","fontSize"in this.styles||(this.styles.fontSize="12px"),"fontFamily"in this.styles||(this.styles.fontFamily="Arial, sans-serif"),"fontWeight"in this.styles||(this.styles.fontWeight="normal"),"fillColor"in this.styles||(this.styles.fillColor="black"),"backgroundColor"in t&&(this._backgroundColor=t.backgroundColor),"borderWidth"in t&&(this._borderWidth=t.borderWidth),"borderColor"in t&&(this._borderColor=t.borderColor),this._rotate="rotate"in t?t.rotate:void 0}hasBackground(){return this._backgroundColor||this._borderStroke||this._borderColor}_updateBounds(){let t,e,n=function(t,e,n){const r=ME.getSVG(),i=document.createElementNS("http://www.w3.org/2000/svg","text");i.setAttribute("font-family",e),i.setAttribute("font-size",n),i.textContent=t,r.appendChild(i);const s=i.getBBox();return r.removeChild(i),{width:s.width,height:s.height}}(this._text,[this.fontWeight,this.fontSize,this.fontFamily].join(" "),parseFloat(this.fontSize)),r=n.width,i=n.height;switch(this._anchor[0]){case zE.LEFT:t=this._x;break;case zE.RIGHT:t=this._x-r;break;case zE.CENTER:t=this._x-r/2;break;default:t=this._x}switch(this._anchor[1]){case zE.TOP:e=this._y;break;case zE.BOTTOM:e=this._y-i;break;case zE.MIDDLE:default:e=this._y-i/2}if(this._rotate&&3===this._rotate.length){let n=[{x:t,y:e},{x:t+r,y:e},{x:t,y:e+i},{x:t+r,y:e+i}].map(t=>OE(t.x,t.y,this._rotate[1],this._rotate[2],this._rotate[0])),s=d3.min(n.map(t=>t.x)),o=d3.max(n.map(t=>t.x)),a=d3.min(n.map(t=>t.y)),l=d3.max(n.map(t=>t.y));this._bounds=new PE(s,a,o-s,l-a)}else this._bounds=new PE(t,e,r,i)}get x(){return this._x}set x(t){this._x=t,this._dirty=!0}get y(){return this._y}set y(t){this._y=t,this._dirty=!0}get text(){return this._text}set text(t){this._text=t,this._dirty=!0}get anchor(){return this._anchor}get fontFamily(){return this.styles.fontFamily}get fontSize(){return this.styles.fontSize}get fontWeight(){return this.styles.fontWeight}set fontWeight(t){this.styles.fontWeight=t,this._dirty=!0}get textPath(){return this._textPath}set textPath(t){this._textPath=t,this._dirty=!0}get textPathOffset(){return this._textPathOffset}set textPathOffset(t){this._textPathOffset=t,this._dirty=!0}get backgroundColor(){return this._backgroundColor?this._backgroundColor:"#fff"}get borderColor(){return this._borderColor?this._borderColor:"#ccc"}get borderWidth(){return this._borderWidth?this._borderWidth:1}copyPropertiesTo(t){t.styles=Object.assign({},this.styles),this._dataScopeRef&&(t.dataScope=this._dataScopeRef),t._x=this._x,t._y=this._y,t._text=this._text,t._anchor=[this._anchor[0],this._anchor[1]],t._backgroundColor=this._backgroundColor,t._borderColor=this._borderColor,t._borderStroke=this._borderStroke}}class pS extends XA{constructor(t){super(t),this._type=Pw.Polygon,this.closed=!0,"x"in t&&(this._x=t.x),"y"in t&&(this._y=t.y),"radius"in t&&(this._radius=t.radius)}get radius(){return this._radius}get x(){return this._x}get y(){return this._y}set x(t){this._x=t,this._dirty=!0}set y(t){this._y=t,this._dirty=!0}set radius(t){this._radius=t,this._dirty=!0}copyPropertiesTo(t){super.copyPropertiesTo(t),t._x=this._x,t._y=this._y,t._radius=this._radius}}class _S extends XA{constructor(t){super(t)}get width(){return this.vertices[1].x-this.vertices[0].x}get height(){return this.vertices[2].y-this.vertices[1].y}get left(){return this.vertices[0].x}get top(){return this.vertices[0].y}get right(){return this.vertices[1].x}get bottom(){return this.vertices[2].y}get area(){return this.width*this.height}setBounds(t,e,n,r){this.vertices[0].x=t,this.vertices[0].y=e,this.vertices[1].x=t+n,this.vertices[1].y=e,this.vertices[2].x=t+n,this.vertices[2].y=e+r,this.vertices[3].x=t,this.vertices[3].y=e+r,this._dirty=!0}resize(t,e,n,r){t!==this.width&&("right"===n?(this.vertices[1].x=this.refBounds.right,this.vertices[2].x=this.refBounds.right,this.vertices[0].x=this.vertices[1].x-t,this.vertices[3].x=this.vertices[0].x):(this.vertices[0].x=this.refBounds.left,this.vertices[3].x=this.refBounds.left,this.vertices[1].x=this.vertices[0].x+t,this.vertices[2].x=this.vertices[1].x)),e!==this.height&&("top"===r?(this.vertices[0].y=this.refBounds.top,this.vertices[1].y=this.refBounds.top,this.vertices[3].y=this.vertices[0].y+e,this.vertices[2].y=this.vertices[3].y):(this.vertices[2].y=this.refBounds.bottom,this.vertices[3].y=this.refBounds.bottom,this.vertices[0].y=this.vertices[3].y-e,this.vertices[1].y=this.vertices[0].y)),this._dirty=!0}get leftSegment(){return this.segments[3]}get rightSegment(){return this.segments[1]}get topSegment(){return this.segments[0]}get bottomSegment(){return this.segments[2]}}class gS extends XA{constructor(t){super(t),this._type=Pw.Ring,this.closed=!0,this._x="x"in t?t.x:0,this._y="y"in t?t.y:0,this._innerRadius="innerRadius"in t?t.innerRadius:100,this._outerRadius="outerRadius"in t?t.outerRadius:200}get innerRadius(){return this._innerRadius}get outerRadius(){return this._outerRadius}get x(){return this._x}get y(){return this._y}get thickness(){return this._outerRadius-this._innerRadius}copyPropertiesTo(t){super.copyPropertiesTo(t),t._x=this._x,t._y=this._y,t._innerRadius=this._innerRadius,t._outerRadius=this._outerRadius}getSVGPathData(){return["M "+this._x+" "+this._y,"m 0, -"+this._outerRadius,"a "+this._outerRadius+","+this._outerRadius+", 0, 1, 0, 1, 0","Z","m 0 "+(this._outerRadius-this._innerRadius),"a "+this._innerRadius+", "+this._innerRadius+", 0, 1, 1, -1, 0","Z"].join(" ")}}class yS extends FE{constructor(t){super(t),this._type=Pw.RichText,this._x="x"in t?t.x:0,this._y="y"in t?t.y:0,this._text="text"in t?t.text:"",this._width="width"in t?t.width:200,this._anchor="anchor"in t?t.anchor:[zE.CENTER,zE.MIDDLE],"fontSize"in this.styles||(this.styles.fontSize="12px"),"fontFamily"in this.styles||(this.styles.fontFamily="Arial, sans-serif"),"fontWeight"in this.styles||(this.styles.fontWeight="normal"),"fillColor"in this.styles||(this.styles.fillColor="black"),"backgroundColor"in t&&(this._backgroundColor=t.backgroundColor),"borderWidth"in t&&(this._borderWidth=t.borderWidth),"borderColor"in t&&(this._borderColor=t.borderColor),this._rotate="rotate"in t?t.rotate:void 0}hasBackground(){return this._backgroundColor||this._borderStroke||this._borderColor}_updateBounds(){let t,e,n=function(t,e,n){const r=ME.getSVG(),i=document.createElementNS("http://www.w3.org/2000/svg","text");i.setAttribute("font-family",e),i.setAttribute("font-size",n),i.textContent=t,r.appendChild(i);const s=i.getBBox();return r.removeChild(i),{width:s.width,height:s.height}}(this._text,[this.fontWeight,this.fontSize,this.fontFamily].join(" "),parseFloat(this.fontSize)),r=n.width,i=n.height;switch(this._anchor[0]){case zE.LEFT:t=this._x;break;case zE.RIGHT:t=this._x-r;break;case zE.CENTER:t=this._x-r/2;break;default:t=this._x}switch(this._anchor[1]){case zE.TOP:e=this._y;break;case zE.BOTTOM:e=this._y-i;break;case zE.MIDDLE:default:e=this._y-i/2}if(this._rotate&&3===this._rotate.length){let n=[{x:t,y:e},{x:t+r,y:e},{x:t,y:e+i},{x:t+r,y:e+i}].map(t=>OE(t.x,t.y,this._rotate[1],this._rotate[2],this._rotate[0])),s=d3.min(n.map(t=>t.x)),o=d3.max(n.map(t=>t.x)),a=d3.min(n.map(t=>t.y)),l=d3.max(n.map(t=>t.y));this._bounds=new PE(s,a,o-s,l-a)}else this._bounds=new PE(t,e,r,i)}get x(){return this._x}get y(){return this._y}set x(t){this._x=t,this._dirty=!0}set y(t){this._y=t,this._dirty=!0}get text(){return this._text}set text(t){this._text=t,this._dirty=!0}get anchor(){return this._anchor}get fontFamily(){return this.styles.fontFamily}get fontSize(){return this.styles.fontSize}get fontWeight(){return this.styles.fontWeight}get textPath(){return this._textPath}set textPath(t){this._textPath=t,this._dirty=!0}get textPathOffset(){return this._textPathOffset}set textPathOffset(t){this._textPathOffset=t,this._dirty=!0}get backgroundColor(){return this._backgroundColor?this._backgroundColor:"#fff"}get borderColor(){return this._borderColor?this._borderColor:"#ccc"}get borderWidth(){return this._borderWidth?this._borderWidth:1}get width(){return this._width}copyPropertiesTo(t){t.styles=Object.assign({},this.styles),this._dataScopeRef&&(t.dataScope=this._dataScopeRef),t._x=this._x,t._y=this._y,t._text=this._text,t._anchor=[this._anchor[0],this._anchor[1]],t._backgroundColor=this._backgroundColor,t._borderColor=this._borderColor,t._borderStroke=this._borderStroke}}class mS{constructor(t){let e=t||{};this._stops=[],this.type=Pw.LinearGradient,this.id=this.type+Dw(),this.x1="x1"in e?e.x1:0,this.x2="x2"in e?e.x2:100,this.y1="y1"in e?e.y1:0,this.y2="y2"in e?e.y2:0}toJSON(){let t={};return t.type=this.type,t.id=this.id,t.x1=this.x1,t.x2=this.x2,t.y1=this.y1,t.y2=this.y2,t.stops=this._stops,t}addStop(t,e,n){this._stops.push({offset:t,color:e,opacity:n})}get stops(){return this._stops}}function bS(t,e,n,r){let i,s=t.domain,o=t.range;switch(t.type){case"linear":case"log":{let a=Math.abs(o[0]-o[1]);i="width"==e||"x"==e?45:30;let l,c=Math.max(2,Math.floor(a/i));if("width"==e||"height"==e){let i=!!r&&(r.elements[0].parent.layout&&r.elements[0].parent.layout.type==HE.STACK);s[1]=t._scale.invert(i?VE(n)[e]:DE(n)[e])}if("log"===t.type){l=[];let e=t._scale.ticks();for(let t of e){let n=Math.log(t)/Math.log(10)+1e-6;Math.abs(n-Math.floor(n))<c/e.length&&l.push(t)}}else l=q(s[0],s[1],c);return l}case"point":{i="width"==e||"x"==e?80:30;let n=Math.floor(t.rangeExtent/s.length),r=Math.ceil(i/n);return"x"==e?s.filter((t,e)=>e%r==0):s}case"band":{i="width"==e||"x"==e?80:30;let n=Math.floor(t.rangeExtent/s.length),r=Math.max(1,Math.ceil(i/n));return s.filter((t,e)=>e%r==0)}case"time":{i="width"==e||"x"==e?80:30;let t,n,r=Math.floor((o[1]-o[0])/i),a=Math.ceil((s[1]-s[0])/r)/1e3,l=[1,60,3600,86400,2628003,31536e3],c=[q_,X_,Q_,rg,zg,Ug];for(let e=0;e<l.length-1;e++)if(a>=l[e]&&a<l[e+1])return t=Math.floor(a/l[e]),n=c[e],n(s[0],s[1],t);return a>l[l.length-1]?(t=Math.floor(a/l[l.length-1]),n=c[l.length-1],n(s[0],s[1],t)):[]}default:return[]}}function vS(t,e){e.removeChild(t)}class xS extends PA{constructor(t){super(),this._type=Pw.Axis,this._id=t.id?t.id:this._type+Dw(),this._attribute=void 0,this._channel=void 0,this._orientation=void 0,this._strokeColor="strokeColor"in t?t.strokeColor:"#555",this._textColor="textColor"in t?t.textColor:"#555",this._fontSize="fontSize"in t?t.fontSize:"12px",this._tickOffset="tickOffset"in t?t.tickOffset:0,this._tickSize="tickSize"in t?t.tickSize:5,this._tickAnchor=t.tickAnchor,this._tickVisible=!("tickVisible"in t)||t.tickVisible,this._pathVisible=!("pathVisible"in t)||t.pathVisible,this._labelVisible=!("labelVisible"in t)||t.labelVisible,this._labelOffset="labelOffset"in t?t.labelOffset:this._tickSize+this._tickOffset+3,this._labelFormat="labelFormat"in t?t.labelFormat:"",this._titleOffset="titleOffset"in t?t.titleOffset:40,this._rotateYTitle=!("rotateTitle"in t&&!t.rotateTitle),this._showTitle=!("titleVisible"in t)||t.titleVisible,this._labelRotation="labelRotation"in t?t.labelRotation:0,this._ticks=new PA,this._ticks._id=this._id+"_ticks",this.addChild(this._ticks),this._labels=new PA,this._labels._id=this._id+"_labels",this.addChild(this._labels),this._title=new dS({text:this._titleText,fillColor:this._textColor,fontWeight:"bold"}),this._title._id=this.id+"_title",this.addChild(this._title),this._showTitle||(this._title.visibility="hidden"),this._pathPos=void 0,this._args=t}get id(){return this._id}get pathPosition(){return this._pathPos}get pathVisible(){return this._pathVisible}get attribute(){return this._attribute}get channel(){return this._channel}get orientation(){return this._orientation}get ticksVisible(){return this._tickVisible}get labelsVisible(){return this._labelVisible}get tickSize(){return this._tickSize}get tickOffset(){return this._tickOffset}get tickAnchor(){return this._tickAnchor?this._tickAnchor:"x"===this._channel||"width"===this._channel?"center":"middle"}get labelOffset(){return this._labelOffset}get labelFormat(){return this._labelFormat}get labelRotation(){return this._labelRotation}get tickValues(){return this._tickValues}get labelValues(){return this._labelValues}get titleOffset(){return this._titleOffset}get titleVisisble(){return this._showTitle}get boundsWithoutTitle(){let t=this.children.filter(t=>t.type!==Pw.SimpleText),e=t[0].bounds.clone();for(let n=1;n<t.length;n++)"hidden"!=t[n].visibility&&(e=e.union(t[n].bounds));return e}get strokeColor(){return this._strokeColor}get textColor(){return this._textColor}}const wS="top",ES="bottom",AS="left";class SS extends xS{constructor(t,e,n,r){super(r),this._encoding=t,this._attribute=this._encoding.attribute,this._channel=this._encoding.channel,this._scale=e,this._elems=n,this._flip="flip"in r&&r.flip,this._posArg="x"==this._channel||"width"==this._channel?r.pathY:r.pathX,this._orientation="orientation"in r?r.orientation:"x"===this._channel||"width"==this._channel?ES:AS,this._titleText="title"in r?r.title:this._encoding.sourceAttribute??this._encoding.attribute,this._path="angle"===this._channel?new aS({strokeColor:this._strokeColor,id:this._id+"_path"}):new XA({strokeColor:this._strokeColor,id:this._id+"_path"}),this._pathVisible||(this._path.visibility="hidden"),this.addChild(this._path),this.createTicksLabels(r),t.dataTable.type(this._attribute)!==Vw.Date||"labelFormat"in r||(this._labelFormat="%m/%d/%y"),"radialDistance"===this._channel&&"rotation"in r&&(this._rotate=[-r.rotation,this._elems[0].parent.x,this._elems[0].parent.y])}isFlipped(){return this._flip}get elements(){return this._elems}get scale(){return this._scale}get encoding(){return this._encoding}get includeZero(){return this._encoding.includeZero}createTicksLabels(t){"tickValues"in t?(this._tickValues=t.tickValues,this._labelValues=t.tickValues):(this._tickValues=bS(this._scale,this._channel,this._elems,this),this._labelValues=this._tickValues),this._ticks.removeAll();for(let t=0;t<this._tickValues.length;t++){let e=new XA({strokeColor:this._strokeColor,id:this._id+"_tick"+t});this._tickVisible||(e.visibility="hidden"),this._ticks.addChild(e)}let e;switch(this._labels.removeAll(),this._encoding.dataTable.type(this._attribute)){case Vw.Date:e=iy(this._labelFormat);break;case Vw.String:e=function(t){return t};break;default:e=Hl(this._labelFormat)}for(let[t,n]of this._labelValues.entries()){let r=new dS({text:e(n),fontSize:this._fontSize,fillColor:this._textColor,id:this._id+"_label"+t});this._labelVisible||(r.visibility="hidden"),this._labels.addChild(r)}this._title._text=this._titleText}}class TS{constructor(t,e){switch(this._id="scale_"+Dw(),this._type=t,e&&(this._args=e),t){case"linear":this._scale=__();break;case"point":this._scale=r_();break;case"band":this._scale=e_().padding(0);break;case"ordinal":this._scale=t_();break;case"ordinalColor":this._scale=t_(Nw[e.scheme]);break;case"power":this._scale=N_().exponent(2);break;case"sqrt":this._scale=N_().exponent(.5);break;case"log":this._scale=A_();break;case"identity":case"time":this._scale=Mm();break;case"sequentialColor":e.scheme?this._scale=Im(Nw[e.scheme]):this._scale=Im()}}get id(){return this._id}get domain(){return this._scale.domain()}set domain(t){this._scale.domain(t)}get range(){return this._scale.range()}set range(t){this._scale.range(t)}get rangeExtent(){let t=this._scale.range();return Math.abs(t[1]-t[0])}set rangeExtent(t){let e=this._scale.range();e[0]<e[1]?this._scale.range([e[0],e[0]+t]):this._scale.range([e[1]+t,e[1]])}get type(){return this._type}map(t){return this._scale(t)}invert(t,e){let n=et(this._scale.range()),r=Q(this._scale.range()),i=t;if(e||(i=Q([n,et([t,r])])),"time"===this._type)return this._scale.invert(i).getTime();if(["point","band","ordinal","ordinalColor"].includes(this._type)){return this._scale.domain().reduce((t,e)=>{let n=this._scale(e);"band"===this._type&&(n+=this._scale.bandwidth()/2);let r=this._scale(t);return"band"===this._type&&(r+=this._scale.bandwidth()/2),Math.abs(n-i)<Math.abs(r-i)?e:t})}return this._scale.invert(i)}}function CS(t){if(t.scaleType)return new TS(t.scaleType);if(t._baseEnc&&t._baseEnc.scales.length>0){let e=t._baseEnc.scales[0];return new TS(e.type,e._args)}if("text"===t.channel)return new TS("ordinal");switch(t.dataTable.type(t.attribute)){case Vw.Boolean:break;case Vw.Date:return new TS("time");case Vw.String:if("count"==t.aggregator)return new TS("linear");if(t.channel.indexOf("Color")>=0){let e={};return e.scheme=t.colorScheme?t.colorScheme:"schemeCategory10",new TS("ordinalColor",e)}return"src"===t.channel?new TS("ordinal"):new TS("point");default:return["strokeColor","fillColor","fillGradient"].indexOf(t.channel)>=0?t.mapping?new TS("linear"):new TS("sequentialColor",{scheme:t.colorScheme}):new TS("linear")}}const kS=["schemeBrBG","schemePRGn","schemePiYG","schemePuOr","schemeRdBu","schemeRdGy","schemeRdYlBu","schemeRdYlGn","schemeSpectral"],RS=["schemeBlues","schemeGreens","schemeGreys","schemeOranges","schemePurples","schemeReds","schemeBuGn","schemeBuPu","schemeGnBu","schemeOrRd","schemePuBuGn","schemePuBu","schemePuRd","schemeRdPu","schemeYlGnBu","schemeYlGn","schemeYlOrBr","schemeYlOrRd"];function MS(t,e){let n=e||aA(t.element);delete n._encodings[PS(t.element)][t.channel],console.log("remove encoding",t.channel,t.attribute),function(t,e){let n=e.findVariable(KE.CHANNEL,[t.channel,t.element]);n||console.warn("cannot find encoding to remove from the dep graph");let r=n.incomingDataflow;e.deleteOperator(r)}(t,n._depGraph);for(let e of t.refElements)vS(e,n),bA(e,n._depGraph);t.clearRefElements()}function OS(t,e){let n=t.scene._encodings[PS(t)],r=[];n&&(r=r.concat(Object.values(n)));{let e=t.scene;for(let n in e._encodings){let i=n.split("_");i.pop(),i.join("_")===t.classId&&(r=r.concat(Object.values(e._encodings[n])))}}return r}function NS(t,e,n){for(let r in n._encodings){let i=n._encodings[r];if(i[e]&&i[e].attribute==t)return i[e]}return null}function IS(t,e){let n=t.scene._encodings[PS(t)];return n&&n[e]?n[e]:null}function PS(t){if(Array.isArray(t))return t.map(t=>PS(t)).join("_");if(t.classId)return t.classId;if("vertex"==t.type&&t.dataScope){if(t.parent.type===Pw.Area){let e=t._index<t.parent._vertices.length/2;return t.parent.classId+"_v"+(e?0:t.parent._vertices.length-1)}return t.parent.classId+"_v"}return"vertex"==t.type?t.parent.classId+"_v"+t._index:"segment"==t.type&&t._dataScopeRef?t.parent.classId+"_s":"segment"==t.type?t.parent.classId+"_s"+t.parent.segments.indexOf(t):null}function LS(t,e){if(0==t.children.length)return[];let n=aA(t),r=t.type===Pw.Composite?t.children:[t.children[0]],i=Object.keys(n._encodings),s=[];for(let t of r){let e=t;for(;e;){if(e.classId&&s.indexOf(e.classId)<0&&s.push(e.classId),e.type===Pw.Glyph){e.children.forEach(t=>s.push(t.classId));break}if(!e.children)break;e=e.children[0]}}let o=[];for(let t of i)for(let r of s)0===t.indexOf(r)&&n._encodings[t][e]&&o.push(n._encodings[t][e]);return o}function DS(t){let e=IS(t,"y"),n=IS(t,"height");return e||n&&n.scales[0].domain[0]<0}function VS(t){let e=IS(t,"x"),n=IS(t,"width");return e||n&&n.scales[0].domain[0]<0}class BS extends XA{constructor(t,e,n,r,i){super(i),this._type=Pw.Gridlines,this._id=this._type+Dw(),this._attribute=e,this._channel=t,this._scale=n,this._elems=r,this._args=i,"strokeColor"in i||(this.styles.strokeColor="#ddd"),"opacity"in i||(this.styles.opacity=.5),this.updateValues(),this._lines=[]}updateValues(){"values"in this._args?this._values=this._args.values:this._scale?this._values=bS(this._scale,this._channel,this._elems):this._values=this._elems.map(t=>t.datum[this._attribute])}get type(){return this._type}get id(){return this._id}getSVGPathData(){let t="";if("radialDistance"===this._channel)for(let e of this._lines)t+="M "+e.x+" "+e.y+" m -"+e.r+" 0 a "+e.r+" "+e.r+" 0 1 0 "+2*e.r+" 0 a "+e.r+" "+e.r+" 0 1 0 -"+2*e.r+" 0 ";else for(let e of this._lines)t+=["M",e.x1,e.y1].join(" ")+[" L",e.x2,e.y2].join(" ")+" ";return t}_updateBounds(){if("radialDistance"===this._channel){let t=this._lines.map(t=>new PE(t.x-t.r,t.y-t.y,2*t.r,2*t.r));this._bounds=LE(t)}else{let t=this._lines.map(t=>t.x1).concat(this._lines.map(t=>t.x2)),e=this._lines.map(t=>t.y1).concat(this._lines.map(t=>t.y2)),n=d3.min(t),r=d3.max(t),i=d3.min(e),s=d3.max(e);this._bounds=new PE(n,i,r-n,s-i)}}get elements(){return this._elems}get values(){return this._values}get channel(){return this._channel}get attribute(){return this._attribute}get scale(){return this._scale}get lines(){return this._lines}set lines(t){this._lines=t}}class zS{constructor(t,e,n,r,i){this._id="encoding_"+Dw(),this._elem=t,this._channel=e,this._attribute=n,this._table=i.table,this._aggregator=r,this._includeZero=i.includeZero,this._flipScale=i.flipScale,this._mapping=i.mapping,this._preferredRangeExtent=i.rangeExtent,this._preferredRangeStart=i.rangeStart,this._preferredDomain=i.domain,this._scaleType=i.scaleType,this._colorScheme=i.scheme,this._forLegend=i.forLegend,this._sourceAttribute=i.sourceAttribute??null,i.shareScale&&(this._baseEnc=i.shareScale),this._scales=[],this._elemGroups=[],this._elem2scale={},this._refElements=[],["width","height","radius","angle","thickness","radialDistance","strokeWidth","area"].indexOf(this._channel)>=0&&(this._includeZero=!0),this.initialize()}get id(){return this._id}initialize(){if(this._scales=[],this._elemGroups=[],"vertex"===this._elem.type){let t,e=lA(this._elem),n=JE(this._elem.parent);if("x"!==this._channel&&"y"!==this._channel||!e.layout||e.layout.type!=HE.GRID)t=VS(this._elem.parent)||DS(this._elem.parent)?n.map(t=>eA(this._elem,[t])):[eA(this._elem,n)];else{t=("x"===this._channel?e.layout.getElementsByCol(!0,this._elem.parent):e.layout.getElementsByRow(!0,this._elem.parent)).map(t=>eA(this._elem,t))}for(let e of t)this._createScaleForVertexIndices(e)}else if("x"===this._channel||"y"===this._channel){let t=this._elem,e=lA(t);if(e.layout&&e.layout.type==HE.GRID){let n="x"===this._channel?e.layout.getElementsByCol(!0,t):e.layout.getElementsByRow(!0,t);for(let t of n)this._createScaleForElems(t)}else{let t=JE(this._elem);this._createScaleForElems(t)}}else if("angle"===this._channel){let t=JE(this._elem).reduce((t,e)=>{const n=e.parent.id;return t[n]||(t[n]=[]),t[n].push(e),t},{}),e=Object.values(t);for(let t of e)this._createScaleForElems(t)}else{let t=JE(this._elem);this._createScaleForElems(t)}}_createScaleForElems(t){this._elemGroups.push(t);var e=CS(this);this._scales.push(e);for(let n of t)this._elem2scale[n.id]=e}_createScaleForVertexIndices(t){this._elemGroups.push({type:"vertexIndices",groups:t});var e=CS(this);this._scales.push(e);for(let n of t)for(let t of n.indices)this._elem2scale[tA(n.parent,t)]=e}refreshElementMappings(){if(1===this._scales.length)if(this._elem2scale={},"vertex"===this._elem.type){let t=JE(this._elem.parent),e=eA(this._elem,t);this._elemGroups=[{type:"vertexIndices",groups:e}];for(let t of e)for(let e of t.indices)this._elem2scale[tA(t.parent,e)]=this._scales[0]}else{let t=JE(this._elem);this._elemGroups=[t];for(let e of t)this._elem2scale[e.id]=this._scales[0]}}getScale(t){return this._elem2scale[t.id]}getAttrValue(t,e,n){let r=(e?this.getScale(e):this._scales[0]).invert(t,n),i=this._attribute;if(this.dataTable.type(i)===Vw.Date){const t=this.dataTable.values(i).slice().sort((t,e)=>t-e);let e=a(t,r);return e=Math.min(e,t.length-1),e>0&&Math.abs(t[e-1]-r)<Math.abs(t[e]-r)&&e--,t[e]}return r}getChannelValue(t,e){return(e?this.getScale(e):this._scales[0]).map(t)}getElements(t){let e=this._scales.indexOf(t);return this._elemGroups[e]}get elementGroups(){return this._elemGroups}get element(){return this._elem}get channel(){return this._channel}get attribute(){return this._attribute}get sourceAttribute(){return this._sourceAttribute}set attribute(t){let e=this._attribute;this._attribute=t;for(let e of this._refElements)e instanceof SS?(e._attribute=t,e.createTicksLabels({}),e._titleText&&(e._titleText=this._sourceAttribute??t)):e instanceof BS&&(e._attribute=t,e.updateValues());const n=this._elem.scene._depGraph.getVariable(KE.ATTRIBUTE,e,this.dataTable,this);n&&(n._attribute=t,this._elem.scene.onChange(KE.ATTRIBUTE,t,this.dataTable,this))}get dataTable(){return this._table}get aggregator(){return this._aggregator}hasMultipleScales(){return this._scales.length>0}get scales(){return this._scales}getRangeStart(t){return et(this.getScale(t).range)}getRangeExtent(t){return this.getScale(t).rangeExtent}get domain(){if(1===this._scales.length)return this._scales[0].domain;throw new Error("AttributeEncoding: multiple scales exist, specify element to get domain.")}get rangeExtent(){if(1===this._scales.length)return this._scales[0].rangeExtent;throw new Error("AttributeEncoding: multiple scales exist, specify element to get rangeExtent.")}get scaleType(){return this._scaleType}set scaleType(t){this._scaleType=t}getDomain(t){return this.getScale(t).domain}set domain(t){this._preferredDomain=t;for(let e of this._scales)e._scale.domain(t);for(let t of this._refElements)t instanceof SS&&t.createTicksLabels({});this._elem.scene.onChange(KE.ATTR_VALUE,this)}set rangeExtent(t){let e=t<1?1:Math.round(t);for(let t of this._scales)t.rangeExtent=e;for(let t of this._refElements)t instanceof SS&&t.createTicksLabels({});this._elem.scene.onChange(KE.PROPERTY,gA.RANGE_EXTENT,this)}set includeZero(t){this._includeZero=t;for(let t of this._refElements)t instanceof SS&&t.createTicksLabels({});this._elem.scene.onChange(KE.PROPERTY,gA.INCLUDE_ZERO,this)}get includeZero(){return this._includeZero}set flipScale(t){this._flipScale=t,this._elem.scene.onChange(KE.PROPERTY,gA.FLIP_SCALE,this)}get flipScale(){return this._flipScale}set mapping(t){this._mapping=t}get mapping(){return this._mapping}set colorScheme(t){this._colorScheme=t}get colorScheme(){return this._colorScheme}addRefElement(t){this._refElements.indexOf(t)<0&&this._refElements.push(t)}get refElements(){return this._refElements}clearRefElements(){this._refElements=[]}zoom(t,e,n,r){let i=r||this._elem,s=this.getDomain(i),o=et(s),a=Q(s),l="log"!==this._scales[0].type,c=this.getAttrValue(e,i,l),u=o-(c-o)*t*n,h=a+(a-c)*t*n;u!==h&&(!l&&u<=0||(this.domain=[u,h]))}}function FS(t,e){let n=function(t){let e=t.parent,n=[];for(;e.type!==Pw.Scene;)n.push(e),e=e.parent;return n}(t);for(let t of n)if(IS(t,e))return!1;return n.length>=2?n[n.length-2]:t}function GS(t,e,n){switch(t.type){case Pw.Rect:case Pw.Path:case Pw.Line:case Pw.Area:!function(t,e,n){for(let r of t.vertices)jS(r,e,n);t._updateBounds(),t._refBounds&&t._refBounds.translate(e,n)}(t,e,n),0===e&&0===n||(t._dirty=!0);break;case Pw.Group:case Pw.Collection:case Pw.Glyph:!function(t,e,n){for(let r of t.children)GS(r,e,n);t._layout&&(void 0!==t._layout._left&&(t._layout._left+=e),void 0!==t._layout._top&&(t._layout._top+=n),t._layout._cellBounds&&t._layout._cellBounds.forEach(t=>t.translate(e,n)));0===e&&0===n||(t._dirty=!0);t._updateBounds(),t._refBounds&&t._refBounds.translate(e,n)}(t,e,n);break;case"segment":!function(t,e,n){jS(t.vertex1,e,n),jS(t.vertex2,e,n)}(t,e,n),0===e&&0===n||(t.parent._dirty=!0);break;case"vertex":jS(t,e,n),0===e&&0===n||(t.parent._dirty=!0);break;default:!function(t,e,n){t._x+=e,t._y+=n,t._updateBounds(),t._refBounds&&t._refBounds.translate(e,n)}(t,e,n),0===e&&0===n||(t._dirty=!0)}}function jS(t,e,n){t.x+=e,t.y+=n}function US(t,e,n,r={}){let i={channel:e,attribute:n,...r};if("rowId"===i.attribute&&(i.attribute=_E),function(t,e,n){if(!t||!e||!n)throw new Error("encode(elem, channel, attribute) — all three arguments are required");if(!Object.values(fA).includes(e))throw new Error(`Unknown channel "${e}"`);let r=pE(t);if(r&&r.tree){if(n.indexOf(".")>0&&!r.tree.nodeTable.has(n.split(".")[1]))throw new Error(`Data attribute "${n}" does not exist in the data table`)}else if(!r||!r.has(n))throw new Error(`Data attribute "${n}" does not exist in the data table`)}(t,e,n),i.shareScale){let t=i.shareScale;if(t.channel!=i.channel&&t.channel.indexOf("Color")<0&&i.channel.indexOf("Color")<0)throw new Error("Cannot share scales between "+t.channel+" and "+i.channel+" encodings");i.scheme=i.shareScale.colorScheme}!function(t){let e;"vertex"===t.type&&t.parent.type===Pw.Area?e=t.parent:t.type===Pw.Area&&(e=t),e&&!e._refBounds&&JE(e).forEach(t=>t._refBounds=t.bounds.clone())}(t);let s=i.aggregator?i.aggregator:"sum";i.table=pE(t);let o=new zS(t,i.channel,i.attribute,s,i),a=t.scene;return a._addAttributeEncoding(o),MA(o,a._depGraph,i.shareScale),i.shareScale?a.onChange(KE.ATTR_VALUE,o):a.onChange(KE.CHANNEL,i.channel,t),o}function YS(t,e,n,r){for(let i=e;i<n;i++)t._vertices._xs[i]=r;t._dirty=!0}function HS(t,e,n,r){for(let i=e;i<n;i++)t._vertices._xs[i]=r(i);t._dirty=!0}function WS(t,e,n,r){for(let i=e;i<n;i++)t._vertices._ys[i]=r;t._dirty=!0}function qS(t,e,n,r){for(let i=e;i<n;i++)t._vertices._ys[i]=r(i);t._dirty=!0}function $S(t,e,n){let r=aA(t),i={};if(i.attribute=i.attribute||_E,function(t,e,n){if(!t||void 0===e)throw new Error("Incomplete information to do repeat. You must specify an element, a categorical data attribute and a data table");if(e instanceof gE||e instanceof mE){if(!Array.isArray(t)||2!==t.length)throw new Error("To repeat with a tree or a network, you need to provide two marks, one for node and one for link")}else e instanceof fE&&function(t,e){if(e.has(t))return!0;if(e.tree&&e.tree.nodeTable.has(t.split(".")[1]))return!0;throw new Error(["Attribute",t,"does not exist in the table",e.name].join(" "))}(n.attribute,e);if(n.layout&&!(n.layout instanceof UE))throw new Error("Invalid layout: "+n.layout)}(t,e,i),e instanceof gE||e instanceof mE){let n=t[0].parent,i=t[1].parent,[s,o]=function(t,e,n,r){let i=e.dataScope?e.dataScope:cE(r.nodeTable),s=uE(i,xE),o=nT(t,{type:Pw.Collection}),a=nT(t,{type:Pw.Collection}),l={};a.dataScope=i,a.addChild(e);for(let t=1;t<s.length;t++){let t=sT(e);a.addChild(t)}a.children.forEach((t,e)=>{t.dataScope=s[e],t.links=[],l[iE(t.dataScope,xE)]=t});let c=n.dataScope?n.dataScope:cE(r.linkTable),u=uE(c,_E);o.dataScope=c,o.addChild(n);for(let t=1;t<u.length;t++){let t=sT(n);o.addChild(t)}o.children.forEach((t,e)=>t.dataScope=u[e]);let h=r instanceof gE?"parent":"source",f=r instanceof gE?"child":"target";for(let t of o.children){let e=iE(t.dataScope,h),n=iE(t.dataScope,f),r=l[e],i=l[n];t.source=r,t.target=i,r.links.push(t),i.links.push(t)}return[a,o]}(r,t[0],t[1],e);return wA(n,t[0],r._depGraph),wA(i,t[1],r._depGraph),vA(s,r._depGraph),vA(o,r._depGraph),EA(s,t[0],r._depGraph),EA(s.parent,s,r._depGraph),EA(o,t[1],r._depGraph),EA(o.parent,o,r._depGraph),[s,o]}if(e instanceof fE){let n=t.parent,s=function(t,e,n,r){let i=r.type(n);if(i!=Vw.String&&i!=Vw.Date&&i!=Vw.Integer)throw new Error("Repeat only works on a string or date attribute: "+n+" is "+i);if(!function(t){if(Array.isArray(t)){if(1===t.length)return XS(t[0]);for(let e of t)if(!GE(e)||e.dataScope)return!1;return!0}return XS(t)}(e))throw new Error("The "+e.type+" is not repeatable");return function(t,e,n,r){let i=e.dataScope?e.dataScope:cE(r),s=uE(i,n),o=nT(t,{type:Pw.Collection});o.dataScope=i,o.addChild(e),e._refBounds||(e._refBounds=e.bounds.clone());for(let t=1;t<s.length;t++){let t=sT(e);o.addChild(t)}return o.children.forEach((t,e)=>t.dataScope=s[e]),o}(t,e,n,r)}(r,t,i.attribute,e);return wA(n,t,r._depGraph),vA(s,r._depGraph),EA(s,t,r._depGraph),EA(s.parent,s,r._depGraph),function(t,e,n,r){let i=r.getVariable(KE.ITEMS,n),s=r.createOneWayDependency($E.REPOPULATE);s._collection=t,s._repeatAttr=e,r.connect(i,s);let o=t.children[0],a=new Set([o,...cA(o)]);for(let t of a)r.connect(s,r.getVariable(KE.DATASCOPE,t))}(s,i.attribute,e,r._depGraph),i.layout&&(s.layout=i.layout),s}}function XS(t){return!(!GE(t)&&t.type!=Pw.Glyph||t.dataScope)||t.type===Pw.Collection&&nE(t.firstChild.dataScope)>1}class KS extends UE{constructor(t){super(),this.type=HE.GRID,this._numCols=t.numCols,this._numRows=t.numRows,this._start="start"in t?t.start:BA.TopLeft,this._direction="direction"in t?t.direction:VA.RowFirst,this._rowGap="rowGap"in t&&void 0!==t.rowGap?t.rowGap:5,this._colGap="colGap"in t&&void 0!==t.colGap?t.colGap:5,this._cellHorzAlignment="horzCellAlignment"in t&&WE("h",t.horzCellAlignment)?t.horzCellAlignment:zE.LEFT,this._cellVertAlignment="vertCellAlignment"in t&&WE("v",t.vertCellAlignment)?t.vertCellAlignment:zE.BOTTOM,this._numCols||this._numRows||(this._numRows=1),this._includeInvisible=!1,this._left=void 0,this._top=void 0,this._cellBounds=void 0,this._grid=void 0}get includeInvisible(){return this._includeInvisible}set includeInvisible(t){this._includeInvisible=t}get cellBounds(){return this._cellBounds}get numCols(){return this._numCols?this._numCols:this._numRows?Math.ceil(this.group.children.length/this._numRows):0}set numCols(t){this._numCols=t}set numRows(t){this._numRows=t}get numRows(){return this._numRows?this._numRows:this._numCols?Math.ceil(this.group.children.length/this._numCols):0}clone(){let t=new KS({numCols:this._numCols,numRows:this._numRows,start:this._start,direction:this._direction,colGap:this._colGap,rowGap:this._rowGap,horzCellAlignment:this._cellHorzAlignment,vertCellAlignment:this._cellVertAlignment});return t._includeInvisible=this._includeInvisible,t._left=this._left,t._top=this._top,this._cellBounds&&(t._cellBounds=this._cellBounds.map(t=>t.clone())),t}getElementsByRow(t,e){let n=[],r=this.group.children;for(let e=0;e<this.numRows;e++){let i=this._grid[e].filter(t=>null!=t).map(t=>r[t]);if(t){let t=[];for(let e of i)t=t.concat(cA(e));n.push(t)}else n.push(i)}return e&&(n=this._filterElementsByExample(n,e)),n}getElementsByCol(t,e){let n=[],r=this.group.children,i=this._grid;for(let e=0;e<this.numCols;e++){let s=i.map(t=>t[e]).filter(t=>null!=t).map(t=>r[t]);if(t){let t=[];for(let e of s)t=t.concat(cA(e));n.push(t)}else n.push(s)}return e&&(n=this._filterElementsByExample(n,e)),n}getElementsByCell(t,e){let n=[],r=this.group.children;for(let e=0;e<r.length;e++)if(t){let t=cA(r[e]);n.push(t)}else n.push(r[e]);return e&&(n=this._filterElementsByExample(n,e)),n}_filterElementsByExample(t,e){let n;return"vertex"===e.type?(n=t.map(t=>t.filter(t=>t.classId===e.parent.classId)),n=n.map(t=>QE(e,t))):"segment"===e.type?(n=t.map(t=>t.filter(t=>t.classId===e.parent.classId)),n=n.map(t=>nA(e,t))):n=t.map(t=>t.filter(t=>t.classId===e.classId)),n}getIndex(t){let e=t;for(;e&&e.parent!==this.group;)e=e.parent;return this.group.children.indexOf(e)}getRowCol(t){let e,n;switch(this._direction){case VA.RowFirst:e=Math.floor(t/this.numCols),n=t%this.numCols;break;case VA.ColumnFirst:e=t%this.numRows,n=Math.floor(t/this.numRows);break;default:throw new Error("Invalid fill direction. Use 'row_first' or 'column_first'.")}return this._start.toLowerCase().includes("bottom")&&(e=this.numRows-1-e),this._start.toLowerCase().includes("right")&&(n=this.numCols-1-n),{row:e,col:n}}get startCorner(){return this._start}set startCorner(t){this._start=t}get direction(){return this._direction}set direction(t){this._direction=t}}class ZS extends PA{constructor(t,e){super(),this._type=Pw.Axis,this._id=this._type+Dw(),this._enc=t,this._textColor="textColor"in e?e.textColor:"#555",this._strokeColor="strokeColor"in e?e.strokeColor:"#555",this._fontSize="fontSize"in e?e.fontSize:"12px",this._x="x"in e?e.x:100,this._y="y"in e?e.y:100,this._showTitle=!("showTitle"in e)||e.showTitle,this._orientation="orientation"in e?e.orientation:FA,this._numberFormat=e.numberFormat?e.numberFormat:""}get attribute(){return this._enc.attribute}get channel(){return this._enc.channel}get attributeType(){return pE(this._enc.element).getFieldType(this.attribute)}get orientation(){return this._orientation}get textColor(){return this._textColor}}class JS extends ZS{constructor(t,e){super(t,e),"numCols"in e||"numRows"in e?(this._numCols=e.numCols,this._numRows=e.numRows):this._orientation===FA?this._numCols=1:this._numRows=1,this._initialize()}_initialize(){let t=this._enc.element.scene,e=this._enc.attribute,n=this._enc.scales[0],r=new fE(n.domain.map(t=>({category:t,value:n.map(t)}))),i=r.unique("category").sort((t,e)=>e.length-t.length)[0],s=this._enc.element,o=s instanceof XA&&s.closed&&"strokeColor"!==this._enc.channel?s.strokeWidth:0;if(this._orientation===FA){let n=0;this._showTitle&&(this.addChild(new dS({fillColor:this._textColor,fontSize:this._fontSize,text:e,x:this._x,y:this._y,anchor:["left","top"]})),n=parseFloat(this._fontSize)+5);let a=t.mark("rect",{top:this._y+2+n,left:this._x,width:10,height:10,strokeWidth:o,strokeColor:s.strokeColor,opacity:s.opacity}),l=t.mark("text",{text:i,fillColor:this._textColor,fontSize:this._fontSize,x:this._x+20,y:this._y+n+12+o,anchor:["left","bottom"]}),c=$S(t.glyph(a,l),r);US(l,"text","category",{forLegend:!0}),US(a,"fillColor","category",{shareScale:this._enc,forLegend:!0}),c.layout=new KS({numCols:this._numCols,numRows:this._numRows}),this.addChild(c)}else{let e=t.mark("rect",{top:this._y,left:this._x,width:10,height:10,strokeWidth:o,strokeColor:s.strokeColor,opacity:s.opacity}),n=t.mark("text",{text:i,fillColor:this._textColor,fontSize:this._fontSize,x:this._x+15,y:this._y,anchor:["left","top"]}),a=$S(t.glyph(e,n),r);US(n,"text","category",{forLegend:!0}),US(e,"fillColor","category",{shareScale:this._enc,forLegend:!0}),a.layout=new KS({numCols:this._numCols,numRows:this._numRows,colGap:15}),this.addChild(a)}}}class QS extends ZS{constructor(t,e){super(t,e),this._initialize()}_initialize(){let t,e,n,r=this._enc.element.scene,i=this._enc.attribute;if(this._orientation==FA?(t=15,e=300):(t=300,e=15),this._showTitle){let e=r.mark("text",{fillColor:this._textColor,text:i,x:this._x+t/2,y:this._y,anchor:["center","middle"]});this.addChild(e),n=20}else n=0;let s,o=r.mark("rect",{top:this._y+n,left:this._x,width:t,height:e,strokeWidth:0,opacity:this._enc.element.opacity}),a=Object.values(this._enc.attrValues),l=[et(a),Q(a)],c=this._enc.mapping,u=[],h=[],f=Hl(this._numberFormat);if(c){let i=Object.keys(c).map(t=>parseFloat(t)).sort((t,e)=>t-e);this._orientation==FA?(s=new mS({x1:0,y1:100,x2:0,y2:0}),i.forEach(i=>{let o=(i-l[0])/(l[1]-l[0]);s.addStop(100*o,c[i],1);let a=r.mark("line",{x1:this._x+t,x2:this._x+t+5,y1:this._y+e-o*e+n,y2:this._y+e-o*e+n,strokeColor:this._strokeColor});h.push(a);let d=r.mark("text",{fillColor:this._textColor,text:this._numberFormat?f(i):i.toFixed(0),x:this._x+t+5+5,y:this._y+e-o*e+n,anchor:["left","middle"]});u.push(d)})):(s=new mS({x1:0,y1:0,x2:100,y2:0}),i.forEach(i=>{let o=(i-l[0])/(l[1]-l[0]);s.addStop(100*o,c[i],1);let a=r.mark("line",{x1:this._x+o*t,x2:this._x+o*t,y1:this._y+20-5+n,y2:this._y+e+5+n,strokeColor:this._strokeColor});h.push(a);let d=r.mark("text",{fillColor:this._textColor,text:this._numberFormat?f(i):i.toFixed(0),x:this._x+o*t,y:this._y+e+5+n,anchor:["center","top"]});u.push(d)}))}else{let o=this._enc.scales[0].domain,a=pE(this._enc.element),l=a.type(i),c=[],d=l===Vw.Date?a.getUniqueFieldValues(i):[...new Set(Object.values(this._enc.attrValues))];if(d.length<=10)c=d,c.sort((t,e)=>t-e);else if(l===Vw.Date){d.sort((t,e)=>t-e);for(let t=0;t<d.length;t+=Math.ceil(d.length/10))c.push(d[t])}else{let t=(o[1]-o[0])/9;for(let e=0;e<10;e++)c.push(o[0]+e*t)}let p=0,_=(c[c.length-1]-c[0])/c.length;for(;_<1;)_*=10,p++;c=c.map(t=>t.toFixed(p)),this._orientation==FA?(s=new mS({x1:0,y1:100,x2:0,y2:0}),c.forEach(c=>{let d=(c-o[0])/(o[1]-o[0]);s.addStop(100*d,this._enc.scales[0].map(c),1);let p=r.mark("line",{x1:this._x+t,x2:this._x+t+5,y1:this._y+e-d*e+n,y2:this._y+e-d*e+n,strokeColor:this._strokeColor});h.push(p);let _=r.mark("text",{fillColor:this._textColor,text:l===Vw.Date?a.raw(i,c):this._numberFormat?f(c):c,x:this._x+t+5+5,y:this._y+e-d*e+n,anchor:["left","middle"]});u.push(_)})):(s=new mS({x1:0,y1:0,x2:100,y2:0}),c.forEach(c=>{let f=(c-o[0])/(o[1]-o[0]);s.addStop(100*f,this._enc.scale.map(c),1);let d=r.mark("line",{x1:this._x+f*t,x2:this._x+f*t,y1:this._y+e+n,y2:this._y+e+5+n,strokeColor:this._strokeColor});h.push(d);let p=r.mark("text",{fillColor:this._textColor,text:l===Vw.Date?a.raw(i,c):c,x:this._x+f*t,y:this._y+e+5+n,anchor:["center","top"]});u.push(p)}))}o.styles.fillColor=s,this.addChild(o);for(let t of u)this.addChild(t);for(let t of h)this.addChild(t)}}class tT extends xS{constructor(t,e,n,r){super(r),this._elems=t,this._attribute=n,this._channel=e,this._posArg="x"==this._channel||"width"==this._channel?r.pathY:r.pathX,this._labelAttribute=r.labelAttribute,this._orientation="orientation"in r?r.orientation:"x"===this._channel||"width"==this._channel?ES:AS,this._titleText="title"in r?r.title:this._attribute,this._path="angle"===this._channel?new aS({strokeColor:this._strokeColor,id:this._id+"_path"}):new XA({strokeColor:this._strokeColor,id:this._id+"_path"}),this._pathVisible||(this._path.visibility="hidden"),this.addChild(this._path),this.createTicksLabels(r),Jw(this._elems[0].dataScope).type(this._attribute)!==Vw.Date||"labelFormat"in r||(this._labelFormat="%m/%d/%y")}get elements(){if(this.layout.type===HE.CLUSTER){const t=new Map(this._elems.map(t=>[t.datum[xE],t]));return this.layout._d3Root.leaves().map(e=>t.get(e.data[xE]))}return this._elems}get layout(){return this._elems[0].parent.layout}createTicksLabels(t){"tickValues"in t?(this._tickValues=t.tickValues,this._labelValues=t.tickValues):(this._tickValues=this.elements.map(t=>t.datum[this._labelAttribute?this._labelAttribute:this._attribute]),this._labelValues=this._tickValues),this._ticks.removeAll();for(let t=0;t<this._tickValues.length;t++){let e=new XA({strokeColor:this._strokeColor,id:this._id+"_tick"+t});this._tickVisible||(e.visibility="hidden"),this._ticks.addChild(e)}let e;switch(this._labels.removeAll(),Jw(this._elems[0].dataScope).type(this._labelAttribute?this._labelAttribute:this._attribute)){case Vw.Date:e=ny(this._labelFormat);break;case Vw.String:e=function(t){return t};break;default:e=Hl(this._labelFormat)}for(let[t,n]of this._labelValues.entries()){let r=new dS({text:e(n),fontSize:this._fontSize,fillColor:this._textColor,id:this._id+"_label"+t});this._labels.addChild(r)}this._title._text=this._titleText}}class eT extends PA{constructor(t){super(),this._type=Pw.Composite,this._id=t&&t.id?t.id:this._type+Dw()}addChild(t){let e=t.parent;super.addChild(t);let n=aA(t)._depGraph;e&&wA(e,t,n),EA(this,t,n)}}function nT(t,e){let n;switch(e.type){case"collection":n=iT(e);break;case"glyph":n=function(t){let e=new DA(t);return e}(e);break;case"axis":n=function(t){if("encoding"===t.axisType){return new SS(t.enc,t.scale,t.elems,t)}if("layout"===t.axisType){return new tT(t.elems,t.channel,t.attribute,t)}}(e);break;case"legend":n=function(t){let e="string"===t.attrType?new JS(t.enc,t):new QS(t.enc,t);return e}(e);break;case"composite":n=function(t){let e=new eT(t);return e}(e);break;default:n=rT(e)}return t.addChild(n),t._itemMap[n.id]=n,n}function rT(t){let e=null;switch(t.type){case Pw.Circle:e=new aS(t);break;case Pw.Line:var n="x1"in t?t.x1:0,r="y1"in t?t.y1:0,i="x2"in t?t.x2:100,s="y2"in t?t.y2:100;t.vertices=[[n,r],[i,s]],e=new cS(t);break;case Pw.Rect:var o="top"in t?t.top:0,a="left"in t?t.left:0,l="width"in t?t.width:50,c="height"in t?t.height:30;t.vertices=[[a,o],[a+l,o],[a+l,o+c],[a,o+c]],e=new _S(t);break;case Pw.SimpleText:e=new dS(t);break;case Pw.RichText:e=new yS(t);break;case Pw.Image:e=new lS(t);break;case Pw.BundledPath:case Pw.Chord:case Pw.Path:e=new XA(t);break;case Pw.Arrow:e=new fS(t);break;case Pw.Area:e=new sS(t);break;case Pw.Ring:e=new gS(t);break;case Pw.Arc:e=new tS(t);break;case Pw.BezierCurve:"vertices"in t||(t.vertices=[[0,100],[20,120],[80,180],[100,200]]),e=new oS(t);break;case Pw.Polygon:e=new pS(t)}return e&&e._updateBounds(),e}function iT(t){return new LA(t)}function sT(t){switch(t.type){case Pw.Collection:return function(t){let e=iT({});for(let n=0;n<t.children.length;n++){let r=t.children[n];e.addChild(sT(r))}if(e._classId=t.classId,t._layout){let n=t._layout.clone();e._layout=n,n.group=e}return e._updateBounds(),t.scene._itemMap[e.id]=e,e}(t);case Pw.Glyph:return function(t){let e=new DA;for(let n of t.children)e.addChild(sT(n));e._classId=t.classId,t.dataScope&&(e.dataScope=t.dataScope);return t.scene._itemMap[e.id]=e,e}(t);default:return function(t){let e=rT({type:t.type});t.copyPropertiesTo(e),e._classId=t.classId,e._bounds=t.bounds.clone(),t._refBounds||(t._refBounds=t.bounds.clone());if(e._refBounds=t._refBounds.clone(),t.vertices)for(let n=0;n<t.vertices.length;n++)t.vertices[n].dataScope&&(e.vertices[n].dataScope=t.vertices[n].dataScope);return t.scene._itemMap[e.id]=e,e}(t)}}class oT extends XE{constructor(t,e){super(t),this._elem=e}get element(){return this._elem}}class aT extends XE{constructor(t,e){super(t),this._item=e}get element(){return this._item}}class lT{constructor(t){this._id=t+"_"+Dw(),this._type=t,this._vars=[],this._edges=[]}get vars(){return this._vars}get edges(){return this._edges}run(){console.log("-",this._type)}}class cT{constructor(t,e,n=!0){this._id="e_"+Dw(),this._fromNode=t,this._toNode=e,this._isDirected=n}get id(){return this._id}get fromNode(){return this._fromNode}get toNode(){return this._toNode}get isDirected(){return this._isDirected}get operator(){return this._fromNode instanceof qE||this._fromNode instanceof lT?this._fromNode:this._toNode}}class uT extends XE{constructor(t,e){super(t),this._encs={},this._encs[e.channel+"_"+PS(e.element)]=e,this._initialized=!1}addLinkedEncoding(t){this._encs[t.channel+"_"+PS(t.element)]=t}getEncoding(t,e){let n=t+"_"+PS(e);return this._encs[n]}get encodings(){return Object.values(this._encs)}get initialized(){return this._initialized}set initialized(t){this._initialized=t}}class hT extends XE{constructor(t,e){super(t),this._encs=[e],this._valueMap={}}addLinkedEncoding(t){this._encs.push(t)}get encodings(){return this._encs}get attrValues(){return this._valueMap}set attrValues(t){this._valueMap=t}}class fT extends qE{constructor(t){super(t)}run(){super.run();let t=this.inputVars.find(t=>t instanceof hT),e=this.outputVar,n=e.encodings,r=n[0],i=r.channel,s=r.attribute,o=t.encodings[0].dataTable.type(t.encodings[0].attribute),a=Object.values(t.attrValues);if("angle"===r.channel&&[Pw.Arc,Pw.Pie].indexOf(r.element.type)>=0)for(let e of t.encodings)for(let t of e.scales){let n=e.getElements(t).map(t=>e.attrValues[t.id]);t.domain=r._preferredDomain?r._preferredDomain:e.dataTable.tree?[0,e.dataTable.tree.getRoot()[s]]:this._getDomainForNumbers(n),console.log("domain for",s,t.domain)}else{let e;e=r._preferredDomain?r._preferredDomain:o==Vw.String||"text"===t.encodings[0].channel?this._getDomainForStrings(a):this._getDomainForNumbers(a);for(let n of t.encodings)for(let t of n.scales)t.domain=e.slice()}for(let t=0;t<r.scales.length;t++){let s=r.scales[t],o=r.getElements(s),a=this._buildRange(i,o,r,e);if(a)for(let e of n)e.scales[t].range=a}e.initialized=!0}_getDomainForNumbers(t){let e=this.outputVar.encodings[0],n=[et(t),Q(t)];if(e.includeZero&&n[0]>0&&(n=[0,Q(t)]),e.mapping)n=Object.keys(e.mapping),n=n.map(t=>parseFloat(t)),n.sort((t,e)=>t-e);else if("sequentialColor"===e.scales[0].type){if(n[0]<0&&n[1]>0){let t=Math.max(Math.abs(n[0]),Math.abs(n[1]));n=[-t,t]}}else if("angle"===e.channel){let e=Object.values(t).reduce((t,e)=>t+e,0);n=[0,e]}return n}_getDomainForStrings(t){let e,n=this.outputVar,r=n.encodings[0];return e="count"==n.encodings[0].aggregator?[0,Math.max(...t)]:Array.from(new Set(t)),r.mapping&&(e=Object.keys(r.mapping)),e}_buildRange(t,e,n,r){return"x"===t?this._buildXRange(e,n,r):"y"===t?this._buildYRange(e,n,r):["width","height","radius","area","fontSize","radialDistance","strokeWidth"].includes(t)?this._buildSizeRange(e,n,r):t.indexOf("Color")>0||"fillGradient"===t?this._buildColorRange(e,n):"angle"===t?this._buildAngleRange(e,n):"thickness"===t?this._buildThicknessRange(e,n,r):"src"===t?n.scales[0].domain.slice():void 0}_buildThicknessRange(t,e,n){let r=t.map(t=>t.outerRadius-t.innerRadius);return[0,n.initialized?e.getRangeExtent(t[0]):e._preferredRangeExtent?e._preferredRangeExtent:Math.max(...r)]}_buildAngleRange(t,e){return[0,360]}_buildColorRange(t,e){if(e.mapping){return e.scales[0].domain.map(t=>e.mapping[t+""])}if("sequentialColor"===e.scales[0].type){let t=this.outputVar,n=e.scales[0].domain;for(let r of t.encodings)if(!e.colorScheme)for(let t of r.scales){let e=t.domain;t._scale=Im(n[0]<0&&n[1]>0?rb:rv),t._scale.domain(e)}}if((kS.indexOf(e.colorScheme)>=0||RS.indexOf(e.colorScheme)>=0)&&"ordinalColor"===e.scales[0].type){let t=this.outputVar,n=e.scales[0].domain;for(let r of t.encodings)for(let t of r.scales){let r=t.domain;t._scale=t_(Nw[e.colorScheme][n.length]),t._scale.domain(r)}}}_buildSizeRange(t,e,n){let r,i;if(r=0,"vertexIndices"===t.type){let r=tA(t.groups[0].parent,t.groups[0].indices[0]);return i=n.initialized?e._elem2scale[r].rangeExtent:e._preferredRangeExtent?e._preferredRangeExtent:Math.max(...this._getVertexIndexSizeValues(t,e.channel)),[0,0+i]}return i=n.initialized?e.getRangeExtent(t[0]):e._preferredRangeExtent?e._preferredRangeExtent:Math.max(...t.map(t=>"radius"===e.channel?t.refBounds.width/2:"strokeWidth"===e.channel?t.strokeWidth:"radialDistance"===e.channel?t.parent.radius:"area"===e.channel?t.type===Pw.Circle?Math.PI*Math.pow(t.radius,2):t.width*t.height:"fontSize"===e.channel?parseFloat(t.fontSize):t.refBounds[e.channel])),[0,0+i]}_getVertexIndexSizeValues(t,e){let n=[];for(let r of t.groups){let t=r.parent._vertices;for(let i of r.indices)n.push("radius"===e?t._radii[i]:"strokeWidth"===e?t._strokeWidths[i]:"radialDistance"===e?r.parent.radius:"width"===e?t._widths[i]:"height"===e?t._heights[i]:0)}return n}_buildXRange(t,e,n){let r,i,s=e.scales[0].type;if("vertexIndices"===t.type){let s=t.groups[0].parent,o=tA(s,t.groups[0].indices[0]),a=s.refBounds?s.refBounds:s.bounds;return r=n.initialized?et(e._elem2scale[o].range):a.left,i=n.initialized?e._elem2scale[o].rangeExtent:e._preferredRangeExtent?e._preferredRangeExtent:a.width,e.flipScale?[r+i,r]:[r,r+i]}switch(t[0].type){case"vertex":case"segment":var o=t[0].parent.refBounds?t[0].parent.refBounds:t[0].parent.bounds;r=n.initialized?e.getRangeStart(t[0]):o.left,i=n.initialized?e.getRangeExtent(t[0]):e._preferredRangeExtent?e._preferredRangeExtent:o.width;break;default:r=n.initialized?e.getRangeStart(t[0]):e._preferredRangeStart?e._preferredRangeStart:lA(t[0]).bounds.left+t[0].bounds.width/2,i="band"===s?t[0].bounds.width*e.scales[0].domain.length:n.initialized?e.getRangeExtent(t[0]):e._preferredRangeExtent?e._preferredRangeExtent:Q([450,Q(t.map(t=>t.bounds.x))-et(t.map(t=>t.bounds.x))])}return e.flipScale?[r+i,r]:[r,r+i]}_buildYRange(t,e,n){let r,i;if(e.scales[0].type,"vertexIndices"===t.type){let s=t.groups[0].parent,o=tA(s,t.groups[0].indices[0]),a=s.refBounds?s.refBounds:s.bounds;return r=n.initialized?et(e._elem2scale[o].range):a.top,i=n.initialized?e._elem2scale[o].rangeExtent:e._preferredRangeExtent?e._preferredRangeExtent:a.height,e.flipScale?[r,r+i]:[r+i,r]}switch(t[0].type){case"vertex":case"segment":var s=t[0].parent.refBounds?t[0].parent.refBounds:t[0].parent.bounds;r=n.initialized?e.getRangeStart(t[0]):s.top,i=n.initialized?e.getRangeExtent(t[0]):e._preferredRangeExtent?e._preferredRangeExtent:s.height;break;default:r=n.initialized?e.getRangeStart(t[0]):lA(t[0]).bounds.top+t[0].bounds.height/2,i=n.initialized?e.getRangeExtent(t[0]):e._preferredRangeExtent?e._preferredRangeExtent:450}return e.flipScale?[r,r+i]:[r+i,r]}}class dT extends qE{constructor(t){super(t)}run(){super.run()}}class pT extends qE{constructor(t){super(t)}run(){super.run();let t=this.inputVars.find(t=>t instanceof dA&&t.property==gA.AXIS_ORIENTATION).element;t.createTicksLabels(t._args),t instanceof SS?this._runForEncoding(t):t instanceof tT&&this._runForLayout(t),BE(t._path)}_runForLayout(t){let e=t.channel,n=t.elements[0].parent.layout&&t.elements[0].parent.layout.type==HE.STACK?VE(t.elements):DE(t.elements),r=[];if("x"===e){let e=t.orientation===wS?n.top-2:n.bottom+2;t._pathPos=t._posArg?t._posArg:e,r.push([n.left,t._pathPos]),r.push([n.right,t._pathPos]),t._path.vertices=r}else if("y"===e){let e=t.orientation===AS?n.left-2:n.right+2;t._pathPos=t._posArg?t._posArg:e,r.push([t._pathPos,n.top]),r.push([t._pathPos,n.bottom]),t._path.vertices=r}else if("angle"===e){let e=t.elements[0].parent.layout;e.type===HE.CLUSTER&&(t._path._x=e.x,t._path._y=e.y,t._path._radius=e.radius)}}_runForEncoding(t){let e=t.channel,n=t.elements,r=n[0].parent.layout&&n[0].parent.layout.type==HE.STACK?VE(n):DE(n),i=[],s=lA(n[0]);if(s&&s.clipMask&&(r=s.clipMask),"x"===e){let e,s,o=IS(n[0],"y");o?(e=Math.min(...o.getScale(n[0]).range,r.top),s=Math.max(...o.getScale(n[0]).range,r.bottom)):(e=r.top,s=r.bottom);let a=t.orientation===wS?e-2:s+2;t._pathPos=t._posArg?t._posArg:a,i.push([t.scale.range[0],t._pathPos]),i.push([t.scale.range[1],t._pathPos])}else if("width"===e){let e=t.orientation===wS?r.top-2:r.bottom+2;t._pathPos=t._posArg?t._posArg:e,i.push([r.left,t._pathPos]),i.push([r.right,t._pathPos])}else if("radialDistance"===e){let e=t.elements[0].parent,n=e.y;t._pathPos=t._posArg?t._posArg:n,i.push([t.scale.range[0]+e.x,t._pathPos]),i.push([t.scale.range[1]+e.x,t._pathPos])}else if("y"===e){let e,s,o=IS(n[0],"x");o?(e=Math.min(...o.getScale(n[0]).range,r.left),s=Math.max(...o.getScale(n[0]).range,r.right)):(e=r.left,s=r.right);let a=t.orientation===AS?e-2:s+2;t._pathPos=t._posArg?t._posArg:a,i.push([t._pathPos,t.scale.range[0]]),i.push([t._pathPos,t.scale.range[1]])}else if("height"===e){let e=t.orientation===AS?r.left-2:r.right+2;t._pathPos=t._posArg?t._posArg:e,i.push([t._pathPos,r.bottom]),i.push([t._pathPos,r.top])}t._path.vertices=i}}class _T extends qE{constructor(t){super(t)}run(){super.run();let t=this.inputVars.find(t=>t instanceof dA&&t.property==gA.AXIS_PATH_POSITION).element;t instanceof SS?this._runForEncoding(t):t instanceof tT&&this._runForLayout(t);let e=[];if("width"===t.channel||"x"===t.channel){let n=t._ticks.children.map(t=>t.vertices[0].x),r=[t._path.vertices[0].x,t._path.vertices[1].x];e.push([d3.min(n.concat(r)),t._path.vertices[0].y]),e.push([d3.max(n.concat(r)),t._path.vertices[0].y]),t._path.vertices=e}else if("height"===t.channel||"y"===t.channel){let n=t._ticks.children.map(t=>t.vertices[0].y),r=[t._path.vertices[0].y,t._path.vertices[1].y];e.push([t._pathPos,d3.min(n.concat(r))]),e.push([t._pathPos,d3.max(n.concat(r))]),t._path.vertices=e}for(let e of t._ticks.children)e._updateBounds();BE(t._ticks)}_runForLayout(t){let e=t.channel;if("x"==e){let e=t.orientation==ES?t._pathPos+t.tickOffset:t._pathPos-t.tickOffset,n=t.orientation==ES?t.tickSize:-t.tickSize;for(let[r,i]of t._ticks.children.entries()){let s=t.elements[r].bounds[t.tickAnchor];i.vertices=[[s,e],[s,e+n]]}}else if("y"===e){let e=t.orientation==AS?t._pathPos-t.tickOffset:t._pathPos+t.tickOffset,n=t.orientation==AS?-t.tickSize:t.tickSize;for(let[r,i]of t._ticks.children.entries()){let s=t.elements[r].bounds[t.tickAnchor];i.vertices=[[e,s],[e+n,s]]}}else if("angle"===e){let e=t.elements[0].parent.layout;if(e.type===HE.CLUSTER){let n=e._d3Root.leaves();const r=new Map(n.map(t=>[t.data[xE],[t.x,t.y]]));for(let[n,i]of t._ticks.children.entries()){let s=t.elements[n].datum[xE],o=nS(r.get(s)[0])-90;i.vertices=[[e.x+r.get(s)[1]+t.elements[n].bounds.width/2,e.y],[e.x+r.get(s)[1]+t.elements[n].bounds.width/2+t.tickSize,e.y]],i._rotate=[o,e.x,e.y]}}}}_runForEncoding(t){let e=t.channel,n=DE(t.elements);if("x"==e){let e=t.orientation==ES?t._pathPos+t.tickOffset:t._pathPos-t.tickOffset,n=t.orientation==ES?t.tickSize:-t.tickSize;for(let[r,i]of t._ticks.children.entries())i.vertices=[[t.scale.map(t._tickValues[r]),e],[t.scale.map(t._tickValues[r]),e+n]]}else if("width"==e){let e=t.orientation==ES?t._pathPos+t.tickOffset:t._pathPos-t.tickOffset,r=t.orientation==ES?t.tickSize:-t.tickSize;if(!!(t.isFlipped()||t.elements[0].type===Pw.Area&&"right"===t.elements[0].baseline))for(let[i,s]of t._ticks.children.entries())s.vertices=[[n.left+t.scale.rangeExtent-t.scale.map(t._tickValues[i]),e],[n.left+t.scale.rangeExtent-t.scale.map(t._tickValues[i]),e+r]];else for(let[i,s]of t._ticks.children.entries())s.vertices=[[t.scale.map(t._tickValues[i])+n.left,e],[t.scale.map(t._tickValues[i])+n.left,e+r]]}else if("y"===e){let e=t.orientation==AS?t._pathPos-t.tickOffset:t._pathPos+t.tickOffset,n=t.orientation==AS?-t.tickSize:t.tickSize;for(let[r,i]of t._ticks.children.entries())i.vertices=[[e,t.scale.map(t._tickValues[r])],[e+n,t.scale.map(t._tickValues[r])]]}else if("height"===e){let e=t.orientation==AS?t._pathPos-t.tickOffset:t._pathPos+t.tickOffset,r=t.orientation==AS?-t.tickSize:t.tickSize;if(!!(t.isFlipped()||t.elements[0].type===Pw.Area&&"top"===t.elements[0].baseline))for(let[i,s]of t._ticks.children.entries())s.vertices=[[e,n.top+t.scale.map(t._tickValues[i])],[e+r,n.top+t.scale.map(t._tickValues[i])]];else for(let[i,s]of t._ticks.children.entries()){let o=n.bottom-t.scale.map(t._tickValues[i]);s.vertices=[[e,o],[e+r,o]]}}else if("radialDistance"===e){let e=t.orientation==ES?t._pathPos+t.tickOffset:t._pathPos-t.tickOffset,n=t.orientation==ES?t.tickSize:-t.tickSize,r=t.elements[0].parent;for(let[i,s]of t._ticks.children.entries())s.vertices=[[r.x+t.scale.map(t._tickValues[i]),e],[r.x+t.scale.map(t._tickValues[i]),e+n]]}}}class gT extends qE{constructor(t){super(t)}run(){super.run();let t=this.inputVars.find(t=>t instanceof dA&&t.property==gA.AXIS_PATH_POSITION).element;t instanceof SS?this._runForEncoding(t):t instanceof tT&&this._runForLayout(t);for(let e of t._labels.children)e._updateBounds();BE(t._labels)}_runForLayout(t){let e=t.channel;if("x"==e){let e=t.orientation==ES?t.labelOffset:-t.labelOffset,n=t.orientation==ES?[zE.CENTER,zE.TOP]:[zE.CENTER,zE.BOTTOM];for(let[r,i]of t._labels.children.entries()){let s=t.elements[r].bounds;i.x=s[t.tickAnchor],i._y=t._pathPos+e,i._anchor=n,t._labelRotation&&(i._rotate=[t._labelRotation,i.x,i.y],i._anchor=[zE.RIGHT,zE.MIDDLE])}}else if("y"===e){let e=t.orientation==AS?-t.labelOffset:t.labelOffset,n=t.orientation==AS?[zE.RIGHT,zE.MIDDLE]:[zE.LEFT,zE.MIDDLE];for(let[r,i]of t._labels.children.entries()){let s=t.elements[r].bounds;i.x=t._pathPos+e,i._y=t.tickAnchor==zE.MIDDLE?s.y:s[t.tickAnchor],i._anchor=n,t._labelRotation&&(i._rotate=[t._labelRotation,i.x,i.y],i._anchor=[zE.RIGHT,n[1]])}}else if("angle"===e){let e=t.elements[0].parent.layout;if(e.type===HE.CLUSTER){let n=e._d3Root.leaves();const r=new Map(n.map(t=>[t.data[xE],[t.x,t.y]]));let i=5;for(let[n,s]of t._labels.children.entries()){let o=t.elements[n].datum[xE];if(r.get(o)[0]<Math.PI){let a=nS(r.get(o)[0])-90;s._anchor=[zE.LEFT,zE.MIDDLE],s.x=e.x+r.get(o)[1]+t.elements[n].bounds.width/2+i,s._y=e.y,s._rotate=[a,e.x,e.y]}else{let a=nS(r.get(o)[0])+90;s._anchor=[zE.RIGHT,zE.MIDDLE],s.x=e.x-r.get(o)[1]-t.elements[n].bounds.width/2-i,s._y=e.y,s._rotate=[a,e.x,e.y]}}}}}_runForEncoding(t){let e=t.channel,n=DE(t.elements);if("x"==e){let e=t.orientation==ES?t.labelOffset:-t.labelOffset,n=t.orientation==ES?[zE.CENTER,zE.TOP]:[zE.CENTER,zE.BOTTOM];for(let[r,i]of t._labels.children.entries())i.x=t.scale.map(t.labelValues[r]),i._y=t._pathPos+e,i._anchor=n,t._labelRotation&&(i._rotate=[t._labelRotation,i.x,i.y],i._anchor=[zE.RIGHT,n[1]])}else if("width"===e){let e=t.orientation==ES?t.labelOffset:-t.labelOffset,r=t.orientation==ES?[zE.CENTER,zE.TOP]:[zE.CENTER,zE.BOTTOM],i=!!(t.isFlipped()||t.elements[0].type===Pw.Area&&"right"===t.elements[0].baseline);for(let[s,o]of t._labels.children.entries())o.x=i?n.left+t.scale.rangeExtent-t.scale.map(t.labelValues[s]):t.scale.map(t.labelValues[s])+n.left,o._y=t._pathPos+e,o._anchor=r,t._labelRotation&&(o._rotate=[t._labelRotation,o.x,o.y],o._anchor=[zE.RIGHT,r[1]])}else if("y"===e){let e=t.orientation==AS?-t.labelOffset:t.labelOffset,n=t.orientation==AS?[zE.RIGHT,zE.MIDDLE]:[zE.LEFT,zE.MIDDLE];for(let[r,i]of t._labels.children.entries())i.x=t._pathPos+e,i._y=t.scale.map(t.labelValues[r]),i._anchor=n,t._labelRotation&&(i._rotate=[t._labelRotation,i.x,i.y],i._anchor=[zE.RIGHT,n[1]])}else if("height"===e){let e=t.orientation==AS?-t.labelOffset:t.labelOffset,r=t.orientation==AS?[zE.RIGHT,zE.MIDDLE]:[zE.LEFT,zE.MIDDLE],i=t.elements[0].type===Pw.Area&&"top"===t.elements[0].baseline;for(let[s,o]of t._labels.children.entries())o.x=t._pathPos+e,o._y=i?n.top+t.scale.map(t.labelValues[s]):n.bottom-t.scale.map(t.labelValues[s]),o._anchor=r,t._labelRotation&&(o._rotate=[t._labelRotation,o.x,o.y],o._anchor=[zE.RIGHT,r[1]])}else if("radialDistance"==e){let e=t.orientation==ES?t.labelOffset:-t.labelOffset,n=t.orientation==ES?[zE.CENTER,zE.TOP]:[zE.CENTER,zE.BOTTOM],r=t.elements[0].parent;for(let[i,s]of t._labels.children.entries())s.x=r.x+t.scale.map(t.labelValues[i]),s._y=t._pathPos+e,s._anchor=n,t._labelRotation&&(s._rotate=[t._labelRotation,s.x,s.y],s._anchor=[zE.RIGHT,n[1]])}}}function yT(t,e){let n=t.getElements(e);return n&&"vertexIndices"===n.type?n.groups[0].parent:n[0]}class mT extends qE{constructor(t){super(t)}run(){super.run();let t=this._outputVars[0].element,e=JE(t.parent);for(let t of e){let e=t.layout;if(!e)return;let n=e._includeInvisible?t.children:t.children.filter(t=>"hidden"!==t.visibility);this.fillGrid(t,e,n),this.computeCellBounds(t,e,n),this.placeElements(t,e,n)}let n=cA(t,!0);for(let t of n)BE(t)}placeElements(t,e,n){let r=LS(t,"x"),i=LS(t,"y");for(let n=0;n<t.children.length;n++){let r=t.children[n],i=e.cellBounds[n];if(!i)continue;let s=0,o=0;switch(e._cellHorzAlignment){case zE.LEFT:s=i.left-r.refBounds.left;break;case zE.CENTER:s=i.x-r.refBounds.x;break;case zE.RIGHT:s=i.right-r.refBounds.right}switch(e._cellVertAlignment){case zE.TOP:o=i.top-r.refBounds.top;break;case zE.MIDDLE:o=i.y-r.refBounds.y;break;case zE.BOTTOM:o=i.bottom-r.refBounds.bottom}GS(r,s,o)}if(r.length>0)for(let t of r)for(let n of t.scales){let r=yT(t,n),i=e.getIndex(r);if(i<0||!e.cellBounds[i])continue;let s="point"===n.type?e.cellBounds[i].left+r.bounds.width/2:e.cellBounds[i].left,o=s+n.rangeExtent;n.range=n.range[0]<n.range[1]?[s,o]:[o,s]}if(i.length>0)for(let t of i)for(let n of t.scales){let r=yT(t,n),i=e.getIndex(r);if(i<0||!e.cellBounds[i])continue;let s="point"===n.type?e.cellBounds[i].top+r.bounds.height/2:e.cellBounds[i].top,o=s+n.rangeExtent;n.range=n.range[0]<n.range[1]?[s,o]:[o,s]}}fillGrid(t,e,n){let r=n.length,i=e._numCols?e._numCols:e._numRows?Math.ceil(r/e._numRows):1,s=e._numRows?e._numRows:Math.ceil(r/i);e._grid=new Array(s).fill(null).map(()=>new Array(i).fill(null));for(let o=0;o<r;o++){let r,a;switch(e._direction){case VA.RowFirst:r=Math.floor(o/i),a=o%i;break;case VA.ColumnFirst:r=o%s,a=Math.floor(o/s);break;default:throw new Error("Invalid fill direction. Use 'row_first' or 'column_first'.")}e._start.toLowerCase().includes("bottom")&&(r=s-1-r),e._start.toLowerCase().includes("right")&&(a=i-1-a);let l=t.children.indexOf(n[o]);e._grid[r][a]=l}}computeCellBounds(t,e,n){let r=n.map(t=>t.refBounds?t.refBounds:t.bounds),i=e._colGap,s=e._rowGap;if(void 0===e._left){let t=r.map(t=>t.left),n=r.map(t=>t.top);e._left=d3.min(t),e._top=d3.min(n)}let o=r.map(t=>t.width),a=r.map(t=>t.height),l=d3.max(o),c=d3.max(a);e._cellBounds=new Array(t.children.length).fill(null);let u=e._grid.length,h=u>0&&e._grid[0]?e._grid[0].length:0;for(let n=0;n<u;n++)for(let r=0;r<h;r++){let o=e._grid[n][r];null==o||o>=t.children.length||(e._cellBounds[o]=new PE(e._left+(l+i)*r+0,e._top+(c+s)*n,l,c))}}}function bT(t,e,n,r){return[n*Math.cos(eS(r))+t,e-n*Math.sin(eS(r))]}function vT(t,e,n){switch(e){case"x":wT(t,n);break;case"y":ET(t,n);break;case"width":!function(t,e){t.resize(e,t.height)}(t,n);break;case"height":!function(t,e){t.resize(t.width,e)}(t,n);break;case"radius":t.radius=n;break;case"strength":t._strength=n;break;case"area":t.type===Pw.Circle?t.radius=Math.sqrt(n/Math.PI):t.type===Pw.Rect&&t.resize(Math.sqrt(n),Math.sqrt(n)),t._updateBounds();break;case"text":t._text=n;break;case"curveMode":t.curveMode=n;break;case"baseline":t.baseline=n;break;case"angle":[Pw.Arc,Pw.Pie].includes(t.type)&&function(t,e){t._endAngle=rS(t._startAngle+e),t._sr=eS(t._startAngle),t._er=eS(t._endAngle),t.vertices[0].x=t._x+t._innerRadius*Math.cos(t._sr),t.vertices[0].y=t._y-t._innerRadius*Math.sin(t._sr),t.vertices[1].x=t._x+t._outerRadius*Math.cos(t._sr),t.vertices[1].y=t._y-t._outerRadius*Math.sin(t._sr),t.vertices[2].x=t._x+t._outerRadius*Math.cos(t._er),t.vertices[2].y=t._y-t._outerRadius*Math.sin(t._er),t.vertices[3].x=t._x+t._innerRadius*Math.cos(t._er),t.vertices[3].y=t._y-t._innerRadius*Math.sin(t._er)}(t,n);break;case"startAngle":!function(t,e){let n=t.angle;t._startAngle=e,t._endAngle=rS(t._startAngle+n),t._sr=eS(t._startAngle),t._er=eS(t._endAngle),t.vertices[0].x=t._x+t._innerRadius*Math.cos(t._sr),t.vertices[0].y=t._y-t._innerRadius*Math.sin(t._sr),t.vertices[1].x=t._x+t._outerRadius*Math.cos(t._sr),t.vertices[1].y=t._y-t._outerRadius*Math.sin(t._sr),t.vertices[2].x=t._x+t._outerRadius*Math.cos(t._er),t.vertices[2].y=t._y-t._outerRadius*Math.sin(t._er),t.vertices[3].x=t._x+t._innerRadius*Math.cos(t._er),t.vertices[3].y=t._y-t._innerRadius*Math.sin(t._er)}(t,n);break;case"thickness":!function(t,e){xT(t,t._innerRadius+e)}(t,n);break;case"innerRadius":!function(t,e){t._innerRadius=e,t.vertices[0].x=t._x+t._innerRadius*Math.cos(t._sr),t.vertices[0].y=t._y-t._innerRadius*Math.sin(t._sr),t.vertices[3].x=t._x+t._innerRadius*Math.cos(t._er),t.vertices[3].y=t._y-t._innerRadius*Math.sin(t._er)}(t,n);break;case"outerRadius":xT(t,n);break;case"radialDistance":{let e=bT(t.parent.x,t.parent.y,n,t.polarAngle);wT(t,e[0]),ET(t,e[1]);break}case"visibility":t.visibility=n;break;case"src":t.src=n;break;case"vxOpacity":if(t instanceof PA)for(let r of t.children)vT(r,e,n);else t.vxOpacity=n;break;default:if("vertex"===t.type)t[e]=n;else if(t instanceof PA)for(let r of t.children)vT(r,e,n);else{if(t.styles[e]==n)return;t.styles[e]=n}}"vertex"===t.type?t.parent._dirty=!0:t._dirty=!0}function xT(t,e){t._outerRadius=e,t.vertices[1].x=t._x+t._outerRadius*Math.cos(t._sr),t.vertices[1].y=t._y-t._outerRadius*Math.sin(t._sr),t.vertices[2].x=t._x+t._outerRadius*Math.cos(t._er),t.vertices[2].y=t._y-t._outerRadius*Math.sin(t._er)}function wT(t,e){"vertex"==t.type?t.x=e:GS(t,e-t.x,0)}function ET(t,e){"vertex"==t.type?t.y=e:GS(t,0,e-t.y)}class AT extends XE{constructor(t,e){super(t),this._result=e.evalResult,this._condEnc=e}get result(){return this._condEnc.evalResult}clearResult(){this._condEnc.evalResult={}}get conditionalEncoding(){return this._condEnc}}class ST extends qE{constructor(t){super(t)}storeValues(t,e){this._storedValues={};let n=JE(t);for(let t of n)this._storedValues[t.id]=t[e]}_restoreValue(t,e){let n=this._storedValues[t.id];t.styles?t.styles[e]!==n&&(t._dirty=!0,t.styles[e]=n):t[e]!==n&&(t._dirty=!0,t[e]=n)}run(){super.run();let t=this.inputVars.find(t=>t instanceof uT),e=this.outputVar,n=t?t.getEncoding(e.channel,e.element):null,r=e.channel,i=this.inputVars.filter(t=>t instanceof AT),s=i.length>0?i.map(t=>t.conditionalEncoding):[],o=s.length>0?s[0].eventContext:null,a=["x","y","width","height","radius"].includes(e.channel);if(t&&"vertex"===e.element.type)return this._runVertexIndexEncoding(n,r),void BE(e.element.parent);let l=JE(e.element),c=l[0].scene;for(let e of l){if(t){let t=n.getScale(e);this._doMapping(e,t,n.attrValues,n),a&&this._updateRefBounds(e,t,n)}else this._restoreValue(e,r);if(i.length>0){let t=s.map(t=>t.evalResult[e.id]).every(t=>t||void 0===t);s[0].stylingFunction(t,o,c.state,e)}}if(a){BE(["vertex","segment"].includes(e.element.type)?e.element.parent:e.element)}}_runVertexIndexEncoding(t,e){for(let n=0;n<t.scales.length;n++){let r=t.scales[n],i=t.getElements(r),s=[];for(let n of i.groups){n.parent._vertices;for(let i of n.indices){let s=tA(n.parent,i),o=t.attrValues[s],a="text"===e?o:r.map(o);this._setVertexIndexChannel(n.parent,i,e,a)}n.parent._dirty=!0,"x"!==e&&"y"!==e||s.includes(n.parent)||(this._updateVertexParentRefBounds(n.parent,e,r,t),s.push(n.parent))}}}_setVertexIndexChannel(t,e,n,r){let i=t._vertices;switch(n){case"x":i._xs[e]=r;break;case"y":i._ys[e]=r;break;case"radialDistance":{let n=i._polarAngles[e]*Math.PI/180;i._xs[e]=t.x+r*Math.cos(n),i._ys[e]=t.y-r*Math.sin(n);break}default:i.setProperty(e,n,r)}}_updateVertexParentRefBounds(t,e,n,r){let i=t.refBounds;"x"===e?t._refBounds=new PE(r.flipScale?n.range[1]:n.range[0],i.top,n.rangeExtent,i.height):"y"===e&&(t._refBounds=new PE(i.left,r.flipScale?n.range[0]:n.range[1],i.width,n.rangeExtent))}_updateRefBounds(t,e,n){switch(this.outputVar.channel){case"width":t._refBounds.setWidth(e.rangeExtent);break;case"height":t._refBounds.setHeight(e.rangeExtent);break;case"radius":t._refBounds.setWidth(2*e.rangeExtent,zE.CENTER),t._refBounds.setHeight(2*e.rangeExtent,zE.MIDDLE);break;case"x":if("vertex"==t.type||"segment"==t.type){let r=t.parent._refBounds;t.parent._refBounds=new PE(n.flipScale?e.range[1]:e.range[0],r.top,e.rangeExtent,r.height)}else if(t._refBounds)if("band"===e.type){let r=e.map(n.attrValues[t.id]),i=t._refBounds;t._refBounds=new PE(r-t.width/2,i.top,t.width,i.height)}else{let r=t.parent;for(;r&&(!r.layout||r.layout.type!==HE.GRID);)r=r.parent;if(r){let r=t._refBounds;t._refBounds=new PE(n.flipScale?e.range[1]:e.range[0],r.top,e.rangeExtent,r.height)}}break;case"y":if("vertex"==t.type||"segment"==t.type){let r=t.parent._refBounds;t.parent._refBounds=new PE(r.left,n.flipScale?e.range[0]:e.range[1],r.width,e.rangeExtent)}else if(t._refBounds){let r=t.parent;for(;r&&(!r.layout||r.layout.type!==HE.GRID);)r=r.parent;if(r){let r=t._refBounds,i=et(e.range);t._refBounds=new PE(r.left,n.flipScale?e.range[0]:i,r.width,e.rangeExtent)}}}}_doMapping(t,e,n,r){switch(this.outputVar.channel){case"width":e.domain[0]<0&&t instanceof _S?function(t,e,n){let r=t.refBounds.left+e.map(0),i=t.refBounds.left+e.map(n[t.id]);GS(t.leftSegment,r-t.leftSegment.x,0),GS(t.rightSegment,i-t.rightSegment.x,0)}(t,e,n):e.domain[0]<0&&t instanceof sS||(t.type===Pw.Area?function(t,e,n){let r=t.baseline;if(t.orientation===FA){let i=t._vertices.length/2;switch(r){case"left":YS(t,i,t._vertices.length,t.refBounds.left),HS(t,0,i,r=>t.refBounds.left+e.map(n[tA(t,r)]));break;case"right":HS(t,i,t._vertices.length,r=>t.refBounds.right-e.map(n[tA(t,r)])),YS(t,0,i,t.refBounds.right);break;case"center":console.log("center"),HS(t,i,t._vertices.length,r=>t.refBounds.center-e.map(n[tA(t,r)])/2),HS(t,0,i,r=>t.refBounds.center+e.map(n[tA(t,r)])/2)}}}(t,e,n):this._doStandardMapping(t,e,n));break;case"height":e.domain[0]<0&&t instanceof _S?function(t,e,n){let r=t.refBounds.bottom-e.map(0),i=t.refBounds.bottom-e.map(n[t.id]);GS(t.bottomSegment,0,r-t.bottomSegment.y),GS(t.topSegment,0,i-t.topSegment.y)}(t,e,n):e.domain[0]<0&&t instanceof sS?function(t,e,n){let r=t._vertices.length/2;qS(t,0,r,r=>t.refBounds.bottom-e.map(n[tA(t,r)])),WS(t,r,t._vertices.length,t.refBounds.bottom-e.map(0))}(t,e,n):t.type===Pw.Area?function(t,e,n){let r=t.baseline;if(t.orientation===zA){let i=t._vertices.length/2;switch(r){case"top":qS(t,i,t._vertices.length,r=>t.refBounds.top+e.map(n[tA(t,r)])),WS(t,0,i,t.refBounds.top);break;case"middle":qS(t,0,i,r=>t.refBounds.middle-e.map(n[tA(t,r)])/2),qS(t,i,t._vertices.length,r=>t.refBounds.middle+e.map(n[tA(t,r)])/2);break;default:qS(t,0,i,r=>t.refBounds.bottom-e.map(n[tA(t,r)])),WS(t,i,t._vertices.length,t.refBounds.bottom)}}}(t,e,n):this._doStandardMapping(t,e,n);break;case"text":this._doTextMapping(t,n);break;case"fillGradient":!function(t,e,n,r){let i=t._vertices._ids.map((e,r)=>n[tA(t,r)]),s=d3.min(i),o=d3.max(i),a="horizontal"===t.orientation?new mS({x1:0,y1:100,x2:0,y2:0}):new mS({x1:0,y1:0,x2:100,y2:0});if(a.addStop(0,e.map(s),1),r._mapping){let t=Object.keys(r._mapping).map(t=>parseFloat(t)).sort();for(let n of t)n>s&&n<o&&a.addStop(100*(n-s)/(o-s),e.map(n),1)}else"divergingColor"===e.type&&a.addStop(100*-s/(o-s),e.map(0),1);"sequentialColor"===e.type&&a.addStop(100*-s/(o-s),e.map(0),1),a.addStop(100,e.map(o),1),t.fillColor=a}(t,e,n,r);break;default:this._doStandardMapping(t,e,n)}}_doTextMapping(t,e){vT(t,this.outputVar.channel,e[t.id])}_doStandardMapping(t,e,n){let r=this.outputVar.channel,i=e.map(n[t.id]);vT(t,r,i),t instanceof XA&&t.firstVertex&&t.firstVertex.shape&&"strokeColor"===r&&t.vertices.forEach(t=>t.fillColor=i)}_doCondEncoding(t,e){let n=t[0].scene;for(let r of t){let t=e.map(t=>t.evalResult[r.id]).every(t=>t||void 0===t),i=e[0].eventContext;e[0].stylingFunction(t,i,r,n)}}_updateElement(t,e,n,r){let i;"object"==typeof r&&t.triggerElement?"property"in r?i=t.triggerElement[r.property]:"attribute"in r&&(i=t.triggerElement.datum[r.attribute]):i=r,["x","y"].includes(n)&&"offset"in r&&(i+=r.offset),vT(e,n,i)}}class TT extends qE{constructor(t){super(t)}run(){let t=this.outputVar.element;t.updateValues(),t.scale?this._runForEncoding(t):this._runForLayout(t),BE(t)}_runForLayout(t){let e=t.channel,n=DE(t.elements),r=[];if("x"===e)for(let e=0;e<t.values.length;e++){let i=t.elements[e].refBounds;r.push({x1:i.x,y1:n.bottom,x2:i.x,y2:n.top})}else if("y"===e)for(let e=0;e<t.values.length;e++){let i=t.elements[e].refBounds;r.push({x1:n.left,y1:i.y,x2:n.right,y2:i.y})}t.lines=r,t._dirty=!0}_runForEncoding(t){let e=t.channel,n=DE(t.elements),r=[];if("x"===e){let e,i,s=IS(t.elements[0],"y");s?(e=Math.min(...s.getScale(t.elements[0]).range,n.top),i=Math.max(...s.getScale(t.elements[0]).range,n.bottom)):(e=n.top,i=n.bottom);for(let n of t.values)r.push({x1:t.scale.map(n),y1:i,x2:t.scale.map(n),y2:e})}else if("width"===e)for(let e of t.values)r.push({x1:t.scale.map(e)+n.left,y1:n.bottom,x2:t.scale.map(e)+n.left,y2:n.top});else if("y"===e){let e,i,s=IS(t.elements[0],"x");s?(e=Math.min(...s.getScale(t.elements[0]).range,n.left),i=Math.max(...s.getScale(t.elements[0]).range,n.right)):(e=n.left,i=n.right);for(let n of t.values)r.push({x1:e,y1:t.scale.map(n),x2:i,y2:t.scale.map(n)})}else if("height"===e)for(let e of t.values)r.push({x1:n.left,y1:n.bottom-t.scale.map(e),x2:n.right,y2:n.bottom-t.scale.map(e)});else if("radialDistance"===e){let e=t.elements[0].parent;for(let n=0;n<t.values.length;n++)r.push({x:e.x,y:e.y,r:t.scale.map(t.values[n])})}t.lines=r,t._dirty=!0}}class CT extends qE{constructor(t){super(t)}run(){super.run();let t=this._outputVars[0].element,e=cA(t)[0],n=JE(t.parent);for(let t of n){let n=t.layout;if(!n)return;switch(e.type){case Pw.Rect:case Pw.Circle:case Pw.Image:this._stackRects(t,n);break;case Pw.Area:t.children[0].orientation===zA?this._stackAreasVert(t,n):this._stackAreasHorz(t,n);break;case Pw.Arc:case Pw.Pie:e.parent.classId===t.classId&&this._stackArcs(t,n)}}BE(e)}_stackArcs(t,e){if(e.orientation===GA){let e=90;if((this._direction?this._direction:YA.Clockwise)===YA.Clockwise)for(let n of t.children){let t=rS(e-n.angle);vT(n,"startAngle",t),e=t}else for(let n of t.children){let t=rS(e+n.angle);vT(n,"startAngle",t),e=t}}else if(e.orientation===jA){let e=d3.min(t.children.map(t=>t.innerRadius));for(let n of t.children){let t=n.outerRadius-n.innerRadius;vT(n,"innerRadius",e),vT(n,"outerRadius",e+t),e=n._outerRadius}}}_stackAreasVert(t,e){let n=t.children.filter(t=>"visible"===t.visibility),r=t.bounds,i=e.vertCellAlignment===zE.TOP?r.top:r.bottom,s=e.vertCellAlignment===zE.TOP?1:-1;if(0===n.length)return;e.vertCellAlignment===zE.BOTTOM&&n.reverse();let o=n[0].vertices.length/2,a=new Array(o).fill(0);for(let t of n){for(let e=0;e<o;e++){let n=t.vertices[e],r=t.vertices[2*o-e-1],l=Math.abs(n.y-r.y),c=i+a[e]*s,u=i+(a[e]+l)*s;GS(n,0,c-n.y),GS(r,0,u-r.y),a[e]+=l}let e=t.bounds.bottom;t._updateBounds(),t._refBounds.translate(0,t.bounds.bottom-e)}if(e.vertCellAlignment===zE.MIDDLE)for(let t of n){for(let e=0;e<o;e++){let n=t.vertices[e],i=t.vertices[2*o-e-1],s=r.middle+a[e]/2;GS(n,0,s-r.bottom),GS(i,0,s-r.bottom)}let e=t.bounds.bottom;t._updateBounds(),t._refBounds.translate(0,t.bounds.bottom-e)}}_stackAreasHorz(t,e){}_stackRects(t,e){t.scene;let n=e._orientation,r=t.children.map(t=>t.bounds),i=r.map(t=>t.left),s=r.map(t=>t.top),o=r.map(t=>t.width),a=r.map(t=>t.height),l=null==e._left?d3.min(i):e._left,c=null==e._top?d3.min(s):e._top,u=d3.max(o),h=d3.max(a);if(n==FA)for(let n=0;n<t.children.length;n++){let r=t.children[n],i=0,s=c+r.bounds.height/2-r.bounds.y;c+=r.bounds.height+e._gap,GS(r,i,s),r._updateBounds();let o=0,a=0;if(!VS(r))switch(e._horzCellAlignment){case zE.LEFT:o=l-r.bounds.left;break;case zE.CENTER:o=l+u/2-r.bounds.x;break;case zE.RIGHT:o=l+u-r.bounds.right}GS(r,o,a)}else for(let n=0;n<t.children.length;n++){let r=t.children[n],i=l+r.bounds.width/2-r.bounds.x,s=0;l+=r.bounds.width+e._gap,GS(r,i,s),r._updateBounds();let o=0,a=0;if(!DS(r))switch(e._vertCellAlignment){case zE.TOP:a=c-r.bounds.top;break;case zE.MIDDLE:a=c+h/2-r.bounds.y;break;case zE.BOTTOM:a=c+h-r.bounds.bottom}GS(r,o,a)}}}class kT extends qE{constructor(t){super(t)}run(){super.run()}}class RT extends qE{constructor(t){super(t)}run(){let t=this._binConfig.attribute,e=this._binConfig.startAttr,n=this._binConfig.endAttr,r=this._binConfig.binIdAttr,i=this.inputVars[0].dataset,s=this.outputVar.dataset,o=i.values(t),a=J();null!=this._binConfig?.numBins&&(a=a.thresholds(this._binConfig.numBins));let l=a(o);this._binConfig.actualNumBins=l.length;let c=String(l.length-1).length,u=t=>String(t).padStart(c,"0"),h=this._findBin,f=o.map(t=>h(t,l).x0),d=o.map(t=>h(t,l).x1),p=o.map(t=>{let e=l.indexOf(h(t,l));return u(e)}),_=l.map((t,e)=>u(e));s.addAttr(e,Vw.Number,f),s.addAttr(n,Vw.Number,d),s.addAttr(r,Vw.String,p),s.order(r,_)}_findBin(t,e){for(let n of e)if(n.indexOf(t)>=0)return n}}class MT extends XE{constructor(t,e){super(t),this._dataset=e}get dataset(){return this._dataset}}class OT extends qE{constructor(t){super(t)}run(){super.run();let t=this.inputVars.find(t=>t instanceof MT),e=this.outputVar.dataset;if(!t)return;let n=t.dataset,r=this._spec;if(!r.value)return void e.load(n.data.slice());let i=kE(r);e.load(n.data.filter(t=>i.testTuple(t)))}}function NT(t,e,n,r){let i=r.type(n);if(i!=Vw.String&&i!=Vw.Date&&i!=Vw.Integer)throw new Error("Repopulate only works on a string or date attribute: "+n+" is "+i);let s=JE(e);for(let t of s){let e=uE(t.dataScope?t.dataScope:cE(r),n,!0),i=t.children.length-e.length,s=e.length-t.children.length;for(let e=0;e<i;e++)t.removeChildAt(t.children.length-1);let o=t._children.length;for(let e=0;e<s;e++){let n=sT(t._children[e%o]);t.addChild(n)}t.children.forEach((t,n)=>t.dataScope=e[n])}}class IT extends qE{constructor(t){super(t),this._collection=null,this._area=null,this._repeatAttr=null}run(){if(super.run(),this._area&&this._repeatAttr){let t=this.inputVars[0];if(!t)return;let e=t.dataset;aA(this._area);return function(t,e,n,r){let i=r.type(n),s=cE(r),o=uE(s,n,i===Vw.Number);i!==Vw.Number&&i!==Vw.Date||o.sort((t,e)=>t.filters[n]>e.filters[n]?1:-1),1===o.length&&o.push(o[0]);let a=o.length,l=e.refBounds??e.bounds,{left:c,top:u,right:h,bottom:f}=l,d=h-c,p=f-u,_=e.orientation===FA,g=[];if(a>0){for(let t=0;t<a;t++)g.push(_?[h,u+t*p/(a-1)]:[c+t*d/(a-1),u]);for(let t=0;t<a;t++)g.push(_?[c,u+(a-1-t)*p/(a-1)]:[c+(a-1-t)*d/(a-1),f])}e.vertices=g;for(let t=0;t<e._vertices.length;t++){let n=t<a?o[t]:o[2*a-1-t];e._vertices.setDataScopeRef(t,n)}let y=e.classId??e.id,m=Math.floor(e._vertices.length/2);for(let t in e.scene._encodings)if(t===y)for(let n of Object.values(e.scene._encodings[t]))1===n._scales.length&&(n._elem2scale={[e.id]:n._scales[0]},n._elemGroups=[[e]]);else if(t.startsWith(y+"_v")){let n=t===y+"_v0",r=n?0:m,i=n?m:e._vertices.length,s=[];for(let t=r;t<i;t++)e._vertices.hasDataScope(t)&&s.push(t);let o=[{parent:e,indices:s}];for(let n of Object.values(e.scene._encodings[t]))if(1===n._scales.length){n._elem2scale={},n._elemGroups=[{type:"vertexIndices",groups:o}];for(let t of s)n._elem2scale[tA(e,t)]=n._scales[0]}}e.dataScope=s}(0,this._area,this._repeatAttr,e),void(this.needsFullRender=!0)}if(!this._collection||!this._repeatAttr)return;let t=this.inputVars[0];if(!t)return;let e=t.dataset,n=this._collection;aA(n);n.dataScope=void 0,NT(0,n,this._repeatAttr,e),n.dataScope=cE(e);for(let t of OS(n.children[0]))t.refreshElementMappings();if(n.layout)for(let t of n.layout.refElements)t instanceof tT&&(t._elems=n.children.slice());this.needsFullRender=!0}}class PT extends qE{constructor(t){super(t)}run(){super.run();let t=this.inputVars.find(t=>t.type===KE.AFFIXATION).affixation,e=t.base,n=t.element,r=JE(e),i=JE(n),s=t.channels,o=t.attribute;if(GE(n)&&GE(e)){let t=r.map(t=>t.datum[o]);i=i.filter(e=>t.includes(e.datum[o]));let e=(t,e)=>t.datum[o]<e.datum[o]?-1:t.datum[o]>e.datum[o]?1:0;i.sort(e),r.sort(e)}if(s.includes("x")||s.includes("y"))for(let e of s)this._handleXY(e,i,r,t.getElementAnchor(e),t.getBaseAnchor(e),t.getOffset(e));(s.includes("radialDistance")||s.includes("angle"))&&this._handlePolar(i,r,t);let a=cA(n,!0);for(let t of a)BE(t)}_handlePolar(t,e,n){let r=n.hasChannel("radialDistance")?n.getBaseAnchor("radialDistance"):zE.MIDDLE,i=n.hasChannel("radialDistance")?n.getElementAnchor("radialDistance"):zE.MIDDLE,s=n.hasChannel("angle")?n.getBaseAnchor("angle"):zE.CENTER;n.hasChannel("angle")?n.getElementAnchor("angle"):zE.CENTER;let o=n.hasChannel("radialDistance")?n.getOffset("radialDistance"):0,a=n.hasChannel("angle")?n.getOffset("angle"):0;if([Pw.Arc,Pw.Ring].indexOf(e[0].type)>=0&&t[0].type==Pw.SimpleText)for(let n=0;n<t.length;n++){let i=e[n],a=t[n],l=r===zE.MIDDLE?(i.outerRadius+i.innerRadius)/2:r===zE.TOP?i.outerRadius-5:i.innerRadius+5;if(l+=o,i.type===Pw.Arc){let t=bT(i.x,i.y,l,i.startAngle),e=bT(i.x,i.y,l,i.endAngle);i.endAngle>=180&&i.endAngle<=360?a._textPath=["M",t[0],t[1],"A",l,l,i.angle,i.angle>=180?1:0,0,e[0],e[1]].join(" "):a._textPath=["M",e[0],e[1],"A",l,l,i.angle,i.angle>=180?1:0,1,t[0],t[1]].join(" ")}else if(i.type===Pw.Ring){let t=275,e=265,n=350,r=bT(i.x,i.y,l,t),s=bT(i.x,i.y,l,e);a._textPath=["M",s[0],s[1],"A",l,l,n,1,1,r[0],r[1]].join(" ")}a.textPathOffset=s===zE.LEFT?"0%":"50%"}else for(let n=0;n<t.length;n++){let l,c,u=e[n],h=t[n];u.type==Pw.Arc||u.type==Pw.Ring?(c="left"==s?u.endAngle+a:"center"==s?u.startAngle+u.angle/2+a:u.startAngle+a,l="top"==r?u.outerRadius+o:"bottom"==r?u.innerRadius+o:(u.outerRadius+u.innerRadius)/2+o):u.type==Pw.Circle&&(c=90,l="top"==r?u.radius+o:"bottom"==r?o:u.radius/2+o),GS(h,u.x-h.x,u.y-l-h.bounds[i]),h._rotate=[90-c,u.x,u.y]}}_handleXY(t,e,n,r,i,s){for(let o=0;o<e.length;o++){let a,l=n[o],c=e[o];if(ZA(l)){a=KA(l,[zE.LEFT,zE.TOP].includes(i)?0:[zE.CENTER,zE.MIDDLE].includes(i)?.5:1)[t]}else a=l.bounds[i]+s;e[0].type===Pw.SimpleText?(c.anchor["x"==t?0:1]=r,vT(c,t,a)):"x"==t?GS(c,a-c.bounds[r],0):GS(c,0,a-c.bounds[r])}}}class LT extends XE{constructor(t,e){super(t),this._affx=e}get affixation(){return this._affx}}class DT extends qE{constructor(t){super(t)}run(){let t=this.inputVars[0],e=this.outputVar,n=t.attribute,r=e.attribute,i=t.dataset,s=e.dataset,o=this.args,a=null!=o.min?o.min:i.summary(n).min,l=null!=o.max?o.max:i.summary(n).max,c=a,u=[];for(;c<l;)u.push(c),c+=o.interval;u.push(c);let h={},f={};if(o.groupBy)for(let t of i.data){let e=o.groupBy.map(e=>t[e]).join("-");e in h||(h[e]=[],f[e]=o.groupBy.map(e=>t[e])),h[e].push(t[n])}else h[""]=i.data.map(t=>t[n]),f[""]="";let d=[];for(let t in f){let e=VT(BT(o.bandwidth),u,h[t]);for(let i of e){let e={};""!==t&&o.groupBy.forEach((n,r)=>e[n]=f[t][r]),e[n]=i[0],e[r]=i[1],d.push(e)}}let p={};if(p[n]=i.type(n),p[r]=Vw.Number,o.groupBy)for(let t of o.groupBy)p[t]=i.type(t);s.initialize(d,s.url,p)}}function VT(t,e,n){return e.map(e=>[e,ct(n,n=>t(e-n))])}function BT(t){return e=>Math.abs(e/=t)<=1?.75*(1-e*e)/t:0}class zT extends qE{constructor(t){super(t)}run(){super.run();let t=this.inputVars.find(t=>t instanceof MT);if(!t)return;let e=t.dataset,n=this.outputVar.dataset;this._spec.fn(e,n,this._spec)}}class FT extends qE{constructor(t){super(t)}run(){super.run();let t=this._outputVars[0].element,e=JE(t.parent);for(let t of e){let e=t.layout;if(!e)return;let n=t.children.map(t=>({name:t.id,radius:t.radius,itm:t})),r=n.reduce((t,e)=>t+Math.pow(e.radius,2),0),i=Math.sqrt(r);void 0===e._width&&(e._width=i),void 0===e._height&&(e._height=i);let s=Od({name:"root",children:n}).sum(t=>t.radius?t.radius:0).sort((t,e)=>e.value-t.value);rp().size([e._width,e._height]).radius(t=>t.value)(s);for(let t of s.children){let n=t.data.itm;GS(n,e._x-s.x+t.x-n.x,e._y-s.y+t.y-n.y)}}let n=cA(t,!0);for(let t of n)BE(t)}}class GT extends qE{constructor(t){super(t)}run(){super.run();let t=this.inputVars.find(t=>t instanceof dA&&t.property==gA.AXIS_PATH_POSITION).element;t instanceof SS?this._runForEncoding(t):t instanceof tT&&this._runForLayout(t),BE(t._title)}_runForEncoding(t){let e=t.channel,n=DE(t.elements);if("x"==e)t._title.x=(t.scale.range[0]+t.scale.range[1])/2,t._title._y=t.orientation==ES?t._pathPos+t.titleOffset:t._pathPos-t.titleOffset;else if("width"==e)t._title.x=n.left+t.scale.rangeExtent/2,t._title._y=t.orientation==ES?t._pathPos+t.titleOffset:t._pathPos-t.titleOffset;else if("y"===e)t._rotateYTitle?(t._title.x=t.orientation==AS?t._pathPos-t.titleOffset:t._pathPos+t.titleOffset,t._title._y=(t.scale.range[0]+t.scale.range[1])/2,t._title._rotate=t.orientation==AS?[-90,t._title._x,t._title._y]:[90,t._title._x,t._title._y]):(t._title.x=t.orientation==AS?t._pathPos-t.titleOffset:t._pathPos+t.titleOffset,t._title._y=d3.min([t.scale.range[0],t.scale.range[1]])-25,t._title._rotate=void 0);else if("height"===e)t._title.x=n.center,t._title._y=(n.top+n.bottom)/2-n.width/2-t.titleOffset,t._title._rotate=t.orientation==AS?[-90,n.center,n.middle]:[90,n.center,n.middle];else if("radialDistance"===e){let e=t.elements[0].parent;t._title.x=e.x+t.scale.rangeExtent/2,t._title._y=t.orientation==ES?t._pathPos+t.titleOffset:t._pathPos-t.titleOffset,t._rotate&&(t._title._rotate=t._rotate.slice())}}_runForLayout(t){let e=t.channel,n=t.elements[0].parent.layout&&t.elements[0].parent.layout.type==HE.STACK?VE(t.elements):DE(t.elements);if("x"==e)t._title.x=n.center,t._title._y=t.orientation==ES?t._pathPos+t.titleOffset:t._pathPos-t.titleOffset;else if("y"===e)t._title.x=n.center,t._title._y=n.middle-n.width/2-t.titleOffset,t._title._rotate=t.orientation==AS?[-90,n.center,n.middle]:[90,n.center,n.middle];else if("angle"===e){let e=t.elements[0].parent.layout;e.type===HE.CLUSTER&&(t._title.x=e.x,t._title._y=e.y)}}}class jT extends lT{constructor(t){super(t)}run(){super.run();let t,e=this.vars.find(t=>t.type===KE.ALIGNMENT).alignment,n=e.anchor,r=e.elements;n==zE.Top||n==zE.LEFT?t=et(r.map(t=>t.bounds[n])):n==zE.BOTTOM||n==zE.RIGHT?t=Q(r.map(t=>t.bounds[n])):n!=zE.CENTER&&n!=zE.MIDDLE||(t=ct(r.map(t=>t.bounds[n])));for(let i of r){let r=FS(i,e.channel);if(r){let s=t-i.bounds[n];GS(r,"x"===e.channel?s:0,"x"===e.channel?0:s)}}for(let t of r)BE(t)}}class UT extends XE{constructor(t,e){super(t),this._aln=e}get alignment(){return this._aln}}class YT extends qE{constructor(t){super(t)}run(){super.run();let t=this._outputVars[0].element,e=JE(t.parent);for(let t of e){let e=t.layout;if(!e)continue;let n=bE(t.children[0]);if(!n)continue;let r=n.linkList.map(t=>({source:n.getNode(t.source),target:n.getNode(t.target)})),i=Ol(n.nodeList).force("charge",Nl().strength(-e._repulsion)).force("link",Tl(r).id(t=>t.id).distance(e._linkDistance)).force("x",Il()).force("y",Pl()).force("center",hl(e._x,e._y).strength(e._attraction));i.stop(),i.tick(e._iterations);for(let e=0;e<t.children.length;e++){let r=t.children[e],i=n.nodeList[e];GS(r,i.x-r.x,i.y-r.y)}}let n=cA(t,!0);for(let t of n)BE(t)}}class HT extends qE{constructor(t){super(t)}run(){super.run();let t=this._outputVars[0].element,e=JE(t);switch(t.type){case Pw.Arc:this._updateArcLinks(e);break;case Pw.BezierCurve:this._updateBezierLinks(e);break;case Pw.BundledPath:this._updateBundledLinks(e);break;case Pw.Chord:this._updateChordLinks(e);break;case Pw.Line:default:this._updateLineLinks(e)}BE(t)}_updateArcLinks(t){for(let e of t){let t=e.source.x<e.target.x?e.source:e.target,n=e.source.x<e.target.x?e.target:e.source;e._x=(t.x+n.x)/2,e._y=(t.y+n.y)/2,e._innerRadius=Math.sqrt(Math.pow(t.x-n.x,2)+Math.pow(t.y-n.y,2))/2,e._outerRadius=e._innerRadius+e._thickness;let r=iS(t.x,t.y,e._x,e._y),i=iS(n.x,n.y,e._x,e._y);e.direction===YA.CLOCKWISE&&([r,i]=[i,r]),vT(e,"startAngle",r),vT(e,"angle",Math.abs(i-r))}}_updateBezierLinks(t){let e=this._inputVars[0].element,n=JE(e),r=e.parent.layout;r.type===HE.DIRECTED||r.type===HE.TIDYTREE?this._updateBezierLinksForDirectedGraph(n,t,r):r.type===HE.CLUSTER&&this._updateBezierLinksForClusteredGraph(n,t,r)}_updateBezierLinksForClusteredGraph(t,e,n){const r=n._d3Root.descendants(),i=new Map(r.map(t=>[WT(t),t])),s=new Map(r.map(t=>[t.data[xE],WT(t)]));if(n.isRadial()){const t=nx().angle(t=>t.x).radius(t=>t.y);for(let r of e){let e=r.source,o=r.target,a=e.datum[xE],l=o.datum[xE],c=i.get(s.get(a)),u=i.get(s.get(l));r._d=QA(t({source:c,target:u}),n.x,n.y)}}else if(n.orientation===FA){const t=ex().x(t=>t.x).y(t=>t.y);for(let r of e){let e=r.source,o=r.target,a=e.datum[xE],l=o.datum[xE],c=i.get(s.get(a)),u=i.get(s.get(l));r._d=QA(t({source:c,target:u}),n.left-n._x0,n.top)}}else if(n.orientation===zA){const t=tx().x(t=>t.y).y(t=>t.x);for(let r of e){let e=r.source,o=r.target,a=e.datum[xE],l=o.datum[xE],c=i.get(s.get(a)),u=i.get(s.get(l));r._d=QA(t({source:c,target:u}),n.left,n.top-n._x0)}}}_updateBezierLinksForDirectedGraph(t,e,n){let r={},i={},s={},o={};for(let e of t){i[e.id]=0,r[e.id]=0;let t=e.links.filter(t=>t.source===e),n=e.links.filter(t=>t.target===e);o[e.id]=n.map(t=>t.strokeWidth).reduce((t,e)=>t+e,0),s[e.id]=t.map(t=>t.strokeWidth).reduce((t,e)=>t+e,0)}n.spreadLinks&&("LR"===n.direction||"RL"===n.direction?e.sort((t,e)=>iS(t.target.bounds.x,t.target.bounds.y,t.source.bounds.x,t.source.bounds.y)-iS(e.target.bounds.x,e.target.bounds.y,e.source.bounds.x,e.source.bounds.y)):e.sort((t,e)=>iS(e.target.bounds.x,e.target.bounds.y,e.source.bounds.x,e.source.bounds.y)-iS(t.target.bounds.x,t.target.bounds.y,t.source.bounds.x,t.source.bounds.y)));for(let t of e){let e,a,l,c,u=t.source,h=t.target;n.spreadLinks?"LR"===n.direction||"RL"===n.direction?(e=u.bounds[t.sourceAnchor[0]]+t.sourceOffset[0],l=h.bounds[t.targetAnchor[0]]+t.targetOffset[0],a=u.bounds[t.sourceAnchor[1]]+t.sourceOffset[1]-s[u.id]/2+r[u.id]+t.strokeWidth/2,c=h.bounds[t.targetAnchor[1]]+t.targetOffset[1]-o[h.id]/2+i[h.id]+t.strokeWidth/2,r[u.id]+=t.strokeWidth,i[h.id]+=t.strokeWidth):(a=u.bounds[t.sourceAnchor[1]]+t.sourceOffset[1],c=h.bounds[t.targetAnchor[1]]+t.targetOffset[1],e=u.bounds[t.sourceAnchor[0]]+t.sourceOffset[0]-s[u.id]/2+r[u.id]+t.strokeWidth/2,l=h.bounds[t.targetAnchor[0]]+t.targetOffset[0]-o[h.id]/2+i[h.id]+t.strokeWidth/2,r[u.id]+=t.strokeWidth,i[h.id]+=t.strokeWidth):(e=u.bounds[t.sourceAnchor[0]]+t.sourceOffset[0],a=u.bounds[t.sourceAnchor[1]]+t.sourceOffset[1],l=h.bounds[t.targetAnchor[0]]+t.targetOffset[0],c=h.bounds[t.targetAnchor[1]]+t.targetOffset[1]),t.orientation===zA?t.vertices=[[e,a],[(e+l)/2,a],[e,c],[l,c]]:t.orientation===FA&&(t.vertices=[[e,a],[e,(a+c)/2],[l,a],[l,c]])}}_updateBundledLinks(t){let e=this._inputVars[0].element.parent.layout;if(e.type!==HE.CLUSTER)throw"Bundled links must work on a cluster layout";let n=e._d3Root.leaves();const r=new Map(n.map(t=>[WT(t),t])),i=new Map(n.map(t=>[t.data[xE],WT(t)])),s=Uv().curve(Vx.beta(t[0]._strength)).radius(t=>t.y).angle(t=>t.x);for(let n of t){let t=n.source.datum[xE],o=n.target.datum[xE],a=r.get(i.get(t)),l=r.get(i.get(o));(a.outgoing??=[]).push([a,l]),l.incoming??=[];let c=a.path(l);n._d=QA(s(c),e.x,e.y),n._dirty=!0}}_updateChordLinks(t){for(let e of t){let t=e.source,n=e.target,r=bT(t.x,t.y,t.innerRadius,t.startAngle),i=bT(t.x,t.y,t.innerRadius,t.endAngle),s=bT(n.x,n.y,n.innerRadius,n.startAngle),o=bT(n.x,n.y,n.innerRadius,n.endAngle);e._d=["M",r[0],r[1],"Q",t.x,t.y,o[0],o[1],"A",t.x,t.y,n.angle,n.angle>180?1:0,1,s[0],s[1],"Q",t.x,t.y,i[0],i[1],"A",t.x,t.y,t.angle,t.angle>180?1:0,1,r[0],r[1]].join(" "),e._dirty=!0}}_updateLineLinks(t){for(let e of t){let t=e.source,n=e.target;e.vertices[0].x=t.bounds.x,e.vertices[0].y=t.bounds.y,e.vertices[1].x=n.bounds.x,e.vertices[1].y=n.bounds.y,e._dirty=!0}}}function WT(t){return`${t.parent?WT(t.parent)+".":""}${t.data[xE]}`}var qT="\0";function $T(t,e){t[e]?t[e]++:t[e]=1}function XT(t,e){--t[e]||delete t[e]}function KT(t,e,n,r){var i=""+e,s=""+n;if(!t&&i>s){var o=i;i=s,s=o}return i+""+s+""+(void 0===r?"\0":r)}function ZT(t,e){return KT(t,e.v,e.w,e.name)}var JT=class{_isDirected=!0;_isMultigraph=!1;_isCompound=!1;_label;_defaultNodeLabelFn=()=>{};_defaultEdgeLabelFn=()=>{};_nodes={};_in={};_preds={};_out={};_sucs={};_edgeObjs={};_edgeLabels={};_nodeCount=0;_edgeCount=0;_parent;_children;constructor(t){t&&(this._isDirected=!Object.hasOwn(t,"directed")||t.directed,this._isMultigraph=!!Object.hasOwn(t,"multigraph")&&t.multigraph,this._isCompound=!!Object.hasOwn(t,"compound")&&t.compound),this._isCompound&&(this._parent={},this._children={},this._children[qT]={})}isDirected(){return this._isDirected}isMultigraph(){return this._isMultigraph}isCompound(){return this._isCompound}setGraph(t){return this._label=t,this}graph(){return this._label}setDefaultNodeLabel(t){return this._defaultNodeLabelFn=t,"function"!=typeof t&&(this._defaultNodeLabelFn=()=>t),this}nodeCount(){return this._nodeCount}nodes(){return Object.keys(this._nodes)}sources(){var t=this;return this.nodes().filter(e=>0===Object.keys(t._in[e]).length)}sinks(){var t=this;return this.nodes().filter(e=>0===Object.keys(t._out[e]).length)}setNodes(t,e){var n=arguments,r=this;return t.forEach(function(t){n.length>1?r.setNode(t,e):r.setNode(t)}),this}setNode(t,e){return Object.hasOwn(this._nodes,t)?(arguments.length>1&&(this._nodes[t]=e),this):(this._nodes[t]=arguments.length>1?e:this._defaultNodeLabelFn(t),this._isCompound&&(this._parent[t]=qT,this._children[t]={},this._children[qT][t]=!0),this._in[t]={},this._preds[t]={},this._out[t]={},this._sucs[t]={},++this._nodeCount,this)}node(t){return this._nodes[t]}hasNode(t){return Object.hasOwn(this._nodes,t)}removeNode(t){var e=this;if(Object.hasOwn(this._nodes,t)){var n=t=>e.removeEdge(e._edgeObjs[t]);delete this._nodes[t],this._isCompound&&(this._removeFromParentsChildList(t),delete this._parent[t],this.children(t).forEach(function(t){e.setParent(t)}),delete this._children[t]),Object.keys(this._in[t]).forEach(n),delete this._in[t],delete this._preds[t],Object.keys(this._out[t]).forEach(n),delete this._out[t],delete this._sucs[t],--this._nodeCount}return this}setParent(t,e){if(!this._isCompound)throw new Error("Cannot set parent in a non-compound graph");if(void 0===e)e=qT;else{for(var n=e+="";void 0!==n;n=this.parent(n))if(n===t)throw new Error("Setting "+e+" as parent of "+t+" would create a cycle");this.setNode(e)}return this.setNode(t),this._removeFromParentsChildList(t),this._parent[t]=e,this._children[e][t]=!0,this}_removeFromParentsChildList(t){delete this._children[this._parent[t]][t]}parent(t){if(this._isCompound){var e=this._parent[t];if(e!==qT)return e}}children(t=qT){if(this._isCompound){var e=this._children[t];if(e)return Object.keys(e)}else{if(t===qT)return this.nodes();if(this.hasNode(t))return[]}}predecessors(t){var e=this._preds[t];if(e)return Object.keys(e)}successors(t){var e=this._sucs[t];if(e)return Object.keys(e)}neighbors(t){var e=this.predecessors(t);if(e){const r=new Set(e);for(var n of this.successors(t))r.add(n);return Array.from(r.values())}}isLeaf(t){return 0===(this.isDirected()?this.successors(t):this.neighbors(t)).length}filterNodes(t){var e=new this.constructor({directed:this._isDirected,multigraph:this._isMultigraph,compound:this._isCompound});e.setGraph(this.graph());var n=this;Object.entries(this._nodes).forEach(function([n,r]){t(n)&&e.setNode(n,r)}),Object.values(this._edgeObjs).forEach(function(t){e.hasNode(t.v)&&e.hasNode(t.w)&&e.setEdge(t,n.edge(t))});var r={};function i(t){var s=n.parent(t);return void 0===s||e.hasNode(s)?(r[t]=s,s):s in r?r[s]:i(s)}return this._isCompound&&e.nodes().forEach(t=>e.setParent(t,i(t))),e}setDefaultEdgeLabel(t){return this._defaultEdgeLabelFn=t,"function"!=typeof t&&(this._defaultEdgeLabelFn=()=>t),this}edgeCount(){return this._edgeCount}edges(){return Object.values(this._edgeObjs)}setPath(t,e){var n=this,r=arguments;return t.reduce(function(t,i){return r.length>1?n.setEdge(t,i,e):n.setEdge(t,i),i}),this}setEdge(){var t,e,n,r,i=!1,s=arguments[0];"object"==typeof s&&null!==s&&"v"in s?(t=s.v,e=s.w,n=s.name,2===arguments.length&&(r=arguments[1],i=!0)):(t=s,e=arguments[1],n=arguments[3],arguments.length>2&&(r=arguments[2],i=!0)),t=""+t,e=""+e,void 0!==n&&(n=""+n);var o=KT(this._isDirected,t,e,n);if(Object.hasOwn(this._edgeLabels,o))return i&&(this._edgeLabels[o]=r),this;if(void 0!==n&&!this._isMultigraph)throw new Error("Cannot set a named edge when isMultigraph = false");this.setNode(t),this.setNode(e),this._edgeLabels[o]=i?r:this._defaultEdgeLabelFn(t,e,n);var a=function(t,e,n,r){var i=""+e,s=""+n;if(!t&&i>s){var o=i;i=s,s=o}var a={v:i,w:s};r&&(a.name=r);return a}(this._isDirected,t,e,n);return t=a.v,e=a.w,Object.freeze(a),this._edgeObjs[o]=a,$T(this._preds[e],t),$T(this._sucs[t],e),this._in[e][o]=a,this._out[t][o]=a,this._edgeCount++,this}edge(t,e,n){var r=1===arguments.length?ZT(this._isDirected,arguments[0]):KT(this._isDirected,t,e,n);return this._edgeLabels[r]}edgeAsObj(){const t=this.edge(...arguments);return"object"!=typeof t?{label:t}:t}hasEdge(t,e,n){var r=1===arguments.length?ZT(this._isDirected,arguments[0]):KT(this._isDirected,t,e,n);return Object.hasOwn(this._edgeLabels,r)}removeEdge(t,e,n){var r=1===arguments.length?ZT(this._isDirected,arguments[0]):KT(this._isDirected,t,e,n),i=this._edgeObjs[r];return i&&(t=i.v,e=i.w,delete this._edgeLabels[r],delete this._edgeObjs[r],XT(this._preds[e],t),XT(this._sucs[t],e),delete this._in[e][r],delete this._out[t][r],this._edgeCount--),this}inEdges(t,e){var n=this._in[t];if(n){var r=Object.values(n);return e?r.filter(t=>t.v===e):r}}outEdges(t,e){var n=this._out[t];if(n){var r=Object.values(n);return e?r.filter(t=>t.w===e):r}}nodeEdges(t,e){var n=this.inEdges(t,e);if(n)return n.concat(this.outEdges(t,e))}},QT={Graph:JT,version:"2.2.4"},tC=JT,eC={write:function(t){var e={options:{directed:t.isDirected(),multigraph:t.isMultigraph(),compound:t.isCompound()},nodes:nC(t),edges:rC(t)};void 0!==t.graph()&&(e.value=structuredClone(t.graph()));return e},read:function(t){var e=new tC(t.options).setGraph(t.value);return t.nodes.forEach(function(t){e.setNode(t.v,t.value),t.parent&&e.setParent(t.v,t.parent)}),t.edges.forEach(function(t){e.setEdge({v:t.v,w:t.w,name:t.name},t.value)}),e}};function nC(t){return t.nodes().map(function(e){var n=t.node(e),r=t.parent(e),i={v:e};return void 0!==n&&(i.value=n),void 0!==r&&(i.parent=r),i})}function rC(t){return t.edges().map(function(e){var n=t.edge(e),r={v:e.v,w:e.w};return void 0!==e.name&&(r.name=e.name),void 0!==n&&(r.value=n),r})}var iC=function(t){var e,n={},r=[];function i(r){Object.hasOwn(n,r)||(n[r]=!0,e.push(r),t.successors(r).forEach(i),t.predecessors(r).forEach(i))}return t.nodes().forEach(function(t){e=[],i(t),e.length&&r.push(e)}),r};var sC=class{_arr=[];_keyIndices={};size(){return this._arr.length}keys(){return this._arr.map(function(t){return t.key})}has(t){return Object.hasOwn(this._keyIndices,t)}priority(t){var e=this._keyIndices[t];if(void 0!==e)return this._arr[e].priority}min(){if(0===this.size())throw new Error("Queue underflow");return this._arr[0].key}add(t,e){var n=this._keyIndices;if(t=String(t),!Object.hasOwn(n,t)){var r=this._arr,i=r.length;return n[t]=i,r.push({key:t,priority:e}),this._decrease(i),!0}return!1}removeMin(){this._swap(0,this._arr.length-1);var t=this._arr.pop();return delete this._keyIndices[t.key],this._heapify(0),t.key}decrease(t,e){var n=this._keyIndices[t];if(e>this._arr[n].priority)throw new Error("New priority is greater than current priority. Key: "+t+" Old: "+this._arr[n].priority+" New: "+e);this._arr[n].priority=e,this._decrease(n)}_heapify(t){var e=this._arr,n=2*t,r=n+1,i=t;n<e.length&&(i=e[n].priority<e[i].priority?n:i,r<e.length&&(i=e[r].priority<e[i].priority?r:i),i!==t&&(this._swap(t,i),this._heapify(i)))}_decrease(t){for(var e,n=this._arr,r=n[t].priority;0!==t&&!(n[e=t>>1].priority<r);)this._swap(t,e),t=e}_swap(t,e){var n=this._arr,r=this._keyIndices,i=n[t],s=n[e];n[t]=s,n[e]=i,r[s.key]=t,r[i.key]=e}},oC=sC,aC=function(t,e,n,r){return function(t,e,n,r){var i,s,o={},a=new oC,l=function(t){var e=t.v!==i?t.v:t.w,r=o[e],l=n(t),c=s.distance+l;if(l<0)throw new Error("dijkstra does not allow negative edge weights. Bad edge: "+t+" Weight: "+l);c<r.distance&&(r.distance=c,r.predecessor=i,a.decrease(e,c))};t.nodes().forEach(function(t){var n=t===e?0:Number.POSITIVE_INFINITY;o[t]={distance:n},a.add(t,n)});for(;a.size()>0&&(i=a.removeMin(),(s=o[i]).distance!==Number.POSITIVE_INFINITY);)r(i).forEach(l);return o}(t,String(e),n||lC,r||function(e){return t.outEdges(e)})},lC=()=>1;var cC=aC,uC=function(t,e,n){return t.nodes().reduce(function(r,i){return r[i]=cC(t,i,e,n),r},{})};var hC=function(t){var e=0,n=[],r={},i=[];function s(o){var a=r[o]={onStack:!0,lowlink:e,index:e++};if(n.push(o),t.successors(o).forEach(function(t){Object.hasOwn(r,t)?r[t].onStack&&(a.lowlink=Math.min(a.lowlink,r[t].index)):(s(t),a.lowlink=Math.min(a.lowlink,r[t].lowlink))}),a.lowlink===a.index){var l,c=[];do{l=n.pop(),r[l].onStack=!1,c.push(l)}while(o!==l);i.push(c)}}return t.nodes().forEach(function(t){Object.hasOwn(r,t)||s(t)}),i};var fC=hC,dC=function(t){return fC(t).filter(function(e){return e.length>1||1===e.length&&t.hasEdge(e[0],e[0])})};var pC=function(t,e,n){return function(t,e,n){var r={},i=t.nodes();return i.forEach(function(t){r[t]={},r[t][t]={distance:0},i.forEach(function(e){t!==e&&(r[t][e]={distance:Number.POSITIVE_INFINITY})}),n(t).forEach(function(n){var i=n.v===t?n.w:n.v,s=e(n);r[t][i]={distance:s,predecessor:t}})}),i.forEach(function(t){var e=r[t];i.forEach(function(n){var s=r[n];i.forEach(function(n){var r=s[t],i=e[n],o=s[n],a=r.distance+i.distance;a<o.distance&&(o.distance=a,o.predecessor=i.predecessor)})})}),r}(t,e||_C,n||function(e){return t.outEdges(e)})},_C=()=>1;function gC(t){var e={},n={},r=[];if(t.sinks().forEach(function i(s){if(Object.hasOwn(n,s))throw new yC;Object.hasOwn(e,s)||(n[s]=!0,e[s]=!0,t.predecessors(s).forEach(i),delete n[s],r.push(s))}),Object.keys(e).length!==t.nodeCount())throw new yC;return r}class yC extends Error{constructor(){super(...arguments)}}var mC=gC;gC.CycleException=yC;var bC=mC;var vC=function(t,e,n){Array.isArray(e)||(e=[e]);var r=t.isDirected()?e=>t.successors(e):e=>t.neighbors(e),i="post"===n?xC:wC,s=[],o={};return e.forEach(e=>{if(!t.hasNode(e))throw new Error("Graph does not have node: "+e);i(e,r,o,s)}),s};function xC(t,e,n,r){for(var i=[[t,!1]];i.length>0;){var s=i.pop();s[1]?r.push(s[0]):Object.hasOwn(n,s[0])||(n[s[0]]=!0,i.push([s[0],!0]),EC(e(s[0]),t=>i.push([t,!1])))}}function wC(t,e,n,r){for(var i=[t];i.length>0;){var s=i.pop();Object.hasOwn(n,s)||(n[s]=!0,r.push(s),EC(e(s),t=>i.push(t)))}}function EC(t,e){for(var n=t.length;n--;)e(t[n],n,t);return t}var AC=vC;var SC=vC;var TC=JT,CC=sC,kC=function(t,e){var n,r=new TC,i={},s=new CC;function o(t){var r=t.v===n?t.w:t.v,o=s.priority(r);if(void 0!==o){var a=e(t);a<o&&(i[r]=n,s.decrease(r,a))}}if(0===t.nodeCount())return r;t.nodes().forEach(function(t){s.add(t,Number.POSITIVE_INFINITY),r.setNode(t)}),s.decrease(t.nodes()[0],0);var a=!1;for(;s.size()>0;){if(n=s.removeMin(),Object.hasOwn(i,n))r.setEdge(n,i[n]);else{if(a)throw new Error("Input graph is not connected: "+t);a=!0}t.nodeEdges(n).forEach(o)}return r};var RC={Graph:QT.Graph,json:eC,alg:{components:iC,dijkstra:aC,dijkstraAll:uC,findCycles:dC,floydWarshall:pC,isAcyclic:function(t){try{bC(t)}catch(t){if(t instanceof bC.CycleException)return!1;throw t}return!0},postorder:function(t,e){return AC(t,e,"post")},preorder:function(t,e){return SC(t,e,"pre")},prim:kC,tarjan:hC,topsort:mC},version:QT.version};function MC(t){t._prev._next=t._next,t._next._prev=t._prev,delete t._next,delete t._prev}function OC(t,e){if("_next"!==t&&"_prev"!==t)return e}let NC=RC.Graph,IC=class{constructor(){let t={};t._next=t._prev=t,this._sentinel=t}dequeue(){let t=this._sentinel,e=t._prev;if(e!==t)return MC(e),e}enqueue(t){let e=this._sentinel;t._prev&&t._next&&MC(t),t._next=e._next,e._next._prev=t,e._next=t,t._prev=e}toString(){let t=[],e=this._sentinel,n=e._prev;for(;n!==e;)t.push(JSON.stringify(n,OC)),n=n._prev;return"["+t.join(", ")+"]"}};var PC=function(t,e){if(t.nodeCount()<=1)return[];let n=function(t,e){let n=new NC,r=0,i=0;t.nodes().forEach(t=>{n.setNode(t,{v:t,in:0,out:0})}),t.edges().forEach(t=>{let s=n.edge(t.v,t.w)||0,o=e(t),a=s+o;n.setEdge(t.v,t.w,a),i=Math.max(i,n.node(t.v).out+=o),r=Math.max(r,n.node(t.w).in+=o)});let s=function(t){const e=[];for(let n=0;n<t;n++)e.push(n);return e}(i+r+3).map(()=>new IC),o=r+1;return n.nodes().forEach(t=>{VC(s,o,n.node(t))}),{graph:n,buckets:s,zeroIdx:o}}(t,e||LC);return function(t,e,n){let r,i=[],s=e[e.length-1],o=e[0];for(;t.nodeCount();){for(;r=o.dequeue();)DC(t,e,n,r);for(;r=s.dequeue();)DC(t,e,n,r);if(t.nodeCount())for(let s=e.length-2;s>0;--s)if(r=e[s].dequeue(),r){i=i.concat(DC(t,e,n,r,!0));break}}return i}(n.graph,n.buckets,n.zeroIdx).flatMap(e=>t.outEdges(e.v,e.w))};let LC=()=>1;function DC(t,e,n,r,i){let s=i?[]:void 0;return t.inEdges(r.v).forEach(r=>{let o=t.edge(r),a=t.node(r.v);i&&s.push({v:r.v,w:r.w}),a.out-=o,VC(e,n,a)}),t.outEdges(r.v).forEach(r=>{let i=t.edge(r),s=r.w,o=t.node(s);o.in-=i,VC(e,n,o)}),t.removeNode(r.v),s}function VC(t,e,n){n.out?n.in?t[n.out-n.in+e].enqueue(n):t[t.length-1].enqueue(n):t[0].enqueue(n)}let BC=RC.Graph;var zC={addBorderNode:function(t,e,n,r){let i={width:0,height:0};arguments.length>=4&&(i.rank=n,i.order=r);return FC(t,"border",i,e)},addDummyNode:FC,applyWithChunking:jC,asNonCompoundGraph:function(t){let e=new BC({multigraph:t.isMultigraph()}).setGraph(t.graph());return t.nodes().forEach(n=>{t.children(n).length||e.setNode(n,t.node(n))}),t.edges().forEach(n=>{e.setEdge(n,t.edge(n))}),e},buildLayerMatrix:function(t){let e=WC(UC(t)+1).map(()=>[]);return t.nodes().forEach(n=>{let r=t.node(n),i=r.rank;void 0!==i&&(e[i][r.order]=n)}),e},intersectRect:function(t,e){let n,r,i=t.x,s=t.y,o=e.x-i,a=e.y-s,l=t.width/2,c=t.height/2;if(!o&&!a)throw new Error("Not possible to find intersection inside of the rectangle");Math.abs(a)*l>Math.abs(o)*c?(a<0&&(c=-c),n=c*o/a,r=c):(o<0&&(l=-l),n=l,r=l*a/o);return{x:i+n,y:s+r}},mapValues:function(t,e){let n=e;"string"==typeof e&&(n=t=>t[e]);return Object.entries(t).reduce((t,[e,r])=>(t[e]=n(r,e),t),{})},maxRank:UC,normalizeRanks:function(t){let e=t.nodes().map(e=>{let n=t.node(e).rank;return void 0===n?Number.MAX_VALUE:n}),n=jC(Math.min,e);t.nodes().forEach(e=>{let r=t.node(e);Object.hasOwn(r,"rank")&&(r.rank-=n)})},notime:function(t,e){return e()},partition:function(t,e){let n={lhs:[],rhs:[]};return t.forEach(t=>{e(t)?n.lhs.push(t):n.rhs.push(t)}),n},pick:function(t,e){const n={};for(const r of e)void 0!==t[r]&&(n[r]=t[r]);return n},predecessorWeights:function(t){let e=t.nodes().map(e=>{let n={};return t.inEdges(e).forEach(e=>{n[e.v]=(n[e.v]||0)+t.edge(e).weight}),n});return qC(t.nodes(),e)},range:WC,removeEmptyRanks:function(t){let e=t.nodes().map(e=>t.node(e).rank),n=jC(Math.min,e),r=[];t.nodes().forEach(e=>{let i=t.node(e).rank-n;r[i]||(r[i]=[]),r[i].push(e)});let i=0,s=t.graph().nodeRankFactor;Array.from(r).forEach((e,n)=>{void 0===e&&n%s!==0?--i:void 0!==e&&i&&e.forEach(e=>t.node(e).rank+=i)})},simplify:function(t){let e=(new BC).setGraph(t.graph());return t.nodes().forEach(n=>e.setNode(n,t.node(n))),t.edges().forEach(n=>{let r=e.edge(n.v,n.w)||{weight:0,minlen:1},i=t.edge(n);e.setEdge(n.v,n.w,{weight:r.weight+i.weight,minlen:Math.max(r.minlen,i.minlen)})}),e},successorWeights:function(t){let e=t.nodes().map(e=>{let n={};return t.outEdges(e).forEach(e=>{n[e.w]=(n[e.w]||0)+t.edge(e).weight}),n});return qC(t.nodes(),e)},time:function(t,e){let n=Date.now();try{return e()}finally{console.log(t+" time: "+(Date.now()-n)+"ms")}},uniqueId:HC,zipObject:qC};function FC(t,e,n,r){for(var i=r;t.hasNode(i);)i=HC(r);return n.dummy=e,t.setNode(i,n),i}const GC=65535;function jC(t,e){if(e.length>GC){const n=function(t,e=GC){const n=[];for(let r=0;r<t.length;r+=e){const i=t.slice(r,r+e);n.push(i)}return n}(e);return t.apply(null,n.map(e=>t.apply(null,e)))}return t.apply(null,e)}function UC(t){const e=t.nodes().map(e=>{let n=t.node(e).rank;return void 0===n?Number.MIN_VALUE:n});return jC(Math.max,e)}let YC=0;function HC(t){return t+""+ ++YC}function WC(t,e,n=1){null==e&&(e=t,t=0);let r=t=>t<e;n<0&&(r=t=>e<t);const i=[];for(let e=t;r(e);e+=n)i.push(e);return i}function qC(t,e){return t.reduce((t,n,r)=>(t[n]=e[r],t),{})}let $C=PC,XC=zC.uniqueId;var KC={run:function(t){("greedy"===t.graph().acyclicer?$C(t,function(t){return e=>t.edge(e).weight}(t)):function(t){let e=[],n={},r={};function i(s){Object.hasOwn(r,s)||(r[s]=!0,n[s]=!0,t.outEdges(s).forEach(t=>{Object.hasOwn(n,t.w)?e.push(t):i(t.w)}),delete n[s])}return t.nodes().forEach(i),e}(t)).forEach(e=>{let n=t.edge(e);t.removeEdge(e),n.forwardName=e.name,n.reversed=!0,t.setEdge(e.w,e.v,n,XC("rev"))})},undo:function(t){t.edges().forEach(e=>{let n=t.edge(e);if(n.reversed){t.removeEdge(e);let r=n.forwardName;delete n.reversed,delete n.forwardName,t.setEdge(e.w,e.v,n,r)}})}};let ZC=zC;var JC={run:function(t){t.graph().dummyChains=[],t.edges().forEach(e=>function(t,e){let n,r,i,s=e.v,o=t.node(s).rank,a=e.w,l=t.node(a).rank,c=e.name,u=t.edge(e),h=u.labelRank;if(l===o+1)return;for(t.removeEdge(e),i=0,++o;o<l;++i,++o)u.points=[],r={width:0,height:0,edgeLabel:u,edgeObj:e,rank:o},n=ZC.addDummyNode(t,"edge",r,"_d"),o===h&&(r.width=u.width,r.height=u.height,r.dummy="edge-label",r.labelpos=u.labelpos),t.setEdge(s,n,{weight:u.weight},c),0===i&&t.graph().dummyChains.push(n),s=n;t.setEdge(s,a,{weight:u.weight},c)}(t,e))},undo:function(t){t.graph().dummyChains.forEach(e=>{let n,r=t.node(e),i=r.edgeLabel;for(t.setEdge(r.edgeObj,i);r.dummy;)n=t.successors(e)[0],t.removeNode(e),i.points.push({x:r.x,y:r.y}),"edge-label"===r.dummy&&(i.x=r.x,i.y=r.y,i.width=r.width,i.height=r.height),e=n,r=t.node(e)})}};const{applyWithChunking:QC}=zC;var tk={longestPath:function(t){var e={};t.sources().forEach(function n(r){var i=t.node(r);if(Object.hasOwn(e,r))return i.rank;e[r]=!0;let s=t.outEdges(r).map(e=>null==e?Number.POSITIVE_INFINITY:n(e.w)-t.edge(e).minlen);var o=QC(Math.min,s);return o===Number.POSITIVE_INFINITY&&(o=0),i.rank=o})},slack:function(t,e){return t.node(e.w).rank-t.node(e.v).rank-t.edge(e).minlen}};var ek=RC.Graph,nk=tk.slack,rk=function(t){var e,n,r=new ek({directed:!1}),i=t.nodes()[0],s=t.nodeCount();r.setNode(i,{});for(;ik(r,t)<s;)e=sk(r,t),n=r.hasNode(e.v)?nk(t,e):-nk(t,e),ok(r,t,n);return r};function ik(t,e){return t.nodes().forEach(function n(r){e.nodeEdges(r).forEach(i=>{var s=i.v,o=r===s?i.w:s;t.hasNode(o)||nk(e,i)||(t.setNode(o,{}),t.setEdge(r,o,{}),n(o))})}),t.nodeCount()}function sk(t,e){return e.edges().reduce((n,r)=>{let i=Number.POSITIVE_INFINITY;return t.hasNode(r.v)!==t.hasNode(r.w)&&(i=nk(e,r)),i<n[0]?[i,r]:n},[Number.POSITIVE_INFINITY,null])[1]}function ok(t,e,n){t.nodes().forEach(t=>e.node(t).rank+=n)}var ak=rk,lk=tk.slack,ck=tk.longestPath,uk=RC.alg.preorder,hk=RC.alg.postorder,fk=zC.simplify,dk=pk;function pk(t){t=fk(t),ck(t);var e,n=ak(t);for(yk(n),_k(n,t);e=bk(n);)xk(n,t,e,vk(n,t,e))}function _k(t,e){var n=hk(t,t.nodes());(n=n.slice(0,n.length-1)).forEach(n=>function(t,e,n){var r=t.node(n),i=r.parent;t.edge(n,i).cutvalue=gk(t,e,n)}(t,e,n))}function gk(t,e,n){var r=t.node(n).parent,i=!0,s=e.edge(n,r),o=0;return s||(i=!1,s=e.edge(r,n)),o=s.weight,e.nodeEdges(n).forEach(s=>{var a=s.v===n,l=a?s.w:s.v;if(l!==r){var c=a===i,u=e.edge(s).weight;if(o+=c?u:-u,function(t,e,n){return t.hasEdge(e,n)}(t,n,l)){var h=t.edge(n,l).cutvalue;o+=c?-h:h}}}),o}function yk(t,e){arguments.length<2&&(e=t.nodes()[0]),mk(t,{},1,e)}function mk(t,e,n,r,i){var s=n,o=t.node(r);return e[r]=!0,t.neighbors(r).forEach(i=>{Object.hasOwn(e,i)||(n=mk(t,e,n,i,r))}),o.low=s,o.lim=n++,i?o.parent=i:delete o.parent,n}function bk(t){return t.edges().find(e=>t.edge(e).cutvalue<0)}function vk(t,e,n){var r=n.v,i=n.w;e.hasEdge(r,i)||(r=n.w,i=n.v);var s=t.node(r),o=t.node(i),a=s,l=!1;s.lim>o.lim&&(a=o,l=!0);var c=e.edges().filter(e=>l===wk(t,t.node(e.v),a)&&l!==wk(t,t.node(e.w),a));return c.reduce((t,n)=>lk(e,n)<lk(e,t)?n:t)}function xk(t,e,n,r){var i=n.v,s=n.w;t.removeEdge(i,s),t.setEdge(r.v,r.w,{}),yk(t),_k(t,e),function(t,e){var n=t.nodes().find(t=>!e.node(t).parent),r=uk(t,n);(r=r.slice(1)).forEach(n=>{var r=t.node(n).parent,i=e.edge(n,r),s=!1;i||(i=e.edge(r,n),s=!0),e.node(n).rank=e.node(r).rank+(s?i.minlen:-i.minlen)})}(t,e)}function wk(t,e,n){return n.low<=e.lim&&e.lim<=n.lim}pk.initLowLimValues=yk,pk.initCutValues=_k,pk.calcCutValue=gk,pk.leaveEdge=bk,pk.enterEdge=vk,pk.exchangeEdges=xk;var Ek=tk.longestPath,Ak=rk,Sk=dk,Tk=function(t){var e=t.graph().ranker;if(e instanceof Function)return e(t);switch(t.graph().ranker){case"network-simplex":default:kk(t);break;case"tight-tree":!function(t){Ek(t),Ak(t)}(t);break;case"longest-path":Ck(t);case"none":}};var Ck=Ek;function kk(t){Sk(t)}var Rk=function(t){let e=function(t){let e={},n=0;function r(i){let s=n;t.children(i).forEach(r),e[i]={low:s,lim:n++}}return t.children().forEach(r),e}(t);t.graph().dummyChains.forEach(n=>{let r=t.node(n),i=r.edgeObj,s=function(t,e,n,r){let i,s,o=[],a=[],l=Math.min(e[n].low,e[r].low),c=Math.max(e[n].lim,e[r].lim);i=n;do{i=t.parent(i),o.push(i)}while(i&&(e[i].low>l||c>e[i].lim));s=i,i=r;for(;(i=t.parent(i))!==s;)a.push(i);return{path:o.concat(a.reverse()),lca:s}}(t,e,i.v,i.w),o=s.path,a=s.lca,l=0,c=o[l],u=!0;for(;n!==i.w;){if(r=t.node(n),u){for(;(c=o[l])!==a&&t.node(c).maxRank<r.rank;)l++;c===a&&(u=!1)}if(!u){for(;l<o.length-1&&t.node(c=o[l+1]).minRank<=r.rank;)l++;c=o[l]}t.setParent(n,c),n=t.successors(n)[0]}})};let Mk=zC;var Ok={run:function(t){let e=Mk.addDummyNode(t,"root",{},"_root"),n=function(t){var e={};function n(r,i){var s=t.children(r);s&&s.length&&s.forEach(t=>n(t,i+1)),e[r]=i}return t.children().forEach(t=>n(t,1)),e}(t),r=Object.values(n),i=Mk.applyWithChunking(Math.max,r)-1,s=2*i+1;t.graph().nestingRoot=e,t.edges().forEach(e=>t.edge(e).minlen*=s);let o=function(t){return t.edges().reduce((e,n)=>e+t.edge(n).weight,0)}(t)+1;t.children().forEach(r=>Nk(t,e,s,o,i,n,r)),t.graph().nodeRankFactor=s},cleanup:function(t){var e=t.graph();t.removeNode(e.nestingRoot),delete e.nestingRoot,t.edges().forEach(e=>{t.edge(e).nestingEdge&&t.removeEdge(e)})}};function Nk(t,e,n,r,i,s,o){let a=t.children(o);if(!a.length)return void(o!==e&&t.setEdge(e,o,{weight:0,minlen:n}));let l=Mk.addBorderNode(t,"_bt"),c=Mk.addBorderNode(t,"_bb"),u=t.node(o);t.setParent(l,o),u.borderTop=l,t.setParent(c,o),u.borderBottom=c,a.forEach(a=>{Nk(t,e,n,r,i,s,a);let u=t.node(a),h=u.borderTop?u.borderTop:a,f=u.borderBottom?u.borderBottom:a,d=u.borderTop?r:2*r,p=h!==f?1:i-s[o]+1;t.setEdge(l,h,{weight:d,minlen:p,nestingEdge:!0}),t.setEdge(f,c,{weight:d,minlen:p,nestingEdge:!0})}),t.parent(o)||t.setEdge(e,l,{weight:0,minlen:i+s[o]})}let Ik=zC;var Pk=function(t){t.children().forEach(function e(n){let r=t.children(n),i=t.node(n);if(r.length&&r.forEach(e),Object.hasOwn(i,"minRank")){i.borderLeft=[],i.borderRight=[];for(let e=i.minRank,r=i.maxRank+1;e<r;++e)Lk(t,"borderLeft","_bl",n,i,e),Lk(t,"borderRight","_br",n,i,e)}})};function Lk(t,e,n,r,i,s){let o={width:0,height:0,rank:s,borderType:e},a=i[e][s-1],l=Ik.addDummyNode(t,"border",o,n);i[e][s]=l,t.setParent(l,r),a&&t.setEdge(a,l,{weight:1})}function Dk(t){t.nodes().forEach(e=>Vk(t.node(e))),t.edges().forEach(e=>Vk(t.edge(e)))}function Vk(t){let e=t.width;t.width=t.height,t.height=e}function Bk(t){t.y=-t.y}function zk(t){let e=t.x;t.x=t.y,t.y=e}let Fk=zC;var Gk=function(t){let e={},n=t.nodes().filter(e=>!t.children(e).length),r=n.map(e=>t.node(e).rank),i=Fk.applyWithChunking(Math.max,r),s=Fk.range(i+1).map(()=>[]);function o(n){if(e[n])return;e[n]=!0;let r=t.node(n);s[r.rank].push(n),t.successors(n).forEach(o)}let a=n.sort((e,n)=>t.node(e).rank-t.node(n).rank);return a.forEach(o),s};let jk=zC.zipObject;function Uk(t,e,n){let r=jk(n,n.map((t,e)=>e)),i=e.flatMap(e=>t.outEdges(e).map(e=>({pos:r[e.w],weight:t.edge(e).weight})).sort((t,e)=>t.pos-e.pos)),s=1;for(;s<n.length;)s<<=1;let o=2*s-1;s-=1;let a=new Array(o).fill(0),l=0;return i.forEach(t=>{let e=t.pos+s;a[e]+=t.weight;let n=0;for(;e>0;)e%2&&(n+=a[e+1]),e=e-1>>1,a[e]+=t.weight;l+=t.weight*n}),l}let Yk=zC;var Hk=function(t,e){let n={};return t.forEach((t,e)=>{let r=n[t.v]={indegree:0,in:[],out:[],vs:[t.v],i:e};void 0!==t.barycenter&&(r.barycenter=t.barycenter,r.weight=t.weight)}),e.edges().forEach(t=>{let e=n[t.v],r=n[t.w];void 0!==e&&void 0!==r&&(r.indegree++,e.out.push(n[t.w]))}),function(t){let e=[];function n(t){return e=>{e.merged||(void 0===e.barycenter||void 0===t.barycenter||e.barycenter>=t.barycenter)&&function(t,e){let n=0,r=0;t.weight&&(n+=t.barycenter*t.weight,r+=t.weight);e.weight&&(n+=e.barycenter*e.weight,r+=e.weight);t.vs=e.vs.concat(t.vs),t.barycenter=n/r,t.weight=r,t.i=Math.min(e.i,t.i),e.merged=!0}(t,e)}}function r(e){return n=>{n.in.push(e),0===--n.indegree&&t.push(n)}}for(;t.length;){let i=t.pop();e.push(i),i.in.reverse().forEach(n(i)),i.out.forEach(r(i))}return e.filter(t=>!t.merged).map(t=>Yk.pick(t,["vs","i","barycenter","weight"]))}(Object.values(n).filter(t=>!t.indegree))};let Wk=zC;var qk=function(t,e){let n=Wk.partition(t,t=>Object.hasOwn(t,"barycenter")),r=n.lhs,i=n.rhs.sort((t,e)=>e.i-t.i),s=[],o=0,a=0,l=0;r.sort((c=!!e,(t,e)=>t.barycenter<e.barycenter?-1:t.barycenter>e.barycenter?1:c?e.i-t.i:t.i-e.i)),l=$k(s,i,l),r.forEach(t=>{l+=t.vs.length,s.push(t.vs),o+=t.barycenter*t.weight,a+=t.weight,l=$k(s,i,l)});var c;let u={vs:s.flat(!0)};a&&(u.barycenter=o/a,u.weight=a);return u};function $k(t,e,n){let r;for(;e.length&&(r=e[e.length-1]).i<=n;)e.pop(),t.push(r.vs),n++;return n}let Xk=function(t,e=[]){return e.map(e=>{let n=t.inEdges(e);if(n.length){let r=n.reduce((e,n)=>{let r=t.edge(n),i=t.node(n.v);return{sum:e.sum+r.weight*i.order,weight:e.weight+r.weight}},{sum:0,weight:0});return{v:e,barycenter:r.sum/r.weight,weight:r.weight}}return{v:e}})},Kk=Hk,Zk=qk;var Jk=function t(e,n,r,i){let s=e.children(n),o=e.node(n),a=o?o.borderLeft:void 0,l=o?o.borderRight:void 0,c={};a&&(s=s.filter(t=>t!==a&&t!==l));let u=Xk(e,s);u.forEach(n=>{if(e.children(n.v).length){let a=t(e,n.v,r,i);c[n.v]=a,Object.hasOwn(a,"barycenter")&&(o=a,void 0!==(s=n).barycenter?(s.barycenter=(s.barycenter*s.weight+o.barycenter*o.weight)/(s.weight+o.weight),s.weight+=o.weight):(s.barycenter=o.barycenter,s.weight=o.weight))}var s,o});let h=Kk(u,r);!function(t,e){t.forEach(t=>{t.vs=t.vs.flatMap(t=>e[t]?e[t].vs:t)})}(h,c);let f=Zk(h,i);if(a&&(f.vs=[a,f.vs,l].flat(!0),e.predecessors(a).length)){let t=e.node(e.predecessors(a)[0]),n=e.node(e.predecessors(l)[0]);Object.hasOwn(f,"barycenter")||(f.barycenter=0,f.weight=0),f.barycenter=(f.barycenter*f.weight+t.order+n.order)/(f.weight+2),f.weight+=2}return f};let Qk=RC.Graph,tR=zC;var eR=function(t,e,n,r){r||(r=t.nodes());let i=function(t){var e;for(;t.hasNode(e=tR.uniqueId("_root")););return e}(t),s=new Qk({compound:!0}).setGraph({root:i}).setDefaultNodeLabel(e=>t.node(e));return r.forEach(r=>{let o=t.node(r),a=t.parent(r);(o.rank===e||o.minRank<=e&&e<=o.maxRank)&&(s.setNode(r),s.setParent(r,a||i),t[n](r).forEach(e=>{let n=e.v===r?e.w:e.v,i=s.edge(n,r),o=void 0!==i?i.weight:0;s.setEdge(n,r,{weight:t.edge(e).weight+o})}),Object.hasOwn(o,"minRank")&&s.setNode(r,{borderLeft:o.borderLeft[e],borderRight:o.borderRight[e]}))}),s};let nR=Gk,rR=function(t,e){let n=0;for(let r=1;r<e.length;++r)n+=Uk(t,e[r-1],e[r]);return n},iR=Jk,sR=eR,oR=function(t,e,n){let r,i={};n.forEach(n=>{let s,o,a=t.parent(n);for(;a;){if(s=t.parent(a),s?(o=i[s],i[s]=a):(o=r,r=a),o&&o!==a)return void e.setEdge(o,a);a=s}})},aR=RC.Graph,lR=zC;var cR=function t(e,n){if(n&&"function"==typeof n.customOrder)return void n.customOrder(e,t);let r=lR.maxRank(e),i=uR(e,lR.range(1,r+1),"inEdges"),s=uR(e,lR.range(r-1,-1,-1),"outEdges"),o=nR(e);if(fR(e,o),n&&n.disableOptimalOrderHeuristic)return;let a,l=Number.POSITIVE_INFINITY;for(let t=0,n=0;n<4;++t,++n){hR(t%2?i:s,t%4>=2),o=lR.buildLayerMatrix(e);let r=rR(e,o);r<l&&(n=0,a=Object.assign({},o),l=r)}fR(e,a)};function uR(t,e,n){const r=new Map,i=(t,e)=>{r.has(t)||r.set(t,[]),r.get(t).push(e)};for(const e of t.nodes()){const n=t.node(e);if("number"==typeof n.rank&&i(n.rank,e),"number"==typeof n.minRank&&"number"==typeof n.maxRank)for(let t=n.minRank;t<=n.maxRank;t++)t!==n.rank&&i(t,e)}return e.map(function(e){return sR(t,e,n,r.get(e)||[])})}function hR(t,e){let n=new aR;t.forEach(function(t){let r=t.graph().root,i=iR(t,r,n,e);i.vs.forEach((e,n)=>t.node(e).order=n),oR(t,n,i.vs)})}function fR(t,e){Object.values(e).forEach(e=>e.forEach((e,n)=>t.node(e).order=n))}let dR=RC.Graph,pR=zC;var _R=function(t){let e,n=pR.buildLayerMatrix(t),r=Object.assign(function(t,e){let n={};function r(e,r){let i=0,s=0,o=e.length,a=r[r.length-1];return r.forEach((e,l)=>{let c=function(t,e){if(t.node(e).dummy)return t.predecessors(e).find(e=>t.node(e).dummy)}(t,e),u=c?t.node(c).order:o;(c||e===a)&&(r.slice(s,l+1).forEach(e=>{t.predecessors(e).forEach(r=>{let s=t.node(r),o=s.order;!(o<i||u<o)||s.dummy&&t.node(e).dummy||gR(n,r,e)})}),s=l+1,i=u)}),r}return e.length&&e.reduce(r),n}(t,n),function(t,e){let n={};function r(e,r,i,s,o){let a;pR.range(r,i).forEach(r=>{a=e[r],t.node(a).dummy&&t.predecessors(a).forEach(e=>{let r=t.node(e);r.dummy&&(r.order<s||r.order>o)&&gR(n,e,a)})})}function i(e,n){let i,s=-1,o=0;return n.forEach((a,l)=>{if("border"===t.node(a).dummy){let e=t.predecessors(a);e.length&&(i=t.node(e[0]).order,r(n,o,l,s,i),o=l,s=i)}r(n,o,n.length,i,e.length)}),n}return e.length&&e.reduce(i),n}(t,n)),i={};["u","d"].forEach(s=>{e="u"===s?n:Object.values(n).reverse(),["l","r"].forEach(n=>{"r"===n&&(e=e.map(t=>Object.values(t).reverse()));let o=("u"===s?t.predecessors:t.successors).bind(t),a=function(t,e,n,r){let i={},s={},o={};return e.forEach(t=>{t.forEach((t,e)=>{i[t]=t,s[t]=t,o[t]=e})}),e.forEach(t=>{let e=-1;t.forEach(t=>{let a=r(t);if(a.length){a=a.sort((t,e)=>o[t]-o[e]);let r=(a.length-1)/2;for(let l=Math.floor(r),c=Math.ceil(r);l<=c;++l){let r=a[l];s[t]===t&&e<o[r]&&!yR(n,t,r)&&(s[r]=t,s[t]=i[t]=i[r],e=o[r])}}})}),{root:i,align:s}}(0,e,r,o),l=function(t,e,n,r,i){let s={},o=function(t,e,n,r){let i=new dR,s=t.graph(),o=function(t,e,n){return(r,i,s)=>{let o,a=r.node(i),l=r.node(s),c=0;if(c+=a.width/2,Object.hasOwn(a,"labelpos"))switch(a.labelpos.toLowerCase()){case"l":o=-a.width/2;break;case"r":o=a.width/2}if(o&&(c+=n?o:-o),o=0,c+=(a.dummy?e:t)/2,c+=(l.dummy?e:t)/2,c+=l.width/2,Object.hasOwn(l,"labelpos"))switch(l.labelpos.toLowerCase()){case"l":o=l.width/2;break;case"r":o=-l.width/2}return o&&(c+=n?o:-o),o=0,c}}(s.nodesep,s.edgesep,r);return e.forEach(e=>{let r;e.forEach(e=>{let s=n[e];if(i.setNode(s),r){var a=n[r],l=i.edge(a,s);i.setEdge(a,s,Math.max(o(t,e,r),l||0))}r=e})}),i}(t,e,n,i),a=i?"borderLeft":"borderRight";function l(t,e){let n=o.nodes(),r=n.pop(),i={};for(;r;)i[r]?t(r):(i[r]=!0,n.push(r),n=n.concat(e(r))),r=n.pop()}function c(t){s[t]=o.inEdges(t).reduce((t,e)=>Math.max(t,s[e.v]+o.edge(e)),0)}function u(e){let n=o.outEdges(e).reduce((t,e)=>Math.min(t,s[e.w]-o.edge(e)),Number.POSITIVE_INFINITY),r=t.node(e);n!==Number.POSITIVE_INFINITY&&r.borderType!==a&&(s[e]=Math.max(s[e],n))}return l(c,o.predecessors.bind(o)),l(u,o.successors.bind(o)),Object.keys(r).forEach(t=>s[t]=s[n[t]]),s}(t,e,a.root,a.align,"r"===n);"r"===n&&(l=pR.mapValues(l,t=>-t)),i[s+n]=l})});let s=function(t,e){return Object.values(e).reduce((e,n)=>{let r=Number.NEGATIVE_INFINITY,i=Number.POSITIVE_INFINITY;Object.entries(n).forEach(([e,n])=>{let s=function(t,e){return t.node(e).width}(t,e)/2;r=Math.max(n+s,r),i=Math.min(n-s,i)});const s=r-i;return s<e[0]&&(e=[s,n]),e},[Number.POSITIVE_INFINITY,null])[1]}(t,i);return function(t,e){let n=Object.values(e),r=pR.applyWithChunking(Math.min,n),i=pR.applyWithChunking(Math.max,n);["u","d"].forEach(n=>{["l","r"].forEach(s=>{let o=n+s,a=t[o];if(a===e)return;let l=Object.values(a),c=r-pR.applyWithChunking(Math.min,l);"l"!==s&&(c=i-pR.applyWithChunking(Math.max,l)),c&&(t[o]=pR.mapValues(a,t=>t+c))})})}(i,s),function(t,e){return pR.mapValues(t.ul,(n,r)=>{if(e)return t[e.toLowerCase()][r];{let e=Object.values(t).map(t=>t[r]).sort((t,e)=>t-e);return(e[1]+e[2])/2}})}(i,t.graph().align)};function gR(t,e,n){if(e>n){let t=e;e=n,n=t}let r=t[e];r||(t[e]=r={}),r[n]=!0}function yR(t,e,n){if(e>n){let t=e;e=n,n=t}return!!t[e]&&Object.hasOwn(t[e],n)}let mR=zC,bR=_R;var vR=function(t){(function(t){let e=mR.buildLayerMatrix(t),n=t.graph().ranksep,r=0;e.forEach(e=>{const i=e.reduce((e,n)=>{const r=t.node(n).height;return e>r?e:r},0);e.forEach(e=>t.node(e).y=r+i/2),r+=i+n})})(t=mR.asNonCompoundGraph(t)),Object.entries(bR(t)).forEach(([e,n])=>t.node(e).x=n)};let xR=KC,wR=JC,ER=Tk,AR=zC.normalizeRanks,SR=Rk,TR=zC.removeEmptyRanks,CR=Ok,kR=Pk,RR={adjust:function(t){let e=t.graph().rankdir.toLowerCase();"lr"!==e&&"rl"!==e||Dk(t)},undo:function(t){let e=t.graph().rankdir.toLowerCase();"bt"!==e&&"rl"!==e||function(t){t.nodes().forEach(e=>Bk(t.node(e))),t.edges().forEach(e=>{let n=t.edge(e);n.points.forEach(Bk),Object.hasOwn(n,"y")&&Bk(n)})}(t);"lr"!==e&&"rl"!==e||(!function(t){t.nodes().forEach(e=>zk(t.node(e))),t.edges().forEach(e=>{let n=t.edge(e);n.points.forEach(zk),Object.hasOwn(n,"x")&&zk(n)})}(t),Dk(t))}},MR=cR,OR=vR,NR=zC,IR=RC.Graph;var PR=function(t,e){let n=e&&e.debugTiming?NR.time:NR.notime;n("layout",()=>{let r=n(" buildLayoutGraph",()=>function(t){let e=new IR({multigraph:!0,compound:!0}),n=YR(t.graph());return e.setGraph(Object.assign({},DR,UR(n,LR),NR.pick(n,VR))),t.nodes().forEach(n=>{const r=UR(YR(t.node(n)),BR);Object.keys(zR).forEach(t=>{void 0===r[t]&&(r[t]=zR[t])}),e.setNode(n,r),e.setParent(n,t.parent(n))}),t.edges().forEach(n=>{let r=YR(t.edge(n));e.setEdge(n,Object.assign({},GR,UR(r,FR),NR.pick(r,jR)))}),e}(t));n(" runLayout",()=>function(t,e,n){e(" makeSpaceForEdgeLabels",()=>function(t){let e=t.graph();e.ranksep/=2,t.edges().forEach(n=>{let r=t.edge(n);r.minlen*=2,"c"!==r.labelpos.toLowerCase()&&("TB"===e.rankdir||"BT"===e.rankdir?r.width+=r.labeloffset:r.height+=r.labeloffset)})}(t)),e(" removeSelfEdges",()=>function(t){t.edges().forEach(e=>{if(e.v===e.w){var n=t.node(e.v);n.selfEdges||(n.selfEdges=[]),n.selfEdges.push({e:e,label:t.edge(e)}),t.removeEdge(e)}})}(t)),e(" acyclic",()=>xR.run(t)),e(" nestingGraph.run",()=>CR.run(t)),e(" rank",()=>ER(NR.asNonCompoundGraph(t))),e(" injectEdgeLabelProxies",()=>function(t){t.edges().forEach(e=>{let n=t.edge(e);if(n.width&&n.height){let n=t.node(e.v),r={rank:(t.node(e.w).rank-n.rank)/2+n.rank,e:e};NR.addDummyNode(t,"edge-proxy",r,"_ep")}})}(t)),e(" removeEmptyRanks",()=>TR(t)),e(" nestingGraph.cleanup",()=>CR.cleanup(t)),e(" normalizeRanks",()=>AR(t)),e(" assignRankMinMax",()=>function(t){let e=0;t.nodes().forEach(n=>{let r=t.node(n);r.borderTop&&(r.minRank=t.node(r.borderTop).rank,r.maxRank=t.node(r.borderBottom).rank,e=Math.max(e,r.maxRank))}),t.graph().maxRank=e}(t)),e(" removeEdgeLabelProxies",()=>function(t){t.nodes().forEach(e=>{let n=t.node(e);"edge-proxy"===n.dummy&&(t.edge(n.e).labelRank=n.rank,t.removeNode(e))})}(t)),e(" normalize.run",()=>wR.run(t)),e(" parentDummyChains",()=>SR(t)),e(" addBorderSegments",()=>kR(t)),e(" order",()=>MR(t,n)),e(" insertSelfEdges",()=>function(t){var e=NR.buildLayerMatrix(t);e.forEach(e=>{var n=0;e.forEach((e,r)=>{var i=t.node(e);i.order=r+n,(i.selfEdges||[]).forEach(e=>{NR.addDummyNode(t,"selfedge",{width:e.label.width,height:e.label.height,rank:i.rank,order:r+ ++n,e:e.e,label:e.label},"_se")}),delete i.selfEdges})})}(t)),e(" adjustCoordinateSystem",()=>RR.adjust(t)),e(" position",()=>OR(t)),e(" positionSelfEdges",()=>function(t){t.nodes().forEach(e=>{var n=t.node(e);if("selfedge"===n.dummy){var r=t.node(n.e.v),i=r.x+r.width/2,s=r.y,o=n.x-i,a=r.height/2;t.setEdge(n.e,n.label),t.removeNode(e),n.label.points=[{x:i+2*o/3,y:s-a},{x:i+5*o/6,y:s-a},{x:i+o,y:s},{x:i+5*o/6,y:s+a},{x:i+2*o/3,y:s+a}],n.label.x=n.x,n.label.y=n.y}})}(t)),e(" removeBorderNodes",()=>function(t){t.nodes().forEach(e=>{if(t.children(e).length){let n=t.node(e),r=t.node(n.borderTop),i=t.node(n.borderBottom),s=t.node(n.borderLeft[n.borderLeft.length-1]),o=t.node(n.borderRight[n.borderRight.length-1]);n.width=Math.abs(o.x-s.x),n.height=Math.abs(i.y-r.y),n.x=s.x+n.width/2,n.y=r.y+n.height/2}}),t.nodes().forEach(e=>{"border"===t.node(e).dummy&&t.removeNode(e)})}(t)),e(" normalize.undo",()=>wR.undo(t)),e(" fixupEdgeLabelCoords",()=>function(t){t.edges().forEach(e=>{let n=t.edge(e);if(Object.hasOwn(n,"x"))switch("l"!==n.labelpos&&"r"!==n.labelpos||(n.width-=n.labeloffset),n.labelpos){case"l":n.x-=n.width/2+n.labeloffset;break;case"r":n.x+=n.width/2+n.labeloffset}})}(t)),e(" undoCoordinateSystem",()=>RR.undo(t)),e(" translateGraph",()=>function(t){let e=Number.POSITIVE_INFINITY,n=0,r=Number.POSITIVE_INFINITY,i=0,s=t.graph(),o=s.marginx||0,a=s.marginy||0;function l(t){let s=t.x,o=t.y,a=t.width,l=t.height;e=Math.min(e,s-a/2),n=Math.max(n,s+a/2),r=Math.min(r,o-l/2),i=Math.max(i,o+l/2)}t.nodes().forEach(e=>l(t.node(e))),t.edges().forEach(e=>{let n=t.edge(e);Object.hasOwn(n,"x")&&l(n)}),e-=o,r-=a,t.nodes().forEach(n=>{let i=t.node(n);i.x-=e,i.y-=r}),t.edges().forEach(n=>{let i=t.edge(n);i.points.forEach(t=>{t.x-=e,t.y-=r}),Object.hasOwn(i,"x")&&(i.x-=e),Object.hasOwn(i,"y")&&(i.y-=r)}),s.width=n-e+o,s.height=i-r+a}(t)),e(" assignNodeIntersects",()=>function(t){t.edges().forEach(e=>{let n,r,i=t.edge(e),s=t.node(e.v),o=t.node(e.w);i.points?(n=i.points[0],r=i.points[i.points.length-1]):(i.points=[],n=o,r=s),i.points.unshift(NR.intersectRect(s,n)),i.points.push(NR.intersectRect(o,r))})}(t)),e(" reversePoints",()=>function(t){t.edges().forEach(e=>{let n=t.edge(e);n.reversed&&n.points.reverse()})}(t)),e(" acyclic.undo",()=>xR.undo(t))}(r,n,e)),n(" updateInputGraph",()=>function(t,e){t.nodes().forEach(n=>{let r=t.node(n),i=e.node(n);r&&(r.x=i.x,r.y=i.y,r.rank=i.rank,e.children(n).length&&(r.width=i.width,r.height=i.height))}),t.edges().forEach(n=>{let r=t.edge(n),i=e.edge(n);r.points=i.points,Object.hasOwn(i,"x")&&(r.x=i.x,r.y=i.y)}),t.graph().width=e.graph().width,t.graph().height=e.graph().height}(t,r))})};let LR=["nodesep","edgesep","ranksep","marginx","marginy"],DR={ranksep:50,edgesep:20,nodesep:50,rankdir:"tb"},VR=["acyclicer","ranker","rankdir","align"],BR=["width","height","rank"],zR={width:0,height:0},FR=["minlen","weight","width","height","labeloffset"],GR={minlen:1,weight:1,width:0,height:0,labeloffset:10,labelpos:"r"},jR=["labelpos"];function UR(t,e){return NR.mapValues(NR.pick(t,e),Number)}function YR(t){var e={};return t&&Object.entries(t).forEach(([t,n])=>{"string"==typeof t&&(t=t.toLowerCase()),e[t]=n}),e}let HR=zC,WR=RC.Graph;var qR={debugOrdering:function(t){let e=HR.buildLayerMatrix(t),n=new WR({compound:!0,multigraph:!0}).setGraph({});return t.nodes().forEach(e=>{n.setNode(e,{label:e}),n.setParent(e,"layer"+t.node(e).rank)}),t.edges().forEach(t=>n.setEdge(t.v,t.w,{},t.name)),e.forEach((t,e)=>{let r="layer"+e;n.setNode(r,{rank:"same"}),t.reduce((t,e)=>(n.setEdge(t,e,{style:"invis"}),e))}),n}};var $R={graphlib:RC,layout:PR,debug:qR,util:{time:zC.time,notime:zC.notime},version:"1.1.8"};class XR extends qE{constructor(t){super(t)}run(){super.run();let t=this._outputVars[0].element,e=JE(t.parent);for(let t of e){let e=t.layout;if(!e)continue;let r=bE(t.children[0]);if(!r)continue;var n=new $R.graphlib.Graph;n.setGraph({edgesep:e._edgeSep}),n.setDefaultEdgeLabel(function(){return{}}),n.graph().rankdir=this._getDagreDirection(e.direction);let i=new Map;for(let e of t.children){let t=e.datum[xE];i.set(t,t+""),n.setNode(t,{label:e.text?e.text:"",width:e.bounds.width,height:e.bounds.height})}for(let t of r.linkList)n.setEdge(t.source,t.target);$R.layout(n);const s={};let o=d3.min(n.nodes().map(t=>n.node(t).y)),a=d3.min(n.nodes().map(t=>n.node(t).x)),l=e.left-a,c=e.top-o;for(const t of n.nodes())s[t]={x:n.node(t).x+l,y:n.node(t).y+c};for(let e of t.children){let t=e.datum[xE];GS(e,s[i.get(t)].x-e.x,s[i.get(t)].y-e.y)}}let r=cA(t,!0);for(let t of r)BE(t)}_getDagreDirection(t){switch(t){case UA.Left2Right:return"LR";case UA.Right2Left:return"RL";case UA.Top2Bottom:return"TB";case UA.Bottom2Top:return"BT"}}}class KR extends qE{constructor(t){super(t)}run(){super.run();let t=this._outputVars[0].element,e=JE(t.parent);for(let t of e){let e=t.layout;if(!e)continue;let n=yE(t.children[0]);if(!n)continue;let r=Od(n._data),i=Math.max(...t.children.map(t=>t.bounds.width)),s=Math.max(...t.children.map(t=>t.bounds.height)),o=e.orientation==zA?[e.height,e.width]:[e.width,e.height],a=wp().nodeSize([i,s]).size(o)(r);this._apply(a,e,t)}BE(t)}_apply(t,e,n){let r,i,s=n.children.filter(e=>e.datum[xE]==t.data[xE])[0];switch(e.orientation){case zA:r=t.y+e.left,i=t.x+e.top;break;case FA:r=t.x+e.left,i=e.top+t.y}if(GS(s,r-s.x,i-s.y),t.children&&t.children.length>0)for(let r of t.children)this._apply(r,e,n)}}class ZR extends qE{constructor(t){super(t)}run(){super.run();let t=this._outputVars[0].element,e=this._inputVars.filter(t=>t.type===KE.PROPERTY&&t.property===gA.CHILDREN_ORDER)[0].element,n=e.layout,r=n.width?n.width:e.bounds.width,i=n.height?n.height:e.bounds.height,s=void 0===n.top?e.bounds.top:n.top,o=void 0===n.left?e.bounds.left:n.left,a=Od(e).sum(t=>t.type===Pw.Rect?t.width*t.height:0);Cp().size([r,i])(a),this._apply(a,o,s);let l=cA(t,!0);for(let t of l)BE(t)}_apply(t,e,n){if(t.data.type==Pw.Collection&&t.children)for(let r of t.children)this._apply(r,e,n);else t.data.type==Pw.Rect&&(t.data.resize(t.x1-t.x0,t.y1-t.y0),GS(t.data,t.x0+e-t.data.left,t.y0+n-t.data.top))}}class JR extends qE{constructor(t){super(t)}run(){super.run();let t=this._outputVars[0].element,e=JE(t.parent);for(let t of e){if(!t.layout)continue;if(0===t.children.length)continue;let e=yE(t.children[0]);if(!e)continue;let n={};for(let e of t.children)n[e.datum[xE]]=e;t.children[0].type===Pw.Rect?this._layoutRects(e.getRoot(),e,n):this._layoutArcs(e.getRoot(),e,n)}BE(t)}_layoutArcs(t,e,n){let r=e.getChildren(t);if(0===r.length)return;let i=n[t[xE]],s=!i||i.type!=Pw.Arc&&i.type!=Pw.Pie?60:i.startAngle;for(let t=0;t<r.length;t++){let i=r[t],o=n[i[xE]];if(o.type===Pw.Arc){let t=rS(s+o.angle);o.setAngles(s,t),s=t}this._layoutArcs(i,e,n)}}_layoutRects(t,e,n){let r=e.getChildren(t);if(0===r.length)return;let i,s,o=n[t[xE]];this._direction,i=o.left,s=o.bottom;for(let t=0;t<r.length;t++){let o=r[t],a=n[o[xE]];GS(a,i-a.left,s-a.top),i+=a.width,this._layoutRects(o,e,n)}}}class QR extends qE{constructor(t){super(t)}run(){super.run();let t=this.outputVar;t.clearResult();let e=this.inputVars.find(t=>void 0!==t.context),n=t.conditionalEncoding,r=e?e.context:void 0,i=aA(n.responderComponent).state,s=t.result;if(n.evalFunction){n.getResponderPeers().forEach(t=>s[t.id]=!!n.evalFunction(r,i,t))}}}class tM extends qE{constructor(t){super(t)}run(){super.run();let t=this._outputVars[0].element,e=JE(t.parent);for(let t of e){let e=t.layout;if(!e)continue;let n=360/t.children.length;for(let[r,i]of t.children.entries())GS(i,e.x+e.radius-i.bounds.x,e.y-i.bounds.y),i._rotate=[r*n,e.x,e.y]}let n=cA(t,!0);for(let t of n)BE(t)}}class eM extends qE{constructor(t){super(t)}run(){super.run();let t=this._outputVars[0].element,e=JE(t.parent);for(let n of e){let e=n.layout;if(!e)continue;let r=Od(e._tree?e._tree._data:yE(n.children[0])._data);if(e.isRadial()){r=Rd().size([eS(e.angleExtent),e.radius])(r),e._d3Root=r;const t=new Map(r.descendants().map(t=>[t.data[xE],[t.x,t.y]]));for(let r of n.children){let n=r.datum[xE];GS(r,e.x-r.bounds.x,e.y-t.get(n)[1]-r.bounds.y),r._rotate=[nS(t.get(n)[0]),e.x,e.y]}}else if(e.orientation===FA){!e.width||e.width;let i=e.height?e.height:600;r=Rd().nodeSize([t.bounds.width+1,i/(r.height+1)])(r),e._d3Root=r;const s=new Map(r.descendants().map(t=>[t.data[xE],[t.x,t.y]]));let o=1/0,a=-o;r.each(t=>{t.x>a&&(a=t.x),t.x<o&&(o=t.x)}),e._x0=o;for(let t of n.children){let n=t.datum[xE];GS(t,s.get(n)[0]-o+e.left-t.bounds.x,s.get(n)[1]+e.top-t.bounds.y)}}else if(e.orientation===zA){!e.width||e.width;let i=e.height?e.height:600;r=Rd().nodeSize([t.bounds.height,i/(r.height+1)])(r),e._d3Root=r;const s=new Map(r.descendants().map(t=>[t.data[xE],[t.x,t.y]]));let o=1/0,a=-o;r.each(t=>{t.x>a&&(a=t.x),t.x<o&&(o=t.x)}),e._x0=o;for(let t of n.children){let n=t.datum[xE];GS(t,s.get(n)[1]+e.left-t.bounds.x,s.get(n)[0]-o+e.top-t.bounds.y)}}}let n=cA(t,!0);for(let t of n)BE(t)}}class nM extends XE{constructor(t,e){super(t),this._cond=e}get context(){return this._cond}}class rM extends qE{constructor(t,e,n){super(t),this._fn=e,this._compnt=n}run(){super.run();let t=this.inputVars.find(t=>t instanceof nM),e=t?t.context:void 0,n=aA(this._compnt);if(this._fn(void 0,e,n?n.state:void 0,this._compnt),n)for(let t of this._outputVars){let e=t.element||t.stateContext;e&&e._scene&&(t.type===KE.CHANNEL?n.onChange(KE.CHANNEL,t.channel,e):t.type===KE.PROPERTY?n.onChange(KE.PROPERTY,t.property,e):t.type===KE.STATE&&n.onChange(KE.STATE,t.key,t.stateContext))}}}class iM extends XE{constructor(t,e,n,r=null){super(t),this._attribute=e,this._dataset=n,this._encoding=r}get attribute(){return this._attribute}get dataset(){return this._dataset}get encoding(){return this._encoding}}class sM extends qE{constructor(t){super(t)}run(){super.run();let t=this.outputVar,e=this.inputVars.find(t=>t instanceof iM),n=t.encodings[0].dataTable.type(e.attribute),r={};for(let e of t.encodings){let t=this._computeAttrValues(e,n);Object.assign(r,t)}t.attrValues=r}_computeAttrValues(t,e){if("vertex"===t.element.type)return this._computeVertexIndexAttrValues(t,e);let n=JE(t.element),r={};if(t.element.type===Pw.Area&&["width","height","fillGradient"].indexOf(t.channel)>=0)for(let e of n)for(let n=0;n<e._vertices.length;n++)r[tA(e,n)]=e._vertices.hasDataScope(n)?e._vertices.aggregateDataScopeAttribute(n,t.attribute,t.aggregator):oE(e.dataScope,t.attribute,t.aggregator);else switch(e){case Vw.Boolean:break;case Vw.Date:for(let e of n)r[e.id]=iE(e.dataScope,t.attribute);break;case Vw.String:try{if("count"==t.aggregator)for(let e of n)r[e.id]=sE(e.dataScope,t.attribute).length;else for(let e of n)r[e.id]=iE(e.dataScope,t.attribute)}catch(e){throw new Error("Cannot bind "+this.channel+" to "+t.attribute+" : "+e)}break;default:if(t.attribute.startsWith("parent.")||t.attribute.startsWith("child.")){let e=t.dataTable.tree.nodeTable,i=t.attribute.split(".")[0],s=t.attribute.split(".")[1];for(let t of n){let n=iE(t.dataScope,i);r[t.id]=iE(aE(cE(e),xE,n),s)}}else for(let e of n)r[e.id]=oE(e.dataScope,t.attribute,t.aggregator)}return t.attrValues=r,r}_computeVertexIndexAttrValues(t,e){let n={};for(let r of t.elementGroups)for(let i of r.groups)for(let r of i.indices){n[tA(i.parent,r)]=this._computeVertexIndexValue(i.parent,r,t,e)}return t.attrValues=n,n}_getVertexIndexContext(t,e,n){let r={type:"vertex",parent:t,index:e,_index:e,id:n};return Object.defineProperty(r,"dataScope",{get:()=>t._vertices.hasDataScope(e)?t._vertices.getDataScopeRef(e):t.dataScope}),Object.defineProperty(r,"datum",{get:()=>eE(r.dataScope)}),Object.defineProperty(r,"data",{get:()=>tE(r.dataScope)}),r}_computeVertexIndexValue(t,e,n,r){if(!t._vertices.hasDataScope(e))return this._computeValue(t.dataScope,n,r);if(n.attribute.startsWith("parent.")||n.attribute.startsWith("child."))return this._computeValue(t._vertices.getDataScopeRef(e),n,r);switch(r){case Vw.Boolean:return;case Vw.Date:return t._vertices.getDataScopeAttrVal(e,n.attribute);case Vw.String:return"count"==n.aggregator?t._vertices.getDataScopeAttributeValues(e,n.attribute).length:t._vertices.getDataScopeAttrVal(e,n.attribute);default:return t._vertices.aggregateDataScopeAttribute(e,n.attribute,n.aggregator)}}_computeValue(t,e,n){switch(n){case Vw.Boolean:return;case Vw.Date:return iE(t,e.attribute);case Vw.String:return"count"==e.aggregator?sE(t,e.attribute).length:iE(t,e.attribute);default:if(e.attribute.startsWith("parent.")||e.attribute.startsWith("child.")){let n=e.dataTable.tree.nodeTable,r=e.attribute.split(".")[0],i=e.attribute.split(".")[1],s=iE(t,r);return iE(aE(cE(n),xE,s),i)}return oE(t,e.attribute,e.aggregator)}}}class oM extends XE{constructor(t,e,n){super(t),this._key=e,this._stateContext=n}get key(){return this._key}get stateContext(){return this._stateContext}}class aM{constructor(){this._variables={},this._operators={},this._edges=[]}toJSON(){const t=this._edges.map(t=>({from:t.fromNode.id,to:t.toNode.id,isDirected:t.isDirected})),e={};for(const t in this._variables)e[t]=Object.values(this._variables[t]).map(t=>{let e={id:t.id,type:t.type,incoming:t.incomingEdges.map(t=>t.id),outgoing:t.outgoingEdges.map(t=>t.id),undirected:t.undirectedEdges.map(t=>t.id)};return"ChannelVar"===t.type?(e.channel=t.channel,e.element=t.element):"BoundsVar"===t.type||"DataScopeVar"===t.type?e.element=t.element:"dataValue"===t.type?(e.scale=t.scale,e.attrValues=t.attrValues):"FieldVar"===t.type?(e.field=t.field,e.dataset=t.dataset):"PropertyVar"===t.type?(e.property=t.property,e.element=t.element):t.type===KE.STATE?e.key=t.key:e.scale=t.scale,e});const n={};for(const t in this._operators)n[t]=Object.values(this._operators[t]).map(t=>{let e={id:t.id,type:t.type,inputVars:t.inputVars.map(t=>t.id),outputVar:t.outputVar?t.outputVar.id:null};return t.type===$E.DOMAIN_BUILDER?e.aggregator=t.aggregator:t.type===$E.SCALE_BUILDER&&(e.channel=t.channel),e});return{edges:t,variables:e,operators:n}}getVariable(t,...e){if(Object.values(KE).indexOf(t)<0)throw console.log(t),new Error("Variable Type Not Known");let n=this.findVariable(t,e);if(n)return n;switch(t){case KE.CHANNEL:n=new hA(t,e[0],e[1]),"vertex"!=e[1].type&&"segment"!=e[1].type||this._connectPathElement2Size(e[1],n);break;case KE.PROPERTY:n=new dA(t,e[0],e[1]);break;case KE.STATE:n=new oM(t,e[0],e[1]);break;case KE.ATTRIBUTE:n=new iM(t,e[0],e[1],e[2]||null);break;case KE.ITEMS:n=new MT(t,e[0]);break;case KE.ATTR_VALUE:n=new hT(t,e[0]);break;case KE.DATASCOPE:n=new aT(t,e[0]);break;case KE.BOUNDS:n=new oT(t,e[0]);break;case KE.SCALE:n=new uT(t,e[0]);break;case KE.AFFIXATION:n=new LT(t,e[0]);break;case KE.ALIGNMENT:n=new UT(t,e[0]);break;case KE.EVT_CTX:n=new nM(t,e[0],e[1]);break;case KE.CONDITION_RESULT:n=new AT(t,e[0])}return t in this._variables||(this._variables[t]={}),this._variables[t][n.id]=n,n}_connectPathElement2Size(t,e){let n=t.parent,r=e.channel,i=this.findVariable(KE.CHANNEL,["x"===r?"width":"height",n]);if(i){let t=i.incomingDataflow;t||(t=this.createOneWayDependency($E.CONDUIT)),this.connect(e,t),this.connect(t,i)}}findIncomingDataflowOperator(t,e){return e.incomingDataflow&&e.incomingDataflow.type===t?e.incomingDataflow:void 0}getIncomingDataflowOperator(t,e){let n=this.findIncomingDataflowOperator(t,e);return n||this.createOneWayDependency(t)}getOutgoingDataflowOperator(t,e){for(let n of e.outgoingEdges)if(n.toNode instanceof qE&&n.toNode.type===t)return n.toNode;return this.createOneWayDependency(t)}createOneWayDependency(t,...e){if(Object.values($E).indexOf(t)<0)throw new Error("Dependency Type Not Known");let n;switch(t){case $E.EVAL_BBOX:n=new dT(t);break;case $E.AFFIXER:n=new PT(t);break;case $E.DATA_EXTRACTOR:n=new sM(t,e[0]);break;case $E.SCALE_BUILDER:n=new fT(t,e[0]);break;case $E.ENCODER:n=new ST(t,e[0]);break;case $E.AXIS_PATH_PLACER:n=new pT(t);break;case $E.AXIS_TICKS_PLACER:n=new _T(t);break;case $E.AXIS_LABELS_PLACER:n=new gT(t);break;case $E.AXIS_TITLE_PLACER:n=new GT(t);break;case $E.LINK_PLACER:n=new HT(t);break;case $E.GRID_LAYOUT:n=new mT(t);break;case $E.STACK_LAYOUT:n=new CT(t);break;case $E.PACK_LAYOUT:n=new FT(t);break;case $E.FORCE_LAYOUT:n=new YT(t);break;case $E.DIRECTED_LAYOUT:n=new XR(t);break;case $E.TIDY_TREE_LAYOUT:n=new KR(t);break;case $E.TREEMAP_LAYOUT:n=new ZR(t);break;case $E.STRATA_LAYOUT:n=new JR(t);break;case $E.CIRCULAR_LAYOUT:n=new tM(t);break;case $E.CLUSTER_LAYOUT:n=new eM(t);break;case $E.GRIDLINES_PLACER:n=new TT(t);break;case $E.BIN_TRANSFORMER:n=new RT(t);break;case $E.FILTER_TRANSFORMER:n=new OT(t);break;case $E.KDE_TRANSFORMER:n=new DT(t);break;case $E.CUSTOM_TRANSFORMER:n=new zT(t);break;case $E.REPOPULATE:n=new IT(t);break;case $E.TARGET_EVALUATOR:n=new QR(t);break;case $E.TARGET_UPDATER:n=new rM(t,e[0],e[1]);break;case $E.CONDUIT:default:n=new kT(t)}return t in this._operators||(this._operators[t]={}),this._operators[t][n.id]=n,n}createMultiWayDependency(t){if(Object.values($E).indexOf(t)<0)throw new Error("Dependency Type Not Known");let e;return $E.ALIGNER,e=new jT(t),t in this._operators||(this._operators[t]={}),this._operators[t][e.id]=e,e}connect(t,e,n=!0){if(t instanceof XE&&e instanceof qE){if(!e.inputVars.includes(t)){const r=new cT(t,e,n);return this._edges.push(r),t.outgoingEdges.push(r),e.inputVars.push(t),r}}else if(t instanceof qE&&e instanceof XE){if(!t.outputVars.includes(e)){const r=new cT(t,e,n);return this._edges.push(r),t.outputVars.push(e),e.incomingEdges.push(r),r}}else if(t instanceof XE&&e instanceof lT){if(!e.vars.includes(t)){const n=new cT(t,e,!1);return this._edges.push(n),e.vars.push(t),e.edges.push(t),t.undirectedEdges.push(n),n}}else{if(!(t instanceof lT&&e instanceof XE))throw new Error("An edge must connect a variable and an operator.");if(!t.vars.includes(e)){const n=new cT(e,t,!1);return this._edges.push(n),t.vars.push(e),t.edges.push(e),e.undirectedEdges.push(n),n}}}disconnectChannelVarFromBBoxOperator(t){let e=this.getOutgoingDataflowOperator($E.EVAL_BBOX,t),n=t.outgoingEdges.find(n=>n.fromNode===t&&n.toNode===e);n&&this.disconnect(t,e,n)}disconnect(t,e,n){if(t instanceof XE&&e instanceof qE){let r=t.outgoingEdges.findIndex(t=>t===n);r>=0&&(this._edges.splice(this._edges.indexOf(n),1),t.outgoingEdges.splice(r,1));let i=e.inputVars.findIndex(e=>e==t);i>=0&&e.inputVars.splice(i,1)}else if(t instanceof qE&&e instanceof XE){let r=e.incomingEdges.findIndex(t=>t===n);r>=0&&(this._edges.splice(this._edges.indexOf(n),1),e.incomingEdges.splice(r,1));let i=t.outputVars.findIndex(t=>t===e);i>=0&&t.outputVars.splice(i,1)}}deleteVariable(t){for(let e=t.incomingEdges.length-1;e>=0;e--){let n=t.incomingEdges[e],r=n.fromNode;this.disconnect(r,t,n),r.isIsolated()&&delete this._operators[r.type][r.id]}for(let e=t.outgoingEdges.length-1;e>=0;e--){let n=t.outgoingEdges[e],r=n.toNode;this.disconnect(t,r,n),r.isIsolated()&&delete this._operators[r.type][r.id]}delete this._variables[t.type][t.id]}deleteOperator(t){for(let e=t.outputVars.length-1;e>=0;e--){let n=t.outputVars[e],r=n.incomingEdges.find(e=>e.fromNode===t&&e.toNode===n);this.disconnect(t,n,r),n.isIsolated()&&delete this._variables[n.type][n.id]}for(let e=t.inputVars.length-1;e>=0;e--){let n=t.inputVars[e],r=n.outgoingEdges.find(e=>e.fromNode===n&&e.toNode===t);this.disconnect(n,t,r),n.isIsolated()&&delete this._variables[n.type][n.id]}delete this._operators[t.type][t.id]}addInteraction(t){}_dfs(t,e,n){if(t&&0!==t.outgoingEdges.length)for(let r of t.outgoingEdges)r.isDirected&&(e.push(r.toNode),this._dfs(r.toNode.outputVars[0],e.slice(),n));else n.push(e)}getOperatorsOnPath(t,e,n,...r){let i=this.findVariable(t,r);if(i){for(let t of i.outgoingEdges)if(t.isDirected){let r=t.toNode,i=e.indexOf(r);-1!==i&&e.splice(i,1),e.push(r);for(let t of r.outputVars)switch(t.type){case KE.ITEMS:this.getOperatorsOnPath(t.type,e,n,t.dataset);break;case KE.ATTRIBUTE:this.getOperatorsOnPath(t.type,e,n,t.attribute,t.dataset);break;case KE.DATASCOPE:case KE.BOUNDS:this.getOperatorsOnPath(t.type,e,n,t.element);break;case KE.CHANNEL:this.getOperatorsOnPath(t.type,e,n,t.channel,t.element);break;case KE.PROPERTY:this.getOperatorsOnPath(t.type,e,n,t.property,t.element);break;case KE.STATE:this.getOperatorsOnPath(t.type,e,n,t.key,t.stateContext);break;case KE.SCALE:case KE.ATTR_VALUE:this.getOperatorsOnPath(t.type,e,n,t.encodings[0]);break;case KE.CONDITION_RESULT:this.getOperatorsOnPath(t.type,e,n,t.conditionalEncoding)}}for(let t of i.undirectedEdges)n.push(t.operator)}else console.warn("Unable to find variables matching the described change: ",t,r)}findVariable(t,e){if(!(t in this._variables))return null;let n=Object.values(this._variables[t]);switch(t){case KE.CHANNEL:return n.find(t=>t.channel==e[0]&&PS(t.element)==PS(e[1]));case KE.PROPERTY:return n.find(t=>t.property==e[0]&&t.element==e[1]);case KE.STATE:return n.find(t=>t.key==e[0]&&t.stateContext==e[1]);case KE.AFFIXATION:return n.find(t=>t.affixation==e[0]);case KE.ATTRIBUTE:return e[2]?n.find(t=>t.attribute==e[0]&&t.dataset==e[1]&&t.encoding===e[2]):n.find(t=>t.attribute==e[0]&&t.dataset==e[1]&&!t.encoding);case KE.ITEMS:return n.find(t=>t.dataset==e[0]);case KE.ATTR_VALUE:case KE.SCALE:return n.find(t=>t.encodings.includes(e[0]));case KE.EVT_CTX:return n.find(t=>t.context===e[0]);case KE.CONDITION_RESULT:return n.find(t=>t.conditionalEncoding==e[0]);case KE.DATASCOPE:default:return e[0].classId?n.find(t=>PS(t.element)==PS(e[0])):n.find(t=>t.element.id==e[0].id)}}findVariablesByElement(t){let e={};for(let n in this._variables){let r=Object.values(this._variables[n]).filter(e=>e.element&&PS(e.element)==PS(t));r.length>0&&(e[n]=r)}return e}}class lM{constructor(t={}){this._attribute=t.attribute??null,this._numBins=t.numBins??null}get attribute(){return this._attribute}set attribute(t){this._attribute=t}get numBins(){return this._numBins}set numBins(t){this._numBins=t}get startAttr(){return this._attribute+"_bin_start"}get endAttr(){return this._attribute+"_bin_end"}get binIdAttr(){return this._attribute+"_bin_id"}}class cM{constructor(t={}){this._attribute=t.attribute??null,this._newAttribute=t.newAttribute??null,this._groupBy=t.groupBy??null,this._min=t.min??null,this._max=t.max??null,this._interval=t.interval??null,this._bandwidth=t.bandwidth??null}get attribute(){return this._attribute}set attribute(t){this._attribute=t}get newAttribute(){return this._newAttribute}set newAttribute(t){this._newAttribute=t}get groupBy(){return this._groupBy}set groupBy(t){this._groupBy=t}get min(){return this._min}set min(t){this._min=t}get max(){return this._max}set max(t){this._max=t}get interval(){return this._interval}set interval(t){this._interval=t}get bandwidth(){return this._bandwidth}set bandwidth(t){this._bandwidth=t}}class uM{constructor(t={}){this._attribute=t.attribute??null,this._type=t.type??null,this._value=t.value??null}get attribute(){return this._attribute}set attribute(t){this._attribute=t}get type(){return this._type}set type(t){this._type=t}get value(){return this._value}set value(t){this._value=t}}class hM{constructor(t,e){this._fn=t,e&&Object.assign(this,e)}get fn(){return this._fn}}function fM(t){return t&&"vertexIndices"===t.type?Array.from(new Set(t.groups.map(t=>t.parent))):t}class dM extends PA{constructor(t){super(),this._itemMap={},this._type=Pw.Scene,this._id=t&&t.id?t.id:this._type+Dw(),t&&t.fillColor&&(this.fillColor=t.fillColor),this._encodings={},this._relations=[],this._triggers={},this._condEncodings={},this._stateContext=new ZE(this),this._stateContext.__scene__=this,this._depGraph=new aM,this._renderers=[]}get depGraph(){return this._depGraph}get interactionTriggers(){return this._triggers}getConditionalEncodings(t){return this._condEncodings[t]||[]}_clearInteractionCaches(){for(let t in this._condEncodings)for(let e of this._condEncodings[t])e.clearResponderPeers()}get state(){return this._stateContext}mark(t,e){if(Object.values(Iw).indexOf(t)<0)throw new Error("Mascot does not allow directly creating a "+t);let n=void 0===e?{}:e;n.type=t;let r=nT(this,n);return null!==r&&(r._classId=r.id,this.addChild(r),this._itemMap[r.id]=r,mA(r,this._depGraph),EA(this,r,this._depGraph)),r}glyph(...t){let e=[];for(let n of t)e.push([n.parent,n]);let n=nT(this,{type:Pw.Glyph,children:t});if(null!==n){n._classId=n.id;for(let t of e)wA(t[0],t[1],this._depGraph);AA(n,this._depGraph),EA(this,n,this._depGraph)}return n}composite(){let t=nT(this,{type:Pw.Composite});return null!==t&&(t._classId=t.id,this.addChild(t),this._itemMap[t.id]=t,xA(t,this._depGraph),EA(this,t,this._depGraph)),t}_addAttributeEncoding(t){let e=PS(t.element);e in this._encodings||(this._encodings[e]={}),this._encodings[e][t.channel]=t}get tables(){let t={},e=this.children.filter(t=>t.type===Pw.Collection);for(let n of e){let e=n.dataScope?Jw(n.dataScope):null;e&&!(e.id in t)&&(t[e.id]=e)}return t}onChange(t,...e){if(Object.values(KE).indexOf(t)<0)throw new Error("Unknown Variable Type: "+t);let n=[],r=[],i=[];this._depGraph.getOperatorsOnPath(t,n,r,...e);let s=!1;for(let t of n)t.run(),t.needsFullRender&&(s=!0),i=i.concat(t.outputVars.filter(t=>t.type===KE.CHANNEL||t.type===KE.PROPERTY));for(let t of r)t.run();const o={};for(let t of i){let e="vertex"===t.element.type||"segment"===t.element.type?t.element.parent:t.element;e.id in o||(o[e.id]=[]);let n=t.channel||t.property;o[e.id].includes(n)||o[e.id].push(n)}if(s){for(const t of this._renderers)t._render(this);for(const t of this._renderers)t._renderChanges(this,o)}else for(const t of this._renderers)t._renderChanges(this,o);return o}gridlines(t,e,n){let r=n||{},i="rowId"==e?_E:e,s=r.element?IS(r.element,t):NS(i,t,this);if(s){s.attribute!==i&&console.warn("Cannot create a "+t+" axis for "+e);let n=[];if("x"==t)for(let t of s.scales)n.push({scale:t,elems:fM(s.getElements(t))});else if("width"==t){let t=lA(s.element),e=s.scales[0];if(t.layout&&t.layout.type==HE.GRID&&t.layout.numCols>1){let r=t.layout.getElementsByCol(!0);for(let t of r)n.push({scale:e,elems:t})}else n.push({scale:s.scales[0],elems:fM(s.getElements(s.scales[0]))})}else if("y"==t){let t=lA(s.element);if(t.layout&&t.layout.type==HE.GRID&&t.layout.numRows>1){let e=t.layout.getElementsByRow(!0,s.element);for(let t of e)n.push({scale:s.getScale(t[0]),elems:t})}else n.push({scale:s.scales[0],elems:fM(s.getElements(s.scales[0]))})}else if("height"==t){let t=lA(s.element),e=s.scales[0];if(t.layout&&t.layout.type==HE.GRID&&t.layout.numRows>1){let r=t.layout.getElementsByRow(!0,s.element);for(let t of r)n.push({scale:e,elems:t})}else n.push({scale:e,elems:fM(s.getElements(e))})}else if("radialDistance"==t){let t=r.element?r.element:s.element;n.push({scale:s.scales[0],elems:JE(t,t.parent)})}for(let t of n){let e=new BS(s.channel,s.attribute,t.scale,t.elems,r);this.addChild(e),this._itemMap[e.id]=e,s.addRefElement(e),IA(e,this._depGraph),EA(this,e,this._depGraph)}}else{let n=r.element?r.element:iA(this,e);if(!n)return void console.warn("Cannot create "+t+" gridlines for "+e);let i=sA(n.parent);if(!i.layout)return void console.warn("Cannot create "+t+" gridlines for "+e);let s=JE(i);for(let n of s){let i=[];n.layout.type==HE.GRID&&n.layout.numRows>1&&"x"==t?i=n.layout.getElementsByRow():n.layout.type==HE.GRID&&n.layout.numCols>1&&"y"==t?i=n.layout.getElementsByCol():i.push(n.children);for(let s of i){let i=new BS(t,e,null,s,r);this.addChild(i),this._itemMap[i.id]=i,n.layout.addRefElement(i),IA(i,this._depGraph),EA(this,i,this._depGraph)}}}}axis(t,e,n){let r=n||{},i="rowId"==e?_E:e,s=[],o=r.element?IS(r.element,t):NS(i,t,this);if(o){o.attribute!==i&&console.warn("Cannot create a "+t+" axis for "+i);let e=[];if("x"==t||"width"==t){let t=lA(r.element?r.element:o.element);if(t.layout&&t.layout.type==HE.GRID&&t.layout.numCols>1){let n=t.layout.getElementsByCell(!0,o.element);for(let t of n)e.push({scale:o.getScale(t[0]),elems:t})}else e.push({scale:o.scales[0],elems:fM(o.getElements(o.scales[0]))})}else if("y"==t||"height"==t){let t=lA(r.element?r.element:o.element);if(t.layout&&t.layout.type==HE.GRID&&t.layout.numRows>1){let n=t.layout.getElementsByCell(!0,o.element);for(let t of n)e.push({scale:o.getScale(t[0]),elems:t})}else e.push({scale:o.scales[0],elems:fM(o.getElements(o.scales[0]))})}else if("radialDistance"==t){let t=r.element?r.element:o.element;e.push({scale:o.scales[0],elems:JE(t,t.parent)})}for(let t of e){let e=Object.assign({},r);e.scale=t.scale,e.elems=t.elems,e.type="axis",e.axisType="encoding",e.enc=o,e.rawArgs=r;let n=nT(this,e);s.push(n),o.addRefElement(n),NA(n,this._depGraph),EA(this,n,this._depGraph),this.onChange(KE.PROPERTY,gA.AXIS_PATH_POSITION,n)}}else{let e=r.element?r.element:iA(this,i);if(!e)return void console.warn("Cannot create a "+t+" axis for "+i);let n=sA(e.parent);if(!n.layout)return void console.warn("Cannot create a "+t+" axis for "+i);let o=JE(n);for(let e of o){let n=[];e.layout.type==HE.GRID&&e.layout.numRows>1&&"x"==t?n=e.layout.getElementsByRow():e.layout.type==HE.GRID&&e.layout.numCols>1&&"y"==t?n=e.layout.getElementsByCol():n.push(e.children);for(let o of n){let n=Object.assign({},r);n.elems=o.slice(),n.type="axis",n.axisType="layout",n.channel=t,n.attribute=i;let a=nT(this,n);s.push(a),e.layout.addRefElement(a),OA(a,this._depGraph),EA(this,a,this._depGraph),this.onChange(KE.PROPERTY,gA.AXIS_PATH_POSITION,a)}}}return s.length>1?s:s[0]}legend(t,e,n){let r=n||{},i="rowId"==e?_E:e,s=r.element?IS(r.element,t):NS(i,t,this);if(s){s.attribute!==e&&console.warn("Cannot create a "+t+" legend for "+e);let n=pE(s.element).type(e);r.type="legend",r.enc=s,r.attrType=n;let i=nT(this,r);!function(t,e){let n=e.getVariable(KE.BOUNDS,t),r=e.getVariable(KE.PROPERTY,gA.LEGEND_POSITION,t),i=e.getIncomingDataflowOperator($E.EVAL_BBOX,n);e.connect(r,i),e.connect(i,n)}(i,this._depGraph),EA(this,i,this._depGraph),BE(i),this.onChange(KE.PROPERTY,gA.LEGEND_POSITION,i)}else console.warn("Cannot create a "+t+" legend for "+i)}mask(t){let e=lA(t),n=e||t;n.clipMask||n.createClipMask()}setLayout(t,e){if(t.layout&&(TA(t,t.layout,this._depGraph),e.type===HE.TREEMAP)){let e=t.firstChild;for(;e&&e.type===Pw.Collection&&e.layout;)TA(e,e.layout,this._depGraph),e=e.firstChild}if(JE(t).forEach(t=>{let n=e?e.clone():e;t._layout=n,n&&(n.group=t)}),CA(t,e,this._depGraph),t.children&&t.children.length>0){let e=cA(t,!0);for(let t of e)this.onChange(KE.CHANNEL,"x",t)}}derive(t,e){let n=t.clone();return e._scene=this,e instanceof lM?(!function(t,e,n,r){let i=r.getVariable(KE.ITEMS,e),s=r.getVariable(KE.ITEMS,n),o=r.createOneWayDependency($E.BIN_TRANSFORMER);r.connect(i,o),r.connect(o,s);let a=r.getVariable(KE.PROPERTY,gA.NUM_BINS,t);r.connect(a,o),o._binConfig=t,o.run()}(e,t,n,this._depGraph),n._binTransform=e):e instanceof cM?function(t,e,n,r){let i=r.getVariable(KE.ATTRIBUTE,t.attribute,e),s=r.getVariable(KE.ATTRIBUTE,t.newAttribute,n),o=r.getVariable(KE.ITEMS,n),a=r.createOneWayDependency($E.KDE_TRANSFORMER);a.args=t,r.connect(i,a),r.connect(a,s),r.connect(a,o),a.run()}(e,t,n,this._depGraph):e instanceof uM?function(t,e,n,r){let i=r.getVariable(KE.ITEMS,e),s=r.getVariable(KE.ITEMS,n),o=r.createOneWayDependency($E.FILTER_TRANSFORMER);o._spec=t,r.connect(i,o),r.connect(o,s);let a=r.getVariable(KE.PROPERTY,"value",t);r.connect(a,o),o.run()}(e,t,n,this._depGraph):e instanceof hM&&function(t,e,n,r){let i=r.getVariable(KE.ITEMS,e),s=r.getVariable(KE.ITEMS,n),o=r.createOneWayDependency($E.CUSTOM_TRANSFORMER);o._spec=t,r.connect(i,o),r.connect(o,s);for(let e of Object.keys(t)){if(e.startsWith("_"))continue;let n=r.getVariable(KE.PROPERTY,e,t);r.connect(n,o)}o.run()}(e,t,n,this._depGraph),n}getElement(t){return this._itemMap[t]}getAxis(t,e){return NS(t,e,this).refElements[0]}}function pM(t,e){return Xw(e[t.dt],t.attr2value||t.filters||{},t.rowIds)}class _M extends UE{constructor(t){super(),this.type=HE.DIRECTED,this._width="width"in t?t.width:500,this._height="height"in t?t.height:300,this._top="top"in t?t.top:0,this._left="left"in t?t.left:0,this._edgeSep="edgeSep"in t?t.edgeSep:50,this._spreadLinks=!("spreadLinks"in t)||t.spreadLinks,this._direction="direction"in t?t.direction:UA.Top2Bottom}clone(){return new _M({width:this._width,height:this._height,top:this._top,left:this._left,edgeSep:this._edgeSep,spreadLinks:this._spreadLinks,direction:this._direction})}get width(){return this._width}get height(){return this._height}get top(){return this._top}get left(){return this._left}get edgeSep(){return this._edgeSep}get spreadLinks(){return this._spreadLinks}get direction(){return this._direction}}class gM extends UE{constructor(t){super(),this.type=HE.FORCE,this._x="x"in t?t.x:0,this._y="y"in t?t.y:0,this._iterations="iterations"in t?t.iterations:1,this._repulsion="repulsion"in t?t.repulsion:30,this._attraction="attraction"in t?t.attraction:1,this._linkDistance="linkDistance"in t?t.linkDistance:30}clone(){return new gM({x:this._x,y:this._y,iterations:this._iterations,repulsion:this._repulsion,attraction:this._attraction,linkDistance:this._linkDistance})}}class yM extends UE{constructor(t){super(),this.type=HE.PACKING,this._x="x"in t?t.x:400,this._y="y"in t?t.y:400,this._width=t.width,this._height=t.height}clone(){return new yM({x:this._x,y:this._y,width:this._width,height:this._height})}}class mM extends UE{constructor(t){super(),this.type=HE.STACK,this._orientation=t.orientation,this._direction=t.direction,this._left=t.left,this._top=t.top,this._horzCellAlignment="horzCellAlignment"in t&&t.horzCellAlignment?t.horzCellAlignment:zE.LEFT,this._vertCellAlignment="vertCellAlignment"in t&&t.vertCellAlignment?t.vertCellAlignment:zE.BOTTOM,this._gap="gap"in t?t.gap:0}clone(){let t=new mM({orientation:this._orientation,direction:this._direction,left:this._left,top:this._top});return t._horzCellAlignment=this._horzCellAlignment,t._vertCellAlignment=this._vertCellAlignment,t}get horzCellAlignment(){return this._horzCellAlignment}get vertCellAlignment(){return this._vertCellAlignment}get orientation(){return this._orientation}set horzCellAlignment(t){this._horzCellAlignment=t}set vertCellAlignment(t){this._vertCellAlignment=t}set orientation(t){this._orientation=t}}class bM extends UE{constructor(t){super(),this.type=HE.STRATA,this._direction=t.direction,this._gap="gap"in t?t.gap:0}clone(){return new bM({direction:this._direction,gap:this._gap})}}class vM extends UE{constructor(t){super(),this.type=HE.TIDYTREE,this._width="width"in t?t.width:500,this._height="height"in t?t.height:500,this._left="left"in t?t.left:100,this._top="top"in t?t.top:100,this._orientation="orientation"in t?t.orientation:zA}get width(){return this._width}get height(){return this._height}get top(){return this._top}get left(){return this._left}get orientation(){return this._orientation}clone(){return new vM({width:this._width,height:this._height,top:this._top,left:this._left,orientation:this._orientation})}}class xM extends UE{constructor(t){super(),this.type=HE.TREEMAP,this._width=t.width,this._height=t.height,this._left=t.left,this._top=t.top}get width(){return this._width}get height(){return this._height}get top(){return this._top}get left(){return this._left}clone(){return new xM({width:this._width,height:this._height,top:this._top,left:this._left})}}function wM(t){switch(t.type){case HE.GRID:return function(t){let e=new KS(t.args);"left"in t&&(e._left=t.left);"top"in t&&(e._top=t.top);"cellBounds"in t&&(e._cellBounds=t.cellBounds.map(t=>EM(t)));"grid"in t&&(e._grid=t.grid);return e}(t);case HE.STACK:return function(t){let e=new mM(t.args);return e}(t);case HE.PACKING:return function(t){let e=new yM(t.args);return e}(t);case HE.FORCE:return function(t){return new gM(t.args)}(t);case HE.DIRECTED:return function(t){return new _M(t.args)}(t);case HE.TIDYTREE:return function(t){return new vM(t.args)}(t);case HE.TREEMAP:return function(t){return new xM(t.args)}(t);case HE.STRATA:return function(t){return new bM(t.args)}(t);default:return void console.warn("unsupported layout type for deserialization:",t.type)}}function EM(t){return new PE(t.x-t.width/2,t.y-t.height/2,t.width,t.height)}function AM(t,e,n){t.type===Pw.Pie&&(t.type=Pw.Arc),t.args.type=t.type;let r=nT(e,t.args);return t.id&&(r._id=t.id),t.classId&&(r._classId=t.classId),t.dataScope&&(r.dataScope=pM(t.dataScope,n)),t.bounds&&(r._bounds=EM(t.bounds)),t.refBounds&&(r._refBounds=EM(t.refBounds)),function(t,e,n,r){if(t.vertices){const n=[];for(let e of t.vertices){const t=SM(e,r);n.push(t)}e.vertices=n}e.vertexCounter=t.vertexCounter,e.segmentCounter=t.segmentCounter,e.curveMode=t.curveMode}(t,r,0,n),r}function SM(t,e){let n={type:"vertex",id:t.id,x:t.x,y:t.y,shape:t.shape,width:t.width,height:t.height,radius:t.radius,fillColor:t.fillColor,opacity:t.opacity,strokeWidth:t.strokeWidth,strokeColor:t.strokeColor};return t.dataScope&&(n.dataScope=pM(t.dataScope,e)),"polarAngle"in t&&(n.polarAngle=t.polarAngle),n}function TM(t){let e={};e.fillColor=t.fillColor;let n=new dM(e);console.log("======== deserialization =========");let r={};if(t.tables)for(let e in t.tables){let n=t.tables[e];r[e]=new fE(n.data,n.url,n.attributeTypes),r[e]._id=n.id}let i={};if(t.scales)for(let e in t.scales)i[e]=MM(t.scales[e]);if(n.scales=i,RM(t,n,n,r),kM(t,n),t.encodings){let e={};for(let i of t.encodings){let t=OM(i,n,r);e[t.id]=t}for(let t in e){n._addAttributeEncoding(e[t]);let r=e[t]._baseEnc?e[e[t]._baseEnc]:void 0;MA(e[t],n._depGraph,r),r?n.onChange(KE.ATTR_VALUE,e[t]):n.onChange(KE.CHANNEL,e[t].channel,e[t].element)}}if(t.axes)for(let e of t.axes){let t=e.args?e.args:{};t.tickValues&&Object.values(r)[0].type(e.attr)===Vw.Date&&(t.tickValues=t.tickValues.map(t=>new Date(new Date(t).toISOString()))),e.id&&(t.id=e.id),n.axis(e.channel,e.attr,t)}if(t.gridlines)for(let e of t.gridlines)n.gridlines(e.channel,e.attr,e.args);return t.bounds&&(n._bounds=EM(t.bounds)),delete n.scales,n}function CM(t,e,n,r){if(t.type===Pw.Collection){let i=nT(n,{type:Pw.Collection,id:t.id});t.classId&&(i._classId=t.classId),e.addChild(i),vA(i,n._depGraph),EA(e,i,n._depGraph),RM(t,i,n,r)}else if(t.type===Pw.Glyph){let i=nT(n,{type:Pw.Glyph,id:t.id});t.classId&&(i._classId=t.classId),e.addChild(i),AA(i,n._depGraph),EA(e,i,n._depGraph),RM(t,i,n,r)}else if(t.type===Pw.Composite){let i=nT(n,{type:Pw.Composite,id:t.id});e.addChild(i),n._itemMap[i.id]=i,xA(i,n._depGraph),EA(e,i,n._depGraph),RM(t,i,n,r),i._bounds=EM(t.bounds)}else if(t.type===Pw.Axis){let i=new xS({});e.addChild(i),function(t,e,n,r){t.id&&(e._id=t.id);if(e._children=[],t.labels){let i=new PA;RM(t.labels,i,n,r),e._labels=i,e._children.push(i)}t.path&&(e._path=CM(t.path,e,n,r));if(t.ticks){let i=new PA;RM(t.ticks,i,n,r),e._ticks=i,e._children.push(i)}t.title&&(e._title=CM(t.title,e,n,r))}(t,i,n,r),n._itemMap[i.id]=i}else if(Object.values(jE).includes(t.type)){let i=AM(t,n,r);return n._itemMap[i.id]=i,e.addChild(i),mA(i,n._depGraph),EA(e,i,n._depGraph),i}}function kM(t,e,n){if(t.children)for(let n of t.children)kM(n,e);else if(Object.values(jE).includes(t.type)){let n=e._itemMap[t.id];t.links&&(n.links=t.links.map(t=>e._itemMap[t])),t.source&&(n.source=e._itemMap[t.source]),t.target&&(n.target=e._itemMap[t.target])}}function RM(t,e,n,r){if(t.id&&(e._id=t.id),t.classId&&(e._classId=t.classId),t.dataScope&&(e.dataScope=pM(t.dataScope,r)),t.bounds&&(e._bounds=EM(t.bounds)),e._sortBy=t.sortBy,t.children)for(let i of t.children)CM(i,e,n,r);t.layout&&(e._layout=wM(t.layout),e._layout.group=e,CA(e,e._layout,n._depGraph))}function MM(t){let e=new TS(t.type,t.args);return e._id=t.id,e.domain=t.domain,e.range=t.range,e}function OM(t,e,n){let r=NM(t.element,t.elementType,e);r||console.warn("element not created:",t.element,t.elementType);let i=t.args?t.args:{};t.table&&(i.table=n[t.table]);let s=new zS(r,t.channel,t.attr,t.aggregator?t.aggregator:"sum",i);if(s._id=t.id,t.scales&&(s._scales=t.scales.map(t=>e.scales[t])),i.baseEnc&&(s._baseEnc=t.args.baseEnc),t.elemGroups&&(s._elemGroups=t.elemGroups.map(t=>t.map(t=>NM(t,r.type,e)))),t.elem2scale){s._elem2scale={};for(let n in t.elem2scale)s._elem2scale[n]=e.scales[t.elem2scale[n]]}return i.startAngle&&(s.startAngle=i.startAngle),s}function NM(t,e,n){if("vertex"===e){let e=t.split("_v_");return n._itemMap[e[0]].vertices.find(e=>e.id===t)}if("segment"===e){let e=t.split("_s_");return n._itemMap[e[0]].segments.find(t=>t._id===parseInt(e[1]))}return n._itemMap[t]}function IM(t){let e={};return e.id=t._id,e.data=t._rawData,e.attributeTypes=t._attrTypes,e.url=t.url,e}function PM(t){let e={};return e.dt=t.dataTable.id,e.attr2value=Object.assign({},t.filters),t.rowIds&&(e.rowIds=t.rowIds.slice()),e}function LM(t,e){e.vertices=[];for(let n=0;n<t._vertices.length;n++)e.vertices.push(DM(t._vertices,n));e.vertexCounter=t.vertexCounter,e.segmentCounter=t.segmentCounter,e.curveMode=t.curveMode}function DM(t,e){let n={type:"vertex"};return n.id=t._ids[e],n.x=t._xs[e],n.y=t._ys[e],t.hasDataScope(e)&&(n.dataScope=PM(t.getDataScopeRef(e))),void 0!==t._polarAngles[e]&&(n.polarAngle=t._polarAngles[e]),n.shape=t._shapes[e],n.width=t._widths[e],n.height=t._heights[e],n.radius=t._radii[e],n.fillColor=t._fillColors[e],n.opacity=t._opacities[e],n.strokeWidth=t._strokeWidths[e],n.strokeColor=t._strokeColors[e],n}function VM(t){return t.type===Pw.Scene?function(t){let e=FM(t,{});e.fillColor=t.fillColor,e.scales={},e.encodings=[];for(let n in t._encodings)for(let r in t._encodings[n]){let i=t._encodings[n][r];i._forLegend||e.encodings.push(zM(i));for(let t of i._scales)t.id in e.scales||(e.scales[t.id]=BM(t))}e.tables={};let n=function(t){let e={};for(let n in t._encodings)for(let r in t._encodings[n]){let i=t._encodings[n][r];i.dataTable.id in e||i._forLegend||(e[i.dataTable.id]=i.dataTable)}for(let n of t.children)if(![Pw.Axis,Pw.Legend,Pw.Gridlines].includes(n.type)){if(n.dataScope){let t=Jw(n.dataScope);e[t.id]=t;break}if(n.children&&n.children.length>0){let t=n.firstChild;for(;t;){if(t.dataScope){let n=Jw(t.dataScope);e[n.id]=n;break}t=t.children&&t.children.length>0?t.firstChild:void 0}}}return e}(t);for(let t in n)e.tables[t]=IM(n[t]);return console.log("======== serialization ========="),console.log(e),e}(t):[Pw.Collection,Pw.Glyph,Pw.Composite].includes(t.type)?FM(t,{}):t instanceof xS?GM(t,{}):t instanceof FE?function(t){let e={args:{}};e.type=t.type,e.id=t.id,t.classId&&(e.classId=t.classId),t.dataScope&&(e.dataScope=PM(t.dataScope)),t.bounds&&(e.bounds=t.bounds.toJSON()),t.refBounds&&(e.refBounds=t.refBounds.toJSON()),t.links&&(e.links=t.links.map(t=>t.id)),t.source&&(e.source=t.source.id),t.target&&(e.target=t.target.id);for(let n in t.styles)n.indexOf("Color")>0&&t.styles[n]instanceof mS?e.args[n]=t.styles[n].toJSON():e.args[n]=t.styles[n];switch(t.type){case Pw.Arc:case Pw.Pie:!function(t,e){e.args.x=t._x,e.args.y=t._y,e.args.innerRadius=t._innerRadius,e.args.outerRadius=t._outerRadius,e.args.startAngle=t._startAngle,e.args.endAngle=t._endAngle,e.args.direction=t._direction,e.args.thickness=t._thickness}(t,e),LM(t,e);break;case Pw.Area:!function(t,e){e.args.baseline=t._baseline,e.args.orientation=t._orientation}(t,e),LM(t,e);break;case Pw.Circle:!function(t,e){e.args.x=t.x,e.args.y=t.y,e.args.radius=t.radius}(t,e);break;case Pw.Image:break;case Pw.Line:case Pw.Path:case Pw.BezierCurve:LM(t,e);break;case Pw.SimpleText:!function(t,e){e.args.x=t._x,e.args.y=t._y,e.args.text=t._text,e.args.anchor=t._anchor,t._backgroundColor&&(e.args.backgroundColor=t._backgroundColor),t._borderWidth&&(e.args.borderWidth=t._borderWidth),t._borderColor&&(e.args.borderColor=t._borderColor)}(t,e);break;case Pw.Polygon:!function(t,e){e.args.x=t._x,e.args.y=t._y,e.args.radius=t._radius}(t,e),LM(t,e);break;case Pw.Rect:!function(t,e){e.args.width=t.width,e.args.height=t.height,e.args.top=t.top,e.args.left=t.left}(t,e),LM(t,e);case Pw.Ring:}return e}(t):(console.warn("unsupported serialization",t.type),{type:t.type})}function BM(t){let e={};return e.type=t.type,e.id=t.id,t._args&&(e.args=t._args),e.domain=t.domain,e.range=t.range,e}function zM(t){let e={};e.id=t._id,e.element=t._elem.id,e.elementType=t._elem.type,e.channel=t._channel,e.attr=t._attribute,e.aggregator=t._aggregator,e.table=t._table.id,e.args={},e.args.includeZero=t._includeZero,e.args.flipScale=t._flipScale,e.args.mapping=t._mapping,e.args.rangeExtent=t._preferredRangeExtent,e.args.domain=t._preferredDomain,e.args.scaleType=t._scaleType,e.args.scheme=t._colorScheme,t._baseEnc&&(e.args.baseEnc=t._baseEnc.id),e.scales=t._scales.map(t=>t.id),e.elemGroups=t._elemGroups.map(t=>t.map(t=>t.id)),e.elem2scale={};for(let n in t._elem2scale)e.elem2scale[n]=t._elem2scale[n].id;return"angle"==t.channel&&(e.args.startAngle=t.startAngle),e}function FM(t,e){if(e.id=t.id,e.type=t.type,t.classId&&(e.classId=t.classId),t.dataScope&&(e.dataScope=PM(t.dataScope)),e.bounds=t.bounds.toJSON(),t._layout&&(e.layout=function(t){switch(t.type){case HE.GRID:return function(t){let e={args:{}};return e.type=t.type,e.args.numCols=t._numCols,e.args.numRows=t._numRows,e.args.start=t._start,e.args.direction=t._direction,e.args.colGap=t._colGap,e.args.rowGap=t._rowGap,e.args.horzCellAlignment=t._cellHorzAlignment,e.args.vertCellAlignment=t._cellVertAlignment,e.left=t._left,e.top=t._top,e.group=t.group.id,e}(t);case HE.STACK:return function(t){let e={args:{}};return e.type=t.type,e.args.orientation=t._orientation,e.args.direction=t._direction,e.args.left=t._left,e.args.top=t._top,e.args.horzCellAlignment=t._horzCellAlignment,e.args.vertCellAlignment=t._vertCellAlignment,e.args.gap=t._gap,e.group=t.group.id,e}(t);case HE.PACKING:return function(t){let e={args:{}};return e.type=t.type,e.args.x=t._x,e.args.y=t._y,e.args.width=t._width,e.args.height=t._height,e.group=t.group.id,e}(t);case HE.FORCE:return function(t){let e={args:{}};return e.type=t.type,e.args.x=t._x,e.args.y=t._y,e.args.iterations=t._iterations,e.args.repulsion=t._repulsion,e.args.attraction=t._attraction,e.args.linkDistance=t._linkDistance,e.group=t.group.id,e}(t);case HE.CLUSTER:return function(t){let e={args:{}};return e.type=t.type,e.args.size=t._size,e.args.rootX=t._rootX,e.args.rootY=t._rootY,e}(t);case HE.DIRECTED:return function(t){let e={args:{}};return e.type=t.type,e.args.left=t._left,e.args.top=t._top,e.args.width=t._width,e.args.height=t._height,e.args.edgeSep=t._edgeSep,e.args.spreadLinks=t._spreadLinks,e.args.direction=t._direction,e}(t);case HE.TIDYTREE:return function(t){let e={args:{}};return e.type=t.type,e.args.left=t._left,e.args.top=t._top,e.args.width=t._width,e.args.height=t._height,e.args.orientation=t._orientation,e}(t);case HE.TREEMAP:return function(t){let e={args:{}};return e.type=t.type,e.args.left=t._left,e.args.top=t._top,e.args.width=t._width,e.args.height=t._height,e}(t);case HE.STRATA:return function(t){let e={args:{}};return e.type=t.type,e.args.direction=t._direction,e.args.gap=t._gap,e}(t);default:throw new Error("unknow layout type "+t.type)}}(t._layout)),e.children=[],t.children.length>0)for(let n of t.children)n instanceof xS?GM(n,e):n instanceof BS?jM(n,e):e.children.push(VM(n));return e.sortBy=t._sortBy,e}function GM(t,e){e.axes??=[];let n={};n.type=t._type,n.id=t._id,n.attr=t._attribute,n.channel=t._channel,n.args={},n.args.orientation=t._orientation,n.args.strokeColor=t._strokeColor,n.args.textColor=t._textColor,n.args.fontSize=t._fontSize,n.args.tickOffset=t._tickOffset,n.args.tickSize=t._tickSize,n.args.tickAnchor=t._tickAnchor,n.args.tickVisible=t._tickVisible,n.args.pathVisible=t._pathVisible,n.args.labelOffset=t._labelOffset,n.args.labelFormat=t._labelFormat,n.args.titleOffset=t._titleOffset,n.args.title=t._titleText,n.args.rotateTitle=t._rotateTitle,n.args.titleVisible=t._showTitle,n.args.labelRotation=t._labelRotation,e.axes.push(n)}function jM(t,e){e.gridlines??=[];let n={};n.type=t._type,n.id=t._id,n.attr=t._attribute,n.channel=t._channel,n.args=t._args,e.gridlines.push(n)}function UM(t,e){return void 0===t&&void 0===e||void 0!==t&&void 0!==e}function YM(t,e){const n=Object.keys(t),r=Object.keys(e);return n.length===r.length&&(0===n.length||n.every(t=>r.includes(t)))}function HM(t,e){if(!UM(t.layout,e.layout))return console.log("Not both defined or undefined:",t.bounds,e.bounds),!1;let n=t.layout,r=e.layout;if(!n&&!r)return!0;if(n.type!==r.type)return console.log("layout types are different:",n,r),!1;switch(n.type){case HE.GRID:return function(t,e){t._cellBounds.length!==e._cellBounds.length&&console.log("cell bounds length different:",t,e);for(let n=0;n<t._cellBounds;n++)if(!qM(t._cellBounds[n],e._cellBounds[n]))return console.log("cell bounds not equal:",t,e),!1;for(let n=0;n<t._grid.length;n++)for(let r=0;r<t._grid[n].length;r++)if(t._grid[n][r]!==e._grid[n][r])return console.log("grid not equal",t,e),!1;return t._numCols===e._numCols&&t._numRows===e._numRows&&t._start===e._start&&t._direction===e._direction&&t._rowGap===e._rowGap&&t._colGap===e._colGap&&t._cellHorzAlignment===e._cellHorzAlignment&&t._cellVertAlignment===e._cellVertAlignment&&t._left===e._left&&t._top===e._top}(n,r);case HE.STACK:return function(t,e){return t._orientation===e._orientation&&t._direction===e._direction&&t._left===e._left&&t._top===e._top&&t._horzCellAlignment===e._horzCellAlignment&&t._vertCellAlignment===e._vertCellAlignment&&t._gap===e._gap}(n,r);case HE.PACKING:return function(t,e){return t._x===e._x&&t._y===e._y&&t._width===e._width&&t._height===e._height}(n,r);case HE.FORCE:return function(t,e){return t._x===e._x&&t._y===e._y&&t._iterations===e._iterations&&t._repulsion===e._repulsion&&t._attraction===e._attraction&&t._linkDistance===e._linkDistance}(n,r);case HE.DIRECTED:return function(t,e){return t._width===e._width&&t._height===e._height&&t._top===e._top&&t._left===e._left&&t._edgeSep===e._edgeSep&&t._spreadLinks===e._spreadLinks&&t._direction===e._direction}(n,r);case HE.TIDYTREE:return function(t,e){return t._width===e._width&&t._height===e._height&&t._top===e._top&&t._left===e._left&&t._orientation===e._orientation}(n,r);case HE.STRATA:return function(t,e){return t._direction===e._direction&&t._gap===e._gap}(n,r);case HE.TREEMAP:return function(t,e){return t._width===e._width&&t._height===e._height&&t._top===e._top&&t._left===e._left}(n,r);default:return!1}}function WM(t,e){if(!UM(t.bounds,e.bounds))return console.log("Not both defined or undefined:",t.bounds,e.bounds),!1;let n=t.bounds,r=e.bounds;return!n&&!r||qM(n,r)}function qM(t,e){return t.x===e.x&&t.y===e.y&&t.width===e.width&&t.height===e.height}function $M(t,e){if(!UM(t,e))return console.log("Not both defined or undefined:",t,e),!1;if(t.type!==e.type)return console.log("Different mark types:",t,e),!1;if(t.id!==e.id)return console.log("id not equal:",t,e),!1;if(t.classId!==e.classId)return console.log("class id not equal:",t,e),!1;if(!KM(t,e))return console.log("DataScopes not equal",t,e),!1;if(!WM(t,e))return console.log("Bounds not equal",t,e),!1;if(!UM(t.links,e.links))return console.log("Not both defined or undefined: links ",t.links,e.links),!1;if(!UM(t.source,e.source))return console.log("Not both defined or undefined: source ",t.source,e.source),!1;if(!UM(t.target,e.target))return console.log("Not both defined or undefined: links ",t.target,e.target),!1;if(t.links&&e.links&&t.links.length!==e.links.length)return console.log("unequal number of links",t,e),!1;if(t.source&&e.source&&!$M(t.source,e.source))return console.log("different sources",t.source,e.source),!1;if(t.target&&e.target&&!$M(t.target,e.target))return console.log("different targets",t.target,e.target),!1;switch(t.type){case Pw.Arc:case Pw.Pie:return XM(t,e)?t.x===e.x&&t.y===e.y&&t.innerRadius===e.innerRadius&&t.outerRadius===e.outerRadius&&t.startAngle===e.startAngle&&t.endAngle===e.endAngle&&t.direction===e.direction&&t.thickness===e.thickness:(console.log("vertices not equal:",t,e),!1);case Pw.Area:return XM(t,e)?t.baseline===e.baseline&&t.orientation===e.orientation:(console.log("vertices not equal:",t,e),!1);case Pw.Circle:return t.x===e.x&&t.y===e.y&&t.radius===e.radius;case Pw.Image:return console.warn("not implemented"),!0;case Pw.Line:case Pw.Path:case Pw.BezierCurve:return!!XM(t,e)||(console.log("vertices not equal:",t,e),!1);case Pw.SimpleText:return t.x===e.x&&t.y===e.y&&t.text===e.text&&t.anchor[0]===e.anchor[0]&&t.anchor[1]===e.anchor[1];case Pw.Polygon:return XM(t,e)?t.x===e.x&&t.y===e.y&&t.radius===e.radius:(console.log("vertices not equal:",t,e),!1);case Pw.Rect:return XM(t,e)?t.width===e.width&&t.height===e.height&&t.top===e.top&&t.left===e.left:(console.log("vertices not equal:",t,e),!1);case Pw.Ring:default:return console.warn("not implemented"),!0}}function XM(t,e){if(t.vertices.length!==e.vertices.length)return console.log("unequal number of vertices:",t,e),!1;for(let n=0;n<t.vertices.length;n++){let r=t.vertices[n],i=e.vertices[n];return r.id!==i.id?(console.log("vertex id not equal:",r,i),!1):r.x!==i.x||r.y!==i.y?(console.log("vertex position not equal:",r,i),!1):KM(r,i)?r._polarAngle===i._polarAngle&&r.shape===i.shape&&r.width===i.width&&r.height==i.height&&r.radius==i.radius&&r.fillColor==i.fillColor&&r.opacity==i.opacity&&r.strokeWidth==i.strokeWidth&&r.strokeColor==i.strokeColor:(console.log("vertex data scopes not equal:",r.dataScope,i.dataScope),!1)}}function KM(t,e){if(!UM(t.dataScope,e.dataScope))return console.log("Not both defined or undefined:",t.dataScope,e.dataScope),!1;if(!t.dataScope&&!e.dataScope)return!0;let n=t.dataScope,r=e.dataScope,i=n.filters||{},s=r.filters||{};if(!YM(i,s))return!1;for(let t in i)if(i[t]!==s[t])return!1;return n.dataTable.id===r.dataTable.id&&tE(n).length===tE(r).length}function ZM(t,e){return t.type!==e.type&&console.log("Different types:",t.type,e.type),[Pw.Collection,Pw.Glyph,Pw.Composite].includes(t.type)?JM(t,e):t instanceof FE?$M(t,e):void 0}function JM(t,e){let n=t.children.filter(t=>!Object.values(Lw).includes(t.type)),r=e.children.filter(t=>!Object.values(Lw).includes(t.type));if(n.length!==r.length)return console.log("children length not equal:",n,r),!1;if(t.id!==e.id)return console.log("id not equal:",t,e),!1;if(t.classId!==e.classId)return console.log("class id not equal:",t,e),!1;if(!KM(t,e))return console.log("DataScopes not equal",t.dataScope,e.dataScope),!1;if(!WM(t,e))return console.log("Bounds not equal",t,e),!1;if(!HM(t,e))return console.log("Layouts not equal",t,e),!1;if(!function(t,e){if(!YM(t,e))return console.log("different keys",t,e),!1;for(let n in t)if(t[n]!==e[n])return!1;return!0}(t._sortBy,e._sortBy))return console.log("SortBy not equal",t,e),!1;for(let t=0;t<n.length;t++)if(!ZM(n[t],r[t]))return console.log("Not equal",n[t],r[t]),!1;return!0}class QM extends UE{constructor(t){super(),this.type=HE.CIRCULAR,this._x="x"in t?t.x:100,this._y="y"in t?t.y:100,this._radius="radius"in t?t.radius:100}get x(){return this._x}get y(){return this._y}get radius(){return this._radius}clone(){return new QM({x:this._x,y:this._y,radius:this._radius})}}class tO extends UE{constructor(t){super(),this.type=HE.CLUSTER,this._isRadial="radial"in t&&t.radial,this._angleExtent="angleExtent"in t?t.angleExtent:360,this._radius="radius"in t?t.radius:300,this._rootX="x"in t?t.x:300,this._rootY="y"in t?t.y:300,this._orientation="orientation"in t?t.orientation:zA,this._width="width"in t?t.width:800,this._height="height"in t?t.height:600,this._left="left"in t?t.left:60,this._top="top"in t?t.top:100,this._tree="tree"in t?t.tree:void 0}get radius(){return this._radius}get angleExtent(){return this._angleExtent}get x(){return this._rootX}get y(){return this._rootY}get width(){return this._width}get height(){return this._height}get left(){return this._left}get top(){return this._top}isRadial(){return this._isRadial}get orientation(){return this._orientation}clone(){return new tO({radius:this._radius,angleExtent:this._angleExtent,x:this._rootX,y:this._rootY,radial:this._isRadial,orientation:this._orientation,left:this._left,top:this._top,width:this._width,height:this._height,tree:this._tree})}}function eO(t){return t.type===Pw.Collection&&!(t.children.length<2)}function nO(t,e,n,r,i,s,o,a,l,c){let u=n.map(t=>r.getParent(t)).filter((t,e,n)=>n.findIndex(e=>e[xE]===t[xE])===e);if(u=u.filter(t=>t!==r.getRoot()),0===u.length)return;let h=[];for(let n of u){let u,f,d,p=e.filter(t=>r.getParent(r.getNode(t.datum[xE]))===n);if(p[0].type===Pw.Circle){let t=p.map(t=>NE(o,a,t.bounds.x,t.bounds.y)-t.radius),e=p.map(t=>NE(o,a,t.bounds.x,t.bounds.y)+t.radius);d=l===HA.OUTWARD?d3.max(e):d3.min(t)-c;let n=p.map(t=>iS(t.bounds.x,t.bounds.y,o,a)),r=p.map(t=>iS(o+NE(o,a,t.bounds.x,t.bounds.y),a-t.radius,o,a)),i=n.map((t,e)=>t-r[e]),s=n.map((t,e)=>t+r[e]),h=i.concat(s);u=d3.min(h),f=d3.max(h)}else p[0].type===Pw.Arc&&(u=360,f=-360,p.forEach(t=>{let e=t.startAngle,n=t.endAngle;n<e&&(n+=360),u=d3.min([u,e]),f=d3.max([f,n])}),u=rS(u),f=rS(f),d=l===HA.OUTWARD?d3.max(p.map(t=>t.outerRadius)):d3.min(p.map(t=>t.innerRadius))-c);let _=nT(t,{type:"arc",innerRadius:d,outerRadius:d+c,x:o,y:a,startAngle:rS(u),endAngle:rS(f),strokeColor:e[0].strokeColor,fillColor:e[0].fillColor,strokeWidth:e[0].strokeWidth,opacity:e[0].opacity});_._updateBounds(),_.dataScope=r.getNodeDataScopeRef(n),_._classId=s,i.addChild(_),h.push(_)}nO(t,h,u,r,i,s,o,a,l,c)}function rO(t,e,n,r,i,s,o,a,l){l&&(t.dataScope=i.getNodeDataScopeRef(s),t._classId=e);let c=i.getChildren(s);if(0===c.length)return;let u=t.type===Pw.Circle||t.type===Pw.Ring?60:t.startAngle,h=(t.type===Pw.Circle||t.type===Pw.Ring?360:t.angle)/c.length;for(let s=0;s<c.length;s++){let l,f;f=n===HA.OUTWARD?t.type===Pw.Circle?t.radius:t.outerRadius:t.type===Pw.Circle?t.radius-r:t.innerRadius-r,l=nT(a,360===h?{type:"ring",innerRadius:f,outerRadius:f+r,x:t.x,y:t.y,strokeColor:t.strokeColor,fillColor:t.fillColor,strokeWidth:t.strokeWidth,opacity:t.opacity}:{type:"arc",innerRadius:f,outerRadius:f+r,x:t.x,y:t.y,startAngle:rS(u+h*s),endAngle:rS(u+h*(s+1)),strokeColor:t.strokeColor,fillColor:t.fillColor,strokeWidth:t.strokeWidth,opacity:t.opacity}),l._updateBounds(),l.dataScope=i.getNodeDataScopeRef(c[s]),l._classId=e+"_strata",o.addChild(l),rO(l,e,n,r,i,c[s],o,a)}}function iO(t,e,n,r,i,s,o,a,l){l&&(t.dataScope=i.getNodeDataScopeRef(s),t._classId=e,o.addChild(t));let c,u,h,f=i.getChildren(s);if(0!==f.length){c=t.left,u=t.bottom,h=t.width/f.length;for(let s=0;s<f.length;s++){let a=sT(t);GS(a,c-a.left,u-a.top),a.resize(h,r),a._updateBounds(),c+=h,a.dataScope=i.getNodeDataScopeRef(f[s]),a._classId=e,o.addChild(a),iO(a,e,n,r,i,f[s],o)}}}class sO{constructor(t,e,n){this._elems=t,this._channel=e,this._anchor=n}get elements(){return this._elems}get channel(){return this._channel}get anchor(){return this._anchor}}class oO{constructor(t,e){this._elem=t,this._base=e,this._id=aO(t,e),this._channels={},this._attribute=void 0}get id(){return this._id}get element(){return this._elem}get base(){return this._base}get channels(){return Object.keys(this._channels)}addChannel(t,e){let n={};n.elemAnchor="elementAnchor"in e?e.elementAnchor:"x"==t||"angle"==t?zE.CENTER:zE.MIDDLE,n.baseAnchor="baseAnchor"in e?e.baseAnchor:"x"==t||"angle"==t?zE.CENTER:zE.MIDDLE,n.offset="offset"in e?e.offset:0,"attribute"in e&&(this._attribute=e.attribute),this._channels[t]=n}hasChannel(t){return t in this._channels}getElementAnchor(t){return this._channels[t].elemAnchor}getBaseAnchor(t){return this._channels[t].baseAnchor}getOffset(t){return this._channels[t].offset}get attribute(){return this._attribute?this._attribute:_E}}function aO(t,e){return(t.classId?t.classId:t.id)+":"+(e.classId?e.classId:e.id)}function lO(t,e,n,r){t.vertices[0].dataScope&&Jw(t.vertices[0].dataScope).has(e)?function(t,e,n,r){let i;if(e===_E)i=(t,n)=>parseInt(iE(t.dataScope,e).substring(1))-parseInt(iE(n.dataScope,e).substring(1));else{switch(Jw(t.vertices[0].dataScope).type(e)){case Vw.Date:break;case Vw.Number:case Vw.Integer:i=(t,n)=>oE(t.dataScope,e)-oE(n.dataScope,e);break;case Vw.String:i=r?(t,n)=>r.indexOf(iE(t.dataScope,e))-r.indexOf(iE(n.dataScope,e)):(t,n)=>iE(t.dataScope,e)<iE(n.dataScope,e)?-1:1}}t.vertices.sort(i),n&&t.vertices.reverse()}(t,e,n,r):function(t,e,n){let r=(t,n)=>t[e]-n[e];t.vertices.sort(r),n&&t.vertices.reverse()}(t,e,n),t._sortBy={property:e,descending:n,vals:r}}class cO{constructor(){this._vals={},this._vals.elements=[]}set(t,e){this._vals[t]=e}get(t){return this._vals[t]}clear(){this._vals={},this._vals.elements=[]}}class uO{constructor(t,e,n,r){this._respCompnt=e.object,this._respProps=e.properties||e.channels,this._responderEval=n,this._efxFn=r,this._evtCtx=t,this._evalResult={},this._responderPeers=void 0}get responderComponent(){return this._respCompnt}getResponderPeers(){if(!this._responderPeers){let t=Array.isArray(this._respCompnt)?this._respCompnt:[this._respCompnt];this._responderPeers=t.map(t=>JE(t)).flat()}return this._responderPeers}clearResponderPeers(){this._responderPeers=void 0}get responderProperties(){return this._respProps}get eventContext(){return this._evtCtx}get evalResult(){return this._evalResult}set evalResult(t){this._evalResult=t}get evalFunction(){return this._responderEval}get stylingFunction(){return this._efxFn}}class hO{constructor(t,e,n,r){this._id=t,this._event=n,this._source=e,this._evtCtx=new cO,this._cumulative=r}get id(){return this._id}get event(){return this._event}get eventContext(){return this._evtCtx}get source(){return this._source}isCumulative(){return this._cumulative}isMouseDriven(){return["brush","brushX","brushY","click","hover"].includes(this._event)}isKeyboardDriven(){return["keydown","keyup"].includes(this._event)}isWidgetDriven(){return["change","input"].includes(this._event)}isStateDriven(){return null!==this._source&&"object"==typeof this._source&&"stateVar"===this._source.type}}exports.activate=function(t,e,n,r,i){const s=aA(e.object);!function(t,e,n,r,i){if(!("event"in t)||!("source"in t))throw"Source and event must be specified in the trigger";if(!("object"in e))throw"Responder object must be specified";if(Array.isArray(r)){if(!r.every(t=>"function"==typeof t))throw"Updater must be a function";if(i&&!Array.isArray(i))throw"An array of effect setters must be accompanied by an array of animation effects";if(i&&Array.isArray(i)&&i.length!==r.length)throw"the length of effect setters is not equal to the length of animation effects"}else if("function"!=typeof r)throw"Updater must be a function"}(t,e,0,r,i);let o=t.event,a=function(t){let e="string"==typeof t.source?t.source:Array.isArray(t.source)?t.source.map(t=>t.classId||t.id).join("_"):"stateVar"===t.source.type?"state:"+t.source.key:t.source.classId?t.source.classId:t.source.id;return[e,t.event].join("-")}(t);o=0===o.indexOf("brush")?"brush":0===o.indexOf("drag")?"drag":o,o in s._triggers||(s._triggers[o]={}),a in s._triggers[o]||(s._triggers[o][a]=new hO(a,t.source,t.event,t.cumulative));let l=s._triggers[o][a].eventContext,c=new uO(l,e,n,r);return a in s._condEncodings||(s._condEncodings[a]=[]),s._condEncodings[a].push(c),function(t,e,n,r,i){let s=e.responderComponent,o=i&&i.source&&"stateVar"===i.source.type?r.getVariable(KE.STATE,i.source.key,i.source.stateContext):r.getVariable(KE.EVT_CTX,t),a=n.properties?n.properties:n.channels;if(e.evalFunction){let t=r.getVariable(KE.CONDITION_RESULT,e),n=r.findIncomingDataflowOperator($E.TARGET_EVALUATOR,t);n||(n=r.createOneWayDependency($E.TARGET_EVALUATOR,e.evalFunction)),r.connect(o,n),r.connect(n,t);for(let e of a){let n=Array.isArray(s)?s:[s];for(let i of n){let n=r.getVariable(KE.CHANNEL,e,i),s=n.incomingDataflow;if(s&&s.type===$E.ENCODER&&s.outputVar.channel===e)r.connect(t,s);else if(!s){let s=r.createOneWayDependency($E.ENCODER);r.connect(t,s),r.connect(s,n),s.storeValues(i,e)}}}}else{let t=r.createOneWayDependency($E.TARGET_UPDATER,e.stylingFunction,s);for(let e of a){let n;n=s instanceof ZE?r.getVariable(KE.STATE,e,s):Object.values(fA).includes(e)?r.getVariable(KE.CHANNEL,e,s):r.getVariable(KE.PROPERTY,pA(e),s),r.connect(o,t),r.connect(t,n)}}}(l,c,e,s._depGraph,t),s._triggers[o][a]},exports.affix=function(t,e,n,r){let i=aA(t);Jw(t.dataScope)!==Jw(e.dataScope)&&console.warn("Affix: elements and base elements are not created from the same table");let s=aO(t,e),o=i._relations.find(t=>t.id===s);o||(o=new oO(t,e),i._relations.push(o)),o.addChannel(n,r||{}),function(t,e){let n=e.getVariable(KE.AFFIXATION,t),r=e.getOutgoingDataflowOperator($E.AFFIXER,n);e.connect(n,r);for(let n of t.channels){let i=e.getVariable(KE.CHANNEL,n,t.element),s=e.getVariable(KE.CHANNEL,n,t.base);e.connect(s,r),e.connect(r,i)}r.run()}(o,i._depGraph)},exports.align=function(t,e,n){let r=aA(t[0]),i=new sO(t,e,n);!function(t,e){let n=e.createMultiWayDependency($E.ALIGNER),r=e.getVariable(KE.ALIGNMENT,t);e.connect(r,n);for(let r of t.elements){let i=e.getVariable(KE.CHANNEL,t.channel,r);e.connect(i,n)}n.run()}(i,r._depGraph),r._relations.push(i)},exports.attach=function(t,e){if(t.type==Pw.Glyph)for(let e of t.children)e._refBounds||(e._refBounds=e.bounds.clone());t.dataScope=cE(e)},exports.canClassify=eO,exports.canDensify=function(t){if([Pw.Line,Pw.Circle,Pw.Rect,Pw.Area].indexOf(t.type)<0)return!1;if(t.dataScope){let e=JE(t,t.scene);for(let t of e)if(nE(t.dataScope)>1)return!0;return!1}return!0},exports.canDivide=function(t){if([Pw.Line,Pw.Circle,Pw.Rect,Pw.Area,Pw.Ring,Pw.Pie,Pw.Path].indexOf(t.type)<0)return!1;if(t.type===Pw.Path&&(t.closed||!t.firstVertex.dataScope))return!1;if(t.dataScope){let e=JE(t);for(let t of e)if(nE(t.dataScope)>1)return!0;return!1}return!0},exports.canRepeat=XS,exports.classify=function(t,e){let n=aA(t),r=e||{};if(console.log("------ classify by",r.attribute," ----"),!eO(t))throw new Error("The "+t.type+" is not classifiable");return function(t,e,n,r){let i=JE(e);for(let e of i){let i,s={},o=e.children;for(let t of o){let e=iE(t.dataScope,n);e in s||(s[e]=[]),s[e].push(t)}let a=pE(o[0]);for(let o in s){let l=nT(t,{type:Pw.Collection});e.addChild(l),void 0===i&&(i=l.id),l._classId=i,l.dataScope=aE(e.dataScope?e.dataScope:cE(a),n,o);for(let t of s[o])l.addChild(t);r&&(l._layout=r.clone(),l._layout.group=l)}}}(n,t,r.attribute,r.layout),wA(t,t.firstChild.firstChild,n._depGraph),vA(t.firstChild,n._depGraph),EA(t.firstChild,t.firstChild.firstChild,n._depGraph),EA(t,t.firstChild,n._depGraph),n.onChange(KE.CHANNEL,"width",t.firstChild.firstChild),t.firstChild},exports.connect=function(t,e){let n=aA(t[0]),r={};t.forEach(t=>r[iE(t.dataScope,xE)]=t);let i=Jw(e[0].dataScope),s=i.tree?"parent":"source",o=i.tree?"child":"target";for(let e of t)e.links=[];for(let t of e){let e=iE(t.dataScope,s),n=iE(t.dataScope,o),i=r[e],a=r[n];t.source=i,t.target=a,i.links.push(t),a.links.push(t)}kA(t.find(t=>t.links.length>0),n._depGraph),n.onChange(KE.CHANNEL,"x",t[0])},exports.csv=async function(t){return async function(t){let e=await wE("GET",t),n=Da(e.trim(),Za);return new fE(n,t)}(t)},exports.csvString=function(t){return function(t){let e=Da(t.trim(),Za);return new fE(e,"fromString")}(t)},exports.deserialize=function(t){return TM(t)},exports.findElements=rA,exports.getLeafMarks=cA,exports.getPeers=JE,exports.graphJSON=async function(t){return async function(t){let e=await wE("GET",t);return new mE(JSON.parse(e),t)}(t)},exports.isEqual=function(t,e){return function(t,e){return t.fillColor!==e.fillColor?(console.log("fillColor not equal:",t,e),!1):JM(t,e)}(t,e)},exports.isMark=GE,exports.isRefElement=function(t){return t.type===Pw.Axis||t.type===Pw.Legend||t.type===Pw.Gridlines},exports.layout=function(t,e){let n=e||{};switch(t.toLowerCase()){case HE.STACK:return new mM(n);case HE.PACKING:return new yM(n);case HE.FORCE:return new gM(n);case HE.DIRECTED:return new _M(n);case HE.TIDYTREE:return new vM(n);case HE.TREEMAP:return new xM(n);case HE.CIRCULAR:return new QM(n);case HE.CLUSTER:return new tO(n);case HE.GRID:default:return new KS(n)}},exports.repopulate=function(t,e,n){t.dataScope=void 0;let r=aA(t),i=t;for(let t in n){NT(r,i,n[t],e);let s=OS(i.children[0]);for(let t of s)MS(t,r);let o=JE(i);for(let t of o)if(t.layout){for(let e of t.layout.refElements)vS(e,r),bA(e,r._depGraph);t.layout.clearRefElements()}i=i.children[0]}t.dataScope=cE(e),r.onChange(KE.CHANNEL,"width",t.children[0])},exports.scene=function(t){return new dM(t)},exports.serialize=function(t){return VM(t)},exports.sortChildren=function(t,e,n,r){let i=aA(t);if(t instanceof PA)!function(t,e,n,r){t.dataScope&&Jw(t.dataScope).has(e)?function(t,e,n,r){if(!Jw(t.dataScope).has(e))return void console.warn("Cannot order collection children by an non-existent attribute",e);let i;if(e===_E)i=(t,n)=>parseInt(iE(t.dataScope,e).substring(1))-parseInt(iE(n.dataScope,e).substring(1));else{switch(Jw(t.children[0].dataScope).type(e)){case Vw.Date:break;case Vw.Number:case Vw.Integer:i=(t,n)=>oE(t.dataScope,e)-oE(n.dataScope,e);break;case Vw.String:i=r?(t,n)=>r.indexOf(iE(t.dataScope,e))-r.indexOf(iE(n.dataScope,e)):(t,n)=>iE(t.dataScope,e)<iE(n.dataScope,e)?-1:1}}t.children.sort(i),n&&t.children.reverse()}(t,e,n,r):function(t,e,n){let r;switch(e){case"x":case"y":case"width":case"height":r=(t,n)=>t.bounds[e]-n.bounds[e];break;default:r=(t,n)=>t[e]-n[e]}t._children.sort(r),n&&t.children.reverse()}(t,e,n);t._sortBy={property:e,descending:n,vals:r}}(t,e,n,r),i.onChange(KE.PROPERTY,gA.CHILDREN_ORDER,t);else if(t instanceof XA){let i=JE(t);for(let t of i)lO(t,e,n,r)}},exports.stratify=function(t,e,n){if(!(e instanceof gE||Array.isArray(e)&&e.every(t=>t instanceof gE)))throw"Cannot stratify on a non-tree dataset";if(![Pw.Circle,Pw.Rect,Pw.Ring].includes(t.type))throw"Cannot stratify elements that are not rects, circles, or rings";let r=aA(t),i=n||{},s=i.direction,o=i.size,a=t.parent,l=function(t,e,n,r,i,s){switch(e.type){case Pw.Circle:case Pw.Ring:return function(t,e,n,r,i,s){let o,a=n||HA.OUTWARD,l=i||50;if(a!==HA.INWARD&&a!==HA.OUTWARD)throw"Unknown direction to stratify";let c,u=JE(e,t),h=Array.isArray(s)?s:[s];if(r){let n=nT(t,{type:Pw.Collection});n.dataScope=void 0,null==c&&(c=n.id),n._classId=c;let r=u.map(t=>h[0].getNode(t.datum[xE]));nO(t,u,r,h[0],n,e.classId?e.classId:e.id,400,350,a,l),o=n}else u.forEach((n,r)=>{let i=nT(t,{type:Pw.Collection});i.dataScope=void 0,null==c&&(c=i.id),i._classId=c;let s=n.parent;rO(n,e.id,a,l,h[r],h[r].getRoot(),i,t,!0),i._layout=new bM({direction:a}),i._layout.group=i,s.addChild(i),n===e&&(o=i)});return o}(t,e,n,r,i,s);case Pw.Rect:return function(t,e,n,r,i,s){let o,a,l=n||UA.Top2Bottom,c=i||50;if(!Object.values(UA).includes(l))throw"Unknown direction to stratify";return JE(e).forEach(n=>{let r=nT(t,{type:Pw.Collection});r.dataScope=void 0,null==a&&(a=r.id),r._classId=a;let i=n.parent;iO(n,e.id,l,c,s,s.getRoot(),r,t,!0),r._layout=new bM({direction:l}),r._layout.group=r,i.addChild(r),n===e&&(o=r)}),o}(t,e,n,0,i,s)}}(r,t,s,i.startFromLeaf,o,e);return wA(a,t,r._depGraph),vA(l,r._depGraph),l.children.length>0&&EA(l,l.firstChild,r._depGraph),EA(l.parent,l,r._depGraph),l},exports.table=function(t){return new fE(t,"")},exports.transform=function(t,e){switch(t){case"kde":return new cM(e);case"filter":return new uM(e);default:return new lM(e)}},exports.treeJSON=async function(t){return async function(t){let e=await wE("GET",t);return new gE(JSON.parse(e),t)}(t)},exports.update=function(t,e){if(!t)throw new Error("update: target is required");if(!e||"object"!=typeof e||Array.isArray(e))throw new Error("update: patch must be an object");if(YE(t)){let n=t.group?[t.group]:[],r=[];for(let t of n)r=r.concat(JE(t));0===r.length&&(r=n);for(let t of r)if(t.layout)for(const[n,r]of Object.entries(e))t.layout[n]=r;let i=aA(t);if(i)for(let t of n)t.firstChild&&i.onChange(KE.CHANNEL,"width",t.firstChild);return}let n=JE(t),r=aA(t);for(const[i,s]of Object.entries(e))if("layout"!==i)for(let t of n)vT(t,i,s);else if(r&&"function"==typeof r.setLayout)r.setLayout(t,s);else for(let t of n)t.layout=s;if("width"in e&&n.forEach(t=>{t._refBounds&&t._refBounds.setWidth(e.width)}),"height"in e&&n.forEach(t=>{t._refBounds&&t._refBounds.setHeight(e.height)}),r)for(let n in e)"layout"!==n&&(["vertex","segment"].includes(t.type)&&!["x","y"].includes(n)||(Object.values(fA).includes(n)?r.onChange(KE.CHANNEL,n,t):r.onChange(KE.PROPERTY,n,t)))};
|