@uwdata/mosaic-spec 0.5.0 → 0.6.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.
@@ -1,19 +1,19 @@
1
- var MU=Object.create;var __=Object.defineProperty;var TU=Object.getOwnPropertyDescriptor;var AU=Object.getOwnPropertyNames;var EU=Object.getPrototypeOf,NU=Object.prototype.hasOwnProperty;var tD=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),wr=(e,t)=>{for(var n in t)__(e,n,{get:t[n],enumerable:!0})},DU=(e,t,n,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of AU(t))!NU.call(e,i)&&i!==n&&__(e,i,{get:()=>t[i],enumerable:!(r=TU(t,i))||r.enumerable});return e};var OU=(e,t,n)=>(n=e!=null?MU(EU(e)):{},DU(t||!e||!e.__esModule?__(n,"default",{value:e,enumerable:!0}):n,e));var N9=tD((k$t,E9)=>{"use strict";function ptt(e,t,n,r,i){for(var o=i+1;r<=i;){var s=r+i>>>1,a=e[s],c=n!==void 0?n(a,t):a-t;c>=0?(o=s,i=s-1):r=s+1}return o}function mtt(e,t,n,r,i){for(var o=i+1;r<=i;){var s=r+i>>>1,a=e[s],c=n!==void 0?n(a,t):a-t;c>0?(o=s,i=s-1):r=s+1}return o}function ytt(e,t,n,r,i){for(var o=r-1;r<=i;){var s=r+i>>>1,a=e[s],c=n!==void 0?n(a,t):a-t;c<0?(o=s,r=s+1):i=s-1}return o}function gtt(e,t,n,r,i){for(var o=r-1;r<=i;){var s=r+i>>>1,a=e[s],c=n!==void 0?n(a,t):a-t;c<=0?(o=s,r=s+1):i=s-1}return o}function xtt(e,t,n,r,i){for(;r<=i;){var o=r+i>>>1,s=e[o],a=n!==void 0?n(s,t):s-t;if(a===0)return o;a<=0?r=o+1:i=o-1}return-1}function My(e,t,n,r,i,o){return typeof n=="function"?o(e,t,n,r===void 0?0:r|0,i===void 0?e.length-1:i|0):o(e,t,void 0,n===void 0?0:n|0,r===void 0?e.length-1:r|0)}E9.exports={ge:function(e,t,n,r,i){return My(e,t,n,r,i,ptt)},gt:function(e,t,n,r,i){return My(e,t,n,r,i,mtt)},lt:function(e,t,n,r,i){return My(e,t,n,r,i,ytt)},le:function(e,t,n,r,i){return My(e,t,n,r,i,gtt)},eq:function(e,t,n,r,i){return My(e,t,n,r,i,xtt)}}});var R9=tD((C$t,F9)=>{"use strict";var Iv=N9(),fd=0,jl=1,Sv=2;F9.exports=wtt;function _3(e,t,n,r,i){this.mid=e,this.left=t,this.right=n,this.leftPoints=r,this.rightPoints=i,this.count=(t?t.count:0)+(n?n.count:0)+r.length}var Ty=_3.prototype;function w3(e,t){e.mid=t.mid,e.left=t.left,e.right=t.right,e.leftPoints=t.leftPoints,e.rightPoints=t.rightPoints,e.count=t.count}function B9(e,t){var n=dd(t);e.mid=n.mid,e.left=n.left,e.right=n.right,e.leftPoints=n.leftPoints,e.rightPoints=n.rightPoints,e.count=n.count}function D9(e,t){var n=e.intervals([]);n.push(t),B9(e,n)}function O9(e,t){var n=e.intervals([]),r=n.indexOf(t);return r<0?fd:(n.splice(r,1),B9(e,n),jl)}Ty.intervals=function(e){return e.push.apply(e,this.leftPoints),this.left&&this.left.intervals(e),this.right&&this.right.intervals(e),e};Ty.insert=function(e){var t=this.count-this.leftPoints.length;if(this.count+=1,e[1]<this.mid)this.left?4*(this.left.count+1)>3*(t+1)?D9(this,e):this.left.insert(e):this.left=dd([e]);else if(e[0]>this.mid)this.right?4*(this.right.count+1)>3*(t+1)?D9(this,e):this.right.insert(e):this.right=dd([e]);else{var n=Iv.ge(this.leftPoints,e,S3),r=Iv.ge(this.rightPoints,e,I3);this.leftPoints.splice(n,0,e),this.rightPoints.splice(r,0,e)}};Ty.remove=function(e){var t=this.count-this.leftPoints;if(e[1]<this.mid){if(!this.left)return fd;var n=this.right?this.right.count:0;if(4*n>3*(t-1))return O9(this,e);var r=this.left.remove(e);return r===Sv?(this.left=null,this.count-=1,jl):(r===jl&&(this.count-=1),r)}else if(e[0]>this.mid){if(!this.right)return fd;var i=this.left?this.left.count:0;if(4*i>3*(t-1))return O9(this,e);var r=this.right.remove(e);return r===Sv?(this.right=null,this.count-=1,jl):(r===jl&&(this.count-=1),r)}else{if(this.count===1)return this.leftPoints[0]===e?Sv:fd;if(this.leftPoints.length===1&&this.leftPoints[0]===e){if(this.left&&this.right){for(var o=this,s=this.left;s.right;)o=s,s=s.right;if(o===this)s.right=this.right;else{var a=this.left,r=this.right;o.count-=s.count,o.right=s.left,s.left=a,s.right=r}w3(this,s),this.count=(this.left?this.left.count:0)+(this.right?this.right.count:0)+this.leftPoints.length}else this.left?w3(this,this.left):w3(this,this.right);return jl}for(var a=Iv.ge(this.leftPoints,e,S3);a<this.leftPoints.length&&this.leftPoints[a][0]===e[0];++a)if(this.leftPoints[a]===e){this.count-=1,this.leftPoints.splice(a,1);for(var r=Iv.ge(this.rightPoints,e,I3);r<this.rightPoints.length&&this.rightPoints[r][1]===e[1];++r)if(this.rightPoints[r]===e)return this.rightPoints.splice(r,1),jl}return fd}};function L9(e,t,n){for(var r=0;r<e.length&&e[r][0]<=t;++r){var i=n(e[r]);if(i)return i}}function k9(e,t,n){for(var r=e.length-1;r>=0&&e[r][1]>=t;--r){var i=n(e[r]);if(i)return i}}function C9(e,t){for(var n=0;n<e.length;++n){var r=t(e[n]);if(r)return r}}Ty.queryPoint=function(e,t){if(e<this.mid){if(this.left){var n=this.left.queryPoint(e,t);if(n)return n}return L9(this.leftPoints,e,t)}else if(e>this.mid){if(this.right){var n=this.right.queryPoint(e,t);if(n)return n}return k9(this.rightPoints,e,t)}else return C9(this.leftPoints,t)};Ty.queryInterval=function(e,t,n){if(e<this.mid&&this.left){var r=this.left.queryInterval(e,t,n);if(r)return r}if(t>this.mid&&this.right){var r=this.right.queryInterval(e,t,n);if(r)return r}return t<this.mid?L9(this.leftPoints,t,n):e>this.mid?k9(this.rightPoints,e,n):C9(this.leftPoints,n)};function btt(e,t){return e-t}function S3(e,t){var n=e[0]-t[0];return n||e[1]-t[1]}function I3(e,t){var n=e[1]-t[1];return n||e[0]-t[0]}function dd(e){if(e.length===0)return null;for(var t=[],n=0;n<e.length;++n)t.push(e[n][0],e[n][1]);t.sort(btt);for(var r=t[t.length>>1],i=[],o=[],s=[],n=0;n<e.length;++n){var a=e[n];a[1]<r?i.push(a):r<a[0]?o.push(a):s.push(a)}var c=s,l=s.slice();return c.sort(S3),l.sort(I3),new _3(r,dd(i),dd(o),c,l)}function v3(e){this.root=e}var hd=v3.prototype;hd.insert=function(e){this.root?this.root.insert(e):this.root=new _3(e[0],null,null,[e],[e])};hd.remove=function(e){if(this.root){var t=this.root.remove(e);return t===Sv&&(this.root=null),t!==fd}return!1};hd.queryPoint=function(e,t){if(this.root)return this.root.queryPoint(e,t)};hd.queryInterval=function(e,t,n){if(e<=t&&this.root)return this.root.queryInterval(e,t,n)};Object.defineProperty(hd,"count",{get:function(){return this.root?this.root.count:0}});Object.defineProperty(hd,"intervals",{get:function(){return this.root?this.root.intervals([]):[]}});function wtt(e){return!e||e.length===0?new v3(null):new v3(dd(e))}});var eD={};function Cd(e,t=!1){let n,r,i=eD;function o(l){n=e(l).then(()=>{if(r){let{value:u}=r;r=null,o(u)}else n=null})}function s(l){r={event:l}}function a(l){n?s(l):o(l)}function c(l){i!==l&&requestAnimationFrame(()=>{let u=i;i=eD,a(u)}),i=l}return t?c:a}var or=class{constructor(t){this._filterBy=t,this._requestUpdate=Cd(()=>this.requestQuery(),!0),this._coordinator=null}get coordinator(){return this._coordinator}set coordinator(t){this._coordinator=t}get filterBy(){return this._filterBy}get filterIndexable(){return!0}fields(){return null}fieldInfo(){return this}query(){return null}queryPending(){return this}queryResult(){return this}queryError(t){return console.error(t),this}requestQuery(t){let n=t||this.query(this.filterBy?.predicate(this));return this._coordinator.requestQuery(this,n)}requestUpdate(){this._requestUpdate()}update(){return this}};function rD(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,r=Object.getOwnPropertySymbols(e);i<r.length;i++)t.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(e,r[i])&&(n[r[i]]=e[r[i]]);return n}function Z(e,t,n,r){function i(o){return o instanceof n?o:new n(function(s){s(o)})}return new(n||(n=Promise))(function(o,s){function a(u){try{l(r.next(u))}catch(f){s(f)}}function c(u){try{l(r.throw(u))}catch(f){s(f)}}function l(u){u.done?o(u.value):i(u.value).then(a,c)}l((r=r.apply(e,t||[])).next())})}function nD(e){var t=typeof Symbol=="function"&&Symbol.iterator,n=t&&e[t],r=0;if(n)return n.call(e);if(e&&typeof e.length=="number")return{next:function(){return e&&r>=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function Ft(e){return this instanceof Ft?(this.v=e,this):new Ft(e)}function vr(e,t,n){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var r=n.apply(e,t||[]),i,o=[];return i={},s("next"),s("throw"),s("return"),i[Symbol.asyncIterator]=function(){return this},i;function s(d){r[d]&&(i[d]=function(h){return new Promise(function(p,m){o.push([d,h,p,m])>1||a(d,h)})})}function a(d,h){try{c(r[d](h))}catch(p){f(o[0][3],p)}}function c(d){d.value instanceof Ft?Promise.resolve(d.value.v).then(l,u):f(o[0][2],d)}function l(d){a("next",d)}function u(d){a("throw",d)}function f(d,h){d(h),o.shift(),o.length&&a(o[0][0],o[0][1])}}function Zl(e){var t,n;return t={},r("next"),r("throw",function(i){throw i}),r("return"),t[Symbol.iterator]=function(){return this},t;function r(i,o){t[i]=e[i]?function(s){return(n=!n)?{value:Ft(e[i](s)),done:!1}:o?o(s):s}:o}}function bi(e){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var t=e[Symbol.asyncIterator],n;return t?t.call(e):(e=typeof nD=="function"?nD(e):e[Symbol.iterator](),n={},r("next"),r("throw"),r("return"),n[Symbol.asyncIterator]=function(){return this},n);function r(o){n[o]=e[o]&&function(s){return new Promise(function(a,c){s=e[o](s),i(a,c,s.done,s.value)})}}function i(o,s,a,c){Promise.resolve(c).then(function(l){o({value:l,done:a})},s)}}var E_={};wr(E_,{compareArrayLike:()=>A_,joinUint8Arrays:()=>Sr,memcpy:()=>Jl,rebaseValueOffsets:()=>ug,toArrayBufferView:()=>Pt,toArrayBufferViewAsyncIterator:()=>vi,toArrayBufferViewIterator:()=>Zi,toBigInt64Array:()=>$U,toBigUint64Array:()=>zU,toFloat32Array:()=>jU,toFloat32ArrayAsyncIterator:()=>iz,toFloat32ArrayIterator:()=>ZU,toFloat64Array:()=>qU,toFloat64ArrayAsyncIterator:()=>oz,toFloat64ArrayIterator:()=>JU,toInt16Array:()=>RU,toInt16ArrayAsyncIterator:()=>tz,toInt16ArrayIterator:()=>XU,toInt32Array:()=>wc,toInt32ArrayAsyncIterator:()=>ez,toInt32ArrayIterator:()=>GU,toInt8Array:()=>FU,toInt8ArrayAsyncIterator:()=>KU,toInt8ArrayIterator:()=>YU,toUint16Array:()=>PU,toUint16ArrayAsyncIterator:()=>nz,toUint16ArrayIterator:()=>WU,toUint32Array:()=>UU,toUint32ArrayAsyncIterator:()=>rz,toUint32ArrayIterator:()=>HU,toUint8Array:()=>Ot,toUint8ArrayAsyncIterator:()=>T_,toUint8ArrayIterator:()=>M_,toUint8ClampedArray:()=>VU,toUint8ClampedArrayAsyncIterator:()=>sz,toUint8ClampedArrayIterator:()=>QU});var BU=new TextDecoder("utf-8"),Fd=e=>BU.decode(e),LU=new TextEncoder,ca=e=>LU.encode(e);var kU=e=>typeof e=="number",iD=e=>typeof e=="boolean",tn=e=>typeof e=="function",zn=e=>e!=null&&Object(e)===e,_r=e=>zn(e)&&tn(e.then);var wi=e=>zn(e)&&tn(e[Symbol.iterator]),Xr=e=>zn(e)&&tn(e[Symbol.asyncIterator]),ig=e=>zn(e)&&zn(e.schema);var og=e=>zn(e)&&"done"in e&&"value"in e;var sg=e=>zn(e)&&tn(e.stat)&&kU(e.fd);var ag=e=>zn(e)&&Rd(e.body),cg=e=>"_getDOMStream"in e&&"_getNodeStream"in e,oD=e=>zn(e)&&tn(e.abort)&&tn(e.getWriter)&&!cg(e),Rd=e=>zn(e)&&tn(e.cancel)&&tn(e.getReader)&&!cg(e),sD=e=>zn(e)&&tn(e.end)&&tn(e.write)&&iD(e.writable)&&!cg(e),lg=e=>zn(e)&&tn(e.read)&&tn(e.pipe)&&iD(e.readable)&&!cg(e),aD=e=>zn(e)&&tn(e.clear)&&tn(e.bytes)&&tn(e.position)&&tn(e.setPosition)&&tn(e.capacity)&&tn(e.getBufferIdentifier)&&tn(e.createLong);var I_=typeof SharedArrayBuffer<"u"?SharedArrayBuffer:ArrayBuffer;function CU(e){let t=e[0]?[e[0]]:[],n,r,i,o;for(let s,a,c=0,l=0,u=e.length;++c<u;){if(s=t[l],a=e[c],!s||!a||s.buffer!==a.buffer||a.byteOffset<s.byteOffset){a&&(t[++l]=a);continue}if({byteOffset:n,byteLength:i}=s,{byteOffset:r,byteLength:o}=a,n+i<r||r+o<n){a&&(t[++l]=a);continue}t[l]=new Uint8Array(s.buffer,n,r-n+o)}return t}function Jl(e,t,n=0,r=t.byteLength){let i=e.byteLength,o=new Uint8Array(e.buffer,e.byteOffset,i),s=new Uint8Array(t.buffer,t.byteOffset,Math.min(r,i));return o.set(s,n),e}function Sr(e,t){let n=CU(e),r=n.reduce((u,f)=>u+f.byteLength,0),i,o,s,a=0,c=-1,l=Math.min(t||Number.POSITIVE_INFINITY,r);for(let u=n.length;++c<u;){if(i=n[c],o=i.subarray(0,Math.min(i.length,l-a)),l<=a+o.length){o.length<i.length?n[c]=i.subarray(o.length):o.length===i.length&&c++,s?Jl(s,o,a):s=o;break}Jl(s||(s=new Uint8Array(l)),o,a),a+=o.length}return[s||new Uint8Array(0),n.slice(c),r-(s?s.byteLength:0)]}function Pt(e,t){let n=og(t)?t.value:t;return n instanceof e?e===Uint8Array?new e(n.buffer,n.byteOffset,n.byteLength):n:n?(typeof n=="string"&&(n=ca(n)),n instanceof ArrayBuffer?new e(n):n instanceof I_?new e(n):aD(n)?Pt(e,n.bytes()):ArrayBuffer.isView(n)?n.byteLength<=0?new e(0):new e(n.buffer,n.byteOffset,n.byteLength/e.BYTES_PER_ELEMENT):e.from(n)):new e(0)}var FU=e=>Pt(Int8Array,e),RU=e=>Pt(Int16Array,e),wc=e=>Pt(Int32Array,e),$U=e=>Pt(BigInt64Array,e),Ot=e=>Pt(Uint8Array,e),PU=e=>Pt(Uint16Array,e),UU=e=>Pt(Uint32Array,e),zU=e=>Pt(BigUint64Array,e),jU=e=>Pt(Float32Array,e),qU=e=>Pt(Float64Array,e),VU=e=>Pt(Uint8ClampedArray,e),S_=e=>(e.next(),e);function*Zi(e,t){let n=function*(i){yield i},r=typeof t=="string"||ArrayBuffer.isView(t)||t instanceof ArrayBuffer||t instanceof I_?n(t):wi(t)?t:n(t);return yield*S_(function*(i){let o=null;do o=i.next(yield Pt(e,o));while(!o.done)}(r[Symbol.iterator]())),new e}var YU=e=>Zi(Int8Array,e),XU=e=>Zi(Int16Array,e),GU=e=>Zi(Int32Array,e),M_=e=>Zi(Uint8Array,e),WU=e=>Zi(Uint16Array,e),HU=e=>Zi(Uint32Array,e),ZU=e=>Zi(Float32Array,e),JU=e=>Zi(Float64Array,e),QU=e=>Zi(Uint8ClampedArray,e);function vi(e,t){return vr(this,arguments,function*(){if(_r(t))return yield Ft(yield Ft(yield*Zl(bi(vi(e,yield Ft(t))))));let r=function(s){return vr(this,arguments,function*(){yield yield Ft(yield Ft(s))})},i=function(s){return vr(this,arguments,function*(){yield Ft(yield*Zl(bi(S_(function*(a){let c=null;do c=a.next(yield c?.value);while(!c.done)}(s[Symbol.iterator]())))))})},o=typeof t=="string"||ArrayBuffer.isView(t)||t instanceof ArrayBuffer||t instanceof I_?r(t):wi(t)?i(t):Xr(t)?t:r(t);return yield Ft(yield*Zl(bi(S_(function(s){return vr(this,arguments,function*(){let a=null;do a=yield Ft(s.next(yield yield Ft(Pt(e,a))));while(!a.done)})}(o[Symbol.asyncIterator]()))))),yield Ft(new e)})}var KU=e=>vi(Int8Array,e),tz=e=>vi(Int16Array,e),ez=e=>vi(Int32Array,e),T_=e=>vi(Uint8Array,e),nz=e=>vi(Uint16Array,e),rz=e=>vi(Uint32Array,e),iz=e=>vi(Float32Array,e),oz=e=>vi(Float64Array,e),sz=e=>vi(Uint8ClampedArray,e);function ug(e,t,n){if(e!==0){n=n.slice(0,t);for(let r=-1,i=n.length;++r<i;)n[r]+=e}return n.subarray(0,t)}function A_(e,t){let n=0,r=e.length;if(r!==t.length)return!1;if(r>0)do if(e[n]!==t[n])return!1;while(++n<r);return!0}var gn={fromIterable(e){return fg(az(e))},fromAsyncIterable(e){return fg(cz(e))},fromDOMStream(e){return fg(lz(e))},fromNodeStream(e){return fg(uz(e))},toDOMStream(e,t){throw new Error('"toDOMStream" not available in this environment')},toNodeStream(e,t){throw new Error('"toNodeStream" not available in this environment')}},fg=e=>(e.next(),e);function*az(e){let t,n=!1,r=[],i,o,s,a=0;function c(){return o==="peek"?Sr(r,s)[0]:([i,r,a]=Sr(r,s),i)}({cmd:o,size:s}=yield null);let l=M_(e)[Symbol.iterator]();try{do if({done:t,value:i}=Number.isNaN(s-a)?l.next():l.next(s-a),!t&&i.byteLength>0&&(r.push(i),a+=i.byteLength),t||s<=a)do({cmd:o,size:s}=yield c());while(s<a);while(!t)}catch(u){(n=!0)&&typeof l.throw=="function"&&l.throw(u)}finally{n===!1&&typeof l.return=="function"&&l.return(null)}return null}function cz(e){return vr(this,arguments,function*(){let n,r=!1,i=[],o,s,a,c=0;function l(){return s==="peek"?Sr(i,a)[0]:([o,i,c]=Sr(i,a),o)}({cmd:s,size:a}=yield yield Ft(null));let u=T_(e)[Symbol.asyncIterator]();try{do if({done:n,value:o}=Number.isNaN(a-c)?yield Ft(u.next()):yield Ft(u.next(a-c)),!n&&o.byteLength>0&&(i.push(o),c+=o.byteLength),n||a<=c)do({cmd:s,size:a}=yield yield Ft(l()));while(a<c);while(!n)}catch(f){(r=!0)&&typeof u.throw=="function"&&(yield Ft(u.throw(f)))}finally{r===!1&&typeof u.return=="function"&&(yield Ft(u.return(new Uint8Array(0))))}return yield Ft(null)})}function lz(e){return vr(this,arguments,function*(){let n=!1,r=!1,i=[],o,s,a,c=0;function l(){return s==="peek"?Sr(i,a)[0]:([o,i,c]=Sr(i,a),o)}({cmd:s,size:a}=yield yield Ft(null));let u=new D_(e);try{do if({done:n,value:o}=Number.isNaN(a-c)?yield Ft(u.read()):yield Ft(u.read(a-c)),!n&&o.byteLength>0&&(i.push(Ot(o)),c+=o.byteLength),n||a<=c)do({cmd:s,size:a}=yield yield Ft(l()));while(a<c);while(!n)}catch(f){(r=!0)&&(yield Ft(u.cancel(f)))}finally{r===!1?yield Ft(u.cancel()):e.locked&&u.releaseLock()}return yield Ft(null)})}var D_=class{constructor(t){this.source=t,this.reader=null,this.reader=this.source.getReader(),this.reader.closed.catch(()=>{})}get closed(){return this.reader?this.reader.closed.catch(()=>{}):Promise.resolve()}releaseLock(){this.reader&&this.reader.releaseLock(),this.reader=null}cancel(t){return Z(this,void 0,void 0,function*(){let{reader:n,source:r}=this;n&&(yield n.cancel(t).catch(()=>{})),r&&r.locked&&this.releaseLock()})}read(t){return Z(this,void 0,void 0,function*(){if(t===0)return{done:this.reader==null,value:new Uint8Array(0)};let n=yield this.reader.read();return!n.done&&(n.value=Ot(n)),n})}},N_=(e,t)=>{let n=i=>r([t,i]),r;return[t,n,new Promise(i=>(r=i)&&e.once(t,n))]};function uz(e){return vr(this,arguments,function*(){let n=[],r="error",i=!1,o=null,s,a,c=0,l=[],u;function f(){return s==="peek"?Sr(l,a)[0]:([u,l,c]=Sr(l,a),u)}if({cmd:s,size:a}=yield yield Ft(null),e.isTTY)return yield yield Ft(new Uint8Array(0)),yield Ft(null);try{n[0]=N_(e,"end"),n[1]=N_(e,"error");do{if(n[2]=N_(e,"readable"),[r,o]=yield Ft(Promise.race(n.map(h=>h[2]))),r==="error")break;if((i=r==="end")||(Number.isFinite(a-c)?(u=Ot(e.read(a-c)),u.byteLength<a-c&&(u=Ot(e.read()))):u=Ot(e.read()),u.byteLength>0&&(l.push(u),c+=u.byteLength)),i||a<=c)do({cmd:s,size:a}=yield yield Ft(f()));while(a<c)}while(!i)}finally{yield Ft(d(n,r==="error"?o:null))}return yield Ft(null);function d(h,p){return u=l=null,new Promise((m,g)=>{for(let[y,x]of h)e.off(y,x);try{let y=e.destroy;y&&y.call(e,p),p=void 0}catch(y){p=y||p}finally{p!=null?g(p):m()}})}})}var Ee;(function(e){e[e.V1=0]="V1",e[e.V2=1]="V2",e[e.V3=2]="V3",e[e.V4=3]="V4",e[e.V5=4]="V5"})(Ee||(Ee={}));var xe;(function(e){e[e.Sparse=0]="Sparse",e[e.Dense=1]="Dense"})(xe||(xe={}));var Se;(function(e){e[e.HALF=0]="HALF",e[e.SINGLE=1]="SINGLE",e[e.DOUBLE=2]="DOUBLE"})(Se||(Se={}));var Dn;(function(e){e[e.DAY=0]="DAY",e[e.MILLISECOND=1]="MILLISECOND"})(Dn||(Dn={}));var mt;(function(e){e[e.SECOND=0]="SECOND",e[e.MILLISECOND=1]="MILLISECOND",e[e.MICROSECOND=2]="MICROSECOND",e[e.NANOSECOND=3]="NANOSECOND"})(mt||(mt={}));var sr;(function(e){e[e.YEAR_MONTH=0]="YEAR_MONTH",e[e.DAY_TIME=1]="DAY_TIME",e[e.MONTH_DAY_NANO=2]="MONTH_DAY_NANO"})(sr||(sr={}));var Qt;(function(e){e[e.NONE=0]="NONE",e[e.Schema=1]="Schema",e[e.DictionaryBatch=2]="DictionaryBatch",e[e.RecordBatch=3]="RecordBatch",e[e.Tensor=4]="Tensor",e[e.SparseTensor=5]="SparseTensor"})(Qt||(Qt={}));var L;(function(e){e[e.NONE=0]="NONE",e[e.Null=1]="Null",e[e.Int=2]="Int",e[e.Float=3]="Float",e[e.Binary=4]="Binary",e[e.Utf8=5]="Utf8",e[e.Bool=6]="Bool",e[e.Decimal=7]="Decimal",e[e.Date=8]="Date",e[e.Time=9]="Time",e[e.Timestamp=10]="Timestamp",e[e.Interval=11]="Interval",e[e.List=12]="List",e[e.Struct=13]="Struct",e[e.Union=14]="Union",e[e.FixedSizeBinary=15]="FixedSizeBinary",e[e.FixedSizeList=16]="FixedSizeList",e[e.Map=17]="Map",e[e.Duration=18]="Duration",e[e.Dictionary=-1]="Dictionary",e[e.Int8=-2]="Int8",e[e.Int16=-3]="Int16",e[e.Int32=-4]="Int32",e[e.Int64=-5]="Int64",e[e.Uint8=-6]="Uint8",e[e.Uint16=-7]="Uint16",e[e.Uint32=-8]="Uint32",e[e.Uint64=-9]="Uint64",e[e.Float16=-10]="Float16",e[e.Float32=-11]="Float32",e[e.Float64=-12]="Float64",e[e.DateDay=-13]="DateDay",e[e.DateMillisecond=-14]="DateMillisecond",e[e.TimestampSecond=-15]="TimestampSecond",e[e.TimestampMillisecond=-16]="TimestampMillisecond",e[e.TimestampMicrosecond=-17]="TimestampMicrosecond",e[e.TimestampNanosecond=-18]="TimestampNanosecond",e[e.TimeSecond=-19]="TimeSecond",e[e.TimeMillisecond=-20]="TimeMillisecond",e[e.TimeMicrosecond=-21]="TimeMicrosecond",e[e.TimeNanosecond=-22]="TimeNanosecond",e[e.DenseUnion=-23]="DenseUnion",e[e.SparseUnion=-24]="SparseUnion",e[e.IntervalDayTime=-25]="IntervalDayTime",e[e.IntervalYearMonth=-26]="IntervalYearMonth",e[e.DurationSecond=-27]="DurationSecond",e[e.DurationMillisecond=-28]="DurationMillisecond",e[e.DurationMicrosecond=-29]="DurationMicrosecond",e[e.DurationNanosecond=-30]="DurationNanosecond"})(L||(L={}));var _i;(function(e){e[e.OFFSET=0]="OFFSET",e[e.DATA=1]="DATA",e[e.VALIDITY=2]="VALIDITY",e[e.TYPE=3]="TYPE"})(_i||(_i={}));var H_={};wr(H_,{clampIndex:()=>ej,clampRange:()=>zd,createElementComparator:()=>fa});var O_={};wr(O_,{valueToString:()=>Si});function Si(e){if(e===null)return"null";if(e===void 0)return"undefined";switch(typeof e){case"number":return`${e}`;case"bigint":return`${e}`;case"string":return`"${e}"`}return typeof e[Symbol.toPrimitive]=="function"?e[Symbol.toPrimitive]("string"):ArrayBuffer.isView(e)?e instanceof BigInt64Array||e instanceof BigUint64Array?`[${[...e].map(t=>Si(t))}]`:`[${e}]`:ArrayBuffer.isView(e)?`[${e}]`:JSON.stringify(e,(t,n)=>typeof n=="bigint"?`${n}`:n)}var L_={};wr(L_,{BN:()=>Pd,bigNumToBigInt:()=>uD,bigNumToString:()=>tu,isArrowBigNumSymbol:()=>cD});var cD=Symbol.for("isArrowBigNum");function Ii(e,...t){return t.length===0?Object.setPrototypeOf(Pt(this.TypedArray,e),this.constructor.prototype):Object.setPrototypeOf(new this.TypedArray(e,...t),this.constructor.prototype)}Ii.prototype[cD]=!0;Ii.prototype.toJSON=function(){return`"${tu(this)}"`};Ii.prototype.valueOf=function(){return lD(this)};Ii.prototype.toString=function(){return tu(this)};Ii.prototype[Symbol.toPrimitive]=function(e="default"){switch(e){case"number":return lD(this);case"string":return tu(this);case"default":return uD(this)}return tu(this)};function Ql(...e){return Ii.apply(this,e)}function Kl(...e){return Ii.apply(this,e)}function $d(...e){return Ii.apply(this,e)}Object.setPrototypeOf(Ql.prototype,Object.create(Int32Array.prototype));Object.setPrototypeOf(Kl.prototype,Object.create(Uint32Array.prototype));Object.setPrototypeOf($d.prototype,Object.create(Uint32Array.prototype));Object.assign(Ql.prototype,Ii.prototype,{constructor:Ql,signed:!0,TypedArray:Int32Array,BigIntArray:BigInt64Array});Object.assign(Kl.prototype,Ii.prototype,{constructor:Kl,signed:!1,TypedArray:Uint32Array,BigIntArray:BigUint64Array});Object.assign($d.prototype,Ii.prototype,{constructor:$d,signed:!0,TypedArray:Uint32Array,BigIntArray:BigUint64Array});function lD(e){let{buffer:t,byteOffset:n,length:r,signed:i}=e,o=new BigUint64Array(t,n,r),s=i&&o.at(-1)&BigInt(1)<<BigInt(63),a=BigInt(s?1:0),c=BigInt(0);if(s){for(let l of o)a+=~l*(BigInt(1)<<BigInt(32)*c++);a*=BigInt(-1)}else for(let l of o)a+=l*(BigInt(1)<<BigInt(32)*c++);return a}var tu=e=>{if(e.byteLength===8)return`${new e.BigIntArray(e.buffer,e.byteOffset,1)[0]}`;if(!e.signed)return B_(e);let t=new Uint16Array(e.buffer,e.byteOffset,e.byteLength/2);if(new Int16Array([t.at(-1)])[0]>=0)return B_(e);t=t.slice();let r=1;for(let o=0;o<t.length;o++){let s=t[o],a=~s+r;t[o]=a,r&=s===0?1:0}return`-${B_(t)}`},uD=e=>e.byteLength===8?new e.BigIntArray(e.buffer,e.byteOffset,1)[0]:tu(e);function B_(e){let t="",n=new Uint32Array(2),r=new Uint16Array(e.buffer,e.byteOffset,e.byteLength/2),i=new Uint32Array((r=new Uint16Array(r).reverse()).buffer),o=-1,s=r.length-1;do{for(n[0]=r[o=0];o<s;)r[o++]=n[1]=n[0]/10,n[0]=(n[0]-n[1]*10<<16)+r[o];r[o]=n[1]=n[0]/10,n[0]=n[0]-n[1]*10,t=`${n[0]}${t}`}while(i[0]||i[1]||i[2]||i[3]);return t??"0"}var Pd=class e{static new(t,n){switch(n){case!0:return new Ql(t);case!1:return new Kl(t)}switch(t.constructor){case Int8Array:case Int16Array:case Int32Array:case BigInt64Array:return new Ql(t)}return t.byteLength===16?new $d(t):new Kl(t)}static signed(t){return new Ql(t)}static unsigned(t){return new Kl(t)}static decimal(t){return new $d(t)}constructor(t,n){return e.new(t,n)}};function ar(e){if(typeof e=="bigint"&&(e<Number.MIN_SAFE_INTEGER||e>Number.MAX_SAFE_INTEGER))throw new TypeError(`${e} is not safe to convert to a number.`);return Number(e)}var fD,dD,hD,pD,mD,yD,gD,xD,bD,wD,vD,_D,SD,ID,MD,TD,AD,ED,ND,DD,at=class e{static isNull(t){return t?.typeId===L.Null}static isInt(t){return t?.typeId===L.Int}static isFloat(t){return t?.typeId===L.Float}static isBinary(t){return t?.typeId===L.Binary}static isUtf8(t){return t?.typeId===L.Utf8}static isBool(t){return t?.typeId===L.Bool}static isDecimal(t){return t?.typeId===L.Decimal}static isDate(t){return t?.typeId===L.Date}static isTime(t){return t?.typeId===L.Time}static isTimestamp(t){return t?.typeId===L.Timestamp}static isInterval(t){return t?.typeId===L.Interval}static isDuration(t){return t?.typeId===L.Duration}static isList(t){return t?.typeId===L.List}static isStruct(t){return t?.typeId===L.Struct}static isUnion(t){return t?.typeId===L.Union}static isFixedSizeBinary(t){return t?.typeId===L.FixedSizeBinary}static isFixedSizeList(t){return t?.typeId===L.FixedSizeList}static isMap(t){return t?.typeId===L.Map}static isDictionary(t){return t?.typeId===L.Dictionary}static isDenseUnion(t){return e.isUnion(t)&&t.mode===xe.Dense}static isSparseUnion(t){return e.isUnion(t)&&t.mode===xe.Sparse}get typeId(){return L.NONE}};fD=Symbol.toStringTag;at[fD]=(e=>(e.children=null,e.ArrayType=Array,e[Symbol.toStringTag]="DataType"))(at.prototype);var jn=class extends at{toString(){return"Null"}get typeId(){return L.Null}};dD=Symbol.toStringTag;jn[dD]=(e=>e[Symbol.toStringTag]="Null")(jn.prototype);var $e=class extends at{constructor(t,n){super(),this.isSigned=t,this.bitWidth=n}get typeId(){return L.Int}get ArrayType(){switch(this.bitWidth){case 8:return this.isSigned?Int8Array:Uint8Array;case 16:return this.isSigned?Int16Array:Uint16Array;case 32:return this.isSigned?Int32Array:Uint32Array;case 64:return this.isSigned?BigInt64Array:BigUint64Array}throw new Error(`Unrecognized ${this[Symbol.toStringTag]} type`)}toString(){return`${this.isSigned?"I":"Ui"}nt${this.bitWidth}`}};hD=Symbol.toStringTag;$e[hD]=(e=>(e.isSigned=null,e.bitWidth=null,e[Symbol.toStringTag]="Int"))($e.prototype);var dg=class extends $e{constructor(){super(!0,8)}get ArrayType(){return Int8Array}},hg=class extends $e{constructor(){super(!0,16)}get ArrayType(){return Int16Array}},Ji=class extends $e{constructor(){super(!0,32)}get ArrayType(){return Int32Array}},pg=class extends $e{constructor(){super(!0,64)}get ArrayType(){return BigInt64Array}},mg=class extends $e{constructor(){super(!1,8)}get ArrayType(){return Uint8Array}},yg=class extends $e{constructor(){super(!1,16)}get ArrayType(){return Uint16Array}},gg=class extends $e{constructor(){super(!1,32)}get ArrayType(){return Uint32Array}},xg=class extends $e{constructor(){super(!1,64)}get ArrayType(){return BigUint64Array}};Object.defineProperty(dg.prototype,"ArrayType",{value:Int8Array});Object.defineProperty(hg.prototype,"ArrayType",{value:Int16Array});Object.defineProperty(Ji.prototype,"ArrayType",{value:Int32Array});Object.defineProperty(pg.prototype,"ArrayType",{value:BigInt64Array});Object.defineProperty(mg.prototype,"ArrayType",{value:Uint8Array});Object.defineProperty(yg.prototype,"ArrayType",{value:Uint16Array});Object.defineProperty(gg.prototype,"ArrayType",{value:Uint32Array});Object.defineProperty(xg.prototype,"ArrayType",{value:BigUint64Array});var cr=class extends at{constructor(t){super(),this.precision=t}get typeId(){return L.Float}get ArrayType(){switch(this.precision){case Se.HALF:return Uint16Array;case Se.SINGLE:return Float32Array;case Se.DOUBLE:return Float64Array}throw new Error(`Unrecognized ${this[Symbol.toStringTag]} type`)}toString(){return`Float${this.precision<<5||16}`}};pD=Symbol.toStringTag;cr[pD]=(e=>(e.precision=null,e[Symbol.toStringTag]="Float"))(cr.prototype);var bg=class extends cr{constructor(){super(Se.HALF)}},wg=class extends cr{constructor(){super(Se.SINGLE)}},vg=class extends cr{constructor(){super(Se.DOUBLE)}};Object.defineProperty(bg.prototype,"ArrayType",{value:Uint16Array});Object.defineProperty(wg.prototype,"ArrayType",{value:Float32Array});Object.defineProperty(vg.prototype,"ArrayType",{value:Float64Array});var Wo=class extends at{constructor(){super()}get typeId(){return L.Binary}toString(){return"Binary"}};mD=Symbol.toStringTag;Wo[mD]=(e=>(e.ArrayType=Uint8Array,e[Symbol.toStringTag]="Binary"))(Wo.prototype);var Ho=class extends at{constructor(){super()}get typeId(){return L.Utf8}toString(){return"Utf8"}};yD=Symbol.toStringTag;Ho[yD]=(e=>(e.ArrayType=Uint8Array,e[Symbol.toStringTag]="Utf8"))(Ho.prototype);var Zo=class extends at{constructor(){super()}get typeId(){return L.Bool}toString(){return"Bool"}};gD=Symbol.toStringTag;Zo[gD]=(e=>(e.ArrayType=Uint8Array,e[Symbol.toStringTag]="Bool"))(Zo.prototype);var Jo=class extends at{constructor(t,n,r=128){super(),this.scale=t,this.precision=n,this.bitWidth=r}get typeId(){return L.Decimal}toString(){return`Decimal[${this.precision}e${this.scale>0?"+":""}${this.scale}]`}};xD=Symbol.toStringTag;Jo[xD]=(e=>(e.scale=null,e.precision=null,e.ArrayType=Uint32Array,e[Symbol.toStringTag]="Decimal"))(Jo.prototype);var Qo=class extends at{constructor(t){super(),this.unit=t}get typeId(){return L.Date}toString(){return`Date${(this.unit+1)*32}<${Dn[this.unit]}>`}};bD=Symbol.toStringTag;Qo[bD]=(e=>(e.unit=null,e.ArrayType=Int32Array,e[Symbol.toStringTag]="Date"))(Qo.prototype);var Mi=class extends at{constructor(t,n){super(),this.unit=t,this.bitWidth=n}get typeId(){return L.Time}toString(){return`Time${this.bitWidth}<${mt[this.unit]}>`}get ArrayType(){switch(this.bitWidth){case 32:return Int32Array;case 64:return BigInt64Array}throw new Error(`Unrecognized ${this[Symbol.toStringTag]} type`)}};wD=Symbol.toStringTag;Mi[wD]=(e=>(e.unit=null,e.bitWidth=null,e[Symbol.toStringTag]="Time"))(Mi.prototype);var Ko=class extends at{constructor(t,n){super(),this.unit=t,this.timezone=n}get typeId(){return L.Timestamp}toString(){return`Timestamp<${mt[this.unit]}${this.timezone?`, ${this.timezone}`:""}>`}};vD=Symbol.toStringTag;Ko[vD]=(e=>(e.unit=null,e.timezone=null,e.ArrayType=Int32Array,e[Symbol.toStringTag]="Timestamp"))(Ko.prototype);var ts=class extends at{constructor(t){super(),this.unit=t}get typeId(){return L.Interval}toString(){return`Interval<${sr[this.unit]}>`}};_D=Symbol.toStringTag;ts[_D]=(e=>(e.unit=null,e.ArrayType=Int32Array,e[Symbol.toStringTag]="Interval"))(ts.prototype);var es=class extends at{constructor(t){super(),this.unit=t}get typeId(){return L.Duration}toString(){return`Duration<${mt[this.unit]}>`}};SD=Symbol.toStringTag;es[SD]=(e=>(e.unit=null,e.ArrayType=BigInt64Array,e[Symbol.toStringTag]="Duration"))(es.prototype);var Ti=class extends at{constructor(t){super(),this.children=[t]}get typeId(){return L.List}toString(){return`List<${this.valueType}>`}get valueType(){return this.children[0].type}get valueField(){return this.children[0]}get ArrayType(){return this.valueType.ArrayType}};ID=Symbol.toStringTag;Ti[ID]=(e=>(e.children=null,e[Symbol.toStringTag]="List"))(Ti.prototype);var me=class extends at{constructor(t){super(),this.children=t}get typeId(){return L.Struct}toString(){return`Struct<{${this.children.map(t=>`${t.name}:${t.type}`).join(", ")}}>`}};MD=Symbol.toStringTag;me[MD]=(e=>(e.children=null,e[Symbol.toStringTag]="Struct"))(me.prototype);var Ai=class extends at{constructor(t,n,r){super(),this.mode=t,this.children=r,this.typeIds=n=Int32Array.from(n),this.typeIdToChildIndex=n.reduce((i,o,s)=>(i[o]=s)&&i||i,Object.create(null))}get typeId(){return L.Union}toString(){return`${this[Symbol.toStringTag]}<${this.children.map(t=>`${t.type}`).join(" | ")}>`}};TD=Symbol.toStringTag;Ai[TD]=(e=>(e.mode=null,e.typeIds=null,e.children=null,e.typeIdToChildIndex=null,e.ArrayType=Int8Array,e[Symbol.toStringTag]="Union"))(Ai.prototype);var ns=class extends at{constructor(t){super(),this.byteWidth=t}get typeId(){return L.FixedSizeBinary}toString(){return`FixedSizeBinary[${this.byteWidth}]`}};AD=Symbol.toStringTag;ns[AD]=(e=>(e.byteWidth=null,e.ArrayType=Uint8Array,e[Symbol.toStringTag]="FixedSizeBinary"))(ns.prototype);var Ei=class extends at{constructor(t,n){super(),this.listSize=t,this.children=[n]}get typeId(){return L.FixedSizeList}get valueType(){return this.children[0].type}get valueField(){return this.children[0]}get ArrayType(){return this.valueType.ArrayType}toString(){return`FixedSizeList[${this.listSize}]<${this.valueType}>`}};ED=Symbol.toStringTag;Ei[ED]=(e=>(e.children=null,e.listSize=null,e[Symbol.toStringTag]="FixedSizeList"))(Ei.prototype);var Ni=class extends at{constructor(t,n=!1){var r,i,o;if(super(),this.children=[t],this.keysSorted=n,t&&(t.name="entries",!((r=t?.type)===null||r===void 0)&&r.children)){let s=(i=t?.type)===null||i===void 0?void 0:i.children[0];s&&(s.name="key");let a=(o=t?.type)===null||o===void 0?void 0:o.children[1];a&&(a.name="value")}}get typeId(){return L.Map}get keyType(){return this.children[0].type.children[0].type}get valueType(){return this.children[0].type.children[1].type}get childType(){return this.children[0].type}toString(){return`Map<{${this.children[0].type.children.map(t=>`${t.name}:${t.type}`).join(", ")}}>`}};ND=Symbol.toStringTag;Ni[ND]=(e=>(e.children=null,e.keysSorted=null,e[Symbol.toStringTag]="Map_"))(Ni.prototype);var fz=(e=>()=>++e)(-1),Ir=class extends at{constructor(t,n,r,i){super(),this.indices=n,this.dictionary=t,this.isOrdered=i||!1,this.id=r==null?fz():ar(r)}get typeId(){return L.Dictionary}get children(){return this.dictionary.children}get valueType(){return this.dictionary}get ArrayType(){return this.dictionary.ArrayType}toString(){return`Dictionary<${this.indices}, ${this.dictionary}>`}};DD=Symbol.toStringTag;Ir[DD]=(e=>(e.id=null,e.indices=null,e.isOrdered=null,e.dictionary=null,e[Symbol.toStringTag]="Dictionary"))(Ir.prototype);function Mr(e){let t=e;switch(e.typeId){case L.Decimal:return e.bitWidth/32;case L.Timestamp:return 2;case L.Date:return 1+t.unit;case L.Interval:return 1+t.unit;case L.FixedSizeList:return t.listSize;case L.FixedSizeBinary:return t.byteWidth;default:return 1}}var ut=class{visitMany(t,...n){return t.map((r,i)=>this.visit(r,...n.map(o=>o[i])))}visit(...t){return this.getVisitFn(t[0],!1).apply(this,t)}getVisitFn(t,n=!0){return dz(this,t,n)}getVisitFnByTypeId(t,n=!0){return eu(this,t,n)}visitNull(t,...n){return null}visitBool(t,...n){return null}visitInt(t,...n){return null}visitFloat(t,...n){return null}visitUtf8(t,...n){return null}visitBinary(t,...n){return null}visitFixedSizeBinary(t,...n){return null}visitDate(t,...n){return null}visitTimestamp(t,...n){return null}visitTime(t,...n){return null}visitDecimal(t,...n){return null}visitList(t,...n){return null}visitStruct(t,...n){return null}visitUnion(t,...n){return null}visitDictionary(t,...n){return null}visitInterval(t,...n){return null}visitDuration(t,...n){return null}visitFixedSizeList(t,...n){return null}visitMap(t,...n){return null}};function dz(e,t,n=!0){return typeof t=="number"?eu(e,t,n):typeof t=="string"&&t in L?eu(e,L[t],n):t&&t instanceof at?eu(e,OD(t),n):t?.type&&t.type instanceof at?eu(e,OD(t.type),n):eu(e,L.NONE,n)}function eu(e,t,n=!0){let r=null;switch(t){case L.Null:r=e.visitNull;break;case L.Bool:r=e.visitBool;break;case L.Int:r=e.visitInt;break;case L.Int8:r=e.visitInt8||e.visitInt;break;case L.Int16:r=e.visitInt16||e.visitInt;break;case L.Int32:r=e.visitInt32||e.visitInt;break;case L.Int64:r=e.visitInt64||e.visitInt;break;case L.Uint8:r=e.visitUint8||e.visitInt;break;case L.Uint16:r=e.visitUint16||e.visitInt;break;case L.Uint32:r=e.visitUint32||e.visitInt;break;case L.Uint64:r=e.visitUint64||e.visitInt;break;case L.Float:r=e.visitFloat;break;case L.Float16:r=e.visitFloat16||e.visitFloat;break;case L.Float32:r=e.visitFloat32||e.visitFloat;break;case L.Float64:r=e.visitFloat64||e.visitFloat;break;case L.Utf8:r=e.visitUtf8;break;case L.Binary:r=e.visitBinary;break;case L.FixedSizeBinary:r=e.visitFixedSizeBinary;break;case L.Date:r=e.visitDate;break;case L.DateDay:r=e.visitDateDay||e.visitDate;break;case L.DateMillisecond:r=e.visitDateMillisecond||e.visitDate;break;case L.Timestamp:r=e.visitTimestamp;break;case L.TimestampSecond:r=e.visitTimestampSecond||e.visitTimestamp;break;case L.TimestampMillisecond:r=e.visitTimestampMillisecond||e.visitTimestamp;break;case L.TimestampMicrosecond:r=e.visitTimestampMicrosecond||e.visitTimestamp;break;case L.TimestampNanosecond:r=e.visitTimestampNanosecond||e.visitTimestamp;break;case L.Time:r=e.visitTime;break;case L.TimeSecond:r=e.visitTimeSecond||e.visitTime;break;case L.TimeMillisecond:r=e.visitTimeMillisecond||e.visitTime;break;case L.TimeMicrosecond:r=e.visitTimeMicrosecond||e.visitTime;break;case L.TimeNanosecond:r=e.visitTimeNanosecond||e.visitTime;break;case L.Decimal:r=e.visitDecimal;break;case L.List:r=e.visitList;break;case L.Struct:r=e.visitStruct;break;case L.Union:r=e.visitUnion;break;case L.DenseUnion:r=e.visitDenseUnion||e.visitUnion;break;case L.SparseUnion:r=e.visitSparseUnion||e.visitUnion;break;case L.Dictionary:r=e.visitDictionary;break;case L.Interval:r=e.visitInterval;break;case L.IntervalDayTime:r=e.visitIntervalDayTime||e.visitInterval;break;case L.IntervalYearMonth:r=e.visitIntervalYearMonth||e.visitInterval;break;case L.Duration:r=e.visitDuration;break;case L.DurationSecond:r=e.visitDurationSecond||e.visitDuration;break;case L.DurationMillisecond:r=e.visitDurationMillisecond||e.visitDuration;break;case L.DurationMicrosecond:r=e.visitDurationMicrosecond||e.visitDuration;break;case L.DurationNanosecond:r=e.visitDurationNanosecond||e.visitDuration;break;case L.FixedSizeList:r=e.visitFixedSizeList;break;case L.Map:r=e.visitMap;break}if(typeof r=="function")return r;if(!n)return()=>null;throw new Error(`Unrecognized type '${L[t]}'`)}function OD(e){switch(e.typeId){case L.Null:return L.Null;case L.Int:{let{bitWidth:t,isSigned:n}=e;switch(t){case 8:return n?L.Int8:L.Uint8;case 16:return n?L.Int16:L.Uint16;case 32:return n?L.Int32:L.Uint32;case 64:return n?L.Int64:L.Uint64}return L.Int}case L.Float:switch(e.precision){case Se.HALF:return L.Float16;case Se.SINGLE:return L.Float32;case Se.DOUBLE:return L.Float64}return L.Float;case L.Binary:return L.Binary;case L.Utf8:return L.Utf8;case L.Bool:return L.Bool;case L.Decimal:return L.Decimal;case L.Time:switch(e.unit){case mt.SECOND:return L.TimeSecond;case mt.MILLISECOND:return L.TimeMillisecond;case mt.MICROSECOND:return L.TimeMicrosecond;case mt.NANOSECOND:return L.TimeNanosecond}return L.Time;case L.Timestamp:switch(e.unit){case mt.SECOND:return L.TimestampSecond;case mt.MILLISECOND:return L.TimestampMillisecond;case mt.MICROSECOND:return L.TimestampMicrosecond;case mt.NANOSECOND:return L.TimestampNanosecond}return L.Timestamp;case L.Date:switch(e.unit){case Dn.DAY:return L.DateDay;case Dn.MILLISECOND:return L.DateMillisecond}return L.Date;case L.Interval:switch(e.unit){case sr.DAY_TIME:return L.IntervalDayTime;case sr.YEAR_MONTH:return L.IntervalYearMonth}return L.Interval;case L.Duration:switch(e.unit){case mt.SECOND:return L.DurationSecond;case mt.MILLISECOND:return L.DurationMillisecond;case mt.MICROSECOND:return L.DurationMicrosecond;case mt.NANOSECOND:return L.DurationNanosecond}return L.Duration;case L.Map:return L.Map;case L.List:return L.List;case L.Struct:return L.Struct;case L.Union:switch(e.mode){case xe.Dense:return L.DenseUnion;case xe.Sparse:return L.SparseUnion}return L.Union;case L.FixedSizeBinary:return L.FixedSizeBinary;case L.FixedSizeList:return L.FixedSizeList;case L.Dictionary:return L.Dictionary}throw new Error(`Unrecognized type '${L[e.typeId]}'`)}ut.prototype.visitInt8=null;ut.prototype.visitInt16=null;ut.prototype.visitInt32=null;ut.prototype.visitInt64=null;ut.prototype.visitUint8=null;ut.prototype.visitUint16=null;ut.prototype.visitUint32=null;ut.prototype.visitUint64=null;ut.prototype.visitFloat16=null;ut.prototype.visitFloat32=null;ut.prototype.visitFloat64=null;ut.prototype.visitDateDay=null;ut.prototype.visitDateMillisecond=null;ut.prototype.visitTimestampSecond=null;ut.prototype.visitTimestampMillisecond=null;ut.prototype.visitTimestampMicrosecond=null;ut.prototype.visitTimestampNanosecond=null;ut.prototype.visitTimeSecond=null;ut.prototype.visitTimeMillisecond=null;ut.prototype.visitTimeMicrosecond=null;ut.prototype.visitTimeNanosecond=null;ut.prototype.visitDenseUnion=null;ut.prototype.visitSparseUnion=null;ut.prototype.visitIntervalDayTime=null;ut.prototype.visitIntervalYearMonth=null;ut.prototype.visitDuration=null;ut.prototype.visitDurationSecond=null;ut.prototype.visitDurationMillisecond=null;ut.prototype.visitDurationMicrosecond=null;ut.prototype.visitDurationNanosecond=null;var k_={};wr(k_,{float64ToUint16:()=>Ud,uint16ToFloat64:()=>_g});var BD=new Float64Array(1),nu=new Uint32Array(BD.buffer);function _g(e){let t=(e&31744)>>10,n=(e&1023)/1024,r=Math.pow(-1,(e&32768)>>15);switch(t){case 31:return r*(n?Number.NaN:1/0);case 0:return r*(n?6103515625e-14*n:0)}return r*Math.pow(2,t-15)*(1+n)}function Ud(e){if(e!==e)return 32256;BD[0]=e;let t=(nu[1]&2147483648)>>16&65535,n=nu[1]&2146435072,r=0;return n>=1089470464?nu[0]>0?n=31744:(n=(n&2080374784)>>16,r=(nu[1]&1048575)>>10):n<=1056964608?(r=1048576+(nu[1]&1048575),r=1048576+(r<<(n>>20)-998)>>21,n=0):(n=n-1056964608>>10,r=(nu[1]&1048575)+512>>10),t|n|r&65535}var _t=class extends ut{};function At(e){return(t,n,r)=>{if(t.setValid(n,r!=null))return e(t,n,r)}}var hz=(e,t,n)=>{e[t]=Math.trunc(n/864e5)},C_=(e,t,n)=>{e[t]=Math.trunc(n%4294967296),e[t+1]=Math.trunc(n/4294967296)},pz=(e,t,n)=>{e[t]=Math.trunc(n*1e3%4294967296),e[t+1]=Math.trunc(n*1e3/4294967296)},mz=(e,t,n)=>{e[t]=Math.trunc(n*1e6%4294967296),e[t+1]=Math.trunc(n*1e6/4294967296)},LD=(e,t,n,r)=>{if(n+1<t.length){let{[n]:i,[n+1]:o}=t;e.set(r.subarray(0,o-i),i)}},yz=({offset:e,values:t},n,r)=>{let i=e+n;r?t[i>>3]|=1<<i%8:t[i>>3]&=~(1<<i%8)},rs=({values:e},t,n)=>{e[t]=n},F_=({values:e},t,n)=>{e[t]=n},kD=({values:e},t,n)=>{e[t]=Ud(n)},gz=(e,t,n)=>{switch(e.type.precision){case Se.HALF:return kD(e,t,n);case Se.SINGLE:case Se.DOUBLE:return F_(e,t,n)}},Sg=({values:e},t,n)=>{hz(e,t,n.valueOf())},Ig=({values:e},t,n)=>{C_(e,t*2,n.valueOf())},R_=({stride:e,values:t},n,r)=>{t.set(r.subarray(0,e),e*n)},xz=({values:e,valueOffsets:t},n,r)=>LD(e,t,n,r),bz=({values:e,valueOffsets:t},n,r)=>{LD(e,t,n,ca(r))},$_=(e,t,n)=>{e.type.unit===Dn.DAY?Sg(e,t,n):Ig(e,t,n)},Mg=({values:e},t,n)=>C_(e,t*2,n/1e3),Tg=({values:e},t,n)=>C_(e,t*2,n),Ag=({values:e},t,n)=>pz(e,t*2,n),Eg=({values:e},t,n)=>mz(e,t*2,n),P_=(e,t,n)=>{switch(e.type.unit){case mt.SECOND:return Mg(e,t,n);case mt.MILLISECOND:return Tg(e,t,n);case mt.MICROSECOND:return Ag(e,t,n);case mt.NANOSECOND:return Eg(e,t,n)}},Ng=({values:e},t,n)=>{e[t]=n},Dg=({values:e},t,n)=>{e[t]=n},Og=({values:e},t,n)=>{e[t]=n},Bg=({values:e},t,n)=>{e[t]=n},U_=(e,t,n)=>{switch(e.type.unit){case mt.SECOND:return Ng(e,t,n);case mt.MILLISECOND:return Dg(e,t,n);case mt.MICROSECOND:return Og(e,t,n);case mt.NANOSECOND:return Bg(e,t,n)}},z_=({values:e,stride:t},n,r)=>{e.set(r.subarray(0,t),t*n)},wz=(e,t,n)=>{let r=e.children[0],i=e.valueOffsets,o=xn.getVisitFn(r);if(Array.isArray(n))for(let s=-1,a=i[t],c=i[t+1];a<c;)o(r,a++,n[++s]);else for(let s=-1,a=i[t],c=i[t+1];a<c;)o(r,a++,n.get(++s))},vz=(e,t,n)=>{let r=e.children[0],{valueOffsets:i}=e,o=xn.getVisitFn(r),{[t]:s,[t+1]:a}=i,c=n instanceof Map?n.entries():Object.entries(n);for(let l of c)if(o(r,s,l),++s>=a)break},_z=(e,t)=>(n,r,i,o)=>r&&n(r,e,t[o]),Sz=(e,t)=>(n,r,i,o)=>r&&n(r,e,t.get(o)),Iz=(e,t)=>(n,r,i,o)=>r&&n(r,e,t.get(i.name)),Mz=(e,t)=>(n,r,i,o)=>r&&n(r,e,t[i.name]),Tz=(e,t,n)=>{let r=e.type.children.map(o=>xn.getVisitFn(o.type)),i=n instanceof Map?Iz(t,n):n instanceof Vt?Sz(t,n):Array.isArray(n)?_z(t,n):Mz(t,n);e.type.children.forEach((o,s)=>i(r[s],e.children[s],o,s))},Az=(e,t,n)=>{e.type.mode===xe.Dense?CD(e,t,n):FD(e,t,n)},CD=(e,t,n)=>{let r=e.type.typeIdToChildIndex[e.typeIds[t]],i=e.children[r];xn.visit(i,e.valueOffsets[t],n)},FD=(e,t,n)=>{let r=e.type.typeIdToChildIndex[e.typeIds[t]],i=e.children[r];xn.visit(i,t,n)},Ez=(e,t,n)=>{var r;(r=e.dictionary)===null||r===void 0||r.set(e.values[t],n)},j_=(e,t,n)=>{e.type.unit===sr.DAY_TIME?Lg(e,t,n):kg(e,t,n)},Lg=({values:e},t,n)=>{e.set(n.subarray(0,2),2*t)},kg=({values:e},t,n)=>{e[t]=n[0]*12+n[1]%12},Cg=({values:e},t,n)=>{e[t]=n},Fg=({values:e},t,n)=>{e[t]=n},Rg=({values:e},t,n)=>{e[t]=n},$g=({values:e},t,n)=>{e[t]=n},q_=(e,t,n)=>{switch(e.type.unit){case mt.SECOND:return Cg(e,t,n);case mt.MILLISECOND:return Fg(e,t,n);case mt.MICROSECOND:return Rg(e,t,n);case mt.NANOSECOND:return $g(e,t,n)}},Nz=(e,t,n)=>{let{stride:r}=e,i=e.children[0],o=xn.getVisitFn(i);if(Array.isArray(n))for(let s=-1,a=t*r;++s<r;)o(i,a+s,n[s]);else for(let s=-1,a=t*r;++s<r;)o(i,a+s,n.get(s))};_t.prototype.visitBool=At(yz);_t.prototype.visitInt=At(rs);_t.prototype.visitInt8=At(rs);_t.prototype.visitInt16=At(rs);_t.prototype.visitInt32=At(rs);_t.prototype.visitInt64=At(rs);_t.prototype.visitUint8=At(rs);_t.prototype.visitUint16=At(rs);_t.prototype.visitUint32=At(rs);_t.prototype.visitUint64=At(rs);_t.prototype.visitFloat=At(gz);_t.prototype.visitFloat16=At(kD);_t.prototype.visitFloat32=At(F_);_t.prototype.visitFloat64=At(F_);_t.prototype.visitUtf8=At(bz);_t.prototype.visitBinary=At(xz);_t.prototype.visitFixedSizeBinary=At(R_);_t.prototype.visitDate=At($_);_t.prototype.visitDateDay=At(Sg);_t.prototype.visitDateMillisecond=At(Ig);_t.prototype.visitTimestamp=At(P_);_t.prototype.visitTimestampSecond=At(Mg);_t.prototype.visitTimestampMillisecond=At(Tg);_t.prototype.visitTimestampMicrosecond=At(Ag);_t.prototype.visitTimestampNanosecond=At(Eg);_t.prototype.visitTime=At(U_);_t.prototype.visitTimeSecond=At(Ng);_t.prototype.visitTimeMillisecond=At(Dg);_t.prototype.visitTimeMicrosecond=At(Og);_t.prototype.visitTimeNanosecond=At(Bg);_t.prototype.visitDecimal=At(z_);_t.prototype.visitList=At(wz);_t.prototype.visitStruct=At(Tz);_t.prototype.visitUnion=At(Az);_t.prototype.visitDenseUnion=At(CD);_t.prototype.visitSparseUnion=At(FD);_t.prototype.visitDictionary=At(Ez);_t.prototype.visitInterval=At(j_);_t.prototype.visitIntervalDayTime=At(Lg);_t.prototype.visitIntervalYearMonth=At(kg);_t.prototype.visitDuration=At(q_);_t.prototype.visitDurationSecond=At(Cg);_t.prototype.visitDurationMillisecond=At(Fg);_t.prototype.visitDurationMicrosecond=At(Rg);_t.prototype.visitDurationNanosecond=At($g);_t.prototype.visitFixedSizeList=At(Nz);_t.prototype.visitMap=At(vz);var xn=new _t;var Di=Symbol.for("parent"),ru=Symbol.for("rowIndex"),la=class{constructor(t,n){return this[Di]=t,this[ru]=n,new Proxy(this,new Y_)}toArray(){return Object.values(this.toJSON())}toJSON(){let t=this[ru],n=this[Di],r=n.type.children,i={};for(let o=-1,s=r.length;++o<s;)i[r[o].name]=qe.visit(n.children[o],t);return i}toString(){return`{${[...this].map(([t,n])=>`${Si(t)}: ${Si(n)}`).join(", ")}}`}[Symbol.for("nodejs.util.inspect.custom")](){return this.toString()}[Symbol.iterator](){return new V_(this[Di],this[ru])}},V_=class{constructor(t,n){this.childIndex=0,this.children=t.children,this.rowIndex=n,this.childFields=t.type.children,this.numChildren=this.childFields.length}[Symbol.iterator](){return this}next(){let t=this.childIndex;return t<this.numChildren?(this.childIndex=t+1,{done:!1,value:[this.childFields[t].name,qe.visit(this.children[t],this.rowIndex)]}):{done:!0,value:null}}};Object.defineProperties(la.prototype,{[Symbol.toStringTag]:{enumerable:!1,configurable:!1,value:"Row"},[Di]:{writable:!0,enumerable:!1,configurable:!1,value:null},[ru]:{writable:!0,enumerable:!1,configurable:!1,value:-1}});var Y_=class{isExtensible(){return!1}deleteProperty(){return!1}preventExtensions(){return!0}ownKeys(t){return t[Di].type.children.map(n=>n.name)}has(t,n){return t[Di].type.children.findIndex(r=>r.name===n)!==-1}getOwnPropertyDescriptor(t,n){if(t[Di].type.children.findIndex(r=>r.name===n)!==-1)return{writable:!0,enumerable:!0,configurable:!0}}get(t,n){if(Reflect.has(t,n))return t[n];let r=t[Di].type.children.findIndex(i=>i.name===n);if(r!==-1){let i=qe.visit(t[Di].children[r],t[ru]);return Reflect.set(t,n,i),i}}set(t,n,r){let i=t[Di].type.children.findIndex(o=>o.name===n);return i!==-1?(xn.visit(t[Di].children[i],t[ru],r),Reflect.set(t,n,r)):Reflect.has(t,n)||typeof n=="symbol"?Reflect.set(t,n,r):!1}};var gt=class extends ut{};function Mt(e){return(t,n)=>t.getValid(n)?e(t,n):null}var Dz=(e,t)=>864e5*e[t],X_=(e,t)=>4294967296*e[t+1]+(e[t]>>>0),Oz=(e,t)=>4294967296*(e[t+1]/1e3)+(e[t]>>>0)/1e3,Bz=(e,t)=>4294967296*(e[t+1]/1e6)+(e[t]>>>0)/1e6,RD=e=>new Date(e),Lz=(e,t)=>RD(Dz(e,t)),kz=(e,t)=>RD(X_(e,t)),Cz=(e,t)=>null,$D=(e,t,n)=>{if(n+1>=t.length)return null;let r=t[n],i=t[n+1];return e.subarray(r,i)},Fz=({offset:e,values:t},n)=>{let r=e+n;return(t[r>>3]&1<<r%8)!==0},PD=({values:e},t)=>Lz(e,t),UD=({values:e},t)=>kz(e,t*2),ua=({stride:e,values:t},n)=>t[e*n],Rz=({stride:e,values:t},n)=>_g(t[e*n]),zD=({values:e},t)=>e[t],$z=({stride:e,values:t},n)=>t.subarray(e*n,e*(n+1)),Pz=({values:e,valueOffsets:t},n)=>$D(e,t,n),Uz=({values:e,valueOffsets:t},n)=>{let r=$D(e,t,n);return r!==null?Fd(r):null},zz=({values:e},t)=>e[t],jz=({type:e,values:t},n)=>e.precision!==Se.HALF?t[n]:_g(t[n]),qz=(e,t)=>e.type.unit===Dn.DAY?PD(e,t):UD(e,t),jD=({values:e},t)=>1e3*X_(e,t*2),qD=({values:e},t)=>X_(e,t*2),VD=({values:e},t)=>Oz(e,t*2),YD=({values:e},t)=>Bz(e,t*2),Vz=(e,t)=>{switch(e.type.unit){case mt.SECOND:return jD(e,t);case mt.MILLISECOND:return qD(e,t);case mt.MICROSECOND:return VD(e,t);case mt.NANOSECOND:return YD(e,t)}},XD=({values:e},t)=>e[t],GD=({values:e},t)=>e[t],WD=({values:e},t)=>e[t],HD=({values:e},t)=>e[t],Yz=(e,t)=>{switch(e.type.unit){case mt.SECOND:return XD(e,t);case mt.MILLISECOND:return GD(e,t);case mt.MICROSECOND:return WD(e,t);case mt.NANOSECOND:return HD(e,t)}},Xz=({values:e,stride:t},n)=>Pd.decimal(e.subarray(t*n,t*(n+1))),Gz=(e,t)=>{let{valueOffsets:n,stride:r,children:i}=e,{[t*r]:o,[t*r+1]:s}=n,c=i[0].slice(o,s-o);return new Vt([c])},Wz=(e,t)=>{let{valueOffsets:n,children:r}=e,{[t]:i,[t+1]:o}=n,s=r[0];return new Qi(s.slice(i,o-i))},Hz=(e,t)=>new la(e,t),Zz=(e,t)=>e.type.mode===xe.Dense?ZD(e,t):JD(e,t),ZD=(e,t)=>{let n=e.type.typeIdToChildIndex[e.typeIds[t]],r=e.children[n];return qe.visit(r,e.valueOffsets[t])},JD=(e,t)=>{let n=e.type.typeIdToChildIndex[e.typeIds[t]],r=e.children[n];return qe.visit(r,t)},Jz=(e,t)=>{var n;return(n=e.dictionary)===null||n===void 0?void 0:n.get(e.values[t])},Qz=(e,t)=>e.type.unit===sr.DAY_TIME?QD(e,t):KD(e,t),QD=({values:e},t)=>e.subarray(2*t,2*(t+1)),KD=({values:e},t)=>{let n=e[t],r=new Int32Array(2);return r[0]=Math.trunc(n/12),r[1]=Math.trunc(n%12),r},tO=({values:e},t)=>e[t],eO=({values:e},t)=>e[t],nO=({values:e},t)=>e[t],rO=({values:e},t)=>e[t],Kz=(e,t)=>{switch(e.type.unit){case mt.SECOND:return tO(e,t);case mt.MILLISECOND:return eO(e,t);case mt.MICROSECOND:return nO(e,t);case mt.NANOSECOND:return rO(e,t)}},tj=(e,t)=>{let{stride:n,children:r}=e,o=r[0].slice(t*n,n);return new Vt([o])};gt.prototype.visitNull=Mt(Cz);gt.prototype.visitBool=Mt(Fz);gt.prototype.visitInt=Mt(zz);gt.prototype.visitInt8=Mt(ua);gt.prototype.visitInt16=Mt(ua);gt.prototype.visitInt32=Mt(ua);gt.prototype.visitInt64=Mt(zD);gt.prototype.visitUint8=Mt(ua);gt.prototype.visitUint16=Mt(ua);gt.prototype.visitUint32=Mt(ua);gt.prototype.visitUint64=Mt(zD);gt.prototype.visitFloat=Mt(jz);gt.prototype.visitFloat16=Mt(Rz);gt.prototype.visitFloat32=Mt(ua);gt.prototype.visitFloat64=Mt(ua);gt.prototype.visitUtf8=Mt(Uz);gt.prototype.visitBinary=Mt(Pz);gt.prototype.visitFixedSizeBinary=Mt($z);gt.prototype.visitDate=Mt(qz);gt.prototype.visitDateDay=Mt(PD);gt.prototype.visitDateMillisecond=Mt(UD);gt.prototype.visitTimestamp=Mt(Vz);gt.prototype.visitTimestampSecond=Mt(jD);gt.prototype.visitTimestampMillisecond=Mt(qD);gt.prototype.visitTimestampMicrosecond=Mt(VD);gt.prototype.visitTimestampNanosecond=Mt(YD);gt.prototype.visitTime=Mt(Yz);gt.prototype.visitTimeSecond=Mt(XD);gt.prototype.visitTimeMillisecond=Mt(GD);gt.prototype.visitTimeMicrosecond=Mt(WD);gt.prototype.visitTimeNanosecond=Mt(HD);gt.prototype.visitDecimal=Mt(Xz);gt.prototype.visitList=Mt(Gz);gt.prototype.visitStruct=Mt(Hz);gt.prototype.visitUnion=Mt(Zz);gt.prototype.visitDenseUnion=Mt(ZD);gt.prototype.visitSparseUnion=Mt(JD);gt.prototype.visitDictionary=Mt(Jz);gt.prototype.visitInterval=Mt(Qz);gt.prototype.visitIntervalDayTime=Mt(QD);gt.prototype.visitIntervalYearMonth=Mt(KD);gt.prototype.visitDuration=Mt(Kz);gt.prototype.visitDurationSecond=Mt(tO);gt.prototype.visitDurationMillisecond=Mt(eO);gt.prototype.visitDurationMicrosecond=Mt(nO);gt.prototype.visitDurationNanosecond=Mt(rO);gt.prototype.visitFixedSizeList=Mt(tj);gt.prototype.visitMap=Mt(Wz);var qe=new gt;var Gr=Symbol.for("keys"),iu=Symbol.for("vals"),Qi=class{constructor(t){return this[Gr]=new Vt([t.children[0]]).memoize(),this[iu]=t.children[1],new Proxy(this,new W_)}[Symbol.iterator](){return new G_(this[Gr],this[iu])}get size(){return this[Gr].length}toArray(){return Object.values(this.toJSON())}toJSON(){let t=this[Gr],n=this[iu],r={};for(let i=-1,o=t.length;++i<o;)r[t.get(i)]=qe.visit(n,i);return r}toString(){return`{${[...this].map(([t,n])=>`${Si(t)}: ${Si(n)}`).join(", ")}}`}[Symbol.for("nodejs.util.inspect.custom")](){return this.toString()}},G_=class{constructor(t,n){this.keys=t,this.vals=n,this.keyIndex=0,this.numKeys=t.length}[Symbol.iterator](){return this}next(){let t=this.keyIndex;return t===this.numKeys?{done:!0,value:null}:(this.keyIndex++,{done:!1,value:[this.keys.get(t),qe.visit(this.vals,t)]})}},W_=class{isExtensible(){return!1}deleteProperty(){return!1}preventExtensions(){return!0}ownKeys(t){return t[Gr].toArray().map(String)}has(t,n){return t[Gr].includes(n)}getOwnPropertyDescriptor(t,n){if(t[Gr].indexOf(n)!==-1)return{writable:!0,enumerable:!0,configurable:!0}}get(t,n){if(Reflect.has(t,n))return t[n];let r=t[Gr].indexOf(n);if(r!==-1){let i=qe.visit(Reflect.get(t,iu),r);return Reflect.set(t,n,i),i}}set(t,n,r){let i=t[Gr].indexOf(n);return i!==-1?(xn.visit(Reflect.get(t,iu),i,r),Reflect.set(t,n,r)):Reflect.has(t,n)?Reflect.set(t,n,r):!1}};Object.defineProperties(Qi.prototype,{[Symbol.toStringTag]:{enumerable:!1,configurable:!1,value:"Row"},[Gr]:{writable:!0,enumerable:!1,configurable:!1,value:null},[iu]:{writable:!0,enumerable:!1,configurable:!1,value:null}});function ej(e,t,n){let r=e.length,i=t>-1?t:r+t%r;return n?n(e,i):i}var iO;function zd(e,t,n,r){let{length:i=0}=e,o=typeof t!="number"?0:t,s=typeof n!="number"?i:n;return o<0&&(o=(o%i+i)%i),s<0&&(s=(s%i+i)%i),s<o&&(iO=o,o=s,s=iO),s>i&&(s=i),r?r(e,o,s):[o,s]}var oO=e=>e!==e;function fa(e){if(typeof e!=="object"||e===null)return oO(e)?oO:n=>n===e;if(e instanceof Date){let n=e.valueOf();return r=>r instanceof Date?r.valueOf()===n:!1}return ArrayBuffer.isView(e)?n=>n?A_(e,n):!1:e instanceof Map?rj(e):Array.isArray(e)?nj(e):e instanceof Vt?ij(e):oj(e,!0)}function nj(e){let t=[];for(let n=-1,r=e.length;++n<r;)t[n]=fa(e[n]);return Pg(t)}function rj(e){let t=-1,n=[];for(let r of e.values())n[++t]=fa(r);return Pg(n)}function ij(e){let t=[];for(let n=-1,r=e.length;++n<r;)t[n]=fa(e.get(n));return Pg(t)}function oj(e,t=!1){let n=Object.keys(e);if(!t&&n.length===0)return()=>!1;let r=[];for(let i=-1,o=n.length;++i<o;)r[i]=fa(e[n[i]]);return Pg(r,n)}function Pg(e,t){return n=>{if(!n||typeof n!="object")return!1;switch(n.constructor){case Array:return sj(e,n);case Map:return sO(e,n,n.keys());case Qi:case la:case Object:case void 0:return sO(e,n,t||Object.keys(n))}return n instanceof Vt?aj(e,n):!1}}function sj(e,t){let n=e.length;if(t.length!==n)return!1;for(let r=-1;++r<n;)if(!e[r](t[r]))return!1;return!0}function aj(e,t){let n=e.length;if(t.length!==n)return!1;for(let r=-1;++r<n;)if(!e[r](t.get(r)))return!1;return!0}function sO(e,t,n){let r=n[Symbol.iterator](),i=t instanceof Map?t.keys():Object.keys(t)[Symbol.iterator](),o=t instanceof Map?t.values():Object.values(t)[Symbol.iterator](),s=0,a=e.length,c=o.next(),l=r.next(),u=i.next();for(;s<a&&!l.done&&!u.done&&!c.done&&!(l.value!==u.value||!e[s](c.value));++s,l=r.next(),u=i.next(),c=o.next());return s===a&&l.done&&u.done&&c.done?!0:(r.return&&r.return(),i.return&&i.return(),o.return&&o.return(),!1)}var Z_={};wr(Z_,{BitIterator:()=>vc,getBit:()=>aO,getBool:()=>zg,packBools:()=>Sc,popcnt_array:()=>cO,popcnt_bit_range:()=>jd,popcnt_uint32:()=>Ug,setBool:()=>cj,truncateBitmap:()=>_c});function zg(e,t,n,r){return(n&1<<r)!==0}function aO(e,t,n,r){return(n&1<<r)>>r}function cj(e,t,n){return n?!!(e[t>>3]|=1<<t%8)||!0:!(e[t>>3]&=~(1<<t%8))&&!1}function _c(e,t,n){let r=n.byteLength+7&-8;if(e>0||n.byteLength<r){let i=new Uint8Array(r);return i.set(e%8===0?n.subarray(e>>3):Sc(new vc(n,e,t,null,zg)).subarray(0,r)),i}return n}function Sc(e){let t=[],n=0,r=0,i=0;for(let s of e)s&&(i|=1<<r),++r===8&&(t[n++]=i,i=r=0);(n===0||r>0)&&(t[n++]=i);let o=new Uint8Array(t.length+7&-8);return o.set(t),o}var vc=class{constructor(t,n,r,i,o){this.bytes=t,this.length=r,this.context=i,this.get=o,this.bit=n%8,this.byteIndex=n>>3,this.byte=t[this.byteIndex++],this.index=0}next(){return this.index<this.length?(this.bit===8&&(this.bit=0,this.byte=this.bytes[this.byteIndex++]),{value:this.get(this.context,this.index++,this.byte,this.bit++)}):{done:!0,value:null}}[Symbol.iterator](){return this}};function jd(e,t,n){if(n-t<=0)return 0;if(n-t<8){let o=0;for(let s of new vc(e,t,n-t,e,aO))o+=s;return o}let r=n>>3<<3,i=t+(t%8===0?0:8-t%8);return jd(e,t,i)+jd(e,r,n)+cO(e,i>>3,r-i>>3)}function cO(e,t,n){let r=0,i=Math.trunc(t),o=new DataView(e.buffer,e.byteOffset,e.byteLength),s=n===void 0?e.byteLength:i+n;for(;s-i>=4;)r+=Ug(o.getUint32(i)),i+=4;for(;s-i>=2;)r+=Ug(o.getUint16(i)),i+=2;for(;s-i>=1;)r+=Ug(o.getUint8(i)),i+=1;return r}function Ug(e){let t=Math.trunc(e);return t=t-(t>>>1&1431655765),t=(t&858993459)+(t>>>2&858993459),(t+(t>>>4)&252645135)*16843009>>>24}var lj=-1,se=class e{get typeId(){return this.type.typeId}get ArrayType(){return this.type.ArrayType}get buffers(){return[this.valueOffsets,this.values,this.nullBitmap,this.typeIds]}get nullable(){if(this._nullCount!==0){let{type:t}=this;return at.isSparseUnion(t)?this.children.some(n=>n.nullable):at.isDenseUnion(t)?this.children.some(n=>n.nullable):this.nullBitmap&&this.nullBitmap.byteLength>0}return!0}get byteLength(){let t=0,{valueOffsets:n,values:r,nullBitmap:i,typeIds:o}=this;return n&&(t+=n.byteLength),r&&(t+=r.byteLength),i&&(t+=i.byteLength),o&&(t+=o.byteLength),this.children.reduce((s,a)=>s+a.byteLength,t)}get nullCount(){if(at.isUnion(this.type))return this.children.reduce((r,i)=>r+i.nullCount,0);let t=this._nullCount,n;return t<=lj&&(n=this.nullBitmap)&&(this._nullCount=t=this.length-jd(n,this.offset,this.offset+this.length)),t}constructor(t,n,r,i,o,s=[],a){this.type=t,this.children=s,this.dictionary=a,this.offset=Math.floor(Math.max(n||0,0)),this.length=Math.floor(Math.max(r||0,0)),this._nullCount=Math.floor(Math.max(i||0,-1));let c;o instanceof e?(this.stride=o.stride,this.values=o.values,this.typeIds=o.typeIds,this.nullBitmap=o.nullBitmap,this.valueOffsets=o.valueOffsets):(this.stride=Mr(t),o&&((c=o[0])&&(this.valueOffsets=c),(c=o[1])&&(this.values=c),(c=o[2])&&(this.nullBitmap=c),(c=o[3])&&(this.typeIds=c)))}getValid(t){let{type:n}=this;if(at.isUnion(n)){let r=n,i=this.children[r.typeIdToChildIndex[this.typeIds[t]]],o=r.mode===xe.Dense?this.valueOffsets[t]:t;return i.getValid(o)}if(this.nullable&&this.nullCount>0){let r=this.offset+t;return(this.nullBitmap[r>>3]&1<<r%8)!==0}return!0}setValid(t,n){let r,{type:i}=this;if(at.isUnion(i)){let o=i,s=this.children[o.typeIdToChildIndex[this.typeIds[t]]],a=o.mode===xe.Dense?this.valueOffsets[t]:t;r=s.getValid(a),s.setValid(a,n)}else{let{nullBitmap:o}=this,{offset:s,length:a}=this,c=s+t,l=1<<c%8,u=c>>3;(!o||o.byteLength<=u)&&(o=new Uint8Array((s+a+63&-64)>>3).fill(255),this.nullCount>0&&o.set(_c(s,a,this.nullBitmap),0),Object.assign(this,{nullBitmap:o,_nullCount:-1}));let f=o[u];r=(f&l)!==0,n?o[u]=f|l:o[u]=f&~l}return r!==!!n&&(this._nullCount=this.nullCount+(n?-1:1)),n}clone(t=this.type,n=this.offset,r=this.length,i=this._nullCount,o=this,s=this.children){return new e(t,n,r,i,o,s,this.dictionary)}slice(t,n){let{stride:r,typeId:i,children:o}=this,s=+(this._nullCount===0)-1,a=i===16?r:1,c=this._sliceBuffers(t,n,r,i);return this.clone(this.type,this.offset+t,n,s,c,o.length===0||this.valueOffsets?o:this._sliceChildren(o,a*t,a*n))}_changeLengthAndBackfillNullBitmap(t){if(this.typeId===L.Null)return this.clone(this.type,0,t,0);let{length:n,nullCount:r}=this,i=new Uint8Array((t+63&-64)>>3).fill(255,0,n>>3);i[n>>3]=(1<<n-(n&-8))-1,r>0&&i.set(_c(this.offset,n,this.nullBitmap),0);let o=this.buffers;return o[_i.VALIDITY]=i,this.clone(this.type,0,t,r+(t-n),o)}_sliceBuffers(t,n,r,i){let o,{buffers:s}=this;return(o=s[_i.TYPE])&&(s[_i.TYPE]=o.subarray(t,t+n)),(o=s[_i.OFFSET])&&(s[_i.OFFSET]=o.subarray(t,t+n+1))||(o=s[_i.DATA])&&(s[_i.DATA]=i===6?o:o.subarray(r*t,r*(t+n))),s}_sliceChildren(t,n,r){return t.map(i=>i.slice(n,r))}};se.prototype.children=Object.freeze([]);var J_=class e extends ut{visit(t){return this.getVisitFn(t.type).call(this,t)}visitNull(t){let{["type"]:n,["offset"]:r=0,["length"]:i=0}=t;return new se(n,r,i,i)}visitBool(t){let{["type"]:n,["offset"]:r=0}=t,i=Ot(t.nullBitmap),o=Pt(n.ArrayType,t.data),{["length"]:s=o.length>>3,["nullCount"]:a=t.nullBitmap?-1:0}=t;return new se(n,r,s,a,[void 0,o,i])}visitInt(t){let{["type"]:n,["offset"]:r=0}=t,i=Ot(t.nullBitmap),o=Pt(n.ArrayType,t.data),{["length"]:s=o.length,["nullCount"]:a=t.nullBitmap?-1:0}=t;return new se(n,r,s,a,[void 0,o,i])}visitFloat(t){let{["type"]:n,["offset"]:r=0}=t,i=Ot(t.nullBitmap),o=Pt(n.ArrayType,t.data),{["length"]:s=o.length,["nullCount"]:a=t.nullBitmap?-1:0}=t;return new se(n,r,s,a,[void 0,o,i])}visitUtf8(t){let{["type"]:n,["offset"]:r=0}=t,i=Ot(t.data),o=Ot(t.nullBitmap),s=wc(t.valueOffsets),{["length"]:a=s.length-1,["nullCount"]:c=t.nullBitmap?-1:0}=t;return new se(n,r,a,c,[s,i,o])}visitBinary(t){let{["type"]:n,["offset"]:r=0}=t,i=Ot(t.data),o=Ot(t.nullBitmap),s=wc(t.valueOffsets),{["length"]:a=s.length-1,["nullCount"]:c=t.nullBitmap?-1:0}=t;return new se(n,r,a,c,[s,i,o])}visitFixedSizeBinary(t){let{["type"]:n,["offset"]:r=0}=t,i=Ot(t.nullBitmap),o=Pt(n.ArrayType,t.data),{["length"]:s=o.length/Mr(n),["nullCount"]:a=t.nullBitmap?-1:0}=t;return new se(n,r,s,a,[void 0,o,i])}visitDate(t){let{["type"]:n,["offset"]:r=0}=t,i=Ot(t.nullBitmap),o=Pt(n.ArrayType,t.data),{["length"]:s=o.length/Mr(n),["nullCount"]:a=t.nullBitmap?-1:0}=t;return new se(n,r,s,a,[void 0,o,i])}visitTimestamp(t){let{["type"]:n,["offset"]:r=0}=t,i=Ot(t.nullBitmap),o=Pt(n.ArrayType,t.data),{["length"]:s=o.length/Mr(n),["nullCount"]:a=t.nullBitmap?-1:0}=t;return new se(n,r,s,a,[void 0,o,i])}visitTime(t){let{["type"]:n,["offset"]:r=0}=t,i=Ot(t.nullBitmap),o=Pt(n.ArrayType,t.data),{["length"]:s=o.length/Mr(n),["nullCount"]:a=t.nullBitmap?-1:0}=t;return new se(n,r,s,a,[void 0,o,i])}visitDecimal(t){let{["type"]:n,["offset"]:r=0}=t,i=Ot(t.nullBitmap),o=Pt(n.ArrayType,t.data),{["length"]:s=o.length/Mr(n),["nullCount"]:a=t.nullBitmap?-1:0}=t;return new se(n,r,s,a,[void 0,o,i])}visitList(t){let{["type"]:n,["offset"]:r=0,["child"]:i}=t,o=Ot(t.nullBitmap),s=wc(t.valueOffsets),{["length"]:a=s.length-1,["nullCount"]:c=t.nullBitmap?-1:0}=t;return new se(n,r,a,c,[s,void 0,o],[i])}visitStruct(t){let{["type"]:n,["offset"]:r=0,["children"]:i=[]}=t,o=Ot(t.nullBitmap),{length:s=i.reduce((c,{length:l})=>Math.max(c,l),0),nullCount:a=t.nullBitmap?-1:0}=t;return new se(n,r,s,a,[void 0,void 0,o],i)}visitUnion(t){let{["type"]:n,["offset"]:r=0,["children"]:i=[]}=t,o=Pt(n.ArrayType,t.typeIds),{["length"]:s=o.length,["nullCount"]:a=-1}=t;if(at.isSparseUnion(n))return new se(n,r,s,a,[void 0,void 0,void 0,o],i);let c=wc(t.valueOffsets);return new se(n,r,s,a,[c,void 0,void 0,o],i)}visitDictionary(t){let{["type"]:n,["offset"]:r=0}=t,i=Ot(t.nullBitmap),o=Pt(n.indices.ArrayType,t.data),{["dictionary"]:s=new Vt([new e().visit({type:n.dictionary})])}=t,{["length"]:a=o.length,["nullCount"]:c=t.nullBitmap?-1:0}=t;return new se(n,r,a,c,[void 0,o,i],[],s)}visitInterval(t){let{["type"]:n,["offset"]:r=0}=t,i=Ot(t.nullBitmap),o=Pt(n.ArrayType,t.data),{["length"]:s=o.length/Mr(n),["nullCount"]:a=t.nullBitmap?-1:0}=t;return new se(n,r,s,a,[void 0,o,i])}visitDuration(t){let{["type"]:n,["offset"]:r=0}=t,i=Ot(t.nullBitmap),o=Pt(n.ArrayType,t.data),{["length"]:s=o.length,["nullCount"]:a=t.nullBitmap?-1:0}=t;return new se(n,r,s,a,[void 0,o,i])}visitFixedSizeList(t){let{["type"]:n,["offset"]:r=0,["child"]:i=new e().visit({type:n.valueType})}=t,o=Ot(t.nullBitmap),{["length"]:s=i.length/Mr(n),["nullCount"]:a=t.nullBitmap?-1:0}=t;return new se(n,r,s,a,[void 0,void 0,o],[i])}visitMap(t){let{["type"]:n,["offset"]:r=0,["child"]:i=new e().visit({type:n.childType})}=t,o=Ot(t.nullBitmap),s=wc(t.valueOffsets),{["length"]:a=s.length-1,["nullCount"]:c=t.nullBitmap?-1:0}=t;return new se(n,r,a,c,[s,void 0,o],[i])}},uj=new J_;function Bt(e){return uj.visit(e)}var qd=class{constructor(t=0,n){this.numChunks=t,this.getChunkIterator=n,this.chunkIndex=0,this.chunkIterator=this.getChunkIterator(0)}next(){for(;this.chunkIndex<this.numChunks;){let t=this.chunkIterator.next();if(!t.done)return t;++this.chunkIndex<this.numChunks&&(this.chunkIterator=this.getChunkIterator(this.chunkIndex))}return{done:!0,value:null}}[Symbol.iterator](){return this}};function jg(e){return e.reduce((t,n)=>t+n.nullCount,0)}function qg(e){return e.reduce((t,n,r)=>(t[r+1]=t[r]+n.length,t),new Uint32Array(e.length+1))}function Vg(e,t,n,r){let i=[];for(let o=-1,s=e.length;++o<s;){let a=e[o],c=t[o],{length:l}=a;if(c>=r)break;if(n>=c+l)continue;if(c>=n&&c+l<=r){i.push(a);continue}let u=Math.max(0,n-c),f=Math.min(r-c,l);i.push(a.slice(u,f-u))}return i.length===0&&i.push(e[0].slice(0,0)),i}function Q_(e,t,n,r){let i=0,o=0,s=t.length-1;do{if(i>=s-1)return n<t[s]?r(e,i,n-t[i]):null;o=i+Math.trunc((s-i)*.5),n<t[o]?s=o:i=o}while(i<s)}function Vd(e,t){return e.getValid(t)}function da(e){function t(n,r,i){return e(n[r],i)}return function(n){let r=this.data;return Q_(r,this._offsets,n,t)}}function Yg(e){let t;function n(r,i,o){return e(r[i],o,t)}return function(r,i){let o=this.data;t=i;let s=Q_(o,this._offsets,r,n);return t=void 0,s}}function Xg(e){let t;function n(r,i,o){let s=o,a=0,c=0;for(let l=i-1,u=r.length;++l<u;){let f=r[l];if(~(a=e(f,t,s)))return c+a;s=0,c+=f.length}return-1}return function(r,i){t=r;let o=this.data,s=typeof i!="number"?n(o,0,0):Q_(o,this._offsets,i,n);return t=void 0,s}}var xt=class extends ut{};function fj(e,t){return t===null&&e.length>0?0:-1}function dj(e,t){let{nullBitmap:n}=e;if(!n||e.nullCount<=0)return-1;let r=0;for(let i of new vc(n,e.offset+(t||0),e.length,n,zg)){if(!i)return r;++r}return-1}function Lt(e,t,n){if(t===void 0)return-1;if(t===null)switch(e.typeId){case L.Union:break;case L.Dictionary:break;default:return dj(e,n)}let r=qe.getVisitFn(e),i=fa(t);for(let o=(n||0)-1,s=e.length;++o<s;)if(i(r(e,o)))return o;return-1}function lO(e,t,n){let r=qe.getVisitFn(e),i=fa(t);for(let o=(n||0)-1,s=e.length;++o<s;)if(i(r(e,o)))return o;return-1}xt.prototype.visitNull=fj;xt.prototype.visitBool=Lt;xt.prototype.visitInt=Lt;xt.prototype.visitInt8=Lt;xt.prototype.visitInt16=Lt;xt.prototype.visitInt32=Lt;xt.prototype.visitInt64=Lt;xt.prototype.visitUint8=Lt;xt.prototype.visitUint16=Lt;xt.prototype.visitUint32=Lt;xt.prototype.visitUint64=Lt;xt.prototype.visitFloat=Lt;xt.prototype.visitFloat16=Lt;xt.prototype.visitFloat32=Lt;xt.prototype.visitFloat64=Lt;xt.prototype.visitUtf8=Lt;xt.prototype.visitBinary=Lt;xt.prototype.visitFixedSizeBinary=Lt;xt.prototype.visitDate=Lt;xt.prototype.visitDateDay=Lt;xt.prototype.visitDateMillisecond=Lt;xt.prototype.visitTimestamp=Lt;xt.prototype.visitTimestampSecond=Lt;xt.prototype.visitTimestampMillisecond=Lt;xt.prototype.visitTimestampMicrosecond=Lt;xt.prototype.visitTimestampNanosecond=Lt;xt.prototype.visitTime=Lt;xt.prototype.visitTimeSecond=Lt;xt.prototype.visitTimeMillisecond=Lt;xt.prototype.visitTimeMicrosecond=Lt;xt.prototype.visitTimeNanosecond=Lt;xt.prototype.visitDecimal=Lt;xt.prototype.visitList=Lt;xt.prototype.visitStruct=Lt;xt.prototype.visitUnion=Lt;xt.prototype.visitDenseUnion=lO;xt.prototype.visitSparseUnion=lO;xt.prototype.visitDictionary=Lt;xt.prototype.visitInterval=Lt;xt.prototype.visitIntervalDayTime=Lt;xt.prototype.visitIntervalYearMonth=Lt;xt.prototype.visitDuration=Lt;xt.prototype.visitDurationSecond=Lt;xt.prototype.visitDurationMillisecond=Lt;xt.prototype.visitDurationMicrosecond=Lt;xt.prototype.visitDurationNanosecond=Lt;xt.prototype.visitFixedSizeList=Lt;xt.prototype.visitMap=Lt;var Ic=new xt;var bt=class extends ut{};function Tt(e){let{type:t}=e;if(e.nullCount===0&&e.stride===1&&(t.typeId===L.Timestamp||t instanceof $e&&t.bitWidth!==64||t instanceof Mi&&t.bitWidth!==64||t instanceof cr&&t.precision!==Se.HALF))return new qd(e.data.length,r=>{let i=e.data[r];return i.values.subarray(0,i.length)[Symbol.iterator]()});let n=0;return new qd(e.data.length,r=>{let o=e.data[r].length,s=e.slice(n,n+o);return n+=o,new K_(s)})}var K_=class{constructor(t){this.vector=t,this.index=0}next(){return this.index<this.vector.length?{value:this.vector.get(this.index++)}:{done:!0,value:null}}[Symbol.iterator](){return this}};bt.prototype.visitNull=Tt;bt.prototype.visitBool=Tt;bt.prototype.visitInt=Tt;bt.prototype.visitInt8=Tt;bt.prototype.visitInt16=Tt;bt.prototype.visitInt32=Tt;bt.prototype.visitInt64=Tt;bt.prototype.visitUint8=Tt;bt.prototype.visitUint16=Tt;bt.prototype.visitUint32=Tt;bt.prototype.visitUint64=Tt;bt.prototype.visitFloat=Tt;bt.prototype.visitFloat16=Tt;bt.prototype.visitFloat32=Tt;bt.prototype.visitFloat64=Tt;bt.prototype.visitUtf8=Tt;bt.prototype.visitBinary=Tt;bt.prototype.visitFixedSizeBinary=Tt;bt.prototype.visitDate=Tt;bt.prototype.visitDateDay=Tt;bt.prototype.visitDateMillisecond=Tt;bt.prototype.visitTimestamp=Tt;bt.prototype.visitTimestampSecond=Tt;bt.prototype.visitTimestampMillisecond=Tt;bt.prototype.visitTimestampMicrosecond=Tt;bt.prototype.visitTimestampNanosecond=Tt;bt.prototype.visitTime=Tt;bt.prototype.visitTimeSecond=Tt;bt.prototype.visitTimeMillisecond=Tt;bt.prototype.visitTimeMicrosecond=Tt;bt.prototype.visitTimeNanosecond=Tt;bt.prototype.visitDecimal=Tt;bt.prototype.visitList=Tt;bt.prototype.visitStruct=Tt;bt.prototype.visitUnion=Tt;bt.prototype.visitDenseUnion=Tt;bt.prototype.visitSparseUnion=Tt;bt.prototype.visitDictionary=Tt;bt.prototype.visitInterval=Tt;bt.prototype.visitIntervalDayTime=Tt;bt.prototype.visitIntervalYearMonth=Tt;bt.prototype.visitDuration=Tt;bt.prototype.visitDurationSecond=Tt;bt.prototype.visitDurationMillisecond=Tt;bt.prototype.visitDurationMicrosecond=Tt;bt.prototype.visitDurationNanosecond=Tt;bt.prototype.visitFixedSizeList=Tt;bt.prototype.visitMap=Tt;var ou=new bt;var hj=(e,t)=>e+t,Ki=class extends ut{visitNull(t,n){return 0}visitInt(t,n){return t.type.bitWidth/8}visitFloat(t,n){return t.type.ArrayType.BYTES_PER_ELEMENT}visitBool(t,n){return 1/8}visitDecimal(t,n){return t.type.bitWidth/8}visitDate(t,n){return(t.type.unit+1)*4}visitTime(t,n){return t.type.bitWidth/8}visitTimestamp(t,n){return t.type.unit===mt.SECOND?4:8}visitInterval(t,n){return(t.type.unit+1)*4}visitDuration(t,n){return 8}visitStruct(t,n){return t.children.reduce((r,i)=>r+Tr.visit(i,n),0)}visitFixedSizeBinary(t,n){return t.type.byteWidth}visitMap(t,n){return 8+t.children.reduce((r,i)=>r+Tr.visit(i,n),0)}visitDictionary(t,n){var r;return t.type.indices.bitWidth/8+(((r=t.dictionary)===null||r===void 0?void 0:r.getByteLength(t.values[n]))||0)}},pj=({valueOffsets:e},t)=>8+(e[t+1]-e[t]),mj=({valueOffsets:e},t)=>8+(e[t+1]-e[t]),yj=({valueOffsets:e,stride:t,children:n},r)=>{let i=n[0],{[r*t]:o}=e,{[r*t+1]:s}=e,a=Tr.getVisitFn(i.type),c=i.slice(o,s-o),l=8;for(let u=-1,f=s-o;++u<f;)l+=a(c,u);return l},gj=({stride:e,children:t},n)=>{let r=t[0],i=r.slice(n*e,e),o=Tr.getVisitFn(r.type),s=0;for(let a=-1,c=i.length;++a<c;)s+=o(i,a);return s},xj=(e,t)=>e.type.mode===xe.Dense?uO(e,t):fO(e,t),uO=({type:e,children:t,typeIds:n,valueOffsets:r},i)=>{let o=e.typeIdToChildIndex[n[i]];return 8+Tr.visit(t[o],r[i])},fO=({children:e},t)=>4+Tr.visitMany(e,e.map(()=>t)).reduce(hj,0);Ki.prototype.visitUtf8=pj;Ki.prototype.visitBinary=mj;Ki.prototype.visitList=yj;Ki.prototype.visitFixedSizeList=gj;Ki.prototype.visitUnion=xj;Ki.prototype.visitDenseUnion=uO;Ki.prototype.visitSparseUnion=fO;var Tr=new Ki;var dO,hO={},pO={},Vt=class e{constructor(t){var n,r,i;let o=t[0]instanceof e?t.flatMap(a=>a.data):t;if(o.length===0||o.some(a=>!(a instanceof se)))throw new TypeError("Vector constructor expects an Array of Data instances.");let s=(n=o[0])===null||n===void 0?void 0:n.type;switch(o.length){case 0:this._offsets=[0];break;case 1:{let{get:a,set:c,indexOf:l,byteLength:u}=hO[s.typeId],f=o[0];this.isValid=d=>Vd(f,d),this.get=d=>a(f,d),this.set=(d,h)=>c(f,d,h),this.indexOf=d=>l(f,d),this.getByteLength=d=>u(f,d),this._offsets=[0,f.length];break}default:Object.setPrototypeOf(this,pO[s.typeId]),this._offsets=qg(o);break}this.data=o,this.type=s,this.stride=Mr(s),this.numChildren=(i=(r=s.children)===null||r===void 0?void 0:r.length)!==null&&i!==void 0?i:0,this.length=this._offsets.at(-1)}get byteLength(){return this.data.reduce((t,n)=>t+n.byteLength,0)}get nullCount(){return jg(this.data)}get ArrayType(){return this.type.ArrayType}get[Symbol.toStringTag](){return`${this.VectorName}<${this.type[Symbol.toStringTag]}>`}get VectorName(){return`${L[this.type.typeId]}Vector`}isValid(t){return!1}get(t){return null}set(t,n){}indexOf(t,n){return-1}includes(t,n){return this.indexOf(t,n)>-1}getByteLength(t){return 0}[Symbol.iterator](){return ou.visit(this)}concat(...t){return new e(this.data.concat(t.flatMap(n=>n.data).flat(Number.POSITIVE_INFINITY)))}slice(t,n){return new e(zd(this,t,n,({data:r,_offsets:i},o,s)=>Vg(r,i,o,s)))}toJSON(){return[...this]}toArray(){let{type:t,data:n,length:r,stride:i,ArrayType:o}=this;switch(t.typeId){case L.Int:case L.Float:case L.Decimal:case L.Time:case L.Timestamp:switch(n.length){case 0:return new o;case 1:return n[0].values.subarray(0,r*i);default:return n.reduce((s,{values:a,length:c})=>(s.array.set(a.subarray(0,c*i),s.offset),s.offset+=c*i,s),{array:new o(r*i),offset:0}).array}}return[...this]}toString(){return`[${[...this].join(",")}]`}getChild(t){var n;return this.getChildAt((n=this.type.children)===null||n===void 0?void 0:n.findIndex(r=>r.name===t))}getChildAt(t){return t>-1&&t<this.numChildren?new e(this.data.map(({children:n})=>n[t])):null}get isMemoized(){return at.isDictionary(this.type)?this.data[0].dictionary.isMemoized:!1}memoize(){if(at.isDictionary(this.type)){let t=new Gg(this.data[0].dictionary),n=this.data.map(r=>{let i=r.clone();return i.dictionary=t,i});return new e(n)}return new Gg(this)}unmemoize(){if(at.isDictionary(this.type)&&this.isMemoized){let t=this.data[0].dictionary.unmemoize(),n=this.data.map(r=>{let i=r.clone();return i.dictionary=t,i});return new e(n)}return this}};dO=Symbol.toStringTag;Vt[dO]=(e=>{e.type=at.prototype,e.data=[],e.length=0,e.stride=1,e.numChildren=0,e._offsets=new Uint32Array([0]),e[Symbol.isConcatSpreadable]=!0;let t=Object.keys(L).map(n=>L[n]).filter(n=>typeof n=="number"&&n!==L.NONE);for(let n of t){let r=qe.getVisitFnByTypeId(n),i=xn.getVisitFnByTypeId(n),o=Ic.getVisitFnByTypeId(n),s=Tr.getVisitFnByTypeId(n);hO[n]={get:r,set:i,indexOf:o,byteLength:s},pO[n]=Object.create(e,{isValid:{value:da(Vd)},get:{value:da(qe.getVisitFnByTypeId(n))},set:{value:Yg(xn.getVisitFnByTypeId(n))},indexOf:{value:Xg(Ic.getVisitFnByTypeId(n))},getByteLength:{value:da(Tr.getVisitFnByTypeId(n))}})}return"Vector"})(Vt.prototype);var Gg=class e extends Vt{constructor(t){super(t.data);let n=this.get,r=this.set,i=this.slice,o=new Array(this.length);Object.defineProperty(this,"get",{value(s){let a=o[s];if(a!==void 0)return a;let c=n.call(this,s);return o[s]=c,c}}),Object.defineProperty(this,"set",{value(s,a){r.call(this,s,a),o[s]=a}}),Object.defineProperty(this,"slice",{value:(s,a)=>new e(i.call(this,s,a))}),Object.defineProperty(this,"isMemoized",{value:!0}),Object.defineProperty(this,"unmemoize",{value:()=>new Vt(this.data)}),Object.defineProperty(this,"memoize",{value:()=>this})}};function mO(e){if(!e||e.length<=0)return function(i){return!0};let t="",n=e.filter(r=>r===r);return n.length>0&&(t=`
1
+ var tz=Object.create;var S_=Object.defineProperty;var ez=Object.getOwnPropertyDescriptor;var nz=Object.getOwnPropertyNames;var rz=Object.getPrototypeOf,iz=Object.prototype.hasOwnProperty;var ID=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),_r=(e,t)=>{for(var n in t)S_(e,n,{get:t[n],enumerable:!0})},oz=(e,t,n,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of nz(t))!iz.call(e,i)&&i!==n&&S_(e,i,{get:()=>t[i],enumerable:!(r=ez(t,i))||r.enumerable});return e};var sz=(e,t,n)=>(n=e!=null?tz(rz(e)):{},oz(t||!e||!e.__esModule?S_(n,"default",{value:e,enumerable:!0}):n,e));var K9=ID((y9t,Q9)=>{"use strict";function Gtt(e,t,n,r,i){for(var o=i+1;r<=i;){var s=r+i>>>1,a=e[s],c=n!==void 0?n(a,t):a-t;c>=0?(o=s,i=s-1):r=s+1}return o}function Wtt(e,t,n,r,i){for(var o=i+1;r<=i;){var s=r+i>>>1,a=e[s],c=n!==void 0?n(a,t):a-t;c>0?(o=s,i=s-1):r=s+1}return o}function Htt(e,t,n,r,i){for(var o=r-1;r<=i;){var s=r+i>>>1,a=e[s],c=n!==void 0?n(a,t):a-t;c<0?(o=s,r=s+1):i=s-1}return o}function Ztt(e,t,n,r,i){for(var o=r-1;r<=i;){var s=r+i>>>1,a=e[s],c=n!==void 0?n(a,t):a-t;c<=0?(o=s,r=s+1):i=s-1}return o}function Jtt(e,t,n,r,i){for(;r<=i;){var o=r+i>>>1,s=e[o],a=n!==void 0?n(s,t):s-t;if(a===0)return o;a<=0?r=o+1:i=o-1}return-1}function Ay(e,t,n,r,i,o){return typeof n=="function"?o(e,t,n,r===void 0?0:r|0,i===void 0?e.length-1:i|0):o(e,t,void 0,n===void 0?0:n|0,r===void 0?e.length-1:r|0)}Q9.exports={ge:function(e,t,n,r,i){return Ay(e,t,n,r,i,Gtt)},gt:function(e,t,n,r,i){return Ay(e,t,n,r,i,Wtt)},lt:function(e,t,n,r,i){return Ay(e,t,n,r,i,Htt)},le:function(e,t,n,r,i){return Ay(e,t,n,r,i,Ztt)},eq:function(e,t,n,r,i){return Ay(e,t,n,r,i,Jtt)}}});var aP=ID((g9t,sP)=>{"use strict";var Av=K9(),hd=0,jl=1,Mv=2;sP.exports=Ktt;function M3(e,t,n,r,i){this.mid=e,this.left=t,this.right=n,this.leftPoints=r,this.rightPoints=i,this.count=(t?t.count:0)+(n?n.count:0)+r.length}var Ty=M3.prototype;function S3(e,t){e.mid=t.mid,e.left=t.left,e.right=t.right,e.leftPoints=t.leftPoints,e.rightPoints=t.rightPoints,e.count=t.count}function nP(e,t){var n=pd(t);e.mid=n.mid,e.left=n.left,e.right=n.right,e.leftPoints=n.leftPoints,e.rightPoints=n.rightPoints,e.count=n.count}function tP(e,t){var n=e.intervals([]);n.push(t),nP(e,n)}function eP(e,t){var n=e.intervals([]),r=n.indexOf(t);return r<0?hd:(n.splice(r,1),nP(e,n),jl)}Ty.intervals=function(e){return e.push.apply(e,this.leftPoints),this.left&&this.left.intervals(e),this.right&&this.right.intervals(e),e};Ty.insert=function(e){var t=this.count-this.leftPoints.length;if(this.count+=1,e[1]<this.mid)this.left?4*(this.left.count+1)>3*(t+1)?tP(this,e):this.left.insert(e):this.left=pd([e]);else if(e[0]>this.mid)this.right?4*(this.right.count+1)>3*(t+1)?tP(this,e):this.right.insert(e):this.right=pd([e]);else{var n=Av.ge(this.leftPoints,e,A3),r=Av.ge(this.rightPoints,e,T3);this.leftPoints.splice(n,0,e),this.rightPoints.splice(r,0,e)}};Ty.remove=function(e){var t=this.count-this.leftPoints;if(e[1]<this.mid){if(!this.left)return hd;var n=this.right?this.right.count:0;if(4*n>3*(t-1))return eP(this,e);var r=this.left.remove(e);return r===Mv?(this.left=null,this.count-=1,jl):(r===jl&&(this.count-=1),r)}else if(e[0]>this.mid){if(!this.right)return hd;var i=this.left?this.left.count:0;if(4*i>3*(t-1))return eP(this,e);var r=this.right.remove(e);return r===Mv?(this.right=null,this.count-=1,jl):(r===jl&&(this.count-=1),r)}else{if(this.count===1)return this.leftPoints[0]===e?Mv:hd;if(this.leftPoints.length===1&&this.leftPoints[0]===e){if(this.left&&this.right){for(var o=this,s=this.left;s.right;)o=s,s=s.right;if(o===this)s.right=this.right;else{var a=this.left,r=this.right;o.count-=s.count,o.right=s.left,s.left=a,s.right=r}S3(this,s),this.count=(this.left?this.left.count:0)+(this.right?this.right.count:0)+this.leftPoints.length}else this.left?S3(this,this.left):S3(this,this.right);return jl}for(var a=Av.ge(this.leftPoints,e,A3);a<this.leftPoints.length&&this.leftPoints[a][0]===e[0];++a)if(this.leftPoints[a]===e){this.count-=1,this.leftPoints.splice(a,1);for(var r=Av.ge(this.rightPoints,e,T3);r<this.rightPoints.length&&this.rightPoints[r][1]===e[1];++r)if(this.rightPoints[r]===e)return this.rightPoints.splice(r,1),jl}return hd}};function rP(e,t,n){for(var r=0;r<e.length&&e[r][0]<=t;++r){var i=n(e[r]);if(i)return i}}function iP(e,t,n){for(var r=e.length-1;r>=0&&e[r][1]>=t;--r){var i=n(e[r]);if(i)return i}}function oP(e,t){for(var n=0;n<e.length;++n){var r=t(e[n]);if(r)return r}}Ty.queryPoint=function(e,t){if(e<this.mid){if(this.left){var n=this.left.queryPoint(e,t);if(n)return n}return rP(this.leftPoints,e,t)}else if(e>this.mid){if(this.right){var n=this.right.queryPoint(e,t);if(n)return n}return iP(this.rightPoints,e,t)}else return oP(this.leftPoints,t)};Ty.queryInterval=function(e,t,n){if(e<this.mid&&this.left){var r=this.left.queryInterval(e,t,n);if(r)return r}if(t>this.mid&&this.right){var r=this.right.queryInterval(e,t,n);if(r)return r}return t<this.mid?rP(this.leftPoints,t,n):e>this.mid?iP(this.rightPoints,e,n):oP(this.leftPoints,n)};function Qtt(e,t){return e-t}function A3(e,t){var n=e[0]-t[0];return n||e[1]-t[1]}function T3(e,t){var n=e[1]-t[1];return n||e[0]-t[0]}function pd(e){if(e.length===0)return null;for(var t=[],n=0;n<e.length;++n)t.push(e[n][0],e[n][1]);t.sort(Qtt);for(var r=t[t.length>>1],i=[],o=[],s=[],n=0;n<e.length;++n){var a=e[n];a[1]<r?i.push(a):r<a[0]?o.push(a):s.push(a)}var c=s,l=s.slice();return c.sort(A3),l.sort(T3),new M3(r,pd(i),pd(o),c,l)}function I3(e){this.root=e}var md=I3.prototype;md.insert=function(e){this.root?this.root.insert(e):this.root=new M3(e[0],null,null,[e],[e])};md.remove=function(e){if(this.root){var t=this.root.remove(e);return t===Mv&&(this.root=null),t!==hd}return!1};md.queryPoint=function(e,t){if(this.root)return this.root.queryPoint(e,t)};md.queryInterval=function(e,t,n){if(e<=t&&this.root)return this.root.queryInterval(e,t,n)};Object.defineProperty(md,"count",{get:function(){return this.root?this.root.count:0}});Object.defineProperty(md,"intervals",{get:function(){return this.root?this.root.intervals([]):[]}});function Ktt(e){return!e||e.length===0?new I3(null):new I3(pd(e))}});var MD={};function Fd(e,t=!1){let n,r,i=MD;function o(l){n=e(l).then(()=>{if(r){let{value:u}=r;r=null,o(u)}else n=null})}function s(l){r={event:l}}function a(l){n?s(l):o(l)}function c(l){i!==l&&requestAnimationFrame(()=>{let u=i;i=MD,a(u)}),i=l}return t?c:a}var ar=class{constructor(t){this._filterBy=t,this._requestUpdate=Fd(()=>this.requestQuery(),!0),this._coordinator=null}get coordinator(){return this._coordinator}set coordinator(t){this._coordinator=t}get filterBy(){return this._filterBy}get filterIndexable(){return!0}fields(){return null}fieldInfo(){return this}query(){return null}queryPending(){return this}queryResult(){return this}queryError(t){return console.error(t),this}requestQuery(t){let n=t||this.query(this.filterBy?.predicate(this));return this._coordinator.requestQuery(this,n)}requestUpdate(){this._requestUpdate()}update(){return this}};function TD(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,r=Object.getOwnPropertySymbols(e);i<r.length;i++)t.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(e,r[i])&&(n[r[i]]=e[r[i]]);return n}function Z(e,t,n,r){function i(o){return o instanceof n?o:new n(function(s){s(o)})}return new(n||(n=Promise))(function(o,s){function a(u){try{l(r.next(u))}catch(f){s(f)}}function c(u){try{l(r.throw(u))}catch(f){s(f)}}function l(u){u.done?o(u.value):i(u.value).then(a,c)}l((r=r.apply(e,t||[])).next())})}function AD(e){var t=typeof Symbol=="function"&&Symbol.iterator,n=t&&e[t],r=0;if(n)return n.call(e);if(e&&typeof e.length=="number")return{next:function(){return e&&r>=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function Ft(e){return this instanceof Ft?(this.v=e,this):new Ft(e)}function Sr(e,t,n){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var r=n.apply(e,t||[]),i,o=[];return i={},s("next"),s("throw"),s("return"),i[Symbol.asyncIterator]=function(){return this},i;function s(d){r[d]&&(i[d]=function(h){return new Promise(function(p,m){o.push([d,h,p,m])>1||a(d,h)})})}function a(d,h){try{c(r[d](h))}catch(p){f(o[0][3],p)}}function c(d){d.value instanceof Ft?Promise.resolve(d.value.v).then(l,u):f(o[0][2],d)}function l(d){a("next",d)}function u(d){a("throw",d)}function f(d,h){d(h),o.shift(),o.length&&a(o[0][0],o[0][1])}}function Jl(e){var t,n;return t={},r("next"),r("throw",function(i){throw i}),r("return"),t[Symbol.iterator]=function(){return this},t;function r(i,o){t[i]=e[i]?function(s){return(n=!n)?{value:Ft(e[i](s)),done:!1}:o?o(s):s}:o}}function bi(e){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var t=e[Symbol.asyncIterator],n;return t?t.call(e):(e=typeof AD=="function"?AD(e):e[Symbol.iterator](),n={},r("next"),r("throw"),r("return"),n[Symbol.asyncIterator]=function(){return this},n);function r(o){n[o]=e[o]&&function(s){return new Promise(function(a,c){s=e[o](s),i(a,c,s.done,s.value)})}}function i(o,s,a,c){Promise.resolve(c).then(function(l){o({value:l,done:a})},s)}}var N_={};_r(N_,{compareArrayLike:()=>E_,joinUint8Arrays:()=>Mr,memcpy:()=>Ql,rebaseValueOffsets:()=>fg,toArrayBufferView:()=>Pt,toArrayBufferViewAsyncIterator:()=>vi,toArrayBufferViewIterator:()=>Zi,toBigInt64Array:()=>hz,toBigUint64Array:()=>yz,toFloat32Array:()=>gz,toFloat32ArrayAsyncIterator:()=>Lz,toFloat32ArrayIterator:()=>Mz,toFloat64Array:()=>xz,toFloat64ArrayAsyncIterator:()=>Cz,toFloat64ArrayIterator:()=>Az,toInt16Array:()=>dz,toInt16ArrayAsyncIterator:()=>Nz,toInt16ArrayIterator:()=>vz,toInt32Array:()=>_c,toInt32ArrayAsyncIterator:()=>Dz,toInt32ArrayIterator:()=>_z,toInt8Array:()=>fz,toInt8ArrayAsyncIterator:()=>Ez,toInt8ArrayIterator:()=>wz,toUint16Array:()=>pz,toUint16ArrayAsyncIterator:()=>Oz,toUint16ArrayIterator:()=>Sz,toUint32Array:()=>mz,toUint32ArrayAsyncIterator:()=>Bz,toUint32ArrayIterator:()=>Iz,toUint8Array:()=>Ot,toUint8ArrayAsyncIterator:()=>T_,toUint8ArrayIterator:()=>A_,toUint8ClampedArray:()=>bz,toUint8ClampedArrayAsyncIterator:()=>kz,toUint8ClampedArrayIterator:()=>Tz});var az=new TextDecoder("utf-8"),Rd=e=>az.decode(e),cz=new TextEncoder,ua=e=>cz.encode(e);var lz=e=>typeof e=="number",ED=e=>typeof e=="boolean",tn=e=>typeof e=="function",qn=e=>e!=null&&Object(e)===e,Ir=e=>qn(e)&&tn(e.then);var wi=e=>qn(e)&&tn(e[Symbol.iterator]),Gr=e=>qn(e)&&tn(e[Symbol.asyncIterator]),og=e=>qn(e)&&qn(e.schema);var sg=e=>qn(e)&&"done"in e&&"value"in e;var ag=e=>qn(e)&&tn(e.stat)&&lz(e.fd);var cg=e=>qn(e)&&$d(e.body),lg=e=>"_getDOMStream"in e&&"_getNodeStream"in e,ND=e=>qn(e)&&tn(e.abort)&&tn(e.getWriter)&&!lg(e),$d=e=>qn(e)&&tn(e.cancel)&&tn(e.getReader)&&!lg(e),DD=e=>qn(e)&&tn(e.end)&&tn(e.write)&&ED(e.writable)&&!lg(e),ug=e=>qn(e)&&tn(e.read)&&tn(e.pipe)&&ED(e.readable)&&!lg(e),OD=e=>qn(e)&&tn(e.clear)&&tn(e.bytes)&&tn(e.position)&&tn(e.setPosition)&&tn(e.capacity)&&tn(e.getBufferIdentifier)&&tn(e.createLong);var M_=typeof SharedArrayBuffer<"u"?SharedArrayBuffer:ArrayBuffer;function uz(e){let t=e[0]?[e[0]]:[],n,r,i,o;for(let s,a,c=0,l=0,u=e.length;++c<u;){if(s=t[l],a=e[c],!s||!a||s.buffer!==a.buffer||a.byteOffset<s.byteOffset){a&&(t[++l]=a);continue}if({byteOffset:n,byteLength:i}=s,{byteOffset:r,byteLength:o}=a,n+i<r||r+o<n){a&&(t[++l]=a);continue}t[l]=new Uint8Array(s.buffer,n,r-n+o)}return t}function Ql(e,t,n=0,r=t.byteLength){let i=e.byteLength,o=new Uint8Array(e.buffer,e.byteOffset,i),s=new Uint8Array(t.buffer,t.byteOffset,Math.min(r,i));return o.set(s,n),e}function Mr(e,t){let n=uz(e),r=n.reduce((u,f)=>u+f.byteLength,0),i,o,s,a=0,c=-1,l=Math.min(t||Number.POSITIVE_INFINITY,r);for(let u=n.length;++c<u;){if(i=n[c],o=i.subarray(0,Math.min(i.length,l-a)),l<=a+o.length){o.length<i.length?n[c]=i.subarray(o.length):o.length===i.length&&c++,s?Ql(s,o,a):s=o;break}Ql(s||(s=new Uint8Array(l)),o,a),a+=o.length}return[s||new Uint8Array(0),n.slice(c),r-(s?s.byteLength:0)]}function Pt(e,t){let n=sg(t)?t.value:t;return n instanceof e?e===Uint8Array?new e(n.buffer,n.byteOffset,n.byteLength):n:n?(typeof n=="string"&&(n=ua(n)),n instanceof ArrayBuffer?new e(n):n instanceof M_?new e(n):OD(n)?Pt(e,n.bytes()):ArrayBuffer.isView(n)?n.byteLength<=0?new e(0):new e(n.buffer,n.byteOffset,n.byteLength/e.BYTES_PER_ELEMENT):e.from(n)):new e(0)}var fz=e=>Pt(Int8Array,e),dz=e=>Pt(Int16Array,e),_c=e=>Pt(Int32Array,e),hz=e=>Pt(BigInt64Array,e),Ot=e=>Pt(Uint8Array,e),pz=e=>Pt(Uint16Array,e),mz=e=>Pt(Uint32Array,e),yz=e=>Pt(BigUint64Array,e),gz=e=>Pt(Float32Array,e),xz=e=>Pt(Float64Array,e),bz=e=>Pt(Uint8ClampedArray,e),I_=e=>(e.next(),e);function*Zi(e,t){let n=function*(i){yield i},r=typeof t=="string"||ArrayBuffer.isView(t)||t instanceof ArrayBuffer||t instanceof M_?n(t):wi(t)?t:n(t);return yield*I_(function*(i){let o=null;do o=i.next(yield Pt(e,o));while(!o.done)}(r[Symbol.iterator]())),new e}var wz=e=>Zi(Int8Array,e),vz=e=>Zi(Int16Array,e),_z=e=>Zi(Int32Array,e),A_=e=>Zi(Uint8Array,e),Sz=e=>Zi(Uint16Array,e),Iz=e=>Zi(Uint32Array,e),Mz=e=>Zi(Float32Array,e),Az=e=>Zi(Float64Array,e),Tz=e=>Zi(Uint8ClampedArray,e);function vi(e,t){return Sr(this,arguments,function*(){if(Ir(t))return yield Ft(yield Ft(yield*Jl(bi(vi(e,yield Ft(t))))));let r=function(s){return Sr(this,arguments,function*(){yield yield Ft(yield Ft(s))})},i=function(s){return Sr(this,arguments,function*(){yield Ft(yield*Jl(bi(I_(function*(a){let c=null;do c=a.next(yield c?.value);while(!c.done)}(s[Symbol.iterator]())))))})},o=typeof t=="string"||ArrayBuffer.isView(t)||t instanceof ArrayBuffer||t instanceof M_?r(t):wi(t)?i(t):Gr(t)?t:r(t);return yield Ft(yield*Jl(bi(I_(function(s){return Sr(this,arguments,function*(){let a=null;do a=yield Ft(s.next(yield yield Ft(Pt(e,a))));while(!a.done)})}(o[Symbol.asyncIterator]()))))),yield Ft(new e)})}var Ez=e=>vi(Int8Array,e),Nz=e=>vi(Int16Array,e),Dz=e=>vi(Int32Array,e),T_=e=>vi(Uint8Array,e),Oz=e=>vi(Uint16Array,e),Bz=e=>vi(Uint32Array,e),Lz=e=>vi(Float32Array,e),Cz=e=>vi(Float64Array,e),kz=e=>vi(Uint8ClampedArray,e);function fg(e,t,n){if(e!==0){n=n.slice(0,t);for(let r=-1,i=n.length;++r<i;)n[r]+=e}return n.subarray(0,t)}function E_(e,t){let n=0,r=e.length;if(r!==t.length)return!1;if(r>0)do if(e[n]!==t[n])return!1;while(++n<r);return!0}var yn={fromIterable(e){return dg(Fz(e))},fromAsyncIterable(e){return dg(Rz(e))},fromDOMStream(e){return dg($z(e))},fromNodeStream(e){return dg(Pz(e))},toDOMStream(e,t){throw new Error('"toDOMStream" not available in this environment')},toNodeStream(e,t){throw new Error('"toNodeStream" not available in this environment')}},dg=e=>(e.next(),e);function*Fz(e){let t,n=!1,r=[],i,o,s,a=0;function c(){return o==="peek"?Mr(r,s)[0]:([i,r,a]=Mr(r,s),i)}({cmd:o,size:s}=yield null);let l=A_(e)[Symbol.iterator]();try{do if({done:t,value:i}=Number.isNaN(s-a)?l.next():l.next(s-a),!t&&i.byteLength>0&&(r.push(i),a+=i.byteLength),t||s<=a)do({cmd:o,size:s}=yield c());while(s<a);while(!t)}catch(u){(n=!0)&&typeof l.throw=="function"&&l.throw(u)}finally{n===!1&&typeof l.return=="function"&&l.return(null)}return null}function Rz(e){return Sr(this,arguments,function*(){let n,r=!1,i=[],o,s,a,c=0;function l(){return s==="peek"?Mr(i,a)[0]:([o,i,c]=Mr(i,a),o)}({cmd:s,size:a}=yield yield Ft(null));let u=T_(e)[Symbol.asyncIterator]();try{do if({done:n,value:o}=Number.isNaN(a-c)?yield Ft(u.next()):yield Ft(u.next(a-c)),!n&&o.byteLength>0&&(i.push(o),c+=o.byteLength),n||a<=c)do({cmd:s,size:a}=yield yield Ft(l()));while(a<c);while(!n)}catch(f){(r=!0)&&typeof u.throw=="function"&&(yield Ft(u.throw(f)))}finally{r===!1&&typeof u.return=="function"&&(yield Ft(u.return(new Uint8Array(0))))}return yield Ft(null)})}function $z(e){return Sr(this,arguments,function*(){let n=!1,r=!1,i=[],o,s,a,c=0;function l(){return s==="peek"?Mr(i,a)[0]:([o,i,c]=Mr(i,a),o)}({cmd:s,size:a}=yield yield Ft(null));let u=new O_(e);try{do if({done:n,value:o}=Number.isNaN(a-c)?yield Ft(u.read()):yield Ft(u.read(a-c)),!n&&o.byteLength>0&&(i.push(Ot(o)),c+=o.byteLength),n||a<=c)do({cmd:s,size:a}=yield yield Ft(l()));while(a<c);while(!n)}catch(f){(r=!0)&&(yield Ft(u.cancel(f)))}finally{r===!1?yield Ft(u.cancel()):e.locked&&u.releaseLock()}return yield Ft(null)})}var O_=class{constructor(t){this.source=t,this.reader=null,this.reader=this.source.getReader(),this.reader.closed.catch(()=>{})}get closed(){return this.reader?this.reader.closed.catch(()=>{}):Promise.resolve()}releaseLock(){this.reader&&this.reader.releaseLock(),this.reader=null}cancel(t){return Z(this,void 0,void 0,function*(){let{reader:n,source:r}=this;n&&(yield n.cancel(t).catch(()=>{})),r&&r.locked&&this.releaseLock()})}read(t){return Z(this,void 0,void 0,function*(){if(t===0)return{done:this.reader==null,value:new Uint8Array(0)};let n=yield this.reader.read();return!n.done&&(n.value=Ot(n)),n})}},D_=(e,t)=>{let n=i=>r([t,i]),r;return[t,n,new Promise(i=>(r=i)&&e.once(t,n))]};function Pz(e){return Sr(this,arguments,function*(){let n=[],r="error",i=!1,o=null,s,a,c=0,l=[],u;function f(){return s==="peek"?Mr(l,a)[0]:([u,l,c]=Mr(l,a),u)}if({cmd:s,size:a}=yield yield Ft(null),e.isTTY)return yield yield Ft(new Uint8Array(0)),yield Ft(null);try{n[0]=D_(e,"end"),n[1]=D_(e,"error");do{if(n[2]=D_(e,"readable"),[r,o]=yield Ft(Promise.race(n.map(h=>h[2]))),r==="error")break;if((i=r==="end")||(Number.isFinite(a-c)?(u=Ot(e.read(a-c)),u.byteLength<a-c&&(u=Ot(e.read()))):u=Ot(e.read()),u.byteLength>0&&(l.push(u),c+=u.byteLength)),i||a<=c)do({cmd:s,size:a}=yield yield Ft(f()));while(a<c)}while(!i)}finally{yield Ft(d(n,r==="error"?o:null))}return yield Ft(null);function d(h,p){return u=l=null,new Promise((m,g)=>{for(let[y,x]of h)e.off(y,x);try{let y=e.destroy;y&&y.call(e,p),p=void 0}catch(y){p=y||p}finally{p!=null?g(p):m()}})}})}var Ee;(function(e){e[e.V1=0]="V1",e[e.V2=1]="V2",e[e.V3=2]="V3",e[e.V4=3]="V4",e[e.V5=4]="V5"})(Ee||(Ee={}));var xe;(function(e){e[e.Sparse=0]="Sparse",e[e.Dense=1]="Dense"})(xe||(xe={}));var Se;(function(e){e[e.HALF=0]="HALF",e[e.SINGLE=1]="SINGLE",e[e.DOUBLE=2]="DOUBLE"})(Se||(Se={}));var On;(function(e){e[e.DAY=0]="DAY",e[e.MILLISECOND=1]="MILLISECOND"})(On||(On={}));var mt;(function(e){e[e.SECOND=0]="SECOND",e[e.MILLISECOND=1]="MILLISECOND",e[e.MICROSECOND=2]="MICROSECOND",e[e.NANOSECOND=3]="NANOSECOND"})(mt||(mt={}));var cr;(function(e){e[e.YEAR_MONTH=0]="YEAR_MONTH",e[e.DAY_TIME=1]="DAY_TIME",e[e.MONTH_DAY_NANO=2]="MONTH_DAY_NANO"})(cr||(cr={}));var Qt;(function(e){e[e.NONE=0]="NONE",e[e.Schema=1]="Schema",e[e.DictionaryBatch=2]="DictionaryBatch",e[e.RecordBatch=3]="RecordBatch",e[e.Tensor=4]="Tensor",e[e.SparseTensor=5]="SparseTensor"})(Qt||(Qt={}));var C;(function(e){e[e.NONE=0]="NONE",e[e.Null=1]="Null",e[e.Int=2]="Int",e[e.Float=3]="Float",e[e.Binary=4]="Binary",e[e.Utf8=5]="Utf8",e[e.Bool=6]="Bool",e[e.Decimal=7]="Decimal",e[e.Date=8]="Date",e[e.Time=9]="Time",e[e.Timestamp=10]="Timestamp",e[e.Interval=11]="Interval",e[e.List=12]="List",e[e.Struct=13]="Struct",e[e.Union=14]="Union",e[e.FixedSizeBinary=15]="FixedSizeBinary",e[e.FixedSizeList=16]="FixedSizeList",e[e.Map=17]="Map",e[e.Duration=18]="Duration",e[e.Dictionary=-1]="Dictionary",e[e.Int8=-2]="Int8",e[e.Int16=-3]="Int16",e[e.Int32=-4]="Int32",e[e.Int64=-5]="Int64",e[e.Uint8=-6]="Uint8",e[e.Uint16=-7]="Uint16",e[e.Uint32=-8]="Uint32",e[e.Uint64=-9]="Uint64",e[e.Float16=-10]="Float16",e[e.Float32=-11]="Float32",e[e.Float64=-12]="Float64",e[e.DateDay=-13]="DateDay",e[e.DateMillisecond=-14]="DateMillisecond",e[e.TimestampSecond=-15]="TimestampSecond",e[e.TimestampMillisecond=-16]="TimestampMillisecond",e[e.TimestampMicrosecond=-17]="TimestampMicrosecond",e[e.TimestampNanosecond=-18]="TimestampNanosecond",e[e.TimeSecond=-19]="TimeSecond",e[e.TimeMillisecond=-20]="TimeMillisecond",e[e.TimeMicrosecond=-21]="TimeMicrosecond",e[e.TimeNanosecond=-22]="TimeNanosecond",e[e.DenseUnion=-23]="DenseUnion",e[e.SparseUnion=-24]="SparseUnion",e[e.IntervalDayTime=-25]="IntervalDayTime",e[e.IntervalYearMonth=-26]="IntervalYearMonth",e[e.DurationSecond=-27]="DurationSecond",e[e.DurationMillisecond=-28]="DurationMillisecond",e[e.DurationMicrosecond=-29]="DurationMicrosecond",e[e.DurationNanosecond=-30]="DurationNanosecond"})(C||(C={}));var _i;(function(e){e[e.OFFSET=0]="OFFSET",e[e.DATA=1]="DATA",e[e.VALIDITY=2]="VALIDITY",e[e.TYPE=3]="TYPE"})(_i||(_i={}));var Z_={};_r(Z_,{clampIndex:()=>Dq,clampRange:()=>qd,createElementComparator:()=>ha});var B_={};_r(B_,{valueToString:()=>Si});function Si(e){if(e===null)return"null";if(e===void 0)return"undefined";switch(typeof e){case"number":return`${e}`;case"bigint":return`${e}`;case"string":return`"${e}"`}return typeof e[Symbol.toPrimitive]=="function"?e[Symbol.toPrimitive]("string"):ArrayBuffer.isView(e)?e instanceof BigInt64Array||e instanceof BigUint64Array?`[${[...e].map(t=>Si(t))}]`:`[${e}]`:ArrayBuffer.isView(e)?`[${e}]`:JSON.stringify(e,(t,n)=>typeof n=="bigint"?`${n}`:n)}var C_={};_r(C_,{BN:()=>Ud,bigNumToBigInt:()=>CD,bigNumToString:()=>eu,isArrowBigNumSymbol:()=>BD});var BD=Symbol.for("isArrowBigNum");function Ii(e,...t){return t.length===0?Object.setPrototypeOf(Pt(this.TypedArray,e),this.constructor.prototype):Object.setPrototypeOf(new this.TypedArray(e,...t),this.constructor.prototype)}Ii.prototype[BD]=!0;Ii.prototype.toJSON=function(){return`"${eu(this)}"`};Ii.prototype.valueOf=function(){return LD(this)};Ii.prototype.toString=function(){return eu(this)};Ii.prototype[Symbol.toPrimitive]=function(e="default"){switch(e){case"number":return LD(this);case"string":return eu(this);case"default":return CD(this)}return eu(this)};function Kl(...e){return Ii.apply(this,e)}function tu(...e){return Ii.apply(this,e)}function Pd(...e){return Ii.apply(this,e)}Object.setPrototypeOf(Kl.prototype,Object.create(Int32Array.prototype));Object.setPrototypeOf(tu.prototype,Object.create(Uint32Array.prototype));Object.setPrototypeOf(Pd.prototype,Object.create(Uint32Array.prototype));Object.assign(Kl.prototype,Ii.prototype,{constructor:Kl,signed:!0,TypedArray:Int32Array,BigIntArray:BigInt64Array});Object.assign(tu.prototype,Ii.prototype,{constructor:tu,signed:!1,TypedArray:Uint32Array,BigIntArray:BigUint64Array});Object.assign(Pd.prototype,Ii.prototype,{constructor:Pd,signed:!0,TypedArray:Uint32Array,BigIntArray:BigUint64Array});function LD(e){let{buffer:t,byteOffset:n,length:r,signed:i}=e,o=new BigUint64Array(t,n,r),s=i&&o.at(-1)&BigInt(1)<<BigInt(63),a=BigInt(s?1:0),c=BigInt(0);if(s){for(let l of o)a+=~l*(BigInt(1)<<BigInt(32)*c++);a*=BigInt(-1)}else for(let l of o)a+=l*(BigInt(1)<<BigInt(32)*c++);return a}var eu=e=>{if(e.byteLength===8)return`${new e.BigIntArray(e.buffer,e.byteOffset,1)[0]}`;if(!e.signed)return L_(e);let t=new Uint16Array(e.buffer,e.byteOffset,e.byteLength/2);if(new Int16Array([t.at(-1)])[0]>=0)return L_(e);t=t.slice();let r=1;for(let o=0;o<t.length;o++){let s=t[o],a=~s+r;t[o]=a,r&=s===0?1:0}return`-${L_(t)}`},CD=e=>e.byteLength===8?new e.BigIntArray(e.buffer,e.byteOffset,1)[0]:eu(e);function L_(e){let t="",n=new Uint32Array(2),r=new Uint16Array(e.buffer,e.byteOffset,e.byteLength/2),i=new Uint32Array((r=new Uint16Array(r).reverse()).buffer),o=-1,s=r.length-1;do{for(n[0]=r[o=0];o<s;)r[o++]=n[1]=n[0]/10,n[0]=(n[0]-n[1]*10<<16)+r[o];r[o]=n[1]=n[0]/10,n[0]=n[0]-n[1]*10,t=`${n[0]}${t}`}while(i[0]||i[1]||i[2]||i[3]);return t??"0"}var Ud=class e{static new(t,n){switch(n){case!0:return new Kl(t);case!1:return new tu(t)}switch(t.constructor){case Int8Array:case Int16Array:case Int32Array:case BigInt64Array:return new Kl(t)}return t.byteLength===16?new Pd(t):new tu(t)}static signed(t){return new Kl(t)}static unsigned(t){return new tu(t)}static decimal(t){return new Pd(t)}constructor(t,n){return e.new(t,n)}};function lr(e){if(typeof e=="bigint"&&(e<Number.MIN_SAFE_INTEGER||e>Number.MAX_SAFE_INTEGER))throw new TypeError(`${e} is not safe to convert to a number.`);return Number(e)}var kD,FD,RD,$D,PD,UD,zD,qD,jD,VD,YD,XD,GD,WD,HD,ZD,JD,QD,KD,tO,at=class e{static isNull(t){return t?.typeId===C.Null}static isInt(t){return t?.typeId===C.Int}static isFloat(t){return t?.typeId===C.Float}static isBinary(t){return t?.typeId===C.Binary}static isUtf8(t){return t?.typeId===C.Utf8}static isBool(t){return t?.typeId===C.Bool}static isDecimal(t){return t?.typeId===C.Decimal}static isDate(t){return t?.typeId===C.Date}static isTime(t){return t?.typeId===C.Time}static isTimestamp(t){return t?.typeId===C.Timestamp}static isInterval(t){return t?.typeId===C.Interval}static isDuration(t){return t?.typeId===C.Duration}static isList(t){return t?.typeId===C.List}static isStruct(t){return t?.typeId===C.Struct}static isUnion(t){return t?.typeId===C.Union}static isFixedSizeBinary(t){return t?.typeId===C.FixedSizeBinary}static isFixedSizeList(t){return t?.typeId===C.FixedSizeList}static isMap(t){return t?.typeId===C.Map}static isDictionary(t){return t?.typeId===C.Dictionary}static isDenseUnion(t){return e.isUnion(t)&&t.mode===xe.Dense}static isSparseUnion(t){return e.isUnion(t)&&t.mode===xe.Sparse}get typeId(){return C.NONE}};kD=Symbol.toStringTag;at[kD]=(e=>(e.children=null,e.ArrayType=Array,e[Symbol.toStringTag]="DataType"))(at.prototype);var jn=class extends at{toString(){return"Null"}get typeId(){return C.Null}};FD=Symbol.toStringTag;jn[FD]=(e=>e[Symbol.toStringTag]="Null")(jn.prototype);var $e=class extends at{constructor(t,n){super(),this.isSigned=t,this.bitWidth=n}get typeId(){return C.Int}get ArrayType(){switch(this.bitWidth){case 8:return this.isSigned?Int8Array:Uint8Array;case 16:return this.isSigned?Int16Array:Uint16Array;case 32:return this.isSigned?Int32Array:Uint32Array;case 64:return this.isSigned?BigInt64Array:BigUint64Array}throw new Error(`Unrecognized ${this[Symbol.toStringTag]} type`)}toString(){return`${this.isSigned?"I":"Ui"}nt${this.bitWidth}`}};RD=Symbol.toStringTag;$e[RD]=(e=>(e.isSigned=null,e.bitWidth=null,e[Symbol.toStringTag]="Int"))($e.prototype);var hg=class extends $e{constructor(){super(!0,8)}get ArrayType(){return Int8Array}},pg=class extends $e{constructor(){super(!0,16)}get ArrayType(){return Int16Array}},Ji=class extends $e{constructor(){super(!0,32)}get ArrayType(){return Int32Array}},mg=class extends $e{constructor(){super(!0,64)}get ArrayType(){return BigInt64Array}},yg=class extends $e{constructor(){super(!1,8)}get ArrayType(){return Uint8Array}},gg=class extends $e{constructor(){super(!1,16)}get ArrayType(){return Uint16Array}},xg=class extends $e{constructor(){super(!1,32)}get ArrayType(){return Uint32Array}},bg=class extends $e{constructor(){super(!1,64)}get ArrayType(){return BigUint64Array}};Object.defineProperty(hg.prototype,"ArrayType",{value:Int8Array});Object.defineProperty(pg.prototype,"ArrayType",{value:Int16Array});Object.defineProperty(Ji.prototype,"ArrayType",{value:Int32Array});Object.defineProperty(mg.prototype,"ArrayType",{value:BigInt64Array});Object.defineProperty(yg.prototype,"ArrayType",{value:Uint8Array});Object.defineProperty(gg.prototype,"ArrayType",{value:Uint16Array});Object.defineProperty(xg.prototype,"ArrayType",{value:Uint32Array});Object.defineProperty(bg.prototype,"ArrayType",{value:BigUint64Array});var ur=class extends at{constructor(t){super(),this.precision=t}get typeId(){return C.Float}get ArrayType(){switch(this.precision){case Se.HALF:return Uint16Array;case Se.SINGLE:return Float32Array;case Se.DOUBLE:return Float64Array}throw new Error(`Unrecognized ${this[Symbol.toStringTag]} type`)}toString(){return`Float${this.precision<<5||16}`}};$D=Symbol.toStringTag;ur[$D]=(e=>(e.precision=null,e[Symbol.toStringTag]="Float"))(ur.prototype);var wg=class extends ur{constructor(){super(Se.HALF)}},vg=class extends ur{constructor(){super(Se.SINGLE)}},_g=class extends ur{constructor(){super(Se.DOUBLE)}};Object.defineProperty(wg.prototype,"ArrayType",{value:Uint16Array});Object.defineProperty(vg.prototype,"ArrayType",{value:Float32Array});Object.defineProperty(_g.prototype,"ArrayType",{value:Float64Array});var Wo=class extends at{constructor(){super()}get typeId(){return C.Binary}toString(){return"Binary"}};PD=Symbol.toStringTag;Wo[PD]=(e=>(e.ArrayType=Uint8Array,e[Symbol.toStringTag]="Binary"))(Wo.prototype);var Ho=class extends at{constructor(){super()}get typeId(){return C.Utf8}toString(){return"Utf8"}};UD=Symbol.toStringTag;Ho[UD]=(e=>(e.ArrayType=Uint8Array,e[Symbol.toStringTag]="Utf8"))(Ho.prototype);var Zo=class extends at{constructor(){super()}get typeId(){return C.Bool}toString(){return"Bool"}};zD=Symbol.toStringTag;Zo[zD]=(e=>(e.ArrayType=Uint8Array,e[Symbol.toStringTag]="Bool"))(Zo.prototype);var Jo=class extends at{constructor(t,n,r=128){super(),this.scale=t,this.precision=n,this.bitWidth=r}get typeId(){return C.Decimal}toString(){return`Decimal[${this.precision}e${this.scale>0?"+":""}${this.scale}]`}};qD=Symbol.toStringTag;Jo[qD]=(e=>(e.scale=null,e.precision=null,e.ArrayType=Uint32Array,e[Symbol.toStringTag]="Decimal"))(Jo.prototype);var Qo=class extends at{constructor(t){super(),this.unit=t}get typeId(){return C.Date}toString(){return`Date${(this.unit+1)*32}<${On[this.unit]}>`}};jD=Symbol.toStringTag;Qo[jD]=(e=>(e.unit=null,e.ArrayType=Int32Array,e[Symbol.toStringTag]="Date"))(Qo.prototype);var Mi=class extends at{constructor(t,n){super(),this.unit=t,this.bitWidth=n}get typeId(){return C.Time}toString(){return`Time${this.bitWidth}<${mt[this.unit]}>`}get ArrayType(){switch(this.bitWidth){case 32:return Int32Array;case 64:return BigInt64Array}throw new Error(`Unrecognized ${this[Symbol.toStringTag]} type`)}};VD=Symbol.toStringTag;Mi[VD]=(e=>(e.unit=null,e.bitWidth=null,e[Symbol.toStringTag]="Time"))(Mi.prototype);var Ko=class extends at{constructor(t,n){super(),this.unit=t,this.timezone=n}get typeId(){return C.Timestamp}toString(){return`Timestamp<${mt[this.unit]}${this.timezone?`, ${this.timezone}`:""}>`}};YD=Symbol.toStringTag;Ko[YD]=(e=>(e.unit=null,e.timezone=null,e.ArrayType=Int32Array,e[Symbol.toStringTag]="Timestamp"))(Ko.prototype);var ts=class extends at{constructor(t){super(),this.unit=t}get typeId(){return C.Interval}toString(){return`Interval<${cr[this.unit]}>`}};XD=Symbol.toStringTag;ts[XD]=(e=>(e.unit=null,e.ArrayType=Int32Array,e[Symbol.toStringTag]="Interval"))(ts.prototype);var es=class extends at{constructor(t){super(),this.unit=t}get typeId(){return C.Duration}toString(){return`Duration<${mt[this.unit]}>`}};GD=Symbol.toStringTag;es[GD]=(e=>(e.unit=null,e.ArrayType=BigInt64Array,e[Symbol.toStringTag]="Duration"))(es.prototype);var Ai=class extends at{constructor(t){super(),this.children=[t]}get typeId(){return C.List}toString(){return`List<${this.valueType}>`}get valueType(){return this.children[0].type}get valueField(){return this.children[0]}get ArrayType(){return this.valueType.ArrayType}};WD=Symbol.toStringTag;Ai[WD]=(e=>(e.children=null,e[Symbol.toStringTag]="List"))(Ai.prototype);var me=class extends at{constructor(t){super(),this.children=t}get typeId(){return C.Struct}toString(){return`Struct<{${this.children.map(t=>`${t.name}:${t.type}`).join(", ")}}>`}};HD=Symbol.toStringTag;me[HD]=(e=>(e.children=null,e[Symbol.toStringTag]="Struct"))(me.prototype);var Ti=class extends at{constructor(t,n,r){super(),this.mode=t,this.children=r,this.typeIds=n=Int32Array.from(n),this.typeIdToChildIndex=n.reduce((i,o,s)=>(i[o]=s)&&i||i,Object.create(null))}get typeId(){return C.Union}toString(){return`${this[Symbol.toStringTag]}<${this.children.map(t=>`${t.type}`).join(" | ")}>`}};ZD=Symbol.toStringTag;Ti[ZD]=(e=>(e.mode=null,e.typeIds=null,e.children=null,e.typeIdToChildIndex=null,e.ArrayType=Int8Array,e[Symbol.toStringTag]="Union"))(Ti.prototype);var ns=class extends at{constructor(t){super(),this.byteWidth=t}get typeId(){return C.FixedSizeBinary}toString(){return`FixedSizeBinary[${this.byteWidth}]`}};JD=Symbol.toStringTag;ns[JD]=(e=>(e.byteWidth=null,e.ArrayType=Uint8Array,e[Symbol.toStringTag]="FixedSizeBinary"))(ns.prototype);var Ei=class extends at{constructor(t,n){super(),this.listSize=t,this.children=[n]}get typeId(){return C.FixedSizeList}get valueType(){return this.children[0].type}get valueField(){return this.children[0]}get ArrayType(){return this.valueType.ArrayType}toString(){return`FixedSizeList[${this.listSize}]<${this.valueType}>`}};QD=Symbol.toStringTag;Ei[QD]=(e=>(e.children=null,e.listSize=null,e[Symbol.toStringTag]="FixedSizeList"))(Ei.prototype);var Ni=class extends at{constructor(t,n=!1){var r,i,o;if(super(),this.children=[t],this.keysSorted=n,t&&(t.name="entries",!((r=t?.type)===null||r===void 0)&&r.children)){let s=(i=t?.type)===null||i===void 0?void 0:i.children[0];s&&(s.name="key");let a=(o=t?.type)===null||o===void 0?void 0:o.children[1];a&&(a.name="value")}}get typeId(){return C.Map}get keyType(){return this.children[0].type.children[0].type}get valueType(){return this.children[0].type.children[1].type}get childType(){return this.children[0].type}toString(){return`Map<{${this.children[0].type.children.map(t=>`${t.name}:${t.type}`).join(", ")}}>`}};KD=Symbol.toStringTag;Ni[KD]=(e=>(e.children=null,e.keysSorted=null,e[Symbol.toStringTag]="Map_"))(Ni.prototype);var Uz=(e=>()=>++e)(-1),Ar=class extends at{constructor(t,n,r,i){super(),this.indices=n,this.dictionary=t,this.isOrdered=i||!1,this.id=r==null?Uz():lr(r)}get typeId(){return C.Dictionary}get children(){return this.dictionary.children}get valueType(){return this.dictionary}get ArrayType(){return this.dictionary.ArrayType}toString(){return`Dictionary<${this.indices}, ${this.dictionary}>`}};tO=Symbol.toStringTag;Ar[tO]=(e=>(e.id=null,e.indices=null,e.isOrdered=null,e.dictionary=null,e[Symbol.toStringTag]="Dictionary"))(Ar.prototype);function Tr(e){let t=e;switch(e.typeId){case C.Decimal:return e.bitWidth/32;case C.Timestamp:return 2;case C.Date:return 1+t.unit;case C.Interval:return 1+t.unit;case C.FixedSizeList:return t.listSize;case C.FixedSizeBinary:return t.byteWidth;default:return 1}}var ut=class{visitMany(t,...n){return t.map((r,i)=>this.visit(r,...n.map(o=>o[i])))}visit(...t){return this.getVisitFn(t[0],!1).apply(this,t)}getVisitFn(t,n=!0){return zz(this,t,n)}getVisitFnByTypeId(t,n=!0){return nu(this,t,n)}visitNull(t,...n){return null}visitBool(t,...n){return null}visitInt(t,...n){return null}visitFloat(t,...n){return null}visitUtf8(t,...n){return null}visitBinary(t,...n){return null}visitFixedSizeBinary(t,...n){return null}visitDate(t,...n){return null}visitTimestamp(t,...n){return null}visitTime(t,...n){return null}visitDecimal(t,...n){return null}visitList(t,...n){return null}visitStruct(t,...n){return null}visitUnion(t,...n){return null}visitDictionary(t,...n){return null}visitInterval(t,...n){return null}visitDuration(t,...n){return null}visitFixedSizeList(t,...n){return null}visitMap(t,...n){return null}};function zz(e,t,n=!0){return typeof t=="number"?nu(e,t,n):typeof t=="string"&&t in C?nu(e,C[t],n):t&&t instanceof at?nu(e,eO(t),n):t?.type&&t.type instanceof at?nu(e,eO(t.type),n):nu(e,C.NONE,n)}function nu(e,t,n=!0){let r=null;switch(t){case C.Null:r=e.visitNull;break;case C.Bool:r=e.visitBool;break;case C.Int:r=e.visitInt;break;case C.Int8:r=e.visitInt8||e.visitInt;break;case C.Int16:r=e.visitInt16||e.visitInt;break;case C.Int32:r=e.visitInt32||e.visitInt;break;case C.Int64:r=e.visitInt64||e.visitInt;break;case C.Uint8:r=e.visitUint8||e.visitInt;break;case C.Uint16:r=e.visitUint16||e.visitInt;break;case C.Uint32:r=e.visitUint32||e.visitInt;break;case C.Uint64:r=e.visitUint64||e.visitInt;break;case C.Float:r=e.visitFloat;break;case C.Float16:r=e.visitFloat16||e.visitFloat;break;case C.Float32:r=e.visitFloat32||e.visitFloat;break;case C.Float64:r=e.visitFloat64||e.visitFloat;break;case C.Utf8:r=e.visitUtf8;break;case C.Binary:r=e.visitBinary;break;case C.FixedSizeBinary:r=e.visitFixedSizeBinary;break;case C.Date:r=e.visitDate;break;case C.DateDay:r=e.visitDateDay||e.visitDate;break;case C.DateMillisecond:r=e.visitDateMillisecond||e.visitDate;break;case C.Timestamp:r=e.visitTimestamp;break;case C.TimestampSecond:r=e.visitTimestampSecond||e.visitTimestamp;break;case C.TimestampMillisecond:r=e.visitTimestampMillisecond||e.visitTimestamp;break;case C.TimestampMicrosecond:r=e.visitTimestampMicrosecond||e.visitTimestamp;break;case C.TimestampNanosecond:r=e.visitTimestampNanosecond||e.visitTimestamp;break;case C.Time:r=e.visitTime;break;case C.TimeSecond:r=e.visitTimeSecond||e.visitTime;break;case C.TimeMillisecond:r=e.visitTimeMillisecond||e.visitTime;break;case C.TimeMicrosecond:r=e.visitTimeMicrosecond||e.visitTime;break;case C.TimeNanosecond:r=e.visitTimeNanosecond||e.visitTime;break;case C.Decimal:r=e.visitDecimal;break;case C.List:r=e.visitList;break;case C.Struct:r=e.visitStruct;break;case C.Union:r=e.visitUnion;break;case C.DenseUnion:r=e.visitDenseUnion||e.visitUnion;break;case C.SparseUnion:r=e.visitSparseUnion||e.visitUnion;break;case C.Dictionary:r=e.visitDictionary;break;case C.Interval:r=e.visitInterval;break;case C.IntervalDayTime:r=e.visitIntervalDayTime||e.visitInterval;break;case C.IntervalYearMonth:r=e.visitIntervalYearMonth||e.visitInterval;break;case C.Duration:r=e.visitDuration;break;case C.DurationSecond:r=e.visitDurationSecond||e.visitDuration;break;case C.DurationMillisecond:r=e.visitDurationMillisecond||e.visitDuration;break;case C.DurationMicrosecond:r=e.visitDurationMicrosecond||e.visitDuration;break;case C.DurationNanosecond:r=e.visitDurationNanosecond||e.visitDuration;break;case C.FixedSizeList:r=e.visitFixedSizeList;break;case C.Map:r=e.visitMap;break}if(typeof r=="function")return r;if(!n)return()=>null;throw new Error(`Unrecognized type '${C[t]}'`)}function eO(e){switch(e.typeId){case C.Null:return C.Null;case C.Int:{let{bitWidth:t,isSigned:n}=e;switch(t){case 8:return n?C.Int8:C.Uint8;case 16:return n?C.Int16:C.Uint16;case 32:return n?C.Int32:C.Uint32;case 64:return n?C.Int64:C.Uint64}return C.Int}case C.Float:switch(e.precision){case Se.HALF:return C.Float16;case Se.SINGLE:return C.Float32;case Se.DOUBLE:return C.Float64}return C.Float;case C.Binary:return C.Binary;case C.Utf8:return C.Utf8;case C.Bool:return C.Bool;case C.Decimal:return C.Decimal;case C.Time:switch(e.unit){case mt.SECOND:return C.TimeSecond;case mt.MILLISECOND:return C.TimeMillisecond;case mt.MICROSECOND:return C.TimeMicrosecond;case mt.NANOSECOND:return C.TimeNanosecond}return C.Time;case C.Timestamp:switch(e.unit){case mt.SECOND:return C.TimestampSecond;case mt.MILLISECOND:return C.TimestampMillisecond;case mt.MICROSECOND:return C.TimestampMicrosecond;case mt.NANOSECOND:return C.TimestampNanosecond}return C.Timestamp;case C.Date:switch(e.unit){case On.DAY:return C.DateDay;case On.MILLISECOND:return C.DateMillisecond}return C.Date;case C.Interval:switch(e.unit){case cr.DAY_TIME:return C.IntervalDayTime;case cr.YEAR_MONTH:return C.IntervalYearMonth}return C.Interval;case C.Duration:switch(e.unit){case mt.SECOND:return C.DurationSecond;case mt.MILLISECOND:return C.DurationMillisecond;case mt.MICROSECOND:return C.DurationMicrosecond;case mt.NANOSECOND:return C.DurationNanosecond}return C.Duration;case C.Map:return C.Map;case C.List:return C.List;case C.Struct:return C.Struct;case C.Union:switch(e.mode){case xe.Dense:return C.DenseUnion;case xe.Sparse:return C.SparseUnion}return C.Union;case C.FixedSizeBinary:return C.FixedSizeBinary;case C.FixedSizeList:return C.FixedSizeList;case C.Dictionary:return C.Dictionary}throw new Error(`Unrecognized type '${C[e.typeId]}'`)}ut.prototype.visitInt8=null;ut.prototype.visitInt16=null;ut.prototype.visitInt32=null;ut.prototype.visitInt64=null;ut.prototype.visitUint8=null;ut.prototype.visitUint16=null;ut.prototype.visitUint32=null;ut.prototype.visitUint64=null;ut.prototype.visitFloat16=null;ut.prototype.visitFloat32=null;ut.prototype.visitFloat64=null;ut.prototype.visitDateDay=null;ut.prototype.visitDateMillisecond=null;ut.prototype.visitTimestampSecond=null;ut.prototype.visitTimestampMillisecond=null;ut.prototype.visitTimestampMicrosecond=null;ut.prototype.visitTimestampNanosecond=null;ut.prototype.visitTimeSecond=null;ut.prototype.visitTimeMillisecond=null;ut.prototype.visitTimeMicrosecond=null;ut.prototype.visitTimeNanosecond=null;ut.prototype.visitDenseUnion=null;ut.prototype.visitSparseUnion=null;ut.prototype.visitIntervalDayTime=null;ut.prototype.visitIntervalYearMonth=null;ut.prototype.visitDuration=null;ut.prototype.visitDurationSecond=null;ut.prototype.visitDurationMillisecond=null;ut.prototype.visitDurationMicrosecond=null;ut.prototype.visitDurationNanosecond=null;var k_={};_r(k_,{float64ToUint16:()=>zd,uint16ToFloat64:()=>Sg});var nO=new Float64Array(1),ru=new Uint32Array(nO.buffer);function Sg(e){let t=(e&31744)>>10,n=(e&1023)/1024,r=Math.pow(-1,(e&32768)>>15);switch(t){case 31:return r*(n?Number.NaN:1/0);case 0:return r*(n?6103515625e-14*n:0)}return r*Math.pow(2,t-15)*(1+n)}function zd(e){if(e!==e)return 32256;nO[0]=e;let t=(ru[1]&2147483648)>>16&65535,n=ru[1]&2146435072,r=0;return n>=1089470464?ru[0]>0?n=31744:(n=(n&2080374784)>>16,r=(ru[1]&1048575)>>10):n<=1056964608?(r=1048576+(ru[1]&1048575),r=1048576+(r<<(n>>20)-998)>>21,n=0):(n=n-1056964608>>10,r=(ru[1]&1048575)+512>>10),t|n|r&65535}var _t=class extends ut{};function Tt(e){return(t,n,r)=>{if(t.setValid(n,r!=null))return e(t,n,r)}}var qz=(e,t,n)=>{e[t]=Math.trunc(n/864e5)},F_=(e,t,n)=>{e[t]=Math.trunc(n%4294967296),e[t+1]=Math.trunc(n/4294967296)},jz=(e,t,n)=>{e[t]=Math.trunc(n*1e3%4294967296),e[t+1]=Math.trunc(n*1e3/4294967296)},Vz=(e,t,n)=>{e[t]=Math.trunc(n*1e6%4294967296),e[t+1]=Math.trunc(n*1e6/4294967296)},rO=(e,t,n,r)=>{if(n+1<t.length){let{[n]:i,[n+1]:o}=t;e.set(r.subarray(0,o-i),i)}},Yz=({offset:e,values:t},n,r)=>{let i=e+n;r?t[i>>3]|=1<<i%8:t[i>>3]&=~(1<<i%8)},rs=({values:e},t,n)=>{e[t]=n},R_=({values:e},t,n)=>{e[t]=n},iO=({values:e},t,n)=>{e[t]=zd(n)},Xz=(e,t,n)=>{switch(e.type.precision){case Se.HALF:return iO(e,t,n);case Se.SINGLE:case Se.DOUBLE:return R_(e,t,n)}},Ig=({values:e},t,n)=>{qz(e,t,n.valueOf())},Mg=({values:e},t,n)=>{F_(e,t*2,n.valueOf())},$_=({stride:e,values:t},n,r)=>{t.set(r.subarray(0,e),e*n)},Gz=({values:e,valueOffsets:t},n,r)=>rO(e,t,n,r),Wz=({values:e,valueOffsets:t},n,r)=>{rO(e,t,n,ua(r))},P_=(e,t,n)=>{e.type.unit===On.DAY?Ig(e,t,n):Mg(e,t,n)},Ag=({values:e},t,n)=>F_(e,t*2,n/1e3),Tg=({values:e},t,n)=>F_(e,t*2,n),Eg=({values:e},t,n)=>jz(e,t*2,n),Ng=({values:e},t,n)=>Vz(e,t*2,n),U_=(e,t,n)=>{switch(e.type.unit){case mt.SECOND:return Ag(e,t,n);case mt.MILLISECOND:return Tg(e,t,n);case mt.MICROSECOND:return Eg(e,t,n);case mt.NANOSECOND:return Ng(e,t,n)}},Dg=({values:e},t,n)=>{e[t]=n},Og=({values:e},t,n)=>{e[t]=n},Bg=({values:e},t,n)=>{e[t]=n},Lg=({values:e},t,n)=>{e[t]=n},z_=(e,t,n)=>{switch(e.type.unit){case mt.SECOND:return Dg(e,t,n);case mt.MILLISECOND:return Og(e,t,n);case mt.MICROSECOND:return Bg(e,t,n);case mt.NANOSECOND:return Lg(e,t,n)}},q_=({values:e,stride:t},n,r)=>{e.set(r.subarray(0,t),t*n)},Hz=(e,t,n)=>{let r=e.children[0],i=e.valueOffsets,o=gn.getVisitFn(r);if(Array.isArray(n))for(let s=-1,a=i[t],c=i[t+1];a<c;)o(r,a++,n[++s]);else for(let s=-1,a=i[t],c=i[t+1];a<c;)o(r,a++,n.get(++s))},Zz=(e,t,n)=>{let r=e.children[0],{valueOffsets:i}=e,o=gn.getVisitFn(r),{[t]:s,[t+1]:a}=i,c=n instanceof Map?n.entries():Object.entries(n);for(let l of c)if(o(r,s,l),++s>=a)break},Jz=(e,t)=>(n,r,i,o)=>r&&n(r,e,t[o]),Qz=(e,t)=>(n,r,i,o)=>r&&n(r,e,t.get(o)),Kz=(e,t)=>(n,r,i,o)=>r&&n(r,e,t.get(i.name)),tq=(e,t)=>(n,r,i,o)=>r&&n(r,e,t[i.name]),eq=(e,t,n)=>{let r=e.type.children.map(o=>gn.getVisitFn(o.type)),i=n instanceof Map?Kz(t,n):n instanceof Yt?Qz(t,n):Array.isArray(n)?Jz(t,n):tq(t,n);e.type.children.forEach((o,s)=>i(r[s],e.children[s],o,s))},nq=(e,t,n)=>{e.type.mode===xe.Dense?oO(e,t,n):sO(e,t,n)},oO=(e,t,n)=>{let r=e.type.typeIdToChildIndex[e.typeIds[t]],i=e.children[r];gn.visit(i,e.valueOffsets[t],n)},sO=(e,t,n)=>{let r=e.type.typeIdToChildIndex[e.typeIds[t]],i=e.children[r];gn.visit(i,t,n)},rq=(e,t,n)=>{var r;(r=e.dictionary)===null||r===void 0||r.set(e.values[t],n)},j_=(e,t,n)=>{e.type.unit===cr.DAY_TIME?Cg(e,t,n):kg(e,t,n)},Cg=({values:e},t,n)=>{e.set(n.subarray(0,2),2*t)},kg=({values:e},t,n)=>{e[t]=n[0]*12+n[1]%12},Fg=({values:e},t,n)=>{e[t]=n},Rg=({values:e},t,n)=>{e[t]=n},$g=({values:e},t,n)=>{e[t]=n},Pg=({values:e},t,n)=>{e[t]=n},V_=(e,t,n)=>{switch(e.type.unit){case mt.SECOND:return Fg(e,t,n);case mt.MILLISECOND:return Rg(e,t,n);case mt.MICROSECOND:return $g(e,t,n);case mt.NANOSECOND:return Pg(e,t,n)}},iq=(e,t,n)=>{let{stride:r}=e,i=e.children[0],o=gn.getVisitFn(i);if(Array.isArray(n))for(let s=-1,a=t*r;++s<r;)o(i,a+s,n[s]);else for(let s=-1,a=t*r;++s<r;)o(i,a+s,n.get(s))};_t.prototype.visitBool=Tt(Yz);_t.prototype.visitInt=Tt(rs);_t.prototype.visitInt8=Tt(rs);_t.prototype.visitInt16=Tt(rs);_t.prototype.visitInt32=Tt(rs);_t.prototype.visitInt64=Tt(rs);_t.prototype.visitUint8=Tt(rs);_t.prototype.visitUint16=Tt(rs);_t.prototype.visitUint32=Tt(rs);_t.prototype.visitUint64=Tt(rs);_t.prototype.visitFloat=Tt(Xz);_t.prototype.visitFloat16=Tt(iO);_t.prototype.visitFloat32=Tt(R_);_t.prototype.visitFloat64=Tt(R_);_t.prototype.visitUtf8=Tt(Wz);_t.prototype.visitBinary=Tt(Gz);_t.prototype.visitFixedSizeBinary=Tt($_);_t.prototype.visitDate=Tt(P_);_t.prototype.visitDateDay=Tt(Ig);_t.prototype.visitDateMillisecond=Tt(Mg);_t.prototype.visitTimestamp=Tt(U_);_t.prototype.visitTimestampSecond=Tt(Ag);_t.prototype.visitTimestampMillisecond=Tt(Tg);_t.prototype.visitTimestampMicrosecond=Tt(Eg);_t.prototype.visitTimestampNanosecond=Tt(Ng);_t.prototype.visitTime=Tt(z_);_t.prototype.visitTimeSecond=Tt(Dg);_t.prototype.visitTimeMillisecond=Tt(Og);_t.prototype.visitTimeMicrosecond=Tt(Bg);_t.prototype.visitTimeNanosecond=Tt(Lg);_t.prototype.visitDecimal=Tt(q_);_t.prototype.visitList=Tt(Hz);_t.prototype.visitStruct=Tt(eq);_t.prototype.visitUnion=Tt(nq);_t.prototype.visitDenseUnion=Tt(oO);_t.prototype.visitSparseUnion=Tt(sO);_t.prototype.visitDictionary=Tt(rq);_t.prototype.visitInterval=Tt(j_);_t.prototype.visitIntervalDayTime=Tt(Cg);_t.prototype.visitIntervalYearMonth=Tt(kg);_t.prototype.visitDuration=Tt(V_);_t.prototype.visitDurationSecond=Tt(Fg);_t.prototype.visitDurationMillisecond=Tt(Rg);_t.prototype.visitDurationMicrosecond=Tt($g);_t.prototype.visitDurationNanosecond=Tt(Pg);_t.prototype.visitFixedSizeList=Tt(iq);_t.prototype.visitMap=Tt(Zz);var gn=new _t;var Di=Symbol.for("parent"),iu=Symbol.for("rowIndex"),fa=class{constructor(t,n){return this[Di]=t,this[iu]=n,new Proxy(this,new X_)}toArray(){return Object.values(this.toJSON())}toJSON(){let t=this[iu],n=this[Di],r=n.type.children,i={};for(let o=-1,s=r.length;++o<s;)i[r[o].name]=je.visit(n.children[o],t);return i}toString(){return`{${[...this].map(([t,n])=>`${Si(t)}: ${Si(n)}`).join(", ")}}`}[Symbol.for("nodejs.util.inspect.custom")](){return this.toString()}[Symbol.iterator](){return new Y_(this[Di],this[iu])}},Y_=class{constructor(t,n){this.childIndex=0,this.children=t.children,this.rowIndex=n,this.childFields=t.type.children,this.numChildren=this.childFields.length}[Symbol.iterator](){return this}next(){let t=this.childIndex;return t<this.numChildren?(this.childIndex=t+1,{done:!1,value:[this.childFields[t].name,je.visit(this.children[t],this.rowIndex)]}):{done:!0,value:null}}};Object.defineProperties(fa.prototype,{[Symbol.toStringTag]:{enumerable:!1,configurable:!1,value:"Row"},[Di]:{writable:!0,enumerable:!1,configurable:!1,value:null},[iu]:{writable:!0,enumerable:!1,configurable:!1,value:-1}});var X_=class{isExtensible(){return!1}deleteProperty(){return!1}preventExtensions(){return!0}ownKeys(t){return t[Di].type.children.map(n=>n.name)}has(t,n){return t[Di].type.children.findIndex(r=>r.name===n)!==-1}getOwnPropertyDescriptor(t,n){if(t[Di].type.children.findIndex(r=>r.name===n)!==-1)return{writable:!0,enumerable:!0,configurable:!0}}get(t,n){if(Reflect.has(t,n))return t[n];let r=t[Di].type.children.findIndex(i=>i.name===n);if(r!==-1){let i=je.visit(t[Di].children[r],t[iu]);return Reflect.set(t,n,i),i}}set(t,n,r){let i=t[Di].type.children.findIndex(o=>o.name===n);return i!==-1?(gn.visit(t[Di].children[i],t[iu],r),Reflect.set(t,n,r)):Reflect.has(t,n)||typeof n=="symbol"?Reflect.set(t,n,r):!1}};var gt=class extends ut{};function Mt(e){return(t,n)=>t.getValid(n)?e(t,n):null}var oq=(e,t)=>864e5*e[t],G_=(e,t)=>4294967296*e[t+1]+(e[t]>>>0),sq=(e,t)=>4294967296*(e[t+1]/1e3)+(e[t]>>>0)/1e3,aq=(e,t)=>4294967296*(e[t+1]/1e6)+(e[t]>>>0)/1e6,aO=e=>new Date(e),cq=(e,t)=>aO(oq(e,t)),lq=(e,t)=>aO(G_(e,t)),uq=(e,t)=>null,cO=(e,t,n)=>{if(n+1>=t.length)return null;let r=t[n],i=t[n+1];return e.subarray(r,i)},fq=({offset:e,values:t},n)=>{let r=e+n;return(t[r>>3]&1<<r%8)!==0},lO=({values:e},t)=>cq(e,t),uO=({values:e},t)=>lq(e,t*2),da=({stride:e,values:t},n)=>t[e*n],dq=({stride:e,values:t},n)=>Sg(t[e*n]),fO=({values:e},t)=>e[t],hq=({stride:e,values:t},n)=>t.subarray(e*n,e*(n+1)),pq=({values:e,valueOffsets:t},n)=>cO(e,t,n),mq=({values:e,valueOffsets:t},n)=>{let r=cO(e,t,n);return r!==null?Rd(r):null},yq=({values:e},t)=>e[t],gq=({type:e,values:t},n)=>e.precision!==Se.HALF?t[n]:Sg(t[n]),xq=(e,t)=>e.type.unit===On.DAY?lO(e,t):uO(e,t),dO=({values:e},t)=>1e3*G_(e,t*2),hO=({values:e},t)=>G_(e,t*2),pO=({values:e},t)=>sq(e,t*2),mO=({values:e},t)=>aq(e,t*2),bq=(e,t)=>{switch(e.type.unit){case mt.SECOND:return dO(e,t);case mt.MILLISECOND:return hO(e,t);case mt.MICROSECOND:return pO(e,t);case mt.NANOSECOND:return mO(e,t)}},yO=({values:e},t)=>e[t],gO=({values:e},t)=>e[t],xO=({values:e},t)=>e[t],bO=({values:e},t)=>e[t],wq=(e,t)=>{switch(e.type.unit){case mt.SECOND:return yO(e,t);case mt.MILLISECOND:return gO(e,t);case mt.MICROSECOND:return xO(e,t);case mt.NANOSECOND:return bO(e,t)}},vq=({values:e,stride:t},n)=>Ud.decimal(e.subarray(t*n,t*(n+1))),_q=(e,t)=>{let{valueOffsets:n,stride:r,children:i}=e,{[t*r]:o,[t*r+1]:s}=n,c=i[0].slice(o,s-o);return new Yt([c])},Sq=(e,t)=>{let{valueOffsets:n,children:r}=e,{[t]:i,[t+1]:o}=n,s=r[0];return new Qi(s.slice(i,o-i))},Iq=(e,t)=>new fa(e,t),Mq=(e,t)=>e.type.mode===xe.Dense?wO(e,t):vO(e,t),wO=(e,t)=>{let n=e.type.typeIdToChildIndex[e.typeIds[t]],r=e.children[n];return je.visit(r,e.valueOffsets[t])},vO=(e,t)=>{let n=e.type.typeIdToChildIndex[e.typeIds[t]],r=e.children[n];return je.visit(r,t)},Aq=(e,t)=>{var n;return(n=e.dictionary)===null||n===void 0?void 0:n.get(e.values[t])},Tq=(e,t)=>e.type.unit===cr.DAY_TIME?_O(e,t):SO(e,t),_O=({values:e},t)=>e.subarray(2*t,2*(t+1)),SO=({values:e},t)=>{let n=e[t],r=new Int32Array(2);return r[0]=Math.trunc(n/12),r[1]=Math.trunc(n%12),r},IO=({values:e},t)=>e[t],MO=({values:e},t)=>e[t],AO=({values:e},t)=>e[t],TO=({values:e},t)=>e[t],Eq=(e,t)=>{switch(e.type.unit){case mt.SECOND:return IO(e,t);case mt.MILLISECOND:return MO(e,t);case mt.MICROSECOND:return AO(e,t);case mt.NANOSECOND:return TO(e,t)}},Nq=(e,t)=>{let{stride:n,children:r}=e,o=r[0].slice(t*n,n);return new Yt([o])};gt.prototype.visitNull=Mt(uq);gt.prototype.visitBool=Mt(fq);gt.prototype.visitInt=Mt(yq);gt.prototype.visitInt8=Mt(da);gt.prototype.visitInt16=Mt(da);gt.prototype.visitInt32=Mt(da);gt.prototype.visitInt64=Mt(fO);gt.prototype.visitUint8=Mt(da);gt.prototype.visitUint16=Mt(da);gt.prototype.visitUint32=Mt(da);gt.prototype.visitUint64=Mt(fO);gt.prototype.visitFloat=Mt(gq);gt.prototype.visitFloat16=Mt(dq);gt.prototype.visitFloat32=Mt(da);gt.prototype.visitFloat64=Mt(da);gt.prototype.visitUtf8=Mt(mq);gt.prototype.visitBinary=Mt(pq);gt.prototype.visitFixedSizeBinary=Mt(hq);gt.prototype.visitDate=Mt(xq);gt.prototype.visitDateDay=Mt(lO);gt.prototype.visitDateMillisecond=Mt(uO);gt.prototype.visitTimestamp=Mt(bq);gt.prototype.visitTimestampSecond=Mt(dO);gt.prototype.visitTimestampMillisecond=Mt(hO);gt.prototype.visitTimestampMicrosecond=Mt(pO);gt.prototype.visitTimestampNanosecond=Mt(mO);gt.prototype.visitTime=Mt(wq);gt.prototype.visitTimeSecond=Mt(yO);gt.prototype.visitTimeMillisecond=Mt(gO);gt.prototype.visitTimeMicrosecond=Mt(xO);gt.prototype.visitTimeNanosecond=Mt(bO);gt.prototype.visitDecimal=Mt(vq);gt.prototype.visitList=Mt(_q);gt.prototype.visitStruct=Mt(Iq);gt.prototype.visitUnion=Mt(Mq);gt.prototype.visitDenseUnion=Mt(wO);gt.prototype.visitSparseUnion=Mt(vO);gt.prototype.visitDictionary=Mt(Aq);gt.prototype.visitInterval=Mt(Tq);gt.prototype.visitIntervalDayTime=Mt(_O);gt.prototype.visitIntervalYearMonth=Mt(SO);gt.prototype.visitDuration=Mt(Eq);gt.prototype.visitDurationSecond=Mt(IO);gt.prototype.visitDurationMillisecond=Mt(MO);gt.prototype.visitDurationMicrosecond=Mt(AO);gt.prototype.visitDurationNanosecond=Mt(TO);gt.prototype.visitFixedSizeList=Mt(Nq);gt.prototype.visitMap=Mt(Sq);var je=new gt;var Wr=Symbol.for("keys"),ou=Symbol.for("vals"),Qi=class{constructor(t){return this[Wr]=new Yt([t.children[0]]).memoize(),this[ou]=t.children[1],new Proxy(this,new H_)}[Symbol.iterator](){return new W_(this[Wr],this[ou])}get size(){return this[Wr].length}toArray(){return Object.values(this.toJSON())}toJSON(){let t=this[Wr],n=this[ou],r={};for(let i=-1,o=t.length;++i<o;)r[t.get(i)]=je.visit(n,i);return r}toString(){return`{${[...this].map(([t,n])=>`${Si(t)}: ${Si(n)}`).join(", ")}}`}[Symbol.for("nodejs.util.inspect.custom")](){return this.toString()}},W_=class{constructor(t,n){this.keys=t,this.vals=n,this.keyIndex=0,this.numKeys=t.length}[Symbol.iterator](){return this}next(){let t=this.keyIndex;return t===this.numKeys?{done:!0,value:null}:(this.keyIndex++,{done:!1,value:[this.keys.get(t),je.visit(this.vals,t)]})}},H_=class{isExtensible(){return!1}deleteProperty(){return!1}preventExtensions(){return!0}ownKeys(t){return t[Wr].toArray().map(String)}has(t,n){return t[Wr].includes(n)}getOwnPropertyDescriptor(t,n){if(t[Wr].indexOf(n)!==-1)return{writable:!0,enumerable:!0,configurable:!0}}get(t,n){if(Reflect.has(t,n))return t[n];let r=t[Wr].indexOf(n);if(r!==-1){let i=je.visit(Reflect.get(t,ou),r);return Reflect.set(t,n,i),i}}set(t,n,r){let i=t[Wr].indexOf(n);return i!==-1?(gn.visit(Reflect.get(t,ou),i,r),Reflect.set(t,n,r)):Reflect.has(t,n)?Reflect.set(t,n,r):!1}};Object.defineProperties(Qi.prototype,{[Symbol.toStringTag]:{enumerable:!1,configurable:!1,value:"Row"},[Wr]:{writable:!0,enumerable:!1,configurable:!1,value:null},[ou]:{writable:!0,enumerable:!1,configurable:!1,value:null}});function Dq(e,t,n){let r=e.length,i=t>-1?t:r+t%r;return n?n(e,i):i}var EO;function qd(e,t,n,r){let{length:i=0}=e,o=typeof t!="number"?0:t,s=typeof n!="number"?i:n;return o<0&&(o=(o%i+i)%i),s<0&&(s=(s%i+i)%i),s<o&&(EO=o,o=s,s=EO),s>i&&(s=i),r?r(e,o,s):[o,s]}var NO=e=>e!==e;function ha(e){if(typeof e!=="object"||e===null)return NO(e)?NO:n=>n===e;if(e instanceof Date){let n=e.valueOf();return r=>r instanceof Date?r.valueOf()===n:!1}return ArrayBuffer.isView(e)?n=>n?E_(e,n):!1:e instanceof Map?Bq(e):Array.isArray(e)?Oq(e):e instanceof Yt?Lq(e):Cq(e,!0)}function Oq(e){let t=[];for(let n=-1,r=e.length;++n<r;)t[n]=ha(e[n]);return Ug(t)}function Bq(e){let t=-1,n=[];for(let r of e.values())n[++t]=ha(r);return Ug(n)}function Lq(e){let t=[];for(let n=-1,r=e.length;++n<r;)t[n]=ha(e.get(n));return Ug(t)}function Cq(e,t=!1){let n=Object.keys(e);if(!t&&n.length===0)return()=>!1;let r=[];for(let i=-1,o=n.length;++i<o;)r[i]=ha(e[n[i]]);return Ug(r,n)}function Ug(e,t){return n=>{if(!n||typeof n!="object")return!1;switch(n.constructor){case Array:return kq(e,n);case Map:return DO(e,n,n.keys());case Qi:case fa:case Object:case void 0:return DO(e,n,t||Object.keys(n))}return n instanceof Yt?Fq(e,n):!1}}function kq(e,t){let n=e.length;if(t.length!==n)return!1;for(let r=-1;++r<n;)if(!e[r](t[r]))return!1;return!0}function Fq(e,t){let n=e.length;if(t.length!==n)return!1;for(let r=-1;++r<n;)if(!e[r](t.get(r)))return!1;return!0}function DO(e,t,n){let r=n[Symbol.iterator](),i=t instanceof Map?t.keys():Object.keys(t)[Symbol.iterator](),o=t instanceof Map?t.values():Object.values(t)[Symbol.iterator](),s=0,a=e.length,c=o.next(),l=r.next(),u=i.next();for(;s<a&&!l.done&&!u.done&&!c.done&&!(l.value!==u.value||!e[s](c.value));++s,l=r.next(),u=i.next(),c=o.next());return s===a&&l.done&&u.done&&c.done?!0:(r.return&&r.return(),i.return&&i.return(),o.return&&o.return(),!1)}var J_={};_r(J_,{BitIterator:()=>Sc,getBit:()=>OO,getBool:()=>qg,packBools:()=>Mc,popcnt_array:()=>BO,popcnt_bit_range:()=>jd,popcnt_uint32:()=>zg,setBool:()=>Rq,truncateBitmap:()=>Ic});function qg(e,t,n,r){return(n&1<<r)!==0}function OO(e,t,n,r){return(n&1<<r)>>r}function Rq(e,t,n){return n?!!(e[t>>3]|=1<<t%8)||!0:!(e[t>>3]&=~(1<<t%8))&&!1}function Ic(e,t,n){let r=n.byteLength+7&-8;if(e>0||n.byteLength<r){let i=new Uint8Array(r);return i.set(e%8===0?n.subarray(e>>3):Mc(new Sc(n,e,t,null,qg)).subarray(0,r)),i}return n}function Mc(e){let t=[],n=0,r=0,i=0;for(let s of e)s&&(i|=1<<r),++r===8&&(t[n++]=i,i=r=0);(n===0||r>0)&&(t[n++]=i);let o=new Uint8Array(t.length+7&-8);return o.set(t),o}var Sc=class{constructor(t,n,r,i,o){this.bytes=t,this.length=r,this.context=i,this.get=o,this.bit=n%8,this.byteIndex=n>>3,this.byte=t[this.byteIndex++],this.index=0}next(){return this.index<this.length?(this.bit===8&&(this.bit=0,this.byte=this.bytes[this.byteIndex++]),{value:this.get(this.context,this.index++,this.byte,this.bit++)}):{done:!0,value:null}}[Symbol.iterator](){return this}};function jd(e,t,n){if(n-t<=0)return 0;if(n-t<8){let o=0;for(let s of new Sc(e,t,n-t,e,OO))o+=s;return o}let r=n>>3<<3,i=t+(t%8===0?0:8-t%8);return jd(e,t,i)+jd(e,r,n)+BO(e,i>>3,r-i>>3)}function BO(e,t,n){let r=0,i=Math.trunc(t),o=new DataView(e.buffer,e.byteOffset,e.byteLength),s=n===void 0?e.byteLength:i+n;for(;s-i>=4;)r+=zg(o.getUint32(i)),i+=4;for(;s-i>=2;)r+=zg(o.getUint16(i)),i+=2;for(;s-i>=1;)r+=zg(o.getUint8(i)),i+=1;return r}function zg(e){let t=Math.trunc(e);return t=t-(t>>>1&1431655765),t=(t&858993459)+(t>>>2&858993459),(t+(t>>>4)&252645135)*16843009>>>24}var $q=-1,se=class e{get typeId(){return this.type.typeId}get ArrayType(){return this.type.ArrayType}get buffers(){return[this.valueOffsets,this.values,this.nullBitmap,this.typeIds]}get nullable(){if(this._nullCount!==0){let{type:t}=this;return at.isSparseUnion(t)?this.children.some(n=>n.nullable):at.isDenseUnion(t)?this.children.some(n=>n.nullable):this.nullBitmap&&this.nullBitmap.byteLength>0}return!0}get byteLength(){let t=0,{valueOffsets:n,values:r,nullBitmap:i,typeIds:o}=this;return n&&(t+=n.byteLength),r&&(t+=r.byteLength),i&&(t+=i.byteLength),o&&(t+=o.byteLength),this.children.reduce((s,a)=>s+a.byteLength,t)}get nullCount(){if(at.isUnion(this.type))return this.children.reduce((r,i)=>r+i.nullCount,0);let t=this._nullCount,n;return t<=$q&&(n=this.nullBitmap)&&(this._nullCount=t=this.length-jd(n,this.offset,this.offset+this.length)),t}constructor(t,n,r,i,o,s=[],a){this.type=t,this.children=s,this.dictionary=a,this.offset=Math.floor(Math.max(n||0,0)),this.length=Math.floor(Math.max(r||0,0)),this._nullCount=Math.floor(Math.max(i||0,-1));let c;o instanceof e?(this.stride=o.stride,this.values=o.values,this.typeIds=o.typeIds,this.nullBitmap=o.nullBitmap,this.valueOffsets=o.valueOffsets):(this.stride=Tr(t),o&&((c=o[0])&&(this.valueOffsets=c),(c=o[1])&&(this.values=c),(c=o[2])&&(this.nullBitmap=c),(c=o[3])&&(this.typeIds=c)))}getValid(t){let{type:n}=this;if(at.isUnion(n)){let r=n,i=this.children[r.typeIdToChildIndex[this.typeIds[t]]],o=r.mode===xe.Dense?this.valueOffsets[t]:t;return i.getValid(o)}if(this.nullable&&this.nullCount>0){let r=this.offset+t;return(this.nullBitmap[r>>3]&1<<r%8)!==0}return!0}setValid(t,n){let r,{type:i}=this;if(at.isUnion(i)){let o=i,s=this.children[o.typeIdToChildIndex[this.typeIds[t]]],a=o.mode===xe.Dense?this.valueOffsets[t]:t;r=s.getValid(a),s.setValid(a,n)}else{let{nullBitmap:o}=this,{offset:s,length:a}=this,c=s+t,l=1<<c%8,u=c>>3;(!o||o.byteLength<=u)&&(o=new Uint8Array((s+a+63&-64)>>3).fill(255),this.nullCount>0&&o.set(Ic(s,a,this.nullBitmap),0),Object.assign(this,{nullBitmap:o,_nullCount:-1}));let f=o[u];r=(f&l)!==0,n?o[u]=f|l:o[u]=f&~l}return r!==!!n&&(this._nullCount=this.nullCount+(n?-1:1)),n}clone(t=this.type,n=this.offset,r=this.length,i=this._nullCount,o=this,s=this.children){return new e(t,n,r,i,o,s,this.dictionary)}slice(t,n){let{stride:r,typeId:i,children:o}=this,s=+(this._nullCount===0)-1,a=i===16?r:1,c=this._sliceBuffers(t,n,r,i);return this.clone(this.type,this.offset+t,n,s,c,o.length===0||this.valueOffsets?o:this._sliceChildren(o,a*t,a*n))}_changeLengthAndBackfillNullBitmap(t){if(this.typeId===C.Null)return this.clone(this.type,0,t,0);let{length:n,nullCount:r}=this,i=new Uint8Array((t+63&-64)>>3).fill(255,0,n>>3);i[n>>3]=(1<<n-(n&-8))-1,r>0&&i.set(Ic(this.offset,n,this.nullBitmap),0);let o=this.buffers;return o[_i.VALIDITY]=i,this.clone(this.type,0,t,r+(t-n),o)}_sliceBuffers(t,n,r,i){let o,{buffers:s}=this;return(o=s[_i.TYPE])&&(s[_i.TYPE]=o.subarray(t,t+n)),(o=s[_i.OFFSET])&&(s[_i.OFFSET]=o.subarray(t,t+n+1))||(o=s[_i.DATA])&&(s[_i.DATA]=i===6?o:o.subarray(r*t,r*(t+n))),s}_sliceChildren(t,n,r){return t.map(i=>i.slice(n,r))}};se.prototype.children=Object.freeze([]);var Q_=class e extends ut{visit(t){return this.getVisitFn(t.type).call(this,t)}visitNull(t){let{["type"]:n,["offset"]:r=0,["length"]:i=0}=t;return new se(n,r,i,i)}visitBool(t){let{["type"]:n,["offset"]:r=0}=t,i=Ot(t.nullBitmap),o=Pt(n.ArrayType,t.data),{["length"]:s=o.length>>3,["nullCount"]:a=t.nullBitmap?-1:0}=t;return new se(n,r,s,a,[void 0,o,i])}visitInt(t){let{["type"]:n,["offset"]:r=0}=t,i=Ot(t.nullBitmap),o=Pt(n.ArrayType,t.data),{["length"]:s=o.length,["nullCount"]:a=t.nullBitmap?-1:0}=t;return new se(n,r,s,a,[void 0,o,i])}visitFloat(t){let{["type"]:n,["offset"]:r=0}=t,i=Ot(t.nullBitmap),o=Pt(n.ArrayType,t.data),{["length"]:s=o.length,["nullCount"]:a=t.nullBitmap?-1:0}=t;return new se(n,r,s,a,[void 0,o,i])}visitUtf8(t){let{["type"]:n,["offset"]:r=0}=t,i=Ot(t.data),o=Ot(t.nullBitmap),s=_c(t.valueOffsets),{["length"]:a=s.length-1,["nullCount"]:c=t.nullBitmap?-1:0}=t;return new se(n,r,a,c,[s,i,o])}visitBinary(t){let{["type"]:n,["offset"]:r=0}=t,i=Ot(t.data),o=Ot(t.nullBitmap),s=_c(t.valueOffsets),{["length"]:a=s.length-1,["nullCount"]:c=t.nullBitmap?-1:0}=t;return new se(n,r,a,c,[s,i,o])}visitFixedSizeBinary(t){let{["type"]:n,["offset"]:r=0}=t,i=Ot(t.nullBitmap),o=Pt(n.ArrayType,t.data),{["length"]:s=o.length/Tr(n),["nullCount"]:a=t.nullBitmap?-1:0}=t;return new se(n,r,s,a,[void 0,o,i])}visitDate(t){let{["type"]:n,["offset"]:r=0}=t,i=Ot(t.nullBitmap),o=Pt(n.ArrayType,t.data),{["length"]:s=o.length/Tr(n),["nullCount"]:a=t.nullBitmap?-1:0}=t;return new se(n,r,s,a,[void 0,o,i])}visitTimestamp(t){let{["type"]:n,["offset"]:r=0}=t,i=Ot(t.nullBitmap),o=Pt(n.ArrayType,t.data),{["length"]:s=o.length/Tr(n),["nullCount"]:a=t.nullBitmap?-1:0}=t;return new se(n,r,s,a,[void 0,o,i])}visitTime(t){let{["type"]:n,["offset"]:r=0}=t,i=Ot(t.nullBitmap),o=Pt(n.ArrayType,t.data),{["length"]:s=o.length/Tr(n),["nullCount"]:a=t.nullBitmap?-1:0}=t;return new se(n,r,s,a,[void 0,o,i])}visitDecimal(t){let{["type"]:n,["offset"]:r=0}=t,i=Ot(t.nullBitmap),o=Pt(n.ArrayType,t.data),{["length"]:s=o.length/Tr(n),["nullCount"]:a=t.nullBitmap?-1:0}=t;return new se(n,r,s,a,[void 0,o,i])}visitList(t){let{["type"]:n,["offset"]:r=0,["child"]:i}=t,o=Ot(t.nullBitmap),s=_c(t.valueOffsets),{["length"]:a=s.length-1,["nullCount"]:c=t.nullBitmap?-1:0}=t;return new se(n,r,a,c,[s,void 0,o],[i])}visitStruct(t){let{["type"]:n,["offset"]:r=0,["children"]:i=[]}=t,o=Ot(t.nullBitmap),{length:s=i.reduce((c,{length:l})=>Math.max(c,l),0),nullCount:a=t.nullBitmap?-1:0}=t;return new se(n,r,s,a,[void 0,void 0,o],i)}visitUnion(t){let{["type"]:n,["offset"]:r=0,["children"]:i=[]}=t,o=Pt(n.ArrayType,t.typeIds),{["length"]:s=o.length,["nullCount"]:a=-1}=t;if(at.isSparseUnion(n))return new se(n,r,s,a,[void 0,void 0,void 0,o],i);let c=_c(t.valueOffsets);return new se(n,r,s,a,[c,void 0,void 0,o],i)}visitDictionary(t){let{["type"]:n,["offset"]:r=0}=t,i=Ot(t.nullBitmap),o=Pt(n.indices.ArrayType,t.data),{["dictionary"]:s=new Yt([new e().visit({type:n.dictionary})])}=t,{["length"]:a=o.length,["nullCount"]:c=t.nullBitmap?-1:0}=t;return new se(n,r,a,c,[void 0,o,i],[],s)}visitInterval(t){let{["type"]:n,["offset"]:r=0}=t,i=Ot(t.nullBitmap),o=Pt(n.ArrayType,t.data),{["length"]:s=o.length/Tr(n),["nullCount"]:a=t.nullBitmap?-1:0}=t;return new se(n,r,s,a,[void 0,o,i])}visitDuration(t){let{["type"]:n,["offset"]:r=0}=t,i=Ot(t.nullBitmap),o=Pt(n.ArrayType,t.data),{["length"]:s=o.length,["nullCount"]:a=t.nullBitmap?-1:0}=t;return new se(n,r,s,a,[void 0,o,i])}visitFixedSizeList(t){let{["type"]:n,["offset"]:r=0,["child"]:i=new e().visit({type:n.valueType})}=t,o=Ot(t.nullBitmap),{["length"]:s=i.length/Tr(n),["nullCount"]:a=t.nullBitmap?-1:0}=t;return new se(n,r,s,a,[void 0,void 0,o],[i])}visitMap(t){let{["type"]:n,["offset"]:r=0,["child"]:i=new e().visit({type:n.childType})}=t,o=Ot(t.nullBitmap),s=_c(t.valueOffsets),{["length"]:a=s.length-1,["nullCount"]:c=t.nullBitmap?-1:0}=t;return new se(n,r,a,c,[s,void 0,o],[i])}},Pq=new Q_;function Bt(e){return Pq.visit(e)}var Vd=class{constructor(t=0,n){this.numChunks=t,this.getChunkIterator=n,this.chunkIndex=0,this.chunkIterator=this.getChunkIterator(0)}next(){for(;this.chunkIndex<this.numChunks;){let t=this.chunkIterator.next();if(!t.done)return t;++this.chunkIndex<this.numChunks&&(this.chunkIterator=this.getChunkIterator(this.chunkIndex))}return{done:!0,value:null}}[Symbol.iterator](){return this}};function jg(e){return e.reduce((t,n)=>t+n.nullCount,0)}function Vg(e){return e.reduce((t,n,r)=>(t[r+1]=t[r]+n.length,t),new Uint32Array(e.length+1))}function Yg(e,t,n,r){let i=[];for(let o=-1,s=e.length;++o<s;){let a=e[o],c=t[o],{length:l}=a;if(c>=r)break;if(n>=c+l)continue;if(c>=n&&c+l<=r){i.push(a);continue}let u=Math.max(0,n-c),f=Math.min(r-c,l);i.push(a.slice(u,f-u))}return i.length===0&&i.push(e[0].slice(0,0)),i}function K_(e,t,n,r){let i=0,o=0,s=t.length-1;do{if(i>=s-1)return n<t[s]?r(e,i,n-t[i]):null;o=i+Math.trunc((s-i)*.5),n<t[o]?s=o:i=o}while(i<s)}function Yd(e,t){return e.getValid(t)}function pa(e){function t(n,r,i){return e(n[r],i)}return function(n){let r=this.data;return K_(r,this._offsets,n,t)}}function Xg(e){let t;function n(r,i,o){return e(r[i],o,t)}return function(r,i){let o=this.data;t=i;let s=K_(o,this._offsets,r,n);return t=void 0,s}}function Gg(e){let t;function n(r,i,o){let s=o,a=0,c=0;for(let l=i-1,u=r.length;++l<u;){let f=r[l];if(~(a=e(f,t,s)))return c+a;s=0,c+=f.length}return-1}return function(r,i){t=r;let o=this.data,s=typeof i!="number"?n(o,0,0):K_(o,this._offsets,i,n);return t=void 0,s}}var xt=class extends ut{};function Uq(e,t){return t===null&&e.length>0?0:-1}function zq(e,t){let{nullBitmap:n}=e;if(!n||e.nullCount<=0)return-1;let r=0;for(let i of new Sc(n,e.offset+(t||0),e.length,n,qg)){if(!i)return r;++r}return-1}function Lt(e,t,n){if(t===void 0)return-1;if(t===null)switch(e.typeId){case C.Union:break;case C.Dictionary:break;default:return zq(e,n)}let r=je.getVisitFn(e),i=ha(t);for(let o=(n||0)-1,s=e.length;++o<s;)if(i(r(e,o)))return o;return-1}function LO(e,t,n){let r=je.getVisitFn(e),i=ha(t);for(let o=(n||0)-1,s=e.length;++o<s;)if(i(r(e,o)))return o;return-1}xt.prototype.visitNull=Uq;xt.prototype.visitBool=Lt;xt.prototype.visitInt=Lt;xt.prototype.visitInt8=Lt;xt.prototype.visitInt16=Lt;xt.prototype.visitInt32=Lt;xt.prototype.visitInt64=Lt;xt.prototype.visitUint8=Lt;xt.prototype.visitUint16=Lt;xt.prototype.visitUint32=Lt;xt.prototype.visitUint64=Lt;xt.prototype.visitFloat=Lt;xt.prototype.visitFloat16=Lt;xt.prototype.visitFloat32=Lt;xt.prototype.visitFloat64=Lt;xt.prototype.visitUtf8=Lt;xt.prototype.visitBinary=Lt;xt.prototype.visitFixedSizeBinary=Lt;xt.prototype.visitDate=Lt;xt.prototype.visitDateDay=Lt;xt.prototype.visitDateMillisecond=Lt;xt.prototype.visitTimestamp=Lt;xt.prototype.visitTimestampSecond=Lt;xt.prototype.visitTimestampMillisecond=Lt;xt.prototype.visitTimestampMicrosecond=Lt;xt.prototype.visitTimestampNanosecond=Lt;xt.prototype.visitTime=Lt;xt.prototype.visitTimeSecond=Lt;xt.prototype.visitTimeMillisecond=Lt;xt.prototype.visitTimeMicrosecond=Lt;xt.prototype.visitTimeNanosecond=Lt;xt.prototype.visitDecimal=Lt;xt.prototype.visitList=Lt;xt.prototype.visitStruct=Lt;xt.prototype.visitUnion=Lt;xt.prototype.visitDenseUnion=LO;xt.prototype.visitSparseUnion=LO;xt.prototype.visitDictionary=Lt;xt.prototype.visitInterval=Lt;xt.prototype.visitIntervalDayTime=Lt;xt.prototype.visitIntervalYearMonth=Lt;xt.prototype.visitDuration=Lt;xt.prototype.visitDurationSecond=Lt;xt.prototype.visitDurationMillisecond=Lt;xt.prototype.visitDurationMicrosecond=Lt;xt.prototype.visitDurationNanosecond=Lt;xt.prototype.visitFixedSizeList=Lt;xt.prototype.visitMap=Lt;var Ac=new xt;var bt=class extends ut{};function At(e){let{type:t}=e;if(e.nullCount===0&&e.stride===1&&(t.typeId===C.Timestamp||t instanceof $e&&t.bitWidth!==64||t instanceof Mi&&t.bitWidth!==64||t instanceof ur&&t.precision!==Se.HALF))return new Vd(e.data.length,r=>{let i=e.data[r];return i.values.subarray(0,i.length)[Symbol.iterator]()});let n=0;return new Vd(e.data.length,r=>{let o=e.data[r].length,s=e.slice(n,n+o);return n+=o,new t2(s)})}var t2=class{constructor(t){this.vector=t,this.index=0}next(){return this.index<this.vector.length?{value:this.vector.get(this.index++)}:{done:!0,value:null}}[Symbol.iterator](){return this}};bt.prototype.visitNull=At;bt.prototype.visitBool=At;bt.prototype.visitInt=At;bt.prototype.visitInt8=At;bt.prototype.visitInt16=At;bt.prototype.visitInt32=At;bt.prototype.visitInt64=At;bt.prototype.visitUint8=At;bt.prototype.visitUint16=At;bt.prototype.visitUint32=At;bt.prototype.visitUint64=At;bt.prototype.visitFloat=At;bt.prototype.visitFloat16=At;bt.prototype.visitFloat32=At;bt.prototype.visitFloat64=At;bt.prototype.visitUtf8=At;bt.prototype.visitBinary=At;bt.prototype.visitFixedSizeBinary=At;bt.prototype.visitDate=At;bt.prototype.visitDateDay=At;bt.prototype.visitDateMillisecond=At;bt.prototype.visitTimestamp=At;bt.prototype.visitTimestampSecond=At;bt.prototype.visitTimestampMillisecond=At;bt.prototype.visitTimestampMicrosecond=At;bt.prototype.visitTimestampNanosecond=At;bt.prototype.visitTime=At;bt.prototype.visitTimeSecond=At;bt.prototype.visitTimeMillisecond=At;bt.prototype.visitTimeMicrosecond=At;bt.prototype.visitTimeNanosecond=At;bt.prototype.visitDecimal=At;bt.prototype.visitList=At;bt.prototype.visitStruct=At;bt.prototype.visitUnion=At;bt.prototype.visitDenseUnion=At;bt.prototype.visitSparseUnion=At;bt.prototype.visitDictionary=At;bt.prototype.visitInterval=At;bt.prototype.visitIntervalDayTime=At;bt.prototype.visitIntervalYearMonth=At;bt.prototype.visitDuration=At;bt.prototype.visitDurationSecond=At;bt.prototype.visitDurationMillisecond=At;bt.prototype.visitDurationMicrosecond=At;bt.prototype.visitDurationNanosecond=At;bt.prototype.visitFixedSizeList=At;bt.prototype.visitMap=At;var su=new bt;var qq=(e,t)=>e+t,Ki=class extends ut{visitNull(t,n){return 0}visitInt(t,n){return t.type.bitWidth/8}visitFloat(t,n){return t.type.ArrayType.BYTES_PER_ELEMENT}visitBool(t,n){return 1/8}visitDecimal(t,n){return t.type.bitWidth/8}visitDate(t,n){return(t.type.unit+1)*4}visitTime(t,n){return t.type.bitWidth/8}visitTimestamp(t,n){return t.type.unit===mt.SECOND?4:8}visitInterval(t,n){return(t.type.unit+1)*4}visitDuration(t,n){return 8}visitStruct(t,n){return t.children.reduce((r,i)=>r+Er.visit(i,n),0)}visitFixedSizeBinary(t,n){return t.type.byteWidth}visitMap(t,n){return 8+t.children.reduce((r,i)=>r+Er.visit(i,n),0)}visitDictionary(t,n){var r;return t.type.indices.bitWidth/8+(((r=t.dictionary)===null||r===void 0?void 0:r.getByteLength(t.values[n]))||0)}},jq=({valueOffsets:e},t)=>8+(e[t+1]-e[t]),Vq=({valueOffsets:e},t)=>8+(e[t+1]-e[t]),Yq=({valueOffsets:e,stride:t,children:n},r)=>{let i=n[0],{[r*t]:o}=e,{[r*t+1]:s}=e,a=Er.getVisitFn(i.type),c=i.slice(o,s-o),l=8;for(let u=-1,f=s-o;++u<f;)l+=a(c,u);return l},Xq=({stride:e,children:t},n)=>{let r=t[0],i=r.slice(n*e,e),o=Er.getVisitFn(r.type),s=0;for(let a=-1,c=i.length;++a<c;)s+=o(i,a);return s},Gq=(e,t)=>e.type.mode===xe.Dense?CO(e,t):kO(e,t),CO=({type:e,children:t,typeIds:n,valueOffsets:r},i)=>{let o=e.typeIdToChildIndex[n[i]];return 8+Er.visit(t[o],r[i])},kO=({children:e},t)=>4+Er.visitMany(e,e.map(()=>t)).reduce(qq,0);Ki.prototype.visitUtf8=jq;Ki.prototype.visitBinary=Vq;Ki.prototype.visitList=Yq;Ki.prototype.visitFixedSizeList=Xq;Ki.prototype.visitUnion=Gq;Ki.prototype.visitDenseUnion=CO;Ki.prototype.visitSparseUnion=kO;var Er=new Ki;var FO,RO={},$O={},Yt=class e{constructor(t){var n,r,i;let o=t[0]instanceof e?t.flatMap(a=>a.data):t;if(o.length===0||o.some(a=>!(a instanceof se)))throw new TypeError("Vector constructor expects an Array of Data instances.");let s=(n=o[0])===null||n===void 0?void 0:n.type;switch(o.length){case 0:this._offsets=[0];break;case 1:{let{get:a,set:c,indexOf:l,byteLength:u}=RO[s.typeId],f=o[0];this.isValid=d=>Yd(f,d),this.get=d=>a(f,d),this.set=(d,h)=>c(f,d,h),this.indexOf=d=>l(f,d),this.getByteLength=d=>u(f,d),this._offsets=[0,f.length];break}default:Object.setPrototypeOf(this,$O[s.typeId]),this._offsets=Vg(o);break}this.data=o,this.type=s,this.stride=Tr(s),this.numChildren=(i=(r=s.children)===null||r===void 0?void 0:r.length)!==null&&i!==void 0?i:0,this.length=this._offsets.at(-1)}get byteLength(){return this.data.reduce((t,n)=>t+n.byteLength,0)}get nullCount(){return jg(this.data)}get ArrayType(){return this.type.ArrayType}get[Symbol.toStringTag](){return`${this.VectorName}<${this.type[Symbol.toStringTag]}>`}get VectorName(){return`${C[this.type.typeId]}Vector`}isValid(t){return!1}get(t){return null}set(t,n){}indexOf(t,n){return-1}includes(t,n){return this.indexOf(t,n)>-1}getByteLength(t){return 0}[Symbol.iterator](){return su.visit(this)}concat(...t){return new e(this.data.concat(t.flatMap(n=>n.data).flat(Number.POSITIVE_INFINITY)))}slice(t,n){return new e(qd(this,t,n,({data:r,_offsets:i},o,s)=>Yg(r,i,o,s)))}toJSON(){return[...this]}toArray(){let{type:t,data:n,length:r,stride:i,ArrayType:o}=this;switch(t.typeId){case C.Int:case C.Float:case C.Decimal:case C.Time:case C.Timestamp:switch(n.length){case 0:return new o;case 1:return n[0].values.subarray(0,r*i);default:return n.reduce((s,{values:a,length:c})=>(s.array.set(a.subarray(0,c*i),s.offset),s.offset+=c*i,s),{array:new o(r*i),offset:0}).array}}return[...this]}toString(){return`[${[...this].join(",")}]`}getChild(t){var n;return this.getChildAt((n=this.type.children)===null||n===void 0?void 0:n.findIndex(r=>r.name===t))}getChildAt(t){return t>-1&&t<this.numChildren?new e(this.data.map(({children:n})=>n[t])):null}get isMemoized(){return at.isDictionary(this.type)?this.data[0].dictionary.isMemoized:!1}memoize(){if(at.isDictionary(this.type)){let t=new Wg(this.data[0].dictionary),n=this.data.map(r=>{let i=r.clone();return i.dictionary=t,i});return new e(n)}return new Wg(this)}unmemoize(){if(at.isDictionary(this.type)&&this.isMemoized){let t=this.data[0].dictionary.unmemoize(),n=this.data.map(r=>{let i=r.clone();return i.dictionary=t,i});return new e(n)}return this}};FO=Symbol.toStringTag;Yt[FO]=(e=>{e.type=at.prototype,e.data=[],e.length=0,e.stride=1,e.numChildren=0,e._offsets=new Uint32Array([0]),e[Symbol.isConcatSpreadable]=!0;let t=Object.keys(C).map(n=>C[n]).filter(n=>typeof n=="number"&&n!==C.NONE);for(let n of t){let r=je.getVisitFnByTypeId(n),i=gn.getVisitFnByTypeId(n),o=Ac.getVisitFnByTypeId(n),s=Er.getVisitFnByTypeId(n);RO[n]={get:r,set:i,indexOf:o,byteLength:s},$O[n]=Object.create(e,{isValid:{value:pa(Yd)},get:{value:pa(je.getVisitFnByTypeId(n))},set:{value:Xg(gn.getVisitFnByTypeId(n))},indexOf:{value:Gg(Ac.getVisitFnByTypeId(n))},getByteLength:{value:pa(Er.getVisitFnByTypeId(n))}})}return"Vector"})(Yt.prototype);var Wg=class e extends Yt{constructor(t){super(t.data);let n=this.get,r=this.set,i=this.slice,o=new Array(this.length);Object.defineProperty(this,"get",{value(s){let a=o[s];if(a!==void 0)return a;let c=n.call(this,s);return o[s]=c,c}}),Object.defineProperty(this,"set",{value(s,a){r.call(this,s,a),o[s]=a}}),Object.defineProperty(this,"slice",{value:(s,a)=>new e(i.call(this,s,a))}),Object.defineProperty(this,"isMemoized",{value:!0}),Object.defineProperty(this,"unmemoize",{value:()=>new Yt(this.data)}),Object.defineProperty(this,"memoize",{value:()=>this})}};function PO(e){if(!e||e.length<=0)return function(i){return!0};let t="",n=e.filter(r=>r===r);return n.length>0&&(t=`
2
2
  switch (x) {${n.map(r=>`
3
- case ${bj(r)}:`).join("")}
3
+ case ${Wq(r)}:`).join("")}
4
4
  return false;
5
5
  }`),e.length!==n.length&&(t=`if (x !== x) return false;
6
6
  ${t}`),new Function("x",`${t}
7
- return true;`)}function bj(e){return typeof e!="bigint"?Si(e):`${Si(e)}n`}var t2=(e,t)=>(Math.ceil(e)*t+63&-64||64)/t,wj=(e,t=0)=>e.length>=t?e.subarray(0,t):Jl(new e.constructor(t),e,0),ha=class{constructor(t,n=1){this.buffer=t,this.stride=n,this.BYTES_PER_ELEMENT=t.BYTES_PER_ELEMENT,this.ArrayType=t.constructor,this._resize(this.length=Math.ceil(t.length/n))}get byteLength(){return Math.ceil(this.length*this.stride)*this.BYTES_PER_ELEMENT}get reservedLength(){return this.buffer.length/this.stride}get reservedByteLength(){return this.buffer.byteLength}set(t,n){return this}append(t){return this.set(this.length,t)}reserve(t){if(t>0){this.length+=t;let n=this.stride,r=this.length*n,i=this.buffer.length;r>=i&&this._resize(i===0?t2(r*1,this.BYTES_PER_ELEMENT):t2(r*2,this.BYTES_PER_ELEMENT))}return this}flush(t=this.length){t=t2(t*this.stride,this.BYTES_PER_ELEMENT);let n=wj(this.buffer,t);return this.clear(),n}clear(){return this.length=0,this._resize(0),this}_resize(t){return this.buffer=Jl(new this.ArrayType(t),this.buffer)}};ha.prototype.offset=0;var is=class extends ha{last(){return this.get(this.length-1)}get(t){return this.buffer[t]}set(t,n){return this.reserve(t-this.length+1),this.buffer[t*this.stride]=n,this}},su=class extends is{constructor(t=new Uint8Array(0)){super(t,1/8),this.numValid=0}get numInvalid(){return this.length-this.numValid}get(t){return this.buffer[t>>3]>>t%8&1}set(t,n){let{buffer:r}=this.reserve(t-this.length+1),i=t>>3,o=t%8,s=r[i]>>o&1;return n?s===0&&(r[i]|=1<<o,++this.numValid):s===1&&(r[i]&=~(1<<o),--this.numValid),this}clear(){return this.numValid=0,super.clear()}},au=class extends is{constructor(t=new Int32Array(1)){super(t,1)}append(t){return this.set(this.length-1,t)}set(t,n){let r=this.length-1,i=this.reserve(t-r+1).buffer;return r<t++&&i.fill(i[r],r,t),i[t]=i[t-1]+n,this}flush(t=this.length-1){return t>this.length&&this.set(t-1,0),super.flush(t+1)}};var be=class{static throughNode(t){throw new Error('"throughNode" not available in this environment')}static throughDOM(t){throw new Error('"throughDOM" not available in this environment')}constructor({type:t,nullValues:n}){this.length=0,this.finished=!1,this.type=t,this.children=[],this.nullValues=n,this.stride=Mr(t),this._nulls=new su,n&&n.length>0&&(this._isValid=mO(n))}toVector(){return new Vt([this.flush()])}get ArrayType(){return this.type.ArrayType}get nullCount(){return this._nulls.numInvalid}get numChildren(){return this.children.length}get byteLength(){let t=0,{_offsets:n,_values:r,_nulls:i,_typeIds:o,children:s}=this;return n&&(t+=n.byteLength),r&&(t+=r.byteLength),i&&(t+=i.byteLength),o&&(t+=o.byteLength),s.reduce((a,c)=>a+c.byteLength,t)}get reservedLength(){return this._nulls.reservedLength}get reservedByteLength(){let t=0;return this._offsets&&(t+=this._offsets.reservedByteLength),this._values&&(t+=this._values.reservedByteLength),this._nulls&&(t+=this._nulls.reservedByteLength),this._typeIds&&(t+=this._typeIds.reservedByteLength),this.children.reduce((n,r)=>n+r.reservedByteLength,t)}get valueOffsets(){return this._offsets?this._offsets.buffer:null}get values(){return this._values?this._values.buffer:null}get nullBitmap(){return this._nulls?this._nulls.buffer:null}get typeIds(){return this._typeIds?this._typeIds.buffer:null}append(t){return this.set(this.length,t)}isValid(t){return this._isValid(t)}set(t,n){return this.setValid(t,this.isValid(n))&&this.setValue(t,n),this}setValue(t,n){this._setValue(this,t,n)}setValid(t,n){return this.length=this._nulls.set(t,+n).length,n}addChild(t,n=`${this.numChildren}`){throw new Error(`Cannot append children to non-nested type "${this.type}"`)}getChildAt(t){return this.children[t]||null}flush(){let t,n,r,i,{type:o,length:s,nullCount:a,_typeIds:c,_offsets:l,_values:u,_nulls:f}=this;(n=c?.flush(s))?i=l?.flush(s):(i=l?.flush(s))?t=u?.flush(l.last()):t=u?.flush(s),a>0&&(r=f?.flush(s));let d=this.children.map(h=>h.flush());return this.clear(),Bt({type:o,length:s,nullCount:a,children:d,child:d[0],data:t,typeIds:n,nullBitmap:r,valueOffsets:i})}finish(){this.finished=!0;for(let t of this.children)t.finish();return this}clear(){var t,n,r,i;this.length=0,(t=this._nulls)===null||t===void 0||t.clear(),(n=this._values)===null||n===void 0||n.clear(),(r=this._offsets)===null||r===void 0||r.clear(),(i=this._typeIds)===null||i===void 0||i.clear();for(let o of this.children)o.clear();return this}};be.prototype.length=1;be.prototype.stride=1;be.prototype.children=null;be.prototype.finished=!1;be.prototype.nullValues=null;be.prototype._isValid=()=>!0;var Ve=class extends be{constructor(t){super(t),this._values=new is(new this.ArrayType(0),this.stride)}setValue(t,n){let r=this._values;return r.reserve(t-r.length+1),super.setValue(t,n)}},to=class extends be{constructor(t){super(t),this._pendingLength=0,this._offsets=new au}setValue(t,n){let r=this._pending||(this._pending=new Map),i=r.get(t);i&&(this._pendingLength-=i.length),this._pendingLength+=n instanceof Qi?n[Gr].length:n.length,r.set(t,n)}setValid(t,n){return super.setValid(t,n)?!0:((this._pending||(this._pending=new Map)).set(t,void 0),!1)}clear(){return this._pendingLength=0,this._pending=void 0,super.clear()}flush(){return this._flush(),super.flush()}finish(){return this._flush(),super.finish()}_flush(){let t=this._pending,n=this._pendingLength;return this._pendingLength=0,this._pending=void 0,t&&t.size>0&&this._flushPending(t,n),this}};var Mc=class{constructor(){this.bb=null,this.bb_pos=0}__init(t,n){return this.bb_pos=t,this.bb=n,this}offset(){return this.bb.readInt64(this.bb_pos)}metaDataLength(){return this.bb.readInt32(this.bb_pos+8)}bodyLength(){return this.bb.readInt64(this.bb_pos+16)}static sizeOf(){return 24}static createBlock(t,n,r,i){return t.prep(8,24),t.writeInt64(BigInt(i??0)),t.pad(4),t.writeInt32(r),t.writeInt64(BigInt(n??0)),t.offset()}};var eo=new Int32Array(2),Wg=new Float32Array(eo.buffer),Hg=new Float64Array(eo.buffer),cu=new Uint16Array(new Uint8Array([1,0]).buffer)[0]===1;var Yd;(function(e){e[e.UTF8_BYTES=1]="UTF8_BYTES",e[e.UTF16_STRING=2]="UTF16_STRING"})(Yd||(Yd={}));var Ar=class e{constructor(t){this.bytes_=t,this.position_=0,this.text_decoder_=new TextDecoder}static allocate(t){return new e(new Uint8Array(t))}clear(){this.position_=0}bytes(){return this.bytes_}position(){return this.position_}setPosition(t){this.position_=t}capacity(){return this.bytes_.length}readInt8(t){return this.readUint8(t)<<24>>24}readUint8(t){return this.bytes_[t]}readInt16(t){return this.readUint16(t)<<16>>16}readUint16(t){return this.bytes_[t]|this.bytes_[t+1]<<8}readInt32(t){return this.bytes_[t]|this.bytes_[t+1]<<8|this.bytes_[t+2]<<16|this.bytes_[t+3]<<24}readUint32(t){return this.readInt32(t)>>>0}readInt64(t){return BigInt.asIntN(64,BigInt(this.readUint32(t))+(BigInt(this.readUint32(t+4))<<BigInt(32)))}readUint64(t){return BigInt.asUintN(64,BigInt(this.readUint32(t))+(BigInt(this.readUint32(t+4))<<BigInt(32)))}readFloat32(t){return eo[0]=this.readInt32(t),Wg[0]}readFloat64(t){return eo[cu?0:1]=this.readInt32(t),eo[cu?1:0]=this.readInt32(t+4),Hg[0]}writeInt8(t,n){this.bytes_[t]=n}writeUint8(t,n){this.bytes_[t]=n}writeInt16(t,n){this.bytes_[t]=n,this.bytes_[t+1]=n>>8}writeUint16(t,n){this.bytes_[t]=n,this.bytes_[t+1]=n>>8}writeInt32(t,n){this.bytes_[t]=n,this.bytes_[t+1]=n>>8,this.bytes_[t+2]=n>>16,this.bytes_[t+3]=n>>24}writeUint32(t,n){this.bytes_[t]=n,this.bytes_[t+1]=n>>8,this.bytes_[t+2]=n>>16,this.bytes_[t+3]=n>>24}writeInt64(t,n){this.writeInt32(t,Number(BigInt.asIntN(32,n))),this.writeInt32(t+4,Number(BigInt.asIntN(32,n>>BigInt(32))))}writeUint64(t,n){this.writeUint32(t,Number(BigInt.asUintN(32,n))),this.writeUint32(t+4,Number(BigInt.asUintN(32,n>>BigInt(32))))}writeFloat32(t,n){Wg[0]=n,this.writeInt32(t,eo[0])}writeFloat64(t,n){Hg[0]=n,this.writeInt32(t,eo[cu?0:1]),this.writeInt32(t+4,eo[cu?1:0])}getBufferIdentifier(){if(this.bytes_.length<this.position_+4+4)throw new Error("FlatBuffers: ByteBuffer is too short to contain an identifier.");let t="";for(let n=0;n<4;n++)t+=String.fromCharCode(this.readInt8(this.position_+4+n));return t}__offset(t,n){let r=t-this.readInt32(t);return n<this.readInt16(r)?this.readInt16(r+n):0}__union(t,n){return t.bb_pos=n+this.readInt32(n),t.bb=this,t}__string(t,n){t+=this.readInt32(t);let r=this.readInt32(t);t+=4;let i=this.bytes_.subarray(t,t+r);return n===Yd.UTF8_BYTES?i:this.text_decoder_.decode(i)}__union_with_string(t,n){return typeof t=="string"?this.__string(n):this.__union(t,n)}__indirect(t){return t+this.readInt32(t)}__vector(t){return t+this.readInt32(t)+4}__vector_len(t){return this.readInt32(t+this.readInt32(t))}__has_identifier(t){if(t.length!=4)throw new Error("FlatBuffers: file identifier must be length "+4);for(let n=0;n<4;n++)if(t.charCodeAt(n)!=this.readInt8(this.position()+4+n))return!1;return!0}createScalarList(t,n){let r=[];for(let i=0;i<n;++i){let o=t(i);o!==null&&r.push(o)}return r}createObjList(t,n){let r=[];for(let i=0;i<n;++i){let o=t(i);o!==null&&r.push(o.unpack())}return r}};var Tc=class e{constructor(t){this.minalign=1,this.vtable=null,this.vtable_in_use=0,this.isNested=!1,this.object_start=0,this.vtables=[],this.vector_num_elems=0,this.force_defaults=!1,this.string_maps=null,this.text_encoder=new TextEncoder;let n;t?n=t:n=1024,this.bb=Ar.allocate(n),this.space=n}clear(){this.bb.clear(),this.space=this.bb.capacity(),this.minalign=1,this.vtable=null,this.vtable_in_use=0,this.isNested=!1,this.object_start=0,this.vtables=[],this.vector_num_elems=0,this.force_defaults=!1,this.string_maps=null}forceDefaults(t){this.force_defaults=t}dataBuffer(){return this.bb}asUint8Array(){return this.bb.bytes().subarray(this.bb.position(),this.bb.position()+this.offset())}prep(t,n){t>this.minalign&&(this.minalign=t);let r=~(this.bb.capacity()-this.space+n)+1&t-1;for(;this.space<r+t+n;){let i=this.bb.capacity();this.bb=e.growByteBuffer(this.bb),this.space+=this.bb.capacity()-i}this.pad(r)}pad(t){for(let n=0;n<t;n++)this.bb.writeInt8(--this.space,0)}writeInt8(t){this.bb.writeInt8(this.space-=1,t)}writeInt16(t){this.bb.writeInt16(this.space-=2,t)}writeInt32(t){this.bb.writeInt32(this.space-=4,t)}writeInt64(t){this.bb.writeInt64(this.space-=8,t)}writeFloat32(t){this.bb.writeFloat32(this.space-=4,t)}writeFloat64(t){this.bb.writeFloat64(this.space-=8,t)}addInt8(t){this.prep(1,0),this.writeInt8(t)}addInt16(t){this.prep(2,0),this.writeInt16(t)}addInt32(t){this.prep(4,0),this.writeInt32(t)}addInt64(t){this.prep(8,0),this.writeInt64(t)}addFloat32(t){this.prep(4,0),this.writeFloat32(t)}addFloat64(t){this.prep(8,0),this.writeFloat64(t)}addFieldInt8(t,n,r){(this.force_defaults||n!=r)&&(this.addInt8(n),this.slot(t))}addFieldInt16(t,n,r){(this.force_defaults||n!=r)&&(this.addInt16(n),this.slot(t))}addFieldInt32(t,n,r){(this.force_defaults||n!=r)&&(this.addInt32(n),this.slot(t))}addFieldInt64(t,n,r){(this.force_defaults||n!==r)&&(this.addInt64(n),this.slot(t))}addFieldFloat32(t,n,r){(this.force_defaults||n!=r)&&(this.addFloat32(n),this.slot(t))}addFieldFloat64(t,n,r){(this.force_defaults||n!=r)&&(this.addFloat64(n),this.slot(t))}addFieldOffset(t,n,r){(this.force_defaults||n!=r)&&(this.addOffset(n),this.slot(t))}addFieldStruct(t,n,r){n!=r&&(this.nested(n),this.slot(t))}nested(t){if(t!=this.offset())throw new TypeError("FlatBuffers: struct must be serialized inline.")}notNested(){if(this.isNested)throw new TypeError("FlatBuffers: object serialization must not be nested.")}slot(t){this.vtable!==null&&(this.vtable[t]=this.offset())}offset(){return this.bb.capacity()-this.space}static growByteBuffer(t){let n=t.capacity();if(n&3221225472)throw new Error("FlatBuffers: cannot grow buffer beyond 2 gigabytes.");let r=n<<1,i=Ar.allocate(r);return i.setPosition(r-n),i.bytes().set(t.bytes(),r-n),i}addOffset(t){this.prep(4,0),this.writeInt32(this.offset()-t+4)}startObject(t){this.notNested(),this.vtable==null&&(this.vtable=[]),this.vtable_in_use=t;for(let n=0;n<t;n++)this.vtable[n]=0;this.isNested=!0,this.object_start=this.offset()}endObject(){if(this.vtable==null||!this.isNested)throw new Error("FlatBuffers: endObject called without startObject");this.addInt32(0);let t=this.offset(),n=this.vtable_in_use-1;for(;n>=0&&this.vtable[n]==0;n--);let r=n+1;for(;n>=0;n--)this.addInt16(this.vtable[n]!=0?t-this.vtable[n]:0);let i=2;this.addInt16(t-this.object_start);let o=(r+i)*2;this.addInt16(o);let s=0,a=this.space;t:for(n=0;n<this.vtables.length;n++){let c=this.bb.capacity()-this.vtables[n];if(o==this.bb.readInt16(c)){for(let l=2;l<o;l+=2)if(this.bb.readInt16(a+l)!=this.bb.readInt16(c+l))continue t;s=this.vtables[n];break}}return s?(this.space=this.bb.capacity()-t,this.bb.writeInt32(this.space,s-t)):(this.vtables.push(this.offset()),this.bb.writeInt32(this.bb.capacity()-t,this.offset()-t)),this.isNested=!1,t}finish(t,n,r){let i=r?4:0;if(n){let o=n;if(this.prep(this.minalign,8+i),o.length!=4)throw new TypeError("FlatBuffers: file identifier must be length "+4);for(let s=3;s>=0;s--)this.writeInt8(o.charCodeAt(s))}this.prep(this.minalign,4+i),this.addOffset(t),i&&this.addInt32(this.bb.capacity()-this.space),this.bb.setPosition(this.space)}finishSizePrefixed(t,n){this.finish(t,n,!0)}requiredField(t,n){let r=this.bb.capacity()-t,i=r-this.bb.readInt32(r);if(!(n<this.bb.readInt16(i)&&this.bb.readInt16(i+n)!=0))throw new TypeError("FlatBuffers: field "+n+" must be set")}startVector(t,n,r){this.notNested(),this.vector_num_elems=n,this.prep(4,t*n),this.prep(r,t*n)}endVector(){return this.writeInt32(this.vector_num_elems),this.offset()}createSharedString(t){if(!t)return 0;if(this.string_maps||(this.string_maps=new Map),this.string_maps.has(t))return this.string_maps.get(t);let n=this.createString(t);return this.string_maps.set(t,n),n}createString(t){if(t==null)return 0;let n;t instanceof Uint8Array?n=t:n=this.text_encoder.encode(t),this.addInt8(0),this.startVector(1,n.length,1),this.bb.setPosition(this.space-=n.length);for(let r=0,i=this.space,o=this.bb.bytes();r<n.length;r++)o[i++]=n[r];return this.endVector()}createObjectOffset(t){return t===null?0:typeof t=="string"?this.createString(t):t.pack(this)}createObjectOffsetList(t){let n=[];for(let r=0;r<t.length;++r){let i=t[r];if(i!==null)n.push(this.createObjectOffset(i));else throw new TypeError("FlatBuffers: Argument for createObjectOffsetList cannot contain null.")}return n}createStructOffsetList(t,n){return n(this,t.length),this.createObjectOffsetList(t.slice().reverse()),this.endVector()}};var en=class e{constructor(){this.bb=null,this.bb_pos=0}__init(t,n){return this.bb_pos=t,this.bb=n,this}static getRootAsKeyValue(t,n){return(n||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsKeyValue(t,n){return t.setPosition(t.position()+4),(n||new e).__init(t.readInt32(t.position())+t.position(),t)}key(t){let n=this.bb.__offset(this.bb_pos,4);return n?this.bb.__string(this.bb_pos+n,t):null}value(t){let n=this.bb.__offset(this.bb_pos,6);return n?this.bb.__string(this.bb_pos+n,t):null}static startKeyValue(t){t.startObject(2)}static addKey(t,n){t.addFieldOffset(0,n,0)}static addValue(t,n){t.addFieldOffset(1,n,0)}static endKeyValue(t){return t.endObject()}static createKeyValue(t,n,r){return e.startKeyValue(t),e.addKey(t,n),e.addValue(t,r),e.endKeyValue(t)}};var pa;(function(e){e[e.V1=0]="V1",e[e.V2=1]="V2",e[e.V3=2]="V3",e[e.V4=3]="V4",e[e.V5=4]="V5"})(pa||(pa={}));var ma;(function(e){e[e.Little=0]="Little",e[e.Big=1]="Big"})(ma||(ma={}));var Xd;(function(e){e[e.DenseArray=0]="DenseArray"})(Xd||(Xd={}));var Bi=class e{constructor(){this.bb=null,this.bb_pos=0}__init(t,n){return this.bb_pos=t,this.bb=n,this}static getRootAsInt(t,n){return(n||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsInt(t,n){return t.setPosition(t.position()+4),(n||new e).__init(t.readInt32(t.position())+t.position(),t)}bitWidth(){let t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt32(this.bb_pos+t):0}isSigned(){let t=this.bb.__offset(this.bb_pos,6);return t?!!this.bb.readInt8(this.bb_pos+t):!1}static startInt(t){t.startObject(2)}static addBitWidth(t,n){t.addFieldInt32(0,n,0)}static addIsSigned(t,n){t.addFieldInt8(1,+n,0)}static endInt(t){return t.endObject()}static createInt(t,n,r){return e.startInt(t),e.addBitWidth(t,n),e.addIsSigned(t,r),e.endInt(t)}};var no=class e{constructor(){this.bb=null,this.bb_pos=0}__init(t,n){return this.bb_pos=t,this.bb=n,this}static getRootAsDictionaryEncoding(t,n){return(n||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsDictionaryEncoding(t,n){return t.setPosition(t.position()+4),(n||new e).__init(t.readInt32(t.position())+t.position(),t)}id(){let t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt64(this.bb_pos+t):BigInt("0")}indexType(t){let n=this.bb.__offset(this.bb_pos,6);return n?(t||new Bi).__init(this.bb.__indirect(this.bb_pos+n),this.bb):null}isOrdered(){let t=this.bb.__offset(this.bb_pos,8);return t?!!this.bb.readInt8(this.bb_pos+t):!1}dictionaryKind(){let t=this.bb.__offset(this.bb_pos,10);return t?this.bb.readInt16(this.bb_pos+t):Xd.DenseArray}static startDictionaryEncoding(t){t.startObject(4)}static addId(t,n){t.addFieldInt64(0,n,BigInt("0"))}static addIndexType(t,n){t.addFieldOffset(1,n,0)}static addIsOrdered(t,n){t.addFieldInt8(2,+n,0)}static addDictionaryKind(t,n){t.addFieldInt16(3,n,Xd.DenseArray)}static endDictionaryEncoding(t){return t.endObject()}};var Gd=class e{constructor(){this.bb=null,this.bb_pos=0}__init(t,n){return this.bb_pos=t,this.bb=n,this}static getRootAsBinary(t,n){return(n||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsBinary(t,n){return t.setPosition(t.position()+4),(n||new e).__init(t.readInt32(t.position())+t.position(),t)}static startBinary(t){t.startObject(0)}static endBinary(t){return t.endObject()}static createBinary(t){return e.startBinary(t),e.endBinary(t)}};var Wd=class e{constructor(){this.bb=null,this.bb_pos=0}__init(t,n){return this.bb_pos=t,this.bb=n,this}static getRootAsBool(t,n){return(n||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsBool(t,n){return t.setPosition(t.position()+4),(n||new e).__init(t.readInt32(t.position())+t.position(),t)}static startBool(t){t.startObject(0)}static endBool(t){return t.endObject()}static createBool(t){return e.startBool(t),e.endBool(t)}};var Hd;(function(e){e[e.DAY=0]="DAY",e[e.MILLISECOND=1]="MILLISECOND"})(Hd||(Hd={}));var ya=class e{constructor(){this.bb=null,this.bb_pos=0}__init(t,n){return this.bb_pos=t,this.bb=n,this}static getRootAsDate(t,n){return(n||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsDate(t,n){return t.setPosition(t.position()+4),(n||new e).__init(t.readInt32(t.position())+t.position(),t)}unit(){let t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt16(this.bb_pos+t):Hd.MILLISECOND}static startDate(t){t.startObject(1)}static addUnit(t,n){t.addFieldInt16(0,n,Hd.MILLISECOND)}static endDate(t){return t.endObject()}static createDate(t,n){return e.startDate(t),e.addUnit(t,n),e.endDate(t)}};var ro=class e{constructor(){this.bb=null,this.bb_pos=0}__init(t,n){return this.bb_pos=t,this.bb=n,this}static getRootAsDecimal(t,n){return(n||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsDecimal(t,n){return t.setPosition(t.position()+4),(n||new e).__init(t.readInt32(t.position())+t.position(),t)}precision(){let t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt32(this.bb_pos+t):0}scale(){let t=this.bb.__offset(this.bb_pos,6);return t?this.bb.readInt32(this.bb_pos+t):0}bitWidth(){let t=this.bb.__offset(this.bb_pos,8);return t?this.bb.readInt32(this.bb_pos+t):128}static startDecimal(t){t.startObject(3)}static addPrecision(t,n){t.addFieldInt32(0,n,0)}static addScale(t,n){t.addFieldInt32(1,n,0)}static addBitWidth(t,n){t.addFieldInt32(2,n,128)}static endDecimal(t){return t.endObject()}static createDecimal(t,n,r,i){return e.startDecimal(t),e.addPrecision(t,n),e.addScale(t,r),e.addBitWidth(t,i),e.endDecimal(t)}};var Li;(function(e){e[e.SECOND=0]="SECOND",e[e.MILLISECOND=1]="MILLISECOND",e[e.MICROSECOND=2]="MICROSECOND",e[e.NANOSECOND=3]="NANOSECOND"})(Li||(Li={}));var ga=class e{constructor(){this.bb=null,this.bb_pos=0}__init(t,n){return this.bb_pos=t,this.bb=n,this}static getRootAsDuration(t,n){return(n||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsDuration(t,n){return t.setPosition(t.position()+4),(n||new e).__init(t.readInt32(t.position())+t.position(),t)}unit(){let t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt16(this.bb_pos+t):Li.MILLISECOND}static startDuration(t){t.startObject(1)}static addUnit(t,n){t.addFieldInt16(0,n,Li.MILLISECOND)}static endDuration(t){return t.endObject()}static createDuration(t,n){return e.startDuration(t),e.addUnit(t,n),e.endDuration(t)}};var xa=class e{constructor(){this.bb=null,this.bb_pos=0}__init(t,n){return this.bb_pos=t,this.bb=n,this}static getRootAsFixedSizeBinary(t,n){return(n||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsFixedSizeBinary(t,n){return t.setPosition(t.position()+4),(n||new e).__init(t.readInt32(t.position())+t.position(),t)}byteWidth(){let t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt32(this.bb_pos+t):0}static startFixedSizeBinary(t){t.startObject(1)}static addByteWidth(t,n){t.addFieldInt32(0,n,0)}static endFixedSizeBinary(t){return t.endObject()}static createFixedSizeBinary(t,n){return e.startFixedSizeBinary(t),e.addByteWidth(t,n),e.endFixedSizeBinary(t)}};var ba=class e{constructor(){this.bb=null,this.bb_pos=0}__init(t,n){return this.bb_pos=t,this.bb=n,this}static getRootAsFixedSizeList(t,n){return(n||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsFixedSizeList(t,n){return t.setPosition(t.position()+4),(n||new e).__init(t.readInt32(t.position())+t.position(),t)}listSize(){let t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt32(this.bb_pos+t):0}static startFixedSizeList(t){t.startObject(1)}static addListSize(t,n){t.addFieldInt32(0,n,0)}static endFixedSizeList(t){return t.endObject()}static createFixedSizeList(t,n){return e.startFixedSizeList(t),e.addListSize(t,n),e.endFixedSizeList(t)}};var Zd;(function(e){e[e.HALF=0]="HALF",e[e.SINGLE=1]="SINGLE",e[e.DOUBLE=2]="DOUBLE"})(Zd||(Zd={}));var wa=class e{constructor(){this.bb=null,this.bb_pos=0}__init(t,n){return this.bb_pos=t,this.bb=n,this}static getRootAsFloatingPoint(t,n){return(n||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsFloatingPoint(t,n){return t.setPosition(t.position()+4),(n||new e).__init(t.readInt32(t.position())+t.position(),t)}precision(){let t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt16(this.bb_pos+t):Zd.HALF}static startFloatingPoint(t){t.startObject(1)}static addPrecision(t,n){t.addFieldInt16(0,n,Zd.HALF)}static endFloatingPoint(t){return t.endObject()}static createFloatingPoint(t,n){return e.startFloatingPoint(t),e.addPrecision(t,n),e.endFloatingPoint(t)}};var Jd;(function(e){e[e.YEAR_MONTH=0]="YEAR_MONTH",e[e.DAY_TIME=1]="DAY_TIME",e[e.MONTH_DAY_NANO=2]="MONTH_DAY_NANO"})(Jd||(Jd={}));var va=class e{constructor(){this.bb=null,this.bb_pos=0}__init(t,n){return this.bb_pos=t,this.bb=n,this}static getRootAsInterval(t,n){return(n||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsInterval(t,n){return t.setPosition(t.position()+4),(n||new e).__init(t.readInt32(t.position())+t.position(),t)}unit(){let t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt16(this.bb_pos+t):Jd.YEAR_MONTH}static startInterval(t){t.startObject(1)}static addUnit(t,n){t.addFieldInt16(0,n,Jd.YEAR_MONTH)}static endInterval(t){return t.endObject()}static createInterval(t,n){return e.startInterval(t),e.addUnit(t,n),e.endInterval(t)}};var Qd=class e{constructor(){this.bb=null,this.bb_pos=0}__init(t,n){return this.bb_pos=t,this.bb=n,this}static getRootAsList(t,n){return(n||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsList(t,n){return t.setPosition(t.position()+4),(n||new e).__init(t.readInt32(t.position())+t.position(),t)}static startList(t){t.startObject(0)}static endList(t){return t.endObject()}static createList(t){return e.startList(t),e.endList(t)}};var _a=class e{constructor(){this.bb=null,this.bb_pos=0}__init(t,n){return this.bb_pos=t,this.bb=n,this}static getRootAsMap(t,n){return(n||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsMap(t,n){return t.setPosition(t.position()+4),(n||new e).__init(t.readInt32(t.position())+t.position(),t)}keysSorted(){let t=this.bb.__offset(this.bb_pos,4);return t?!!this.bb.readInt8(this.bb_pos+t):!1}static startMap(t){t.startObject(1)}static addKeysSorted(t,n){t.addFieldInt8(0,+n,0)}static endMap(t){return t.endObject()}static createMap(t,n){return e.startMap(t),e.addKeysSorted(t,n),e.endMap(t)}};var Kd=class e{constructor(){this.bb=null,this.bb_pos=0}__init(t,n){return this.bb_pos=t,this.bb=n,this}static getRootAsNull(t,n){return(n||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsNull(t,n){return t.setPosition(t.position()+4),(n||new e).__init(t.readInt32(t.position())+t.position(),t)}static startNull(t){t.startObject(0)}static endNull(t){return t.endObject()}static createNull(t){return e.startNull(t),e.endNull(t)}};var th=class e{constructor(){this.bb=null,this.bb_pos=0}__init(t,n){return this.bb_pos=t,this.bb=n,this}static getRootAsStruct_(t,n){return(n||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsStruct_(t,n){return t.setPosition(t.position()+4),(n||new e).__init(t.readInt32(t.position())+t.position(),t)}static startStruct_(t){t.startObject(0)}static endStruct_(t){return t.endObject()}static createStruct_(t){return e.startStruct_(t),e.endStruct_(t)}};var os=class e{constructor(){this.bb=null,this.bb_pos=0}__init(t,n){return this.bb_pos=t,this.bb=n,this}static getRootAsTime(t,n){return(n||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsTime(t,n){return t.setPosition(t.position()+4),(n||new e).__init(t.readInt32(t.position())+t.position(),t)}unit(){let t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt16(this.bb_pos+t):Li.MILLISECOND}bitWidth(){let t=this.bb.__offset(this.bb_pos,6);return t?this.bb.readInt32(this.bb_pos+t):32}static startTime(t){t.startObject(2)}static addUnit(t,n){t.addFieldInt16(0,n,Li.MILLISECOND)}static addBitWidth(t,n){t.addFieldInt32(1,n,32)}static endTime(t){return t.endObject()}static createTime(t,n,r){return e.startTime(t),e.addUnit(t,n),e.addBitWidth(t,r),e.endTime(t)}};var ss=class e{constructor(){this.bb=null,this.bb_pos=0}__init(t,n){return this.bb_pos=t,this.bb=n,this}static getRootAsTimestamp(t,n){return(n||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsTimestamp(t,n){return t.setPosition(t.position()+4),(n||new e).__init(t.readInt32(t.position())+t.position(),t)}unit(){let t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt16(this.bb_pos+t):Li.SECOND}timezone(t){let n=this.bb.__offset(this.bb_pos,6);return n?this.bb.__string(this.bb_pos+n,t):null}static startTimestamp(t){t.startObject(2)}static addUnit(t,n){t.addFieldInt16(0,n,Li.SECOND)}static addTimezone(t,n){t.addFieldOffset(1,n,0)}static endTimestamp(t){return t.endObject()}static createTimestamp(t,n,r){return e.startTimestamp(t),e.addUnit(t,n),e.addTimezone(t,r),e.endTimestamp(t)}};var eh;(function(e){e[e.Sparse=0]="Sparse",e[e.Dense=1]="Dense"})(eh||(eh={}));var ki=class e{constructor(){this.bb=null,this.bb_pos=0}__init(t,n){return this.bb_pos=t,this.bb=n,this}static getRootAsUnion(t,n){return(n||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsUnion(t,n){return t.setPosition(t.position()+4),(n||new e).__init(t.readInt32(t.position())+t.position(),t)}mode(){let t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt16(this.bb_pos+t):eh.Sparse}typeIds(t){let n=this.bb.__offset(this.bb_pos,6);return n?this.bb.readInt32(this.bb.__vector(this.bb_pos+n)+t*4):0}typeIdsLength(){let t=this.bb.__offset(this.bb_pos,6);return t?this.bb.__vector_len(this.bb_pos+t):0}typeIdsArray(){let t=this.bb.__offset(this.bb_pos,6);return t?new Int32Array(this.bb.bytes().buffer,this.bb.bytes().byteOffset+this.bb.__vector(this.bb_pos+t),this.bb.__vector_len(this.bb_pos+t)):null}static startUnion(t){t.startObject(2)}static addMode(t,n){t.addFieldInt16(0,n,eh.Sparse)}static addTypeIds(t,n){t.addFieldOffset(1,n,0)}static createTypeIdsVector(t,n){t.startVector(4,n.length,4);for(let r=n.length-1;r>=0;r--)t.addInt32(n[r]);return t.endVector()}static startTypeIdsVector(t,n){t.startVector(4,n,4)}static endUnion(t){return t.endObject()}static createUnion(t,n,r){return e.startUnion(t),e.addMode(t,n),e.addTypeIds(t,r),e.endUnion(t)}};var nh=class e{constructor(){this.bb=null,this.bb_pos=0}__init(t,n){return this.bb_pos=t,this.bb=n,this}static getRootAsUtf8(t,n){return(n||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsUtf8(t,n){return t.setPosition(t.position()+4),(n||new e).__init(t.readInt32(t.position())+t.position(),t)}static startUtf8(t){t.startObject(0)}static endUtf8(t){return t.endObject()}static createUtf8(t){return e.startUtf8(t),e.endUtf8(t)}};var ye;(function(e){e[e.NONE=0]="NONE",e[e.Null=1]="Null",e[e.Int=2]="Int",e[e.FloatingPoint=3]="FloatingPoint",e[e.Binary=4]="Binary",e[e.Utf8=5]="Utf8",e[e.Bool=6]="Bool",e[e.Decimal=7]="Decimal",e[e.Date=8]="Date",e[e.Time=9]="Time",e[e.Timestamp=10]="Timestamp",e[e.Interval=11]="Interval",e[e.List=12]="List",e[e.Struct_=13]="Struct_",e[e.Union=14]="Union",e[e.FixedSizeBinary=15]="FixedSizeBinary",e[e.FixedSizeList=16]="FixedSizeList",e[e.Map=17]="Map",e[e.Duration=18]="Duration",e[e.LargeBinary=19]="LargeBinary",e[e.LargeUtf8=20]="LargeUtf8",e[e.LargeList=21]="LargeList",e[e.RunEndEncoded=22]="RunEndEncoded"})(ye||(ye={}));var On=class e{constructor(){this.bb=null,this.bb_pos=0}__init(t,n){return this.bb_pos=t,this.bb=n,this}static getRootAsField(t,n){return(n||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsField(t,n){return t.setPosition(t.position()+4),(n||new e).__init(t.readInt32(t.position())+t.position(),t)}name(t){let n=this.bb.__offset(this.bb_pos,4);return n?this.bb.__string(this.bb_pos+n,t):null}nullable(){let t=this.bb.__offset(this.bb_pos,6);return t?!!this.bb.readInt8(this.bb_pos+t):!1}typeType(){let t=this.bb.__offset(this.bb_pos,8);return t?this.bb.readUint8(this.bb_pos+t):ye.NONE}type(t){let n=this.bb.__offset(this.bb_pos,10);return n?this.bb.__union(t,this.bb_pos+n):null}dictionary(t){let n=this.bb.__offset(this.bb_pos,12);return n?(t||new no).__init(this.bb.__indirect(this.bb_pos+n),this.bb):null}children(t,n){let r=this.bb.__offset(this.bb_pos,14);return r?(n||new e).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+r)+t*4),this.bb):null}childrenLength(){let t=this.bb.__offset(this.bb_pos,14);return t?this.bb.__vector_len(this.bb_pos+t):0}customMetadata(t,n){let r=this.bb.__offset(this.bb_pos,16);return r?(n||new en).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+r)+t*4),this.bb):null}customMetadataLength(){let t=this.bb.__offset(this.bb_pos,16);return t?this.bb.__vector_len(this.bb_pos+t):0}static startField(t){t.startObject(7)}static addName(t,n){t.addFieldOffset(0,n,0)}static addNullable(t,n){t.addFieldInt8(1,+n,0)}static addTypeType(t,n){t.addFieldInt8(2,n,ye.NONE)}static addType(t,n){t.addFieldOffset(3,n,0)}static addDictionary(t,n){t.addFieldOffset(4,n,0)}static addChildren(t,n){t.addFieldOffset(5,n,0)}static createChildrenVector(t,n){t.startVector(4,n.length,4);for(let r=n.length-1;r>=0;r--)t.addOffset(n[r]);return t.endVector()}static startChildrenVector(t,n){t.startVector(4,n,4)}static addCustomMetadata(t,n){t.addFieldOffset(6,n,0)}static createCustomMetadataVector(t,n){t.startVector(4,n.length,4);for(let r=n.length-1;r>=0;r--)t.addOffset(n[r]);return t.endVector()}static startCustomMetadataVector(t,n){t.startVector(4,n,4)}static endField(t){return t.endObject()}};var lr=class e{constructor(){this.bb=null,this.bb_pos=0}__init(t,n){return this.bb_pos=t,this.bb=n,this}static getRootAsSchema(t,n){return(n||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsSchema(t,n){return t.setPosition(t.position()+4),(n||new e).__init(t.readInt32(t.position())+t.position(),t)}endianness(){let t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt16(this.bb_pos+t):ma.Little}fields(t,n){let r=this.bb.__offset(this.bb_pos,6);return r?(n||new On).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+r)+t*4),this.bb):null}fieldsLength(){let t=this.bb.__offset(this.bb_pos,6);return t?this.bb.__vector_len(this.bb_pos+t):0}customMetadata(t,n){let r=this.bb.__offset(this.bb_pos,8);return r?(n||new en).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+r)+t*4),this.bb):null}customMetadataLength(){let t=this.bb.__offset(this.bb_pos,8);return t?this.bb.__vector_len(this.bb_pos+t):0}features(t){let n=this.bb.__offset(this.bb_pos,10);return n?this.bb.readInt64(this.bb.__vector(this.bb_pos+n)+t*8):BigInt(0)}featuresLength(){let t=this.bb.__offset(this.bb_pos,10);return t?this.bb.__vector_len(this.bb_pos+t):0}static startSchema(t){t.startObject(4)}static addEndianness(t,n){t.addFieldInt16(0,n,ma.Little)}static addFields(t,n){t.addFieldOffset(1,n,0)}static createFieldsVector(t,n){t.startVector(4,n.length,4);for(let r=n.length-1;r>=0;r--)t.addOffset(n[r]);return t.endVector()}static startFieldsVector(t,n){t.startVector(4,n,4)}static addCustomMetadata(t,n){t.addFieldOffset(2,n,0)}static createCustomMetadataVector(t,n){t.startVector(4,n.length,4);for(let r=n.length-1;r>=0;r--)t.addOffset(n[r]);return t.endVector()}static startCustomMetadataVector(t,n){t.startVector(4,n,4)}static addFeatures(t,n){t.addFieldOffset(3,n,0)}static createFeaturesVector(t,n){t.startVector(8,n.length,8);for(let r=n.length-1;r>=0;r--)t.addInt64(n[r]);return t.endVector()}static startFeaturesVector(t,n){t.startVector(8,n,8)}static endSchema(t){return t.endObject()}static finishSchemaBuffer(t,n){t.finish(n)}static finishSizePrefixedSchemaBuffer(t,n){t.finish(n,void 0,!0)}static createSchema(t,n,r,i,o){return e.startSchema(t),e.addEndianness(t,n),e.addFields(t,r),e.addCustomMetadata(t,i),e.addFeatures(t,o),e.endSchema(t)}};var Er=class e{constructor(){this.bb=null,this.bb_pos=0}__init(t,n){return this.bb_pos=t,this.bb=n,this}static getRootAsFooter(t,n){return(n||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsFooter(t,n){return t.setPosition(t.position()+4),(n||new e).__init(t.readInt32(t.position())+t.position(),t)}version(){let t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt16(this.bb_pos+t):pa.V1}schema(t){let n=this.bb.__offset(this.bb_pos,6);return n?(t||new lr).__init(this.bb.__indirect(this.bb_pos+n),this.bb):null}dictionaries(t,n){let r=this.bb.__offset(this.bb_pos,8);return r?(n||new Mc).__init(this.bb.__vector(this.bb_pos+r)+t*24,this.bb):null}dictionariesLength(){let t=this.bb.__offset(this.bb_pos,8);return t?this.bb.__vector_len(this.bb_pos+t):0}recordBatches(t,n){let r=this.bb.__offset(this.bb_pos,10);return r?(n||new Mc).__init(this.bb.__vector(this.bb_pos+r)+t*24,this.bb):null}recordBatchesLength(){let t=this.bb.__offset(this.bb_pos,10);return t?this.bb.__vector_len(this.bb_pos+t):0}customMetadata(t,n){let r=this.bb.__offset(this.bb_pos,12);return r?(n||new en).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+r)+t*4),this.bb):null}customMetadataLength(){let t=this.bb.__offset(this.bb_pos,12);return t?this.bb.__vector_len(this.bb_pos+t):0}static startFooter(t){t.startObject(5)}static addVersion(t,n){t.addFieldInt16(0,n,pa.V1)}static addSchema(t,n){t.addFieldOffset(1,n,0)}static addDictionaries(t,n){t.addFieldOffset(2,n,0)}static startDictionariesVector(t,n){t.startVector(24,n,8)}static addRecordBatches(t,n){t.addFieldOffset(3,n,0)}static startRecordBatchesVector(t,n){t.startVector(24,n,8)}static addCustomMetadata(t,n){t.addFieldOffset(4,n,0)}static createCustomMetadataVector(t,n){t.startVector(4,n.length,4);for(let r=n.length-1;r>=0;r--)t.addOffset(n[r]);return t.endVector()}static startCustomMetadataVector(t,n){t.startVector(4,n,4)}static endFooter(t){return t.endObject()}static finishFooterBuffer(t,n){t.finish(n)}static finishSizePrefixedFooterBuffer(t,n){t.finish(n,void 0,!0)}};var re=class e{constructor(t=[],n,r,i=Ee.V5){this.fields=t||[],this.metadata=n||new Map,r||(r=e2(t)),this.dictionaries=r,this.metadataVersion=i}get[Symbol.toStringTag](){return"Schema"}get names(){return this.fields.map(t=>t.name)}toString(){return`Schema<{ ${this.fields.map((t,n)=>`${n}: ${t}`).join(", ")} }>`}select(t){let n=new Set(t),r=this.fields.filter(i=>n.has(i.name));return new e(r,this.metadata)}selectAt(t){let n=t.map(r=>this.fields[r]).filter(Boolean);return new e(n,this.metadata)}assign(...t){let n=t[0]instanceof e?t[0]:Array.isArray(t[0])?new e(t[0]):new e(t),r=[...this.fields],i=Jg(Jg(new Map,this.metadata),n.metadata),o=n.fields.filter(a=>{let c=r.findIndex(l=>l.name===a.name);return~c?(r[c]=a.clone({metadata:Jg(Jg(new Map,r[c].metadata),a.metadata)}))&&!1:!0}),s=e2(o,new Map);return new e([...r,...o],i,new Map([...this.dictionaries,...s]))}};re.prototype.fields=null;re.prototype.metadata=null;re.prototype.dictionaries=null;var Ut=class e{static new(...t){let[n,r,i,o]=t;return t[0]&&typeof t[0]=="object"&&({name:n}=t[0],r===void 0&&(r=t[0].type),i===void 0&&(i=t[0].nullable),o===void 0&&(o=t[0].metadata)),new e(`${n}`,r,i,o)}constructor(t,n,r=!1,i){this.name=t,this.type=n,this.nullable=r,this.metadata=i||new Map}get typeId(){return this.type.typeId}get[Symbol.toStringTag](){return"Field"}toString(){return`${this.name}: ${this.type}`}clone(...t){let[n,r,i,o]=t;return!t[0]||typeof t[0]!="object"?[n=this.name,r=this.type,i=this.nullable,o=this.metadata]=t:{name:n=this.name,type:r=this.type,nullable:i=this.nullable,metadata:o=this.metadata}=t[0],e.new(n,r,i,o)}};Ut.prototype.type=null;Ut.prototype.name=null;Ut.prototype.nullable=null;Ut.prototype.metadata=null;function Jg(e,t){return new Map([...e||new Map,...t||new Map])}function e2(e,t=new Map){for(let n=-1,r=e.length;++n<r;){let o=e[n].type;if(at.isDictionary(o)){if(!t.has(o.id))t.set(o.id,o.dictionary);else if(t.get(o.id)!==o.dictionary)throw new Error("Cannot create Schema containing two different dictionaries with the same Id")}o.children&&o.children.length>0&&e2(o.children,t)}return t}var vj=Tc,_j=Ar,as=class{static decode(t){t=new _j(Ot(t));let n=Er.getRootAsFooter(t),r=re.decode(n.schema(),new Map,n.version());return new n2(r,n)}static encode(t){let n=new vj,r=re.encode(n,t.schema);Er.startRecordBatchesVector(n,t.numRecordBatches);for(let s of[...t.recordBatches()].slice().reverse())cs.encode(n,s);let i=n.endVector();Er.startDictionariesVector(n,t.numDictionaries);for(let s of[...t.dictionaryBatches()].slice().reverse())cs.encode(n,s);let o=n.endVector();return Er.startFooter(n),Er.addSchema(n,r),Er.addVersion(n,Ee.V5),Er.addRecordBatches(n,i),Er.addDictionaries(n,o),Er.finishFooterBuffer(n,Er.endFooter(n)),n.asUint8Array()}get numRecordBatches(){return this._recordBatches.length}get numDictionaries(){return this._dictionaryBatches.length}constructor(t,n=Ee.V5,r,i){this.schema=t,this.version=n,r&&(this._recordBatches=r),i&&(this._dictionaryBatches=i)}*recordBatches(){for(let t,n=-1,r=this.numRecordBatches;++n<r;)(t=this.getRecordBatch(n))&&(yield t)}*dictionaryBatches(){for(let t,n=-1,r=this.numDictionaries;++n<r;)(t=this.getDictionaryBatch(n))&&(yield t)}getRecordBatch(t){return t>=0&&t<this.numRecordBatches&&this._recordBatches[t]||null}getDictionaryBatch(t){return t>=0&&t<this.numDictionaries&&this._dictionaryBatches[t]||null}};var n2=class extends as{get numRecordBatches(){return this._footer.recordBatchesLength()}get numDictionaries(){return this._footer.dictionariesLength()}constructor(t,n){super(t,n.version()),this._footer=n}getRecordBatch(t){if(t>=0&&t<this.numRecordBatches){let n=this._footer.recordBatches(t);if(n)return cs.decode(n)}return null}getDictionaryBatch(t){if(t>=0&&t<this.numDictionaries){let n=this._footer.dictionaries(t);if(n)return cs.decode(n)}return null}},cs=class e{static decode(t){return new e(t.metaDataLength(),t.bodyLength(),t.offset())}static encode(t,n){let{metaDataLength:r}=n,i=BigInt(n.offset),o=BigInt(n.bodyLength);return Mc.createBlock(t,i,r,o)}constructor(t,n,r){this.metaDataLength=t,this.offset=ar(r),this.bodyLength=ar(n)}};var ge=Object.freeze({done:!0,value:void 0}),rh=class{constructor(t){this._json=t}get schema(){return this._json.schema}get batches(){return this._json.batches||[]}get dictionaries(){return this._json.dictionaries||[]}},Ac=class{tee(){return this._getDOMStream().tee()}pipe(t,n){return this._getNodeStream().pipe(t,n)}pipeTo(t,n){return this._getDOMStream().pipeTo(t,n)}pipeThrough(t,n){return this._getDOMStream().pipeThrough(t,n)}_getDOMStream(){return this._DOMStream||(this._DOMStream=this.toDOMStream())}_getNodeStream(){return this._nodeStream||(this._nodeStream=this.toNodeStream())}},Qg=class extends Ac{constructor(){super(),this._values=[],this.resolvers=[],this._closedPromise=new Promise(t=>this._closedPromiseResolve=t)}get closed(){return this._closedPromise}cancel(t){return Z(this,void 0,void 0,function*(){yield this.return(t)})}write(t){this._ensureOpen()&&(this.resolvers.length<=0?this._values.push(t):this.resolvers.shift().resolve({done:!1,value:t}))}abort(t){this._closedPromiseResolve&&(this.resolvers.length<=0?this._error={error:t}:this.resolvers.shift().reject({done:!0,value:t}))}close(){if(this._closedPromiseResolve){let{resolvers:t}=this;for(;t.length>0;)t.shift().resolve(ge);this._closedPromiseResolve(),this._closedPromiseResolve=void 0}}[Symbol.asyncIterator](){return this}toDOMStream(t){return gn.toDOMStream(this._closedPromiseResolve||this._error?this:this._values,t)}toNodeStream(t){return gn.toNodeStream(this._closedPromiseResolve||this._error?this:this._values,t)}throw(t){return Z(this,void 0,void 0,function*(){return yield this.abort(t),ge})}return(t){return Z(this,void 0,void 0,function*(){return yield this.close(),ge})}read(t){return Z(this,void 0,void 0,function*(){return(yield this.next(t,"read")).value})}peek(t){return Z(this,void 0,void 0,function*(){return(yield this.next(t,"peek")).value})}next(...t){return this._values.length>0?Promise.resolve({done:!1,value:this._values.shift()}):this._error?Promise.reject({done:!0,value:this._error.error}):this._closedPromiseResolve?new Promise((n,r)=>{this.resolvers.push({resolve:n,reject:r})}):Promise.resolve(ge)}_ensureOpen(){if(this._closedPromiseResolve)return!0;throw new Error("AsyncQueue is closed")}};var io=class extends Qg{write(t){if((t=Ot(t)).byteLength>0)return super.write(t)}toString(t=!1){return t?Fd(this.toUint8Array(!0)):this.toUint8Array(!1).then(Fd)}toUint8Array(t=!1){return t?Sr(this._values)[0]:Z(this,void 0,void 0,function*(){var n,r,i,o;let s=[],a=0;try{for(var c=!0,l=bi(this),u;u=yield l.next(),n=u.done,!n;c=!0){o=u.value,c=!1;let f=o;s.push(f),a+=f.byteLength}}catch(f){r={error:f}}finally{try{!c&&!n&&(i=l.return)&&(yield i.call(l))}finally{if(r)throw r.error}}return Sr(s,a)[0]})}},oo=class{constructor(t){t&&(this.source=new r2(gn.fromIterable(t)))}[Symbol.iterator](){return this}next(t){return this.source.next(t)}throw(t){return this.source.throw(t)}return(t){return this.source.return(t)}peek(t){return this.source.peek(t)}read(t){return this.source.read(t)}},Hr=class e{constructor(t){t instanceof e?this.source=t.source:t instanceof io?this.source=new ls(gn.fromAsyncIterable(t)):lg(t)?this.source=new ls(gn.fromNodeStream(t)):Rd(t)?this.source=new ls(gn.fromDOMStream(t)):ag(t)?this.source=new ls(gn.fromDOMStream(t.body)):wi(t)?this.source=new ls(gn.fromIterable(t)):_r(t)?this.source=new ls(gn.fromAsyncIterable(t)):Xr(t)&&(this.source=new ls(gn.fromAsyncIterable(t)))}[Symbol.asyncIterator](){return this}next(t){return this.source.next(t)}throw(t){return this.source.throw(t)}return(t){return this.source.return(t)}get closed(){return this.source.closed}cancel(t){return this.source.cancel(t)}peek(t){return this.source.peek(t)}read(t){return this.source.read(t)}},r2=class{constructor(t){this.source=t}cancel(t){this.return(t)}peek(t){return this.next(t,"peek").value}read(t){return this.next(t,"read").value}next(t,n="read"){return this.source.next({cmd:n,size:t})}throw(t){return Object.create(this.source.throw&&this.source.throw(t)||ge)}return(t){return Object.create(this.source.return&&this.source.return(t)||ge)}},ls=class{constructor(t){this.source=t,this._closedPromise=new Promise(n=>this._closedPromiseResolve=n)}cancel(t){return Z(this,void 0,void 0,function*(){yield this.return(t)})}get closed(){return this._closedPromise}read(t){return Z(this,void 0,void 0,function*(){return(yield this.next(t,"read")).value})}peek(t){return Z(this,void 0,void 0,function*(){return(yield this.next(t,"peek")).value})}next(t,n="read"){return Z(this,void 0,void 0,function*(){return yield this.source.next({cmd:n,size:t})})}throw(t){return Z(this,void 0,void 0,function*(){let n=this.source.throw&&(yield this.source.throw(t))||ge;return this._closedPromiseResolve&&this._closedPromiseResolve(),this._closedPromiseResolve=void 0,Object.create(n)})}return(t){return Z(this,void 0,void 0,function*(){let n=this.source.return&&(yield this.source.return(t))||ge;return this._closedPromiseResolve&&this._closedPromiseResolve(),this._closedPromiseResolve=void 0,Object.create(n)})}};var ih=class extends oo{constructor(t,n){super(),this.position=0,this.buffer=Ot(t),this.size=n===void 0?this.buffer.byteLength:n}readInt32(t){let{buffer:n,byteOffset:r}=this.readAt(t,4);return new DataView(n,r).getInt32(0,!0)}seek(t){return this.position=Math.min(t,this.size),t<this.size}read(t){let{buffer:n,size:r,position:i}=this;return n&&i<r?(typeof t!="number"&&(t=Number.POSITIVE_INFINITY),this.position=Math.min(r,i+Math.min(r-i,t)),n.subarray(i,this.position)):null}readAt(t,n){let r=this.buffer,i=Math.min(this.size,t+n);return r?r.subarray(t,i):new Uint8Array(n)}close(){this.buffer&&(this.buffer=null)}throw(t){return this.close(),{done:!0,value:t}}return(t){return this.close(),{done:!0,value:t}}},Sa=class extends Hr{constructor(t,n){super(),this.position=0,this._handle=t,typeof n=="number"?this.size=n:this._pending=Z(this,void 0,void 0,function*(){this.size=(yield t.stat()).size,delete this._pending})}readInt32(t){return Z(this,void 0,void 0,function*(){let{buffer:n,byteOffset:r}=yield this.readAt(t,4);return new DataView(n,r).getInt32(0,!0)})}seek(t){return Z(this,void 0,void 0,function*(){return this._pending&&(yield this._pending),this.position=Math.min(t,this.size),t<this.size})}read(t){return Z(this,void 0,void 0,function*(){this._pending&&(yield this._pending);let{_handle:n,size:r,position:i}=this;if(n&&i<r){typeof t!="number"&&(t=Number.POSITIVE_INFINITY);let o=i,s=0,a=0,c=Math.min(r,o+Math.min(r-o,t)),l=new Uint8Array(Math.max(0,(this.position=c)-o));for(;(o+=a)<c&&(s+=a)<l.byteLength;)({bytesRead:a}=yield n.read(l,s,l.byteLength-s,o));return l}return null})}readAt(t,n){return Z(this,void 0,void 0,function*(){this._pending&&(yield this._pending);let{_handle:r,size:i}=this;if(r&&t+n<i){let o=Math.min(i,t+n),s=new Uint8Array(o-t);return(yield r.read(s,0,n,t)).buffer}return new Uint8Array(n)})}close(){return Z(this,void 0,void 0,function*(){let t=this._handle;this._handle=null,t&&(yield t.close())})}throw(t){return Z(this,void 0,void 0,function*(){return yield this.close(),{done:!0,value:t}})}return(t){return Z(this,void 0,void 0,function*(){return yield this.close(),{done:!0,value:t}})}};var o2={};wr(o2,{BaseInt64:()=>oh,Int128:()=>sh,Int64:()=>us,Uint64:()=>Ne});function lu(e){return e<0&&(e=4294967295+e+1),`0x${e.toString(16)}`}var uu=8,i2=[1,10,100,1e3,1e4,1e5,1e6,1e7,1e8],oh=class{constructor(t){this.buffer=t}high(){return this.buffer[1]}low(){return this.buffer[0]}_times(t){let n=new Uint32Array([this.buffer[1]>>>16,this.buffer[1]&65535,this.buffer[0]>>>16,this.buffer[0]&65535]),r=new Uint32Array([t.buffer[1]>>>16,t.buffer[1]&65535,t.buffer[0]>>>16,t.buffer[0]&65535]),i=n[3]*r[3];this.buffer[0]=i&65535;let o=i>>>16;return i=n[2]*r[3],o+=i,i=n[3]*r[2]>>>0,o+=i,this.buffer[0]+=o<<16,this.buffer[1]=o>>>0<i?65536:0,this.buffer[1]+=o>>>16,this.buffer[1]+=n[1]*r[3]+n[2]*r[2]+n[3]*r[1],this.buffer[1]+=n[0]*r[3]+n[1]*r[2]+n[2]*r[1]+n[3]*r[0]<<16,this}_plus(t){let n=this.buffer[0]+t.buffer[0]>>>0;this.buffer[1]+=t.buffer[1],n<this.buffer[0]>>>0&&++this.buffer[1],this.buffer[0]=n}lessThan(t){return this.buffer[1]<t.buffer[1]||this.buffer[1]===t.buffer[1]&&this.buffer[0]<t.buffer[0]}equals(t){return this.buffer[1]===t.buffer[1]&&this.buffer[0]==t.buffer[0]}greaterThan(t){return t.lessThan(this)}hex(){return`${lu(this.buffer[1])} ${lu(this.buffer[0])}`}},Ne=class e extends oh{times(t){return this._times(t),this}plus(t){return this._plus(t),this}static from(t,n=new Uint32Array(2)){return e.fromString(typeof t=="string"?t:t.toString(),n)}static fromNumber(t,n=new Uint32Array(2)){return e.fromString(t.toString(),n)}static fromString(t,n=new Uint32Array(2)){let r=t.length,i=new e(n);for(let o=0;o<r;){let s=uu<r-o?uu:r-o,a=new e(new Uint32Array([Number.parseInt(t.slice(o,o+s),10),0])),c=new e(new Uint32Array([i2[s],0]));i.times(c),i.plus(a),o+=s}return i}static convertArray(t){let n=new Uint32Array(t.length*2);for(let r=-1,i=t.length;++r<i;)e.from(t[r],new Uint32Array(n.buffer,n.byteOffset+2*r*4,2));return n}static multiply(t,n){return new e(new Uint32Array(t.buffer)).times(n)}static add(t,n){return new e(new Uint32Array(t.buffer)).plus(n)}},us=class e extends oh{negate(){return this.buffer[0]=~this.buffer[0]+1,this.buffer[1]=~this.buffer[1],this.buffer[0]==0&&++this.buffer[1],this}times(t){return this._times(t),this}plus(t){return this._plus(t),this}lessThan(t){let n=this.buffer[1]<<0,r=t.buffer[1]<<0;return n<r||n===r&&this.buffer[0]<t.buffer[0]}static from(t,n=new Uint32Array(2)){return e.fromString(typeof t=="string"?t:t.toString(),n)}static fromNumber(t,n=new Uint32Array(2)){return e.fromString(t.toString(),n)}static fromString(t,n=new Uint32Array(2)){let r=t.startsWith("-"),i=t.length,o=new e(n);for(let s=r?1:0;s<i;){let a=uu<i-s?uu:i-s,c=new e(new Uint32Array([Number.parseInt(t.slice(s,s+a),10),0])),l=new e(new Uint32Array([i2[a],0]));o.times(l),o.plus(c),s+=a}return r?o.negate():o}static convertArray(t){let n=new Uint32Array(t.length*2);for(let r=-1,i=t.length;++r<i;)e.from(t[r],new Uint32Array(n.buffer,n.byteOffset+2*r*4,2));return n}static multiply(t,n){return new e(new Uint32Array(t.buffer)).times(n)}static add(t,n){return new e(new Uint32Array(t.buffer)).plus(n)}},sh=class e{constructor(t){this.buffer=t}high(){return new us(new Uint32Array(this.buffer.buffer,this.buffer.byteOffset+8,2))}low(){return new us(new Uint32Array(this.buffer.buffer,this.buffer.byteOffset,2))}negate(){return this.buffer[0]=~this.buffer[0]+1,this.buffer[1]=~this.buffer[1],this.buffer[2]=~this.buffer[2],this.buffer[3]=~this.buffer[3],this.buffer[0]==0&&++this.buffer[1],this.buffer[1]==0&&++this.buffer[2],this.buffer[2]==0&&++this.buffer[3],this}times(t){let n=new Ne(new Uint32Array([this.buffer[3],0])),r=new Ne(new Uint32Array([this.buffer[2],0])),i=new Ne(new Uint32Array([this.buffer[1],0])),o=new Ne(new Uint32Array([this.buffer[0],0])),s=new Ne(new Uint32Array([t.buffer[3],0])),a=new Ne(new Uint32Array([t.buffer[2],0])),c=new Ne(new Uint32Array([t.buffer[1],0])),l=new Ne(new Uint32Array([t.buffer[0],0])),u=Ne.multiply(o,l);this.buffer[0]=u.low();let f=new Ne(new Uint32Array([u.high(),0]));return u=Ne.multiply(i,l),f.plus(u),u=Ne.multiply(o,c),f.plus(u),this.buffer[1]=f.low(),this.buffer[3]=f.lessThan(u)?1:0,this.buffer[2]=f.high(),new Ne(new Uint32Array(this.buffer.buffer,this.buffer.byteOffset+8,2)).plus(Ne.multiply(r,l)).plus(Ne.multiply(i,c)).plus(Ne.multiply(o,a)),this.buffer[3]+=Ne.multiply(n,l).plus(Ne.multiply(r,c)).plus(Ne.multiply(i,a)).plus(Ne.multiply(o,s)).low(),this}plus(t){let n=new Uint32Array(4);return n[3]=this.buffer[3]+t.buffer[3]>>>0,n[2]=this.buffer[2]+t.buffer[2]>>>0,n[1]=this.buffer[1]+t.buffer[1]>>>0,n[0]=this.buffer[0]+t.buffer[0]>>>0,n[0]<this.buffer[0]>>>0&&++n[1],n[1]<this.buffer[1]>>>0&&++n[2],n[2]<this.buffer[2]>>>0&&++n[3],this.buffer[3]=n[3],this.buffer[2]=n[2],this.buffer[1]=n[1],this.buffer[0]=n[0],this}hex(){return`${lu(this.buffer[3])} ${lu(this.buffer[2])} ${lu(this.buffer[1])} ${lu(this.buffer[0])}`}static multiply(t,n){return new e(new Uint32Array(t.buffer)).times(n)}static add(t,n){return new e(new Uint32Array(t.buffer)).plus(n)}static from(t,n=new Uint32Array(4)){return e.fromString(typeof t=="string"?t:t.toString(),n)}static fromNumber(t,n=new Uint32Array(4)){return e.fromString(t.toString(),n)}static fromString(t,n=new Uint32Array(4)){let r=t.startsWith("-"),i=t.length,o=new e(n);for(let s=r?1:0;s<i;){let a=uu<i-s?uu:i-s,c=new e(new Uint32Array([Number.parseInt(t.slice(s,s+a),10),0,0,0])),l=new e(new Uint32Array([i2[a],0,0,0]));o.times(l),o.plus(c),s+=a}return r?o.negate():o}static convertArray(t){let n=new Uint32Array(t.length*4);for(let r=-1,i=t.length;++r<i;)e.from(t[r],new Uint32Array(n.buffer,n.byteOffset+4*4*r,4));return n}};var ah=class extends ut{constructor(t,n,r,i,o=Ee.V5){super(),this.nodesIndex=-1,this.buffersIndex=-1,this.bytes=t,this.nodes=n,this.buffers=r,this.dictionaries=i,this.metadataVersion=o}visit(t){return super.visit(t instanceof Ut?t.type:t)}visitNull(t,{length:n}=this.nextFieldNode()){return Bt({type:t,length:n})}visitBool(t,{length:n,nullCount:r}=this.nextFieldNode()){return Bt({type:t,length:n,nullCount:r,nullBitmap:this.readNullBitmap(t,r),data:this.readData(t)})}visitInt(t,{length:n,nullCount:r}=this.nextFieldNode()){return Bt({type:t,length:n,nullCount:r,nullBitmap:this.readNullBitmap(t,r),data:this.readData(t)})}visitFloat(t,{length:n,nullCount:r}=this.nextFieldNode()){return Bt({type:t,length:n,nullCount:r,nullBitmap:this.readNullBitmap(t,r),data:this.readData(t)})}visitUtf8(t,{length:n,nullCount:r}=this.nextFieldNode()){return Bt({type:t,length:n,nullCount:r,nullBitmap:this.readNullBitmap(t,r),valueOffsets:this.readOffsets(t),data:this.readData(t)})}visitBinary(t,{length:n,nullCount:r}=this.nextFieldNode()){return Bt({type:t,length:n,nullCount:r,nullBitmap:this.readNullBitmap(t,r),valueOffsets:this.readOffsets(t),data:this.readData(t)})}visitFixedSizeBinary(t,{length:n,nullCount:r}=this.nextFieldNode()){return Bt({type:t,length:n,nullCount:r,nullBitmap:this.readNullBitmap(t,r),data:this.readData(t)})}visitDate(t,{length:n,nullCount:r}=this.nextFieldNode()){return Bt({type:t,length:n,nullCount:r,nullBitmap:this.readNullBitmap(t,r),data:this.readData(t)})}visitTimestamp(t,{length:n,nullCount:r}=this.nextFieldNode()){return Bt({type:t,length:n,nullCount:r,nullBitmap:this.readNullBitmap(t,r),data:this.readData(t)})}visitTime(t,{length:n,nullCount:r}=this.nextFieldNode()){return Bt({type:t,length:n,nullCount:r,nullBitmap:this.readNullBitmap(t,r),data:this.readData(t)})}visitDecimal(t,{length:n,nullCount:r}=this.nextFieldNode()){return Bt({type:t,length:n,nullCount:r,nullBitmap:this.readNullBitmap(t,r),data:this.readData(t)})}visitList(t,{length:n,nullCount:r}=this.nextFieldNode()){return Bt({type:t,length:n,nullCount:r,nullBitmap:this.readNullBitmap(t,r),valueOffsets:this.readOffsets(t),child:this.visit(t.children[0])})}visitStruct(t,{length:n,nullCount:r}=this.nextFieldNode()){return Bt({type:t,length:n,nullCount:r,nullBitmap:this.readNullBitmap(t,r),children:this.visitMany(t.children)})}visitUnion(t,{length:n,nullCount:r}=this.nextFieldNode()){return this.metadataVersion<Ee.V5&&this.readNullBitmap(t,r),t.mode===xe.Sparse?this.visitSparseUnion(t,{length:n,nullCount:r}):this.visitDenseUnion(t,{length:n,nullCount:r})}visitDenseUnion(t,{length:n,nullCount:r}=this.nextFieldNode()){return Bt({type:t,length:n,nullCount:r,typeIds:this.readTypeIds(t),valueOffsets:this.readOffsets(t),children:this.visitMany(t.children)})}visitSparseUnion(t,{length:n,nullCount:r}=this.nextFieldNode()){return Bt({type:t,length:n,nullCount:r,typeIds:this.readTypeIds(t),children:this.visitMany(t.children)})}visitDictionary(t,{length:n,nullCount:r}=this.nextFieldNode()){return Bt({type:t,length:n,nullCount:r,nullBitmap:this.readNullBitmap(t,r),data:this.readData(t.indices),dictionary:this.readDictionary(t)})}visitInterval(t,{length:n,nullCount:r}=this.nextFieldNode()){return Bt({type:t,length:n,nullCount:r,nullBitmap:this.readNullBitmap(t,r),data:this.readData(t)})}visitDuration(t,{length:n,nullCount:r}=this.nextFieldNode()){return Bt({type:t,length:n,nullCount:r,nullBitmap:this.readNullBitmap(t,r),data:this.readData(t)})}visitFixedSizeList(t,{length:n,nullCount:r}=this.nextFieldNode()){return Bt({type:t,length:n,nullCount:r,nullBitmap:this.readNullBitmap(t,r),child:this.visit(t.children[0])})}visitMap(t,{length:n,nullCount:r}=this.nextFieldNode()){return Bt({type:t,length:n,nullCount:r,nullBitmap:this.readNullBitmap(t,r),valueOffsets:this.readOffsets(t),child:this.visit(t.children[0])})}nextFieldNode(){return this.nodes[++this.nodesIndex]}nextBufferRange(){return this.buffers[++this.buffersIndex]}readNullBitmap(t,n,r=this.nextBufferRange()){return n>0&&this.readData(t,r)||new Uint8Array(0)}readOffsets(t,n){return this.readData(t,n)}readTypeIds(t,n){return this.readData(t,n)}readData(t,{length:n,offset:r}=this.nextBufferRange()){return this.bytes.subarray(r,r+n)}readDictionary(t){return this.dictionaries.get(t.id)}},Kg=class extends ah{constructor(t,n,r,i,o){super(new Uint8Array(0),n,r,i,o),this.sources=t}readNullBitmap(t,n,{offset:r}=this.nextBufferRange()){return n<=0?new Uint8Array(0):Sc(this.sources[r])}readOffsets(t,{offset:n}=this.nextBufferRange()){return Pt(Uint8Array,Pt(Int32Array,this.sources[n]))}readTypeIds(t,{offset:n}=this.nextBufferRange()){return Pt(Uint8Array,Pt(t.ArrayType,this.sources[n]))}readData(t,{offset:n}=this.nextBufferRange()){let{sources:r}=this;return at.isTimestamp(t)?Pt(Uint8Array,us.convertArray(r[n])):(at.isInt(t)||at.isTime(t))&&t.bitWidth===64||at.isDuration(t)?Pt(Uint8Array,us.convertArray(r[n])):at.isDate(t)&&t.unit===Dn.MILLISECOND?Pt(Uint8Array,us.convertArray(r[n])):at.isDecimal(t)?Pt(Uint8Array,sh.convertArray(r[n])):at.isBinary(t)||at.isFixedSizeBinary(t)?Sj(r[n]):at.isBool(t)?Sc(r[n]):at.isUtf8(t)?ca(r[n].join("")):Pt(Uint8Array,Pt(t.ArrayType,r[n].map(i=>+i)))}};function Sj(e){let t=e.join(""),n=new Uint8Array(t.length/2);for(let r=0;r<t.length;r+=2)n[r>>1]=Number.parseInt(t.slice(r,r+2),16);return n}var fu=class extends to{constructor(t){super(t),this._values=new ha(new Uint8Array(0))}get byteLength(){let t=this._pendingLength+this.length*4;return this._offsets&&(t+=this._offsets.byteLength),this._values&&(t+=this._values.byteLength),this._nulls&&(t+=this._nulls.byteLength),t}setValue(t,n){return super.setValue(t,Ot(n))}_flushPending(t,n){let r=this._offsets,i=this._values.reserve(n).buffer,o=0;for(let[s,a]of t)if(a===void 0)r.set(s,0);else{let c=a.length;i.set(a,o),r.set(s,c),o+=c}}};var t0=class extends be{constructor(t){super(t),this._values=new su}setValue(t,n){this._values.set(t,+n)}};var Ec=class extends Ve{};Ec.prototype._setValue=$_;var ch=class extends Ec{};ch.prototype._setValue=Sg;var lh=class extends Ec{};lh.prototype._setValue=Ig;var uh=class extends Ve{};uh.prototype._setValue=z_;var e0=class extends be{constructor({type:t,nullValues:n,dictionaryHashFunction:r}){super({type:new Ir(t.dictionary,t.indices,t.id,t.isOrdered)}),this._nulls=null,this._dictionaryOffset=0,this._keysToIndices=Object.create(null),this.indices=Nc({type:this.type.indices,nullValues:n}),this.dictionary=Nc({type:this.type.dictionary,nullValues:null}),typeof r=="function"&&(this.valueToKey=r)}get values(){return this.indices.values}get nullCount(){return this.indices.nullCount}get nullBitmap(){return this.indices.nullBitmap}get byteLength(){return this.indices.byteLength+this.dictionary.byteLength}get reservedLength(){return this.indices.reservedLength+this.dictionary.reservedLength}get reservedByteLength(){return this.indices.reservedByteLength+this.dictionary.reservedByteLength}isValid(t){return this.indices.isValid(t)}setValid(t,n){let r=this.indices;return n=r.setValid(t,n),this.length=r.length,n}setValue(t,n){let r=this._keysToIndices,i=this.valueToKey(n),o=r[i];return o===void 0&&(r[i]=o=this._dictionaryOffset+this.dictionary.append(n).length-1),this.indices.setValue(t,o)}flush(){let t=this.type,n=this._dictionary,r=this.dictionary.toVector(),i=this.indices.flush().clone(t);return i.dictionary=n?n.concat(r):r,this.finished||(this._dictionaryOffset+=r.length),this._dictionary=i.dictionary,this.clear(),i}finish(){return this.indices.finish(),this.dictionary.finish(),this._dictionaryOffset=0,this._keysToIndices=Object.create(null),super.finish()}clear(){return this.indices.clear(),this.dictionary.clear(),super.clear()}valueToKey(t){return typeof t=="string"?t:`${t}`}};var fh=class extends Ve{};fh.prototype._setValue=R_;var n0=class extends be{setValue(t,n){let[r]=this.children,i=t*this.stride;for(let o=-1,s=n.length;++o<s;)r.set(i+o,n[o])}addChild(t,n="0"){if(this.numChildren>0)throw new Error("FixedSizeListBuilder can only have one child.");let r=this.children.push(t);return this.type=new Ei(this.type.listSize,new Ut(n,t.type,!0)),r}};var Dc=class extends Ve{setValue(t,n){this._values.set(t,n)}},r0=class extends Dc{setValue(t,n){super.setValue(t,Ud(n))}},i0=class extends Dc{},o0=class extends Dc{};var Oc=class extends Ve{};Oc.prototype._setValue=j_;var dh=class extends Oc{};dh.prototype._setValue=Lg;var hh=class extends Oc{};hh.prototype._setValue=kg;var fs=class extends Ve{};fs.prototype._setValue=q_;var ph=class extends fs{};ph.prototype._setValue=Cg;var mh=class extends fs{};mh.prototype._setValue=Fg;var yh=class extends fs{};yh.prototype._setValue=Rg;var gh=class extends fs{};gh.prototype._setValue=$g;var Zr=class extends Ve{setValue(t,n){this._values.set(t,n)}},s0=class extends Zr{},a0=class extends Zr{},c0=class extends Zr{},l0=class extends Zr{},u0=class extends Zr{},f0=class extends Zr{},d0=class extends Zr{},h0=class extends Zr{};var p0=class extends to{constructor(t){super(t),this._offsets=new au}addChild(t,n="0"){if(this.numChildren>0)throw new Error("ListBuilder can only have one child.");return this.children[this.numChildren]=t,this.type=new Ti(new Ut(n,t.type,!0)),this.numChildren-1}_flushPending(t){let n=this._offsets,[r]=this.children;for(let[i,o]of t)if(typeof o>"u")n.set(i,0);else{let s=o,a=s.length,c=n.set(i,a).buffer[i];for(let l=-1;++l<a;)r.set(c+l,s[l])}}};var m0=class extends to{set(t,n){return super.set(t,n)}setValue(t,n){let r=n instanceof Map?n:new Map(Object.entries(n)),i=this._pending||(this._pending=new Map),o=i.get(t);o&&(this._pendingLength-=o.size),this._pendingLength+=r.size,i.set(t,r)}addChild(t,n=`${this.numChildren}`){if(this.numChildren>0)throw new Error("ListBuilder can only have one child.");return this.children[this.numChildren]=t,this.type=new Ni(new Ut(n,t.type,!0),this.type.keysSorted),this.numChildren-1}_flushPending(t){let n=this._offsets,[r]=this.children;for(let[i,o]of t)if(o===void 0)n.set(i,0);else{let{[i]:s,[i+1]:a}=n.set(i,o.size).buffer;for(let c of o.entries())if(r.set(s,c),++s>=a)break}}};var y0=class extends be{setValue(t,n){}setValid(t,n){return this.length=Math.max(t+1,this.length),n}};var g0=class extends be{setValue(t,n){let{children:r,type:i}=this;switch(Array.isArray(n)||n.constructor){case!0:return i.children.forEach((o,s)=>r[s].set(t,n[s]));case Map:return i.children.forEach((o,s)=>r[s].set(t,n.get(o.name)));default:return i.children.forEach((o,s)=>r[s].set(t,n[o.name]))}}setValid(t,n){return super.setValid(t,n)||this.children.forEach(r=>r.setValid(t,n)),n}addChild(t,n=`${this.numChildren}`){let r=this.children.push(t);return this.type=new me([...this.type.children,new Ut(n,t.type,!0)]),r}};var ds=class extends Ve{};ds.prototype._setValue=P_;var xh=class extends ds{};xh.prototype._setValue=Mg;var bh=class extends ds{};bh.prototype._setValue=Tg;var wh=class extends ds{};wh.prototype._setValue=Ag;var vh=class extends ds{};vh.prototype._setValue=Eg;var hs=class extends Ve{};hs.prototype._setValue=U_;var _h=class extends hs{};_h.prototype._setValue=Ng;var Sh=class extends hs{};Sh.prototype._setValue=Dg;var Ih=class extends hs{};Ih.prototype._setValue=Og;var Mh=class extends hs{};Mh.prototype._setValue=Bg;var du=class extends be{constructor(t){super(t),this._typeIds=new is(new Int8Array(0),1),typeof t.valueToChildTypeId=="function"&&(this._valueToChildTypeId=t.valueToChildTypeId)}get typeIdToChildIndex(){return this.type.typeIdToChildIndex}append(t,n){return this.set(this.length,t,n)}set(t,n,r){return r===void 0&&(r=this._valueToChildTypeId(this,n,t)),this.setValue(t,n,r),this}setValue(t,n,r){this._typeIds.set(t,r);let i=this.type.typeIdToChildIndex[r],o=this.children[i];o?.set(t,n)}addChild(t,n=`${this.children.length}`){let r=this.children.push(t),{type:{children:i,mode:o,typeIds:s}}=this,a=[...i,new Ut(n,t.type)];return this.type=new Ai(o,[...s,r],a),r}_valueToChildTypeId(t,n,r){throw new Error("Cannot map UnionBuilder value to child typeId. Pass the `childTypeId` as the second argument to unionBuilder.append(), or supply a `valueToChildTypeId` function as part of the UnionBuilder constructor options.")}},x0=class extends du{},b0=class extends du{constructor(t){super(t),this._offsets=new is(new Int32Array(0))}setValue(t,n,r){let i=this._typeIds.set(t,r).buffer[t],o=this.getChildAt(this.type.typeIdToChildIndex[i]),s=this._offsets.set(t,o.length).buffer[t];o?.set(s,n)}};var Th=class extends to{constructor(t){super(t),this._values=new ha(new Uint8Array(0))}get byteLength(){let t=this._pendingLength+this.length*4;return this._offsets&&(t+=this._offsets.byteLength),this._values&&(t+=this._values.byteLength),this._nulls&&(t+=this._nulls.byteLength),t}setValue(t,n){return super.setValue(t,ca(n))}_flushPending(t,n){}};Th.prototype._flushPending=fu.prototype._flushPending;var s2=class extends ut{visitNull(){return y0}visitBool(){return t0}visitInt(){return Zr}visitInt8(){return s0}visitInt16(){return a0}visitInt32(){return c0}visitInt64(){return l0}visitUint8(){return u0}visitUint16(){return f0}visitUint32(){return d0}visitUint64(){return h0}visitFloat(){return Dc}visitFloat16(){return r0}visitFloat32(){return i0}visitFloat64(){return o0}visitUtf8(){return Th}visitBinary(){return fu}visitFixedSizeBinary(){return fh}visitDate(){return Ec}visitDateDay(){return ch}visitDateMillisecond(){return lh}visitTimestamp(){return ds}visitTimestampSecond(){return xh}visitTimestampMillisecond(){return bh}visitTimestampMicrosecond(){return wh}visitTimestampNanosecond(){return vh}visitTime(){return hs}visitTimeSecond(){return _h}visitTimeMillisecond(){return Sh}visitTimeMicrosecond(){return Ih}visitTimeNanosecond(){return Mh}visitDecimal(){return uh}visitList(){return p0}visitStruct(){return g0}visitUnion(){return du}visitDenseUnion(){return b0}visitSparseUnion(){return x0}visitDictionary(){return e0}visitInterval(){return Oc}visitIntervalDayTime(){return dh}visitIntervalYearMonth(){return hh}visitDuration(){return fs}visitDurationSecond(){return ph}visitDurationMillisecond(){return mh}visitDurationMicrosecond(){return yh}visistDurationNanosecond(){return gh}visitFixedSizeList(){return n0}visitMap(){return m0}},yO=new s2;var wt=class extends ut{compareSchemas(t,n){return t===n||n instanceof t.constructor&&this.compareManyFields(t.fields,n.fields)}compareManyFields(t,n){return t===n||Array.isArray(t)&&Array.isArray(n)&&t.length===n.length&&t.every((r,i)=>this.compareFields(r,n[i]))}compareFields(t,n){return t===n||n instanceof t.constructor&&t.name===n.name&&t.nullable===n.nullable&&this.visit(t.type,n.type)}};function qn(e,t){return t instanceof e.constructor}function Ah(e,t){return e===t||qn(e,t)}function ps(e,t){return e===t||qn(e,t)&&e.bitWidth===t.bitWidth&&e.isSigned===t.isSigned}function w0(e,t){return e===t||qn(e,t)&&e.precision===t.precision}function Ij(e,t){return e===t||qn(e,t)&&e.byteWidth===t.byteWidth}function a2(e,t){return e===t||qn(e,t)&&e.unit===t.unit}function Eh(e,t){return e===t||qn(e,t)&&e.unit===t.unit&&e.timezone===t.timezone}function Nh(e,t){return e===t||qn(e,t)&&e.unit===t.unit&&e.bitWidth===t.bitWidth}function Mj(e,t){return e===t||qn(e,t)&&e.children.length===t.children.length&&so.compareManyFields(e.children,t.children)}function Tj(e,t){return e===t||qn(e,t)&&e.children.length===t.children.length&&so.compareManyFields(e.children,t.children)}function c2(e,t){return e===t||qn(e,t)&&e.mode===t.mode&&e.typeIds.every((n,r)=>n===t.typeIds[r])&&so.compareManyFields(e.children,t.children)}function Aj(e,t){return e===t||qn(e,t)&&e.id===t.id&&e.isOrdered===t.isOrdered&&so.visit(e.indices,t.indices)&&so.visit(e.dictionary,t.dictionary)}function l2(e,t){return e===t||qn(e,t)&&e.unit===t.unit}function Dh(e,t){return e===t||qn(e,t)&&e.unit===t.unit}function Ej(e,t){return e===t||qn(e,t)&&e.listSize===t.listSize&&e.children.length===t.children.length&&so.compareManyFields(e.children,t.children)}function Nj(e,t){return e===t||qn(e,t)&&e.keysSorted===t.keysSorted&&e.children.length===t.children.length&&so.compareManyFields(e.children,t.children)}wt.prototype.visitNull=Ah;wt.prototype.visitBool=Ah;wt.prototype.visitInt=ps;wt.prototype.visitInt8=ps;wt.prototype.visitInt16=ps;wt.prototype.visitInt32=ps;wt.prototype.visitInt64=ps;wt.prototype.visitUint8=ps;wt.prototype.visitUint16=ps;wt.prototype.visitUint32=ps;wt.prototype.visitUint64=ps;wt.prototype.visitFloat=w0;wt.prototype.visitFloat16=w0;wt.prototype.visitFloat32=w0;wt.prototype.visitFloat64=w0;wt.prototype.visitUtf8=Ah;wt.prototype.visitBinary=Ah;wt.prototype.visitFixedSizeBinary=Ij;wt.prototype.visitDate=a2;wt.prototype.visitDateDay=a2;wt.prototype.visitDateMillisecond=a2;wt.prototype.visitTimestamp=Eh;wt.prototype.visitTimestampSecond=Eh;wt.prototype.visitTimestampMillisecond=Eh;wt.prototype.visitTimestampMicrosecond=Eh;wt.prototype.visitTimestampNanosecond=Eh;wt.prototype.visitTime=Nh;wt.prototype.visitTimeSecond=Nh;wt.prototype.visitTimeMillisecond=Nh;wt.prototype.visitTimeMicrosecond=Nh;wt.prototype.visitTimeNanosecond=Nh;wt.prototype.visitDecimal=Ah;wt.prototype.visitList=Mj;wt.prototype.visitStruct=Tj;wt.prototype.visitUnion=c2;wt.prototype.visitDenseUnion=c2;wt.prototype.visitSparseUnion=c2;wt.prototype.visitDictionary=Aj;wt.prototype.visitInterval=l2;wt.prototype.visitIntervalDayTime=l2;wt.prototype.visitIntervalYearMonth=l2;wt.prototype.visitDuration=Dh;wt.prototype.visitDurationSecond=Dh;wt.prototype.visitDurationMillisecond=Dh;wt.prototype.visitDurationMicrosecond=Dh;wt.prototype.visitDurationNanosecond=Dh;wt.prototype.visitFixedSizeList=Ej;wt.prototype.visitMap=Nj;var so=new wt;function Bc(e,t){return so.compareSchemas(e,t)}function gO(e,t){return so.compareFields(e,t)}function xO(e,t){return so.visit(e,t)}function Nc(e){let t=e.type,n=new(yO.getVisitFn(t)())(e);if(t.children&&t.children.length>0){let r=e.children||[],i={nullValues:e.nullValues},o=Array.isArray(r)?(s,a)=>r[a]||i:({name:s})=>r[s]||i;for(let[s,a]of t.children.entries()){let{type:c}=a,l=o(a,s);n.children.push(Nc(Object.assign(Object.assign({},l),{type:c})))}}return n}function v0(e,t){return Dj(e,t.map(n=>n.data.concat()))}function Dj(e,t){let n=[...e.fields],r=[],i={numBatches:t.reduce((f,d)=>Math.max(f,d.length),0)},o=0,s=0,a=-1,c=t.length,l,u=[];for(;i.numBatches-- >0;){for(s=Number.POSITIVE_INFINITY,a=-1;++a<c;)u[a]=l=t[a].shift(),s=Math.min(s,l?l.length:s);Number.isFinite(s)&&(u=Oj(n,s,u,t,i),s>0&&(r[o++]=Bt({type:new me(n),length:s,nullCount:0,children:u.slice()})))}return[e=e.assign(n),r.map(f=>new Le(e,f))]}function Oj(e,t,n,r,i){var o;let s=(t+63&-64)>>3;for(let a=-1,c=r.length;++a<c;){let l=n[a],u=l?.length;if(u>=t)u===t?n[a]=l:(n[a]=l.slice(0,t),i.numBatches=Math.max(i.numBatches,r[a].unshift(l.slice(t,u-t))));else{let f=e[a];e[a]=f.clone({nullable:!0}),n[a]=(o=l?._changeLengthAndBackfillNullBitmap(t))!==null&&o!==void 0?o:Bt({type:f.type,length:t,nullCount:t,nullBitmap:new Uint8Array(s)})}}return n}var bO,ur=class e{constructor(...t){var n,r;if(t.length===0)return this.batches=[],this.schema=new re([]),this._offsets=[0],this;let i,o;t[0]instanceof re&&(i=t.shift()),t.at(-1)instanceof Uint32Array&&(o=t.pop());let s=c=>{if(c){if(c instanceof Le)return[c];if(c instanceof e)return c.batches;if(c instanceof se){if(c.type instanceof me)return[new Le(new re(c.type.children),c)]}else{if(Array.isArray(c))return c.flatMap(l=>s(l));if(typeof c[Symbol.iterator]=="function")return[...c].flatMap(l=>s(l));if(typeof c=="object"){let l=Object.keys(c),u=l.map(h=>new Vt([c[h]])),f=new re(l.map((h,p)=>new Ut(String(h),u[p].type))),[,d]=v0(f,u);return d.length===0?[new Le(c)]:d}}}return[]},a=t.flatMap(c=>s(c));if(i=(r=i??((n=a[0])===null||n===void 0?void 0:n.schema))!==null&&r!==void 0?r:new re([]),!(i instanceof re))throw new TypeError("Table constructor expects a [Schema, RecordBatch[]] pair.");for(let c of a){if(!(c instanceof Le))throw new TypeError("Table constructor expects a [Schema, RecordBatch[]] pair.");if(!Bc(i,c.schema))throw new TypeError("Table and inner RecordBatch schemas must be equivalent.")}this.schema=i,this.batches=a,this._offsets=o??qg(this.data)}get data(){return this.batches.map(({data:t})=>t)}get numCols(){return this.schema.fields.length}get numRows(){return this.data.reduce((t,n)=>t+n.length,0)}get nullCount(){return this._nullCount===-1&&(this._nullCount=jg(this.data)),this._nullCount}isValid(t){return!1}get(t){return null}set(t,n){}indexOf(t,n){return-1}getByteLength(t){return 0}[Symbol.iterator](){return this.batches.length>0?ou.visit(new Vt(this.data)):new Array(0)[Symbol.iterator]()}toArray(){return[...this]}toString(){return`[
7
+ return true;`)}function Wq(e){return typeof e!="bigint"?Si(e):`${Si(e)}n`}var e2=(e,t)=>(Math.ceil(e)*t+63&-64||64)/t,Hq=(e,t=0)=>e.length>=t?e.subarray(0,t):Ql(new e.constructor(t),e,0),ma=class{constructor(t,n=1){this.buffer=t,this.stride=n,this.BYTES_PER_ELEMENT=t.BYTES_PER_ELEMENT,this.ArrayType=t.constructor,this._resize(this.length=Math.ceil(t.length/n))}get byteLength(){return Math.ceil(this.length*this.stride)*this.BYTES_PER_ELEMENT}get reservedLength(){return this.buffer.length/this.stride}get reservedByteLength(){return this.buffer.byteLength}set(t,n){return this}append(t){return this.set(this.length,t)}reserve(t){if(t>0){this.length+=t;let n=this.stride,r=this.length*n,i=this.buffer.length;r>=i&&this._resize(i===0?e2(r*1,this.BYTES_PER_ELEMENT):e2(r*2,this.BYTES_PER_ELEMENT))}return this}flush(t=this.length){t=e2(t*this.stride,this.BYTES_PER_ELEMENT);let n=Hq(this.buffer,t);return this.clear(),n}clear(){return this.length=0,this._resize(0),this}_resize(t){return this.buffer=Ql(new this.ArrayType(t),this.buffer)}};ma.prototype.offset=0;var is=class extends ma{last(){return this.get(this.length-1)}get(t){return this.buffer[t]}set(t,n){return this.reserve(t-this.length+1),this.buffer[t*this.stride]=n,this}},au=class extends is{constructor(t=new Uint8Array(0)){super(t,1/8),this.numValid=0}get numInvalid(){return this.length-this.numValid}get(t){return this.buffer[t>>3]>>t%8&1}set(t,n){let{buffer:r}=this.reserve(t-this.length+1),i=t>>3,o=t%8,s=r[i]>>o&1;return n?s===0&&(r[i]|=1<<o,++this.numValid):s===1&&(r[i]&=~(1<<o),--this.numValid),this}clear(){return this.numValid=0,super.clear()}},cu=class extends is{constructor(t=new Int32Array(1)){super(t,1)}append(t){return this.set(this.length-1,t)}set(t,n){let r=this.length-1,i=this.reserve(t-r+1).buffer;return r<t++&&i.fill(i[r],r,t),i[t]=i[t-1]+n,this}flush(t=this.length-1){return t>this.length&&this.set(t-1,0),super.flush(t+1)}};var be=class{static throughNode(t){throw new Error('"throughNode" not available in this environment')}static throughDOM(t){throw new Error('"throughDOM" not available in this environment')}constructor({type:t,nullValues:n}){this.length=0,this.finished=!1,this.type=t,this.children=[],this.nullValues=n,this.stride=Tr(t),this._nulls=new au,n&&n.length>0&&(this._isValid=PO(n))}toVector(){return new Yt([this.flush()])}get ArrayType(){return this.type.ArrayType}get nullCount(){return this._nulls.numInvalid}get numChildren(){return this.children.length}get byteLength(){let t=0,{_offsets:n,_values:r,_nulls:i,_typeIds:o,children:s}=this;return n&&(t+=n.byteLength),r&&(t+=r.byteLength),i&&(t+=i.byteLength),o&&(t+=o.byteLength),s.reduce((a,c)=>a+c.byteLength,t)}get reservedLength(){return this._nulls.reservedLength}get reservedByteLength(){let t=0;return this._offsets&&(t+=this._offsets.reservedByteLength),this._values&&(t+=this._values.reservedByteLength),this._nulls&&(t+=this._nulls.reservedByteLength),this._typeIds&&(t+=this._typeIds.reservedByteLength),this.children.reduce((n,r)=>n+r.reservedByteLength,t)}get valueOffsets(){return this._offsets?this._offsets.buffer:null}get values(){return this._values?this._values.buffer:null}get nullBitmap(){return this._nulls?this._nulls.buffer:null}get typeIds(){return this._typeIds?this._typeIds.buffer:null}append(t){return this.set(this.length,t)}isValid(t){return this._isValid(t)}set(t,n){return this.setValid(t,this.isValid(n))&&this.setValue(t,n),this}setValue(t,n){this._setValue(this,t,n)}setValid(t,n){return this.length=this._nulls.set(t,+n).length,n}addChild(t,n=`${this.numChildren}`){throw new Error(`Cannot append children to non-nested type "${this.type}"`)}getChildAt(t){return this.children[t]||null}flush(){let t,n,r,i,{type:o,length:s,nullCount:a,_typeIds:c,_offsets:l,_values:u,_nulls:f}=this;(n=c?.flush(s))?i=l?.flush(s):(i=l?.flush(s))?t=u?.flush(l.last()):t=u?.flush(s),a>0&&(r=f?.flush(s));let d=this.children.map(h=>h.flush());return this.clear(),Bt({type:o,length:s,nullCount:a,children:d,child:d[0],data:t,typeIds:n,nullBitmap:r,valueOffsets:i})}finish(){this.finished=!0;for(let t of this.children)t.finish();return this}clear(){var t,n,r,i;this.length=0,(t=this._nulls)===null||t===void 0||t.clear(),(n=this._values)===null||n===void 0||n.clear(),(r=this._offsets)===null||r===void 0||r.clear(),(i=this._typeIds)===null||i===void 0||i.clear();for(let o of this.children)o.clear();return this}};be.prototype.length=1;be.prototype.stride=1;be.prototype.children=null;be.prototype.finished=!1;be.prototype.nullValues=null;be.prototype._isValid=()=>!0;var Ve=class extends be{constructor(t){super(t),this._values=new is(new this.ArrayType(0),this.stride)}setValue(t,n){let r=this._values;return r.reserve(t-r.length+1),super.setValue(t,n)}},to=class extends be{constructor(t){super(t),this._pendingLength=0,this._offsets=new cu}setValue(t,n){let r=this._pending||(this._pending=new Map),i=r.get(t);i&&(this._pendingLength-=i.length),this._pendingLength+=n instanceof Qi?n[Wr].length:n.length,r.set(t,n)}setValid(t,n){return super.setValid(t,n)?!0:((this._pending||(this._pending=new Map)).set(t,void 0),!1)}clear(){return this._pendingLength=0,this._pending=void 0,super.clear()}flush(){return this._flush(),super.flush()}finish(){return this._flush(),super.finish()}_flush(){let t=this._pending,n=this._pendingLength;return this._pendingLength=0,this._pending=void 0,t&&t.size>0&&this._flushPending(t,n),this}};var Tc=class{constructor(){this.bb=null,this.bb_pos=0}__init(t,n){return this.bb_pos=t,this.bb=n,this}offset(){return this.bb.readInt64(this.bb_pos)}metaDataLength(){return this.bb.readInt32(this.bb_pos+8)}bodyLength(){return this.bb.readInt64(this.bb_pos+16)}static sizeOf(){return 24}static createBlock(t,n,r,i){return t.prep(8,24),t.writeInt64(BigInt(i??0)),t.pad(4),t.writeInt32(r),t.writeInt64(BigInt(n??0)),t.offset()}};var eo=new Int32Array(2),Hg=new Float32Array(eo.buffer),Zg=new Float64Array(eo.buffer),lu=new Uint16Array(new Uint8Array([1,0]).buffer)[0]===1;var Xd;(function(e){e[e.UTF8_BYTES=1]="UTF8_BYTES",e[e.UTF16_STRING=2]="UTF16_STRING"})(Xd||(Xd={}));var Nr=class e{constructor(t){this.bytes_=t,this.position_=0,this.text_decoder_=new TextDecoder}static allocate(t){return new e(new Uint8Array(t))}clear(){this.position_=0}bytes(){return this.bytes_}position(){return this.position_}setPosition(t){this.position_=t}capacity(){return this.bytes_.length}readInt8(t){return this.readUint8(t)<<24>>24}readUint8(t){return this.bytes_[t]}readInt16(t){return this.readUint16(t)<<16>>16}readUint16(t){return this.bytes_[t]|this.bytes_[t+1]<<8}readInt32(t){return this.bytes_[t]|this.bytes_[t+1]<<8|this.bytes_[t+2]<<16|this.bytes_[t+3]<<24}readUint32(t){return this.readInt32(t)>>>0}readInt64(t){return BigInt.asIntN(64,BigInt(this.readUint32(t))+(BigInt(this.readUint32(t+4))<<BigInt(32)))}readUint64(t){return BigInt.asUintN(64,BigInt(this.readUint32(t))+(BigInt(this.readUint32(t+4))<<BigInt(32)))}readFloat32(t){return eo[0]=this.readInt32(t),Hg[0]}readFloat64(t){return eo[lu?0:1]=this.readInt32(t),eo[lu?1:0]=this.readInt32(t+4),Zg[0]}writeInt8(t,n){this.bytes_[t]=n}writeUint8(t,n){this.bytes_[t]=n}writeInt16(t,n){this.bytes_[t]=n,this.bytes_[t+1]=n>>8}writeUint16(t,n){this.bytes_[t]=n,this.bytes_[t+1]=n>>8}writeInt32(t,n){this.bytes_[t]=n,this.bytes_[t+1]=n>>8,this.bytes_[t+2]=n>>16,this.bytes_[t+3]=n>>24}writeUint32(t,n){this.bytes_[t]=n,this.bytes_[t+1]=n>>8,this.bytes_[t+2]=n>>16,this.bytes_[t+3]=n>>24}writeInt64(t,n){this.writeInt32(t,Number(BigInt.asIntN(32,n))),this.writeInt32(t+4,Number(BigInt.asIntN(32,n>>BigInt(32))))}writeUint64(t,n){this.writeUint32(t,Number(BigInt.asUintN(32,n))),this.writeUint32(t+4,Number(BigInt.asUintN(32,n>>BigInt(32))))}writeFloat32(t,n){Hg[0]=n,this.writeInt32(t,eo[0])}writeFloat64(t,n){Zg[0]=n,this.writeInt32(t,eo[lu?0:1]),this.writeInt32(t+4,eo[lu?1:0])}getBufferIdentifier(){if(this.bytes_.length<this.position_+4+4)throw new Error("FlatBuffers: ByteBuffer is too short to contain an identifier.");let t="";for(let n=0;n<4;n++)t+=String.fromCharCode(this.readInt8(this.position_+4+n));return t}__offset(t,n){let r=t-this.readInt32(t);return n<this.readInt16(r)?this.readInt16(r+n):0}__union(t,n){return t.bb_pos=n+this.readInt32(n),t.bb=this,t}__string(t,n){t+=this.readInt32(t);let r=this.readInt32(t);t+=4;let i=this.bytes_.subarray(t,t+r);return n===Xd.UTF8_BYTES?i:this.text_decoder_.decode(i)}__union_with_string(t,n){return typeof t=="string"?this.__string(n):this.__union(t,n)}__indirect(t){return t+this.readInt32(t)}__vector(t){return t+this.readInt32(t)+4}__vector_len(t){return this.readInt32(t+this.readInt32(t))}__has_identifier(t){if(t.length!=4)throw new Error("FlatBuffers: file identifier must be length "+4);for(let n=0;n<4;n++)if(t.charCodeAt(n)!=this.readInt8(this.position()+4+n))return!1;return!0}createScalarList(t,n){let r=[];for(let i=0;i<n;++i){let o=t(i);o!==null&&r.push(o)}return r}createObjList(t,n){let r=[];for(let i=0;i<n;++i){let o=t(i);o!==null&&r.push(o.unpack())}return r}};var Ec=class e{constructor(t){this.minalign=1,this.vtable=null,this.vtable_in_use=0,this.isNested=!1,this.object_start=0,this.vtables=[],this.vector_num_elems=0,this.force_defaults=!1,this.string_maps=null,this.text_encoder=new TextEncoder;let n;t?n=t:n=1024,this.bb=Nr.allocate(n),this.space=n}clear(){this.bb.clear(),this.space=this.bb.capacity(),this.minalign=1,this.vtable=null,this.vtable_in_use=0,this.isNested=!1,this.object_start=0,this.vtables=[],this.vector_num_elems=0,this.force_defaults=!1,this.string_maps=null}forceDefaults(t){this.force_defaults=t}dataBuffer(){return this.bb}asUint8Array(){return this.bb.bytes().subarray(this.bb.position(),this.bb.position()+this.offset())}prep(t,n){t>this.minalign&&(this.minalign=t);let r=~(this.bb.capacity()-this.space+n)+1&t-1;for(;this.space<r+t+n;){let i=this.bb.capacity();this.bb=e.growByteBuffer(this.bb),this.space+=this.bb.capacity()-i}this.pad(r)}pad(t){for(let n=0;n<t;n++)this.bb.writeInt8(--this.space,0)}writeInt8(t){this.bb.writeInt8(this.space-=1,t)}writeInt16(t){this.bb.writeInt16(this.space-=2,t)}writeInt32(t){this.bb.writeInt32(this.space-=4,t)}writeInt64(t){this.bb.writeInt64(this.space-=8,t)}writeFloat32(t){this.bb.writeFloat32(this.space-=4,t)}writeFloat64(t){this.bb.writeFloat64(this.space-=8,t)}addInt8(t){this.prep(1,0),this.writeInt8(t)}addInt16(t){this.prep(2,0),this.writeInt16(t)}addInt32(t){this.prep(4,0),this.writeInt32(t)}addInt64(t){this.prep(8,0),this.writeInt64(t)}addFloat32(t){this.prep(4,0),this.writeFloat32(t)}addFloat64(t){this.prep(8,0),this.writeFloat64(t)}addFieldInt8(t,n,r){(this.force_defaults||n!=r)&&(this.addInt8(n),this.slot(t))}addFieldInt16(t,n,r){(this.force_defaults||n!=r)&&(this.addInt16(n),this.slot(t))}addFieldInt32(t,n,r){(this.force_defaults||n!=r)&&(this.addInt32(n),this.slot(t))}addFieldInt64(t,n,r){(this.force_defaults||n!==r)&&(this.addInt64(n),this.slot(t))}addFieldFloat32(t,n,r){(this.force_defaults||n!=r)&&(this.addFloat32(n),this.slot(t))}addFieldFloat64(t,n,r){(this.force_defaults||n!=r)&&(this.addFloat64(n),this.slot(t))}addFieldOffset(t,n,r){(this.force_defaults||n!=r)&&(this.addOffset(n),this.slot(t))}addFieldStruct(t,n,r){n!=r&&(this.nested(n),this.slot(t))}nested(t){if(t!=this.offset())throw new TypeError("FlatBuffers: struct must be serialized inline.")}notNested(){if(this.isNested)throw new TypeError("FlatBuffers: object serialization must not be nested.")}slot(t){this.vtable!==null&&(this.vtable[t]=this.offset())}offset(){return this.bb.capacity()-this.space}static growByteBuffer(t){let n=t.capacity();if(n&3221225472)throw new Error("FlatBuffers: cannot grow buffer beyond 2 gigabytes.");let r=n<<1,i=Nr.allocate(r);return i.setPosition(r-n),i.bytes().set(t.bytes(),r-n),i}addOffset(t){this.prep(4,0),this.writeInt32(this.offset()-t+4)}startObject(t){this.notNested(),this.vtable==null&&(this.vtable=[]),this.vtable_in_use=t;for(let n=0;n<t;n++)this.vtable[n]=0;this.isNested=!0,this.object_start=this.offset()}endObject(){if(this.vtable==null||!this.isNested)throw new Error("FlatBuffers: endObject called without startObject");this.addInt32(0);let t=this.offset(),n=this.vtable_in_use-1;for(;n>=0&&this.vtable[n]==0;n--);let r=n+1;for(;n>=0;n--)this.addInt16(this.vtable[n]!=0?t-this.vtable[n]:0);let i=2;this.addInt16(t-this.object_start);let o=(r+i)*2;this.addInt16(o);let s=0,a=this.space;t:for(n=0;n<this.vtables.length;n++){let c=this.bb.capacity()-this.vtables[n];if(o==this.bb.readInt16(c)){for(let l=2;l<o;l+=2)if(this.bb.readInt16(a+l)!=this.bb.readInt16(c+l))continue t;s=this.vtables[n];break}}return s?(this.space=this.bb.capacity()-t,this.bb.writeInt32(this.space,s-t)):(this.vtables.push(this.offset()),this.bb.writeInt32(this.bb.capacity()-t,this.offset()-t)),this.isNested=!1,t}finish(t,n,r){let i=r?4:0;if(n){let o=n;if(this.prep(this.minalign,8+i),o.length!=4)throw new TypeError("FlatBuffers: file identifier must be length "+4);for(let s=3;s>=0;s--)this.writeInt8(o.charCodeAt(s))}this.prep(this.minalign,4+i),this.addOffset(t),i&&this.addInt32(this.bb.capacity()-this.space),this.bb.setPosition(this.space)}finishSizePrefixed(t,n){this.finish(t,n,!0)}requiredField(t,n){let r=this.bb.capacity()-t,i=r-this.bb.readInt32(r);if(!(n<this.bb.readInt16(i)&&this.bb.readInt16(i+n)!=0))throw new TypeError("FlatBuffers: field "+n+" must be set")}startVector(t,n,r){this.notNested(),this.vector_num_elems=n,this.prep(4,t*n),this.prep(r,t*n)}endVector(){return this.writeInt32(this.vector_num_elems),this.offset()}createSharedString(t){if(!t)return 0;if(this.string_maps||(this.string_maps=new Map),this.string_maps.has(t))return this.string_maps.get(t);let n=this.createString(t);return this.string_maps.set(t,n),n}createString(t){if(t==null)return 0;let n;t instanceof Uint8Array?n=t:n=this.text_encoder.encode(t),this.addInt8(0),this.startVector(1,n.length,1),this.bb.setPosition(this.space-=n.length);for(let r=0,i=this.space,o=this.bb.bytes();r<n.length;r++)o[i++]=n[r];return this.endVector()}createObjectOffset(t){return t===null?0:typeof t=="string"?this.createString(t):t.pack(this)}createObjectOffsetList(t){let n=[];for(let r=0;r<t.length;++r){let i=t[r];if(i!==null)n.push(this.createObjectOffset(i));else throw new TypeError("FlatBuffers: Argument for createObjectOffsetList cannot contain null.")}return n}createStructOffsetList(t,n){return n(this,t.length),this.createObjectOffsetList(t.slice().reverse()),this.endVector()}};var en=class e{constructor(){this.bb=null,this.bb_pos=0}__init(t,n){return this.bb_pos=t,this.bb=n,this}static getRootAsKeyValue(t,n){return(n||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsKeyValue(t,n){return t.setPosition(t.position()+4),(n||new e).__init(t.readInt32(t.position())+t.position(),t)}key(t){let n=this.bb.__offset(this.bb_pos,4);return n?this.bb.__string(this.bb_pos+n,t):null}value(t){let n=this.bb.__offset(this.bb_pos,6);return n?this.bb.__string(this.bb_pos+n,t):null}static startKeyValue(t){t.startObject(2)}static addKey(t,n){t.addFieldOffset(0,n,0)}static addValue(t,n){t.addFieldOffset(1,n,0)}static endKeyValue(t){return t.endObject()}static createKeyValue(t,n,r){return e.startKeyValue(t),e.addKey(t,n),e.addValue(t,r),e.endKeyValue(t)}};var ya;(function(e){e[e.V1=0]="V1",e[e.V2=1]="V2",e[e.V3=2]="V3",e[e.V4=3]="V4",e[e.V5=4]="V5"})(ya||(ya={}));var ga;(function(e){e[e.Little=0]="Little",e[e.Big=1]="Big"})(ga||(ga={}));var Gd;(function(e){e[e.DenseArray=0]="DenseArray"})(Gd||(Gd={}));var Bi=class e{constructor(){this.bb=null,this.bb_pos=0}__init(t,n){return this.bb_pos=t,this.bb=n,this}static getRootAsInt(t,n){return(n||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsInt(t,n){return t.setPosition(t.position()+4),(n||new e).__init(t.readInt32(t.position())+t.position(),t)}bitWidth(){let t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt32(this.bb_pos+t):0}isSigned(){let t=this.bb.__offset(this.bb_pos,6);return t?!!this.bb.readInt8(this.bb_pos+t):!1}static startInt(t){t.startObject(2)}static addBitWidth(t,n){t.addFieldInt32(0,n,0)}static addIsSigned(t,n){t.addFieldInt8(1,+n,0)}static endInt(t){return t.endObject()}static createInt(t,n,r){return e.startInt(t),e.addBitWidth(t,n),e.addIsSigned(t,r),e.endInt(t)}};var no=class e{constructor(){this.bb=null,this.bb_pos=0}__init(t,n){return this.bb_pos=t,this.bb=n,this}static getRootAsDictionaryEncoding(t,n){return(n||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsDictionaryEncoding(t,n){return t.setPosition(t.position()+4),(n||new e).__init(t.readInt32(t.position())+t.position(),t)}id(){let t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt64(this.bb_pos+t):BigInt("0")}indexType(t){let n=this.bb.__offset(this.bb_pos,6);return n?(t||new Bi).__init(this.bb.__indirect(this.bb_pos+n),this.bb):null}isOrdered(){let t=this.bb.__offset(this.bb_pos,8);return t?!!this.bb.readInt8(this.bb_pos+t):!1}dictionaryKind(){let t=this.bb.__offset(this.bb_pos,10);return t?this.bb.readInt16(this.bb_pos+t):Gd.DenseArray}static startDictionaryEncoding(t){t.startObject(4)}static addId(t,n){t.addFieldInt64(0,n,BigInt("0"))}static addIndexType(t,n){t.addFieldOffset(1,n,0)}static addIsOrdered(t,n){t.addFieldInt8(2,+n,0)}static addDictionaryKind(t,n){t.addFieldInt16(3,n,Gd.DenseArray)}static endDictionaryEncoding(t){return t.endObject()}};var Wd=class e{constructor(){this.bb=null,this.bb_pos=0}__init(t,n){return this.bb_pos=t,this.bb=n,this}static getRootAsBinary(t,n){return(n||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsBinary(t,n){return t.setPosition(t.position()+4),(n||new e).__init(t.readInt32(t.position())+t.position(),t)}static startBinary(t){t.startObject(0)}static endBinary(t){return t.endObject()}static createBinary(t){return e.startBinary(t),e.endBinary(t)}};var Hd=class e{constructor(){this.bb=null,this.bb_pos=0}__init(t,n){return this.bb_pos=t,this.bb=n,this}static getRootAsBool(t,n){return(n||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsBool(t,n){return t.setPosition(t.position()+4),(n||new e).__init(t.readInt32(t.position())+t.position(),t)}static startBool(t){t.startObject(0)}static endBool(t){return t.endObject()}static createBool(t){return e.startBool(t),e.endBool(t)}};var Zd;(function(e){e[e.DAY=0]="DAY",e[e.MILLISECOND=1]="MILLISECOND"})(Zd||(Zd={}));var xa=class e{constructor(){this.bb=null,this.bb_pos=0}__init(t,n){return this.bb_pos=t,this.bb=n,this}static getRootAsDate(t,n){return(n||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsDate(t,n){return t.setPosition(t.position()+4),(n||new e).__init(t.readInt32(t.position())+t.position(),t)}unit(){let t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt16(this.bb_pos+t):Zd.MILLISECOND}static startDate(t){t.startObject(1)}static addUnit(t,n){t.addFieldInt16(0,n,Zd.MILLISECOND)}static endDate(t){return t.endObject()}static createDate(t,n){return e.startDate(t),e.addUnit(t,n),e.endDate(t)}};var ro=class e{constructor(){this.bb=null,this.bb_pos=0}__init(t,n){return this.bb_pos=t,this.bb=n,this}static getRootAsDecimal(t,n){return(n||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsDecimal(t,n){return t.setPosition(t.position()+4),(n||new e).__init(t.readInt32(t.position())+t.position(),t)}precision(){let t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt32(this.bb_pos+t):0}scale(){let t=this.bb.__offset(this.bb_pos,6);return t?this.bb.readInt32(this.bb_pos+t):0}bitWidth(){let t=this.bb.__offset(this.bb_pos,8);return t?this.bb.readInt32(this.bb_pos+t):128}static startDecimal(t){t.startObject(3)}static addPrecision(t,n){t.addFieldInt32(0,n,0)}static addScale(t,n){t.addFieldInt32(1,n,0)}static addBitWidth(t,n){t.addFieldInt32(2,n,128)}static endDecimal(t){return t.endObject()}static createDecimal(t,n,r,i){return e.startDecimal(t),e.addPrecision(t,n),e.addScale(t,r),e.addBitWidth(t,i),e.endDecimal(t)}};var Li;(function(e){e[e.SECOND=0]="SECOND",e[e.MILLISECOND=1]="MILLISECOND",e[e.MICROSECOND=2]="MICROSECOND",e[e.NANOSECOND=3]="NANOSECOND"})(Li||(Li={}));var ba=class e{constructor(){this.bb=null,this.bb_pos=0}__init(t,n){return this.bb_pos=t,this.bb=n,this}static getRootAsDuration(t,n){return(n||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsDuration(t,n){return t.setPosition(t.position()+4),(n||new e).__init(t.readInt32(t.position())+t.position(),t)}unit(){let t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt16(this.bb_pos+t):Li.MILLISECOND}static startDuration(t){t.startObject(1)}static addUnit(t,n){t.addFieldInt16(0,n,Li.MILLISECOND)}static endDuration(t){return t.endObject()}static createDuration(t,n){return e.startDuration(t),e.addUnit(t,n),e.endDuration(t)}};var wa=class e{constructor(){this.bb=null,this.bb_pos=0}__init(t,n){return this.bb_pos=t,this.bb=n,this}static getRootAsFixedSizeBinary(t,n){return(n||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsFixedSizeBinary(t,n){return t.setPosition(t.position()+4),(n||new e).__init(t.readInt32(t.position())+t.position(),t)}byteWidth(){let t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt32(this.bb_pos+t):0}static startFixedSizeBinary(t){t.startObject(1)}static addByteWidth(t,n){t.addFieldInt32(0,n,0)}static endFixedSizeBinary(t){return t.endObject()}static createFixedSizeBinary(t,n){return e.startFixedSizeBinary(t),e.addByteWidth(t,n),e.endFixedSizeBinary(t)}};var va=class e{constructor(){this.bb=null,this.bb_pos=0}__init(t,n){return this.bb_pos=t,this.bb=n,this}static getRootAsFixedSizeList(t,n){return(n||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsFixedSizeList(t,n){return t.setPosition(t.position()+4),(n||new e).__init(t.readInt32(t.position())+t.position(),t)}listSize(){let t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt32(this.bb_pos+t):0}static startFixedSizeList(t){t.startObject(1)}static addListSize(t,n){t.addFieldInt32(0,n,0)}static endFixedSizeList(t){return t.endObject()}static createFixedSizeList(t,n){return e.startFixedSizeList(t),e.addListSize(t,n),e.endFixedSizeList(t)}};var Jd;(function(e){e[e.HALF=0]="HALF",e[e.SINGLE=1]="SINGLE",e[e.DOUBLE=2]="DOUBLE"})(Jd||(Jd={}));var _a=class e{constructor(){this.bb=null,this.bb_pos=0}__init(t,n){return this.bb_pos=t,this.bb=n,this}static getRootAsFloatingPoint(t,n){return(n||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsFloatingPoint(t,n){return t.setPosition(t.position()+4),(n||new e).__init(t.readInt32(t.position())+t.position(),t)}precision(){let t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt16(this.bb_pos+t):Jd.HALF}static startFloatingPoint(t){t.startObject(1)}static addPrecision(t,n){t.addFieldInt16(0,n,Jd.HALF)}static endFloatingPoint(t){return t.endObject()}static createFloatingPoint(t,n){return e.startFloatingPoint(t),e.addPrecision(t,n),e.endFloatingPoint(t)}};var Qd;(function(e){e[e.YEAR_MONTH=0]="YEAR_MONTH",e[e.DAY_TIME=1]="DAY_TIME",e[e.MONTH_DAY_NANO=2]="MONTH_DAY_NANO"})(Qd||(Qd={}));var Sa=class e{constructor(){this.bb=null,this.bb_pos=0}__init(t,n){return this.bb_pos=t,this.bb=n,this}static getRootAsInterval(t,n){return(n||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsInterval(t,n){return t.setPosition(t.position()+4),(n||new e).__init(t.readInt32(t.position())+t.position(),t)}unit(){let t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt16(this.bb_pos+t):Qd.YEAR_MONTH}static startInterval(t){t.startObject(1)}static addUnit(t,n){t.addFieldInt16(0,n,Qd.YEAR_MONTH)}static endInterval(t){return t.endObject()}static createInterval(t,n){return e.startInterval(t),e.addUnit(t,n),e.endInterval(t)}};var Kd=class e{constructor(){this.bb=null,this.bb_pos=0}__init(t,n){return this.bb_pos=t,this.bb=n,this}static getRootAsList(t,n){return(n||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsList(t,n){return t.setPosition(t.position()+4),(n||new e).__init(t.readInt32(t.position())+t.position(),t)}static startList(t){t.startObject(0)}static endList(t){return t.endObject()}static createList(t){return e.startList(t),e.endList(t)}};var Ia=class e{constructor(){this.bb=null,this.bb_pos=0}__init(t,n){return this.bb_pos=t,this.bb=n,this}static getRootAsMap(t,n){return(n||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsMap(t,n){return t.setPosition(t.position()+4),(n||new e).__init(t.readInt32(t.position())+t.position(),t)}keysSorted(){let t=this.bb.__offset(this.bb_pos,4);return t?!!this.bb.readInt8(this.bb_pos+t):!1}static startMap(t){t.startObject(1)}static addKeysSorted(t,n){t.addFieldInt8(0,+n,0)}static endMap(t){return t.endObject()}static createMap(t,n){return e.startMap(t),e.addKeysSorted(t,n),e.endMap(t)}};var th=class e{constructor(){this.bb=null,this.bb_pos=0}__init(t,n){return this.bb_pos=t,this.bb=n,this}static getRootAsNull(t,n){return(n||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsNull(t,n){return t.setPosition(t.position()+4),(n||new e).__init(t.readInt32(t.position())+t.position(),t)}static startNull(t){t.startObject(0)}static endNull(t){return t.endObject()}static createNull(t){return e.startNull(t),e.endNull(t)}};var eh=class e{constructor(){this.bb=null,this.bb_pos=0}__init(t,n){return this.bb_pos=t,this.bb=n,this}static getRootAsStruct_(t,n){return(n||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsStruct_(t,n){return t.setPosition(t.position()+4),(n||new e).__init(t.readInt32(t.position())+t.position(),t)}static startStruct_(t){t.startObject(0)}static endStruct_(t){return t.endObject()}static createStruct_(t){return e.startStruct_(t),e.endStruct_(t)}};var os=class e{constructor(){this.bb=null,this.bb_pos=0}__init(t,n){return this.bb_pos=t,this.bb=n,this}static getRootAsTime(t,n){return(n||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsTime(t,n){return t.setPosition(t.position()+4),(n||new e).__init(t.readInt32(t.position())+t.position(),t)}unit(){let t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt16(this.bb_pos+t):Li.MILLISECOND}bitWidth(){let t=this.bb.__offset(this.bb_pos,6);return t?this.bb.readInt32(this.bb_pos+t):32}static startTime(t){t.startObject(2)}static addUnit(t,n){t.addFieldInt16(0,n,Li.MILLISECOND)}static addBitWidth(t,n){t.addFieldInt32(1,n,32)}static endTime(t){return t.endObject()}static createTime(t,n,r){return e.startTime(t),e.addUnit(t,n),e.addBitWidth(t,r),e.endTime(t)}};var ss=class e{constructor(){this.bb=null,this.bb_pos=0}__init(t,n){return this.bb_pos=t,this.bb=n,this}static getRootAsTimestamp(t,n){return(n||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsTimestamp(t,n){return t.setPosition(t.position()+4),(n||new e).__init(t.readInt32(t.position())+t.position(),t)}unit(){let t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt16(this.bb_pos+t):Li.SECOND}timezone(t){let n=this.bb.__offset(this.bb_pos,6);return n?this.bb.__string(this.bb_pos+n,t):null}static startTimestamp(t){t.startObject(2)}static addUnit(t,n){t.addFieldInt16(0,n,Li.SECOND)}static addTimezone(t,n){t.addFieldOffset(1,n,0)}static endTimestamp(t){return t.endObject()}static createTimestamp(t,n,r){return e.startTimestamp(t),e.addUnit(t,n),e.addTimezone(t,r),e.endTimestamp(t)}};var nh;(function(e){e[e.Sparse=0]="Sparse",e[e.Dense=1]="Dense"})(nh||(nh={}));var Ci=class e{constructor(){this.bb=null,this.bb_pos=0}__init(t,n){return this.bb_pos=t,this.bb=n,this}static getRootAsUnion(t,n){return(n||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsUnion(t,n){return t.setPosition(t.position()+4),(n||new e).__init(t.readInt32(t.position())+t.position(),t)}mode(){let t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt16(this.bb_pos+t):nh.Sparse}typeIds(t){let n=this.bb.__offset(this.bb_pos,6);return n?this.bb.readInt32(this.bb.__vector(this.bb_pos+n)+t*4):0}typeIdsLength(){let t=this.bb.__offset(this.bb_pos,6);return t?this.bb.__vector_len(this.bb_pos+t):0}typeIdsArray(){let t=this.bb.__offset(this.bb_pos,6);return t?new Int32Array(this.bb.bytes().buffer,this.bb.bytes().byteOffset+this.bb.__vector(this.bb_pos+t),this.bb.__vector_len(this.bb_pos+t)):null}static startUnion(t){t.startObject(2)}static addMode(t,n){t.addFieldInt16(0,n,nh.Sparse)}static addTypeIds(t,n){t.addFieldOffset(1,n,0)}static createTypeIdsVector(t,n){t.startVector(4,n.length,4);for(let r=n.length-1;r>=0;r--)t.addInt32(n[r]);return t.endVector()}static startTypeIdsVector(t,n){t.startVector(4,n,4)}static endUnion(t){return t.endObject()}static createUnion(t,n,r){return e.startUnion(t),e.addMode(t,n),e.addTypeIds(t,r),e.endUnion(t)}};var rh=class e{constructor(){this.bb=null,this.bb_pos=0}__init(t,n){return this.bb_pos=t,this.bb=n,this}static getRootAsUtf8(t,n){return(n||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsUtf8(t,n){return t.setPosition(t.position()+4),(n||new e).__init(t.readInt32(t.position())+t.position(),t)}static startUtf8(t){t.startObject(0)}static endUtf8(t){return t.endObject()}static createUtf8(t){return e.startUtf8(t),e.endUtf8(t)}};var ye;(function(e){e[e.NONE=0]="NONE",e[e.Null=1]="Null",e[e.Int=2]="Int",e[e.FloatingPoint=3]="FloatingPoint",e[e.Binary=4]="Binary",e[e.Utf8=5]="Utf8",e[e.Bool=6]="Bool",e[e.Decimal=7]="Decimal",e[e.Date=8]="Date",e[e.Time=9]="Time",e[e.Timestamp=10]="Timestamp",e[e.Interval=11]="Interval",e[e.List=12]="List",e[e.Struct_=13]="Struct_",e[e.Union=14]="Union",e[e.FixedSizeBinary=15]="FixedSizeBinary",e[e.FixedSizeList=16]="FixedSizeList",e[e.Map=17]="Map",e[e.Duration=18]="Duration",e[e.LargeBinary=19]="LargeBinary",e[e.LargeUtf8=20]="LargeUtf8",e[e.LargeList=21]="LargeList",e[e.RunEndEncoded=22]="RunEndEncoded"})(ye||(ye={}));var Bn=class e{constructor(){this.bb=null,this.bb_pos=0}__init(t,n){return this.bb_pos=t,this.bb=n,this}static getRootAsField(t,n){return(n||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsField(t,n){return t.setPosition(t.position()+4),(n||new e).__init(t.readInt32(t.position())+t.position(),t)}name(t){let n=this.bb.__offset(this.bb_pos,4);return n?this.bb.__string(this.bb_pos+n,t):null}nullable(){let t=this.bb.__offset(this.bb_pos,6);return t?!!this.bb.readInt8(this.bb_pos+t):!1}typeType(){let t=this.bb.__offset(this.bb_pos,8);return t?this.bb.readUint8(this.bb_pos+t):ye.NONE}type(t){let n=this.bb.__offset(this.bb_pos,10);return n?this.bb.__union(t,this.bb_pos+n):null}dictionary(t){let n=this.bb.__offset(this.bb_pos,12);return n?(t||new no).__init(this.bb.__indirect(this.bb_pos+n),this.bb):null}children(t,n){let r=this.bb.__offset(this.bb_pos,14);return r?(n||new e).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+r)+t*4),this.bb):null}childrenLength(){let t=this.bb.__offset(this.bb_pos,14);return t?this.bb.__vector_len(this.bb_pos+t):0}customMetadata(t,n){let r=this.bb.__offset(this.bb_pos,16);return r?(n||new en).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+r)+t*4),this.bb):null}customMetadataLength(){let t=this.bb.__offset(this.bb_pos,16);return t?this.bb.__vector_len(this.bb_pos+t):0}static startField(t){t.startObject(7)}static addName(t,n){t.addFieldOffset(0,n,0)}static addNullable(t,n){t.addFieldInt8(1,+n,0)}static addTypeType(t,n){t.addFieldInt8(2,n,ye.NONE)}static addType(t,n){t.addFieldOffset(3,n,0)}static addDictionary(t,n){t.addFieldOffset(4,n,0)}static addChildren(t,n){t.addFieldOffset(5,n,0)}static createChildrenVector(t,n){t.startVector(4,n.length,4);for(let r=n.length-1;r>=0;r--)t.addOffset(n[r]);return t.endVector()}static startChildrenVector(t,n){t.startVector(4,n,4)}static addCustomMetadata(t,n){t.addFieldOffset(6,n,0)}static createCustomMetadataVector(t,n){t.startVector(4,n.length,4);for(let r=n.length-1;r>=0;r--)t.addOffset(n[r]);return t.endVector()}static startCustomMetadataVector(t,n){t.startVector(4,n,4)}static endField(t){return t.endObject()}};var fr=class e{constructor(){this.bb=null,this.bb_pos=0}__init(t,n){return this.bb_pos=t,this.bb=n,this}static getRootAsSchema(t,n){return(n||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsSchema(t,n){return t.setPosition(t.position()+4),(n||new e).__init(t.readInt32(t.position())+t.position(),t)}endianness(){let t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt16(this.bb_pos+t):ga.Little}fields(t,n){let r=this.bb.__offset(this.bb_pos,6);return r?(n||new Bn).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+r)+t*4),this.bb):null}fieldsLength(){let t=this.bb.__offset(this.bb_pos,6);return t?this.bb.__vector_len(this.bb_pos+t):0}customMetadata(t,n){let r=this.bb.__offset(this.bb_pos,8);return r?(n||new en).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+r)+t*4),this.bb):null}customMetadataLength(){let t=this.bb.__offset(this.bb_pos,8);return t?this.bb.__vector_len(this.bb_pos+t):0}features(t){let n=this.bb.__offset(this.bb_pos,10);return n?this.bb.readInt64(this.bb.__vector(this.bb_pos+n)+t*8):BigInt(0)}featuresLength(){let t=this.bb.__offset(this.bb_pos,10);return t?this.bb.__vector_len(this.bb_pos+t):0}static startSchema(t){t.startObject(4)}static addEndianness(t,n){t.addFieldInt16(0,n,ga.Little)}static addFields(t,n){t.addFieldOffset(1,n,0)}static createFieldsVector(t,n){t.startVector(4,n.length,4);for(let r=n.length-1;r>=0;r--)t.addOffset(n[r]);return t.endVector()}static startFieldsVector(t,n){t.startVector(4,n,4)}static addCustomMetadata(t,n){t.addFieldOffset(2,n,0)}static createCustomMetadataVector(t,n){t.startVector(4,n.length,4);for(let r=n.length-1;r>=0;r--)t.addOffset(n[r]);return t.endVector()}static startCustomMetadataVector(t,n){t.startVector(4,n,4)}static addFeatures(t,n){t.addFieldOffset(3,n,0)}static createFeaturesVector(t,n){t.startVector(8,n.length,8);for(let r=n.length-1;r>=0;r--)t.addInt64(n[r]);return t.endVector()}static startFeaturesVector(t,n){t.startVector(8,n,8)}static endSchema(t){return t.endObject()}static finishSchemaBuffer(t,n){t.finish(n)}static finishSizePrefixedSchemaBuffer(t,n){t.finish(n,void 0,!0)}static createSchema(t,n,r,i,o){return e.startSchema(t),e.addEndianness(t,n),e.addFields(t,r),e.addCustomMetadata(t,i),e.addFeatures(t,o),e.endSchema(t)}};var Dr=class e{constructor(){this.bb=null,this.bb_pos=0}__init(t,n){return this.bb_pos=t,this.bb=n,this}static getRootAsFooter(t,n){return(n||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsFooter(t,n){return t.setPosition(t.position()+4),(n||new e).__init(t.readInt32(t.position())+t.position(),t)}version(){let t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt16(this.bb_pos+t):ya.V1}schema(t){let n=this.bb.__offset(this.bb_pos,6);return n?(t||new fr).__init(this.bb.__indirect(this.bb_pos+n),this.bb):null}dictionaries(t,n){let r=this.bb.__offset(this.bb_pos,8);return r?(n||new Tc).__init(this.bb.__vector(this.bb_pos+r)+t*24,this.bb):null}dictionariesLength(){let t=this.bb.__offset(this.bb_pos,8);return t?this.bb.__vector_len(this.bb_pos+t):0}recordBatches(t,n){let r=this.bb.__offset(this.bb_pos,10);return r?(n||new Tc).__init(this.bb.__vector(this.bb_pos+r)+t*24,this.bb):null}recordBatchesLength(){let t=this.bb.__offset(this.bb_pos,10);return t?this.bb.__vector_len(this.bb_pos+t):0}customMetadata(t,n){let r=this.bb.__offset(this.bb_pos,12);return r?(n||new en).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+r)+t*4),this.bb):null}customMetadataLength(){let t=this.bb.__offset(this.bb_pos,12);return t?this.bb.__vector_len(this.bb_pos+t):0}static startFooter(t){t.startObject(5)}static addVersion(t,n){t.addFieldInt16(0,n,ya.V1)}static addSchema(t,n){t.addFieldOffset(1,n,0)}static addDictionaries(t,n){t.addFieldOffset(2,n,0)}static startDictionariesVector(t,n){t.startVector(24,n,8)}static addRecordBatches(t,n){t.addFieldOffset(3,n,0)}static startRecordBatchesVector(t,n){t.startVector(24,n,8)}static addCustomMetadata(t,n){t.addFieldOffset(4,n,0)}static createCustomMetadataVector(t,n){t.startVector(4,n.length,4);for(let r=n.length-1;r>=0;r--)t.addOffset(n[r]);return t.endVector()}static startCustomMetadataVector(t,n){t.startVector(4,n,4)}static endFooter(t){return t.endObject()}static finishFooterBuffer(t,n){t.finish(n)}static finishSizePrefixedFooterBuffer(t,n){t.finish(n,void 0,!0)}};var re=class e{constructor(t=[],n,r,i=Ee.V5){this.fields=t||[],this.metadata=n||new Map,r||(r=n2(t)),this.dictionaries=r,this.metadataVersion=i}get[Symbol.toStringTag](){return"Schema"}get names(){return this.fields.map(t=>t.name)}toString(){return`Schema<{ ${this.fields.map((t,n)=>`${n}: ${t}`).join(", ")} }>`}select(t){let n=new Set(t),r=this.fields.filter(i=>n.has(i.name));return new e(r,this.metadata)}selectAt(t){let n=t.map(r=>this.fields[r]).filter(Boolean);return new e(n,this.metadata)}assign(...t){let n=t[0]instanceof e?t[0]:Array.isArray(t[0])?new e(t[0]):new e(t),r=[...this.fields],i=Qg(Qg(new Map,this.metadata),n.metadata),o=n.fields.filter(a=>{let c=r.findIndex(l=>l.name===a.name);return~c?(r[c]=a.clone({metadata:Qg(Qg(new Map,r[c].metadata),a.metadata)}))&&!1:!0}),s=n2(o,new Map);return new e([...r,...o],i,new Map([...this.dictionaries,...s]))}};re.prototype.fields=null;re.prototype.metadata=null;re.prototype.dictionaries=null;var Ut=class e{static new(...t){let[n,r,i,o]=t;return t[0]&&typeof t[0]=="object"&&({name:n}=t[0],r===void 0&&(r=t[0].type),i===void 0&&(i=t[0].nullable),o===void 0&&(o=t[0].metadata)),new e(`${n}`,r,i,o)}constructor(t,n,r=!1,i){this.name=t,this.type=n,this.nullable=r,this.metadata=i||new Map}get typeId(){return this.type.typeId}get[Symbol.toStringTag](){return"Field"}toString(){return`${this.name}: ${this.type}`}clone(...t){let[n,r,i,o]=t;return!t[0]||typeof t[0]!="object"?[n=this.name,r=this.type,i=this.nullable,o=this.metadata]=t:{name:n=this.name,type:r=this.type,nullable:i=this.nullable,metadata:o=this.metadata}=t[0],e.new(n,r,i,o)}};Ut.prototype.type=null;Ut.prototype.name=null;Ut.prototype.nullable=null;Ut.prototype.metadata=null;function Qg(e,t){return new Map([...e||new Map,...t||new Map])}function n2(e,t=new Map){for(let n=-1,r=e.length;++n<r;){let o=e[n].type;if(at.isDictionary(o)){if(!t.has(o.id))t.set(o.id,o.dictionary);else if(t.get(o.id)!==o.dictionary)throw new Error("Cannot create Schema containing two different dictionaries with the same Id")}o.children&&o.children.length>0&&n2(o.children,t)}return t}var Zq=Ec,Jq=Nr,as=class{static decode(t){t=new Jq(Ot(t));let n=Dr.getRootAsFooter(t),r=re.decode(n.schema(),new Map,n.version());return new r2(r,n)}static encode(t){let n=new Zq,r=re.encode(n,t.schema);Dr.startRecordBatchesVector(n,t.numRecordBatches);for(let s of[...t.recordBatches()].slice().reverse())cs.encode(n,s);let i=n.endVector();Dr.startDictionariesVector(n,t.numDictionaries);for(let s of[...t.dictionaryBatches()].slice().reverse())cs.encode(n,s);let o=n.endVector();return Dr.startFooter(n),Dr.addSchema(n,r),Dr.addVersion(n,Ee.V5),Dr.addRecordBatches(n,i),Dr.addDictionaries(n,o),Dr.finishFooterBuffer(n,Dr.endFooter(n)),n.asUint8Array()}get numRecordBatches(){return this._recordBatches.length}get numDictionaries(){return this._dictionaryBatches.length}constructor(t,n=Ee.V5,r,i){this.schema=t,this.version=n,r&&(this._recordBatches=r),i&&(this._dictionaryBatches=i)}*recordBatches(){for(let t,n=-1,r=this.numRecordBatches;++n<r;)(t=this.getRecordBatch(n))&&(yield t)}*dictionaryBatches(){for(let t,n=-1,r=this.numDictionaries;++n<r;)(t=this.getDictionaryBatch(n))&&(yield t)}getRecordBatch(t){return t>=0&&t<this.numRecordBatches&&this._recordBatches[t]||null}getDictionaryBatch(t){return t>=0&&t<this.numDictionaries&&this._dictionaryBatches[t]||null}};var r2=class extends as{get numRecordBatches(){return this._footer.recordBatchesLength()}get numDictionaries(){return this._footer.dictionariesLength()}constructor(t,n){super(t,n.version()),this._footer=n}getRecordBatch(t){if(t>=0&&t<this.numRecordBatches){let n=this._footer.recordBatches(t);if(n)return cs.decode(n)}return null}getDictionaryBatch(t){if(t>=0&&t<this.numDictionaries){let n=this._footer.dictionaries(t);if(n)return cs.decode(n)}return null}},cs=class e{static decode(t){return new e(t.metaDataLength(),t.bodyLength(),t.offset())}static encode(t,n){let{metaDataLength:r}=n,i=BigInt(n.offset),o=BigInt(n.bodyLength);return Tc.createBlock(t,i,r,o)}constructor(t,n,r){this.metaDataLength=t,this.offset=lr(r),this.bodyLength=lr(n)}};var ge=Object.freeze({done:!0,value:void 0}),ih=class{constructor(t){this._json=t}get schema(){return this._json.schema}get batches(){return this._json.batches||[]}get dictionaries(){return this._json.dictionaries||[]}},Nc=class{tee(){return this._getDOMStream().tee()}pipe(t,n){return this._getNodeStream().pipe(t,n)}pipeTo(t,n){return this._getDOMStream().pipeTo(t,n)}pipeThrough(t,n){return this._getDOMStream().pipeThrough(t,n)}_getDOMStream(){return this._DOMStream||(this._DOMStream=this.toDOMStream())}_getNodeStream(){return this._nodeStream||(this._nodeStream=this.toNodeStream())}},Kg=class extends Nc{constructor(){super(),this._values=[],this.resolvers=[],this._closedPromise=new Promise(t=>this._closedPromiseResolve=t)}get closed(){return this._closedPromise}cancel(t){return Z(this,void 0,void 0,function*(){yield this.return(t)})}write(t){this._ensureOpen()&&(this.resolvers.length<=0?this._values.push(t):this.resolvers.shift().resolve({done:!1,value:t}))}abort(t){this._closedPromiseResolve&&(this.resolvers.length<=0?this._error={error:t}:this.resolvers.shift().reject({done:!0,value:t}))}close(){if(this._closedPromiseResolve){let{resolvers:t}=this;for(;t.length>0;)t.shift().resolve(ge);this._closedPromiseResolve(),this._closedPromiseResolve=void 0}}[Symbol.asyncIterator](){return this}toDOMStream(t){return yn.toDOMStream(this._closedPromiseResolve||this._error?this:this._values,t)}toNodeStream(t){return yn.toNodeStream(this._closedPromiseResolve||this._error?this:this._values,t)}throw(t){return Z(this,void 0,void 0,function*(){return yield this.abort(t),ge})}return(t){return Z(this,void 0,void 0,function*(){return yield this.close(),ge})}read(t){return Z(this,void 0,void 0,function*(){return(yield this.next(t,"read")).value})}peek(t){return Z(this,void 0,void 0,function*(){return(yield this.next(t,"peek")).value})}next(...t){return this._values.length>0?Promise.resolve({done:!1,value:this._values.shift()}):this._error?Promise.reject({done:!0,value:this._error.error}):this._closedPromiseResolve?new Promise((n,r)=>{this.resolvers.push({resolve:n,reject:r})}):Promise.resolve(ge)}_ensureOpen(){if(this._closedPromiseResolve)return!0;throw new Error("AsyncQueue is closed")}};var io=class extends Kg{write(t){if((t=Ot(t)).byteLength>0)return super.write(t)}toString(t=!1){return t?Rd(this.toUint8Array(!0)):this.toUint8Array(!1).then(Rd)}toUint8Array(t=!1){return t?Mr(this._values)[0]:Z(this,void 0,void 0,function*(){var n,r,i,o;let s=[],a=0;try{for(var c=!0,l=bi(this),u;u=yield l.next(),n=u.done,!n;c=!0){o=u.value,c=!1;let f=o;s.push(f),a+=f.byteLength}}catch(f){r={error:f}}finally{try{!c&&!n&&(i=l.return)&&(yield i.call(l))}finally{if(r)throw r.error}}return Mr(s,a)[0]})}},oo=class{constructor(t){t&&(this.source=new i2(yn.fromIterable(t)))}[Symbol.iterator](){return this}next(t){return this.source.next(t)}throw(t){return this.source.throw(t)}return(t){return this.source.return(t)}peek(t){return this.source.peek(t)}read(t){return this.source.read(t)}},Zr=class e{constructor(t){t instanceof e?this.source=t.source:t instanceof io?this.source=new ls(yn.fromAsyncIterable(t)):ug(t)?this.source=new ls(yn.fromNodeStream(t)):$d(t)?this.source=new ls(yn.fromDOMStream(t)):cg(t)?this.source=new ls(yn.fromDOMStream(t.body)):wi(t)?this.source=new ls(yn.fromIterable(t)):Ir(t)?this.source=new ls(yn.fromAsyncIterable(t)):Gr(t)&&(this.source=new ls(yn.fromAsyncIterable(t)))}[Symbol.asyncIterator](){return this}next(t){return this.source.next(t)}throw(t){return this.source.throw(t)}return(t){return this.source.return(t)}get closed(){return this.source.closed}cancel(t){return this.source.cancel(t)}peek(t){return this.source.peek(t)}read(t){return this.source.read(t)}},i2=class{constructor(t){this.source=t}cancel(t){this.return(t)}peek(t){return this.next(t,"peek").value}read(t){return this.next(t,"read").value}next(t,n="read"){return this.source.next({cmd:n,size:t})}throw(t){return Object.create(this.source.throw&&this.source.throw(t)||ge)}return(t){return Object.create(this.source.return&&this.source.return(t)||ge)}},ls=class{constructor(t){this.source=t,this._closedPromise=new Promise(n=>this._closedPromiseResolve=n)}cancel(t){return Z(this,void 0,void 0,function*(){yield this.return(t)})}get closed(){return this._closedPromise}read(t){return Z(this,void 0,void 0,function*(){return(yield this.next(t,"read")).value})}peek(t){return Z(this,void 0,void 0,function*(){return(yield this.next(t,"peek")).value})}next(t,n="read"){return Z(this,void 0,void 0,function*(){return yield this.source.next({cmd:n,size:t})})}throw(t){return Z(this,void 0,void 0,function*(){let n=this.source.throw&&(yield this.source.throw(t))||ge;return this._closedPromiseResolve&&this._closedPromiseResolve(),this._closedPromiseResolve=void 0,Object.create(n)})}return(t){return Z(this,void 0,void 0,function*(){let n=this.source.return&&(yield this.source.return(t))||ge;return this._closedPromiseResolve&&this._closedPromiseResolve(),this._closedPromiseResolve=void 0,Object.create(n)})}};var oh=class extends oo{constructor(t,n){super(),this.position=0,this.buffer=Ot(t),this.size=n===void 0?this.buffer.byteLength:n}readInt32(t){let{buffer:n,byteOffset:r}=this.readAt(t,4);return new DataView(n,r).getInt32(0,!0)}seek(t){return this.position=Math.min(t,this.size),t<this.size}read(t){let{buffer:n,size:r,position:i}=this;return n&&i<r?(typeof t!="number"&&(t=Number.POSITIVE_INFINITY),this.position=Math.min(r,i+Math.min(r-i,t)),n.subarray(i,this.position)):null}readAt(t,n){let r=this.buffer,i=Math.min(this.size,t+n);return r?r.subarray(t,i):new Uint8Array(n)}close(){this.buffer&&(this.buffer=null)}throw(t){return this.close(),{done:!0,value:t}}return(t){return this.close(),{done:!0,value:t}}},Ma=class extends Zr{constructor(t,n){super(),this.position=0,this._handle=t,typeof n=="number"?this.size=n:this._pending=Z(this,void 0,void 0,function*(){this.size=(yield t.stat()).size,delete this._pending})}readInt32(t){return Z(this,void 0,void 0,function*(){let{buffer:n,byteOffset:r}=yield this.readAt(t,4);return new DataView(n,r).getInt32(0,!0)})}seek(t){return Z(this,void 0,void 0,function*(){return this._pending&&(yield this._pending),this.position=Math.min(t,this.size),t<this.size})}read(t){return Z(this,void 0,void 0,function*(){this._pending&&(yield this._pending);let{_handle:n,size:r,position:i}=this;if(n&&i<r){typeof t!="number"&&(t=Number.POSITIVE_INFINITY);let o=i,s=0,a=0,c=Math.min(r,o+Math.min(r-o,t)),l=new Uint8Array(Math.max(0,(this.position=c)-o));for(;(o+=a)<c&&(s+=a)<l.byteLength;)({bytesRead:a}=yield n.read(l,s,l.byteLength-s,o));return l}return null})}readAt(t,n){return Z(this,void 0,void 0,function*(){this._pending&&(yield this._pending);let{_handle:r,size:i}=this;if(r&&t+n<i){let o=Math.min(i,t+n),s=new Uint8Array(o-t);return(yield r.read(s,0,n,t)).buffer}return new Uint8Array(n)})}close(){return Z(this,void 0,void 0,function*(){let t=this._handle;this._handle=null,t&&(yield t.close())})}throw(t){return Z(this,void 0,void 0,function*(){return yield this.close(),{done:!0,value:t}})}return(t){return Z(this,void 0,void 0,function*(){return yield this.close(),{done:!0,value:t}})}};var s2={};_r(s2,{BaseInt64:()=>sh,Int128:()=>ah,Int64:()=>us,Uint64:()=>Ne});function uu(e){return e<0&&(e=4294967295+e+1),`0x${e.toString(16)}`}var fu=8,o2=[1,10,100,1e3,1e4,1e5,1e6,1e7,1e8],sh=class{constructor(t){this.buffer=t}high(){return this.buffer[1]}low(){return this.buffer[0]}_times(t){let n=new Uint32Array([this.buffer[1]>>>16,this.buffer[1]&65535,this.buffer[0]>>>16,this.buffer[0]&65535]),r=new Uint32Array([t.buffer[1]>>>16,t.buffer[1]&65535,t.buffer[0]>>>16,t.buffer[0]&65535]),i=n[3]*r[3];this.buffer[0]=i&65535;let o=i>>>16;return i=n[2]*r[3],o+=i,i=n[3]*r[2]>>>0,o+=i,this.buffer[0]+=o<<16,this.buffer[1]=o>>>0<i?65536:0,this.buffer[1]+=o>>>16,this.buffer[1]+=n[1]*r[3]+n[2]*r[2]+n[3]*r[1],this.buffer[1]+=n[0]*r[3]+n[1]*r[2]+n[2]*r[1]+n[3]*r[0]<<16,this}_plus(t){let n=this.buffer[0]+t.buffer[0]>>>0;this.buffer[1]+=t.buffer[1],n<this.buffer[0]>>>0&&++this.buffer[1],this.buffer[0]=n}lessThan(t){return this.buffer[1]<t.buffer[1]||this.buffer[1]===t.buffer[1]&&this.buffer[0]<t.buffer[0]}equals(t){return this.buffer[1]===t.buffer[1]&&this.buffer[0]==t.buffer[0]}greaterThan(t){return t.lessThan(this)}hex(){return`${uu(this.buffer[1])} ${uu(this.buffer[0])}`}},Ne=class e extends sh{times(t){return this._times(t),this}plus(t){return this._plus(t),this}static from(t,n=new Uint32Array(2)){return e.fromString(typeof t=="string"?t:t.toString(),n)}static fromNumber(t,n=new Uint32Array(2)){return e.fromString(t.toString(),n)}static fromString(t,n=new Uint32Array(2)){let r=t.length,i=new e(n);for(let o=0;o<r;){let s=fu<r-o?fu:r-o,a=new e(new Uint32Array([Number.parseInt(t.slice(o,o+s),10),0])),c=new e(new Uint32Array([o2[s],0]));i.times(c),i.plus(a),o+=s}return i}static convertArray(t){let n=new Uint32Array(t.length*2);for(let r=-1,i=t.length;++r<i;)e.from(t[r],new Uint32Array(n.buffer,n.byteOffset+2*r*4,2));return n}static multiply(t,n){return new e(new Uint32Array(t.buffer)).times(n)}static add(t,n){return new e(new Uint32Array(t.buffer)).plus(n)}},us=class e extends sh{negate(){return this.buffer[0]=~this.buffer[0]+1,this.buffer[1]=~this.buffer[1],this.buffer[0]==0&&++this.buffer[1],this}times(t){return this._times(t),this}plus(t){return this._plus(t),this}lessThan(t){let n=this.buffer[1]<<0,r=t.buffer[1]<<0;return n<r||n===r&&this.buffer[0]<t.buffer[0]}static from(t,n=new Uint32Array(2)){return e.fromString(typeof t=="string"?t:t.toString(),n)}static fromNumber(t,n=new Uint32Array(2)){return e.fromString(t.toString(),n)}static fromString(t,n=new Uint32Array(2)){let r=t.startsWith("-"),i=t.length,o=new e(n);for(let s=r?1:0;s<i;){let a=fu<i-s?fu:i-s,c=new e(new Uint32Array([Number.parseInt(t.slice(s,s+a),10),0])),l=new e(new Uint32Array([o2[a],0]));o.times(l),o.plus(c),s+=a}return r?o.negate():o}static convertArray(t){let n=new Uint32Array(t.length*2);for(let r=-1,i=t.length;++r<i;)e.from(t[r],new Uint32Array(n.buffer,n.byteOffset+2*r*4,2));return n}static multiply(t,n){return new e(new Uint32Array(t.buffer)).times(n)}static add(t,n){return new e(new Uint32Array(t.buffer)).plus(n)}},ah=class e{constructor(t){this.buffer=t}high(){return new us(new Uint32Array(this.buffer.buffer,this.buffer.byteOffset+8,2))}low(){return new us(new Uint32Array(this.buffer.buffer,this.buffer.byteOffset,2))}negate(){return this.buffer[0]=~this.buffer[0]+1,this.buffer[1]=~this.buffer[1],this.buffer[2]=~this.buffer[2],this.buffer[3]=~this.buffer[3],this.buffer[0]==0&&++this.buffer[1],this.buffer[1]==0&&++this.buffer[2],this.buffer[2]==0&&++this.buffer[3],this}times(t){let n=new Ne(new Uint32Array([this.buffer[3],0])),r=new Ne(new Uint32Array([this.buffer[2],0])),i=new Ne(new Uint32Array([this.buffer[1],0])),o=new Ne(new Uint32Array([this.buffer[0],0])),s=new Ne(new Uint32Array([t.buffer[3],0])),a=new Ne(new Uint32Array([t.buffer[2],0])),c=new Ne(new Uint32Array([t.buffer[1],0])),l=new Ne(new Uint32Array([t.buffer[0],0])),u=Ne.multiply(o,l);this.buffer[0]=u.low();let f=new Ne(new Uint32Array([u.high(),0]));return u=Ne.multiply(i,l),f.plus(u),u=Ne.multiply(o,c),f.plus(u),this.buffer[1]=f.low(),this.buffer[3]=f.lessThan(u)?1:0,this.buffer[2]=f.high(),new Ne(new Uint32Array(this.buffer.buffer,this.buffer.byteOffset+8,2)).plus(Ne.multiply(r,l)).plus(Ne.multiply(i,c)).plus(Ne.multiply(o,a)),this.buffer[3]+=Ne.multiply(n,l).plus(Ne.multiply(r,c)).plus(Ne.multiply(i,a)).plus(Ne.multiply(o,s)).low(),this}plus(t){let n=new Uint32Array(4);return n[3]=this.buffer[3]+t.buffer[3]>>>0,n[2]=this.buffer[2]+t.buffer[2]>>>0,n[1]=this.buffer[1]+t.buffer[1]>>>0,n[0]=this.buffer[0]+t.buffer[0]>>>0,n[0]<this.buffer[0]>>>0&&++n[1],n[1]<this.buffer[1]>>>0&&++n[2],n[2]<this.buffer[2]>>>0&&++n[3],this.buffer[3]=n[3],this.buffer[2]=n[2],this.buffer[1]=n[1],this.buffer[0]=n[0],this}hex(){return`${uu(this.buffer[3])} ${uu(this.buffer[2])} ${uu(this.buffer[1])} ${uu(this.buffer[0])}`}static multiply(t,n){return new e(new Uint32Array(t.buffer)).times(n)}static add(t,n){return new e(new Uint32Array(t.buffer)).plus(n)}static from(t,n=new Uint32Array(4)){return e.fromString(typeof t=="string"?t:t.toString(),n)}static fromNumber(t,n=new Uint32Array(4)){return e.fromString(t.toString(),n)}static fromString(t,n=new Uint32Array(4)){let r=t.startsWith("-"),i=t.length,o=new e(n);for(let s=r?1:0;s<i;){let a=fu<i-s?fu:i-s,c=new e(new Uint32Array([Number.parseInt(t.slice(s,s+a),10),0,0,0])),l=new e(new Uint32Array([o2[a],0,0,0]));o.times(l),o.plus(c),s+=a}return r?o.negate():o}static convertArray(t){let n=new Uint32Array(t.length*4);for(let r=-1,i=t.length;++r<i;)e.from(t[r],new Uint32Array(n.buffer,n.byteOffset+4*4*r,4));return n}};var ch=class extends ut{constructor(t,n,r,i,o=Ee.V5){super(),this.nodesIndex=-1,this.buffersIndex=-1,this.bytes=t,this.nodes=n,this.buffers=r,this.dictionaries=i,this.metadataVersion=o}visit(t){return super.visit(t instanceof Ut?t.type:t)}visitNull(t,{length:n}=this.nextFieldNode()){return Bt({type:t,length:n})}visitBool(t,{length:n,nullCount:r}=this.nextFieldNode()){return Bt({type:t,length:n,nullCount:r,nullBitmap:this.readNullBitmap(t,r),data:this.readData(t)})}visitInt(t,{length:n,nullCount:r}=this.nextFieldNode()){return Bt({type:t,length:n,nullCount:r,nullBitmap:this.readNullBitmap(t,r),data:this.readData(t)})}visitFloat(t,{length:n,nullCount:r}=this.nextFieldNode()){return Bt({type:t,length:n,nullCount:r,nullBitmap:this.readNullBitmap(t,r),data:this.readData(t)})}visitUtf8(t,{length:n,nullCount:r}=this.nextFieldNode()){return Bt({type:t,length:n,nullCount:r,nullBitmap:this.readNullBitmap(t,r),valueOffsets:this.readOffsets(t),data:this.readData(t)})}visitBinary(t,{length:n,nullCount:r}=this.nextFieldNode()){return Bt({type:t,length:n,nullCount:r,nullBitmap:this.readNullBitmap(t,r),valueOffsets:this.readOffsets(t),data:this.readData(t)})}visitFixedSizeBinary(t,{length:n,nullCount:r}=this.nextFieldNode()){return Bt({type:t,length:n,nullCount:r,nullBitmap:this.readNullBitmap(t,r),data:this.readData(t)})}visitDate(t,{length:n,nullCount:r}=this.nextFieldNode()){return Bt({type:t,length:n,nullCount:r,nullBitmap:this.readNullBitmap(t,r),data:this.readData(t)})}visitTimestamp(t,{length:n,nullCount:r}=this.nextFieldNode()){return Bt({type:t,length:n,nullCount:r,nullBitmap:this.readNullBitmap(t,r),data:this.readData(t)})}visitTime(t,{length:n,nullCount:r}=this.nextFieldNode()){return Bt({type:t,length:n,nullCount:r,nullBitmap:this.readNullBitmap(t,r),data:this.readData(t)})}visitDecimal(t,{length:n,nullCount:r}=this.nextFieldNode()){return Bt({type:t,length:n,nullCount:r,nullBitmap:this.readNullBitmap(t,r),data:this.readData(t)})}visitList(t,{length:n,nullCount:r}=this.nextFieldNode()){return Bt({type:t,length:n,nullCount:r,nullBitmap:this.readNullBitmap(t,r),valueOffsets:this.readOffsets(t),child:this.visit(t.children[0])})}visitStruct(t,{length:n,nullCount:r}=this.nextFieldNode()){return Bt({type:t,length:n,nullCount:r,nullBitmap:this.readNullBitmap(t,r),children:this.visitMany(t.children)})}visitUnion(t,{length:n,nullCount:r}=this.nextFieldNode()){return this.metadataVersion<Ee.V5&&this.readNullBitmap(t,r),t.mode===xe.Sparse?this.visitSparseUnion(t,{length:n,nullCount:r}):this.visitDenseUnion(t,{length:n,nullCount:r})}visitDenseUnion(t,{length:n,nullCount:r}=this.nextFieldNode()){return Bt({type:t,length:n,nullCount:r,typeIds:this.readTypeIds(t),valueOffsets:this.readOffsets(t),children:this.visitMany(t.children)})}visitSparseUnion(t,{length:n,nullCount:r}=this.nextFieldNode()){return Bt({type:t,length:n,nullCount:r,typeIds:this.readTypeIds(t),children:this.visitMany(t.children)})}visitDictionary(t,{length:n,nullCount:r}=this.nextFieldNode()){return Bt({type:t,length:n,nullCount:r,nullBitmap:this.readNullBitmap(t,r),data:this.readData(t.indices),dictionary:this.readDictionary(t)})}visitInterval(t,{length:n,nullCount:r}=this.nextFieldNode()){return Bt({type:t,length:n,nullCount:r,nullBitmap:this.readNullBitmap(t,r),data:this.readData(t)})}visitDuration(t,{length:n,nullCount:r}=this.nextFieldNode()){return Bt({type:t,length:n,nullCount:r,nullBitmap:this.readNullBitmap(t,r),data:this.readData(t)})}visitFixedSizeList(t,{length:n,nullCount:r}=this.nextFieldNode()){return Bt({type:t,length:n,nullCount:r,nullBitmap:this.readNullBitmap(t,r),child:this.visit(t.children[0])})}visitMap(t,{length:n,nullCount:r}=this.nextFieldNode()){return Bt({type:t,length:n,nullCount:r,nullBitmap:this.readNullBitmap(t,r),valueOffsets:this.readOffsets(t),child:this.visit(t.children[0])})}nextFieldNode(){return this.nodes[++this.nodesIndex]}nextBufferRange(){return this.buffers[++this.buffersIndex]}readNullBitmap(t,n,r=this.nextBufferRange()){return n>0&&this.readData(t,r)||new Uint8Array(0)}readOffsets(t,n){return this.readData(t,n)}readTypeIds(t,n){return this.readData(t,n)}readData(t,{length:n,offset:r}=this.nextBufferRange()){return this.bytes.subarray(r,r+n)}readDictionary(t){return this.dictionaries.get(t.id)}},t0=class extends ch{constructor(t,n,r,i,o){super(new Uint8Array(0),n,r,i,o),this.sources=t}readNullBitmap(t,n,{offset:r}=this.nextBufferRange()){return n<=0?new Uint8Array(0):Mc(this.sources[r])}readOffsets(t,{offset:n}=this.nextBufferRange()){return Pt(Uint8Array,Pt(Int32Array,this.sources[n]))}readTypeIds(t,{offset:n}=this.nextBufferRange()){return Pt(Uint8Array,Pt(t.ArrayType,this.sources[n]))}readData(t,{offset:n}=this.nextBufferRange()){let{sources:r}=this;return at.isTimestamp(t)?Pt(Uint8Array,us.convertArray(r[n])):(at.isInt(t)||at.isTime(t))&&t.bitWidth===64||at.isDuration(t)?Pt(Uint8Array,us.convertArray(r[n])):at.isDate(t)&&t.unit===On.MILLISECOND?Pt(Uint8Array,us.convertArray(r[n])):at.isDecimal(t)?Pt(Uint8Array,ah.convertArray(r[n])):at.isBinary(t)||at.isFixedSizeBinary(t)?Qq(r[n]):at.isBool(t)?Mc(r[n]):at.isUtf8(t)?ua(r[n].join("")):Pt(Uint8Array,Pt(t.ArrayType,r[n].map(i=>+i)))}};function Qq(e){let t=e.join(""),n=new Uint8Array(t.length/2);for(let r=0;r<t.length;r+=2)n[r>>1]=Number.parseInt(t.slice(r,r+2),16);return n}var du=class extends to{constructor(t){super(t),this._values=new ma(new Uint8Array(0))}get byteLength(){let t=this._pendingLength+this.length*4;return this._offsets&&(t+=this._offsets.byteLength),this._values&&(t+=this._values.byteLength),this._nulls&&(t+=this._nulls.byteLength),t}setValue(t,n){return super.setValue(t,Ot(n))}_flushPending(t,n){let r=this._offsets,i=this._values.reserve(n).buffer,o=0;for(let[s,a]of t)if(a===void 0)r.set(s,0);else{let c=a.length;i.set(a,o),r.set(s,c),o+=c}}};var e0=class extends be{constructor(t){super(t),this._values=new au}setValue(t,n){this._values.set(t,+n)}};var Dc=class extends Ve{};Dc.prototype._setValue=P_;var lh=class extends Dc{};lh.prototype._setValue=Ig;var uh=class extends Dc{};uh.prototype._setValue=Mg;var fh=class extends Ve{};fh.prototype._setValue=q_;var n0=class extends be{constructor({type:t,nullValues:n,dictionaryHashFunction:r}){super({type:new Ar(t.dictionary,t.indices,t.id,t.isOrdered)}),this._nulls=null,this._dictionaryOffset=0,this._keysToIndices=Object.create(null),this.indices=Oc({type:this.type.indices,nullValues:n}),this.dictionary=Oc({type:this.type.dictionary,nullValues:null}),typeof r=="function"&&(this.valueToKey=r)}get values(){return this.indices.values}get nullCount(){return this.indices.nullCount}get nullBitmap(){return this.indices.nullBitmap}get byteLength(){return this.indices.byteLength+this.dictionary.byteLength}get reservedLength(){return this.indices.reservedLength+this.dictionary.reservedLength}get reservedByteLength(){return this.indices.reservedByteLength+this.dictionary.reservedByteLength}isValid(t){return this.indices.isValid(t)}setValid(t,n){let r=this.indices;return n=r.setValid(t,n),this.length=r.length,n}setValue(t,n){let r=this._keysToIndices,i=this.valueToKey(n),o=r[i];return o===void 0&&(r[i]=o=this._dictionaryOffset+this.dictionary.append(n).length-1),this.indices.setValue(t,o)}flush(){let t=this.type,n=this._dictionary,r=this.dictionary.toVector(),i=this.indices.flush().clone(t);return i.dictionary=n?n.concat(r):r,this.finished||(this._dictionaryOffset+=r.length),this._dictionary=i.dictionary,this.clear(),i}finish(){return this.indices.finish(),this.dictionary.finish(),this._dictionaryOffset=0,this._keysToIndices=Object.create(null),super.finish()}clear(){return this.indices.clear(),this.dictionary.clear(),super.clear()}valueToKey(t){return typeof t=="string"?t:`${t}`}};var dh=class extends Ve{};dh.prototype._setValue=$_;var r0=class extends be{setValue(t,n){let[r]=this.children,i=t*this.stride;for(let o=-1,s=n.length;++o<s;)r.set(i+o,n[o])}addChild(t,n="0"){if(this.numChildren>0)throw new Error("FixedSizeListBuilder can only have one child.");let r=this.children.push(t);return this.type=new Ei(this.type.listSize,new Ut(n,t.type,!0)),r}};var Bc=class extends Ve{setValue(t,n){this._values.set(t,n)}},i0=class extends Bc{setValue(t,n){super.setValue(t,zd(n))}},o0=class extends Bc{},s0=class extends Bc{};var Lc=class extends Ve{};Lc.prototype._setValue=j_;var hh=class extends Lc{};hh.prototype._setValue=Cg;var ph=class extends Lc{};ph.prototype._setValue=kg;var fs=class extends Ve{};fs.prototype._setValue=V_;var mh=class extends fs{};mh.prototype._setValue=Fg;var yh=class extends fs{};yh.prototype._setValue=Rg;var gh=class extends fs{};gh.prototype._setValue=$g;var xh=class extends fs{};xh.prototype._setValue=Pg;var Jr=class extends Ve{setValue(t,n){this._values.set(t,n)}},a0=class extends Jr{},c0=class extends Jr{},l0=class extends Jr{},u0=class extends Jr{},f0=class extends Jr{},d0=class extends Jr{},h0=class extends Jr{},p0=class extends Jr{};var m0=class extends to{constructor(t){super(t),this._offsets=new cu}addChild(t,n="0"){if(this.numChildren>0)throw new Error("ListBuilder can only have one child.");return this.children[this.numChildren]=t,this.type=new Ai(new Ut(n,t.type,!0)),this.numChildren-1}_flushPending(t){let n=this._offsets,[r]=this.children;for(let[i,o]of t)if(typeof o>"u")n.set(i,0);else{let s=o,a=s.length,c=n.set(i,a).buffer[i];for(let l=-1;++l<a;)r.set(c+l,s[l])}}};var y0=class extends to{set(t,n){return super.set(t,n)}setValue(t,n){let r=n instanceof Map?n:new Map(Object.entries(n)),i=this._pending||(this._pending=new Map),o=i.get(t);o&&(this._pendingLength-=o.size),this._pendingLength+=r.size,i.set(t,r)}addChild(t,n=`${this.numChildren}`){if(this.numChildren>0)throw new Error("ListBuilder can only have one child.");return this.children[this.numChildren]=t,this.type=new Ni(new Ut(n,t.type,!0),this.type.keysSorted),this.numChildren-1}_flushPending(t){let n=this._offsets,[r]=this.children;for(let[i,o]of t)if(o===void 0)n.set(i,0);else{let{[i]:s,[i+1]:a}=n.set(i,o.size).buffer;for(let c of o.entries())if(r.set(s,c),++s>=a)break}}};var g0=class extends be{setValue(t,n){}setValid(t,n){return this.length=Math.max(t+1,this.length),n}};var x0=class extends be{setValue(t,n){let{children:r,type:i}=this;switch(Array.isArray(n)||n.constructor){case!0:return i.children.forEach((o,s)=>r[s].set(t,n[s]));case Map:return i.children.forEach((o,s)=>r[s].set(t,n.get(o.name)));default:return i.children.forEach((o,s)=>r[s].set(t,n[o.name]))}}setValid(t,n){return super.setValid(t,n)||this.children.forEach(r=>r.setValid(t,n)),n}addChild(t,n=`${this.numChildren}`){let r=this.children.push(t);return this.type=new me([...this.type.children,new Ut(n,t.type,!0)]),r}};var ds=class extends Ve{};ds.prototype._setValue=U_;var bh=class extends ds{};bh.prototype._setValue=Ag;var wh=class extends ds{};wh.prototype._setValue=Tg;var vh=class extends ds{};vh.prototype._setValue=Eg;var _h=class extends ds{};_h.prototype._setValue=Ng;var hs=class extends Ve{};hs.prototype._setValue=z_;var Sh=class extends hs{};Sh.prototype._setValue=Dg;var Ih=class extends hs{};Ih.prototype._setValue=Og;var Mh=class extends hs{};Mh.prototype._setValue=Bg;var Ah=class extends hs{};Ah.prototype._setValue=Lg;var hu=class extends be{constructor(t){super(t),this._typeIds=new is(new Int8Array(0),1),typeof t.valueToChildTypeId=="function"&&(this._valueToChildTypeId=t.valueToChildTypeId)}get typeIdToChildIndex(){return this.type.typeIdToChildIndex}append(t,n){return this.set(this.length,t,n)}set(t,n,r){return r===void 0&&(r=this._valueToChildTypeId(this,n,t)),this.setValue(t,n,r),this}setValue(t,n,r){this._typeIds.set(t,r);let i=this.type.typeIdToChildIndex[r],o=this.children[i];o?.set(t,n)}addChild(t,n=`${this.children.length}`){let r=this.children.push(t),{type:{children:i,mode:o,typeIds:s}}=this,a=[...i,new Ut(n,t.type)];return this.type=new Ti(o,[...s,r],a),r}_valueToChildTypeId(t,n,r){throw new Error("Cannot map UnionBuilder value to child typeId. Pass the `childTypeId` as the second argument to unionBuilder.append(), or supply a `valueToChildTypeId` function as part of the UnionBuilder constructor options.")}},b0=class extends hu{},w0=class extends hu{constructor(t){super(t),this._offsets=new is(new Int32Array(0))}setValue(t,n,r){let i=this._typeIds.set(t,r).buffer[t],o=this.getChildAt(this.type.typeIdToChildIndex[i]),s=this._offsets.set(t,o.length).buffer[t];o?.set(s,n)}};var Th=class extends to{constructor(t){super(t),this._values=new ma(new Uint8Array(0))}get byteLength(){let t=this._pendingLength+this.length*4;return this._offsets&&(t+=this._offsets.byteLength),this._values&&(t+=this._values.byteLength),this._nulls&&(t+=this._nulls.byteLength),t}setValue(t,n){return super.setValue(t,ua(n))}_flushPending(t,n){}};Th.prototype._flushPending=du.prototype._flushPending;var a2=class extends ut{visitNull(){return g0}visitBool(){return e0}visitInt(){return Jr}visitInt8(){return a0}visitInt16(){return c0}visitInt32(){return l0}visitInt64(){return u0}visitUint8(){return f0}visitUint16(){return d0}visitUint32(){return h0}visitUint64(){return p0}visitFloat(){return Bc}visitFloat16(){return i0}visitFloat32(){return o0}visitFloat64(){return s0}visitUtf8(){return Th}visitBinary(){return du}visitFixedSizeBinary(){return dh}visitDate(){return Dc}visitDateDay(){return lh}visitDateMillisecond(){return uh}visitTimestamp(){return ds}visitTimestampSecond(){return bh}visitTimestampMillisecond(){return wh}visitTimestampMicrosecond(){return vh}visitTimestampNanosecond(){return _h}visitTime(){return hs}visitTimeSecond(){return Sh}visitTimeMillisecond(){return Ih}visitTimeMicrosecond(){return Mh}visitTimeNanosecond(){return Ah}visitDecimal(){return fh}visitList(){return m0}visitStruct(){return x0}visitUnion(){return hu}visitDenseUnion(){return w0}visitSparseUnion(){return b0}visitDictionary(){return n0}visitInterval(){return Lc}visitIntervalDayTime(){return hh}visitIntervalYearMonth(){return ph}visitDuration(){return fs}visitDurationSecond(){return mh}visitDurationMillisecond(){return yh}visitDurationMicrosecond(){return gh}visistDurationNanosecond(){return xh}visitFixedSizeList(){return r0}visitMap(){return y0}},UO=new a2;var wt=class extends ut{compareSchemas(t,n){return t===n||n instanceof t.constructor&&this.compareManyFields(t.fields,n.fields)}compareManyFields(t,n){return t===n||Array.isArray(t)&&Array.isArray(n)&&t.length===n.length&&t.every((r,i)=>this.compareFields(r,n[i]))}compareFields(t,n){return t===n||n instanceof t.constructor&&t.name===n.name&&t.nullable===n.nullable&&this.visit(t.type,n.type)}};function Vn(e,t){return t instanceof e.constructor}function Eh(e,t){return e===t||Vn(e,t)}function ps(e,t){return e===t||Vn(e,t)&&e.bitWidth===t.bitWidth&&e.isSigned===t.isSigned}function v0(e,t){return e===t||Vn(e,t)&&e.precision===t.precision}function Kq(e,t){return e===t||Vn(e,t)&&e.byteWidth===t.byteWidth}function c2(e,t){return e===t||Vn(e,t)&&e.unit===t.unit}function Nh(e,t){return e===t||Vn(e,t)&&e.unit===t.unit&&e.timezone===t.timezone}function Dh(e,t){return e===t||Vn(e,t)&&e.unit===t.unit&&e.bitWidth===t.bitWidth}function tj(e,t){return e===t||Vn(e,t)&&e.children.length===t.children.length&&so.compareManyFields(e.children,t.children)}function ej(e,t){return e===t||Vn(e,t)&&e.children.length===t.children.length&&so.compareManyFields(e.children,t.children)}function l2(e,t){return e===t||Vn(e,t)&&e.mode===t.mode&&e.typeIds.every((n,r)=>n===t.typeIds[r])&&so.compareManyFields(e.children,t.children)}function nj(e,t){return e===t||Vn(e,t)&&e.id===t.id&&e.isOrdered===t.isOrdered&&so.visit(e.indices,t.indices)&&so.visit(e.dictionary,t.dictionary)}function u2(e,t){return e===t||Vn(e,t)&&e.unit===t.unit}function Oh(e,t){return e===t||Vn(e,t)&&e.unit===t.unit}function rj(e,t){return e===t||Vn(e,t)&&e.listSize===t.listSize&&e.children.length===t.children.length&&so.compareManyFields(e.children,t.children)}function ij(e,t){return e===t||Vn(e,t)&&e.keysSorted===t.keysSorted&&e.children.length===t.children.length&&so.compareManyFields(e.children,t.children)}wt.prototype.visitNull=Eh;wt.prototype.visitBool=Eh;wt.prototype.visitInt=ps;wt.prototype.visitInt8=ps;wt.prototype.visitInt16=ps;wt.prototype.visitInt32=ps;wt.prototype.visitInt64=ps;wt.prototype.visitUint8=ps;wt.prototype.visitUint16=ps;wt.prototype.visitUint32=ps;wt.prototype.visitUint64=ps;wt.prototype.visitFloat=v0;wt.prototype.visitFloat16=v0;wt.prototype.visitFloat32=v0;wt.prototype.visitFloat64=v0;wt.prototype.visitUtf8=Eh;wt.prototype.visitBinary=Eh;wt.prototype.visitFixedSizeBinary=Kq;wt.prototype.visitDate=c2;wt.prototype.visitDateDay=c2;wt.prototype.visitDateMillisecond=c2;wt.prototype.visitTimestamp=Nh;wt.prototype.visitTimestampSecond=Nh;wt.prototype.visitTimestampMillisecond=Nh;wt.prototype.visitTimestampMicrosecond=Nh;wt.prototype.visitTimestampNanosecond=Nh;wt.prototype.visitTime=Dh;wt.prototype.visitTimeSecond=Dh;wt.prototype.visitTimeMillisecond=Dh;wt.prototype.visitTimeMicrosecond=Dh;wt.prototype.visitTimeNanosecond=Dh;wt.prototype.visitDecimal=Eh;wt.prototype.visitList=tj;wt.prototype.visitStruct=ej;wt.prototype.visitUnion=l2;wt.prototype.visitDenseUnion=l2;wt.prototype.visitSparseUnion=l2;wt.prototype.visitDictionary=nj;wt.prototype.visitInterval=u2;wt.prototype.visitIntervalDayTime=u2;wt.prototype.visitIntervalYearMonth=u2;wt.prototype.visitDuration=Oh;wt.prototype.visitDurationSecond=Oh;wt.prototype.visitDurationMillisecond=Oh;wt.prototype.visitDurationMicrosecond=Oh;wt.prototype.visitDurationNanosecond=Oh;wt.prototype.visitFixedSizeList=rj;wt.prototype.visitMap=ij;var so=new wt;function Cc(e,t){return so.compareSchemas(e,t)}function zO(e,t){return so.compareFields(e,t)}function qO(e,t){return so.visit(e,t)}function Oc(e){let t=e.type,n=new(UO.getVisitFn(t)())(e);if(t.children&&t.children.length>0){let r=e.children||[],i={nullValues:e.nullValues},o=Array.isArray(r)?(s,a)=>r[a]||i:({name:s})=>r[s]||i;for(let[s,a]of t.children.entries()){let{type:c}=a,l=o(a,s);n.children.push(Oc(Object.assign(Object.assign({},l),{type:c})))}}return n}function _0(e,t){return oj(e,t.map(n=>n.data.concat()))}function oj(e,t){let n=[...e.fields],r=[],i={numBatches:t.reduce((f,d)=>Math.max(f,d.length),0)},o=0,s=0,a=-1,c=t.length,l,u=[];for(;i.numBatches-- >0;){for(s=Number.POSITIVE_INFINITY,a=-1;++a<c;)u[a]=l=t[a].shift(),s=Math.min(s,l?l.length:s);Number.isFinite(s)&&(u=sj(n,s,u,t,i),s>0&&(r[o++]=Bt({type:new me(n),length:s,nullCount:0,children:u.slice()})))}return[e=e.assign(n),r.map(f=>new Le(e,f))]}function sj(e,t,n,r,i){var o;let s=(t+63&-64)>>3;for(let a=-1,c=r.length;++a<c;){let l=n[a],u=l?.length;if(u>=t)u===t?n[a]=l:(n[a]=l.slice(0,t),i.numBatches=Math.max(i.numBatches,r[a].unshift(l.slice(t,u-t))));else{let f=e[a];e[a]=f.clone({nullable:!0}),n[a]=(o=l?._changeLengthAndBackfillNullBitmap(t))!==null&&o!==void 0?o:Bt({type:f.type,length:t,nullCount:t,nullBitmap:new Uint8Array(s)})}}return n}var jO,dr=class e{constructor(...t){var n,r;if(t.length===0)return this.batches=[],this.schema=new re([]),this._offsets=[0],this;let i,o;t[0]instanceof re&&(i=t.shift()),t.at(-1)instanceof Uint32Array&&(o=t.pop());let s=c=>{if(c){if(c instanceof Le)return[c];if(c instanceof e)return c.batches;if(c instanceof se){if(c.type instanceof me)return[new Le(new re(c.type.children),c)]}else{if(Array.isArray(c))return c.flatMap(l=>s(l));if(typeof c[Symbol.iterator]=="function")return[...c].flatMap(l=>s(l));if(typeof c=="object"){let l=Object.keys(c),u=l.map(h=>new Yt([c[h]])),f=new re(l.map((h,p)=>new Ut(String(h),u[p].type))),[,d]=_0(f,u);return d.length===0?[new Le(c)]:d}}}return[]},a=t.flatMap(c=>s(c));if(i=(r=i??((n=a[0])===null||n===void 0?void 0:n.schema))!==null&&r!==void 0?r:new re([]),!(i instanceof re))throw new TypeError("Table constructor expects a [Schema, RecordBatch[]] pair.");for(let c of a){if(!(c instanceof Le))throw new TypeError("Table constructor expects a [Schema, RecordBatch[]] pair.");if(!Cc(i,c.schema))throw new TypeError("Table and inner RecordBatch schemas must be equivalent.")}this.schema=i,this.batches=a,this._offsets=o??Vg(this.data)}get data(){return this.batches.map(({data:t})=>t)}get numCols(){return this.schema.fields.length}get numRows(){return this.data.reduce((t,n)=>t+n.length,0)}get nullCount(){return this._nullCount===-1&&(this._nullCount=jg(this.data)),this._nullCount}isValid(t){return!1}get(t){return null}set(t,n){}indexOf(t,n){return-1}getByteLength(t){return 0}[Symbol.iterator](){return this.batches.length>0?su.visit(new Yt(this.data)):new Array(0)[Symbol.iterator]()}toArray(){return[...this]}toString(){return`[
8
8
  ${this.toArray().join(`,
9
9
  `)}
10
- ]`}concat(...t){let n=this.schema,r=this.data.concat(t.flatMap(({data:i})=>i));return new e(n,r.map(i=>new Le(n,i)))}slice(t,n){let r=this.schema;[t,n]=zd({length:this.numRows},t,n);let i=Vg(this.data,this._offsets,t,n);return new e(r,i.map(o=>new Le(r,o)))}getChild(t){return this.getChildAt(this.schema.fields.findIndex(n=>n.name===t))}getChildAt(t){if(t>-1&&t<this.schema.fields.length){let n=this.data.map(r=>r.children[t]);if(n.length===0){let{type:r}=this.schema.fields[t],i=Bt({type:r,length:0,nullCount:0});n.push(i._changeLengthAndBackfillNullBitmap(this.numRows))}return new Vt(n)}return null}setChild(t,n){var r;return this.setChildAt((r=this.schema.fields)===null||r===void 0?void 0:r.findIndex(i=>i.name===t),n)}setChildAt(t,n){let r=this.schema,i=[...this.batches];if(t>-1&&t<this.numCols){n||(n=new Vt([Bt({type:new jn,length:this.numRows})]));let o=r.fields.slice(),s=o[t].clone({type:n.type}),a=this.schema.fields.map((c,l)=>this.getChildAt(l));[o[t],a[t]]=[s,n],[r,i]=v0(r,a)}return new e(r,i)}select(t){let n=this.schema.fields.reduce((r,i,o)=>r.set(i.name,o),new Map);return this.selectAt(t.map(r=>n.get(r)).filter(r=>r>-1))}selectAt(t){let n=this.schema.selectAt(t),r=this.batches.map(i=>i.selectAt(t));return new e(n,r)}assign(t){let n=this.schema.fields,[r,i]=t.schema.fields.reduce((a,c,l)=>{let[u,f]=a,d=n.findIndex(h=>h.name===c.name);return~d?f[d]=l:u.push(l),a},[[],[]]),o=this.schema.assign(t.schema),s=[...n.map((a,c)=>[c,i[c]]).map(([a,c])=>c===void 0?this.getChildAt(a):t.getChildAt(c)),...r.map(a=>t.getChildAt(a))].filter(Boolean);return new e(...v0(o,s))}};bO=Symbol.toStringTag;ur[bO]=(e=>(e.schema=null,e.batches=[],e._offsets=new Uint32Array([0]),e._nullCount=-1,e[Symbol.isConcatSpreadable]=!0,e.isValid=da(Vd),e.get=da(qe.getVisitFn(L.Struct)),e.set=Yg(xn.getVisitFn(L.Struct)),e.indexOf=Xg(Ic.getVisitFn(L.Struct)),e.getByteLength=da(Tr.getVisitFn(L.Struct)),"Table"))(ur.prototype);var vO,Le=class e{constructor(...t){switch(t.length){case 2:{if([this.schema]=t,!(this.schema instanceof re))throw new TypeError("RecordBatch constructor expects a [Schema, Data] pair.");if([,this.data=Bt({nullCount:0,type:new me(this.schema.fields),children:this.schema.fields.map(n=>Bt({type:n.type,nullCount:0}))})]=t,!(this.data instanceof se))throw new TypeError("RecordBatch constructor expects a [Schema, Data] pair.");[this.schema,this.data]=wO(this.schema,this.data.children);break}case 1:{let[n]=t,{fields:r,children:i,length:o}=Object.keys(n).reduce((c,l,u)=>(c.children[u]=n[l],c.length=Math.max(c.length,n[l].length),c.fields[u]=Ut.new({name:l,type:n[l].type,nullable:!0}),c),{length:0,fields:new Array,children:new Array}),s=new re(r),a=Bt({type:new me(r),length:o,children:i,nullCount:0});[this.schema,this.data]=wO(s,a.children,o);break}default:throw new TypeError("RecordBatch constructor expects an Object mapping names to child Data, or a [Schema, Data] pair.")}}get dictionaries(){return this._dictionaries||(this._dictionaries=_O(this.schema.fields,this.data.children))}get numCols(){return this.schema.fields.length}get numRows(){return this.data.length}get nullCount(){return this.data.nullCount}isValid(t){return this.data.getValid(t)}get(t){return qe.visit(this.data,t)}set(t,n){return xn.visit(this.data,t,n)}indexOf(t,n){return Ic.visit(this.data,t,n)}getByteLength(t){return Tr.visit(this.data,t)}[Symbol.iterator](){return ou.visit(new Vt([this.data]))}toArray(){return[...this]}concat(...t){return new ur(this.schema,[this,...t])}slice(t,n){let[r]=new Vt([this.data]).slice(t,n).data;return new e(this.schema,r)}getChild(t){var n;return this.getChildAt((n=this.schema.fields)===null||n===void 0?void 0:n.findIndex(r=>r.name===t))}getChildAt(t){return t>-1&&t<this.schema.fields.length?new Vt([this.data.children[t]]):null}setChild(t,n){var r;return this.setChildAt((r=this.schema.fields)===null||r===void 0?void 0:r.findIndex(i=>i.name===t),n)}setChildAt(t,n){let r=this.schema,i=this.data;if(t>-1&&t<this.numCols){n||(n=new Vt([Bt({type:new jn,length:this.numRows})]));let o=r.fields.slice(),s=i.children.slice(),a=o[t].clone({type:n.type});[o[t],s[t]]=[a,n.data[0]],r=new re(o,new Map(this.schema.metadata)),i=Bt({type:new me(o),children:s})}return new e(r,i)}select(t){let n=this.schema.select(t),r=new me(n.fields),i=[];for(let o of t){let s=this.schema.fields.findIndex(a=>a.name===o);~s&&(i[s]=this.data.children[s])}return new e(n,Bt({type:r,length:this.numRows,children:i}))}selectAt(t){let n=this.schema.selectAt(t),r=t.map(o=>this.data.children[o]).filter(Boolean),i=Bt({type:new me(n.fields),length:this.numRows,children:r});return new e(n,i)}};vO=Symbol.toStringTag;Le[vO]=(e=>(e._nullCount=-1,e[Symbol.isConcatSpreadable]=!0,"RecordBatch"))(Le.prototype);function wO(e,t,n=t.reduce((r,i)=>Math.max(r,i.length),0)){var r;let i=[...e.fields],o=[...t],s=(n+63&-64)>>3;for(let[a,c]of e.fields.entries()){let l=t[a];(!l||l.length!==n)&&(i[a]=c.clone({nullable:!0}),o[a]=(r=l?._changeLengthAndBackfillNullBitmap(n))!==null&&r!==void 0?r:Bt({type:c.type,length:n,nullCount:n,nullBitmap:new Uint8Array(s)}))}return[e.assign(i),Bt({type:new me(i),length:n,children:o})]}function _O(e,t,n=new Map){var r,i;if(((r=e?.length)!==null&&r!==void 0?r:0)>0&&e?.length===t?.length)for(let o=-1,s=e.length;++o<s;){let{type:a}=e[o],c=t[o];for(let l of[c,...((i=c?.dictionary)===null||i===void 0?void 0:i.data)||[]])_O(a.children,l?.children,n);if(at.isDictionary(a)){let{id:l}=a;if(!n.has(l))c?.dictionary&&n.set(l,c.dictionary);else if(n.get(l)!==c.dictionary)throw new Error("Cannot create Schema containing two different dictionaries with the same Id")}}return n}var Lc=class extends Le{constructor(t){let n=t.fields.map(i=>Bt({type:i.type})),r=Bt({type:new me(t.fields),nullCount:0,children:n});super(t,r)}};var Oh;(function(e){e[e.BUFFER=0]="BUFFER"})(Oh||(Oh={}));var Bh;(function(e){e[e.LZ4_FRAME=0]="LZ4_FRAME",e[e.ZSTD=1]="ZSTD"})(Bh||(Bh={}));var _0=class e{constructor(){this.bb=null,this.bb_pos=0}__init(t,n){return this.bb_pos=t,this.bb=n,this}static getRootAsBodyCompression(t,n){return(n||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsBodyCompression(t,n){return t.setPosition(t.position()+4),(n||new e).__init(t.readInt32(t.position())+t.position(),t)}codec(){let t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt8(this.bb_pos+t):Bh.LZ4_FRAME}method(){let t=this.bb.__offset(this.bb_pos,6);return t?this.bb.readInt8(this.bb_pos+t):Oh.BUFFER}static startBodyCompression(t){t.startObject(2)}static addCodec(t,n){t.addFieldInt8(0,n,Bh.LZ4_FRAME)}static addMethod(t,n){t.addFieldInt8(1,n,Oh.BUFFER)}static endBodyCompression(t){return t.endObject()}static createBodyCompression(t,n,r){return e.startBodyCompression(t),e.addCodec(t,n),e.addMethod(t,r),e.endBodyCompression(t)}};var hu=class{constructor(){this.bb=null,this.bb_pos=0}__init(t,n){return this.bb_pos=t,this.bb=n,this}offset(){return this.bb.readInt64(this.bb_pos)}length(){return this.bb.readInt64(this.bb_pos+8)}static sizeOf(){return 16}static createBuffer(t,n,r){return t.prep(8,16),t.writeInt64(BigInt(r??0)),t.writeInt64(BigInt(n??0)),t.offset()}};var pu=class{constructor(){this.bb=null,this.bb_pos=0}__init(t,n){return this.bb_pos=t,this.bb=n,this}length(){return this.bb.readInt64(this.bb_pos)}nullCount(){return this.bb.readInt64(this.bb_pos+8)}static sizeOf(){return 16}static createFieldNode(t,n,r){return t.prep(8,16),t.writeInt64(BigInt(r??0)),t.writeInt64(BigInt(n??0)),t.offset()}};var Nr=class e{constructor(){this.bb=null,this.bb_pos=0}__init(t,n){return this.bb_pos=t,this.bb=n,this}static getRootAsRecordBatch(t,n){return(n||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsRecordBatch(t,n){return t.setPosition(t.position()+4),(n||new e).__init(t.readInt32(t.position())+t.position(),t)}length(){let t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt64(this.bb_pos+t):BigInt("0")}nodes(t,n){let r=this.bb.__offset(this.bb_pos,6);return r?(n||new pu).__init(this.bb.__vector(this.bb_pos+r)+t*16,this.bb):null}nodesLength(){let t=this.bb.__offset(this.bb_pos,6);return t?this.bb.__vector_len(this.bb_pos+t):0}buffers(t,n){let r=this.bb.__offset(this.bb_pos,8);return r?(n||new hu).__init(this.bb.__vector(this.bb_pos+r)+t*16,this.bb):null}buffersLength(){let t=this.bb.__offset(this.bb_pos,8);return t?this.bb.__vector_len(this.bb_pos+t):0}compression(t){let n=this.bb.__offset(this.bb_pos,10);return n?(t||new _0).__init(this.bb.__indirect(this.bb_pos+n),this.bb):null}static startRecordBatch(t){t.startObject(4)}static addLength(t,n){t.addFieldInt64(0,n,BigInt("0"))}static addNodes(t,n){t.addFieldOffset(1,n,0)}static startNodesVector(t,n){t.startVector(16,n,8)}static addBuffers(t,n){t.addFieldOffset(2,n,0)}static startBuffersVector(t,n){t.startVector(16,n,8)}static addCompression(t,n){t.addFieldOffset(3,n,0)}static endRecordBatch(t){return t.endObject()}};var ms=class e{constructor(){this.bb=null,this.bb_pos=0}__init(t,n){return this.bb_pos=t,this.bb=n,this}static getRootAsDictionaryBatch(t,n){return(n||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsDictionaryBatch(t,n){return t.setPosition(t.position()+4),(n||new e).__init(t.readInt32(t.position())+t.position(),t)}id(){let t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt64(this.bb_pos+t):BigInt("0")}data(t){let n=this.bb.__offset(this.bb_pos,6);return n?(t||new Nr).__init(this.bb.__indirect(this.bb_pos+n),this.bb):null}isDelta(){let t=this.bb.__offset(this.bb_pos,8);return t?!!this.bb.readInt8(this.bb_pos+t):!1}static startDictionaryBatch(t){t.startObject(3)}static addId(t,n){t.addFieldInt64(0,n,BigInt("0"))}static addData(t,n){t.addFieldOffset(1,n,0)}static addIsDelta(t,n){t.addFieldInt8(2,+n,0)}static endDictionaryBatch(t){return t.endObject()}};var mu;(function(e){e[e.NONE=0]="NONE",e[e.Schema=1]="Schema",e[e.DictionaryBatch=2]="DictionaryBatch",e[e.RecordBatch=3]="RecordBatch",e[e.Tensor=4]="Tensor",e[e.SparseTensor=5]="SparseTensor"})(mu||(mu={}));var Ci=class e{constructor(){this.bb=null,this.bb_pos=0}__init(t,n){return this.bb_pos=t,this.bb=n,this}static getRootAsMessage(t,n){return(n||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsMessage(t,n){return t.setPosition(t.position()+4),(n||new e).__init(t.readInt32(t.position())+t.position(),t)}version(){let t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt16(this.bb_pos+t):pa.V1}headerType(){let t=this.bb.__offset(this.bb_pos,6);return t?this.bb.readUint8(this.bb_pos+t):mu.NONE}header(t){let n=this.bb.__offset(this.bb_pos,8);return n?this.bb.__union(t,this.bb_pos+n):null}bodyLength(){let t=this.bb.__offset(this.bb_pos,10);return t?this.bb.readInt64(this.bb_pos+t):BigInt("0")}customMetadata(t,n){let r=this.bb.__offset(this.bb_pos,12);return r?(n||new en).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+r)+t*4),this.bb):null}customMetadataLength(){let t=this.bb.__offset(this.bb_pos,12);return t?this.bb.__vector_len(this.bb_pos+t):0}static startMessage(t){t.startObject(5)}static addVersion(t,n){t.addFieldInt16(0,n,pa.V1)}static addHeaderType(t,n){t.addFieldInt8(1,n,mu.NONE)}static addHeader(t,n){t.addFieldOffset(2,n,0)}static addBodyLength(t,n){t.addFieldInt64(3,n,BigInt("0"))}static addCustomMetadata(t,n){t.addFieldOffset(4,n,0)}static createCustomMetadataVector(t,n){t.startVector(4,n.length,4);for(let r=n.length-1;r>=0;r--)t.addOffset(n[r]);return t.endVector()}static startCustomMetadataVector(t,n){t.startVector(4,n,4)}static endMessage(t){return t.endObject()}static finishMessageBuffer(t,n){t.finish(n)}static finishSizePrefixedMessageBuffer(t,n){t.finish(n,void 0,!0)}static createMessage(t,n,r,i,o,s){return e.startMessage(t),e.addVersion(t,n),e.addHeaderType(t,r),e.addHeader(t,i),e.addBodyLength(t,o),e.addCustomMetadata(t,s),e.endMessage(t)}};var u2=class extends ut{visit(t,n){return t==null||n==null?void 0:super.visit(t,n)}visitNull(t,n){return Kd.startNull(n),Kd.endNull(n)}visitInt(t,n){return Bi.startInt(n),Bi.addBitWidth(n,t.bitWidth),Bi.addIsSigned(n,t.isSigned),Bi.endInt(n)}visitFloat(t,n){return wa.startFloatingPoint(n),wa.addPrecision(n,t.precision),wa.endFloatingPoint(n)}visitBinary(t,n){return Gd.startBinary(n),Gd.endBinary(n)}visitBool(t,n){return Wd.startBool(n),Wd.endBool(n)}visitUtf8(t,n){return nh.startUtf8(n),nh.endUtf8(n)}visitDecimal(t,n){return ro.startDecimal(n),ro.addScale(n,t.scale),ro.addPrecision(n,t.precision),ro.addBitWidth(n,t.bitWidth),ro.endDecimal(n)}visitDate(t,n){return ya.startDate(n),ya.addUnit(n,t.unit),ya.endDate(n)}visitTime(t,n){return os.startTime(n),os.addUnit(n,t.unit),os.addBitWidth(n,t.bitWidth),os.endTime(n)}visitTimestamp(t,n){let r=t.timezone&&n.createString(t.timezone)||void 0;return ss.startTimestamp(n),ss.addUnit(n,t.unit),r!==void 0&&ss.addTimezone(n,r),ss.endTimestamp(n)}visitInterval(t,n){return va.startInterval(n),va.addUnit(n,t.unit),va.endInterval(n)}visitDuration(t,n){return ga.startDuration(n),ga.addUnit(n,t.unit),ga.endDuration(n)}visitList(t,n){return Qd.startList(n),Qd.endList(n)}visitStruct(t,n){return th.startStruct_(n),th.endStruct_(n)}visitUnion(t,n){ki.startTypeIdsVector(n,t.typeIds.length);let r=ki.createTypeIdsVector(n,t.typeIds);return ki.startUnion(n),ki.addMode(n,t.mode),ki.addTypeIds(n,r),ki.endUnion(n)}visitDictionary(t,n){let r=this.visit(t.indices,n);return no.startDictionaryEncoding(n),no.addId(n,BigInt(t.id)),no.addIsOrdered(n,t.isOrdered),r!==void 0&&no.addIndexType(n,r),no.endDictionaryEncoding(n)}visitFixedSizeBinary(t,n){return xa.startFixedSizeBinary(n),xa.addByteWidth(n,t.byteWidth),xa.endFixedSizeBinary(n)}visitFixedSizeList(t,n){return ba.startFixedSizeList(n),ba.addListSize(n,t.listSize),ba.endFixedSizeList(n)}visitMap(t,n){return _a.startMap(n),_a.addKeysSorted(n,t.keysSorted),_a.endMap(n)}},S0=new u2;function TO(e,t=new Map){return new re(Lj(e,t),I0(e.metadata),t)}function f2(e){return new bn(e.count,EO(e.columns),NO(e.columns))}function AO(e){return new dr(f2(e.data),e.id,e.isDelta)}function Lj(e,t){return(e.fields||[]).filter(Boolean).map(n=>Ut.fromJSON(n,t))}function SO(e,t){return(e.children||[]).filter(Boolean).map(n=>Ut.fromJSON(n,t))}function EO(e){return(e||[]).reduce((t,n)=>[...t,new Jr(n.count,kj(n.VALIDITY)),...EO(n.children)],[])}function NO(e,t=[]){for(let n=-1,r=(e||[]).length;++n<r;){let i=e[n];i.VALIDITY&&t.push(new fr(t.length,i.VALIDITY.length)),i.TYPE_ID&&t.push(new fr(t.length,i.TYPE_ID.length)),i.OFFSET&&t.push(new fr(t.length,i.OFFSET.length)),i.DATA&&t.push(new fr(t.length,i.DATA.length)),t=NO(i.children,t)}return t}function kj(e){return(e||[]).reduce((t,n)=>t+ +(n===0),0)}function DO(e,t){let n,r,i,o,s,a;return!t||!(o=e.dictionary)?(s=MO(e,SO(e,t)),i=new Ut(e.name,s,e.nullable,I0(e.metadata))):t.has(n=o.id)?(r=(r=o.indexType)?IO(r):new Ji,a=new Ir(t.get(n),r,n,o.isOrdered),i=new Ut(e.name,a,e.nullable,I0(e.metadata))):(r=(r=o.indexType)?IO(r):new Ji,t.set(n,s=MO(e,SO(e,t))),a=new Ir(s,r,n,o.isOrdered),i=new Ut(e.name,a,e.nullable,I0(e.metadata))),i||null}function I0(e=[]){return new Map(e.map(({key:t,value:n})=>[t,n]))}function IO(e){return new $e(e.isSigned,e.bitWidth)}function MO(e,t){let n=e.type.name;switch(n){case"NONE":return new jn;case"null":return new jn;case"binary":return new Wo;case"utf8":return new Ho;case"bool":return new Zo;case"list":return new Ti((t||[])[0]);case"struct":return new me(t||[]);case"struct_":return new me(t||[])}switch(n){case"int":{let r=e.type;return new $e(r.isSigned,r.bitWidth)}case"floatingpoint":{let r=e.type;return new cr(Se[r.precision])}case"decimal":{let r=e.type;return new Jo(r.scale,r.precision,r.bitWidth)}case"date":{let r=e.type;return new Qo(Dn[r.unit])}case"time":{let r=e.type;return new Mi(mt[r.unit],r.bitWidth)}case"timestamp":{let r=e.type;return new Ko(mt[r.unit],r.timezone)}case"interval":{let r=e.type;return new ts(sr[r.unit])}case"duration":{let r=e.type;return new es(mt[r.unit])}case"union":{let r=e.type,[i,...o]=(r.mode+"").toLowerCase(),s=i.toUpperCase()+o.join("");return new Ai(xe[s],r.typeIds||[],t||[])}case"fixedsizebinary":{let r=e.type;return new ns(r.byteWidth)}case"fixedsizelist":{let r=e.type;return new Ei(r.listSize,(t||[])[0])}case"map":{let r=e.type;return new Ni((t||[])[0],r.keysSorted)}}throw new Error(`Unrecognized type: "${n}"`)}var Cj=Tc,Fj=Ar,hr=class e{static fromJSON(t,n){let r=new e(0,Ee.V5,n);return r._createHeader=Rj(t,n),r}static decode(t){t=new Fj(Ot(t));let n=Ci.getRootAsMessage(t),r=n.bodyLength(),i=n.version(),o=n.headerType(),s=new e(r,i,o);return s._createHeader=$j(n,o),s}static encode(t){let n=new Cj,r=-1;return t.isSchema()?r=re.encode(n,t.header()):t.isRecordBatch()?r=bn.encode(n,t.header()):t.isDictionaryBatch()&&(r=dr.encode(n,t.header())),Ci.startMessage(n),Ci.addVersion(n,Ee.V5),Ci.addHeader(n,r),Ci.addHeaderType(n,t.headerType),Ci.addBodyLength(n,BigInt(t.bodyLength)),Ci.finishMessageBuffer(n,Ci.endMessage(n)),n.asUint8Array()}static from(t,n=0){if(t instanceof re)return new e(0,Ee.V5,Qt.Schema,t);if(t instanceof bn)return new e(n,Ee.V5,Qt.RecordBatch,t);if(t instanceof dr)return new e(n,Ee.V5,Qt.DictionaryBatch,t);throw new Error(`Unrecognized Message header: ${t}`)}get type(){return this.headerType}get version(){return this._version}get headerType(){return this._headerType}get bodyLength(){return this._bodyLength}header(){return this._createHeader()}isSchema(){return this.headerType===Qt.Schema}isRecordBatch(){return this.headerType===Qt.RecordBatch}isDictionaryBatch(){return this.headerType===Qt.DictionaryBatch}constructor(t,n,r,i){this._version=n,this._headerType=r,this.body=new Uint8Array(0),i&&(this._createHeader=()=>i),this._bodyLength=ar(t)}},bn=class{get nodes(){return this._nodes}get length(){return this._length}get buffers(){return this._buffers}constructor(t,n,r){this._nodes=n,this._buffers=r,this._length=ar(t)}},dr=class{get id(){return this._id}get data(){return this._data}get isDelta(){return this._isDelta}get length(){return this.data.length}get nodes(){return this.data.nodes}get buffers(){return this.data.buffers}constructor(t,n,r=!1){this._data=t,this._isDelta=r,this._id=ar(n)}},fr=class{constructor(t,n){this.offset=ar(t),this.length=ar(n)}},Jr=class{constructor(t,n){this.length=ar(t),this.nullCount=ar(n)}};function Rj(e,t){return()=>{switch(t){case Qt.Schema:return re.fromJSON(e);case Qt.RecordBatch:return bn.fromJSON(e);case Qt.DictionaryBatch:return dr.fromJSON(e)}throw new Error(`Unrecognized Message type: { name: ${Qt[t]}, type: ${t} }`)}}function $j(e,t){return()=>{switch(t){case Qt.Schema:return re.decode(e.header(new lr),new Map,e.version());case Qt.RecordBatch:return bn.decode(e.header(new Nr),e.version());case Qt.DictionaryBatch:return dr.decode(e.header(new ms),e.version())}throw new Error(`Unrecognized Message type: { name: ${Qt[t]}, type: ${t} }`)}}Ut.encode=Hj;Ut.decode=Gj;Ut.fromJSON=DO;re.encode=Wj;re.decode=Pj;re.fromJSON=TO;bn.encode=Zj;bn.decode=Uj;bn.fromJSON=f2;dr.encode=Jj;dr.decode=zj;dr.fromJSON=AO;Jr.encode=Qj;Jr.decode=qj;fr.encode=Kj;fr.decode=jj;function Pj(e,t=new Map,n=Ee.V5){let r=Xj(e,t);return new re(r,M0(e),t,n)}function Uj(e,t=Ee.V5){if(e.compression()!==null)throw new Error("Record batch compression not implemented");return new bn(e.length(),Vj(e),Yj(e,t))}function zj(e,t=Ee.V5){return new dr(bn.decode(e.data(),t),e.id(),e.isDelta())}function jj(e){return new fr(e.offset(),e.length())}function qj(e){return new Jr(e.length(),e.nullCount())}function Vj(e){let t=[];for(let n,r=-1,i=-1,o=e.nodesLength();++r<o;)(n=e.nodes(r))&&(t[++i]=Jr.decode(n));return t}function Yj(e,t){let n=[];for(let r,i=-1,o=-1,s=e.buffersLength();++i<s;)(r=e.buffers(i))&&(t<Ee.V4&&(r.bb_pos+=8*(i+1)),n[++o]=fr.decode(r));return n}function Xj(e,t){let n=[];for(let r,i=-1,o=-1,s=e.fieldsLength();++i<s;)(r=e.fields(i))&&(n[++o]=Ut.decode(r,t));return n}function OO(e,t){let n=[];for(let r,i=-1,o=-1,s=e.childrenLength();++i<s;)(r=e.children(i))&&(n[++o]=Ut.decode(r,t));return n}function Gj(e,t){let n,r,i,o,s,a;return!t||!(a=e.dictionary())?(i=LO(e,OO(e,t)),r=new Ut(e.name(),i,e.nullable(),M0(e))):t.has(n=ar(a.id()))?(o=(o=a.indexType())?BO(o):new Ji,s=new Ir(t.get(n),o,n,a.isOrdered()),r=new Ut(e.name(),s,e.nullable(),M0(e))):(o=(o=a.indexType())?BO(o):new Ji,t.set(n,i=LO(e,OO(e,t))),s=new Ir(i,o,n,a.isOrdered()),r=new Ut(e.name(),s,e.nullable(),M0(e))),r||null}function M0(e){let t=new Map;if(e)for(let n,r,i=-1,o=Math.trunc(e.customMetadataLength());++i<o;)(n=e.customMetadata(i))&&(r=n.key())!=null&&t.set(r,n.value());return t}function BO(e){return new $e(e.isSigned(),e.bitWidth())}function LO(e,t){let n=e.typeType();switch(n){case ye.NONE:return new jn;case ye.Null:return new jn;case ye.Binary:return new Wo;case ye.Utf8:return new Ho;case ye.Bool:return new Zo;case ye.List:return new Ti((t||[])[0]);case ye.Struct_:return new me(t||[])}switch(n){case ye.Int:{let r=e.type(new Bi);return new $e(r.isSigned(),r.bitWidth())}case ye.FloatingPoint:{let r=e.type(new wa);return new cr(r.precision())}case ye.Decimal:{let r=e.type(new ro);return new Jo(r.scale(),r.precision(),r.bitWidth())}case ye.Date:{let r=e.type(new ya);return new Qo(r.unit())}case ye.Time:{let r=e.type(new os);return new Mi(r.unit(),r.bitWidth())}case ye.Timestamp:{let r=e.type(new ss);return new Ko(r.unit(),r.timezone())}case ye.Interval:{let r=e.type(new va);return new ts(r.unit())}case ye.Duration:{let r=e.type(new ga);return new es(r.unit())}case ye.Union:{let r=e.type(new ki);return new Ai(r.mode(),r.typeIdsArray()||[],t||[])}case ye.FixedSizeBinary:{let r=e.type(new xa);return new ns(r.byteWidth())}case ye.FixedSizeList:{let r=e.type(new ba);return new Ei(r.listSize(),(t||[])[0])}case ye.Map:{let r=e.type(new _a);return new Ni((t||[])[0],r.keysSorted())}}throw new Error(`Unrecognized type: "${ye[n]}" (${n})`)}function Wj(e,t){let n=t.fields.map(o=>Ut.encode(e,o));lr.startFieldsVector(e,n.length);let r=lr.createFieldsVector(e,n),i=t.metadata&&t.metadata.size>0?lr.createCustomMetadataVector(e,[...t.metadata].map(([o,s])=>{let a=e.createString(`${o}`),c=e.createString(`${s}`);return en.startKeyValue(e),en.addKey(e,a),en.addValue(e,c),en.endKeyValue(e)})):-1;return lr.startSchema(e),lr.addFields(e,r),lr.addEndianness(e,tq?ma.Little:ma.Big),i!==-1&&lr.addCustomMetadata(e,i),lr.endSchema(e)}function Hj(e,t){let n=-1,r=-1,i=-1,o=t.type,s=t.typeId;at.isDictionary(o)?(s=o.dictionary.typeId,i=S0.visit(o,e),r=S0.visit(o.dictionary,e)):r=S0.visit(o,e);let a=(o.children||[]).map(u=>Ut.encode(e,u)),c=On.createChildrenVector(e,a),l=t.metadata&&t.metadata.size>0?On.createCustomMetadataVector(e,[...t.metadata].map(([u,f])=>{let d=e.createString(`${u}`),h=e.createString(`${f}`);return en.startKeyValue(e),en.addKey(e,d),en.addValue(e,h),en.endKeyValue(e)})):-1;return t.name&&(n=e.createString(t.name)),On.startField(e),On.addType(e,r),On.addTypeType(e,s),On.addChildren(e,c),On.addNullable(e,!!t.nullable),n!==-1&&On.addName(e,n),i!==-1&&On.addDictionary(e,i),l!==-1&&On.addCustomMetadata(e,l),On.endField(e)}function Zj(e,t){let n=t.nodes||[],r=t.buffers||[];Nr.startNodesVector(e,n.length);for(let s of n.slice().reverse())Jr.encode(e,s);let i=e.endVector();Nr.startBuffersVector(e,r.length);for(let s of r.slice().reverse())fr.encode(e,s);let o=e.endVector();return Nr.startRecordBatch(e),Nr.addLength(e,BigInt(t.length)),Nr.addNodes(e,i),Nr.addBuffers(e,o),Nr.endRecordBatch(e)}function Jj(e,t){let n=bn.encode(e,t.data);return ms.startDictionaryBatch(e),ms.addId(e,BigInt(t.id)),ms.addIsDelta(e,t.isDelta),ms.addData(e,n),ms.endDictionaryBatch(e)}function Qj(e,t){return pu.createFieldNode(e,BigInt(t.length),BigInt(t.nullCount))}function Kj(e,t){return hu.createBuffer(e,BigInt(t.offset),BigInt(t.length))}var tq=(()=>{let e=new ArrayBuffer(2);return new DataView(e).setInt16(0,256,!0),new Int16Array(e)[0]===256})();var h2=e=>`Expected ${Qt[e]} Message in stream, but was null or length 0.`,p2=e=>`Header pointer of flatbuffer-encoded ${Qt[e]} Message is null or length 0.`,kO=(e,t)=>`Expected to read ${e} metadata bytes, but only read ${t}.`,CO=(e,t)=>`Expected to read ${e} bytes for message body, but only read ${t}.`,yu=class{constructor(t){this.source=t instanceof oo?t:new oo(t)}[Symbol.iterator](){return this}next(){let t;return(t=this.readMetadataLength()).done?ge:t.value===-1&&(t=this.readMetadataLength()).done?ge:(t=this.readMetadata(t.value)).done?ge:t}throw(t){return this.source.throw(t)}return(t){return this.source.return(t)}readMessage(t){let n;if((n=this.next()).done)return null;if(t!=null&&n.value.headerType!==t)throw new Error(h2(t));return n.value}readMessageBody(t){if(t<=0)return new Uint8Array(0);let n=Ot(this.source.read(t));if(n.byteLength<t)throw new Error(CO(t,n.byteLength));return n.byteOffset%8===0&&n.byteOffset+n.byteLength<=n.buffer.byteLength?n:n.slice()}readSchema(t=!1){let n=Qt.Schema,r=this.readMessage(n),i=r?.header();if(t&&!i)throw new Error(p2(n));return i}readMetadataLength(){let t=this.source.read(T0),n=t&&new Ar(t),r=n?.readInt32(0)||0;return{done:r===0,value:r}}readMetadata(t){let n=this.source.read(t);if(!n)return ge;if(n.byteLength<t)throw new Error(kO(t,n.byteLength));return{done:!1,value:hr.decode(n)}}},Lh=class{constructor(t,n){this.source=t instanceof Hr?t:sg(t)?new Sa(t,n):new Hr(t)}[Symbol.asyncIterator](){return this}next(){return Z(this,void 0,void 0,function*(){let t;return(t=yield this.readMetadataLength()).done?ge:t.value===-1&&(t=yield this.readMetadataLength()).done?ge:(t=yield this.readMetadata(t.value)).done?ge:t})}throw(t){return Z(this,void 0,void 0,function*(){return yield this.source.throw(t)})}return(t){return Z(this,void 0,void 0,function*(){return yield this.source.return(t)})}readMessage(t){return Z(this,void 0,void 0,function*(){let n;if((n=yield this.next()).done)return null;if(t!=null&&n.value.headerType!==t)throw new Error(h2(t));return n.value})}readMessageBody(t){return Z(this,void 0,void 0,function*(){if(t<=0)return new Uint8Array(0);let n=Ot(yield this.source.read(t));if(n.byteLength<t)throw new Error(CO(t,n.byteLength));return n.byteOffset%8===0&&n.byteOffset+n.byteLength<=n.buffer.byteLength?n:n.slice()})}readSchema(t=!1){return Z(this,void 0,void 0,function*(){let n=Qt.Schema,r=yield this.readMessage(n),i=r?.header();if(t&&!i)throw new Error(p2(n));return i})}readMetadataLength(){return Z(this,void 0,void 0,function*(){let t=yield this.source.read(T0),n=t&&new Ar(t),r=n?.readInt32(0)||0;return{done:r===0,value:r}})}readMetadata(t){return Z(this,void 0,void 0,function*(){let n=yield this.source.read(t);if(!n)return ge;if(n.byteLength<t)throw new Error(kO(t,n.byteLength));return{done:!1,value:hr.decode(n)}})}},kh=class extends yu{constructor(t){super(new Uint8Array(0)),this._schema=!1,this._body=[],this._batchIndex=0,this._dictionaryIndex=0,this._json=t instanceof rh?t:new rh(t)}next(){let{_json:t}=this;if(!this._schema)return this._schema=!0,{done:!1,value:hr.fromJSON(t.schema,Qt.Schema)};if(this._dictionaryIndex<t.dictionaries.length){let n=t.dictionaries[this._dictionaryIndex++];return this._body=n.data.columns,{done:!1,value:hr.fromJSON(n,Qt.DictionaryBatch)}}if(this._batchIndex<t.batches.length){let n=t.batches[this._batchIndex++];return this._body=n.columns,{done:!1,value:hr.fromJSON(n,Qt.RecordBatch)}}return this._body=[],ge}readMessageBody(t){return n(this._body);function n(r){return(r||[]).reduce((i,o)=>[...i,...o.VALIDITY&&[o.VALIDITY]||[],...o.TYPE_ID&&[o.TYPE_ID]||[],...o.OFFSET&&[o.OFFSET]||[],...o.DATA&&[o.DATA]||[],...n(o.children)],[])}}readMessage(t){let n;if((n=this.next()).done)return null;if(t!=null&&n.value.headerType!==t)throw new Error(h2(t));return n.value}readSchema(){let t=Qt.Schema,n=this.readMessage(t),r=n?.header();if(!n||!r)throw new Error(p2(t));return r}},T0=4,d2="ARROW1",gu=new Uint8Array(d2.length);for(let e=0;e<d2.length;e+=1)gu[e]=d2.codePointAt(e);function A0(e,t=0){for(let n=-1,r=gu.length;++n<r;)if(gu[n]!==e[t+n])return!1;return!0}var xu=gu.length,m2=xu+T0,FO=xu*2+T0;var Dr=class e extends Ac{constructor(t){super(),this._impl=t}get closed(){return this._impl.closed}get schema(){return this._impl.schema}get autoDestroy(){return this._impl.autoDestroy}get dictionaries(){return this._impl.dictionaries}get numDictionaries(){return this._impl.numDictionaries}get numRecordBatches(){return this._impl.numRecordBatches}get footer(){return this._impl.isFile()?this._impl.footer:null}isSync(){return this._impl.isSync()}isAsync(){return this._impl.isAsync()}isFile(){return this._impl.isFile()}isStream(){return this._impl.isStream()}next(){return this._impl.next()}throw(t){return this._impl.throw(t)}return(t){return this._impl.return(t)}cancel(){return this._impl.cancel()}reset(t){return this._impl.reset(t),this._DOMStream=void 0,this._nodeStream=void 0,this}open(t){let n=this._impl.open(t);return _r(n)?n.then(()=>this):this}readRecordBatch(t){return this._impl.isFile()?this._impl.readRecordBatch(t):null}[Symbol.iterator](){return this._impl[Symbol.iterator]()}[Symbol.asyncIterator](){return this._impl[Symbol.asyncIterator]()}toDOMStream(){return gn.toDOMStream(this.isSync()?{[Symbol.iterator]:()=>this}:{[Symbol.asyncIterator]:()=>this})}toNodeStream(){return gn.toNodeStream(this.isSync()?{[Symbol.iterator]:()=>this}:{[Symbol.asyncIterator]:()=>this},{objectMode:!0})}static throughNode(t){throw new Error('"throughNode" not available in this environment')}static throughDOM(t,n){throw new Error('"throughDOM" not available in this environment')}static from(t){return t instanceof e?t:ig(t)?nq(t):sg(t)?oq(t):_r(t)?Z(this,void 0,void 0,function*(){return yield e.from(yield t)}):ag(t)||Rd(t)||lg(t)||Xr(t)?iq(new Hr(t)):rq(new oo(t))}static readAll(t){return t instanceof e?t.isSync()?RO(t):$O(t):ig(t)||ArrayBuffer.isView(t)||wi(t)||og(t)?RO(t):$O(t)}},ys=class extends Dr{constructor(t){super(t),this._impl=t}readAll(){return[...this]}[Symbol.iterator](){return this._impl[Symbol.iterator]()}[Symbol.asyncIterator](){return vr(this,arguments,function*(){yield Ft(yield*Zl(bi(this[Symbol.iterator]())))})}},kc=class extends Dr{constructor(t){super(t),this._impl=t}readAll(){var t,n,r,i;return Z(this,void 0,void 0,function*(){let o=new Array;try{for(var s=!0,a=bi(this),c;c=yield a.next(),t=c.done,!t;s=!0){i=c.value,s=!1;let l=i;o.push(l)}}catch(l){n={error:l}}finally{try{!s&&!t&&(r=a.return)&&(yield r.call(a))}finally{if(n)throw n.error}}return o})}[Symbol.iterator](){throw new Error("AsyncRecordBatchStreamReader is not Iterable")}[Symbol.asyncIterator](){return this._impl[Symbol.asyncIterator]()}},Cc=class extends ys{constructor(t){super(t),this._impl=t}},E0=class extends kc{constructor(t){super(t),this._impl=t}},N0=class{get numDictionaries(){return this._dictionaryIndex}get numRecordBatches(){return this._recordBatchIndex}constructor(t=new Map){this.closed=!1,this.autoDestroy=!0,this._dictionaryIndex=0,this._recordBatchIndex=0,this.dictionaries=t}isSync(){return!1}isAsync(){return!1}isFile(){return!1}isStream(){return!1}reset(t){return this._dictionaryIndex=0,this._recordBatchIndex=0,this.schema=t,this.dictionaries=new Map,this}_loadRecordBatch(t,n){let r=this._loadVectors(t,n,this.schema.fields),i=Bt({type:new me(this.schema.fields),length:t.length,children:r});return new Le(this.schema,i)}_loadDictionaryBatch(t,n){let{id:r,isDelta:i}=t,{dictionaries:o,schema:s}=this,a=o.get(r);if(i||!a){let c=s.dictionaries.get(r),l=this._loadVectors(t.data,n,[c]);return(a&&i?a.concat(new Vt(l)):new Vt(l)).memoize()}return a.memoize()}_loadVectors(t,n,r){return new ah(n,t.nodes,t.buffers,this.dictionaries,this.schema.metadataVersion).visitMany(r)}},bu=class extends N0{constructor(t,n){super(n),this._reader=ig(t)?new kh(this._handle=t):new yu(this._handle=t)}isSync(){return!0}isStream(){return!0}[Symbol.iterator](){return this}cancel(){!this.closed&&(this.closed=!0)&&(this.reset()._reader.return(),this._reader=null,this.dictionaries=null)}open(t){return this.closed||(this.autoDestroy=PO(this,t),this.schema||(this.schema=this._reader.readSchema())||this.cancel()),this}throw(t){return!this.closed&&this.autoDestroy&&(this.closed=!0)?this.reset()._reader.throw(t):ge}return(t){return!this.closed&&this.autoDestroy&&(this.closed=!0)?this.reset()._reader.return(t):ge}next(){if(this.closed)return ge;let t,{_reader:n}=this;for(;t=this._readNextMessageAndValidate();)if(t.isSchema())this.reset(t.header());else if(t.isRecordBatch()){this._recordBatchIndex++;let r=t.header(),i=n.readMessageBody(t.bodyLength);return{done:!1,value:this._loadRecordBatch(r,i)}}else if(t.isDictionaryBatch()){this._dictionaryIndex++;let r=t.header(),i=n.readMessageBody(t.bodyLength),o=this._loadDictionaryBatch(r,i);this.dictionaries.set(r.id,o)}return this.schema&&this._recordBatchIndex===0?(this._recordBatchIndex++,{done:!1,value:new Lc(this.schema)}):this.return()}_readNextMessageAndValidate(t){return this._reader.readMessage(t)}},wu=class extends N0{constructor(t,n){super(n),this._reader=new Lh(this._handle=t)}isAsync(){return!0}isStream(){return!0}[Symbol.asyncIterator](){return this}cancel(){return Z(this,void 0,void 0,function*(){!this.closed&&(this.closed=!0)&&(yield this.reset()._reader.return(),this._reader=null,this.dictionaries=null)})}open(t){return Z(this,void 0,void 0,function*(){return this.closed||(this.autoDestroy=PO(this,t),this.schema||(this.schema=yield this._reader.readSchema())||(yield this.cancel())),this})}throw(t){return Z(this,void 0,void 0,function*(){return!this.closed&&this.autoDestroy&&(this.closed=!0)?yield this.reset()._reader.throw(t):ge})}return(t){return Z(this,void 0,void 0,function*(){return!this.closed&&this.autoDestroy&&(this.closed=!0)?yield this.reset()._reader.return(t):ge})}next(){return Z(this,void 0,void 0,function*(){if(this.closed)return ge;let t,{_reader:n}=this;for(;t=yield this._readNextMessageAndValidate();)if(t.isSchema())yield this.reset(t.header());else if(t.isRecordBatch()){this._recordBatchIndex++;let r=t.header(),i=yield n.readMessageBody(t.bodyLength);return{done:!1,value:this._loadRecordBatch(r,i)}}else if(t.isDictionaryBatch()){this._dictionaryIndex++;let r=t.header(),i=yield n.readMessageBody(t.bodyLength),o=this._loadDictionaryBatch(r,i);this.dictionaries.set(r.id,o)}return this.schema&&this._recordBatchIndex===0?(this._recordBatchIndex++,{done:!1,value:new Lc(this.schema)}):yield this.return()})}_readNextMessageAndValidate(t){return Z(this,void 0,void 0,function*(){return yield this._reader.readMessage(t)})}},D0=class extends bu{get footer(){return this._footer}get numDictionaries(){return this._footer?this._footer.numDictionaries:0}get numRecordBatches(){return this._footer?this._footer.numRecordBatches:0}constructor(t,n){super(t instanceof ih?t:new ih(t),n)}isSync(){return!0}isFile(){return!0}open(t){if(!this.closed&&!this._footer){this.schema=(this._footer=this._readFooter()).schema;for(let n of this._footer.dictionaryBatches())n&&this._readDictionaryBatch(this._dictionaryIndex++)}return super.open(t)}readRecordBatch(t){var n;if(this.closed)return null;this._footer||this.open();let r=(n=this._footer)===null||n===void 0?void 0:n.getRecordBatch(t);if(r&&this._handle.seek(r.offset)){let i=this._reader.readMessage(Qt.RecordBatch);if(i?.isRecordBatch()){let o=i.header(),s=this._reader.readMessageBody(i.bodyLength);return this._loadRecordBatch(o,s)}}return null}_readDictionaryBatch(t){var n;let r=(n=this._footer)===null||n===void 0?void 0:n.getDictionaryBatch(t);if(r&&this._handle.seek(r.offset)){let i=this._reader.readMessage(Qt.DictionaryBatch);if(i?.isDictionaryBatch()){let o=i.header(),s=this._reader.readMessageBody(i.bodyLength),a=this._loadDictionaryBatch(o,s);this.dictionaries.set(o.id,a)}}}_readFooter(){let{_handle:t}=this,n=t.size-m2,r=t.readInt32(n),i=t.readAt(n-r,r);return as.decode(i)}_readNextMessageAndValidate(t){var n;if(this._footer||this.open(),this._footer&&this._recordBatchIndex<this.numRecordBatches){let r=(n=this._footer)===null||n===void 0?void 0:n.getRecordBatch(this._recordBatchIndex);if(r&&this._handle.seek(r.offset))return this._reader.readMessage(t)}return null}},y2=class extends wu{get footer(){return this._footer}get numDictionaries(){return this._footer?this._footer.numDictionaries:0}get numRecordBatches(){return this._footer?this._footer.numRecordBatches:0}constructor(t,...n){let r=typeof n[0]!="number"?n.shift():void 0,i=n[0]instanceof Map?n.shift():void 0;super(t instanceof Sa?t:new Sa(t,r),i)}isFile(){return!0}isAsync(){return!0}open(t){let n=Object.create(null,{open:{get:()=>super.open}});return Z(this,void 0,void 0,function*(){if(!this.closed&&!this._footer){this.schema=(this._footer=yield this._readFooter()).schema;for(let r of this._footer.dictionaryBatches())r&&(yield this._readDictionaryBatch(this._dictionaryIndex++))}return yield n.open.call(this,t)})}readRecordBatch(t){var n;return Z(this,void 0,void 0,function*(){if(this.closed)return null;this._footer||(yield this.open());let r=(n=this._footer)===null||n===void 0?void 0:n.getRecordBatch(t);if(r&&(yield this._handle.seek(r.offset))){let i=yield this._reader.readMessage(Qt.RecordBatch);if(i?.isRecordBatch()){let o=i.header(),s=yield this._reader.readMessageBody(i.bodyLength);return this._loadRecordBatch(o,s)}}return null})}_readDictionaryBatch(t){var n;return Z(this,void 0,void 0,function*(){let r=(n=this._footer)===null||n===void 0?void 0:n.getDictionaryBatch(t);if(r&&(yield this._handle.seek(r.offset))){let i=yield this._reader.readMessage(Qt.DictionaryBatch);if(i?.isDictionaryBatch()){let o=i.header(),s=yield this._reader.readMessageBody(i.bodyLength),a=this._loadDictionaryBatch(o,s);this.dictionaries.set(o.id,a)}}})}_readFooter(){return Z(this,void 0,void 0,function*(){let{_handle:t}=this;t._pending&&(yield t._pending);let n=t.size-m2,r=yield t.readInt32(n),i=yield t.readAt(n-r,r);return as.decode(i)})}_readNextMessageAndValidate(t){return Z(this,void 0,void 0,function*(){if(this._footer||(yield this.open()),this._footer&&this._recordBatchIndex<this.numRecordBatches){let n=this._footer.getRecordBatch(this._recordBatchIndex);if(n&&(yield this._handle.seek(n.offset)))return yield this._reader.readMessage(t)}return null})}},g2=class extends bu{constructor(t,n){super(t,n)}_loadVectors(t,n,r){return new Kg(n,t.nodes,t.buffers,this.dictionaries,this.schema.metadataVersion).visitMany(r)}};function PO(e,t){return t&&typeof t.autoDestroy=="boolean"?t.autoDestroy:e.autoDestroy}function*RO(e){let t=Dr.from(e);try{if(!t.open({autoDestroy:!1}).closed)do yield t;while(!t.reset().open().closed)}finally{t.cancel()}}function $O(e){return vr(this,arguments,function*(){let n=yield Ft(Dr.from(e));try{if(!(yield Ft(n.open({autoDestroy:!1}))).closed)do yield yield Ft(n);while(!(yield Ft(n.reset().open())).closed)}finally{yield Ft(n.cancel())}})}function nq(e){return new ys(new g2(e))}function rq(e){let t=e.peek(xu+7&-8);return t&&t.byteLength>=4?A0(t)?new Cc(new D0(e.read())):new ys(new bu(e)):new ys(new bu(function*(){}()))}function iq(e){return Z(this,void 0,void 0,function*(){let t=yield e.peek(xu+7&-8);return t&&t.byteLength>=4?A0(t)?new Cc(new D0(yield e.read())):new kc(new wu(e)):new kc(new wu(function(){return vr(this,arguments,function*(){})}()))})}function oq(e){return Z(this,void 0,void 0,function*(){let{size:t}=yield e.stat(),n=new Sa(e,t);return t>=FO&&A0(yield n.readAt(0,xu+7&-8))?new E0(new y2(n)):new kc(new wu(n))})}var ke=class e extends ut{static assemble(...t){let n=i=>i.flatMap(o=>Array.isArray(o)?n(o):o instanceof Le?o.data.children:o.data),r=new e;return r.visitMany(n(t)),r}constructor(){super(),this._byteLength=0,this._nodes=[],this._buffers=[],this._bufferRegions=[]}visit(t){if(t instanceof Vt)return this.visitMany(t.data),this;let{type:n}=t;if(!at.isDictionary(n)){let{length:r}=t;if(r>2147483647)throw new RangeError("Cannot write arrays larger than 2^31 - 1 in length");if(at.isUnion(n))this.nodes.push(new Jr(r,0));else{let{nullCount:i}=t;at.isNull(n)||Fi.call(this,i<=0?new Uint8Array(0):_c(t.offset,r,t.nullBitmap)),this.nodes.push(new Jr(r,i))}}return super.visit(t)}visitNull(t){return this}visitDictionary(t){return this.visit(t.clone(t.type.indices))}get nodes(){return this._nodes}get buffers(){return this._buffers}get byteLength(){return this._byteLength}get bufferRegions(){return this._bufferRegions}};function Fi(e){let t=e.byteLength+7&-8;return this.buffers.push(e),this.bufferRegions.push(new fr(this._byteLength,t)),this._byteLength+=t,this}function sq(e){var t;let{type:n,length:r,typeIds:i,valueOffsets:o}=e;if(Fi.call(this,i),n.mode===xe.Sparse)return x2.call(this,e);if(n.mode===xe.Dense){if(e.offset<=0)return Fi.call(this,o),x2.call(this,e);{let s=new Int32Array(r),a=Object.create(null),c=Object.create(null);for(let l,u,f=-1;++f<r;)(l=i[f])!==void 0&&((u=a[l])===void 0&&(u=a[l]=o[f]),s[f]=o[f]-u,c[l]=((t=c[l])!==null&&t!==void 0?t:0)+1);Fi.call(this,s),this.visitMany(e.children.map((l,u)=>{let f=n.typeIds[u],d=a[f],h=c[f];return l.slice(d,Math.min(r,h))}))}}return this}function aq(e){let t;return e.nullCount>=e.length?Fi.call(this,new Uint8Array(0)):(t=e.values)instanceof Uint8Array?Fi.call(this,_c(e.offset,e.length,t)):Fi.call(this,Sc(e.values))}function gs(e){return Fi.call(this,e.values.subarray(0,e.length*e.stride))}function UO(e){let{length:t,values:n,valueOffsets:r}=e,{[0]:i,[t]:o}=r,s=Math.min(o-i,n.byteLength-i);return Fi.call(this,ug(-i,t+1,r)),Fi.call(this,n.subarray(i,i+s)),this}function b2(e){let{length:t,valueOffsets:n}=e;if(n){let{[0]:r,[t]:i}=n;return Fi.call(this,ug(-r,t+1,n)),this.visit(e.children[0].slice(r,i-r))}return this.visit(e.children[0])}function x2(e){return this.visitMany(e.type.children.map((t,n)=>e.children[n]).filter(Boolean))[0]}ke.prototype.visitBool=aq;ke.prototype.visitInt=gs;ke.prototype.visitFloat=gs;ke.prototype.visitUtf8=UO;ke.prototype.visitBinary=UO;ke.prototype.visitFixedSizeBinary=gs;ke.prototype.visitDate=gs;ke.prototype.visitTimestamp=gs;ke.prototype.visitTime=gs;ke.prototype.visitDecimal=gs;ke.prototype.visitList=b2;ke.prototype.visitStruct=x2;ke.prototype.visitUnion=sq;ke.prototype.visitInterval=gs;ke.prototype.visitDuration=gs;ke.prototype.visitFixedSizeList=b2;ke.prototype.visitMap=b2;var Fc=class extends Ac{static throughNode(t){throw new Error('"throughNode" not available in this environment')}static throughDOM(t,n){throw new Error('"throughDOM" not available in this environment')}constructor(t){super(),this._position=0,this._started=!1,this._sink=new io,this._schema=null,this._dictionaryBlocks=[],this._recordBatchBlocks=[],this._dictionaryDeltaOffsets=new Map,zn(t)||(t={autoDestroy:!0,writeLegacyIpcFormat:!1}),this._autoDestroy=typeof t.autoDestroy=="boolean"?t.autoDestroy:!0,this._writeLegacyIpcFormat=typeof t.writeLegacyIpcFormat=="boolean"?t.writeLegacyIpcFormat:!1}toString(t=!1){return this._sink.toString(t)}toUint8Array(t=!1){return this._sink.toUint8Array(t)}writeAll(t){return _r(t)?t.then(n=>this.writeAll(n)):Xr(t)?v2(this,t):w2(this,t)}get closed(){return this._sink.closed}[Symbol.asyncIterator](){return this._sink[Symbol.asyncIterator]()}toDOMStream(t){return this._sink.toDOMStream(t)}toNodeStream(t){return this._sink.toNodeStream(t)}close(){return this.reset()._sink.close()}abort(t){return this.reset()._sink.abort(t)}finish(){return this._autoDestroy?this.close():this.reset(this._sink,this._schema),this}reset(t=this._sink,n=null){return t===this._sink||t instanceof io?this._sink=t:(this._sink=new io,t&&oD(t)?this.toDOMStream({type:"bytes"}).pipeTo(t):t&&sD(t)&&this.toNodeStream({objectMode:!1}).pipe(t)),this._started&&this._schema&&this._writeFooter(this._schema),this._started=!1,this._dictionaryBlocks=[],this._recordBatchBlocks=[],this._dictionaryDeltaOffsets=new Map,(!n||!Bc(n,this._schema))&&(n==null?(this._position=0,this._schema=null):(this._started=!0,this._schema=n,this._writeSchema(n))),this}write(t){let n=null;if(this._sink){if(t==null)return this.finish()&&void 0;if(t instanceof ur&&!(n=t.schema))return this.finish()&&void 0;if(t instanceof Le&&!(n=t.schema))return this.finish()&&void 0}else throw new Error("RecordBatchWriter is closed");if(n&&!Bc(n,this._schema)){if(this._started&&this._autoDestroy)return this.close();this.reset(this._sink,n)}t instanceof Le?t instanceof Lc||this._writeRecordBatch(t):t instanceof ur?this.writeAll(t.batches):wi(t)&&this.writeAll(t)}_writeMessage(t,n=8){let r=n-1,i=hr.encode(t),o=i.byteLength,s=this._writeLegacyIpcFormat?4:8,a=o+s+r&~r,c=a-o-s;return t.headerType===Qt.RecordBatch?this._recordBatchBlocks.push(new cs(a,t.bodyLength,this._position)):t.headerType===Qt.DictionaryBatch&&this._dictionaryBlocks.push(new cs(a,t.bodyLength,this._position)),this._writeLegacyIpcFormat||this._write(Int32Array.of(-1)),this._write(Int32Array.of(a-s)),o>0&&this._write(i),this._writePadding(c)}_write(t){if(this._started){let n=Ot(t);n&&n.byteLength>0&&(this._sink.write(n),this._position+=n.byteLength)}return this}_writeSchema(t){return this._writeMessage(hr.from(t))}_writeFooter(t){return this._writeLegacyIpcFormat?this._write(Int32Array.of(0)):this._write(Int32Array.of(-1,0))}_writeMagic(){return this._write(gu)}_writePadding(t){return t>0?this._write(new Uint8Array(t)):this}_writeRecordBatch(t){let{byteLength:n,nodes:r,bufferRegions:i,buffers:o}=ke.assemble(t),s=new bn(t.numRows,r,i),a=hr.from(s,n);return this._writeDictionaries(t)._writeMessage(a)._writeBodyBuffers(o)}_writeDictionaryBatch(t,n,r=!1){this._dictionaryDeltaOffsets.set(n,t.length+(this._dictionaryDeltaOffsets.get(n)||0));let{byteLength:i,nodes:o,bufferRegions:s,buffers:a}=ke.assemble(new Vt([t])),c=new bn(t.length,o,s),l=new dr(c,n,r),u=hr.from(l,i);return this._writeMessage(u)._writeBodyBuffers(a)}_writeBodyBuffers(t){let n,r,i;for(let o=-1,s=t.length;++o<s;)(n=t[o])&&(r=n.byteLength)>0&&(this._write(n),(i=(r+7&-8)-r)>0&&this._writePadding(i));return this}_writeDictionaries(t){for(let[n,r]of t.dictionaries){let i=this._dictionaryDeltaOffsets.get(n)||0;if(i===0||(r=r?.slice(i)).length>0)for(let o of r.data)this._writeDictionaryBatch(o,n,i>0),i+=o.length}return this}},Ch=class e extends Fc{static writeAll(t,n){let r=new e(n);return _r(t)?t.then(i=>r.writeAll(i)):Xr(t)?v2(r,t):w2(r,t)}},Fh=class e extends Fc{static writeAll(t){let n=new e;return _r(t)?t.then(r=>n.writeAll(r)):Xr(t)?v2(n,t):w2(n,t)}constructor(){super(),this._autoDestroy=!0}_writeSchema(t){return this._writeMagic()._writePadding(2)}_writeFooter(t){let n=as.encode(new as(t,Ee.V5,this._recordBatchBlocks,this._dictionaryBlocks));return super._writeFooter(t)._write(n)._write(Int32Array.of(n.byteLength))._writeMagic()}};function w2(e,t){let n=t;t instanceof ur&&(n=t.batches,e.reset(void 0,t.schema));for(let r of n)e.write(r);return e.finish()}function v2(e,t){var n,r,i,o,s,a,c;return Z(this,void 0,void 0,function*(){try{for(n=!0,r=bi(t);i=yield r.next(),o=i.done,!o;n=!0){c=i.value,n=!1;let l=c;e.write(l)}}catch(l){s={error:l}}finally{try{!n&&!o&&(a=r.return)&&(yield a.call(r))}finally{if(s)throw s.error}}return e.finish()})}function zO(e,t){if(Xr(e))return lq(e,t);if(wi(e))return cq(e,t);throw new Error("toDOMStream() must be called with an Iterable or AsyncIterable")}function cq(e,t){let n=null,r=t?.type==="bytes"||!1,i=t?.highWaterMark||Math.pow(2,24);return new ReadableStream(Object.assign(Object.assign({},t),{start(s){o(s,n||(n=e[Symbol.iterator]()))},pull(s){n?o(s,n):s.close()},cancel(){(n?.return&&n.return()||!0)&&(n=null)}}),Object.assign({highWaterMark:r?i:void 0},t));function o(s,a){let c,l=null,u=s.desiredSize||null;for(;!(l=a.next(r?u:null)).done;)if(ArrayBuffer.isView(l.value)&&(c=Ot(l.value))&&(u!=null&&r&&(u=u-c.byteLength+1),l.value=c),s.enqueue(l.value),u!=null&&--u<=0)return;s.close()}}function lq(e,t){let n=null,r=t?.type==="bytes"||!1,i=t?.highWaterMark||Math.pow(2,24);return new ReadableStream(Object.assign(Object.assign({},t),{start(s){return Z(this,void 0,void 0,function*(){yield o(s,n||(n=e[Symbol.asyncIterator]()))})},pull(s){return Z(this,void 0,void 0,function*(){n?yield o(s,n):s.close()})},cancel(){return Z(this,void 0,void 0,function*(){(n?.return&&(yield n.return())||!0)&&(n=null)})}}),Object.assign({highWaterMark:r?i:void 0},t));function o(s,a){return Z(this,void 0,void 0,function*(){let c,l=null,u=s.desiredSize||null;for(;!(l=yield a.next(r?u:null)).done;)if(ArrayBuffer.isView(l.value)&&(c=Ot(l.value))&&(u!=null&&r&&(u=u-c.byteLength+1),l.value=c),s.enqueue(l.value),u!=null&&--u<=0)return;s.close()})}}function VO(e){return new _2(e)}var _2=class{constructor(t){this._numChunks=0,this._finished=!1,this._bufferedSize=0;let{["readableStrategy"]:n,["writableStrategy"]:r,["queueingStrategy"]:i="count"}=t,o=rD(t,["readableStrategy","writableStrategy","queueingStrategy"]);this._controller=null,this._builder=Nc(o),this._getSize=i!=="bytes"?jO:qO;let{["highWaterMark"]:s=i==="bytes"?Math.pow(2,14):1e3}=Object.assign({},n),{["highWaterMark"]:a=i==="bytes"?Math.pow(2,14):1e3}=Object.assign({},r);this.readable=new ReadableStream({cancel:()=>{this._builder.clear()},pull:c=>{this._maybeFlush(this._builder,this._controller=c)},start:c=>{this._maybeFlush(this._builder,this._controller=c)}},{highWaterMark:s,size:i!=="bytes"?jO:qO}),this.writable=new WritableStream({abort:()=>{this._builder.clear()},write:()=>{this._maybeFlush(this._builder,this._controller)},close:()=>{this._maybeFlush(this._builder.finish(),this._controller)}},{highWaterMark:a,size:c=>this._writeValueAndReturnChunkSize(c)})}_writeValueAndReturnChunkSize(t){let n=this._bufferedSize;return this._bufferedSize=this._getSize(this._builder.append(t)),this._bufferedSize-n}_maybeFlush(t,n){n!=null&&(this._bufferedSize>=n.desiredSize&&++this._numChunks&&this._enqueue(n,t.toVector()),t.finished&&((t.length>0||this._numChunks===0)&&++this._numChunks&&this._enqueue(n,t.toVector()),!this._finished&&(this._finished=!0)&&this._enqueue(n,null)))}_enqueue(t,n){this._bufferedSize=0,this._controller=null,n==null?t.close():t.enqueue(n)}},jO=e=>{var t;return(t=e?.length)!==null&&t!==void 0?t:0},qO=e=>{var t;return(t=e?.byteLength)!==null&&t!==void 0?t:0};function O0(e,t){let n=new io,r=null,i=new ReadableStream({cancel(){return Z(this,void 0,void 0,function*(){yield n.close()})},start(a){return Z(this,void 0,void 0,function*(){yield s(a,r||(r=yield o()))})},pull(a){return Z(this,void 0,void 0,function*(){r?yield s(a,r):a.close()})}});return{writable:new WritableStream(n,Object.assign({highWaterMark:Math.pow(2,14)},e)),readable:i};function o(){return Z(this,void 0,void 0,function*(){return yield(yield Dr.from(n)).open(t)})}function s(a,c){return Z(this,void 0,void 0,function*(){let l=a.desiredSize,u=null;for(;!(u=yield c.next()).done;)if(a.enqueue(u.value),l!=null&&--l<=0)return;a.close()})}}function B0(e,t){let n=new this(e),r=new Hr(n),i=new ReadableStream({cancel(){return Z(this,void 0,void 0,function*(){yield r.cancel()})},pull(s){return Z(this,void 0,void 0,function*(){yield o(s)})},start(s){return Z(this,void 0,void 0,function*(){yield o(s)})}},Object.assign({highWaterMark:Math.pow(2,14)},t));return{writable:new WritableStream(n,e),readable:i};function o(s){return Z(this,void 0,void 0,function*(){let a=null,c=s.desiredSize;for(;a=yield r.read(c||null);)if(s.enqueue(a),c!=null&&(c-=a.byteLength)<=0)return;s.close()})}}function Rh(e){let t=Dr.from(e);return _r(t)?t.then(n=>Rh(n)):t.isAsync()?t.readAll().then(n=>new ur(n)):new ur(t.readAll())}var fq=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},L_),o2),Z_),k_),E_),H_),O_),{compareSchemas:Bc,compareFields:gO,compareTypes:xO});gn.toDOMStream=zO;be.throughDOM=VO;Dr.throughDOM=O0;Cc.throughDOM=O0;ys.throughDOM=O0;Fc.throughDOM=B0;Fh.throughDOM=B0;Ch.throughDOM=B0;function L0(e="ws://localhost:3000/"){let t=[],n=!1,r=null,i,o={open(){n=!0,c()},close(){for(n=!1,r=null,i=null;t.length;)t.shift().reject("Socket closed")},error(l){if(r){let{reject:u}=r;r=null,c(),u(l)}else console.error("WebSocket error: ",l)},message({data:l}){if(r){let{query:u,resolve:f,reject:d}=r;if(r=null,c(),typeof l=="string"){let h=JSON.parse(l);h.error?d(h.error):f(h)}else if(u.type==="exec")f();else if(u.type==="arrow")f(Rh(l.arrayBuffer()));else throw new Error(`Unexpected socket data: ${l}`)}else console.log("WebSocket message: ",l)}};function s(){i=new WebSocket(e);for(let l in o)i.addEventListener(l,o[l])}function a(l,u,f){i==null&&s(),t.push({query:l,resolve:u,reject:f}),n&&!r&&c()}function c(){t.length&&(r=t.shift(),i.send(JSON.stringify(r.query)))}return{get connected(){return n},query(l){return new Promise((u,f)=>a(l,u,f))}}}var pr=class{constructor(t,n){t&&(this.table=String(t)),n&&(this.column=n)}get columns(){return this.column?[this.column]:[]}toString(){let{table:t,column:n}=this;if(n){let r=n.startsWith("*")?n:`"${n}"`;return`${t?`${YO(t)}.`:""}${r}`}else return t?YO(t):"NULL"}};function YO(e){return e.split(".").map(n=>`"${n}"`).join(".")}function XO(e,t){return e instanceof pr&&e.column===t}function Yt(e){return typeof e=="string"?Ia(e):e}function Rc(e){return typeof e=="string"?GO(e):e}function GO(e){return new pr(e)}function Ia(e,t){return arguments.length===1&&(t=e,e=null),new pr(e,t)}function ao(e){switch(typeof e){case"boolean":return e?"TRUE":"FALSE";case"string":return`'${e}'`;case"number":return Number.isFinite(e)?String(e):"NULL";default:if(e==null)return"NULL";if(e instanceof Date){let t=+e;if(Number.isNaN(t))return"NULL";let n=e.getUTCFullYear(),r=e.getUTCMonth(),i=e.getUTCDate();return t===Date.UTC(n,r,i)?`MAKE_DATE(${n}, ${r+1}, ${i})`:`EPOCH_MS(${t})`}else return e instanceof RegExp?`'${e.source}'`:String(e)}}var xs=e=>typeof e?.addEventListener=="function";function k0(e){return e instanceof Ma}var Ma=class{constructor(t,n,r){this._expr=Array.isArray(t)?t:[t],this._deps=n||[],this.annotate(r);let i=this._expr.filter(o=>xs(o));i.length>0?(this._params=Array.from(new Set(i)),this._params.forEach(o=>{o.addEventListener("value",()=>dq(this,this.map?.get("value")))})):this.addEventListener=void 0}get value(){return this}get columns(){let{_params:t,_deps:n}=this;if(t){let r=new Set(t.flatMap(i=>{let o=i.value?.columns;return Array.isArray(o)?o:[]}));if(r.size){let i=new Set(n);return r.forEach(o=>i.add(o)),Array.from(i)}}return n}get column(){return this._deps.length?this._deps[0]:this.columns[0]}annotate(...t){return Object.assign(this,...t)}toString(){return this._expr.map(t=>xs(t)&&!k0(t)?ao(t.value):t).join("")}addEventListener(t,n){let r=this.map||(this.map=new Map);(r.get(t)||(r.set(t,new Set),r.get(t))).add(n)}};function dq(e,t){if(t?.size)return Promise.allSettled(Array.from(t,n=>n(e)))}function S2(e,t){let n=[e[0]],r=new Set,i=t.length;for(let o=0,s=0;o<i;){let a=t[o];xs(a)?n[++s]=a:(Array.isArray(a?.columns)&&a.columns.forEach(l=>r.add(l)),n[s]+=typeof a=="string"?a:ao(a));let c=e[++o];xs(n[s])?n[++s]=c:n[s]+=c}return{spans:n,cols:Array.from(r)}}function q(e,...t){let{spans:n,cols:r}=S2(e,t);return new Ma(n,r)}function I2(e){let t=Yt(e);return q`${t} DESC NULLS LAST`.annotate({label:t?.label,desc:!0})}var Or=e=>({value:e,toString:()=>ao(e)});function $h(e){e(this.op,this),this.children?.forEach(t=>t.visit(e))}function WO(e,t){let n=t.filter(i=>i!=null).map(Yt),r=n.map((i,o)=>o?` ${e} `:"");return n.length===1?r.push(""):n.length>1&&(r[0]="(",r.push(")")),q(r,...n).annotate({op:e,children:n,visit:$h})}var Vn=(...e)=>WO("AND",e.flat()),$c=(...e)=>WO("OR",e.flat()),hq=e=>t=>q`(${e} ${Yt(t)})`.annotate({op:e,a:t,visit:$h}),M2=hq("NOT"),HO=e=>t=>q`(${Yt(t)} ${e})`.annotate({op:e,a:t,visit:$h}),Pc=HO("IS NULL"),bs=HO("IS NOT NULL"),Ta=e=>(t,n)=>q`(${Yt(t)} ${e} ${Yt(n)})`.annotate({op:e,a:t,b:n,visit:$h}),ws=Ta("="),Ph=Ta("<>"),vs=Ta("<"),Uc=Ta(">"),_s=Ta("<="),T2=Ta(">="),A2=Ta("IS DISTINCT FROM"),Uh=Ta("IS NOT DISTINCT FROM");function ZO(e,t,n,r){t=Yt(t);let i=e.startsWith("NOT ")?"NOT ":"";return(n?r?q`${i}(${n[0]} <= ${t} AND ${t} < ${n[1]})`:q`(${t} ${e} ${n[0]} AND ${n[1]})`:q``).annotate({op:e,visit:$h,field:t,range:n})}var Ie=(e,t,n)=>ZO("BETWEEN",e,t,n),E2=(e,t,n)=>ZO("NOT BETWEEN",e,t,n);function zc(e,t){return Array.from({length:e},()=>t)}function wn(e,t){return(...n)=>{let r=n.map(Yt),i=t?`::${t}`:"";return(r.length?q([`${e}(`,...zc(r.length-1,", "),`)${i}`],...r):q`${e}()${i}`).annotate({func:e,args:r})}}var N2=wn("REGEXP_MATCHES"),D2=wn("CONTAINS"),O2=wn("PREFIX"),B2=wn("SUFFIX"),pq=wn("LOWER"),mq=wn("UPPER"),yq=wn("LENGTH"),gq=wn("ISNAN"),xq=wn("ISFINITE"),bq=wn("ISINF");var zh=class e extends Ma{constructor(t,n,r,i,o="",s="",a=""){let c;if(i&&!(o||s||a))c=i?q`${n} OVER "${i}"`:q`${n} OVER ()`;else{let d=o&&s?" ":"",h=(o||s)&&a?" ":"";c=q`${n} OVER (${i?`"${i}" `:""}${o}${d}${s}${h}${a})`}r&&(c=q`(${c})::${r}`);let{_expr:u,_deps:f}=c;super(u,f,{window:t,func:n,type:r,name:i,group:o,order:s,frame:a})}get basis(){return this.column}get label(){let{func:t}=this;return t.label??t.toString()}over(t){let{window:n,func:r,type:i,group:o,order:s,frame:a}=this;return new e(n,r,i,t,o,s,a)}partitionby(...t){let n=t.flat().filter(u=>u).map(Yt),r=q(["PARTITION BY ",zc(n.length-1,", "),""],...n),{window:i,func:o,type:s,name:a,order:c,frame:l}=this;return new e(i,o,s,a,r,c,l)}orderby(...t){let n=t.flat().filter(u=>u).map(Yt),r=q(["ORDER BY ",zc(n.length-1,", "),""],...n),{window:i,func:o,type:s,name:a,group:c,frame:l}=this;return new e(i,o,s,a,c,r,l)}rows(t){let n=JO("ROWS",t),{window:r,func:i,type:o,name:s,group:a,order:c}=this;return new e(r,i,o,s,a,c,n)}range(t){let n=JO("RANGE",t),{window:r,func:i,type:o,name:s,group:a,order:c}=this;return new e(r,i,o,s,a,c,n)}};function JO(e,t){if(xs(t)){let n=q`${t}`;return n.toString=()=>`${e} ${QO(t.value)}`,n}return`${e} ${QO(t)}`}function QO(e){let[t,n]=e,r=t===0?"CURRENT ROW":Number.isFinite(t)?`${Math.abs(t)} PRECEDING`:"UNBOUNDED PRECEDING",i=n===0?"CURRENT ROW":Number.isFinite(n)?`${Math.abs(n)} FOLLOWING`:"UNBOUNDED FOLLOWING";return`BETWEEN ${r} AND ${i}`}function Ri(e,t){return(...n)=>{let r=wn(e)(...n);return new zh(e,r,t)}}var L2=Ri("ROW_NUMBER","INTEGER"),k2=Ri("RANK","INTEGER"),C2=Ri("DENSE_RANK","INTEGER"),F2=Ri("PERCENT_RANK"),R2=Ri("CUME_DIST"),$2=Ri("NTILE"),P2=Ri("LAG"),U2=Ri("LEAD"),z2=Ri("FIRST_VALUE"),j2=Ri("LAST_VALUE"),q2=Ri("NTH_VALUE");function Y2(e,...t){return q(e,...t).annotate({aggregate:!0})}var V2=class e extends Ma{constructor(t,n,r,i,o){n=(n||[]).map(Yt);let{strings:s,exprs:a}=wq(t,n,r,i,o),{spans:c,cols:l}=S2(s,a);super(c,l,{aggregate:t,args:n,type:r,isDistinct:i,filter:o})}get basis(){return this.column}get label(){let{aggregate:t,args:n,isDistinct:r}=this,i=r?"DISTINCT"+(n.length?" ":""):"",o=n.length?`(${i}${n.map(vq).join(", ")})`:"";return`${t.toLowerCase()}${o}`}distinct(){let{aggregate:t,args:n,type:r,filter:i}=this;return new e(t,n,r,!0,i)}where(t){let{aggregate:n,args:r,type:i,isDistinct:o}=this;return new e(n,r,i,o,t)}window(){let{aggregate:t,args:n,type:r,isDistinct:i}=this,o=new e(t,n,null,i);return new zh(t,o,r)}partitionby(...t){return this.window().partitionby(...t)}orderby(...t){return this.window().orderby(...t)}rows(t,n){return this.window().rows(t,n)}range(t,n){return this.window().range(t,n)}};function wq(e,t,n,r,i){let o=`)${n?`::${n}`:""}`,s=[`${e}(${r?"DISTINCT ":""}`],a=[];return t.length?(s=s.concat([...zc(t.length-1,", "),`${o}${i?" FILTER (WHERE ":""}`,...i?[")"]:[]]),a=[...t,...i?[i]:[]]):s[0]+="*"+o,{exprs:a,strings:s}}function vq(e){let t=ao(e);return t&&t.startsWith('"')&&t.endsWith('"')?t.slice(1,-1):t}function Zt(e,t){return(...n)=>new V2(e,n,t)}var Br=Zt("COUNT","INTEGER"),X2=Zt("AVG"),_q=Zt("AVG"),G2=Zt("MAD"),Qr=Zt("MAX"),Kr=Zt("MIN"),Lr=Zt("SUM","DOUBLE"),W2=Zt("PRODUCT"),H2=Zt("MEDIAN"),Z2=Zt("QUANTILE"),J2=Zt("MODE"),Q2=Zt("VARIANCE"),K2=Zt("STDDEV"),tS=Zt("SKEWNESS"),eS=Zt("KURTOSIS"),nS=Zt("ENTROPY"),rS=Zt("VAR_POP"),iS=Zt("STDDEV_POP"),oS=Zt("CORR"),sS=Zt("COVAR_POP"),aS=Zt("REGR_INTERCEPT"),cS=Zt("REGR_SLOPE"),lS=Zt("REGR_COUNT"),Sq=Zt("REGR_R2"),uS=Zt("REGR_SYY"),fS=Zt("REGR_SXX"),Iq=Zt("REGR_SXY"),dS=Zt("REGR_AVGX"),Mq=Zt("REGR_AVGY"),Tq=Zt("FIRST"),hS=Zt("LAST"),vu=Zt("ARG_MIN"),_u=Zt("ARG_MAX"),pS=Zt("STRING_AGG"),mS=Zt("ARRAY_AGG");function jh(e,t){let n=Yt(e),r=q`CAST(${n} AS ${t})`;return Object.defineProperty(r,"label",{enumerable:!0,get(){return e.label}}),Object.defineProperty(r,"aggregate",{enumerable:!0,get(){return e.aggregate||!1}}),r}var Su=e=>jh(e,"DOUBLE"),yS=e=>jh(e,"INTEGER");var qh=e=>{let t=Yt(e);return q`(1000 * (epoch(${t}) - second(${t})) + millisecond(${t}))::DOUBLE`},gS=e=>{let t=Yt(e);return q`MAKE_DATE(2012, MONTH(${t}), 1)`.annotate({label:"month"})},xS=e=>{let t=Yt(e);return q`MAKE_DATE(2012, MONTH(${t}), DAY(${t}))`.annotate({label:"date"})},bS=e=>{let t=Yt(e);return q`MAKE_DATE(2012, 1, DAY(${t}))`.annotate({label:"date"})};var Vh=wn("ST_AsGeoJSON"),KO=wn("ST_X"),t5=wn("ST_Y"),Yh=wn("ST_CENTROID"),wS=e=>KO(Yh(e)),vS=e=>t5(Yh(e));var yt=class e{static select(...t){return new e().select(...t)}static from(...t){return new e().from(...t)}static with(...t){return new e().with(...t)}static union(...t){return new jc("UNION",t.flat())}static unionAll(...t){return new jc("UNION ALL",t.flat())}static intersect(...t){return new jc("INTERSECT",t.flat())}static except(...t){return new jc("EXCEPT",t.flat())}constructor(){this.query={with:[],select:[],from:[],where:[],groupby:[],having:[],window:[],qualify:[],orderby:[]}}clone(){let t=new e;return t.query={...this.query},t}with(...t){let{query:n}=this;if(t.length===0)return n.with;{let r=[],i=(o,s)=>{let a=s.clone();a.cteFor=this,r.push({as:o,query:a})};return t.flat().forEach(o=>{if(o!=null)if(o.as&&o.query)i(o.as,o.query);else for(let s in o)i(s,o[s])}),n.with=n.with.concat(r),this}}select(...t){let{query:n}=this;if(t.length===0)return n.select;{let r=[];for(let i of t.flat())if(i!=null)if(typeof i=="string")r.push({as:i,expr:Yt(i)});else if(i instanceof pr)r.push({as:i.column,expr:i});else if(Array.isArray(i))r.push({as:i[0],expr:i[1]});else for(let o in i)r.push({as:C0(o),expr:Yt(i[o])});return n.select=n.select.concat(r),this}}$select(...t){return this.query.select=[],this.select(...t)}distinct(t=!0){return this.query.distinct=!!t,this}from(...t){let{query:n}=this;if(t.length===0)return n.from;{let r=[];return t.flat().forEach(i=>{if(i!=null)if(typeof i=="string")r.push({as:i,from:Rc(i)});else if(i instanceof pr)r.push({as:i.table,from:i});else if(F0(i)||k0(i))r.push({from:i});else if(Array.isArray(i))r.push({as:C0(i[0]),from:Rc(i[1])});else for(let o in i)r.push({as:C0(o),from:Rc(i[o])})}),n.from=n.from.concat(r),this}}$from(...t){return this.query.from=[],this.from(...t)}sample(t,n){let{query:r}=this;if(arguments.length===0)return r.sample;{let i=t;return typeof t=="number"&&(i=t>0&&t<1?{perc:100*t,method:n}:{rows:Math.round(t),method:n}),r.sample=i,this}}where(...t){let{query:n}=this;return t.length===0?n.where:(n.where=n.where.concat(t.flat().filter(r=>r)),this)}$where(...t){return this.query.where=[],this.where(...t)}groupby(...t){let{query:n}=this;return t.length===0?n.groupby:(n.groupby=n.groupby.concat(t.flat().filter(r=>r).map(Yt)),this)}$groupby(...t){return this.query.groupby=[],this.groupby(...t)}having(...t){let{query:n}=this;return t.length===0?n.having:(n.having=n.having.concat(t.flat().filter(r=>r)),this)}window(...t){let{query:n}=this;if(t.length===0)return n.window;{let r=[];return t.flat().forEach(i=>{if(i!=null)for(let o in i)r.push({as:C0(o),expr:i[o]})}),n.window=n.window.concat(r),this}}qualify(...t){let{query:n}=this;return t.length===0?n.qualify:(n.qualify=n.qualify.concat(t.flat().filter(r=>r)),this)}orderby(...t){let{query:n}=this;return t.length===0?n.orderby:(n.orderby=n.orderby.concat(t.flat().filter(r=>r).map(Yt)),this)}limit(t){let{query:n}=this;return arguments.length===0?n.limit:(n.limit=Number.isFinite(t)?t:void 0,this)}offset(t){let{query:n}=this;return arguments.length===0?n.offset:(n.offset=Number.isFinite(t)?t:void 0,this)}get subqueries(){let{query:t,cteFor:n}=this,i=(n?.query||t).with?.reduce((s,{as:a,query:c})=>(s[a]=c,s),{}),o=[];return t.from.forEach(({from:s})=>{if(F0(s))o.push(s);else if(i[s.table]){let a=i[s.table];o.push(a)}}),o}toString(){let{select:t,distinct:n,from:r,sample:i,where:o,groupby:s,having:a,window:c,qualify:l,orderby:u,limit:f,offset:d,with:h}=this.query,p=[];if(h.length){let g=h.map(({as:y,query:x})=>`"${y}" AS (${x})`);p.push(`WITH ${g.join(", ")}`)}let m=t.map(({as:g,expr:y})=>XO(y,g)&&!y.table?`${y}`:`${y} AS "${g}"`);if(p.push(`SELECT${n?" DISTINCT":""} ${m.join(", ")}`),r.length){let g=r.map(({as:y,from:x})=>{let b=F0(x)?`(${x})`:`${x}`;return!y||y===x.table?b:`${b} AS "${y}"`});p.push(`FROM ${g.join(", ")}`)}if(o.length){let g=o.map(String).filter(y=>y).join(" AND ");g&&p.push(`WHERE ${g}`)}if(i){let{rows:g,perc:y,method:x,seed:b}=i,w=g?`${g} ROWS`:`${y} PERCENT`,_=x?` (${x}${b!=null?`, ${b}`:""})`:"";p.push(`USING SAMPLE ${w}${_}`)}if(s.length&&p.push(`GROUP BY ${s.join(", ")}`),a.length){let g=a.map(String).filter(y=>y).join(" AND ");g&&p.push(`HAVING ${g}`)}if(c.length){let g=c.map(({as:y,expr:x})=>`"${y}" AS (${x})`);p.push(`WINDOW ${g.join(", ")}`)}if(l.length){let g=l.map(String).filter(y=>y).join(" AND ");g&&p.push(`QUALIFY ${g}`)}return u.length&&p.push(`ORDER BY ${u.join(", ")}`),Number.isFinite(f)&&p.push(`LIMIT ${f}`),Number.isFinite(d)&&p.push(`OFFSET ${d}`),p.join(" ")}},jc=class e{constructor(t,n){this.op=t,this.queries=n.map(r=>r.clone()),this.query={orderby:[]}}clone(){let t=new e(this.op,this.queries);return t.query={...this.query},t}orderby(...t){let{query:n}=this;return t.length===0?n.orderby:(n.orderby=n.orderby.concat(t.flat().filter(r=>r).map(Yt)),this)}limit(t){let{query:n}=this;return arguments.length===0?n.limit:(n.limit=Number.isFinite(t)?t:void 0,this)}offset(t){let{query:n}=this;return arguments.length===0?n.offset:(n.offset=Number.isFinite(t)?t:void 0,this)}get subqueries(){let{queries:t,cteFor:n}=this;return n&&t.forEach(r=>r.cteFor=n),t}toString(){let{op:t,queries:n,query:{orderby:r,limit:i,offset:o}}=this,s=[n.join(` ${t} `)];return r.length&&s.push(`ORDER BY ${r.join(", ")}`),Number.isFinite(i)&&s.push(`LIMIT ${i}`),Number.isFinite(o)&&s.push(`OFFSET ${o}`),s.join(" ")}};function F0(e){return e instanceof yt||e instanceof jc}function C0(e){return Aq(e)?e.slice(1,-1):e}function Aq(e){return e[0]==='"'&&e[e.length-1]==='"'}function co(e,t,{replace:n=!1,temp:r=!0,view:i=!1}={}){return"CREATE"+(n?" OR REPLACE ":" ")+(r?"TEMP ":"")+(i?"VIEW":"TABLE")+(n?" ":" IF NOT EXISTS ")+e+" AS "+t}function Xh(e){return`INSTALL ${e}; LOAD ${e}`}function e5(e,{columns:t=Object.keys(e?.[0]||{})}={}){let n=[];if(Array.isArray(t)?(n=t,t=n.reduce((i,o)=>(i[o]=o,i),{})):t&&(n=Object.keys(t)),!n.length)throw new Error("Can not create table from empty column set.");let r=[];for(let i of e){let o=n.map(s=>`${ao(i[s])} AS "${t[s]}"`);r.push(`(SELECT ${o.join(", ")})`)}return r.join(" UNION ALL ")}function R0(e,t,n,r={},i={}){let{select:o=["*"],where:s,view:a,temp:c,replace:l,...u}=r,f=Eq({...i,...u}),d=`${e}('${n}'${f?", "+f:""})`,h=s?` WHERE ${s}`:"",p=`SELECT ${o.join(", ")} FROM ${d}${h}`;return co(t,p,{view:a,temp:c,replace:l})}function SS(e,t,n){return R0("read_csv",e,t,n,{auto_detect:!0,sample_size:-1})}function IS(e,t,n){return R0("read_json",e,t,n,{auto_detect:!0,json_format:"auto"})}function MS(e,t,n){return R0("read_parquet",e,t,n)}function TS(e,t,n={}){let{options:r,...i}=n;if(r){let o=Array.isArray(r)?r.join(", "):typeof r=="string"?r:Object.entries(r).map(([s,a])=>`${s}=${a}`).join(", ");i.open_options=o.toUpperCase()}return R0("st_read",e,t,i)}function AS(e,t,n={}){let{select:r=["*"],...i}=n,o=e5(t),s=r.length===1&&r[0]==="*"?o:`SELECT ${r} FROM ${o}`;return co(e,s,i)}function Eq(e){return Object.entries(e).map(([t,n])=>`${t}=${_S(n)}`).join(", ")}function _S(e){switch(typeof e){case"boolean":return String(e);case"string":return`'${e}'`;case"undefined":case"object":return e==null?"NULL":Array.isArray(e)?"["+e.map(t=>_S(t)).join(", ")+"]":"{"+Object.entries(e).map(([t,n])=>`'${t}': ${_S(n)}`).join(", ")+"}";default:return e}}function n5(e){switch(e){case"BIGINT":case"HUGEINT":case"INTEGER":case"SMALLINT":case"TINYINT":case"UBIGINT":case"UINTEGER":case"USMALLINT":case"UTINYINT":case"DOUBLE":case"FLOAT":case"REAL":case"DECIMAL":return"number";case"DATE":case"TIMESTAMP":case"TIMESTAMPTZ":case"TIMESTAMP WITH TIME ZONE":case"TIME":case"TIMESTAMP_NS":return"date";case"BOOLEAN":return"boolean";case"VARCHAR":case"UUID":return"string";case"LIST":return"array";case"BLOB":case"STRUCT":case"MAP":return"object";default:throw new Error(`Unsupported type: ${e}`)}}var Nq="count",Dq="nulls",Oq="max",Bq="min",Lq="distinct";var kq={[Nq]:Br,[Lq]:e=>Br(e).distinct(),[Oq]:Qr,[Bq]:Kr,[Dq]:e=>Br().where(Pc(e))};function r5({table:e,column:t},n){return yt.from(e).select(n.map(r=>[r,kq[r](t)]))}var i5=()=>Object.create(null),$0=class{constructor(t){this.mc=t,this.clear()}clear(){this.tables=i5()}tableInfo(t){let n=this.tables;if(n[t])return n[t];let r=Cq(this.mc,t).catch(i=>{throw n[t]=null,i});return n[t]=r}async fieldInfo({table:t,column:n,stats:r}){let o=(await this.tableInfo(t))[n];if(o==null)return;if(!r?.length)return o;let s=await this.mc.query(r5(o,r),{persist:!0}),a={...o,...Array.from(s)[0]};for(let c in a){let l=a[c];typeof l=="bigint"&&(a[c]=Number(l))}return a}async queryFields(t){let n=await Fq(this,t);return(await Promise.all(n.map(i=>this.fieldInfo(i)))).filter(i=>i)}};async function Cq(e,t){let n=await e.query(`DESCRIBE ${Rc(t)}`,{type:"json",cache:!1}),r=i5();for(let i of n)r[i.column_name]={table:t,column:i.column_name,sqlType:i.column_type,type:n5(i.column_type),nullable:i.null==="YES"};return r}async function Fq(e,t){return t.length===1&&t[0].column==="*"?Object.values(await e.tableInfo(t[0].table)):t}function s5(e){let t=2166136261;for(let n=0,r=e.length;n<r;++n){let i=e.charCodeAt(n),o=i&65280;o&&(t=o5(t^o>>8)),t=o5(t^i&255)}return Rq(t)}function o5(e){return e+(e<<1)+(e<<4)+(e<<7)+(e<<8)+(e<<24)}function Rq(e){return e+=e<<13,e^=e>>>7,e+=e<<3,e^=e>>>17,e+=e<<5,e&4294967295}var l5=e=>e,P0=class{constructor(t,{selection:n,temp:r=!0}){this.mc=t,this.selection=n,this.temp=r,this.reset()}reset(){this.enabled=!1,this.clients=null,this.indices=null,this.activeView=null}clear(){this.indices&&(this.mc.cancel(Array.from(this.indices.values(),t=>t.result)),this.indices=null)}index(t,n){if(this.clients!==t){let l=Array.from(t,c5),u=l[0]?.from;this.enabled=l.every(f=>f&&f.from===u),this.clients=t,this.activeView=null,this.clear()}if(!this.enabled)return!1;n=n||this.selection.active;let{source:r}=n;if(r&&r===this.activeView?.source)return!0;if(this.clear(),!r)return!1;let i=this.activeView=$q(n);if(!i)return!1;this.mc.logger().warn("DATA CUBE INDEX CONSTRUCTION");let o=this.selection.remove(r),s=this.indices=new Map,{mc:a,temp:c}=this;for(let l of t){if(o.skip(l,n))continue;let u=c5(l),f=l.query(o.predicate(l)).select({...i.columns,...u.count}).groupby(Object.keys(i.columns)),[d]=f.subqueries;if(d){let x=Object.values(i.columns).map(b=>b.columns[0]);zq(d,x)}let h=f.orderby();f.query.orderby=[];let p=f.toString(),g=`cube_index_${(s5(p)>>>0).toString(16)}`,y=a.exec(co(g,p,{temp:c}));s.set(l,{table:g,result:y,order:h,...u})}}async update(){let{clients:t,selection:n,activeView:r}=this,i=r.predicate(n.active.predicate);return Promise.all(Array.from(t).map(o=>this.updateClient(o,i)))}async updateClient(t,n){let r=this.indices.get(t);if(!r)return;n||(n=this.activeView.predicate(this.selection.active.predicate));let{table:i,dims:o,aggr:s,order:a=[]}=r,c=yt.select(o,s).from(i).groupby(o).where(n).orderby(a);return this.mc.updateClient(t,c)}};function $q(e){let{source:t,schema:n}=e,r=e.predicate?.columns;if(!n||!r)return null;let{type:i,scales:o,pixelSize:s=1}=n,a;if(i==="interval"&&o){let c=o.map(l=>Pq(l,s));if(c.some(l=>l==null))return null;c.length===1?(a=l=>l?Ie("active0",l.range.map(c[0])):[],r={active0:c[0](e.predicate.field)}):(a=l=>l?Vn(l.children.map(({range:u},f)=>Ie(`active${f}`,u.map(c[f])))):[],r=Object.fromEntries(e.predicate.children.map((l,u)=>[`active${u}`,c[u](l.field)])))}else if(i==="point")a=l5,r=Object.fromEntries(r.map(c=>[c.toString(),c]));else return null;return{source:t,columns:r,predicate:a}}function Pq(e,t){let{type:n,domain:r,range:i}=e,o,s;switch(n){case"linear":o=l5,s=Yt;break;case"log":o=Math.log,s=a=>q`LN(${Yt(a)})`;break;case"symlog":o=a=>Math.sign(a)*Math.log1p(Math.abs(a)),s=a=>(a=Yt(a),q`SIGN(${a}) * LN(1 + ABS(${a}))`);break;case"sqrt":o=Math.sqrt,s=a=>q`SQRT(${Yt(a)})`;break;case"utc":case"time":o=a=>+a,s=a=>a instanceof Date?+a:qh(Yt(a));break}return o?Uq(r,i,t,o,s):null}function Uq(e,t,n,r,i){let o=r(Math.min(e[0],e[1])),s=r(Math.max(e[0],e[1])),a=Math.abs(r(t[1])-r(t[0]))/(s-o)/n,c=n===1?"":`${n}::INTEGER * `;return l=>q`${c}FLOOR(${a}::DOUBLE * (${i(l)} - ${o}::DOUBLE))::INTEGER`}var a5={from:NaN};function c5(e){if(!e.filterIndexable)return a5;let t=e.query(),n=ES(t);if(!n||!t.groupby)return a5;let r=new Set(t.groupby().map(a=>a.column)),i=[],o=[],s;for(let{as:a,expr:{aggregate:c}}of t.select())switch(c?.toUpperCase?.()){case"COUNT":case"SUM":i.push({[a]:q`SUM("${a}")::DOUBLE`});break;case"AVG":s="_count_",i.push({[a]:q`(SUM("${a}" * ${s}) / SUM(${s}))::DOUBLE`});break;case"MAX":i.push({[a]:q`MAX("${a}")`});break;case"MIN":i.push({[a]:q`MIN("${a}")`});break;default:if(r.has(a))o.push(a);else return null}return{aggr:i,dims:o,count:s?{[s]:q`COUNT(*)`}:{},from:n}}function ES(e){let t=e.subqueries;if(e.select){let r=e.from();if(!r.length)return;if(t.length===0)return r[0].from.table}let n=ES(t[0]);for(let r=1;r<t.length;++r){let i=ES(t[r]);if(i!==void 0&&i!==n)return NaN}return n}function zq(e,t){let n=new Set,r=i=>{n.has(i)||(n.add(i),i.select&&i.from().length&&i.select(t),i.subqueries.forEach(r))};r(e)}var U0=class{constructor(t,n,r=!0){this.mc=t,this.selection=n,this.clients=new Set,this.indexer=r?new P0(this.mc,{...r,selection:n}):null;let{value:i,activate:o}=this.handlers={value:()=>this.update(),activate:s=>this.indexer?.index(this.clients,s)};n.addEventListener("value",i),n.addEventListener("activate",o)}finalize(){let{value:t,activate:n}=this.handlers;this.selection.removeEventListener("value",t),this.selection.removeEventListener("activate",n)}reset(){this.indexer?.reset()}add(t){return(this.clients=new Set(this.clients)).add(t),this}remove(t){return this.clients.has(t)&&(this.clients=new Set(this.clients)).delete(t),this}update(){let{mc:t,indexer:n,clients:r,selection:i}=this;return n?.index(r)?n.update():jq(t,r,i)}};function jq(e,t,n){return Promise.all(Array.from(t).map(r=>{let i=n.predicate(r);if(i!=null)return e.updateClient(r,r.query(i))}))}function z0(){let e,t,n=new Promise((r,i)=>{e=r,t=i});return n.fulfill=r=>(e(r),n),n.reject=r=>(t(r),n),n}function qq(e){return(typeof requestAnimationFrame<"u"?requestAnimationFrame:typeof setImmediate<"u"?setImmediate:setTimeout)(e)}function u5(e,t,n){let r=[],i=0;function o(){let s=Vq(r,t);r=[],i=0;for(let a of s)Xq(a,e,n),Hq(a,t)}return{add(s,a){s.request.type==="arrow"?(i=i||qq(()=>o()),r.push({entry:s,priority:a,index:r.length})):e(s,a)}}}function Vq(e,t){let n=[],r=new Map;for(let i of e){let{entry:{request:o}}=i,s=Yq(o.query,t);if(!r.has(s)){let a=[];n.push(a),r.set(s,a)}r.get(s).push(i)}return n}function Yq(e,t){let n=`${e}`;if(e instanceof yt&&!t.get(n)){if(e.orderby().length||e.where().length||e.qualify().length||e.having().length)return n;let r=e.clone().$select("*"),i=e.groupby();if(i.length){let o={};e.select().forEach(({as:s,expr:a})=>o[s]=a),r.$groupby(i.map(s=>s instanceof pr&&o[s.column]||s))}return`${r}`}else return n}function Xq(e,t,n){if(Gq(e))t({request:{type:"arrow",cache:!1,record:!1,query:Wq(e,n)},result:e.result=z0()});else for(let{entry:r,priority:i}of e)t(r,i)}function Gq(e){if(e.length>1){let t=`${e[0].entry.request.query}`;for(let n=1;n<e.length;++n)if(t!==`${e[n].entry.request.query}`)return!0}return!1}function Wq(e,t){let n=e.maps=[],r=new Map;for(let s of e){let{query:a}=s.entry.request,c=[];n.push(c);for(let{as:l,expr:u}of a.select()){let f=`${u}`;r.has(f)||r.set(f,[`col${r.size}`,u]);let[d]=r.get(f);c.push([d,l])}t(`${a}`)}let i=e[0].entry.request.query.clone(),o=i.groupby();if(o.length){let s={};e.maps[0].forEach(([a,c])=>s[c]=a),i.$groupby(o.map(a=>a instanceof pr&&s[a.column]||a))}return i.$select(Array.from(r.values()))}async function Hq(e,t){let{maps:n,result:r}=e;if(!n)return;let i;try{i=await r}catch(o){for(let{entry:s}of e)s.result.reject(o);return}e.forEach(({entry:o},s)=>{let{request:a,result:c}=o,l=Zq(i,n[s]);a.cache&&t.set(String(a.query),l),c.fulfill(l)})}function Zq(e,t){if(t){let n={};for(let[r,i]of t)n[i]=e.getChild(r);return new e.constructor(n)}else return e}var Jq=typeof requestIdleCallback<"u"?requestIdleCallback:setTimeout,f5=()=>({get:()=>{},set:(e,t)=>t,clear:()=>{}});function d5({max:e=1e3,ttl:t=3*60*60*1e3}={}){let n=new Map;function r(){let i=performance.now()-t,o=null,s=1/0;for(let[a,c]of n){let{last:l}=c;l<s&&(o=a,s=l),i>l&&n.delete(a)}o&&n.delete(o)}return{get(i){let o=n.get(i);if(o)return o.last=performance.now(),o.value},set(i,o){return n.set(i,{last:performance.now(),value:o}),n.size>e&&Jq(r),o},clear(){n=new Map}}}function h5(e){let t=Array.from({length:e},()=>({head:null,tail:null}));return{isEmpty(){return t.every(n=>!n.head)},insert(n,r){let i=t[r];if(!i)throw new Error(`Invalid queue priority rank: ${r}`);let o={item:n,next:null};i.head===null?i.head=i.tail=o:i.tail=i.tail.next=o},remove(n){for(let r of t){let{head:i,tail:o}=r;for(let s=null,a=i;a;s=a,a=a.next)n(a.item)&&(a===i?i=a.next:s.next=a.next,a===o&&(o=s||i));r.head=i,r.tail=o}},next(){for(let n of t){let{head:r}=n;if(r!==null)return n.head=r.next,n.tail===r&&(n.tail=null),r.item}}}}var lo={High:0,Normal:1,Low:2};function p5(){let e=h5(3),t,n,r,i=[],o=null,s;function a(){if(o||e.isEmpty())return;let{request:f,result:d}=e.next();o=u(f,d),o.finally(()=>{o=null,a()})}function c(f,d=lo.Normal){e.insert(f,d),a()}function l(f){i.length&&f&&i.forEach(d=>d.add(f))}async function u(f,d){try{let{query:h,type:p,cache:m=!1,record:g=!0,options:y}=f,x=h?`${h}`:null;if(g&&l(x),m){let _=n.get(x);if(_){r.debug("Cache"),d.fulfill(_);return}}let b=performance.now(),w=await t.query({type:p,sql:x,...y});m&&n.set(x,w),r.debug(`Request: ${(performance.now()-b).toFixed(1)}`),d.fulfill(w)}catch(h){d.reject(h)}}return{cache(f){return f!==void 0?n=f===!0?d5():f||f5():n},logger(f){return f?r=f:r},connector(f){return f?t=f:t},consolidate(f){f&&!s?s=u5(c,n,l):!f&&s&&(s=null)},request(f,d=lo.Normal){let h=z0(),p={request:f,result:h};return s?s.add(p,d):c(p,d),h},cancel(f){let d=new Set(f);e.remove(({result:h})=>d.has(h))},clear(){e.remove(({result:f})=>(f.reject("Cleared"),!0))},record(){let f=[],d={add(h){f.push(h)},reset(){f=[]},snapshot(){return f.slice()},stop(){return i=i.filter(h=>h!==d),f}};return i.push(d),d}}}function m5(){return{debug(){},info(){},log(){},warn(){},error(){}}}var j0;function ti(e){return e?j0=e:j0==null&&(j0=new Gh),j0}var Gh=class{constructor(t=L0(),n={}){let{logger:r=console,manager:i=p5()}=n;this.catalog=new $0(this),this.manager=i,this.logger(r),this.configure(n),this.databaseConnector(t),this.clear()}logger(t){return arguments.length&&(this._logger=t||m5(),this.manager.logger(this._logger)),this._logger}configure({cache:t=!0,consolidate:n=!0,indexes:r=!0}){this.manager.cache(t),this.manager.consolidate(n),this.indexes=r}clear({clients:t=!0,cache:n=!0,catalog:r=!1}={}){this.manager.clear(),t&&(this.clients?.forEach(i=>this.disconnect(i)),this.filterGroups?.forEach(i=>i.finalize()),this.clients=new Set,this.filterGroups=new Map),n&&this.manager.cache().clear(),r&&this.catalog.clear()}databaseConnector(t){return this.manager.connector(t)}cancel(t){this.manager.cancel(t)}exec(t,{priority:n=lo.Normal}={}){return t=Array.isArray(t)?t.join(`;
11
- `):t,this.manager.request({type:"exec",query:t},n)}query(t,{type:n="arrow",cache:r=!0,priority:i=lo.Normal,...o}={}){return this.manager.request({type:n,query:t,cache:r,options:o},i)}prefetch(t,n={}){return this.query(t,{...n,cache:!0,priority:lo.Low})}createBundle(t,n,r=lo.Low){let i={name:t,queries:n};return this.manager.request({type:"create-bundle",options:i},r)}loadBundle(t,n=lo.High){let r={name:t};return this.manager.request({type:"load-bundle",options:r},n)}updateClient(t,n,r=lo.Normal){return t.queryPending(),this.query(n,{priority:r}).then(i=>t.queryResult(i).update(),i=>{t.queryError(i),this._logger.error(i)})}requestQuery(t,n){return this.filterGroups.get(t.filterBy)?.reset(),n?this.updateClient(t,n):t.update()}async connect(t){let{catalog:n,clients:r,filterGroups:i,indexes:o}=this;if(r.has(t))throw new Error("Client already connected.");r.add(t),t.coordinator=this;let s=t.fields();s?.length&&t.fieldInfo(await n.queryFields(s));let a=t.filterBy;if(a)if(i.has(a))i.get(a).add(t);else{let c=new U0(this,a,o);i.set(a,c.add(t))}t.requestQuery()}disconnect(t){let{clients:n,filterGroups:r}=this;n.has(t)&&(n.delete(t),r.get(t.filterBy)?.remove(t),t.coordinator=null)}};var q0=class{constructor(){this._callbacks=new Map}addEventListener(t,n){this._callbacks.has(t)||this._callbacks.set(t,{callbacks:new Set,pending:null,queue:new NS}),this._callbacks.get(t).callbacks.add(n)}removeEventListener(t,n){let r=this._callbacks.get(t);r&&r.callbacks.delete(n)}willEmit(t,n){return n}emitQueueFilter(){return null}cancel(t){this._callbacks.get(t)?.queue.clear()}emit(t,n){let r=this._callbacks.get(t)||{};if(r.pending)r.queue.enqueue(n,this.emitQueueFilter(t,n));else{let i=this.willEmit(t,n),{callbacks:o,queue:s}=r;if(o?.size){let a=Promise.allSettled(Array.from(o,c=>c(i))).then(()=>{r.pending=null,s.isEmpty()||this.emit(t,s.dequeue())});r.pending=a}}}},NS=class{constructor(){this.clear()}clear(){this.next=null}isEmpty(){return!this.next}enqueue(t,n){let r={value:t};if(n&&this.next){let i=this;for(;i.next;)n(i.next.value)?i=i.next:i.next=i.next.next;i.next=r}else this.next=r}dequeue(){let{next:t}=this;return this.next=t?.next,t?.value}};function Wh(e,t){return e===t?!1:e instanceof Date&&t instanceof Date?+e!=+t:Array.isArray(e)&&Array.isArray(t)?Qq(e,t):!0}function Qq(e,t){if(e.length!==t.length)return!0;for(let n=0;n<e.length;++n)if(e[n]!==t[n])return!0;return!1}function mr(e){return e instanceof Aa}var Aa=class e extends q0{constructor(t){super(),this._value=t}static value(t){return new e(t)}static array(t){if(t.some(n=>mr(n))){let n=new e,r=()=>n.update(t.map(i=>mr(i)?i.value:i));return r(),t.forEach(i=>mr(i)?i.addEventListener("value",r):0),n}return new e(t)}get value(){return this._value}update(t,{force:n}={}){return Wh(this._value,t)||n?this.emit("value",t):this.cancel("value"),this}willEmit(t,n){return t==="value"&&(this._value=n),n}};function ei(e){return e instanceof Ss}var Ss=class e extends Aa{static intersect({cross:t=!1}={}){return new e(new qc({cross:t}))}static union({cross:t=!1}={}){return new e(new qc({cross:t,union:!0}))}static single({cross:t=!1}={}){return new e(new qc({cross:t,single:!0}))}static crossfilter(){return new e(new qc({cross:!0}))}constructor(t=new qc){super([]),this._resolved=this._value,this._resolver=t}clone(){let t=new e(this._resolver);return t._value=t._resolved=this._value,t}remove(t){let n=this.clone();return n._value=n._resolved=n._resolver.resolve(this._resolved,{source:t}),n._value.active={source:t},n}get active(){return this.clauses.active}get value(){return this.active?.value}get clauses(){return super.value}get single(){return this._resolver.single}activate(t){this.emit("activate",t)}update(t){return this._resolved=this._resolver.resolve(this._resolved,t,!0),this._resolved.active=t,super.update(this._resolved)}willEmit(t,n){return t==="value"?(this._value=n,this.value):n}emitQueueFilter(t,n){return t==="value"?this._resolver.queueFilter(n):null}skip(t,n){return this._resolver.skip(t,n)}predicate(t,n=!1){let{clauses:r}=this,i=n?null:r.active;return this._resolver.predicate(r,i,t)}},qc=class{constructor({union:t,cross:n,single:r}={}){this.union=!!t,this.cross=!!n,this.single=!!r}resolve(t,n,r=!1){let{source:i,predicate:o}=n,s=t.filter(c=>i!==c.source),a=this.single?[]:s;return this.single&&r&&s.forEach(c=>c.source?.reset?.()),o&&a.push(n),a}skip(t,n){return this.cross&&n?.clients?.has(t)}predicate(t,n,r){let{union:i}=this;if(this.skip(r,n))return;let o=t.filter(s=>!this.skip(r,s)).map(s=>s.predicate);return i&&o.length>1?$c(o):o}queueFilter(t){if(this.cross){let n=t.active?.source;return r=>r.active?.source!==n}}};function DS(){let e=new Set,t,n=new Promise(r=>t=r);return{pending(r){e.add(r)},ready(r){return e.delete(r),e.size===0},resolve(){n=new Promise(r=>{t(),t=r})},get promise(){return n}}}var jN={};wr(jN,{Fixed:()=>Vc,Param:()=>Aa,Query:()=>yt,Selection:()=>Ss,agg:()=>Y2,align:()=>r6,and:()=>Vn,area:()=>g8,areaX:()=>x8,areaY:()=>b8,argmax:()=>_u,argmin:()=>vu,arrayAgg:()=>mS,arrow:()=>lN,aspectRatio:()=>i6,avg:()=>X2,axis:()=>o6,axisFx:()=>pN,axisFy:()=>mN,axisX:()=>dN,axisY:()=>hN,barX:()=>S8,barY:()=>I8,bin:()=>$v,cast:()=>jh,castDouble:()=>Su,castInteger:()=>yS,cell:()=>M8,cellX:()=>T8,cellY:()=>A8,centroid:()=>Yh,centroidX:()=>wS,centroidY:()=>vS,circle:()=>k8,colorClamp:()=>AE,colorDomain:()=>ME,colorInterpolate:()=>OE,colorLabel:()=>kE,colorLegend:()=>PN,colorN:()=>EE,colorNice:()=>NE,colorPivot:()=>BE,colorRange:()=>TE,colorReverse:()=>CE,colorScale:()=>IE,colorScheme:()=>DE,colorSymmetric:()=>LE,colorTickFormat:()=>RE,colorZero:()=>FE,column:()=>Ia,contour:()=>Q8,coordinator:()=>ti,corr:()=>oS,count:()=>Br,covarPop:()=>sS,create:()=>co,cume_dist:()=>R2,dateDay:()=>bS,dateMonth:()=>gS,dateMonthDay:()=>xS,delaunayLink:()=>sN,delaunayMesh:()=>aN,denseLine:()=>J8,dense_rank:()=>C2,density:()=>Z8,densityX:()=>W8,densityY:()=>H8,dot:()=>O8,dotX:()=>B8,dotY:()=>L8,entropy:()=>nS,eq:()=>ws,facetGrid:()=>_4,facetLabel:()=>S4,facetMargin:()=>g4,facetMarginBottom:()=>b4,facetMarginLeft:()=>w4,facetMarginRight:()=>v4,facetMarginTop:()=>x4,first_value:()=>z2,frame:()=>fN,from:()=>BP,fxAlign:()=>O4,fxAriaDescription:()=>H4,fxAriaLabel:()=>W4,fxAxis:()=>C4,fxDomain:()=>I4,fxFontVariant:()=>G4,fxGrid:()=>j4,fxInset:()=>A4,fxInsetLeft:()=>E4,fxInsetRight:()=>N4,fxLabel:()=>V4,fxLabelAnchor:()=>Y4,fxLabelOffset:()=>X4,fxLine:()=>q4,fxNice:()=>T4,fxPadding:()=>B4,fxPaddingInner:()=>L4,fxPaddingOuter:()=>k4,fxRange:()=>M4,fxReverse:()=>Z4,fxRound:()=>D4,fxTickFormat:()=>U4,fxTickPadding:()=>P4,fxTickRotate:()=>z4,fxTickSize:()=>R4,fxTickSpacing:()=>$4,fxTicks:()=>F4,fyAlign:()=>iE,fyAriaDescription:()=>_E,fyAriaLabel:()=>vE,fyAxis:()=>cE,fyDomain:()=>J4,fyFontVariant:()=>wE,fyGrid:()=>mE,fyInset:()=>tE,fyInsetBottom:()=>nE,fyInsetTop:()=>eE,fyLabel:()=>gE,fyLabelAnchor:()=>xE,fyLabelOffset:()=>bE,fyLine:()=>yE,fyNice:()=>K4,fyPadding:()=>oE,fyPaddingInner:()=>sE,fyPaddingOuter:()=>aE,fyRange:()=>Q4,fyReverse:()=>SE,fyRound:()=>rE,fyTickFormat:()=>hE,fyTickPadding:()=>dE,fyTickRotate:()=>pE,fyTickSize:()=>uE,fyTickSpacing:()=>fE,fyTicks:()=>lE,geo:()=>wN,geojson:()=>Vh,graticule:()=>_N,grid:()=>a6,gridFx:()=>xN,gridFy:()=>bN,gridX:()=>yN,gridY:()=>gN,gt:()=>Uc,gte:()=>T2,hconcat:()=>TP,height:()=>Q3,hexagon:()=>C8,hexbin:()=>eN,hexgrid:()=>nN,highlight:()=>SN,hspace:()=>NP,hull:()=>cN,image:()=>G8,inset:()=>s6,intervalX:()=>NN,intervalXY:()=>ON,intervalY:()=>DN,isBetween:()=>Ie,isDistinct:()=>A2,isNotBetween:()=>E2,isNotDistinct:()=>Uh,isNotNull:()=>bs,isNull:()=>Pc,kurtosis:()=>eS,label:()=>c6,lag:()=>P2,last:()=>hS,last_value:()=>j2,lead:()=>U2,lengthClamp:()=>n8,lengthDomain:()=>t8,lengthNice:()=>r8,lengthRange:()=>e8,lengthScale:()=>KE,lengthZero:()=>i8,line:()=>w8,lineX:()=>v8,lineY:()=>_8,link:()=>uN,literal:()=>Or,loadCSV:()=>SS,loadExtension:()=>Xh,loadJSON:()=>IS,loadObjects:()=>AS,loadParquet:()=>MS,loadSpatial:()=>TS,lt:()=>vs,lte:()=>_s,mad:()=>G2,margin:()=>W3,marginBottom:()=>n6,marginLeft:()=>K3,marginRight:()=>t6,marginTop:()=>e6,margins:()=>G3,max:()=>Qr,median:()=>H2,menu:()=>wP,min:()=>Kr,mode:()=>J2,name:()=>Y3,nearestX:()=>AN,nearestY:()=>EN,neq:()=>Ph,not:()=>M2,nth_value:()=>q2,ntile:()=>$2,opacityClamp:()=>zE,opacityDomain:()=>PE,opacityLabel:()=>qE,opacityLegend:()=>UN,opacityNice:()=>jE,opacityRange:()=>UE,opacityReverse:()=>VE,opacityScale:()=>$E,opacityTickFormat:()=>XE,opacityZero:()=>YE,or:()=>$c,padding:()=>l6,pan:()=>BN,panX:()=>LN,panY:()=>kN,panZoom:()=>CN,panZoomX:()=>FN,panZoomY:()=>RN,percent_rank:()=>F2,plot:()=>LP,product:()=>W2,projectionClip:()=>m8,projectionDomain:()=>l8,projectionInset:()=>u8,projectionInsetBottom:()=>p8,projectionInsetLeft:()=>f8,projectionInsetRight:()=>d8,projectionInsetTop:()=>h8,projectionParallels:()=>s8,projectionPrecision:()=>a8,projectionRotate:()=>c8,projectionType:()=>o8,quantile:()=>Z2,rClamp:()=>ZE,rDomain:()=>WE,rNice:()=>JE,rRange:()=>HE,rScale:()=>GE,rZero:()=>QE,rank:()=>k2,raster:()=>K8,rasterTile:()=>tN,rect:()=>E8,rectX:()=>N8,rectY:()=>D8,regressionY:()=>rN,round:()=>u6,row_number:()=>L2,ruleX:()=>P8,ruleY:()=>U8,search:()=>vP,skewness:()=>tS,slider:()=>_P,sphere:()=>vN,spike:()=>X8,sql:()=>q,stddev:()=>K2,stddevPop:()=>iS,stringAgg:()=>pS,style:()=>Z3,sum:()=>Lr,symbolLegend:()=>zN,table:()=>SP,text:()=>F8,textX:()=>R8,textY:()=>$8,tickX:()=>z8,tickY:()=>j8,toggle:()=>Sd,toggleColor:()=>TN,toggleX:()=>IN,toggleY:()=>MN,varPop:()=>rS,variance:()=>Q2,vconcat:()=>MP,vector:()=>q8,vectorX:()=>V8,vectorY:()=>Y8,voronoi:()=>iN,voronoiMesh:()=>oN,vspace:()=>EP,width:()=>J3,xAlign:()=>w6,xAriaDescription:()=>$6,xAriaLabel:()=>R6,xAxis:()=>I6,xClamp:()=>x6,xDomain:()=>d6,xFontVariant:()=>F6,xGrid:()=>O6,xInset:()=>m6,xInsetLeft:()=>y6,xInsetRight:()=>g6,xLabel:()=>L6,xLabelAnchor:()=>k6,xLabelOffset:()=>C6,xLine:()=>B6,xNice:()=>p6,xPadding:()=>v6,xPaddingInner:()=>_6,xPaddingOuter:()=>S6,xRange:()=>h6,xReverse:()=>P6,xRound:()=>b6,xScale:()=>f6,xTickFormat:()=>N6,xTickPadding:()=>E6,xTickRotate:()=>D6,xTickSize:()=>T6,xTickSpacing:()=>A6,xTicks:()=>M6,xZero:()=>U6,xyDomain:()=>H3,yAlign:()=>Z6,yAriaDescription:()=>p4,yAriaLabel:()=>h4,yAxis:()=>t4,yClamp:()=>W6,yDomain:()=>j6,yFontVariant:()=>d4,yGrid:()=>a4,yInset:()=>Y6,yInsetBottom:()=>G6,yInsetTop:()=>X6,yLabel:()=>l4,yLabelAnchor:()=>u4,yLabelOffset:()=>f4,yLine:()=>c4,yNice:()=>V6,yPadding:()=>J6,yPaddingInner:()=>Q6,yPaddingOuter:()=>K6,yRange:()=>q6,yReverse:()=>m4,yRound:()=>H6,yScale:()=>z6,yTickFormat:()=>o4,yTickPadding:()=>i4,yTickRotate:()=>s4,yTickSize:()=>n4,yTickSpacing:()=>r4,yTicks:()=>e4,yZero:()=>y4});var Vc=Symbol("Fixed"),ni=Symbol("Transient"),Hh=Symbol("Transform");var Av={};wr(Av,{Area:()=>Fl,Arrow:()=>sy,BarX:()=>ay,BarY:()=>cy,Cell:()=>Rl,Contour:()=>gy,Density:()=>wy,Dot:()=>$l,Frame:()=>Qm,Geo:()=>vy,Hexgrid:()=>_y,Image:()=>Sy,Line:()=>Pl,Link:()=>iy,Mark:()=>vt,Raster:()=>yy,Rect:()=>zl,RuleX:()=>Gm,RuleY:()=>Wm,Text:()=>Ll,TickX:()=>dy,TickY:()=>hy,Tip:()=>Km,Vector:()=>Cl,area:()=>ry,areaX:()=>cc,areaY:()=>oa,arrow:()=>u$,auto:()=>v$,autoSpec:()=>ZA,axisFx:()=>Xw,axisFy:()=>Yw,axisX:()=>Zm,axisY:()=>Hm,barX:()=>jo,barY:()=>qo,bin:()=>ia,binX:()=>Uo,binY:()=>zo,bollinger:()=>dc,bollingerX:()=>A$,bollingerY:()=>E$,boxX:()=>N$,boxY:()=>D$,cell:()=>lc,cellX:()=>d$,cellY:()=>h$,centroid:()=>T9,circle:()=>y$,cluster:()=>M9,column:()=>dn,contour:()=>P$,crosshair:()=>j$,crosshairX:()=>q$,crosshairY:()=>V$,delaunayLink:()=>G$,delaunayMesh:()=>W$,density:()=>K$,differenceY:()=>n9,dodgeX:()=>U9,dodgeY:()=>z9,dot:()=>yi,dotX:()=>p$,dotY:()=>m$,filter:()=>SF,find:()=>BF,formatIsoDate:()=>oA,formatMonth:()=>RF,formatWeekday:()=>$F,frame:()=>Yf,geo:()=>yv,geoCentroid:()=>A9,graticule:()=>i9,gridFx:()=>Zw,gridFy:()=>Ww,gridX:()=>Hw,gridY:()=>Gw,group:()=>Pm,groupX:()=>tc,groupY:()=>ec,groupZ:()=>$m,hexagon:()=>g$,hexbin:()=>o9,hexgrid:()=>s9,hull:()=>H$,identity:()=>G,image:()=>c9,indexOf:()=>Te,initializer:()=>_e,interpolateNearest:()=>r3,interpolateNone:()=>mv,interpolatorBarycentric:()=>n3,interpolatorRandomWalk:()=>i3,legend:()=>B7,line:()=>Ul,lineX:()=>uc,lineY:()=>fc,linearRegressionX:()=>f9,linearRegressionY:()=>d9,link:()=>sv,map:()=>gr,mapX:()=>id,mapY:()=>od,marks:()=>Ke,normalize:()=>Mv,normalizeX:()=>Y9,normalizeY:()=>X9,plot:()=>ey,pointer:()=>Uf,pointerX:()=>zf,pointerY:()=>Nl,raster:()=>C$,rect:()=>uy,rectX:()=>ed,rectY:()=>nd,reverse:()=>IF,ruleX:()=>qr,ruleY:()=>Vr,scale:()=>$o,select:()=>W9,selectFirst:()=>M3,selectLast:()=>T3,selectMaxX:()=>J9,selectMaxY:()=>Q9,selectMinX:()=>H9,selectMinY:()=>Z9,shiftX:()=>G9,shuffle:()=>MF,sort:()=>lw,sphere:()=>r9,spike:()=>d7,stackX:()=>GA,stackX1:()=>e$,stackX2:()=>n$,stackY:()=>WA,stackY1:()=>r$,stackY2:()=>i$,text:()=>Po,textX:()=>$w,textY:()=>Pw,tickX:()=>dv,tickY:()=>hv,tip:()=>Kw,transform:()=>hn,tree:()=>b3,treeLink:()=>vv,treeNode:()=>Iy,valueof:()=>pt,vector:()=>FA,vectorX:()=>jw,vectorY:()=>qw,voronoi:()=>Z$,voronoiMesh:()=>J$,window:()=>sd,windowX:()=>_$,windowY:()=>S$});function Gt(e,t){return e==null||t==null?NaN:e<t?-1:e>t?1:e>=t?0:NaN}function Yn(e,t){return e==null||t==null?NaN:t<e?-1:t>e?1:t>=e?0:NaN}function Is(e){let t,n,r;e.length!==2?(t=Gt,n=(a,c)=>Gt(e(a),c),r=(a,c)=>e(a)-c):(t=e===Gt||e===Yn?e:eV,n=e,r=e);function i(a,c,l=0,u=a.length){if(l<u){if(t(c,c)!==0)return u;do{let f=l+u>>>1;n(a[f],c)<0?l=f+1:u=f}while(l<u)}return l}function o(a,c,l=0,u=a.length){if(l<u){if(t(c,c)!==0)return u;do{let f=l+u>>>1;n(a[f],c)<=0?l=f+1:u=f}while(l<u)}return l}function s(a,c,l=0,u=a.length){let f=i(a,c,l,u-1);return f>l&&r(a[f-1],c)>-r(a[f],c)?f-1:f}return{left:i,center:s,right:o}}function eV(){return 0}function Zh(e){return e===null?NaN:+e}function*y5(e,t){if(t===void 0)for(let n of e)n!=null&&(n=+n)>=n&&(yield n);else{let n=-1;for(let r of e)(r=t(r,++n,e))!=null&&(r=+r)>=r&&(yield r)}}var g5=Is(Gt),x5=g5.right,nV=g5.left,rV=Is(Zh).center,Ms=x5;var Jh=b5(w5),OS=b5(iV);function b5(e){return function(t,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:s}=t;if(!((o=Math.floor(o))>=0))throw new RangeError("invalid width");if(!((s=Math.floor(s!==void 0?s:i.length/o))>=0))throw new RangeError("invalid height");if(!o||!s||!n&&!r)return t;let a=n&&e(n),c=r&&e(r),l=i.slice();return a&&c?(Iu(a,l,i,o,s),Iu(a,i,l,o,s),Iu(a,l,i,o,s),Mu(c,i,l,o,s),Mu(c,l,i,o,s),Mu(c,i,l,o,s)):a?(Iu(a,i,l,o,s),Iu(a,l,i,o,s),Iu(a,i,l,o,s)):c&&(Mu(c,i,l,o,s),Mu(c,l,i,o,s),Mu(c,i,l,o,s)),t}}function Iu(e,t,n,r,i){for(let o=0,s=r*i;o<s;)e(t,n,o,o+=r,1)}function Mu(e,t,n,r,i){for(let o=0,s=r*i;o<r;++o)e(t,n,o,o+s,r)}function iV(e){let t=w5(e);return(n,r,i,o,s)=>{i<<=2,o<<=2,s<<=2,t(n,r,i+0,o+0,s),t(n,r,i+1,o+1,s),t(n,r,i+2,o+2,s),t(n,r,i+3,o+3,s)}}function w5(e){let t=Math.floor(e);if(t===e)return oV(e);let n=e-t,r=2*e+1;return(i,o,s,a,c)=>{if(!((a-=c)>=s))return;let l=t*o[s],u=c*t,f=u+c;for(let d=s,h=s+u;d<h;d+=c)l+=o[Math.min(a,d)];for(let d=s,h=a;d<=h;d+=c)l+=o[Math.min(a,d+u)],i[d]=(l+n*(o[Math.max(s,d-f)]+o[Math.min(a,d+f)]))/r,l-=o[Math.max(s,d-u)]}}function oV(e){let t=2*e+1;return(n,r,i,o,s)=>{if(!((o-=s)>=i))return;let a=e*r[i],c=s*e;for(let l=i,u=i+c;l<u;l+=s)a+=r[Math.min(o,l)];for(let l=i,u=o;l<=u;l+=s)a+=r[Math.min(o,l+c)],n[l]=a/t,a-=r[Math.max(i,l-c)]}}function uo(e,t){let n=0;if(t===void 0)for(let r of e)r!=null&&(r=+r)>=r&&++n;else{let r=-1;for(let i of e)(i=t(i,++r,e))!=null&&(i=+i)>=i&&++n}return n}function sV(e){return e.length|0}function aV(e){return!(e>0)}function cV(e){return typeof e!="object"||"length"in e?e:Array.from(e)}function lV(e){return t=>e(...t)}function V0(...e){let t=typeof e[e.length-1]=="function"&&lV(e.pop());e=e.map(cV);let n=e.map(sV),r=e.length-1,i=new Array(r+1).fill(0),o=[];if(r<0||n.some(aV))return o;for(;;){o.push(i.map((a,c)=>e[c][a]));let s=r;for(;++i[s]===n[s];){if(s===0)return t?o.map(t):o;i[s--]=0}}}function Y0(e,t){var n=0,r=0;return Float64Array.from(e,t===void 0?i=>n+=+i||0:i=>n+=+t(i,r++,e)||0)}function Ea(e,t){let n=0,r,i=0,o=0;if(t===void 0)for(let s of e)s!=null&&(s=+s)>=s&&(r=s-i,i+=r/++n,o+=r*(s-i));else{let s=-1;for(let a of e)(a=t(a,++s,e))!=null&&(a=+a)>=a&&(r=a-i,i+=r/++n,o+=r*(a-i))}if(n>1)return o/(n-1)}function ri(e,t){let n=Ea(e,t);return n&&Math.sqrt(n)}function ae(e,t){let n,r;if(t===void 0)for(let i of e)i!=null&&(n===void 0?i>=i&&(n=r=i):(n>i&&(n=i),r<i&&(r=i)));else{let i=-1;for(let o of e)(o=t(o,++i,e))!=null&&(n===void 0?o>=o&&(n=r=o):(n>o&&(n=o),r<o&&(r=o)))}return[n,r]}var vn=class{constructor(){this._partials=new Float64Array(32),this._n=0}add(t){let n=this._partials,r=0;for(let i=0;i<this._n&&i<32;i++){let o=n[i],s=t+o,a=Math.abs(t)<Math.abs(o)?t-(s-o):o-(s-t);a&&(n[r++]=a),t=s}return n[r]=t,this._n=r+1,this}valueOf(){let t=this._partials,n=this._n,r,i,o,s=0;if(n>0){for(s=t[--n];n>0&&(r=s,i=t[--n],s=r+i,o=i-(s-r),!o););n>0&&(o<0&&t[n-1]<0||o>0&&t[n-1]>0)&&(i=o*2,r=s+i,i==r-s&&(s=r))}return s}};var Xn=class extends Map{constructor(t,n=S5){if(super(),Object.defineProperties(this,{_intern:{value:new Map},_key:{value:n}}),t!=null)for(let[r,i]of t)this.set(r,i)}get(t){return super.get(BS(this,t))}has(t){return super.has(BS(this,t))}set(t,n){return super.set(v5(this,t),n)}delete(t){return super.delete(_5(this,t))}},kr=class extends Set{constructor(t,n=S5){if(super(),Object.defineProperties(this,{_intern:{value:new Map},_key:{value:n}}),t!=null)for(let r of t)this.add(r)}has(t){return super.has(BS(this,t))}add(t){return super.add(v5(this,t))}delete(t){return super.delete(_5(this,t))}};function BS({_intern:e,_key:t},n){let r=t(n);return e.has(r)?e.get(r):n}function v5({_intern:e,_key:t},n){let r=t(n);return e.has(r)?e.get(r):(e.set(r,n),n)}function _5({_intern:e,_key:t},n){let r=t(n);return e.has(r)&&(n=e.get(r),e.delete(r)),n}function S5(e){return e!==null&&typeof e=="object"?e.valueOf():e}function Qh(e){return e}function rn(e,...t){return kS(e,Qh,Qh,t)}function $i(e,t,...n){return kS(e,Qh,t,n)}function LS(e,t,...n){return kS(e,Array.from,t,n)}function kS(e,t,n,r){return function i(o,s){if(s>=r.length)return n(o);let a=new Xn,c=r[s++],l=-1;for(let u of o){let f=c(u,++l,o),d=a.get(f);d?d.push(u):a.set(f,[u])}for(let[u,f]of a)a.set(u,i(f,s));return t(a)}(e,0)}function CS(e,t){return Array.from(t,n=>e[n])}function fo(e,...t){if(typeof e[Symbol.iterator]!="function")throw new TypeError("values is not iterable");e=Array.from(e);let[n]=t;if(n&&n.length!==2||t.length>1){let r=Uint32Array.from(e,(i,o)=>o);return t.length>1?(t=t.map(i=>e.map(i)),r.sort((i,o)=>{for(let s of t){let a=Yc(s[i],s[o]);if(a)return a}})):(n=e.map(n),r.sort((i,o)=>Yc(n[i],n[o]))),CS(e,r)}return e.sort(Kh(n))}function Kh(e=Gt){if(e===Gt)return Yc;if(typeof e!="function")throw new TypeError("compare is not a function");return(t,n)=>{let r=e(t,n);return r||r===0?r:(e(n,n)===0)-(e(t,t)===0)}}function Yc(e,t){return(e==null||!(e>=e))-(t==null||!(t>=t))||(e<t?-1:e>t?1:0)}function Tu(e,t,n){return(t.length!==2?fo($i(e,t,n),([r,i],[o,s])=>Gt(i,s)||Gt(r,o)):fo(rn(e,n),([r,i],[o,s])=>t(i,s)||Gt(r,o))).map(([r])=>r)}var uV=Math.sqrt(50),fV=Math.sqrt(10),dV=Math.sqrt(2);function X0(e,t,n){let r=(t-e)/Math.max(0,n),i=Math.floor(Math.log10(r)),o=r/Math.pow(10,i),s=o>=uV?10:o>=fV?5:o>=dV?2:1,a,c,l;return i<0?(l=Math.pow(10,-i)/s,a=Math.round(e*l),c=Math.round(t*l),a/l<e&&++a,c/l>t&&--c,l=-l):(l=Math.pow(10,i)*s,a=Math.round(e/l),c=Math.round(t/l),a*l<e&&++a,c*l>t&&--c),c<a&&.5<=n&&n<2?X0(e,t,n*2):[a,c,l]}function _n(e,t,n){if(t=+t,e=+e,n=+n,!(n>0))return[];if(e===t)return[e];let r=t<e,[i,o,s]=r?X0(t,e,n):X0(e,t,n);if(!(o>=i))return[];let a=o-i+1,c=new Array(a);if(r)if(s<0)for(let l=0;l<a;++l)c[l]=(o-l)/-s;else for(let l=0;l<a;++l)c[l]=(o-l)*s;else if(s<0)for(let l=0;l<a;++l)c[l]=(i+l)/-s;else for(let l=0;l<a;++l)c[l]=(i+l)*s;return c}function Ts(e,t,n){return t=+t,e=+e,n=+n,X0(e,t,n)[2]}function Au(e,t,n){t=+t,e=+e,n=+n;let r=t<e,i=r?Ts(t,e,n):Ts(e,t,n);return(r?-1:1)*(i<0?1/-i:i)}function Eu(e,t,n){let r;for(;;){let i=Ts(e,t,n);if(i===r||i===0||!isFinite(i))return[e,t];i>0?(e=Math.floor(e/i)*i,t=Math.ceil(t/i)*i):i<0&&(e=Math.ceil(e*i)/i,t=Math.floor(t*i)/i),r=i}}function Na(e){return Math.max(1,Math.ceil(Math.log(uo(e))/Math.LN2)+1)}function zt(e,t){let n;if(t===void 0)for(let r of e)r!=null&&(n<r||n===void 0&&r>=r)&&(n=r);else{let r=-1;for(let i of e)(i=t(i,++r,e))!=null&&(n<i||n===void 0&&i>=i)&&(n=i)}return n}function G0(e,t){let n,r=-1,i=-1;if(t===void 0)for(let o of e)++i,o!=null&&(n<o||n===void 0&&o>=o)&&(n=o,r=i);else for(let o of e)(o=t(o,++i,e))!=null&&(n<o||n===void 0&&o>=o)&&(n=o,r=i);return r}function ce(e,t){let n;if(t===void 0)for(let r of e)r!=null&&(n>r||n===void 0&&r>=r)&&(n=r);else{let r=-1;for(let i of e)(i=t(i,++r,e))!=null&&(n>i||n===void 0&&i>=i)&&(n=i)}return n}function W0(e,t){let n,r=-1,i=-1;if(t===void 0)for(let o of e)++i,o!=null&&(n>o||n===void 0&&o>=o)&&(n=o,r=i);else for(let o of e)(o=t(o,++i,e))!=null&&(n>o||n===void 0&&o>=o)&&(n=o,r=i);return r}function H0(e,t,n=0,r=1/0,i){if(t=Math.floor(t),n=Math.floor(Math.max(0,n)),r=Math.floor(Math.min(e.length-1,r)),!(n<=t&&t<=r))return e;for(i=i===void 0?Yc:Kh(i);r>n;){if(r-n>600){let c=r-n+1,l=t-n+1,u=Math.log(c),f=.5*Math.exp(2*u/3),d=.5*Math.sqrt(u*f*(c-f)/c)*(l-c/2<0?-1:1),h=Math.max(n,Math.floor(t-l*f/c+d)),p=Math.min(r,Math.floor(t+(c-l)*f/c+d));H0(e,t,h,p,i)}let o=e[t],s=n,a=r;for(tp(e,n,t),i(e[r],o)>0&&tp(e,n,r);s<a;){for(tp(e,s,a),++s,--a;i(e[s],o)<0;)++s;for(;i(e[a],o)>0;)--a}i(e[n],o)===0?tp(e,n,a):(++a,tp(e,a,r)),a<=t&&(n=a+1),t<=a&&(r=a-1)}return e}function tp(e,t,n){let r=e[t];e[t]=e[n],e[n]=r}function Xc(e,t=Gt){let n,r=!1;if(t.length===1){let i;for(let o of e){let s=t(o);(r?Gt(s,i)>0:Gt(s,s)===0)&&(n=o,i=s,r=!0)}}else for(let i of e)(r?t(i,n)>0:t(i,i)===0)&&(n=i,r=!0);return n}function Gn(e,t,n){if(e=Float64Array.from(y5(e,n)),!(!(r=e.length)||isNaN(t=+t))){if(t<=0||r<2)return ce(e);if(t>=1)return zt(e);var r,i=(r-1)*t,o=Math.floor(i),s=zt(H0(e,o).subarray(0,o+1)),a=ce(e.subarray(o+1));return s+(a-s)*(i-o)}}function FS(e,t,n=Zh){if(!(!(r=e.length)||isNaN(t=+t))){if(t<=0||r<2)return+n(e[0],0,e);if(t>=1)return+n(e[r-1],r-1,e);var r,i=(r-1)*t,o=Math.floor(i),s=+n(e[o],o,e),a=+n(e[o+1],o+1,e);return s+(a-s)*(i-o)}}function Z0(e,t,n){let r=uo(e),i=Gn(e,.75)-Gn(e,.25);return r&&i?Math.ceil((n-t)/(2*i*Math.pow(r,-1/3))):1}function ep(e,t,n){let r=uo(e),i=ri(e);return r&&i?Math.ceil((n-t)*Math.cbrt(r)/(3.49*i)):1}function As(e,t){let n=0,r=0;if(t===void 0)for(let i of e)i!=null&&(i=+i)>=i&&(++n,r+=i);else{let i=-1;for(let o of e)(o=t(o,++i,e))!=null&&(o=+o)>=o&&(++n,r+=o)}if(n)return r/n}function Pi(e,t){return Gn(e,.5,t)}function*pV(e){for(let t of e)yield*t}function Nu(e){return Array.from(pV(e))}function Du(e,t){let n=new Xn;if(t===void 0)for(let o of e)o!=null&&o>=o&&n.set(o,(n.get(o)||0)+1);else{let o=-1;for(let s of e)(s=t(s,++o,e))!=null&&s>=s&&n.set(s,(n.get(s)||0)+1)}let r,i=0;for(let[o,s]of n)s>i&&(i=s,r=o);return r}function J0(e,t=mV){let n=[],r,i=!1;for(let o of e)i&&n.push(t(r,o)),r=o,i=!0;return n}function mV(e,t){return[e,t]}function Pe(e,t,n){e=+e,t=+t,n=(i=arguments.length)<2?(t=e,e=0,1):i<3?1:+n;for(var r=-1,i=Math.max(0,Math.ceil((t-e)/n))|0,o=new Array(i);++r<i;)o[r]=e+r*n;return o}function np(e,t=Gt){if(typeof e[Symbol.iterator]!="function")throw new TypeError("values is not iterable");let n=Array.from(e),r=new Float64Array(n.length);t.length!==2&&(n=n.map(t),t=Gt);let i=(a,c)=>t(n[a],n[c]),o,s;return e=Uint32Array.from(n,(a,c)=>c),e.sort(t===Gt?(a,c)=>Yc(n[a],n[c]):Kh(i)),e.forEach((a,c)=>{let l=i(a,o===void 0?a:o);l>=0?((o===void 0||l>0)&&(o=a,s=c),r[a]=s):r[a]=NaN}),r}function Q0(e,t=Gt){let n,r=!1;if(t.length===1){let i;for(let o of e){let s=t(o);(r?Gt(s,i)<0:Gt(s,s)===0)&&(n=o,i=s,r=!0)}}else for(let i of e)(r?t(i,n)<0:t(i,i)===0)&&(n=i,r=!0);return n}function Sn(e,t){let n=0;if(t===void 0)for(let r of e)(r=+r)&&(n+=r);else{let r=-1;for(let i of e)(i=+t(i,++r,e))&&(n+=i)}return n}function Da(e){if(typeof e[Symbol.iterator]!="function")throw new TypeError("values is not iterable");return Array.from(e).reverse()}function I5(e){return e}var RS=1,$S=2,PS=3,K0=4,M5=1e-6;function yV(e){return"translate("+e+",0)"}function gV(e){return"translate(0,"+e+")"}function xV(e){return t=>+e(t)}function bV(e,t){return t=Math.max(0,e.bandwidth()-t*2)/2,e.round()&&(t=Math.round(t)),n=>+e(n)+t}function wV(){return!this.__axis}function vV(e,t){var n=[],r=null,i=null,o=6,s=6,a=3,c=typeof window<"u"&&window.devicePixelRatio>1?0:.5,l=e===RS||e===K0?-1:1,u=e===K0||e===$S?"x":"y",f=e===RS||e===PS?yV:gV;function d(h){var p=r??(t.ticks?t.ticks.apply(t,n):t.domain()),m=i??(t.tickFormat?t.tickFormat.apply(t,n):I5),g=Math.max(o,0)+a,y=t.range(),x=+y[0]+c,b=+y[y.length-1]+c,w=(t.bandwidth?bV:xV)(t.copy(),c),_=h.selection?h.selection():h,v=_.selectAll(".domain").data([null]),M=_.selectAll(".tick").data(p,t).order(),E=M.exit(),D=M.enter().append("g").attr("class","tick"),I=M.select("line"),T=M.select("text");v=v.merge(v.enter().insert("path",".tick").attr("class","domain").attr("stroke","currentColor")),M=M.merge(D),I=I.merge(D.append("line").attr("stroke","currentColor").attr(u+"2",l*o)),T=T.merge(D.append("text").attr("fill","currentColor").attr(u,l*g).attr("dy",e===RS?"0em":e===PS?"0.71em":"0.32em")),h!==_&&(v=v.transition(h),M=M.transition(h),I=I.transition(h),T=T.transition(h),E=E.transition(h).attr("opacity",M5).attr("transform",function(O){return isFinite(O=w(O))?f(O+c):this.getAttribute("transform")}),D.attr("opacity",M5).attr("transform",function(O){var B=this.parentNode.__axis;return f((B&&isFinite(B=B(O))?B:w(O))+c)})),E.remove(),v.attr("d",e===K0||e===$S?s?"M"+l*s+","+x+"H"+c+"V"+b+"H"+l*s:"M"+c+","+x+"V"+b:s?"M"+x+","+l*s+"V"+c+"H"+b+"V"+l*s:"M"+x+","+c+"H"+b),M.attr("opacity",1).attr("transform",function(O){return f(w(O)+c)}),I.attr(u+"2",l*o),T.attr(u,l*g).text(m),_.filter(wV).attr("fill","none").attr("font-size",10).attr("font-family","sans-serif").attr("text-anchor",e===$S?"start":e===K0?"end":"middle"),_.each(function(){this.__axis=w})}return d.scale=function(h){return arguments.length?(t=h,d):t},d.ticks=function(){return n=Array.from(arguments),d},d.tickArguments=function(h){return arguments.length?(n=h==null?[]:Array.from(h),d):n.slice()},d.tickValues=function(h){return arguments.length?(r=h==null?null:Array.from(h),d):r&&r.slice()},d.tickFormat=function(h){return arguments.length?(i=h,d):i},d.tickSize=function(h){return arguments.length?(o=s=+h,d):o},d.tickSizeInner=function(h){return arguments.length?(o=+h,d):o},d.tickSizeOuter=function(h){return arguments.length?(s=+h,d):s},d.tickPadding=function(h){return arguments.length?(a=+h,d):a},d.offset=function(h){return arguments.length?(c=+h,d):c},d}function US(e){return vV(PS,e)}var _V={value:()=>{}};function A5(){for(var e=0,t=arguments.length,n={},r;e<t;++e){if(!(r=arguments[e]+"")||r in n||/[\s.]/.test(r))throw new Error("illegal type: "+r);n[r]=[]}return new tx(n)}function tx(e){this._=e}function SV(e,t){return e.trim().split(/^|\s+/).map(function(n){var r="",i=n.indexOf(".");if(i>=0&&(r=n.slice(i+1),n=n.slice(0,i)),n&&!t.hasOwnProperty(n))throw new Error("unknown type: "+n);return{type:n,name:r}})}tx.prototype=A5.prototype={constructor:tx,on:function(e,t){var n=this._,r=SV(e+"",n),i,o=-1,s=r.length;if(arguments.length<2){for(;++o<s;)if((i=(e=r[o]).type)&&(i=IV(n[i],e.name)))return i;return}if(t!=null&&typeof t!="function")throw new Error("invalid callback: "+t);for(;++o<s;)if(i=(e=r[o]).type)n[i]=T5(n[i],e.name,t);else if(t==null)for(i in n)n[i]=T5(n[i],e.name,null);return this},copy:function(){var e={},t=this._;for(var n in t)e[n]=t[n].slice();return new tx(e)},call:function(e,t){if((i=arguments.length-2)>0)for(var n=new Array(i),r=0,i,o;r<i;++r)n[r]=arguments[r+2];if(!this._.hasOwnProperty(e))throw new Error("unknown type: "+e);for(o=this._[e],r=0,i=o.length;r<i;++r)o[r].value.apply(t,n)},apply:function(e,t,n){if(!this._.hasOwnProperty(e))throw new Error("unknown type: "+e);for(var r=this._[e],i=0,o=r.length;i<o;++i)r[i].value.apply(t,n)}};function IV(e,t){for(var n=0,r=e.length,i;n<r;++n)if((i=e[n]).name===t)return i.value}function T5(e,t,n){for(var r=0,i=e.length;r<i;++r)if(e[r].name===t){e[r]=_V,e=e.slice(0,r).concat(e.slice(r+1));break}return n!=null&&e.push({name:t,value:n}),e}var Gc=A5;var ex="http://www.w3.org/1999/xhtml",ii={svg:"http://www.w3.org/2000/svg",xhtml:ex,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};function Es(e){var t=e+="",n=t.indexOf(":");return n>=0&&(t=e.slice(0,n))!=="xmlns"&&(e=e.slice(n+1)),ii.hasOwnProperty(t)?{space:ii[t],local:e}:e}function MV(e){return function(){var t=this.ownerDocument,n=this.namespaceURI;return n===ex&&t.documentElement.namespaceURI===ex?t.createElement(e):t.createElementNS(n,e)}}function TV(e){return function(){return this.ownerDocument.createElementNS(e.space,e.local)}}function Ns(e){var t=Es(e);return(t.local?TV:MV)(t)}function AV(){}function Wc(e){return e==null?AV:function(){return this.querySelector(e)}}function E5(e){typeof e!="function"&&(e=Wc(e));for(var t=this._groups,n=t.length,r=new Array(n),i=0;i<n;++i)for(var o=t[i],s=o.length,a=r[i]=new Array(s),c,l,u=0;u<s;++u)(c=o[u])&&(l=e.call(c,c.__data__,u,o))&&("__data__"in c&&(l.__data__=c.__data__),a[u]=l);return new Ce(r,this._parents)}function zS(e){return e==null?[]:Array.isArray(e)?e:Array.from(e)}function EV(){return[]}function rp(e){return e==null?EV:function(){return this.querySelectorAll(e)}}function NV(e){return function(){return zS(e.apply(this,arguments))}}function N5(e){typeof e=="function"?e=NV(e):e=rp(e);for(var t=this._groups,n=t.length,r=[],i=[],o=0;o<n;++o)for(var s=t[o],a=s.length,c,l=0;l<a;++l)(c=s[l])&&(r.push(e.call(c,c.__data__,l,s)),i.push(c));return new Ce(r,i)}function ip(e){return function(){return this.matches(e)}}function nx(e){return function(t){return t.matches(e)}}var DV=Array.prototype.find;function OV(e){return function(){return DV.call(this.children,e)}}function BV(){return this.firstElementChild}function D5(e){return this.select(e==null?BV:OV(typeof e=="function"?e:nx(e)))}var LV=Array.prototype.filter;function kV(){return Array.from(this.children)}function CV(e){return function(){return LV.call(this.children,e)}}function O5(e){return this.selectAll(e==null?kV:CV(typeof e=="function"?e:nx(e)))}function B5(e){typeof e!="function"&&(e=ip(e));for(var t=this._groups,n=t.length,r=new Array(n),i=0;i<n;++i)for(var o=t[i],s=o.length,a=r[i]=[],c,l=0;l<s;++l)(c=o[l])&&e.call(c,c.__data__,l,o)&&a.push(c);return new Ce(r,this._parents)}function rx(e){return new Array(e.length)}function L5(){return new Ce(this._enter||this._groups.map(rx),this._parents)}function op(e,t){this.ownerDocument=e.ownerDocument,this.namespaceURI=e.namespaceURI,this._next=null,this._parent=e,this.__data__=t}op.prototype={constructor:op,appendChild:function(e){return this._parent.insertBefore(e,this._next)},insertBefore:function(e,t){return this._parent.insertBefore(e,t)},querySelector:function(e){return this._parent.querySelector(e)},querySelectorAll:function(e){return this._parent.querySelectorAll(e)}};function k5(e){return function(){return e}}function FV(e,t,n,r,i,o){for(var s=0,a,c=t.length,l=o.length;s<l;++s)(a=t[s])?(a.__data__=o[s],r[s]=a):n[s]=new op(e,o[s]);for(;s<c;++s)(a=t[s])&&(i[s]=a)}function RV(e,t,n,r,i,o,s){var a,c,l=new Map,u=t.length,f=o.length,d=new Array(u),h;for(a=0;a<u;++a)(c=t[a])&&(d[a]=h=s.call(c,c.__data__,a,t)+"",l.has(h)?i[a]=c:l.set(h,c));for(a=0;a<f;++a)h=s.call(e,o[a],a,o)+"",(c=l.get(h))?(r[a]=c,c.__data__=o[a],l.delete(h)):n[a]=new op(e,o[a]);for(a=0;a<u;++a)(c=t[a])&&l.get(d[a])===c&&(i[a]=c)}function $V(e){return e.__data__}function C5(e,t){if(!arguments.length)return Array.from(this,$V);var n=t?RV:FV,r=this._parents,i=this._groups;typeof e!="function"&&(e=k5(e));for(var o=i.length,s=new Array(o),a=new Array(o),c=new Array(o),l=0;l<o;++l){var u=r[l],f=i[l],d=f.length,h=PV(e.call(u,u&&u.__data__,l,r)),p=h.length,m=a[l]=new Array(p),g=s[l]=new Array(p),y=c[l]=new Array(d);n(u,f,m,g,y,h,t);for(var x=0,b=0,w,_;x<p;++x)if(w=m[x]){for(x>=b&&(b=x+1);!(_=g[b])&&++b<p;);w._next=_||null}}return s=new Ce(s,r),s._enter=a,s._exit=c,s}function PV(e){return typeof e=="object"&&"length"in e?e:Array.from(e)}function F5(){return new Ce(this._exit||this._groups.map(rx),this._parents)}function R5(e,t,n){var r=this.enter(),i=this,o=this.exit();return typeof e=="function"?(r=e(r),r&&(r=r.selection())):r=r.append(e+""),t!=null&&(i=t(i),i&&(i=i.selection())),n==null?o.remove():n(o),r&&i?r.merge(i).order():i}function $5(e){for(var t=e.selection?e.selection():e,n=this._groups,r=t._groups,i=n.length,o=r.length,s=Math.min(i,o),a=new Array(i),c=0;c<s;++c)for(var l=n[c],u=r[c],f=l.length,d=a[c]=new Array(f),h,p=0;p<f;++p)(h=l[p]||u[p])&&(d[p]=h);for(;c<i;++c)a[c]=n[c];return new Ce(a,this._parents)}function P5(){for(var e=this._groups,t=-1,n=e.length;++t<n;)for(var r=e[t],i=r.length-1,o=r[i],s;--i>=0;)(s=r[i])&&(o&&s.compareDocumentPosition(o)^4&&o.parentNode.insertBefore(s,o),o=s);return this}function U5(e){e||(e=UV);function t(f,d){return f&&d?e(f.__data__,d.__data__):!f-!d}for(var n=this._groups,r=n.length,i=new Array(r),o=0;o<r;++o){for(var s=n[o],a=s.length,c=i[o]=new Array(a),l,u=0;u<a;++u)(l=s[u])&&(c[u]=l);c.sort(t)}return new Ce(i,this._parents).order()}function UV(e,t){return e<t?-1:e>t?1:e>=t?0:NaN}function z5(){var e=arguments[0];return arguments[0]=this,e.apply(null,arguments),this}function j5(){return Array.from(this)}function q5(){for(var e=this._groups,t=0,n=e.length;t<n;++t)for(var r=e[t],i=0,o=r.length;i<o;++i){var s=r[i];if(s)return s}return null}function V5(){let e=0;for(let t of this)++e;return e}function Y5(){return!this.node()}function X5(e){for(var t=this._groups,n=0,r=t.length;n<r;++n)for(var i=t[n],o=0,s=i.length,a;o<s;++o)(a=i[o])&&e.call(a,a.__data__,o,i);return this}function zV(e){return function(){this.removeAttribute(e)}}function jV(e){return function(){this.removeAttributeNS(e.space,e.local)}}function qV(e,t){return function(){this.setAttribute(e,t)}}function VV(e,t){return function(){this.setAttributeNS(e.space,e.local,t)}}function YV(e,t){return function(){var n=t.apply(this,arguments);n==null?this.removeAttribute(e):this.setAttribute(e,n)}}function XV(e,t){return function(){var n=t.apply(this,arguments);n==null?this.removeAttributeNS(e.space,e.local):this.setAttributeNS(e.space,e.local,n)}}function G5(e,t){var n=Es(e);if(arguments.length<2){var r=this.node();return n.local?r.getAttributeNS(n.space,n.local):r.getAttribute(n)}return this.each((t==null?n.local?jV:zV:typeof t=="function"?n.local?XV:YV:n.local?VV:qV)(n,t))}function ix(e){return e.ownerDocument&&e.ownerDocument.defaultView||e.document&&e||e.defaultView}function GV(e){return function(){this.style.removeProperty(e)}}function WV(e,t,n){return function(){this.style.setProperty(e,t,n)}}function HV(e,t,n){return function(){var r=t.apply(this,arguments);r==null?this.style.removeProperty(e):this.style.setProperty(e,r,n)}}function W5(e,t,n){return arguments.length>1?this.each((t==null?GV:typeof t=="function"?HV:WV)(e,t,n??"")):Oa(this.node(),e)}function Oa(e,t){return e.style.getPropertyValue(t)||ix(e).getComputedStyle(e,null).getPropertyValue(t)}function ZV(e){return function(){delete this[e]}}function JV(e,t){return function(){this[e]=t}}function QV(e,t){return function(){var n=t.apply(this,arguments);n==null?delete this[e]:this[e]=n}}function H5(e,t){return arguments.length>1?this.each((t==null?ZV:typeof t=="function"?QV:JV)(e,t)):this.node()[e]}function Z5(e){return e.trim().split(/^|\s+/)}function jS(e){return e.classList||new J5(e)}function J5(e){this._node=e,this._names=Z5(e.getAttribute("class")||"")}J5.prototype={add:function(e){var t=this._names.indexOf(e);t<0&&(this._names.push(e),this._node.setAttribute("class",this._names.join(" ")))},remove:function(e){var t=this._names.indexOf(e);t>=0&&(this._names.splice(t,1),this._node.setAttribute("class",this._names.join(" ")))},contains:function(e){return this._names.indexOf(e)>=0}};function Q5(e,t){for(var n=jS(e),r=-1,i=t.length;++r<i;)n.add(t[r])}function K5(e,t){for(var n=jS(e),r=-1,i=t.length;++r<i;)n.remove(t[r])}function KV(e){return function(){Q5(this,e)}}function tY(e){return function(){K5(this,e)}}function eY(e,t){return function(){(t.apply(this,arguments)?Q5:K5)(this,e)}}function tB(e,t){var n=Z5(e+"");if(arguments.length<2){for(var r=jS(this.node()),i=-1,o=n.length;++i<o;)if(!r.contains(n[i]))return!1;return!0}return this.each((typeof t=="function"?eY:t?KV:tY)(n,t))}function nY(){this.textContent=""}function rY(e){return function(){this.textContent=e}}function iY(e){return function(){var t=e.apply(this,arguments);this.textContent=t??""}}function eB(e){return arguments.length?this.each(e==null?nY:(typeof e=="function"?iY:rY)(e)):this.node().textContent}function oY(){this.innerHTML=""}function sY(e){return function(){this.innerHTML=e}}function aY(e){return function(){var t=e.apply(this,arguments);this.innerHTML=t??""}}function nB(e){return arguments.length?this.each(e==null?oY:(typeof e=="function"?aY:sY)(e)):this.node().innerHTML}function cY(){this.nextSibling&&this.parentNode.appendChild(this)}function rB(){return this.each(cY)}function lY(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function iB(){return this.each(lY)}function oB(e){var t=typeof e=="function"?e:Ns(e);return this.select(function(){return this.appendChild(t.apply(this,arguments))})}function uY(){return null}function sB(e,t){var n=typeof e=="function"?e:Ns(e),r=t==null?uY:typeof t=="function"?t:Wc(t);return this.select(function(){return this.insertBefore(n.apply(this,arguments),r.apply(this,arguments)||null)})}function fY(){var e=this.parentNode;e&&e.removeChild(this)}function aB(){return this.each(fY)}function dY(){var e=this.cloneNode(!1),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function hY(){var e=this.cloneNode(!0),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function cB(e){return this.select(e?hY:dY)}function lB(e){return arguments.length?this.property("__data__",e):this.node().__data__}function pY(e){return function(t){e.call(this,t,this.__data__)}}function mY(e){return e.trim().split(/^|\s+/).map(function(t){var n="",r=t.indexOf(".");return r>=0&&(n=t.slice(r+1),t=t.slice(0,r)),{type:t,name:n}})}function yY(e){return function(){var t=this.__on;if(t){for(var n=0,r=-1,i=t.length,o;n<i;++n)o=t[n],(!e.type||o.type===e.type)&&o.name===e.name?this.removeEventListener(o.type,o.listener,o.options):t[++r]=o;++r?t.length=r:delete this.__on}}}function gY(e,t,n){return function(){var r=this.__on,i,o=pY(t);if(r){for(var s=0,a=r.length;s<a;++s)if((i=r[s]).type===e.type&&i.name===e.name){this.removeEventListener(i.type,i.listener,i.options),this.addEventListener(i.type,i.listener=o,i.options=n),i.value=t;return}}this.addEventListener(e.type,o,n),i={type:e.type,name:e.name,value:t,listener:o,options:n},r?r.push(i):this.__on=[i]}}function uB(e,t,n){var r=mY(e+""),i,o=r.length,s;if(arguments.length<2){var a=this.node().__on;if(a){for(var c=0,l=a.length,u;c<l;++c)for(i=0,u=a[c];i<o;++i)if((s=r[i]).type===u.type&&s.name===u.name)return u.value}return}for(a=t?gY:yY,i=0;i<o;++i)this.each(a(r[i],t,n));return this}function fB(e,t,n){var r=ix(e),i=r.CustomEvent;typeof i=="function"?i=new i(t,n):(i=r.document.createEvent("Event"),n?(i.initEvent(t,n.bubbles,n.cancelable),i.detail=n.detail):i.initEvent(t,!1,!1)),e.dispatchEvent(i)}function xY(e,t){return function(){return fB(this,e,t)}}function bY(e,t){return function(){return fB(this,e,t.apply(this,arguments))}}function dB(e,t){return this.each((typeof t=="function"?bY:xY)(e,t))}function*hB(){for(var e=this._groups,t=0,n=e.length;t<n;++t)for(var r=e[t],i=0,o=r.length,s;i<o;++i)(s=r[i])&&(yield s)}var qS=[null];function Ce(e,t){this._groups=e,this._parents=t}function pB(){return new Ce([[document.documentElement]],qS)}function wY(){return this}Ce.prototype=pB.prototype={constructor:Ce,select:E5,selectAll:N5,selectChild:D5,selectChildren:O5,filter:B5,data:C5,enter:L5,exit:F5,join:R5,merge:$5,selection:wY,order:P5,sort:U5,call:z5,nodes:j5,node:q5,size:V5,empty:Y5,each:X5,attr:G5,style:W5,property:H5,classed:tB,text:eB,html:nB,raise:rB,lower:iB,append:oB,insert:sB,remove:aB,clone:cB,datum:lB,on:uB,dispatch:dB,[Symbol.iterator]:hB};var Ds=pB;function jt(e){return typeof e=="string"?new Ce([[document.querySelector(e)]],[document.documentElement]):new Ce([[e]],qS)}function mB(e){let t;for(;t=e.sourceEvent;)e=t;return e}function Bn(e,t){if(e=mB(e),t===void 0&&(t=e.currentTarget),t){var n=t.ownerSVGElement||t;if(n.createSVGPoint){var r=n.createSVGPoint();return r.x=e.clientX,r.y=e.clientY,r=r.matrixTransform(t.getScreenCTM().inverse()),[r.x,r.y]}if(t.getBoundingClientRect){var i=t.getBoundingClientRect();return[e.clientX-i.left-t.clientLeft,e.clientY-i.top-t.clientTop]}}return[e.pageX,e.pageY]}var ox={capture:!0,passive:!1};function sx(e){e.preventDefault(),e.stopImmediatePropagation()}function sp(e){var t=e.document.documentElement,n=jt(e).on("dragstart.drag",sx,ox);"onselectstart"in t?n.on("selectstart.drag",sx,ox):(t.__noselect=t.style.MozUserSelect,t.style.MozUserSelect="none")}function ap(e,t){var n=e.document.documentElement,r=jt(e).on("dragstart.drag",null);t&&(r.on("click.drag",sx,ox),setTimeout(function(){r.on("click.drag",null)},0)),"onselectstart"in n?r.on("selectstart.drag",null):(n.style.MozUserSelect=n.__noselect,delete n.__noselect)}function Os(e,t,n){e.prototype=t.prototype=n,n.constructor=e}function Ba(e,t){var n=Object.create(e.prototype);for(var r in t)n[r]=t[r];return n}function po(){}var La=.7,Jc=1/La,Ou="\\s*([+-]?\\d+)\\s*",cp="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",ho="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",vY=/^#([0-9a-f]{3,8})$/,_Y=new RegExp(`^rgb\\(${Ou},${Ou},${Ou}\\)$`),SY=new RegExp(`^rgb\\(${ho},${ho},${ho}\\)$`),IY=new RegExp(`^rgba\\(${Ou},${Ou},${Ou},${cp}\\)$`),MY=new RegExp(`^rgba\\(${ho},${ho},${ho},${cp}\\)$`),TY=new RegExp(`^hsl\\(${cp},${ho},${ho}\\)$`),AY=new RegExp(`^hsla\\(${cp},${ho},${ho},${cp}\\)$`),yB={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};Os(po,Cr,{copy(e){return Object.assign(new this.constructor,this,e)},displayable(){return this.rgb().displayable()},hex:gB,formatHex:gB,formatHex8:EY,formatHsl:NY,formatRgb:xB,toString:xB});function gB(){return this.rgb().formatHex()}function EY(){return this.rgb().formatHex8()}function NY(){return IB(this).formatHsl()}function xB(){return this.rgb().formatRgb()}function Cr(e){var t,n;return e=(e+"").trim().toLowerCase(),(t=vY.exec(e))?(n=t[1].length,t=parseInt(t[1],16),n===6?bB(t):n===3?new Ye(t>>8&15|t>>4&240,t>>4&15|t&240,(t&15)<<4|t&15,1):n===8?ax(t>>24&255,t>>16&255,t>>8&255,(t&255)/255):n===4?ax(t>>12&15|t>>8&240,t>>8&15|t>>4&240,t>>4&15|t&240,((t&15)<<4|t&15)/255):null):(t=_Y.exec(e))?new Ye(t[1],t[2],t[3],1):(t=SY.exec(e))?new Ye(t[1]*255/100,t[2]*255/100,t[3]*255/100,1):(t=IY.exec(e))?ax(t[1],t[2],t[3],t[4]):(t=MY.exec(e))?ax(t[1]*255/100,t[2]*255/100,t[3]*255/100,t[4]):(t=TY.exec(e))?_B(t[1],t[2]/100,t[3]/100,1):(t=AY.exec(e))?_B(t[1],t[2]/100,t[3]/100,t[4]):yB.hasOwnProperty(e)?bB(yB[e]):e==="transparent"?new Ye(NaN,NaN,NaN,0):null}function bB(e){return new Ye(e>>16&255,e>>8&255,e&255,1)}function ax(e,t,n,r){return r<=0&&(e=t=n=NaN),new Ye(e,t,n,r)}function lp(e){return e instanceof po||(e=Cr(e)),e?(e=e.rgb(),new Ye(e.r,e.g,e.b,e.opacity)):new Ye}function on(e,t,n,r){return arguments.length===1?lp(e):new Ye(e,t,n,r??1)}function Ye(e,t,n,r){this.r=+e,this.g=+t,this.b=+n,this.opacity=+r}Os(Ye,on,Ba(po,{brighter(e){return e=e==null?Jc:Math.pow(Jc,e),new Ye(this.r*e,this.g*e,this.b*e,this.opacity)},darker(e){return e=e==null?La:Math.pow(La,e),new Ye(this.r*e,this.g*e,this.b*e,this.opacity)},rgb(){return this},clamp(){return new Ye(Zc(this.r),Zc(this.g),Zc(this.b),lx(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:wB,formatHex:wB,formatHex8:DY,formatRgb:vB,toString:vB}));function wB(){return`#${Hc(this.r)}${Hc(this.g)}${Hc(this.b)}`}function DY(){return`#${Hc(this.r)}${Hc(this.g)}${Hc(this.b)}${Hc((isNaN(this.opacity)?1:this.opacity)*255)}`}function vB(){let e=lx(this.opacity);return`${e===1?"rgb(":"rgba("}${Zc(this.r)}, ${Zc(this.g)}, ${Zc(this.b)}${e===1?")":`, ${e})`}`}function lx(e){return isNaN(e)?1:Math.max(0,Math.min(1,e))}function Zc(e){return Math.max(0,Math.min(255,Math.round(e)||0))}function Hc(e){return e=Zc(e),(e<16?"0":"")+e.toString(16)}function _B(e,t,n,r){return r<=0?e=t=n=NaN:n<=0||n>=1?e=t=NaN:t<=0&&(e=NaN),new Ui(e,t,n,r)}function IB(e){if(e instanceof Ui)return new Ui(e.h,e.s,e.l,e.opacity);if(e instanceof po||(e=Cr(e)),!e)return new Ui;if(e instanceof Ui)return e;e=e.rgb();var t=e.r/255,n=e.g/255,r=e.b/255,i=Math.min(t,n,r),o=Math.max(t,n,r),s=NaN,a=o-i,c=(o+i)/2;return a?(t===o?s=(n-r)/a+(n<r)*6:n===o?s=(r-t)/a+2:s=(t-n)/a+4,a/=c<.5?o+i:2-o-i,s*=60):a=c>0&&c<1?0:s,new Ui(s,a,c,e.opacity)}function up(e,t,n,r){return arguments.length===1?IB(e):new Ui(e,t,n,r??1)}function Ui(e,t,n,r){this.h=+e,this.s=+t,this.l=+n,this.opacity=+r}Os(Ui,up,Ba(po,{brighter(e){return e=e==null?Jc:Math.pow(Jc,e),new Ui(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=e==null?La:Math.pow(La,e),new Ui(this.h,this.s,this.l*e,this.opacity)},rgb(){var e=this.h%360+(this.h<0)*360,t=isNaN(e)||isNaN(this.s)?0:this.s,n=this.l,r=n+(n<.5?n:1-n)*t,i=2*n-r;return new Ye(VS(e>=240?e-240:e+120,i,r),VS(e,i,r),VS(e<120?e+240:e-120,i,r),this.opacity)},clamp(){return new Ui(SB(this.h),cx(this.s),cx(this.l),lx(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(){let e=lx(this.opacity);return`${e===1?"hsl(":"hsla("}${SB(this.h)}, ${cx(this.s)*100}%, ${cx(this.l)*100}%${e===1?")":`, ${e})`}`}}));function SB(e){return e=(e||0)%360,e<0?e+360:e}function cx(e){return Math.max(0,Math.min(1,e||0))}function VS(e,t,n){return(e<60?t+(n-t)*e/60:e<180?n:e<240?t+(n-t)*(240-e)/60:t)*255}var ux=Math.PI/180,fx=180/Math.PI;var dx=18,MB=.96422,TB=1,AB=.82521,EB=4/29,Bu=6/29,NB=3*Bu*Bu,OY=Bu*Bu*Bu;function DB(e){if(e instanceof mo)return new mo(e.l,e.a,e.b,e.opacity);if(e instanceof Bs)return OB(e);e instanceof Ye||(e=lp(e));var t=WS(e.r),n=WS(e.g),r=WS(e.b),i=YS((.2225045*t+.7168786*n+.0606169*r)/TB),o,s;return t===n&&n===r?o=s=i:(o=YS((.4360747*t+.3850649*n+.1430804*r)/MB),s=YS((.0139322*t+.0971045*n+.7141733*r)/AB)),new mo(116*i-16,500*(o-i),200*(i-s),e.opacity)}function Lu(e,t,n,r){return arguments.length===1?DB(e):new mo(e,t,n,r??1)}function mo(e,t,n,r){this.l=+e,this.a=+t,this.b=+n,this.opacity=+r}Os(mo,Lu,Ba(po,{brighter(e){return new mo(this.l+dx*(e??1),this.a,this.b,this.opacity)},darker(e){return new mo(this.l-dx*(e??1),this.a,this.b,this.opacity)},rgb(){var e=(this.l+16)/116,t=isNaN(this.a)?e:e+this.a/500,n=isNaN(this.b)?e:e-this.b/200;return t=MB*XS(t),e=TB*XS(e),n=AB*XS(n),new Ye(GS(3.1338561*t-1.6168667*e-.4906146*n),GS(-.9787684*t+1.9161415*e+.033454*n),GS(.0719453*t-.2289914*e+1.4052427*n),this.opacity)}}));function YS(e){return e>OY?Math.pow(e,1/3):e/NB+EB}function XS(e){return e>Bu?e*e*e:NB*(e-EB)}function GS(e){return 255*(e<=.0031308?12.92*e:1.055*Math.pow(e,1/2.4)-.055)}function WS(e){return(e/=255)<=.04045?e/12.92:Math.pow((e+.055)/1.055,2.4)}function BY(e){if(e instanceof Bs)return new Bs(e.h,e.c,e.l,e.opacity);if(e instanceof mo||(e=DB(e)),e.a===0&&e.b===0)return new Bs(NaN,0<e.l&&e.l<100?0:NaN,e.l,e.opacity);var t=Math.atan2(e.b,e.a)*fx;return new Bs(t<0?t+360:t,Math.sqrt(e.a*e.a+e.b*e.b),e.l,e.opacity)}function fp(e,t,n,r){return arguments.length===1?BY(e):new Bs(e,t,n,r??1)}function Bs(e,t,n,r){this.h=+e,this.c=+t,this.l=+n,this.opacity=+r}function OB(e){if(isNaN(e.h))return new mo(e.l,0,0,e.opacity);var t=e.h*ux;return new mo(e.l,Math.cos(t)*e.c,Math.sin(t)*e.c,e.opacity)}Os(Bs,fp,Ba(po,{brighter(e){return new Bs(this.h,this.c,this.l+dx*(e??1),this.opacity)},darker(e){return new Bs(this.h,this.c,this.l-dx*(e??1),this.opacity)},rgb(){return OB(this).rgb()}}));var CB=-.14861,HS=1.78277,ZS=-.29227,hx=-.90649,dp=1.97294,BB=dp*hx,LB=dp*HS,kB=HS*ZS-hx*CB;function LY(e){if(e instanceof Qc)return new Qc(e.h,e.s,e.l,e.opacity);e instanceof Ye||(e=lp(e));var t=e.r/255,n=e.g/255,r=e.b/255,i=(kB*r+BB*t-LB*n)/(kB+BB-LB),o=r-i,s=(dp*(n-i)-ZS*o)/hx,a=Math.sqrt(s*s+o*o)/(dp*i*(1-i)),c=a?Math.atan2(s,o)*fx-120:NaN;return new Qc(c<0?c+360:c,a,i,e.opacity)}function Wn(e,t,n,r){return arguments.length===1?LY(e):new Qc(e,t,n,r??1)}function Qc(e,t,n,r){this.h=+e,this.s=+t,this.l=+n,this.opacity=+r}Os(Qc,Wn,Ba(po,{brighter(e){return e=e==null?Jc:Math.pow(Jc,e),new Qc(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=e==null?La:Math.pow(La,e),new Qc(this.h,this.s,this.l*e,this.opacity)},rgb(){var e=isNaN(this.h)?0:(this.h+120)*ux,t=+this.l,n=isNaN(this.s)?0:this.s*t*(1-t),r=Math.cos(e),i=Math.sin(e);return new Ye(255*(t+n*(CB*r+HS*i)),255*(t+n*(ZS*r+hx*i)),255*(t+n*(dp*r)),this.opacity)}}));function JS(e,t,n,r,i){var o=e*e,s=o*e;return((1-3*e+3*o-s)*t+(4-6*o+3*s)*n+(1+3*e+3*o-3*s)*r+s*i)/6}function FB(e){var t=e.length-1;return function(n){var r=n<=0?n=0:n>=1?(n=1,t-1):Math.floor(n*t),i=e[r],o=e[r+1],s=r>0?e[r-1]:2*i-o,a=r<t-1?e[r+2]:2*o-i;return JS((n-r/t)*t,s,i,o,a)}}function RB(e){var t=e.length;return function(n){var r=Math.floor(((n%=1)<0?++n:n)*t),i=e[(r+t-1)%t],o=e[r%t],s=e[(r+1)%t],a=e[(r+2)%t];return JS((n-r/t)*t,i,o,s,a)}}var ku=e=>()=>e;function $B(e,t){return function(n){return e+n*t}}function kY(e,t,n){return e=Math.pow(e,n),t=Math.pow(t,n)-e,n=1/n,function(r){return Math.pow(e+r*t,n)}}function Cu(e,t){var n=t-e;return n?$B(e,n>180||n<-180?n-360*Math.round(n/360):n):ku(isNaN(e)?t:e)}function PB(e){return(e=+e)==1?Me:function(t,n){return n-t?kY(t,n,e):ku(isNaN(t)?n:t)}}function Me(e,t){var n=t-e;return n?$B(e,n):ku(isNaN(e)?t:e)}var oi=function e(t){var n=PB(t);function r(i,o){var s=n((i=on(i)).r,(o=on(o)).r),a=n(i.g,o.g),c=n(i.b,o.b),l=Me(i.opacity,o.opacity);return function(u){return i.r=s(u),i.g=a(u),i.b=c(u),i.opacity=l(u),i+""}}return r.gamma=e,r}(1);function UB(e){return function(t){var n=t.length,r=new Array(n),i=new Array(n),o=new Array(n),s,a;for(s=0;s<n;++s)a=on(t[s]),r[s]=a.r||0,i[s]=a.g||0,o[s]=a.b||0;return r=e(r),i=e(i),o=e(o),a.opacity=1,function(c){return a.r=r(c),a.g=i(c),a.b=o(c),a+""}}}var QS=UB(FB),CY=UB(RB);function zB(e,t){t||(t=[]);var n=e?Math.min(t.length,e.length):0,r=t.slice(),i;return function(o){for(i=0;i<n;++i)r[i]=e[i]*(1-o)+t[i]*o;return r}}function jB(e){return ArrayBuffer.isView(e)&&!(e instanceof DataView)}function qB(e,t){var n=t?t.length:0,r=e?Math.min(n,e.length):0,i=new Array(r),o=new Array(n),s;for(s=0;s<r;++s)i[s]=Fr(e[s],t[s]);for(;s<n;++s)o[s]=t[s];return function(a){for(s=0;s<r;++s)o[s]=i[s](a);return o}}function VB(e,t){var n=new Date;return e=+e,t=+t,function(r){return n.setTime(e*(1-r)+t*r),n}}function we(e,t){return e=+e,t=+t,function(n){return e*(1-n)+t*n}}function YB(e,t){var n={},r={},i;(e===null||typeof e!="object")&&(e={}),(t===null||typeof t!="object")&&(t={});for(i in t)i in e?n[i]=Fr(e[i],t[i]):r[i]=t[i];return function(o){for(i in n)r[i]=n[i](o);return r}}var tI=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,KS=new RegExp(tI.source,"g");function FY(e){return function(){return e}}function RY(e){return function(t){return e(t)+""}}function hp(e,t){var n=tI.lastIndex=KS.lastIndex=0,r,i,o,s=-1,a=[],c=[];for(e=e+"",t=t+"";(r=tI.exec(e))&&(i=KS.exec(t));)(o=i.index)>n&&(o=t.slice(n,o),a[s]?a[s]+=o:a[++s]=o),(r=r[0])===(i=i[0])?a[s]?a[s]+=i:a[++s]=i:(a[++s]=null,c.push({i:s,x:we(r,i)})),n=KS.lastIndex;return n<t.length&&(o=t.slice(n),a[s]?a[s]+=o:a[++s]=o),a.length<2?c[0]?RY(c[0].x):FY(t):(t=c.length,function(l){for(var u=0,f;u<t;++u)a[(f=c[u]).i]=f.x(l);return a.join("")})}function Fr(e,t){var n=typeof t,r;return t==null||n==="boolean"?ku(t):(n==="number"?we:n==="string"?(r=Cr(t))?(t=r,oi):hp:t instanceof Cr?oi:t instanceof Date?VB:jB(t)?zB:Array.isArray(t)?qB:typeof t.valueOf!="function"&&typeof t.toString!="function"||isNaN(t)?YB:we)(e,t)}function Kc(e,t){return e=+e,t=+t,function(n){return Math.round(e*(1-n)+t*n)}}var XB=180/Math.PI,px={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1};function eI(e,t,n,r,i,o){var s,a,c;return(s=Math.sqrt(e*e+t*t))&&(e/=s,t/=s),(c=e*n+t*r)&&(n-=e*c,r-=t*c),(a=Math.sqrt(n*n+r*r))&&(n/=a,r/=a,c/=a),e*r<t*n&&(e=-e,t=-t,c=-c,s=-s),{translateX:i,translateY:o,rotate:Math.atan2(t,e)*XB,skewX:Math.atan(c)*XB,scaleX:s,scaleY:a}}var mx;function GB(e){let t=new(typeof DOMMatrix=="function"?DOMMatrix:WebKitCSSMatrix)(e+"");return t.isIdentity?px:eI(t.a,t.b,t.c,t.d,t.e,t.f)}function WB(e){return e==null?px:(mx||(mx=document.createElementNS("http://www.w3.org/2000/svg","g")),mx.setAttribute("transform",e),(e=mx.transform.baseVal.consolidate())?(e=e.matrix,eI(e.a,e.b,e.c,e.d,e.e,e.f)):px)}function HB(e,t,n,r){function i(l){return l.length?l.pop()+" ":""}function o(l,u,f,d,h,p){if(l!==f||u!==d){var m=h.push("translate(",null,t,null,n);p.push({i:m-4,x:we(l,f)},{i:m-2,x:we(u,d)})}else(f||d)&&h.push("translate("+f+t+d+n)}function s(l,u,f,d){l!==u?(l-u>180?u+=360:u-l>180&&(l+=360),d.push({i:f.push(i(f)+"rotate(",null,r)-2,x:we(l,u)})):u&&f.push(i(f)+"rotate("+u+r)}function a(l,u,f,d){l!==u?d.push({i:f.push(i(f)+"skewX(",null,r)-2,x:we(l,u)}):u&&f.push(i(f)+"skewX("+u+r)}function c(l,u,f,d,h,p){if(l!==f||u!==d){var m=h.push(i(h)+"scale(",null,",",null,")");p.push({i:m-4,x:we(l,f)},{i:m-2,x:we(u,d)})}else(f!==1||d!==1)&&h.push(i(h)+"scale("+f+","+d+")")}return function(l,u){var f=[],d=[];return l=e(l),u=e(u),o(l.translateX,l.translateY,u.translateX,u.translateY,f,d),s(l.rotate,u.rotate,f,d),a(l.skewX,u.skewX,f,d),c(l.scaleX,l.scaleY,u.scaleX,u.scaleY,f,d),l=u=null,function(h){for(var p=-1,m=d.length,g;++p<m;)f[(g=d[p]).i]=g.x(h);return f.join("")}}}var nI=HB(GB,"px, ","px)","deg)"),rI=HB(WB,", ",")",")");var $Y=1e-12;function ZB(e){return((e=Math.exp(e))+1/e)/2}function PY(e){return((e=Math.exp(e))-1/e)/2}function UY(e){return((e=Math.exp(2*e))-1)/(e+1)}var iI=function e(t,n,r){function i(o,s){var a=o[0],c=o[1],l=o[2],u=s[0],f=s[1],d=s[2],h=u-a,p=f-c,m=h*h+p*p,g,y;if(m<$Y)y=Math.log(d/l)/t,g=function(M){return[a+M*h,c+M*p,l*Math.exp(t*M*y)]};else{var x=Math.sqrt(m),b=(d*d-l*l+r*m)/(2*l*n*x),w=(d*d-l*l-r*m)/(2*d*n*x),_=Math.log(Math.sqrt(b*b+1)-b),v=Math.log(Math.sqrt(w*w+1)-w);y=(v-_)/t,g=function(M){var E=M*y,D=ZB(_),I=l/(n*x)*(D*UY(t*E+_)-PY(_));return[a+I*h,c+I*p,l*D/ZB(t*E+_)]}}return g.duration=y*1e3*t/Math.SQRT2,g}return i.rho=function(o){var s=Math.max(.001,+o),a=s*s,c=a*a;return e(s,a,c)},i}(Math.SQRT2,2,4);function JB(e){return function(t,n){var r=e((t=up(t)).h,(n=up(n)).h),i=Me(t.s,n.s),o=Me(t.l,n.l),s=Me(t.opacity,n.opacity);return function(a){return t.h=r(a),t.s=i(a),t.l=o(a),t.opacity=s(a),t+""}}}var oI=JB(Cu),zY=JB(Me);function yx(e,t){var n=Me((e=Lu(e)).l,(t=Lu(t)).l),r=Me(e.a,t.a),i=Me(e.b,t.b),o=Me(e.opacity,t.opacity);return function(s){return e.l=n(s),e.a=r(s),e.b=i(s),e.opacity=o(s),e+""}}function QB(e){return function(t,n){var r=e((t=fp(t)).h,(n=fp(n)).h),i=Me(t.c,n.c),o=Me(t.l,n.l),s=Me(t.opacity,n.opacity);return function(a){return t.h=r(a),t.c=i(a),t.l=o(a),t.opacity=s(a),t+""}}}var sI=QB(Cu),jY=QB(Me);function KB(e){return function t(n){n=+n;function r(i,o){var s=e((i=Wn(i)).h,(o=Wn(o)).h),a=Me(i.s,o.s),c=Me(i.l,o.l),l=Me(i.opacity,o.opacity);return function(u){return i.h=s(u),i.s=a(u),i.l=c(Math.pow(u,n)),i.opacity=l(u),i+""}}return r.gamma=t,r}(1)}var qY=KB(Cu),Fu=KB(Me);function yo(e,t){t===void 0&&(t=e,e=Fr);for(var n=0,r=t.length-1,i=t[0],o=new Array(r<0?0:r);n<r;)o[n]=e(i,i=t[++n]);return function(s){var a=Math.max(0,Math.min(r-1,Math.floor(s*=r)));return o[a](s-a)}}function Ln(e,t){for(var n=new Array(t),r=0;r<t;++r)n[r]=e(r/(t-1));return n}var Ru=0,mp=0,pp=0,eL=1e3,gx,yp,xx=0,tl=0,bx=0,gp=typeof performance=="object"&&performance.now?performance:Date,nL=typeof window=="object"&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(e){setTimeout(e,17)};function bp(){return tl||(nL(VY),tl=gp.now()+bx)}function VY(){tl=0}function xp(){this._call=this._time=this._next=null}xp.prototype=wx.prototype={constructor:xp,restart:function(e,t,n){if(typeof e!="function")throw new TypeError("callback is not a function");n=(n==null?bp():+n)+(t==null?0:+t),!this._next&&yp!==this&&(yp?yp._next=this:gx=this,yp=this),this._call=e,this._time=n,aI()},stop:function(){this._call&&(this._call=null,this._time=1/0,aI())}};function wx(e,t,n){var r=new xp;return r.restart(e,t,n),r}function rL(){bp(),++Ru;for(var e=gx,t;e;)(t=tl-e._time)>=0&&e._call.call(void 0,t),e=e._next;--Ru}function tL(){tl=(xx=gp.now())+bx,Ru=mp=0;try{rL()}finally{Ru=0,XY(),tl=0}}function YY(){var e=gp.now(),t=e-xx;t>eL&&(bx-=t,xx=e)}function XY(){for(var e,t=gx,n,r=1/0;t;)t._call?(r>t._time&&(r=t._time),e=t,t=t._next):(n=t._next,t._next=null,t=e?e._next=n:gx=n);yp=e,aI(r)}function aI(e){if(!Ru){mp&&(mp=clearTimeout(mp));var t=e-tl;t>24?(e<1/0&&(mp=setTimeout(tL,e-gp.now()-bx)),pp&&(pp=clearInterval(pp))):(pp||(xx=gp.now(),pp=setInterval(YY,eL)),Ru=1,nL(tL))}}function vx(e,t,n){var r=new xp;return t=t==null?0:+t,r.restart(i=>{r.stop(),e(i+t)},t,n),r}var GY=Gc("start","end","cancel","interrupt"),WY=[],sL=0,iL=1,Sx=2,_x=3,oL=4,Ix=5,wp=6;function ka(e,t,n,r,i,o){var s=e.__transition;if(!s)e.__transition={};else if(n in s)return;HY(e,n,{name:t,index:r,group:i,on:GY,tween:WY,time:o.time,delay:o.delay,duration:o.duration,ease:o.ease,timer:null,state:sL})}function vp(e,t){var n=nn(e,t);if(n.state>sL)throw new Error("too late; already scheduled");return n}function In(e,t){var n=nn(e,t);if(n.state>_x)throw new Error("too late; already running");return n}function nn(e,t){var n=e.__transition;if(!n||!(n=n[t]))throw new Error("transition not found");return n}function HY(e,t,n){var r=e.__transition,i;r[t]=n,n.timer=wx(o,0,n.time);function o(l){n.state=iL,n.timer.restart(s,n.delay,n.time),n.delay<=l&&s(l-n.delay)}function s(l){var u,f,d,h;if(n.state!==iL)return c();for(u in r)if(h=r[u],h.name===n.name){if(h.state===_x)return vx(s);h.state===oL?(h.state=wp,h.timer.stop(),h.on.call("interrupt",e,e.__data__,h.index,h.group),delete r[u]):+u<t&&(h.state=wp,h.timer.stop(),h.on.call("cancel",e,e.__data__,h.index,h.group),delete r[u])}if(vx(function(){n.state===_x&&(n.state=oL,n.timer.restart(a,n.delay,n.time),a(l))}),n.state=Sx,n.on.call("start",e,e.__data__,n.index,n.group),n.state===Sx){for(n.state=_x,i=new Array(d=n.tween.length),u=0,f=-1;u<d;++u)(h=n.tween[u].value.call(e,e.__data__,n.index,n.group))&&(i[++f]=h);i.length=f+1}}function a(l){for(var u=l<n.duration?n.ease.call(null,l/n.duration):(n.timer.restart(c),n.state=Ix,1),f=-1,d=i.length;++f<d;)i[f].call(e,u);n.state===Ix&&(n.on.call("end",e,e.__data__,n.index,n.group),c())}function c(){n.state=wp,n.timer.stop(),delete r[t];for(var l in r)return;delete e.__transition}}function go(e,t){var n=e.__transition,r,i,o=!0,s;if(n){t=t==null?null:t+"";for(s in n){if((r=n[s]).name!==t){o=!1;continue}i=r.state>Sx&&r.state<Ix,r.state=wp,r.timer.stop(),r.on.call(i?"interrupt":"cancel",e,e.__data__,r.index,r.group),delete n[s]}o&&delete e.__transition}}function aL(e){return this.each(function(){go(this,e)})}function ZY(e,t){var n,r;return function(){var i=In(this,e),o=i.tween;if(o!==n){r=n=o;for(var s=0,a=r.length;s<a;++s)if(r[s].name===t){r=r.slice(),r.splice(s,1);break}}i.tween=r}}function JY(e,t,n){var r,i;if(typeof n!="function")throw new Error;return function(){var o=In(this,e),s=o.tween;if(s!==r){i=(r=s).slice();for(var a={name:t,value:n},c=0,l=i.length;c<l;++c)if(i[c].name===t){i[c]=a;break}c===l&&i.push(a)}o.tween=i}}function cL(e,t){var n=this._id;if(e+="",arguments.length<2){for(var r=nn(this.node(),n).tween,i=0,o=r.length,s;i<o;++i)if((s=r[i]).name===e)return s.value;return null}return this.each((t==null?ZY:JY)(n,e,t))}function $u(e,t,n){var r=e._id;return e.each(function(){var i=In(this,r);(i.value||(i.value={}))[t]=n.apply(this,arguments)}),function(i){return nn(i,r).value[t]}}function Mx(e,t){var n;return(typeof t=="number"?we:t instanceof Cr?oi:(n=Cr(t))?(t=n,oi):hp)(e,t)}function QY(e){return function(){this.removeAttribute(e)}}function KY(e){return function(){this.removeAttributeNS(e.space,e.local)}}function tX(e,t,n){var r,i=n+"",o;return function(){var s=this.getAttribute(e);return s===i?null:s===r?o:o=t(r=s,n)}}function eX(e,t,n){var r,i=n+"",o;return function(){var s=this.getAttributeNS(e.space,e.local);return s===i?null:s===r?o:o=t(r=s,n)}}function nX(e,t,n){var r,i,o;return function(){var s,a=n(this),c;return a==null?void this.removeAttribute(e):(s=this.getAttribute(e),c=a+"",s===c?null:s===r&&c===i?o:(i=c,o=t(r=s,a)))}}function rX(e,t,n){var r,i,o;return function(){var s,a=n(this),c;return a==null?void this.removeAttributeNS(e.space,e.local):(s=this.getAttributeNS(e.space,e.local),c=a+"",s===c?null:s===r&&c===i?o:(i=c,o=t(r=s,a)))}}function lL(e,t){var n=Es(e),r=n==="transform"?rI:Mx;return this.attrTween(e,typeof t=="function"?(n.local?rX:nX)(n,r,$u(this,"attr."+e,t)):t==null?(n.local?KY:QY)(n):(n.local?eX:tX)(n,r,t))}function iX(e,t){return function(n){this.setAttribute(e,t.call(this,n))}}function oX(e,t){return function(n){this.setAttributeNS(e.space,e.local,t.call(this,n))}}function sX(e,t){var n,r;function i(){var o=t.apply(this,arguments);return o!==r&&(n=(r=o)&&oX(e,o)),n}return i._value=t,i}function aX(e,t){var n,r;function i(){var o=t.apply(this,arguments);return o!==r&&(n=(r=o)&&iX(e,o)),n}return i._value=t,i}function uL(e,t){var n="attr."+e;if(arguments.length<2)return(n=this.tween(n))&&n._value;if(t==null)return this.tween(n,null);if(typeof t!="function")throw new Error;var r=Es(e);return this.tween(n,(r.local?sX:aX)(r,t))}function cX(e,t){return function(){vp(this,e).delay=+t.apply(this,arguments)}}function lX(e,t){return t=+t,function(){vp(this,e).delay=t}}function fL(e){var t=this._id;return arguments.length?this.each((typeof e=="function"?cX:lX)(t,e)):nn(this.node(),t).delay}function uX(e,t){return function(){In(this,e).duration=+t.apply(this,arguments)}}function fX(e,t){return t=+t,function(){In(this,e).duration=t}}function dL(e){var t=this._id;return arguments.length?this.each((typeof e=="function"?uX:fX)(t,e)):nn(this.node(),t).duration}function dX(e,t){if(typeof t!="function")throw new Error;return function(){In(this,e).ease=t}}function hL(e){var t=this._id;return arguments.length?this.each(dX(t,e)):nn(this.node(),t).ease}function hX(e,t){return function(){var n=t.apply(this,arguments);if(typeof n!="function")throw new Error;In(this,e).ease=n}}function pL(e){if(typeof e!="function")throw new Error;return this.each(hX(this._id,e))}function mL(e){typeof e!="function"&&(e=ip(e));for(var t=this._groups,n=t.length,r=new Array(n),i=0;i<n;++i)for(var o=t[i],s=o.length,a=r[i]=[],c,l=0;l<s;++l)(c=o[l])&&e.call(c,c.__data__,l,o)&&a.push(c);return new Hn(r,this._parents,this._name,this._id)}function yL(e){if(e._id!==this._id)throw new Error;for(var t=this._groups,n=e._groups,r=t.length,i=n.length,o=Math.min(r,i),s=new Array(r),a=0;a<o;++a)for(var c=t[a],l=n[a],u=c.length,f=s[a]=new Array(u),d,h=0;h<u;++h)(d=c[h]||l[h])&&(f[h]=d);for(;a<r;++a)s[a]=t[a];return new Hn(s,this._parents,this._name,this._id)}function pX(e){return(e+"").trim().split(/^|\s+/).every(function(t){var n=t.indexOf(".");return n>=0&&(t=t.slice(0,n)),!t||t==="start"})}function mX(e,t,n){var r,i,o=pX(t)?vp:In;return function(){var s=o(this,e),a=s.on;a!==r&&(i=(r=a).copy()).on(t,n),s.on=i}}function gL(e,t){var n=this._id;return arguments.length<2?nn(this.node(),n).on.on(e):this.each(mX(n,e,t))}function yX(e){return function(){var t=this.parentNode;for(var n in this.__transition)if(+n!==e)return;t&&t.removeChild(this)}}function xL(){return this.on("end.remove",yX(this._id))}function bL(e){var t=this._name,n=this._id;typeof e!="function"&&(e=Wc(e));for(var r=this._groups,i=r.length,o=new Array(i),s=0;s<i;++s)for(var a=r[s],c=a.length,l=o[s]=new Array(c),u,f,d=0;d<c;++d)(u=a[d])&&(f=e.call(u,u.__data__,d,a))&&("__data__"in u&&(f.__data__=u.__data__),l[d]=f,ka(l[d],t,n,d,l,nn(u,n)));return new Hn(o,this._parents,t,n)}function wL(e){var t=this._name,n=this._id;typeof e!="function"&&(e=rp(e));for(var r=this._groups,i=r.length,o=[],s=[],a=0;a<i;++a)for(var c=r[a],l=c.length,u,f=0;f<l;++f)if(u=c[f]){for(var d=e.call(u,u.__data__,f,c),h,p=nn(u,n),m=0,g=d.length;m<g;++m)(h=d[m])&&ka(h,t,n,m,d,p);o.push(d),s.push(u)}return new Hn(o,s,t,n)}var gX=Ds.prototype.constructor;function vL(){return new gX(this._groups,this._parents)}function xX(e,t){var n,r,i;return function(){var o=Oa(this,e),s=(this.style.removeProperty(e),Oa(this,e));return o===s?null:o===n&&s===r?i:i=t(n=o,r=s)}}function _L(e){return function(){this.style.removeProperty(e)}}function bX(e,t,n){var r,i=n+"",o;return function(){var s=Oa(this,e);return s===i?null:s===r?o:o=t(r=s,n)}}function wX(e,t,n){var r,i,o;return function(){var s=Oa(this,e),a=n(this),c=a+"";return a==null&&(c=a=(this.style.removeProperty(e),Oa(this,e))),s===c?null:s===r&&c===i?o:(i=c,o=t(r=s,a))}}function vX(e,t){var n,r,i,o="style."+t,s="end."+o,a;return function(){var c=In(this,e),l=c.on,u=c.value[o]==null?a||(a=_L(t)):void 0;(l!==n||i!==u)&&(r=(n=l).copy()).on(s,i=u),c.on=r}}function SL(e,t,n){var r=(e+="")=="transform"?nI:Mx;return t==null?this.styleTween(e,xX(e,r)).on("end.style."+e,_L(e)):typeof t=="function"?this.styleTween(e,wX(e,r,$u(this,"style."+e,t))).each(vX(this._id,e)):this.styleTween(e,bX(e,r,t),n).on("end.style."+e,null)}function _X(e,t,n){return function(r){this.style.setProperty(e,t.call(this,r),n)}}function SX(e,t,n){var r,i;function o(){var s=t.apply(this,arguments);return s!==i&&(r=(i=s)&&_X(e,s,n)),r}return o._value=t,o}function IL(e,t,n){var r="style."+(e+="");if(arguments.length<2)return(r=this.tween(r))&&r._value;if(t==null)return this.tween(r,null);if(typeof t!="function")throw new Error;return this.tween(r,SX(e,t,n??""))}function IX(e){return function(){this.textContent=e}}function MX(e){return function(){var t=e(this);this.textContent=t??""}}function ML(e){return this.tween("text",typeof e=="function"?MX($u(this,"text",e)):IX(e==null?"":e+""))}function TX(e){return function(t){this.textContent=e.call(this,t)}}function AX(e){var t,n;function r(){var i=e.apply(this,arguments);return i!==n&&(t=(n=i)&&TX(i)),t}return r._value=e,r}function TL(e){var t="text";if(arguments.length<1)return(t=this.tween(t))&&t._value;if(e==null)return this.tween(t,null);if(typeof e!="function")throw new Error;return this.tween(t,AX(e))}function AL(){for(var e=this._name,t=this._id,n=Tx(),r=this._groups,i=r.length,o=0;o<i;++o)for(var s=r[o],a=s.length,c,l=0;l<a;++l)if(c=s[l]){var u=nn(c,t);ka(c,e,n,l,s,{time:u.time+u.delay+u.duration,delay:0,duration:u.duration,ease:u.ease})}return new Hn(r,this._parents,e,n)}function EL(){var e,t,n=this,r=n._id,i=n.size();return new Promise(function(o,s){var a={value:s},c={value:function(){--i===0&&o()}};n.each(function(){var l=In(this,r),u=l.on;u!==e&&(t=(e=u).copy(),t._.cancel.push(a),t._.interrupt.push(a),t._.end.push(c)),l.on=t}),i===0&&o()})}var EX=0;function Hn(e,t,n,r){this._groups=e,this._parents=t,this._name=n,this._id=r}function NL(e){return Ds().transition(e)}function Tx(){return++EX}var Ls=Ds.prototype;Hn.prototype=NL.prototype={constructor:Hn,select:bL,selectAll:wL,selectChild:Ls.selectChild,selectChildren:Ls.selectChildren,filter:mL,merge:yL,selection:vL,transition:AL,call:Ls.call,nodes:Ls.nodes,node:Ls.node,size:Ls.size,empty:Ls.empty,each:Ls.each,on:gL,attr:lL,attrTween:uL,style:SL,styleTween:IL,text:ML,textTween:TL,remove:xL,tween:cL,delay:fL,duration:dL,ease:hL,easeVarying:pL,end:EL,[Symbol.iterator]:Ls[Symbol.iterator]};function Ax(e){return((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2}var NX={time:null,delay:0,duration:250,ease:Ax};function DX(e,t){for(var n;!(n=e.__transition)||!(n=n[t]);)if(!(e=e.parentNode))throw new Error(`transition ${t} not found`);return n}function DL(e){var t,n;e instanceof Hn?(t=e._id,e=e._name):(t=Tx(),(n=NX).time=bp(),e=e==null?null:e+"");for(var r=this._groups,i=r.length,o=0;o<i;++o)for(var s=r[o],a=s.length,c,l=0;l<a;++l)(c=s[l])&&ka(c,e,t,l,s,n||DX(c,t));return new Hn(r,this._parents,e,t)}Ds.prototype.interrupt=aL;Ds.prototype.transition=DL;var Ex=e=>()=>e;function cI(e,{sourceEvent:t,target:n,selection:r,mode:i,dispatch:o}){Object.defineProperties(this,{type:{value:e,enumerable:!0,configurable:!0},sourceEvent:{value:t,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 OL(e){e.stopImmediatePropagation()}function Nx(e){e.preventDefault(),e.stopImmediatePropagation()}var BL={name:"drag"},lI={name:"space"},Pu={name:"handle"},Uu={name:"center"},{abs:LL,max:kn,min:Cn}=Math;function kL(e){return[+e[0],+e[1]]}function fI(e){return[kL(e[0]),kL(e[1])]}var Dx={name:"x",handles:["w","e"].map(_p),input:function(e,t){return e==null?null:[[+e[0],t[0][1]],[+e[1],t[1][1]]]},output:function(e){return e&&[e[0][0],e[1][0]]}},Ox={name:"y",handles:["n","s"].map(_p),input:function(e,t){return e==null?null:[[t[0][0],+e[0]],[t[1][0],+e[1]]]},output:function(e){return e&&[e[0][1],e[1][1]]}},OX={name:"xy",handles:["n","w","e","s","nw","ne","sw","se"].map(_p),input:function(e){return e==null?null:fI(e)},output:function(e){return e}},ks={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"},CL={e:"w",w:"e",nw:"ne",ne:"nw",se:"sw",sw:"se"},FL={n:"s",s:"n",nw:"sw",ne:"se",se:"ne",sw:"nw"},BX={overlay:1,selection:1,n:null,e:1,s:null,w:-1,nw:-1,ne:1,se:1,sw:-1},LX={overlay:1,selection:1,n:-1,e:null,s:1,w:null,nw:-1,ne:-1,se:1,sw:1};function _p(e){return{type:e}}function kX(e){return!e.ctrlKey&&!e.button}function CX(){var e=this.ownerSVGElement||this;return e.hasAttribute("viewBox")?(e=e.viewBox.baseVal,[[e.x,e.y],[e.x+e.width,e.y+e.height]]):[[0,0],[e.width.baseVal.value,e.height.baseVal.value]]}function FX(){return navigator.maxTouchPoints||"ontouchstart"in this}function uI(e){for(;!e.__brush;)if(!(e=e.parentNode))return;return e.__brush}function RX(e){return e[0][0]===e[1][0]||e[0][1]===e[1][1]}function dI(){return mI(Dx)}function hI(){return mI(Ox)}function pI(){return mI(OX)}function mI(e){var t=CX,n=kX,r=FX,i=!0,o=Gc("start","brush","end"),s=6,a;function c(g){var y=g.property("__brush",m).selectAll(".overlay").data([_p("overlay")]);y.enter().append("rect").attr("class","overlay").attr("pointer-events","all").attr("cursor",ks.overlay).merge(y).each(function(){var b=uI(this).extent;jt(this).attr("x",b[0][0]).attr("y",b[0][1]).attr("width",b[1][0]-b[0][0]).attr("height",b[1][1]-b[0][1])}),g.selectAll(".selection").data([_p("selection")]).enter().append("rect").attr("class","selection").attr("cursor",ks.selection).attr("fill","#777").attr("fill-opacity",.3).attr("stroke","#fff").attr("shape-rendering","crispEdges");var x=g.selectAll(".handle").data(e.handles,function(b){return b.type});x.exit().remove(),x.enter().append("rect").attr("class",function(b){return"handle handle--"+b.type}).attr("cursor",function(b){return ks[b.type]}),g.each(l).attr("fill","none").attr("pointer-events","all").on("mousedown.brush",d).filter(r).on("touchstart.brush",d).on("touchmove.brush",h).on("touchend.brush touchcancel.brush",p).style("touch-action","none").style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}c.move=function(g,y,x){g.tween?g.on("start.brush",function(b){u(this,arguments).beforestart().start(b)}).on("interrupt.brush end.brush",function(b){u(this,arguments).end(b)}).tween("brush",function(){var b=this,w=b.__brush,_=u(b,arguments),v=w.selection,M=e.input(typeof y=="function"?y.apply(this,arguments):y,w.extent),E=Fr(v,M);function D(I){w.selection=I===1&&M===null?null:E(I),l.call(b),_.brush()}return v!==null&&M!==null?D:D(1)}):g.each(function(){var b=this,w=arguments,_=b.__brush,v=e.input(typeof y=="function"?y.apply(b,w):y,_.extent),M=u(b,w).beforestart();go(b),_.selection=v===null?null:v,l.call(b),M.start(x).brush(x).end(x)})},c.clear=function(g,y){c.move(g,null,y)};function l(){var g=jt(this),y=uI(this).selection;y?(g.selectAll(".selection").style("display",null).attr("x",y[0][0]).attr("y",y[0][1]).attr("width",y[1][0]-y[0][0]).attr("height",y[1][1]-y[0][1]),g.selectAll(".handle").style("display",null).attr("x",function(x){return x.type[x.type.length-1]==="e"?y[1][0]-s/2:y[0][0]-s/2}).attr("y",function(x){return x.type[0]==="s"?y[1][1]-s/2:y[0][1]-s/2}).attr("width",function(x){return x.type==="n"||x.type==="s"?y[1][0]-y[0][0]+s:s}).attr("height",function(x){return x.type==="e"||x.type==="w"?y[1][1]-y[0][1]+s:s})):g.selectAll(".selection,.handle").style("display","none").attr("x",null).attr("y",null).attr("width",null).attr("height",null)}function u(g,y,x){var b=g.__brush.emitter;return b&&(!x||!b.clean)?b:new f(g,y,x)}function f(g,y,x){this.that=g,this.args=y,this.state=g.__brush,this.active=0,this.clean=x}f.prototype={beforestart:function(){return++this.active===1&&(this.state.emitter=this,this.starting=!0),this},start:function(g,y){return this.starting?(this.starting=!1,this.emit("start",g,y)):this.emit("brush",g),this},brush:function(g,y){return this.emit("brush",g,y),this},end:function(g,y){return--this.active===0&&(delete this.state.emitter,this.emit("end",g,y)),this},emit:function(g,y,x){var b=jt(this.that).datum();o.call(g,this.that,new cI(g,{sourceEvent:y,target:c,selection:e.output(this.state.selection),mode:x,dispatch:o}),b)}};function d(g){if(a&&!g.touches||!n.apply(this,arguments))return;var y=this,x=g.target.__data__.type,b=(i&&g.metaKey?x="overlay":x)==="selection"?BL:i&&g.altKey?Uu:Pu,w=e===Ox?null:BX[x],_=e===Dx?null:LX[x],v=uI(y),M=v.extent,E=v.selection,D=M[0][0],I,T,O=M[0][1],B,S,A=M[1][0],N,k,R=M[1][1],F,$,P=0,U=0,W,tt=w&&_&&i&&g.shiftKey,nt,st,Y=Array.from(g.touches||[g],et=>{let oe=et.identifier;return et=Bn(et,y),et.point0=et.slice(),et.identifier=oe,et});go(y);var rt=u(y,arguments,!0).beforestart();if(x==="overlay"){E&&(W=!0);let et=[Y[0],Y[1]||Y[0]];v.selection=E=[[I=e===Ox?D:Cn(et[0][0],et[1][0]),B=e===Dx?O:Cn(et[0][1],et[1][1])],[N=e===Ox?A:kn(et[0][0],et[1][0]),F=e===Dx?R:kn(et[0][1],et[1][1])]],Y.length>1&&Ct(g)}else I=E[0][0],B=E[0][1],N=E[1][0],F=E[1][1];T=I,S=B,k=N,$=F;var j=jt(y).attr("pointer-events","none"),H=j.selectAll(".overlay").attr("cursor",ks[x]);if(g.touches)rt.moved=z,rt.ended=dt;else{var ot=jt(g.view).on("mousemove.brush",z,!0).on("mouseup.brush",dt,!0);i&&ot.on("keydown.brush",Wt,!0).on("keyup.brush",Ht,!0),sp(g.view)}l.call(y),rt.start(g,b.name);function z(et){for(let oe of et.changedTouches||[et])for(let br of Y)br.identifier===oe.identifier&&(br.cur=Bn(oe,y));if(tt&&!nt&&!st&&Y.length===1){let oe=Y[0];LL(oe.cur[0]-oe[0])>LL(oe.cur[1]-oe[1])?st=!0:nt=!0}for(let oe of Y)oe.cur&&(oe[0]=oe.cur[0],oe[1]=oe.cur[1]);W=!0,Nx(et),Ct(et)}function Ct(et){let oe=Y[0],br=oe.point0;var Wi;switch(P=oe[0]-br[0],U=oe[1]-br[1],b){case lI:case BL:{w&&(P=kn(D-I,Cn(A-N,P)),T=I+P,k=N+P),_&&(U=kn(O-B,Cn(R-F,U)),S=B+U,$=F+U);break}case Pu:{Y[1]?(w&&(T=kn(D,Cn(A,Y[0][0])),k=kn(D,Cn(A,Y[1][0])),w=1),_&&(S=kn(O,Cn(R,Y[0][1])),$=kn(O,Cn(R,Y[1][1])),_=1)):(w<0?(P=kn(D-I,Cn(A-I,P)),T=I+P,k=N):w>0&&(P=kn(D-N,Cn(A-N,P)),T=I,k=N+P),_<0?(U=kn(O-B,Cn(R-B,U)),S=B+U,$=F):_>0&&(U=kn(O-F,Cn(R-F,U)),S=B,$=F+U));break}case Uu:{w&&(T=kn(D,Cn(A,I-P*w)),k=kn(D,Cn(A,N+P*w))),_&&(S=kn(O,Cn(R,B-U*_)),$=kn(O,Cn(R,F+U*_)));break}}k<T&&(w*=-1,Wi=I,I=N,N=Wi,Wi=T,T=k,k=Wi,x in CL&&H.attr("cursor",ks[x=CL[x]])),$<S&&(_*=-1,Wi=B,B=F,F=Wi,Wi=S,S=$,$=Wi,x in FL&&H.attr("cursor",ks[x=FL[x]])),v.selection&&(E=v.selection),nt&&(T=E[0][0],k=E[1][0]),st&&(S=E[0][1],$=E[1][1]),(E[0][0]!==T||E[0][1]!==S||E[1][0]!==k||E[1][1]!==$)&&(v.selection=[[T,S],[k,$]],l.call(y),rt.brush(et,b.name))}function dt(et){if(OL(et),et.touches){if(et.touches.length)return;a&&clearTimeout(a),a=setTimeout(function(){a=null},500)}else ap(et.view,W),ot.on("keydown.brush keyup.brush mousemove.brush mouseup.brush",null);j.attr("pointer-events","all"),H.attr("cursor",ks.overlay),v.selection&&(E=v.selection),RX(E)&&(v.selection=null,l.call(y)),rt.end(et,b.name)}function Wt(et){switch(et.keyCode){case 16:{tt=w&&_;break}case 18:{b===Pu&&(w&&(N=k-P*w,I=T+P*w),_&&(F=$-U*_,B=S+U*_),b=Uu,Ct(et));break}case 32:{(b===Pu||b===Uu)&&(w<0?N=k-P:w>0&&(I=T-P),_<0?F=$-U:_>0&&(B=S-U),b=lI,H.attr("cursor",ks.selection),Ct(et));break}default:return}Nx(et)}function Ht(et){switch(et.keyCode){case 16:{tt&&(nt=st=tt=!1,Ct(et));break}case 18:{b===Uu&&(w<0?N=k:w>0&&(I=T),_<0?F=$:_>0&&(B=S),b=Pu,Ct(et));break}case 32:{b===lI&&(et.altKey?(w&&(N=k-P*w,I=T+P*w),_&&(F=$-U*_,B=S+U*_),b=Uu):(w<0?N=k:w>0&&(I=T),_<0?F=$:_>0&&(B=S),b=Pu),H.attr("cursor",ks[x]),Ct(et));break}default:return}Nx(et)}}function h(g){u(this,arguments).moved(g)}function p(g){u(this,arguments).ended(g)}function m(){var g=this.__brush||{selection:null};return g.extent=fI(t.apply(this,arguments)),g.dim=e,g}return c.extent=function(g){return arguments.length?(t=typeof g=="function"?g:Ex(fI(g)),c):t},c.filter=function(g){return arguments.length?(n=typeof g=="function"?g:Ex(!!g),c):n},c.touchable=function(g){return arguments.length?(r=typeof g=="function"?g:Ex(!!g),c):r},c.handleSize=function(g){return arguments.length?(s=+g,c):s},c.keyModifiers=function(g){return arguments.length?(i=!!g,c):i},c.on=function(){var g=o.on.apply(o,arguments);return g===o?c:g},c}var yI=Math.PI,gI=2*yI,el=1e-6,$X=gI-el;function RL(e){this._+=e[0];for(let t=1,n=e.length;t<n;++t)this._+=arguments[t]+e[t]}function PX(e){let t=Math.floor(e);if(!(t>=0))throw new Error(`invalid digits: ${e}`);if(t>15)return RL;let n=10**t;return function(r){this._+=r[0];for(let i=1,o=r.length;i<o;++i)this._+=Math.round(arguments[i]*n)/n+r[i]}}var Ca=class{constructor(t){this._x0=this._y0=this._x1=this._y1=null,this._="",this._append=t==null?RL:PX(t)}moveTo(t,n){this._append`M${this._x0=this._x1=+t},${this._y0=this._y1=+n}`}closePath(){this._x1!==null&&(this._x1=this._x0,this._y1=this._y0,this._append`Z`)}lineTo(t,n){this._append`L${this._x1=+t},${this._y1=+n}`}quadraticCurveTo(t,n,r,i){this._append`Q${+t},${+n},${this._x1=+r},${this._y1=+i}`}bezierCurveTo(t,n,r,i,o,s){this._append`C${+t},${+n},${+r},${+i},${this._x1=+o},${this._y1=+s}`}arcTo(t,n,r,i,o){if(t=+t,n=+n,r=+r,i=+i,o=+o,o<0)throw new Error(`negative radius: ${o}`);let s=this._x1,a=this._y1,c=r-t,l=i-n,u=s-t,f=a-n,d=u*u+f*f;if(this._x1===null)this._append`M${this._x1=t},${this._y1=n}`;else if(d>el)if(!(Math.abs(f*c-l*u)>el)||!o)this._append`L${this._x1=t},${this._y1=n}`;else{let h=r-s,p=i-a,m=c*c+l*l,g=h*h+p*p,y=Math.sqrt(m),x=Math.sqrt(d),b=o*Math.tan((yI-Math.acos((m+d-g)/(2*y*x)))/2),w=b/x,_=b/y;Math.abs(w-1)>el&&this._append`L${t+w*u},${n+w*f}`,this._append`A${o},${o},0,0,${+(f*h>u*p)},${this._x1=t+_*c},${this._y1=n+_*l}`}}arc(t,n,r,i,o,s){if(t=+t,n=+n,r=+r,s=!!s,r<0)throw new Error(`negative radius: ${r}`);let a=r*Math.cos(i),c=r*Math.sin(i),l=t+a,u=n+c,f=1^s,d=s?i-o:o-i;this._x1===null?this._append`M${l},${u}`:(Math.abs(this._x1-l)>el||Math.abs(this._y1-u)>el)&&this._append`L${l},${u}`,r&&(d<0&&(d=d%gI+gI),d>$X?this._append`A${r},${r},0,1,${f},${t-a},${n-c}A${r},${r},0,1,${f},${this._x1=l},${this._y1=u}`:d>el&&this._append`A${r},${r},0,${+(d>=yI)},${f},${this._x1=t+r*Math.cos(o)},${this._y1=n+r*Math.sin(o)}`)}rect(t,n,r,i){this._append`M${this._x0=this._x1=+t},${this._y0=this._y1=+n}h${r=+r}v${+i}h${-r}Z`}toString(){return this._}};function $L(){return new Ca}$L.prototype=Ca.prototype;function Zn(e=3){return new Ca(+e)}var UX=Array.prototype,Bx=UX.slice;function PL(e,t){return e-t}function UL(e){for(var t=0,n=e.length,r=e[n-1][1]*e[0][0]-e[n-1][0]*e[0][1];++t<n;)r+=e[t-1][1]*e[t][0]-e[t-1][0]*e[t][1];return r}var xo=e=>()=>e;function zL(e,t){for(var n=-1,r=t.length,i;++n<r;)if(i=zX(e,t[n]))return i;return 0}function zX(e,t){for(var n=t[0],r=t[1],i=-1,o=0,s=e.length,a=s-1;o<s;a=o++){var c=e[o],l=c[0],u=c[1],f=e[a],d=f[0],h=f[1];if(jX(c,f,t))return 0;u>r!=h>r&&n<(d-l)*(r-u)/(h-u)+l&&(i=-i)}return i}function jX(e,t,n){var r;return qX(e,t,n)&&VX(e[r=+(e[0]===t[0])],n[r],t[r])}function qX(e,t,n){return(t[0]-e[0])*(n[1]-e[1])===(n[0]-e[0])*(t[1]-e[1])}function VX(e,t,n){return e<=t&&t<=n||n<=t&&t<=e}function jL(){}var Cs=[[],[[[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 Fa(){var e=1,t=1,n=Na,r=c;function i(l){var u=n(l);if(Array.isArray(u))u=u.slice().sort(PL);else{let f=ae(l,YX);for(u=_n(...Eu(f[0],f[1],u),u);u[u.length-1]>=f[1];)u.pop();for(;u[1]<f[0];)u.shift()}return u.map(f=>o(l,f))}function o(l,u){let f=u==null?NaN:+u;if(isNaN(f))throw new Error(`invalid value: ${u}`);var d=[],h=[];return s(l,f,function(p){r(p,l,f),UL(p)>0?d.push([p]):h.push(p)}),h.forEach(function(p){for(var m=0,g=d.length,y;m<g;++m)if(zL((y=d[m])[0],p)!==-1){y.push(p);return}}),{type:"MultiPolygon",value:u,coordinates:d}}function s(l,u,f){var d=new Array,h=new Array,p,m,g,y,x,b;for(p=m=-1,y=nl(l[0],u),Cs[y<<1].forEach(w);++p<e-1;)g=y,y=nl(l[p+1],u),Cs[g|y<<1].forEach(w);for(Cs[y<<0].forEach(w);++m<t-1;){for(p=-1,y=nl(l[m*e+e],u),x=nl(l[m*e],u),Cs[y<<1|x<<2].forEach(w);++p<e-1;)g=y,y=nl(l[m*e+e+p+1],u),b=x,x=nl(l[m*e+p+1],u),Cs[g|y<<1|x<<2|b<<3].forEach(w);Cs[y|x<<3].forEach(w)}for(p=-1,x=l[m*e]>=u,Cs[x<<2].forEach(w);++p<e-1;)b=x,x=nl(l[m*e+p+1],u),Cs[x<<2|b<<3].forEach(w);Cs[x<<3].forEach(w);function w(_){var v=[_[0][0]+p,_[0][1]+m],M=[_[1][0]+p,_[1][1]+m],E=a(v),D=a(M),I,T;(I=h[E])?(T=d[D])?(delete h[I.end],delete d[T.start],I===T?(I.ring.push(M),f(I.ring)):d[I.start]=h[T.end]={start:I.start,end:T.end,ring:I.ring.concat(T.ring)}):(delete h[I.end],I.ring.push(M),h[I.end=D]=I):(I=d[D])?(T=h[E])?(delete d[I.start],delete h[T.end],I===T?(I.ring.push(M),f(I.ring)):d[T.start]=h[I.end]={start:T.start,end:I.end,ring:T.ring.concat(I.ring)}):(delete d[I.start],I.ring.unshift(v),d[I.start=E]=I):d[E]=h[D]={start:E,end:D,ring:[v,M]}}}function a(l){return l[0]*2+l[1]*(e+1)*4}function c(l,u,f){l.forEach(function(d){var h=d[0],p=d[1],m=h|0,g=p|0,y=xI(u[g*e+m]);h>0&&h<e&&m===h&&(d[0]=qL(h,xI(u[g*e+m-1]),y,f)),p>0&&p<t&&g===p&&(d[1]=qL(p,xI(u[(g-1)*e+m]),y,f))})}return i.contour=o,i.size=function(l){if(!arguments.length)return[e,t];var u=Math.floor(l[0]),f=Math.floor(l[1]);if(!(u>=0&&f>=0))throw new Error("invalid size");return e=u,t=f,i},i.thresholds=function(l){return arguments.length?(n=typeof l=="function"?l:Array.isArray(l)?xo(Bx.call(l)):xo(l),i):n},i.smooth=function(l){return arguments.length?(r=l?c:jL,i):r===c},i}function YX(e){return isFinite(e)?e:NaN}function nl(e,t){return e==null?!1:+e>=t}function xI(e){return e==null||isNaN(e=+e)?-1/0:e}function qL(e,t,n,r){let i=r-t,o=n-t,s=isFinite(i)||isFinite(o)?i/o:Math.sign(i)/Math.sign(o);return isNaN(s)?e:e+s-.5}function XX(e){return e[0]}function GX(e){return e[1]}function WX(){return 1}function bI(){var e=XX,t=GX,n=WX,r=960,i=500,o=20,s=2,a=o*3,c=r+a*2>>s,l=i+a*2>>s,u=xo(20);function f(x){var b=new Float32Array(c*l),w=Math.pow(2,-s),_=-1;for(let B of x){var v=(e(B,++_,x)+a)*w,M=(t(B,_,x)+a)*w,E=+n(B,_,x);if(E&&v>=0&&v<c&&M>=0&&M<l){var D=Math.floor(v),I=Math.floor(M),T=v-D-.5,O=M-I-.5;b[D+I*c]+=(1-T)*(1-O)*E,b[D+1+I*c]+=T*(1-O)*E,b[D+1+(I+1)*c]+=T*O*E,b[D+(I+1)*c]+=(1-T)*O*E}}return Jh({data:b,width:c,height:l},o*w),b}function d(x){var b=f(x),w=u(b),_=Math.pow(2,2*s);return Array.isArray(w)||(w=_n(Number.MIN_VALUE,zt(b)/_,w)),Fa().size([c,l]).thresholds(w.map(v=>v*_))(b).map((v,M)=>(v.value=+w[M],h(v)))}d.contours=function(x){var b=f(x),w=Fa().size([c,l]),_=Math.pow(2,2*s),v=M=>{M=+M;var E=h(w.contour(b,M*_));return E.value=M,E};return Object.defineProperty(v,"max",{get:()=>zt(b)/_}),v};function h(x){return x.coordinates.forEach(p),x}function p(x){x.forEach(m)}function m(x){x.forEach(g)}function g(x){x[0]=x[0]*Math.pow(2,s)-a,x[1]=x[1]*Math.pow(2,s)-a}function y(){return a=o*3,c=r+a*2>>s,l=i+a*2>>s,d}return d.x=function(x){return arguments.length?(e=typeof x=="function"?x:xo(+x),d):e},d.y=function(x){return arguments.length?(t=typeof x=="function"?x:xo(+x),d):t},d.weight=function(x){return arguments.length?(n=typeof x=="function"?x:xo(+x),d):n},d.size=function(x){if(!arguments.length)return[r,i];var b=+x[0],w=+x[1];if(!(b>=0&&w>=0))throw new Error("invalid size");return r=b,i=w,y()},d.cellSize=function(x){if(!arguments.length)return 1<<s;if(!((x=+x)>=1))throw new Error("invalid cell size");return s=Math.floor(Math.log(x)/Math.LN2),y()},d.thresholds=function(x){return arguments.length?(u=typeof x=="function"?x:Array.isArray(x)?xo(Bx.call(x)):xo(x),d):u},d.bandwidth=function(x){if(!arguments.length)return Math.sqrt(o*(o+1));if(!((x=+x)>=0))throw new Error("invalid bandwidth");return o=(Math.sqrt(4*x*x+1)-1)/2,y()},d}var Kt=11102230246251565e-32,Xe=134217729,Sp=(3+8*Kt)*Kt;function rl(e,t,n,r,i){let o,s,a,c,l=t[0],u=r[0],f=0,d=0;u>l==u>-l?(o=l,l=t[++f]):(o=u,u=r[++d]);let h=0;if(f<e&&d<n)for(u>l==u>-l?(s=l+o,a=o-(s-l),l=t[++f]):(s=u+o,a=o-(s-u),u=r[++d]),o=s,a!==0&&(i[h++]=a);f<e&&d<n;)u>l==u>-l?(s=o+l,c=s-o,a=o-(s-c)+(l-c),l=t[++f]):(s=o+u,c=s-o,a=o-(s-c)+(u-c),u=r[++d]),o=s,a!==0&&(i[h++]=a);for(;f<e;)s=o+l,c=s-o,a=o-(s-c)+(l-c),l=t[++f],o=s,a!==0&&(i[h++]=a);for(;d<n;)s=o+u,c=s-o,a=o-(s-c)+(u-c),u=r[++d],o=s,a!==0&&(i[h++]=a);return(o!==0||h===0)&&(i[h++]=o),h}function Ip(e,t){let n=t[0];for(let r=1;r<e;r++)n+=t[r];return n}function V(e){return new Float64Array(e)}var HX=(3+16*Kt)*Kt,ZX=(2+12*Kt)*Kt,JX=(9+64*Kt)*Kt*Kt,zu=V(4),VL=V(8),YL=V(12),XL=V(16),Jn=V(4);function QX(e,t,n,r,i,o,s){let a,c,l,u,f,d,h,p,m,g,y,x,b,w,_,v,M,E,D=e-i,I=n-i,T=t-o,O=r-o;w=D*O,d=Xe*D,h=d-(d-D),p=D-h,d=Xe*O,m=d-(d-O),g=O-m,_=p*g-(w-h*m-p*m-h*g),v=T*I,d=Xe*T,h=d-(d-T),p=T-h,d=Xe*I,m=d-(d-I),g=I-m,M=p*g-(v-h*m-p*m-h*g),y=_-M,f=_-y,zu[0]=_-(y+f)+(f-M),x=w+y,f=x-w,b=w-(x-f)+(y-f),y=b-v,f=b-y,zu[1]=b-(y+f)+(f-v),E=x+y,f=E-x,zu[2]=x-(E-f)+(y-f),zu[3]=E;let B=Ip(4,zu),S=ZX*s;if(B>=S||-B>=S||(f=e-D,a=e-(D+f)+(f-i),f=n-I,l=n-(I+f)+(f-i),f=t-T,c=t-(T+f)+(f-o),f=r-O,u=r-(O+f)+(f-o),a===0&&c===0&&l===0&&u===0)||(S=JX*s+Sp*Math.abs(B),B+=D*u+O*a-(T*l+I*c),B>=S||-B>=S))return B;w=a*O,d=Xe*a,h=d-(d-a),p=a-h,d=Xe*O,m=d-(d-O),g=O-m,_=p*g-(w-h*m-p*m-h*g),v=c*I,d=Xe*c,h=d-(d-c),p=c-h,d=Xe*I,m=d-(d-I),g=I-m,M=p*g-(v-h*m-p*m-h*g),y=_-M,f=_-y,Jn[0]=_-(y+f)+(f-M),x=w+y,f=x-w,b=w-(x-f)+(y-f),y=b-v,f=b-y,Jn[1]=b-(y+f)+(f-v),E=x+y,f=E-x,Jn[2]=x-(E-f)+(y-f),Jn[3]=E;let A=rl(4,zu,4,Jn,VL);w=D*u,d=Xe*D,h=d-(d-D),p=D-h,d=Xe*u,m=d-(d-u),g=u-m,_=p*g-(w-h*m-p*m-h*g),v=T*l,d=Xe*T,h=d-(d-T),p=T-h,d=Xe*l,m=d-(d-l),g=l-m,M=p*g-(v-h*m-p*m-h*g),y=_-M,f=_-y,Jn[0]=_-(y+f)+(f-M),x=w+y,f=x-w,b=w-(x-f)+(y-f),y=b-v,f=b-y,Jn[1]=b-(y+f)+(f-v),E=x+y,f=E-x,Jn[2]=x-(E-f)+(y-f),Jn[3]=E;let N=rl(A,VL,4,Jn,YL);w=a*u,d=Xe*a,h=d-(d-a),p=a-h,d=Xe*u,m=d-(d-u),g=u-m,_=p*g-(w-h*m-p*m-h*g),v=c*l,d=Xe*c,h=d-(d-c),p=c-h,d=Xe*l,m=d-(d-l),g=l-m,M=p*g-(v-h*m-p*m-h*g),y=_-M,f=_-y,Jn[0]=_-(y+f)+(f-M),x=w+y,f=x-w,b=w-(x-f)+(y-f),y=b-v,f=b-y,Jn[1]=b-(y+f)+(f-v),E=x+y,f=E-x,Jn[2]=x-(E-f)+(y-f),Jn[3]=E;let k=rl(N,YL,4,Jn,XL);return XL[k-1]}function ju(e,t,n,r,i,o){let s=(t-o)*(n-i),a=(e-i)*(r-o),c=s-a;if(s===0||a===0||s>0!=a>0)return c;let l=Math.abs(s+a);return Math.abs(c)>=HX*l?c:-QX(e,t,n,r,i,o,l)}var Zwt=(7+56*Kt)*Kt,Jwt=(3+28*Kt)*Kt,Qwt=(26+288*Kt)*Kt*Kt,Kwt=V(4),tvt=V(4),evt=V(4),nvt=V(4),rvt=V(4),ivt=V(4),ovt=V(4),svt=V(4),avt=V(4),cvt=V(8),lvt=V(8),uvt=V(8),fvt=V(4),dvt=V(8),hvt=V(8),pvt=V(8),mvt=V(12),yvt=V(192),gvt=V(192);var wvt=(10+96*Kt)*Kt,vvt=(4+48*Kt)*Kt,_vt=(44+576*Kt)*Kt*Kt,Svt=V(4),Ivt=V(4),Mvt=V(4),Tvt=V(4),Avt=V(4),Evt=V(4),Nvt=V(4),Dvt=V(4),Ovt=V(8),Bvt=V(8),Lvt=V(8),kvt=V(8),Cvt=V(8),Fvt=V(8),Rvt=V(8),$vt=V(8),Pvt=V(8),Uvt=V(4),zvt=V(4),jvt=V(4),qvt=V(8),Vvt=V(16),Yvt=V(16),Xvt=V(16),Gvt=V(32),Wvt=V(32),Hvt=V(48),Zvt=V(64),Jvt=V(1152),Qvt=V(1152);var n_t=(16+224*Kt)*Kt,r_t=(5+72*Kt)*Kt,i_t=(71+1408*Kt)*Kt*Kt,o_t=V(4),s_t=V(4),a_t=V(4),c_t=V(4),l_t=V(4),u_t=V(4),f_t=V(4),d_t=V(4),h_t=V(4),p_t=V(4),m_t=V(24),y_t=V(24),g_t=V(24),x_t=V(24),b_t=V(24),w_t=V(24),v_t=V(24),__t=V(24),S_t=V(24),I_t=V(24),M_t=V(1152),T_t=V(1152),A_t=V(1152),E_t=V(1152),N_t=V(1152),D_t=V(2304),O_t=V(2304),B_t=V(3456),L_t=V(5760),k_t=V(8),C_t=V(8),F_t=V(8),R_t=V(16),$_t=V(24),P_t=V(48),U_t=V(48),z_t=V(96),j_t=V(192),q_t=V(384),V_t=V(384),Y_t=V(384),X_t=V(768);var G_t=V(96),W_t=V(96),H_t=V(96),Z_t=V(1152);var WL=Math.pow(2,-52),Lx=new Uint32Array(512),Vu=class e{static from(t,n=iG,r=oG){let i=t.length,o=new Float64Array(i*2);for(let s=0;s<i;s++){let a=t[s];o[2*s]=n(a),o[2*s+1]=r(a)}return new e(o)}constructor(t){let n=t.length>>1;if(n>0&&typeof t[0]!="number")throw new Error("Expected coords to contain numbers.");this.coords=t;let r=Math.max(2*n-5,0);this._triangles=new Uint32Array(r*3),this._halfedges=new Int32Array(r*3),this._hashSize=Math.ceil(Math.sqrt(n)),this._hullPrev=new Uint32Array(n),this._hullNext=new Uint32Array(n),this._hullTri=new Uint32Array(n),this._hullHash=new Int32Array(this._hashSize).fill(-1),this._ids=new Uint32Array(n),this._dists=new Float64Array(n),this.update()}update(){let{coords:t,_hullPrev:n,_hullNext:r,_hullTri:i,_hullHash:o}=this,s=t.length>>1,a=1/0,c=1/0,l=-1/0,u=-1/0;for(let I=0;I<s;I++){let T=t[2*I],O=t[2*I+1];T<a&&(a=T),O<c&&(c=O),T>l&&(l=T),O>u&&(u=O),this._ids[I]=I}let f=(a+l)/2,d=(c+u)/2,h=1/0,p,m,g;for(let I=0;I<s;I++){let T=wI(f,d,t[2*I],t[2*I+1]);T<h&&(p=I,h=T)}let y=t[2*p],x=t[2*p+1];h=1/0;for(let I=0;I<s;I++){if(I===p)continue;let T=wI(y,x,t[2*I],t[2*I+1]);T<h&&T>0&&(m=I,h=T)}let b=t[2*m],w=t[2*m+1],_=1/0;for(let I=0;I<s;I++){if(I===p||I===m)continue;let T=nG(y,x,b,w,t[2*I],t[2*I+1]);T<_&&(g=I,_=T)}let v=t[2*g],M=t[2*g+1];if(_===1/0){for(let O=0;O<s;O++)this._dists[O]=t[2*O]-t[0]||t[2*O+1]-t[1];qu(this._ids,this._dists,0,s-1);let I=new Uint32Array(s),T=0;for(let O=0,B=-1/0;O<s;O++){let S=this._ids[O];this._dists[S]>B&&(I[T++]=S,B=this._dists[S])}this.hull=I.subarray(0,T),this.triangles=new Uint32Array(0),this.halfedges=new Uint32Array(0);return}if(ju(y,x,b,w,v,M)<0){let I=m,T=b,O=w;m=g,b=v,w=M,g=I,v=T,M=O}let E=rG(y,x,b,w,v,M);this._cx=E.x,this._cy=E.y;for(let I=0;I<s;I++)this._dists[I]=wI(t[2*I],t[2*I+1],E.x,E.y);qu(this._ids,this._dists,0,s-1),this._hullStart=p;let D=3;r[p]=n[g]=m,r[m]=n[p]=g,r[g]=n[m]=p,i[p]=0,i[m]=1,i[g]=2,o.fill(-1),o[this._hashKey(y,x)]=p,o[this._hashKey(b,w)]=m,o[this._hashKey(v,M)]=g,this.trianglesLen=0,this._addTriangle(p,m,g,-1,-1,-1);for(let I=0,T,O;I<this._ids.length;I++){let B=this._ids[I],S=t[2*B],A=t[2*B+1];if(I>0&&Math.abs(S-T)<=WL&&Math.abs(A-O)<=WL||(T=S,O=A,B===p||B===m||B===g))continue;let N=0;for(let P=0,U=this._hashKey(S,A);P<this._hashSize&&(N=o[(U+P)%this._hashSize],!(N!==-1&&N!==r[N]));P++);N=n[N];let k=N,R;for(;R=r[k],ju(S,A,t[2*k],t[2*k+1],t[2*R],t[2*R+1])>=0;)if(k=R,k===N){k=-1;break}if(k===-1)continue;let F=this._addTriangle(k,B,r[k],-1,-1,i[k]);i[B]=this._legalize(F+2),i[k]=F,D++;let $=r[k];for(;R=r[$],ju(S,A,t[2*$],t[2*$+1],t[2*R],t[2*R+1])<0;)F=this._addTriangle($,B,R,i[B],-1,i[$]),i[B]=this._legalize(F+2),r[$]=$,D--,$=R;if(k===N)for(;R=n[k],ju(S,A,t[2*R],t[2*R+1],t[2*k],t[2*k+1])<0;)F=this._addTriangle(R,B,k,-1,i[k],i[R]),this._legalize(F+2),i[R]=F,r[k]=k,D--,k=R;this._hullStart=n[B]=k,r[k]=n[$]=B,r[B]=$,o[this._hashKey(S,A)]=B,o[this._hashKey(t[2*k],t[2*k+1])]=k}this.hull=new Uint32Array(D);for(let I=0,T=this._hullStart;I<D;I++)this.hull[I]=T,T=r[T];this.triangles=this._triangles.subarray(0,this.trianglesLen),this.halfedges=this._halfedges.subarray(0,this.trianglesLen)}_hashKey(t,n){return Math.floor(tG(t-this._cx,n-this._cy)*this._hashSize)%this._hashSize}_legalize(t){let{_triangles:n,_halfedges:r,coords:i}=this,o=0,s=0;for(;;){let a=r[t],c=t-t%3;if(s=c+(t+2)%3,a===-1){if(o===0)break;t=Lx[--o];continue}let l=a-a%3,u=c+(t+1)%3,f=l+(a+2)%3,d=n[s],h=n[t],p=n[u],m=n[f];if(eG(i[2*d],i[2*d+1],i[2*h],i[2*h+1],i[2*p],i[2*p+1],i[2*m],i[2*m+1])){n[t]=m,n[a]=d;let y=r[f];if(y===-1){let b=this._hullStart;do{if(this._hullTri[b]===f){this._hullTri[b]=t;break}b=this._hullPrev[b]}while(b!==this._hullStart)}this._link(t,y),this._link(a,r[s]),this._link(s,f);let x=l+(a+1)%3;o<Lx.length&&(Lx[o++]=x)}else{if(o===0)break;t=Lx[--o]}}return s}_link(t,n){this._halfedges[t]=n,n!==-1&&(this._halfedges[n]=t)}_addTriangle(t,n,r,i,o,s){let a=this.trianglesLen;return this._triangles[a]=t,this._triangles[a+1]=n,this._triangles[a+2]=r,this._link(a,i),this._link(a+1,o),this._link(a+2,s),this.trianglesLen+=3,a}};function tG(e,t){let n=e/(Math.abs(e)+Math.abs(t));return(t>0?3-n:1+n)/4}function wI(e,t,n,r){let i=e-n,o=t-r;return i*i+o*o}function eG(e,t,n,r,i,o,s,a){let c=e-s,l=t-a,u=n-s,f=r-a,d=i-s,h=o-a,p=c*c+l*l,m=u*u+f*f,g=d*d+h*h;return c*(f*g-m*h)-l*(u*g-m*d)+p*(u*h-f*d)<0}function nG(e,t,n,r,i,o){let s=n-e,a=r-t,c=i-e,l=o-t,u=s*s+a*a,f=c*c+l*l,d=.5/(s*l-a*c),h=(l*u-a*f)*d,p=(s*f-c*u)*d;return h*h+p*p}function rG(e,t,n,r,i,o){let s=n-e,a=r-t,c=i-e,l=o-t,u=s*s+a*a,f=c*c+l*l,d=.5/(s*l-a*c),h=e+(l*u-a*f)*d,p=t+(s*f-c*u)*d;return{x:h,y:p}}function qu(e,t,n,r){if(r-n<=20)for(let i=n+1;i<=r;i++){let o=e[i],s=t[o],a=i-1;for(;a>=n&&t[e[a]]>s;)e[a+1]=e[a--];e[a+1]=o}else{let i=n+r>>1,o=n+1,s=r;Mp(e,i,o),t[e[n]]>t[e[r]]&&Mp(e,n,r),t[e[o]]>t[e[r]]&&Mp(e,o,r),t[e[n]]>t[e[o]]&&Mp(e,n,o);let a=e[o],c=t[a];for(;;){do o++;while(t[e[o]]<c);do s--;while(t[e[s]]>c);if(s<o)break;Mp(e,o,s)}e[n+1]=e[s],e[s]=a,r-o+1>=s-n?(qu(e,t,o,r),qu(e,t,n,s-1)):(qu(e,t,n,s-1),qu(e,t,o,r))}}function Mp(e,t,n){let r=e[t];e[t]=e[n],e[n]=r}function iG(e){return e[0]}function oG(e){return e[1]}var si=class{constructor(){this._x0=this._y0=this._x1=this._y1=null,this._=""}moveTo(t,n){this._+=`M${this._x0=this._x1=+t},${this._y0=this._y1=+n}`}closePath(){this._x1!==null&&(this._x1=this._x0,this._y1=this._y0,this._+="Z")}lineTo(t,n){this._+=`L${this._x1=+t},${this._y1=+n}`}arc(t,n,r){t=+t,n=+n,r=+r;let i=t+r,o=n;if(r<0)throw new Error("negative radius");this._x1===null?this._+=`M${i},${o}`:(Math.abs(this._x1-i)>1e-6||Math.abs(this._y1-o)>1e-6)&&(this._+="L"+i+","+o),r&&(this._+=`A${r},${r},0,1,1,${t-r},${n}A${r},${r},0,1,1,${this._x1=i},${this._y1=o}`)}rect(t,n,r,i){this._+=`M${this._x0=this._x1=+t},${this._y0=this._y1=+n}h${+r}v${+i}h${-r}Z`}value(){return this._||null}};var Ra=class{constructor(){this._=[]}moveTo(t,n){this._.push([t,n])}closePath(){this._.push(this._[0].slice())}lineTo(t,n){this._.push([t,n])}value(){return this._.length?this._:null}};var Tp=class{constructor(t,[n,r,i,o]=[0,0,960,500]){if(!((i=+i)>=(n=+n))||!((o=+o)>=(r=+r)))throw new Error("invalid bounds");this.delaunay=t,this._circumcenters=new Float64Array(t.points.length*2),this.vectors=new Float64Array(t.points.length*2),this.xmax=i,this.xmin=n,this.ymax=o,this.ymin=r,this._init()}update(){return this.delaunay.update(),this._init(),this}_init(){let{delaunay:{points:t,hull:n,triangles:r},vectors:i}=this,o,s,a=this.circumcenters=this._circumcenters.subarray(0,r.length/3*2);for(let m=0,g=0,y=r.length,x,b;m<y;m+=3,g+=2){let w=r[m]*2,_=r[m+1]*2,v=r[m+2]*2,M=t[w],E=t[w+1],D=t[_],I=t[_+1],T=t[v],O=t[v+1],B=D-M,S=I-E,A=T-M,N=O-E,k=(B*N-S*A)*2;if(Math.abs(k)<1e-9){if(o===void 0){o=s=0;for(let F of n)o+=t[F*2],s+=t[F*2+1];o/=n.length,s/=n.length}let R=1e9*Math.sign((o-M)*N-(s-E)*A);x=(M+T)/2-R*N,b=(E+O)/2+R*A}else{let R=1/k,F=B*B+S*S,$=A*A+N*N;x=M+(N*F-S*$)*R,b=E+(B*$-A*F)*R}a[g]=x,a[g+1]=b}let c=n[n.length-1],l,u=c*4,f,d=t[2*c],h,p=t[2*c+1];i.fill(0);for(let m=0;m<n.length;++m)c=n[m],l=u,f=d,h=p,u=c*4,d=t[2*c],p=t[2*c+1],i[l+2]=i[u]=h-p,i[l+3]=i[u+1]=d-f}render(t){let n=t==null?t=new si:void 0,{delaunay:{halfedges:r,inedges:i,hull:o},circumcenters:s,vectors:a}=this;if(o.length<=1)return null;for(let u=0,f=r.length;u<f;++u){let d=r[u];if(d<u)continue;let h=Math.floor(u/3)*2,p=Math.floor(d/3)*2,m=s[h],g=s[h+1],y=s[p],x=s[p+1];this._renderSegment(m,g,y,x,t)}let c,l=o[o.length-1];for(let u=0;u<o.length;++u){c=l,l=o[u];let f=Math.floor(i[l]/3)*2,d=s[f],h=s[f+1],p=c*4,m=this._project(d,h,a[p+2],a[p+3]);m&&this._renderSegment(d,h,m[0],m[1],t)}return n&&n.value()}renderBounds(t){let n=t==null?t=new si:void 0;return t.rect(this.xmin,this.ymin,this.xmax-this.xmin,this.ymax-this.ymin),n&&n.value()}renderCell(t,n){let r=n==null?n=new si:void 0,i=this._clip(t);if(i===null||!i.length)return;n.moveTo(i[0],i[1]);let o=i.length;for(;i[0]===i[o-2]&&i[1]===i[o-1]&&o>1;)o-=2;for(let s=2;s<o;s+=2)(i[s]!==i[s-2]||i[s+1]!==i[s-1])&&n.lineTo(i[s],i[s+1]);return n.closePath(),r&&r.value()}*cellPolygons(){let{delaunay:{points:t}}=this;for(let n=0,r=t.length/2;n<r;++n){let i=this.cellPolygon(n);i&&(i.index=n,yield i)}}cellPolygon(t){let n=new Ra;return this.renderCell(t,n),n.value()}_renderSegment(t,n,r,i,o){let s,a=this._regioncode(t,n),c=this._regioncode(r,i);a===0&&c===0?(o.moveTo(t,n),o.lineTo(r,i)):(s=this._clipSegment(t,n,r,i,a,c))&&(o.moveTo(s[0],s[1]),o.lineTo(s[2],s[3]))}contains(t,n,r){return n=+n,n!==n||(r=+r,r!==r)?!1:this.delaunay._step(t,n,r)===t}*neighbors(t){let n=this._clip(t);if(n)for(let r of this.delaunay.neighbors(t)){let i=this._clip(r);if(i){t:for(let o=0,s=n.length;o<s;o+=2)for(let a=0,c=i.length;a<c;a+=2)if(n[o]===i[a]&&n[o+1]===i[a+1]&&n[(o+2)%s]===i[(a+c-2)%c]&&n[(o+3)%s]===i[(a+c-1)%c]){yield r;break t}}}}_cell(t){let{circumcenters:n,delaunay:{inedges:r,halfedges:i,triangles:o}}=this,s=r[t];if(s===-1)return null;let a=[],c=s;do{let l=Math.floor(c/3);if(a.push(n[l*2],n[l*2+1]),c=c%3===2?c-2:c+1,o[c]!==t)break;c=i[c]}while(c!==s&&c!==-1);return a}_clip(t){if(t===0&&this.delaunay.hull.length===1)return[this.xmax,this.ymin,this.xmax,this.ymax,this.xmin,this.ymax,this.xmin,this.ymin];let n=this._cell(t);if(n===null)return null;let{vectors:r}=this,i=t*4;return this._simplify(r[i]||r[i+1]?this._clipInfinite(t,n,r[i],r[i+1],r[i+2],r[i+3]):this._clipFinite(t,n))}_clipFinite(t,n){let r=n.length,i=null,o,s,a=n[r-2],c=n[r-1],l,u=this._regioncode(a,c),f,d=0;for(let h=0;h<r;h+=2)if(o=a,s=c,a=n[h],c=n[h+1],l=u,u=this._regioncode(a,c),l===0&&u===0)f=d,d=0,i?i.push(a,c):i=[a,c];else{let p,m,g,y,x;if(l===0){if((p=this._clipSegment(o,s,a,c,l,u))===null)continue;[m,g,y,x]=p}else{if((p=this._clipSegment(a,c,o,s,u,l))===null)continue;[y,x,m,g]=p,f=d,d=this._edgecode(m,g),f&&d&&this._edge(t,f,d,i,i.length),i?i.push(m,g):i=[m,g]}f=d,d=this._edgecode(y,x),f&&d&&this._edge(t,f,d,i,i.length),i?i.push(y,x):i=[y,x]}if(i)f=d,d=this._edgecode(i[0],i[1]),f&&d&&this._edge(t,f,d,i,i.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 i}_clipSegment(t,n,r,i,o,s){let a=o<s;for(a&&([t,n,r,i,o,s]=[r,i,t,n,s,o]);;){if(o===0&&s===0)return a?[r,i,t,n]:[t,n,r,i];if(o&s)return null;let c,l,u=o||s;u&8?(c=t+(r-t)*(this.ymax-n)/(i-n),l=this.ymax):u&4?(c=t+(r-t)*(this.ymin-n)/(i-n),l=this.ymin):u&2?(l=n+(i-n)*(this.xmax-t)/(r-t),c=this.xmax):(l=n+(i-n)*(this.xmin-t)/(r-t),c=this.xmin),o?(t=c,n=l,o=this._regioncode(t,n)):(r=c,i=l,s=this._regioncode(r,i))}}_clipInfinite(t,n,r,i,o,s){let a=Array.from(n),c;if((c=this._project(a[0],a[1],r,i))&&a.unshift(c[0],c[1]),(c=this._project(a[a.length-2],a[a.length-1],o,s))&&a.push(c[0],c[1]),a=this._clipFinite(t,a))for(let l=0,u=a.length,f,d=this._edgecode(a[u-2],a[u-1]);l<u;l+=2)f=d,d=this._edgecode(a[l],a[l+1]),f&&d&&(l=this._edge(t,f,d,a,l),u=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,n,r,i,o){for(;n!==r;){let s,a;switch(n){case 5:n=4;continue;case 4:n=6,s=this.xmax,a=this.ymin;break;case 6:n=2;continue;case 2:n=10,s=this.xmax,a=this.ymax;break;case 10:n=8;continue;case 8:n=9,s=this.xmin,a=this.ymax;break;case 9:n=1;continue;case 1:n=5,s=this.xmin,a=this.ymin;break}(i[o]!==s||i[o+1]!==a)&&this.contains(t,s,a)&&(i.splice(o,0,s,a),o+=2)}return o}_project(t,n,r,i){let o=1/0,s,a,c;if(i<0){if(n<=this.ymin)return null;(s=(this.ymin-n)/i)<o&&(c=this.ymin,a=t+(o=s)*r)}else if(i>0){if(n>=this.ymax)return null;(s=(this.ymax-n)/i)<o&&(c=this.ymax,a=t+(o=s)*r)}if(r>0){if(t>=this.xmax)return null;(s=(this.xmax-t)/r)<o&&(a=this.xmax,c=n+(o=s)*i)}else if(r<0){if(t<=this.xmin)return null;(s=(this.xmin-t)/r)<o&&(a=this.xmin,c=n+(o=s)*i)}return[a,c]}_edgecode(t,n){return(t===this.xmin?1:t===this.xmax?2:0)|(n===this.ymin?4:n===this.ymax?8:0)}_regioncode(t,n){return(t<this.xmin?1:t>this.xmax?2:0)|(n<this.ymin?4:n>this.ymax?8:0)}_simplify(t){if(t&&t.length>4){for(let n=0;n<t.length;n+=2){let r=(n+2)%t.length,i=(n+4)%t.length;(t[n]===t[r]&&t[r]===t[i]||t[n+1]===t[r+1]&&t[r+1]===t[i+1])&&(t.splice(r,2),n-=2)}t.length||(t=null)}return t}};var sG=2*Math.PI,Yu=Math.pow;function aG(e){return e[0]}function cG(e){return e[1]}function lG(e){let{triangles:t,coords:n}=e;for(let r=0;r<t.length;r+=3){let i=2*t[r],o=2*t[r+1],s=2*t[r+2];if((n[s]-n[i])*(n[o+1]-n[i+1])-(n[o]-n[i])*(n[s+1]-n[i+1])>1e-10)return!1}return!0}function uG(e,t,n){return[e+Math.sin(e+t)*n,t+Math.cos(e-t)*n]}var ai=class e{static from(t,n=aG,r=cG,i){return new e("length"in t?fG(t,n,r,i):Float64Array.from(dG(t,n,r,i)))}constructor(t){this._delaunator=new Vu(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(){let t=this._delaunator,n=this.points;if(t.hull&&t.hull.length>2&&lG(t)){this.collinear=Int32Array.from({length:n.length/2},(d,h)=>h).sort((d,h)=>n[2*d]-n[2*h]||n[2*d+1]-n[2*h+1]);let c=this.collinear[0],l=this.collinear[this.collinear.length-1],u=[n[2*c],n[2*c+1],n[2*l],n[2*l+1]],f=1e-8*Math.hypot(u[3]-u[1],u[2]-u[0]);for(let d=0,h=n.length/2;d<h;++d){let p=uG(n[2*d],n[2*d+1],f);n[2*d]=p[0],n[2*d+1]=p[1]}this._delaunator=new Vu(n)}else delete this.collinear;let r=this.halfedges=this._delaunator.halfedges,i=this.hull=this._delaunator.hull,o=this.triangles=this._delaunator.triangles,s=this.inedges.fill(-1),a=this._hullIndex.fill(-1);for(let c=0,l=r.length;c<l;++c){let u=o[c%3===2?c-2:c+1];(r[c]===-1||s[u]===-1)&&(s[u]=c)}for(let c=0,l=i.length;c<l;++c)a[i[c]]=c;i.length<=2&&i.length>0&&(this.triangles=new Int32Array(3).fill(-1),this.halfedges=new Int32Array(3).fill(-1),this.triangles[0]=i[0],s[i[0]]=1,i.length===2&&(s[i[1]]=0,this.triangles[1]=i[1],this.triangles[2]=i[1]))}voronoi(t){return new Tp(this,t)}*neighbors(t){let{inedges:n,hull:r,_hullIndex:i,halfedges:o,triangles:s,collinear:a}=this;if(a){let f=a.indexOf(t);f>0&&(yield a[f-1]),f<a.length-1&&(yield a[f+1]);return}let c=n[t];if(c===-1)return;let l=c,u=-1;do{if(yield u=s[l],l=l%3===2?l-2:l+1,s[l]!==t)return;if(l=o[l],l===-1){let f=r[(i[t]+1)%r.length];f!==u&&(yield f);return}}while(l!==c)}find(t,n,r=0){if(t=+t,t!==t||(n=+n,n!==n))return-1;let i=r,o;for(;(o=this._step(r,t,n))>=0&&o!==r&&o!==i;)r=o;return o}_step(t,n,r){let{inedges:i,hull:o,_hullIndex:s,halfedges:a,triangles:c,points:l}=this;if(i[t]===-1||!l.length)return(t+1)%(l.length>>1);let u=t,f=Yu(n-l[t*2],2)+Yu(r-l[t*2+1],2),d=i[t],h=d;do{let p=c[h],m=Yu(n-l[p*2],2)+Yu(r-l[p*2+1],2);if(m<f&&(f=m,u=p),h=h%3===2?h-2:h+1,c[h]!==t)break;if(h=a[h],h===-1){if(h=o[(s[t]+1)%o.length],h!==p&&Yu(n-l[h*2],2)+Yu(r-l[h*2+1],2)<f)return h;break}}while(h!==d);return u}render(t){let n=t==null?t=new si:void 0,{points:r,halfedges:i,triangles:o}=this;for(let s=0,a=i.length;s<a;++s){let c=i[s];if(c<s)continue;let l=o[s]*2,u=o[c]*2;t.moveTo(r[l],r[l+1]),t.lineTo(r[u],r[u+1])}return this.renderHull(t),n&&n.value()}renderPoints(t,n){n===void 0&&(!t||typeof t.moveTo!="function")&&(n=t,t=null),n=n==null?2:+n;let r=t==null?t=new si:void 0,{points:i}=this;for(let o=0,s=i.length;o<s;o+=2){let a=i[o],c=i[o+1];t.moveTo(a+n,c),t.arc(a,c,n,0,sG)}return r&&r.value()}renderHull(t){let n=t==null?t=new si:void 0,{hull:r,points:i}=this,o=r[0]*2,s=r.length;t.moveTo(i[o],i[o+1]);for(let a=1;a<s;++a){let c=2*r[a];t.lineTo(i[c],i[c+1])}return t.closePath(),n&&n.value()}hullPolygon(){let t=new Ra;return this.renderHull(t),t.value()}renderTriangle(t,n){let r=n==null?n=new si:void 0,{points:i,triangles:o}=this,s=o[t*=3]*2,a=o[t+1]*2,c=o[t+2]*2;return n.moveTo(i[s],i[s+1]),n.lineTo(i[a],i[a+1]),n.lineTo(i[c],i[c+1]),n.closePath(),r&&r.value()}*trianglePolygons(){let{triangles:t}=this;for(let n=0,r=t.length/3;n<r;++n)yield this.trianglePolygon(n)}trianglePolygon(t){let n=new Ra;return this.renderTriangle(t,n),n.value()}};function fG(e,t,n,r){let i=e.length,o=new Float64Array(i*2);for(let s=0;s<i;++s){let a=e[s];o[s*2]=t.call(r,a,s,e),o[s*2+1]=n.call(r,a,s,e)}return o}function*dG(e,t,n,r){let i=0;for(let o of e)yield t.call(r,o,i,e),yield n.call(r,o,i,e),++i}function HL(e){return Math.abs(e=Math.round(e))>=1e21?e.toLocaleString("en").replace(/,/g,""):e.toString(10)}function il(e,t){if((n=(e=t?e.toExponential(t-1):e.toExponential()).indexOf("e"))<0)return null;var n,r=e.slice(0,n);return[r.length>1?r[0]+r.slice(2):r,+e.slice(n+1)]}function bo(e){return e=il(Math.abs(e)),e?e[1]:NaN}function ZL(e,t){return function(n,r){for(var i=n.length,o=[],s=0,a=e[0],c=0;i>0&&a>0&&(c+a+1>r&&(a=Math.max(1,r-c)),o.push(n.substring(i-=a,i+a)),!((c+=a+1)>r));)a=e[s=(s+1)%e.length];return o.reverse().join(t)}}function JL(e){return function(t){return t.replace(/[0-9]/g,function(n){return e[+n]})}}var hG=/^(?:(.)?([<>=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i;function wo(e){if(!(t=hG.exec(e)))throw new Error("invalid format: "+e);var t;return new kx({fill:t[1],align:t[2],sign:t[3],symbol:t[4],zero:t[5],width:t[6],comma:t[7],precision:t[8]&&t[8].slice(1),trim:t[9],type:t[10]})}wo.prototype=kx.prototype;function kx(e){this.fill=e.fill===void 0?" ":e.fill+"",this.align=e.align===void 0?">":e.align+"",this.sign=e.sign===void 0?"-":e.sign+"",this.symbol=e.symbol===void 0?"":e.symbol+"",this.zero=!!e.zero,this.width=e.width===void 0?void 0:+e.width,this.comma=!!e.comma,this.precision=e.precision===void 0?void 0:+e.precision,this.trim=!!e.trim,this.type=e.type===void 0?"":e.type+""}kx.prototype.toString=function(){return this.fill+this.align+this.sign+this.symbol+(this.zero?"0":"")+(this.width===void 0?"":Math.max(1,this.width|0))+(this.comma?",":"")+(this.precision===void 0?"":"."+Math.max(0,this.precision|0))+(this.trim?"~":"")+this.type};function QL(e){t:for(var t=e.length,n=1,r=-1,i;n<t;++n)switch(e[n]){case".":r=i=n;break;case"0":r===0&&(r=n),i=n;break;default:if(!+e[n])break t;r>0&&(r=0);break}return r>0?e.slice(0,r)+e.slice(i+1):e}var vI;function KL(e,t){var n=il(e,t);if(!n)return e+"";var r=n[0],i=n[1],o=i-(vI=Math.max(-8,Math.min(8,Math.floor(i/3)))*3)+1,s=r.length;return o===s?r:o>s?r+new Array(o-s+1).join("0"):o>0?r.slice(0,o)+"."+r.slice(o):"0."+new Array(1-o).join("0")+il(e,Math.max(0,t+o-1))[0]}function _I(e,t){var n=il(e,t);if(!n)return e+"";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")}var SI={"%":(e,t)=>(e*100).toFixed(t),b:e=>Math.round(e).toString(2),c:e=>e+"",d:HL,e:(e,t)=>e.toExponential(t),f:(e,t)=>e.toFixed(t),g:(e,t)=>e.toPrecision(t),o:e=>Math.round(e).toString(8),p:(e,t)=>_I(e*100,t),r:_I,s:KL,X:e=>Math.round(e).toString(16).toUpperCase(),x:e=>Math.round(e).toString(16)};function II(e){return e}var tk=Array.prototype.map,ek=["y","z","a","f","p","n","\xB5","m","","k","M","G","T","P","E","Z","Y"];function nk(e){var t=e.grouping===void 0||e.thousands===void 0?II:ZL(tk.call(e.grouping,Number),e.thousands+""),n=e.currency===void 0?"":e.currency[0]+"",r=e.currency===void 0?"":e.currency[1]+"",i=e.decimal===void 0?".":e.decimal+"",o=e.numerals===void 0?II:JL(tk.call(e.numerals,String)),s=e.percent===void 0?"%":e.percent+"",a=e.minus===void 0?"\u2212":e.minus+"",c=e.nan===void 0?"NaN":e.nan+"";function l(f){f=wo(f);var d=f.fill,h=f.align,p=f.sign,m=f.symbol,g=f.zero,y=f.width,x=f.comma,b=f.precision,w=f.trim,_=f.type;_==="n"?(x=!0,_="g"):SI[_]||(b===void 0&&(b=12),w=!0,_="g"),(g||d==="0"&&h==="=")&&(g=!0,d="0",h="=");var v=m==="$"?n:m==="#"&&/[boxX]/.test(_)?"0"+_.toLowerCase():"",M=m==="$"?r:/[%p]/.test(_)?s:"",E=SI[_],D=/[defgprs%]/.test(_);b=b===void 0?6:/[gprs]/.test(_)?Math.max(1,Math.min(21,b)):Math.max(0,Math.min(20,b));function I(T){var O=v,B=M,S,A,N;if(_==="c")B=E(T)+B,T="";else{T=+T;var k=T<0||1/T<0;if(T=isNaN(T)?c:E(Math.abs(T),b),w&&(T=QL(T)),k&&+T==0&&p!=="+"&&(k=!1),O=(k?p==="("?p:a:p==="-"||p==="("?"":p)+O,B=(_==="s"?ek[8+vI/3]:"")+B+(k&&p==="("?")":""),D){for(S=-1,A=T.length;++S<A;)if(N=T.charCodeAt(S),48>N||N>57){B=(N===46?i+T.slice(S+1):T.slice(S))+B,T=T.slice(0,S);break}}}x&&!g&&(T=t(T,1/0));var R=O.length+T.length+B.length,F=R<y?new Array(y-R+1).join(d):"";switch(x&&g&&(T=t(F+T,F.length?y-B.length:1/0),F=""),h){case"<":T=O+T+B+F;break;case"=":T=O+F+T+B;break;case"^":T=F.slice(0,R=F.length>>1)+O+T+B+F.slice(R);break;default:T=F+O+T+B;break}return o(T)}return I.toString=function(){return f+""},I}function u(f,d){var h=l((f=wo(f),f.type="f",f)),p=Math.max(-8,Math.min(8,Math.floor(bo(d)/3)))*3,m=Math.pow(10,-p),g=ek[8+p/3];return function(y){return h(m*y)+g}}return{format:l,formatPrefix:u}}var Cx,ci,Fx;MI({thousands:",",grouping:[3],currency:["$",""]});function MI(e){return Cx=nk(e),ci=Cx.format,Fx=Cx.formatPrefix,Cx}function TI(e){return Math.max(0,-bo(Math.abs(e)))}function AI(e,t){return Math.max(0,Math.max(-8,Math.min(8,Math.floor(bo(t)/3)))*3-bo(Math.abs(e)))}function EI(e,t){return e=Math.abs(e),t=Math.abs(t)-e,Math.max(0,bo(t)-bo(e))+1}var K=1e-6,ol=1e-12,Et=Math.PI,de=Et/2,NI=Et/4,sn=Et*2,Fe=180/Et,qt=Et/180,Rt=Math.abs,li=Math.atan,Ge=Math.atan2,Q=Math.cos,Ap=Math.ceil,Rx=Math.exp;var $x=Math.hypot,sl=Math.log,Px=Math.pow,J=Math.sin,Fn=Math.sign||function(e){return e>0?1:e<0?-1:0},he=Math.sqrt,Xu=Math.tan;function Ux(e){return e>1?0:e<-1?Et:Math.acos(e)}function ve(e){return e>1?de:e<-1?-de:Math.asin(e)}function We(){}function zx(e,t){e&&ik.hasOwnProperty(e.type)&&ik[e.type](e,t)}var rk={Feature:function(e,t){zx(e.geometry,t)},FeatureCollection:function(e,t){for(var n=e.features,r=-1,i=n.length;++r<i;)zx(n[r].geometry,t)}},ik={Sphere:function(e,t){t.sphere()},Point:function(e,t){e=e.coordinates,t.point(e[0],e[1],e[2])},MultiPoint:function(e,t){for(var n=e.coordinates,r=-1,i=n.length;++r<i;)e=n[r],t.point(e[0],e[1],e[2])},LineString:function(e,t){DI(e.coordinates,t,0)},MultiLineString:function(e,t){for(var n=e.coordinates,r=-1,i=n.length;++r<i;)DI(n[r],t,0)},Polygon:function(e,t){ok(e.coordinates,t)},MultiPolygon:function(e,t){for(var n=e.coordinates,r=-1,i=n.length;++r<i;)ok(n[r],t)},GeometryCollection:function(e,t){for(var n=e.geometries,r=-1,i=n.length;++r<i;)zx(n[r],t)}};function DI(e,t,n){var r=-1,i=e.length-n,o;for(t.lineStart();++r<i;)o=e[r],t.point(o[0],o[1],o[2]);t.lineEnd()}function ok(e,t){var n=-1,r=e.length;for(t.polygonStart();++n<r;)DI(e[n],t,1);t.polygonEnd()}function Rr(e,t){e&&rk.hasOwnProperty(e.type)?rk[e.type](e,t):zx(e,t)}function Ep(e){return[Ge(e[1],e[0]),ve(e[2])]}function vo(e){var t=e[0],n=e[1],r=Q(n);return[r*Q(t),r*J(t),J(n)]}function Np(e,t){return e[0]*t[0]+e[1]*t[1]+e[2]*t[2]}function Gu(e,t){return[e[1]*t[2]-e[2]*t[1],e[2]*t[0]-e[0]*t[2],e[0]*t[1]-e[1]*t[0]]}function jx(e,t){e[0]+=t[0],e[1]+=t[1],e[2]+=t[2]}function Dp(e,t){return[e[0]*t,e[1]*t,e[2]*t]}function Op(e){var t=he(e[0]*e[0]+e[1]*e[1]+e[2]*e[2]);e[0]/=t,e[1]/=t,e[2]/=t}var Bp,qx,Vx,Yx,Xx,Gx,Wx,Hx,OI,BI,LI,ck,lk,Qn,Kn,tr,zi={sphere:We,point:kI,lineStart:sk,lineEnd:ak,polygonStart:function(){zi.lineStart=yG,zi.lineEnd=gG},polygonEnd:function(){zi.lineStart=sk,zi.lineEnd=ak}};function kI(e,t){e*=qt,t*=qt;var n=Q(t);Lp(n*Q(e),n*J(e),J(t))}function Lp(e,t,n){++Bp,Vx+=(e-Vx)/Bp,Yx+=(t-Yx)/Bp,Xx+=(n-Xx)/Bp}function sk(){zi.point=pG}function pG(e,t){e*=qt,t*=qt;var n=Q(t);Qn=n*Q(e),Kn=n*J(e),tr=J(t),zi.point=mG,Lp(Qn,Kn,tr)}function mG(e,t){e*=qt,t*=qt;var n=Q(t),r=n*Q(e),i=n*J(e),o=J(t),s=Ge(he((s=Kn*o-tr*i)*s+(s=tr*r-Qn*o)*s+(s=Qn*i-Kn*r)*s),Qn*r+Kn*i+tr*o);qx+=s,Gx+=s*(Qn+(Qn=r)),Wx+=s*(Kn+(Kn=i)),Hx+=s*(tr+(tr=o)),Lp(Qn,Kn,tr)}function ak(){zi.point=kI}function yG(){zi.point=xG}function gG(){uk(ck,lk),zi.point=kI}function xG(e,t){ck=e,lk=t,e*=qt,t*=qt,zi.point=uk;var n=Q(t);Qn=n*Q(e),Kn=n*J(e),tr=J(t),Lp(Qn,Kn,tr)}function uk(e,t){e*=qt,t*=qt;var n=Q(t),r=n*Q(e),i=n*J(e),o=J(t),s=Kn*o-tr*i,a=tr*r-Qn*o,c=Qn*i-Kn*r,l=$x(s,a,c),u=ve(l),f=l&&-u/l;OI.add(f*s),BI.add(f*a),LI.add(f*c),qx+=u,Gx+=u*(Qn+(Qn=r)),Wx+=u*(Kn+(Kn=i)),Hx+=u*(tr+(tr=o)),Lp(Qn,Kn,tr)}function CI(e){Bp=qx=Vx=Yx=Xx=Gx=Wx=Hx=0,OI=new vn,BI=new vn,LI=new vn,Rr(e,zi);var t=+OI,n=+BI,r=+LI,i=$x(t,n,r);return i<ol&&(t=Gx,n=Wx,r=Hx,qx<K&&(t=Vx,n=Yx,r=Xx),i=$x(t,n,r),i<ol)?[NaN,NaN]:[Ge(n,t)*Fe,ve(r/i)*Fe]}function kp(e,t){function n(r,i){return r=e(r,i),t(r[0],r[1])}return e.invert&&t.invert&&(n.invert=function(r,i){return r=t.invert(r,i),r&&e.invert(r[0],r[1])}),n}function FI(e,t){return Rt(e)>Et&&(e-=Math.round(e/sn)*sn),[e,t]}FI.invert=FI;function RI(e,t,n){return(e%=sn)?t||n?kp(dk(e),hk(t,n)):dk(e):t||n?hk(t,n):FI}function fk(e){return function(t,n){return t+=e,Rt(t)>Et&&(t-=Math.round(t/sn)*sn),[t,n]}}function dk(e){var t=fk(e);return t.invert=fk(-e),t}function hk(e,t){var n=Q(e),r=J(e),i=Q(t),o=J(t);function s(a,c){var l=Q(c),u=Q(a)*l,f=J(a)*l,d=J(c),h=d*n+u*r;return[Ge(f*i-h*o,u*n-d*r),ve(h*i+f*o)]}return s.invert=function(a,c){var l=Q(c),u=Q(a)*l,f=J(a)*l,d=J(c),h=d*i-f*o;return[Ge(f*i+d*o,u*n+h*r),ve(h*n-u*r)]},s}function pk(e){e=RI(e[0]*qt,e[1]*qt,e.length>2?e[2]*qt:0);function t(n){return n=e(n[0]*qt,n[1]*qt),n[0]*=Fe,n[1]*=Fe,n}return t.invert=function(n){return n=e.invert(n[0]*qt,n[1]*qt),n[0]*=Fe,n[1]*=Fe,n},t}function yk(e,t,n,r,i,o){if(n){var s=Q(t),a=J(t),c=r*n;i==null?(i=t+r*sn,o=t-c/2):(i=mk(s,i),o=mk(s,o),(r>0?i<o:i>o)&&(i+=r*sn));for(var l,u=i;r>0?u>o:u<o;u-=c)l=Ep([s,-a*Q(u),-a*J(u)]),e.point(l[0],l[1])}}function mk(e,t){t=vo(t),t[0]-=e,Op(t);var n=Ux(-t[1]);return((-t[2]<0?-n:n)+sn-K)%sn}function Zx(){var e=[],t;return{point:function(n,r,i){t.push([n,r,i])},lineStart:function(){e.push(t=[])},lineEnd:We,rejoin:function(){e.length>1&&e.push(e.pop().concat(e.shift()))},result:function(){var n=e;return e=[],t=null,n}}}function Wu(e,t){return Rt(e[0]-t[0])<K&&Rt(e[1]-t[1])<K}function Jx(e,t,n,r){this.x=e,this.z=t,this.o=n,this.e=r,this.v=!1,this.n=this.p=null}function Qx(e,t,n,r,i){var o=[],s=[],a,c;if(e.forEach(function(p){if(!((m=p.length-1)<=0)){var m,g=p[0],y=p[m],x;if(Wu(g,y)){if(!g[2]&&!y[2]){for(i.lineStart(),a=0;a<m;++a)i.point((g=p[a])[0],g[1]);i.lineEnd();return}y[0]+=2*K}o.push(x=new Jx(g,p,null,!0)),s.push(x.o=new Jx(g,null,x,!1)),o.push(x=new Jx(y,p,null,!1)),s.push(x.o=new Jx(y,null,x,!0))}}),!!o.length){for(s.sort(t),gk(o),gk(s),a=0,c=s.length;a<c;++a)s[a].e=n=!n;for(var l=o[0],u,f;;){for(var d=l,h=!0;d.v;)if((d=d.n)===l)return;u=d.z,i.lineStart();do{if(d.v=d.o.v=!0,d.e){if(h)for(a=0,c=u.length;a<c;++a)i.point((f=u[a])[0],f[1]);else r(d.x,d.n.x,1,i);d=d.n}else{if(h)for(u=d.p.z,a=u.length-1;a>=0;--a)i.point((f=u[a])[0],f[1]);else r(d.x,d.p.x,-1,i);d=d.p}d=d.o,u=d.z,h=!h}while(!d.v);i.lineEnd()}}}function gk(e){if(t=e.length){for(var t,n=0,r=e[0],i;++n<t;)r.n=i=e[n],i.p=r,r=i;r.n=i=e[0],i.p=r}}function $I(e){return Rt(e[0])<=Et?e[0]:Fn(e[0])*((Rt(e[0])+Et)%sn-Et)}function xk(e,t){var n=$I(t),r=t[1],i=J(r),o=[J(n),-Q(n),0],s=0,a=0,c=new vn;i===1?r=de+K:i===-1&&(r=-de-K);for(var l=0,u=e.length;l<u;++l)if(d=(f=e[l]).length)for(var f,d,h=f[d-1],p=$I(h),m=h[1]/2+NI,g=J(m),y=Q(m),x=0;x<d;++x,p=w,g=v,y=M,h=b){var b=f[x],w=$I(b),_=b[1]/2+NI,v=J(_),M=Q(_),E=w-p,D=E>=0?1:-1,I=D*E,T=I>Et,O=g*v;if(c.add(Ge(O*D*J(I),y*M+O*Q(I))),s+=T?E+D*sn:E,T^p>=n^w>=n){var B=Gu(vo(h),vo(b));Op(B);var S=Gu(o,B);Op(S);var A=(T^E>=0?-1:1)*ve(S[2]);(r>A||r===A&&(B[0]||B[1]))&&(a+=T^E>=0?1:-1)}}return(s<-K||s<K&&c<-ol)^a&1}function Kx(e,t,n,r){return function(i){var o=t(i),s=Zx(),a=t(s),c=!1,l,u,f,d={point:h,lineStart:m,lineEnd:g,polygonStart:function(){d.point=y,d.lineStart=x,d.lineEnd=b,u=[],l=[]},polygonEnd:function(){d.point=h,d.lineStart=m,d.lineEnd=g,u=Nu(u);var w=xk(l,r);u.length?(c||(i.polygonStart(),c=!0),Qx(u,wG,w,n,i)):w&&(c||(i.polygonStart(),c=!0),i.lineStart(),n(null,null,1,i),i.lineEnd()),c&&(i.polygonEnd(),c=!1),u=l=null},sphere:function(){i.polygonStart(),i.lineStart(),n(null,null,1,i),i.lineEnd(),i.polygonEnd()}};function h(w,_){e(w,_)&&i.point(w,_)}function p(w,_){o.point(w,_)}function m(){d.point=p,o.lineStart()}function g(){d.point=h,o.lineEnd()}function y(w,_){f.push([w,_]),a.point(w,_)}function x(){a.lineStart(),f=[]}function b(){y(f[0][0],f[0][1]),a.lineEnd();var w=a.clean(),_=s.result(),v,M=_.length,E,D,I;if(f.pop(),l.push(f),f=null,!!M){if(w&1){if(D=_[0],(E=D.length-1)>0){for(c||(i.polygonStart(),c=!0),i.lineStart(),v=0;v<E;++v)i.point((I=D[v])[0],I[1]);i.lineEnd()}return}M>1&&w&2&&_.push(_.pop().concat(_.shift())),u.push(_.filter(bG))}}return d}}function bG(e){return e.length>1}function wG(e,t){return((e=e.x)[0]<0?e[1]-de-K:de-e[1])-((t=t.x)[0]<0?t[1]-de-K:de-t[1])}var PI=Kx(function(){return!0},vG,SG,[-Et,-de]);function vG(e){var t=NaN,n=NaN,r=NaN,i;return{lineStart:function(){e.lineStart(),i=1},point:function(o,s){var a=o>0?Et:-Et,c=Rt(o-t);Rt(c-Et)<K?(e.point(t,n=(n+s)/2>0?de:-de),e.point(r,n),e.lineEnd(),e.lineStart(),e.point(a,n),e.point(o,n),i=0):r!==a&&c>=Et&&(Rt(t-r)<K&&(t-=r*K),Rt(o-a)<K&&(o-=a*K),n=_G(t,n,o,s),e.point(r,n),e.lineEnd(),e.lineStart(),e.point(a,n),i=0),e.point(t=o,n=s),r=a},lineEnd:function(){e.lineEnd(),t=n=NaN},clean:function(){return 2-i}}}function _G(e,t,n,r){var i,o,s=J(e-n);return Rt(s)>K?li((J(t)*(o=Q(r))*J(n)-J(r)*(i=Q(t))*J(e))/(i*o*s)):(t+r)/2}function SG(e,t,n,r){var i;if(e==null)i=n*de,r.point(-Et,i),r.point(0,i),r.point(Et,i),r.point(Et,0),r.point(Et,-i),r.point(0,-i),r.point(-Et,-i),r.point(-Et,0),r.point(-Et,i);else if(Rt(e[0]-t[0])>K){var o=e[0]<t[0]?Et:-Et;i=n*o/2,r.point(-o,i),r.point(0,i),r.point(o,i)}else r.point(t[0],t[1])}function bk(e){var t=Q(e),n=6*qt,r=t>0,i=Rt(t)>K;function o(u,f,d,h){yk(h,e,n,d,u,f)}function s(u,f){return Q(u)*Q(f)>t}function a(u){var f,d,h,p,m;return{lineStart:function(){p=h=!1,m=1},point:function(g,y){var x=[g,y],b,w=s(g,y),_=r?w?0:l(g,y):w?l(g+(g<0?Et:-Et),y):0;if(!f&&(p=h=w)&&u.lineStart(),w!==h&&(b=c(f,x),(!b||Wu(f,b)||Wu(x,b))&&(x[2]=1)),w!==h)m=0,w?(u.lineStart(),b=c(x,f),u.point(b[0],b[1])):(b=c(f,x),u.point(b[0],b[1],2),u.lineEnd()),f=b;else if(i&&f&&r^w){var v;!(_&d)&&(v=c(x,f,!0))&&(m=0,r?(u.lineStart(),u.point(v[0][0],v[0][1]),u.point(v[1][0],v[1][1]),u.lineEnd()):(u.point(v[1][0],v[1][1]),u.lineEnd(),u.lineStart(),u.point(v[0][0],v[0][1],3)))}w&&(!f||!Wu(f,x))&&u.point(x[0],x[1]),f=x,h=w,d=_},lineEnd:function(){h&&u.lineEnd(),f=null},clean:function(){return m|(p&&h)<<1}}}function c(u,f,d){var h=vo(u),p=vo(f),m=[1,0,0],g=Gu(h,p),y=Np(g,g),x=g[0],b=y-x*x;if(!b)return!d&&u;var w=t*y/b,_=-t*x/b,v=Gu(m,g),M=Dp(m,w),E=Dp(g,_);jx(M,E);var D=v,I=Np(M,D),T=Np(D,D),O=I*I-T*(Np(M,M)-1);if(!(O<0)){var B=he(O),S=Dp(D,(-I-B)/T);if(jx(S,M),S=Ep(S),!d)return S;var A=u[0],N=f[0],k=u[1],R=f[1],F;N<A&&(F=A,A=N,N=F);var $=N-A,P=Rt($-Et)<K,U=P||$<K;if(!P&&R<k&&(F=k,k=R,R=F),U?P?k+R>0^S[1]<(Rt(S[0]-A)<K?k:R):k<=S[1]&&S[1]<=R:$>Et^(A<=S[0]&&S[0]<=N)){var W=Dp(D,(-I+B)/T);return jx(W,M),[S,Ep(W)]}}}function l(u,f){var d=r?e:Et-e,h=0;return u<-d?h|=1:u>d&&(h|=2),f<-d?h|=4:f>d&&(h|=8),h}return Kx(s,a,o,r?[0,-e]:[-Et,e-Et])}function wk(e,t,n,r,i,o){var s=e[0],a=e[1],c=t[0],l=t[1],u=0,f=1,d=c-s,h=l-a,p;if(p=n-s,!(!d&&p>0)){if(p/=d,d<0){if(p<u)return;p<f&&(f=p)}else if(d>0){if(p>f)return;p>u&&(u=p)}if(p=i-s,!(!d&&p<0)){if(p/=d,d<0){if(p>f)return;p>u&&(u=p)}else if(d>0){if(p<u)return;p<f&&(f=p)}if(p=r-a,!(!h&&p>0)){if(p/=h,h<0){if(p<u)return;p<f&&(f=p)}else if(h>0){if(p>f)return;p>u&&(u=p)}if(p=o-a,!(!h&&p<0)){if(p/=h,h<0){if(p>f)return;p>u&&(u=p)}else if(h>0){if(p<u)return;p<f&&(f=p)}return u>0&&(e[0]=s+u*d,e[1]=a+u*h),f<1&&(t[0]=s+f*d,t[1]=a+f*h),!0}}}}}var Cp=1e9,tb=-Cp;function Hu(e,t,n,r){function i(l,u){return e<=l&&l<=n&&t<=u&&u<=r}function o(l,u,f,d){var h=0,p=0;if(l==null||(h=s(l,f))!==(p=s(u,f))||c(l,u)<0^f>0)do d.point(h===0||h===3?e:n,h>1?r:t);while((h=(h+f+4)%4)!==p);else d.point(u[0],u[1])}function s(l,u){return Rt(l[0]-e)<K?u>0?0:3:Rt(l[0]-n)<K?u>0?2:1:Rt(l[1]-t)<K?u>0?1:0:u>0?3:2}function a(l,u){return c(l.x,u.x)}function c(l,u){var f=s(l,1),d=s(u,1);return f!==d?f-d:f===0?u[1]-l[1]:f===1?l[0]-u[0]:f===2?l[1]-u[1]:u[0]-l[0]}return function(l){var u=l,f=Zx(),d,h,p,m,g,y,x,b,w,_,v,M={point:E,lineStart:O,lineEnd:B,polygonStart:I,polygonEnd:T};function E(A,N){i(A,N)&&u.point(A,N)}function D(){for(var A=0,N=0,k=h.length;N<k;++N)for(var R=h[N],F=1,$=R.length,P=R[0],U,W,tt=P[0],nt=P[1];F<$;++F)U=tt,W=nt,P=R[F],tt=P[0],nt=P[1],W<=r?nt>r&&(tt-U)*(r-W)>(nt-W)*(e-U)&&++A:nt<=r&&(tt-U)*(r-W)<(nt-W)*(e-U)&&--A;return A}function I(){u=f,d=[],h=[],v=!0}function T(){var A=D(),N=v&&A,k=(d=Nu(d)).length;(N||k)&&(l.polygonStart(),N&&(l.lineStart(),o(null,null,1,l),l.lineEnd()),k&&Qx(d,a,A,o,l),l.polygonEnd()),u=l,d=h=p=null}function O(){M.point=S,h&&h.push(p=[]),_=!0,w=!1,x=b=NaN}function B(){d&&(S(m,g),y&&w&&f.rejoin(),d.push(f.result())),M.point=E,w&&u.lineEnd()}function S(A,N){var k=i(A,N);if(h&&p.push([A,N]),_)m=A,g=N,y=k,_=!1,k&&(u.lineStart(),u.point(A,N));else if(k&&w)u.point(A,N);else{var R=[x=Math.max(tb,Math.min(Cp,x)),b=Math.max(tb,Math.min(Cp,b))],F=[A=Math.max(tb,Math.min(Cp,A)),N=Math.max(tb,Math.min(Cp,N))];wk(R,F,e,t,n,r)?(w||(u.lineStart(),u.point(R[0],R[1])),u.point(F[0],F[1]),k||u.lineEnd(),v=!1):k&&(u.lineStart(),u.point(A,N),v=!1)}x=A,b=N,w=k}return M}}function vk(e,t,n){var r=Pe(e,t-K,n).concat(t);return function(i){return r.map(function(o){return[i,o]})}}function _k(e,t,n){var r=Pe(e,t-K,n).concat(t);return function(i){return r.map(function(o){return[o,i]})}}function UI(){var e,t,n,r,i,o,s,a,c=10,l=c,u=90,f=360,d,h,p,m,g=2.5;function y(){return{type:"MultiLineString",coordinates:x()}}function x(){return Pe(Ap(r/u)*u,n,u).map(p).concat(Pe(Ap(a/f)*f,s,f).map(m)).concat(Pe(Ap(t/c)*c,e,c).filter(function(b){return Rt(b%u)>K}).map(d)).concat(Pe(Ap(o/l)*l,i,l).filter(function(b){return Rt(b%f)>K}).map(h))}return y.lines=function(){return x().map(function(b){return{type:"LineString",coordinates:b}})},y.outline=function(){return{type:"Polygon",coordinates:[p(r).concat(m(s).slice(1),p(n).reverse().slice(1),m(a).reverse().slice(1))]}},y.extent=function(b){return arguments.length?y.extentMajor(b).extentMinor(b):y.extentMinor()},y.extentMajor=function(b){return arguments.length?(r=+b[0][0],n=+b[1][0],a=+b[0][1],s=+b[1][1],r>n&&(b=r,r=n,n=b),a>s&&(b=a,a=s,s=b),y.precision(g)):[[r,a],[n,s]]},y.extentMinor=function(b){return arguments.length?(t=+b[0][0],e=+b[1][0],o=+b[0][1],i=+b[1][1],t>e&&(b=t,t=e,e=b),o>i&&(b=o,o=i,i=b),y.precision(g)):[[t,o],[e,i]]},y.step=function(b){return arguments.length?y.stepMajor(b).stepMinor(b):y.stepMinor()},y.stepMajor=function(b){return arguments.length?(u=+b[0],f=+b[1],y):[u,f]},y.stepMinor=function(b){return arguments.length?(c=+b[0],l=+b[1],y):[c,l]},y.precision=function(b){return arguments.length?(g=+b,d=vk(o,i,90),h=_k(t,e,g),p=vk(a,s,90),m=_k(r,n,g),y):g},y.extentMajor([[-180,-90+K],[180,90-K]]).extentMinor([[-180,-80-K],[180,80+K]])}function zI(){return UI()()}var Fp=e=>e;var jI=new vn,qI=new vn,Sk,Ik,VI,YI,$a={point:We,lineStart:We,lineEnd:We,polygonStart:function(){$a.lineStart=IG,$a.lineEnd=TG},polygonEnd:function(){$a.lineStart=$a.lineEnd=$a.point=We,jI.add(Rt(qI)),qI=new vn},result:function(){var e=jI/2;return jI=new vn,e}};function IG(){$a.point=MG}function MG(e,t){$a.point=Mk,Sk=VI=e,Ik=YI=t}function Mk(e,t){qI.add(YI*e-VI*t),VI=e,YI=t}function TG(){Mk(Sk,Ik)}var XI=$a;var Zu=1/0,eb=Zu,Rp=-Zu,nb=Rp,AG={point:EG,lineStart:We,lineEnd:We,polygonStart:We,polygonEnd:We,result:function(){var e=[[Zu,eb],[Rp,nb]];return Rp=nb=-(eb=Zu=1/0),e}};function EG(e,t){e<Zu&&(Zu=e),e>Rp&&(Rp=e),t<eb&&(eb=t),t>nb&&(nb=t)}var Ju=AG;var GI=0,WI=0,$p=0,rb=0,ib=0,Qu=0,HI=0,ZI=0,Pp=0,Ek,Nk,_o,So,ji={point:al,lineStart:Tk,lineEnd:Ak,polygonStart:function(){ji.lineStart=OG,ji.lineEnd=BG},polygonEnd:function(){ji.point=al,ji.lineStart=Tk,ji.lineEnd=Ak},result:function(){var e=Pp?[HI/Pp,ZI/Pp]:Qu?[rb/Qu,ib/Qu]:$p?[GI/$p,WI/$p]:[NaN,NaN];return GI=WI=$p=rb=ib=Qu=HI=ZI=Pp=0,e}};function al(e,t){GI+=e,WI+=t,++$p}function Tk(){ji.point=NG}function NG(e,t){ji.point=DG,al(_o=e,So=t)}function DG(e,t){var n=e-_o,r=t-So,i=he(n*n+r*r);rb+=i*(_o+e)/2,ib+=i*(So+t)/2,Qu+=i,al(_o=e,So=t)}function Ak(){ji.point=al}function OG(){ji.point=LG}function BG(){Dk(Ek,Nk)}function LG(e,t){ji.point=Dk,al(Ek=_o=e,Nk=So=t)}function Dk(e,t){var n=e-_o,r=t-So,i=he(n*n+r*r);rb+=i*(_o+e)/2,ib+=i*(So+t)/2,Qu+=i,i=So*e-_o*t,HI+=i*(_o+e),ZI+=i*(So+t),Pp+=i*3,al(_o=e,So=t)}var JI=ji;function ob(e){this._context=e}ob.prototype={_radius:4.5,pointRadius:function(e){return this._radius=e,this},polygonStart:function(){this._line=0},polygonEnd:function(){this._line=NaN},lineStart:function(){this._point=0},lineEnd:function(){this._line===0&&this._context.closePath(),this._point=NaN},point:function(e,t){switch(this._point){case 0:{this._context.moveTo(e,t),this._point=1;break}case 1:{this._context.lineTo(e,t);break}default:{this._context.moveTo(e+this._radius,t),this._context.arc(e,t,this._radius,0,sn);break}}},result:We};var KI=new vn,QI,Ok,Bk,Up,zp,sb={point:We,lineStart:function(){sb.point=kG},lineEnd:function(){QI&&Lk(Ok,Bk),sb.point=We},polygonStart:function(){QI=!0},polygonEnd:function(){QI=null},result:function(){var e=+KI;return KI=new vn,e}};function kG(e,t){sb.point=Lk,Ok=Up=e,Bk=zp=t}function Lk(e,t){Up-=e,zp-=t,KI.add(he(Up*Up+zp*zp)),Up=e,zp=t}var tM=sb;var kk,ab,Ck,Fk,Ku=class{constructor(t){this._append=t==null?Rk:CG(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(){this._line===0&&(this._+="Z"),this._point=NaN}point(t,n){switch(this._point){case 0:{this._append`M${t},${n}`,this._point=1;break}case 1:{this._append`L${t},${n}`;break}default:{if(this._append`M${t},${n}`,this._radius!==Ck||this._append!==ab){let r=this._radius,i=this._;this._="",this._append`m0,${r}a${r},${r} 0 1,1 0,${-2*r}a${r},${r} 0 1,1 0,${2*r}z`,Ck=r,ab=this._append,Fk=this._,this._=i}this._+=Fk;break}}}result(){let t=this._;return this._="",t.length?t:null}};function Rk(e){let t=1;this._+=e[0];for(let n=e.length;t<n;++t)this._+=arguments[t]+e[t]}function CG(e){let t=Math.floor(e);if(!(t>=0))throw new RangeError(`invalid digits: ${e}`);if(t>15)return Rk;if(t!==kk){let n=10**t;kk=t,ab=function(i){let o=1;this._+=i[0];for(let s=i.length;o<s;++o)this._+=Math.round(arguments[o]*n)/n+i[o]}}return ab}function Mn(e,t){let n=3,r=4.5,i,o;function s(a){return a&&(typeof r=="function"&&o.pointRadius(+r.apply(this,arguments)),Rr(a,i(o))),o.result()}return s.area=function(a){return Rr(a,i(XI)),XI.result()},s.measure=function(a){return Rr(a,i(tM)),tM.result()},s.bounds=function(a){return Rr(a,i(Ju)),Ju.result()},s.centroid=function(a){return Rr(a,i(JI)),JI.result()},s.projection=function(a){return arguments.length?(i=a==null?(e=null,Fp):(e=a).stream,s):e},s.context=function(a){return arguments.length?(o=a==null?(t=null,new Ku(n)):new ob(t=a),typeof r!="function"&&o.pointRadius(r),s):t},s.pointRadius=function(a){return arguments.length?(r=typeof a=="function"?a:(o.pointRadius(+a),+a),s):r},s.digits=function(a){if(!arguments.length)return n;if(a==null)n=null;else{let c=Math.floor(a);if(!(c>=0))throw new RangeError(`invalid digits: ${a}`);n=c}return t===null&&(o=new Ku(n)),s},s.projection(e).digits(n).context(t)}function cl(e){return{stream:tf(e)}}function tf(e){return function(t){var n=new eM;for(var r in e)n[r]=e[r];return n.stream=t,n}}function eM(){}eM.prototype={constructor:eM,point:function(e,t){this.stream.point(e,t)},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()}};function nM(e,t,n){var r=e.clipExtent&&e.clipExtent();return e.scale(150).translate([0,0]),r!=null&&e.clipExtent(null),Rr(n,e.stream(Ju)),t(Ju.result()),r!=null&&e.clipExtent(r),e}function jp(e,t,n){return nM(e,function(r){var i=t[1][0]-t[0][0],o=t[1][1]-t[0][1],s=Math.min(i/(r[1][0]-r[0][0]),o/(r[1][1]-r[0][1])),a=+t[0][0]+(i-s*(r[1][0]+r[0][0]))/2,c=+t[0][1]+(o-s*(r[1][1]+r[0][1]))/2;e.scale(150*s).translate([a,c])},n)}function cb(e,t,n){return jp(e,[[0,0],t],n)}function lb(e,t,n){return nM(e,function(r){var i=+t,o=i/(r[1][0]-r[0][0]),s=(i-o*(r[1][0]+r[0][0]))/2,a=-o*r[0][1];e.scale(150*o).translate([s,a])},n)}function ub(e,t,n){return nM(e,function(r){var i=+t,o=i/(r[1][1]-r[0][1]),s=-o*r[0][0],a=(i-o*(r[1][1]+r[0][1]))/2;e.scale(150*o).translate([s,a])},n)}var $k=16,FG=Q(30*qt);function rM(e,t){return+t?$G(e,t):RG(e)}function RG(e){return tf({point:function(t,n){t=e(t,n),this.stream.point(t[0],t[1])}})}function $G(e,t){function n(r,i,o,s,a,c,l,u,f,d,h,p,m,g){var y=l-r,x=u-i,b=y*y+x*x;if(b>4*t&&m--){var w=s+d,_=a+h,v=c+p,M=he(w*w+_*_+v*v),E=ve(v/=M),D=Rt(Rt(v)-1)<K||Rt(o-f)<K?(o+f)/2:Ge(_,w),I=e(D,E),T=I[0],O=I[1],B=T-r,S=O-i,A=x*B-y*S;(A*A/b>t||Rt((y*B+x*S)/b-.5)>.3||s*d+a*h+c*p<FG)&&(n(r,i,o,s,a,c,T,O,D,w/=M,_/=M,v,m,g),g.point(T,O),n(T,O,D,w,_,v,l,u,f,d,h,p,m,g))}}return function(r){var i,o,s,a,c,l,u,f,d,h,p,m,g={point:y,lineStart:x,lineEnd:w,polygonStart:function(){r.polygonStart(),g.lineStart=_},polygonEnd:function(){r.polygonEnd(),g.lineStart=x}};function y(E,D){E=e(E,D),r.point(E[0],E[1])}function x(){f=NaN,g.point=b,r.lineStart()}function b(E,D){var I=vo([E,D]),T=e(E,D);n(f,d,u,h,p,m,f=T[0],d=T[1],u=E,h=I[0],p=I[1],m=I[2],$k,r),r.point(f,d)}function w(){g.point=y,r.lineEnd()}function _(){x(),g.point=v,g.lineEnd=M}function v(E,D){b(i=E,D),o=f,s=d,a=h,c=p,l=m,g.point=b}function M(){n(f,d,u,h,p,m,o,s,i,a,c,l,$k,r),g.lineEnd=w,w()}return g}}var PG=tf({point:function(e,t){this.stream.point(e*qt,t*qt)}});function UG(e){return tf({point:function(t,n){var r=e(t,n);return this.stream.point(r[0],r[1])}})}function zG(e,t,n,r,i){function o(s,a){return s*=r,a*=i,[t+e*s,n-e*a]}return o.invert=function(s,a){return[(s-t)/e*r,(n-a)/e*i]},o}function Pk(e,t,n,r,i,o){if(!o)return zG(e,t,n,r,i);var s=Q(o),a=J(o),c=s*e,l=a*e,u=s/e,f=a/e,d=(a*n-s*t)/e,h=(a*t+s*n)/e;function p(m,g){return m*=r,g*=i,[c*m-l*g+t,n-l*m-c*g]}return p.invert=function(m,g){return[r*(u*m-f*g+d),i*(h-f*m-u*g)]},p}function Tn(e){return iM(function(){return e})()}function iM(e){var t,n=150,r=480,i=250,o=0,s=0,a=0,c=0,l=0,u,f=0,d=1,h=1,p=null,m=PI,g=null,y,x,b,w=Fp,_=.5,v,M,E,D,I;function T(A){return E(A[0]*qt,A[1]*qt)}function O(A){return A=E.invert(A[0],A[1]),A&&[A[0]*Fe,A[1]*Fe]}T.stream=function(A){return D&&I===A?D:D=PG(UG(u)(m(v(w(I=A)))))},T.preclip=function(A){return arguments.length?(m=A,p=void 0,S()):m},T.postclip=function(A){return arguments.length?(w=A,g=y=x=b=null,S()):w},T.clipAngle=function(A){return arguments.length?(m=+A?bk(p=A*qt):(p=null,PI),S()):p*Fe},T.clipExtent=function(A){return arguments.length?(w=A==null?(g=y=x=b=null,Fp):Hu(g=+A[0][0],y=+A[0][1],x=+A[1][0],b=+A[1][1]),S()):g==null?null:[[g,y],[x,b]]},T.scale=function(A){return arguments.length?(n=+A,B()):n},T.translate=function(A){return arguments.length?(r=+A[0],i=+A[1],B()):[r,i]},T.center=function(A){return arguments.length?(o=A[0]%360*qt,s=A[1]%360*qt,B()):[o*Fe,s*Fe]},T.rotate=function(A){return arguments.length?(a=A[0]%360*qt,c=A[1]%360*qt,l=A.length>2?A[2]%360*qt:0,B()):[a*Fe,c*Fe,l*Fe]},T.angle=function(A){return arguments.length?(f=A%360*qt,B()):f*Fe},T.reflectX=function(A){return arguments.length?(d=A?-1:1,B()):d<0},T.reflectY=function(A){return arguments.length?(h=A?-1:1,B()):h<0},T.precision=function(A){return arguments.length?(v=rM(M,_=A*A),S()):he(_)},T.fitExtent=function(A,N){return jp(T,A,N)},T.fitSize=function(A,N){return cb(T,A,N)},T.fitWidth=function(A,N){return lb(T,A,N)},T.fitHeight=function(A,N){return ub(T,A,N)};function B(){var A=Pk(n,0,0,d,h,f).apply(null,t(o,s)),N=Pk(n,r-A[0],i-A[1],d,h,f);return u=RI(a,c,l),M=kp(t,N),E=kp(u,M),v=rM(M,_),S()}function S(){return D=I=null,T}return function(){return t=e.apply(this,arguments),T.invert=t.invert&&O,B()}}function ef(e){var t=0,n=Et/3,r=iM(e),i=r(t,n);return i.parallels=function(o){return arguments.length?r(t=o[0]*qt,n=o[1]*qt):[t*Fe,n*Fe]},i}function Uk(e){var t=Q(e);function n(r,i){return[r*t,J(i)/t]}return n.invert=function(r,i){return[r/t,ve(i*t)]},n}function zk(e,t){var n=J(e),r=(n+J(t))/2;if(Rt(r)<K)return Uk(e);var i=1+n*(2*r-n),o=he(i)/r;function s(a,c){var l=he(i-2*r*J(c))/r;return[l*J(a*=r),o-l*Q(a)]}return s.invert=function(a,c){var l=o-c,u=Ge(a,Rt(l))*Fn(l);return l*r<0&&(u-=Et*Fn(a)*Fn(l)),[u/r,ve((i-(a*a+l*l)*r*r)/(2*r))]},s}function Pa(){return ef(zk).scale(155.424).center([0,33.6442])}function qp(){return Pa().parallels([29.5,45.5]).scale(1070).translate([480,250]).rotate([96,0]).center([-.6,38.7])}function jG(e){var t=e.length;return{point:function(n,r){for(var i=-1;++i<t;)e[i].point(n,r)},sphere:function(){for(var n=-1;++n<t;)e[n].sphere()},lineStart:function(){for(var n=-1;++n<t;)e[n].lineStart()},lineEnd:function(){for(var n=-1;++n<t;)e[n].lineEnd()},polygonStart:function(){for(var n=-1;++n<t;)e[n].polygonStart()},polygonEnd:function(){for(var n=-1;++n<t;)e[n].polygonEnd()}}}function oM(){var e,t,n=qp(),r,i=Pa().rotate([154,0]).center([-2,58.5]).parallels([55,65]),o,s=Pa().rotate([157,0]).center([-3,19.9]).parallels([8,18]),a,c,l={point:function(d,h){c=[d,h]}};function u(d){var h=d[0],p=d[1];return c=null,r.point(h,p),c||(o.point(h,p),c)||(a.point(h,p),c)}u.invert=function(d){var h=n.scale(),p=n.translate(),m=(d[0]-p[0])/h,g=(d[1]-p[1])/h;return(g>=.12&&g<.234&&m>=-.425&&m<-.214?i:g>=.166&&g<.234&&m>=-.214&&m<-.115?s:n).invert(d)},u.stream=function(d){return e&&t===d?e:e=jG([n.stream(t=d),i.stream(d),s.stream(d)])},u.precision=function(d){return arguments.length?(n.precision(d),i.precision(d),s.precision(d),f()):n.precision()},u.scale=function(d){return arguments.length?(n.scale(d),i.scale(d*.35),s.scale(d),u.translate(n.translate())):n.scale()},u.translate=function(d){if(!arguments.length)return n.translate();var h=n.scale(),p=+d[0],m=+d[1];return r=n.translate(d).clipExtent([[p-.455*h,m-.238*h],[p+.455*h,m+.238*h]]).stream(l),o=i.translate([p-.307*h,m+.201*h]).clipExtent([[p-.425*h+K,m+.12*h+K],[p-.214*h-K,m+.234*h-K]]).stream(l),a=s.translate([p-.205*h,m+.212*h]).clipExtent([[p-.214*h+K,m+.166*h+K],[p-.115*h-K,m+.234*h-K]]).stream(l),f()},u.fitExtent=function(d,h){return jp(u,d,h)},u.fitSize=function(d,h){return cb(u,d,h)},u.fitWidth=function(d,h){return lb(u,d,h)},u.fitHeight=function(d,h){return ub(u,d,h)};function f(){return e=t=null,u}return u.scale(1070)}function fb(e){return function(t,n){var r=Q(t),i=Q(n),o=e(r*i);return o===1/0?[2,0]:[o*i*J(t),o*J(n)]}}function Io(e){return function(t,n){var r=he(t*t+n*n),i=e(r),o=J(i),s=Q(i);return[Ge(t*o,r*s),ve(r&&n*o/r)]}}var sM=fb(function(e){return he(2/(1+e))});sM.invert=Io(function(e){return 2*ve(e/2)});function aM(){return Tn(sM).scale(124.75).clipAngle(180-.001)}var cM=fb(function(e){return(e=Ux(e))&&e/J(e)});cM.invert=Io(function(e){return e});function lM(){return Tn(cM).scale(79.4188).clipAngle(180-.001)}function nf(e,t){return[e,sl(Xu((de+t)/2))]}nf.invert=function(e,t){return[e,2*li(Rx(t))-de]};function uM(){return fM(nf).scale(961/sn)}function fM(e){var t=Tn(e),n=t.center,r=t.scale,i=t.translate,o=t.clipExtent,s=null,a,c,l;t.scale=function(f){return arguments.length?(r(f),u()):r()},t.translate=function(f){return arguments.length?(i(f),u()):i()},t.center=function(f){return arguments.length?(n(f),u()):n()},t.clipExtent=function(f){return arguments.length?(f==null?s=a=c=l=null:(s=+f[0][0],a=+f[0][1],c=+f[1][0],l=+f[1][1]),u()):s==null?null:[[s,a],[c,l]]};function u(){var f=Et*r(),d=t(pk(t.rotate()).invert([0,0]));return o(s==null?[[d[0]-f,d[1]-f],[d[0]+f,d[1]+f]]:e===nf?[[Math.max(d[0]-f,s),a],[Math.min(d[0]+f,c),l]]:[[s,Math.max(d[1]-f,a)],[c,Math.min(d[1]+f,l)]])}return u()}function db(e){return Xu((de+e)/2)}function jk(e,t){var n=Q(e),r=e===t?J(e):sl(n/Q(t))/sl(db(t)/db(e)),i=n*Px(db(e),r)/r;if(!r)return nf;function o(s,a){i>0?a<-de+K&&(a=-de+K):a>de-K&&(a=de-K);var c=i/Px(db(a),r);return[c*J(r*s),i-c*Q(r*s)]}return o.invert=function(s,a){var c=i-a,l=Fn(r)*he(s*s+c*c),u=Ge(s,Rt(c))*Fn(c);return c*r<0&&(u-=Et*Fn(s)*Fn(c)),[u/r,2*li(Px(i/l,1/r))-de]},o}function dM(){return ef(jk).scale(109.5).parallels([30,30])}function rf(e,t){return[e,t]}rf.invert=rf;function hM(){return Tn(rf).scale(152.63)}function qk(e,t){var n=Q(e),r=e===t?J(e):(n-Q(t))/(t-e),i=n/r+e;if(Rt(r)<K)return rf;function o(s,a){var c=i-a,l=r*s;return[c*J(l),i-c*Q(l)]}return o.invert=function(s,a){var c=i-a,l=Ge(s,Rt(c))*Fn(c);return c*r<0&&(l-=Et*Fn(s)*Fn(c)),[l/r,i-Fn(r)*he(s*s+c*c)]},o}function pM(){return ef(qk).scale(131.154).center([0,13.9389])}var Vp=1.340264,Yp=-.081106,Xp=893e-6,Gp=.003796,hb=he(3)/2,qG=12;function mM(e,t){var n=ve(hb*J(t)),r=n*n,i=r*r*r;return[e*Q(n)/(hb*(Vp+3*Yp*r+i*(7*Xp+9*Gp*r))),n*(Vp+Yp*r+i*(Xp+Gp*r))]}mM.invert=function(e,t){for(var n=t,r=n*n,i=r*r*r,o=0,s,a,c;o<qG&&(a=n*(Vp+Yp*r+i*(Xp+Gp*r))-t,c=Vp+3*Yp*r+i*(7*Xp+9*Gp*r),n-=s=a/c,r=n*n,i=r*r*r,!(Rt(s)<ol));++o);return[hb*e*(Vp+3*Yp*r+i*(7*Xp+9*Gp*r))/Q(n),ve(J(n)/hb)]};function yM(){return Tn(mM).scale(177.158)}function gM(e,t){var n=Q(t),r=Q(e)*n;return[n*J(e)/r,J(t)/r]}gM.invert=Io(li);function xM(){return Tn(gM).scale(144.049).clipAngle(60)}function bM(e,t){return[Q(t)*J(e),J(t)]}bM.invert=Io(ve);function wM(){return Tn(bM).scale(249.5).clipAngle(90+K)}function vM(e,t){var n=Q(t),r=1+Q(e)*n;return[n*J(e)/r,J(t)/r]}vM.invert=Io(function(e){return 2*li(e)});function _M(){return Tn(vM).scale(250).clipAngle(142)}function SM(e,t){return[sl(Xu((de+t)/2)),-e]}SM.invert=function(e,t){return[-t,2*li(Rx(e))-de]};function IM(){var e=fM(SM),t=e.center,n=e.rotate;return e.center=function(r){return arguments.length?t([-r[1],r[0]]):(r=t(),[r[1],-r[0]])},e.rotate=function(r){return arguments.length?n([r[0],r[1],r.length>2?r[2]+90:90]):(r=n(),[r[0],r[1],r[2]-90])},n([0,0,90]).scale(159.155)}function VG(e,t){return e.parent===t.parent?1:2}function YG(e){return e.reduce(XG,0)/e.length}function XG(e,t){return e+t.x}function GG(e){return 1+e.reduce(WG,0)}function WG(e,t){return Math.max(e,t.y)}function HG(e){for(var t;t=e.children;)e=t[0];return e}function ZG(e){for(var t;t=e.children;)e=t[t.length-1];return e}function pb(){var e=VG,t=1,n=1,r=!1;function i(o){var s,a=0;o.eachAfter(function(d){var h=d.children;h?(d.x=YG(h),d.y=GG(h)):(d.x=s?a+=e(d,s):0,d.y=0,s=d)});var c=HG(o),l=ZG(o),u=c.x-e(c,l)/2,f=l.x+e(l,c)/2;return o.eachAfter(r?function(d){d.x=(d.x-o.x)*t,d.y=(o.y-d.y)*n}:function(d){d.x=(d.x-u)/(f-u)*t,d.y=(1-(o.y?d.y/o.y:1))*n})}return i.separation=function(o){return arguments.length?(e=o,i):e},i.size=function(o){return arguments.length?(r=!1,t=+o[0],n=+o[1],i):r?null:[t,n]},i.nodeSize=function(o){return arguments.length?(r=!0,t=+o[0],n=+o[1],i):r?[t,n]:null},i}function JG(e){var t=0,n=e.children,r=n&&n.length;if(!r)t=1;else for(;--r>=0;)t+=n[r].value;e.value=t}function Vk(){return this.eachAfter(JG)}function Yk(e,t){let n=-1;for(let r of this)e.call(t,r,++n,this);return this}function Xk(e,t){for(var n=this,r=[n],i,o,s=-1;n=r.pop();)if(e.call(t,n,++s,this),i=n.children)for(o=i.length-1;o>=0;--o)r.push(i[o]);return this}function Gk(e,t){for(var n=this,r=[n],i=[],o,s,a,c=-1;n=r.pop();)if(i.push(n),o=n.children)for(s=0,a=o.length;s<a;++s)r.push(o[s]);for(;n=i.pop();)e.call(t,n,++c,this);return this}function Wk(e,t){let n=-1;for(let r of this)if(e.call(t,r,++n,this))return r}function Hk(e){return this.eachAfter(function(t){for(var n=+e(t.data)||0,r=t.children,i=r&&r.length;--i>=0;)n+=r[i].value;t.value=n})}function Zk(e){return this.eachBefore(function(t){t.children&&t.children.sort(e)})}function Jk(e){for(var t=this,n=QG(t,e),r=[t];t!==n;)t=t.parent,r.push(t);for(var i=r.length;e!==n;)r.splice(i,0,e),e=e.parent;return r}function QG(e,t){if(e===t)return e;var n=e.ancestors(),r=t.ancestors(),i=null;for(e=n.pop(),t=r.pop();e===t;)i=e,e=n.pop(),t=r.pop();return i}function Qk(){for(var e=this,t=[e];e=e.parent;)t.push(e);return t}function Kk(){return Array.from(this)}function tC(){var e=[];return this.eachBefore(function(t){t.children||e.push(t)}),e}function eC(){var e=this,t=[];return e.each(function(n){n!==e&&t.push({source:n.parent,target:n})}),t}function*nC(){var e=this,t,n=[e],r,i,o;do for(t=n.reverse(),n=[];e=t.pop();)if(yield e,r=e.children)for(i=0,o=r.length;i<o;++i)n.push(r[i]);while(n.length)}function MM(e,t){e instanceof Map?(e=[void 0,e],t===void 0&&(t=eW)):t===void 0&&(t=tW);for(var n=new Ua(e),r,i=[n],o,s,a,c;r=i.pop();)if((s=t(r.data))&&(c=(s=Array.from(s)).length))for(r.children=s,a=c-1;a>=0;--a)i.push(o=s[a]=new Ua(s[a])),o.parent=r,o.depth=r.depth+1;return n.eachBefore(TM)}function KG(){return MM(this).eachBefore(nW)}function tW(e){return e.children}function eW(e){return Array.isArray(e)?e[1]:null}function nW(e){e.data.value!==void 0&&(e.value=e.data.value),e.data=e.data.data}function TM(e){var t=0;do e.height=t;while((e=e.parent)&&e.height<++t)}function Ua(e){this.data=e,this.depth=this.height=0,this.parent=null}Ua.prototype=MM.prototype={constructor:Ua,count:Vk,each:Yk,eachAfter:Gk,eachBefore:Xk,find:Wk,sum:Hk,sort:Zk,path:Jk,ancestors:Qk,descendants:Kk,leaves:tC,links:eC,copy:KG,[Symbol.iterator]:nC};function mb(e){return e==null?null:rW(e)}function rW(e){if(typeof e!="function")throw new Error;return e}var iW={depth:-1},rC={},AM={};function oW(e){return e.id}function sW(e){return e.parentId}function yb(){var e=oW,t=sW,n;function r(i){var o=Array.from(i),s=e,a=t,c,l,u,f,d,h,p,m,g=new Map;if(n!=null){let y=o.map((w,_)=>aW(n(w,_,i))),x=y.map(iC),b=new Set(y).add("");for(let w of x)b.has(w)||(b.add(w),y.push(w),x.push(iC(w)),o.push(AM));s=(w,_)=>y[_],a=(w,_)=>x[_]}for(u=0,c=o.length;u<c;++u)l=o[u],h=o[u]=new Ua(l),(p=s(l,u,i))!=null&&(p+="")&&(m=h.id=p,g.set(m,g.has(m)?rC:h)),(p=a(l,u,i))!=null&&(p+="")&&(h.parent=p);for(u=0;u<c;++u)if(h=o[u],p=h.parent){if(d=g.get(p),!d)throw new Error("missing: "+p);if(d===rC)throw new Error("ambiguous: "+p);d.children?d.children.push(h):d.children=[h],h.parent=d}else{if(f)throw new Error("multiple roots");f=h}if(!f)throw new Error("no root");if(n!=null){for(;f.data===AM&&f.children.length===1;)f=f.children[0],--c;for(let y=o.length-1;y>=0&&(h=o[y],h.data===AM);--y)h.data=null}if(f.parent=iW,f.eachBefore(function(y){y.depth=y.parent.depth+1,--c}).eachBefore(TM),f.parent=null,c>0)throw new Error("cycle");return f}return r.id=function(i){return arguments.length?(e=mb(i),r):e},r.parentId=function(i){return arguments.length?(t=mb(i),r):t},r.path=function(i){return arguments.length?(n=mb(i),r):n},r}function aW(e){e=`${e}`;let t=e.length;return EM(e,t-1)&&!EM(e,t-2)&&(e=e.slice(0,-1)),e[0]==="/"?e:`/${e}`}function iC(e){let t=e.length;if(t<2)return"";for(;--t>1&&!EM(e,t););return e.slice(0,t)}function EM(e,t){if(e[t]==="/"){let n=0;for(;t>0&&e[--t]==="\\";)++n;if(!(n&1))return!0}return!1}function cW(e,t){return e.parent===t.parent?1:2}function NM(e){var t=e.children;return t?t[0]:e.t}function DM(e){var t=e.children;return t?t[t.length-1]:e.t}function lW(e,t,n){var r=n/(t.i-e.i);t.c-=r,t.s+=n,e.c+=r,t.z+=n,t.m+=n}function uW(e){for(var t=0,n=0,r=e.children,i=r.length,o;--i>=0;)o=r[i],o.z+=t,o.m+=t,t+=o.s+(n+=o.c)}function fW(e,t,n){return e.a.parent===t.parent?e.a:n}function gb(e,t){this._=e,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=t}gb.prototype=Object.create(Ua.prototype);function dW(e){for(var t=new gb(e,0),n,r=[t],i,o,s,a;n=r.pop();)if(o=n._.children)for(n.children=new Array(a=o.length),s=a-1;s>=0;--s)r.push(i=n.children[s]=new gb(o[s],s)),i.parent=n;return(t.parent=new gb(null,0)).children=[t],t}function ll(){var e=cW,t=1,n=1,r=null;function i(l){var u=dW(l);if(u.eachAfter(o),u.parent.m=-u.z,u.eachBefore(s),r)l.eachBefore(c);else{var f=l,d=l,h=l;l.eachBefore(function(x){x.x<f.x&&(f=x),x.x>d.x&&(d=x),x.depth>h.depth&&(h=x)});var p=f===d?1:e(f,d)/2,m=p-f.x,g=t/(d.x+p+m),y=n/(h.depth||1);l.eachBefore(function(x){x.x=(x.x+m)*g,x.y=x.depth*y})}return l}function o(l){var u=l.children,f=l.parent.children,d=l.i?f[l.i-1]:null;if(u){uW(l);var h=(u[0].z+u[u.length-1].z)/2;d?(l.z=d.z+e(l._,d._),l.m=l.z-h):l.z=h}else d&&(l.z=d.z+e(l._,d._));l.parent.A=a(l,d,l.parent.A||f[0])}function s(l){l._.x=l.z+l.parent.m,l.m+=l.parent.m}function a(l,u,f){if(u){for(var d=l,h=l,p=u,m=d.parent.children[0],g=d.m,y=h.m,x=p.m,b=m.m,w;p=DM(p),d=NM(d),p&&d;)m=NM(m),h=DM(h),h.a=l,w=p.z+x-d.z-g+e(p._,d._),w>0&&(lW(fW(p,l,f),l,w),g+=w,y+=w),x+=p.m,g+=d.m,b+=m.m,y+=h.m;p&&!DM(h)&&(h.t=p,h.m+=x-y),d&&!NM(m)&&(m.t=d,m.m+=g-b,f=l)}return f}function c(l){l.x*=t,l.y=l.depth*n}return i.separation=function(l){return arguments.length?(e=l,i):e},i.size=function(l){return arguments.length?(r=!1,t=+l[0],n=+l[1],i):r?null:[t,n]},i.nodeSize=function(l){return arguments.length?(r=!0,t=+l[0],n=+l[1],i):r?[t,n]:null},i}var oC=23283064365386963e-26;function ul(e=Math.random()){let t=(0<=e&&e<1?e/oC:Math.abs(e))|0;return()=>(t=1664525*t+1013904223|0,oC*(t>>>0))}function He(e,t){switch(arguments.length){case 0:break;case 1:this.range(e);break;default:this.range(t).domain(e);break}return this}function Wp(e,t){switch(arguments.length){case 0:break;case 1:{typeof e=="function"?this.interpolator(e):this.range(e);break}default:{this.domain(e),typeof t=="function"?this.interpolator(t):this.range(t);break}}return this}var Hp=Symbol("implicit");function fl(){var e=new Xn,t=[],n=[],r=Hp;function i(o){let s=e.get(o);if(s===void 0){if(r!==Hp)return r;e.set(o,s=t.push(o)-1)}return n[s%n.length]}return i.domain=function(o){if(!arguments.length)return t.slice();t=[],e=new Xn;for(let s of o)e.has(s)||e.set(s,t.push(s)-1);return i},i.range=function(o){return arguments.length?(n=Array.from(o),i):n.slice()},i.unknown=function(o){return arguments.length?(r=o,i):r},i.copy=function(){return fl(t,n).unknown(r)},He.apply(i,arguments),i}function za(){var e=fl().unknown(void 0),t=e.domain,n=e.range,r=0,i=1,o,s,a=!1,c=0,l=0,u=.5;delete e.unknown;function f(){var d=t().length,h=i<r,p=h?i:r,m=h?r:i;o=(m-p)/Math.max(1,d-c+l*2),a&&(o=Math.floor(o)),p+=(m-p-o*(d-c))*u,s=o*(1-c),a&&(p=Math.round(p),s=Math.round(s));var g=Pe(d).map(function(y){return p+o*y});return n(h?g.reverse():g)}return e.domain=function(d){return arguments.length?(t(d),f()):t()},e.range=function(d){return arguments.length?([r,i]=d,r=+r,i=+i,f()):[r,i]},e.rangeRound=function(d){return[r,i]=d,r=+r,i=+i,a=!0,f()},e.bandwidth=function(){return s},e.step=function(){return o},e.round=function(d){return arguments.length?(a=!!d,f()):a},e.padding=function(d){return arguments.length?(c=Math.min(1,l=+d),f()):c},e.paddingInner=function(d){return arguments.length?(c=Math.min(1,d),f()):c},e.paddingOuter=function(d){return arguments.length?(l=+d,f()):l},e.align=function(d){return arguments.length?(u=Math.max(0,Math.min(1,d)),f()):u},e.copy=function(){return za(t(),[r,i]).round(a).paddingInner(c).paddingOuter(l).align(u)},He.apply(f(),arguments)}function sC(e){var t=e.copy;return e.padding=e.paddingOuter,delete e.paddingInner,delete e.paddingOuter,e.copy=function(){return sC(t())},e}function OM(){return sC(za.apply(null,arguments).paddingInner(1))}function BM(e){return function(){return e}}function of(e){return+e}var aC=[0,1];function yr(e){return e}function LM(e,t){return(t-=e=+e)?function(n){return(n-e)/t}:BM(isNaN(t)?NaN:.5)}function hW(e,t){var n;return e>t&&(n=e,e=t,t=n),function(r){return Math.max(e,Math.min(t,r))}}function pW(e,t,n){var r=e[0],i=e[1],o=t[0],s=t[1];return i<r?(r=LM(i,r),o=n(s,o)):(r=LM(r,i),o=n(o,s)),function(a){return o(r(a))}}function mW(e,t,n){var r=Math.min(e.length,t.length)-1,i=new Array(r),o=new Array(r),s=-1;for(e[r]<e[0]&&(e=e.slice().reverse(),t=t.slice().reverse());++s<r;)i[s]=LM(e[s],e[s+1]),o[s]=n(t[s],t[s+1]);return function(a){var c=Ms(e,a,1,r)-1;return o[c](i[c](a))}}function Mo(e,t){return t.domain(e.domain()).range(e.range()).interpolate(e.interpolate()).clamp(e.clamp()).unknown(e.unknown())}function dl(){var e=aC,t=aC,n=Fr,r,i,o,s=yr,a,c,l;function u(){var d=Math.min(e.length,t.length);return s!==yr&&(s=hW(e[0],e[d-1])),a=d>2?mW:pW,c=l=null,f}function f(d){return d==null||isNaN(d=+d)?o:(c||(c=a(e.map(r),t,n)))(r(s(d)))}return f.invert=function(d){return s(i((l||(l=a(t,e.map(r),we)))(d)))},f.domain=function(d){return arguments.length?(e=Array.from(d,of),u()):e.slice()},f.range=function(d){return arguments.length?(t=Array.from(d),u()):t.slice()},f.rangeRound=function(d){return t=Array.from(d),n=Kc,u()},f.clamp=function(d){return arguments.length?(s=d?!0:yr,u()):s!==yr},f.interpolate=function(d){return arguments.length?(n=d,u()):n},f.unknown=function(d){return arguments.length?(o=d,f):o},function(d,h){return r=d,i=h,u()}}function Zp(){return dl()(yr,yr)}function kM(e,t,n,r){var i=Au(e,t,n),o;switch(r=wo(r??",f"),r.type){case"s":{var s=Math.max(Math.abs(e),Math.abs(t));return r.precision==null&&!isNaN(o=AI(i,s))&&(r.precision=o),Fx(r,s)}case"":case"e":case"g":case"p":case"r":{r.precision==null&&!isNaN(o=EI(i,Math.max(Math.abs(e),Math.abs(t))))&&(r.precision=o-(r.type==="e"));break}case"f":case"%":{r.precision==null&&!isNaN(o=TI(i))&&(r.precision=o-(r.type==="%")*2);break}}return ci(r)}function Fs(e){var t=e.domain;return e.ticks=function(n){var r=t();return _n(r[0],r[r.length-1],n??10)},e.tickFormat=function(n,r){var i=t();return kM(i[0],i[i.length-1],n??10,r)},e.nice=function(n){n==null&&(n=10);var r=t(),i=0,o=r.length-1,s=r[i],a=r[o],c,l,u=10;for(a<s&&(l=s,s=a,a=l,l=i,i=o,o=l);u-- >0;){if(l=Ts(s,a,n),l===c)return r[i]=s,r[o]=a,t(r);if(l>0)s=Math.floor(s/l)*l,a=Math.ceil(a/l)*l;else if(l<0)s=Math.ceil(s*l)/l,a=Math.floor(a*l)/l;else break;c=l}return e},e}function Rs(){var e=Zp();return e.copy=function(){return Mo(e,Rs())},He.apply(e,arguments),Fs(e)}function Jp(e){var t;function n(r){return r==null||isNaN(r=+r)?t:r}return n.invert=n,n.domain=n.range=function(r){return arguments.length?(e=Array.from(r,of),n):e.slice()},n.unknown=function(r){return arguments.length?(t=r,n):t},n.copy=function(){return Jp(e).unknown(t)},e=arguments.length?Array.from(e,of):[0,1],Fs(n)}function Qp(e,t){e=e.slice();var n=0,r=e.length-1,i=e[n],o=e[r],s;return o<i&&(s=n,n=r,r=s,s=i,i=o,o=s),e[n]=t.floor(i),e[r]=t.ceil(o),e}function cC(e){return Math.log(e)}function lC(e){return Math.exp(e)}function yW(e){return-Math.log(-e)}function gW(e){return-Math.exp(-e)}function xW(e){return isFinite(e)?+("1e"+e):e<0?0:e}function bW(e){return e===10?xW:e===Math.E?Math.exp:t=>Math.pow(e,t)}function wW(e){return e===Math.E?Math.log:e===10&&Math.log10||e===2&&Math.log2||(e=Math.log(e),t=>Math.log(t)/e)}function uC(e){return(t,n)=>-e(-t,n)}function CM(e){let t=e(cC,lC),n=t.domain,r=10,i,o;function s(){return i=wW(r),o=bW(r),n()[0]<0?(i=uC(i),o=uC(o),e(yW,gW)):e(cC,lC),t}return t.base=function(a){return arguments.length?(r=+a,s()):r},t.domain=function(a){return arguments.length?(n(a),s()):n()},t.ticks=a=>{let c=n(),l=c[0],u=c[c.length-1],f=u<l;f&&([l,u]=[u,l]);let d=i(l),h=i(u),p,m,g=a==null?10:+a,y=[];if(!(r%1)&&h-d<g){if(d=Math.floor(d),h=Math.ceil(h),l>0){for(;d<=h;++d)for(p=1;p<r;++p)if(m=d<0?p/o(-d):p*o(d),!(m<l)){if(m>u)break;y.push(m)}}else for(;d<=h;++d)for(p=r-1;p>=1;--p)if(m=d>0?p/o(-d):p*o(d),!(m<l)){if(m>u)break;y.push(m)}y.length*2<g&&(y=_n(l,u,g))}else y=_n(d,h,Math.min(h-d,g)).map(o);return f?y.reverse():y},t.tickFormat=(a,c)=>{if(a==null&&(a=10),c==null&&(c=r===10?"s":","),typeof c!="function"&&(!(r%1)&&(c=wo(c)).precision==null&&(c.trim=!0),c=ci(c)),a===1/0)return c;let l=Math.max(1,r*a/t.ticks().length);return u=>{let f=u/o(Math.round(i(u)));return f*r<r-.5&&(f*=r),f<=l?c(u):""}},t.nice=()=>n(Qp(n(),{floor:a=>o(Math.floor(i(a))),ceil:a=>o(Math.ceil(i(a)))})),t}function Kp(){let e=CM(dl()).domain([1,10]);return e.copy=()=>Mo(e,Kp()).base(e.base()),He.apply(e,arguments),e}function fC(e){return function(t){return Math.sign(t)*Math.log1p(Math.abs(t/e))}}function dC(e){return function(t){return Math.sign(t)*Math.expm1(Math.abs(t))*e}}function FM(e){var t=1,n=e(fC(t),dC(t));return n.constant=function(r){return arguments.length?e(fC(t=+r),dC(t)):t},Fs(n)}function tm(){var e=FM(dl());return e.copy=function(){return Mo(e,tm()).constant(e.constant())},He.apply(e,arguments)}function hC(e){return function(t){return t<0?-Math.pow(-t,e):Math.pow(t,e)}}function vW(e){return e<0?-Math.sqrt(-e):Math.sqrt(e)}function _W(e){return e<0?-e*e:e*e}function RM(e){var t=e(yr,yr),n=1;function r(){return n===1?e(yr,yr):n===.5?e(vW,_W):e(hC(n),hC(1/n))}return t.exponent=function(i){return arguments.length?(n=+i,r()):n},Fs(t)}function em(){var e=RM(dl());return e.copy=function(){return Mo(e,em()).exponent(e.exponent())},He.apply(e,arguments),e}function nm(){var e=[],t=[],n=[],r;function i(){var s=0,a=Math.max(1,t.length);for(n=new Array(a-1);++s<a;)n[s-1]=FS(e,s/a);return o}function o(s){return s==null||isNaN(s=+s)?r:t[Ms(n,s)]}return o.invertExtent=function(s){var a=t.indexOf(s);return a<0?[NaN,NaN]:[a>0?n[a-1]:e[0],a<n.length?n[a]:e[e.length-1]]},o.domain=function(s){if(!arguments.length)return e.slice();e=[];for(let a of s)a!=null&&!isNaN(a=+a)&&e.push(a);return e.sort(Gt),i()},o.range=function(s){return arguments.length?(t=Array.from(s),i()):t.slice()},o.unknown=function(s){return arguments.length?(r=s,o):r},o.quantiles=function(){return n.slice()},o.copy=function(){return nm().domain(e).range(t).unknown(r)},He.apply(o,arguments)}function rm(){var e=[.5],t=[0,1],n,r=1;function i(o){return o!=null&&o<=o?t[Ms(e,o,0,r)]:n}return i.domain=function(o){return arguments.length?(e=Array.from(o),r=Math.min(e.length,t.length-1),i):e.slice()},i.range=function(o){return arguments.length?(t=Array.from(o),r=Math.min(e.length,t.length-1),i):t.slice()},i.invertExtent=function(o){var s=t.indexOf(o);return[e[s-1],e[s]]},i.unknown=function(o){return arguments.length?(n=o,i):n},i.copy=function(){return rm().domain(e).range(t).unknown(n)},He.apply(i,arguments)}var $M=new Date,PM=new Date;function pe(e,t,n,r){function i(o){return e(o=arguments.length===0?new Date:new Date(+o)),o}return i.floor=o=>(e(o=new Date(+o)),o),i.ceil=o=>(e(o=new Date(o-1)),t(o,1),e(o),o),i.round=o=>{let s=i(o),a=i.ceil(o);return o-s<a-o?s:a},i.offset=(o,s)=>(t(o=new Date(+o),s==null?1:Math.floor(s)),o),i.range=(o,s,a)=>{let c=[];if(o=i.ceil(o),a=a==null?1:Math.floor(a),!(o<s)||!(a>0))return c;let l;do c.push(l=new Date(+o)),t(o,a),e(o);while(l<o&&o<s);return c},i.filter=o=>pe(s=>{if(s>=s)for(;e(s),!o(s);)s.setTime(s-1)},(s,a)=>{if(s>=s)if(a<0)for(;++a<=0;)for(;t(s,-1),!o(s););else for(;--a>=0;)for(;t(s,1),!o(s););}),n&&(i.count=(o,s)=>($M.setTime(+o),PM.setTime(+s),e($M),e(PM),Math.floor(n($M,PM))),i.every=o=>(o=Math.floor(o),!isFinite(o)||!(o>0)?null:o>1?i.filter(r?s=>r(s)%o===0:s=>i.count(0,s)%o===0):i)),i}var im=pe(()=>{},(e,t)=>{e.setTime(+e+t)},(e,t)=>t-e);im.every=e=>(e=Math.floor(e),!isFinite(e)||!(e>0)?null:e>1?pe(t=>{t.setTime(Math.floor(t/e)*e)},(t,n)=>{t.setTime(+t+n*e)},(t,n)=>(n-t)/e):im);var s3t=im.range;var an=pe(e=>{e.setTime(e-e.getMilliseconds())},(e,t)=>{e.setTime(+e+t*1e3)},(e,t)=>(t-e)/1e3,e=>e.getUTCSeconds()),pC=an.range;var $s=pe(e=>{e.setTime(e-e.getMilliseconds()-e.getSeconds()*1e3)},(e,t)=>{e.setTime(+e+t*6e4)},(e,t)=>(t-e)/6e4,e=>e.getMinutes()),SW=$s.range,Ps=pe(e=>{e.setUTCSeconds(0,0)},(e,t)=>{e.setTime(+e+t*6e4)},(e,t)=>(t-e)/6e4,e=>e.getUTCMinutes()),IW=Ps.range;var Us=pe(e=>{e.setTime(e-e.getMilliseconds()-e.getSeconds()*1e3-e.getMinutes()*6e4)},(e,t)=>{e.setTime(+e+t*36e5)},(e,t)=>(t-e)/36e5,e=>e.getHours()),MW=Us.range,zs=pe(e=>{e.setUTCMinutes(0,0,0)},(e,t)=>{e.setTime(+e+t*36e5)},(e,t)=>(t-e)/36e5,e=>e.getUTCHours()),TW=zs.range;var ui=pe(e=>e.setHours(0,0,0,0),(e,t)=>e.setDate(e.getDate()+t),(e,t)=>(t-e-(t.getTimezoneOffset()-e.getTimezoneOffset())*6e4)/864e5,e=>e.getDate()-1),AW=ui.range,ml=pe(e=>{e.setUTCHours(0,0,0,0)},(e,t)=>{e.setUTCDate(e.getUTCDate()+t)},(e,t)=>(t-e)/864e5,e=>e.getUTCDate()-1),EW=ml.range,yl=pe(e=>{e.setUTCHours(0,0,0,0)},(e,t)=>{e.setUTCDate(e.getUTCDate()+t)},(e,t)=>(t-e)/864e5,e=>Math.floor(e/864e5)),NW=yl.range;function gl(e){return pe(t=>{t.setDate(t.getDate()-(t.getDay()+7-e)%7),t.setHours(0,0,0,0)},(t,n)=>{t.setDate(t.getDate()+n*7)},(t,n)=>(n-t-(n.getTimezoneOffset()-t.getTimezoneOffset())*6e4)/6048e5)}var $r=gl(0),ja=gl(1),xb=gl(2),bb=gl(3),Ao=gl(4),wb=gl(5),vb=gl(6),yC=$r.range,DW=ja.range,OW=xb.range,BW=bb.range,LW=Ao.range,kW=wb.range,CW=vb.range;function xl(e){return pe(t=>{t.setUTCDate(t.getUTCDate()-(t.getUTCDay()+7-e)%7),t.setUTCHours(0,0,0,0)},(t,n)=>{t.setUTCDate(t.getUTCDate()+n*7)},(t,n)=>(n-t)/6048e5)}var Pr=xl(0),qa=xl(1),_b=xl(2),Sb=xl(3),Eo=xl(4),Ib=xl(5),Mb=xl(6),gC=Pr.range,FW=qa.range,RW=_b.range,$W=Sb.range,PW=Eo.range,UW=Ib.range,zW=Mb.range;var js=pe(e=>{e.setDate(1),e.setHours(0,0,0,0)},(e,t)=>{e.setMonth(e.getMonth()+t)},(e,t)=>t.getMonth()-e.getMonth()+(t.getFullYear()-e.getFullYear())*12,e=>e.getMonth()),jW=js.range,qs=pe(e=>{e.setUTCDate(1),e.setUTCHours(0,0,0,0)},(e,t)=>{e.setUTCMonth(e.getUTCMonth()+t)},(e,t)=>t.getUTCMonth()-e.getUTCMonth()+(t.getUTCFullYear()-e.getUTCFullYear())*12,e=>e.getUTCMonth()),qW=qs.range;var Rn=pe(e=>{e.setMonth(0,1),e.setHours(0,0,0,0)},(e,t)=>{e.setFullYear(e.getFullYear()+t)},(e,t)=>t.getFullYear()-e.getFullYear(),e=>e.getFullYear());Rn.every=e=>!isFinite(e=Math.floor(e))||!(e>0)?null:pe(t=>{t.setFullYear(Math.floor(t.getFullYear()/e)*e),t.setMonth(0,1),t.setHours(0,0,0,0)},(t,n)=>{t.setFullYear(t.getFullYear()+n*e)});var VW=Rn.range,$n=pe(e=>{e.setUTCMonth(0,1),e.setUTCHours(0,0,0,0)},(e,t)=>{e.setUTCFullYear(e.getUTCFullYear()+t)},(e,t)=>t.getUTCFullYear()-e.getUTCFullYear(),e=>e.getUTCFullYear());$n.every=e=>!isFinite(e=Math.floor(e))||!(e>0)?null:pe(t=>{t.setUTCFullYear(Math.floor(t.getUTCFullYear()/e)*e),t.setUTCMonth(0,1),t.setUTCHours(0,0,0,0)},(t,n)=>{t.setUTCFullYear(t.getUTCFullYear()+n*e)});var YW=$n.range;function bC(e,t,n,r,i,o){let s=[[an,1,1e3],[an,5,5*1e3],[an,15,15*1e3],[an,30,30*1e3],[o,1,6e4],[o,5,5*6e4],[o,15,15*6e4],[o,30,30*6e4],[i,1,36e5],[i,3,3*36e5],[i,6,6*36e5],[i,12,12*36e5],[r,1,864e5],[r,2,2*864e5],[n,1,6048e5],[t,1,2592e6],[t,3,3*2592e6],[e,1,31536e6]];function a(l,u,f){let d=u<l;d&&([l,u]=[u,l]);let h=f&&typeof f.range=="function"?f:c(l,u,f),p=h?h.range(l,+u+1):[];return d?p.reverse():p}function c(l,u,f){let d=Math.abs(u-l)/f,h=Is(([,,g])=>g).right(s,d);if(h===s.length)return e.every(Au(l/31536e6,u/31536e6,f));if(h===0)return im.every(Math.max(Au(l,u,f),1));let[p,m]=s[d/s[h-1][2]<s[h][2]/d?h-1:h];return p.every(m)}return[a,c]}var[UM,sm]=bC($n,qs,Pr,yl,zs,Ps),[zM,jM]=bC(Rn,js,$r,ui,Us,$s);function qM(e){if(0<=e.y&&e.y<100){var t=new Date(-1,e.m,e.d,e.H,e.M,e.S,e.L);return t.setFullYear(e.y),t}return new Date(e.y,e.m,e.d,e.H,e.M,e.S,e.L)}function VM(e){if(0<=e.y&&e.y<100){var t=new Date(Date.UTC(-1,e.m,e.d,e.H,e.M,e.S,e.L));return t.setUTCFullYear(e.y),t}return new Date(Date.UTC(e.y,e.m,e.d,e.H,e.M,e.S,e.L))}function am(e,t,n){return{y:e,m:t,d:n,H:0,M:0,S:0,L:0}}function YM(e){var t=e.dateTime,n=e.date,r=e.time,i=e.periods,o=e.days,s=e.shortDays,a=e.months,c=e.shortMonths,l=cm(i),u=lm(i),f=cm(o),d=lm(o),h=cm(s),p=lm(s),m=cm(a),g=lm(a),y=cm(c),x=lm(c),b={a:k,A:R,b:F,B:$,c:null,d:MC,e:MC,f:mH,g:MH,G:AH,H:dH,I:hH,j:pH,L:DC,m:yH,M:gH,p:P,q:U,Q:EC,s:NC,S:xH,u:bH,U:wH,V:vH,w:_H,W:SH,x:null,X:null,y:IH,Y:TH,Z:EH,"%":AC},w={a:W,A:tt,b:nt,B:st,c:null,d:TC,e:TC,f:BH,g:jH,G:VH,H:NH,I:DH,j:OH,L:BC,m:LH,M:kH,p:Y,q:rt,Q:EC,s:NC,S:CH,u:FH,U:RH,V:$H,w:PH,W:UH,x:null,X:null,y:zH,Y:qH,Z:YH,"%":AC},_={a:I,A:T,b:O,B,c:S,d:SC,e:SC,f:cH,g:_C,G:vC,H:IC,I:IC,j:iH,L:aH,m:rH,M:oH,p:D,q:nH,Q:uH,s:fH,S:sH,u:JW,U:QW,V:KW,w:ZW,W:tH,x:A,X:N,y:_C,Y:vC,Z:eH,"%":lH};b.x=v(n,b),b.X=v(r,b),b.c=v(t,b),w.x=v(n,w),w.X=v(r,w),w.c=v(t,w);function v(j,H){return function(ot){var z=[],Ct=-1,dt=0,Wt=j.length,Ht,et,oe;for(ot instanceof Date||(ot=new Date(+ot));++Ct<Wt;)j.charCodeAt(Ct)===37&&(z.push(j.slice(dt,Ct)),(et=wC[Ht=j.charAt(++Ct)])!=null?Ht=j.charAt(++Ct):et=Ht==="e"?" ":"0",(oe=H[Ht])&&(Ht=oe(ot,et)),z.push(Ht),dt=Ct+1);return z.push(j.slice(dt,Ct)),z.join("")}}function M(j,H){return function(ot){var z=am(1900,void 0,1),Ct=E(z,j,ot+="",0),dt,Wt;if(Ct!=ot.length)return null;if("Q"in z)return new Date(z.Q);if("s"in z)return new Date(z.s*1e3+("L"in z?z.L:0));if(H&&!("Z"in z)&&(z.Z=0),"p"in z&&(z.H=z.H%12+z.p*12),z.m===void 0&&(z.m="q"in z?z.q:0),"V"in z){if(z.V<1||z.V>53)return null;"w"in z||(z.w=1),"Z"in z?(dt=VM(am(z.y,0,1)),Wt=dt.getUTCDay(),dt=Wt>4||Wt===0?qa.ceil(dt):qa(dt),dt=ml.offset(dt,(z.V-1)*7),z.y=dt.getUTCFullYear(),z.m=dt.getUTCMonth(),z.d=dt.getUTCDate()+(z.w+6)%7):(dt=qM(am(z.y,0,1)),Wt=dt.getDay(),dt=Wt>4||Wt===0?ja.ceil(dt):ja(dt),dt=ui.offset(dt,(z.V-1)*7),z.y=dt.getFullYear(),z.m=dt.getMonth(),z.d=dt.getDate()+(z.w+6)%7)}else("W"in z||"U"in z)&&("w"in z||(z.w="u"in z?z.u%7:"W"in z?1:0),Wt="Z"in z?VM(am(z.y,0,1)).getUTCDay():qM(am(z.y,0,1)).getDay(),z.m=0,z.d="W"in z?(z.w+6)%7+z.W*7-(Wt+5)%7:z.w+z.U*7-(Wt+6)%7);return"Z"in z?(z.H+=z.Z/100|0,z.M+=z.Z%100,VM(z)):qM(z)}}function E(j,H,ot,z){for(var Ct=0,dt=H.length,Wt=ot.length,Ht,et;Ct<dt;){if(z>=Wt)return-1;if(Ht=H.charCodeAt(Ct++),Ht===37){if(Ht=H.charAt(Ct++),et=_[Ht in wC?H.charAt(Ct++):Ht],!et||(z=et(j,ot,z))<0)return-1}else if(Ht!=ot.charCodeAt(z++))return-1}return z}function D(j,H,ot){var z=l.exec(H.slice(ot));return z?(j.p=u.get(z[0].toLowerCase()),ot+z[0].length):-1}function I(j,H,ot){var z=h.exec(H.slice(ot));return z?(j.w=p.get(z[0].toLowerCase()),ot+z[0].length):-1}function T(j,H,ot){var z=f.exec(H.slice(ot));return z?(j.w=d.get(z[0].toLowerCase()),ot+z[0].length):-1}function O(j,H,ot){var z=y.exec(H.slice(ot));return z?(j.m=x.get(z[0].toLowerCase()),ot+z[0].length):-1}function B(j,H,ot){var z=m.exec(H.slice(ot));return z?(j.m=g.get(z[0].toLowerCase()),ot+z[0].length):-1}function S(j,H,ot){return E(j,t,H,ot)}function A(j,H,ot){return E(j,n,H,ot)}function N(j,H,ot){return E(j,r,H,ot)}function k(j){return s[j.getDay()]}function R(j){return o[j.getDay()]}function F(j){return c[j.getMonth()]}function $(j){return a[j.getMonth()]}function P(j){return i[+(j.getHours()>=12)]}function U(j){return 1+~~(j.getMonth()/3)}function W(j){return s[j.getUTCDay()]}function tt(j){return o[j.getUTCDay()]}function nt(j){return c[j.getUTCMonth()]}function st(j){return a[j.getUTCMonth()]}function Y(j){return i[+(j.getUTCHours()>=12)]}function rt(j){return 1+~~(j.getUTCMonth()/3)}return{format:function(j){var H=v(j+="",b);return H.toString=function(){return j},H},parse:function(j){var H=M(j+="",!1);return H.toString=function(){return j},H},utcFormat:function(j){var H=v(j+="",w);return H.toString=function(){return j},H},utcParse:function(j){var H=M(j+="",!0);return H.toString=function(){return j},H}}}var wC={"-":"",_:" ",0:"0"},cn=/^\s*\d+/,GW=/^%/,WW=/[\\^$*+?|[\]().{}]/g;function te(e,t,n){var r=e<0?"-":"",i=(r?-e:e)+"",o=i.length;return r+(o<n?new Array(n-o+1).join(t)+i:i)}function HW(e){return e.replace(WW,"\\$&")}function cm(e){return new RegExp("^(?:"+e.map(HW).join("|")+")","i")}function lm(e){return new Map(e.map((t,n)=>[t.toLowerCase(),n]))}function ZW(e,t,n){var r=cn.exec(t.slice(n,n+1));return r?(e.w=+r[0],n+r[0].length):-1}function JW(e,t,n){var r=cn.exec(t.slice(n,n+1));return r?(e.u=+r[0],n+r[0].length):-1}function QW(e,t,n){var r=cn.exec(t.slice(n,n+2));return r?(e.U=+r[0],n+r[0].length):-1}function KW(e,t,n){var r=cn.exec(t.slice(n,n+2));return r?(e.V=+r[0],n+r[0].length):-1}function tH(e,t,n){var r=cn.exec(t.slice(n,n+2));return r?(e.W=+r[0],n+r[0].length):-1}function vC(e,t,n){var r=cn.exec(t.slice(n,n+4));return r?(e.y=+r[0],n+r[0].length):-1}function _C(e,t,n){var r=cn.exec(t.slice(n,n+2));return r?(e.y=+r[0]+(+r[0]>68?1900:2e3),n+r[0].length):-1}function eH(e,t,n){var r=/^(Z)|([+-]\d\d)(?::?(\d\d))?/.exec(t.slice(n,n+6));return r?(e.Z=r[1]?0:-(r[2]+(r[3]||"00")),n+r[0].length):-1}function nH(e,t,n){var r=cn.exec(t.slice(n,n+1));return r?(e.q=r[0]*3-3,n+r[0].length):-1}function rH(e,t,n){var r=cn.exec(t.slice(n,n+2));return r?(e.m=r[0]-1,n+r[0].length):-1}function SC(e,t,n){var r=cn.exec(t.slice(n,n+2));return r?(e.d=+r[0],n+r[0].length):-1}function iH(e,t,n){var r=cn.exec(t.slice(n,n+3));return r?(e.m=0,e.d=+r[0],n+r[0].length):-1}function IC(e,t,n){var r=cn.exec(t.slice(n,n+2));return r?(e.H=+r[0],n+r[0].length):-1}function oH(e,t,n){var r=cn.exec(t.slice(n,n+2));return r?(e.M=+r[0],n+r[0].length):-1}function sH(e,t,n){var r=cn.exec(t.slice(n,n+2));return r?(e.S=+r[0],n+r[0].length):-1}function aH(e,t,n){var r=cn.exec(t.slice(n,n+3));return r?(e.L=+r[0],n+r[0].length):-1}function cH(e,t,n){var r=cn.exec(t.slice(n,n+6));return r?(e.L=Math.floor(r[0]/1e3),n+r[0].length):-1}function lH(e,t,n){var r=GW.exec(t.slice(n,n+1));return r?n+r[0].length:-1}function uH(e,t,n){var r=cn.exec(t.slice(n));return r?(e.Q=+r[0],n+r[0].length):-1}function fH(e,t,n){var r=cn.exec(t.slice(n));return r?(e.s=+r[0],n+r[0].length):-1}function MC(e,t){return te(e.getDate(),t,2)}function dH(e,t){return te(e.getHours(),t,2)}function hH(e,t){return te(e.getHours()%12||12,t,2)}function pH(e,t){return te(1+ui.count(Rn(e),e),t,3)}function DC(e,t){return te(e.getMilliseconds(),t,3)}function mH(e,t){return DC(e,t)+"000"}function yH(e,t){return te(e.getMonth()+1,t,2)}function gH(e,t){return te(e.getMinutes(),t,2)}function xH(e,t){return te(e.getSeconds(),t,2)}function bH(e){var t=e.getDay();return t===0?7:t}function wH(e,t){return te($r.count(Rn(e)-1,e),t,2)}function OC(e){var t=e.getDay();return t>=4||t===0?Ao(e):Ao.ceil(e)}function vH(e,t){return e=OC(e),te(Ao.count(Rn(e),e)+(Rn(e).getDay()===4),t,2)}function _H(e){return e.getDay()}function SH(e,t){return te(ja.count(Rn(e)-1,e),t,2)}function IH(e,t){return te(e.getFullYear()%100,t,2)}function MH(e,t){return e=OC(e),te(e.getFullYear()%100,t,2)}function TH(e,t){return te(e.getFullYear()%1e4,t,4)}function AH(e,t){var n=e.getDay();return e=n>=4||n===0?Ao(e):Ao.ceil(e),te(e.getFullYear()%1e4,t,4)}function EH(e){var t=e.getTimezoneOffset();return(t>0?"-":(t*=-1,"+"))+te(t/60|0,"0",2)+te(t%60,"0",2)}function TC(e,t){return te(e.getUTCDate(),t,2)}function NH(e,t){return te(e.getUTCHours(),t,2)}function DH(e,t){return te(e.getUTCHours()%12||12,t,2)}function OH(e,t){return te(1+ml.count($n(e),e),t,3)}function BC(e,t){return te(e.getUTCMilliseconds(),t,3)}function BH(e,t){return BC(e,t)+"000"}function LH(e,t){return te(e.getUTCMonth()+1,t,2)}function kH(e,t){return te(e.getUTCMinutes(),t,2)}function CH(e,t){return te(e.getUTCSeconds(),t,2)}function FH(e){var t=e.getUTCDay();return t===0?7:t}function RH(e,t){return te(Pr.count($n(e)-1,e),t,2)}function LC(e){var t=e.getUTCDay();return t>=4||t===0?Eo(e):Eo.ceil(e)}function $H(e,t){return e=LC(e),te(Eo.count($n(e),e)+($n(e).getUTCDay()===4),t,2)}function PH(e){return e.getUTCDay()}function UH(e,t){return te(qa.count($n(e)-1,e),t,2)}function zH(e,t){return te(e.getUTCFullYear()%100,t,2)}function jH(e,t){return e=LC(e),te(e.getUTCFullYear()%100,t,2)}function qH(e,t){return te(e.getUTCFullYear()%1e4,t,4)}function VH(e,t){var n=e.getUTCDay();return e=n>=4||n===0?Eo(e):Eo.ceil(e),te(e.getUTCFullYear()%1e4,t,4)}function YH(){return"+0000"}function AC(){return"%"}function EC(e){return+e}function NC(e){return Math.floor(+e/1e3)}var sf,af,kC,No,CC;XM({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"]});function XM(e){return sf=YM(e),af=sf.format,kC=sf.parse,No=sf.utcFormat,CC=sf.utcParse,sf}function XH(e){return new Date(e)}function GH(e){return e instanceof Date?+e:+new Date(+e)}function Tb(e,t,n,r,i,o,s,a,c,l){var u=Zp(),f=u.invert,d=u.domain,h=l(".%L"),p=l(":%S"),m=l("%I:%M"),g=l("%I %p"),y=l("%a %d"),x=l("%b %d"),b=l("%B"),w=l("%Y");function _(v){return(c(v)<v?h:a(v)<v?p:s(v)<v?m:o(v)<v?g:r(v)<v?i(v)<v?y:x:n(v)<v?b:w)(v)}return u.invert=function(v){return new Date(f(v))},u.domain=function(v){return arguments.length?d(Array.from(v,GH)):d().map(XH)},u.ticks=function(v){var M=d();return e(M[0],M[M.length-1],v??10)},u.tickFormat=function(v,M){return M==null?_:l(M)},u.nice=function(v){var M=d();return(!v||typeof v.range!="function")&&(v=t(M[0],M[M.length-1],v??10)),v?d(Qp(M,v)):u},u.copy=function(){return Mo(u,Tb(e,t,n,r,i,o,s,a,c,l))},u}function Ab(){return He.apply(Tb(zM,jM,Rn,js,$r,ui,Us,$s,an,af).domain([new Date(2e3,0,1),new Date(2e3,0,2)]),arguments)}function Eb(){return He.apply(Tb(UM,sm,$n,qs,Pr,ml,zs,Ps,an,No).domain([Date.UTC(2e3,0,1),Date.UTC(2e3,0,2)]),arguments)}function um(e,t){return t.domain(e.domain()).interpolator(e.interpolator()).clamp(e.clamp()).unknown(e.unknown())}function Nb(){var e=0,t=.5,n=1,r=1,i,o,s,a,c,l=yr,u,f=!1,d;function h(m){return isNaN(m=+m)?d:(m=.5+((m=+u(m))-o)*(r*m<r*o?a:c),l(f?Math.max(0,Math.min(1,m)):m))}h.domain=function(m){return arguments.length?([e,t,n]=m,i=u(e=+e),o=u(t=+t),s=u(n=+n),a=i===o?0:.5/(o-i),c=o===s?0:.5/(s-o),r=o<i?-1:1,h):[e,t,n]},h.clamp=function(m){return arguments.length?(f=!!m,h):f},h.interpolator=function(m){return arguments.length?(l=m,h):l};function p(m){return function(g){var y,x,b;return arguments.length?([y,x,b]=g,l=yo(m,[y,x,b]),h):[l(0),l(.5),l(1)]}}return h.range=p(Fr),h.rangeRound=p(Kc),h.unknown=function(m){return arguments.length?(d=m,h):d},function(m){return u=m,i=m(e),o=m(t),s=m(n),a=i===o?0:.5/(o-i),c=o===s?0:.5/(s-o),r=o<i?-1:1,h}}function fm(){var e=Fs(Nb()(yr));return e.copy=function(){return um(e,fm())},Wp.apply(e,arguments)}function Db(){var e=CM(Nb()).domain([.1,1,10]);return e.copy=function(){return um(e,Db()).base(e.base())},Wp.apply(e,arguments)}function Ob(){var e=FM(Nb());return e.copy=function(){return um(e,Ob()).constant(e.constant())},Wp.apply(e,arguments)}function Bb(){var e=RM(Nb());return e.copy=function(){return um(e,Bb()).exponent(e.exponent())},Wp.apply(e,arguments)}function X(e){for(var t=e.length/6|0,n=new Array(t),r=0;r<t;)n[r]="#"+e.slice(r*6,++r*6);return n}var GM=X("1f77b4ff7f0e2ca02cd627289467bd8c564be377c27f7f7fbcbd2217becf");var WM=X("7fc97fbeaed4fdc086ffff99386cb0f0027fbf5b17666666");var HM=X("1b9e77d95f027570b3e7298a66a61ee6ab02a6761d666666");var ZM=X("a6cee31f78b4b2df8a33a02cfb9a99e31a1cfdbf6fff7f00cab2d66a3d9affff99b15928");var JM=X("fbb4aeb3cde3ccebc5decbe4fed9a6ffffcce5d8bdfddaecf2f2f2");var QM=X("b3e2cdfdcdaccbd5e8f4cae4e6f5c9fff2aef1e2cccccccc");var KM=X("e41a1c377eb84daf4a984ea3ff7f00ffff33a65628f781bf999999");var tT=X("66c2a5fc8d628da0cbe78ac3a6d854ffd92fe5c494b3b3b3");var eT=X("8dd3c7ffffb3bebadafb807280b1d3fdb462b3de69fccde5d9d9d9bc80bdccebc5ffed6f");var nT=X("4e79a7f28e2ce1575976b7b259a14fedc949af7aa1ff9da79c755fbab0ab");var ht=e=>QS(e[e.length-1]);var Lb=new Array(3).concat("d8b365f5f5f55ab4ac","a6611adfc27d80cdc1018571","a6611adfc27df5f5f580cdc1018571","8c510ad8b365f6e8c3c7eae55ab4ac01665e","8c510ad8b365f6e8c3f5f5f5c7eae55ab4ac01665e","8c510abf812ddfc27df6e8c3c7eae580cdc135978f01665e","8c510abf812ddfc27df6e8c3f5f5f5c7eae580cdc135978f01665e","5430058c510abf812ddfc27df6e8c3c7eae580cdc135978f01665e003c30","5430058c510abf812ddfc27df6e8c3f5f5f5c7eae580cdc135978f01665e003c30").map(X),kb=ht(Lb);var Cb=new Array(3).concat("af8dc3f7f7f77fbf7b","7b3294c2a5cfa6dba0008837","7b3294c2a5cff7f7f7a6dba0008837","762a83af8dc3e7d4e8d9f0d37fbf7b1b7837","762a83af8dc3e7d4e8f7f7f7d9f0d37fbf7b1b7837","762a839970abc2a5cfe7d4e8d9f0d3a6dba05aae611b7837","762a839970abc2a5cfe7d4e8f7f7f7d9f0d3a6dba05aae611b7837","40004b762a839970abc2a5cfe7d4e8d9f0d3a6dba05aae611b783700441b","40004b762a839970abc2a5cfe7d4e8f7f7f7d9f0d3a6dba05aae611b783700441b").map(X),Fb=ht(Cb);var Rb=new Array(3).concat("e9a3c9f7f7f7a1d76a","d01c8bf1b6dab8e1864dac26","d01c8bf1b6daf7f7f7b8e1864dac26","c51b7de9a3c9fde0efe6f5d0a1d76a4d9221","c51b7de9a3c9fde0eff7f7f7e6f5d0a1d76a4d9221","c51b7dde77aef1b6dafde0efe6f5d0b8e1867fbc414d9221","c51b7dde77aef1b6dafde0eff7f7f7e6f5d0b8e1867fbc414d9221","8e0152c51b7dde77aef1b6dafde0efe6f5d0b8e1867fbc414d9221276419","8e0152c51b7dde77aef1b6dafde0eff7f7f7e6f5d0b8e1867fbc414d9221276419").map(X),$b=ht(Rb);var Pb=new Array(3).concat("998ec3f7f7f7f1a340","5e3c99b2abd2fdb863e66101","5e3c99b2abd2f7f7f7fdb863e66101","542788998ec3d8daebfee0b6f1a340b35806","542788998ec3d8daebf7f7f7fee0b6f1a340b35806","5427888073acb2abd2d8daebfee0b6fdb863e08214b35806","5427888073acb2abd2d8daebf7f7f7fee0b6fdb863e08214b35806","2d004b5427888073acb2abd2d8daebfee0b6fdb863e08214b358067f3b08","2d004b5427888073acb2abd2d8daebf7f7f7fee0b6fdb863e08214b358067f3b08").map(X),Ub=ht(Pb);var dm=new Array(3).concat("ef8a62f7f7f767a9cf","ca0020f4a58292c5de0571b0","ca0020f4a582f7f7f792c5de0571b0","b2182bef8a62fddbc7d1e5f067a9cf2166ac","b2182bef8a62fddbc7f7f7f7d1e5f067a9cf2166ac","b2182bd6604df4a582fddbc7d1e5f092c5de4393c32166ac","b2182bd6604df4a582fddbc7f7f7f7d1e5f092c5de4393c32166ac","67001fb2182bd6604df4a582fddbc7d1e5f092c5de4393c32166ac053061","67001fb2182bd6604df4a582fddbc7f7f7f7d1e5f092c5de4393c32166ac053061").map(X),cf=ht(dm);var zb=new Array(3).concat("ef8a62ffffff999999","ca0020f4a582bababa404040","ca0020f4a582ffffffbababa404040","b2182bef8a62fddbc7e0e0e09999994d4d4d","b2182bef8a62fddbc7ffffffe0e0e09999994d4d4d","b2182bd6604df4a582fddbc7e0e0e0bababa8787874d4d4d","b2182bd6604df4a582fddbc7ffffffe0e0e0bababa8787874d4d4d","67001fb2182bd6604df4a582fddbc7e0e0e0bababa8787874d4d4d1a1a1a","67001fb2182bd6604df4a582fddbc7ffffffe0e0e0bababa8787874d4d4d1a1a1a").map(X),jb=ht(zb);var hm=new Array(3).concat("fc8d59ffffbf91bfdb","d7191cfdae61abd9e92c7bb6","d7191cfdae61ffffbfabd9e92c7bb6","d73027fc8d59fee090e0f3f891bfdb4575b4","d73027fc8d59fee090ffffbfe0f3f891bfdb4575b4","d73027f46d43fdae61fee090e0f3f8abd9e974add14575b4","d73027f46d43fdae61fee090ffffbfe0f3f8abd9e974add14575b4","a50026d73027f46d43fdae61fee090e0f3f8abd9e974add14575b4313695","a50026d73027f46d43fdae61fee090ffffbfe0f3f8abd9e974add14575b4313695").map(X),lf=ht(hm);var qb=new Array(3).concat("fc8d59ffffbf91cf60","d7191cfdae61a6d96a1a9641","d7191cfdae61ffffbfa6d96a1a9641","d73027fc8d59fee08bd9ef8b91cf601a9850","d73027fc8d59fee08bffffbfd9ef8b91cf601a9850","d73027f46d43fdae61fee08bd9ef8ba6d96a66bd631a9850","d73027f46d43fdae61fee08bffffbfd9ef8ba6d96a66bd631a9850","a50026d73027f46d43fdae61fee08bd9ef8ba6d96a66bd631a9850006837","a50026d73027f46d43fdae61fee08bffffbfd9ef8ba6d96a66bd631a9850006837").map(X),Vb=ht(qb);var Yb=new Array(3).concat("fc8d59ffffbf99d594","d7191cfdae61abdda42b83ba","d7191cfdae61ffffbfabdda42b83ba","d53e4ffc8d59fee08be6f59899d5943288bd","d53e4ffc8d59fee08bffffbfe6f59899d5943288bd","d53e4ff46d43fdae61fee08be6f598abdda466c2a53288bd","d53e4ff46d43fdae61fee08bffffbfe6f598abdda466c2a53288bd","9e0142d53e4ff46d43fdae61fee08be6f598abdda466c2a53288bd5e4fa2","9e0142d53e4ff46d43fdae61fee08bffffbfe6f598abdda466c2a53288bd5e4fa2").map(X),Xb=ht(Yb);var Gb=new Array(3).concat("e5f5f999d8c92ca25f","edf8fbb2e2e266c2a4238b45","edf8fbb2e2e266c2a42ca25f006d2c","edf8fbccece699d8c966c2a42ca25f006d2c","edf8fbccece699d8c966c2a441ae76238b45005824","f7fcfde5f5f9ccece699d8c966c2a441ae76238b45005824","f7fcfde5f5f9ccece699d8c966c2a441ae76238b45006d2c00441b").map(X),Wb=ht(Gb);var Hb=new Array(3).concat("e0ecf49ebcda8856a7","edf8fbb3cde38c96c688419d","edf8fbb3cde38c96c68856a7810f7c","edf8fbbfd3e69ebcda8c96c68856a7810f7c","edf8fbbfd3e69ebcda8c96c68c6bb188419d6e016b","f7fcfde0ecf4bfd3e69ebcda8c96c68c6bb188419d6e016b","f7fcfde0ecf4bfd3e69ebcda8c96c68c6bb188419d810f7c4d004b").map(X),Zb=ht(Hb);var Jb=new Array(3).concat("e0f3dba8ddb543a2ca","f0f9e8bae4bc7bccc42b8cbe","f0f9e8bae4bc7bccc443a2ca0868ac","f0f9e8ccebc5a8ddb57bccc443a2ca0868ac","f0f9e8ccebc5a8ddb57bccc44eb3d32b8cbe08589e","f7fcf0e0f3dbccebc5a8ddb57bccc44eb3d32b8cbe08589e","f7fcf0e0f3dbccebc5a8ddb57bccc44eb3d32b8cbe0868ac084081").map(X),Qb=ht(Jb);var Kb=new Array(3).concat("fee8c8fdbb84e34a33","fef0d9fdcc8afc8d59d7301f","fef0d9fdcc8afc8d59e34a33b30000","fef0d9fdd49efdbb84fc8d59e34a33b30000","fef0d9fdd49efdbb84fc8d59ef6548d7301f990000","fff7ecfee8c8fdd49efdbb84fc8d59ef6548d7301f990000","fff7ecfee8c8fdd49efdbb84fc8d59ef6548d7301fb300007f0000").map(X),t1=ht(Kb);var e1=new Array(3).concat("ece2f0a6bddb1c9099","f6eff7bdc9e167a9cf02818a","f6eff7bdc9e167a9cf1c9099016c59","f6eff7d0d1e6a6bddb67a9cf1c9099016c59","f6eff7d0d1e6a6bddb67a9cf3690c002818a016450","fff7fbece2f0d0d1e6a6bddb67a9cf3690c002818a016450","fff7fbece2f0d0d1e6a6bddb67a9cf3690c002818a016c59014636").map(X),n1=ht(e1);var r1=new Array(3).concat("ece7f2a6bddb2b8cbe","f1eef6bdc9e174a9cf0570b0","f1eef6bdc9e174a9cf2b8cbe045a8d","f1eef6d0d1e6a6bddb74a9cf2b8cbe045a8d","f1eef6d0d1e6a6bddb74a9cf3690c00570b0034e7b","fff7fbece7f2d0d1e6a6bddb74a9cf3690c00570b0034e7b","fff7fbece7f2d0d1e6a6bddb74a9cf3690c00570b0045a8d023858").map(X),i1=ht(r1);var o1=new Array(3).concat("e7e1efc994c7dd1c77","f1eef6d7b5d8df65b0ce1256","f1eef6d7b5d8df65b0dd1c77980043","f1eef6d4b9dac994c7df65b0dd1c77980043","f1eef6d4b9dac994c7df65b0e7298ace125691003f","f7f4f9e7e1efd4b9dac994c7df65b0e7298ace125691003f","f7f4f9e7e1efd4b9dac994c7df65b0e7298ace125698004367001f").map(X),s1=ht(o1);var a1=new Array(3).concat("fde0ddfa9fb5c51b8a","feebe2fbb4b9f768a1ae017e","feebe2fbb4b9f768a1c51b8a7a0177","feebe2fcc5c0fa9fb5f768a1c51b8a7a0177","feebe2fcc5c0fa9fb5f768a1dd3497ae017e7a0177","fff7f3fde0ddfcc5c0fa9fb5f768a1dd3497ae017e7a0177","fff7f3fde0ddfcc5c0fa9fb5f768a1dd3497ae017e7a017749006a").map(X),c1=ht(a1);var l1=new Array(3).concat("edf8b17fcdbb2c7fb8","ffffcca1dab441b6c4225ea8","ffffcca1dab441b6c42c7fb8253494","ffffccc7e9b47fcdbb41b6c42c7fb8253494","ffffccc7e9b47fcdbb41b6c41d91c0225ea80c2c84","ffffd9edf8b1c7e9b47fcdbb41b6c41d91c0225ea80c2c84","ffffd9edf8b1c7e9b47fcdbb41b6c41d91c0225ea8253494081d58").map(X),u1=ht(l1);var f1=new Array(3).concat("f7fcb9addd8e31a354","ffffccc2e69978c679238443","ffffccc2e69978c67931a354006837","ffffccd9f0a3addd8e78c67931a354006837","ffffccd9f0a3addd8e78c67941ab5d238443005a32","ffffe5f7fcb9d9f0a3addd8e78c67941ab5d238443005a32","ffffe5f7fcb9d9f0a3addd8e78c67941ab5d238443006837004529").map(X),d1=ht(f1);var h1=new Array(3).concat("fff7bcfec44fd95f0e","ffffd4fed98efe9929cc4c02","ffffd4fed98efe9929d95f0e993404","ffffd4fee391fec44ffe9929d95f0e993404","ffffd4fee391fec44ffe9929ec7014cc4c028c2d04","ffffe5fff7bcfee391fec44ffe9929ec7014cc4c028c2d04","ffffe5fff7bcfee391fec44ffe9929ec7014cc4c02993404662506").map(X),p1=ht(h1);var m1=new Array(3).concat("ffeda0feb24cf03b20","ffffb2fecc5cfd8d3ce31a1c","ffffb2fecc5cfd8d3cf03b20bd0026","ffffb2fed976feb24cfd8d3cf03b20bd0026","ffffb2fed976feb24cfd8d3cfc4e2ae31a1cb10026","ffffccffeda0fed976feb24cfd8d3cfc4e2ae31a1cb10026","ffffccffeda0fed976feb24cfd8d3cfc4e2ae31a1cbd0026800026").map(X),y1=ht(m1);var g1=new Array(3).concat("deebf79ecae13182bd","eff3ffbdd7e76baed62171b5","eff3ffbdd7e76baed63182bd08519c","eff3ffc6dbef9ecae16baed63182bd08519c","eff3ffc6dbef9ecae16baed64292c62171b5084594","f7fbffdeebf7c6dbef9ecae16baed64292c62171b5084594","f7fbffdeebf7c6dbef9ecae16baed64292c62171b508519c08306b").map(X),x1=ht(g1);var b1=new Array(3).concat("e5f5e0a1d99b31a354","edf8e9bae4b374c476238b45","edf8e9bae4b374c47631a354006d2c","edf8e9c7e9c0a1d99b74c47631a354006d2c","edf8e9c7e9c0a1d99b74c47641ab5d238b45005a32","f7fcf5e5f5e0c7e9c0a1d99b74c47641ab5d238b45005a32","f7fcf5e5f5e0c7e9c0a1d99b74c47641ab5d238b45006d2c00441b").map(X),w1=ht(b1);var v1=new Array(3).concat("f0f0f0bdbdbd636363","f7f7f7cccccc969696525252","f7f7f7cccccc969696636363252525","f7f7f7d9d9d9bdbdbd969696636363252525","f7f7f7d9d9d9bdbdbd969696737373525252252525","fffffff0f0f0d9d9d9bdbdbd969696737373525252252525","fffffff0f0f0d9d9d9bdbdbd969696737373525252252525000000").map(X),_1=ht(v1);var S1=new Array(3).concat("efedf5bcbddc756bb1","f2f0f7cbc9e29e9ac86a51a3","f2f0f7cbc9e29e9ac8756bb154278f","f2f0f7dadaebbcbddc9e9ac8756bb154278f","f2f0f7dadaebbcbddc9e9ac8807dba6a51a34a1486","fcfbfdefedf5dadaebbcbddc9e9ac8807dba6a51a34a1486","fcfbfdefedf5dadaebbcbddc9e9ac8807dba6a51a354278f3f007d").map(X),I1=ht(S1);var M1=new Array(3).concat("fee0d2fc9272de2d26","fee5d9fcae91fb6a4acb181d","fee5d9fcae91fb6a4ade2d26a50f15","fee5d9fcbba1fc9272fb6a4ade2d26a50f15","fee5d9fcbba1fc9272fb6a4aef3b2ccb181d99000d","fff5f0fee0d2fcbba1fc9272fb6a4aef3b2ccb181d99000d","fff5f0fee0d2fcbba1fc9272fb6a4aef3b2ccb181da50f1567000d").map(X),T1=ht(M1);var A1=new Array(3).concat("fee6cefdae6be6550d","feeddefdbe85fd8d3cd94701","feeddefdbe85fd8d3ce6550da63603","feeddefdd0a2fdae6bfd8d3ce6550da63603","feeddefdd0a2fdae6bfd8d3cf16913d948018c2d04","fff5ebfee6cefdd0a2fdae6bfd8d3cf16913d948018c2d04","fff5ebfee6cefdd0a2fdae6bfd8d3cf16913d94801a636037f2704").map(X),E1=ht(A1);function N1(e){return e=Math.max(0,Math.min(1,e)),"rgb("+Math.max(0,Math.min(255,Math.round(-4.54-e*(35.34-e*(2381.73-e*(6402.7-e*(7024.72-e*2710.57)))))))+", "+Math.max(0,Math.min(255,Math.round(32.49+e*(170.73+e*(52.82-e*(131.46-e*(176.58-e*67.37)))))))+", "+Math.max(0,Math.min(255,Math.round(81.24+e*(442.36-e*(2482.43-e*(6167.24-e*(6614.94-e*2475.67)))))))+")"}var D1=Fu(Wn(300,.5,0),Wn(-240,.5,1));var B1=Fu(Wn(-100,.75,.35),Wn(80,1.5,.8)),L1=Fu(Wn(260,.75,.35),Wn(80,1.5,.8)),O1=Wn();function k1(e){(e<0||e>1)&&(e-=Math.floor(e));var t=Math.abs(e-.5);return O1.h=360*e-100,O1.s=1.5-1.5*t,O1.l=.8-.9*t,O1+""}var C1=on(),WH=Math.PI/3,HH=Math.PI*2/3;function F1(e){var t;return e=(.5-e)*Math.PI,C1.r=255*(t=Math.sin(e))*t,C1.g=255*(t=Math.sin(e+WH))*t,C1.b=255*(t=Math.sin(e+HH))*t,C1+""}function R1(e){return e=Math.max(0,Math.min(1,e)),"rgb("+Math.max(0,Math.min(255,Math.round(34.61+e*(1172.33-e*(10793.56-e*(33300.12-e*(38394.49-e*14825.05)))))))+", "+Math.max(0,Math.min(255,Math.round(23.31+e*(557.33+e*(1225.33-e*(3574.96-e*(1073.77+e*707.56)))))))+", "+Math.max(0,Math.min(255,Math.round(27.2+e*(3211.1-e*(15327.97-e*(27814-e*(22569.18-e*6838.66)))))))+")"}function $1(e){var t=e.length;return function(n){return e[Math.max(0,Math.min(t-1,Math.floor(n*t)))]}}var P1=$1(X("44015444025645045745055946075a46085c460a5d460b5e470d60470e6147106347116447136548146748166848176948186a481a6c481b6d481c6e481d6f481f70482071482173482374482475482576482677482878482979472a7a472c7a472d7b472e7c472f7d46307e46327e46337f463480453581453781453882443983443a83443b84433d84433e85423f854240864241864142874144874045884046883f47883f48893e49893e4a893e4c8a3d4d8a3d4e8a3c4f8a3c508b3b518b3b528b3a538b3a548c39558c39568c38588c38598c375a8c375b8d365c8d365d8d355e8d355f8d34608d34618d33628d33638d32648e32658e31668e31678e31688e30698e306a8e2f6b8e2f6c8e2e6d8e2e6e8e2e6f8e2d708e2d718e2c718e2c728e2c738e2b748e2b758e2a768e2a778e2a788e29798e297a8e297b8e287c8e287d8e277e8e277f8e27808e26818e26828e26828e25838e25848e25858e24868e24878e23888e23898e238a8d228b8d228c8d228d8d218e8d218f8d21908d21918c20928c20928c20938c1f948c1f958b1f968b1f978b1f988b1f998a1f9a8a1e9b8a1e9c891e9d891f9e891f9f881fa0881fa1881fa1871fa28720a38620a48621a58521a68522a78522a88423a98324aa8325ab8225ac8226ad8127ad8128ae8029af7f2ab07f2cb17e2db27d2eb37c2fb47c31b57b32b67a34b67935b77937b87838b9773aba763bbb753dbc743fbc7340bd7242be7144bf7046c06f48c16e4ac16d4cc26c4ec36b50c46a52c56954c56856c66758c7655ac8645cc8635ec96260ca6063cb5f65cb5e67cc5c69cd5b6ccd5a6ece5870cf5773d05675d05477d1537ad1517cd2507fd34e81d34d84d44b86d54989d5488bd6468ed64590d74393d74195d84098d83e9bd93c9dd93ba0da39a2da37a5db36a8db34aadc32addc30b0dd2fb2dd2db5de2bb8de29bade28bddf26c0df25c2df23c5e021c8e020cae11fcde11dd0e11cd2e21bd5e21ad8e219dae319dde318dfe318e2e418e5e419e7e419eae51aece51befe51cf1e51df4e61ef6e620f8e621fbe723fde725")),U1=$1(X("00000401000501010601010802010902020b02020d03030f03031204041405041606051806051a07061c08071e0907200a08220b09240c09260d0a290e0b2b100b2d110c2f120d31130d34140e36150e38160f3b180f3d19103f1a10421c10441d11471e114920114b21114e22115024125325125527125829115a2a115c2c115f2d11612f116331116533106734106936106b38106c390f6e3b0f703d0f713f0f72400f74420f75440f764510774710784910784a10794c117a4e117b4f127b51127c52137c54137d56147d57157e59157e5a167e5c167f5d177f5f187f601880621980641a80651a80671b80681c816a1c816b1d816d1d816e1e81701f81721f817320817521817621817822817922827b23827c23827e24828025828125818326818426818627818827818928818b29818c29818e2a81902a81912b81932b80942c80962c80982d80992d809b2e7f9c2e7f9e2f7fa02f7fa1307ea3307ea5317ea6317da8327daa337dab337cad347cae347bb0357bb2357bb3367ab5367ab73779b83779ba3878bc3978bd3977bf3a77c03a76c23b75c43c75c53c74c73d73c83e73ca3e72cc3f71cd4071cf4070d0416fd2426fd3436ed5446dd6456cd8456cd9466bdb476adc4869de4968df4a68e04c67e24d66e34e65e44f64e55064e75263e85362e95462ea5661eb5760ec5860ed5a5fee5b5eef5d5ef05f5ef1605df2625df2645cf3655cf4675cf4695cf56b5cf66c5cf66e5cf7705cf7725cf8745cf8765cf9785df9795df97b5dfa7d5efa7f5efa815ffb835ffb8560fb8761fc8961fc8a62fc8c63fc8e64fc9065fd9266fd9467fd9668fd9869fd9a6afd9b6bfe9d6cfe9f6dfea16efea36ffea571fea772fea973feaa74feac76feae77feb078feb27afeb47bfeb67cfeb77efeb97ffebb81febd82febf84fec185fec287fec488fec68afec88cfeca8dfecc8ffecd90fecf92fed194fed395fed597fed799fed89afdda9cfddc9efddea0fde0a1fde2a3fde3a5fde5a7fde7a9fde9aafdebacfcecaefceeb0fcf0b2fcf2b4fcf4b6fcf6b8fcf7b9fcf9bbfcfbbdfcfdbf")),z1=$1(X("00000401000501010601010802010a02020c02020e03021004031204031405041706041907051b08051d09061f0a07220b07240c08260d08290e092b10092d110a30120a32140b34150b37160b39180c3c190c3e1b0c411c0c431e0c451f0c48210c4a230c4c240c4f260c51280b53290b552b0b572d0b592f0a5b310a5c320a5e340a5f3609613809623909633b09643d09653e0966400a67420a68440a68450a69470b6a490b6a4a0c6b4c0c6b4d0d6c4f0d6c510e6c520e6d540f6d550f6d57106e59106e5a116e5c126e5d126e5f136e61136e62146e64156e65156e67166e69166e6a176e6c186e6d186e6f196e71196e721a6e741a6e751b6e771c6d781c6d7a1d6d7c1d6d7d1e6d7f1e6c801f6c82206c84206b85216b87216b88226a8a226a8c23698d23698f24699025689225689326679526679727669827669a28659b29649d29649f2a63a02a63a22b62a32c61a52c60a62d60a82e5fa92e5eab2f5ead305dae305cb0315bb1325ab3325ab43359b63458b73557b93556ba3655bc3754bd3853bf3952c03a51c13a50c33b4fc43c4ec63d4dc73e4cc83f4bca404acb4149cc4248ce4347cf4446d04545d24644d34743d44842d54a41d74b3fd84c3ed94d3dda4e3cdb503bdd513ade5238df5337e05536e15635e25734e35933e45a31e55c30e65d2fe75e2ee8602de9612bea632aeb6429eb6628ec6726ed6925ee6a24ef6c23ef6e21f06f20f1711ff1731df2741cf3761bf37819f47918f57b17f57d15f67e14f68013f78212f78410f8850ff8870ef8890cf98b0bf98c0af98e09fa9008fa9207fa9407fb9606fb9706fb9906fb9b06fb9d07fc9f07fca108fca309fca50afca60cfca80dfcaa0ffcac11fcae12fcb014fcb216fcb418fbb61afbb81dfbba1ffbbc21fbbe23fac026fac228fac42afac62df9c72ff9c932f9cb35f8cd37f8cf3af7d13df7d340f6d543f6d746f5d949f5db4cf4dd4ff4df53f4e156f3e35af3e55df2e661f2e865f2ea69f1ec6df1ed71f1ef75f1f179f2f27df2f482f3f586f3f68af4f88ef5f992f6fa96f8fb9af9fc9dfafda1fcffa4")),j1=$1(X("0d088710078813078916078a19068c1b068d1d068e20068f2206902406912605912805922a05932c05942e05952f059631059733059735049837049938049a3a049a3c049b3e049c3f049c41049d43039e44039e46039f48039f4903a04b03a14c02a14e02a25002a25102a35302a35502a45601a45801a45901a55b01a55c01a65e01a66001a66100a76300a76400a76600a76700a86900a86a00a86c00a86e00a86f00a87100a87201a87401a87501a87701a87801a87a02a87b02a87d03a87e03a88004a88104a78305a78405a78606a68707a68808a68a09a58b0aa58d0ba58e0ca48f0da4910ea3920fa39410a29511a19613a19814a099159f9a169f9c179e9d189d9e199da01a9ca11b9ba21d9aa31e9aa51f99a62098a72197a82296aa2395ab2494ac2694ad2793ae2892b02991b12a90b22b8fb32c8eb42e8db52f8cb6308bb7318ab83289ba3388bb3488bc3587bd3786be3885bf3984c03a83c13b82c23c81c33d80c43e7fc5407ec6417dc7427cc8437bc9447aca457acb4679cc4778cc4977cd4a76ce4b75cf4c74d04d73d14e72d24f71d35171d45270d5536fd5546ed6556dd7566cd8576bd9586ada5a6ada5b69db5c68dc5d67dd5e66de5f65de6164df6263e06363e16462e26561e26660e3685fe4695ee56a5de56b5de66c5ce76e5be76f5ae87059e97158e97257ea7457eb7556eb7655ec7754ed7953ed7a52ee7b51ef7c51ef7e50f07f4ff0804ef1814df1834cf2844bf3854bf3874af48849f48948f58b47f58c46f68d45f68f44f79044f79143f79342f89441f89540f9973ff9983ef99a3efa9b3dfa9c3cfa9e3bfb9f3afba139fba238fca338fca537fca636fca835fca934fdab33fdac33fdae32fdaf31fdb130fdb22ffdb42ffdb52efeb72dfeb82cfeba2cfebb2bfebd2afebe2afec029fdc229fdc328fdc527fdc627fdc827fdca26fdcb26fccd25fcce25fcd025fcd225fbd324fbd524fbd724fad824fada24f9dc24f9dd25f8df25f8e125f7e225f7e425f6e626f6e826f5e926f5eb27f4ed27f3ee27f3f027f2f227f1f426f1f525f0f724f0f921"));function Ze(e){return function(){return e}}var rT=Math.cos;var uf=Math.min,pm=Math.sin,ee=Math.sqrt,iT=1e-12,bl=Math.PI,E8t=bl/2,ff=2*bl;function q1(e){let t=3;return e.digits=function(n){if(!arguments.length)return t;if(n==null)t=null;else{let r=Math.floor(n);if(!(r>=0))throw new RangeError(`invalid digits: ${n}`);t=r}return e},()=>new Ca(t)}var B8t=Array.prototype.slice;function V1(e){return typeof e=="object"&&"length"in e?e:Array.from(e)}function FC(e){this._context=e}FC.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._point=0},lineEnd:function(){(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;default:this._context.lineTo(e,t);break}}};function Vs(e){return new FC(e)}function Y1(e){return e[0]}function X1(e){return e[1]}function mm(e,t){var n=Ze(!0),r=null,i=Vs,o=null,s=q1(a);e=typeof e=="function"?e:e===void 0?Y1:Ze(e),t=typeof t=="function"?t:t===void 0?X1:Ze(t);function a(c){var l,u=(c=V1(c)).length,f,d=!1,h;for(r==null&&(o=i(h=s())),l=0;l<=u;++l)!(l<u&&n(f=c[l],l,c))===d&&((d=!d)?o.lineStart():o.lineEnd()),d&&o.point(+e(f,l,c),+t(f,l,c));if(h)return o=null,h+""||null}return a.x=function(c){return arguments.length?(e=typeof c=="function"?c:Ze(+c),a):e},a.y=function(c){return arguments.length?(t=typeof c=="function"?c:Ze(+c),a):t},a.defined=function(c){return arguments.length?(n=typeof c=="function"?c:Ze(!!c),a):n},a.curve=function(c){return arguments.length?(i=c,r!=null&&(o=i(r)),a):i},a.context=function(c){return arguments.length?(c==null?r=o=null:o=i(r=c),a):r},a}function df(e,t,n){var r=null,i=Ze(!0),o=null,s=Vs,a=null,c=q1(l);e=typeof e=="function"?e:e===void 0?Y1:Ze(+e),t=typeof t=="function"?t:t===void 0?Ze(0):Ze(+t),n=typeof n=="function"?n:n===void 0?X1:Ze(+n);function l(f){var d,h,p,m=(f=V1(f)).length,g,y=!1,x,b=new Array(m),w=new Array(m);for(o==null&&(a=s(x=c())),d=0;d<=m;++d){if(!(d<m&&i(g=f[d],d,f))===y)if(y=!y)h=d,a.areaStart(),a.lineStart();else{for(a.lineEnd(),a.lineStart(),p=d-1;p>=h;--p)a.point(b[p],w[p]);a.lineEnd(),a.areaEnd()}y&&(b[d]=+e(g,d,f),w[d]=+t(g,d,f),a.point(r?+r(g,d,f):b[d],n?+n(g,d,f):w[d]))}if(x)return a=null,x+""||null}function u(){return mm().defined(i).curve(s).context(o)}return l.x=function(f){return arguments.length?(e=typeof f=="function"?f:Ze(+f),r=null,l):e},l.x0=function(f){return arguments.length?(e=typeof f=="function"?f:Ze(+f),l):e},l.x1=function(f){return arguments.length?(r=f==null?null:typeof f=="function"?f:Ze(+f),l):r},l.y=function(f){return arguments.length?(t=typeof f=="function"?f:Ze(+f),n=null,l):t},l.y0=function(f){return arguments.length?(t=typeof f=="function"?f:Ze(+f),l):t},l.y1=function(f){return arguments.length?(n=f==null?null:typeof f=="function"?f:Ze(+f),l):n},l.lineX0=l.lineY0=function(){return u().x(e).y(t)},l.lineY1=function(){return u().x(e).y(n)},l.lineX1=function(){return u().x(r).y(t)},l.defined=function(f){return arguments.length?(i=typeof f=="function"?f:Ze(!!f),l):i},l.curve=function(f){return arguments.length?(s=f,o!=null&&(a=s(o)),l):s},l.context=function(f){return arguments.length?(f==null?o=a=null:a=s(o=f),l):o},l}var G1=class{constructor(t,n){this._context=t,this._x=n}areaStart(){this._line=0}areaEnd(){this._line=NaN}lineStart(){this._point=0}lineEnd(){(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line}point(t,n){switch(t=+t,n=+n,this._point){case 0:{this._point=1,this._line?this._context.lineTo(t,n):this._context.moveTo(t,n);break}case 1:this._point=2;default:{this._x?this._context.bezierCurveTo(this._x0=(this._x0+t)/2,this._y0,this._x0,n,t,n):this._context.bezierCurveTo(this._x0,this._y0=(this._y0+n)/2,t,this._y0,t,n);break}}this._x0=t,this._y0=n}};function oT(e){return new G1(e,!0)}function sT(e){return new G1(e,!1)}var ZH=ee(3),ym={draw(e,t){let n=ee(t+uf(t/28,.75))*.59436,r=n/2,i=r*ZH;e.moveTo(0,n),e.lineTo(0,-n),e.moveTo(-i,-r),e.lineTo(i,r),e.moveTo(-i,r),e.lineTo(i,-r)}};var Ys={draw(e,t){let n=ee(t/bl);e.moveTo(n,0),e.arc(0,0,n,0,ff)}};var gm={draw(e,t){let n=ee(t/5)/2;e.moveTo(-3*n,-n),e.lineTo(-n,-n),e.lineTo(-n,-3*n),e.lineTo(n,-3*n),e.lineTo(n,-n),e.lineTo(3*n,-n),e.lineTo(3*n,n),e.lineTo(n,n),e.lineTo(n,3*n),e.lineTo(-n,3*n),e.lineTo(-n,n),e.lineTo(-3*n,n),e.closePath()}};var RC=ee(1/3),JH=RC*2,xm={draw(e,t){let n=ee(t/JH),r=n*RC;e.moveTo(0,-n),e.lineTo(r,0),e.lineTo(0,n),e.lineTo(-r,0),e.closePath()}};var bm={draw(e,t){let n=ee(t)*.62625;e.moveTo(0,-n),e.lineTo(n,0),e.lineTo(0,n),e.lineTo(-n,0),e.closePath()}};var wm={draw(e,t){let n=ee(t-uf(t/7,2))*.87559;e.moveTo(-n,0),e.lineTo(n,0),e.moveTo(0,n),e.lineTo(0,-n)}};var vm={draw(e,t){let n=ee(t),r=-n/2;e.rect(r,r,n,n)}};var _m={draw(e,t){let n=ee(t)*.4431;e.moveTo(n,n),e.lineTo(n,-n),e.lineTo(-n,-n),e.lineTo(-n,n),e.closePath()}};var QH=.8908130915292852,$C=pm(bl/10)/pm(7*bl/10),KH=pm(ff/10)*$C,tZ=-rT(ff/10)*$C,Sm={draw(e,t){let n=ee(t*QH),r=KH*n,i=tZ*n;e.moveTo(0,-n),e.lineTo(r,i);for(let o=1;o<5;++o){let s=ff*o/5,a=rT(s),c=pm(s);e.lineTo(c*n,-a*n),e.lineTo(a*r-c*i,c*r+a*i)}e.closePath()}};var aT=ee(3),Im={draw(e,t){let n=-ee(t/(aT*3));e.moveTo(0,n*2),e.lineTo(-aT*n,-n),e.lineTo(aT*n,-n),e.closePath()}};var eZ=ee(3),Mm={draw(e,t){let n=ee(t)*.6824,r=n/2,i=n*eZ/2;e.moveTo(0,-n),e.lineTo(i,r),e.lineTo(-i,r),e.closePath()}};var fi=-.5,di=ee(3)/2,cT=1/ee(12),nZ=(cT/2+1)*3,Tm={draw(e,t){let n=ee(t/nZ),r=n/2,i=n*cT,o=r,s=n*cT+n,a=-o,c=s;e.moveTo(r,i),e.lineTo(o,s),e.lineTo(a,c),e.lineTo(fi*r-di*i,di*r+fi*i),e.lineTo(fi*o-di*s,di*o+fi*s),e.lineTo(fi*a-di*c,di*a+fi*c),e.lineTo(fi*r+di*i,fi*i-di*r),e.lineTo(fi*o+di*s,fi*s-di*o),e.lineTo(fi*a+di*c,fi*c-di*a),e.closePath()}};var hf={draw(e,t){let n=ee(t-uf(t/6,1.7))*.6189;e.moveTo(-n,-n),e.lineTo(n,n),e.moveTo(-n,n),e.lineTo(n,-n)}};var W1=[Ys,gm,xm,vm,Sm,Im,Tm],lT=[Ys,wm,hf,Mm,ym,_m,bm];function hi(){}function pf(e,t,n){e._context.bezierCurveTo((2*e._x0+e._x1)/3,(2*e._y0+e._y1)/3,(e._x0+2*e._x1)/3,(e._y0+2*e._y1)/3,(e._x0+4*e._x1+t)/6,(e._y0+4*e._y1+n)/6)}function Am(e){this._context=e}Am.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:pf(this,this._x1,this._y1);case 2:this._context.lineTo(this._x1,this._y1);break}(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);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:pf(this,e,t);break}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t}};function uT(e){return new Am(e)}function PC(e){this._context=e}PC.prototype={areaStart:hi,areaEnd:hi,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);break}}},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._x2=e,this._y2=t;break;case 1:this._point=2,this._x3=e,this._y3=t;break;case 2:this._point=3,this._x4=e,this._y4=t,this._context.moveTo((this._x0+4*this._x1+e)/6,(this._y0+4*this._y1+t)/6);break;default:pf(this,e,t);break}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t}};function fT(e){return new PC(e)}function UC(e){this._context=e}UC.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||this._line!==0&&this._point===3)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){switch(e=+e,t=+t,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+e)/6,r=(this._y0+4*this._y1+t)/6;this._line?this._context.lineTo(n,r):this._context.moveTo(n,r);break;case 3:this._point=4;default:pf(this,e,t);break}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t}};function dT(e){return new UC(e)}function zC(e,t){this._basis=new Am(e),this._beta=t}zC.prototype={lineStart:function(){this._x=[],this._y=[],this._basis.lineStart()},lineEnd:function(){var e=this._x,t=this._y,n=e.length-1;if(n>0)for(var r=e[0],i=t[0],o=e[n]-r,s=t[n]-i,a=-1,c;++a<=n;)c=a/n,this._basis.point(this._beta*e[a]+(1-this._beta)*(r+c*o),this._beta*t[a]+(1-this._beta)*(i+c*s));this._x=this._y=null,this._basis.lineEnd()},point:function(e,t){this._x.push(+e),this._y.push(+t)}};var hT=function e(t){function n(r){return t===1?new Am(r):new zC(r,t)}return n.beta=function(r){return e(+r)},n}(.85);function mf(e,t,n){e._context.bezierCurveTo(e._x1+e._k*(e._x2-e._x0),e._y1+e._k*(e._y2-e._y0),e._x2+e._k*(e._x1-t),e._y2+e._k*(e._y1-n),e._x2,e._y2)}function H1(e,t){this._context=e,this._k=(1-t)/6}H1.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:mf(this,this._x1,this._y1);break}(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2,this._x1=e,this._y1=t;break;case 2:this._point=3;default:mf(this,e,t);break}this._x0=this._x1,this._x1=this._x2,this._x2=e,this._y0=this._y1,this._y1=this._y2,this._y2=t}};var pT=function e(t){function n(r){return new H1(r,t)}return n.tension=function(r){return e(+r)},n}(0);function Z1(e,t){this._context=e,this._k=(1-t)/6}Z1.prototype={areaStart:hi,areaEnd:hi,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);break}}},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._x3=e,this._y3=t;break;case 1:this._point=2,this._context.moveTo(this._x4=e,this._y4=t);break;case 2:this._point=3,this._x5=e,this._y5=t;break;default:mf(this,e,t);break}this._x0=this._x1,this._x1=this._x2,this._x2=e,this._y0=this._y1,this._y1=this._y2,this._y2=t}};var mT=function e(t){function n(r){return new Z1(r,t)}return n.tension=function(r){return e(+r)},n}(0);function J1(e,t){this._context=e,this._k=(1-t)/6}J1.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||this._line!==0&&this._point===3)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){switch(e=+e,t=+t,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:mf(this,e,t);break}this._x0=this._x1,this._x1=this._x2,this._x2=e,this._y0=this._y1,this._y1=this._y2,this._y2=t}};var yT=function e(t){function n(r){return new J1(r,t)}return n.tension=function(r){return e(+r)},n}(0);function Em(e,t,n){var r=e._x1,i=e._y1,o=e._x2,s=e._y2;if(e._l01_a>iT){var a=2*e._l01_2a+3*e._l01_a*e._l12_a+e._l12_2a,c=3*e._l01_a*(e._l01_a+e._l12_a);r=(r*a-e._x0*e._l12_2a+e._x2*e._l01_2a)/c,i=(i*a-e._y0*e._l12_2a+e._y2*e._l01_2a)/c}if(e._l23_a>iT){var l=2*e._l23_2a+3*e._l23_a*e._l12_a+e._l12_2a,u=3*e._l23_a*(e._l23_a+e._l12_a);o=(o*l+e._x1*e._l23_2a-t*e._l12_2a)/u,s=(s*l+e._y1*e._l23_2a-n*e._l12_2a)/u}e._context.bezierCurveTo(r,i,o,s,e._x2,e._y2)}function jC(e,t){this._context=e,this._alpha=t}jC.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._x2=this._y0=this._y1=this._y2=NaN,this._l01_a=this._l12_a=this._l23_a=this._l01_2a=this._l12_2a=this._l23_2a=this._point=0},lineEnd:function(){switch(this._point){case 2:this._context.lineTo(this._x2,this._y2);break;case 3:this.point(this._x2,this._y2);break}(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){if(e=+e,t=+t,this._point){var n=this._x2-e,r=this._y2-t;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(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;break;case 2:this._point=3;default:Em(this,e,t);break}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=e,this._y0=this._y1,this._y1=this._y2,this._y2=t}};var gT=function e(t){function n(r){return t?new jC(r,t):new H1(r,0)}return n.alpha=function(r){return e(+r)},n}(.5);function qC(e,t){this._context=e,this._alpha=t}qC.prototype={areaStart:hi,areaEnd:hi,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);break}}},point:function(e,t){if(e=+e,t=+t,this._point){var n=this._x2-e,r=this._y2-t;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=e,this._y3=t;break;case 1:this._point=2,this._context.moveTo(this._x4=e,this._y4=t);break;case 2:this._point=3,this._x5=e,this._y5=t;break;default:Em(this,e,t);break}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=e,this._y0=this._y1,this._y1=this._y2,this._y2=t}};var xT=function e(t){function n(r){return t?new qC(r,t):new Z1(r,0)}return n.alpha=function(r){return e(+r)},n}(.5);function VC(e,t){this._context=e,this._alpha=t}VC.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._x2=this._y0=this._y1=this._y2=NaN,this._l01_a=this._l12_a=this._l23_a=this._l01_2a=this._l12_2a=this._l23_2a=this._point=0},lineEnd:function(){(this._line||this._line!==0&&this._point===3)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){if(e=+e,t=+t,this._point){var n=this._x2-e,r=this._y2-t;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:Em(this,e,t);break}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=e,this._y0=this._y1,this._y1=this._y2,this._y2=t}};var bT=function e(t){function n(r){return t?new VC(r,t):new J1(r,0)}return n.alpha=function(r){return e(+r)},n}(.5);function YC(e){this._context=e}YC.prototype={areaStart:hi,areaEnd:hi,lineStart:function(){this._point=0},lineEnd:function(){this._point&&this._context.closePath()},point:function(e,t){e=+e,t=+t,this._point?this._context.lineTo(e,t):(this._point=1,this._context.moveTo(e,t))}};function wT(e){return new YC(e)}function XC(e){return e<0?-1:1}function GC(e,t,n){var r=e._x1-e._x0,i=t-e._x1,o=(e._y1-e._y0)/(r||i<0&&-0),s=(n-e._y1)/(i||r<0&&-0),a=(o*i+s*r)/(r+i);return(XC(o)+XC(s))*Math.min(Math.abs(o),Math.abs(s),.5*Math.abs(a))||0}function WC(e,t){var n=e._x1-e._x0;return n?(3*(e._y1-e._y0)/n-t)/2:t}function vT(e,t,n){var r=e._x0,i=e._y0,o=e._x1,s=e._y1,a=(o-r)/3;e._context.bezierCurveTo(r+a,i+a*t,o-a,s-a*n,o,s)}function Q1(e){this._context=e}Q1.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:vT(this,this._t0,WC(this,this._t0));break}(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){var n=NaN;if(e=+e,t=+t,!(e===this._x1&&t===this._y1)){switch(this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;break;case 2:this._point=3,vT(this,WC(this,n=GC(this,e,t)),n);break;default:vT(this,this._t0,n=GC(this,e,t));break}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t,this._t0=n}}};function HC(e){this._context=new ZC(e)}(HC.prototype=Object.create(Q1.prototype)).point=function(e,t){Q1.prototype.point.call(this,t,e)};function ZC(e){this._context=e}ZC.prototype={moveTo:function(e,t){this._context.moveTo(t,e)},closePath:function(){this._context.closePath()},lineTo:function(e,t){this._context.lineTo(t,e)},bezierCurveTo:function(e,t,n,r,i,o){this._context.bezierCurveTo(t,e,r,n,o,i)}};function _T(e){return new Q1(e)}function ST(e){return new HC(e)}function QC(e){this._context=e}QC.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x=[],this._y=[]},lineEnd:function(){var e=this._x,t=this._y,n=e.length;if(n)if(this._line?this._context.lineTo(e[0],t[0]):this._context.moveTo(e[0],t[0]),n===2)this._context.lineTo(e[1],t[1]);else for(var r=JC(e),i=JC(t),o=0,s=1;s<n;++o,++s)this._context.bezierCurveTo(r[0][o],i[0][o],r[1][o],i[1][o],e[s],t[s]);(this._line||this._line!==0&&n===1)&&this._context.closePath(),this._line=1-this._line,this._x=this._y=null},point:function(e,t){this._x.push(+e),this._y.push(+t)}};function JC(e){var t,n=e.length-1,r,i=new Array(n),o=new Array(n),s=new Array(n);for(i[0]=0,o[0]=2,s[0]=e[0]+2*e[1],t=1;t<n-1;++t)i[t]=1,o[t]=4,s[t]=4*e[t]+2*e[t+1];for(i[n-1]=2,o[n-1]=7,s[n-1]=8*e[n-1]+e[n],t=1;t<n;++t)r=i[t]/o[t-1],o[t]-=r,s[t]-=r*s[t-1];for(i[n-1]=s[n-1]/o[n-1],t=n-2;t>=0;--t)i[t]=(s[t]-i[t+1])/o[t];for(o[n-1]=(e[n]+i[n-1])/2,t=0;t<n-1;++t)o[t]=2*e[t+1]-i[t+1];return[i,o]}function IT(e){return new QC(e)}function K1(e,t){this._context=e,this._t=t}K1.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&&this._point===2&&this._context.lineTo(this._x,this._y),(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line>=0&&(this._t=1-this._t,this._line=1-this._line)},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;default:{if(this._t<=0)this._context.lineTo(this._x,t),this._context.lineTo(e,t);else{var n=this._x*(1-this._t)+e*this._t;this._context.lineTo(n,this._y),this._context.lineTo(n,t)}break}}this._x=e,this._y=t}};function MT(e){return new K1(e,.5)}function TT(e){return new K1(e,0)}function AT(e){return new K1(e,1)}var Nm=e=>()=>e;function ET(e,{sourceEvent:t,target:n,transform:r,dispatch:i}){Object.defineProperties(this,{type:{value:e,enumerable:!0,configurable:!0},sourceEvent:{value:t,enumerable:!0,configurable:!0},target:{value:n,enumerable:!0,configurable:!0},transform:{value:r,enumerable:!0,configurable:!0},_:{value:i}})}function Ur(e,t,n){this.k=e,this.x=t,this.y=n}Ur.prototype={constructor:Ur,scale:function(e){return e===1?this:new Ur(this.k*e,this.x,this.y)},translate:function(e,t){return e===0&t===0?this:new Ur(this.k,this.x+this.k*e,this.y+this.k*t)},apply:function(e){return[e[0]*this.k+this.x,e[1]*this.k+this.y]},applyX:function(e){return e*this.k+this.x},applyY:function(e){return e*this.k+this.y},invert:function(e){return[(e[0]-this.x)/this.k,(e[1]-this.y)/this.k]},invertX:function(e){return(e-this.x)/this.k},invertY:function(e){return(e-this.y)/this.k},rescaleX:function(e){return e.copy().domain(e.range().map(this.invertX,this).map(e.invert,e))},rescaleY:function(e){return e.copy().domain(e.range().map(this.invertY,this).map(e.invert,e))},toString:function(){return"translate("+this.x+","+this.y+") scale("+this.k+")"}};var Dm=new Ur(1,0,0);NT.prototype=Ur.prototype;function NT(e){for(;!e.__zoom;)if(!(e=e.parentNode))return Dm;return e.__zoom}function tw(e){e.stopImmediatePropagation()}function yf(e){e.preventDefault(),e.stopImmediatePropagation()}function rZ(e){return(!e.ctrlKey||e.type==="wheel")&&!e.button}function iZ(){var e=this;return e instanceof SVGElement?(e=e.ownerSVGElement||e,e.hasAttribute("viewBox")?(e=e.viewBox.baseVal,[[e.x,e.y],[e.x+e.width,e.y+e.height]]):[[0,0],[e.width.baseVal.value,e.height.baseVal.value]]):[[0,0],[e.clientWidth,e.clientHeight]]}function KC(){return this.__zoom||Dm}function oZ(e){return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*(e.ctrlKey?10:1)}function sZ(){return navigator.maxTouchPoints||"ontouchstart"in this}function aZ(e,t,n){var r=e.invertX(t[0][0])-n[0][0],i=e.invertX(t[1][0])-n[1][0],o=e.invertY(t[0][1])-n[0][1],s=e.invertY(t[1][1])-n[1][1];return e.translate(i>r?(r+i)/2:Math.min(0,r)||Math.max(0,i),s>o?(o+s)/2:Math.min(0,o)||Math.max(0,s))}function DT(){var e=rZ,t=iZ,n=aZ,r=oZ,i=sZ,o=[0,1/0],s=[[-1/0,-1/0],[1/0,1/0]],a=250,c=iI,l=Gc("start","zoom","end"),u,f,d,h=500,p=150,m=0,g=10;function y(S){S.property("__zoom",KC).on("wheel.zoom",E,{passive:!1}).on("mousedown.zoom",D).on("dblclick.zoom",I).filter(i).on("touchstart.zoom",T).on("touchmove.zoom",O).on("touchend.zoom touchcancel.zoom",B).style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}y.transform=function(S,A,N,k){var R=S.selection?S.selection():S;R.property("__zoom",KC),S!==R?_(S,A,N,k):R.interrupt().each(function(){v(this,arguments).event(k).start().zoom(null,typeof A=="function"?A.apply(this,arguments):A).end()})},y.scaleBy=function(S,A,N,k){y.scaleTo(S,function(){var R=this.__zoom.k,F=typeof A=="function"?A.apply(this,arguments):A;return R*F},N,k)},y.scaleTo=function(S,A,N,k){y.transform(S,function(){var R=t.apply(this,arguments),F=this.__zoom,$=N==null?w(R):typeof N=="function"?N.apply(this,arguments):N,P=F.invert($),U=typeof A=="function"?A.apply(this,arguments):A;return n(b(x(F,U),$,P),R,s)},N,k)},y.translateBy=function(S,A,N,k){y.transform(S,function(){return n(this.__zoom.translate(typeof A=="function"?A.apply(this,arguments):A,typeof N=="function"?N.apply(this,arguments):N),t.apply(this,arguments),s)},null,k)},y.translateTo=function(S,A,N,k,R){y.transform(S,function(){var F=t.apply(this,arguments),$=this.__zoom,P=k==null?w(F):typeof k=="function"?k.apply(this,arguments):k;return n(Dm.translate(P[0],P[1]).scale($.k).translate(typeof A=="function"?-A.apply(this,arguments):-A,typeof N=="function"?-N.apply(this,arguments):-N),F,s)},k,R)};function x(S,A){return A=Math.max(o[0],Math.min(o[1],A)),A===S.k?S:new Ur(A,S.x,S.y)}function b(S,A,N){var k=A[0]-N[0]*S.k,R=A[1]-N[1]*S.k;return k===S.x&&R===S.y?S:new Ur(S.k,k,R)}function w(S){return[(+S[0][0]+ +S[1][0])/2,(+S[0][1]+ +S[1][1])/2]}function _(S,A,N,k){S.on("start.zoom",function(){v(this,arguments).event(k).start()}).on("interrupt.zoom end.zoom",function(){v(this,arguments).event(k).end()}).tween("zoom",function(){var R=this,F=arguments,$=v(R,F).event(k),P=t.apply(R,F),U=N==null?w(P):typeof N=="function"?N.apply(R,F):N,W=Math.max(P[1][0]-P[0][0],P[1][1]-P[0][1]),tt=R.__zoom,nt=typeof A=="function"?A.apply(R,F):A,st=c(tt.invert(U).concat(W/tt.k),nt.invert(U).concat(W/nt.k));return function(Y){if(Y===1)Y=nt;else{var rt=st(Y),j=W/rt[2];Y=new Ur(j,U[0]-rt[0]*j,U[1]-rt[1]*j)}$.zoom(null,Y)}})}function v(S,A,N){return!N&&S.__zooming||new M(S,A)}function M(S,A){this.that=S,this.args=A,this.active=0,this.sourceEvent=null,this.extent=t.apply(S,A),this.taps=0}M.prototype={event:function(S){return S&&(this.sourceEvent=S),this},start:function(){return++this.active===1&&(this.that.__zooming=this,this.emit("start")),this},zoom:function(S,A){return this.mouse&&S!=="mouse"&&(this.mouse[1]=A.invert(this.mouse[0])),this.touch0&&S!=="touch"&&(this.touch0[1]=A.invert(this.touch0[0])),this.touch1&&S!=="touch"&&(this.touch1[1]=A.invert(this.touch1[0])),this.that.__zoom=A,this.emit("zoom"),this},end:function(){return--this.active===0&&(delete this.that.__zooming,this.emit("end")),this},emit:function(S){var A=jt(this.that).datum();l.call(S,this.that,new ET(S,{sourceEvent:this.sourceEvent,target:y,type:S,transform:this.that.__zoom,dispatch:l}),A)}};function E(S,...A){if(!e.apply(this,arguments))return;var N=v(this,A).event(S),k=this.__zoom,R=Math.max(o[0],Math.min(o[1],k.k*Math.pow(2,r.apply(this,arguments)))),F=Bn(S);if(N.wheel)(N.mouse[0][0]!==F[0]||N.mouse[0][1]!==F[1])&&(N.mouse[1]=k.invert(N.mouse[0]=F)),clearTimeout(N.wheel);else{if(k.k===R)return;N.mouse=[F,k.invert(F)],go(this),N.start()}yf(S),N.wheel=setTimeout($,p),N.zoom("mouse",n(b(x(k,R),N.mouse[0],N.mouse[1]),N.extent,s));function $(){N.wheel=null,N.end()}}function D(S,...A){if(d||!e.apply(this,arguments))return;var N=S.currentTarget,k=v(this,A,!0).event(S),R=jt(S.view).on("mousemove.zoom",U,!0).on("mouseup.zoom",W,!0),F=Bn(S,N),$=S.clientX,P=S.clientY;sp(S.view),tw(S),k.mouse=[F,this.__zoom.invert(F)],go(this),k.start();function U(tt){if(yf(tt),!k.moved){var nt=tt.clientX-$,st=tt.clientY-P;k.moved=nt*nt+st*st>m}k.event(tt).zoom("mouse",n(b(k.that.__zoom,k.mouse[0]=Bn(tt,N),k.mouse[1]),k.extent,s))}function W(tt){R.on("mousemove.zoom mouseup.zoom",null),ap(tt.view,k.moved),yf(tt),k.event(tt).end()}}function I(S,...A){if(e.apply(this,arguments)){var N=this.__zoom,k=Bn(S.changedTouches?S.changedTouches[0]:S,this),R=N.invert(k),F=N.k*(S.shiftKey?.5:2),$=n(b(x(N,F),k,R),t.apply(this,A),s);yf(S),a>0?jt(this).transition().duration(a).call(_,$,k,S):jt(this).call(y.transform,$,k,S)}}function T(S,...A){if(e.apply(this,arguments)){var N=S.touches,k=N.length,R=v(this,A,S.changedTouches.length===k).event(S),F,$,P,U;for(tw(S),$=0;$<k;++$)P=N[$],U=Bn(P,this),U=[U,this.__zoom.invert(U),P.identifier],R.touch0?!R.touch1&&R.touch0[2]!==U[2]&&(R.touch1=U,R.taps=0):(R.touch0=U,F=!0,R.taps=1+!!u);u&&(u=clearTimeout(u)),F&&(R.taps<2&&(f=U[0],u=setTimeout(function(){u=null},h)),go(this),R.start())}}function O(S,...A){if(this.__zooming){var N=v(this,A).event(S),k=S.changedTouches,R=k.length,F,$,P,U;for(yf(S),F=0;F<R;++F)$=k[F],P=Bn($,this),N.touch0&&N.touch0[2]===$.identifier?N.touch0[0]=P:N.touch1&&N.touch1[2]===$.identifier&&(N.touch1[0]=P);if($=N.that.__zoom,N.touch1){var W=N.touch0[0],tt=N.touch0[1],nt=N.touch1[0],st=N.touch1[1],Y=(Y=nt[0]-W[0])*Y+(Y=nt[1]-W[1])*Y,rt=(rt=st[0]-tt[0])*rt+(rt=st[1]-tt[1])*rt;$=x($,Math.sqrt(Y/rt)),P=[(W[0]+nt[0])/2,(W[1]+nt[1])/2],U=[(tt[0]+st[0])/2,(tt[1]+st[1])/2]}else if(N.touch0)P=N.touch0[0],U=N.touch0[1];else return;N.zoom("touch",n(b($,P,U),N.extent,s))}}function B(S,...A){if(this.__zooming){var N=v(this,A).event(S),k=S.changedTouches,R=k.length,F,$;for(tw(S),d&&clearTimeout(d),d=setTimeout(function(){d=null},h),F=0;F<R;++F)$=k[F],N.touch0&&N.touch0[2]===$.identifier?delete N.touch0:N.touch1&&N.touch1[2]===$.identifier&&delete N.touch1;if(N.touch1&&!N.touch0&&(N.touch0=N.touch1,delete N.touch1),N.touch0)N.touch0[1]=this.__zoom.invert(N.touch0[0]);else if(N.end(),N.taps===2&&($=Bn($,this),Math.hypot(f[0]-$[0],f[1]-$[1])<g)){var P=jt(this).on("dblclick.zoom");P&&P.apply(this,arguments)}}}return y.wheelDelta=function(S){return arguments.length?(r=typeof S=="function"?S:Nm(+S),y):r},y.filter=function(S){return arguments.length?(e=typeof S=="function"?S:Nm(!!S),y):e},y.touchable=function(S){return arguments.length?(i=typeof S=="function"?S:Nm(!!S),y):i},y.extent=function(S){return arguments.length?(t=typeof S=="function"?S:Nm([[+S[0][0],+S[0][1]],[+S[1][0],+S[1][1]]]),y):t},y.scaleExtent=function(S){return arguments.length?(o[0]=+S[0],o[1]=+S[1],y):[o[0],o[1]]},y.translateExtent=function(S){return arguments.length?(s[0][0]=+S[0][0],s[1][0]=+S[1][0],s[0][1]=+S[0][1],s[1][1]=+S[1][1],y):[[s[0][0],s[0][1]],[s[1][0],s[1][1]]]},y.constrain=function(S){return arguments.length?(n=S,y):n},y.duration=function(S){return arguments.length?(a=+S,y):a},y.interpolate=function(S){return arguments.length?(c=S,y):c},y.on=function(){var S=l.on.apply(l,arguments);return S===l?y:S},y.clickDistance=function(S){return arguments.length?(m=(S=+S)*S,y):Math.sqrt(m)},y.tapDistance=function(S){return arguments.length?(g=+S,y):g},y}function Ue(e){return e!=null&&!Number.isNaN(e)}function ln(e,t){return+Ue(t)-+Ue(e)||Gt(e,t)}function wl(e,t){return+Ue(t)-+Ue(e)||Yn(e,t)}function Om(e){return e!=null&&`${e}`!=""}function gf(e){return isFinite(e)?e:NaN}function er(e){return e>0&&isFinite(e)?e:NaN}function Va(e){return e<0&&isFinite(e)?e:NaN}function xf(e,t){if(e instanceof Date||(e=new Date(+e)),isNaN(e))return typeof t=="function"?t(e):t;let n=e.getUTCHours(),r=e.getUTCMinutes(),i=e.getUTCSeconds(),o=e.getUTCMilliseconds();return`${cZ(e.getUTCFullYear(),4)}-${Xs(e.getUTCMonth()+1,2)}-${Xs(e.getUTCDate(),2)}${n||r||i||o?`T${Xs(n,2)}:${Xs(r,2)}${i||o?`:${Xs(i,2)}${o?`.${Xs(o,3)}`:""}`:""}Z`:""}`}function cZ(e){return e<0?`-${Xs(-e,6)}`:e>9999?`+${Xs(e,6)}`:Xs(e,4)}function Xs(e,t){return`${e}`.padStart(t,"0")}var lZ=/^(?:[-+]\d{2})?\d{4}(?:-\d{2}(?:-\d{2})?)?(?:T\d{2}:\d{2}(?::\d{2}(?:\.\d{3})?)?(?:Z|[-+]\d{2}:?\d{2})?)?$/;function vl(e,t){return lZ.test(e+="")?new Date(e):typeof t=="function"?t(e):t}var wf=1e3,Xa=wf*60,Ga=Xa*60,Oo=Ga*24,Do=Oo*7,_l=Oo*30,Ya=Oo*365,OT=[["millisecond",1],["2 milliseconds",2],["5 milliseconds",5],["10 milliseconds",10],["20 milliseconds",20],["50 milliseconds",50],["100 milliseconds",100],["200 milliseconds",200],["500 milliseconds",500],["second",wf],["5 seconds",5*wf],["15 seconds",15*wf],["30 seconds",30*wf],["minute",Xa],["5 minutes",5*Xa],["15 minutes",15*Xa],["30 minutes",30*Xa],["hour",Ga],["3 hours",3*Ga],["6 hours",6*Ga],["12 hours",12*Ga],["day",Oo],["2 days",2*Oo],["week",Do],["2 weeks",2*Do],["month",_l],["3 months",3*_l],["6 months",6*_l],["year",Ya],["2 years",2*Ya],["5 years",5*Ya],["10 years",10*Ya],["20 years",20*Ya],["50 years",50*Ya],["100 years",100*Ya]],BT=new Map([["second",wf],["minute",Xa],["hour",Ga],["day",Oo],["monday",Do],["tuesday",Do],["wednesday",Do],["thursday",Do],["friday",Do],["saturday",Do],["sunday",Do],["week",Do],["month",_l],["year",Ya]]),eF=new Map([["second",an],["minute",$s],["hour",Us],["day",ui],["monday",ja],["tuesday",xb],["wednesday",bb],["thursday",Ao],["friday",wb],["saturday",vb],["sunday",$r],["week",$r],["month",js],["year",Rn]]),LT=new Map([["second",an],["minute",Ps],["hour",zs],["day",yl],["monday",qa],["tuesday",_b],["wednesday",Sb],["thursday",Eo],["friday",Ib],["saturday",Mb],["sunday",Pr],["week",Pr],["month",qs],["year",$n]]),vf=Symbol("intervalDuration"),nw=Symbol("intervalType");for(let[e,t]of eF)t[vf]=BT.get(e),t[nw]="time";for(let[e,t]of LT)t[vf]=BT.get(e),t[nw]="utc";var Bm=[["year",$n,"utc"],["month",qs,"utc"],["day",yl,"utc",6*_l],["hour",zs,"utc",3*Oo],["minute",Ps,"utc",6*Ga],["second",an,"utc",30*Xa]],ew=[["year",Rn,"time"],["month",js,"time"],["day",ui,"time",6*_l],["hour",Us,"time",3*Oo],["minute",$s,"time",6*Ga],["second",an,"time",30*Xa]],uZ=[Bm[0],ew[0],Bm[1],ew[1],Bm[2],ew[2],...Bm.slice(3)];function rw(e){let t=`${e}`.toLowerCase();t.endsWith("s")&&(t=t.slice(0,-1));let n=1,r=/^(?:(\d+)\s+)/.exec(t);switch(r&&(t=t.slice(r[0].length),n=+r[1]),t){case"quarter":t="month",n*=3;break;case"half":t="month",n*=6;break}let i=LT.get(t);if(!i)throw new Error(`unknown interval: ${e}`);if(n>1&&!i.every)throw new Error(`non-periodic interval: ${t}`);return[t,n]}function kT(e){return nF(rw(e),"time")}function Lm(e){return nF(rw(e),"utc")}function nF([e,t],n){let r=(n==="time"?eF:LT).get(e);return t>1&&(r=r.every(t),r[vf]=BT.get(e)*t,r[nw]=n),r}function CT(e,t){if(!(t>1))return;let n=e[vf];if(!OT.some(([,i])=>i===n)||n%Oo===0&&Oo<n&&n<_l)return;let[r]=OT[Is(([,i])=>Math.log(i)).center(OT,Math.log(n*t))];return(e[nw]==="time"?kT:Lm)(r)}function tF(e,t,n){let r=t==="time"?af:No;if(n==null)return r(e==="year"?"%Y":e==="month"?"%Y-%m":e==="day"?"%Y-%m-%d":e==="hour"||e==="minute"?"%Y-%m-%dT%H:%M":e==="second"?"%Y-%m-%dT%H:%M:%S":"%Y-%m-%dT%H:%M:%S.%L");let i=fZ(n);switch(e){case"millisecond":return bf(r(".%L"),r(":%M:%S"),i);case"second":return bf(r(":%S"),r("%-I:%M"),i);case"minute":return bf(r("%-I:%M"),r("%p"),i);case"hour":return bf(r("%-I %p"),r("%b %-d"),i);case"day":return bf(r("%-d"),r("%b"),i);case"month":return bf(r("%b"),r("%Y"),i);case"year":return r("%Y")}throw new Error("unable to format time ticks")}function fZ(e){return e==="left"||e==="right"?(t,n)=>`
10
+ ]`}concat(...t){let n=this.schema,r=this.data.concat(t.flatMap(({data:i})=>i));return new e(n,r.map(i=>new Le(n,i)))}slice(t,n){let r=this.schema;[t,n]=qd({length:this.numRows},t,n);let i=Yg(this.data,this._offsets,t,n);return new e(r,i.map(o=>new Le(r,o)))}getChild(t){return this.getChildAt(this.schema.fields.findIndex(n=>n.name===t))}getChildAt(t){if(t>-1&&t<this.schema.fields.length){let n=this.data.map(r=>r.children[t]);if(n.length===0){let{type:r}=this.schema.fields[t],i=Bt({type:r,length:0,nullCount:0});n.push(i._changeLengthAndBackfillNullBitmap(this.numRows))}return new Yt(n)}return null}setChild(t,n){var r;return this.setChildAt((r=this.schema.fields)===null||r===void 0?void 0:r.findIndex(i=>i.name===t),n)}setChildAt(t,n){let r=this.schema,i=[...this.batches];if(t>-1&&t<this.numCols){n||(n=new Yt([Bt({type:new jn,length:this.numRows})]));let o=r.fields.slice(),s=o[t].clone({type:n.type}),a=this.schema.fields.map((c,l)=>this.getChildAt(l));[o[t],a[t]]=[s,n],[r,i]=_0(r,a)}return new e(r,i)}select(t){let n=this.schema.fields.reduce((r,i,o)=>r.set(i.name,o),new Map);return this.selectAt(t.map(r=>n.get(r)).filter(r=>r>-1))}selectAt(t){let n=this.schema.selectAt(t),r=this.batches.map(i=>i.selectAt(t));return new e(n,r)}assign(t){let n=this.schema.fields,[r,i]=t.schema.fields.reduce((a,c,l)=>{let[u,f]=a,d=n.findIndex(h=>h.name===c.name);return~d?f[d]=l:u.push(l),a},[[],[]]),o=this.schema.assign(t.schema),s=[...n.map((a,c)=>[c,i[c]]).map(([a,c])=>c===void 0?this.getChildAt(a):t.getChildAt(c)),...r.map(a=>t.getChildAt(a))].filter(Boolean);return new e(..._0(o,s))}};jO=Symbol.toStringTag;dr[jO]=(e=>(e.schema=null,e.batches=[],e._offsets=new Uint32Array([0]),e._nullCount=-1,e[Symbol.isConcatSpreadable]=!0,e.isValid=pa(Yd),e.get=pa(je.getVisitFn(C.Struct)),e.set=Xg(gn.getVisitFn(C.Struct)),e.indexOf=Gg(Ac.getVisitFn(C.Struct)),e.getByteLength=pa(Er.getVisitFn(C.Struct)),"Table"))(dr.prototype);var YO,Le=class e{constructor(...t){switch(t.length){case 2:{if([this.schema]=t,!(this.schema instanceof re))throw new TypeError("RecordBatch constructor expects a [Schema, Data] pair.");if([,this.data=Bt({nullCount:0,type:new me(this.schema.fields),children:this.schema.fields.map(n=>Bt({type:n.type,nullCount:0}))})]=t,!(this.data instanceof se))throw new TypeError("RecordBatch constructor expects a [Schema, Data] pair.");[this.schema,this.data]=VO(this.schema,this.data.children);break}case 1:{let[n]=t,{fields:r,children:i,length:o}=Object.keys(n).reduce((c,l,u)=>(c.children[u]=n[l],c.length=Math.max(c.length,n[l].length),c.fields[u]=Ut.new({name:l,type:n[l].type,nullable:!0}),c),{length:0,fields:new Array,children:new Array}),s=new re(r),a=Bt({type:new me(r),length:o,children:i,nullCount:0});[this.schema,this.data]=VO(s,a.children,o);break}default:throw new TypeError("RecordBatch constructor expects an Object mapping names to child Data, or a [Schema, Data] pair.")}}get dictionaries(){return this._dictionaries||(this._dictionaries=XO(this.schema.fields,this.data.children))}get numCols(){return this.schema.fields.length}get numRows(){return this.data.length}get nullCount(){return this.data.nullCount}isValid(t){return this.data.getValid(t)}get(t){return je.visit(this.data,t)}set(t,n){return gn.visit(this.data,t,n)}indexOf(t,n){return Ac.visit(this.data,t,n)}getByteLength(t){return Er.visit(this.data,t)}[Symbol.iterator](){return su.visit(new Yt([this.data]))}toArray(){return[...this]}concat(...t){return new dr(this.schema,[this,...t])}slice(t,n){let[r]=new Yt([this.data]).slice(t,n).data;return new e(this.schema,r)}getChild(t){var n;return this.getChildAt((n=this.schema.fields)===null||n===void 0?void 0:n.findIndex(r=>r.name===t))}getChildAt(t){return t>-1&&t<this.schema.fields.length?new Yt([this.data.children[t]]):null}setChild(t,n){var r;return this.setChildAt((r=this.schema.fields)===null||r===void 0?void 0:r.findIndex(i=>i.name===t),n)}setChildAt(t,n){let r=this.schema,i=this.data;if(t>-1&&t<this.numCols){n||(n=new Yt([Bt({type:new jn,length:this.numRows})]));let o=r.fields.slice(),s=i.children.slice(),a=o[t].clone({type:n.type});[o[t],s[t]]=[a,n.data[0]],r=new re(o,new Map(this.schema.metadata)),i=Bt({type:new me(o),children:s})}return new e(r,i)}select(t){let n=this.schema.select(t),r=new me(n.fields),i=[];for(let o of t){let s=this.schema.fields.findIndex(a=>a.name===o);~s&&(i[s]=this.data.children[s])}return new e(n,Bt({type:r,length:this.numRows,children:i}))}selectAt(t){let n=this.schema.selectAt(t),r=t.map(o=>this.data.children[o]).filter(Boolean),i=Bt({type:new me(n.fields),length:this.numRows,children:r});return new e(n,i)}};YO=Symbol.toStringTag;Le[YO]=(e=>(e._nullCount=-1,e[Symbol.isConcatSpreadable]=!0,"RecordBatch"))(Le.prototype);function VO(e,t,n=t.reduce((r,i)=>Math.max(r,i.length),0)){var r;let i=[...e.fields],o=[...t],s=(n+63&-64)>>3;for(let[a,c]of e.fields.entries()){let l=t[a];(!l||l.length!==n)&&(i[a]=c.clone({nullable:!0}),o[a]=(r=l?._changeLengthAndBackfillNullBitmap(n))!==null&&r!==void 0?r:Bt({type:c.type,length:n,nullCount:n,nullBitmap:new Uint8Array(s)}))}return[e.assign(i),Bt({type:new me(i),length:n,children:o})]}function XO(e,t,n=new Map){var r,i;if(((r=e?.length)!==null&&r!==void 0?r:0)>0&&e?.length===t?.length)for(let o=-1,s=e.length;++o<s;){let{type:a}=e[o],c=t[o];for(let l of[c,...((i=c?.dictionary)===null||i===void 0?void 0:i.data)||[]])XO(a.children,l?.children,n);if(at.isDictionary(a)){let{id:l}=a;if(!n.has(l))c?.dictionary&&n.set(l,c.dictionary);else if(n.get(l)!==c.dictionary)throw new Error("Cannot create Schema containing two different dictionaries with the same Id")}}return n}var kc=class extends Le{constructor(t){let n=t.fields.map(i=>Bt({type:i.type})),r=Bt({type:new me(t.fields),nullCount:0,children:n});super(t,r)}};var Bh;(function(e){e[e.BUFFER=0]="BUFFER"})(Bh||(Bh={}));var Lh;(function(e){e[e.LZ4_FRAME=0]="LZ4_FRAME",e[e.ZSTD=1]="ZSTD"})(Lh||(Lh={}));var S0=class e{constructor(){this.bb=null,this.bb_pos=0}__init(t,n){return this.bb_pos=t,this.bb=n,this}static getRootAsBodyCompression(t,n){return(n||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsBodyCompression(t,n){return t.setPosition(t.position()+4),(n||new e).__init(t.readInt32(t.position())+t.position(),t)}codec(){let t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt8(this.bb_pos+t):Lh.LZ4_FRAME}method(){let t=this.bb.__offset(this.bb_pos,6);return t?this.bb.readInt8(this.bb_pos+t):Bh.BUFFER}static startBodyCompression(t){t.startObject(2)}static addCodec(t,n){t.addFieldInt8(0,n,Lh.LZ4_FRAME)}static addMethod(t,n){t.addFieldInt8(1,n,Bh.BUFFER)}static endBodyCompression(t){return t.endObject()}static createBodyCompression(t,n,r){return e.startBodyCompression(t),e.addCodec(t,n),e.addMethod(t,r),e.endBodyCompression(t)}};var pu=class{constructor(){this.bb=null,this.bb_pos=0}__init(t,n){return this.bb_pos=t,this.bb=n,this}offset(){return this.bb.readInt64(this.bb_pos)}length(){return this.bb.readInt64(this.bb_pos+8)}static sizeOf(){return 16}static createBuffer(t,n,r){return t.prep(8,16),t.writeInt64(BigInt(r??0)),t.writeInt64(BigInt(n??0)),t.offset()}};var mu=class{constructor(){this.bb=null,this.bb_pos=0}__init(t,n){return this.bb_pos=t,this.bb=n,this}length(){return this.bb.readInt64(this.bb_pos)}nullCount(){return this.bb.readInt64(this.bb_pos+8)}static sizeOf(){return 16}static createFieldNode(t,n,r){return t.prep(8,16),t.writeInt64(BigInt(r??0)),t.writeInt64(BigInt(n??0)),t.offset()}};var Or=class e{constructor(){this.bb=null,this.bb_pos=0}__init(t,n){return this.bb_pos=t,this.bb=n,this}static getRootAsRecordBatch(t,n){return(n||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsRecordBatch(t,n){return t.setPosition(t.position()+4),(n||new e).__init(t.readInt32(t.position())+t.position(),t)}length(){let t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt64(this.bb_pos+t):BigInt("0")}nodes(t,n){let r=this.bb.__offset(this.bb_pos,6);return r?(n||new mu).__init(this.bb.__vector(this.bb_pos+r)+t*16,this.bb):null}nodesLength(){let t=this.bb.__offset(this.bb_pos,6);return t?this.bb.__vector_len(this.bb_pos+t):0}buffers(t,n){let r=this.bb.__offset(this.bb_pos,8);return r?(n||new pu).__init(this.bb.__vector(this.bb_pos+r)+t*16,this.bb):null}buffersLength(){let t=this.bb.__offset(this.bb_pos,8);return t?this.bb.__vector_len(this.bb_pos+t):0}compression(t){let n=this.bb.__offset(this.bb_pos,10);return n?(t||new S0).__init(this.bb.__indirect(this.bb_pos+n),this.bb):null}static startRecordBatch(t){t.startObject(4)}static addLength(t,n){t.addFieldInt64(0,n,BigInt("0"))}static addNodes(t,n){t.addFieldOffset(1,n,0)}static startNodesVector(t,n){t.startVector(16,n,8)}static addBuffers(t,n){t.addFieldOffset(2,n,0)}static startBuffersVector(t,n){t.startVector(16,n,8)}static addCompression(t,n){t.addFieldOffset(3,n,0)}static endRecordBatch(t){return t.endObject()}};var ms=class e{constructor(){this.bb=null,this.bb_pos=0}__init(t,n){return this.bb_pos=t,this.bb=n,this}static getRootAsDictionaryBatch(t,n){return(n||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsDictionaryBatch(t,n){return t.setPosition(t.position()+4),(n||new e).__init(t.readInt32(t.position())+t.position(),t)}id(){let t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt64(this.bb_pos+t):BigInt("0")}data(t){let n=this.bb.__offset(this.bb_pos,6);return n?(t||new Or).__init(this.bb.__indirect(this.bb_pos+n),this.bb):null}isDelta(){let t=this.bb.__offset(this.bb_pos,8);return t?!!this.bb.readInt8(this.bb_pos+t):!1}static startDictionaryBatch(t){t.startObject(3)}static addId(t,n){t.addFieldInt64(0,n,BigInt("0"))}static addData(t,n){t.addFieldOffset(1,n,0)}static addIsDelta(t,n){t.addFieldInt8(2,+n,0)}static endDictionaryBatch(t){return t.endObject()}};var yu;(function(e){e[e.NONE=0]="NONE",e[e.Schema=1]="Schema",e[e.DictionaryBatch=2]="DictionaryBatch",e[e.RecordBatch=3]="RecordBatch",e[e.Tensor=4]="Tensor",e[e.SparseTensor=5]="SparseTensor"})(yu||(yu={}));var ki=class e{constructor(){this.bb=null,this.bb_pos=0}__init(t,n){return this.bb_pos=t,this.bb=n,this}static getRootAsMessage(t,n){return(n||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsMessage(t,n){return t.setPosition(t.position()+4),(n||new e).__init(t.readInt32(t.position())+t.position(),t)}version(){let t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt16(this.bb_pos+t):ya.V1}headerType(){let t=this.bb.__offset(this.bb_pos,6);return t?this.bb.readUint8(this.bb_pos+t):yu.NONE}header(t){let n=this.bb.__offset(this.bb_pos,8);return n?this.bb.__union(t,this.bb_pos+n):null}bodyLength(){let t=this.bb.__offset(this.bb_pos,10);return t?this.bb.readInt64(this.bb_pos+t):BigInt("0")}customMetadata(t,n){let r=this.bb.__offset(this.bb_pos,12);return r?(n||new en).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+r)+t*4),this.bb):null}customMetadataLength(){let t=this.bb.__offset(this.bb_pos,12);return t?this.bb.__vector_len(this.bb_pos+t):0}static startMessage(t){t.startObject(5)}static addVersion(t,n){t.addFieldInt16(0,n,ya.V1)}static addHeaderType(t,n){t.addFieldInt8(1,n,yu.NONE)}static addHeader(t,n){t.addFieldOffset(2,n,0)}static addBodyLength(t,n){t.addFieldInt64(3,n,BigInt("0"))}static addCustomMetadata(t,n){t.addFieldOffset(4,n,0)}static createCustomMetadataVector(t,n){t.startVector(4,n.length,4);for(let r=n.length-1;r>=0;r--)t.addOffset(n[r]);return t.endVector()}static startCustomMetadataVector(t,n){t.startVector(4,n,4)}static endMessage(t){return t.endObject()}static finishMessageBuffer(t,n){t.finish(n)}static finishSizePrefixedMessageBuffer(t,n){t.finish(n,void 0,!0)}static createMessage(t,n,r,i,o,s){return e.startMessage(t),e.addVersion(t,n),e.addHeaderType(t,r),e.addHeader(t,i),e.addBodyLength(t,o),e.addCustomMetadata(t,s),e.endMessage(t)}};var f2=class extends ut{visit(t,n){return t==null||n==null?void 0:super.visit(t,n)}visitNull(t,n){return th.startNull(n),th.endNull(n)}visitInt(t,n){return Bi.startInt(n),Bi.addBitWidth(n,t.bitWidth),Bi.addIsSigned(n,t.isSigned),Bi.endInt(n)}visitFloat(t,n){return _a.startFloatingPoint(n),_a.addPrecision(n,t.precision),_a.endFloatingPoint(n)}visitBinary(t,n){return Wd.startBinary(n),Wd.endBinary(n)}visitBool(t,n){return Hd.startBool(n),Hd.endBool(n)}visitUtf8(t,n){return rh.startUtf8(n),rh.endUtf8(n)}visitDecimal(t,n){return ro.startDecimal(n),ro.addScale(n,t.scale),ro.addPrecision(n,t.precision),ro.addBitWidth(n,t.bitWidth),ro.endDecimal(n)}visitDate(t,n){return xa.startDate(n),xa.addUnit(n,t.unit),xa.endDate(n)}visitTime(t,n){return os.startTime(n),os.addUnit(n,t.unit),os.addBitWidth(n,t.bitWidth),os.endTime(n)}visitTimestamp(t,n){let r=t.timezone&&n.createString(t.timezone)||void 0;return ss.startTimestamp(n),ss.addUnit(n,t.unit),r!==void 0&&ss.addTimezone(n,r),ss.endTimestamp(n)}visitInterval(t,n){return Sa.startInterval(n),Sa.addUnit(n,t.unit),Sa.endInterval(n)}visitDuration(t,n){return ba.startDuration(n),ba.addUnit(n,t.unit),ba.endDuration(n)}visitList(t,n){return Kd.startList(n),Kd.endList(n)}visitStruct(t,n){return eh.startStruct_(n),eh.endStruct_(n)}visitUnion(t,n){Ci.startTypeIdsVector(n,t.typeIds.length);let r=Ci.createTypeIdsVector(n,t.typeIds);return Ci.startUnion(n),Ci.addMode(n,t.mode),Ci.addTypeIds(n,r),Ci.endUnion(n)}visitDictionary(t,n){let r=this.visit(t.indices,n);return no.startDictionaryEncoding(n),no.addId(n,BigInt(t.id)),no.addIsOrdered(n,t.isOrdered),r!==void 0&&no.addIndexType(n,r),no.endDictionaryEncoding(n)}visitFixedSizeBinary(t,n){return wa.startFixedSizeBinary(n),wa.addByteWidth(n,t.byteWidth),wa.endFixedSizeBinary(n)}visitFixedSizeList(t,n){return va.startFixedSizeList(n),va.addListSize(n,t.listSize),va.endFixedSizeList(n)}visitMap(t,n){return Ia.startMap(n),Ia.addKeysSorted(n,t.keysSorted),Ia.endMap(n)}},I0=new f2;function ZO(e,t=new Map){return new re(cj(e,t),M0(e.metadata),t)}function d2(e){return new xn(e.count,QO(e.columns),KO(e.columns))}function JO(e){return new pr(d2(e.data),e.id,e.isDelta)}function cj(e,t){return(e.fields||[]).filter(Boolean).map(n=>Ut.fromJSON(n,t))}function GO(e,t){return(e.children||[]).filter(Boolean).map(n=>Ut.fromJSON(n,t))}function QO(e){return(e||[]).reduce((t,n)=>[...t,new Qr(n.count,lj(n.VALIDITY)),...QO(n.children)],[])}function KO(e,t=[]){for(let n=-1,r=(e||[]).length;++n<r;){let i=e[n];i.VALIDITY&&t.push(new hr(t.length,i.VALIDITY.length)),i.TYPE_ID&&t.push(new hr(t.length,i.TYPE_ID.length)),i.OFFSET&&t.push(new hr(t.length,i.OFFSET.length)),i.DATA&&t.push(new hr(t.length,i.DATA.length)),t=KO(i.children,t)}return t}function lj(e){return(e||[]).reduce((t,n)=>t+ +(n===0),0)}function t5(e,t){let n,r,i,o,s,a;return!t||!(o=e.dictionary)?(s=HO(e,GO(e,t)),i=new Ut(e.name,s,e.nullable,M0(e.metadata))):t.has(n=o.id)?(r=(r=o.indexType)?WO(r):new Ji,a=new Ar(t.get(n),r,n,o.isOrdered),i=new Ut(e.name,a,e.nullable,M0(e.metadata))):(r=(r=o.indexType)?WO(r):new Ji,t.set(n,s=HO(e,GO(e,t))),a=new Ar(s,r,n,o.isOrdered),i=new Ut(e.name,a,e.nullable,M0(e.metadata))),i||null}function M0(e=[]){return new Map(e.map(({key:t,value:n})=>[t,n]))}function WO(e){return new $e(e.isSigned,e.bitWidth)}function HO(e,t){let n=e.type.name;switch(n){case"NONE":return new jn;case"null":return new jn;case"binary":return new Wo;case"utf8":return new Ho;case"bool":return new Zo;case"list":return new Ai((t||[])[0]);case"struct":return new me(t||[]);case"struct_":return new me(t||[])}switch(n){case"int":{let r=e.type;return new $e(r.isSigned,r.bitWidth)}case"floatingpoint":{let r=e.type;return new ur(Se[r.precision])}case"decimal":{let r=e.type;return new Jo(r.scale,r.precision,r.bitWidth)}case"date":{let r=e.type;return new Qo(On[r.unit])}case"time":{let r=e.type;return new Mi(mt[r.unit],r.bitWidth)}case"timestamp":{let r=e.type;return new Ko(mt[r.unit],r.timezone)}case"interval":{let r=e.type;return new ts(cr[r.unit])}case"duration":{let r=e.type;return new es(mt[r.unit])}case"union":{let r=e.type,[i,...o]=(r.mode+"").toLowerCase(),s=i.toUpperCase()+o.join("");return new Ti(xe[s],r.typeIds||[],t||[])}case"fixedsizebinary":{let r=e.type;return new ns(r.byteWidth)}case"fixedsizelist":{let r=e.type;return new Ei(r.listSize,(t||[])[0])}case"map":{let r=e.type;return new Ni((t||[])[0],r.keysSorted)}}throw new Error(`Unrecognized type: "${n}"`)}var uj=Ec,fj=Nr,mr=class e{static fromJSON(t,n){let r=new e(0,Ee.V5,n);return r._createHeader=dj(t,n),r}static decode(t){t=new fj(Ot(t));let n=ki.getRootAsMessage(t),r=n.bodyLength(),i=n.version(),o=n.headerType(),s=new e(r,i,o);return s._createHeader=hj(n,o),s}static encode(t){let n=new uj,r=-1;return t.isSchema()?r=re.encode(n,t.header()):t.isRecordBatch()?r=xn.encode(n,t.header()):t.isDictionaryBatch()&&(r=pr.encode(n,t.header())),ki.startMessage(n),ki.addVersion(n,Ee.V5),ki.addHeader(n,r),ki.addHeaderType(n,t.headerType),ki.addBodyLength(n,BigInt(t.bodyLength)),ki.finishMessageBuffer(n,ki.endMessage(n)),n.asUint8Array()}static from(t,n=0){if(t instanceof re)return new e(0,Ee.V5,Qt.Schema,t);if(t instanceof xn)return new e(n,Ee.V5,Qt.RecordBatch,t);if(t instanceof pr)return new e(n,Ee.V5,Qt.DictionaryBatch,t);throw new Error(`Unrecognized Message header: ${t}`)}get type(){return this.headerType}get version(){return this._version}get headerType(){return this._headerType}get bodyLength(){return this._bodyLength}header(){return this._createHeader()}isSchema(){return this.headerType===Qt.Schema}isRecordBatch(){return this.headerType===Qt.RecordBatch}isDictionaryBatch(){return this.headerType===Qt.DictionaryBatch}constructor(t,n,r,i){this._version=n,this._headerType=r,this.body=new Uint8Array(0),i&&(this._createHeader=()=>i),this._bodyLength=lr(t)}},xn=class{get nodes(){return this._nodes}get length(){return this._length}get buffers(){return this._buffers}constructor(t,n,r){this._nodes=n,this._buffers=r,this._length=lr(t)}},pr=class{get id(){return this._id}get data(){return this._data}get isDelta(){return this._isDelta}get length(){return this.data.length}get nodes(){return this.data.nodes}get buffers(){return this.data.buffers}constructor(t,n,r=!1){this._data=t,this._isDelta=r,this._id=lr(n)}},hr=class{constructor(t,n){this.offset=lr(t),this.length=lr(n)}},Qr=class{constructor(t,n){this.length=lr(t),this.nullCount=lr(n)}};function dj(e,t){return()=>{switch(t){case Qt.Schema:return re.fromJSON(e);case Qt.RecordBatch:return xn.fromJSON(e);case Qt.DictionaryBatch:return pr.fromJSON(e)}throw new Error(`Unrecognized Message type: { name: ${Qt[t]}, type: ${t} }`)}}function hj(e,t){return()=>{switch(t){case Qt.Schema:return re.decode(e.header(new fr),new Map,e.version());case Qt.RecordBatch:return xn.decode(e.header(new Or),e.version());case Qt.DictionaryBatch:return pr.decode(e.header(new ms),e.version())}throw new Error(`Unrecognized Message type: { name: ${Qt[t]}, type: ${t} }`)}}Ut.encode=Ij;Ut.decode=_j;Ut.fromJSON=t5;re.encode=Sj;re.decode=pj;re.fromJSON=ZO;xn.encode=Mj;xn.decode=mj;xn.fromJSON=d2;pr.encode=Aj;pr.decode=yj;pr.fromJSON=JO;Qr.encode=Tj;Qr.decode=xj;hr.encode=Ej;hr.decode=gj;function pj(e,t=new Map,n=Ee.V5){let r=vj(e,t);return new re(r,A0(e),t,n)}function mj(e,t=Ee.V5){if(e.compression()!==null)throw new Error("Record batch compression not implemented");return new xn(e.length(),bj(e),wj(e,t))}function yj(e,t=Ee.V5){return new pr(xn.decode(e.data(),t),e.id(),e.isDelta())}function gj(e){return new hr(e.offset(),e.length())}function xj(e){return new Qr(e.length(),e.nullCount())}function bj(e){let t=[];for(let n,r=-1,i=-1,o=e.nodesLength();++r<o;)(n=e.nodes(r))&&(t[++i]=Qr.decode(n));return t}function wj(e,t){let n=[];for(let r,i=-1,o=-1,s=e.buffersLength();++i<s;)(r=e.buffers(i))&&(t<Ee.V4&&(r.bb_pos+=8*(i+1)),n[++o]=hr.decode(r));return n}function vj(e,t){let n=[];for(let r,i=-1,o=-1,s=e.fieldsLength();++i<s;)(r=e.fields(i))&&(n[++o]=Ut.decode(r,t));return n}function e5(e,t){let n=[];for(let r,i=-1,o=-1,s=e.childrenLength();++i<s;)(r=e.children(i))&&(n[++o]=Ut.decode(r,t));return n}function _j(e,t){let n,r,i,o,s,a;return!t||!(a=e.dictionary())?(i=r5(e,e5(e,t)),r=new Ut(e.name(),i,e.nullable(),A0(e))):t.has(n=lr(a.id()))?(o=(o=a.indexType())?n5(o):new Ji,s=new Ar(t.get(n),o,n,a.isOrdered()),r=new Ut(e.name(),s,e.nullable(),A0(e))):(o=(o=a.indexType())?n5(o):new Ji,t.set(n,i=r5(e,e5(e,t))),s=new Ar(i,o,n,a.isOrdered()),r=new Ut(e.name(),s,e.nullable(),A0(e))),r||null}function A0(e){let t=new Map;if(e)for(let n,r,i=-1,o=Math.trunc(e.customMetadataLength());++i<o;)(n=e.customMetadata(i))&&(r=n.key())!=null&&t.set(r,n.value());return t}function n5(e){return new $e(e.isSigned(),e.bitWidth())}function r5(e,t){let n=e.typeType();switch(n){case ye.NONE:return new jn;case ye.Null:return new jn;case ye.Binary:return new Wo;case ye.Utf8:return new Ho;case ye.Bool:return new Zo;case ye.List:return new Ai((t||[])[0]);case ye.Struct_:return new me(t||[])}switch(n){case ye.Int:{let r=e.type(new Bi);return new $e(r.isSigned(),r.bitWidth())}case ye.FloatingPoint:{let r=e.type(new _a);return new ur(r.precision())}case ye.Decimal:{let r=e.type(new ro);return new Jo(r.scale(),r.precision(),r.bitWidth())}case ye.Date:{let r=e.type(new xa);return new Qo(r.unit())}case ye.Time:{let r=e.type(new os);return new Mi(r.unit(),r.bitWidth())}case ye.Timestamp:{let r=e.type(new ss);return new Ko(r.unit(),r.timezone())}case ye.Interval:{let r=e.type(new Sa);return new ts(r.unit())}case ye.Duration:{let r=e.type(new ba);return new es(r.unit())}case ye.Union:{let r=e.type(new Ci);return new Ti(r.mode(),r.typeIdsArray()||[],t||[])}case ye.FixedSizeBinary:{let r=e.type(new wa);return new ns(r.byteWidth())}case ye.FixedSizeList:{let r=e.type(new va);return new Ei(r.listSize(),(t||[])[0])}case ye.Map:{let r=e.type(new Ia);return new Ni((t||[])[0],r.keysSorted())}}throw new Error(`Unrecognized type: "${ye[n]}" (${n})`)}function Sj(e,t){let n=t.fields.map(o=>Ut.encode(e,o));fr.startFieldsVector(e,n.length);let r=fr.createFieldsVector(e,n),i=t.metadata&&t.metadata.size>0?fr.createCustomMetadataVector(e,[...t.metadata].map(([o,s])=>{let a=e.createString(`${o}`),c=e.createString(`${s}`);return en.startKeyValue(e),en.addKey(e,a),en.addValue(e,c),en.endKeyValue(e)})):-1;return fr.startSchema(e),fr.addFields(e,r),fr.addEndianness(e,Nj?ga.Little:ga.Big),i!==-1&&fr.addCustomMetadata(e,i),fr.endSchema(e)}function Ij(e,t){let n=-1,r=-1,i=-1,o=t.type,s=t.typeId;at.isDictionary(o)?(s=o.dictionary.typeId,i=I0.visit(o,e),r=I0.visit(o.dictionary,e)):r=I0.visit(o,e);let a=(o.children||[]).map(u=>Ut.encode(e,u)),c=Bn.createChildrenVector(e,a),l=t.metadata&&t.metadata.size>0?Bn.createCustomMetadataVector(e,[...t.metadata].map(([u,f])=>{let d=e.createString(`${u}`),h=e.createString(`${f}`);return en.startKeyValue(e),en.addKey(e,d),en.addValue(e,h),en.endKeyValue(e)})):-1;return t.name&&(n=e.createString(t.name)),Bn.startField(e),Bn.addType(e,r),Bn.addTypeType(e,s),Bn.addChildren(e,c),Bn.addNullable(e,!!t.nullable),n!==-1&&Bn.addName(e,n),i!==-1&&Bn.addDictionary(e,i),l!==-1&&Bn.addCustomMetadata(e,l),Bn.endField(e)}function Mj(e,t){let n=t.nodes||[],r=t.buffers||[];Or.startNodesVector(e,n.length);for(let s of n.slice().reverse())Qr.encode(e,s);let i=e.endVector();Or.startBuffersVector(e,r.length);for(let s of r.slice().reverse())hr.encode(e,s);let o=e.endVector();return Or.startRecordBatch(e),Or.addLength(e,BigInt(t.length)),Or.addNodes(e,i),Or.addBuffers(e,o),Or.endRecordBatch(e)}function Aj(e,t){let n=xn.encode(e,t.data);return ms.startDictionaryBatch(e),ms.addId(e,BigInt(t.id)),ms.addIsDelta(e,t.isDelta),ms.addData(e,n),ms.endDictionaryBatch(e)}function Tj(e,t){return mu.createFieldNode(e,BigInt(t.length),BigInt(t.nullCount))}function Ej(e,t){return pu.createBuffer(e,BigInt(t.offset),BigInt(t.length))}var Nj=(()=>{let e=new ArrayBuffer(2);return new DataView(e).setInt16(0,256,!0),new Int16Array(e)[0]===256})();var p2=e=>`Expected ${Qt[e]} Message in stream, but was null or length 0.`,m2=e=>`Header pointer of flatbuffer-encoded ${Qt[e]} Message is null or length 0.`,i5=(e,t)=>`Expected to read ${e} metadata bytes, but only read ${t}.`,o5=(e,t)=>`Expected to read ${e} bytes for message body, but only read ${t}.`,gu=class{constructor(t){this.source=t instanceof oo?t:new oo(t)}[Symbol.iterator](){return this}next(){let t;return(t=this.readMetadataLength()).done?ge:t.value===-1&&(t=this.readMetadataLength()).done?ge:(t=this.readMetadata(t.value)).done?ge:t}throw(t){return this.source.throw(t)}return(t){return this.source.return(t)}readMessage(t){let n;if((n=this.next()).done)return null;if(t!=null&&n.value.headerType!==t)throw new Error(p2(t));return n.value}readMessageBody(t){if(t<=0)return new Uint8Array(0);let n=Ot(this.source.read(t));if(n.byteLength<t)throw new Error(o5(t,n.byteLength));return n.byteOffset%8===0&&n.byteOffset+n.byteLength<=n.buffer.byteLength?n:n.slice()}readSchema(t=!1){let n=Qt.Schema,r=this.readMessage(n),i=r?.header();if(t&&!i)throw new Error(m2(n));return i}readMetadataLength(){let t=this.source.read(T0),n=t&&new Nr(t),r=n?.readInt32(0)||0;return{done:r===0,value:r}}readMetadata(t){let n=this.source.read(t);if(!n)return ge;if(n.byteLength<t)throw new Error(i5(t,n.byteLength));return{done:!1,value:mr.decode(n)}}},Ch=class{constructor(t,n){this.source=t instanceof Zr?t:ag(t)?new Ma(t,n):new Zr(t)}[Symbol.asyncIterator](){return this}next(){return Z(this,void 0,void 0,function*(){let t;return(t=yield this.readMetadataLength()).done?ge:t.value===-1&&(t=yield this.readMetadataLength()).done?ge:(t=yield this.readMetadata(t.value)).done?ge:t})}throw(t){return Z(this,void 0,void 0,function*(){return yield this.source.throw(t)})}return(t){return Z(this,void 0,void 0,function*(){return yield this.source.return(t)})}readMessage(t){return Z(this,void 0,void 0,function*(){let n;if((n=yield this.next()).done)return null;if(t!=null&&n.value.headerType!==t)throw new Error(p2(t));return n.value})}readMessageBody(t){return Z(this,void 0,void 0,function*(){if(t<=0)return new Uint8Array(0);let n=Ot(yield this.source.read(t));if(n.byteLength<t)throw new Error(o5(t,n.byteLength));return n.byteOffset%8===0&&n.byteOffset+n.byteLength<=n.buffer.byteLength?n:n.slice()})}readSchema(t=!1){return Z(this,void 0,void 0,function*(){let n=Qt.Schema,r=yield this.readMessage(n),i=r?.header();if(t&&!i)throw new Error(m2(n));return i})}readMetadataLength(){return Z(this,void 0,void 0,function*(){let t=yield this.source.read(T0),n=t&&new Nr(t),r=n?.readInt32(0)||0;return{done:r===0,value:r}})}readMetadata(t){return Z(this,void 0,void 0,function*(){let n=yield this.source.read(t);if(!n)return ge;if(n.byteLength<t)throw new Error(i5(t,n.byteLength));return{done:!1,value:mr.decode(n)}})}},kh=class extends gu{constructor(t){super(new Uint8Array(0)),this._schema=!1,this._body=[],this._batchIndex=0,this._dictionaryIndex=0,this._json=t instanceof ih?t:new ih(t)}next(){let{_json:t}=this;if(!this._schema)return this._schema=!0,{done:!1,value:mr.fromJSON(t.schema,Qt.Schema)};if(this._dictionaryIndex<t.dictionaries.length){let n=t.dictionaries[this._dictionaryIndex++];return this._body=n.data.columns,{done:!1,value:mr.fromJSON(n,Qt.DictionaryBatch)}}if(this._batchIndex<t.batches.length){let n=t.batches[this._batchIndex++];return this._body=n.columns,{done:!1,value:mr.fromJSON(n,Qt.RecordBatch)}}return this._body=[],ge}readMessageBody(t){return n(this._body);function n(r){return(r||[]).reduce((i,o)=>[...i,...o.VALIDITY&&[o.VALIDITY]||[],...o.TYPE_ID&&[o.TYPE_ID]||[],...o.OFFSET&&[o.OFFSET]||[],...o.DATA&&[o.DATA]||[],...n(o.children)],[])}}readMessage(t){let n;if((n=this.next()).done)return null;if(t!=null&&n.value.headerType!==t)throw new Error(p2(t));return n.value}readSchema(){let t=Qt.Schema,n=this.readMessage(t),r=n?.header();if(!n||!r)throw new Error(m2(t));return r}},T0=4,h2="ARROW1",xu=new Uint8Array(h2.length);for(let e=0;e<h2.length;e+=1)xu[e]=h2.codePointAt(e);function E0(e,t=0){for(let n=-1,r=xu.length;++n<r;)if(xu[n]!==e[t+n])return!1;return!0}var bu=xu.length,y2=bu+T0,s5=bu*2+T0;var Br=class e extends Nc{constructor(t){super(),this._impl=t}get closed(){return this._impl.closed}get schema(){return this._impl.schema}get autoDestroy(){return this._impl.autoDestroy}get dictionaries(){return this._impl.dictionaries}get numDictionaries(){return this._impl.numDictionaries}get numRecordBatches(){return this._impl.numRecordBatches}get footer(){return this._impl.isFile()?this._impl.footer:null}isSync(){return this._impl.isSync()}isAsync(){return this._impl.isAsync()}isFile(){return this._impl.isFile()}isStream(){return this._impl.isStream()}next(){return this._impl.next()}throw(t){return this._impl.throw(t)}return(t){return this._impl.return(t)}cancel(){return this._impl.cancel()}reset(t){return this._impl.reset(t),this._DOMStream=void 0,this._nodeStream=void 0,this}open(t){let n=this._impl.open(t);return Ir(n)?n.then(()=>this):this}readRecordBatch(t){return this._impl.isFile()?this._impl.readRecordBatch(t):null}[Symbol.iterator](){return this._impl[Symbol.iterator]()}[Symbol.asyncIterator](){return this._impl[Symbol.asyncIterator]()}toDOMStream(){return yn.toDOMStream(this.isSync()?{[Symbol.iterator]:()=>this}:{[Symbol.asyncIterator]:()=>this})}toNodeStream(){return yn.toNodeStream(this.isSync()?{[Symbol.iterator]:()=>this}:{[Symbol.asyncIterator]:()=>this},{objectMode:!0})}static throughNode(t){throw new Error('"throughNode" not available in this environment')}static throughDOM(t,n){throw new Error('"throughDOM" not available in this environment')}static from(t){return t instanceof e?t:og(t)?Oj(t):ag(t)?Cj(t):Ir(t)?Z(this,void 0,void 0,function*(){return yield e.from(yield t)}):cg(t)||$d(t)||ug(t)||Gr(t)?Lj(new Zr(t)):Bj(new oo(t))}static readAll(t){return t instanceof e?t.isSync()?a5(t):c5(t):og(t)||ArrayBuffer.isView(t)||wi(t)||sg(t)?a5(t):c5(t)}},ys=class extends Br{constructor(t){super(t),this._impl=t}readAll(){return[...this]}[Symbol.iterator](){return this._impl[Symbol.iterator]()}[Symbol.asyncIterator](){return Sr(this,arguments,function*(){yield Ft(yield*Jl(bi(this[Symbol.iterator]())))})}},Fc=class extends Br{constructor(t){super(t),this._impl=t}readAll(){var t,n,r,i;return Z(this,void 0,void 0,function*(){let o=new Array;try{for(var s=!0,a=bi(this),c;c=yield a.next(),t=c.done,!t;s=!0){i=c.value,s=!1;let l=i;o.push(l)}}catch(l){n={error:l}}finally{try{!s&&!t&&(r=a.return)&&(yield r.call(a))}finally{if(n)throw n.error}}return o})}[Symbol.iterator](){throw new Error("AsyncRecordBatchStreamReader is not Iterable")}[Symbol.asyncIterator](){return this._impl[Symbol.asyncIterator]()}},Rc=class extends ys{constructor(t){super(t),this._impl=t}},N0=class extends Fc{constructor(t){super(t),this._impl=t}},D0=class{get numDictionaries(){return this._dictionaryIndex}get numRecordBatches(){return this._recordBatchIndex}constructor(t=new Map){this.closed=!1,this.autoDestroy=!0,this._dictionaryIndex=0,this._recordBatchIndex=0,this.dictionaries=t}isSync(){return!1}isAsync(){return!1}isFile(){return!1}isStream(){return!1}reset(t){return this._dictionaryIndex=0,this._recordBatchIndex=0,this.schema=t,this.dictionaries=new Map,this}_loadRecordBatch(t,n){let r=this._loadVectors(t,n,this.schema.fields),i=Bt({type:new me(this.schema.fields),length:t.length,children:r});return new Le(this.schema,i)}_loadDictionaryBatch(t,n){let{id:r,isDelta:i}=t,{dictionaries:o,schema:s}=this,a=o.get(r);if(i||!a){let c=s.dictionaries.get(r),l=this._loadVectors(t.data,n,[c]);return(a&&i?a.concat(new Yt(l)):new Yt(l)).memoize()}return a.memoize()}_loadVectors(t,n,r){return new ch(n,t.nodes,t.buffers,this.dictionaries,this.schema.metadataVersion).visitMany(r)}},wu=class extends D0{constructor(t,n){super(n),this._reader=og(t)?new kh(this._handle=t):new gu(this._handle=t)}isSync(){return!0}isStream(){return!0}[Symbol.iterator](){return this}cancel(){!this.closed&&(this.closed=!0)&&(this.reset()._reader.return(),this._reader=null,this.dictionaries=null)}open(t){return this.closed||(this.autoDestroy=l5(this,t),this.schema||(this.schema=this._reader.readSchema())||this.cancel()),this}throw(t){return!this.closed&&this.autoDestroy&&(this.closed=!0)?this.reset()._reader.throw(t):ge}return(t){return!this.closed&&this.autoDestroy&&(this.closed=!0)?this.reset()._reader.return(t):ge}next(){if(this.closed)return ge;let t,{_reader:n}=this;for(;t=this._readNextMessageAndValidate();)if(t.isSchema())this.reset(t.header());else if(t.isRecordBatch()){this._recordBatchIndex++;let r=t.header(),i=n.readMessageBody(t.bodyLength);return{done:!1,value:this._loadRecordBatch(r,i)}}else if(t.isDictionaryBatch()){this._dictionaryIndex++;let r=t.header(),i=n.readMessageBody(t.bodyLength),o=this._loadDictionaryBatch(r,i);this.dictionaries.set(r.id,o)}return this.schema&&this._recordBatchIndex===0?(this._recordBatchIndex++,{done:!1,value:new kc(this.schema)}):this.return()}_readNextMessageAndValidate(t){return this._reader.readMessage(t)}},vu=class extends D0{constructor(t,n){super(n),this._reader=new Ch(this._handle=t)}isAsync(){return!0}isStream(){return!0}[Symbol.asyncIterator](){return this}cancel(){return Z(this,void 0,void 0,function*(){!this.closed&&(this.closed=!0)&&(yield this.reset()._reader.return(),this._reader=null,this.dictionaries=null)})}open(t){return Z(this,void 0,void 0,function*(){return this.closed||(this.autoDestroy=l5(this,t),this.schema||(this.schema=yield this._reader.readSchema())||(yield this.cancel())),this})}throw(t){return Z(this,void 0,void 0,function*(){return!this.closed&&this.autoDestroy&&(this.closed=!0)?yield this.reset()._reader.throw(t):ge})}return(t){return Z(this,void 0,void 0,function*(){return!this.closed&&this.autoDestroy&&(this.closed=!0)?yield this.reset()._reader.return(t):ge})}next(){return Z(this,void 0,void 0,function*(){if(this.closed)return ge;let t,{_reader:n}=this;for(;t=yield this._readNextMessageAndValidate();)if(t.isSchema())yield this.reset(t.header());else if(t.isRecordBatch()){this._recordBatchIndex++;let r=t.header(),i=yield n.readMessageBody(t.bodyLength);return{done:!1,value:this._loadRecordBatch(r,i)}}else if(t.isDictionaryBatch()){this._dictionaryIndex++;let r=t.header(),i=yield n.readMessageBody(t.bodyLength),o=this._loadDictionaryBatch(r,i);this.dictionaries.set(r.id,o)}return this.schema&&this._recordBatchIndex===0?(this._recordBatchIndex++,{done:!1,value:new kc(this.schema)}):yield this.return()})}_readNextMessageAndValidate(t){return Z(this,void 0,void 0,function*(){return yield this._reader.readMessage(t)})}},O0=class extends wu{get footer(){return this._footer}get numDictionaries(){return this._footer?this._footer.numDictionaries:0}get numRecordBatches(){return this._footer?this._footer.numRecordBatches:0}constructor(t,n){super(t instanceof oh?t:new oh(t),n)}isSync(){return!0}isFile(){return!0}open(t){if(!this.closed&&!this._footer){this.schema=(this._footer=this._readFooter()).schema;for(let n of this._footer.dictionaryBatches())n&&this._readDictionaryBatch(this._dictionaryIndex++)}return super.open(t)}readRecordBatch(t){var n;if(this.closed)return null;this._footer||this.open();let r=(n=this._footer)===null||n===void 0?void 0:n.getRecordBatch(t);if(r&&this._handle.seek(r.offset)){let i=this._reader.readMessage(Qt.RecordBatch);if(i?.isRecordBatch()){let o=i.header(),s=this._reader.readMessageBody(i.bodyLength);return this._loadRecordBatch(o,s)}}return null}_readDictionaryBatch(t){var n;let r=(n=this._footer)===null||n===void 0?void 0:n.getDictionaryBatch(t);if(r&&this._handle.seek(r.offset)){let i=this._reader.readMessage(Qt.DictionaryBatch);if(i?.isDictionaryBatch()){let o=i.header(),s=this._reader.readMessageBody(i.bodyLength),a=this._loadDictionaryBatch(o,s);this.dictionaries.set(o.id,a)}}}_readFooter(){let{_handle:t}=this,n=t.size-y2,r=t.readInt32(n),i=t.readAt(n-r,r);return as.decode(i)}_readNextMessageAndValidate(t){var n;if(this._footer||this.open(),this._footer&&this._recordBatchIndex<this.numRecordBatches){let r=(n=this._footer)===null||n===void 0?void 0:n.getRecordBatch(this._recordBatchIndex);if(r&&this._handle.seek(r.offset))return this._reader.readMessage(t)}return null}},g2=class extends vu{get footer(){return this._footer}get numDictionaries(){return this._footer?this._footer.numDictionaries:0}get numRecordBatches(){return this._footer?this._footer.numRecordBatches:0}constructor(t,...n){let r=typeof n[0]!="number"?n.shift():void 0,i=n[0]instanceof Map?n.shift():void 0;super(t instanceof Ma?t:new Ma(t,r),i)}isFile(){return!0}isAsync(){return!0}open(t){let n=Object.create(null,{open:{get:()=>super.open}});return Z(this,void 0,void 0,function*(){if(!this.closed&&!this._footer){this.schema=(this._footer=yield this._readFooter()).schema;for(let r of this._footer.dictionaryBatches())r&&(yield this._readDictionaryBatch(this._dictionaryIndex++))}return yield n.open.call(this,t)})}readRecordBatch(t){var n;return Z(this,void 0,void 0,function*(){if(this.closed)return null;this._footer||(yield this.open());let r=(n=this._footer)===null||n===void 0?void 0:n.getRecordBatch(t);if(r&&(yield this._handle.seek(r.offset))){let i=yield this._reader.readMessage(Qt.RecordBatch);if(i?.isRecordBatch()){let o=i.header(),s=yield this._reader.readMessageBody(i.bodyLength);return this._loadRecordBatch(o,s)}}return null})}_readDictionaryBatch(t){var n;return Z(this,void 0,void 0,function*(){let r=(n=this._footer)===null||n===void 0?void 0:n.getDictionaryBatch(t);if(r&&(yield this._handle.seek(r.offset))){let i=yield this._reader.readMessage(Qt.DictionaryBatch);if(i?.isDictionaryBatch()){let o=i.header(),s=yield this._reader.readMessageBody(i.bodyLength),a=this._loadDictionaryBatch(o,s);this.dictionaries.set(o.id,a)}}})}_readFooter(){return Z(this,void 0,void 0,function*(){let{_handle:t}=this;t._pending&&(yield t._pending);let n=t.size-y2,r=yield t.readInt32(n),i=yield t.readAt(n-r,r);return as.decode(i)})}_readNextMessageAndValidate(t){return Z(this,void 0,void 0,function*(){if(this._footer||(yield this.open()),this._footer&&this._recordBatchIndex<this.numRecordBatches){let n=this._footer.getRecordBatch(this._recordBatchIndex);if(n&&(yield this._handle.seek(n.offset)))return yield this._reader.readMessage(t)}return null})}},x2=class extends wu{constructor(t,n){super(t,n)}_loadVectors(t,n,r){return new t0(n,t.nodes,t.buffers,this.dictionaries,this.schema.metadataVersion).visitMany(r)}};function l5(e,t){return t&&typeof t.autoDestroy=="boolean"?t.autoDestroy:e.autoDestroy}function*a5(e){let t=Br.from(e);try{if(!t.open({autoDestroy:!1}).closed)do yield t;while(!t.reset().open().closed)}finally{t.cancel()}}function c5(e){return Sr(this,arguments,function*(){let n=yield Ft(Br.from(e));try{if(!(yield Ft(n.open({autoDestroy:!1}))).closed)do yield yield Ft(n);while(!(yield Ft(n.reset().open())).closed)}finally{yield Ft(n.cancel())}})}function Oj(e){return new ys(new x2(e))}function Bj(e){let t=e.peek(bu+7&-8);return t&&t.byteLength>=4?E0(t)?new Rc(new O0(e.read())):new ys(new wu(e)):new ys(new wu(function*(){}()))}function Lj(e){return Z(this,void 0,void 0,function*(){let t=yield e.peek(bu+7&-8);return t&&t.byteLength>=4?E0(t)?new Rc(new O0(yield e.read())):new Fc(new vu(e)):new Fc(new vu(function(){return Sr(this,arguments,function*(){})}()))})}function Cj(e){return Z(this,void 0,void 0,function*(){let{size:t}=yield e.stat(),n=new Ma(e,t);return t>=s5&&E0(yield n.readAt(0,bu+7&-8))?new N0(new g2(n)):new Fc(new vu(n))})}var Ce=class e extends ut{static assemble(...t){let n=i=>i.flatMap(o=>Array.isArray(o)?n(o):o instanceof Le?o.data.children:o.data),r=new e;return r.visitMany(n(t)),r}constructor(){super(),this._byteLength=0,this._nodes=[],this._buffers=[],this._bufferRegions=[]}visit(t){if(t instanceof Yt)return this.visitMany(t.data),this;let{type:n}=t;if(!at.isDictionary(n)){let{length:r}=t;if(r>2147483647)throw new RangeError("Cannot write arrays larger than 2^31 - 1 in length");if(at.isUnion(n))this.nodes.push(new Qr(r,0));else{let{nullCount:i}=t;at.isNull(n)||Fi.call(this,i<=0?new Uint8Array(0):Ic(t.offset,r,t.nullBitmap)),this.nodes.push(new Qr(r,i))}}return super.visit(t)}visitNull(t){return this}visitDictionary(t){return this.visit(t.clone(t.type.indices))}get nodes(){return this._nodes}get buffers(){return this._buffers}get byteLength(){return this._byteLength}get bufferRegions(){return this._bufferRegions}};function Fi(e){let t=e.byteLength+7&-8;return this.buffers.push(e),this.bufferRegions.push(new hr(this._byteLength,t)),this._byteLength+=t,this}function kj(e){var t;let{type:n,length:r,typeIds:i,valueOffsets:o}=e;if(Fi.call(this,i),n.mode===xe.Sparse)return b2.call(this,e);if(n.mode===xe.Dense){if(e.offset<=0)return Fi.call(this,o),b2.call(this,e);{let s=new Int32Array(r),a=Object.create(null),c=Object.create(null);for(let l,u,f=-1;++f<r;)(l=i[f])!==void 0&&((u=a[l])===void 0&&(u=a[l]=o[f]),s[f]=o[f]-u,c[l]=((t=c[l])!==null&&t!==void 0?t:0)+1);Fi.call(this,s),this.visitMany(e.children.map((l,u)=>{let f=n.typeIds[u],d=a[f],h=c[f];return l.slice(d,Math.min(r,h))}))}}return this}function Fj(e){let t;return e.nullCount>=e.length?Fi.call(this,new Uint8Array(0)):(t=e.values)instanceof Uint8Array?Fi.call(this,Ic(e.offset,e.length,t)):Fi.call(this,Mc(e.values))}function gs(e){return Fi.call(this,e.values.subarray(0,e.length*e.stride))}function u5(e){let{length:t,values:n,valueOffsets:r}=e,{[0]:i,[t]:o}=r,s=Math.min(o-i,n.byteLength-i);return Fi.call(this,fg(-i,t+1,r)),Fi.call(this,n.subarray(i,i+s)),this}function w2(e){let{length:t,valueOffsets:n}=e;if(n){let{[0]:r,[t]:i}=n;return Fi.call(this,fg(-r,t+1,n)),this.visit(e.children[0].slice(r,i-r))}return this.visit(e.children[0])}function b2(e){return this.visitMany(e.type.children.map((t,n)=>e.children[n]).filter(Boolean))[0]}Ce.prototype.visitBool=Fj;Ce.prototype.visitInt=gs;Ce.prototype.visitFloat=gs;Ce.prototype.visitUtf8=u5;Ce.prototype.visitBinary=u5;Ce.prototype.visitFixedSizeBinary=gs;Ce.prototype.visitDate=gs;Ce.prototype.visitTimestamp=gs;Ce.prototype.visitTime=gs;Ce.prototype.visitDecimal=gs;Ce.prototype.visitList=w2;Ce.prototype.visitStruct=b2;Ce.prototype.visitUnion=kj;Ce.prototype.visitInterval=gs;Ce.prototype.visitDuration=gs;Ce.prototype.visitFixedSizeList=w2;Ce.prototype.visitMap=w2;var $c=class extends Nc{static throughNode(t){throw new Error('"throughNode" not available in this environment')}static throughDOM(t,n){throw new Error('"throughDOM" not available in this environment')}constructor(t){super(),this._position=0,this._started=!1,this._sink=new io,this._schema=null,this._dictionaryBlocks=[],this._recordBatchBlocks=[],this._dictionaryDeltaOffsets=new Map,qn(t)||(t={autoDestroy:!0,writeLegacyIpcFormat:!1}),this._autoDestroy=typeof t.autoDestroy=="boolean"?t.autoDestroy:!0,this._writeLegacyIpcFormat=typeof t.writeLegacyIpcFormat=="boolean"?t.writeLegacyIpcFormat:!1}toString(t=!1){return this._sink.toString(t)}toUint8Array(t=!1){return this._sink.toUint8Array(t)}writeAll(t){return Ir(t)?t.then(n=>this.writeAll(n)):Gr(t)?_2(this,t):v2(this,t)}get closed(){return this._sink.closed}[Symbol.asyncIterator](){return this._sink[Symbol.asyncIterator]()}toDOMStream(t){return this._sink.toDOMStream(t)}toNodeStream(t){return this._sink.toNodeStream(t)}close(){return this.reset()._sink.close()}abort(t){return this.reset()._sink.abort(t)}finish(){return this._autoDestroy?this.close():this.reset(this._sink,this._schema),this}reset(t=this._sink,n=null){return t===this._sink||t instanceof io?this._sink=t:(this._sink=new io,t&&ND(t)?this.toDOMStream({type:"bytes"}).pipeTo(t):t&&DD(t)&&this.toNodeStream({objectMode:!1}).pipe(t)),this._started&&this._schema&&this._writeFooter(this._schema),this._started=!1,this._dictionaryBlocks=[],this._recordBatchBlocks=[],this._dictionaryDeltaOffsets=new Map,(!n||!Cc(n,this._schema))&&(n==null?(this._position=0,this._schema=null):(this._started=!0,this._schema=n,this._writeSchema(n))),this}write(t){let n=null;if(this._sink){if(t==null)return this.finish()&&void 0;if(t instanceof dr&&!(n=t.schema))return this.finish()&&void 0;if(t instanceof Le&&!(n=t.schema))return this.finish()&&void 0}else throw new Error("RecordBatchWriter is closed");if(n&&!Cc(n,this._schema)){if(this._started&&this._autoDestroy)return this.close();this.reset(this._sink,n)}t instanceof Le?t instanceof kc||this._writeRecordBatch(t):t instanceof dr?this.writeAll(t.batches):wi(t)&&this.writeAll(t)}_writeMessage(t,n=8){let r=n-1,i=mr.encode(t),o=i.byteLength,s=this._writeLegacyIpcFormat?4:8,a=o+s+r&~r,c=a-o-s;return t.headerType===Qt.RecordBatch?this._recordBatchBlocks.push(new cs(a,t.bodyLength,this._position)):t.headerType===Qt.DictionaryBatch&&this._dictionaryBlocks.push(new cs(a,t.bodyLength,this._position)),this._writeLegacyIpcFormat||this._write(Int32Array.of(-1)),this._write(Int32Array.of(a-s)),o>0&&this._write(i),this._writePadding(c)}_write(t){if(this._started){let n=Ot(t);n&&n.byteLength>0&&(this._sink.write(n),this._position+=n.byteLength)}return this}_writeSchema(t){return this._writeMessage(mr.from(t))}_writeFooter(t){return this._writeLegacyIpcFormat?this._write(Int32Array.of(0)):this._write(Int32Array.of(-1,0))}_writeMagic(){return this._write(xu)}_writePadding(t){return t>0?this._write(new Uint8Array(t)):this}_writeRecordBatch(t){let{byteLength:n,nodes:r,bufferRegions:i,buffers:o}=Ce.assemble(t),s=new xn(t.numRows,r,i),a=mr.from(s,n);return this._writeDictionaries(t)._writeMessage(a)._writeBodyBuffers(o)}_writeDictionaryBatch(t,n,r=!1){this._dictionaryDeltaOffsets.set(n,t.length+(this._dictionaryDeltaOffsets.get(n)||0));let{byteLength:i,nodes:o,bufferRegions:s,buffers:a}=Ce.assemble(new Yt([t])),c=new xn(t.length,o,s),l=new pr(c,n,r),u=mr.from(l,i);return this._writeMessage(u)._writeBodyBuffers(a)}_writeBodyBuffers(t){let n,r,i;for(let o=-1,s=t.length;++o<s;)(n=t[o])&&(r=n.byteLength)>0&&(this._write(n),(i=(r+7&-8)-r)>0&&this._writePadding(i));return this}_writeDictionaries(t){for(let[n,r]of t.dictionaries){let i=this._dictionaryDeltaOffsets.get(n)||0;if(i===0||(r=r?.slice(i)).length>0)for(let o of r.data)this._writeDictionaryBatch(o,n,i>0),i+=o.length}return this}},Fh=class e extends $c{static writeAll(t,n){let r=new e(n);return Ir(t)?t.then(i=>r.writeAll(i)):Gr(t)?_2(r,t):v2(r,t)}},Rh=class e extends $c{static writeAll(t){let n=new e;return Ir(t)?t.then(r=>n.writeAll(r)):Gr(t)?_2(n,t):v2(n,t)}constructor(){super(),this._autoDestroy=!0}_writeSchema(t){return this._writeMagic()._writePadding(2)}_writeFooter(t){let n=as.encode(new as(t,Ee.V5,this._recordBatchBlocks,this._dictionaryBlocks));return super._writeFooter(t)._write(n)._write(Int32Array.of(n.byteLength))._writeMagic()}};function v2(e,t){let n=t;t instanceof dr&&(n=t.batches,e.reset(void 0,t.schema));for(let r of n)e.write(r);return e.finish()}function _2(e,t){var n,r,i,o,s,a,c;return Z(this,void 0,void 0,function*(){try{for(n=!0,r=bi(t);i=yield r.next(),o=i.done,!o;n=!0){c=i.value,n=!1;let l=c;e.write(l)}}catch(l){s={error:l}}finally{try{!n&&!o&&(a=r.return)&&(yield a.call(r))}finally{if(s)throw s.error}}return e.finish()})}function f5(e,t){if(Gr(e))return $j(e,t);if(wi(e))return Rj(e,t);throw new Error("toDOMStream() must be called with an Iterable or AsyncIterable")}function Rj(e,t){let n=null,r=t?.type==="bytes"||!1,i=t?.highWaterMark||Math.pow(2,24);return new ReadableStream(Object.assign(Object.assign({},t),{start(s){o(s,n||(n=e[Symbol.iterator]()))},pull(s){n?o(s,n):s.close()},cancel(){(n?.return&&n.return()||!0)&&(n=null)}}),Object.assign({highWaterMark:r?i:void 0},t));function o(s,a){let c,l=null,u=s.desiredSize||null;for(;!(l=a.next(r?u:null)).done;)if(ArrayBuffer.isView(l.value)&&(c=Ot(l.value))&&(u!=null&&r&&(u=u-c.byteLength+1),l.value=c),s.enqueue(l.value),u!=null&&--u<=0)return;s.close()}}function $j(e,t){let n=null,r=t?.type==="bytes"||!1,i=t?.highWaterMark||Math.pow(2,24);return new ReadableStream(Object.assign(Object.assign({},t),{start(s){return Z(this,void 0,void 0,function*(){yield o(s,n||(n=e[Symbol.asyncIterator]()))})},pull(s){return Z(this,void 0,void 0,function*(){n?yield o(s,n):s.close()})},cancel(){return Z(this,void 0,void 0,function*(){(n?.return&&(yield n.return())||!0)&&(n=null)})}}),Object.assign({highWaterMark:r?i:void 0},t));function o(s,a){return Z(this,void 0,void 0,function*(){let c,l=null,u=s.desiredSize||null;for(;!(l=yield a.next(r?u:null)).done;)if(ArrayBuffer.isView(l.value)&&(c=Ot(l.value))&&(u!=null&&r&&(u=u-c.byteLength+1),l.value=c),s.enqueue(l.value),u!=null&&--u<=0)return;s.close()})}}function p5(e){return new S2(e)}var S2=class{constructor(t){this._numChunks=0,this._finished=!1,this._bufferedSize=0;let{["readableStrategy"]:n,["writableStrategy"]:r,["queueingStrategy"]:i="count"}=t,o=TD(t,["readableStrategy","writableStrategy","queueingStrategy"]);this._controller=null,this._builder=Oc(o),this._getSize=i!=="bytes"?d5:h5;let{["highWaterMark"]:s=i==="bytes"?Math.pow(2,14):1e3}=Object.assign({},n),{["highWaterMark"]:a=i==="bytes"?Math.pow(2,14):1e3}=Object.assign({},r);this.readable=new ReadableStream({cancel:()=>{this._builder.clear()},pull:c=>{this._maybeFlush(this._builder,this._controller=c)},start:c=>{this._maybeFlush(this._builder,this._controller=c)}},{highWaterMark:s,size:i!=="bytes"?d5:h5}),this.writable=new WritableStream({abort:()=>{this._builder.clear()},write:()=>{this._maybeFlush(this._builder,this._controller)},close:()=>{this._maybeFlush(this._builder.finish(),this._controller)}},{highWaterMark:a,size:c=>this._writeValueAndReturnChunkSize(c)})}_writeValueAndReturnChunkSize(t){let n=this._bufferedSize;return this._bufferedSize=this._getSize(this._builder.append(t)),this._bufferedSize-n}_maybeFlush(t,n){n!=null&&(this._bufferedSize>=n.desiredSize&&++this._numChunks&&this._enqueue(n,t.toVector()),t.finished&&((t.length>0||this._numChunks===0)&&++this._numChunks&&this._enqueue(n,t.toVector()),!this._finished&&(this._finished=!0)&&this._enqueue(n,null)))}_enqueue(t,n){this._bufferedSize=0,this._controller=null,n==null?t.close():t.enqueue(n)}},d5=e=>{var t;return(t=e?.length)!==null&&t!==void 0?t:0},h5=e=>{var t;return(t=e?.byteLength)!==null&&t!==void 0?t:0};function B0(e,t){let n=new io,r=null,i=new ReadableStream({cancel(){return Z(this,void 0,void 0,function*(){yield n.close()})},start(a){return Z(this,void 0,void 0,function*(){yield s(a,r||(r=yield o()))})},pull(a){return Z(this,void 0,void 0,function*(){r?yield s(a,r):a.close()})}});return{writable:new WritableStream(n,Object.assign({highWaterMark:Math.pow(2,14)},e)),readable:i};function o(){return Z(this,void 0,void 0,function*(){return yield(yield Br.from(n)).open(t)})}function s(a,c){return Z(this,void 0,void 0,function*(){let l=a.desiredSize,u=null;for(;!(u=yield c.next()).done;)if(a.enqueue(u.value),l!=null&&--l<=0)return;a.close()})}}function L0(e,t){let n=new this(e),r=new Zr(n),i=new ReadableStream({cancel(){return Z(this,void 0,void 0,function*(){yield r.cancel()})},pull(s){return Z(this,void 0,void 0,function*(){yield o(s)})},start(s){return Z(this,void 0,void 0,function*(){yield o(s)})}},Object.assign({highWaterMark:Math.pow(2,14)},t));return{writable:new WritableStream(n,e),readable:i};function o(s){return Z(this,void 0,void 0,function*(){let a=null,c=s.desiredSize;for(;a=yield r.read(c||null);)if(s.enqueue(a),c!=null&&(c-=a.byteLength)<=0)return;s.close()})}}function $h(e){let t=Br.from(e);return Ir(t)?t.then(n=>$h(n)):t.isAsync()?t.readAll().then(n=>new dr(n)):new dr(t.readAll())}var Uj=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},C_),s2),J_),k_),N_),Z_),B_),{compareSchemas:Cc,compareFields:zO,compareTypes:qO});yn.toDOMStream=f5;be.throughDOM=p5;Br.throughDOM=B0;Rc.throughDOM=B0;ys.throughDOM=B0;$c.throughDOM=L0;Rh.throughDOM=L0;Fh.throughDOM=L0;function C0(e="ws://localhost:3000/"){let t=[],n=!1,r=null,i,o={open(){n=!0,c()},close(){for(n=!1,r=null,i=null;t.length;)t.shift().reject("Socket closed")},error(l){if(r){let{reject:u}=r;r=null,c(),u(l)}else console.error("WebSocket error: ",l)},message({data:l}){if(r){let{query:u,resolve:f,reject:d}=r;if(r=null,c(),typeof l=="string"){let h=JSON.parse(l);h.error?d(h.error):f(h)}else if(u.type==="exec")f();else if(u.type==="arrow")f($h(l.arrayBuffer()));else throw new Error(`Unexpected socket data: ${l}`)}else console.log("WebSocket message: ",l)}};function s(){i=new WebSocket(e);for(let l in o)i.addEventListener(l,o[l])}function a(l,u,f){i==null&&s(),t.push({query:l,resolve:u,reject:f}),n&&!r&&c()}function c(){t.length&&(r=t.shift(),i.send(JSON.stringify(r.query)))}return{get connected(){return n},query(l){return new Promise((u,f)=>a(l,u,f))}}}var yr=class{constructor(t,n){t&&(this.table=String(t)),n&&(this.column=n)}get columns(){return this.column?[this.column]:[]}toString(){let{table:t,column:n}=this;if(n){let r=n.startsWith("*")?n:`"${n}"`;return`${t?`${m5(t)}.`:""}${r}`}else return t?m5(t):"NULL"}};function m5(e){return e.split(".").map(n=>`"${n}"`).join(".")}function y5(e,t){return e instanceof yr&&e.column===t}function qt(e){return typeof e=="string"?Aa(e):e}function Pc(e){return typeof e=="string"?g5(e):e}function g5(e){return new yr(e)}function Aa(e,t){return arguments.length===1&&(t=e,e=null),new yr(e,t)}function ao(e){switch(typeof e){case"boolean":return e?"TRUE":"FALSE";case"string":return`'${e}'`;case"number":return Number.isFinite(e)?String(e):"NULL";default:if(e==null)return"NULL";if(e instanceof Date){let t=+e;if(Number.isNaN(t))return"NULL";let n=e.getUTCFullYear(),r=e.getUTCMonth(),i=e.getUTCDate();return t===Date.UTC(n,r,i)?`MAKE_DATE(${n}, ${r+1}, ${i})`:`EPOCH_MS(${t})`}else return e instanceof RegExp?`'${e.source}'`:String(e)}}var xs=e=>typeof e?.addEventListener=="function";function k0(e){return e instanceof Ta}var Ta=class{constructor(t,n,r){this._expr=Array.isArray(t)?t:[t],this._deps=n||[],this.annotate(r);let i=this._expr.filter(o=>xs(o));i.length>0?(this._params=Array.from(new Set(i)),this._params.forEach(o=>{o.addEventListener("value",()=>zj(this,this.map?.get("value")))})):this.addEventListener=void 0}get value(){return this}get columns(){let{_params:t,_deps:n}=this;if(t){let r=new Set(t.flatMap(i=>{let o=i.value?.columns;return Array.isArray(o)?o:[]}));if(r.size){let i=new Set(n);return r.forEach(o=>i.add(o)),Array.from(i)}}return n}get column(){return this._deps.length?this._deps[0]:this.columns[0]}annotate(...t){return Object.assign(this,...t)}toString(){return this._expr.map(t=>xs(t)&&!k0(t)?ao(t.value):t).join("")}addEventListener(t,n){let r=this.map||(this.map=new Map);(r.get(t)||(r.set(t,new Set),r.get(t))).add(n)}};function zj(e,t){if(t?.size)return Promise.allSettled(Array.from(t,n=>n(e)))}function I2(e,t){let n=[e[0]],r=new Set,i=t.length;for(let o=0,s=0;o<i;){let a=t[o];xs(a)?n[++s]=a:(Array.isArray(a?.columns)&&a.columns.forEach(l=>r.add(l)),n[s]+=typeof a=="string"?a:ao(a));let c=e[++o];xs(n[s])?n[++s]=c:n[s]+=c}return{spans:n,cols:Array.from(r)}}function j(e,...t){let{spans:n,cols:r}=I2(e,t);return new Ta(n,r)}function M2(e){let t=qt(e);return j`${t} DESC NULLS LAST`.annotate({label:t?.label,desc:!0})}var Lr=e=>({value:e,toString:()=>ao(e)});function Ph(e){e(this.op,this),this.children?.forEach(t=>t.visit(e))}function x5(e,t){let n=t.filter(i=>i!=null).map(qt),r=n.map((i,o)=>o?` ${e} `:"");return n.length===1?r.push(""):n.length>1&&(r[0]="(",r.push(")")),j(r,...n).annotate({op:e,children:n,visit:Ph})}var Yn=(...e)=>x5("AND",e.flat()),Uc=(...e)=>x5("OR",e.flat()),qj=e=>t=>j`(${e} ${qt(t)})`.annotate({op:e,a:t,visit:Ph}),A2=qj("NOT"),b5=e=>t=>j`(${qt(t)} ${e})`.annotate({op:e,a:t,visit:Ph}),zc=b5("IS NULL"),bs=b5("IS NOT NULL"),Ea=e=>(t,n)=>j`(${qt(t)} ${e} ${qt(n)})`.annotate({op:e,a:t,b:n,visit:Ph}),ws=Ea("="),qc=Ea("<>"),vs=Ea("<"),Uh=Ea(">"),_s=Ea("<="),T2=Ea(">="),E2=Ea("IS DISTINCT FROM"),zh=Ea("IS NOT DISTINCT FROM");function w5(e,t,n,r){t=qt(t);let i=e.startsWith("NOT ")?"NOT ":"";return(n?r?j`${i}(${n[0]} <= ${t} AND ${t} < ${n[1]})`:j`(${t} ${e} ${n[0]} AND ${n[1]})`:j``).annotate({op:e,visit:Ph,field:t,range:n})}var Ie=(e,t,n)=>w5("BETWEEN",e,t,n),N2=(e,t,n)=>w5("NOT BETWEEN",e,t,n);function jc(e,t){return Array.from({length:e},()=>t)}function bn(e,t){return(...n)=>{let r=n.map(qt),i=t?`::${t}`:"";return(r.length?j([`${e}(`,...jc(r.length-1,", "),`)${i}`],...r):j`${e}()${i}`).annotate({func:e,args:r})}}var D2=bn("REGEXP_MATCHES"),O2=bn("CONTAINS"),B2=bn("PREFIX"),L2=bn("SUFFIX"),jj=bn("LOWER"),Vj=bn("UPPER"),Yj=bn("LENGTH"),Xj=bn("ISNAN"),Gj=bn("ISFINITE"),Wj=bn("ISINF");var qh=class e extends Ta{constructor(t,n,r,i,o="",s="",a=""){let c;if(i&&!(o||s||a))c=i?j`${n} OVER "${i}"`:j`${n} OVER ()`;else{let d=o&&s?" ":"",h=(o||s)&&a?" ":"";c=j`${n} OVER (${i?`"${i}" `:""}${o}${d}${s}${h}${a})`}r&&(c=j`(${c})::${r}`);let{_expr:u,_deps:f}=c;super(u,f,{window:t,func:n,type:r,name:i,group:o,order:s,frame:a})}get basis(){return this.column}get label(){let{func:t}=this;return t.label??t.toString()}over(t){let{window:n,func:r,type:i,group:o,order:s,frame:a}=this;return new e(n,r,i,t,o,s,a)}partitionby(...t){let n=t.flat().filter(u=>u).map(qt),r=j(["PARTITION BY ",jc(n.length-1,", "),""],...n),{window:i,func:o,type:s,name:a,order:c,frame:l}=this;return new e(i,o,s,a,r,c,l)}orderby(...t){let n=t.flat().filter(u=>u).map(qt),r=j(["ORDER BY ",jc(n.length-1,", "),""],...n),{window:i,func:o,type:s,name:a,group:c,frame:l}=this;return new e(i,o,s,a,c,r,l)}rows(t){let n=v5("ROWS",t),{window:r,func:i,type:o,name:s,group:a,order:c}=this;return new e(r,i,o,s,a,c,n)}range(t){let n=v5("RANGE",t),{window:r,func:i,type:o,name:s,group:a,order:c}=this;return new e(r,i,o,s,a,c,n)}};function v5(e,t){if(xs(t)){let n=j`${t}`;return n.toString=()=>`${e} ${_5(t.value)}`,n}return`${e} ${_5(t)}`}function _5(e){let[t,n]=e,r=t===0?"CURRENT ROW":Number.isFinite(t)?`${Math.abs(t)} PRECEDING`:"UNBOUNDED PRECEDING",i=n===0?"CURRENT ROW":Number.isFinite(n)?`${Math.abs(n)} FOLLOWING`:"UNBOUNDED FOLLOWING";return`BETWEEN ${r} AND ${i}`}function Ri(e,t){return(...n)=>{let r=bn(e)(...n);return new qh(e,r,t)}}var C2=Ri("ROW_NUMBER","INTEGER"),k2=Ri("RANK","INTEGER"),F2=Ri("DENSE_RANK","INTEGER"),R2=Ri("PERCENT_RANK"),$2=Ri("CUME_DIST"),P2=Ri("NTILE"),U2=Ri("LAG"),z2=Ri("LEAD"),q2=Ri("FIRST_VALUE"),j2=Ri("LAST_VALUE"),V2=Ri("NTH_VALUE");function X2(e,...t){return j(e,...t).annotate({aggregate:!0})}var Y2=class e extends Ta{constructor(t,n,r,i,o){n=(n||[]).map(qt);let{strings:s,exprs:a}=Hj(t,n,r,i,o),{spans:c,cols:l}=I2(s,a);super(c,l,{aggregate:t,args:n,type:r,isDistinct:i,filter:o})}get basis(){return this.column}get label(){let{aggregate:t,args:n,isDistinct:r}=this,i=r?"DISTINCT"+(n.length?" ":""):"",o=n.length?`(${i}${n.map(Zj).join(", ")})`:"";return`${t.toLowerCase()}${o}`}distinct(){let{aggregate:t,args:n,type:r,filter:i}=this;return new e(t,n,r,!0,i)}where(t){let{aggregate:n,args:r,type:i,isDistinct:o}=this;return new e(n,r,i,o,t)}window(){let{aggregate:t,args:n,type:r,isDistinct:i}=this,o=new e(t,n,null,i);return new qh(t,o,r)}partitionby(...t){return this.window().partitionby(...t)}orderby(...t){return this.window().orderby(...t)}rows(t,n){return this.window().rows(t,n)}range(t,n){return this.window().range(t,n)}};function Hj(e,t,n,r,i){let o=`)${n?`::${n}`:""}`,s=[`${e}(${r?"DISTINCT ":""}`],a=[];return t.length?(s=s.concat([...jc(t.length-1,", "),`${o}${i?" FILTER (WHERE ":""}`,...i?[")"]:[]]),a=[...t,...i?[i]:[]]):s[0]+="*"+o,{exprs:a,strings:s}}function Zj(e){let t=ao(e);return t&&t.startsWith('"')&&t.endsWith('"')?t.slice(1,-1):t}function Zt(e,t){return(...n)=>new Y2(e,n,t)}var Cr=Zt("COUNT","INTEGER"),G2=Zt("AVG"),Jj=Zt("AVG"),W2=Zt("MAD"),Kr=Zt("MAX"),ti=Zt("MIN"),kr=Zt("SUM","DOUBLE"),H2=Zt("PRODUCT"),Z2=Zt("MEDIAN"),J2=Zt("QUANTILE"),Q2=Zt("MODE"),K2=Zt("VARIANCE"),tS=Zt("STDDEV"),eS=Zt("SKEWNESS"),nS=Zt("KURTOSIS"),rS=Zt("ENTROPY"),iS=Zt("VAR_POP"),oS=Zt("STDDEV_POP"),sS=Zt("CORR"),aS=Zt("COVAR_POP"),cS=Zt("REGR_INTERCEPT"),lS=Zt("REGR_SLOPE"),uS=Zt("REGR_COUNT"),Qj=Zt("REGR_R2"),fS=Zt("REGR_SYY"),dS=Zt("REGR_SXX"),Kj=Zt("REGR_SXY"),hS=Zt("REGR_AVGX"),tV=Zt("REGR_AVGY"),pS=Zt("FIRST"),mS=Zt("LAST"),_u=Zt("ARG_MIN"),Su=Zt("ARG_MAX"),yS=Zt("STRING_AGG"),gS=Zt("ARRAY_AGG");function jh(e,t){let n=qt(e),r=j`CAST(${n} AS ${t})`;return Object.defineProperty(r,"label",{enumerable:!0,get(){return e.label}}),Object.defineProperty(r,"aggregate",{enumerable:!0,get(){return e.aggregate||!1}}),r}var Iu=e=>jh(e,"DOUBLE"),xS=e=>jh(e,"INTEGER");var bS=e=>j`epoch_ms(${qt(e)})`,wS=e=>{let t=qt(e);return j`MAKE_DATE(2012, MONTH(${t}), 1)`.annotate({label:"month"})},vS=e=>{let t=qt(e);return j`MAKE_DATE(2012, MONTH(${t}), DAY(${t}))`.annotate({label:"date"})},_S=e=>{let t=qt(e);return j`MAKE_DATE(2012, 1, DAY(${t}))`.annotate({label:"date"})};var Vh=bn("ST_AsGeoJSON"),S5=bn("ST_X"),I5=bn("ST_Y"),Yh=bn("ST_CENTROID"),SS=e=>S5(Yh(e)),IS=e=>I5(Yh(e));var yt=class e{static select(...t){return new e().select(...t)}static from(...t){return new e().from(...t)}static with(...t){return new e().with(...t)}static union(...t){return new Vc("UNION",t.flat())}static unionAll(...t){return new Vc("UNION ALL",t.flat())}static intersect(...t){return new Vc("INTERSECT",t.flat())}static except(...t){return new Vc("EXCEPT",t.flat())}constructor(){this.query={with:[],select:[],from:[],where:[],groupby:[],having:[],window:[],qualify:[],orderby:[]}}clone(){let t=new e;return t.query={...this.query},t}with(...t){let{query:n}=this;if(t.length===0)return n.with;{let r=[],i=(o,s)=>{let a=s.clone();a.cteFor=this,r.push({as:o,query:a})};return t.flat().forEach(o=>{if(o!=null)if(o.as&&o.query)i(o.as,o.query);else for(let s in o)i(s,o[s])}),n.with=n.with.concat(r),this}}select(...t){let{query:n}=this;if(t.length===0)return n.select;{let r=[];for(let i of t.flat())if(i!=null)if(typeof i=="string")r.push({as:i,expr:qt(i)});else if(i instanceof yr)r.push({as:i.column,expr:i});else if(Array.isArray(i))r.push({as:i[0],expr:i[1]});else for(let o in i)r.push({as:F0(o),expr:qt(i[o])});return n.select=n.select.concat(r),this}}$select(...t){return this.query.select=[],this.select(...t)}distinct(t=!0){return this.query.distinct=!!t,this}from(...t){let{query:n}=this;if(t.length===0)return n.from;{let r=[];return t.flat().forEach(i=>{if(i!=null)if(typeof i=="string")r.push({as:i,from:Pc(i)});else if(i instanceof yr)r.push({as:i.table,from:i});else if(R0(i)||k0(i))r.push({from:i});else if(Array.isArray(i))r.push({as:F0(i[0]),from:Pc(i[1])});else for(let o in i)r.push({as:F0(o),from:Pc(i[o])})}),n.from=n.from.concat(r),this}}$from(...t){return this.query.from=[],this.from(...t)}sample(t,n){let{query:r}=this;if(arguments.length===0)return r.sample;{let i=t;return typeof t=="number"&&(i=t>0&&t<1?{perc:100*t,method:n}:{rows:Math.round(t),method:n}),r.sample=i,this}}where(...t){let{query:n}=this;return t.length===0?n.where:(n.where=n.where.concat(t.flat().filter(r=>r)),this)}$where(...t){return this.query.where=[],this.where(...t)}groupby(...t){let{query:n}=this;return t.length===0?n.groupby:(n.groupby=n.groupby.concat(t.flat().filter(r=>r).map(qt)),this)}$groupby(...t){return this.query.groupby=[],this.groupby(...t)}having(...t){let{query:n}=this;return t.length===0?n.having:(n.having=n.having.concat(t.flat().filter(r=>r)),this)}window(...t){let{query:n}=this;if(t.length===0)return n.window;{let r=[];return t.flat().forEach(i=>{if(i!=null)for(let o in i)r.push({as:F0(o),expr:i[o]})}),n.window=n.window.concat(r),this}}qualify(...t){let{query:n}=this;return t.length===0?n.qualify:(n.qualify=n.qualify.concat(t.flat().filter(r=>r)),this)}orderby(...t){let{query:n}=this;return t.length===0?n.orderby:(n.orderby=n.orderby.concat(t.flat().filter(r=>r).map(qt)),this)}limit(t){let{query:n}=this;return arguments.length===0?n.limit:(n.limit=Number.isFinite(t)?t:void 0,this)}offset(t){let{query:n}=this;return arguments.length===0?n.offset:(n.offset=Number.isFinite(t)?t:void 0,this)}get subqueries(){let{query:t,cteFor:n}=this,i=(n?.query||t).with?.reduce((s,{as:a,query:c})=>(s[a]=c,s),{}),o=[];return t.from.forEach(({from:s})=>{if(R0(s))o.push(s);else if(i[s.table]){let a=i[s.table];o.push(a)}}),o}toString(){let{select:t,distinct:n,from:r,sample:i,where:o,groupby:s,having:a,window:c,qualify:l,orderby:u,limit:f,offset:d,with:h}=this.query,p=[];if(h.length){let g=h.map(({as:y,query:x})=>`"${y}" AS (${x})`);p.push(`WITH ${g.join(", ")}`)}let m=t.map(({as:g,expr:y})=>y5(y,g)&&!y.table?`${y}`:`${y} AS "${g}"`);if(p.push(`SELECT${n?" DISTINCT":""} ${m.join(", ")}`),r.length){let g=r.map(({as:y,from:x})=>{let b=R0(x)?`(${x})`:`${x}`;return!y||y===x.table?b:`${b} AS "${y}"`});p.push(`FROM ${g.join(", ")}`)}if(o.length){let g=o.map(String).filter(y=>y).join(" AND ");g&&p.push(`WHERE ${g}`)}if(i){let{rows:g,perc:y,method:x,seed:b}=i,w=g?`${g} ROWS`:`${y} PERCENT`,_=x?` (${x}${b!=null?`, ${b}`:""})`:"";p.push(`USING SAMPLE ${w}${_}`)}if(s.length&&p.push(`GROUP BY ${s.join(", ")}`),a.length){let g=a.map(String).filter(y=>y).join(" AND ");g&&p.push(`HAVING ${g}`)}if(c.length){let g=c.map(({as:y,expr:x})=>`"${y}" AS (${x})`);p.push(`WINDOW ${g.join(", ")}`)}if(l.length){let g=l.map(String).filter(y=>y).join(" AND ");g&&p.push(`QUALIFY ${g}`)}return u.length&&p.push(`ORDER BY ${u.join(", ")}`),Number.isFinite(f)&&p.push(`LIMIT ${f}`),Number.isFinite(d)&&p.push(`OFFSET ${d}`),p.join(" ")}},Vc=class e{constructor(t,n){this.op=t,this.queries=n.map(r=>r.clone()),this.query={orderby:[]}}clone(){let t=new e(this.op,this.queries);return t.query={...this.query},t}orderby(...t){let{query:n}=this;return t.length===0?n.orderby:(n.orderby=n.orderby.concat(t.flat().filter(r=>r).map(qt)),this)}limit(t){let{query:n}=this;return arguments.length===0?n.limit:(n.limit=Number.isFinite(t)?t:void 0,this)}offset(t){let{query:n}=this;return arguments.length===0?n.offset:(n.offset=Number.isFinite(t)?t:void 0,this)}get subqueries(){let{queries:t,cteFor:n}=this;return n&&t.forEach(r=>r.cteFor=n),t}toString(){let{op:t,queries:n,query:{orderby:r,limit:i,offset:o}}=this,s=[n.join(` ${t} `)];return r.length&&s.push(`ORDER BY ${r.join(", ")}`),Number.isFinite(i)&&s.push(`LIMIT ${i}`),Number.isFinite(o)&&s.push(`OFFSET ${o}`),s.join(" ")}};function R0(e){return e instanceof yt||e instanceof Vc}function F0(e){return eV(e)?e.slice(1,-1):e}function eV(e){return e[0]==='"'&&e[e.length-1]==='"'}var $0=e=>e;function nV(){return{apply:$0,invert:$0,sqlApply:qt,sqlInvert:$0}}function rV({base:e}={}){if(e==null||e===Math.E)return{apply:Math.log,invert:Math.exp,sqlApply:t=>j`LN(${qt(t)})`,sqlInvert:t=>j`EXP(${t})`};if(e===10)return{apply:Math.log10,invert:t=>Math.pow(10,t),sqlApply:t=>j`LOG(${qt(t)})`,sqlInvert:t=>j`POW(10, ${t})`};{let t=+e;return{apply:n=>Math.log(n)/Math.log(t),invert:n=>Math.pow(t,n),sqlApply:n=>j`LN(${qt(n)}) / LN(${t})`,sqlInvert:n=>j`POW(${t}, ${n})`}}}function iV({constant:e=1}={}){let t=+e;return{apply:n=>Math.sign(n)*Math.log1p(Math.abs(n)),invert:n=>Math.sign(n)*Math.exp(Math.abs(n)-t),sqlApply:n=>(n=qt(n),j`SIGN(${n}) * LN(${t} + ABS(${n}))`),sqlInvert:n=>j`SIGN(${n}) * (EXP(ABS(${n})) - ${t})`}}function oV(){return{apply:e=>Math.sign(e)*Math.sqrt(Math.abs(e)),invert:e=>Math.sign(e)*e*e,sqlApply:e=>(e=qt(e),j`SIGN(${e}) * SQRT(ABS(${e}))`),sqlInvert:e=>j`SIGN(${e}) * (${e}) ** 2`}}function sV({exponent:e=1}={}){let t=+e;return{apply:n=>Math.sign(n)*Math.pow(Math.abs(n),t),invert:n=>Math.sign(n)*Math.pow(Math.abs(n),1/t),sqlApply:n=>(n=qt(n),j`SIGN(${n}) * POW(ABS(${n}), ${t})`),sqlInvert:n=>j`SIGN(${n}) * POW(ABS(${n}), 1/${t})`}}function M5(){return{apply:e=>+e,invert:e=>new Date(e),sqlApply:e=>e instanceof Date?+e:bS(qt(e)),sqlInvert:$0}}var aV={linear:nV,log:rV,symlog:iV,sqrt:oV,pow:sV,time:M5,utc:M5};function Xh(e){let t=aV[e.type];return t?{...e,...t(e)}:null}function co(e,t,{replace:n=!1,temp:r=!0,view:i=!1}={}){return"CREATE"+(n?" OR REPLACE ":" ")+(r?"TEMP ":"")+(i?"VIEW":"TABLE")+(n?" ":" IF NOT EXISTS ")+e+" AS "+t}function Gh(e){return`INSTALL ${e}; LOAD ${e}`}function A5(e,{columns:t=Object.keys(e?.[0]||{})}={}){let n=[];if(Array.isArray(t)?(n=t,t=n.reduce((i,o)=>(i[o]=o,i),{})):t&&(n=Object.keys(t)),!n.length)throw new Error("Can not create table from empty column set.");let r=[];for(let i of e){let o=n.map(s=>`${ao(i[s])} AS "${t[s]}"`);r.push(`(SELECT ${o.join(", ")})`)}return r.join(" UNION ALL ")}function P0(e,t,n,r={},i={}){let{select:o=["*"],where:s,view:a,temp:c,replace:l,...u}=r,f=cV({...i,...u}),d=`${e}('${n}'${f?", "+f:""})`,h=s?` WHERE ${s}`:"",p=`SELECT ${o.join(", ")} FROM ${d}${h}`;return co(t,p,{view:a,temp:c,replace:l})}function AS(e,t,n){return P0("read_csv",e,t,n,{auto_detect:!0,sample_size:-1})}function TS(e,t,n){return P0("read_json",e,t,n,{auto_detect:!0,json_format:"auto"})}function ES(e,t,n){return P0("read_parquet",e,t,n)}function NS(e,t,n={}){let{options:r,...i}=n;if(r){let o=Array.isArray(r)?r.join(", "):typeof r=="string"?r:Object.entries(r).map(([s,a])=>`${s}=${a}`).join(", ");i.open_options=o.toUpperCase()}return P0("st_read",e,t,i)}function DS(e,t,n={}){let{select:r=["*"],...i}=n,o=A5(t),s=r.length===1&&r[0]==="*"?o:`SELECT ${r} FROM ${o}`;return co(e,s,i)}function cV(e){return Object.entries(e).map(([t,n])=>`${t}=${MS(n)}`).join(", ")}function MS(e){switch(typeof e){case"boolean":return String(e);case"string":return`'${e}'`;case"undefined":case"object":return e==null?"NULL":Array.isArray(e)?"["+e.map(t=>MS(t)).join(", ")+"]":"{"+Object.entries(e).map(([t,n])=>`'${t}': ${MS(n)}`).join(", ")+"}";default:return e}}function T5(e){switch(e){case"BIGINT":case"HUGEINT":case"INTEGER":case"SMALLINT":case"TINYINT":case"UBIGINT":case"UINTEGER":case"USMALLINT":case"UTINYINT":case"DOUBLE":case"FLOAT":case"REAL":case"DECIMAL":return"number";case"DATE":case"TIMESTAMP":case"TIMESTAMPTZ":case"TIMESTAMP WITH TIME ZONE":case"TIME":case"TIMESTAMP_NS":return"date";case"BOOLEAN":return"boolean";case"VARCHAR":case"UUID":return"string";case"LIST":return"array";case"BLOB":case"STRUCT":case"MAP":return"object";default:throw new Error(`Unsupported type: ${e}`)}}var lV="count",uV="nulls",fV="max",dV="min",hV="distinct";var pV={[lV]:Cr,[hV]:e=>Cr(e).distinct(),[fV]:Kr,[dV]:ti,[uV]:e=>Cr().where(zc(e))};function E5({table:e,column:t},n){return yt.from(e).select(n.map(r=>[r,pV[r](t)]))}var N5=()=>Object.create(null),U0=class{constructor(t){this.mc=t,this.clear()}clear(){this.tables=N5()}tableInfo(t){let n=this.tables;if(n[t])return n[t];let r=mV(this.mc,t).catch(i=>{throw n[t]=null,i});return n[t]=r}async fieldInfo({table:t,column:n,stats:r}){let o=(await this.tableInfo(t))[n];if(o==null)return;if(!r?.length)return o;let s=await this.mc.query(E5(o,r),{persist:!0}),a={...o,...Array.from(s)[0]};for(let c in a){let l=a[c];typeof l=="bigint"&&(a[c]=Number(l))}return a}async queryFields(t){let n=await yV(this,t);return(await Promise.all(n.map(i=>this.fieldInfo(i)))).filter(i=>i)}};async function mV(e,t){let n=await e.query(`DESCRIBE ${Pc(t)}`,{type:"json",cache:!1}),r=N5();for(let i of n)r[i.column_name]={table:t,column:i.column_name,sqlType:i.column_type,type:T5(i.column_type),nullable:i.null==="YES"};return r}async function yV(e,t){return t.length===1&&t[0].column==="*"?Object.values(await e.tableInfo(t[0].table)):t}function O5(e){let t=2166136261;for(let n=0,r=e.length;n<r;++n){let i=e.charCodeAt(n),o=i&65280;o&&(t=D5(t^o>>8)),t=D5(t^i&255)}return gV(t)}function D5(e){return e+(e<<1)+(e<<4)+(e<<7)+(e<<8)+(e<<24)}function gV(e){return e+=e<<13,e^=e>>>7,e+=e<<3,e^=e>>>17,e+=e<<5,e&4294967295}var z0=class{constructor(t,{selection:n,temp:r=!0}){this.mc=t,this.selection=n,this.temp=r,this.reset()}reset(){this.enabled=!1,this.clients=null,this.indices=null,this.activeView=null}clear(){this.indices&&(this.mc.cancel(Array.from(this.indices.values(),t=>t.result)),this.indices=null)}index(t,n){if(this.clients!==t){let l=Array.from(t,L5),u=l[0]?.from;this.enabled=l.every(f=>f&&f.from===u),this.clients=t,this.activeView=null,this.clear()}if(!this.enabled)return!1;n=n||this.selection.active;let{source:r}=n;if(r&&r===this.activeView?.source)return!0;if(this.clear(),!r)return!1;let i=this.activeView=xV(n);if(!i)return!1;this.mc.logger().warn("DATA CUBE INDEX CONSTRUCTION");let o=this.selection.remove(r),s=this.indices=new Map,{mc:a,temp:c}=this;for(let l of t){if(o.skip(l,n))continue;let u=L5(l),f=l.query(o.predicate(l)).select({...i.columns,...u.count}).groupby(Object.keys(i.columns)),[d]=f.subqueries;if(d){let x=Object.values(i.columns).map(b=>b.columns[0]);wV(d,x)}let h=f.orderby();f.query.orderby=[];let p=f.toString(),g=`cube_index_${(O5(p)>>>0).toString(16)}`,y=a.exec(co(g,p,{temp:c}));s.set(l,{table:g,result:y,order:h,...u})}}async update(){let{clients:t,selection:n,activeView:r}=this,i=r.predicate(n.active.predicate);return Promise.all(Array.from(t).map(o=>this.updateClient(o,i)))}async updateClient(t,n){let r=this.indices.get(t);if(!r)return;n||(n=this.activeView.predicate(this.selection.active.predicate));let{table:i,dims:o,aggr:s,order:a=[]}=r,c=yt.select(o,s).from(i).groupby(o).where(n).orderby(a);return this.mc.updateClient(t,c)}};function xV(e){let{source:t,schema:n}=e,r=e.predicate?.columns;if(!n||!r)return null;let{type:i,scales:o,pixelSize:s=1}=n,a;if(i==="interval"&&o){let c=o.map(l=>bV(l,s));if(c.some(l=>l==null))return null;c.length===1?(a=l=>l?Ie("active0",l.range.map(c[0])):[],r={active0:c[0](e.predicate.field)}):(a=l=>l?Yn(l.children.map(({range:u},f)=>Ie(`active${f}`,u.map(c[f])))):[],r=Object.fromEntries(e.predicate.children.map((l,u)=>[`active${u}`,c[u](l.field)])))}else if(i==="point")a=c=>c,r=Object.fromEntries(r.map(c=>[c.toString(),c]));else return null;return{source:t,columns:r,predicate:a}}function bV(e,t){let{apply:n,sqlApply:r}=Xh(e);if(n){let{domain:i,range:o}=e,s=n(Math.min(...i)),a=n(Math.max(...i)),c=Math.abs(o[1]-o[0])/(a-s)/t,l=t===1?"":`${t}::INTEGER * `;return u=>j`${l}FLOOR(${c}::DOUBLE * (${r(u)} - ${s}::DOUBLE))::INTEGER`}}var B5={from:NaN};function L5(e){if(!e.filterIndexable)return B5;let t=e.query(),n=OS(t);if(!n||!t.groupby)return B5;let r=new Set(t.groupby().map(a=>a.column)),i=[],o=[],s;for(let{as:a,expr:{aggregate:c}}of t.select())switch(c?.toUpperCase?.()){case"COUNT":case"SUM":i.push({[a]:j`SUM("${a}")::DOUBLE`});break;case"AVG":s="_count_",i.push({[a]:j`(SUM("${a}" * ${s}) / SUM(${s}))::DOUBLE`});break;case"MAX":i.push({[a]:j`MAX("${a}")`});break;case"MIN":i.push({[a]:j`MIN("${a}")`});break;default:if(r.has(a))o.push(a);else return null}return{aggr:i,dims:o,count:s?{[s]:j`COUNT(*)`}:{},from:n}}function OS(e){let t=e.subqueries;if(e.select){let r=e.from();if(!r.length)return;if(t.length===0)return r[0].from.table}let n=OS(t[0]);for(let r=1;r<t.length;++r){let i=OS(t[r]);if(i!==void 0&&i!==n)return NaN}return n}function wV(e,t){let n=new Set,r=i=>{n.has(i)||(n.add(i),i.select&&i.from().length&&i.select(t),i.subqueries.forEach(r))};r(e)}var q0=class{constructor(t,n,r=!0){this.mc=t,this.selection=n,this.clients=new Set,this.indexer=r?new z0(this.mc,{...r,selection:n}):null;let{value:i,activate:o}=this.handlers={value:()=>this.update(),activate:s=>this.indexer?.index(this.clients,s)};n.addEventListener("value",i),n.addEventListener("activate",o)}finalize(){let{value:t,activate:n}=this.handlers;this.selection.removeEventListener("value",t),this.selection.removeEventListener("activate",n)}reset(){this.indexer?.reset()}add(t){return(this.clients=new Set(this.clients)).add(t),this}remove(t){return this.clients.has(t)&&(this.clients=new Set(this.clients)).delete(t),this}update(){let{mc:t,indexer:n,clients:r,selection:i}=this;return n?.index(r)?n.update():vV(t,r,i)}};function vV(e,t,n){return Promise.all(Array.from(t).map(r=>{let i=n.predicate(r);if(i!=null)return e.updateClient(r,r.query(i))}))}function j0(){let e,t,n=new Promise((r,i)=>{e=r,t=i});return n.fulfill=r=>(e(r),n),n.reject=r=>(t(r),n),n}function _V(e){return(typeof requestAnimationFrame<"u"?requestAnimationFrame:typeof setImmediate<"u"?setImmediate:setTimeout)(e)}function C5(e,t,n){let r=[],i=0;function o(){let s=SV(r,t);r=[],i=0;for(let a of s)MV(a,e,n),EV(a,t)}return{add(s,a){s.request.type==="arrow"?(i=i||_V(()=>o()),r.push({entry:s,priority:a,index:r.length})):e(s,a)}}}function SV(e,t){let n=[],r=new Map;for(let i of e){let{entry:{request:o}}=i,s=IV(o.query,t);if(!r.has(s)){let a=[];n.push(a),r.set(s,a)}r.get(s).push(i)}return n}function IV(e,t){let n=`${e}`;if(e instanceof yt&&!t.get(n)){if(e.orderby().length||e.where().length||e.qualify().length||e.having().length)return n;let r=e.clone().$select("*"),i=e.groupby();if(i.length){let o={};e.select().forEach(({as:s,expr:a})=>o[s]=a),r.$groupby(i.map(s=>s instanceof yr&&o[s.column]||s))}return`${r}`}else return n}function MV(e,t,n){if(AV(e))t({request:{type:"arrow",cache:!1,record:!1,query:TV(e,n)},result:e.result=j0()});else for(let{entry:r,priority:i}of e)t(r,i)}function AV(e){if(e.length>1){let t=`${e[0].entry.request.query}`;for(let n=1;n<e.length;++n)if(t!==`${e[n].entry.request.query}`)return!0}return!1}function TV(e,t){let n=e.maps=[],r=new Map;for(let s of e){let{query:a}=s.entry.request,c=[];n.push(c);for(let{as:l,expr:u}of a.select()){let f=`${u}`;r.has(f)||r.set(f,[`col${r.size}`,u]);let[d]=r.get(f);c.push([d,l])}t(`${a}`)}let i=e[0].entry.request.query.clone(),o=i.groupby();if(o.length){let s={};e.maps[0].forEach(([a,c])=>s[c]=a),i.$groupby(o.map(a=>a instanceof yr&&s[a.column]||a))}return i.$select(Array.from(r.values()))}async function EV(e,t){let{maps:n,result:r}=e;if(!n)return;let i;try{i=await r}catch(o){for(let{entry:s}of e)s.result.reject(o);return}e.forEach(({entry:o},s)=>{let{request:a,result:c}=o,l=NV(i,n[s]);a.cache&&t.set(String(a.query),l),c.fulfill(l)})}function NV(e,t){if(t){let n={};for(let[r,i]of t)n[i]=e.getChild(r);return new e.constructor(n)}else return e}var DV=typeof requestIdleCallback<"u"?requestIdleCallback:setTimeout,k5=()=>({get:()=>{},set:(e,t)=>t,clear:()=>{}});function F5({max:e=1e3,ttl:t=3*60*60*1e3}={}){let n=new Map;function r(){let i=performance.now()-t,o=null,s=1/0;for(let[a,c]of n){let{last:l}=c;l<s&&(o=a,s=l),i>l&&n.delete(a)}o&&n.delete(o)}return{get(i){let o=n.get(i);if(o)return o.last=performance.now(),o.value},set(i,o){return n.set(i,{last:performance.now(),value:o}),n.size>e&&DV(r),o},clear(){n=new Map}}}function R5(e){let t=Array.from({length:e},()=>({head:null,tail:null}));return{isEmpty(){return t.every(n=>!n.head)},insert(n,r){let i=t[r];if(!i)throw new Error(`Invalid queue priority rank: ${r}`);let o={item:n,next:null};i.head===null?i.head=i.tail=o:i.tail=i.tail.next=o},remove(n){for(let r of t){let{head:i,tail:o}=r;for(let s=null,a=i;a;s=a,a=a.next)n(a.item)&&(a===i?i=a.next:s.next=a.next,a===o&&(o=s||i));r.head=i,r.tail=o}},next(){for(let n of t){let{head:r}=n;if(r!==null)return n.head=r.next,n.tail===r&&(n.tail=null),r.item}}}}var lo={High:0,Normal:1,Low:2};function $5(){let e=R5(3),t,n,r,i=[],o=null,s;function a(){if(o||e.isEmpty())return;let{request:f,result:d}=e.next();o=u(f,d),o.finally(()=>{o=null,a()})}function c(f,d=lo.Normal){e.insert(f,d),a()}function l(f){i.length&&f&&i.forEach(d=>d.add(f))}async function u(f,d){try{let{query:h,type:p,cache:m=!1,record:g=!0,options:y}=f,x=h?`${h}`:null;if(g&&l(x),m){let _=n.get(x);if(_){r.debug("Cache"),d.fulfill(_);return}}let b=performance.now(),w=await t.query({type:p,sql:x,...y});m&&n.set(x,w),r.debug(`Request: ${(performance.now()-b).toFixed(1)}`),d.fulfill(w)}catch(h){d.reject(h)}}return{cache(f){return f!==void 0?n=f===!0?F5():f||k5():n},logger(f){return f?r=f:r},connector(f){return f?t=f:t},consolidate(f){f&&!s?s=C5(c,n,l):!f&&s&&(s=null)},request(f,d=lo.Normal){let h=j0(),p={request:f,result:h};return s?s.add(p,d):c(p,d),h},cancel(f){let d=new Set(f);e.remove(({result:h})=>d.has(h))},clear(){e.remove(({result:f})=>(f.reject("Cleared"),!0))},record(){let f=[],d={add(h){f.push(h)},reset(){f=[]},snapshot(){return f.slice()},stop(){return i=i.filter(h=>h!==d),f}};return i.push(d),d}}}function P5(){return{debug(){},info(){},log(){},warn(){},error(){}}}var V0;function ei(e){return e?V0=e:V0==null&&(V0=new Wh),V0}var Wh=class{constructor(t=C0(),n={}){let{logger:r=console,manager:i=$5()}=n;this.catalog=new U0(this),this.manager=i,this.logger(r),this.configure(n),this.databaseConnector(t),this.clear()}logger(t){return arguments.length&&(this._logger=t||P5(),this.manager.logger(this._logger)),this._logger}configure({cache:t=!0,consolidate:n=!0,indexes:r=!0}){this.manager.cache(t),this.manager.consolidate(n),this.indexes=r}clear({clients:t=!0,cache:n=!0,catalog:r=!1}={}){this.manager.clear(),t&&(this.clients?.forEach(i=>this.disconnect(i)),this.filterGroups?.forEach(i=>i.finalize()),this.clients=new Set,this.filterGroups=new Map),n&&this.manager.cache().clear(),r&&this.catalog.clear()}databaseConnector(t){return this.manager.connector(t)}cancel(t){this.manager.cancel(t)}exec(t,{priority:n=lo.Normal}={}){return t=Array.isArray(t)?t.join(`;
11
+ `):t,this.manager.request({type:"exec",query:t},n)}query(t,{type:n="arrow",cache:r=!0,priority:i=lo.Normal,...o}={}){return this.manager.request({type:n,query:t,cache:r,options:o},i)}prefetch(t,n={}){return this.query(t,{...n,cache:!0,priority:lo.Low})}createBundle(t,n,r=lo.Low){let i={name:t,queries:n};return this.manager.request({type:"create-bundle",options:i},r)}loadBundle(t,n=lo.High){let r={name:t};return this.manager.request({type:"load-bundle",options:r},n)}updateClient(t,n,r=lo.Normal){return t.queryPending(),this.query(n,{priority:r}).then(i=>t.queryResult(i).update(),i=>{t.queryError(i),this._logger.error(i)})}requestQuery(t,n){return this.filterGroups.get(t.filterBy)?.reset(),n?this.updateClient(t,n):t.update()}async connect(t){let{catalog:n,clients:r,filterGroups:i,indexes:o}=this;if(r.has(t))throw new Error("Client already connected.");r.add(t),t.coordinator=this;let s=t.fields();s?.length&&t.fieldInfo(await n.queryFields(s));let a=t.filterBy;if(a)if(i.has(a))i.get(a).add(t);else{let c=new q0(this,a,o);i.set(a,c.add(t))}t.requestQuery()}disconnect(t){let{clients:n,filterGroups:r}=this;n.has(t)&&(n.delete(t),r.get(t.filterBy)?.remove(t),t.coordinator=null)}};var Y0=class{constructor(){this._callbacks=new Map}addEventListener(t,n){this._callbacks.has(t)||this._callbacks.set(t,{callbacks:new Set,pending:null,queue:new BS}),this._callbacks.get(t).callbacks.add(n)}removeEventListener(t,n){let r=this._callbacks.get(t);r&&r.callbacks.delete(n)}willEmit(t,n){return n}emitQueueFilter(){return null}cancel(t){this._callbacks.get(t)?.queue.clear()}emit(t,n){let r=this._callbacks.get(t)||{};if(r.pending)r.queue.enqueue(n,this.emitQueueFilter(t,n));else{let i=this.willEmit(t,n),{callbacks:o,queue:s}=r;if(o?.size){let a=Promise.allSettled(Array.from(o,c=>c(i))).then(()=>{r.pending=null,s.isEmpty()||this.emit(t,s.dequeue())});r.pending=a}}}},BS=class{constructor(){this.clear()}clear(){this.next=null}isEmpty(){return!this.next}enqueue(t,n){let r={value:t};if(n&&this.next){let i=this;for(;i.next;)n(i.next.value)?i=i.next:i.next=i.next.next;i.next=r}else this.next=r}dequeue(){let{next:t}=this;return this.next=t?.next,t?.value}};function Hh(e,t){return e===t?!1:e instanceof Date&&t instanceof Date?+e!=+t:Array.isArray(e)&&Array.isArray(t)?OV(e,t):!0}function OV(e,t){if(e.length!==t.length)return!0;for(let n=0;n<e.length;++n)if(e[n]!==t[n])return!0;return!1}function gr(e){return e instanceof Na}var Na=class e extends Y0{constructor(t){super(),this._value=t}static value(t){return new e(t)}static array(t){if(t.some(n=>gr(n))){let n=new e,r=()=>n.update(t.map(i=>gr(i)?i.value:i));return r(),t.forEach(i=>gr(i)?i.addEventListener("value",r):0),n}return new e(t)}get value(){return this._value}update(t,{force:n}={}){return Hh(this._value,t)||n?this.emit("value",t):this.cancel("value"),this}willEmit(t,n){return t==="value"&&(this._value=n),n}};function ni(e){return e instanceof Ss}var Ss=class e extends Na{static intersect({cross:t=!1}={}){return new e(new Yc({cross:t}))}static union({cross:t=!1}={}){return new e(new Yc({cross:t,union:!0}))}static single({cross:t=!1}={}){return new e(new Yc({cross:t,single:!0}))}static crossfilter(){return new e(new Yc({cross:!0}))}constructor(t=new Yc){super([]),this._resolved=this._value,this._resolver=t}clone(){let t=new e(this._resolver);return t._value=t._resolved=this._value,t}remove(t){let n=this.clone();return n._value=n._resolved=n._resolver.resolve(this._resolved,{source:t}),n._value.active={source:t},n}get active(){return this.clauses.active}get value(){return this.active?.value}get clauses(){return super.value}get single(){return this._resolver.single}activate(t){this.emit("activate",t)}update(t){return this._resolved=this._resolver.resolve(this._resolved,t,!0),this._resolved.active=t,super.update(this._resolved)}willEmit(t,n){return t==="value"?(this._value=n,this.value):n}emitQueueFilter(t,n){return t==="value"?this._resolver.queueFilter(n):null}skip(t,n){return this._resolver.skip(t,n)}predicate(t,n=!1){let{clauses:r}=this,i=n?null:r.active;return this._resolver.predicate(r,i,t)}},Yc=class{constructor({union:t,cross:n,single:r}={}){this.union=!!t,this.cross=!!n,this.single=!!r}resolve(t,n,r=!1){let{source:i,predicate:o}=n,s=t.filter(c=>i!==c.source),a=this.single?[]:s;return this.single&&r&&s.forEach(c=>c.source?.reset?.()),o&&a.push(n),a}skip(t,n){return this.cross&&n?.clients?.has(t)}predicate(t,n,r){let{union:i}=this;if(this.skip(r,n))return;let o=t.filter(s=>!this.skip(r,s)).map(s=>s.predicate);return i&&o.length>1?Uc(o):o}queueFilter(t){if(this.cross){let n=t.active?.source;return r=>r.active?.source!==n}}};function LS(){let e=new Set,t,n=new Promise(r=>t=r);return{pending(r){e.add(r)},ready(r){return e.delete(r),e.size===0},resolve(){n=new Promise(r=>{t(),t=r})},get promise(){return n}}}var dD={};_r(dD,{Fixed:()=>uo,Param:()=>Na,Query:()=>yt,Selection:()=>Ss,agg:()=>X2,align:()=>c6,and:()=>Yn,area:()=>U8,areaX:()=>z8,areaY:()=>q8,argmax:()=>Su,argmin:()=>_u,arrayAgg:()=>gS,arrow:()=>LN,aspectRatio:()=>l6,avg:()=>G2,axis:()=>u6,axisFx:()=>$N,axisFy:()=>PN,axisX:()=>FN,axisY:()=>RN,barX:()=>X8,barY:()=>G8,bin:()=>Pv,cast:()=>jh,castDouble:()=>Iu,castInteger:()=>xS,cell:()=>W8,cellX:()=>H8,cellY:()=>Z8,centroid:()=>Yh,centroidX:()=>SS,centroidY:()=>IS,circle:()=>rN,colorBase:()=>H4,colorClamp:()=>$4,colorConstant:()=>J4,colorDomain:()=>F4,colorExponent:()=>Z4,colorInterpolate:()=>q4,colorLabel:()=>Y4,colorLegend:()=>lD,colorN:()=>P4,colorNice:()=>U4,colorPivot:()=>j4,colorRange:()=>R4,colorReverse:()=>X4,colorScale:()=>k4,colorScheme:()=>z4,colorSymmetric:()=>V4,colorTickFormat:()=>W4,colorZero:()=>G4,column:()=>Aa,contour:()=>vN,coordinator:()=>ei,corr:()=>sS,count:()=>Cr,covarPop:()=>aS,create:()=>co,cume_dist:()=>$2,dateDay:()=>_S,dateMonth:()=>wS,dateMonthDay:()=>vS,delaunayLink:()=>DN,delaunayMesh:()=>ON,denseLine:()=>wN,dense_rank:()=>F2,density:()=>bN,densityX:()=>gN,densityY:()=>xN,dot:()=>tN,dotX:()=>eN,dotY:()=>nN,entropy:()=>rS,eq:()=>ws,facetGrid:()=>LE,facetLabel:()=>CE,facetMargin:()=>EE,facetMarginBottom:()=>DE,facetMarginLeft:()=>OE,facetMarginRight:()=>BE,facetMarginTop:()=>NE,first:()=>pS,first_value:()=>q2,frame:()=>kN,from:()=>aU,fxAlign:()=>qE,fxAriaDescription:()=>s4,fxAriaLabel:()=>o4,fxAxis:()=>XE,fxDomain:()=>kE,fxFontVariant:()=>i4,fxGrid:()=>KE,fxInset:()=>$E,fxInsetLeft:()=>PE,fxInsetRight:()=>UE,fxLabel:()=>e4,fxLabelAnchor:()=>n4,fxLabelOffset:()=>r4,fxLine:()=>t4,fxNice:()=>RE,fxPadding:()=>jE,fxPaddingInner:()=>VE,fxPaddingOuter:()=>YE,fxRange:()=>FE,fxReverse:()=>a4,fxRound:()=>zE,fxTickFormat:()=>JE,fxTickPadding:()=>ZE,fxTickRotate:()=>QE,fxTickSize:()=>WE,fxTickSpacing:()=>HE,fxTicks:()=>GE,fyAlign:()=>m4,fyAriaDescription:()=>L4,fyAriaLabel:()=>B4,fyAxis:()=>b4,fyDomain:()=>c4,fyFontVariant:()=>O4,fyGrid:()=>A4,fyInset:()=>f4,fyInsetBottom:()=>h4,fyInsetTop:()=>d4,fyLabel:()=>E4,fyLabelAnchor:()=>N4,fyLabelOffset:()=>D4,fyLine:()=>T4,fyNice:()=>u4,fyPadding:()=>y4,fyPaddingInner:()=>g4,fyPaddingOuter:()=>x4,fyRange:()=>l4,fyReverse:()=>C4,fyRound:()=>p4,fyTickFormat:()=>I4,fyTickPadding:()=>S4,fyTickRotate:()=>M4,fyTickSize:()=>v4,fyTickSpacing:()=>_4,fyTicks:()=>w4,geo:()=>VN,geojson:()=>Vh,graticule:()=>XN,grid:()=>d6,gridFx:()=>qN,gridFy:()=>jN,gridX:()=>UN,gridY:()=>zN,gt:()=>Uh,gte:()=>T2,hconcat:()=>eU,heatmap:()=>_N,height:()=>r6,hexagon:()=>iN,hexbin:()=>MN,hexgrid:()=>AN,highlight:()=>GN,hspace:()=>iU,hull:()=>BN,image:()=>yN,inset:()=>f6,intervalX:()=>KN,intervalXY:()=>eD,intervalY:()=>tD,isBetween:()=>Ie,isDistinct:()=>E2,isNotBetween:()=>N2,isNotDistinct:()=>zh,isNotNull:()=>bs,isNull:()=>zc,kurtosis:()=>nS,label:()=>h6,lag:()=>U2,last:()=>mS,last_value:()=>j2,lead:()=>z2,lengthBase:()=>M8,lengthClamp:()=>_8,lengthConstant:()=>T8,lengthDomain:()=>w8,lengthExponent:()=>A8,lengthNice:()=>S8,lengthRange:()=>v8,lengthScale:()=>b8,lengthZero:()=>I8,line:()=>j8,lineX:()=>V8,lineY:()=>Y8,link:()=>CN,literal:()=>Lr,loadCSV:()=>AS,loadExtension:()=>Gh,loadJSON:()=>TS,loadObjects:()=>DS,loadParquet:()=>ES,loadSpatial:()=>NS,lt:()=>vs,lte:()=>_s,mad:()=>W2,margin:()=>K3,marginBottom:()=>a6,marginLeft:()=>i6,marginRight:()=>o6,marginTop:()=>s6,margins:()=>Q3,max:()=>Kr,median:()=>Z2,menu:()=>HP,min:()=>ti,mode:()=>Q2,name:()=>Z3,nearestX:()=>JN,nearestY:()=>QN,neq:()=>qc,not:()=>A2,nth_value:()=>V2,ntile:()=>P2,opacityBase:()=>a8,opacityClamp:()=>e8,opacityConstant:()=>l8,opacityDomain:()=>K4,opacityExponent:()=>c8,opacityLabel:()=>r8,opacityLegend:()=>uD,opacityNice:()=>n8,opacityRange:()=>t8,opacityReverse:()=>i8,opacityScale:()=>Q4,opacityTickFormat:()=>s8,opacityZero:()=>o8,or:()=>Uc,padding:()=>p6,pan:()=>nD,panX:()=>rD,panY:()=>iD,panZoom:()=>oD,panZoomX:()=>sD,panZoomY:()=>aD,percent_rank:()=>R2,plot:()=>cU,product:()=>H2,projectionClip:()=>$8,projectionDomain:()=>B8,projectionInset:()=>L8,projectionInsetBottom:()=>R8,projectionInsetLeft:()=>C8,projectionInsetRight:()=>k8,projectionInsetTop:()=>F8,projectionParallels:()=>N8,projectionPrecision:()=>D8,projectionRotate:()=>O8,projectionType:()=>E8,quantile:()=>J2,rBase:()=>y8,rClamp:()=>h8,rConstant:()=>x8,rDomain:()=>f8,rExponent:()=>g8,rNice:()=>p8,rRange:()=>d8,rScale:()=>u8,rZero:()=>m8,rank:()=>k2,raster:()=>SN,rasterTile:()=>IN,rect:()=>J8,rectX:()=>Q8,rectY:()=>K8,regressionY:()=>TN,round:()=>m6,row_number:()=>C2,ruleX:()=>cN,ruleY:()=>lN,search:()=>ZP,skewness:()=>eS,slider:()=>JP,sphere:()=>YN,spike:()=>mN,sql:()=>j,stddev:()=>tS,stddevPop:()=>oS,stringAgg:()=>yS,style:()=>e6,sum:()=>kr,symbolLegend:()=>fD,table:()=>QP,text:()=>oN,textX:()=>sN,textY:()=>aN,tickX:()=>uN,tickY:()=>fN,toggle:()=>Id,toggleColor:()=>ZN,toggleX:()=>WN,toggleY:()=>HN,varPop:()=>iS,variance:()=>K2,vconcat:()=>tU,vector:()=>dN,vectorX:()=>hN,vectorY:()=>pN,voronoi:()=>EN,voronoiMesh:()=>NN,vspace:()=>rU,width:()=>n6,xAlign:()=>M6,xAriaDescription:()=>j6,xAriaLabel:()=>q6,xAxis:()=>N6,xBase:()=>X6,xClamp:()=>S6,xConstant:()=>W6,xDomain:()=>g6,xExponent:()=>G6,xFontVariant:()=>z6,xGrid:()=>F6,xInset:()=>w6,xInsetLeft:()=>v6,xInsetRight:()=>_6,xLabel:()=>$6,xLabelAnchor:()=>P6,xLabelOffset:()=>U6,xLine:()=>R6,xNice:()=>b6,xPadding:()=>A6,xPaddingInner:()=>T6,xPaddingOuter:()=>E6,xRange:()=>x6,xReverse:()=>V6,xRound:()=>I6,xScale:()=>y6,xTickFormat:()=>C6,xTickPadding:()=>L6,xTickRotate:()=>k6,xTickSize:()=>O6,xTickSpacing:()=>B6,xTicks:()=>D6,xZero:()=>Y6,xyDomain:()=>t6,yAlign:()=>iE,yAriaDescription:()=>_E,yAriaLabel:()=>vE,yAxis:()=>cE,yBase:()=>ME,yClamp:()=>nE,yConstant:()=>TE,yDomain:()=>Z6,yExponent:()=>AE,yFontVariant:()=>wE,yGrid:()=>mE,yInset:()=>K6,yInsetBottom:()=>eE,yInsetTop:()=>tE,yLabel:()=>gE,yLabelAnchor:()=>xE,yLabelOffset:()=>bE,yLine:()=>yE,yNice:()=>Q6,yPadding:()=>oE,yPaddingInner:()=>sE,yPaddingOuter:()=>aE,yRange:()=>J6,yReverse:()=>SE,yRound:()=>rE,yScale:()=>H6,yTickFormat:()=>hE,yTickPadding:()=>dE,yTickRotate:()=>pE,yTickSize:()=>uE,yTickSpacing:()=>fE,yTicks:()=>lE,yZero:()=>IE});var uo=Symbol("Fixed"),wn=Symbol("Transient"),Zh=Symbol("Transform");var Nv={};_r(Nv,{Area:()=>Rl,Arrow:()=>ay,BarX:()=>cy,BarY:()=>ly,Cell:()=>$l,Contour:()=>xy,Density:()=>vy,Dot:()=>Pl,Frame:()=>Km,Geo:()=>_y,Hexgrid:()=>Sy,Image:()=>Iy,Line:()=>Ul,Link:()=>oy,Mark:()=>vt,Raster:()=>gy,Rect:()=>ql,RuleX:()=>Wm,RuleY:()=>Hm,Text:()=>Cl,TickX:()=>hy,TickY:()=>py,Tip:()=>ty,Vector:()=>Fl,area:()=>iy,areaX:()=>uc,areaY:()=>oa,arrow:()=>C$,auto:()=>Y$,autoSpec:()=>KT,axisFx:()=>Ww,axisFy:()=>Gw,axisX:()=>Jm,axisY:()=>Zm,barX:()=>qo,barY:()=>jo,bin:()=>ia,binX:()=>Uo,binY:()=>zo,bollinger:()=>pc,bollingerX:()=>J$,bollingerY:()=>Q$,boxX:()=>K$,boxY:()=>t9,cell:()=>fc,cellX:()=>F$,cellY:()=>R$,centroid:()=>Z9,circle:()=>U$,cluster:()=>H9,column:()=>dn,contour:()=>l9,crosshair:()=>d9,crosshairX:()=>h9,crosshairY:()=>p9,delaunayLink:()=>g9,delaunayMesh:()=>x9,density:()=>S9,differenceY:()=>A9,dodgeX:()=>uP,dodgeY:()=>fP,dot:()=>yi,dotX:()=>$$,dotY:()=>P$,filter:()=>GF,find:()=>nR,formatIsoDate:()=>cT,formatMonth:()=>aR,formatWeekday:()=>cR,frame:()=>Gf,geo:()=>xv,geoCentroid:()=>J9,graticule:()=>E9,gridFx:()=>Qw,gridFy:()=>Zw,gridX:()=>Jw,gridY:()=>Hw,group:()=>Um,groupX:()=>nc,groupY:()=>rc,groupZ:()=>Pm,hexagon:()=>z$,hexbin:()=>N9,hexgrid:()=>D9,hull:()=>b9,identity:()=>G,image:()=>B9,indexOf:()=>Ae,initializer:()=>_e,interpolateNearest:()=>s3,interpolateNone:()=>gv,interpolatorBarycentric:()=>o3,interpolatorRandomWalk:()=>a3,legend:()=>n$,line:()=>zl,lineX:()=>dc,lineY:()=>hc,linearRegressionX:()=>k9,linearRegressionY:()=>F9,link:()=>cv,map:()=>br,mapX:()=>sd,mapY:()=>ad,marks:()=>Ke,normalize:()=>Tv,normalizeX:()=>mP,normalizeY:()=>yP,plot:()=>ny,pointer:()=>qf,pointerX:()=>jf,pointerY:()=>Dl,raster:()=>o9,rect:()=>fy,rectX:()=>rd,rectY:()=>id,reverse:()=>WF,ruleX:()=>Vr,ruleY:()=>Yr,scale:()=>Uf,select:()=>xP,selectFirst:()=>E3,selectLast:()=>N3,selectMaxX:()=>vP,selectMaxY:()=>_P,selectMinX:()=>bP,selectMinY:()=>wP,shiftX:()=>gP,shuffle:()=>HF,sort:()=>fw,sphere:()=>T9,spike:()=>F7,stackX:()=>ZT,stackX1:()=>M$,stackX2:()=>A$,stackY:()=>JT,stackY1:()=>T$,stackY2:()=>E$,text:()=>Po,textX:()=>Uw,textY:()=>zw,tickX:()=>pv,tickY:()=>mv,tip:()=>ev,transform:()=>hn,tree:()=>_3,treeLink:()=>Sv,treeNode:()=>My,valueof:()=>pt,vector:()=>PT,vectorX:()=>Vw,vectorY:()=>Yw,voronoi:()=>w9,voronoiMesh:()=>v9,window:()=>cd,windowX:()=>X$,windowY:()=>G$});function zt(e,t){return e==null||t==null?NaN:e<t?-1:e>t?1:e>=t?0:NaN}function Xn(e,t){return e==null||t==null?NaN:t<e?-1:t>e?1:t>=e?0:NaN}function Is(e){let t,n,r;e.length!==2?(t=zt,n=(a,c)=>zt(e(a),c),r=(a,c)=>e(a)-c):(t=e===zt||e===Xn?e:CV,n=e,r=e);function i(a,c,l=0,u=a.length){if(l<u){if(t(c,c)!==0)return u;do{let f=l+u>>>1;n(a[f],c)<0?l=f+1:u=f}while(l<u)}return l}function o(a,c,l=0,u=a.length){if(l<u){if(t(c,c)!==0)return u;do{let f=l+u>>>1;n(a[f],c)<=0?l=f+1:u=f}while(l<u)}return l}function s(a,c,l=0,u=a.length){let f=i(a,c,l,u-1);return f>l&&r(a[f-1],c)>-r(a[f],c)?f-1:f}return{left:i,center:s,right:o}}function CV(){return 0}function Jh(e){return e===null?NaN:+e}function*U5(e,t){if(t===void 0)for(let n of e)n!=null&&(n=+n)>=n&&(yield n);else{let n=-1;for(let r of e)(r=t(r,++n,e))!=null&&(r=+r)>=r&&(yield r)}}var z5=Is(zt),q5=z5.right,kV=z5.left,FV=Is(Jh).center,Ms=q5;var Qh=j5(V5),CS=j5(RV);function j5(e){return function(t,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:s}=t;if(!((o=Math.floor(o))>=0))throw new RangeError("invalid width");if(!((s=Math.floor(s!==void 0?s:i.length/o))>=0))throw new RangeError("invalid height");if(!o||!s||!n&&!r)return t;let a=n&&e(n),c=r&&e(r),l=i.slice();return a&&c?(Mu(a,l,i,o,s),Mu(a,i,l,o,s),Mu(a,l,i,o,s),Au(c,i,l,o,s),Au(c,l,i,o,s),Au(c,i,l,o,s)):a?(Mu(a,i,l,o,s),Mu(a,l,i,o,s),Mu(a,i,l,o,s)):c&&(Au(c,i,l,o,s),Au(c,l,i,o,s),Au(c,i,l,o,s)),t}}function Mu(e,t,n,r,i){for(let o=0,s=r*i;o<s;)e(t,n,o,o+=r,1)}function Au(e,t,n,r,i){for(let o=0,s=r*i;o<r;++o)e(t,n,o,o+s,r)}function RV(e){let t=V5(e);return(n,r,i,o,s)=>{i<<=2,o<<=2,s<<=2,t(n,r,i+0,o+0,s),t(n,r,i+1,o+1,s),t(n,r,i+2,o+2,s),t(n,r,i+3,o+3,s)}}function V5(e){let t=Math.floor(e);if(t===e)return $V(e);let n=e-t,r=2*e+1;return(i,o,s,a,c)=>{if(!((a-=c)>=s))return;let l=t*o[s],u=c*t,f=u+c;for(let d=s,h=s+u;d<h;d+=c)l+=o[Math.min(a,d)];for(let d=s,h=a;d<=h;d+=c)l+=o[Math.min(a,d+u)],i[d]=(l+n*(o[Math.max(s,d-f)]+o[Math.min(a,d+f)]))/r,l-=o[Math.max(s,d-u)]}}function $V(e){let t=2*e+1;return(n,r,i,o,s)=>{if(!((o-=s)>=i))return;let a=e*r[i],c=s*e;for(let l=i,u=i+c;l<u;l+=s)a+=r[Math.min(o,l)];for(let l=i,u=o;l<=u;l+=s)a+=r[Math.min(o,l+c)],n[l]=a/t,a-=r[Math.max(i,l-c)]}}function fo(e,t){let n=0;if(t===void 0)for(let r of e)r!=null&&(r=+r)>=r&&++n;else{let r=-1;for(let i of e)(i=t(i,++r,e))!=null&&(i=+i)>=i&&++n}return n}function PV(e){return e.length|0}function UV(e){return!(e>0)}function zV(e){return typeof e!="object"||"length"in e?e:Array.from(e)}function qV(e){return t=>e(...t)}function X0(...e){let t=typeof e[e.length-1]=="function"&&qV(e.pop());e=e.map(zV);let n=e.map(PV),r=e.length-1,i=new Array(r+1).fill(0),o=[];if(r<0||n.some(UV))return o;for(;;){o.push(i.map((a,c)=>e[c][a]));let s=r;for(;++i[s]===n[s];){if(s===0)return t?o.map(t):o;i[s--]=0}}}function G0(e,t){var n=0,r=0;return Float64Array.from(e,t===void 0?i=>n+=+i||0:i=>n+=+t(i,r++,e)||0)}function Da(e,t){let n=0,r,i=0,o=0;if(t===void 0)for(let s of e)s!=null&&(s=+s)>=s&&(r=s-i,i+=r/++n,o+=r*(s-i));else{let s=-1;for(let a of e)(a=t(a,++s,e))!=null&&(a=+a)>=a&&(r=a-i,i+=r/++n,o+=r*(a-i))}if(n>1)return o/(n-1)}function ri(e,t){let n=Da(e,t);return n&&Math.sqrt(n)}function ae(e,t){let n,r;if(t===void 0)for(let i of e)i!=null&&(n===void 0?i>=i&&(n=r=i):(n>i&&(n=i),r<i&&(r=i)));else{let i=-1;for(let o of e)(o=t(o,++i,e))!=null&&(n===void 0?o>=o&&(n=r=o):(n>o&&(n=o),r<o&&(r=o)))}return[n,r]}var vn=class{constructor(){this._partials=new Float64Array(32),this._n=0}add(t){let n=this._partials,r=0;for(let i=0;i<this._n&&i<32;i++){let o=n[i],s=t+o,a=Math.abs(t)<Math.abs(o)?t-(s-o):o-(s-t);a&&(n[r++]=a),t=s}return n[r]=t,this._n=r+1,this}valueOf(){let t=this._partials,n=this._n,r,i,o,s=0;if(n>0){for(s=t[--n];n>0&&(r=s,i=t[--n],s=r+i,o=i-(s-r),!o););n>0&&(o<0&&t[n-1]<0||o>0&&t[n-1]>0)&&(i=o*2,r=s+i,i==r-s&&(s=r))}return s}};var Gn=class extends Map{constructor(t,n=G5){if(super(),Object.defineProperties(this,{_intern:{value:new Map},_key:{value:n}}),t!=null)for(let[r,i]of t)this.set(r,i)}get(t){return super.get(kS(this,t))}has(t){return super.has(kS(this,t))}set(t,n){return super.set(Y5(this,t),n)}delete(t){return super.delete(X5(this,t))}},Wn=class extends Set{constructor(t,n=G5){if(super(),Object.defineProperties(this,{_intern:{value:new Map},_key:{value:n}}),t!=null)for(let r of t)this.add(r)}has(t){return super.has(kS(this,t))}add(t){return super.add(Y5(this,t))}delete(t){return super.delete(X5(this,t))}};function kS({_intern:e,_key:t},n){let r=t(n);return e.has(r)?e.get(r):n}function Y5({_intern:e,_key:t},n){let r=t(n);return e.has(r)?e.get(r):(e.set(r,n),n)}function X5({_intern:e,_key:t},n){let r=t(n);return e.has(r)&&(n=e.get(r),e.delete(r)),n}function G5(e){return e!==null&&typeof e=="object"?e.valueOf():e}function Kh(e){return e}function on(e,...t){return RS(e,Kh,Kh,t)}function $i(e,t,...n){return RS(e,Kh,t,n)}function FS(e,t,...n){return RS(e,Array.from,t,n)}function RS(e,t,n,r){return function i(o,s){if(s>=r.length)return n(o);let a=new Gn,c=r[s++],l=-1;for(let u of o){let f=c(u,++l,o),d=a.get(f);d?d.push(u):a.set(f,[u])}for(let[u,f]of a)a.set(u,i(f,s));return t(a)}(e,0)}function $S(e,t){return Array.from(t,n=>e[n])}function ho(e,...t){if(typeof e[Symbol.iterator]!="function")throw new TypeError("values is not iterable");e=Array.from(e);let[n]=t;if(n&&n.length!==2||t.length>1){let r=Uint32Array.from(e,(i,o)=>o);return t.length>1?(t=t.map(i=>e.map(i)),r.sort((i,o)=>{for(let s of t){let a=Xc(s[i],s[o]);if(a)return a}})):(n=e.map(n),r.sort((i,o)=>Xc(n[i],n[o]))),$S(e,r)}return e.sort(tp(n))}function tp(e=zt){if(e===zt)return Xc;if(typeof e!="function")throw new TypeError("compare is not a function");return(t,n)=>{let r=e(t,n);return r||r===0?r:(e(n,n)===0)-(e(t,t)===0)}}function Xc(e,t){return(e==null||!(e>=e))-(t==null||!(t>=t))||(e<t?-1:e>t?1:0)}function Tu(e,t,n){return(t.length!==2?ho($i(e,t,n),([r,i],[o,s])=>zt(i,s)||zt(r,o)):ho(on(e,n),([r,i],[o,s])=>t(i,s)||zt(r,o))).map(([r])=>r)}var jV=Math.sqrt(50),VV=Math.sqrt(10),YV=Math.sqrt(2);function W0(e,t,n){let r=(t-e)/Math.max(0,n),i=Math.floor(Math.log10(r)),o=r/Math.pow(10,i),s=o>=jV?10:o>=VV?5:o>=YV?2:1,a,c,l;return i<0?(l=Math.pow(10,-i)/s,a=Math.round(e*l),c=Math.round(t*l),a/l<e&&++a,c/l>t&&--c,l=-l):(l=Math.pow(10,i)*s,a=Math.round(e/l),c=Math.round(t/l),a*l<e&&++a,c*l>t&&--c),c<a&&.5<=n&&n<2?W0(e,t,n*2):[a,c,l]}function _n(e,t,n){if(t=+t,e=+e,n=+n,!(n>0))return[];if(e===t)return[e];let r=t<e,[i,o,s]=r?W0(t,e,n):W0(e,t,n);if(!(o>=i))return[];let a=o-i+1,c=new Array(a);if(r)if(s<0)for(let l=0;l<a;++l)c[l]=(o-l)/-s;else for(let l=0;l<a;++l)c[l]=(o-l)*s;else if(s<0)for(let l=0;l<a;++l)c[l]=(i+l)/-s;else for(let l=0;l<a;++l)c[l]=(i+l)*s;return c}function As(e,t,n){return t=+t,e=+e,n=+n,W0(e,t,n)[2]}function Eu(e,t,n){t=+t,e=+e,n=+n;let r=t<e,i=r?As(t,e,n):As(e,t,n);return(r?-1:1)*(i<0?1/-i:i)}function Nu(e,t,n){let r;for(;;){let i=As(e,t,n);if(i===r||i===0||!isFinite(i))return[e,t];i>0?(e=Math.floor(e/i)*i,t=Math.ceil(t/i)*i):i<0&&(e=Math.ceil(e*i)/i,t=Math.floor(t*i)/i),r=i}}function Oa(e){return Math.max(1,Math.ceil(Math.log(fo(e))/Math.LN2)+1)}function Gt(e,t){let n;if(t===void 0)for(let r of e)r!=null&&(n<r||n===void 0&&r>=r)&&(n=r);else{let r=-1;for(let i of e)(i=t(i,++r,e))!=null&&(n<i||n===void 0&&i>=i)&&(n=i)}return n}function H0(e,t){let n,r=-1,i=-1;if(t===void 0)for(let o of e)++i,o!=null&&(n<o||n===void 0&&o>=o)&&(n=o,r=i);else for(let o of e)(o=t(o,++i,e))!=null&&(n<o||n===void 0&&o>=o)&&(n=o,r=i);return r}function ce(e,t){let n;if(t===void 0)for(let r of e)r!=null&&(n>r||n===void 0&&r>=r)&&(n=r);else{let r=-1;for(let i of e)(i=t(i,++r,e))!=null&&(n>i||n===void 0&&i>=i)&&(n=i)}return n}function Z0(e,t){let n,r=-1,i=-1;if(t===void 0)for(let o of e)++i,o!=null&&(n>o||n===void 0&&o>=o)&&(n=o,r=i);else for(let o of e)(o=t(o,++i,e))!=null&&(n>o||n===void 0&&o>=o)&&(n=o,r=i);return r}function J0(e,t,n=0,r=1/0,i){if(t=Math.floor(t),n=Math.floor(Math.max(0,n)),r=Math.floor(Math.min(e.length-1,r)),!(n<=t&&t<=r))return e;for(i=i===void 0?Xc:tp(i);r>n;){if(r-n>600){let c=r-n+1,l=t-n+1,u=Math.log(c),f=.5*Math.exp(2*u/3),d=.5*Math.sqrt(u*f*(c-f)/c)*(l-c/2<0?-1:1),h=Math.max(n,Math.floor(t-l*f/c+d)),p=Math.min(r,Math.floor(t+(c-l)*f/c+d));J0(e,t,h,p,i)}let o=e[t],s=n,a=r;for(ep(e,n,t),i(e[r],o)>0&&ep(e,n,r);s<a;){for(ep(e,s,a),++s,--a;i(e[s],o)<0;)++s;for(;i(e[a],o)>0;)--a}i(e[n],o)===0?ep(e,n,a):(++a,ep(e,a,r)),a<=t&&(n=a+1),t<=a&&(r=a-1)}return e}function ep(e,t,n){let r=e[t];e[t]=e[n],e[n]=r}function Gc(e,t=zt){let n,r=!1;if(t.length===1){let i;for(let o of e){let s=t(o);(r?zt(s,i)>0:zt(s,s)===0)&&(n=o,i=s,r=!0)}}else for(let i of e)(r?t(i,n)>0:t(i,i)===0)&&(n=i,r=!0);return n}function Hn(e,t,n){if(e=Float64Array.from(U5(e,n)),!(!(r=e.length)||isNaN(t=+t))){if(t<=0||r<2)return ce(e);if(t>=1)return Gt(e);var r,i=(r-1)*t,o=Math.floor(i),s=Gt(J0(e,o).subarray(0,o+1)),a=ce(e.subarray(o+1));return s+(a-s)*(i-o)}}function PS(e,t,n=Jh){if(!(!(r=e.length)||isNaN(t=+t))){if(t<=0||r<2)return+n(e[0],0,e);if(t>=1)return+n(e[r-1],r-1,e);var r,i=(r-1)*t,o=Math.floor(i),s=+n(e[o],o,e),a=+n(e[o+1],o+1,e);return s+(a-s)*(i-o)}}function Q0(e,t,n){let r=fo(e),i=Hn(e,.75)-Hn(e,.25);return r&&i?Math.ceil((n-t)/(2*i*Math.pow(r,-1/3))):1}function np(e,t,n){let r=fo(e),i=ri(e);return r&&i?Math.ceil((n-t)*Math.cbrt(r)/(3.49*i)):1}function Ts(e,t){let n=0,r=0;if(t===void 0)for(let i of e)i!=null&&(i=+i)>=i&&(++n,r+=i);else{let i=-1;for(let o of e)(o=t(o,++i,e))!=null&&(o=+o)>=o&&(++n,r+=o)}if(n)return r/n}function Pi(e,t){return Hn(e,.5,t)}function*GV(e){for(let t of e)yield*t}function Du(e){return Array.from(GV(e))}function Ou(e,t){let n=new Gn;if(t===void 0)for(let o of e)o!=null&&o>=o&&n.set(o,(n.get(o)||0)+1);else{let o=-1;for(let s of e)(s=t(s,++o,e))!=null&&s>=s&&n.set(s,(n.get(s)||0)+1)}let r,i=0;for(let[o,s]of n)s>i&&(i=s,r=o);return r}function K0(e,t=WV){let n=[],r,i=!1;for(let o of e)i&&n.push(t(r,o)),r=o,i=!0;return n}function WV(e,t){return[e,t]}function Pe(e,t,n){e=+e,t=+t,n=(i=arguments.length)<2?(t=e,e=0,1):i<3?1:+n;for(var r=-1,i=Math.max(0,Math.ceil((t-e)/n))|0,o=new Array(i);++r<i;)o[r]=e+r*n;return o}function rp(e,t=zt){if(typeof e[Symbol.iterator]!="function")throw new TypeError("values is not iterable");let n=Array.from(e),r=new Float64Array(n.length);t.length!==2&&(n=n.map(t),t=zt);let i=(a,c)=>t(n[a],n[c]),o,s;return e=Uint32Array.from(n,(a,c)=>c),e.sort(t===zt?(a,c)=>Xc(n[a],n[c]):tp(i)),e.forEach((a,c)=>{let l=i(a,o===void 0?a:o);l>=0?((o===void 0||l>0)&&(o=a,s=c),r[a]=s):r[a]=NaN}),r}function tx(e,t=zt){let n,r=!1;if(t.length===1){let i;for(let o of e){let s=t(o);(r?zt(s,i)<0:zt(s,s)===0)&&(n=o,i=s,r=!0)}}else for(let i of e)(r?t(i,n)<0:t(i,i)===0)&&(n=i,r=!0);return n}function Sn(e,t){let n=0;if(t===void 0)for(let r of e)(r=+r)&&(n+=r);else{let r=-1;for(let i of e)(i=+t(i,++r,e))&&(n+=i)}return n}function Ba(e){if(typeof e[Symbol.iterator]!="function")throw new TypeError("values is not iterable");return Array.from(e).reverse()}function W5(e){return e}var US=1,zS=2,qS=3,ex=4,H5=1e-6;function HV(e){return"translate("+e+",0)"}function ZV(e){return"translate(0,"+e+")"}function JV(e){return t=>+e(t)}function QV(e,t){return t=Math.max(0,e.bandwidth()-t*2)/2,e.round()&&(t=Math.round(t)),n=>+e(n)+t}function KV(){return!this.__axis}function tY(e,t){var n=[],r=null,i=null,o=6,s=6,a=3,c=typeof window<"u"&&window.devicePixelRatio>1?0:.5,l=e===US||e===ex?-1:1,u=e===ex||e===zS?"x":"y",f=e===US||e===qS?HV:ZV;function d(h){var p=r??(t.ticks?t.ticks.apply(t,n):t.domain()),m=i??(t.tickFormat?t.tickFormat.apply(t,n):W5),g=Math.max(o,0)+a,y=t.range(),x=+y[0]+c,b=+y[y.length-1]+c,w=(t.bandwidth?QV:JV)(t.copy(),c),_=h.selection?h.selection():h,v=_.selectAll(".domain").data([null]),M=_.selectAll(".tick").data(p,t).order(),E=M.exit(),D=M.enter().append("g").attr("class","tick"),I=M.select("line"),T=M.select("text");v=v.merge(v.enter().insert("path",".tick").attr("class","domain").attr("stroke","currentColor")),M=M.merge(D),I=I.merge(D.append("line").attr("stroke","currentColor").attr(u+"2",l*o)),T=T.merge(D.append("text").attr("fill","currentColor").attr(u,l*g).attr("dy",e===US?"0em":e===qS?"0.71em":"0.32em")),h!==_&&(v=v.transition(h),M=M.transition(h),I=I.transition(h),T=T.transition(h),E=E.transition(h).attr("opacity",H5).attr("transform",function(O){return isFinite(O=w(O))?f(O+c):this.getAttribute("transform")}),D.attr("opacity",H5).attr("transform",function(O){var L=this.parentNode.__axis;return f((L&&isFinite(L=L(O))?L:w(O))+c)})),E.remove(),v.attr("d",e===ex||e===zS?s?"M"+l*s+","+x+"H"+c+"V"+b+"H"+l*s:"M"+c+","+x+"V"+b:s?"M"+x+","+l*s+"V"+c+"H"+b+"V"+l*s:"M"+x+","+c+"H"+b),M.attr("opacity",1).attr("transform",function(O){return f(w(O)+c)}),I.attr(u+"2",l*o),T.attr(u,l*g).text(m),_.filter(KV).attr("fill","none").attr("font-size",10).attr("font-family","sans-serif").attr("text-anchor",e===zS?"start":e===ex?"end":"middle"),_.each(function(){this.__axis=w})}return d.scale=function(h){return arguments.length?(t=h,d):t},d.ticks=function(){return n=Array.from(arguments),d},d.tickArguments=function(h){return arguments.length?(n=h==null?[]:Array.from(h),d):n.slice()},d.tickValues=function(h){return arguments.length?(r=h==null?null:Array.from(h),d):r&&r.slice()},d.tickFormat=function(h){return arguments.length?(i=h,d):i},d.tickSize=function(h){return arguments.length?(o=s=+h,d):o},d.tickSizeInner=function(h){return arguments.length?(o=+h,d):o},d.tickSizeOuter=function(h){return arguments.length?(s=+h,d):s},d.tickPadding=function(h){return arguments.length?(a=+h,d):a},d.offset=function(h){return arguments.length?(c=+h,d):c},d}function jS(e){return tY(qS,e)}var eY={value:()=>{}};function J5(){for(var e=0,t=arguments.length,n={},r;e<t;++e){if(!(r=arguments[e]+"")||r in n||/[\s.]/.test(r))throw new Error("illegal type: "+r);n[r]=[]}return new nx(n)}function nx(e){this._=e}function nY(e,t){return e.trim().split(/^|\s+/).map(function(n){var r="",i=n.indexOf(".");if(i>=0&&(r=n.slice(i+1),n=n.slice(0,i)),n&&!t.hasOwnProperty(n))throw new Error("unknown type: "+n);return{type:n,name:r}})}nx.prototype=J5.prototype={constructor:nx,on:function(e,t){var n=this._,r=nY(e+"",n),i,o=-1,s=r.length;if(arguments.length<2){for(;++o<s;)if((i=(e=r[o]).type)&&(i=rY(n[i],e.name)))return i;return}if(t!=null&&typeof t!="function")throw new Error("invalid callback: "+t);for(;++o<s;)if(i=(e=r[o]).type)n[i]=Z5(n[i],e.name,t);else if(t==null)for(i in n)n[i]=Z5(n[i],e.name,null);return this},copy:function(){var e={},t=this._;for(var n in t)e[n]=t[n].slice();return new nx(e)},call:function(e,t){if((i=arguments.length-2)>0)for(var n=new Array(i),r=0,i,o;r<i;++r)n[r]=arguments[r+2];if(!this._.hasOwnProperty(e))throw new Error("unknown type: "+e);for(o=this._[e],r=0,i=o.length;r<i;++r)o[r].value.apply(t,n)},apply:function(e,t,n){if(!this._.hasOwnProperty(e))throw new Error("unknown type: "+e);for(var r=this._[e],i=0,o=r.length;i<o;++i)r[i].value.apply(t,n)}};function rY(e,t){for(var n=0,r=e.length,i;n<r;++n)if((i=e[n]).name===t)return i.value}function Z5(e,t,n){for(var r=0,i=e.length;r<i;++r)if(e[r].name===t){e[r]=eY,e=e.slice(0,r).concat(e.slice(r+1));break}return n!=null&&e.push({name:t,value:n}),e}var Wc=J5;var rx="http://www.w3.org/1999/xhtml",ii={svg:"http://www.w3.org/2000/svg",xhtml:rx,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};function Es(e){var t=e+="",n=t.indexOf(":");return n>=0&&(t=e.slice(0,n))!=="xmlns"&&(e=e.slice(n+1)),ii.hasOwnProperty(t)?{space:ii[t],local:e}:e}function iY(e){return function(){var t=this.ownerDocument,n=this.namespaceURI;return n===rx&&t.documentElement.namespaceURI===rx?t.createElement(e):t.createElementNS(n,e)}}function oY(e){return function(){return this.ownerDocument.createElementNS(e.space,e.local)}}function Ns(e){var t=Es(e);return(t.local?oY:iY)(t)}function sY(){}function Hc(e){return e==null?sY:function(){return this.querySelector(e)}}function Q5(e){typeof e!="function"&&(e=Hc(e));for(var t=this._groups,n=t.length,r=new Array(n),i=0;i<n;++i)for(var o=t[i],s=o.length,a=r[i]=new Array(s),c,l,u=0;u<s;++u)(c=o[u])&&(l=e.call(c,c.__data__,u,o))&&("__data__"in c&&(l.__data__=c.__data__),a[u]=l);return new ke(r,this._parents)}function VS(e){return e==null?[]:Array.isArray(e)?e:Array.from(e)}function aY(){return[]}function ip(e){return e==null?aY:function(){return this.querySelectorAll(e)}}function cY(e){return function(){return VS(e.apply(this,arguments))}}function K5(e){typeof e=="function"?e=cY(e):e=ip(e);for(var t=this._groups,n=t.length,r=[],i=[],o=0;o<n;++o)for(var s=t[o],a=s.length,c,l=0;l<a;++l)(c=s[l])&&(r.push(e.call(c,c.__data__,l,s)),i.push(c));return new ke(r,i)}function op(e){return function(){return this.matches(e)}}function ix(e){return function(t){return t.matches(e)}}var lY=Array.prototype.find;function uY(e){return function(){return lY.call(this.children,e)}}function fY(){return this.firstElementChild}function tB(e){return this.select(e==null?fY:uY(typeof e=="function"?e:ix(e)))}var dY=Array.prototype.filter;function hY(){return Array.from(this.children)}function pY(e){return function(){return dY.call(this.children,e)}}function eB(e){return this.selectAll(e==null?hY:pY(typeof e=="function"?e:ix(e)))}function nB(e){typeof e!="function"&&(e=op(e));for(var t=this._groups,n=t.length,r=new Array(n),i=0;i<n;++i)for(var o=t[i],s=o.length,a=r[i]=[],c,l=0;l<s;++l)(c=o[l])&&e.call(c,c.__data__,l,o)&&a.push(c);return new ke(r,this._parents)}function ox(e){return new Array(e.length)}function rB(){return new ke(this._enter||this._groups.map(ox),this._parents)}function sp(e,t){this.ownerDocument=e.ownerDocument,this.namespaceURI=e.namespaceURI,this._next=null,this._parent=e,this.__data__=t}sp.prototype={constructor:sp,appendChild:function(e){return this._parent.insertBefore(e,this._next)},insertBefore:function(e,t){return this._parent.insertBefore(e,t)},querySelector:function(e){return this._parent.querySelector(e)},querySelectorAll:function(e){return this._parent.querySelectorAll(e)}};function iB(e){return function(){return e}}function mY(e,t,n,r,i,o){for(var s=0,a,c=t.length,l=o.length;s<l;++s)(a=t[s])?(a.__data__=o[s],r[s]=a):n[s]=new sp(e,o[s]);for(;s<c;++s)(a=t[s])&&(i[s]=a)}function yY(e,t,n,r,i,o,s){var a,c,l=new Map,u=t.length,f=o.length,d=new Array(u),h;for(a=0;a<u;++a)(c=t[a])&&(d[a]=h=s.call(c,c.__data__,a,t)+"",l.has(h)?i[a]=c:l.set(h,c));for(a=0;a<f;++a)h=s.call(e,o[a],a,o)+"",(c=l.get(h))?(r[a]=c,c.__data__=o[a],l.delete(h)):n[a]=new sp(e,o[a]);for(a=0;a<u;++a)(c=t[a])&&l.get(d[a])===c&&(i[a]=c)}function gY(e){return e.__data__}function oB(e,t){if(!arguments.length)return Array.from(this,gY);var n=t?yY:mY,r=this._parents,i=this._groups;typeof e!="function"&&(e=iB(e));for(var o=i.length,s=new Array(o),a=new Array(o),c=new Array(o),l=0;l<o;++l){var u=r[l],f=i[l],d=f.length,h=xY(e.call(u,u&&u.__data__,l,r)),p=h.length,m=a[l]=new Array(p),g=s[l]=new Array(p),y=c[l]=new Array(d);n(u,f,m,g,y,h,t);for(var x=0,b=0,w,_;x<p;++x)if(w=m[x]){for(x>=b&&(b=x+1);!(_=g[b])&&++b<p;);w._next=_||null}}return s=new ke(s,r),s._enter=a,s._exit=c,s}function xY(e){return typeof e=="object"&&"length"in e?e:Array.from(e)}function sB(){return new ke(this._exit||this._groups.map(ox),this._parents)}function aB(e,t,n){var r=this.enter(),i=this,o=this.exit();return typeof e=="function"?(r=e(r),r&&(r=r.selection())):r=r.append(e+""),t!=null&&(i=t(i),i&&(i=i.selection())),n==null?o.remove():n(o),r&&i?r.merge(i).order():i}function cB(e){for(var t=e.selection?e.selection():e,n=this._groups,r=t._groups,i=n.length,o=r.length,s=Math.min(i,o),a=new Array(i),c=0;c<s;++c)for(var l=n[c],u=r[c],f=l.length,d=a[c]=new Array(f),h,p=0;p<f;++p)(h=l[p]||u[p])&&(d[p]=h);for(;c<i;++c)a[c]=n[c];return new ke(a,this._parents)}function lB(){for(var e=this._groups,t=-1,n=e.length;++t<n;)for(var r=e[t],i=r.length-1,o=r[i],s;--i>=0;)(s=r[i])&&(o&&s.compareDocumentPosition(o)^4&&o.parentNode.insertBefore(s,o),o=s);return this}function uB(e){e||(e=bY);function t(f,d){return f&&d?e(f.__data__,d.__data__):!f-!d}for(var n=this._groups,r=n.length,i=new Array(r),o=0;o<r;++o){for(var s=n[o],a=s.length,c=i[o]=new Array(a),l,u=0;u<a;++u)(l=s[u])&&(c[u]=l);c.sort(t)}return new ke(i,this._parents).order()}function bY(e,t){return e<t?-1:e>t?1:e>=t?0:NaN}function fB(){var e=arguments[0];return arguments[0]=this,e.apply(null,arguments),this}function dB(){return Array.from(this)}function hB(){for(var e=this._groups,t=0,n=e.length;t<n;++t)for(var r=e[t],i=0,o=r.length;i<o;++i){var s=r[i];if(s)return s}return null}function pB(){let e=0;for(let t of this)++e;return e}function mB(){return!this.node()}function yB(e){for(var t=this._groups,n=0,r=t.length;n<r;++n)for(var i=t[n],o=0,s=i.length,a;o<s;++o)(a=i[o])&&e.call(a,a.__data__,o,i);return this}function wY(e){return function(){this.removeAttribute(e)}}function vY(e){return function(){this.removeAttributeNS(e.space,e.local)}}function _Y(e,t){return function(){this.setAttribute(e,t)}}function SY(e,t){return function(){this.setAttributeNS(e.space,e.local,t)}}function IY(e,t){return function(){var n=t.apply(this,arguments);n==null?this.removeAttribute(e):this.setAttribute(e,n)}}function MY(e,t){return function(){var n=t.apply(this,arguments);n==null?this.removeAttributeNS(e.space,e.local):this.setAttributeNS(e.space,e.local,n)}}function gB(e,t){var n=Es(e);if(arguments.length<2){var r=this.node();return n.local?r.getAttributeNS(n.space,n.local):r.getAttribute(n)}return this.each((t==null?n.local?vY:wY:typeof t=="function"?n.local?MY:IY:n.local?SY:_Y)(n,t))}function sx(e){return e.ownerDocument&&e.ownerDocument.defaultView||e.document&&e||e.defaultView}function AY(e){return function(){this.style.removeProperty(e)}}function TY(e,t,n){return function(){this.style.setProperty(e,t,n)}}function EY(e,t,n){return function(){var r=t.apply(this,arguments);r==null?this.style.removeProperty(e):this.style.setProperty(e,r,n)}}function xB(e,t,n){return arguments.length>1?this.each((t==null?AY:typeof t=="function"?EY:TY)(e,t,n??"")):La(this.node(),e)}function La(e,t){return e.style.getPropertyValue(t)||sx(e).getComputedStyle(e,null).getPropertyValue(t)}function NY(e){return function(){delete this[e]}}function DY(e,t){return function(){this[e]=t}}function OY(e,t){return function(){var n=t.apply(this,arguments);n==null?delete this[e]:this[e]=n}}function bB(e,t){return arguments.length>1?this.each((t==null?NY:typeof t=="function"?OY:DY)(e,t)):this.node()[e]}function wB(e){return e.trim().split(/^|\s+/)}function YS(e){return e.classList||new vB(e)}function vB(e){this._node=e,this._names=wB(e.getAttribute("class")||"")}vB.prototype={add:function(e){var t=this._names.indexOf(e);t<0&&(this._names.push(e),this._node.setAttribute("class",this._names.join(" ")))},remove:function(e){var t=this._names.indexOf(e);t>=0&&(this._names.splice(t,1),this._node.setAttribute("class",this._names.join(" ")))},contains:function(e){return this._names.indexOf(e)>=0}};function _B(e,t){for(var n=YS(e),r=-1,i=t.length;++r<i;)n.add(t[r])}function SB(e,t){for(var n=YS(e),r=-1,i=t.length;++r<i;)n.remove(t[r])}function BY(e){return function(){_B(this,e)}}function LY(e){return function(){SB(this,e)}}function CY(e,t){return function(){(t.apply(this,arguments)?_B:SB)(this,e)}}function IB(e,t){var n=wB(e+"");if(arguments.length<2){for(var r=YS(this.node()),i=-1,o=n.length;++i<o;)if(!r.contains(n[i]))return!1;return!0}return this.each((typeof t=="function"?CY:t?BY:LY)(n,t))}function kY(){this.textContent=""}function FY(e){return function(){this.textContent=e}}function RY(e){return function(){var t=e.apply(this,arguments);this.textContent=t??""}}function MB(e){return arguments.length?this.each(e==null?kY:(typeof e=="function"?RY:FY)(e)):this.node().textContent}function $Y(){this.innerHTML=""}function PY(e){return function(){this.innerHTML=e}}function UY(e){return function(){var t=e.apply(this,arguments);this.innerHTML=t??""}}function AB(e){return arguments.length?this.each(e==null?$Y:(typeof e=="function"?UY:PY)(e)):this.node().innerHTML}function zY(){this.nextSibling&&this.parentNode.appendChild(this)}function TB(){return this.each(zY)}function qY(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function EB(){return this.each(qY)}function NB(e){var t=typeof e=="function"?e:Ns(e);return this.select(function(){return this.appendChild(t.apply(this,arguments))})}function jY(){return null}function DB(e,t){var n=typeof e=="function"?e:Ns(e),r=t==null?jY:typeof t=="function"?t:Hc(t);return this.select(function(){return this.insertBefore(n.apply(this,arguments),r.apply(this,arguments)||null)})}function VY(){var e=this.parentNode;e&&e.removeChild(this)}function OB(){return this.each(VY)}function YY(){var e=this.cloneNode(!1),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function XY(){var e=this.cloneNode(!0),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function BB(e){return this.select(e?XY:YY)}function LB(e){return arguments.length?this.property("__data__",e):this.node().__data__}function GY(e){return function(t){e.call(this,t,this.__data__)}}function WY(e){return e.trim().split(/^|\s+/).map(function(t){var n="",r=t.indexOf(".");return r>=0&&(n=t.slice(r+1),t=t.slice(0,r)),{type:t,name:n}})}function HY(e){return function(){var t=this.__on;if(t){for(var n=0,r=-1,i=t.length,o;n<i;++n)o=t[n],(!e.type||o.type===e.type)&&o.name===e.name?this.removeEventListener(o.type,o.listener,o.options):t[++r]=o;++r?t.length=r:delete this.__on}}}function ZY(e,t,n){return function(){var r=this.__on,i,o=GY(t);if(r){for(var s=0,a=r.length;s<a;++s)if((i=r[s]).type===e.type&&i.name===e.name){this.removeEventListener(i.type,i.listener,i.options),this.addEventListener(i.type,i.listener=o,i.options=n),i.value=t;return}}this.addEventListener(e.type,o,n),i={type:e.type,name:e.name,value:t,listener:o,options:n},r?r.push(i):this.__on=[i]}}function CB(e,t,n){var r=WY(e+""),i,o=r.length,s;if(arguments.length<2){var a=this.node().__on;if(a){for(var c=0,l=a.length,u;c<l;++c)for(i=0,u=a[c];i<o;++i)if((s=r[i]).type===u.type&&s.name===u.name)return u.value}return}for(a=t?ZY:HY,i=0;i<o;++i)this.each(a(r[i],t,n));return this}function kB(e,t,n){var r=sx(e),i=r.CustomEvent;typeof i=="function"?i=new i(t,n):(i=r.document.createEvent("Event"),n?(i.initEvent(t,n.bubbles,n.cancelable),i.detail=n.detail):i.initEvent(t,!1,!1)),e.dispatchEvent(i)}function JY(e,t){return function(){return kB(this,e,t)}}function QY(e,t){return function(){return kB(this,e,t.apply(this,arguments))}}function FB(e,t){return this.each((typeof t=="function"?QY:JY)(e,t))}function*RB(){for(var e=this._groups,t=0,n=e.length;t<n;++t)for(var r=e[t],i=0,o=r.length,s;i<o;++i)(s=r[i])&&(yield s)}var XS=[null];function ke(e,t){this._groups=e,this._parents=t}function $B(){return new ke([[document.documentElement]],XS)}function KY(){return this}ke.prototype=$B.prototype={constructor:ke,select:Q5,selectAll:K5,selectChild:tB,selectChildren:eB,filter:nB,data:oB,enter:rB,exit:sB,join:aB,merge:cB,selection:KY,order:lB,sort:uB,call:fB,nodes:dB,node:hB,size:pB,empty:mB,each:yB,attr:gB,style:xB,property:bB,classed:IB,text:MB,html:AB,raise:TB,lower:EB,append:NB,insert:DB,remove:OB,clone:BB,datum:LB,on:CB,dispatch:FB,[Symbol.iterator]:RB};var Ds=$B;function jt(e){return typeof e=="string"?new ke([[document.querySelector(e)]],[document.documentElement]):new ke([[e]],XS)}function PB(e){let t;for(;t=e.sourceEvent;)e=t;return e}function Ln(e,t){if(e=PB(e),t===void 0&&(t=e.currentTarget),t){var n=t.ownerSVGElement||t;if(n.createSVGPoint){var r=n.createSVGPoint();return r.x=e.clientX,r.y=e.clientY,r=r.matrixTransform(t.getScreenCTM().inverse()),[r.x,r.y]}if(t.getBoundingClientRect){var i=t.getBoundingClientRect();return[e.clientX-i.left-t.clientLeft,e.clientY-i.top-t.clientTop]}}return[e.pageX,e.pageY]}var ax={capture:!0,passive:!1};function cx(e){e.preventDefault(),e.stopImmediatePropagation()}function ap(e){var t=e.document.documentElement,n=jt(e).on("dragstart.drag",cx,ax);"onselectstart"in t?n.on("selectstart.drag",cx,ax):(t.__noselect=t.style.MozUserSelect,t.style.MozUserSelect="none")}function cp(e,t){var n=e.document.documentElement,r=jt(e).on("dragstart.drag",null);t&&(r.on("click.drag",cx,ax),setTimeout(function(){r.on("click.drag",null)},0)),"onselectstart"in n?r.on("selectstart.drag",null):(n.style.MozUserSelect=n.__noselect,delete n.__noselect)}function Os(e,t,n){e.prototype=t.prototype=n,n.constructor=e}function Ca(e,t){var n=Object.create(e.prototype);for(var r in t)n[r]=t[r];return n}function mo(){}var ka=.7,Qc=1/ka,Bu="\\s*([+-]?\\d+)\\s*",lp="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",po="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",tX=/^#([0-9a-f]{3,8})$/,eX=new RegExp(`^rgb\\(${Bu},${Bu},${Bu}\\)$`),nX=new RegExp(`^rgb\\(${po},${po},${po}\\)$`),rX=new RegExp(`^rgba\\(${Bu},${Bu},${Bu},${lp}\\)$`),iX=new RegExp(`^rgba\\(${po},${po},${po},${lp}\\)$`),oX=new RegExp(`^hsl\\(${lp},${po},${po}\\)$`),sX=new RegExp(`^hsla\\(${lp},${po},${po},${lp}\\)$`),UB={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};Os(mo,Fr,{copy(e){return Object.assign(new this.constructor,this,e)},displayable(){return this.rgb().displayable()},hex:zB,formatHex:zB,formatHex8:aX,formatHsl:cX,formatRgb:qB,toString:qB});function zB(){return this.rgb().formatHex()}function aX(){return this.rgb().formatHex8()}function cX(){return WB(this).formatHsl()}function qB(){return this.rgb().formatRgb()}function Fr(e){var t,n;return e=(e+"").trim().toLowerCase(),(t=tX.exec(e))?(n=t[1].length,t=parseInt(t[1],16),n===6?jB(t):n===3?new Ye(t>>8&15|t>>4&240,t>>4&15|t&240,(t&15)<<4|t&15,1):n===8?lx(t>>24&255,t>>16&255,t>>8&255,(t&255)/255):n===4?lx(t>>12&15|t>>8&240,t>>8&15|t>>4&240,t>>4&15|t&240,((t&15)<<4|t&15)/255):null):(t=eX.exec(e))?new Ye(t[1],t[2],t[3],1):(t=nX.exec(e))?new Ye(t[1]*255/100,t[2]*255/100,t[3]*255/100,1):(t=rX.exec(e))?lx(t[1],t[2],t[3],t[4]):(t=iX.exec(e))?lx(t[1]*255/100,t[2]*255/100,t[3]*255/100,t[4]):(t=oX.exec(e))?XB(t[1],t[2]/100,t[3]/100,1):(t=sX.exec(e))?XB(t[1],t[2]/100,t[3]/100,t[4]):UB.hasOwnProperty(e)?jB(UB[e]):e==="transparent"?new Ye(NaN,NaN,NaN,0):null}function jB(e){return new Ye(e>>16&255,e>>8&255,e&255,1)}function lx(e,t,n,r){return r<=0&&(e=t=n=NaN),new Ye(e,t,n,r)}function up(e){return e instanceof mo||(e=Fr(e)),e?(e=e.rgb(),new Ye(e.r,e.g,e.b,e.opacity)):new Ye}function nn(e,t,n,r){return arguments.length===1?up(e):new Ye(e,t,n,r??1)}function Ye(e,t,n,r){this.r=+e,this.g=+t,this.b=+n,this.opacity=+r}Os(Ye,nn,Ca(mo,{brighter(e){return e=e==null?Qc:Math.pow(Qc,e),new Ye(this.r*e,this.g*e,this.b*e,this.opacity)},darker(e){return e=e==null?ka:Math.pow(ka,e),new Ye(this.r*e,this.g*e,this.b*e,this.opacity)},rgb(){return this},clamp(){return new Ye(Jc(this.r),Jc(this.g),Jc(this.b),fx(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:VB,formatHex:VB,formatHex8:lX,formatRgb:YB,toString:YB}));function VB(){return`#${Zc(this.r)}${Zc(this.g)}${Zc(this.b)}`}function lX(){return`#${Zc(this.r)}${Zc(this.g)}${Zc(this.b)}${Zc((isNaN(this.opacity)?1:this.opacity)*255)}`}function YB(){let e=fx(this.opacity);return`${e===1?"rgb(":"rgba("}${Jc(this.r)}, ${Jc(this.g)}, ${Jc(this.b)}${e===1?")":`, ${e})`}`}function fx(e){return isNaN(e)?1:Math.max(0,Math.min(1,e))}function Jc(e){return Math.max(0,Math.min(255,Math.round(e)||0))}function Zc(e){return e=Jc(e),(e<16?"0":"")+e.toString(16)}function XB(e,t,n,r){return r<=0?e=t=n=NaN:n<=0||n>=1?e=t=NaN:t<=0&&(e=NaN),new Ui(e,t,n,r)}function WB(e){if(e instanceof Ui)return new Ui(e.h,e.s,e.l,e.opacity);if(e instanceof mo||(e=Fr(e)),!e)return new Ui;if(e instanceof Ui)return e;e=e.rgb();var t=e.r/255,n=e.g/255,r=e.b/255,i=Math.min(t,n,r),o=Math.max(t,n,r),s=NaN,a=o-i,c=(o+i)/2;return a?(t===o?s=(n-r)/a+(n<r)*6:n===o?s=(r-t)/a+2:s=(t-n)/a+4,a/=c<.5?o+i:2-o-i,s*=60):a=c>0&&c<1?0:s,new Ui(s,a,c,e.opacity)}function fp(e,t,n,r){return arguments.length===1?WB(e):new Ui(e,t,n,r??1)}function Ui(e,t,n,r){this.h=+e,this.s=+t,this.l=+n,this.opacity=+r}Os(Ui,fp,Ca(mo,{brighter(e){return e=e==null?Qc:Math.pow(Qc,e),new Ui(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=e==null?ka:Math.pow(ka,e),new Ui(this.h,this.s,this.l*e,this.opacity)},rgb(){var e=this.h%360+(this.h<0)*360,t=isNaN(e)||isNaN(this.s)?0:this.s,n=this.l,r=n+(n<.5?n:1-n)*t,i=2*n-r;return new Ye(GS(e>=240?e-240:e+120,i,r),GS(e,i,r),GS(e<120?e+240:e-120,i,r),this.opacity)},clamp(){return new Ui(GB(this.h),ux(this.s),ux(this.l),fx(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(){let e=fx(this.opacity);return`${e===1?"hsl(":"hsla("}${GB(this.h)}, ${ux(this.s)*100}%, ${ux(this.l)*100}%${e===1?")":`, ${e})`}`}}));function GB(e){return e=(e||0)%360,e<0?e+360:e}function ux(e){return Math.max(0,Math.min(1,e||0))}function GS(e,t,n){return(e<60?t+(n-t)*e/60:e<180?n:e<240?t+(n-t)*(240-e)/60:t)*255}var dx=Math.PI/180,hx=180/Math.PI;var px=18,HB=.96422,ZB=1,JB=.82521,QB=4/29,Lu=6/29,KB=3*Lu*Lu,uX=Lu*Lu*Lu;function tL(e){if(e instanceof yo)return new yo(e.l,e.a,e.b,e.opacity);if(e instanceof Bs)return eL(e);e instanceof Ye||(e=up(e));var t=JS(e.r),n=JS(e.g),r=JS(e.b),i=WS((.2225045*t+.7168786*n+.0606169*r)/ZB),o,s;return t===n&&n===r?o=s=i:(o=WS((.4360747*t+.3850649*n+.1430804*r)/HB),s=WS((.0139322*t+.0971045*n+.7141733*r)/JB)),new yo(116*i-16,500*(o-i),200*(i-s),e.opacity)}function Cu(e,t,n,r){return arguments.length===1?tL(e):new yo(e,t,n,r??1)}function yo(e,t,n,r){this.l=+e,this.a=+t,this.b=+n,this.opacity=+r}Os(yo,Cu,Ca(mo,{brighter(e){return new yo(this.l+px*(e??1),this.a,this.b,this.opacity)},darker(e){return new yo(this.l-px*(e??1),this.a,this.b,this.opacity)},rgb(){var e=(this.l+16)/116,t=isNaN(this.a)?e:e+this.a/500,n=isNaN(this.b)?e:e-this.b/200;return t=HB*HS(t),e=ZB*HS(e),n=JB*HS(n),new Ye(ZS(3.1338561*t-1.6168667*e-.4906146*n),ZS(-.9787684*t+1.9161415*e+.033454*n),ZS(.0719453*t-.2289914*e+1.4052427*n),this.opacity)}}));function WS(e){return e>uX?Math.pow(e,1/3):e/KB+QB}function HS(e){return e>Lu?e*e*e:KB*(e-QB)}function ZS(e){return 255*(e<=.0031308?12.92*e:1.055*Math.pow(e,1/2.4)-.055)}function JS(e){return(e/=255)<=.04045?e/12.92:Math.pow((e+.055)/1.055,2.4)}function fX(e){if(e instanceof Bs)return new Bs(e.h,e.c,e.l,e.opacity);if(e instanceof yo||(e=tL(e)),e.a===0&&e.b===0)return new Bs(NaN,0<e.l&&e.l<100?0:NaN,e.l,e.opacity);var t=Math.atan2(e.b,e.a)*hx;return new Bs(t<0?t+360:t,Math.sqrt(e.a*e.a+e.b*e.b),e.l,e.opacity)}function dp(e,t,n,r){return arguments.length===1?fX(e):new Bs(e,t,n,r??1)}function Bs(e,t,n,r){this.h=+e,this.c=+t,this.l=+n,this.opacity=+r}function eL(e){if(isNaN(e.h))return new yo(e.l,0,0,e.opacity);var t=e.h*dx;return new yo(e.l,Math.cos(t)*e.c,Math.sin(t)*e.c,e.opacity)}Os(Bs,dp,Ca(mo,{brighter(e){return new Bs(this.h,this.c,this.l+px*(e??1),this.opacity)},darker(e){return new Bs(this.h,this.c,this.l-px*(e??1),this.opacity)},rgb(){return eL(this).rgb()}}));var oL=-.14861,QS=1.78277,KS=-.29227,mx=-.90649,hp=1.97294,nL=hp*mx,rL=hp*QS,iL=QS*KS-mx*oL;function dX(e){if(e instanceof Kc)return new Kc(e.h,e.s,e.l,e.opacity);e instanceof Ye||(e=up(e));var t=e.r/255,n=e.g/255,r=e.b/255,i=(iL*r+nL*t-rL*n)/(iL+nL-rL),o=r-i,s=(hp*(n-i)-KS*o)/mx,a=Math.sqrt(s*s+o*o)/(hp*i*(1-i)),c=a?Math.atan2(s,o)*hx-120:NaN;return new Kc(c<0?c+360:c,a,i,e.opacity)}function Zn(e,t,n,r){return arguments.length===1?dX(e):new Kc(e,t,n,r??1)}function Kc(e,t,n,r){this.h=+e,this.s=+t,this.l=+n,this.opacity=+r}Os(Kc,Zn,Ca(mo,{brighter(e){return e=e==null?Qc:Math.pow(Qc,e),new Kc(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=e==null?ka:Math.pow(ka,e),new Kc(this.h,this.s,this.l*e,this.opacity)},rgb(){var e=isNaN(this.h)?0:(this.h+120)*dx,t=+this.l,n=isNaN(this.s)?0:this.s*t*(1-t),r=Math.cos(e),i=Math.sin(e);return new Ye(255*(t+n*(oL*r+QS*i)),255*(t+n*(KS*r+mx*i)),255*(t+n*(hp*r)),this.opacity)}}));function tI(e,t,n,r,i){var o=e*e,s=o*e;return((1-3*e+3*o-s)*t+(4-6*o+3*s)*n+(1+3*e+3*o-3*s)*r+s*i)/6}function sL(e){var t=e.length-1;return function(n){var r=n<=0?n=0:n>=1?(n=1,t-1):Math.floor(n*t),i=e[r],o=e[r+1],s=r>0?e[r-1]:2*i-o,a=r<t-1?e[r+2]:2*o-i;return tI((n-r/t)*t,s,i,o,a)}}function aL(e){var t=e.length;return function(n){var r=Math.floor(((n%=1)<0?++n:n)*t),i=e[(r+t-1)%t],o=e[r%t],s=e[(r+1)%t],a=e[(r+2)%t];return tI((n-r/t)*t,i,o,s,a)}}var ku=e=>()=>e;function cL(e,t){return function(n){return e+n*t}}function hX(e,t,n){return e=Math.pow(e,n),t=Math.pow(t,n)-e,n=1/n,function(r){return Math.pow(e+r*t,n)}}function Fu(e,t){var n=t-e;return n?cL(e,n>180||n<-180?n-360*Math.round(n/360):n):ku(isNaN(e)?t:e)}function lL(e){return(e=+e)==1?Me:function(t,n){return n-t?hX(t,n,e):ku(isNaN(t)?n:t)}}function Me(e,t){var n=t-e;return n?cL(e,n):ku(isNaN(e)?t:e)}var oi=function e(t){var n=lL(t);function r(i,o){var s=n((i=nn(i)).r,(o=nn(o)).r),a=n(i.g,o.g),c=n(i.b,o.b),l=Me(i.opacity,o.opacity);return function(u){return i.r=s(u),i.g=a(u),i.b=c(u),i.opacity=l(u),i+""}}return r.gamma=e,r}(1);function uL(e){return function(t){var n=t.length,r=new Array(n),i=new Array(n),o=new Array(n),s,a;for(s=0;s<n;++s)a=nn(t[s]),r[s]=a.r||0,i[s]=a.g||0,o[s]=a.b||0;return r=e(r),i=e(i),o=e(o),a.opacity=1,function(c){return a.r=r(c),a.g=i(c),a.b=o(c),a+""}}}var eI=uL(sL),pX=uL(aL);function fL(e,t){t||(t=[]);var n=e?Math.min(t.length,e.length):0,r=t.slice(),i;return function(o){for(i=0;i<n;++i)r[i]=e[i]*(1-o)+t[i]*o;return r}}function dL(e){return ArrayBuffer.isView(e)&&!(e instanceof DataView)}function hL(e,t){var n=t?t.length:0,r=e?Math.min(n,e.length):0,i=new Array(r),o=new Array(n),s;for(s=0;s<r;++s)i[s]=Rr(e[s],t[s]);for(;s<n;++s)o[s]=t[s];return function(a){for(s=0;s<r;++s)o[s]=i[s](a);return o}}function pL(e,t){var n=new Date;return e=+e,t=+t,function(r){return n.setTime(e*(1-r)+t*r),n}}function we(e,t){return e=+e,t=+t,function(n){return e*(1-n)+t*n}}function mL(e,t){var n={},r={},i;(e===null||typeof e!="object")&&(e={}),(t===null||typeof t!="object")&&(t={});for(i in t)i in e?n[i]=Rr(e[i],t[i]):r[i]=t[i];return function(o){for(i in n)r[i]=n[i](o);return r}}var rI=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,nI=new RegExp(rI.source,"g");function mX(e){return function(){return e}}function yX(e){return function(t){return e(t)+""}}function pp(e,t){var n=rI.lastIndex=nI.lastIndex=0,r,i,o,s=-1,a=[],c=[];for(e=e+"",t=t+"";(r=rI.exec(e))&&(i=nI.exec(t));)(o=i.index)>n&&(o=t.slice(n,o),a[s]?a[s]+=o:a[++s]=o),(r=r[0])===(i=i[0])?a[s]?a[s]+=i:a[++s]=i:(a[++s]=null,c.push({i:s,x:we(r,i)})),n=nI.lastIndex;return n<t.length&&(o=t.slice(n),a[s]?a[s]+=o:a[++s]=o),a.length<2?c[0]?yX(c[0].x):mX(t):(t=c.length,function(l){for(var u=0,f;u<t;++u)a[(f=c[u]).i]=f.x(l);return a.join("")})}function Rr(e,t){var n=typeof t,r;return t==null||n==="boolean"?ku(t):(n==="number"?we:n==="string"?(r=Fr(t))?(t=r,oi):pp:t instanceof Fr?oi:t instanceof Date?pL:dL(t)?fL:Array.isArray(t)?hL:typeof t.valueOf!="function"&&typeof t.toString!="function"||isNaN(t)?mL:we)(e,t)}function tl(e,t){return e=+e,t=+t,function(n){return Math.round(e*(1-n)+t*n)}}var yL=180/Math.PI,yx={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1};function iI(e,t,n,r,i,o){var s,a,c;return(s=Math.sqrt(e*e+t*t))&&(e/=s,t/=s),(c=e*n+t*r)&&(n-=e*c,r-=t*c),(a=Math.sqrt(n*n+r*r))&&(n/=a,r/=a,c/=a),e*r<t*n&&(e=-e,t=-t,c=-c,s=-s),{translateX:i,translateY:o,rotate:Math.atan2(t,e)*yL,skewX:Math.atan(c)*yL,scaleX:s,scaleY:a}}var gx;function gL(e){let t=new(typeof DOMMatrix=="function"?DOMMatrix:WebKitCSSMatrix)(e+"");return t.isIdentity?yx:iI(t.a,t.b,t.c,t.d,t.e,t.f)}function xL(e){return e==null?yx:(gx||(gx=document.createElementNS("http://www.w3.org/2000/svg","g")),gx.setAttribute("transform",e),(e=gx.transform.baseVal.consolidate())?(e=e.matrix,iI(e.a,e.b,e.c,e.d,e.e,e.f)):yx)}function bL(e,t,n,r){function i(l){return l.length?l.pop()+" ":""}function o(l,u,f,d,h,p){if(l!==f||u!==d){var m=h.push("translate(",null,t,null,n);p.push({i:m-4,x:we(l,f)},{i:m-2,x:we(u,d)})}else(f||d)&&h.push("translate("+f+t+d+n)}function s(l,u,f,d){l!==u?(l-u>180?u+=360:u-l>180&&(l+=360),d.push({i:f.push(i(f)+"rotate(",null,r)-2,x:we(l,u)})):u&&f.push(i(f)+"rotate("+u+r)}function a(l,u,f,d){l!==u?d.push({i:f.push(i(f)+"skewX(",null,r)-2,x:we(l,u)}):u&&f.push(i(f)+"skewX("+u+r)}function c(l,u,f,d,h,p){if(l!==f||u!==d){var m=h.push(i(h)+"scale(",null,",",null,")");p.push({i:m-4,x:we(l,f)},{i:m-2,x:we(u,d)})}else(f!==1||d!==1)&&h.push(i(h)+"scale("+f+","+d+")")}return function(l,u){var f=[],d=[];return l=e(l),u=e(u),o(l.translateX,l.translateY,u.translateX,u.translateY,f,d),s(l.rotate,u.rotate,f,d),a(l.skewX,u.skewX,f,d),c(l.scaleX,l.scaleY,u.scaleX,u.scaleY,f,d),l=u=null,function(h){for(var p=-1,m=d.length,g;++p<m;)f[(g=d[p]).i]=g.x(h);return f.join("")}}}var oI=bL(gL,"px, ","px)","deg)"),sI=bL(xL,", ",")",")");var gX=1e-12;function wL(e){return((e=Math.exp(e))+1/e)/2}function xX(e){return((e=Math.exp(e))-1/e)/2}function bX(e){return((e=Math.exp(2*e))-1)/(e+1)}var aI=function e(t,n,r){function i(o,s){var a=o[0],c=o[1],l=o[2],u=s[0],f=s[1],d=s[2],h=u-a,p=f-c,m=h*h+p*p,g,y;if(m<gX)y=Math.log(d/l)/t,g=function(M){return[a+M*h,c+M*p,l*Math.exp(t*M*y)]};else{var x=Math.sqrt(m),b=(d*d-l*l+r*m)/(2*l*n*x),w=(d*d-l*l-r*m)/(2*d*n*x),_=Math.log(Math.sqrt(b*b+1)-b),v=Math.log(Math.sqrt(w*w+1)-w);y=(v-_)/t,g=function(M){var E=M*y,D=wL(_),I=l/(n*x)*(D*bX(t*E+_)-xX(_));return[a+I*h,c+I*p,l*D/wL(t*E+_)]}}return g.duration=y*1e3*t/Math.SQRT2,g}return i.rho=function(o){var s=Math.max(.001,+o),a=s*s,c=a*a;return e(s,a,c)},i}(Math.SQRT2,2,4);function vL(e){return function(t,n){var r=e((t=fp(t)).h,(n=fp(n)).h),i=Me(t.s,n.s),o=Me(t.l,n.l),s=Me(t.opacity,n.opacity);return function(a){return t.h=r(a),t.s=i(a),t.l=o(a),t.opacity=s(a),t+""}}}var cI=vL(Fu),wX=vL(Me);function xx(e,t){var n=Me((e=Cu(e)).l,(t=Cu(t)).l),r=Me(e.a,t.a),i=Me(e.b,t.b),o=Me(e.opacity,t.opacity);return function(s){return e.l=n(s),e.a=r(s),e.b=i(s),e.opacity=o(s),e+""}}function _L(e){return function(t,n){var r=e((t=dp(t)).h,(n=dp(n)).h),i=Me(t.c,n.c),o=Me(t.l,n.l),s=Me(t.opacity,n.opacity);return function(a){return t.h=r(a),t.c=i(a),t.l=o(a),t.opacity=s(a),t+""}}}var lI=_L(Fu),vX=_L(Me);function SL(e){return function t(n){n=+n;function r(i,o){var s=e((i=Zn(i)).h,(o=Zn(o)).h),a=Me(i.s,o.s),c=Me(i.l,o.l),l=Me(i.opacity,o.opacity);return function(u){return i.h=s(u),i.s=a(u),i.l=c(Math.pow(u,n)),i.opacity=l(u),i+""}}return r.gamma=t,r}(1)}var _X=SL(Fu),Ru=SL(Me);function go(e,t){t===void 0&&(t=e,e=Rr);for(var n=0,r=t.length-1,i=t[0],o=new Array(r<0?0:r);n<r;)o[n]=e(i,i=t[++n]);return function(s){var a=Math.max(0,Math.min(r-1,Math.floor(s*=r)));return o[a](s-a)}}function Cn(e,t){for(var n=new Array(t),r=0;r<t;++r)n[r]=e(r/(t-1));return n}var $u=0,yp=0,mp=0,ML=1e3,bx,gp,wx=0,el=0,vx=0,xp=typeof performance=="object"&&performance.now?performance:Date,AL=typeof window=="object"&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(e){setTimeout(e,17)};function wp(){return el||(AL(SX),el=xp.now()+vx)}function SX(){el=0}function bp(){this._call=this._time=this._next=null}bp.prototype=_x.prototype={constructor:bp,restart:function(e,t,n){if(typeof e!="function")throw new TypeError("callback is not a function");n=(n==null?wp():+n)+(t==null?0:+t),!this._next&&gp!==this&&(gp?gp._next=this:bx=this,gp=this),this._call=e,this._time=n,uI()},stop:function(){this._call&&(this._call=null,this._time=1/0,uI())}};function _x(e,t,n){var r=new bp;return r.restart(e,t,n),r}function TL(){wp(),++$u;for(var e=bx,t;e;)(t=el-e._time)>=0&&e._call.call(void 0,t),e=e._next;--$u}function IL(){el=(wx=xp.now())+vx,$u=yp=0;try{TL()}finally{$u=0,MX(),el=0}}function IX(){var e=xp.now(),t=e-wx;t>ML&&(vx-=t,wx=e)}function MX(){for(var e,t=bx,n,r=1/0;t;)t._call?(r>t._time&&(r=t._time),e=t,t=t._next):(n=t._next,t._next=null,t=e?e._next=n:bx=n);gp=e,uI(r)}function uI(e){if(!$u){yp&&(yp=clearTimeout(yp));var t=e-el;t>24?(e<1/0&&(yp=setTimeout(IL,e-xp.now()-vx)),mp&&(mp=clearInterval(mp))):(mp||(wx=xp.now(),mp=setInterval(IX,ML)),$u=1,AL(IL))}}function Sx(e,t,n){var r=new bp;return t=t==null?0:+t,r.restart(i=>{r.stop(),e(i+t)},t,n),r}var AX=Wc("start","end","cancel","interrupt"),TX=[],DL=0,EL=1,Mx=2,Ix=3,NL=4,Ax=5,vp=6;function Fa(e,t,n,r,i,o){var s=e.__transition;if(!s)e.__transition={};else if(n in s)return;EX(e,n,{name:t,index:r,group:i,on:AX,tween:TX,time:o.time,delay:o.delay,duration:o.duration,ease:o.ease,timer:null,state:DL})}function _p(e,t){var n=rn(e,t);if(n.state>DL)throw new Error("too late; already scheduled");return n}function In(e,t){var n=rn(e,t);if(n.state>Ix)throw new Error("too late; already running");return n}function rn(e,t){var n=e.__transition;if(!n||!(n=n[t]))throw new Error("transition not found");return n}function EX(e,t,n){var r=e.__transition,i;r[t]=n,n.timer=_x(o,0,n.time);function o(l){n.state=EL,n.timer.restart(s,n.delay,n.time),n.delay<=l&&s(l-n.delay)}function s(l){var u,f,d,h;if(n.state!==EL)return c();for(u in r)if(h=r[u],h.name===n.name){if(h.state===Ix)return Sx(s);h.state===NL?(h.state=vp,h.timer.stop(),h.on.call("interrupt",e,e.__data__,h.index,h.group),delete r[u]):+u<t&&(h.state=vp,h.timer.stop(),h.on.call("cancel",e,e.__data__,h.index,h.group),delete r[u])}if(Sx(function(){n.state===Ix&&(n.state=NL,n.timer.restart(a,n.delay,n.time),a(l))}),n.state=Mx,n.on.call("start",e,e.__data__,n.index,n.group),n.state===Mx){for(n.state=Ix,i=new Array(d=n.tween.length),u=0,f=-1;u<d;++u)(h=n.tween[u].value.call(e,e.__data__,n.index,n.group))&&(i[++f]=h);i.length=f+1}}function a(l){for(var u=l<n.duration?n.ease.call(null,l/n.duration):(n.timer.restart(c),n.state=Ax,1),f=-1,d=i.length;++f<d;)i[f].call(e,u);n.state===Ax&&(n.on.call("end",e,e.__data__,n.index,n.group),c())}function c(){n.state=vp,n.timer.stop(),delete r[t];for(var l in r)return;delete e.__transition}}function xo(e,t){var n=e.__transition,r,i,o=!0,s;if(n){t=t==null?null:t+"";for(s in n){if((r=n[s]).name!==t){o=!1;continue}i=r.state>Mx&&r.state<Ax,r.state=vp,r.timer.stop(),r.on.call(i?"interrupt":"cancel",e,e.__data__,r.index,r.group),delete n[s]}o&&delete e.__transition}}function OL(e){return this.each(function(){xo(this,e)})}function NX(e,t){var n,r;return function(){var i=In(this,e),o=i.tween;if(o!==n){r=n=o;for(var s=0,a=r.length;s<a;++s)if(r[s].name===t){r=r.slice(),r.splice(s,1);break}}i.tween=r}}function DX(e,t,n){var r,i;if(typeof n!="function")throw new Error;return function(){var o=In(this,e),s=o.tween;if(s!==r){i=(r=s).slice();for(var a={name:t,value:n},c=0,l=i.length;c<l;++c)if(i[c].name===t){i[c]=a;break}c===l&&i.push(a)}o.tween=i}}function BL(e,t){var n=this._id;if(e+="",arguments.length<2){for(var r=rn(this.node(),n).tween,i=0,o=r.length,s;i<o;++i)if((s=r[i]).name===e)return s.value;return null}return this.each((t==null?NX:DX)(n,e,t))}function Pu(e,t,n){var r=e._id;return e.each(function(){var i=In(this,r);(i.value||(i.value={}))[t]=n.apply(this,arguments)}),function(i){return rn(i,r).value[t]}}function Tx(e,t){var n;return(typeof t=="number"?we:t instanceof Fr?oi:(n=Fr(t))?(t=n,oi):pp)(e,t)}function OX(e){return function(){this.removeAttribute(e)}}function BX(e){return function(){this.removeAttributeNS(e.space,e.local)}}function LX(e,t,n){var r,i=n+"",o;return function(){var s=this.getAttribute(e);return s===i?null:s===r?o:o=t(r=s,n)}}function CX(e,t,n){var r,i=n+"",o;return function(){var s=this.getAttributeNS(e.space,e.local);return s===i?null:s===r?o:o=t(r=s,n)}}function kX(e,t,n){var r,i,o;return function(){var s,a=n(this),c;return a==null?void this.removeAttribute(e):(s=this.getAttribute(e),c=a+"",s===c?null:s===r&&c===i?o:(i=c,o=t(r=s,a)))}}function FX(e,t,n){var r,i,o;return function(){var s,a=n(this),c;return a==null?void this.removeAttributeNS(e.space,e.local):(s=this.getAttributeNS(e.space,e.local),c=a+"",s===c?null:s===r&&c===i?o:(i=c,o=t(r=s,a)))}}function LL(e,t){var n=Es(e),r=n==="transform"?sI:Tx;return this.attrTween(e,typeof t=="function"?(n.local?FX:kX)(n,r,Pu(this,"attr."+e,t)):t==null?(n.local?BX:OX)(n):(n.local?CX:LX)(n,r,t))}function RX(e,t){return function(n){this.setAttribute(e,t.call(this,n))}}function $X(e,t){return function(n){this.setAttributeNS(e.space,e.local,t.call(this,n))}}function PX(e,t){var n,r;function i(){var o=t.apply(this,arguments);return o!==r&&(n=(r=o)&&$X(e,o)),n}return i._value=t,i}function UX(e,t){var n,r;function i(){var o=t.apply(this,arguments);return o!==r&&(n=(r=o)&&RX(e,o)),n}return i._value=t,i}function CL(e,t){var n="attr."+e;if(arguments.length<2)return(n=this.tween(n))&&n._value;if(t==null)return this.tween(n,null);if(typeof t!="function")throw new Error;var r=Es(e);return this.tween(n,(r.local?PX:UX)(r,t))}function zX(e,t){return function(){_p(this,e).delay=+t.apply(this,arguments)}}function qX(e,t){return t=+t,function(){_p(this,e).delay=t}}function kL(e){var t=this._id;return arguments.length?this.each((typeof e=="function"?zX:qX)(t,e)):rn(this.node(),t).delay}function jX(e,t){return function(){In(this,e).duration=+t.apply(this,arguments)}}function VX(e,t){return t=+t,function(){In(this,e).duration=t}}function FL(e){var t=this._id;return arguments.length?this.each((typeof e=="function"?jX:VX)(t,e)):rn(this.node(),t).duration}function YX(e,t){if(typeof t!="function")throw new Error;return function(){In(this,e).ease=t}}function RL(e){var t=this._id;return arguments.length?this.each(YX(t,e)):rn(this.node(),t).ease}function XX(e,t){return function(){var n=t.apply(this,arguments);if(typeof n!="function")throw new Error;In(this,e).ease=n}}function $L(e){if(typeof e!="function")throw new Error;return this.each(XX(this._id,e))}function PL(e){typeof e!="function"&&(e=op(e));for(var t=this._groups,n=t.length,r=new Array(n),i=0;i<n;++i)for(var o=t[i],s=o.length,a=r[i]=[],c,l=0;l<s;++l)(c=o[l])&&e.call(c,c.__data__,l,o)&&a.push(c);return new Jn(r,this._parents,this._name,this._id)}function UL(e){if(e._id!==this._id)throw new Error;for(var t=this._groups,n=e._groups,r=t.length,i=n.length,o=Math.min(r,i),s=new Array(r),a=0;a<o;++a)for(var c=t[a],l=n[a],u=c.length,f=s[a]=new Array(u),d,h=0;h<u;++h)(d=c[h]||l[h])&&(f[h]=d);for(;a<r;++a)s[a]=t[a];return new Jn(s,this._parents,this._name,this._id)}function GX(e){return(e+"").trim().split(/^|\s+/).every(function(t){var n=t.indexOf(".");return n>=0&&(t=t.slice(0,n)),!t||t==="start"})}function WX(e,t,n){var r,i,o=GX(t)?_p:In;return function(){var s=o(this,e),a=s.on;a!==r&&(i=(r=a).copy()).on(t,n),s.on=i}}function zL(e,t){var n=this._id;return arguments.length<2?rn(this.node(),n).on.on(e):this.each(WX(n,e,t))}function HX(e){return function(){var t=this.parentNode;for(var n in this.__transition)if(+n!==e)return;t&&t.removeChild(this)}}function qL(){return this.on("end.remove",HX(this._id))}function jL(e){var t=this._name,n=this._id;typeof e!="function"&&(e=Hc(e));for(var r=this._groups,i=r.length,o=new Array(i),s=0;s<i;++s)for(var a=r[s],c=a.length,l=o[s]=new Array(c),u,f,d=0;d<c;++d)(u=a[d])&&(f=e.call(u,u.__data__,d,a))&&("__data__"in u&&(f.__data__=u.__data__),l[d]=f,Fa(l[d],t,n,d,l,rn(u,n)));return new Jn(o,this._parents,t,n)}function VL(e){var t=this._name,n=this._id;typeof e!="function"&&(e=ip(e));for(var r=this._groups,i=r.length,o=[],s=[],a=0;a<i;++a)for(var c=r[a],l=c.length,u,f=0;f<l;++f)if(u=c[f]){for(var d=e.call(u,u.__data__,f,c),h,p=rn(u,n),m=0,g=d.length;m<g;++m)(h=d[m])&&Fa(h,t,n,m,d,p);o.push(d),s.push(u)}return new Jn(o,s,t,n)}var ZX=Ds.prototype.constructor;function YL(){return new ZX(this._groups,this._parents)}function JX(e,t){var n,r,i;return function(){var o=La(this,e),s=(this.style.removeProperty(e),La(this,e));return o===s?null:o===n&&s===r?i:i=t(n=o,r=s)}}function XL(e){return function(){this.style.removeProperty(e)}}function QX(e,t,n){var r,i=n+"",o;return function(){var s=La(this,e);return s===i?null:s===r?o:o=t(r=s,n)}}function KX(e,t,n){var r,i,o;return function(){var s=La(this,e),a=n(this),c=a+"";return a==null&&(c=a=(this.style.removeProperty(e),La(this,e))),s===c?null:s===r&&c===i?o:(i=c,o=t(r=s,a))}}function tG(e,t){var n,r,i,o="style."+t,s="end."+o,a;return function(){var c=In(this,e),l=c.on,u=c.value[o]==null?a||(a=XL(t)):void 0;(l!==n||i!==u)&&(r=(n=l).copy()).on(s,i=u),c.on=r}}function GL(e,t,n){var r=(e+="")=="transform"?oI:Tx;return t==null?this.styleTween(e,JX(e,r)).on("end.style."+e,XL(e)):typeof t=="function"?this.styleTween(e,KX(e,r,Pu(this,"style."+e,t))).each(tG(this._id,e)):this.styleTween(e,QX(e,r,t),n).on("end.style."+e,null)}function eG(e,t,n){return function(r){this.style.setProperty(e,t.call(this,r),n)}}function nG(e,t,n){var r,i;function o(){var s=t.apply(this,arguments);return s!==i&&(r=(i=s)&&eG(e,s,n)),r}return o._value=t,o}function WL(e,t,n){var r="style."+(e+="");if(arguments.length<2)return(r=this.tween(r))&&r._value;if(t==null)return this.tween(r,null);if(typeof t!="function")throw new Error;return this.tween(r,nG(e,t,n??""))}function rG(e){return function(){this.textContent=e}}function iG(e){return function(){var t=e(this);this.textContent=t??""}}function HL(e){return this.tween("text",typeof e=="function"?iG(Pu(this,"text",e)):rG(e==null?"":e+""))}function oG(e){return function(t){this.textContent=e.call(this,t)}}function sG(e){var t,n;function r(){var i=e.apply(this,arguments);return i!==n&&(t=(n=i)&&oG(i)),t}return r._value=e,r}function ZL(e){var t="text";if(arguments.length<1)return(t=this.tween(t))&&t._value;if(e==null)return this.tween(t,null);if(typeof e!="function")throw new Error;return this.tween(t,sG(e))}function JL(){for(var e=this._name,t=this._id,n=Ex(),r=this._groups,i=r.length,o=0;o<i;++o)for(var s=r[o],a=s.length,c,l=0;l<a;++l)if(c=s[l]){var u=rn(c,t);Fa(c,e,n,l,s,{time:u.time+u.delay+u.duration,delay:0,duration:u.duration,ease:u.ease})}return new Jn(r,this._parents,e,n)}function QL(){var e,t,n=this,r=n._id,i=n.size();return new Promise(function(o,s){var a={value:s},c={value:function(){--i===0&&o()}};n.each(function(){var l=In(this,r),u=l.on;u!==e&&(t=(e=u).copy(),t._.cancel.push(a),t._.interrupt.push(a),t._.end.push(c)),l.on=t}),i===0&&o()})}var aG=0;function Jn(e,t,n,r){this._groups=e,this._parents=t,this._name=n,this._id=r}function KL(e){return Ds().transition(e)}function Ex(){return++aG}var Ls=Ds.prototype;Jn.prototype=KL.prototype={constructor:Jn,select:jL,selectAll:VL,selectChild:Ls.selectChild,selectChildren:Ls.selectChildren,filter:PL,merge:UL,selection:YL,transition:JL,call:Ls.call,nodes:Ls.nodes,node:Ls.node,size:Ls.size,empty:Ls.empty,each:Ls.each,on:zL,attr:LL,attrTween:CL,style:GL,styleTween:WL,text:HL,textTween:ZL,remove:qL,tween:BL,delay:kL,duration:FL,ease:RL,easeVarying:$L,end:QL,[Symbol.iterator]:Ls[Symbol.iterator]};function Nx(e){return((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2}var cG={time:null,delay:0,duration:250,ease:Nx};function lG(e,t){for(var n;!(n=e.__transition)||!(n=n[t]);)if(!(e=e.parentNode))throw new Error(`transition ${t} not found`);return n}function tC(e){var t,n;e instanceof Jn?(t=e._id,e=e._name):(t=Ex(),(n=cG).time=wp(),e=e==null?null:e+"");for(var r=this._groups,i=r.length,o=0;o<i;++o)for(var s=r[o],a=s.length,c,l=0;l<a;++l)(c=s[l])&&Fa(c,e,t,l,s,n||lG(c,t));return new Jn(r,this._parents,e,t)}Ds.prototype.interrupt=OL;Ds.prototype.transition=tC;var Dx=e=>()=>e;function fI(e,{sourceEvent:t,target:n,selection:r,mode:i,dispatch:o}){Object.defineProperties(this,{type:{value:e,enumerable:!0,configurable:!0},sourceEvent:{value:t,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 eC(e){e.stopImmediatePropagation()}function Ox(e){e.preventDefault(),e.stopImmediatePropagation()}var nC={name:"drag"},dI={name:"space"},Uu={name:"handle"},zu={name:"center"},{abs:rC,max:kn,min:Fn}=Math;function iC(e){return[+e[0],+e[1]]}function pI(e){return[iC(e[0]),iC(e[1])]}var Bx={name:"x",handles:["w","e"].map(Sp),input:function(e,t){return e==null?null:[[+e[0],t[0][1]],[+e[1],t[1][1]]]},output:function(e){return e&&[e[0][0],e[1][0]]}},Lx={name:"y",handles:["n","s"].map(Sp),input:function(e,t){return e==null?null:[[t[0][0],+e[0]],[t[1][0],+e[1]]]},output:function(e){return e&&[e[0][1],e[1][1]]}},uG={name:"xy",handles:["n","w","e","s","nw","ne","sw","se"].map(Sp),input:function(e){return e==null?null:pI(e)},output:function(e){return e}},Cs={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"},oC={e:"w",w:"e",nw:"ne",ne:"nw",se:"sw",sw:"se"},sC={n:"s",s:"n",nw:"sw",ne:"se",se:"ne",sw:"nw"},fG={overlay:1,selection:1,n:null,e:1,s:null,w:-1,nw:-1,ne:1,se:1,sw:-1},dG={overlay:1,selection:1,n:-1,e:null,s:1,w:null,nw:-1,ne:-1,se:1,sw:1};function Sp(e){return{type:e}}function hG(e){return!e.ctrlKey&&!e.button}function pG(){var e=this.ownerSVGElement||this;return e.hasAttribute("viewBox")?(e=e.viewBox.baseVal,[[e.x,e.y],[e.x+e.width,e.y+e.height]]):[[0,0],[e.width.baseVal.value,e.height.baseVal.value]]}function mG(){return navigator.maxTouchPoints||"ontouchstart"in this}function hI(e){for(;!e.__brush;)if(!(e=e.parentNode))return;return e.__brush}function yG(e){return e[0][0]===e[1][0]||e[0][1]===e[1][1]}function mI(){return xI(Bx)}function yI(){return xI(Lx)}function gI(){return xI(uG)}function xI(e){var t=pG,n=hG,r=mG,i=!0,o=Wc("start","brush","end"),s=6,a;function c(g){var y=g.property("__brush",m).selectAll(".overlay").data([Sp("overlay")]);y.enter().append("rect").attr("class","overlay").attr("pointer-events","all").attr("cursor",Cs.overlay).merge(y).each(function(){var b=hI(this).extent;jt(this).attr("x",b[0][0]).attr("y",b[0][1]).attr("width",b[1][0]-b[0][0]).attr("height",b[1][1]-b[0][1])}),g.selectAll(".selection").data([Sp("selection")]).enter().append("rect").attr("class","selection").attr("cursor",Cs.selection).attr("fill","#777").attr("fill-opacity",.3).attr("stroke","#fff").attr("shape-rendering","crispEdges");var x=g.selectAll(".handle").data(e.handles,function(b){return b.type});x.exit().remove(),x.enter().append("rect").attr("class",function(b){return"handle handle--"+b.type}).attr("cursor",function(b){return Cs[b.type]}),g.each(l).attr("fill","none").attr("pointer-events","all").on("mousedown.brush",d).filter(r).on("touchstart.brush",d).on("touchmove.brush",h).on("touchend.brush touchcancel.brush",p).style("touch-action","none").style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}c.move=function(g,y,x){g.tween?g.on("start.brush",function(b){u(this,arguments).beforestart().start(b)}).on("interrupt.brush end.brush",function(b){u(this,arguments).end(b)}).tween("brush",function(){var b=this,w=b.__brush,_=u(b,arguments),v=w.selection,M=e.input(typeof y=="function"?y.apply(this,arguments):y,w.extent),E=Rr(v,M);function D(I){w.selection=I===1&&M===null?null:E(I),l.call(b),_.brush()}return v!==null&&M!==null?D:D(1)}):g.each(function(){var b=this,w=arguments,_=b.__brush,v=e.input(typeof y=="function"?y.apply(b,w):y,_.extent),M=u(b,w).beforestart();xo(b),_.selection=v===null?null:v,l.call(b),M.start(x).brush(x).end(x)})},c.clear=function(g,y){c.move(g,null,y)};function l(){var g=jt(this),y=hI(this).selection;y?(g.selectAll(".selection").style("display",null).attr("x",y[0][0]).attr("y",y[0][1]).attr("width",y[1][0]-y[0][0]).attr("height",y[1][1]-y[0][1]),g.selectAll(".handle").style("display",null).attr("x",function(x){return x.type[x.type.length-1]==="e"?y[1][0]-s/2:y[0][0]-s/2}).attr("y",function(x){return x.type[0]==="s"?y[1][1]-s/2:y[0][1]-s/2}).attr("width",function(x){return x.type==="n"||x.type==="s"?y[1][0]-y[0][0]+s:s}).attr("height",function(x){return x.type==="e"||x.type==="w"?y[1][1]-y[0][1]+s:s})):g.selectAll(".selection,.handle").style("display","none").attr("x",null).attr("y",null).attr("width",null).attr("height",null)}function u(g,y,x){var b=g.__brush.emitter;return b&&(!x||!b.clean)?b:new f(g,y,x)}function f(g,y,x){this.that=g,this.args=y,this.state=g.__brush,this.active=0,this.clean=x}f.prototype={beforestart:function(){return++this.active===1&&(this.state.emitter=this,this.starting=!0),this},start:function(g,y){return this.starting?(this.starting=!1,this.emit("start",g,y)):this.emit("brush",g),this},brush:function(g,y){return this.emit("brush",g,y),this},end:function(g,y){return--this.active===0&&(delete this.state.emitter,this.emit("end",g,y)),this},emit:function(g,y,x){var b=jt(this.that).datum();o.call(g,this.that,new fI(g,{sourceEvent:y,target:c,selection:e.output(this.state.selection),mode:x,dispatch:o}),b)}};function d(g){if(a&&!g.touches||!n.apply(this,arguments))return;var y=this,x=g.target.__data__.type,b=(i&&g.metaKey?x="overlay":x)==="selection"?nC:i&&g.altKey?zu:Uu,w=e===Lx?null:fG[x],_=e===Bx?null:dG[x],v=hI(y),M=v.extent,E=v.selection,D=M[0][0],I,T,O=M[0][1],L,S,A=M[1][0],N,k,R=M[1][1],F,$,P=0,U=0,W,tt=w&&_&&i&&g.shiftKey,nt,st,Y=Array.from(g.touches||[g],et=>{let oe=et.identifier;return et=Ln(et,y),et.point0=et.slice(),et.identifier=oe,et});xo(y);var rt=u(y,arguments,!0).beforestart();if(x==="overlay"){E&&(W=!0);let et=[Y[0],Y[1]||Y[0]];v.selection=E=[[I=e===Lx?D:Fn(et[0][0],et[1][0]),L=e===Bx?O:Fn(et[0][1],et[1][1])],[N=e===Lx?A:kn(et[0][0],et[1][0]),F=e===Bx?R:kn(et[0][1],et[1][1])]],Y.length>1&&kt(g)}else I=E[0][0],L=E[0][1],N=E[1][0],F=E[1][1];T=I,S=L,k=N,$=F;var q=jt(y).attr("pointer-events","none"),H=q.selectAll(".overlay").attr("cursor",Cs[x]);if(g.touches)rt.moved=z,rt.ended=dt;else{var ot=jt(g.view).on("mousemove.brush",z,!0).on("mouseup.brush",dt,!0);i&&ot.on("keydown.brush",Wt,!0).on("keyup.brush",Ht,!0),ap(g.view)}l.call(y),rt.start(g,b.name);function z(et){for(let oe of et.changedTouches||[et])for(let vr of Y)vr.identifier===oe.identifier&&(vr.cur=Ln(oe,y));if(tt&&!nt&&!st&&Y.length===1){let oe=Y[0];rC(oe.cur[0]-oe[0])>rC(oe.cur[1]-oe[1])?st=!0:nt=!0}for(let oe of Y)oe.cur&&(oe[0]=oe.cur[0],oe[1]=oe.cur[1]);W=!0,Ox(et),kt(et)}function kt(et){let oe=Y[0],vr=oe.point0;var Wi;switch(P=oe[0]-vr[0],U=oe[1]-vr[1],b){case dI:case nC:{w&&(P=kn(D-I,Fn(A-N,P)),T=I+P,k=N+P),_&&(U=kn(O-L,Fn(R-F,U)),S=L+U,$=F+U);break}case Uu:{Y[1]?(w&&(T=kn(D,Fn(A,Y[0][0])),k=kn(D,Fn(A,Y[1][0])),w=1),_&&(S=kn(O,Fn(R,Y[0][1])),$=kn(O,Fn(R,Y[1][1])),_=1)):(w<0?(P=kn(D-I,Fn(A-I,P)),T=I+P,k=N):w>0&&(P=kn(D-N,Fn(A-N,P)),T=I,k=N+P),_<0?(U=kn(O-L,Fn(R-L,U)),S=L+U,$=F):_>0&&(U=kn(O-F,Fn(R-F,U)),S=L,$=F+U));break}case zu:{w&&(T=kn(D,Fn(A,I-P*w)),k=kn(D,Fn(A,N+P*w))),_&&(S=kn(O,Fn(R,L-U*_)),$=kn(O,Fn(R,F+U*_)));break}}k<T&&(w*=-1,Wi=I,I=N,N=Wi,Wi=T,T=k,k=Wi,x in oC&&H.attr("cursor",Cs[x=oC[x]])),$<S&&(_*=-1,Wi=L,L=F,F=Wi,Wi=S,S=$,$=Wi,x in sC&&H.attr("cursor",Cs[x=sC[x]])),v.selection&&(E=v.selection),nt&&(T=E[0][0],k=E[1][0]),st&&(S=E[0][1],$=E[1][1]),(E[0][0]!==T||E[0][1]!==S||E[1][0]!==k||E[1][1]!==$)&&(v.selection=[[T,S],[k,$]],l.call(y),rt.brush(et,b.name))}function dt(et){if(eC(et),et.touches){if(et.touches.length)return;a&&clearTimeout(a),a=setTimeout(function(){a=null},500)}else cp(et.view,W),ot.on("keydown.brush keyup.brush mousemove.brush mouseup.brush",null);q.attr("pointer-events","all"),H.attr("cursor",Cs.overlay),v.selection&&(E=v.selection),yG(E)&&(v.selection=null,l.call(y)),rt.end(et,b.name)}function Wt(et){switch(et.keyCode){case 16:{tt=w&&_;break}case 18:{b===Uu&&(w&&(N=k-P*w,I=T+P*w),_&&(F=$-U*_,L=S+U*_),b=zu,kt(et));break}case 32:{(b===Uu||b===zu)&&(w<0?N=k-P:w>0&&(I=T-P),_<0?F=$-U:_>0&&(L=S-U),b=dI,H.attr("cursor",Cs.selection),kt(et));break}default:return}Ox(et)}function Ht(et){switch(et.keyCode){case 16:{tt&&(nt=st=tt=!1,kt(et));break}case 18:{b===zu&&(w<0?N=k:w>0&&(I=T),_<0?F=$:_>0&&(L=S),b=Uu,kt(et));break}case 32:{b===dI&&(et.altKey?(w&&(N=k-P*w,I=T+P*w),_&&(F=$-U*_,L=S+U*_),b=zu):(w<0?N=k:w>0&&(I=T),_<0?F=$:_>0&&(L=S),b=Uu),H.attr("cursor",Cs[x]),kt(et));break}default:return}Ox(et)}}function h(g){u(this,arguments).moved(g)}function p(g){u(this,arguments).ended(g)}function m(){var g=this.__brush||{selection:null};return g.extent=pI(t.apply(this,arguments)),g.dim=e,g}return c.extent=function(g){return arguments.length?(t=typeof g=="function"?g:Dx(pI(g)),c):t},c.filter=function(g){return arguments.length?(n=typeof g=="function"?g:Dx(!!g),c):n},c.touchable=function(g){return arguments.length?(r=typeof g=="function"?g:Dx(!!g),c):r},c.handleSize=function(g){return arguments.length?(s=+g,c):s},c.keyModifiers=function(g){return arguments.length?(i=!!g,c):i},c.on=function(){var g=o.on.apply(o,arguments);return g===o?c:g},c}var bI=Math.PI,wI=2*bI,nl=1e-6,gG=wI-nl;function aC(e){this._+=e[0];for(let t=1,n=e.length;t<n;++t)this._+=arguments[t]+e[t]}function xG(e){let t=Math.floor(e);if(!(t>=0))throw new Error(`invalid digits: ${e}`);if(t>15)return aC;let n=10**t;return function(r){this._+=r[0];for(let i=1,o=r.length;i<o;++i)this._+=Math.round(arguments[i]*n)/n+r[i]}}var Ra=class{constructor(t){this._x0=this._y0=this._x1=this._y1=null,this._="",this._append=t==null?aC:xG(t)}moveTo(t,n){this._append`M${this._x0=this._x1=+t},${this._y0=this._y1=+n}`}closePath(){this._x1!==null&&(this._x1=this._x0,this._y1=this._y0,this._append`Z`)}lineTo(t,n){this._append`L${this._x1=+t},${this._y1=+n}`}quadraticCurveTo(t,n,r,i){this._append`Q${+t},${+n},${this._x1=+r},${this._y1=+i}`}bezierCurveTo(t,n,r,i,o,s){this._append`C${+t},${+n},${+r},${+i},${this._x1=+o},${this._y1=+s}`}arcTo(t,n,r,i,o){if(t=+t,n=+n,r=+r,i=+i,o=+o,o<0)throw new Error(`negative radius: ${o}`);let s=this._x1,a=this._y1,c=r-t,l=i-n,u=s-t,f=a-n,d=u*u+f*f;if(this._x1===null)this._append`M${this._x1=t},${this._y1=n}`;else if(d>nl)if(!(Math.abs(f*c-l*u)>nl)||!o)this._append`L${this._x1=t},${this._y1=n}`;else{let h=r-s,p=i-a,m=c*c+l*l,g=h*h+p*p,y=Math.sqrt(m),x=Math.sqrt(d),b=o*Math.tan((bI-Math.acos((m+d-g)/(2*y*x)))/2),w=b/x,_=b/y;Math.abs(w-1)>nl&&this._append`L${t+w*u},${n+w*f}`,this._append`A${o},${o},0,0,${+(f*h>u*p)},${this._x1=t+_*c},${this._y1=n+_*l}`}}arc(t,n,r,i,o,s){if(t=+t,n=+n,r=+r,s=!!s,r<0)throw new Error(`negative radius: ${r}`);let a=r*Math.cos(i),c=r*Math.sin(i),l=t+a,u=n+c,f=1^s,d=s?i-o:o-i;this._x1===null?this._append`M${l},${u}`:(Math.abs(this._x1-l)>nl||Math.abs(this._y1-u)>nl)&&this._append`L${l},${u}`,r&&(d<0&&(d=d%wI+wI),d>gG?this._append`A${r},${r},0,1,${f},${t-a},${n-c}A${r},${r},0,1,${f},${this._x1=l},${this._y1=u}`:d>nl&&this._append`A${r},${r},0,${+(d>=bI)},${f},${this._x1=t+r*Math.cos(o)},${this._y1=n+r*Math.sin(o)}`)}rect(t,n,r,i){this._append`M${this._x0=this._x1=+t},${this._y0=this._y1=+n}h${r=+r}v${+i}h${-r}Z`}toString(){return this._}};function cC(){return new Ra}cC.prototype=Ra.prototype;function Qn(e=3){return new Ra(+e)}var bG=Array.prototype,Cx=bG.slice;function lC(e,t){return e-t}function uC(e){for(var t=0,n=e.length,r=e[n-1][1]*e[0][0]-e[n-1][0]*e[0][1];++t<n;)r+=e[t-1][1]*e[t][0]-e[t-1][0]*e[t][1];return r}var bo=e=>()=>e;function fC(e,t){for(var n=-1,r=t.length,i;++n<r;)if(i=wG(e,t[n]))return i;return 0}function wG(e,t){for(var n=t[0],r=t[1],i=-1,o=0,s=e.length,a=s-1;o<s;a=o++){var c=e[o],l=c[0],u=c[1],f=e[a],d=f[0],h=f[1];if(vG(c,f,t))return 0;u>r!=h>r&&n<(d-l)*(r-u)/(h-u)+l&&(i=-i)}return i}function vG(e,t,n){var r;return _G(e,t,n)&&SG(e[r=+(e[0]===t[0])],n[r],t[r])}function _G(e,t,n){return(t[0]-e[0])*(n[1]-e[1])===(n[0]-e[0])*(t[1]-e[1])}function SG(e,t,n){return e<=t&&t<=n||n<=t&&t<=e}function dC(){}var ks=[[],[[[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 $a(){var e=1,t=1,n=Oa,r=c;function i(l){var u=n(l);if(Array.isArray(u))u=u.slice().sort(lC);else{let f=ae(l,IG);for(u=_n(...Nu(f[0],f[1],u),u);u[u.length-1]>=f[1];)u.pop();for(;u[1]<f[0];)u.shift()}return u.map(f=>o(l,f))}function o(l,u){let f=u==null?NaN:+u;if(isNaN(f))throw new Error(`invalid value: ${u}`);var d=[],h=[];return s(l,f,function(p){r(p,l,f),uC(p)>0?d.push([p]):h.push(p)}),h.forEach(function(p){for(var m=0,g=d.length,y;m<g;++m)if(fC((y=d[m])[0],p)!==-1){y.push(p);return}}),{type:"MultiPolygon",value:u,coordinates:d}}function s(l,u,f){var d=new Array,h=new Array,p,m,g,y,x,b;for(p=m=-1,y=rl(l[0],u),ks[y<<1].forEach(w);++p<e-1;)g=y,y=rl(l[p+1],u),ks[g|y<<1].forEach(w);for(ks[y<<0].forEach(w);++m<t-1;){for(p=-1,y=rl(l[m*e+e],u),x=rl(l[m*e],u),ks[y<<1|x<<2].forEach(w);++p<e-1;)g=y,y=rl(l[m*e+e+p+1],u),b=x,x=rl(l[m*e+p+1],u),ks[g|y<<1|x<<2|b<<3].forEach(w);ks[y|x<<3].forEach(w)}for(p=-1,x=l[m*e]>=u,ks[x<<2].forEach(w);++p<e-1;)b=x,x=rl(l[m*e+p+1],u),ks[x<<2|b<<3].forEach(w);ks[x<<3].forEach(w);function w(_){var v=[_[0][0]+p,_[0][1]+m],M=[_[1][0]+p,_[1][1]+m],E=a(v),D=a(M),I,T;(I=h[E])?(T=d[D])?(delete h[I.end],delete d[T.start],I===T?(I.ring.push(M),f(I.ring)):d[I.start]=h[T.end]={start:I.start,end:T.end,ring:I.ring.concat(T.ring)}):(delete h[I.end],I.ring.push(M),h[I.end=D]=I):(I=d[D])?(T=h[E])?(delete d[I.start],delete h[T.end],I===T?(I.ring.push(M),f(I.ring)):d[T.start]=h[I.end]={start:T.start,end:I.end,ring:T.ring.concat(I.ring)}):(delete d[I.start],I.ring.unshift(v),d[I.start=E]=I):d[E]=h[D]={start:E,end:D,ring:[v,M]}}}function a(l){return l[0]*2+l[1]*(e+1)*4}function c(l,u,f){l.forEach(function(d){var h=d[0],p=d[1],m=h|0,g=p|0,y=vI(u[g*e+m]);h>0&&h<e&&m===h&&(d[0]=hC(h,vI(u[g*e+m-1]),y,f)),p>0&&p<t&&g===p&&(d[1]=hC(p,vI(u[(g-1)*e+m]),y,f))})}return i.contour=o,i.size=function(l){if(!arguments.length)return[e,t];var u=Math.floor(l[0]),f=Math.floor(l[1]);if(!(u>=0&&f>=0))throw new Error("invalid size");return e=u,t=f,i},i.thresholds=function(l){return arguments.length?(n=typeof l=="function"?l:Array.isArray(l)?bo(Cx.call(l)):bo(l),i):n},i.smooth=function(l){return arguments.length?(r=l?c:dC,i):r===c},i}function IG(e){return isFinite(e)?e:NaN}function rl(e,t){return e==null?!1:+e>=t}function vI(e){return e==null||isNaN(e=+e)?-1/0:e}function hC(e,t,n,r){let i=r-t,o=n-t,s=isFinite(i)||isFinite(o)?i/o:Math.sign(i)/Math.sign(o);return isNaN(s)?e:e+s-.5}function MG(e){return e[0]}function AG(e){return e[1]}function TG(){return 1}function _I(){var e=MG,t=AG,n=TG,r=960,i=500,o=20,s=2,a=o*3,c=r+a*2>>s,l=i+a*2>>s,u=bo(20);function f(x){var b=new Float32Array(c*l),w=Math.pow(2,-s),_=-1;for(let L of x){var v=(e(L,++_,x)+a)*w,M=(t(L,_,x)+a)*w,E=+n(L,_,x);if(E&&v>=0&&v<c&&M>=0&&M<l){var D=Math.floor(v),I=Math.floor(M),T=v-D-.5,O=M-I-.5;b[D+I*c]+=(1-T)*(1-O)*E,b[D+1+I*c]+=T*(1-O)*E,b[D+1+(I+1)*c]+=T*O*E,b[D+(I+1)*c]+=(1-T)*O*E}}return Qh({data:b,width:c,height:l},o*w),b}function d(x){var b=f(x),w=u(b),_=Math.pow(2,2*s);return Array.isArray(w)||(w=_n(Number.MIN_VALUE,Gt(b)/_,w)),$a().size([c,l]).thresholds(w.map(v=>v*_))(b).map((v,M)=>(v.value=+w[M],h(v)))}d.contours=function(x){var b=f(x),w=$a().size([c,l]),_=Math.pow(2,2*s),v=M=>{M=+M;var E=h(w.contour(b,M*_));return E.value=M,E};return Object.defineProperty(v,"max",{get:()=>Gt(b)/_}),v};function h(x){return x.coordinates.forEach(p),x}function p(x){x.forEach(m)}function m(x){x.forEach(g)}function g(x){x[0]=x[0]*Math.pow(2,s)-a,x[1]=x[1]*Math.pow(2,s)-a}function y(){return a=o*3,c=r+a*2>>s,l=i+a*2>>s,d}return d.x=function(x){return arguments.length?(e=typeof x=="function"?x:bo(+x),d):e},d.y=function(x){return arguments.length?(t=typeof x=="function"?x:bo(+x),d):t},d.weight=function(x){return arguments.length?(n=typeof x=="function"?x:bo(+x),d):n},d.size=function(x){if(!arguments.length)return[r,i];var b=+x[0],w=+x[1];if(!(b>=0&&w>=0))throw new Error("invalid size");return r=b,i=w,y()},d.cellSize=function(x){if(!arguments.length)return 1<<s;if(!((x=+x)>=1))throw new Error("invalid cell size");return s=Math.floor(Math.log(x)/Math.LN2),y()},d.thresholds=function(x){return arguments.length?(u=typeof x=="function"?x:Array.isArray(x)?bo(Cx.call(x)):bo(x),d):u},d.bandwidth=function(x){if(!arguments.length)return Math.sqrt(o*(o+1));if(!((x=+x)>=0))throw new Error("invalid bandwidth");return o=(Math.sqrt(4*x*x+1)-1)/2,y()},d}var Kt=11102230246251565e-32,Xe=134217729,Ip=(3+8*Kt)*Kt;function il(e,t,n,r,i){let o,s,a,c,l=t[0],u=r[0],f=0,d=0;u>l==u>-l?(o=l,l=t[++f]):(o=u,u=r[++d]);let h=0;if(f<e&&d<n)for(u>l==u>-l?(s=l+o,a=o-(s-l),l=t[++f]):(s=u+o,a=o-(s-u),u=r[++d]),o=s,a!==0&&(i[h++]=a);f<e&&d<n;)u>l==u>-l?(s=o+l,c=s-o,a=o-(s-c)+(l-c),l=t[++f]):(s=o+u,c=s-o,a=o-(s-c)+(u-c),u=r[++d]),o=s,a!==0&&(i[h++]=a);for(;f<e;)s=o+l,c=s-o,a=o-(s-c)+(l-c),l=t[++f],o=s,a!==0&&(i[h++]=a);for(;d<n;)s=o+u,c=s-o,a=o-(s-c)+(u-c),u=r[++d],o=s,a!==0&&(i[h++]=a);return(o!==0||h===0)&&(i[h++]=o),h}function Mp(e,t){let n=t[0];for(let r=1;r<e;r++)n+=t[r];return n}function V(e){return new Float64Array(e)}var EG=(3+16*Kt)*Kt,NG=(2+12*Kt)*Kt,DG=(9+64*Kt)*Kt*Kt,qu=V(4),pC=V(8),mC=V(12),yC=V(16),Kn=V(4);function OG(e,t,n,r,i,o,s){let a,c,l,u,f,d,h,p,m,g,y,x,b,w,_,v,M,E,D=e-i,I=n-i,T=t-o,O=r-o;w=D*O,d=Xe*D,h=d-(d-D),p=D-h,d=Xe*O,m=d-(d-O),g=O-m,_=p*g-(w-h*m-p*m-h*g),v=T*I,d=Xe*T,h=d-(d-T),p=T-h,d=Xe*I,m=d-(d-I),g=I-m,M=p*g-(v-h*m-p*m-h*g),y=_-M,f=_-y,qu[0]=_-(y+f)+(f-M),x=w+y,f=x-w,b=w-(x-f)+(y-f),y=b-v,f=b-y,qu[1]=b-(y+f)+(f-v),E=x+y,f=E-x,qu[2]=x-(E-f)+(y-f),qu[3]=E;let L=Mp(4,qu),S=NG*s;if(L>=S||-L>=S||(f=e-D,a=e-(D+f)+(f-i),f=n-I,l=n-(I+f)+(f-i),f=t-T,c=t-(T+f)+(f-o),f=r-O,u=r-(O+f)+(f-o),a===0&&c===0&&l===0&&u===0)||(S=DG*s+Ip*Math.abs(L),L+=D*u+O*a-(T*l+I*c),L>=S||-L>=S))return L;w=a*O,d=Xe*a,h=d-(d-a),p=a-h,d=Xe*O,m=d-(d-O),g=O-m,_=p*g-(w-h*m-p*m-h*g),v=c*I,d=Xe*c,h=d-(d-c),p=c-h,d=Xe*I,m=d-(d-I),g=I-m,M=p*g-(v-h*m-p*m-h*g),y=_-M,f=_-y,Kn[0]=_-(y+f)+(f-M),x=w+y,f=x-w,b=w-(x-f)+(y-f),y=b-v,f=b-y,Kn[1]=b-(y+f)+(f-v),E=x+y,f=E-x,Kn[2]=x-(E-f)+(y-f),Kn[3]=E;let A=il(4,qu,4,Kn,pC);w=D*u,d=Xe*D,h=d-(d-D),p=D-h,d=Xe*u,m=d-(d-u),g=u-m,_=p*g-(w-h*m-p*m-h*g),v=T*l,d=Xe*T,h=d-(d-T),p=T-h,d=Xe*l,m=d-(d-l),g=l-m,M=p*g-(v-h*m-p*m-h*g),y=_-M,f=_-y,Kn[0]=_-(y+f)+(f-M),x=w+y,f=x-w,b=w-(x-f)+(y-f),y=b-v,f=b-y,Kn[1]=b-(y+f)+(f-v),E=x+y,f=E-x,Kn[2]=x-(E-f)+(y-f),Kn[3]=E;let N=il(A,pC,4,Kn,mC);w=a*u,d=Xe*a,h=d-(d-a),p=a-h,d=Xe*u,m=d-(d-u),g=u-m,_=p*g-(w-h*m-p*m-h*g),v=c*l,d=Xe*c,h=d-(d-c),p=c-h,d=Xe*l,m=d-(d-l),g=l-m,M=p*g-(v-h*m-p*m-h*g),y=_-M,f=_-y,Kn[0]=_-(y+f)+(f-M),x=w+y,f=x-w,b=w-(x-f)+(y-f),y=b-v,f=b-y,Kn[1]=b-(y+f)+(f-v),E=x+y,f=E-x,Kn[2]=x-(E-f)+(y-f),Kn[3]=E;let k=il(N,mC,4,Kn,yC);return yC[k-1]}function ju(e,t,n,r,i,o){let s=(t-o)*(n-i),a=(e-i)*(r-o),c=s-a;if(s===0||a===0||s>0!=a>0)return c;let l=Math.abs(s+a);return Math.abs(c)>=EG*l?c:-OG(e,t,n,r,i,o,l)}var Bvt=(7+56*Kt)*Kt,Lvt=(3+28*Kt)*Kt,Cvt=(26+288*Kt)*Kt*Kt,kvt=V(4),Fvt=V(4),Rvt=V(4),$vt=V(4),Pvt=V(4),Uvt=V(4),zvt=V(4),qvt=V(4),jvt=V(4),Vvt=V(8),Yvt=V(8),Xvt=V(8),Gvt=V(4),Wvt=V(8),Hvt=V(8),Zvt=V(8),Jvt=V(12),Qvt=V(192),Kvt=V(192);var n_t=(10+96*Kt)*Kt,r_t=(4+48*Kt)*Kt,i_t=(44+576*Kt)*Kt*Kt,o_t=V(4),s_t=V(4),a_t=V(4),c_t=V(4),l_t=V(4),u_t=V(4),f_t=V(4),d_t=V(4),h_t=V(8),p_t=V(8),m_t=V(8),y_t=V(8),g_t=V(8),x_t=V(8),b_t=V(8),w_t=V(8),v_t=V(8),__t=V(4),S_t=V(4),I_t=V(4),M_t=V(8),A_t=V(16),T_t=V(16),E_t=V(16),N_t=V(32),D_t=V(32),O_t=V(48),B_t=V(64),L_t=V(1152),C_t=V(1152);var $_t=(16+224*Kt)*Kt,P_t=(5+72*Kt)*Kt,U_t=(71+1408*Kt)*Kt*Kt,z_t=V(4),q_t=V(4),j_t=V(4),V_t=V(4),Y_t=V(4),X_t=V(4),G_t=V(4),W_t=V(4),H_t=V(4),Z_t=V(4),J_t=V(24),Q_t=V(24),K_t=V(24),t2t=V(24),e2t=V(24),n2t=V(24),r2t=V(24),i2t=V(24),o2t=V(24),s2t=V(24),a2t=V(1152),c2t=V(1152),l2t=V(1152),u2t=V(1152),f2t=V(1152),d2t=V(2304),h2t=V(2304),p2t=V(3456),m2t=V(5760),y2t=V(8),g2t=V(8),x2t=V(8),b2t=V(16),w2t=V(24),v2t=V(48),_2t=V(48),S2t=V(96),I2t=V(192),M2t=V(384),A2t=V(384),T2t=V(384),E2t=V(768);var N2t=V(96),D2t=V(96),O2t=V(96),B2t=V(1152);var xC=Math.pow(2,-52),kx=new Uint32Array(512),Yu=class e{static from(t,n=RG,r=$G){let i=t.length,o=new Float64Array(i*2);for(let s=0;s<i;s++){let a=t[s];o[2*s]=n(a),o[2*s+1]=r(a)}return new e(o)}constructor(t){let n=t.length>>1;if(n>0&&typeof t[0]!="number")throw new Error("Expected coords to contain numbers.");this.coords=t;let r=Math.max(2*n-5,0);this._triangles=new Uint32Array(r*3),this._halfedges=new Int32Array(r*3),this._hashSize=Math.ceil(Math.sqrt(n)),this._hullPrev=new Uint32Array(n),this._hullNext=new Uint32Array(n),this._hullTri=new Uint32Array(n),this._hullHash=new Int32Array(this._hashSize).fill(-1),this._ids=new Uint32Array(n),this._dists=new Float64Array(n),this.update()}update(){let{coords:t,_hullPrev:n,_hullNext:r,_hullTri:i,_hullHash:o}=this,s=t.length>>1,a=1/0,c=1/0,l=-1/0,u=-1/0;for(let I=0;I<s;I++){let T=t[2*I],O=t[2*I+1];T<a&&(a=T),O<c&&(c=O),T>l&&(l=T),O>u&&(u=O),this._ids[I]=I}let f=(a+l)/2,d=(c+u)/2,h=1/0,p,m,g;for(let I=0;I<s;I++){let T=SI(f,d,t[2*I],t[2*I+1]);T<h&&(p=I,h=T)}let y=t[2*p],x=t[2*p+1];h=1/0;for(let I=0;I<s;I++){if(I===p)continue;let T=SI(y,x,t[2*I],t[2*I+1]);T<h&&T>0&&(m=I,h=T)}let b=t[2*m],w=t[2*m+1],_=1/0;for(let I=0;I<s;I++){if(I===p||I===m)continue;let T=kG(y,x,b,w,t[2*I],t[2*I+1]);T<_&&(g=I,_=T)}let v=t[2*g],M=t[2*g+1];if(_===1/0){for(let O=0;O<s;O++)this._dists[O]=t[2*O]-t[0]||t[2*O+1]-t[1];Vu(this._ids,this._dists,0,s-1);let I=new Uint32Array(s),T=0;for(let O=0,L=-1/0;O<s;O++){let S=this._ids[O];this._dists[S]>L&&(I[T++]=S,L=this._dists[S])}this.hull=I.subarray(0,T),this.triangles=new Uint32Array(0),this.halfedges=new Uint32Array(0);return}if(ju(y,x,b,w,v,M)<0){let I=m,T=b,O=w;m=g,b=v,w=M,g=I,v=T,M=O}let E=FG(y,x,b,w,v,M);this._cx=E.x,this._cy=E.y;for(let I=0;I<s;I++)this._dists[I]=SI(t[2*I],t[2*I+1],E.x,E.y);Vu(this._ids,this._dists,0,s-1),this._hullStart=p;let D=3;r[p]=n[g]=m,r[m]=n[p]=g,r[g]=n[m]=p,i[p]=0,i[m]=1,i[g]=2,o.fill(-1),o[this._hashKey(y,x)]=p,o[this._hashKey(b,w)]=m,o[this._hashKey(v,M)]=g,this.trianglesLen=0,this._addTriangle(p,m,g,-1,-1,-1);for(let I=0,T,O;I<this._ids.length;I++){let L=this._ids[I],S=t[2*L],A=t[2*L+1];if(I>0&&Math.abs(S-T)<=xC&&Math.abs(A-O)<=xC||(T=S,O=A,L===p||L===m||L===g))continue;let N=0;for(let P=0,U=this._hashKey(S,A);P<this._hashSize&&(N=o[(U+P)%this._hashSize],!(N!==-1&&N!==r[N]));P++);N=n[N];let k=N,R;for(;R=r[k],ju(S,A,t[2*k],t[2*k+1],t[2*R],t[2*R+1])>=0;)if(k=R,k===N){k=-1;break}if(k===-1)continue;let F=this._addTriangle(k,L,r[k],-1,-1,i[k]);i[L]=this._legalize(F+2),i[k]=F,D++;let $=r[k];for(;R=r[$],ju(S,A,t[2*$],t[2*$+1],t[2*R],t[2*R+1])<0;)F=this._addTriangle($,L,R,i[L],-1,i[$]),i[L]=this._legalize(F+2),r[$]=$,D--,$=R;if(k===N)for(;R=n[k],ju(S,A,t[2*R],t[2*R+1],t[2*k],t[2*k+1])<0;)F=this._addTriangle(R,L,k,-1,i[k],i[R]),this._legalize(F+2),i[R]=F,r[k]=k,D--,k=R;this._hullStart=n[L]=k,r[k]=n[$]=L,r[L]=$,o[this._hashKey(S,A)]=L,o[this._hashKey(t[2*k],t[2*k+1])]=k}this.hull=new Uint32Array(D);for(let I=0,T=this._hullStart;I<D;I++)this.hull[I]=T,T=r[T];this.triangles=this._triangles.subarray(0,this.trianglesLen),this.halfedges=this._halfedges.subarray(0,this.trianglesLen)}_hashKey(t,n){return Math.floor(LG(t-this._cx,n-this._cy)*this._hashSize)%this._hashSize}_legalize(t){let{_triangles:n,_halfedges:r,coords:i}=this,o=0,s=0;for(;;){let a=r[t],c=t-t%3;if(s=c+(t+2)%3,a===-1){if(o===0)break;t=kx[--o];continue}let l=a-a%3,u=c+(t+1)%3,f=l+(a+2)%3,d=n[s],h=n[t],p=n[u],m=n[f];if(CG(i[2*d],i[2*d+1],i[2*h],i[2*h+1],i[2*p],i[2*p+1],i[2*m],i[2*m+1])){n[t]=m,n[a]=d;let y=r[f];if(y===-1){let b=this._hullStart;do{if(this._hullTri[b]===f){this._hullTri[b]=t;break}b=this._hullPrev[b]}while(b!==this._hullStart)}this._link(t,y),this._link(a,r[s]),this._link(s,f);let x=l+(a+1)%3;o<kx.length&&(kx[o++]=x)}else{if(o===0)break;t=kx[--o]}}return s}_link(t,n){this._halfedges[t]=n,n!==-1&&(this._halfedges[n]=t)}_addTriangle(t,n,r,i,o,s){let a=this.trianglesLen;return this._triangles[a]=t,this._triangles[a+1]=n,this._triangles[a+2]=r,this._link(a,i),this._link(a+1,o),this._link(a+2,s),this.trianglesLen+=3,a}};function LG(e,t){let n=e/(Math.abs(e)+Math.abs(t));return(t>0?3-n:1+n)/4}function SI(e,t,n,r){let i=e-n,o=t-r;return i*i+o*o}function CG(e,t,n,r,i,o,s,a){let c=e-s,l=t-a,u=n-s,f=r-a,d=i-s,h=o-a,p=c*c+l*l,m=u*u+f*f,g=d*d+h*h;return c*(f*g-m*h)-l*(u*g-m*d)+p*(u*h-f*d)<0}function kG(e,t,n,r,i,o){let s=n-e,a=r-t,c=i-e,l=o-t,u=s*s+a*a,f=c*c+l*l,d=.5/(s*l-a*c),h=(l*u-a*f)*d,p=(s*f-c*u)*d;return h*h+p*p}function FG(e,t,n,r,i,o){let s=n-e,a=r-t,c=i-e,l=o-t,u=s*s+a*a,f=c*c+l*l,d=.5/(s*l-a*c),h=e+(l*u-a*f)*d,p=t+(s*f-c*u)*d;return{x:h,y:p}}function Vu(e,t,n,r){if(r-n<=20)for(let i=n+1;i<=r;i++){let o=e[i],s=t[o],a=i-1;for(;a>=n&&t[e[a]]>s;)e[a+1]=e[a--];e[a+1]=o}else{let i=n+r>>1,o=n+1,s=r;Ap(e,i,o),t[e[n]]>t[e[r]]&&Ap(e,n,r),t[e[o]]>t[e[r]]&&Ap(e,o,r),t[e[n]]>t[e[o]]&&Ap(e,n,o);let a=e[o],c=t[a];for(;;){do o++;while(t[e[o]]<c);do s--;while(t[e[s]]>c);if(s<o)break;Ap(e,o,s)}e[n+1]=e[s],e[s]=a,r-o+1>=s-n?(Vu(e,t,o,r),Vu(e,t,n,s-1)):(Vu(e,t,n,s-1),Vu(e,t,o,r))}}function Ap(e,t,n){let r=e[t];e[t]=e[n],e[n]=r}function RG(e){return e[0]}function $G(e){return e[1]}var si=class{constructor(){this._x0=this._y0=this._x1=this._y1=null,this._=""}moveTo(t,n){this._+=`M${this._x0=this._x1=+t},${this._y0=this._y1=+n}`}closePath(){this._x1!==null&&(this._x1=this._x0,this._y1=this._y0,this._+="Z")}lineTo(t,n){this._+=`L${this._x1=+t},${this._y1=+n}`}arc(t,n,r){t=+t,n=+n,r=+r;let i=t+r,o=n;if(r<0)throw new Error("negative radius");this._x1===null?this._+=`M${i},${o}`:(Math.abs(this._x1-i)>1e-6||Math.abs(this._y1-o)>1e-6)&&(this._+="L"+i+","+o),r&&(this._+=`A${r},${r},0,1,1,${t-r},${n}A${r},${r},0,1,1,${this._x1=i},${this._y1=o}`)}rect(t,n,r,i){this._+=`M${this._x0=this._x1=+t},${this._y0=this._y1=+n}h${+r}v${+i}h${-r}Z`}value(){return this._||null}};var Pa=class{constructor(){this._=[]}moveTo(t,n){this._.push([t,n])}closePath(){this._.push(this._[0].slice())}lineTo(t,n){this._.push([t,n])}value(){return this._.length?this._:null}};var Tp=class{constructor(t,[n,r,i,o]=[0,0,960,500]){if(!((i=+i)>=(n=+n))||!((o=+o)>=(r=+r)))throw new Error("invalid bounds");this.delaunay=t,this._circumcenters=new Float64Array(t.points.length*2),this.vectors=new Float64Array(t.points.length*2),this.xmax=i,this.xmin=n,this.ymax=o,this.ymin=r,this._init()}update(){return this.delaunay.update(),this._init(),this}_init(){let{delaunay:{points:t,hull:n,triangles:r},vectors:i}=this,o,s,a=this.circumcenters=this._circumcenters.subarray(0,r.length/3*2);for(let m=0,g=0,y=r.length,x,b;m<y;m+=3,g+=2){let w=r[m]*2,_=r[m+1]*2,v=r[m+2]*2,M=t[w],E=t[w+1],D=t[_],I=t[_+1],T=t[v],O=t[v+1],L=D-M,S=I-E,A=T-M,N=O-E,k=(L*N-S*A)*2;if(Math.abs(k)<1e-9){if(o===void 0){o=s=0;for(let F of n)o+=t[F*2],s+=t[F*2+1];o/=n.length,s/=n.length}let R=1e9*Math.sign((o-M)*N-(s-E)*A);x=(M+T)/2-R*N,b=(E+O)/2+R*A}else{let R=1/k,F=L*L+S*S,$=A*A+N*N;x=M+(N*F-S*$)*R,b=E+(L*$-A*F)*R}a[g]=x,a[g+1]=b}let c=n[n.length-1],l,u=c*4,f,d=t[2*c],h,p=t[2*c+1];i.fill(0);for(let m=0;m<n.length;++m)c=n[m],l=u,f=d,h=p,u=c*4,d=t[2*c],p=t[2*c+1],i[l+2]=i[u]=h-p,i[l+3]=i[u+1]=d-f}render(t){let n=t==null?t=new si:void 0,{delaunay:{halfedges:r,inedges:i,hull:o},circumcenters:s,vectors:a}=this;if(o.length<=1)return null;for(let u=0,f=r.length;u<f;++u){let d=r[u];if(d<u)continue;let h=Math.floor(u/3)*2,p=Math.floor(d/3)*2,m=s[h],g=s[h+1],y=s[p],x=s[p+1];this._renderSegment(m,g,y,x,t)}let c,l=o[o.length-1];for(let u=0;u<o.length;++u){c=l,l=o[u];let f=Math.floor(i[l]/3)*2,d=s[f],h=s[f+1],p=c*4,m=this._project(d,h,a[p+2],a[p+3]);m&&this._renderSegment(d,h,m[0],m[1],t)}return n&&n.value()}renderBounds(t){let n=t==null?t=new si:void 0;return t.rect(this.xmin,this.ymin,this.xmax-this.xmin,this.ymax-this.ymin),n&&n.value()}renderCell(t,n){let r=n==null?n=new si:void 0,i=this._clip(t);if(i===null||!i.length)return;n.moveTo(i[0],i[1]);let o=i.length;for(;i[0]===i[o-2]&&i[1]===i[o-1]&&o>1;)o-=2;for(let s=2;s<o;s+=2)(i[s]!==i[s-2]||i[s+1]!==i[s-1])&&n.lineTo(i[s],i[s+1]);return n.closePath(),r&&r.value()}*cellPolygons(){let{delaunay:{points:t}}=this;for(let n=0,r=t.length/2;n<r;++n){let i=this.cellPolygon(n);i&&(i.index=n,yield i)}}cellPolygon(t){let n=new Pa;return this.renderCell(t,n),n.value()}_renderSegment(t,n,r,i,o){let s,a=this._regioncode(t,n),c=this._regioncode(r,i);a===0&&c===0?(o.moveTo(t,n),o.lineTo(r,i)):(s=this._clipSegment(t,n,r,i,a,c))&&(o.moveTo(s[0],s[1]),o.lineTo(s[2],s[3]))}contains(t,n,r){return n=+n,n!==n||(r=+r,r!==r)?!1:this.delaunay._step(t,n,r)===t}*neighbors(t){let n=this._clip(t);if(n)for(let r of this.delaunay.neighbors(t)){let i=this._clip(r);if(i){t:for(let o=0,s=n.length;o<s;o+=2)for(let a=0,c=i.length;a<c;a+=2)if(n[o]===i[a]&&n[o+1]===i[a+1]&&n[(o+2)%s]===i[(a+c-2)%c]&&n[(o+3)%s]===i[(a+c-1)%c]){yield r;break t}}}}_cell(t){let{circumcenters:n,delaunay:{inedges:r,halfedges:i,triangles:o}}=this,s=r[t];if(s===-1)return null;let a=[],c=s;do{let l=Math.floor(c/3);if(a.push(n[l*2],n[l*2+1]),c=c%3===2?c-2:c+1,o[c]!==t)break;c=i[c]}while(c!==s&&c!==-1);return a}_clip(t){if(t===0&&this.delaunay.hull.length===1)return[this.xmax,this.ymin,this.xmax,this.ymax,this.xmin,this.ymax,this.xmin,this.ymin];let n=this._cell(t);if(n===null)return null;let{vectors:r}=this,i=t*4;return this._simplify(r[i]||r[i+1]?this._clipInfinite(t,n,r[i],r[i+1],r[i+2],r[i+3]):this._clipFinite(t,n))}_clipFinite(t,n){let r=n.length,i=null,o,s,a=n[r-2],c=n[r-1],l,u=this._regioncode(a,c),f,d=0;for(let h=0;h<r;h+=2)if(o=a,s=c,a=n[h],c=n[h+1],l=u,u=this._regioncode(a,c),l===0&&u===0)f=d,d=0,i?i.push(a,c):i=[a,c];else{let p,m,g,y,x;if(l===0){if((p=this._clipSegment(o,s,a,c,l,u))===null)continue;[m,g,y,x]=p}else{if((p=this._clipSegment(a,c,o,s,u,l))===null)continue;[y,x,m,g]=p,f=d,d=this._edgecode(m,g),f&&d&&this._edge(t,f,d,i,i.length),i?i.push(m,g):i=[m,g]}f=d,d=this._edgecode(y,x),f&&d&&this._edge(t,f,d,i,i.length),i?i.push(y,x):i=[y,x]}if(i)f=d,d=this._edgecode(i[0],i[1]),f&&d&&this._edge(t,f,d,i,i.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 i}_clipSegment(t,n,r,i,o,s){let a=o<s;for(a&&([t,n,r,i,o,s]=[r,i,t,n,s,o]);;){if(o===0&&s===0)return a?[r,i,t,n]:[t,n,r,i];if(o&s)return null;let c,l,u=o||s;u&8?(c=t+(r-t)*(this.ymax-n)/(i-n),l=this.ymax):u&4?(c=t+(r-t)*(this.ymin-n)/(i-n),l=this.ymin):u&2?(l=n+(i-n)*(this.xmax-t)/(r-t),c=this.xmax):(l=n+(i-n)*(this.xmin-t)/(r-t),c=this.xmin),o?(t=c,n=l,o=this._regioncode(t,n)):(r=c,i=l,s=this._regioncode(r,i))}}_clipInfinite(t,n,r,i,o,s){let a=Array.from(n),c;if((c=this._project(a[0],a[1],r,i))&&a.unshift(c[0],c[1]),(c=this._project(a[a.length-2],a[a.length-1],o,s))&&a.push(c[0],c[1]),a=this._clipFinite(t,a))for(let l=0,u=a.length,f,d=this._edgecode(a[u-2],a[u-1]);l<u;l+=2)f=d,d=this._edgecode(a[l],a[l+1]),f&&d&&(l=this._edge(t,f,d,a,l),u=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,n,r,i,o){for(;n!==r;){let s,a;switch(n){case 5:n=4;continue;case 4:n=6,s=this.xmax,a=this.ymin;break;case 6:n=2;continue;case 2:n=10,s=this.xmax,a=this.ymax;break;case 10:n=8;continue;case 8:n=9,s=this.xmin,a=this.ymax;break;case 9:n=1;continue;case 1:n=5,s=this.xmin,a=this.ymin;break}(i[o]!==s||i[o+1]!==a)&&this.contains(t,s,a)&&(i.splice(o,0,s,a),o+=2)}return o}_project(t,n,r,i){let o=1/0,s,a,c;if(i<0){if(n<=this.ymin)return null;(s=(this.ymin-n)/i)<o&&(c=this.ymin,a=t+(o=s)*r)}else if(i>0){if(n>=this.ymax)return null;(s=(this.ymax-n)/i)<o&&(c=this.ymax,a=t+(o=s)*r)}if(r>0){if(t>=this.xmax)return null;(s=(this.xmax-t)/r)<o&&(a=this.xmax,c=n+(o=s)*i)}else if(r<0){if(t<=this.xmin)return null;(s=(this.xmin-t)/r)<o&&(a=this.xmin,c=n+(o=s)*i)}return[a,c]}_edgecode(t,n){return(t===this.xmin?1:t===this.xmax?2:0)|(n===this.ymin?4:n===this.ymax?8:0)}_regioncode(t,n){return(t<this.xmin?1:t>this.xmax?2:0)|(n<this.ymin?4:n>this.ymax?8:0)}_simplify(t){if(t&&t.length>4){for(let n=0;n<t.length;n+=2){let r=(n+2)%t.length,i=(n+4)%t.length;(t[n]===t[r]&&t[r]===t[i]||t[n+1]===t[r+1]&&t[r+1]===t[i+1])&&(t.splice(r,2),n-=2)}t.length||(t=null)}return t}};var PG=2*Math.PI,Xu=Math.pow;function UG(e){return e[0]}function zG(e){return e[1]}function qG(e){let{triangles:t,coords:n}=e;for(let r=0;r<t.length;r+=3){let i=2*t[r],o=2*t[r+1],s=2*t[r+2];if((n[s]-n[i])*(n[o+1]-n[i+1])-(n[o]-n[i])*(n[s+1]-n[i+1])>1e-10)return!1}return!0}function jG(e,t,n){return[e+Math.sin(e+t)*n,t+Math.cos(e-t)*n]}var ai=class e{static from(t,n=UG,r=zG,i){return new e("length"in t?VG(t,n,r,i):Float64Array.from(YG(t,n,r,i)))}constructor(t){this._delaunator=new Yu(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(){let t=this._delaunator,n=this.points;if(t.hull&&t.hull.length>2&&qG(t)){this.collinear=Int32Array.from({length:n.length/2},(d,h)=>h).sort((d,h)=>n[2*d]-n[2*h]||n[2*d+1]-n[2*h+1]);let c=this.collinear[0],l=this.collinear[this.collinear.length-1],u=[n[2*c],n[2*c+1],n[2*l],n[2*l+1]],f=1e-8*Math.hypot(u[3]-u[1],u[2]-u[0]);for(let d=0,h=n.length/2;d<h;++d){let p=jG(n[2*d],n[2*d+1],f);n[2*d]=p[0],n[2*d+1]=p[1]}this._delaunator=new Yu(n)}else delete this.collinear;let r=this.halfedges=this._delaunator.halfedges,i=this.hull=this._delaunator.hull,o=this.triangles=this._delaunator.triangles,s=this.inedges.fill(-1),a=this._hullIndex.fill(-1);for(let c=0,l=r.length;c<l;++c){let u=o[c%3===2?c-2:c+1];(r[c]===-1||s[u]===-1)&&(s[u]=c)}for(let c=0,l=i.length;c<l;++c)a[i[c]]=c;i.length<=2&&i.length>0&&(this.triangles=new Int32Array(3).fill(-1),this.halfedges=new Int32Array(3).fill(-1),this.triangles[0]=i[0],s[i[0]]=1,i.length===2&&(s[i[1]]=0,this.triangles[1]=i[1],this.triangles[2]=i[1]))}voronoi(t){return new Tp(this,t)}*neighbors(t){let{inedges:n,hull:r,_hullIndex:i,halfedges:o,triangles:s,collinear:a}=this;if(a){let f=a.indexOf(t);f>0&&(yield a[f-1]),f<a.length-1&&(yield a[f+1]);return}let c=n[t];if(c===-1)return;let l=c,u=-1;do{if(yield u=s[l],l=l%3===2?l-2:l+1,s[l]!==t)return;if(l=o[l],l===-1){let f=r[(i[t]+1)%r.length];f!==u&&(yield f);return}}while(l!==c)}find(t,n,r=0){if(t=+t,t!==t||(n=+n,n!==n))return-1;let i=r,o;for(;(o=this._step(r,t,n))>=0&&o!==r&&o!==i;)r=o;return o}_step(t,n,r){let{inedges:i,hull:o,_hullIndex:s,halfedges:a,triangles:c,points:l}=this;if(i[t]===-1||!l.length)return(t+1)%(l.length>>1);let u=t,f=Xu(n-l[t*2],2)+Xu(r-l[t*2+1],2),d=i[t],h=d;do{let p=c[h],m=Xu(n-l[p*2],2)+Xu(r-l[p*2+1],2);if(m<f&&(f=m,u=p),h=h%3===2?h-2:h+1,c[h]!==t)break;if(h=a[h],h===-1){if(h=o[(s[t]+1)%o.length],h!==p&&Xu(n-l[h*2],2)+Xu(r-l[h*2+1],2)<f)return h;break}}while(h!==d);return u}render(t){let n=t==null?t=new si:void 0,{points:r,halfedges:i,triangles:o}=this;for(let s=0,a=i.length;s<a;++s){let c=i[s];if(c<s)continue;let l=o[s]*2,u=o[c]*2;t.moveTo(r[l],r[l+1]),t.lineTo(r[u],r[u+1])}return this.renderHull(t),n&&n.value()}renderPoints(t,n){n===void 0&&(!t||typeof t.moveTo!="function")&&(n=t,t=null),n=n==null?2:+n;let r=t==null?t=new si:void 0,{points:i}=this;for(let o=0,s=i.length;o<s;o+=2){let a=i[o],c=i[o+1];t.moveTo(a+n,c),t.arc(a,c,n,0,PG)}return r&&r.value()}renderHull(t){let n=t==null?t=new si:void 0,{hull:r,points:i}=this,o=r[0]*2,s=r.length;t.moveTo(i[o],i[o+1]);for(let a=1;a<s;++a){let c=2*r[a];t.lineTo(i[c],i[c+1])}return t.closePath(),n&&n.value()}hullPolygon(){let t=new Pa;return this.renderHull(t),t.value()}renderTriangle(t,n){let r=n==null?n=new si:void 0,{points:i,triangles:o}=this,s=o[t*=3]*2,a=o[t+1]*2,c=o[t+2]*2;return n.moveTo(i[s],i[s+1]),n.lineTo(i[a],i[a+1]),n.lineTo(i[c],i[c+1]),n.closePath(),r&&r.value()}*trianglePolygons(){let{triangles:t}=this;for(let n=0,r=t.length/3;n<r;++n)yield this.trianglePolygon(n)}trianglePolygon(t){let n=new Pa;return this.renderTriangle(t,n),n.value()}};function VG(e,t,n,r){let i=e.length,o=new Float64Array(i*2);for(let s=0;s<i;++s){let a=e[s];o[s*2]=t.call(r,a,s,e),o[s*2+1]=n.call(r,a,s,e)}return o}function*YG(e,t,n,r){let i=0;for(let o of e)yield t.call(r,o,i,e),yield n.call(r,o,i,e),++i}function bC(e){return Math.abs(e=Math.round(e))>=1e21?e.toLocaleString("en").replace(/,/g,""):e.toString(10)}function ol(e,t){if((n=(e=t?e.toExponential(t-1):e.toExponential()).indexOf("e"))<0)return null;var n,r=e.slice(0,n);return[r.length>1?r[0]+r.slice(2):r,+e.slice(n+1)]}function wo(e){return e=ol(Math.abs(e)),e?e[1]:NaN}function wC(e,t){return function(n,r){for(var i=n.length,o=[],s=0,a=e[0],c=0;i>0&&a>0&&(c+a+1>r&&(a=Math.max(1,r-c)),o.push(n.substring(i-=a,i+a)),!((c+=a+1)>r));)a=e[s=(s+1)%e.length];return o.reverse().join(t)}}function vC(e){return function(t){return t.replace(/[0-9]/g,function(n){return e[+n]})}}var XG=/^(?:(.)?([<>=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i;function vo(e){if(!(t=XG.exec(e)))throw new Error("invalid format: "+e);var t;return new Fx({fill:t[1],align:t[2],sign:t[3],symbol:t[4],zero:t[5],width:t[6],comma:t[7],precision:t[8]&&t[8].slice(1),trim:t[9],type:t[10]})}vo.prototype=Fx.prototype;function Fx(e){this.fill=e.fill===void 0?" ":e.fill+"",this.align=e.align===void 0?">":e.align+"",this.sign=e.sign===void 0?"-":e.sign+"",this.symbol=e.symbol===void 0?"":e.symbol+"",this.zero=!!e.zero,this.width=e.width===void 0?void 0:+e.width,this.comma=!!e.comma,this.precision=e.precision===void 0?void 0:+e.precision,this.trim=!!e.trim,this.type=e.type===void 0?"":e.type+""}Fx.prototype.toString=function(){return this.fill+this.align+this.sign+this.symbol+(this.zero?"0":"")+(this.width===void 0?"":Math.max(1,this.width|0))+(this.comma?",":"")+(this.precision===void 0?"":"."+Math.max(0,this.precision|0))+(this.trim?"~":"")+this.type};function _C(e){t:for(var t=e.length,n=1,r=-1,i;n<t;++n)switch(e[n]){case".":r=i=n;break;case"0":r===0&&(r=n),i=n;break;default:if(!+e[n])break t;r>0&&(r=0);break}return r>0?e.slice(0,r)+e.slice(i+1):e}var II;function SC(e,t){var n=ol(e,t);if(!n)return e+"";var r=n[0],i=n[1],o=i-(II=Math.max(-8,Math.min(8,Math.floor(i/3)))*3)+1,s=r.length;return o===s?r:o>s?r+new Array(o-s+1).join("0"):o>0?r.slice(0,o)+"."+r.slice(o):"0."+new Array(1-o).join("0")+ol(e,Math.max(0,t+o-1))[0]}function MI(e,t){var n=ol(e,t);if(!n)return e+"";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")}var AI={"%":(e,t)=>(e*100).toFixed(t),b:e=>Math.round(e).toString(2),c:e=>e+"",d:bC,e:(e,t)=>e.toExponential(t),f:(e,t)=>e.toFixed(t),g:(e,t)=>e.toPrecision(t),o:e=>Math.round(e).toString(8),p:(e,t)=>MI(e*100,t),r:MI,s:SC,X:e=>Math.round(e).toString(16).toUpperCase(),x:e=>Math.round(e).toString(16)};function TI(e){return e}var IC=Array.prototype.map,MC=["y","z","a","f","p","n","\xB5","m","","k","M","G","T","P","E","Z","Y"];function AC(e){var t=e.grouping===void 0||e.thousands===void 0?TI:wC(IC.call(e.grouping,Number),e.thousands+""),n=e.currency===void 0?"":e.currency[0]+"",r=e.currency===void 0?"":e.currency[1]+"",i=e.decimal===void 0?".":e.decimal+"",o=e.numerals===void 0?TI:vC(IC.call(e.numerals,String)),s=e.percent===void 0?"%":e.percent+"",a=e.minus===void 0?"\u2212":e.minus+"",c=e.nan===void 0?"NaN":e.nan+"";function l(f){f=vo(f);var d=f.fill,h=f.align,p=f.sign,m=f.symbol,g=f.zero,y=f.width,x=f.comma,b=f.precision,w=f.trim,_=f.type;_==="n"?(x=!0,_="g"):AI[_]||(b===void 0&&(b=12),w=!0,_="g"),(g||d==="0"&&h==="=")&&(g=!0,d="0",h="=");var v=m==="$"?n:m==="#"&&/[boxX]/.test(_)?"0"+_.toLowerCase():"",M=m==="$"?r:/[%p]/.test(_)?s:"",E=AI[_],D=/[defgprs%]/.test(_);b=b===void 0?6:/[gprs]/.test(_)?Math.max(1,Math.min(21,b)):Math.max(0,Math.min(20,b));function I(T){var O=v,L=M,S,A,N;if(_==="c")L=E(T)+L,T="";else{T=+T;var k=T<0||1/T<0;if(T=isNaN(T)?c:E(Math.abs(T),b),w&&(T=_C(T)),k&&+T==0&&p!=="+"&&(k=!1),O=(k?p==="("?p:a:p==="-"||p==="("?"":p)+O,L=(_==="s"?MC[8+II/3]:"")+L+(k&&p==="("?")":""),D){for(S=-1,A=T.length;++S<A;)if(N=T.charCodeAt(S),48>N||N>57){L=(N===46?i+T.slice(S+1):T.slice(S))+L,T=T.slice(0,S);break}}}x&&!g&&(T=t(T,1/0));var R=O.length+T.length+L.length,F=R<y?new Array(y-R+1).join(d):"";switch(x&&g&&(T=t(F+T,F.length?y-L.length:1/0),F=""),h){case"<":T=O+T+L+F;break;case"=":T=O+F+T+L;break;case"^":T=F.slice(0,R=F.length>>1)+O+T+L+F.slice(R);break;default:T=F+O+T+L;break}return o(T)}return I.toString=function(){return f+""},I}function u(f,d){var h=l((f=vo(f),f.type="f",f)),p=Math.max(-8,Math.min(8,Math.floor(wo(d)/3)))*3,m=Math.pow(10,-p),g=MC[8+p/3];return function(y){return h(m*y)+g}}return{format:l,formatPrefix:u}}var Rx,ci,$x;EI({thousands:",",grouping:[3],currency:["$",""]});function EI(e){return Rx=AC(e),ci=Rx.format,$x=Rx.formatPrefix,Rx}function NI(e){return Math.max(0,-wo(Math.abs(e)))}function DI(e,t){return Math.max(0,Math.max(-8,Math.min(8,Math.floor(wo(t)/3)))*3-wo(Math.abs(e)))}function OI(e,t){return e=Math.abs(e),t=Math.abs(t)-e,Math.max(0,wo(t)-wo(e))+1}var K=1e-6,sl=1e-12,Et=Math.PI,de=Et/2,BI=Et/4,sn=Et*2,Fe=180/Et,Vt=Et/180,Rt=Math.abs,li=Math.atan,Ge=Math.atan2,Q=Math.cos,Ep=Math.ceil,Px=Math.exp;var Ux=Math.hypot,al=Math.log,zx=Math.pow,J=Math.sin,Rn=Math.sign||function(e){return e>0?1:e<0?-1:0},he=Math.sqrt,Gu=Math.tan;function qx(e){return e>1?0:e<-1?Et:Math.acos(e)}function ve(e){return e>1?de:e<-1?-de:Math.asin(e)}function We(){}function jx(e,t){e&&EC.hasOwnProperty(e.type)&&EC[e.type](e,t)}var TC={Feature:function(e,t){jx(e.geometry,t)},FeatureCollection:function(e,t){for(var n=e.features,r=-1,i=n.length;++r<i;)jx(n[r].geometry,t)}},EC={Sphere:function(e,t){t.sphere()},Point:function(e,t){e=e.coordinates,t.point(e[0],e[1],e[2])},MultiPoint:function(e,t){for(var n=e.coordinates,r=-1,i=n.length;++r<i;)e=n[r],t.point(e[0],e[1],e[2])},LineString:function(e,t){LI(e.coordinates,t,0)},MultiLineString:function(e,t){for(var n=e.coordinates,r=-1,i=n.length;++r<i;)LI(n[r],t,0)},Polygon:function(e,t){NC(e.coordinates,t)},MultiPolygon:function(e,t){for(var n=e.coordinates,r=-1,i=n.length;++r<i;)NC(n[r],t)},GeometryCollection:function(e,t){for(var n=e.geometries,r=-1,i=n.length;++r<i;)jx(n[r],t)}};function LI(e,t,n){var r=-1,i=e.length-n,o;for(t.lineStart();++r<i;)o=e[r],t.point(o[0],o[1],o[2]);t.lineEnd()}function NC(e,t){var n=-1,r=e.length;for(t.polygonStart();++n<r;)LI(e[n],t,1);t.polygonEnd()}function $r(e,t){e&&TC.hasOwnProperty(e.type)?TC[e.type](e,t):jx(e,t)}function Np(e){return[Ge(e[1],e[0]),ve(e[2])]}function _o(e){var t=e[0],n=e[1],r=Q(n);return[r*Q(t),r*J(t),J(n)]}function Dp(e,t){return e[0]*t[0]+e[1]*t[1]+e[2]*t[2]}function Wu(e,t){return[e[1]*t[2]-e[2]*t[1],e[2]*t[0]-e[0]*t[2],e[0]*t[1]-e[1]*t[0]]}function Vx(e,t){e[0]+=t[0],e[1]+=t[1],e[2]+=t[2]}function Op(e,t){return[e[0]*t,e[1]*t,e[2]*t]}function Bp(e){var t=he(e[0]*e[0]+e[1]*e[1]+e[2]*e[2]);e[0]/=t,e[1]/=t,e[2]/=t}var Lp,Yx,Xx,Gx,Wx,Hx,Zx,Jx,CI,kI,FI,BC,LC,tr,er,nr,zi={sphere:We,point:RI,lineStart:DC,lineEnd:OC,polygonStart:function(){zi.lineStart=HG,zi.lineEnd=ZG},polygonEnd:function(){zi.lineStart=DC,zi.lineEnd=OC}};function RI(e,t){e*=Vt,t*=Vt;var n=Q(t);Cp(n*Q(e),n*J(e),J(t))}function Cp(e,t,n){++Lp,Xx+=(e-Xx)/Lp,Gx+=(t-Gx)/Lp,Wx+=(n-Wx)/Lp}function DC(){zi.point=GG}function GG(e,t){e*=Vt,t*=Vt;var n=Q(t);tr=n*Q(e),er=n*J(e),nr=J(t),zi.point=WG,Cp(tr,er,nr)}function WG(e,t){e*=Vt,t*=Vt;var n=Q(t),r=n*Q(e),i=n*J(e),o=J(t),s=Ge(he((s=er*o-nr*i)*s+(s=nr*r-tr*o)*s+(s=tr*i-er*r)*s),tr*r+er*i+nr*o);Yx+=s,Hx+=s*(tr+(tr=r)),Zx+=s*(er+(er=i)),Jx+=s*(nr+(nr=o)),Cp(tr,er,nr)}function OC(){zi.point=RI}function HG(){zi.point=JG}function ZG(){CC(BC,LC),zi.point=RI}function JG(e,t){BC=e,LC=t,e*=Vt,t*=Vt,zi.point=CC;var n=Q(t);tr=n*Q(e),er=n*J(e),nr=J(t),Cp(tr,er,nr)}function CC(e,t){e*=Vt,t*=Vt;var n=Q(t),r=n*Q(e),i=n*J(e),o=J(t),s=er*o-nr*i,a=nr*r-tr*o,c=tr*i-er*r,l=Ux(s,a,c),u=ve(l),f=l&&-u/l;CI.add(f*s),kI.add(f*a),FI.add(f*c),Yx+=u,Hx+=u*(tr+(tr=r)),Zx+=u*(er+(er=i)),Jx+=u*(nr+(nr=o)),Cp(tr,er,nr)}function $I(e){Lp=Yx=Xx=Gx=Wx=Hx=Zx=Jx=0,CI=new vn,kI=new vn,FI=new vn,$r(e,zi);var t=+CI,n=+kI,r=+FI,i=Ux(t,n,r);return i<sl&&(t=Hx,n=Zx,r=Jx,Yx<K&&(t=Xx,n=Gx,r=Wx),i=Ux(t,n,r),i<sl)?[NaN,NaN]:[Ge(n,t)*Fe,ve(r/i)*Fe]}function kp(e,t){function n(r,i){return r=e(r,i),t(r[0],r[1])}return e.invert&&t.invert&&(n.invert=function(r,i){return r=t.invert(r,i),r&&e.invert(r[0],r[1])}),n}function PI(e,t){return Rt(e)>Et&&(e-=Math.round(e/sn)*sn),[e,t]}PI.invert=PI;function UI(e,t,n){return(e%=sn)?t||n?kp(FC(e),RC(t,n)):FC(e):t||n?RC(t,n):PI}function kC(e){return function(t,n){return t+=e,Rt(t)>Et&&(t-=Math.round(t/sn)*sn),[t,n]}}function FC(e){var t=kC(e);return t.invert=kC(-e),t}function RC(e,t){var n=Q(e),r=J(e),i=Q(t),o=J(t);function s(a,c){var l=Q(c),u=Q(a)*l,f=J(a)*l,d=J(c),h=d*n+u*r;return[Ge(f*i-h*o,u*n-d*r),ve(h*i+f*o)]}return s.invert=function(a,c){var l=Q(c),u=Q(a)*l,f=J(a)*l,d=J(c),h=d*i-f*o;return[Ge(f*i+d*o,u*n+h*r),ve(h*n-u*r)]},s}function $C(e){e=UI(e[0]*Vt,e[1]*Vt,e.length>2?e[2]*Vt:0);function t(n){return n=e(n[0]*Vt,n[1]*Vt),n[0]*=Fe,n[1]*=Fe,n}return t.invert=function(n){return n=e.invert(n[0]*Vt,n[1]*Vt),n[0]*=Fe,n[1]*=Fe,n},t}function UC(e,t,n,r,i,o){if(n){var s=Q(t),a=J(t),c=r*n;i==null?(i=t+r*sn,o=t-c/2):(i=PC(s,i),o=PC(s,o),(r>0?i<o:i>o)&&(i+=r*sn));for(var l,u=i;r>0?u>o:u<o;u-=c)l=Np([s,-a*Q(u),-a*J(u)]),e.point(l[0],l[1])}}function PC(e,t){t=_o(t),t[0]-=e,Bp(t);var n=qx(-t[1]);return((-t[2]<0?-n:n)+sn-K)%sn}function Qx(){var e=[],t;return{point:function(n,r,i){t.push([n,r,i])},lineStart:function(){e.push(t=[])},lineEnd:We,rejoin:function(){e.length>1&&e.push(e.pop().concat(e.shift()))},result:function(){var n=e;return e=[],t=null,n}}}function Hu(e,t){return Rt(e[0]-t[0])<K&&Rt(e[1]-t[1])<K}function Kx(e,t,n,r){this.x=e,this.z=t,this.o=n,this.e=r,this.v=!1,this.n=this.p=null}function tb(e,t,n,r,i){var o=[],s=[],a,c;if(e.forEach(function(p){if(!((m=p.length-1)<=0)){var m,g=p[0],y=p[m],x;if(Hu(g,y)){if(!g[2]&&!y[2]){for(i.lineStart(),a=0;a<m;++a)i.point((g=p[a])[0],g[1]);i.lineEnd();return}y[0]+=2*K}o.push(x=new Kx(g,p,null,!0)),s.push(x.o=new Kx(g,null,x,!1)),o.push(x=new Kx(y,p,null,!1)),s.push(x.o=new Kx(y,null,x,!0))}}),!!o.length){for(s.sort(t),zC(o),zC(s),a=0,c=s.length;a<c;++a)s[a].e=n=!n;for(var l=o[0],u,f;;){for(var d=l,h=!0;d.v;)if((d=d.n)===l)return;u=d.z,i.lineStart();do{if(d.v=d.o.v=!0,d.e){if(h)for(a=0,c=u.length;a<c;++a)i.point((f=u[a])[0],f[1]);else r(d.x,d.n.x,1,i);d=d.n}else{if(h)for(u=d.p.z,a=u.length-1;a>=0;--a)i.point((f=u[a])[0],f[1]);else r(d.x,d.p.x,-1,i);d=d.p}d=d.o,u=d.z,h=!h}while(!d.v);i.lineEnd()}}}function zC(e){if(t=e.length){for(var t,n=0,r=e[0],i;++n<t;)r.n=i=e[n],i.p=r,r=i;r.n=i=e[0],i.p=r}}function zI(e){return Rt(e[0])<=Et?e[0]:Rn(e[0])*((Rt(e[0])+Et)%sn-Et)}function qC(e,t){var n=zI(t),r=t[1],i=J(r),o=[J(n),-Q(n),0],s=0,a=0,c=new vn;i===1?r=de+K:i===-1&&(r=-de-K);for(var l=0,u=e.length;l<u;++l)if(d=(f=e[l]).length)for(var f,d,h=f[d-1],p=zI(h),m=h[1]/2+BI,g=J(m),y=Q(m),x=0;x<d;++x,p=w,g=v,y=M,h=b){var b=f[x],w=zI(b),_=b[1]/2+BI,v=J(_),M=Q(_),E=w-p,D=E>=0?1:-1,I=D*E,T=I>Et,O=g*v;if(c.add(Ge(O*D*J(I),y*M+O*Q(I))),s+=T?E+D*sn:E,T^p>=n^w>=n){var L=Wu(_o(h),_o(b));Bp(L);var S=Wu(o,L);Bp(S);var A=(T^E>=0?-1:1)*ve(S[2]);(r>A||r===A&&(L[0]||L[1]))&&(a+=T^E>=0?1:-1)}}return(s<-K||s<K&&c<-sl)^a&1}function eb(e,t,n,r){return function(i){var o=t(i),s=Qx(),a=t(s),c=!1,l,u,f,d={point:h,lineStart:m,lineEnd:g,polygonStart:function(){d.point=y,d.lineStart=x,d.lineEnd=b,u=[],l=[]},polygonEnd:function(){d.point=h,d.lineStart=m,d.lineEnd=g,u=Du(u);var w=qC(l,r);u.length?(c||(i.polygonStart(),c=!0),tb(u,KG,w,n,i)):w&&(c||(i.polygonStart(),c=!0),i.lineStart(),n(null,null,1,i),i.lineEnd()),c&&(i.polygonEnd(),c=!1),u=l=null},sphere:function(){i.polygonStart(),i.lineStart(),n(null,null,1,i),i.lineEnd(),i.polygonEnd()}};function h(w,_){e(w,_)&&i.point(w,_)}function p(w,_){o.point(w,_)}function m(){d.point=p,o.lineStart()}function g(){d.point=h,o.lineEnd()}function y(w,_){f.push([w,_]),a.point(w,_)}function x(){a.lineStart(),f=[]}function b(){y(f[0][0],f[0][1]),a.lineEnd();var w=a.clean(),_=s.result(),v,M=_.length,E,D,I;if(f.pop(),l.push(f),f=null,!!M){if(w&1){if(D=_[0],(E=D.length-1)>0){for(c||(i.polygonStart(),c=!0),i.lineStart(),v=0;v<E;++v)i.point((I=D[v])[0],I[1]);i.lineEnd()}return}M>1&&w&2&&_.push(_.pop().concat(_.shift())),u.push(_.filter(QG))}}return d}}function QG(e){return e.length>1}function KG(e,t){return((e=e.x)[0]<0?e[1]-de-K:de-e[1])-((t=t.x)[0]<0?t[1]-de-K:de-t[1])}var qI=eb(function(){return!0},tW,nW,[-Et,-de]);function tW(e){var t=NaN,n=NaN,r=NaN,i;return{lineStart:function(){e.lineStart(),i=1},point:function(o,s){var a=o>0?Et:-Et,c=Rt(o-t);Rt(c-Et)<K?(e.point(t,n=(n+s)/2>0?de:-de),e.point(r,n),e.lineEnd(),e.lineStart(),e.point(a,n),e.point(o,n),i=0):r!==a&&c>=Et&&(Rt(t-r)<K&&(t-=r*K),Rt(o-a)<K&&(o-=a*K),n=eW(t,n,o,s),e.point(r,n),e.lineEnd(),e.lineStart(),e.point(a,n),i=0),e.point(t=o,n=s),r=a},lineEnd:function(){e.lineEnd(),t=n=NaN},clean:function(){return 2-i}}}function eW(e,t,n,r){var i,o,s=J(e-n);return Rt(s)>K?li((J(t)*(o=Q(r))*J(n)-J(r)*(i=Q(t))*J(e))/(i*o*s)):(t+r)/2}function nW(e,t,n,r){var i;if(e==null)i=n*de,r.point(-Et,i),r.point(0,i),r.point(Et,i),r.point(Et,0),r.point(Et,-i),r.point(0,-i),r.point(-Et,-i),r.point(-Et,0),r.point(-Et,i);else if(Rt(e[0]-t[0])>K){var o=e[0]<t[0]?Et:-Et;i=n*o/2,r.point(-o,i),r.point(0,i),r.point(o,i)}else r.point(t[0],t[1])}function jC(e){var t=Q(e),n=6*Vt,r=t>0,i=Rt(t)>K;function o(u,f,d,h){UC(h,e,n,d,u,f)}function s(u,f){return Q(u)*Q(f)>t}function a(u){var f,d,h,p,m;return{lineStart:function(){p=h=!1,m=1},point:function(g,y){var x=[g,y],b,w=s(g,y),_=r?w?0:l(g,y):w?l(g+(g<0?Et:-Et),y):0;if(!f&&(p=h=w)&&u.lineStart(),w!==h&&(b=c(f,x),(!b||Hu(f,b)||Hu(x,b))&&(x[2]=1)),w!==h)m=0,w?(u.lineStart(),b=c(x,f),u.point(b[0],b[1])):(b=c(f,x),u.point(b[0],b[1],2),u.lineEnd()),f=b;else if(i&&f&&r^w){var v;!(_&d)&&(v=c(x,f,!0))&&(m=0,r?(u.lineStart(),u.point(v[0][0],v[0][1]),u.point(v[1][0],v[1][1]),u.lineEnd()):(u.point(v[1][0],v[1][1]),u.lineEnd(),u.lineStart(),u.point(v[0][0],v[0][1],3)))}w&&(!f||!Hu(f,x))&&u.point(x[0],x[1]),f=x,h=w,d=_},lineEnd:function(){h&&u.lineEnd(),f=null},clean:function(){return m|(p&&h)<<1}}}function c(u,f,d){var h=_o(u),p=_o(f),m=[1,0,0],g=Wu(h,p),y=Dp(g,g),x=g[0],b=y-x*x;if(!b)return!d&&u;var w=t*y/b,_=-t*x/b,v=Wu(m,g),M=Op(m,w),E=Op(g,_);Vx(M,E);var D=v,I=Dp(M,D),T=Dp(D,D),O=I*I-T*(Dp(M,M)-1);if(!(O<0)){var L=he(O),S=Op(D,(-I-L)/T);if(Vx(S,M),S=Np(S),!d)return S;var A=u[0],N=f[0],k=u[1],R=f[1],F;N<A&&(F=A,A=N,N=F);var $=N-A,P=Rt($-Et)<K,U=P||$<K;if(!P&&R<k&&(F=k,k=R,R=F),U?P?k+R>0^S[1]<(Rt(S[0]-A)<K?k:R):k<=S[1]&&S[1]<=R:$>Et^(A<=S[0]&&S[0]<=N)){var W=Op(D,(-I+L)/T);return Vx(W,M),[S,Np(W)]}}}function l(u,f){var d=r?e:Et-e,h=0;return u<-d?h|=1:u>d&&(h|=2),f<-d?h|=4:f>d&&(h|=8),h}return eb(s,a,o,r?[0,-e]:[-Et,e-Et])}function VC(e,t,n,r,i,o){var s=e[0],a=e[1],c=t[0],l=t[1],u=0,f=1,d=c-s,h=l-a,p;if(p=n-s,!(!d&&p>0)){if(p/=d,d<0){if(p<u)return;p<f&&(f=p)}else if(d>0){if(p>f)return;p>u&&(u=p)}if(p=i-s,!(!d&&p<0)){if(p/=d,d<0){if(p>f)return;p>u&&(u=p)}else if(d>0){if(p<u)return;p<f&&(f=p)}if(p=r-a,!(!h&&p>0)){if(p/=h,h<0){if(p<u)return;p<f&&(f=p)}else if(h>0){if(p>f)return;p>u&&(u=p)}if(p=o-a,!(!h&&p<0)){if(p/=h,h<0){if(p>f)return;p>u&&(u=p)}else if(h>0){if(p<u)return;p<f&&(f=p)}return u>0&&(e[0]=s+u*d,e[1]=a+u*h),f<1&&(t[0]=s+f*d,t[1]=a+f*h),!0}}}}}var Fp=1e9,nb=-Fp;function Zu(e,t,n,r){function i(l,u){return e<=l&&l<=n&&t<=u&&u<=r}function o(l,u,f,d){var h=0,p=0;if(l==null||(h=s(l,f))!==(p=s(u,f))||c(l,u)<0^f>0)do d.point(h===0||h===3?e:n,h>1?r:t);while((h=(h+f+4)%4)!==p);else d.point(u[0],u[1])}function s(l,u){return Rt(l[0]-e)<K?u>0?0:3:Rt(l[0]-n)<K?u>0?2:1:Rt(l[1]-t)<K?u>0?1:0:u>0?3:2}function a(l,u){return c(l.x,u.x)}function c(l,u){var f=s(l,1),d=s(u,1);return f!==d?f-d:f===0?u[1]-l[1]:f===1?l[0]-u[0]:f===2?l[1]-u[1]:u[0]-l[0]}return function(l){var u=l,f=Qx(),d,h,p,m,g,y,x,b,w,_,v,M={point:E,lineStart:O,lineEnd:L,polygonStart:I,polygonEnd:T};function E(A,N){i(A,N)&&u.point(A,N)}function D(){for(var A=0,N=0,k=h.length;N<k;++N)for(var R=h[N],F=1,$=R.length,P=R[0],U,W,tt=P[0],nt=P[1];F<$;++F)U=tt,W=nt,P=R[F],tt=P[0],nt=P[1],W<=r?nt>r&&(tt-U)*(r-W)>(nt-W)*(e-U)&&++A:nt<=r&&(tt-U)*(r-W)<(nt-W)*(e-U)&&--A;return A}function I(){u=f,d=[],h=[],v=!0}function T(){var A=D(),N=v&&A,k=(d=Du(d)).length;(N||k)&&(l.polygonStart(),N&&(l.lineStart(),o(null,null,1,l),l.lineEnd()),k&&tb(d,a,A,o,l),l.polygonEnd()),u=l,d=h=p=null}function O(){M.point=S,h&&h.push(p=[]),_=!0,w=!1,x=b=NaN}function L(){d&&(S(m,g),y&&w&&f.rejoin(),d.push(f.result())),M.point=E,w&&u.lineEnd()}function S(A,N){var k=i(A,N);if(h&&p.push([A,N]),_)m=A,g=N,y=k,_=!1,k&&(u.lineStart(),u.point(A,N));else if(k&&w)u.point(A,N);else{var R=[x=Math.max(nb,Math.min(Fp,x)),b=Math.max(nb,Math.min(Fp,b))],F=[A=Math.max(nb,Math.min(Fp,A)),N=Math.max(nb,Math.min(Fp,N))];VC(R,F,e,t,n,r)?(w||(u.lineStart(),u.point(R[0],R[1])),u.point(F[0],F[1]),k||u.lineEnd(),v=!1):k&&(u.lineStart(),u.point(A,N),v=!1)}x=A,b=N,w=k}return M}}function YC(e,t,n){var r=Pe(e,t-K,n).concat(t);return function(i){return r.map(function(o){return[i,o]})}}function XC(e,t,n){var r=Pe(e,t-K,n).concat(t);return function(i){return r.map(function(o){return[o,i]})}}function jI(){var e,t,n,r,i,o,s,a,c=10,l=c,u=90,f=360,d,h,p,m,g=2.5;function y(){return{type:"MultiLineString",coordinates:x()}}function x(){return Pe(Ep(r/u)*u,n,u).map(p).concat(Pe(Ep(a/f)*f,s,f).map(m)).concat(Pe(Ep(t/c)*c,e,c).filter(function(b){return Rt(b%u)>K}).map(d)).concat(Pe(Ep(o/l)*l,i,l).filter(function(b){return Rt(b%f)>K}).map(h))}return y.lines=function(){return x().map(function(b){return{type:"LineString",coordinates:b}})},y.outline=function(){return{type:"Polygon",coordinates:[p(r).concat(m(s).slice(1),p(n).reverse().slice(1),m(a).reverse().slice(1))]}},y.extent=function(b){return arguments.length?y.extentMajor(b).extentMinor(b):y.extentMinor()},y.extentMajor=function(b){return arguments.length?(r=+b[0][0],n=+b[1][0],a=+b[0][1],s=+b[1][1],r>n&&(b=r,r=n,n=b),a>s&&(b=a,a=s,s=b),y.precision(g)):[[r,a],[n,s]]},y.extentMinor=function(b){return arguments.length?(t=+b[0][0],e=+b[1][0],o=+b[0][1],i=+b[1][1],t>e&&(b=t,t=e,e=b),o>i&&(b=o,o=i,i=b),y.precision(g)):[[t,o],[e,i]]},y.step=function(b){return arguments.length?y.stepMajor(b).stepMinor(b):y.stepMinor()},y.stepMajor=function(b){return arguments.length?(u=+b[0],f=+b[1],y):[u,f]},y.stepMinor=function(b){return arguments.length?(c=+b[0],l=+b[1],y):[c,l]},y.precision=function(b){return arguments.length?(g=+b,d=YC(o,i,90),h=XC(t,e,g),p=YC(a,s,90),m=XC(r,n,g),y):g},y.extentMajor([[-180,-90+K],[180,90-K]]).extentMinor([[-180,-80-K],[180,80+K]])}function VI(){return jI()()}var Rp=e=>e;var YI=new vn,XI=new vn,GC,WC,GI,WI,Ua={point:We,lineStart:We,lineEnd:We,polygonStart:function(){Ua.lineStart=rW,Ua.lineEnd=oW},polygonEnd:function(){Ua.lineStart=Ua.lineEnd=Ua.point=We,YI.add(Rt(XI)),XI=new vn},result:function(){var e=YI/2;return YI=new vn,e}};function rW(){Ua.point=iW}function iW(e,t){Ua.point=HC,GC=GI=e,WC=WI=t}function HC(e,t){XI.add(WI*e-GI*t),GI=e,WI=t}function oW(){HC(GC,WC)}var HI=Ua;var Ju=1/0,rb=Ju,$p=-Ju,ib=$p,sW={point:aW,lineStart:We,lineEnd:We,polygonStart:We,polygonEnd:We,result:function(){var e=[[Ju,rb],[$p,ib]];return $p=ib=-(rb=Ju=1/0),e}};function aW(e,t){e<Ju&&(Ju=e),e>$p&&($p=e),t<rb&&(rb=t),t>ib&&(ib=t)}var Qu=sW;var ZI=0,JI=0,Pp=0,ob=0,sb=0,Ku=0,QI=0,KI=0,Up=0,QC,KC,So,Io,qi={point:cl,lineStart:ZC,lineEnd:JC,polygonStart:function(){qi.lineStart=uW,qi.lineEnd=fW},polygonEnd:function(){qi.point=cl,qi.lineStart=ZC,qi.lineEnd=JC},result:function(){var e=Up?[QI/Up,KI/Up]:Ku?[ob/Ku,sb/Ku]:Pp?[ZI/Pp,JI/Pp]:[NaN,NaN];return ZI=JI=Pp=ob=sb=Ku=QI=KI=Up=0,e}};function cl(e,t){ZI+=e,JI+=t,++Pp}function ZC(){qi.point=cW}function cW(e,t){qi.point=lW,cl(So=e,Io=t)}function lW(e,t){var n=e-So,r=t-Io,i=he(n*n+r*r);ob+=i*(So+e)/2,sb+=i*(Io+t)/2,Ku+=i,cl(So=e,Io=t)}function JC(){qi.point=cl}function uW(){qi.point=dW}function fW(){tk(QC,KC)}function dW(e,t){qi.point=tk,cl(QC=So=e,KC=Io=t)}function tk(e,t){var n=e-So,r=t-Io,i=he(n*n+r*r);ob+=i*(So+e)/2,sb+=i*(Io+t)/2,Ku+=i,i=Io*e-So*t,QI+=i*(So+e),KI+=i*(Io+t),Up+=i*3,cl(So=e,Io=t)}var tM=qi;function ab(e){this._context=e}ab.prototype={_radius:4.5,pointRadius:function(e){return this._radius=e,this},polygonStart:function(){this._line=0},polygonEnd:function(){this._line=NaN},lineStart:function(){this._point=0},lineEnd:function(){this._line===0&&this._context.closePath(),this._point=NaN},point:function(e,t){switch(this._point){case 0:{this._context.moveTo(e,t),this._point=1;break}case 1:{this._context.lineTo(e,t);break}default:{this._context.moveTo(e+this._radius,t),this._context.arc(e,t,this._radius,0,sn);break}}},result:We};var nM=new vn,eM,ek,nk,zp,qp,cb={point:We,lineStart:function(){cb.point=hW},lineEnd:function(){eM&&rk(ek,nk),cb.point=We},polygonStart:function(){eM=!0},polygonEnd:function(){eM=null},result:function(){var e=+nM;return nM=new vn,e}};function hW(e,t){cb.point=rk,ek=zp=e,nk=qp=t}function rk(e,t){zp-=e,qp-=t,nM.add(he(zp*zp+qp*qp)),zp=e,qp=t}var rM=cb;var ik,lb,ok,sk,tf=class{constructor(t){this._append=t==null?ak:pW(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(){this._line===0&&(this._+="Z"),this._point=NaN}point(t,n){switch(this._point){case 0:{this._append`M${t},${n}`,this._point=1;break}case 1:{this._append`L${t},${n}`;break}default:{if(this._append`M${t},${n}`,this._radius!==ok||this._append!==lb){let r=this._radius,i=this._;this._="",this._append`m0,${r}a${r},${r} 0 1,1 0,${-2*r}a${r},${r} 0 1,1 0,${2*r}z`,ok=r,lb=this._append,sk=this._,this._=i}this._+=sk;break}}}result(){let t=this._;return this._="",t.length?t:null}};function ak(e){let t=1;this._+=e[0];for(let n=e.length;t<n;++t)this._+=arguments[t]+e[t]}function pW(e){let t=Math.floor(e);if(!(t>=0))throw new RangeError(`invalid digits: ${e}`);if(t>15)return ak;if(t!==ik){let n=10**t;ik=t,lb=function(i){let o=1;this._+=i[0];for(let s=i.length;o<s;++o)this._+=Math.round(arguments[o]*n)/n+i[o]}}return lb}function Mn(e,t){let n=3,r=4.5,i,o;function s(a){return a&&(typeof r=="function"&&o.pointRadius(+r.apply(this,arguments)),$r(a,i(o))),o.result()}return s.area=function(a){return $r(a,i(HI)),HI.result()},s.measure=function(a){return $r(a,i(rM)),rM.result()},s.bounds=function(a){return $r(a,i(Qu)),Qu.result()},s.centroid=function(a){return $r(a,i(tM)),tM.result()},s.projection=function(a){return arguments.length?(i=a==null?(e=null,Rp):(e=a).stream,s):e},s.context=function(a){return arguments.length?(o=a==null?(t=null,new tf(n)):new ab(t=a),typeof r!="function"&&o.pointRadius(r),s):t},s.pointRadius=function(a){return arguments.length?(r=typeof a=="function"?a:(o.pointRadius(+a),+a),s):r},s.digits=function(a){if(!arguments.length)return n;if(a==null)n=null;else{let c=Math.floor(a);if(!(c>=0))throw new RangeError(`invalid digits: ${a}`);n=c}return t===null&&(o=new tf(n)),s},s.projection(e).digits(n).context(t)}function ll(e){return{stream:ef(e)}}function ef(e){return function(t){var n=new iM;for(var r in e)n[r]=e[r];return n.stream=t,n}}function iM(){}iM.prototype={constructor:iM,point:function(e,t){this.stream.point(e,t)},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()}};function oM(e,t,n){var r=e.clipExtent&&e.clipExtent();return e.scale(150).translate([0,0]),r!=null&&e.clipExtent(null),$r(n,e.stream(Qu)),t(Qu.result()),r!=null&&e.clipExtent(r),e}function jp(e,t,n){return oM(e,function(r){var i=t[1][0]-t[0][0],o=t[1][1]-t[0][1],s=Math.min(i/(r[1][0]-r[0][0]),o/(r[1][1]-r[0][1])),a=+t[0][0]+(i-s*(r[1][0]+r[0][0]))/2,c=+t[0][1]+(o-s*(r[1][1]+r[0][1]))/2;e.scale(150*s).translate([a,c])},n)}function ub(e,t,n){return jp(e,[[0,0],t],n)}function fb(e,t,n){return oM(e,function(r){var i=+t,o=i/(r[1][0]-r[0][0]),s=(i-o*(r[1][0]+r[0][0]))/2,a=-o*r[0][1];e.scale(150*o).translate([s,a])},n)}function db(e,t,n){return oM(e,function(r){var i=+t,o=i/(r[1][1]-r[0][1]),s=-o*r[0][0],a=(i-o*(r[1][1]+r[0][1]))/2;e.scale(150*o).translate([s,a])},n)}var ck=16,mW=Q(30*Vt);function sM(e,t){return+t?gW(e,t):yW(e)}function yW(e){return ef({point:function(t,n){t=e(t,n),this.stream.point(t[0],t[1])}})}function gW(e,t){function n(r,i,o,s,a,c,l,u,f,d,h,p,m,g){var y=l-r,x=u-i,b=y*y+x*x;if(b>4*t&&m--){var w=s+d,_=a+h,v=c+p,M=he(w*w+_*_+v*v),E=ve(v/=M),D=Rt(Rt(v)-1)<K||Rt(o-f)<K?(o+f)/2:Ge(_,w),I=e(D,E),T=I[0],O=I[1],L=T-r,S=O-i,A=x*L-y*S;(A*A/b>t||Rt((y*L+x*S)/b-.5)>.3||s*d+a*h+c*p<mW)&&(n(r,i,o,s,a,c,T,O,D,w/=M,_/=M,v,m,g),g.point(T,O),n(T,O,D,w,_,v,l,u,f,d,h,p,m,g))}}return function(r){var i,o,s,a,c,l,u,f,d,h,p,m,g={point:y,lineStart:x,lineEnd:w,polygonStart:function(){r.polygonStart(),g.lineStart=_},polygonEnd:function(){r.polygonEnd(),g.lineStart=x}};function y(E,D){E=e(E,D),r.point(E[0],E[1])}function x(){f=NaN,g.point=b,r.lineStart()}function b(E,D){var I=_o([E,D]),T=e(E,D);n(f,d,u,h,p,m,f=T[0],d=T[1],u=E,h=I[0],p=I[1],m=I[2],ck,r),r.point(f,d)}function w(){g.point=y,r.lineEnd()}function _(){x(),g.point=v,g.lineEnd=M}function v(E,D){b(i=E,D),o=f,s=d,a=h,c=p,l=m,g.point=b}function M(){n(f,d,u,h,p,m,o,s,i,a,c,l,ck,r),g.lineEnd=w,w()}return g}}var xW=ef({point:function(e,t){this.stream.point(e*Vt,t*Vt)}});function bW(e){return ef({point:function(t,n){var r=e(t,n);return this.stream.point(r[0],r[1])}})}function wW(e,t,n,r,i){function o(s,a){return s*=r,a*=i,[t+e*s,n-e*a]}return o.invert=function(s,a){return[(s-t)/e*r,(n-a)/e*i]},o}function lk(e,t,n,r,i,o){if(!o)return wW(e,t,n,r,i);var s=Q(o),a=J(o),c=s*e,l=a*e,u=s/e,f=a/e,d=(a*n-s*t)/e,h=(a*t+s*n)/e;function p(m,g){return m*=r,g*=i,[c*m-l*g+t,n-l*m-c*g]}return p.invert=function(m,g){return[r*(u*m-f*g+d),i*(h-f*m-u*g)]},p}function An(e){return aM(function(){return e})()}function aM(e){var t,n=150,r=480,i=250,o=0,s=0,a=0,c=0,l=0,u,f=0,d=1,h=1,p=null,m=qI,g=null,y,x,b,w=Rp,_=.5,v,M,E,D,I;function T(A){return E(A[0]*Vt,A[1]*Vt)}function O(A){return A=E.invert(A[0],A[1]),A&&[A[0]*Fe,A[1]*Fe]}T.stream=function(A){return D&&I===A?D:D=xW(bW(u)(m(v(w(I=A)))))},T.preclip=function(A){return arguments.length?(m=A,p=void 0,S()):m},T.postclip=function(A){return arguments.length?(w=A,g=y=x=b=null,S()):w},T.clipAngle=function(A){return arguments.length?(m=+A?jC(p=A*Vt):(p=null,qI),S()):p*Fe},T.clipExtent=function(A){return arguments.length?(w=A==null?(g=y=x=b=null,Rp):Zu(g=+A[0][0],y=+A[0][1],x=+A[1][0],b=+A[1][1]),S()):g==null?null:[[g,y],[x,b]]},T.scale=function(A){return arguments.length?(n=+A,L()):n},T.translate=function(A){return arguments.length?(r=+A[0],i=+A[1],L()):[r,i]},T.center=function(A){return arguments.length?(o=A[0]%360*Vt,s=A[1]%360*Vt,L()):[o*Fe,s*Fe]},T.rotate=function(A){return arguments.length?(a=A[0]%360*Vt,c=A[1]%360*Vt,l=A.length>2?A[2]%360*Vt:0,L()):[a*Fe,c*Fe,l*Fe]},T.angle=function(A){return arguments.length?(f=A%360*Vt,L()):f*Fe},T.reflectX=function(A){return arguments.length?(d=A?-1:1,L()):d<0},T.reflectY=function(A){return arguments.length?(h=A?-1:1,L()):h<0},T.precision=function(A){return arguments.length?(v=sM(M,_=A*A),S()):he(_)},T.fitExtent=function(A,N){return jp(T,A,N)},T.fitSize=function(A,N){return ub(T,A,N)},T.fitWidth=function(A,N){return fb(T,A,N)},T.fitHeight=function(A,N){return db(T,A,N)};function L(){var A=lk(n,0,0,d,h,f).apply(null,t(o,s)),N=lk(n,r-A[0],i-A[1],d,h,f);return u=UI(a,c,l),M=kp(t,N),E=kp(u,M),v=sM(M,_),S()}function S(){return D=I=null,T}return function(){return t=e.apply(this,arguments),T.invert=t.invert&&O,L()}}function nf(e){var t=0,n=Et/3,r=aM(e),i=r(t,n);return i.parallels=function(o){return arguments.length?r(t=o[0]*Vt,n=o[1]*Vt):[t*Fe,n*Fe]},i}function uk(e){var t=Q(e);function n(r,i){return[r*t,J(i)/t]}return n.invert=function(r,i){return[r/t,ve(i*t)]},n}function fk(e,t){var n=J(e),r=(n+J(t))/2;if(Rt(r)<K)return uk(e);var i=1+n*(2*r-n),o=he(i)/r;function s(a,c){var l=he(i-2*r*J(c))/r;return[l*J(a*=r),o-l*Q(a)]}return s.invert=function(a,c){var l=o-c,u=Ge(a,Rt(l))*Rn(l);return l*r<0&&(u-=Et*Rn(a)*Rn(l)),[u/r,ve((i-(a*a+l*l)*r*r)/(2*r))]},s}function za(){return nf(fk).scale(155.424).center([0,33.6442])}function Vp(){return za().parallels([29.5,45.5]).scale(1070).translate([480,250]).rotate([96,0]).center([-.6,38.7])}function vW(e){var t=e.length;return{point:function(n,r){for(var i=-1;++i<t;)e[i].point(n,r)},sphere:function(){for(var n=-1;++n<t;)e[n].sphere()},lineStart:function(){for(var n=-1;++n<t;)e[n].lineStart()},lineEnd:function(){for(var n=-1;++n<t;)e[n].lineEnd()},polygonStart:function(){for(var n=-1;++n<t;)e[n].polygonStart()},polygonEnd:function(){for(var n=-1;++n<t;)e[n].polygonEnd()}}}function cM(){var e,t,n=Vp(),r,i=za().rotate([154,0]).center([-2,58.5]).parallels([55,65]),o,s=za().rotate([157,0]).center([-3,19.9]).parallels([8,18]),a,c,l={point:function(d,h){c=[d,h]}};function u(d){var h=d[0],p=d[1];return c=null,r.point(h,p),c||(o.point(h,p),c)||(a.point(h,p),c)}u.invert=function(d){var h=n.scale(),p=n.translate(),m=(d[0]-p[0])/h,g=(d[1]-p[1])/h;return(g>=.12&&g<.234&&m>=-.425&&m<-.214?i:g>=.166&&g<.234&&m>=-.214&&m<-.115?s:n).invert(d)},u.stream=function(d){return e&&t===d?e:e=vW([n.stream(t=d),i.stream(d),s.stream(d)])},u.precision=function(d){return arguments.length?(n.precision(d),i.precision(d),s.precision(d),f()):n.precision()},u.scale=function(d){return arguments.length?(n.scale(d),i.scale(d*.35),s.scale(d),u.translate(n.translate())):n.scale()},u.translate=function(d){if(!arguments.length)return n.translate();var h=n.scale(),p=+d[0],m=+d[1];return r=n.translate(d).clipExtent([[p-.455*h,m-.238*h],[p+.455*h,m+.238*h]]).stream(l),o=i.translate([p-.307*h,m+.201*h]).clipExtent([[p-.425*h+K,m+.12*h+K],[p-.214*h-K,m+.234*h-K]]).stream(l),a=s.translate([p-.205*h,m+.212*h]).clipExtent([[p-.214*h+K,m+.166*h+K],[p-.115*h-K,m+.234*h-K]]).stream(l),f()},u.fitExtent=function(d,h){return jp(u,d,h)},u.fitSize=function(d,h){return ub(u,d,h)},u.fitWidth=function(d,h){return fb(u,d,h)},u.fitHeight=function(d,h){return db(u,d,h)};function f(){return e=t=null,u}return u.scale(1070)}function hb(e){return function(t,n){var r=Q(t),i=Q(n),o=e(r*i);return o===1/0?[2,0]:[o*i*J(t),o*J(n)]}}function Mo(e){return function(t,n){var r=he(t*t+n*n),i=e(r),o=J(i),s=Q(i);return[Ge(t*o,r*s),ve(r&&n*o/r)]}}var lM=hb(function(e){return he(2/(1+e))});lM.invert=Mo(function(e){return 2*ve(e/2)});function uM(){return An(lM).scale(124.75).clipAngle(180-.001)}var fM=hb(function(e){return(e=qx(e))&&e/J(e)});fM.invert=Mo(function(e){return e});function dM(){return An(fM).scale(79.4188).clipAngle(180-.001)}function rf(e,t){return[e,al(Gu((de+t)/2))]}rf.invert=function(e,t){return[e,2*li(Px(t))-de]};function hM(){return pM(rf).scale(961/sn)}function pM(e){var t=An(e),n=t.center,r=t.scale,i=t.translate,o=t.clipExtent,s=null,a,c,l;t.scale=function(f){return arguments.length?(r(f),u()):r()},t.translate=function(f){return arguments.length?(i(f),u()):i()},t.center=function(f){return arguments.length?(n(f),u()):n()},t.clipExtent=function(f){return arguments.length?(f==null?s=a=c=l=null:(s=+f[0][0],a=+f[0][1],c=+f[1][0],l=+f[1][1]),u()):s==null?null:[[s,a],[c,l]]};function u(){var f=Et*r(),d=t($C(t.rotate()).invert([0,0]));return o(s==null?[[d[0]-f,d[1]-f],[d[0]+f,d[1]+f]]:e===rf?[[Math.max(d[0]-f,s),a],[Math.min(d[0]+f,c),l]]:[[s,Math.max(d[1]-f,a)],[c,Math.min(d[1]+f,l)]])}return u()}function pb(e){return Gu((de+e)/2)}function dk(e,t){var n=Q(e),r=e===t?J(e):al(n/Q(t))/al(pb(t)/pb(e)),i=n*zx(pb(e),r)/r;if(!r)return rf;function o(s,a){i>0?a<-de+K&&(a=-de+K):a>de-K&&(a=de-K);var c=i/zx(pb(a),r);return[c*J(r*s),i-c*Q(r*s)]}return o.invert=function(s,a){var c=i-a,l=Rn(r)*he(s*s+c*c),u=Ge(s,Rt(c))*Rn(c);return c*r<0&&(u-=Et*Rn(s)*Rn(c)),[u/r,2*li(zx(i/l,1/r))-de]},o}function mM(){return nf(dk).scale(109.5).parallels([30,30])}function of(e,t){return[e,t]}of.invert=of;function yM(){return An(of).scale(152.63)}function hk(e,t){var n=Q(e),r=e===t?J(e):(n-Q(t))/(t-e),i=n/r+e;if(Rt(r)<K)return of;function o(s,a){var c=i-a,l=r*s;return[c*J(l),i-c*Q(l)]}return o.invert=function(s,a){var c=i-a,l=Ge(s,Rt(c))*Rn(c);return c*r<0&&(l-=Et*Rn(s)*Rn(c)),[l/r,i-Rn(r)*he(s*s+c*c)]},o}function gM(){return nf(hk).scale(131.154).center([0,13.9389])}var Yp=1.340264,Xp=-.081106,Gp=893e-6,Wp=.003796,mb=he(3)/2,_W=12;function xM(e,t){var n=ve(mb*J(t)),r=n*n,i=r*r*r;return[e*Q(n)/(mb*(Yp+3*Xp*r+i*(7*Gp+9*Wp*r))),n*(Yp+Xp*r+i*(Gp+Wp*r))]}xM.invert=function(e,t){for(var n=t,r=n*n,i=r*r*r,o=0,s,a,c;o<_W&&(a=n*(Yp+Xp*r+i*(Gp+Wp*r))-t,c=Yp+3*Xp*r+i*(7*Gp+9*Wp*r),n-=s=a/c,r=n*n,i=r*r*r,!(Rt(s)<sl));++o);return[mb*e*(Yp+3*Xp*r+i*(7*Gp+9*Wp*r))/Q(n),ve(J(n)/mb)]};function bM(){return An(xM).scale(177.158)}function wM(e,t){var n=Q(t),r=Q(e)*n;return[n*J(e)/r,J(t)/r]}wM.invert=Mo(li);function vM(){return An(wM).scale(144.049).clipAngle(60)}function _M(e,t){return[Q(t)*J(e),J(t)]}_M.invert=Mo(ve);function SM(){return An(_M).scale(249.5).clipAngle(90+K)}function IM(e,t){var n=Q(t),r=1+Q(e)*n;return[n*J(e)/r,J(t)/r]}IM.invert=Mo(function(e){return 2*li(e)});function MM(){return An(IM).scale(250).clipAngle(142)}function AM(e,t){return[al(Gu((de+t)/2)),-e]}AM.invert=function(e,t){return[-t,2*li(Px(e))-de]};function TM(){var e=pM(AM),t=e.center,n=e.rotate;return e.center=function(r){return arguments.length?t([-r[1],r[0]]):(r=t(),[r[1],-r[0]])},e.rotate=function(r){return arguments.length?n([r[0],r[1],r.length>2?r[2]+90:90]):(r=n(),[r[0],r[1],r[2]-90])},n([0,0,90]).scale(159.155)}function SW(e,t){return e.parent===t.parent?1:2}function IW(e){return e.reduce(MW,0)/e.length}function MW(e,t){return e+t.x}function AW(e){return 1+e.reduce(TW,0)}function TW(e,t){return Math.max(e,t.y)}function EW(e){for(var t;t=e.children;)e=t[0];return e}function NW(e){for(var t;t=e.children;)e=t[t.length-1];return e}function yb(){var e=SW,t=1,n=1,r=!1;function i(o){var s,a=0;o.eachAfter(function(d){var h=d.children;h?(d.x=IW(h),d.y=AW(h)):(d.x=s?a+=e(d,s):0,d.y=0,s=d)});var c=EW(o),l=NW(o),u=c.x-e(c,l)/2,f=l.x+e(l,c)/2;return o.eachAfter(r?function(d){d.x=(d.x-o.x)*t,d.y=(o.y-d.y)*n}:function(d){d.x=(d.x-u)/(f-u)*t,d.y=(1-(o.y?d.y/o.y:1))*n})}return i.separation=function(o){return arguments.length?(e=o,i):e},i.size=function(o){return arguments.length?(r=!1,t=+o[0],n=+o[1],i):r?null:[t,n]},i.nodeSize=function(o){return arguments.length?(r=!0,t=+o[0],n=+o[1],i):r?[t,n]:null},i}function DW(e){var t=0,n=e.children,r=n&&n.length;if(!r)t=1;else for(;--r>=0;)t+=n[r].value;e.value=t}function pk(){return this.eachAfter(DW)}function mk(e,t){let n=-1;for(let r of this)e.call(t,r,++n,this);return this}function yk(e,t){for(var n=this,r=[n],i,o,s=-1;n=r.pop();)if(e.call(t,n,++s,this),i=n.children)for(o=i.length-1;o>=0;--o)r.push(i[o]);return this}function gk(e,t){for(var n=this,r=[n],i=[],o,s,a,c=-1;n=r.pop();)if(i.push(n),o=n.children)for(s=0,a=o.length;s<a;++s)r.push(o[s]);for(;n=i.pop();)e.call(t,n,++c,this);return this}function xk(e,t){let n=-1;for(let r of this)if(e.call(t,r,++n,this))return r}function bk(e){return this.eachAfter(function(t){for(var n=+e(t.data)||0,r=t.children,i=r&&r.length;--i>=0;)n+=r[i].value;t.value=n})}function wk(e){return this.eachBefore(function(t){t.children&&t.children.sort(e)})}function vk(e){for(var t=this,n=OW(t,e),r=[t];t!==n;)t=t.parent,r.push(t);for(var i=r.length;e!==n;)r.splice(i,0,e),e=e.parent;return r}function OW(e,t){if(e===t)return e;var n=e.ancestors(),r=t.ancestors(),i=null;for(e=n.pop(),t=r.pop();e===t;)i=e,e=n.pop(),t=r.pop();return i}function _k(){for(var e=this,t=[e];e=e.parent;)t.push(e);return t}function Sk(){return Array.from(this)}function Ik(){var e=[];return this.eachBefore(function(t){t.children||e.push(t)}),e}function Mk(){var e=this,t=[];return e.each(function(n){n!==e&&t.push({source:n.parent,target:n})}),t}function*Ak(){var e=this,t,n=[e],r,i,o;do for(t=n.reverse(),n=[];e=t.pop();)if(yield e,r=e.children)for(i=0,o=r.length;i<o;++i)n.push(r[i]);while(n.length)}function EM(e,t){e instanceof Map?(e=[void 0,e],t===void 0&&(t=CW)):t===void 0&&(t=LW);for(var n=new qa(e),r,i=[n],o,s,a,c;r=i.pop();)if((s=t(r.data))&&(c=(s=Array.from(s)).length))for(r.children=s,a=c-1;a>=0;--a)i.push(o=s[a]=new qa(s[a])),o.parent=r,o.depth=r.depth+1;return n.eachBefore(NM)}function BW(){return EM(this).eachBefore(kW)}function LW(e){return e.children}function CW(e){return Array.isArray(e)?e[1]:null}function kW(e){e.data.value!==void 0&&(e.value=e.data.value),e.data=e.data.data}function NM(e){var t=0;do e.height=t;while((e=e.parent)&&e.height<++t)}function qa(e){this.data=e,this.depth=this.height=0,this.parent=null}qa.prototype=EM.prototype={constructor:qa,count:pk,each:mk,eachAfter:gk,eachBefore:yk,find:xk,sum:bk,sort:wk,path:vk,ancestors:_k,descendants:Sk,leaves:Ik,links:Mk,copy:BW,[Symbol.iterator]:Ak};function gb(e){return e==null?null:FW(e)}function FW(e){if(typeof e!="function")throw new Error;return e}var RW={depth:-1},Tk={},DM={};function $W(e){return e.id}function PW(e){return e.parentId}function xb(){var e=$W,t=PW,n;function r(i){var o=Array.from(i),s=e,a=t,c,l,u,f,d,h,p,m,g=new Map;if(n!=null){let y=o.map((w,_)=>UW(n(w,_,i))),x=y.map(Ek),b=new Set(y).add("");for(let w of x)b.has(w)||(b.add(w),y.push(w),x.push(Ek(w)),o.push(DM));s=(w,_)=>y[_],a=(w,_)=>x[_]}for(u=0,c=o.length;u<c;++u)l=o[u],h=o[u]=new qa(l),(p=s(l,u,i))!=null&&(p+="")&&(m=h.id=p,g.set(m,g.has(m)?Tk:h)),(p=a(l,u,i))!=null&&(p+="")&&(h.parent=p);for(u=0;u<c;++u)if(h=o[u],p=h.parent){if(d=g.get(p),!d)throw new Error("missing: "+p);if(d===Tk)throw new Error("ambiguous: "+p);d.children?d.children.push(h):d.children=[h],h.parent=d}else{if(f)throw new Error("multiple roots");f=h}if(!f)throw new Error("no root");if(n!=null){for(;f.data===DM&&f.children.length===1;)f=f.children[0],--c;for(let y=o.length-1;y>=0&&(h=o[y],h.data===DM);--y)h.data=null}if(f.parent=RW,f.eachBefore(function(y){y.depth=y.parent.depth+1,--c}).eachBefore(NM),f.parent=null,c>0)throw new Error("cycle");return f}return r.id=function(i){return arguments.length?(e=gb(i),r):e},r.parentId=function(i){return arguments.length?(t=gb(i),r):t},r.path=function(i){return arguments.length?(n=gb(i),r):n},r}function UW(e){e=`${e}`;let t=e.length;return OM(e,t-1)&&!OM(e,t-2)&&(e=e.slice(0,-1)),e[0]==="/"?e:`/${e}`}function Ek(e){let t=e.length;if(t<2)return"";for(;--t>1&&!OM(e,t););return e.slice(0,t)}function OM(e,t){if(e[t]==="/"){let n=0;for(;t>0&&e[--t]==="\\";)++n;if(!(n&1))return!0}return!1}function zW(e,t){return e.parent===t.parent?1:2}function BM(e){var t=e.children;return t?t[0]:e.t}function LM(e){var t=e.children;return t?t[t.length-1]:e.t}function qW(e,t,n){var r=n/(t.i-e.i);t.c-=r,t.s+=n,e.c+=r,t.z+=n,t.m+=n}function jW(e){for(var t=0,n=0,r=e.children,i=r.length,o;--i>=0;)o=r[i],o.z+=t,o.m+=t,t+=o.s+(n+=o.c)}function VW(e,t,n){return e.a.parent===t.parent?e.a:n}function bb(e,t){this._=e,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=t}bb.prototype=Object.create(qa.prototype);function YW(e){for(var t=new bb(e,0),n,r=[t],i,o,s,a;n=r.pop();)if(o=n._.children)for(n.children=new Array(a=o.length),s=a-1;s>=0;--s)r.push(i=n.children[s]=new bb(o[s],s)),i.parent=n;return(t.parent=new bb(null,0)).children=[t],t}function ul(){var e=zW,t=1,n=1,r=null;function i(l){var u=YW(l);if(u.eachAfter(o),u.parent.m=-u.z,u.eachBefore(s),r)l.eachBefore(c);else{var f=l,d=l,h=l;l.eachBefore(function(x){x.x<f.x&&(f=x),x.x>d.x&&(d=x),x.depth>h.depth&&(h=x)});var p=f===d?1:e(f,d)/2,m=p-f.x,g=t/(d.x+p+m),y=n/(h.depth||1);l.eachBefore(function(x){x.x=(x.x+m)*g,x.y=x.depth*y})}return l}function o(l){var u=l.children,f=l.parent.children,d=l.i?f[l.i-1]:null;if(u){jW(l);var h=(u[0].z+u[u.length-1].z)/2;d?(l.z=d.z+e(l._,d._),l.m=l.z-h):l.z=h}else d&&(l.z=d.z+e(l._,d._));l.parent.A=a(l,d,l.parent.A||f[0])}function s(l){l._.x=l.z+l.parent.m,l.m+=l.parent.m}function a(l,u,f){if(u){for(var d=l,h=l,p=u,m=d.parent.children[0],g=d.m,y=h.m,x=p.m,b=m.m,w;p=LM(p),d=BM(d),p&&d;)m=BM(m),h=LM(h),h.a=l,w=p.z+x-d.z-g+e(p._,d._),w>0&&(qW(VW(p,l,f),l,w),g+=w,y+=w),x+=p.m,g+=d.m,b+=m.m,y+=h.m;p&&!LM(h)&&(h.t=p,h.m+=x-y),d&&!BM(m)&&(m.t=d,m.m+=g-b,f=l)}return f}function c(l){l.x*=t,l.y=l.depth*n}return i.separation=function(l){return arguments.length?(e=l,i):e},i.size=function(l){return arguments.length?(r=!1,t=+l[0],n=+l[1],i):r?null:[t,n]},i.nodeSize=function(l){return arguments.length?(r=!0,t=+l[0],n=+l[1],i):r?[t,n]:null},i}var Nk=23283064365386963e-26;function fl(e=Math.random()){let t=(0<=e&&e<1?e/Nk:Math.abs(e))|0;return()=>(t=1664525*t+1013904223|0,Nk*(t>>>0))}function He(e,t){switch(arguments.length){case 0:break;case 1:this.range(e);break;default:this.range(t).domain(e);break}return this}function Hp(e,t){switch(arguments.length){case 0:break;case 1:{typeof e=="function"?this.interpolator(e):this.range(e);break}default:{this.domain(e),typeof t=="function"?this.interpolator(t):this.range(t);break}}return this}var Zp=Symbol("implicit");function dl(){var e=new Gn,t=[],n=[],r=Zp;function i(o){let s=e.get(o);if(s===void 0){if(r!==Zp)return r;e.set(o,s=t.push(o)-1)}return n[s%n.length]}return i.domain=function(o){if(!arguments.length)return t.slice();t=[],e=new Gn;for(let s of o)e.has(s)||e.set(s,t.push(s)-1);return i},i.range=function(o){return arguments.length?(n=Array.from(o),i):n.slice()},i.unknown=function(o){return arguments.length?(r=o,i):r},i.copy=function(){return dl(t,n).unknown(r)},He.apply(i,arguments),i}function ja(){var e=dl().unknown(void 0),t=e.domain,n=e.range,r=0,i=1,o,s,a=!1,c=0,l=0,u=.5;delete e.unknown;function f(){var d=t().length,h=i<r,p=h?i:r,m=h?r:i;o=(m-p)/Math.max(1,d-c+l*2),a&&(o=Math.floor(o)),p+=(m-p-o*(d-c))*u,s=o*(1-c),a&&(p=Math.round(p),s=Math.round(s));var g=Pe(d).map(function(y){return p+o*y});return n(h?g.reverse():g)}return e.domain=function(d){return arguments.length?(t(d),f()):t()},e.range=function(d){return arguments.length?([r,i]=d,r=+r,i=+i,f()):[r,i]},e.rangeRound=function(d){return[r,i]=d,r=+r,i=+i,a=!0,f()},e.bandwidth=function(){return s},e.step=function(){return o},e.round=function(d){return arguments.length?(a=!!d,f()):a},e.padding=function(d){return arguments.length?(c=Math.min(1,l=+d),f()):c},e.paddingInner=function(d){return arguments.length?(c=Math.min(1,d),f()):c},e.paddingOuter=function(d){return arguments.length?(l=+d,f()):l},e.align=function(d){return arguments.length?(u=Math.max(0,Math.min(1,d)),f()):u},e.copy=function(){return ja(t(),[r,i]).round(a).paddingInner(c).paddingOuter(l).align(u)},He.apply(f(),arguments)}function Dk(e){var t=e.copy;return e.padding=e.paddingOuter,delete e.paddingInner,delete e.paddingOuter,e.copy=function(){return Dk(t())},e}function CM(){return Dk(ja.apply(null,arguments).paddingInner(1))}function kM(e){return function(){return e}}function sf(e){return+e}var Ok=[0,1];function xr(e){return e}function FM(e,t){return(t-=e=+e)?function(n){return(n-e)/t}:kM(isNaN(t)?NaN:.5)}function XW(e,t){var n;return e>t&&(n=e,e=t,t=n),function(r){return Math.max(e,Math.min(t,r))}}function GW(e,t,n){var r=e[0],i=e[1],o=t[0],s=t[1];return i<r?(r=FM(i,r),o=n(s,o)):(r=FM(r,i),o=n(o,s)),function(a){return o(r(a))}}function WW(e,t,n){var r=Math.min(e.length,t.length)-1,i=new Array(r),o=new Array(r),s=-1;for(e[r]<e[0]&&(e=e.slice().reverse(),t=t.slice().reverse());++s<r;)i[s]=FM(e[s],e[s+1]),o[s]=n(t[s],t[s+1]);return function(a){var c=Ms(e,a,1,r)-1;return o[c](i[c](a))}}function Ao(e,t){return t.domain(e.domain()).range(e.range()).interpolate(e.interpolate()).clamp(e.clamp()).unknown(e.unknown())}function hl(){var e=Ok,t=Ok,n=Rr,r,i,o,s=xr,a,c,l;function u(){var d=Math.min(e.length,t.length);return s!==xr&&(s=XW(e[0],e[d-1])),a=d>2?WW:GW,c=l=null,f}function f(d){return d==null||isNaN(d=+d)?o:(c||(c=a(e.map(r),t,n)))(r(s(d)))}return f.invert=function(d){return s(i((l||(l=a(t,e.map(r),we)))(d)))},f.domain=function(d){return arguments.length?(e=Array.from(d,sf),u()):e.slice()},f.range=function(d){return arguments.length?(t=Array.from(d),u()):t.slice()},f.rangeRound=function(d){return t=Array.from(d),n=tl,u()},f.clamp=function(d){return arguments.length?(s=d?!0:xr,u()):s!==xr},f.interpolate=function(d){return arguments.length?(n=d,u()):n},f.unknown=function(d){return arguments.length?(o=d,f):o},function(d,h){return r=d,i=h,u()}}function Jp(){return hl()(xr,xr)}function RM(e,t,n,r){var i=Eu(e,t,n),o;switch(r=vo(r??",f"),r.type){case"s":{var s=Math.max(Math.abs(e),Math.abs(t));return r.precision==null&&!isNaN(o=DI(i,s))&&(r.precision=o),$x(r,s)}case"":case"e":case"g":case"p":case"r":{r.precision==null&&!isNaN(o=OI(i,Math.max(Math.abs(e),Math.abs(t))))&&(r.precision=o-(r.type==="e"));break}case"f":case"%":{r.precision==null&&!isNaN(o=NI(i))&&(r.precision=o-(r.type==="%")*2);break}}return ci(r)}function Fs(e){var t=e.domain;return e.ticks=function(n){var r=t();return _n(r[0],r[r.length-1],n??10)},e.tickFormat=function(n,r){var i=t();return RM(i[0],i[i.length-1],n??10,r)},e.nice=function(n){n==null&&(n=10);var r=t(),i=0,o=r.length-1,s=r[i],a=r[o],c,l,u=10;for(a<s&&(l=s,s=a,a=l,l=i,i=o,o=l);u-- >0;){if(l=As(s,a,n),l===c)return r[i]=s,r[o]=a,t(r);if(l>0)s=Math.floor(s/l)*l,a=Math.ceil(a/l)*l;else if(l<0)s=Math.ceil(s*l)/l,a=Math.floor(a*l)/l;else break;c=l}return e},e}function Rs(){var e=Jp();return e.copy=function(){return Ao(e,Rs())},He.apply(e,arguments),Fs(e)}function Qp(e){var t;function n(r){return r==null||isNaN(r=+r)?t:r}return n.invert=n,n.domain=n.range=function(r){return arguments.length?(e=Array.from(r,sf),n):e.slice()},n.unknown=function(r){return arguments.length?(t=r,n):t},n.copy=function(){return Qp(e).unknown(t)},e=arguments.length?Array.from(e,sf):[0,1],Fs(n)}function Kp(e,t){e=e.slice();var n=0,r=e.length-1,i=e[n],o=e[r],s;return o<i&&(s=n,n=r,r=s,s=i,i=o,o=s),e[n]=t.floor(i),e[r]=t.ceil(o),e}function Bk(e){return Math.log(e)}function Lk(e){return Math.exp(e)}function HW(e){return-Math.log(-e)}function ZW(e){return-Math.exp(-e)}function JW(e){return isFinite(e)?+("1e"+e):e<0?0:e}function QW(e){return e===10?JW:e===Math.E?Math.exp:t=>Math.pow(e,t)}function KW(e){return e===Math.E?Math.log:e===10&&Math.log10||e===2&&Math.log2||(e=Math.log(e),t=>Math.log(t)/e)}function Ck(e){return(t,n)=>-e(-t,n)}function $M(e){let t=e(Bk,Lk),n=t.domain,r=10,i,o;function s(){return i=KW(r),o=QW(r),n()[0]<0?(i=Ck(i),o=Ck(o),e(HW,ZW)):e(Bk,Lk),t}return t.base=function(a){return arguments.length?(r=+a,s()):r},t.domain=function(a){return arguments.length?(n(a),s()):n()},t.ticks=a=>{let c=n(),l=c[0],u=c[c.length-1],f=u<l;f&&([l,u]=[u,l]);let d=i(l),h=i(u),p,m,g=a==null?10:+a,y=[];if(!(r%1)&&h-d<g){if(d=Math.floor(d),h=Math.ceil(h),l>0){for(;d<=h;++d)for(p=1;p<r;++p)if(m=d<0?p/o(-d):p*o(d),!(m<l)){if(m>u)break;y.push(m)}}else for(;d<=h;++d)for(p=r-1;p>=1;--p)if(m=d>0?p/o(-d):p*o(d),!(m<l)){if(m>u)break;y.push(m)}y.length*2<g&&(y=_n(l,u,g))}else y=_n(d,h,Math.min(h-d,g)).map(o);return f?y.reverse():y},t.tickFormat=(a,c)=>{if(a==null&&(a=10),c==null&&(c=r===10?"s":","),typeof c!="function"&&(!(r%1)&&(c=vo(c)).precision==null&&(c.trim=!0),c=ci(c)),a===1/0)return c;let l=Math.max(1,r*a/t.ticks().length);return u=>{let f=u/o(Math.round(i(u)));return f*r<r-.5&&(f*=r),f<=l?c(u):""}},t.nice=()=>n(Kp(n(),{floor:a=>o(Math.floor(i(a))),ceil:a=>o(Math.ceil(i(a)))})),t}function tm(){let e=$M(hl()).domain([1,10]);return e.copy=()=>Ao(e,tm()).base(e.base()),He.apply(e,arguments),e}function kk(e){return function(t){return Math.sign(t)*Math.log1p(Math.abs(t/e))}}function Fk(e){return function(t){return Math.sign(t)*Math.expm1(Math.abs(t))*e}}function PM(e){var t=1,n=e(kk(t),Fk(t));return n.constant=function(r){return arguments.length?e(kk(t=+r),Fk(t)):t},Fs(n)}function em(){var e=PM(hl());return e.copy=function(){return Ao(e,em()).constant(e.constant())},He.apply(e,arguments)}function Rk(e){return function(t){return t<0?-Math.pow(-t,e):Math.pow(t,e)}}function tH(e){return e<0?-Math.sqrt(-e):Math.sqrt(e)}function eH(e){return e<0?-e*e:e*e}function UM(e){var t=e(xr,xr),n=1;function r(){return n===1?e(xr,xr):n===.5?e(tH,eH):e(Rk(n),Rk(1/n))}return t.exponent=function(i){return arguments.length?(n=+i,r()):n},Fs(t)}function nm(){var e=UM(hl());return e.copy=function(){return Ao(e,nm()).exponent(e.exponent())},He.apply(e,arguments),e}function rm(){var e=[],t=[],n=[],r;function i(){var s=0,a=Math.max(1,t.length);for(n=new Array(a-1);++s<a;)n[s-1]=PS(e,s/a);return o}function o(s){return s==null||isNaN(s=+s)?r:t[Ms(n,s)]}return o.invertExtent=function(s){var a=t.indexOf(s);return a<0?[NaN,NaN]:[a>0?n[a-1]:e[0],a<n.length?n[a]:e[e.length-1]]},o.domain=function(s){if(!arguments.length)return e.slice();e=[];for(let a of s)a!=null&&!isNaN(a=+a)&&e.push(a);return e.sort(zt),i()},o.range=function(s){return arguments.length?(t=Array.from(s),i()):t.slice()},o.unknown=function(s){return arguments.length?(r=s,o):r},o.quantiles=function(){return n.slice()},o.copy=function(){return rm().domain(e).range(t).unknown(r)},He.apply(o,arguments)}function im(){var e=[.5],t=[0,1],n,r=1;function i(o){return o!=null&&o<=o?t[Ms(e,o,0,r)]:n}return i.domain=function(o){return arguments.length?(e=Array.from(o),r=Math.min(e.length,t.length-1),i):e.slice()},i.range=function(o){return arguments.length?(t=Array.from(o),r=Math.min(e.length,t.length-1),i):t.slice()},i.invertExtent=function(o){var s=t.indexOf(o);return[e[s-1],e[s]]},i.unknown=function(o){return arguments.length?(n=o,i):n},i.copy=function(){return im().domain(e).range(t).unknown(n)},He.apply(i,arguments)}var zM=new Date,qM=new Date;function pe(e,t,n,r){function i(o){return e(o=arguments.length===0?new Date:new Date(+o)),o}return i.floor=o=>(e(o=new Date(+o)),o),i.ceil=o=>(e(o=new Date(o-1)),t(o,1),e(o),o),i.round=o=>{let s=i(o),a=i.ceil(o);return o-s<a-o?s:a},i.offset=(o,s)=>(t(o=new Date(+o),s==null?1:Math.floor(s)),o),i.range=(o,s,a)=>{let c=[];if(o=i.ceil(o),a=a==null?1:Math.floor(a),!(o<s)||!(a>0))return c;let l;do c.push(l=new Date(+o)),t(o,a),e(o);while(l<o&&o<s);return c},i.filter=o=>pe(s=>{if(s>=s)for(;e(s),!o(s);)s.setTime(s-1)},(s,a)=>{if(s>=s)if(a<0)for(;++a<=0;)for(;t(s,-1),!o(s););else for(;--a>=0;)for(;t(s,1),!o(s););}),n&&(i.count=(o,s)=>(zM.setTime(+o),qM.setTime(+s),e(zM),e(qM),Math.floor(n(zM,qM))),i.every=o=>(o=Math.floor(o),!isFinite(o)||!(o>0)?null:o>1?i.filter(r?s=>r(s)%o===0:s=>i.count(0,s)%o===0):i)),i}var om=pe(()=>{},(e,t)=>{e.setTime(+e+t)},(e,t)=>t-e);om.every=e=>(e=Math.floor(e),!isFinite(e)||!(e>0)?null:e>1?pe(t=>{t.setTime(Math.floor(t/e)*e)},(t,n)=>{t.setTime(+t+n*e)},(t,n)=>(n-t)/e):om);var q3t=om.range;var an=pe(e=>{e.setTime(e-e.getMilliseconds())},(e,t)=>{e.setTime(+e+t*1e3)},(e,t)=>(t-e)/1e3,e=>e.getUTCSeconds()),$k=an.range;var $s=pe(e=>{e.setTime(e-e.getMilliseconds()-e.getSeconds()*1e3)},(e,t)=>{e.setTime(+e+t*6e4)},(e,t)=>(t-e)/6e4,e=>e.getMinutes()),nH=$s.range,Ps=pe(e=>{e.setUTCSeconds(0,0)},(e,t)=>{e.setTime(+e+t*6e4)},(e,t)=>(t-e)/6e4,e=>e.getUTCMinutes()),rH=Ps.range;var Us=pe(e=>{e.setTime(e-e.getMilliseconds()-e.getSeconds()*1e3-e.getMinutes()*6e4)},(e,t)=>{e.setTime(+e+t*36e5)},(e,t)=>(t-e)/36e5,e=>e.getHours()),iH=Us.range,zs=pe(e=>{e.setUTCMinutes(0,0,0)},(e,t)=>{e.setTime(+e+t*36e5)},(e,t)=>(t-e)/36e5,e=>e.getUTCHours()),oH=zs.range;var ui=pe(e=>e.setHours(0,0,0,0),(e,t)=>e.setDate(e.getDate()+t),(e,t)=>(t-e-(t.getTimezoneOffset()-e.getTimezoneOffset())*6e4)/864e5,e=>e.getDate()-1),sH=ui.range,yl=pe(e=>{e.setUTCHours(0,0,0,0)},(e,t)=>{e.setUTCDate(e.getUTCDate()+t)},(e,t)=>(t-e)/864e5,e=>e.getUTCDate()-1),aH=yl.range,gl=pe(e=>{e.setUTCHours(0,0,0,0)},(e,t)=>{e.setUTCDate(e.getUTCDate()+t)},(e,t)=>(t-e)/864e5,e=>Math.floor(e/864e5)),cH=gl.range;function xl(e){return pe(t=>{t.setDate(t.getDate()-(t.getDay()+7-e)%7),t.setHours(0,0,0,0)},(t,n)=>{t.setDate(t.getDate()+n*7)},(t,n)=>(n-t-(n.getTimezoneOffset()-t.getTimezoneOffset())*6e4)/6048e5)}var Pr=xl(0),Va=xl(1),wb=xl(2),vb=xl(3),Eo=xl(4),_b=xl(5),Sb=xl(6),Uk=Pr.range,lH=Va.range,uH=wb.range,fH=vb.range,dH=Eo.range,hH=_b.range,pH=Sb.range;function bl(e){return pe(t=>{t.setUTCDate(t.getUTCDate()-(t.getUTCDay()+7-e)%7),t.setUTCHours(0,0,0,0)},(t,n)=>{t.setUTCDate(t.getUTCDate()+n*7)},(t,n)=>(n-t)/6048e5)}var Ur=bl(0),Ya=bl(1),Ib=bl(2),Mb=bl(3),No=bl(4),Ab=bl(5),Tb=bl(6),zk=Ur.range,mH=Ya.range,yH=Ib.range,gH=Mb.range,xH=No.range,bH=Ab.range,wH=Tb.range;var qs=pe(e=>{e.setDate(1),e.setHours(0,0,0,0)},(e,t)=>{e.setMonth(e.getMonth()+t)},(e,t)=>t.getMonth()-e.getMonth()+(t.getFullYear()-e.getFullYear())*12,e=>e.getMonth()),vH=qs.range,js=pe(e=>{e.setUTCDate(1),e.setUTCHours(0,0,0,0)},(e,t)=>{e.setUTCMonth(e.getUTCMonth()+t)},(e,t)=>t.getUTCMonth()-e.getUTCMonth()+(t.getUTCFullYear()-e.getUTCFullYear())*12,e=>e.getUTCMonth()),_H=js.range;var $n=pe(e=>{e.setMonth(0,1),e.setHours(0,0,0,0)},(e,t)=>{e.setFullYear(e.getFullYear()+t)},(e,t)=>t.getFullYear()-e.getFullYear(),e=>e.getFullYear());$n.every=e=>!isFinite(e=Math.floor(e))||!(e>0)?null:pe(t=>{t.setFullYear(Math.floor(t.getFullYear()/e)*e),t.setMonth(0,1),t.setHours(0,0,0,0)},(t,n)=>{t.setFullYear(t.getFullYear()+n*e)});var SH=$n.range,Pn=pe(e=>{e.setUTCMonth(0,1),e.setUTCHours(0,0,0,0)},(e,t)=>{e.setUTCFullYear(e.getUTCFullYear()+t)},(e,t)=>t.getUTCFullYear()-e.getUTCFullYear(),e=>e.getUTCFullYear());Pn.every=e=>!isFinite(e=Math.floor(e))||!(e>0)?null:pe(t=>{t.setUTCFullYear(Math.floor(t.getUTCFullYear()/e)*e),t.setUTCMonth(0,1),t.setUTCHours(0,0,0,0)},(t,n)=>{t.setUTCFullYear(t.getUTCFullYear()+n*e)});var IH=Pn.range;function jk(e,t,n,r,i,o){let s=[[an,1,1e3],[an,5,5*1e3],[an,15,15*1e3],[an,30,30*1e3],[o,1,6e4],[o,5,5*6e4],[o,15,15*6e4],[o,30,30*6e4],[i,1,36e5],[i,3,3*36e5],[i,6,6*36e5],[i,12,12*36e5],[r,1,864e5],[r,2,2*864e5],[n,1,6048e5],[t,1,2592e6],[t,3,3*2592e6],[e,1,31536e6]];function a(l,u,f){let d=u<l;d&&([l,u]=[u,l]);let h=f&&typeof f.range=="function"?f:c(l,u,f),p=h?h.range(l,+u+1):[];return d?p.reverse():p}function c(l,u,f){let d=Math.abs(u-l)/f,h=Is(([,,g])=>g).right(s,d);if(h===s.length)return e.every(Eu(l/31536e6,u/31536e6,f));if(h===0)return om.every(Math.max(Eu(l,u,f),1));let[p,m]=s[d/s[h-1][2]<s[h][2]/d?h-1:h];return p.every(m)}return[a,c]}var[jM,am]=jk(Pn,js,Ur,gl,zs,Ps),[VM,YM]=jk($n,qs,Pr,ui,Us,$s);function XM(e){if(0<=e.y&&e.y<100){var t=new Date(-1,e.m,e.d,e.H,e.M,e.S,e.L);return t.setFullYear(e.y),t}return new Date(e.y,e.m,e.d,e.H,e.M,e.S,e.L)}function GM(e){if(0<=e.y&&e.y<100){var t=new Date(Date.UTC(-1,e.m,e.d,e.H,e.M,e.S,e.L));return t.setUTCFullYear(e.y),t}return new Date(Date.UTC(e.y,e.m,e.d,e.H,e.M,e.S,e.L))}function cm(e,t,n){return{y:e,m:t,d:n,H:0,M:0,S:0,L:0}}function WM(e){var t=e.dateTime,n=e.date,r=e.time,i=e.periods,o=e.days,s=e.shortDays,a=e.months,c=e.shortMonths,l=lm(i),u=um(i),f=lm(o),d=um(o),h=lm(s),p=um(s),m=lm(a),g=um(a),y=lm(c),x=um(c),b={a:k,A:R,b:F,B:$,c:null,d:Hk,e:Hk,f:WH,g:iZ,G:sZ,H:YH,I:XH,j:GH,L:tF,m:HH,M:ZH,p:P,q:U,Q:Qk,s:Kk,S:JH,u:QH,U:KH,V:tZ,w:eZ,W:nZ,x:null,X:null,y:rZ,Y:oZ,Z:aZ,"%":Jk},w={a:W,A:tt,b:nt,B:st,c:null,d:Zk,e:Zk,f:fZ,g:vZ,G:SZ,H:cZ,I:lZ,j:uZ,L:nF,m:dZ,M:hZ,p:Y,q:rt,Q:Qk,s:Kk,S:pZ,u:mZ,U:yZ,V:gZ,w:xZ,W:bZ,x:null,X:null,y:wZ,Y:_Z,Z:IZ,"%":Jk},_={a:I,A:T,b:O,B:L,c:S,d:Gk,e:Gk,f:zH,g:Xk,G:Yk,H:Wk,I:Wk,j:RH,L:UH,m:FH,M:$H,p:D,q:kH,Q:jH,s:VH,S:PH,u:DH,U:OH,V:BH,w:NH,W:LH,x:A,X:N,y:Xk,Y:Yk,Z:CH,"%":qH};b.x=v(n,b),b.X=v(r,b),b.c=v(t,b),w.x=v(n,w),w.X=v(r,w),w.c=v(t,w);function v(q,H){return function(ot){var z=[],kt=-1,dt=0,Wt=q.length,Ht,et,oe;for(ot instanceof Date||(ot=new Date(+ot));++kt<Wt;)q.charCodeAt(kt)===37&&(z.push(q.slice(dt,kt)),(et=Vk[Ht=q.charAt(++kt)])!=null?Ht=q.charAt(++kt):et=Ht==="e"?" ":"0",(oe=H[Ht])&&(Ht=oe(ot,et)),z.push(Ht),dt=kt+1);return z.push(q.slice(dt,kt)),z.join("")}}function M(q,H){return function(ot){var z=cm(1900,void 0,1),kt=E(z,q,ot+="",0),dt,Wt;if(kt!=ot.length)return null;if("Q"in z)return new Date(z.Q);if("s"in z)return new Date(z.s*1e3+("L"in z?z.L:0));if(H&&!("Z"in z)&&(z.Z=0),"p"in z&&(z.H=z.H%12+z.p*12),z.m===void 0&&(z.m="q"in z?z.q:0),"V"in z){if(z.V<1||z.V>53)return null;"w"in z||(z.w=1),"Z"in z?(dt=GM(cm(z.y,0,1)),Wt=dt.getUTCDay(),dt=Wt>4||Wt===0?Ya.ceil(dt):Ya(dt),dt=yl.offset(dt,(z.V-1)*7),z.y=dt.getUTCFullYear(),z.m=dt.getUTCMonth(),z.d=dt.getUTCDate()+(z.w+6)%7):(dt=XM(cm(z.y,0,1)),Wt=dt.getDay(),dt=Wt>4||Wt===0?Va.ceil(dt):Va(dt),dt=ui.offset(dt,(z.V-1)*7),z.y=dt.getFullYear(),z.m=dt.getMonth(),z.d=dt.getDate()+(z.w+6)%7)}else("W"in z||"U"in z)&&("w"in z||(z.w="u"in z?z.u%7:"W"in z?1:0),Wt="Z"in z?GM(cm(z.y,0,1)).getUTCDay():XM(cm(z.y,0,1)).getDay(),z.m=0,z.d="W"in z?(z.w+6)%7+z.W*7-(Wt+5)%7:z.w+z.U*7-(Wt+6)%7);return"Z"in z?(z.H+=z.Z/100|0,z.M+=z.Z%100,GM(z)):XM(z)}}function E(q,H,ot,z){for(var kt=0,dt=H.length,Wt=ot.length,Ht,et;kt<dt;){if(z>=Wt)return-1;if(Ht=H.charCodeAt(kt++),Ht===37){if(Ht=H.charAt(kt++),et=_[Ht in Vk?H.charAt(kt++):Ht],!et||(z=et(q,ot,z))<0)return-1}else if(Ht!=ot.charCodeAt(z++))return-1}return z}function D(q,H,ot){var z=l.exec(H.slice(ot));return z?(q.p=u.get(z[0].toLowerCase()),ot+z[0].length):-1}function I(q,H,ot){var z=h.exec(H.slice(ot));return z?(q.w=p.get(z[0].toLowerCase()),ot+z[0].length):-1}function T(q,H,ot){var z=f.exec(H.slice(ot));return z?(q.w=d.get(z[0].toLowerCase()),ot+z[0].length):-1}function O(q,H,ot){var z=y.exec(H.slice(ot));return z?(q.m=x.get(z[0].toLowerCase()),ot+z[0].length):-1}function L(q,H,ot){var z=m.exec(H.slice(ot));return z?(q.m=g.get(z[0].toLowerCase()),ot+z[0].length):-1}function S(q,H,ot){return E(q,t,H,ot)}function A(q,H,ot){return E(q,n,H,ot)}function N(q,H,ot){return E(q,r,H,ot)}function k(q){return s[q.getDay()]}function R(q){return o[q.getDay()]}function F(q){return c[q.getMonth()]}function $(q){return a[q.getMonth()]}function P(q){return i[+(q.getHours()>=12)]}function U(q){return 1+~~(q.getMonth()/3)}function W(q){return s[q.getUTCDay()]}function tt(q){return o[q.getUTCDay()]}function nt(q){return c[q.getUTCMonth()]}function st(q){return a[q.getUTCMonth()]}function Y(q){return i[+(q.getUTCHours()>=12)]}function rt(q){return 1+~~(q.getUTCMonth()/3)}return{format:function(q){var H=v(q+="",b);return H.toString=function(){return q},H},parse:function(q){var H=M(q+="",!1);return H.toString=function(){return q},H},utcFormat:function(q){var H=v(q+="",w);return H.toString=function(){return q},H},utcParse:function(q){var H=M(q+="",!0);return H.toString=function(){return q},H}}}var Vk={"-":"",_:" ",0:"0"},cn=/^\s*\d+/,AH=/^%/,TH=/[\\^$*+?|[\]().{}]/g;function te(e,t,n){var r=e<0?"-":"",i=(r?-e:e)+"",o=i.length;return r+(o<n?new Array(n-o+1).join(t)+i:i)}function EH(e){return e.replace(TH,"\\$&")}function lm(e){return new RegExp("^(?:"+e.map(EH).join("|")+")","i")}function um(e){return new Map(e.map((t,n)=>[t.toLowerCase(),n]))}function NH(e,t,n){var r=cn.exec(t.slice(n,n+1));return r?(e.w=+r[0],n+r[0].length):-1}function DH(e,t,n){var r=cn.exec(t.slice(n,n+1));return r?(e.u=+r[0],n+r[0].length):-1}function OH(e,t,n){var r=cn.exec(t.slice(n,n+2));return r?(e.U=+r[0],n+r[0].length):-1}function BH(e,t,n){var r=cn.exec(t.slice(n,n+2));return r?(e.V=+r[0],n+r[0].length):-1}function LH(e,t,n){var r=cn.exec(t.slice(n,n+2));return r?(e.W=+r[0],n+r[0].length):-1}function Yk(e,t,n){var r=cn.exec(t.slice(n,n+4));return r?(e.y=+r[0],n+r[0].length):-1}function Xk(e,t,n){var r=cn.exec(t.slice(n,n+2));return r?(e.y=+r[0]+(+r[0]>68?1900:2e3),n+r[0].length):-1}function CH(e,t,n){var r=/^(Z)|([+-]\d\d)(?::?(\d\d))?/.exec(t.slice(n,n+6));return r?(e.Z=r[1]?0:-(r[2]+(r[3]||"00")),n+r[0].length):-1}function kH(e,t,n){var r=cn.exec(t.slice(n,n+1));return r?(e.q=r[0]*3-3,n+r[0].length):-1}function FH(e,t,n){var r=cn.exec(t.slice(n,n+2));return r?(e.m=r[0]-1,n+r[0].length):-1}function Gk(e,t,n){var r=cn.exec(t.slice(n,n+2));return r?(e.d=+r[0],n+r[0].length):-1}function RH(e,t,n){var r=cn.exec(t.slice(n,n+3));return r?(e.m=0,e.d=+r[0],n+r[0].length):-1}function Wk(e,t,n){var r=cn.exec(t.slice(n,n+2));return r?(e.H=+r[0],n+r[0].length):-1}function $H(e,t,n){var r=cn.exec(t.slice(n,n+2));return r?(e.M=+r[0],n+r[0].length):-1}function PH(e,t,n){var r=cn.exec(t.slice(n,n+2));return r?(e.S=+r[0],n+r[0].length):-1}function UH(e,t,n){var r=cn.exec(t.slice(n,n+3));return r?(e.L=+r[0],n+r[0].length):-1}function zH(e,t,n){var r=cn.exec(t.slice(n,n+6));return r?(e.L=Math.floor(r[0]/1e3),n+r[0].length):-1}function qH(e,t,n){var r=AH.exec(t.slice(n,n+1));return r?n+r[0].length:-1}function jH(e,t,n){var r=cn.exec(t.slice(n));return r?(e.Q=+r[0],n+r[0].length):-1}function VH(e,t,n){var r=cn.exec(t.slice(n));return r?(e.s=+r[0],n+r[0].length):-1}function Hk(e,t){return te(e.getDate(),t,2)}function YH(e,t){return te(e.getHours(),t,2)}function XH(e,t){return te(e.getHours()%12||12,t,2)}function GH(e,t){return te(1+ui.count($n(e),e),t,3)}function tF(e,t){return te(e.getMilliseconds(),t,3)}function WH(e,t){return tF(e,t)+"000"}function HH(e,t){return te(e.getMonth()+1,t,2)}function ZH(e,t){return te(e.getMinutes(),t,2)}function JH(e,t){return te(e.getSeconds(),t,2)}function QH(e){var t=e.getDay();return t===0?7:t}function KH(e,t){return te(Pr.count($n(e)-1,e),t,2)}function eF(e){var t=e.getDay();return t>=4||t===0?Eo(e):Eo.ceil(e)}function tZ(e,t){return e=eF(e),te(Eo.count($n(e),e)+($n(e).getDay()===4),t,2)}function eZ(e){return e.getDay()}function nZ(e,t){return te(Va.count($n(e)-1,e),t,2)}function rZ(e,t){return te(e.getFullYear()%100,t,2)}function iZ(e,t){return e=eF(e),te(e.getFullYear()%100,t,2)}function oZ(e,t){return te(e.getFullYear()%1e4,t,4)}function sZ(e,t){var n=e.getDay();return e=n>=4||n===0?Eo(e):Eo.ceil(e),te(e.getFullYear()%1e4,t,4)}function aZ(e){var t=e.getTimezoneOffset();return(t>0?"-":(t*=-1,"+"))+te(t/60|0,"0",2)+te(t%60,"0",2)}function Zk(e,t){return te(e.getUTCDate(),t,2)}function cZ(e,t){return te(e.getUTCHours(),t,2)}function lZ(e,t){return te(e.getUTCHours()%12||12,t,2)}function uZ(e,t){return te(1+yl.count(Pn(e),e),t,3)}function nF(e,t){return te(e.getUTCMilliseconds(),t,3)}function fZ(e,t){return nF(e,t)+"000"}function dZ(e,t){return te(e.getUTCMonth()+1,t,2)}function hZ(e,t){return te(e.getUTCMinutes(),t,2)}function pZ(e,t){return te(e.getUTCSeconds(),t,2)}function mZ(e){var t=e.getUTCDay();return t===0?7:t}function yZ(e,t){return te(Ur.count(Pn(e)-1,e),t,2)}function rF(e){var t=e.getUTCDay();return t>=4||t===0?No(e):No.ceil(e)}function gZ(e,t){return e=rF(e),te(No.count(Pn(e),e)+(Pn(e).getUTCDay()===4),t,2)}function xZ(e){return e.getUTCDay()}function bZ(e,t){return te(Ya.count(Pn(e)-1,e),t,2)}function wZ(e,t){return te(e.getUTCFullYear()%100,t,2)}function vZ(e,t){return e=rF(e),te(e.getUTCFullYear()%100,t,2)}function _Z(e,t){return te(e.getUTCFullYear()%1e4,t,4)}function SZ(e,t){var n=e.getUTCDay();return e=n>=4||n===0?No(e):No.ceil(e),te(e.getUTCFullYear()%1e4,t,4)}function IZ(){return"+0000"}function Jk(){return"%"}function Qk(e){return+e}function Kk(e){return Math.floor(+e/1e3)}var af,cf,iF,Do,oF;HM({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"]});function HM(e){return af=WM(e),cf=af.format,iF=af.parse,Do=af.utcFormat,oF=af.utcParse,af}function MZ(e){return new Date(e)}function AZ(e){return e instanceof Date?+e:+new Date(+e)}function Eb(e,t,n,r,i,o,s,a,c,l){var u=Jp(),f=u.invert,d=u.domain,h=l(".%L"),p=l(":%S"),m=l("%I:%M"),g=l("%I %p"),y=l("%a %d"),x=l("%b %d"),b=l("%B"),w=l("%Y");function _(v){return(c(v)<v?h:a(v)<v?p:s(v)<v?m:o(v)<v?g:r(v)<v?i(v)<v?y:x:n(v)<v?b:w)(v)}return u.invert=function(v){return new Date(f(v))},u.domain=function(v){return arguments.length?d(Array.from(v,AZ)):d().map(MZ)},u.ticks=function(v){var M=d();return e(M[0],M[M.length-1],v??10)},u.tickFormat=function(v,M){return M==null?_:l(M)},u.nice=function(v){var M=d();return(!v||typeof v.range!="function")&&(v=t(M[0],M[M.length-1],v??10)),v?d(Kp(M,v)):u},u.copy=function(){return Ao(u,Eb(e,t,n,r,i,o,s,a,c,l))},u}function Nb(){return He.apply(Eb(VM,YM,$n,qs,Pr,ui,Us,$s,an,cf).domain([new Date(2e3,0,1),new Date(2e3,0,2)]),arguments)}function Db(){return He.apply(Eb(jM,am,Pn,js,Ur,yl,zs,Ps,an,Do).domain([Date.UTC(2e3,0,1),Date.UTC(2e3,0,2)]),arguments)}function fm(e,t){return t.domain(e.domain()).interpolator(e.interpolator()).clamp(e.clamp()).unknown(e.unknown())}function Ob(){var e=0,t=.5,n=1,r=1,i,o,s,a,c,l=xr,u,f=!1,d;function h(m){return isNaN(m=+m)?d:(m=.5+((m=+u(m))-o)*(r*m<r*o?a:c),l(f?Math.max(0,Math.min(1,m)):m))}h.domain=function(m){return arguments.length?([e,t,n]=m,i=u(e=+e),o=u(t=+t),s=u(n=+n),a=i===o?0:.5/(o-i),c=o===s?0:.5/(s-o),r=o<i?-1:1,h):[e,t,n]},h.clamp=function(m){return arguments.length?(f=!!m,h):f},h.interpolator=function(m){return arguments.length?(l=m,h):l};function p(m){return function(g){var y,x,b;return arguments.length?([y,x,b]=g,l=go(m,[y,x,b]),h):[l(0),l(.5),l(1)]}}return h.range=p(Rr),h.rangeRound=p(tl),h.unknown=function(m){return arguments.length?(d=m,h):d},function(m){return u=m,i=m(e),o=m(t),s=m(n),a=i===o?0:.5/(o-i),c=o===s?0:.5/(s-o),r=o<i?-1:1,h}}function dm(){var e=Fs(Ob()(xr));return e.copy=function(){return fm(e,dm())},Hp.apply(e,arguments)}function Bb(){var e=$M(Ob()).domain([.1,1,10]);return e.copy=function(){return fm(e,Bb()).base(e.base())},Hp.apply(e,arguments)}function Lb(){var e=PM(Ob());return e.copy=function(){return fm(e,Lb()).constant(e.constant())},Hp.apply(e,arguments)}function Cb(){var e=UM(Ob());return e.copy=function(){return fm(e,Cb()).exponent(e.exponent())},Hp.apply(e,arguments)}function X(e){for(var t=e.length/6|0,n=new Array(t),r=0;r<t;)n[r]="#"+e.slice(r*6,++r*6);return n}var ZM=X("1f77b4ff7f0e2ca02cd627289467bd8c564be377c27f7f7fbcbd2217becf");var JM=X("7fc97fbeaed4fdc086ffff99386cb0f0027fbf5b17666666");var QM=X("1b9e77d95f027570b3e7298a66a61ee6ab02a6761d666666");var KM=X("a6cee31f78b4b2df8a33a02cfb9a99e31a1cfdbf6fff7f00cab2d66a3d9affff99b15928");var tA=X("fbb4aeb3cde3ccebc5decbe4fed9a6ffffcce5d8bdfddaecf2f2f2");var eA=X("b3e2cdfdcdaccbd5e8f4cae4e6f5c9fff2aef1e2cccccccc");var nA=X("e41a1c377eb84daf4a984ea3ff7f00ffff33a65628f781bf999999");var rA=X("66c2a5fc8d628da0cbe78ac3a6d854ffd92fe5c494b3b3b3");var iA=X("8dd3c7ffffb3bebadafb807280b1d3fdb462b3de69fccde5d9d9d9bc80bdccebc5ffed6f");var oA=X("4e79a7f28e2ce1575976b7b259a14fedc949af7aa1ff9da79c755fbab0ab");var ht=e=>eI(e[e.length-1]);var kb=new Array(3).concat("d8b365f5f5f55ab4ac","a6611adfc27d80cdc1018571","a6611adfc27df5f5f580cdc1018571","8c510ad8b365f6e8c3c7eae55ab4ac01665e","8c510ad8b365f6e8c3f5f5f5c7eae55ab4ac01665e","8c510abf812ddfc27df6e8c3c7eae580cdc135978f01665e","8c510abf812ddfc27df6e8c3f5f5f5c7eae580cdc135978f01665e","5430058c510abf812ddfc27df6e8c3c7eae580cdc135978f01665e003c30","5430058c510abf812ddfc27df6e8c3f5f5f5c7eae580cdc135978f01665e003c30").map(X),Fb=ht(kb);var Rb=new Array(3).concat("af8dc3f7f7f77fbf7b","7b3294c2a5cfa6dba0008837","7b3294c2a5cff7f7f7a6dba0008837","762a83af8dc3e7d4e8d9f0d37fbf7b1b7837","762a83af8dc3e7d4e8f7f7f7d9f0d37fbf7b1b7837","762a839970abc2a5cfe7d4e8d9f0d3a6dba05aae611b7837","762a839970abc2a5cfe7d4e8f7f7f7d9f0d3a6dba05aae611b7837","40004b762a839970abc2a5cfe7d4e8d9f0d3a6dba05aae611b783700441b","40004b762a839970abc2a5cfe7d4e8f7f7f7d9f0d3a6dba05aae611b783700441b").map(X),$b=ht(Rb);var Pb=new Array(3).concat("e9a3c9f7f7f7a1d76a","d01c8bf1b6dab8e1864dac26","d01c8bf1b6daf7f7f7b8e1864dac26","c51b7de9a3c9fde0efe6f5d0a1d76a4d9221","c51b7de9a3c9fde0eff7f7f7e6f5d0a1d76a4d9221","c51b7dde77aef1b6dafde0efe6f5d0b8e1867fbc414d9221","c51b7dde77aef1b6dafde0eff7f7f7e6f5d0b8e1867fbc414d9221","8e0152c51b7dde77aef1b6dafde0efe6f5d0b8e1867fbc414d9221276419","8e0152c51b7dde77aef1b6dafde0eff7f7f7e6f5d0b8e1867fbc414d9221276419").map(X),Ub=ht(Pb);var zb=new Array(3).concat("998ec3f7f7f7f1a340","5e3c99b2abd2fdb863e66101","5e3c99b2abd2f7f7f7fdb863e66101","542788998ec3d8daebfee0b6f1a340b35806","542788998ec3d8daebf7f7f7fee0b6f1a340b35806","5427888073acb2abd2d8daebfee0b6fdb863e08214b35806","5427888073acb2abd2d8daebf7f7f7fee0b6fdb863e08214b35806","2d004b5427888073acb2abd2d8daebfee0b6fdb863e08214b358067f3b08","2d004b5427888073acb2abd2d8daebf7f7f7fee0b6fdb863e08214b358067f3b08").map(X),qb=ht(zb);var hm=new Array(3).concat("ef8a62f7f7f767a9cf","ca0020f4a58292c5de0571b0","ca0020f4a582f7f7f792c5de0571b0","b2182bef8a62fddbc7d1e5f067a9cf2166ac","b2182bef8a62fddbc7f7f7f7d1e5f067a9cf2166ac","b2182bd6604df4a582fddbc7d1e5f092c5de4393c32166ac","b2182bd6604df4a582fddbc7f7f7f7d1e5f092c5de4393c32166ac","67001fb2182bd6604df4a582fddbc7d1e5f092c5de4393c32166ac053061","67001fb2182bd6604df4a582fddbc7f7f7f7d1e5f092c5de4393c32166ac053061").map(X),lf=ht(hm);var jb=new Array(3).concat("ef8a62ffffff999999","ca0020f4a582bababa404040","ca0020f4a582ffffffbababa404040","b2182bef8a62fddbc7e0e0e09999994d4d4d","b2182bef8a62fddbc7ffffffe0e0e09999994d4d4d","b2182bd6604df4a582fddbc7e0e0e0bababa8787874d4d4d","b2182bd6604df4a582fddbc7ffffffe0e0e0bababa8787874d4d4d","67001fb2182bd6604df4a582fddbc7e0e0e0bababa8787874d4d4d1a1a1a","67001fb2182bd6604df4a582fddbc7ffffffe0e0e0bababa8787874d4d4d1a1a1a").map(X),Vb=ht(jb);var pm=new Array(3).concat("fc8d59ffffbf91bfdb","d7191cfdae61abd9e92c7bb6","d7191cfdae61ffffbfabd9e92c7bb6","d73027fc8d59fee090e0f3f891bfdb4575b4","d73027fc8d59fee090ffffbfe0f3f891bfdb4575b4","d73027f46d43fdae61fee090e0f3f8abd9e974add14575b4","d73027f46d43fdae61fee090ffffbfe0f3f8abd9e974add14575b4","a50026d73027f46d43fdae61fee090e0f3f8abd9e974add14575b4313695","a50026d73027f46d43fdae61fee090ffffbfe0f3f8abd9e974add14575b4313695").map(X),uf=ht(pm);var Yb=new Array(3).concat("fc8d59ffffbf91cf60","d7191cfdae61a6d96a1a9641","d7191cfdae61ffffbfa6d96a1a9641","d73027fc8d59fee08bd9ef8b91cf601a9850","d73027fc8d59fee08bffffbfd9ef8b91cf601a9850","d73027f46d43fdae61fee08bd9ef8ba6d96a66bd631a9850","d73027f46d43fdae61fee08bffffbfd9ef8ba6d96a66bd631a9850","a50026d73027f46d43fdae61fee08bd9ef8ba6d96a66bd631a9850006837","a50026d73027f46d43fdae61fee08bffffbfd9ef8ba6d96a66bd631a9850006837").map(X),Xb=ht(Yb);var Gb=new Array(3).concat("fc8d59ffffbf99d594","d7191cfdae61abdda42b83ba","d7191cfdae61ffffbfabdda42b83ba","d53e4ffc8d59fee08be6f59899d5943288bd","d53e4ffc8d59fee08bffffbfe6f59899d5943288bd","d53e4ff46d43fdae61fee08be6f598abdda466c2a53288bd","d53e4ff46d43fdae61fee08bffffbfe6f598abdda466c2a53288bd","9e0142d53e4ff46d43fdae61fee08be6f598abdda466c2a53288bd5e4fa2","9e0142d53e4ff46d43fdae61fee08bffffbfe6f598abdda466c2a53288bd5e4fa2").map(X),Wb=ht(Gb);var Hb=new Array(3).concat("e5f5f999d8c92ca25f","edf8fbb2e2e266c2a4238b45","edf8fbb2e2e266c2a42ca25f006d2c","edf8fbccece699d8c966c2a42ca25f006d2c","edf8fbccece699d8c966c2a441ae76238b45005824","f7fcfde5f5f9ccece699d8c966c2a441ae76238b45005824","f7fcfde5f5f9ccece699d8c966c2a441ae76238b45006d2c00441b").map(X),Zb=ht(Hb);var Jb=new Array(3).concat("e0ecf49ebcda8856a7","edf8fbb3cde38c96c688419d","edf8fbb3cde38c96c68856a7810f7c","edf8fbbfd3e69ebcda8c96c68856a7810f7c","edf8fbbfd3e69ebcda8c96c68c6bb188419d6e016b","f7fcfde0ecf4bfd3e69ebcda8c96c68c6bb188419d6e016b","f7fcfde0ecf4bfd3e69ebcda8c96c68c6bb188419d810f7c4d004b").map(X),Qb=ht(Jb);var Kb=new Array(3).concat("e0f3dba8ddb543a2ca","f0f9e8bae4bc7bccc42b8cbe","f0f9e8bae4bc7bccc443a2ca0868ac","f0f9e8ccebc5a8ddb57bccc443a2ca0868ac","f0f9e8ccebc5a8ddb57bccc44eb3d32b8cbe08589e","f7fcf0e0f3dbccebc5a8ddb57bccc44eb3d32b8cbe08589e","f7fcf0e0f3dbccebc5a8ddb57bccc44eb3d32b8cbe0868ac084081").map(X),t1=ht(Kb);var e1=new Array(3).concat("fee8c8fdbb84e34a33","fef0d9fdcc8afc8d59d7301f","fef0d9fdcc8afc8d59e34a33b30000","fef0d9fdd49efdbb84fc8d59e34a33b30000","fef0d9fdd49efdbb84fc8d59ef6548d7301f990000","fff7ecfee8c8fdd49efdbb84fc8d59ef6548d7301f990000","fff7ecfee8c8fdd49efdbb84fc8d59ef6548d7301fb300007f0000").map(X),n1=ht(e1);var r1=new Array(3).concat("ece2f0a6bddb1c9099","f6eff7bdc9e167a9cf02818a","f6eff7bdc9e167a9cf1c9099016c59","f6eff7d0d1e6a6bddb67a9cf1c9099016c59","f6eff7d0d1e6a6bddb67a9cf3690c002818a016450","fff7fbece2f0d0d1e6a6bddb67a9cf3690c002818a016450","fff7fbece2f0d0d1e6a6bddb67a9cf3690c002818a016c59014636").map(X),i1=ht(r1);var o1=new Array(3).concat("ece7f2a6bddb2b8cbe","f1eef6bdc9e174a9cf0570b0","f1eef6bdc9e174a9cf2b8cbe045a8d","f1eef6d0d1e6a6bddb74a9cf2b8cbe045a8d","f1eef6d0d1e6a6bddb74a9cf3690c00570b0034e7b","fff7fbece7f2d0d1e6a6bddb74a9cf3690c00570b0034e7b","fff7fbece7f2d0d1e6a6bddb74a9cf3690c00570b0045a8d023858").map(X),s1=ht(o1);var a1=new Array(3).concat("e7e1efc994c7dd1c77","f1eef6d7b5d8df65b0ce1256","f1eef6d7b5d8df65b0dd1c77980043","f1eef6d4b9dac994c7df65b0dd1c77980043","f1eef6d4b9dac994c7df65b0e7298ace125691003f","f7f4f9e7e1efd4b9dac994c7df65b0e7298ace125691003f","f7f4f9e7e1efd4b9dac994c7df65b0e7298ace125698004367001f").map(X),c1=ht(a1);var l1=new Array(3).concat("fde0ddfa9fb5c51b8a","feebe2fbb4b9f768a1ae017e","feebe2fbb4b9f768a1c51b8a7a0177","feebe2fcc5c0fa9fb5f768a1c51b8a7a0177","feebe2fcc5c0fa9fb5f768a1dd3497ae017e7a0177","fff7f3fde0ddfcc5c0fa9fb5f768a1dd3497ae017e7a0177","fff7f3fde0ddfcc5c0fa9fb5f768a1dd3497ae017e7a017749006a").map(X),u1=ht(l1);var f1=new Array(3).concat("edf8b17fcdbb2c7fb8","ffffcca1dab441b6c4225ea8","ffffcca1dab441b6c42c7fb8253494","ffffccc7e9b47fcdbb41b6c42c7fb8253494","ffffccc7e9b47fcdbb41b6c41d91c0225ea80c2c84","ffffd9edf8b1c7e9b47fcdbb41b6c41d91c0225ea80c2c84","ffffd9edf8b1c7e9b47fcdbb41b6c41d91c0225ea8253494081d58").map(X),d1=ht(f1);var h1=new Array(3).concat("f7fcb9addd8e31a354","ffffccc2e69978c679238443","ffffccc2e69978c67931a354006837","ffffccd9f0a3addd8e78c67931a354006837","ffffccd9f0a3addd8e78c67941ab5d238443005a32","ffffe5f7fcb9d9f0a3addd8e78c67941ab5d238443005a32","ffffe5f7fcb9d9f0a3addd8e78c67941ab5d238443006837004529").map(X),p1=ht(h1);var m1=new Array(3).concat("fff7bcfec44fd95f0e","ffffd4fed98efe9929cc4c02","ffffd4fed98efe9929d95f0e993404","ffffd4fee391fec44ffe9929d95f0e993404","ffffd4fee391fec44ffe9929ec7014cc4c028c2d04","ffffe5fff7bcfee391fec44ffe9929ec7014cc4c028c2d04","ffffe5fff7bcfee391fec44ffe9929ec7014cc4c02993404662506").map(X),y1=ht(m1);var g1=new Array(3).concat("ffeda0feb24cf03b20","ffffb2fecc5cfd8d3ce31a1c","ffffb2fecc5cfd8d3cf03b20bd0026","ffffb2fed976feb24cfd8d3cf03b20bd0026","ffffb2fed976feb24cfd8d3cfc4e2ae31a1cb10026","ffffccffeda0fed976feb24cfd8d3cfc4e2ae31a1cb10026","ffffccffeda0fed976feb24cfd8d3cfc4e2ae31a1cbd0026800026").map(X),x1=ht(g1);var b1=new Array(3).concat("deebf79ecae13182bd","eff3ffbdd7e76baed62171b5","eff3ffbdd7e76baed63182bd08519c","eff3ffc6dbef9ecae16baed63182bd08519c","eff3ffc6dbef9ecae16baed64292c62171b5084594","f7fbffdeebf7c6dbef9ecae16baed64292c62171b5084594","f7fbffdeebf7c6dbef9ecae16baed64292c62171b508519c08306b").map(X),w1=ht(b1);var v1=new Array(3).concat("e5f5e0a1d99b31a354","edf8e9bae4b374c476238b45","edf8e9bae4b374c47631a354006d2c","edf8e9c7e9c0a1d99b74c47631a354006d2c","edf8e9c7e9c0a1d99b74c47641ab5d238b45005a32","f7fcf5e5f5e0c7e9c0a1d99b74c47641ab5d238b45005a32","f7fcf5e5f5e0c7e9c0a1d99b74c47641ab5d238b45006d2c00441b").map(X),_1=ht(v1);var S1=new Array(3).concat("f0f0f0bdbdbd636363","f7f7f7cccccc969696525252","f7f7f7cccccc969696636363252525","f7f7f7d9d9d9bdbdbd969696636363252525","f7f7f7d9d9d9bdbdbd969696737373525252252525","fffffff0f0f0d9d9d9bdbdbd969696737373525252252525","fffffff0f0f0d9d9d9bdbdbd969696737373525252252525000000").map(X),I1=ht(S1);var M1=new Array(3).concat("efedf5bcbddc756bb1","f2f0f7cbc9e29e9ac86a51a3","f2f0f7cbc9e29e9ac8756bb154278f","f2f0f7dadaebbcbddc9e9ac8756bb154278f","f2f0f7dadaebbcbddc9e9ac8807dba6a51a34a1486","fcfbfdefedf5dadaebbcbddc9e9ac8807dba6a51a34a1486","fcfbfdefedf5dadaebbcbddc9e9ac8807dba6a51a354278f3f007d").map(X),A1=ht(M1);var T1=new Array(3).concat("fee0d2fc9272de2d26","fee5d9fcae91fb6a4acb181d","fee5d9fcae91fb6a4ade2d26a50f15","fee5d9fcbba1fc9272fb6a4ade2d26a50f15","fee5d9fcbba1fc9272fb6a4aef3b2ccb181d99000d","fff5f0fee0d2fcbba1fc9272fb6a4aef3b2ccb181d99000d","fff5f0fee0d2fcbba1fc9272fb6a4aef3b2ccb181da50f1567000d").map(X),E1=ht(T1);var N1=new Array(3).concat("fee6cefdae6be6550d","feeddefdbe85fd8d3cd94701","feeddefdbe85fd8d3ce6550da63603","feeddefdd0a2fdae6bfd8d3ce6550da63603","feeddefdd0a2fdae6bfd8d3cf16913d948018c2d04","fff5ebfee6cefdd0a2fdae6bfd8d3cf16913d948018c2d04","fff5ebfee6cefdd0a2fdae6bfd8d3cf16913d94801a636037f2704").map(X),D1=ht(N1);function O1(e){return e=Math.max(0,Math.min(1,e)),"rgb("+Math.max(0,Math.min(255,Math.round(-4.54-e*(35.34-e*(2381.73-e*(6402.7-e*(7024.72-e*2710.57)))))))+", "+Math.max(0,Math.min(255,Math.round(32.49+e*(170.73+e*(52.82-e*(131.46-e*(176.58-e*67.37)))))))+", "+Math.max(0,Math.min(255,Math.round(81.24+e*(442.36-e*(2482.43-e*(6167.24-e*(6614.94-e*2475.67)))))))+")"}var B1=Ru(Zn(300,.5,0),Zn(-240,.5,1));var C1=Ru(Zn(-100,.75,.35),Zn(80,1.5,.8)),k1=Ru(Zn(260,.75,.35),Zn(80,1.5,.8)),L1=Zn();function F1(e){(e<0||e>1)&&(e-=Math.floor(e));var t=Math.abs(e-.5);return L1.h=360*e-100,L1.s=1.5-1.5*t,L1.l=.8-.9*t,L1+""}var R1=nn(),TZ=Math.PI/3,EZ=Math.PI*2/3;function $1(e){var t;return e=(.5-e)*Math.PI,R1.r=255*(t=Math.sin(e))*t,R1.g=255*(t=Math.sin(e+TZ))*t,R1.b=255*(t=Math.sin(e+EZ))*t,R1+""}function P1(e){return e=Math.max(0,Math.min(1,e)),"rgb("+Math.max(0,Math.min(255,Math.round(34.61+e*(1172.33-e*(10793.56-e*(33300.12-e*(38394.49-e*14825.05)))))))+", "+Math.max(0,Math.min(255,Math.round(23.31+e*(557.33+e*(1225.33-e*(3574.96-e*(1073.77+e*707.56)))))))+", "+Math.max(0,Math.min(255,Math.round(27.2+e*(3211.1-e*(15327.97-e*(27814-e*(22569.18-e*6838.66)))))))+")"}function U1(e){var t=e.length;return function(n){return e[Math.max(0,Math.min(t-1,Math.floor(n*t)))]}}var z1=U1(X("44015444025645045745055946075a46085c460a5d460b5e470d60470e6147106347116447136548146748166848176948186a481a6c481b6d481c6e481d6f481f70482071482173482374482475482576482677482878482979472a7a472c7a472d7b472e7c472f7d46307e46327e46337f463480453581453781453882443983443a83443b84433d84433e85423f854240864241864142874144874045884046883f47883f48893e49893e4a893e4c8a3d4d8a3d4e8a3c4f8a3c508b3b518b3b528b3a538b3a548c39558c39568c38588c38598c375a8c375b8d365c8d365d8d355e8d355f8d34608d34618d33628d33638d32648e32658e31668e31678e31688e30698e306a8e2f6b8e2f6c8e2e6d8e2e6e8e2e6f8e2d708e2d718e2c718e2c728e2c738e2b748e2b758e2a768e2a778e2a788e29798e297a8e297b8e287c8e287d8e277e8e277f8e27808e26818e26828e26828e25838e25848e25858e24868e24878e23888e23898e238a8d228b8d228c8d228d8d218e8d218f8d21908d21918c20928c20928c20938c1f948c1f958b1f968b1f978b1f988b1f998a1f9a8a1e9b8a1e9c891e9d891f9e891f9f881fa0881fa1881fa1871fa28720a38620a48621a58521a68522a78522a88423a98324aa8325ab8225ac8226ad8127ad8128ae8029af7f2ab07f2cb17e2db27d2eb37c2fb47c31b57b32b67a34b67935b77937b87838b9773aba763bbb753dbc743fbc7340bd7242be7144bf7046c06f48c16e4ac16d4cc26c4ec36b50c46a52c56954c56856c66758c7655ac8645cc8635ec96260ca6063cb5f65cb5e67cc5c69cd5b6ccd5a6ece5870cf5773d05675d05477d1537ad1517cd2507fd34e81d34d84d44b86d54989d5488bd6468ed64590d74393d74195d84098d83e9bd93c9dd93ba0da39a2da37a5db36a8db34aadc32addc30b0dd2fb2dd2db5de2bb8de29bade28bddf26c0df25c2df23c5e021c8e020cae11fcde11dd0e11cd2e21bd5e21ad8e219dae319dde318dfe318e2e418e5e419e7e419eae51aece51befe51cf1e51df4e61ef6e620f8e621fbe723fde725")),q1=U1(X("00000401000501010601010802010902020b02020d03030f03031204041405041606051806051a07061c08071e0907200a08220b09240c09260d0a290e0b2b100b2d110c2f120d31130d34140e36150e38160f3b180f3d19103f1a10421c10441d11471e114920114b21114e22115024125325125527125829115a2a115c2c115f2d11612f116331116533106734106936106b38106c390f6e3b0f703d0f713f0f72400f74420f75440f764510774710784910784a10794c117a4e117b4f127b51127c52137c54137d56147d57157e59157e5a167e5c167f5d177f5f187f601880621980641a80651a80671b80681c816a1c816b1d816d1d816e1e81701f81721f817320817521817621817822817922827b23827c23827e24828025828125818326818426818627818827818928818b29818c29818e2a81902a81912b81932b80942c80962c80982d80992d809b2e7f9c2e7f9e2f7fa02f7fa1307ea3307ea5317ea6317da8327daa337dab337cad347cae347bb0357bb2357bb3367ab5367ab73779b83779ba3878bc3978bd3977bf3a77c03a76c23b75c43c75c53c74c73d73c83e73ca3e72cc3f71cd4071cf4070d0416fd2426fd3436ed5446dd6456cd8456cd9466bdb476adc4869de4968df4a68e04c67e24d66e34e65e44f64e55064e75263e85362e95462ea5661eb5760ec5860ed5a5fee5b5eef5d5ef05f5ef1605df2625df2645cf3655cf4675cf4695cf56b5cf66c5cf66e5cf7705cf7725cf8745cf8765cf9785df9795df97b5dfa7d5efa7f5efa815ffb835ffb8560fb8761fc8961fc8a62fc8c63fc8e64fc9065fd9266fd9467fd9668fd9869fd9a6afd9b6bfe9d6cfe9f6dfea16efea36ffea571fea772fea973feaa74feac76feae77feb078feb27afeb47bfeb67cfeb77efeb97ffebb81febd82febf84fec185fec287fec488fec68afec88cfeca8dfecc8ffecd90fecf92fed194fed395fed597fed799fed89afdda9cfddc9efddea0fde0a1fde2a3fde3a5fde5a7fde7a9fde9aafdebacfcecaefceeb0fcf0b2fcf2b4fcf4b6fcf6b8fcf7b9fcf9bbfcfbbdfcfdbf")),j1=U1(X("00000401000501010601010802010a02020c02020e03021004031204031405041706041907051b08051d09061f0a07220b07240c08260d08290e092b10092d110a30120a32140b34150b37160b39180c3c190c3e1b0c411c0c431e0c451f0c48210c4a230c4c240c4f260c51280b53290b552b0b572d0b592f0a5b310a5c320a5e340a5f3609613809623909633b09643d09653e0966400a67420a68440a68450a69470b6a490b6a4a0c6b4c0c6b4d0d6c4f0d6c510e6c520e6d540f6d550f6d57106e59106e5a116e5c126e5d126e5f136e61136e62146e64156e65156e67166e69166e6a176e6c186e6d186e6f196e71196e721a6e741a6e751b6e771c6d781c6d7a1d6d7c1d6d7d1e6d7f1e6c801f6c82206c84206b85216b87216b88226a8a226a8c23698d23698f24699025689225689326679526679727669827669a28659b29649d29649f2a63a02a63a22b62a32c61a52c60a62d60a82e5fa92e5eab2f5ead305dae305cb0315bb1325ab3325ab43359b63458b73557b93556ba3655bc3754bd3853bf3952c03a51c13a50c33b4fc43c4ec63d4dc73e4cc83f4bca404acb4149cc4248ce4347cf4446d04545d24644d34743d44842d54a41d74b3fd84c3ed94d3dda4e3cdb503bdd513ade5238df5337e05536e15635e25734e35933e45a31e55c30e65d2fe75e2ee8602de9612bea632aeb6429eb6628ec6726ed6925ee6a24ef6c23ef6e21f06f20f1711ff1731df2741cf3761bf37819f47918f57b17f57d15f67e14f68013f78212f78410f8850ff8870ef8890cf98b0bf98c0af98e09fa9008fa9207fa9407fb9606fb9706fb9906fb9b06fb9d07fc9f07fca108fca309fca50afca60cfca80dfcaa0ffcac11fcae12fcb014fcb216fcb418fbb61afbb81dfbba1ffbbc21fbbe23fac026fac228fac42afac62df9c72ff9c932f9cb35f8cd37f8cf3af7d13df7d340f6d543f6d746f5d949f5db4cf4dd4ff4df53f4e156f3e35af3e55df2e661f2e865f2ea69f1ec6df1ed71f1ef75f1f179f2f27df2f482f3f586f3f68af4f88ef5f992f6fa96f8fb9af9fc9dfafda1fcffa4")),V1=U1(X("0d088710078813078916078a19068c1b068d1d068e20068f2206902406912605912805922a05932c05942e05952f059631059733059735049837049938049a3a049a3c049b3e049c3f049c41049d43039e44039e46039f48039f4903a04b03a14c02a14e02a25002a25102a35302a35502a45601a45801a45901a55b01a55c01a65e01a66001a66100a76300a76400a76600a76700a86900a86a00a86c00a86e00a86f00a87100a87201a87401a87501a87701a87801a87a02a87b02a87d03a87e03a88004a88104a78305a78405a78606a68707a68808a68a09a58b0aa58d0ba58e0ca48f0da4910ea3920fa39410a29511a19613a19814a099159f9a169f9c179e9d189d9e199da01a9ca11b9ba21d9aa31e9aa51f99a62098a72197a82296aa2395ab2494ac2694ad2793ae2892b02991b12a90b22b8fb32c8eb42e8db52f8cb6308bb7318ab83289ba3388bb3488bc3587bd3786be3885bf3984c03a83c13b82c23c81c33d80c43e7fc5407ec6417dc7427cc8437bc9447aca457acb4679cc4778cc4977cd4a76ce4b75cf4c74d04d73d14e72d24f71d35171d45270d5536fd5546ed6556dd7566cd8576bd9586ada5a6ada5b69db5c68dc5d67dd5e66de5f65de6164df6263e06363e16462e26561e26660e3685fe4695ee56a5de56b5de66c5ce76e5be76f5ae87059e97158e97257ea7457eb7556eb7655ec7754ed7953ed7a52ee7b51ef7c51ef7e50f07f4ff0804ef1814df1834cf2844bf3854bf3874af48849f48948f58b47f58c46f68d45f68f44f79044f79143f79342f89441f89540f9973ff9983ef99a3efa9b3dfa9c3cfa9e3bfb9f3afba139fba238fca338fca537fca636fca835fca934fdab33fdac33fdae32fdaf31fdb130fdb22ffdb42ffdb52efeb72dfeb82cfeba2cfebb2bfebd2afebe2afec029fdc229fdc328fdc527fdc627fdc827fdca26fdcb26fccd25fcce25fcd025fcd225fbd324fbd524fbd724fad824fada24f9dc24f9dd25f8df25f8e125f7e225f7e425f6e626f6e826f5e926f5eb27f4ed27f3ee27f3f027f2f227f1f426f1f525f0f724f0f921"));function Ze(e){return function(){return e}}var sA=Math.cos;var ff=Math.min,mm=Math.sin,ee=Math.sqrt,aA=1e-12,wl=Math.PI,uNt=wl/2,df=2*wl;function Y1(e){let t=3;return e.digits=function(n){if(!arguments.length)return t;if(n==null)t=null;else{let r=Math.floor(n);if(!(r>=0))throw new RangeError(`invalid digits: ${n}`);t=r}return e},()=>new Ra(t)}var pNt=Array.prototype.slice;function X1(e){return typeof e=="object"&&"length"in e?e:Array.from(e)}function sF(e){this._context=e}sF.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._point=0},lineEnd:function(){(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;default:this._context.lineTo(e,t);break}}};function Vs(e){return new sF(e)}function G1(e){return e[0]}function W1(e){return e[1]}function ym(e,t){var n=Ze(!0),r=null,i=Vs,o=null,s=Y1(a);e=typeof e=="function"?e:e===void 0?G1:Ze(e),t=typeof t=="function"?t:t===void 0?W1:Ze(t);function a(c){var l,u=(c=X1(c)).length,f,d=!1,h;for(r==null&&(o=i(h=s())),l=0;l<=u;++l)!(l<u&&n(f=c[l],l,c))===d&&((d=!d)?o.lineStart():o.lineEnd()),d&&o.point(+e(f,l,c),+t(f,l,c));if(h)return o=null,h+""||null}return a.x=function(c){return arguments.length?(e=typeof c=="function"?c:Ze(+c),a):e},a.y=function(c){return arguments.length?(t=typeof c=="function"?c:Ze(+c),a):t},a.defined=function(c){return arguments.length?(n=typeof c=="function"?c:Ze(!!c),a):n},a.curve=function(c){return arguments.length?(i=c,r!=null&&(o=i(r)),a):i},a.context=function(c){return arguments.length?(c==null?r=o=null:o=i(r=c),a):r},a}function hf(e,t,n){var r=null,i=Ze(!0),o=null,s=Vs,a=null,c=Y1(l);e=typeof e=="function"?e:e===void 0?G1:Ze(+e),t=typeof t=="function"?t:t===void 0?Ze(0):Ze(+t),n=typeof n=="function"?n:n===void 0?W1:Ze(+n);function l(f){var d,h,p,m=(f=X1(f)).length,g,y=!1,x,b=new Array(m),w=new Array(m);for(o==null&&(a=s(x=c())),d=0;d<=m;++d){if(!(d<m&&i(g=f[d],d,f))===y)if(y=!y)h=d,a.areaStart(),a.lineStart();else{for(a.lineEnd(),a.lineStart(),p=d-1;p>=h;--p)a.point(b[p],w[p]);a.lineEnd(),a.areaEnd()}y&&(b[d]=+e(g,d,f),w[d]=+t(g,d,f),a.point(r?+r(g,d,f):b[d],n?+n(g,d,f):w[d]))}if(x)return a=null,x+""||null}function u(){return ym().defined(i).curve(s).context(o)}return l.x=function(f){return arguments.length?(e=typeof f=="function"?f:Ze(+f),r=null,l):e},l.x0=function(f){return arguments.length?(e=typeof f=="function"?f:Ze(+f),l):e},l.x1=function(f){return arguments.length?(r=f==null?null:typeof f=="function"?f:Ze(+f),l):r},l.y=function(f){return arguments.length?(t=typeof f=="function"?f:Ze(+f),n=null,l):t},l.y0=function(f){return arguments.length?(t=typeof f=="function"?f:Ze(+f),l):t},l.y1=function(f){return arguments.length?(n=f==null?null:typeof f=="function"?f:Ze(+f),l):n},l.lineX0=l.lineY0=function(){return u().x(e).y(t)},l.lineY1=function(){return u().x(e).y(n)},l.lineX1=function(){return u().x(r).y(t)},l.defined=function(f){return arguments.length?(i=typeof f=="function"?f:Ze(!!f),l):i},l.curve=function(f){return arguments.length?(s=f,o!=null&&(a=s(o)),l):s},l.context=function(f){return arguments.length?(f==null?o=a=null:a=s(o=f),l):o},l}var H1=class{constructor(t,n){this._context=t,this._x=n}areaStart(){this._line=0}areaEnd(){this._line=NaN}lineStart(){this._point=0}lineEnd(){(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line}point(t,n){switch(t=+t,n=+n,this._point){case 0:{this._point=1,this._line?this._context.lineTo(t,n):this._context.moveTo(t,n);break}case 1:this._point=2;default:{this._x?this._context.bezierCurveTo(this._x0=(this._x0+t)/2,this._y0,this._x0,n,t,n):this._context.bezierCurveTo(this._x0,this._y0=(this._y0+n)/2,t,this._y0,t,n);break}}this._x0=t,this._y0=n}};function cA(e){return new H1(e,!0)}function lA(e){return new H1(e,!1)}var NZ=ee(3),gm={draw(e,t){let n=ee(t+ff(t/28,.75))*.59436,r=n/2,i=r*NZ;e.moveTo(0,n),e.lineTo(0,-n),e.moveTo(-i,-r),e.lineTo(i,r),e.moveTo(-i,r),e.lineTo(i,-r)}};var Ys={draw(e,t){let n=ee(t/wl);e.moveTo(n,0),e.arc(0,0,n,0,df)}};var xm={draw(e,t){let n=ee(t/5)/2;e.moveTo(-3*n,-n),e.lineTo(-n,-n),e.lineTo(-n,-3*n),e.lineTo(n,-3*n),e.lineTo(n,-n),e.lineTo(3*n,-n),e.lineTo(3*n,n),e.lineTo(n,n),e.lineTo(n,3*n),e.lineTo(-n,3*n),e.lineTo(-n,n),e.lineTo(-3*n,n),e.closePath()}};var aF=ee(1/3),DZ=aF*2,bm={draw(e,t){let n=ee(t/DZ),r=n*aF;e.moveTo(0,-n),e.lineTo(r,0),e.lineTo(0,n),e.lineTo(-r,0),e.closePath()}};var wm={draw(e,t){let n=ee(t)*.62625;e.moveTo(0,-n),e.lineTo(n,0),e.lineTo(0,n),e.lineTo(-n,0),e.closePath()}};var vm={draw(e,t){let n=ee(t-ff(t/7,2))*.87559;e.moveTo(-n,0),e.lineTo(n,0),e.moveTo(0,n),e.lineTo(0,-n)}};var _m={draw(e,t){let n=ee(t),r=-n/2;e.rect(r,r,n,n)}};var Sm={draw(e,t){let n=ee(t)*.4431;e.moveTo(n,n),e.lineTo(n,-n),e.lineTo(-n,-n),e.lineTo(-n,n),e.closePath()}};var OZ=.8908130915292852,cF=mm(wl/10)/mm(7*wl/10),BZ=mm(df/10)*cF,LZ=-sA(df/10)*cF,Im={draw(e,t){let n=ee(t*OZ),r=BZ*n,i=LZ*n;e.moveTo(0,-n),e.lineTo(r,i);for(let o=1;o<5;++o){let s=df*o/5,a=sA(s),c=mm(s);e.lineTo(c*n,-a*n),e.lineTo(a*r-c*i,c*r+a*i)}e.closePath()}};var uA=ee(3),Mm={draw(e,t){let n=-ee(t/(uA*3));e.moveTo(0,n*2),e.lineTo(-uA*n,-n),e.lineTo(uA*n,-n),e.closePath()}};var CZ=ee(3),Am={draw(e,t){let n=ee(t)*.6824,r=n/2,i=n*CZ/2;e.moveTo(0,-n),e.lineTo(i,r),e.lineTo(-i,r),e.closePath()}};var fi=-.5,di=ee(3)/2,fA=1/ee(12),kZ=(fA/2+1)*3,Tm={draw(e,t){let n=ee(t/kZ),r=n/2,i=n*fA,o=r,s=n*fA+n,a=-o,c=s;e.moveTo(r,i),e.lineTo(o,s),e.lineTo(a,c),e.lineTo(fi*r-di*i,di*r+fi*i),e.lineTo(fi*o-di*s,di*o+fi*s),e.lineTo(fi*a-di*c,di*a+fi*c),e.lineTo(fi*r+di*i,fi*i-di*r),e.lineTo(fi*o+di*s,fi*s-di*o),e.lineTo(fi*a+di*c,fi*c-di*a),e.closePath()}};var pf={draw(e,t){let n=ee(t-ff(t/6,1.7))*.6189;e.moveTo(-n,-n),e.lineTo(n,n),e.moveTo(-n,n),e.lineTo(n,-n)}};var Z1=[Ys,xm,bm,_m,Im,Mm,Tm],dA=[Ys,vm,pf,Am,gm,Sm,wm];function hi(){}function mf(e,t,n){e._context.bezierCurveTo((2*e._x0+e._x1)/3,(2*e._y0+e._y1)/3,(e._x0+2*e._x1)/3,(e._y0+2*e._y1)/3,(e._x0+4*e._x1+t)/6,(e._y0+4*e._y1+n)/6)}function Em(e){this._context=e}Em.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:mf(this,this._x1,this._y1);case 2:this._context.lineTo(this._x1,this._y1);break}(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);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:mf(this,e,t);break}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t}};function hA(e){return new Em(e)}function lF(e){this._context=e}lF.prototype={areaStart:hi,areaEnd:hi,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);break}}},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._x2=e,this._y2=t;break;case 1:this._point=2,this._x3=e,this._y3=t;break;case 2:this._point=3,this._x4=e,this._y4=t,this._context.moveTo((this._x0+4*this._x1+e)/6,(this._y0+4*this._y1+t)/6);break;default:mf(this,e,t);break}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t}};function pA(e){return new lF(e)}function uF(e){this._context=e}uF.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||this._line!==0&&this._point===3)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){switch(e=+e,t=+t,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+e)/6,r=(this._y0+4*this._y1+t)/6;this._line?this._context.lineTo(n,r):this._context.moveTo(n,r);break;case 3:this._point=4;default:mf(this,e,t);break}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t}};function mA(e){return new uF(e)}function fF(e,t){this._basis=new Em(e),this._beta=t}fF.prototype={lineStart:function(){this._x=[],this._y=[],this._basis.lineStart()},lineEnd:function(){var e=this._x,t=this._y,n=e.length-1;if(n>0)for(var r=e[0],i=t[0],o=e[n]-r,s=t[n]-i,a=-1,c;++a<=n;)c=a/n,this._basis.point(this._beta*e[a]+(1-this._beta)*(r+c*o),this._beta*t[a]+(1-this._beta)*(i+c*s));this._x=this._y=null,this._basis.lineEnd()},point:function(e,t){this._x.push(+e),this._y.push(+t)}};var yA=function e(t){function n(r){return t===1?new Em(r):new fF(r,t)}return n.beta=function(r){return e(+r)},n}(.85);function yf(e,t,n){e._context.bezierCurveTo(e._x1+e._k*(e._x2-e._x0),e._y1+e._k*(e._y2-e._y0),e._x2+e._k*(e._x1-t),e._y2+e._k*(e._y1-n),e._x2,e._y2)}function J1(e,t){this._context=e,this._k=(1-t)/6}J1.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:yf(this,this._x1,this._y1);break}(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2,this._x1=e,this._y1=t;break;case 2:this._point=3;default:yf(this,e,t);break}this._x0=this._x1,this._x1=this._x2,this._x2=e,this._y0=this._y1,this._y1=this._y2,this._y2=t}};var gA=function e(t){function n(r){return new J1(r,t)}return n.tension=function(r){return e(+r)},n}(0);function Q1(e,t){this._context=e,this._k=(1-t)/6}Q1.prototype={areaStart:hi,areaEnd:hi,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);break}}},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._x3=e,this._y3=t;break;case 1:this._point=2,this._context.moveTo(this._x4=e,this._y4=t);break;case 2:this._point=3,this._x5=e,this._y5=t;break;default:yf(this,e,t);break}this._x0=this._x1,this._x1=this._x2,this._x2=e,this._y0=this._y1,this._y1=this._y2,this._y2=t}};var xA=function e(t){function n(r){return new Q1(r,t)}return n.tension=function(r){return e(+r)},n}(0);function K1(e,t){this._context=e,this._k=(1-t)/6}K1.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||this._line!==0&&this._point===3)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){switch(e=+e,t=+t,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:yf(this,e,t);break}this._x0=this._x1,this._x1=this._x2,this._x2=e,this._y0=this._y1,this._y1=this._y2,this._y2=t}};var bA=function e(t){function n(r){return new K1(r,t)}return n.tension=function(r){return e(+r)},n}(0);function Nm(e,t,n){var r=e._x1,i=e._y1,o=e._x2,s=e._y2;if(e._l01_a>aA){var a=2*e._l01_2a+3*e._l01_a*e._l12_a+e._l12_2a,c=3*e._l01_a*(e._l01_a+e._l12_a);r=(r*a-e._x0*e._l12_2a+e._x2*e._l01_2a)/c,i=(i*a-e._y0*e._l12_2a+e._y2*e._l01_2a)/c}if(e._l23_a>aA){var l=2*e._l23_2a+3*e._l23_a*e._l12_a+e._l12_2a,u=3*e._l23_a*(e._l23_a+e._l12_a);o=(o*l+e._x1*e._l23_2a-t*e._l12_2a)/u,s=(s*l+e._y1*e._l23_2a-n*e._l12_2a)/u}e._context.bezierCurveTo(r,i,o,s,e._x2,e._y2)}function dF(e,t){this._context=e,this._alpha=t}dF.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);break}(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){if(e=+e,t=+t,this._point){var n=this._x2-e,r=this._y2-t;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(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;break;case 2:this._point=3;default:Nm(this,e,t);break}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=e,this._y0=this._y1,this._y1=this._y2,this._y2=t}};var wA=function e(t){function n(r){return t?new dF(r,t):new J1(r,0)}return n.alpha=function(r){return e(+r)},n}(.5);function hF(e,t){this._context=e,this._alpha=t}hF.prototype={areaStart:hi,areaEnd:hi,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);break}}},point:function(e,t){if(e=+e,t=+t,this._point){var n=this._x2-e,r=this._y2-t;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=e,this._y3=t;break;case 1:this._point=2,this._context.moveTo(this._x4=e,this._y4=t);break;case 2:this._point=3,this._x5=e,this._y5=t;break;default:Nm(this,e,t);break}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=e,this._y0=this._y1,this._y1=this._y2,this._y2=t}};var vA=function e(t){function n(r){return t?new hF(r,t):new Q1(r,0)}return n.alpha=function(r){return e(+r)},n}(.5);function pF(e,t){this._context=e,this._alpha=t}pF.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||this._line!==0&&this._point===3)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){if(e=+e,t=+t,this._point){var n=this._x2-e,r=this._y2-t;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:Nm(this,e,t);break}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=e,this._y0=this._y1,this._y1=this._y2,this._y2=t}};var _A=function e(t){function n(r){return t?new pF(r,t):new K1(r,0)}return n.alpha=function(r){return e(+r)},n}(.5);function mF(e){this._context=e}mF.prototype={areaStart:hi,areaEnd:hi,lineStart:function(){this._point=0},lineEnd:function(){this._point&&this._context.closePath()},point:function(e,t){e=+e,t=+t,this._point?this._context.lineTo(e,t):(this._point=1,this._context.moveTo(e,t))}};function SA(e){return new mF(e)}function yF(e){return e<0?-1:1}function gF(e,t,n){var r=e._x1-e._x0,i=t-e._x1,o=(e._y1-e._y0)/(r||i<0&&-0),s=(n-e._y1)/(i||r<0&&-0),a=(o*i+s*r)/(r+i);return(yF(o)+yF(s))*Math.min(Math.abs(o),Math.abs(s),.5*Math.abs(a))||0}function xF(e,t){var n=e._x1-e._x0;return n?(3*(e._y1-e._y0)/n-t)/2:t}function IA(e,t,n){var r=e._x0,i=e._y0,o=e._x1,s=e._y1,a=(o-r)/3;e._context.bezierCurveTo(r+a,i+a*t,o-a,s-a*n,o,s)}function tw(e){this._context=e}tw.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:IA(this,this._t0,xF(this,this._t0));break}(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){var n=NaN;if(e=+e,t=+t,!(e===this._x1&&t===this._y1)){switch(this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;break;case 2:this._point=3,IA(this,xF(this,n=gF(this,e,t)),n);break;default:IA(this,this._t0,n=gF(this,e,t));break}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t,this._t0=n}}};function bF(e){this._context=new wF(e)}(bF.prototype=Object.create(tw.prototype)).point=function(e,t){tw.prototype.point.call(this,t,e)};function wF(e){this._context=e}wF.prototype={moveTo:function(e,t){this._context.moveTo(t,e)},closePath:function(){this._context.closePath()},lineTo:function(e,t){this._context.lineTo(t,e)},bezierCurveTo:function(e,t,n,r,i,o){this._context.bezierCurveTo(t,e,r,n,o,i)}};function MA(e){return new tw(e)}function AA(e){return new bF(e)}function _F(e){this._context=e}_F.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x=[],this._y=[]},lineEnd:function(){var e=this._x,t=this._y,n=e.length;if(n)if(this._line?this._context.lineTo(e[0],t[0]):this._context.moveTo(e[0],t[0]),n===2)this._context.lineTo(e[1],t[1]);else for(var r=vF(e),i=vF(t),o=0,s=1;s<n;++o,++s)this._context.bezierCurveTo(r[0][o],i[0][o],r[1][o],i[1][o],e[s],t[s]);(this._line||this._line!==0&&n===1)&&this._context.closePath(),this._line=1-this._line,this._x=this._y=null},point:function(e,t){this._x.push(+e),this._y.push(+t)}};function vF(e){var t,n=e.length-1,r,i=new Array(n),o=new Array(n),s=new Array(n);for(i[0]=0,o[0]=2,s[0]=e[0]+2*e[1],t=1;t<n-1;++t)i[t]=1,o[t]=4,s[t]=4*e[t]+2*e[t+1];for(i[n-1]=2,o[n-1]=7,s[n-1]=8*e[n-1]+e[n],t=1;t<n;++t)r=i[t]/o[t-1],o[t]-=r,s[t]-=r*s[t-1];for(i[n-1]=s[n-1]/o[n-1],t=n-2;t>=0;--t)i[t]=(s[t]-i[t+1])/o[t];for(o[n-1]=(e[n]+i[n-1])/2,t=0;t<n-1;++t)o[t]=2*e[t+1]-i[t+1];return[i,o]}function TA(e){return new _F(e)}function ew(e,t){this._context=e,this._t=t}ew.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&&this._point===2&&this._context.lineTo(this._x,this._y),(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line>=0&&(this._t=1-this._t,this._line=1-this._line)},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;default:{if(this._t<=0)this._context.lineTo(this._x,t),this._context.lineTo(e,t);else{var n=this._x*(1-this._t)+e*this._t;this._context.lineTo(n,this._y),this._context.lineTo(n,t)}break}}this._x=e,this._y=t}};function EA(e){return new ew(e,.5)}function NA(e){return new ew(e,0)}function DA(e){return new ew(e,1)}var Dm=e=>()=>e;function OA(e,{sourceEvent:t,target:n,transform:r,dispatch:i}){Object.defineProperties(this,{type:{value:e,enumerable:!0,configurable:!0},sourceEvent:{value:t,enumerable:!0,configurable:!0},target:{value:n,enumerable:!0,configurable:!0},transform:{value:r,enumerable:!0,configurable:!0},_:{value:i}})}function zr(e,t,n){this.k=e,this.x=t,this.y=n}zr.prototype={constructor:zr,scale:function(e){return e===1?this:new zr(this.k*e,this.x,this.y)},translate:function(e,t){return e===0&t===0?this:new zr(this.k,this.x+this.k*e,this.y+this.k*t)},apply:function(e){return[e[0]*this.k+this.x,e[1]*this.k+this.y]},applyX:function(e){return e*this.k+this.x},applyY:function(e){return e*this.k+this.y},invert:function(e){return[(e[0]-this.x)/this.k,(e[1]-this.y)/this.k]},invertX:function(e){return(e-this.x)/this.k},invertY:function(e){return(e-this.y)/this.k},rescaleX:function(e){return e.copy().domain(e.range().map(this.invertX,this).map(e.invert,e))},rescaleY:function(e){return e.copy().domain(e.range().map(this.invertY,this).map(e.invert,e))},toString:function(){return"translate("+this.x+","+this.y+") scale("+this.k+")"}};var Om=new zr(1,0,0);BA.prototype=zr.prototype;function BA(e){for(;!e.__zoom;)if(!(e=e.parentNode))return Om;return e.__zoom}function nw(e){e.stopImmediatePropagation()}function gf(e){e.preventDefault(),e.stopImmediatePropagation()}function FZ(e){return(!e.ctrlKey||e.type==="wheel")&&!e.button}function RZ(){var e=this;return e instanceof SVGElement?(e=e.ownerSVGElement||e,e.hasAttribute("viewBox")?(e=e.viewBox.baseVal,[[e.x,e.y],[e.x+e.width,e.y+e.height]]):[[0,0],[e.width.baseVal.value,e.height.baseVal.value]]):[[0,0],[e.clientWidth,e.clientHeight]]}function SF(){return this.__zoom||Om}function $Z(e){return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*(e.ctrlKey?10:1)}function PZ(){return navigator.maxTouchPoints||"ontouchstart"in this}function UZ(e,t,n){var r=e.invertX(t[0][0])-n[0][0],i=e.invertX(t[1][0])-n[1][0],o=e.invertY(t[0][1])-n[0][1],s=e.invertY(t[1][1])-n[1][1];return e.translate(i>r?(r+i)/2:Math.min(0,r)||Math.max(0,i),s>o?(o+s)/2:Math.min(0,o)||Math.max(0,s))}function LA(){var e=FZ,t=RZ,n=UZ,r=$Z,i=PZ,o=[0,1/0],s=[[-1/0,-1/0],[1/0,1/0]],a=250,c=aI,l=Wc("start","zoom","end"),u,f,d,h=500,p=150,m=0,g=10;function y(S){S.property("__zoom",SF).on("wheel.zoom",E,{passive:!1}).on("mousedown.zoom",D).on("dblclick.zoom",I).filter(i).on("touchstart.zoom",T).on("touchmove.zoom",O).on("touchend.zoom touchcancel.zoom",L).style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}y.transform=function(S,A,N,k){var R=S.selection?S.selection():S;R.property("__zoom",SF),S!==R?_(S,A,N,k):R.interrupt().each(function(){v(this,arguments).event(k).start().zoom(null,typeof A=="function"?A.apply(this,arguments):A).end()})},y.scaleBy=function(S,A,N,k){y.scaleTo(S,function(){var R=this.__zoom.k,F=typeof A=="function"?A.apply(this,arguments):A;return R*F},N,k)},y.scaleTo=function(S,A,N,k){y.transform(S,function(){var R=t.apply(this,arguments),F=this.__zoom,$=N==null?w(R):typeof N=="function"?N.apply(this,arguments):N,P=F.invert($),U=typeof A=="function"?A.apply(this,arguments):A;return n(b(x(F,U),$,P),R,s)},N,k)},y.translateBy=function(S,A,N,k){y.transform(S,function(){return n(this.__zoom.translate(typeof A=="function"?A.apply(this,arguments):A,typeof N=="function"?N.apply(this,arguments):N),t.apply(this,arguments),s)},null,k)},y.translateTo=function(S,A,N,k,R){y.transform(S,function(){var F=t.apply(this,arguments),$=this.__zoom,P=k==null?w(F):typeof k=="function"?k.apply(this,arguments):k;return n(Om.translate(P[0],P[1]).scale($.k).translate(typeof A=="function"?-A.apply(this,arguments):-A,typeof N=="function"?-N.apply(this,arguments):-N),F,s)},k,R)};function x(S,A){return A=Math.max(o[0],Math.min(o[1],A)),A===S.k?S:new zr(A,S.x,S.y)}function b(S,A,N){var k=A[0]-N[0]*S.k,R=A[1]-N[1]*S.k;return k===S.x&&R===S.y?S:new zr(S.k,k,R)}function w(S){return[(+S[0][0]+ +S[1][0])/2,(+S[0][1]+ +S[1][1])/2]}function _(S,A,N,k){S.on("start.zoom",function(){v(this,arguments).event(k).start()}).on("interrupt.zoom end.zoom",function(){v(this,arguments).event(k).end()}).tween("zoom",function(){var R=this,F=arguments,$=v(R,F).event(k),P=t.apply(R,F),U=N==null?w(P):typeof N=="function"?N.apply(R,F):N,W=Math.max(P[1][0]-P[0][0],P[1][1]-P[0][1]),tt=R.__zoom,nt=typeof A=="function"?A.apply(R,F):A,st=c(tt.invert(U).concat(W/tt.k),nt.invert(U).concat(W/nt.k));return function(Y){if(Y===1)Y=nt;else{var rt=st(Y),q=W/rt[2];Y=new zr(q,U[0]-rt[0]*q,U[1]-rt[1]*q)}$.zoom(null,Y)}})}function v(S,A,N){return!N&&S.__zooming||new M(S,A)}function M(S,A){this.that=S,this.args=A,this.active=0,this.sourceEvent=null,this.extent=t.apply(S,A),this.taps=0}M.prototype={event:function(S){return S&&(this.sourceEvent=S),this},start:function(){return++this.active===1&&(this.that.__zooming=this,this.emit("start")),this},zoom:function(S,A){return this.mouse&&S!=="mouse"&&(this.mouse[1]=A.invert(this.mouse[0])),this.touch0&&S!=="touch"&&(this.touch0[1]=A.invert(this.touch0[0])),this.touch1&&S!=="touch"&&(this.touch1[1]=A.invert(this.touch1[0])),this.that.__zoom=A,this.emit("zoom"),this},end:function(){return--this.active===0&&(delete this.that.__zooming,this.emit("end")),this},emit:function(S){var A=jt(this.that).datum();l.call(S,this.that,new OA(S,{sourceEvent:this.sourceEvent,target:y,type:S,transform:this.that.__zoom,dispatch:l}),A)}};function E(S,...A){if(!e.apply(this,arguments))return;var N=v(this,A).event(S),k=this.__zoom,R=Math.max(o[0],Math.min(o[1],k.k*Math.pow(2,r.apply(this,arguments)))),F=Ln(S);if(N.wheel)(N.mouse[0][0]!==F[0]||N.mouse[0][1]!==F[1])&&(N.mouse[1]=k.invert(N.mouse[0]=F)),clearTimeout(N.wheel);else{if(k.k===R)return;N.mouse=[F,k.invert(F)],xo(this),N.start()}gf(S),N.wheel=setTimeout($,p),N.zoom("mouse",n(b(x(k,R),N.mouse[0],N.mouse[1]),N.extent,s));function $(){N.wheel=null,N.end()}}function D(S,...A){if(d||!e.apply(this,arguments))return;var N=S.currentTarget,k=v(this,A,!0).event(S),R=jt(S.view).on("mousemove.zoom",U,!0).on("mouseup.zoom",W,!0),F=Ln(S,N),$=S.clientX,P=S.clientY;ap(S.view),nw(S),k.mouse=[F,this.__zoom.invert(F)],xo(this),k.start();function U(tt){if(gf(tt),!k.moved){var nt=tt.clientX-$,st=tt.clientY-P;k.moved=nt*nt+st*st>m}k.event(tt).zoom("mouse",n(b(k.that.__zoom,k.mouse[0]=Ln(tt,N),k.mouse[1]),k.extent,s))}function W(tt){R.on("mousemove.zoom mouseup.zoom",null),cp(tt.view,k.moved),gf(tt),k.event(tt).end()}}function I(S,...A){if(e.apply(this,arguments)){var N=this.__zoom,k=Ln(S.changedTouches?S.changedTouches[0]:S,this),R=N.invert(k),F=N.k*(S.shiftKey?.5:2),$=n(b(x(N,F),k,R),t.apply(this,A),s);gf(S),a>0?jt(this).transition().duration(a).call(_,$,k,S):jt(this).call(y.transform,$,k,S)}}function T(S,...A){if(e.apply(this,arguments)){var N=S.touches,k=N.length,R=v(this,A,S.changedTouches.length===k).event(S),F,$,P,U;for(nw(S),$=0;$<k;++$)P=N[$],U=Ln(P,this),U=[U,this.__zoom.invert(U),P.identifier],R.touch0?!R.touch1&&R.touch0[2]!==U[2]&&(R.touch1=U,R.taps=0):(R.touch0=U,F=!0,R.taps=1+!!u);u&&(u=clearTimeout(u)),F&&(R.taps<2&&(f=U[0],u=setTimeout(function(){u=null},h)),xo(this),R.start())}}function O(S,...A){if(this.__zooming){var N=v(this,A).event(S),k=S.changedTouches,R=k.length,F,$,P,U;for(gf(S),F=0;F<R;++F)$=k[F],P=Ln($,this),N.touch0&&N.touch0[2]===$.identifier?N.touch0[0]=P:N.touch1&&N.touch1[2]===$.identifier&&(N.touch1[0]=P);if($=N.that.__zoom,N.touch1){var W=N.touch0[0],tt=N.touch0[1],nt=N.touch1[0],st=N.touch1[1],Y=(Y=nt[0]-W[0])*Y+(Y=nt[1]-W[1])*Y,rt=(rt=st[0]-tt[0])*rt+(rt=st[1]-tt[1])*rt;$=x($,Math.sqrt(Y/rt)),P=[(W[0]+nt[0])/2,(W[1]+nt[1])/2],U=[(tt[0]+st[0])/2,(tt[1]+st[1])/2]}else if(N.touch0)P=N.touch0[0],U=N.touch0[1];else return;N.zoom("touch",n(b($,P,U),N.extent,s))}}function L(S,...A){if(this.__zooming){var N=v(this,A).event(S),k=S.changedTouches,R=k.length,F,$;for(nw(S),d&&clearTimeout(d),d=setTimeout(function(){d=null},h),F=0;F<R;++F)$=k[F],N.touch0&&N.touch0[2]===$.identifier?delete N.touch0:N.touch1&&N.touch1[2]===$.identifier&&delete N.touch1;if(N.touch1&&!N.touch0&&(N.touch0=N.touch1,delete N.touch1),N.touch0)N.touch0[1]=this.__zoom.invert(N.touch0[0]);else if(N.end(),N.taps===2&&($=Ln($,this),Math.hypot(f[0]-$[0],f[1]-$[1])<g)){var P=jt(this).on("dblclick.zoom");P&&P.apply(this,arguments)}}}return y.wheelDelta=function(S){return arguments.length?(r=typeof S=="function"?S:Dm(+S),y):r},y.filter=function(S){return arguments.length?(e=typeof S=="function"?S:Dm(!!S),y):e},y.touchable=function(S){return arguments.length?(i=typeof S=="function"?S:Dm(!!S),y):i},y.extent=function(S){return arguments.length?(t=typeof S=="function"?S:Dm([[+S[0][0],+S[0][1]],[+S[1][0],+S[1][1]]]),y):t},y.scaleExtent=function(S){return arguments.length?(o[0]=+S[0],o[1]=+S[1],y):[o[0],o[1]]},y.translateExtent=function(S){return arguments.length?(s[0][0]=+S[0][0],s[1][0]=+S[1][0],s[0][1]=+S[0][1],s[1][1]=+S[1][1],y):[[s[0][0],s[0][1]],[s[1][0],s[1][1]]]},y.constrain=function(S){return arguments.length?(n=S,y):n},y.duration=function(S){return arguments.length?(a=+S,y):a},y.interpolate=function(S){return arguments.length?(c=S,y):c},y.on=function(){var S=l.on.apply(l,arguments);return S===l?y:S},y.clickDistance=function(S){return arguments.length?(m=(S=+S)*S,y):Math.sqrt(m)},y.tapDistance=function(S){return arguments.length?(g=+S,y):g},y}function Ue(e){return e!=null&&!Number.isNaN(e)}function ln(e,t){return+Ue(t)-+Ue(e)||zt(e,t)}function vl(e,t){return+Ue(t)-+Ue(e)||Xn(e,t)}function Bm(e){return e!=null&&`${e}`!=""}function xf(e){return isFinite(e)?e:NaN}function rr(e){return e>0&&isFinite(e)?e:NaN}function Xa(e){return e<0&&isFinite(e)?e:NaN}function bf(e,t){if(e instanceof Date||(e=new Date(+e)),isNaN(e))return typeof t=="function"?t(e):t;let n=e.getUTCHours(),r=e.getUTCMinutes(),i=e.getUTCSeconds(),o=e.getUTCMilliseconds();return`${zZ(e.getUTCFullYear(),4)}-${Xs(e.getUTCMonth()+1,2)}-${Xs(e.getUTCDate(),2)}${n||r||i||o?`T${Xs(n,2)}:${Xs(r,2)}${i||o?`:${Xs(i,2)}${o?`.${Xs(o,3)}`:""}`:""}Z`:""}`}function zZ(e){return e<0?`-${Xs(-e,6)}`:e>9999?`+${Xs(e,6)}`:Xs(e,4)}function Xs(e,t){return`${e}`.padStart(t,"0")}var qZ=/^(?:[-+]\d{2})?\d{4}(?:-\d{2}(?:-\d{2})?)?(?:T\d{2}:\d{2}(?::\d{2}(?:\.\d{3})?)?(?:Z|[-+]\d{2}:?\d{2})?)?$/;function _l(e,t){return qZ.test(e+="")?new Date(e):typeof t=="function"?t(e):t}var vf=1e3,Wa=vf*60,Ha=Wa*60,Bo=Ha*24,Oo=Bo*7,Sl=Bo*30,Ga=Bo*365,CA=[["millisecond",1],["2 milliseconds",2],["5 milliseconds",5],["10 milliseconds",10],["20 milliseconds",20],["50 milliseconds",50],["100 milliseconds",100],["200 milliseconds",200],["500 milliseconds",500],["second",vf],["5 seconds",5*vf],["15 seconds",15*vf],["30 seconds",30*vf],["minute",Wa],["5 minutes",5*Wa],["15 minutes",15*Wa],["30 minutes",30*Wa],["hour",Ha],["3 hours",3*Ha],["6 hours",6*Ha],["12 hours",12*Ha],["day",Bo],["2 days",2*Bo],["week",Oo],["2 weeks",2*Oo],["month",Sl],["3 months",3*Sl],["6 months",6*Sl],["year",Ga],["2 years",2*Ga],["5 years",5*Ga],["10 years",10*Ga],["20 years",20*Ga],["50 years",50*Ga],["100 years",100*Ga]],kA=new Map([["second",vf],["minute",Wa],["hour",Ha],["day",Bo],["monday",Oo],["tuesday",Oo],["wednesday",Oo],["thursday",Oo],["friday",Oo],["saturday",Oo],["sunday",Oo],["week",Oo],["month",Sl],["year",Ga]]),MF=new Map([["second",an],["minute",$s],["hour",Us],["day",ui],["monday",Va],["tuesday",wb],["wednesday",vb],["thursday",Eo],["friday",_b],["saturday",Sb],["sunday",Pr],["week",Pr],["month",qs],["year",$n]]),FA=new Map([["second",an],["minute",Ps],["hour",zs],["day",gl],["monday",Ya],["tuesday",Ib],["wednesday",Mb],["thursday",No],["friday",Ab],["saturday",Tb],["sunday",Ur],["week",Ur],["month",js],["year",Pn]]),_f=Symbol("intervalDuration"),iw=Symbol("intervalType");for(let[e,t]of MF)t[_f]=kA.get(e),t[iw]="time";for(let[e,t]of FA)t[_f]=kA.get(e),t[iw]="utc";var Lm=[["year",Pn,"utc"],["month",js,"utc"],["day",gl,"utc",6*Sl],["hour",zs,"utc",3*Bo],["minute",Ps,"utc",6*Ha],["second",an,"utc",30*Wa]],rw=[["year",$n,"time"],["month",qs,"time"],["day",ui,"time",6*Sl],["hour",Us,"time",3*Bo],["minute",$s,"time",6*Ha],["second",an,"time",30*Wa]],jZ=[Lm[0],rw[0],Lm[1],rw[1],Lm[2],rw[2],...Lm.slice(3)];function ow(e){let t=`${e}`.toLowerCase();t.endsWith("s")&&(t=t.slice(0,-1));let n=1,r=/^(?:(\d+)\s+)/.exec(t);switch(r&&(t=t.slice(r[0].length),n=+r[1]),t){case"quarter":t="month",n*=3;break;case"half":t="month",n*=6;break}let i=FA.get(t);if(!i)throw new Error(`unknown interval: ${e}`);if(n>1&&!i.every)throw new Error(`non-periodic interval: ${t}`);return[t,n]}function RA(e){return AF(ow(e),"time")}function Cm(e){return AF(ow(e),"utc")}function AF([e,t],n){let r=(n==="time"?MF:FA).get(e);return t>1&&(r=r.every(t),r[_f]=kA.get(e)*t,r[iw]=n),r}function $A(e,t){if(!(t>1))return;let n=e[_f];if(!CA.some(([,i])=>i===n)||n%Bo===0&&Bo<n&&n<Sl)return;let[r]=CA[Is(([,i])=>Math.log(i)).center(CA,Math.log(n*t))];return(e[iw]==="time"?RA:Cm)(r)}function IF(e,t,n){let r=t==="time"?cf:Do;if(n==null)return r(e==="year"?"%Y":e==="month"?"%Y-%m":e==="day"?"%Y-%m-%d":e==="hour"||e==="minute"?"%Y-%m-%dT%H:%M":e==="second"?"%Y-%m-%dT%H:%M:%S":"%Y-%m-%dT%H:%M:%S.%L");let i=VZ(n);switch(e){case"millisecond":return wf(r(".%L"),r(":%M:%S"),i);case"second":return wf(r(":%S"),r("%-I:%M"),i);case"minute":return wf(r("%-I:%M"),r("%p"),i);case"hour":return wf(r("%-I %p"),r("%b %-d"),i);case"day":return wf(r("%-d"),r("%b"),i);case"month":return wf(r("%b"),r("%Y"),i);case"year":return r("%Y")}throw new Error("unable to format time ticks")}function VZ(e){return e==="left"||e==="right"?(t,n)=>`
12
12
  ${t}
13
13
  ${n}`:e==="top"?(t,n)=>`${n}
14
14
  ${t}`:(t,n)=>`${t}
15
- ${n}`}function dZ(e){return e==="time"?ew:e==="utc"?Bm:uZ}function rF(e,t,n){let r=zt(J0(t,(i,o)=>Math.abs(o-i)));if(r<1e3)return tF("millisecond","utc",n);for(let[i,o,s,a]of dZ(e)){if(r>a||i==="hour"&&!r)break;if(t.every(c=>o.floor(c)>=c))return tF(i,s,n)}}function bf(e,t,n){return(r,i,o)=>{let s=e(r,i),a=t(r,i),c=i-Gs(o);return i!==c&&o[c]!==void 0&&a===t(o[c],c)?s:n(s,a)}}var Sl=Object.getPrototypeOf(Uint8Array),hZ=Object.prototype.toString,FT=Symbol("reindex");function pt(e,t,n){let r=typeof t;return r==="string"?iF(e,RT(t),n):r==="function"?iF(e,t,n):r==="number"||t instanceof Date||r==="boolean"?Xt(e,un(t),n):typeof t?.transform=="function"?oF(t.transform(e),n):pZ(oF(t,n),e?.[FT])}function pZ(e,t){return t?Cm(e,t):e}function iF(e,t,n){return Xt(e,n?.prototype instanceof Sl?mZ(t):t,n)}function oF(e,t){return t===void 0?je(e):e instanceof t?e:t.prototype instanceof Sl&&!(e instanceof Sl)?t.from(e,$T):t.from(e)}function mZ(e){return(t,n)=>$T(e(t,n))}var Wa=[null],RT=e=>t=>t[e],Te={transform:nr},G={transform:e=>e};var km=()=>1,sF=()=>!0,ze=e=>e==null?e:`${e}`,Nt=e=>e==null?e:+e;var Ws=e=>e?e[0]:void 0,Ha=e=>e?e[1]:void 0,aF=e=>e?e[2]:void 0,un=e=>()=>e;function _f(e){let t=+`${e}`.slice(1)/100;return(n,r)=>Gn(n,t,r)}function Je(e){return e instanceof Sl?e:Xt(e,$T,Float64Array)}function $T(e){return e==null?NaN:Number(e)}function cF(e){return Xt(e,PT)}function PT(e){return e instanceof Date&&!isNaN(e)?e:typeof e=="string"?vl(e):e==null||isNaN(e=+e)?void 0:new Date(e)}function De(e,t){return e===void 0&&(e=t),e===null?[void 0,"none"]:Qa(e)?[void 0,e]:[e,void 0]}function ie(e,t){return e===void 0&&(e=t),e===null||typeof e=="number"?[void 0,e]:[e,void 0]}function UT(e,t,n){if(e!=null)return Qe(e,t,n)}function Qe(e,t,n){let r=`${e}`.toLowerCase();if(!n.includes(r))throw new Error(`invalid ${t}: ${e}`);return r}function je(e){return e==null||e instanceof Array||e instanceof Sl?e:Array.from(e)}function Xt(e,t,n=Array){return e==null?e:e instanceof n?e.map(t):n.from(e,t)}function Za(e,t=Array){return e instanceof t?e.slice():t.from(e)}function zT({x:e,x1:t,x2:n}){return e!==void 0||t!==void 0||n!==void 0}function jT({y:e,y1:t,y2:n}){return e!==void 0||t!==void 0||n!==void 0}function Sf(e){return zT(e)||jT(e)||e.interval!==void 0}function fn(e){return e?.toString===hZ}function Bo(e){return fn(e)&&(e.type!==void 0||e.domain!==void 0)}function zr(e){return fn(e)&&typeof e.transform!="function"}function Lo(e){return zr(e)&&e.value===void 0&&e.channel===void 0}function qT(e,t,n,r=G){return t===void 0&&n===void 0?(t=0,n=e===void 0?r:e):t===void 0?t=e===void 0?0:e:n===void 0&&(n=e===void 0?0:e),[t,n]}function Re(e,t){return e===void 0&&t===void 0?[Ws,Ha]:[e,t]}function Pn({z:e,fill:t,stroke:n}={}){return e===void 0&&([e]=De(t)),e===void 0&&([e]=De(n)),e}function nr(e){let t=e.length,n=new Uint32Array(t);for(let r=0;r<t;++r)n[r]=r;return n}function Cm(e,t){return Xt(t,n=>e[n],e.constructor)}function If(e){return e.length===1?(t,n)=>e(Cm(n,t)):e}function Hs(e,t,n){return e.subarray?e.subarray(t,n):e.slice(t,n)}function Zs(e){return e!==null&&typeof e=="object"?e.valueOf():e}function iw(e,t){if(t[e]!==void 0)return t[e];switch(e){case"x1":case"x2":e="x";break;case"y1":case"y2":e="y";break}return t[e]}function dn(e){let t;return[{transform:()=>t,label:En(e)},n=>t=n]}function An(e){return e==null?[e]:dn(e)}function En(e,t){return typeof e=="string"?e:e&&e.label!==void 0?e.label:t}function Mf(e,t){return{transform(n){let r=e.transform(n),i=t.transform(n);return Oe(r)||Oe(i)?Xt(r,(o,s)=>new Date((+r[s]+ +i[s])/2)):Xt(r,(o,s)=>(+r[s]+ +i[s])/2,Float64Array)},label:e.label}}function Il(e,t){let n=VT(t?.interval,t?.type);return n?Xt(e,n):e}function VT(e,t){let n=Tf(e,t);return n&&(r=>Ue(r)?n.floor(r):r)}function Tf(e,t){if(e!=null){if(typeof e=="number"){0<e&&e<1&&Number.isInteger(1/e)&&(e=-1/e);let n=Math.abs(e);return e<0?{floor:r=>Math.floor(r*n)/n,offset:r=>(r*n+1)/n,range:(r,i)=>Pe(Math.ceil(r*n),i*n).map(o=>o/n)}:{floor:r=>Math.floor(r/n)*n,offset:r=>r+n,range:(r,i)=>Pe(Math.ceil(r/n),i/n).map(o=>o*n)}}if(typeof e=="string")return(t==="time"?kT:Lm)(e);if(typeof e.floor!="function")throw new Error("invalid interval; missing floor method");if(typeof e.offset!="function")throw new Error("invalid interval; missing offset method");return e}}function ko(e,t){if(e=Tf(e,t),e&&typeof e.range!="function")throw new Error("invalid interval: missing range method");return e}function lF(e,t){if(e=ko(e,t),e&&typeof e.ceil!="function")throw new Error("invalid interval: missing ceil method");return e}function uF(e){return Ja(e)&&typeof e?.floor=="function"&&e.floor()instanceof Date}function Ja(e){return typeof e?.range=="function"}function pi(e){return e===void 0||zr(e)?e:{value:e}}function fF(e){return e==null?null:{transform:t=>pt(t,e,Float64Array),label:En(e)}}function dF(e){if(!rr(e))return!1;for(let t of e)if(t!=null)return typeof t=="object"&&"0"in t&&"1"in t}function rr(e){return e&&typeof e[Symbol.iterator]=="function"}function ow(e){for(let t of e)if(t!=null)return typeof t!="object"||t instanceof Date}function Ae(e){for(let t of e){if(t==null)continue;let n=typeof t;return n==="string"||n==="boolean"}}function Oe(e){for(let t of e)if(t!=null)return t instanceof Date}function hF(e){for(let t of e)if(t!=null)return typeof t=="string"&&isNaN(t)&&vl(t)}function pF(e){for(let t of e)if(t!=null){if(typeof t!="string")return!1;if(t.trim())return!isNaN(t)}}function Js(e){for(let t of e)if(t!=null)return typeof t=="number"}function sw(e,t){let n;for(let r of e)if(r!=null){if(!t(r))return!1;n=!0}return n}var yZ=new Set("none,currentcolor,transparent,aliceblue,antiquewhite,aqua,aquamarine,azure,beige,bisque,black,blanchedalmond,blue,blueviolet,brown,burlywood,cadetblue,chartreuse,chocolate,coral,cornflowerblue,cornsilk,crimson,cyan,darkblue,darkcyan,darkgoldenrod,darkgray,darkgreen,darkgrey,darkkhaki,darkmagenta,darkolivegreen,darkorange,darkorchid,darkred,darksalmon,darkseagreen,darkslateblue,darkslategray,darkslategrey,darkturquoise,darkviolet,deeppink,deepskyblue,dimgray,dimgrey,dodgerblue,firebrick,floralwhite,forestgreen,fuchsia,gainsboro,ghostwhite,gold,goldenrod,gray,green,greenyellow,grey,honeydew,hotpink,indianred,indigo,ivory,khaki,lavender,lavenderblush,lawngreen,lemonchiffon,lightblue,lightcoral,lightcyan,lightgoldenrodyellow,lightgray,lightgreen,lightgrey,lightpink,lightsalmon,lightseagreen,lightskyblue,lightslategray,lightslategrey,lightsteelblue,lightyellow,lime,limegreen,linen,magenta,maroon,mediumaquamarine,mediumblue,mediumorchid,mediumpurple,mediumseagreen,mediumslateblue,mediumspringgreen,mediumturquoise,mediumvioletred,midnightblue,mintcream,mistyrose,moccasin,navajowhite,navy,oldlace,olive,olivedrab,orange,orangered,orchid,palegoldenrod,palegreen,paleturquoise,palevioletred,papayawhip,peachpuff,peru,pink,plum,powderblue,purple,rebeccapurple,red,rosybrown,royalblue,saddlebrown,salmon,sandybrown,seagreen,seashell,sienna,silver,skyblue,slateblue,slategray,slategrey,snow,springgreen,steelblue,tan,teal,thistle,tomato,turquoise,violet,wheat,white,whitesmoke,yellow".split(","));function Qa(e){return typeof e!="string"?!1:(e=e.toLowerCase().trim(),/^#[0-9a-f]{3,8}$/.test(e)||/^(?:url|var|rgb|rgba|hsl|hsla|hwb|lab|lch|oklab|oklch|color|color-mix)\(.*\)$/.test(e)||yZ.has(e))}function mF(e){return typeof e=="number"&&(0<=e&&e<=1||isNaN(e))}function ne(e){return e==null||Qs(e)}function Qs(e){return/^\s*none\s*$/i.test(e)}function yF(e){return/^\s*round\s*$/i.test(e)}function aw(e,t){return UT(e,t,["middle","top-left","top","top-right","right","bottom-right","bottom","bottom-left","left"])}function Co(e="middle"){return aw(e,"frameAnchor")}function Gs(e){if(e==null)return;let t=e[0],n=e[e.length-1];return Yn(t,n)}function gF(e={},...t){let n=e;for(let r of t)for(let i in r)if(n[i]===void 0){let o=r[i];n===e?n={...n,[i]:o}:n[i]=o}return n}function gZ(e){console.warn("named iterables are deprecated; please use an object instead");let t=new Set;return Object.fromEntries(Array.from(e,n=>{let{name:r}=n;if(r==null)throw new Error("missing name");let i=`${r}`;if(i==="__proto__")throw new Error(`illegal name: ${i}`);if(t.has(i))throw new Error(`duplicate name: ${i}`);return t.add(i),[r,n]}))}function Fm(e){return rr(e)?gZ(e):e}var mi=Symbol("position"),jr=Symbol("color"),Ml=Symbol("radius"),Tl=Symbol("length"),Al=Symbol("opacity"),Af=Symbol("symbol"),xF=Symbol("projection"),fe=new Map([["x",mi],["y",mi],["fx",mi],["fy",mi],["r",Ml],["color",jr],["opacity",Al],["symbol",Af],["length",Tl],["projection",xF]]);function bF(e){return e===mi||e===xF}function wF(e){return e===mi||e===Ml||e===Tl||e===Al}var YT=Math.sqrt(3),XT=2/YT,xZ={draw(e,t){let n=Math.sqrt(t/Math.PI),r=n*XT,i=r/2;e.moveTo(0,r),e.lineTo(n,i),e.lineTo(n,-i),e.lineTo(0,-r),e.lineTo(-n,-i),e.lineTo(-n,i),e.closePath()}},GT=new Map([["asterisk",ym],["circle",Ys],["cross",gm],["diamond",xm],["diamond2",bm],["hexagon",xZ],["plus",wm],["square",vm],["square2",_m],["star",Sm],["times",hf],["triangle",Im],["triangle2",Mm],["wye",Tm]]);function WT(e){return e&&typeof e.draw=="function"}function vF(e){return WT(e)?!0:typeof e!="string"?!1:GT.has(e.toLowerCase())}function Ef(e){if(e==null||WT(e))return e;let t=GT.get(`${e}`.toLowerCase());if(t)return t;throw new Error(`invalid symbol: ${e}`)}function _F(e){if(e==null||WT(e))return[void 0,e];if(typeof e=="string"){let t=GT.get(`${e}`.toLowerCase());if(t)return[void 0,t]}return[e,void 0]}function hn({filter:e,sort:t,reverse:n,transform:r,initializer:i,...o}={},s){if(r===void 0&&(e!=null&&(r=JT(e)),t!=null&&!Lo(t)&&(r=HT(r,KT(t))),n&&(r=HT(r,QT))),s!=null&&i!=null)throw new Error("transforms cannot be applied after initializers");return{...o,...(t===null||Lo(t))&&{sort:t},transform:HT(r,s)}}function _e({filter:e,sort:t,reverse:n,initializer:r,...i}={},o){return r===void 0&&(e!=null&&(r=JT(e)),t!=null&&!Lo(t)&&(r=ZT(r,KT(t))),n&&(r=ZT(r,QT))),{...i,...(t===null||Lo(t))&&{sort:t},initializer:ZT(r,o)}}function HT(e,t){return e==null?t===null?void 0:t:t==null?e===null?void 0:e:function(n,r,i){return{data:n,facets:r}=e.call(this,n,r,i),t.call(this,je(n),r,i)}}function ZT(e,t){return e==null?t===null?void 0:t:t==null?e===null?void 0:e:function(n,r,i,...o){let s,a,c,l,u,f;return{data:a=n,facets:c=r,channels:s}=e.call(this,n,r,i,...o),{data:u=a,facets:f=c,channels:l}=t.call(this,a,c,{...i,...s},...o),{data:u,facets:f,channels:{...s,...l}}}}function cw(e,t){return(e.initializer!=null?_e:hn)(e,t)}function SF(e,t){return cw(t,JT(e))}function JT(e){return(t,n)=>{let r=pt(t,e);return{data:t,facets:n.map(i=>i.filter(o=>r[o]))}}}function IF({sort:e,...t}={}){return{...cw(t,QT),sort:Lo(e)?e:null}}function QT(e,t){return{data:e,facets:t.map(n=>n.slice().reverse())}}function MF({seed:e,sort:t,...n}={}){return{...cw(n,TF(e==null?Math.random:ul(e))),sort:Lo(t)?t:null}}function lw(e,{sort:t,...n}={}){return{...(zr(e)&&e.channel!==void 0?_e:cw)(n,KT(e)),sort:Lo(t)?t:null}}function KT(e){return(typeof e=="function"&&e.length!==1?bZ:TF)(e)}function bZ(e){return(t,n)=>{let r=(i,o)=>e(t[i],t[o]);return{data:t,facets:n.map(i=>i.slice().sort(r))}}}function TF(e){let t,n;({channel:t,value:e,order:n}={...pi(e)});let r=t?.startsWith("-");if(r&&(t=t.slice(1)),n===void 0&&(n=r?wl:ln),typeof n!="function")switch(`${n}`.toLowerCase()){case"ascending":n=ln;break;case"descending":n=wl;break;default:throw new Error(`invalid order: ${n}`)}return(i,o,s)=>{let a;if(t===void 0)a=pt(i,e);else{if(s===void 0)throw new Error("channel sort requires an initializer");if(a=s[t],!a)return{};a=a.value}let c=(l,u)=>n(a[l],a[u]);return{data:i,facets:o.map(l=>l.slice().sort(c))}}}function $m(e,t){return uw(null,null,e,t)}function tc(e={y:"count"},t={}){let{x:n=G}=t;if(n==null)throw new Error("missing channel: x");return uw(n,null,e,t)}function ec(e={x:"count"},t={}){let{y:n=G}=t;if(n==null)throw new Error("missing channel: y");return uw(null,n,e,t)}function Pm(e={fill:"count"},t={}){let{x:n,y:r}=t;if([n,r]=Re(n,r),n==null)throw new Error("missing channel: x");if(r==null)throw new Error("missing channel: y");return uw(n,r,e,t)}function uw(e,t,{data:n=hw,filter:r,sort:i,reverse:o,...s}={},a={}){s=eA(s,a),n=OF(n,G),i=i==null?void 0:NF("sort",i,a),r=r==null?void 0:DF("filter",r,a);let[c,l]=An(e),[u,f]=An(t),{z:d,fill:h,stroke:p,x1:m,x2:g,y1:y,y2:x,...b}=a,[w,_]=An(d),[v]=De(h),[M]=De(p),[E,D]=An(v),[I,T]=An(M);return{..."z"in a&&{z:w||d},..."fill"in a&&{fill:E||h},..."stroke"in a&&{stroke:I||p},...hn(b,(O,B,S)=>{let A=Il(pt(O,e),S?.x),N=Il(pt(O,t),S?.y),k=pt(O,d),R=pt(O,v),F=pt(O,M),$=Um(s,{z:k,fill:R,stroke:F}),P=[],U=[],W=A&&l([]),tt=N&&f([]),nt=k&&_([]),st=R&&D([]),Y=F&&T([]),rt=0;for(let j of s)j.initialize(O);i&&i.initialize(O),r&&r.initialize(O);for(let j of B){let H=[];for(let ot of s)ot.scope("facet",j);i&&i.scope("facet",j),r&&r.scope("facet",j);for(let[ot,z]of Ka(j,$))for(let[Ct,dt]of Ka(z,N))for(let[Wt,Ht]of Ka(dt,A)){let et={data:O};if(A&&(et.x=Wt),N&&(et.y=Ct),!(r&&!r.reduce(Ht,et))){H.push(rt++),U.push(n.reduceIndex(Ht,O,et)),A&&W.push(Wt),N&&tt.push(Ct),k&&nt.push($===k?ot:k[Ht[0]]),R&&st.push($===R?ot:R[Ht[0]]),F&&Y.push($===F?ot:F[Ht[0]]);for(let oe of s)oe.reduce(Ht,et);i&&i.reduce(Ht,et)}}P.push(H)}return nA(P,i,o),{data:U,facets:P}}),...!Fo(s,"x")&&(c?{x:c}:{x1:m,x2:g}),...!Fo(s,"y")&&(u?{y:u}:{y1:y,y2:x}),...Object.fromEntries(s.map(({name:O,output:B})=>[O,B]))}}function Fo(e,...t){for(let{name:n}of e)if(t.includes(n))return!0;return!1}function tA(e,t,n=fw){let r=Object.entries(e);return t.title!=null&&e.title===void 0&&r.push(["title",MZ]),t.href!=null&&e.href===void 0&&r.push(["href",pw]),r.filter(([,i])=>i!==void 0).map(([i,o])=>o===null?wZ(i):n(i,o,t))}function fw(e,t,n,r=dw){let i;fn(t)&&"reduce"in t&&(i=t.scale,t=t.reduce);let o=r(e,t,n),[s,a]=dn(o.label),c;return{name:e,output:i===void 0?s:{value:s,scale:i},initialize(l){o.initialize(l),c=a([])},scope(l,u){o.scope(l,u)},reduce(l,u){c.push(o.reduce(l,u))}}}function wZ(e){return{name:e,initialize(){},scope(){},reduce(){}}}function dw(e,t,n,r=Nf){let i=iw(e,n),o=r(t,i),s,a;return{label:En(o===Rm?null:i,o.label),initialize(c){s=i===void 0?c:pt(c,i),o.scope==="data"&&(a=o.reduceIndex(nr(c),s))},scope(c,l){o.scope===c&&(a=o.reduceIndex(l,s))},reduce(c,l){return o.scope==null?o.reduceIndex(c,s,l):o.reduceIndex(c,s,a,l)}}}function Ka(e,t){return t?fo(rn(e,n=>t[n]),Ws):[[,e]]}function Nf(e,t,n=vZ){if(e==null)return n(e);if(typeof e.reduceIndex=="function")return e;if(typeof e.reduce=="function"&&fn(e))return SZ(e);if(typeof e=="function")return IZ(e);if(/^p\d{2}$/i.test(e))return Ks(_f(e));switch(`${e}`.toLowerCase()){case"first":return pw;case"last":return TZ;case"identity":return hw;case"count":return Rm;case"distinct":return AZ;case"sum":return t==null?Rm:EZ;case"proportion":return EF(t,"data");case"proportion-facet":return EF(t,"facet");case"deviation":return Ks(ri);case"min":return Ks(ce);case"min-index":return Ks(W0);case"max":return Ks(zt);case"max-index":return Ks(G0);case"mean":return AF(As);case"median":return AF(Pi);case"variance":return Ks(Ea);case"mode":return Ks(Du)}return n(e)}function vZ(e){throw new Error(`invalid reduce: ${e}`)}function eA(e,t){return tA(e,t,NF)}function NF(e,t,n){return fw(e,t,n,DF)}function DF(e,t,n){return dw(e,t,n,OF)}function OF(e,t){return Nf(e,t,_Z)}function _Z(e){switch(`${e}`.toLowerCase()){case"x":return NZ;case"y":return DZ}throw new Error(`invalid group reduce: ${e}`)}function Um(e,t){for(let n in t){let r=t[n];if(r!==void 0&&!e.some(i=>i.name===n))return r}}function nA(e,t,n){if(t){let r=t.output.transform(),i=(o,s)=>ln(r[o],r[s]);e.forEach(o=>o.sort(i))}n&&e.forEach(r=>r.reverse())}function SZ(e){return console.warn("deprecated reduce interface; implement reduceIndex instead."),{...e,reduceIndex:e.reduce.bind(e)}}function IZ(e){return{reduceIndex(t,n,r){return e(Cm(n,t),r)}}}function Ks(e){return{reduceIndex(t,n){return e(t,r=>n[r])}}}function AF(e){return{reduceIndex(t,n){let r=e(t,i=>n[i]);return Oe(n)?new Date(r):r}}}var hw={reduceIndex(e,t){return Cm(t,e)}},pw={reduceIndex(e,t){return t[e[0]]}},MZ={reduceIndex(e,t){let r=fo($i(e,o=>o.length,o=>t[o]),Ha),i=r.slice(-5).reverse();if(i.length<r.length){let o=r.slice(0,-4);i[4]=[`\u2026 ${o.length.toLocaleString("en-US")} more`,Sn(o,Ha)]}return i.map(([o,s])=>`${o} (${s.toLocaleString("en-US")})`).join(`
16
- `)}},TZ={reduceIndex(e,t){return t[e[e.length-1]]}},Rm={label:"Frequency",reduceIndex(e){return e.length}},AZ={label:"Distinct",reduceIndex(e,t){let n=new kr;for(let r of e)n.add(t[r]);return n.size}},EZ=Ks(Sn);function EF(e,t){return e==null?{scope:t,label:"Frequency",reduceIndex:(n,r,i=1)=>n.length/i}:{scope:t,reduceIndex:(n,r,i=1)=>Sn(n,o=>r[o])/i}}var NZ={reduceIndex(e,t,{x:n}){return n}},DZ={reduceIndex(e,t,{y:n}){return n}};function BF(e){if(typeof e!="function")throw new Error(`invalid test function: ${e}`);return{reduceIndex(t,n,{data:r}){return n[t.find(i=>e(r[i],i,r))]}}}function Df(e,{scale:t,type:n,value:r,filter:i,hint:o,label:s=En(r)},a){return o===void 0&&typeof r?.transform=="function"&&(o=r.hint),iA(a,{scale:t,type:n,value:pt(e,r),label:s,filter:i,hint:o})}function mw(e,t){return Object.fromEntries(Object.entries(e).map(([n,r])=>[n,Df(t,r,n)]))}function Of(e,t){let n=Object.fromEntries(Object.entries(e).map(([r,{scale:i,value:o}])=>{let s=i==null?null:t[i];return[r,s==null?o:Xt(o,s)]}));return n.channels=e,n}function iA(e,t){let{scale:n,value:r}=t;if(n===!0||n==="auto")switch(e){case"fill":case"stroke":case"color":t.scale=n!==!0&&sw(r,Qa)?null:"color";break;case"fillOpacity":case"strokeOpacity":case"opacity":t.scale=n!==!0&&sw(r,mF)?null:"opacity";break;case"symbol":n!==!0&&sw(r,vF)?(t.scale=null,t.value=Xt(r,Ef)):t.scale="symbol";break;default:t.scale=fe.has(e)?e:null;break}else if(n===!1)t.scale=null;else if(n!=null&&!fe.has(n))throw new Error(`unknown scale: ${n}`);return t}function kF(e,t,n,r,i){let{order:o,reverse:s,reduce:a=!0,limit:c}=i;for(let l in i){if(!fe.has(l))continue;let{value:u,order:f=o,reverse:d=s,reduce:h=a,limit:p=c}=pi(i[l]),m=u?.startsWith("-");if(m&&(u=u.slice(1)),f=f===void 0?m!==(u==="width"||u==="height")?FF:CF:LZ(f),h==null||h===!1)continue;let g=l==="fx"||l==="fy"?BZ(t,r[l]):OZ(n,l);if(!g)throw new Error(`missing channel for scale: ${l}`);let y=g.value,[x=0,b=1/0]=rr(p)?p:p<0?[p]:[0,p];if(u==null)g.domain=()=>{let w=Array.from(new kr(y));return d&&(w=w.reverse()),(x!==0||b!==1/0)&&(w=w.slice(x,b)),w};else{let w=u==="data"?e:u==="height"?LF(n,"y1","y2"):u==="width"?LF(n,"x1","x2"):rA(n,u,u==="y"?"y2":u==="x"?"x2":void 0),_=Nf(h===!0?"max":h,w);g.domain=()=>{let v=LS(nr(y),M=>_.reduceIndex(M,w),M=>y[M]);return f&&v.sort(f),d&&v.reverse(),(x!==0||b!==1/0)&&(v=v.slice(x,b)),v.map(Ws)}}}}function OZ(e,t){for(let n in e){let r=e[n];if(r.scale===t)return r}}function BZ(e,t){let n=e.original;if(n===e)return t;let r=t.value,i=t.value=[];for(let o=0;o<n.length;++o){let s=r[n[o][0]];for(let a of e[o])i[a]=s}return t}function LF(e,t,n){let r=rA(e,t),i=rA(e,n);return Xt(i,(o,s)=>Math.abs(o-r[s]),Float64Array)}function rA(e,t,n){let r=e[t];if(!r&&n!==void 0&&(r=e[n]),r)return r.value;throw new Error(`missing channel: ${t}`)}function LZ(e){if(e==null||typeof e=="function")return e;switch(`${e}`.toLowerCase()){case"ascending":return CF;case"descending":return FF}throw new Error(`invalid order: ${e}`)}function CF([e,t],[n,r]){return ln(t,r)||ln(e,n)}function FF([e,t],[n,r]){return wl(t,r)||ln(e,n)}function zm(e,t){let n=e[t];if(n){for(;n.source;)n=n.source;return n.source===null?null:n}}function yw(e){let t,n;return(...r)=>((n?.length!==r.length||n.some((i,o)=>i!==r[o]))&&(n=r,t=e(...r)),t)}var kZ=yw(e=>new Intl.NumberFormat(e)),CZ=yw((e,t)=>new Intl.DateTimeFormat(e,{timeZone:"UTC",...t&&{month:t}})),FZ=yw((e,t)=>new Intl.DateTimeFormat(e,{timeZone:"UTC",...t&&{weekday:t}}));function RZ(e="en-US"){let t=kZ(e);return n=>n!=null&&!isNaN(n)?t.format(n):void 0}function RF(e="en-US",t="short"){let n=CZ(e,t);return r=>r!=null&&!isNaN(r=+new Date(Date.UTC(2e3,+r)))?n.format(r):void 0}function $F(e="en-US",t="short"){let n=FZ(e,t);return r=>r!=null&&!isNaN(r=+new Date(Date.UTC(2001,0,+r)))?n.format(r):void 0}function oA(e){return xf(e,"Invalid Date")}function $Z(e="en-US"){let t=RZ(e);return n=>(n instanceof Date?oA:typeof n=="number"?t:ze)(n)}var qi=$Z();var sA=0,aA;function PF(){let e=sA;return sA=0,aA=void 0,e}function Un(e){e!==aA&&(aA=e,console.warn(e),++sA)}var Be=(typeof window<"u"?window.devicePixelRatio>1:typeof it>"u")?0:.5,PZ=0;function gw(){return`plot-clip-${++PZ}`}function xw(e,{title:t,href:n,ariaLabel:r,ariaDescription:i,ariaHidden:o,target:s,fill:a,fillOpacity:c,stroke:l,strokeWidth:u,strokeOpacity:f,strokeLinejoin:d,strokeLinecap:h,strokeMiterlimit:p,strokeDasharray:m,strokeDashoffset:g,opacity:y,mixBlendMode:x,imageFilter:b,paintOrder:w,pointerEvents:_,shapeRendering:v,channels:M},{ariaLabel:E,fill:D="currentColor",fillOpacity:I,stroke:T="none",strokeOpacity:O,strokeWidth:B,strokeLinecap:S,strokeLinejoin:A,strokeMiterlimit:N,paintOrder:k}){D===null&&(a=null,c=null),T===null&&(l=null,f=null),ne(D)?!ne(T)&&(!ne(a)||M?.fill)&&(T="none"):ne(T)&&(!ne(l)||M?.stroke)&&(D="none");let[R,F]=De(a,D),[$,P]=ie(c,I),[U,W]=De(l,T),[tt,nt]=ie(f,O),[st,Y]=ie(y);Qs(W)||(u===void 0&&(u=B),h===void 0&&(h=S),d===void 0&&(d=A),p===void 0&&!yF(d)&&(p=N),!Qs(F)&&w===void 0&&(w=k));let[rt,j]=ie(u);return D!==null&&(e.fill=le(F,"currentColor"),e.fillOpacity=jm(P,1)),T!==null&&(e.stroke=le(W,"none"),e.strokeWidth=jm(j,1),e.strokeOpacity=jm(nt,1),e.strokeLinejoin=le(d,"miter"),e.strokeLinecap=le(h,"butt"),e.strokeMiterlimit=jm(p,4),e.strokeDasharray=le(m,"none"),e.strokeDashoffset=le(g,"0")),e.target=ze(s),e.ariaLabel=ze(E),e.ariaDescription=ze(i),e.ariaHidden=ze(o),e.opacity=jm(Y,1),e.mixBlendMode=le(x,"normal"),e.imageFilter=le(b,"none"),e.paintOrder=le(w,"normal"),e.pointerEvents=le(_,"auto"),e.shapeRendering=le(v,"auto"),{title:{value:t,optional:!0,filter:null},href:{value:n,optional:!0,filter:null},ariaLabel:{value:r,optional:!0,filter:null},fill:{value:R,scale:"auto",optional:!0},fillOpacity:{value:$,scale:"auto",optional:!0},stroke:{value:U,scale:"auto",optional:!0},strokeOpacity:{value:tt,scale:"auto",optional:!0},strokeWidth:{value:rt,optional:!0},opacity:{value:st,scale:"auto",optional:!0}}}function UZ(e,t){t&&e.filter(n=>Om(t[n])).append("title").call(jZ,t)}function zZ(e,t){t&&e.filter(([n])=>Om(t[n])).append("title").call(qZ,t)}function jZ(e,t){t&&e.text(n=>qi(t[n]))}function qZ(e,t){t&&e.text(([n])=>qi(t[n]))}function Jt(e,{target:t,tip:n},{ariaLabel:r,title:i,fill:o,fillOpacity:s,stroke:a,strokeOpacity:c,strokeWidth:l,opacity:u,href:f}){r&&ft(e,"aria-label",d=>r[d]),o&&ft(e,"fill",d=>o[d]),s&&ft(e,"fill-opacity",d=>s[d]),a&&ft(e,"stroke",d=>a[d]),c&&ft(e,"stroke-opacity",d=>c[d]),l&&ft(e,"stroke-width",d=>l[d]),u&&ft(e,"opacity",d=>u[d]),f&&UF(e,d=>f[d],t),n||UZ(e,i)}function El(e,{target:t,tip:n},{ariaLabel:r,title:i,fill:o,fillOpacity:s,stroke:a,strokeOpacity:c,strokeWidth:l,opacity:u,href:f}){r&&ft(e,"aria-label",([d])=>r[d]),o&&ft(e,"fill",([d])=>o[d]),s&&ft(e,"fill-opacity",([d])=>s[d]),a&&ft(e,"stroke",([d])=>a[d]),c&&ft(e,"stroke-opacity",([d])=>c[d]),l&&ft(e,"stroke-width",([d])=>l[d]),u&&ft(e,"opacity",([d])=>u[d]),f&&UF(e,([d])=>f[d],t),n||zZ(e,i)}function VZ({ariaLabel:e,title:t,fill:n,fillOpacity:r,stroke:i,strokeOpacity:o,strokeWidth:s,opacity:a,href:c},{tip:l}){return[e,l?void 0:t,n,r,i,o,s,a,c].filter(u=>u!==void 0)}function qm(e,t,n){let r=rn(e,i=>t[i]);return n===void 0&&r.size>1+e.length>>1&&Un("Warning: the implicit z channel has high cardinality. This may occur when the fill or stroke channel is associated with quantitative data rather than ordinal or categorical data. You can suppress this warning by setting the z option explicitly; if this data represents a single series, set z to null."),r.values()}function*bw(e,t,n,r){let{z:i}=n,{z:o}=r,s=VZ(r,n),a=[...t,...s];for(let c of o?qm(e,o,i):[e]){let l,u;t:for(let f of c){for(let d of a)if(!Ue(d[f])){u&&u.push(-1);continue t}if(l===void 0){u&&(yield u),l=s.map(d=>Zs(d[f])),u=[f];continue}u.push(f);for(let d=0;d<s.length;++d)if(Zs(s[d][f])!==l[d]){yield u,l=s.map(p=>Zs(p[f])),u=[f];continue t}}u&&(yield u)}}function ww(e){return e===!0?e="frame":e===!1?e=null:e!=null&&(e=Qe(e,"clip",["frame","sphere"])),e}function YZ(e,t,n,r){let i,{clip:o=r.clip}=t;switch(o){case"frame":{let{width:s,height:a,marginLeft:c,marginRight:l,marginTop:u,marginBottom:f}=n,d=gw();i=`url(#${d})`,e=ct("svg:g",r).call(h=>h.append("svg:clipPath").attr("id",d).append("rect").attr("x",c).attr("y",u).attr("width",s-l-c).attr("height",a-u-f)).each(function(){this.appendChild(e.node()),e.node=()=>this});break}case"sphere":{let{projection:s}=r;if(!s)throw new Error('the "sphere" clip option requires a projection');let a=gw();i=`url(#${a})`,e.append("clipPath").attr("id",a).append("path").attr("d",Mn(s)({type:"Sphere"}));break}}ft(e,"aria-label",t.ariaLabel),ft(e,"aria-description",t.ariaDescription),ft(e,"aria-hidden",t.ariaHidden),ft(e,"clip-path",i)}function kt(e,t,n,r){YZ(e,t,n,r),ft(e,"fill",t.fill),ft(e,"fill-opacity",t.fillOpacity),ft(e,"stroke",t.stroke),ft(e,"stroke-width",t.strokeWidth),ft(e,"stroke-opacity",t.strokeOpacity),ft(e,"stroke-linejoin",t.strokeLinejoin),ft(e,"stroke-linecap",t.strokeLinecap),ft(e,"stroke-miterlimit",t.strokeMiterlimit),ft(e,"stroke-dasharray",t.strokeDasharray),ft(e,"stroke-dashoffset",t.strokeDashoffset),ft(e,"shape-rendering",t.shapeRendering),ft(e,"filter",t.imageFilter),ft(e,"paint-order",t.paintOrder);let{pointerEvents:i=r.pointerSticky===!1?"none":void 0}=t;ft(e,"pointer-events",i)}function Dt(e,t){XZ(e,"mix-blend-mode",t.mixBlendMode),ft(e,"opacity",t.opacity)}function UF(e,t,n){e.each(function(r){let i=t(r);if(i!=null){let o=this.ownerDocument.createElementNS(ii.svg,"a");o.setAttribute("fill","inherit"),o.setAttributeNS(ii.xlink,"href",i),n!=null&&o.setAttribute("target",n),this.parentNode.insertBefore(o,this).appendChild(this)}})}function ft(e,t,n){n!=null&&e.attr(t,n)}function XZ(e,t,n){n!=null&&e.style(t,n)}function It(e,t,{x:n,y:r},i=Be,o=Be){i+=t.dx,o+=t.dy,n?.bandwidth&&(i+=n.bandwidth()/2),r?.bandwidth&&(o+=r.bandwidth()/2),(i||o)&&e.attr("transform",`translate(${i},${o})`)}function le(e,t){if((e=ze(e))!==t)return e}function jm(e,t){if((e=Nt(e))!==t)return e}var GZ=/^-?([_a-z]|[\240-\377]|\\[0-9a-f]{1,6}(\r\n|[ \t\r\n\f])?|\\[^\r\n\f0-9a-f])([_a-z0-9-]|[\240-\377]|\\[0-9a-f]{1,6}(\r\n|[ \t\r\n\f])?|\\[^\r\n\f0-9a-f])*$/i;function Bf(e){if(e===void 0)return"plot-d6a7b5";if(e=`${e}`,!GZ.test(e))throw new Error(`invalid class name: ${e}`);return e}function Lf(e,t){if(typeof t=="string")e.property("style",t);else if(t!=null)for(let n of e)Object.assign(n.style,t)}function pn({frameAnchor:e},{width:t,height:n,marginTop:r,marginRight:i,marginBottom:o,marginLeft:s}){return[/left$/.test(e)?s:/right$/.test(e)?t-i:(s+t-i)/2,/^top/.test(e)?r:/^bottom/.test(e)?n-o:(r+n-o)/2]}function nc(e={}){let{document:t=typeof window<"u"?window.document:void 0,clip:n}=e;return{document:t,clip:ww(n)}}function ct(e,{document:t}){return jt(Ns(e).call(t.documentElement))}var jF=Math.PI,ta=2*jF,zF=.618;function qF({projection:e,inset:t=0,insetTop:n=t,insetRight:r=t,insetBottom:i=t,insetLeft:o=t}={},s){if(e==null)return;if(typeof e.stream=="function")return e;let a,c,l="frame";if(fn(e)){let _;if({type:e,domain:c,inset:_,insetTop:n=_!==void 0?_:n,insetRight:r=_!==void 0?_:r,insetBottom:i=_!==void 0?_:i,insetLeft:o=_!==void 0?_:o,clip:l=l,...a}=e,e==null)return}typeof e!="function"&&({type:e}=VF(e));let{width:u,height:f,marginLeft:d,marginRight:h,marginTop:p,marginBottom:m}=s,g=u-d-h-o-r,y=f-p-m-n-i;if(e=e?.({width:g,height:y,clip:l,...a}),e==null)return;l=WZ(l,d,p,u-h,f-m);let x=d+o,b=p+n,w;if(c!=null){let[[_,v],[M,E]]=Mn(e).bounds(c),D=Math.min(g/(M-_),y/(E-v));D>0?(x-=(D*(_+M)-g)/2,b-=(D*(v+E)-y)/2,w=Object.assign(cl({point(I,T){this.stream.point(I*D+x,T*D+b)}}),{invert:([I,T])=>[(I-x)/D,(T-b)/D]})):Un("Warning: the projection could not be fit to the specified domain; using the default scale.")}return w??=x===0&&b===0?YF():Object.assign(cl({point(_,v){this.stream.point(_+x,v+b)}}),{invert:([_,v])=>[_-x,v-b]}),{stream:_=>e.stream(w.stream(l(_))),invert:_=>e.invert(w.invert(_))}}function VF(e){switch(`${e}`.toLowerCase()){case"albers-usa":return Vi(oM,.7463,.4673);case"albers":return vw(qp,.7463,.4673);case"azimuthal-equal-area":return Vi(aM,4,4);case"azimuthal-equidistant":return Vi(lM,ta,ta);case"conic-conformal":return vw(dM,ta,ta);case"conic-equal-area":return vw(Pa,6.1702,2.9781);case"conic-equidistant":return vw(pM,7.312,3.6282);case"equal-earth":return Vi(yM,5.4133,2.6347);case"equirectangular":return Vi(hM,ta,jF);case"gnomonic":return Vi(xM,3.4641,3.4641);case"identity":return{type:YF};case"reflect-y":return{type:HZ};case"mercator":return Vi(uM,ta,ta);case"orthographic":return Vi(wM,2,2);case"stereographic":return Vi(_M,2,2);case"transverse-mercator":return Vi(IM,ta,ta);default:throw new Error(`unknown projection type: ${e}`)}}function WZ(e,t,n,r,i){if(e===!1||e==null||typeof e=="number")return o=>o;switch(e===!0&&(e="frame"),`${e}`.toLowerCase()){case"frame":return Hu(t,n,r,i);default:throw new Error(`unknown projection clip type: ${e}`)}}function Vi(e,t,n){return{type:({width:r,height:i,rotate:o,precision:s=.15,clip:a})=>{let c=e();return s!=null&&c.precision?.(s),o!=null&&c.rotate?.(o),typeof a=="number"&&c.clipAngle?.(a),c.scale(Math.min(r/t,i/n)),c.translate([r/2,i/2]),c},aspectRatio:n/t}}function vw(e,t,n){let{type:r,aspectRatio:i}=Vi(e,t,n);return{type:o=>{let{parallels:s,domain:a,width:c,height:l}=o,u=r(o);return s!=null&&(u.parallels(s),a===void 0&&u.fitSize([c,l],{type:"Sphere"})),u},aspectRatio:i}}var YF=un({stream:e=>e,invert:e=>e}),HZ=un(Object.assign(cl({point(e,t){this.stream.point(e,-t)}}),{invert:([e,t])=>[e,-t]}));function cA(e,t,n,r){let i=n[e],o=n[t],s=i.length,a=n[e]=new Float64Array(s).fill(NaN),c=n[t]=new Float64Array(s).fill(NaN),l,u=r.stream({point(f,d){a[l]=f,c[l]=d}});for(l=0;l<s;++l)u.point(i[l],o[l])}function XF({projection:e}={}){return e==null?!1:typeof e.stream=="function"?!0:(fn(e)&&(e=e.type),e!=null)}function GF(e){if(typeof e?.stream=="function")return zF;if(fn(e)&&(e=e.type),e!=null){if(typeof e!="function"){let{aspectRatio:t}=VF(e);if(t)return t}return zF}}function rc(e,t,{projection:n}){let{x:r,y:i}=e,o={};return r&&(o.x=r),i&&(o.y=i),o=Of(o,t),n&&r?.scale==="x"&&i?.scale==="y"&&cA("x","y",o,n),r&&(o.x=Je(o.x)),i&&(o.y=Je(o.y)),o}function WF(e){let t=[],n=[],r={scale:"x",value:t},i={scale:"y",value:n},o={point(s,a){t.push(s),n.push(a)},lineStart(){},lineEnd(){},polygonStart(){},polygonEnd(){},sphere(){}};for(let s of e.value)Rr(s,o);return[r,i]}var ZZ=["#4269d0","#efb118","#ff725c","#6cc5b0","#3ca951","#ff8ab7","#a463f2","#97bbf5","#9c6b4e","#9498a0"],KF=new Map([["accent",WM],["category10",GM],["dark2",HM],["observable10",ZZ],["paired",ZM],["pastel1",JM],["pastel2",QM],["set1",KM],["set2",tT],["set3",eT],["tableau10",nT]]);function tR(e){return e!=null&&KF.has(`${e}`.toLowerCase())}var HF=new Map([...KF,["brbg",ea(Lb,kb)],["prgn",ea(Cb,Fb)],["piyg",ea(Rb,$b)],["puor",ea(Pb,Ub)],["rdbu",ea(dm,cf)],["rdgy",ea(zb,jb)],["rdylbu",ea(hm,lf)],["rdylgn",ea(qb,Vb)],["spectral",ea(Yb,Xb)],["burd",ZF(dm,cf)],["buylrd",ZF(hm,lf)],["blues",mn(g1,x1)],["greens",mn(b1,w1)],["greys",mn(v1,_1)],["oranges",mn(A1,E1)],["purples",mn(S1,I1)],["reds",mn(M1,T1)],["turbo",na(R1)],["viridis",na(P1)],["magma",na(U1)],["inferno",na(z1)],["plasma",na(j1)],["cividis",na(N1)],["cubehelix",na(D1)],["warm",na(B1)],["cool",na(L1)],["bugn",mn(Gb,Wb)],["bupu",mn(Hb,Zb)],["gnbu",mn(Jb,Qb)],["orrd",mn(Kb,t1)],["pubu",mn(r1,i1)],["pubugn",mn(e1,n1)],["purd",mn(o1,s1)],["rdpu",mn(a1,c1)],["ylgn",mn(f1,d1)],["ylgnbu",mn(l1,u1)],["ylorbr",mn(h1,p1)],["ylorrd",mn(m1,y1)],["rainbow",JF(k1)],["sinebow",JF(F1)]]);function mn(e,t){return({length:n})=>n===1?[e[3][1]]:n===2?[e[3][1],e[3][2]]:(n=Math.max(3,Math.floor(n)),n>9?Ln(t,n):e[n])}function ea(e,t){return({length:n})=>n===2?[e[3][0],e[3][2]]:(n=Math.max(3,Math.floor(n)),n>11?Ln(t,n):e[n])}function ZF(e,t){return({length:n})=>n===2?[e[3][2],e[3][0]]:(n=Math.max(3,Math.floor(n)),n>11?Ln(r=>t(1-r),n):e[n].slice().reverse())}function na(e){return({length:t})=>Ln(e,Math.max(2,Math.floor(t)))}function JF(e){return({length:t})=>Ln(e,Math.floor(t)+1).slice(0,-1)}function lA(e){let t=`${e}`.toLowerCase();if(!HF.has(t))throw new Error(`unknown ordinal scheme: ${t}`);return HF.get(t)}function Vm(e,t){let n=lA(e),r=typeof n=="function"?n({length:t}):n;return r.length!==t?r.slice(0,t):r}function eR(e,t="greys"){let n=new Set,[r,i]=Vm(t,2);for(let o of e)if(o!=null)if(o===!0)n.add(i);else if(o===!1)n.add(r);else return;return[...n]}var QF=new Map([["brbg",kb],["prgn",Fb],["piyg",$b],["puor",Ub],["rdbu",cf],["rdgy",jb],["rdylbu",lf],["rdylgn",Vb],["spectral",Xb],["burd",e=>cf(1-e)],["buylrd",e=>lf(1-e)],["blues",x1],["greens",w1],["greys",_1],["purples",I1],["reds",T1],["oranges",E1],["turbo",R1],["viridis",P1],["magma",U1],["inferno",z1],["plasma",j1],["cividis",N1],["cubehelix",D1],["warm",B1],["cool",L1],["bugn",Wb],["bupu",Zb],["gnbu",Qb],["orrd",t1],["pubugn",n1],["pubu",i1],["purd",s1],["rdpu",c1],["ylgnbu",u1],["ylgn",d1],["ylorbr",p1],["ylorrd",y1],["rainbow",k1],["sinebow",F1]]);function kf(e){let t=`${e}`.toLowerCase();if(!QF.has(t))throw new Error(`unknown quantitative scheme: ${t}`);return QF.get(t)}var JZ=new Set(["brbg","prgn","piyg","puor","rdbu","rdgy","rdylbu","rdylgn","spectral","burd","buylrd"]);function nR(e){return e!=null&&JZ.has(`${e}`.toLowerCase())}var fA=e=>t=>e(1-t),uA=[0,1],rR=new Map([["number",we],["rgb",oi],["hsl",oI],["hcl",sI],["lab",yx]]);function dA(e){let t=`${e}`.toLowerCase();if(!rR.has(t))throw new Error(`unknown interpolator: ${t}`);return rR.get(t)}function Ff(e,t,n,{type:r,nice:i,clamp:o,zero:s,domain:a=fR(e,n),unknown:c,round:l,scheme:u,interval:f,range:d=fe.get(e)===Ml?eJ(n,a):fe.get(e)===Tl?nJ(n,a):fe.get(e)===Al?uA:void 0,interpolate:h=fe.get(e)===jr?u==null&&d!==void 0?oi:kf(u!==void 0?u:r==="cyclical"?"rainbow":"turbo"):l?Kc:we,reverse:p}){if(f=ko(f,r),(r==="cyclical"||r==="sequential")&&(r="linear"),typeof h!="function"&&(h=dA(h)),p=!!p,d!==void 0){let m=(a=je(a)).length,g=(d=je(d)).length;if(m!==g){if(h.length===1)throw new Error("invalid piecewise interpolator");h=yo(h,d),d=void 0}}if(h.length===1?(p&&(h=fA(h),p=!1),d===void 0&&(d=Float64Array.from(a,(m,g)=>g/(a.length-1)),d.length===2&&(d=uA)),t.interpolate((d===uA?un:Ym)(h))):t.interpolate(h),s){let[m,g]=ae(a);(m>0||g<0)&&(a=Za(a),Gs(a)!==Math.sign(m)?a[a.length-1]=0:a[0]=0)}return p&&(a=Da(a)),t.domain(a).unknown(c),i&&(t.nice(QZ(i,r)),a=t.domain()),d!==void 0&&t.range(d),o&&t.clamp(o),{type:r,domain:a,range:d,scale:t,interpolate:h,interval:f}}function QZ(e,t){return e===!0?void 0:typeof e=="number"?e:lF(e,t)}function iR(e,t,n){return Ff(e,Rs(),t,n)}function oR(e,t,n){return hA(e,t,{...n,exponent:.5})}function hA(e,t,{exponent:n=1,...r}){return Ff(e,em().exponent(n),t,{...r,type:"pow"})}function sR(e,t,{base:n=10,domain:r=rJ(t),...i}){return Ff(e,Kp().base(n),t,{...i,domain:r})}function aR(e,t,{constant:n=1,...r}){return Ff(e,tm().constant(n),t,r)}function cR(e,t,{range:n,quantiles:r=n===void 0?5:(n=[...n]).length,n:i=r,scheme:o="rdylbu",domain:s=iJ(t),unknown:a,interpolate:c,reverse:l}){return n===void 0&&(n=c!==void 0?Ln(c,i):fe.get(e)===jr?Vm(o,i):void 0),s.length>0&&(s=nm(s,n===void 0?{length:i}:n).quantiles()),_w(e,t,{domain:s,range:n,reverse:l,unknown:a})}function lR(e,t,{range:n,n:r=n===void 0?5:(n=[...n]).length,scheme:i="rdylbu",domain:o=fR(e,t),unknown:s,interpolate:a,reverse:c}){let[l,u]=ae(o),f;return n===void 0?(f=_n(l,u,r),f[0]<=l&&f.splice(0,1),f[f.length-1]>=u&&f.pop(),r=f.length+1,n=a!==void 0?Ln(a,r):fe.get(e)===jr?Vm(i,r):void 0):(f=Ln(we(l,u),r+1).slice(1,-1),l instanceof Date&&(f=f.map(d=>new Date(d)))),Gs(je(o))<0&&f.reverse(),_w(e,t,{domain:f,range:n,reverse:c,unknown:s})}function _w(e,t,{domain:n=[0],unknown:r,scheme:i="rdylbu",interpolate:o,range:s=o!==void 0?Ln(o,n.length+1):fe.get(e)===jr?Vm(i,n.length+1):void 0,reverse:a}){n=je(n);let c=Gs(n);if(!isNaN(c)&&!KZ(n,c))throw new Error(`the ${e} scale has a non-monotonic domain`);return a&&(s=Da(s)),{type:"threshold",scale:rm(c<0?Da(n):n,s===void 0?[]:s).unknown(r),domain:n,range:s}}function KZ(e,t){for(let n=1,r=e.length,i=e[0];n<r;++n){let o=Yn(i,i=e[n]);if(o!==0&&o!==t)return!1}return!0}function uR(e){return{type:"identity",scale:wF(fe.get(e))?Jp():t=>t}}function Cf(e,t=gf){return e.length?[ce(e,({value:n})=>n===void 0?n:ce(n,t)),zt(e,({value:n})=>n===void 0?n:zt(n,t))]:[0,1]}function fR(e,t){let n=fe.get(e);return(n===Ml||n===Al||n===Tl?tJ:Cf)(t)}function tJ(e){return[0,e.length?zt(e,({value:t})=>t===void 0?t:zt(t,gf)):1]}function eJ(e,t){let n=e.find(({radius:s})=>s!==void 0);if(n!==void 0)return[0,n.radius];let r=Gn(e,.5,({value:s})=>s===void 0?NaN:Gn(s,.25,er)),i=t.map(s=>3*Math.sqrt(s/r)),o=30/zt(i);return o<1?i.map(s=>s*o):i}function nJ(e,t){let n=Pi(e,({value:o})=>o===void 0?NaN:Pi(o,Math.abs)),r=t.map(o=>12*o/n),i=60/zt(r);return i<1?r.map(o=>o*i):r}function rJ(e){for(let{value:t}of e)if(t!==void 0)for(let n of t){if(n>0)return Cf(e,er);if(n<0)return Cf(e,Va)}return[1,10]}function iJ(e){let t=[];for(let{value:n}of e)if(n!==void 0)for(let r of n)t.push(r);return t}function Ym(e){return(t,n)=>r=>e(t+r*(n-t))}function Sw(e,t,n,r,{type:i,nice:o,clamp:s,domain:a=Cf(r),unknown:c,pivot:l=0,scheme:u,range:f,symmetric:d=!0,interpolate:h=fe.get(e)===jr?u==null&&f!==void 0?oi:kf(u!==void 0?u:"rdbu"):we,reverse:p}){l=+l,a=je(a);let[m,g]=a;if(a.length>2&&Un(`Warning: the diverging ${e} scale domain contains extra elements.`),Yn(m,g)<0&&([m,g]=[g,m],p=!p),m=Math.min(m,l),g=Math.max(g,l),typeof h!="function"&&(h=dA(h)),f!==void 0&&(h=h.length===1?Ym(h)(...f):yo(h,f)),p&&(h=fA(h)),d){let y=n.apply(l),x=y-n.apply(m),b=n.apply(g)-y;x<b?m=n.invert(y-b):x>b&&(g=n.invert(y+x))}return t.domain([m,l,g]).unknown(c).interpolator(h),s&&t.clamp(s),o&&t.nice(o),{type:i,domain:[m,g],pivot:l,interpolate:h,scale:t}}function dR(e,t,n){return Sw(e,fm(),oJ,t,n)}function hR(e,t,n){return pA(e,t,{...n,exponent:.5})}function pA(e,t,{exponent:n=1,...r}){return Sw(e,Bb().exponent(n=+n),cJ(n),t,{...r,type:"diverging-pow"})}function pR(e,t,{base:n=10,pivot:r=1,domain:i=Cf(t,r<0?Va:er),...o}){return Sw(e,Db().base(n=+n),sJ,t,{domain:i,pivot:r,...o})}function mR(e,t,{constant:n=1,...r}){return Sw(e,Ob().constant(n=+n),lJ(n),t,r)}var oJ={apply(e){return e},invert(e){return e}},sJ={apply:Math.log,invert:Math.exp},aJ={apply(e){return Math.sign(e)*Math.sqrt(Math.abs(e))},invert(e){return Math.sign(e)*(e*e)}};function cJ(e){return e===.5?aJ:{apply(t){return Math.sign(t)*Math.pow(Math.abs(t),e)},invert(t){return Math.sign(t)*Math.pow(Math.abs(t),1/e)}}}function lJ(e){return{apply(t){return Math.sign(t)*Math.log1p(Math.abs(t/e))},invert(t){return Math.sign(t)*Math.expm1(Math.abs(t))*e}}}function yR(e,t,n,r){return Ff(e,t,n,r)}function gR(e,t,n){return yR(e,Ab(),t,n)}function xR(e,t,n){return yR(e,Eb(),t,n)}var Rf=Symbol("ordinal");function wR(e,t,n,{type:r,interval:i,domain:o,range:s,reverse:a,hint:c}){return i=ko(i,r),o===void 0&&(o=MR(n,i,e)),(r==="categorical"||r===Rf)&&(r="ordinal"),a&&(o=Da(o)),o=t.domain(o).domain(),s!==void 0&&(typeof s=="function"&&(s=s(o)),t.range(s)),{type:r,domain:o,range:s,scale:t,hint:c,interval:i}}function vR(e,t,{type:n,interval:r,domain:i,range:o,scheme:s,unknown:a,...c}){r=ko(r,n),i===void 0&&(i=MR(t,r,e));let l;if(fe.get(e)===Af)l=uJ(t),o=o===void 0?fJ(l):Xt(o,Ef);else if(fe.get(e)===jr&&(o===void 0&&(n==="ordinal"||n===Rf)&&(o=eR(i,s),o!==void 0&&(s=void 0)),s===void 0&&o===void 0&&(s=n==="ordinal"?"turbo":"observable10"),s!==void 0))if(o!==void 0){let u=kf(s),f=o[0],d=o[1]-o[0];o=({length:h})=>Ln(p=>u(f+d*p),h)}else o=lA(s);if(a===Hp)throw new Error(`implicit unknown on ${e} scale is not supported`);return wR(e,fl().unknown(a),t,{...c,type:n,domain:i,range:o,hint:l})}function _R(e,t,{align:n=.5,padding:r=.5,...i}){return IR(OM().align(n).padding(r),t,i,e)}function SR(e,t,{align:n=.5,padding:r=.1,paddingInner:i=r,paddingOuter:o=e==="fx"||e==="fy"?0:r,...s}){return IR(za().align(n).paddingInner(i).paddingOuter(o),t,s,e)}function IR(e,t,n,r){let{round:i}=n;return i!==void 0&&e.round(i=!!i),e=wR(r,e,t,n),e.round=i,e}function MR(e,t,n){let r=new kr;for(let{value:i,domain:o}of e){if(o!==void 0)return o();if(i!==void 0)for(let s of i)r.add(s)}if(t!==void 0){let[i,o]=ae(r).map(t.floor,t);return t.range(i,t.offset(o))}if(r.size>1e4&&fe.get(n)===mi)throw new Error(`implicit ordinal domain of ${n} scale has more than 10,000 values`);return fo(r,ln)}function bR(e,t){let n;for(let{hint:r}of e){let i=r?.[t];if(i!==void 0){if(n===void 0)n=i;else if(n!==i)return}}return n}function uJ(e){return{fill:bR(e,"fill"),stroke:bR(e,"stroke")}}function fJ(e){return ne(e.fill)?lT:W1}function Xm(e,{label:t,inset:n=0,insetTop:r=n,insetRight:i=n,insetBottom:o=n,insetLeft:s=n,round:a,nice:c,clamp:l,zero:u,align:f,padding:d,projection:h,facet:{label:p=t}={},...m}={}){let g={};for(let[y,x]of e){let b=m[y],w=LR(y,x,{round:fe.get(y)===mi?a:void 0,nice:c,clamp:l,zero:u,align:f,padding:d,projection:h,...b});if(w){let{label:_=y==="fx"||y==="fy"?p:t,percent:v,transform:M,inset:E,insetTop:D=E!==void 0?E:y==="y"?r:0,insetRight:I=E!==void 0?E:y==="x"?i:0,insetBottom:T=E!==void 0?E:y==="y"?o:0,insetLeft:O=E!==void 0?E:y==="x"?s:0}=b||{};if(M==null)M=void 0;else if(typeof M!="function")throw new Error("invalid scale transform; not a function");w.percent=!!v,w.label=_===void 0?dJ(x,w):_,w.transform=M,y==="x"||y==="fx"?(w.insetLeft=+O,w.insetRight=+I):(y==="y"||y==="fy")&&(w.insetTop=+D,w.insetBottom=+T),g[y]=w}}return g}function yA(e){let t={},n={scales:t};for(let[r,i]of Object.entries(e)){let{scale:o,type:s,interval:a,label:c}=i;t[r]=CR(i),n[r]=o,o.type=s,a!=null&&(o.interval=a),c!=null&&(o.label=c)}return n}function DR(e,t){let{x:n,y:r,fx:i,fy:o}=e,s=i||o?Tw(t):t;i&&TR(i,s),o&&AR(o,s);let a=i||o?gA(e,t):t;n&&TR(n,a),r&&AR(r,a)}function dJ(e=[],t){let n;for(let{label:r}of e)if(r!==void 0){if(n===void 0)n=r;else if(n!==r)return}if(n!==void 0)return!Ro(t)&&t.percent&&(n=`${n} (%)`),{inferred:!0,toString:()=>n}}function Mw(e){return Math.sign(Gs(e.domain()))*Math.sign(Gs(e.range()))}function Tw(e){let{marginTop:t,marginRight:n,marginBottom:r,marginLeft:i,width:o,height:s,facet:{marginTop:a,marginRight:c,marginBottom:l,marginLeft:u}}=e;return{marginTop:Math.max(t,a),marginRight:Math.max(n,c),marginBottom:Math.max(r,l),marginLeft:Math.max(i,u),width:o,height:s}}function gA({fx:e,fy:t},n){let{marginTop:r,marginRight:i,marginBottom:o,marginLeft:s,width:a,height:c}=Tw(n);return{marginTop:r,marginRight:i,marginBottom:o,marginLeft:s,width:e?e.scale.bandwidth()+s+i:a,height:t?t.scale.bandwidth()+r+o:c,facet:{width:a,height:c}}}function TR(e,t){if(e.range===void 0){let{insetLeft:n,insetRight:r}=e,{width:i,marginLeft:o=0,marginRight:s=0}=t,a=o+n,c=i-s-r;e.range=[a,Math.max(a,c)],Ro(e)||(e.range=BR(e)),e.scale.range(e.range)}OR(e)}function AR(e,t){if(e.range===void 0){let{insetTop:n,insetBottom:r}=e,{height:i,marginTop:o=0,marginBottom:s=0}=t,a=o+n,c=i-s-r;e.range=[Math.max(a,c),a],Ro(e)?e.range.reverse():e.range=BR(e),e.scale.range(e.range)}OR(e)}function OR(e){e.round===void 0&&mJ(e)&&hJ(e)<=30&&e.scale.round(!0)}function hJ({scale:e}){let t=e.domain().length,[n,r]=e.range(),i=e.paddingInner?e.paddingInner():1,o=e.paddingOuter?e.paddingOuter():e.padding(),s=t-i,a=Math.abs(r-n)/Math.max(1,s+o*2);return(a-Math.floor(a))*s}function BR(e){let t=e.scale.domain().length+xA(e);if(!(t>2))return e.range;let[n,r]=e.range;return Array.from({length:t},(i,o)=>n+o/(t-1)*(r-n))}function Aw(e,t,n){return LR(e,n===void 0?void 0:[{hint:n}],{...t})}function LR(e,t=[],n={}){let r=pJ(e,t,n);if(n.type===void 0&&n.domain===void 0&&n.range===void 0&&n.interval==null&&e!=="fx"&&e!=="fy"&&Ro({type:r})){let i=t.map(({value:o})=>o).filter(o=>o!==void 0);i.some(Oe)?Un(`Warning: some data associated with the ${e} scale are dates. Dates are typically associated with a "utc" or "time" scale rather than a "${$f(r)}" scale. If you are using a bar mark, you probably want a rect mark with the interval option instead; if you are using a group transform, you probably want a bin transform instead. If you want to treat this data as ordinal, you can specify the interval of the ${e} scale (e.g., d3.utcDay), or you can suppress this warning by setting the type of the ${e} scale to "${$f(r)}".`):i.some(hF)?Un(`Warning: some data associated with the ${e} scale are strings that appear to be dates (e.g., YYYY-MM-DD). If these strings represent dates, you should parse them to Date objects. Dates are typically associated with a "utc" or "time" scale rather than a "${$f(r)}" scale. If you are using a bar mark, you probably want a rect mark with the interval option instead; if you are using a group transform, you probably want a bin transform instead. If you want to treat this data as ordinal, you can suppress this warning by setting the type of the ${e} scale to "${$f(r)}".`):i.some(pF)&&Un(`Warning: some data associated with the ${e} scale are strings that appear to be numbers. If these strings represent numbers, you should parse or coerce them to numbers. Numbers are typically associated with a "linear" scale rather than a "${$f(r)}" scale. If you want to treat this data as ordinal, you can specify the interval of the ${e} scale (e.g., 1 for integers), or you can suppress this warning by setting the type of the ${e} scale to "${$f(r)}".`)}switch(n.type=r,r){case"diverging":case"diverging-sqrt":case"diverging-pow":case"diverging-log":case"diverging-symlog":case"cyclical":case"sequential":case"linear":case"sqrt":case"threshold":case"quantile":case"pow":case"log":case"symlog":n=Iw(t,n,Je);break;case"identity":switch(fe.get(e)){case mi:n=Iw(t,n,Je);break;case Af:n=Iw(t,n,yJ);break}break;case"utc":case"time":n=Iw(t,n,cF);break}switch(r){case"diverging":return dR(e,t,n);case"diverging-sqrt":return hR(e,t,n);case"diverging-pow":return pA(e,t,n);case"diverging-log":return pR(e,t,n);case"diverging-symlog":return mR(e,t,n);case"categorical":case"ordinal":case Rf:return vR(e,t,n);case"cyclical":case"sequential":case"linear":return iR(e,t,n);case"sqrt":return oR(e,t,n);case"threshold":return _w(e,t,n);case"quantile":return cR(e,t,n);case"quantize":return lR(e,t,n);case"pow":return hA(e,t,n);case"log":return sR(e,t,n);case"symlog":return aR(e,t,n);case"utc":return xR(e,t,n);case"time":return gR(e,t,n);case"point":return _R(e,t,n);case"band":return SR(e,t,n);case"identity":return uR(e);case void 0:return;default:throw new Error(`unknown scale type: ${r}`)}}function $f(e){return typeof e=="symbol"?e.description:e}function ER(e){return typeof e=="string"?`${e}`.toLowerCase():e}var NR={toString:()=>"projection"};function pJ(e,t,{type:n,domain:r,range:i,scheme:o,pivot:s,projection:a}){if(n=ER(n),e==="fx"||e==="fy")return"band";(e==="x"||e==="y")&&a!=null&&(n=NR);for(let l of t){let u=ER(l.type);if(u!==void 0){if(n===void 0)n=u;else if(n!==u)throw new Error(`scale incompatible with channel: ${n} !== ${u}`)}}if(n===NR)return;if(n!==void 0)return n;if(r===void 0&&!t.some(({value:l})=>l!==void 0))return;let c=fe.get(e);if(c===Ml)return"sqrt";if(c===Al||c===Tl)return"linear";if(c===Af)return"ordinal";if((r||i||[]).length>2)return mA(c);if(r!==void 0){if(Ae(r))return mA(c);if(Oe(r))return"utc"}else{let l=t.map(({value:u})=>u).filter(u=>u!==void 0);if(l.some(Ae))return mA(c);if(l.some(Oe))return"utc"}if(c===jr){if(s!=null||nR(o))return"diverging";if(tR(o))return"categorical"}return"linear"}function mA(e){switch(e){case mi:return"point";case jr:return Rf;default:return"ordinal"}}function Ro({type:e}){return e==="ordinal"||e==="point"||e==="band"||e===Rf}function xA({type:e}){return e==="threshold"}function mJ({type:e}){return e==="point"||e==="band"}function ir(e){if(e===void 0)return!0;let t=e.domain(),n=e(t[0]);for(let r=1,i=t.length;r<i;++r)if(e(t[r])-n)return!1;return!0}function Iw(e,{domain:t,...n},r){for(let i of e)i.value!==void 0&&(t===void 0&&(t=i.value?.domain),i.value=r(i.value));return{domain:t===void 0?t:r(t),...n}}function yJ(e){return Xt(e,Ef)}function $o(e={}){let t;for(let n in e)if(fe.has(n)&&Bo(e[n])){if(t!==void 0)throw new Error("ambiguous scale definition; multiple scales found");t=CR(Aw(n,e[n]))}if(t===void 0)throw new Error("invalid scale definition; no scale found");return t}function kR(e){return t=>{if(!fe.has(t=`${t}`))throw new Error(`unknown scale: ${t}`);return e[t]}}function CR({scale:e,type:t,domain:n,range:r,interpolate:i,interval:o,transform:s,percent:a,pivot:c}){if(t==="identity")return{type:"identity",apply:u=>u,invert:u=>u};let l=e.unknown?e.unknown():void 0;return{type:t,domain:Za(n),...r!==void 0&&{range:Za(r)},...s!==void 0&&{transform:s},...a&&{percent:a},...l!==void 0&&{unknown:l},...o!==void 0&&{interval:o},...i!==void 0&&{interpolate:i},...e.clamp&&{clamp:e.clamp()},...c!==void 0&&{pivot:c,symmetric:!1},...e.base&&{base:e.base()},...e.exponent&&{exponent:e.exponent()},...e.constant&&{constant:e.constant()},...e.align&&{align:e.align(),round:e.round()},...e.padding&&(e.paddingInner?{paddingInner:e.paddingInner(),paddingOuter:e.paddingOuter()}:{padding:e.padding()}),...e.bandwidth&&{bandwidth:e.bandwidth(),step:e.step()},apply:u=>e(u),...e.invert&&{invert:u=>e.invert(u)}}}function RR(e,t,n={}){let r=.5-Be,i=.5+Be,o=.5+Be,s=.5-Be;for(let{marginTop:m,marginRight:g,marginBottom:y,marginLeft:x}of t)m>r&&(r=m),g>i&&(i=g),y>o&&(o=y),x>s&&(s=x);let{margin:a,marginTop:c=a!==void 0?a:r,marginRight:l=a!==void 0?a:i,marginBottom:u=a!==void 0?a:o,marginLeft:f=a!==void 0?a:s}=n;c=+c,l=+l,u=+u,f=+f;let{width:d=640,height:h=gJ(e,n,{width:d,marginTopDefault:r,marginRightDefault:i,marginBottomDefault:o,marginLeftDefault:s})+Math.max(0,c-r+u-o)}=n;d=+d,h=+h;let p={width:d,height:h,marginTop:c,marginRight:l,marginBottom:u,marginLeft:f};if(e.fx||e.fy){let{margin:m,marginTop:g=m!==void 0?m:c,marginRight:y=m!==void 0?m:l,marginBottom:x=m!==void 0?m:u,marginLeft:b=m!==void 0?m:f}=n.facet??{};g=+g,y=+y,x=+x,b=+b,p.facet={marginTop:g,marginRight:y,marginBottom:x,marginLeft:b}}return p}function gJ({x:e,y:t,fy:n,fx:r},{projection:i,aspectRatio:o},{width:s,marginTopDefault:a,marginRightDefault:c,marginBottomDefault:l,marginLeftDefault:u}){let f=n?n.scale.domain().length:1,d=GF(i);if(d){let p=r?r.scale.domain().length:1,m=(1.1*f-.1)/(1.1*p-.1)*d,g=Math.max(.1,Math.min(10,m));return Math.round((s-u-c)*g+a+l)}let h=t?Ro(t)?t.scale.domain().length:Math.max(7,17/f):1;if(o!=null){if(o=+o,!(isFinite(o)&&o>0))throw new Error(`invalid aspectRatio: ${o}`);let p=FR("y",t)/(FR("x",e)*o),m=r?r.scale.bandwidth():1,g=n?n.scale.bandwidth():1,y=m*(s-u-c)-e.insetLeft-e.insetRight;return(p*y+t.insetTop+t.insetBottom)/g+a+l}return!!(t||n)*Math.max(1,Math.min(60,h*f))*20+!!r*30+60}function FR(e,t){if(!t)throw new Error(`aspectRatio requires ${e} scale`);let{type:n,domain:r}=t,i;switch(n){case"linear":case"utc":case"time":i=Number;break;case"pow":{let a=t.scale.exponent();i=c=>Math.pow(c,a);break}case"log":i=Math.log;break;case"point":case"band":return r.length;default:throw new Error(`unsupported ${e} scale for aspectRatio: ${n}`)}let[o,s]=ae(r);return Math.abs(i(s)-i(o))}function PR(e,t){let{fx:n,fy:r}=Xm(e,t),i=n?.scale.domain(),o=r?.scale.domain();return i&&o?V0(i,o).map(([s,a],c)=>({x:s,y:a,i:c})):i?i.map((s,a)=>({x:s,i:a})):o?o.map((s,a)=>({y:s,i:a})):void 0}function UR(e,{x:t,y:n}){return t&&=SA(t),n&&=SA(n),e.filter(t&&n?r=>t.has(r.x)&&n.has(r.y):t?r=>t.has(r.x):r=>n.has(r.y)).sort(t&&n?(r,i)=>t.get(r.x)-t.get(i.x)||n.get(r.y)-n.get(i.y):t?(r,i)=>t.get(r.x)-t.get(i.x):(r,i)=>n.get(r.y)-n.get(i.y))}function Nw(e,{fx:t,fy:n}){let r=nr(e),i=t?.value,o=n?.value;return t&&n?$i(r,s=>(s.fx=i[s[0]],s.fy=o[s[0]],s),s=>i[s],s=>o[s]):t?$i(r,s=>(s.fx=i[s[0]],s),s=>i[s]):$i(r,s=>(s.fy=o[s[0]],s),s=>o[s])}function zR(e,t,{marginTop:n,marginLeft:r}){return e&&t?({x:i,y:o})=>`translate(${e(i)-r},${t(o)-n})`:e?({x:i})=>`translate(${e(i)-r},0)`:({y:i})=>`translate(0,${t(i)-n})`}function jR(e){let t=[],n=new Uint32Array(Sn(e,r=>r.length));for(let r of e){let i=0;for(let o of e)r!==o&&(n.set(o,i),i+=o.length);t.push(n.slice(0,i))}return t}var xJ=new Map([["top",bA],["right",_A],["bottom",wA],["left",vA],["top-left",Ew(bA,vA)],["top-right",Ew(bA,_A)],["bottom-left",Ew(wA,vA)],["bottom-right",Ew(wA,_A)],["top-empty",wJ],["right-empty",SJ],["bottom-empty",vJ],["left-empty",_J],["empty",IJ]]);function qR(e){if(e==null)return null;let t=xJ.get(`${e}`.toLowerCase());if(t)return t;throw new Error(`invalid facet anchor: ${e}`)}var $R=new WeakMap;function SA(e){let t=$R.get(e);return t||$R.set(e,t=new Xn(Xt(e,(n,r)=>[n,r]))),t}function ic(e,t){return SA(e).get(t)}function bJ(e,t,n){return t=Zs(t),n=Zs(n),e.find(r=>Object.is(Zs(r.x),t)&&Object.is(Zs(r.y),n))}function Dw(e,t,n){return bJ(e,t,n)?.empty}function bA(e,{y:t},{y:n}){return t?ic(t,n)===0:!0}function wA(e,{y:t},{y:n}){return t?ic(t,n)===t.length-1:!0}function vA(e,{x:t},{x:n}){return t?ic(t,n)===0:!0}function _A(e,{x:t},{x:n}){return t?ic(t,n)===t.length-1:!0}function wJ(e,{y:t},{x:n,y:r,empty:i}){if(i)return!1;if(!t)return;let o=ic(t,r);if(o>0)return Dw(e,n,t[o-1])}function vJ(e,{y:t},{x:n,y:r,empty:i}){if(i)return!1;if(!t)return;let o=ic(t,r);if(o<t.length-1)return Dw(e,n,t[o+1])}function _J(e,{x:t},{x:n,y:r,empty:i}){if(i)return!1;if(!t)return;let o=ic(t,n);if(o>0)return Dw(e,t[o-1],r)}function SJ(e,{x:t},{x:n,y:r,empty:i}){if(i)return!1;if(!t)return;let o=ic(t,n);if(o<t.length-1)return Dw(e,t[o+1],r)}function IJ(e,t,{empty:n}){return n}function Ew(e,t){return function(){return e.apply(null,arguments)&&t.apply(null,arguments)}}function Ow(e,{channels:{fx:t,fy:n},groups:r}){return t&&n?e.map(({x:i,y:o})=>r.get(i)?.get(o)??[]):t?e.map(({x:i})=>r.get(i)??[]):e.map(({y:i})=>r.get(i)??[])}var vt=class{constructor(t,n={},r={},i){let{facet:o="auto",facetAnchor:s,fx:a,fy:c,sort:l,dx:u=0,dy:f=0,margin:d=0,marginTop:h=d,marginRight:p=d,marginBottom:m=d,marginLeft:g=d,clip:y=i?.clip,channels:x,tip:b,render:w}=r;if(this.data=t,this.sort=Lo(l)?l:null,this.initializer=_e(r).initializer,this.transform=this.initializer?r.transform:hn(r).transform,o===null||o===!1?this.facet=null:(this.facet=Qe(o===!0?"include":o,"facet",["auto","include","exclude","super"]),this.fx=t===Wa&&typeof a=="string"?[a]:a,this.fy=t===Wa&&typeof c=="string"?[c]:c),this.facetAnchor=qR(s),n=Fm(n),x!==void 0&&(n={...MJ(x),...n}),i!==void 0&&(n={...xw(this,r,i),...n}),this.channels=Object.fromEntries(Object.entries(n).map(([_,v])=>{if(zr(v.value)){let{value:M,label:E=v.label,scale:D=v.scale}=v.value;v={...v,label:E,scale:D,value:M}}if(t===Wa&&typeof v.value=="string"){let{value:M}=v;v={...v,value:[M]}}return[_,v]}).filter(([_,{value:v,optional:M}])=>{if(v!=null)return!0;if(M)return!1;throw new Error(`missing channel value: ${_}`)})),this.dx=+u,this.dy=+f,this.marginTop=+h,this.marginRight=+p,this.marginBottom=+m,this.marginLeft=+g,this.clip=ww(y),this.tip=TJ(b),this.facet==="super"){if(a||c)throw new Error("super-faceting cannot use fx or fy");for(let _ in this.channels){let{scale:v}=n[_];if(!(v!=="x"&&v!=="y"))throw new Error("super-faceting cannot use x or y")}}w!=null&&(this.render=Pf(w,this.render))}initialize(t,n,r){let i=je(this.data);t===void 0&&i!=null&&(t=[nr(i)]);let o=t;this.transform!=null&&({facets:t,data:i}=this.transform(i,t,r),i=je(i)),t!==void 0&&(t.original=o);let s=mw(this.channels,i);return this.sort!=null&&kF(i,t,s,n,this.sort),{data:i,facets:t,channels:s}}filter(t,n,r){for(let i in n){let{filter:o=Ue}=n[i];if(o!==null){let s=r[i];t=t.filter(a=>o(s[a]))}}return t}project(t,n,r){for(let i in t)if(t[i].scale==="x"&&/^x|x$/.test(i)){let o=i.replace(/^x|x$/,"y");o in t&&t[o].scale==="y"&&cA(i,o,n,r.projection)}}scale(t,n,r){let i=Of(t,n);return r.projection&&this.project(t,i,r),i}};function Ke(...e){return e.plot=vt.prototype.plot,e}function Pf(e,t){if(e==null)return t===null?void 0:t;if(t==null)return e===null?void 0:e;if(typeof e!="function")throw new TypeError(`invalid render transform: ${e}`);if(typeof t!="function")throw new TypeError(`invalid render transform: ${t}`);return function(n,r,i,o,s,a){return e.call(this,n,r,i,o,s,(c,l,u,f,d)=>t.call(this,c,l,u,f,d,a))}}function MJ(e){return Object.fromEntries(Object.entries(Fm(e)).map(([t,n])=>(n=typeof n=="string"?{value:n,label:t}:pi(n),n.filter===void 0&&n.scale==null&&(n={...n,filter:null}),[t,n])))}function TJ(e){return e===!0?"xy":e===!1||e==null?null:typeof e=="string"?Qe(e,"tip",["x","y","xy"]):e}function Yi(e,t){return e?.tip===!0?{...e,tip:t}:fn(e?.tip)&&e.tip.pointer===void 0?{...e,tip:{...e.tip,pointer:t}}:e}var VR=new WeakMap;function IA(e,t,{x:n,y:r,px:i,py:o,maxRadius:s=40,channels:a,render:c,...l}={}){return s=+s,i!=null&&(n??=null,a={...a,px:{value:i,scale:"x"}}),o!=null&&(r??=null,a={...a,py:{value:o,scale:"y"}}),{x:n,y:r,channels:a,...l,render:Pf(function(u,f,d,h,p,m){p={...p,pointerSticky:!1};let g=p.ownerSVGElement,{data:y}=p.getMarkState(this),x=VR.get(g);x||VR.set(g,x={sticky:!1,roots:[],renders:[]});let b=x.renders.push(W)-1,{x:w,y:_,fx:v,fy:M}=f,E=v?v(u.fx)-h.marginLeft:0,D=M?M(u.fy)-h.marginTop:0;w?.bandwidth&&(E+=w.bandwidth()/2),_?.bandwidth&&(D+=_.bandwidth()/2);let I=u.fi!=null,T;if(I){let Y=x.facetStates;Y||(x.facetStates=Y=new Map),T=Y.get(this),T||Y.set(this,T=new Map)}let[O,B]=pn(this,h),{px:S,py:A}=d,N=S?Y=>S[Y]:MA(d,O),k=A?Y=>A[Y]:TA(d,B),R,F,$,P;function U(Y,rt){if(I)if(P&&(P=cancelAnimationFrame(P)),Y==null)T.delete(u.fi);else{T.set(u.fi,rt),P=requestAnimationFrame(()=>{P=null;for(let[j,H]of T)if(H<rt||H===rt&&j<u.fi){Y=null;break}W(Y)});return}W(Y)}function W(Y){if(R===Y&&$===x.sticky)return;R=Y,$=p.pointerSticky=x.sticky;let rt=R==null?[]:[R];I&&(rt.fx=u.fx,rt.fy=u.fy,rt.fi=u.fi);let j=m(rt,f,d,h,p);if(F){if(I){let H=F.parentNode,ot=F.getAttribute("transform"),z=j.getAttribute("transform");ot?j.setAttribute("transform",ot):j.removeAttribute("transform"),z?H.setAttribute("transform",z):H.removeAttribute("transform"),j.removeAttribute("aria-label"),j.removeAttribute("aria-description"),j.removeAttribute("aria-hidden")}F.replaceWith(j)}return x.roots[b]=F=j,R==null&&T?.size>1||p.dispatchValue(R==null?null:y[R]),j}function tt(Y){if(x.sticky||Y.pointerType==="mouse"&&Y.buttons===1)return;let[rt,j]=Bn(Y);rt-=E,j-=D;let H=rt<h.marginLeft||rt>h.width-h.marginRight?1:e,ot=j<h.marginTop||j>h.height-h.marginBottom?1:t,z=null,Ct=s*s;for(let dt of u){let Wt=H*(N(dt)-rt),Ht=ot*(k(dt)-j),et=Wt*Wt+Ht*Ht;et<=Ct&&(z=dt,Ct=et)}if(z!=null&&(e!==1||t!==1)){let dt=N(z)-rt,Wt=k(z)-j;Ct=dt*dt+Wt*Wt}U(z,Ct)}function nt(Y){Y.pointerType==="mouse"&&R!=null&&(x.sticky&&x.roots.some(rt=>rt?.contains(Y.target))||(x.sticky?(x.sticky=!1,x.renders.forEach(rt=>rt(null))):(x.sticky=!0,W(R)),Y.stopImmediatePropagation()))}function st(Y){Y.pointerType==="mouse"&&(x.sticky||U(null))}return g.addEventListener("pointerenter",tt),g.addEventListener("pointermove",tt),g.addEventListener("pointerdown",nt),g.addEventListener("pointerleave",st),W(null)},c)}}function Uf(e){return IA(1,1,e)}function zf(e){return IA(1,.01,e)}function Nl(e){return IA(.01,1,e)}function MA({x1:e,x2:t,x:n=e},r){return e&&t?i=>(e[i]+t[i])/2:n?i=>n[i]:()=>r}function TA({y1:e,y2:t,y:n=e},r){return e&&t?i=>(e[i]+t[i])/2:n?i=>n[i]:()=>r}function Bw(e){return Ro(e)&&e.interval===void 0?void 0:"tabular-nums"}function YR(e,t){let{label:n=e.label,tickSize:r=6,width:i=240,height:o=44+r,marginTop:s=18,marginRight:a=0,marginBottom:c=16+r,marginLeft:l=0,style:u,ticks:f=(i-l-a)/64,tickFormat:d,fontVariant:h=Bw(e),round:p=!0,opacity:m,className:g}=t,y=nc(t);g=Bf(g),m=ie(m)[1],d===null&&(d=()=>null);let x=ct("svg",y).attr("class",`${g}-ramp`).attr("font-family","system-ui, sans-serif").attr("font-size",10).attr("width",i).attr("height",o).attr("viewBox",`0 0 ${i} ${o}`).call(O=>O.append("style").text(`:where(.${g}-ramp) {
15
+ ${n}`}function YZ(e){return e==="time"?rw:e==="utc"?Lm:jZ}function TF(e,t,n){let r=Gt(K0(t,(i,o)=>Math.abs(o-i)));if(r<1e3)return IF("millisecond","utc",n);for(let[i,o,s,a]of YZ(e)){if(r>a||i==="hour"&&!r)break;if(t.every(c=>o.floor(c)>=c))return IF(i,s,n)}}function wf(e,t,n){return(r,i,o)=>{let s=e(r,i),a=t(r,i),c=i-Gs(o);return i!==c&&o[c]!==void 0&&a===t(o[c],c)?s:n(s,a)}}var Il=Object.getPrototypeOf(Uint8Array),XZ=Object.prototype.toString,PA=Symbol("reindex");function pt(e,t,n){let r=typeof t;return r==="string"?EF(e,UA(t),n):r==="function"?EF(e,t,n):r==="number"||t instanceof Date||r==="boolean"?Xt(e,un(t),n):typeof t?.transform=="function"?NF(t.transform(e),n):GZ(NF(t,n),e?.[PA])}function GZ(e,t){return t?Fm(e,t):e}function EF(e,t,n){return Xt(e,n?.prototype instanceof Il?WZ(t):t,n)}function NF(e,t){return t===void 0?qe(e):e instanceof t?e:t.prototype instanceof Il&&!(e instanceof Il)?t.from(e,zA):t.from(e)}function WZ(e){return(t,n)=>zA(e(t,n))}var Za=[null],UA=e=>t=>t[e],Ae={transform:ir},G={transform:e=>e};var km=()=>1,DF=()=>!0,ze=e=>e==null?e:`${e}`,Nt=e=>e==null?e:+e;var Ws=e=>e?e[0]:void 0,Ja=e=>e?e[1]:void 0,OF=e=>e?e[2]:void 0,un=e=>()=>e;function Sf(e){let t=+`${e}`.slice(1)/100;return(n,r)=>Hn(n,t,r)}function Je(e){return e instanceof Il?e:Xt(e,zA,Float64Array)}function zA(e){return e==null?NaN:Number(e)}function BF(e){return Xt(e,qA)}function qA(e){return e instanceof Date&&!isNaN(e)?e:typeof e=="string"?_l(e):e==null||isNaN(e=+e)?void 0:new Date(e)}function De(e,t){return e===void 0&&(e=t),e===null?[void 0,"none"]:tc(e)?[void 0,e]:[e,void 0]}function ie(e,t){return e===void 0&&(e=t),e===null||typeof e=="number"?[void 0,e]:[e,void 0]}function jA(e,t,n){if(e!=null)return Qe(e,t,n)}function Qe(e,t,n){let r=`${e}`.toLowerCase();if(!n.includes(r))throw new Error(`invalid ${t}: ${e}`);return r}function qe(e){return e==null||e instanceof Array||e instanceof Il?e:Array.from(e)}function Xt(e,t,n=Array){return e==null?e:e instanceof n?e.map(t):n.from(e,t)}function Qa(e,t=Array){return e instanceof t?e.slice():t.from(e)}function VA({x:e,x1:t,x2:n}){return e!==void 0||t!==void 0||n!==void 0}function YA({y:e,y1:t,y2:n}){return e!==void 0||t!==void 0||n!==void 0}function If(e){return VA(e)||YA(e)||e.interval!==void 0}function fn(e){return e?.toString===XZ}function Lo(e){return fn(e)&&(e.type!==void 0||e.domain!==void 0)}function qr(e){return fn(e)&&typeof e.transform!="function"}function Co(e){return qr(e)&&e.value===void 0&&e.channel===void 0}function XA(e,t,n,r=G){return t===void 0&&n===void 0?(t=0,n=e===void 0?r:e):t===void 0?t=e===void 0?0:e:n===void 0&&(n=e===void 0?0:e),[t,n]}function Re(e,t){return e===void 0&&t===void 0?[Ws,Ja]:[e,t]}function Un({z:e,fill:t,stroke:n}={}){return e===void 0&&([e]=De(t)),e===void 0&&([e]=De(n)),e}function ir(e){let t=e.length,n=new Uint32Array(t);for(let r=0;r<t;++r)n[r]=r;return n}function Fm(e,t){return Xt(t,n=>e[n],e.constructor)}function Mf(e){return e.length===1?(t,n)=>e(Fm(n,t)):e}function Hs(e,t,n){return e.subarray?e.subarray(t,n):e.slice(t,n)}function Zs(e){return e!==null&&typeof e=="object"?e.valueOf():e}function sw(e,t){if(t[e]!==void 0)return t[e];switch(e){case"x1":case"x2":e="x";break;case"y1":case"y2":e="y";break}return t[e]}function dn(e){let t;return[{transform:()=>t,label:En(e)},n=>t=n]}function Tn(e){return e==null?[e]:dn(e)}function En(e,t){return typeof e=="string"?e:e&&e.label!==void 0?e.label:t}function Af(e,t){return{transform(n){let r=e.transform(n),i=t.transform(n);return Oe(r)||Oe(i)?Xt(r,(o,s)=>new Date((+r[s]+ +i[s])/2)):Xt(r,(o,s)=>(+r[s]+ +i[s])/2,Float64Array)},label:e.label}}function Ml(e,t){let n=GA(t?.interval,t?.type);return n?Xt(e,n):e}function GA(e,t){let n=Tf(e,t);return n&&(r=>Ue(r)?n.floor(r):r)}function Tf(e,t){if(e!=null){if(typeof e=="number"){0<e&&e<1&&Number.isInteger(1/e)&&(e=-1/e);let n=Math.abs(e);return e<0?{floor:r=>Math.floor(r*n)/n,offset:r=>(r*n+1)/n,range:(r,i)=>Pe(Math.ceil(r*n),i*n).map(o=>o/n)}:{floor:r=>Math.floor(r/n)*n,offset:r=>r+n,range:(r,i)=>Pe(Math.ceil(r/n),i/n).map(o=>o*n)}}if(typeof e=="string")return(t==="time"?RA:Cm)(e);if(typeof e.floor!="function")throw new Error("invalid interval; missing floor method");if(typeof e.offset!="function")throw new Error("invalid interval; missing offset method");return e}}function ko(e,t){if(e=Tf(e,t),e&&typeof e.range!="function")throw new Error("invalid interval: missing range method");return e}function LF(e,t){if(e=ko(e,t),e&&typeof e.ceil!="function")throw new Error("invalid interval: missing ceil method");return e}function CF(e){return Ka(e)&&typeof e?.floor=="function"&&e.floor()instanceof Date}function Ka(e){return typeof e?.range=="function"}function pi(e){return e===void 0||qr(e)?e:{value:e}}function kF(e){return e==null?null:{transform:t=>pt(t,e,Float64Array),label:En(e)}}function FF(e){if(!or(e))return!1;for(let t of e)if(t!=null)return typeof t=="object"&&"0"in t&&"1"in t}function or(e){return e&&typeof e[Symbol.iterator]=="function"}function aw(e){for(let t of e)if(t!=null)return typeof t!="object"||t instanceof Date}function Te(e){for(let t of e){if(t==null)continue;let n=typeof t;return n==="string"||n==="boolean"}}function Oe(e){for(let t of e)if(t!=null)return t instanceof Date}function RF(e){for(let t of e)if(t!=null)return typeof t=="string"&&isNaN(t)&&_l(t)}function $F(e){for(let t of e)if(t!=null){if(typeof t!="string")return!1;if(t.trim())return!isNaN(t)}}function Js(e){for(let t of e)if(t!=null)return typeof t=="number"}function cw(e,t){let n;for(let r of e)if(r!=null){if(!t(r))return!1;n=!0}return n}var HZ=new Set("none,currentcolor,transparent,aliceblue,antiquewhite,aqua,aquamarine,azure,beige,bisque,black,blanchedalmond,blue,blueviolet,brown,burlywood,cadetblue,chartreuse,chocolate,coral,cornflowerblue,cornsilk,crimson,cyan,darkblue,darkcyan,darkgoldenrod,darkgray,darkgreen,darkgrey,darkkhaki,darkmagenta,darkolivegreen,darkorange,darkorchid,darkred,darksalmon,darkseagreen,darkslateblue,darkslategray,darkslategrey,darkturquoise,darkviolet,deeppink,deepskyblue,dimgray,dimgrey,dodgerblue,firebrick,floralwhite,forestgreen,fuchsia,gainsboro,ghostwhite,gold,goldenrod,gray,green,greenyellow,grey,honeydew,hotpink,indianred,indigo,ivory,khaki,lavender,lavenderblush,lawngreen,lemonchiffon,lightblue,lightcoral,lightcyan,lightgoldenrodyellow,lightgray,lightgreen,lightgrey,lightpink,lightsalmon,lightseagreen,lightskyblue,lightslategray,lightslategrey,lightsteelblue,lightyellow,lime,limegreen,linen,magenta,maroon,mediumaquamarine,mediumblue,mediumorchid,mediumpurple,mediumseagreen,mediumslateblue,mediumspringgreen,mediumturquoise,mediumvioletred,midnightblue,mintcream,mistyrose,moccasin,navajowhite,navy,oldlace,olive,olivedrab,orange,orangered,orchid,palegoldenrod,palegreen,paleturquoise,palevioletred,papayawhip,peachpuff,peru,pink,plum,powderblue,purple,rebeccapurple,red,rosybrown,royalblue,saddlebrown,salmon,sandybrown,seagreen,seashell,sienna,silver,skyblue,slateblue,slategray,slategrey,snow,springgreen,steelblue,tan,teal,thistle,tomato,turquoise,violet,wheat,white,whitesmoke,yellow".split(","));function tc(e){return typeof e!="string"?!1:(e=e.toLowerCase().trim(),/^#[0-9a-f]{3,8}$/.test(e)||/^(?:url|var|rgb|rgba|hsl|hsla|hwb|lab|lch|oklab|oklch|color|color-mix)\(.*\)$/.test(e)||HZ.has(e))}function PF(e){return typeof e=="number"&&(0<=e&&e<=1||isNaN(e))}function ne(e){return e==null||Qs(e)}function Qs(e){return/^\s*none\s*$/i.test(e)}function UF(e){return/^\s*round\s*$/i.test(e)}function lw(e,t){return jA(e,t,["middle","top-left","top","top-right","right","bottom-right","bottom","bottom-left","left"])}function Fo(e="middle"){return lw(e,"frameAnchor")}function Gs(e){if(e==null)return;let t=e[0],n=e[e.length-1];return Xn(t,n)}function zF(e={},...t){let n=e;for(let r of t)for(let i in r)if(n[i]===void 0){let o=r[i];n===e?n={...n,[i]:o}:n[i]=o}return n}function ZZ(e){console.warn("named iterables are deprecated; please use an object instead");let t=new Set;return Object.fromEntries(Array.from(e,n=>{let{name:r}=n;if(r==null)throw new Error("missing name");let i=`${r}`;if(i==="__proto__")throw new Error(`illegal name: ${i}`);if(t.has(i))throw new Error(`duplicate name: ${i}`);return t.add(i),[r,n]}))}function Rm(e){return or(e)?ZZ(e):e}var mi=Symbol("position"),jr=Symbol("color"),Al=Symbol("radius"),Tl=Symbol("length"),El=Symbol("opacity"),Ef=Symbol("symbol"),qF=Symbol("projection"),fe=new Map([["x",mi],["y",mi],["fx",mi],["fy",mi],["r",Al],["color",jr],["opacity",El],["symbol",Ef],["length",Tl],["projection",qF]]);function jF(e){return e===mi||e===qF}function VF(e){return e===mi||e===Al||e===Tl||e===El}var WA=Math.sqrt(3),HA=2/WA,JZ={draw(e,t){let n=Math.sqrt(t/Math.PI),r=n*HA,i=r/2;e.moveTo(0,r),e.lineTo(n,i),e.lineTo(n,-i),e.lineTo(0,-r),e.lineTo(-n,-i),e.lineTo(-n,i),e.closePath()}},ZA=new Map([["asterisk",gm],["circle",Ys],["cross",xm],["diamond",bm],["diamond2",wm],["hexagon",JZ],["plus",vm],["square",_m],["square2",Sm],["star",Im],["times",pf],["triangle",Mm],["triangle2",Am],["wye",Tm]]);function JA(e){return e&&typeof e.draw=="function"}function YF(e){return JA(e)?!0:typeof e!="string"?!1:ZA.has(e.toLowerCase())}function Nf(e){if(e==null||JA(e))return e;let t=ZA.get(`${e}`.toLowerCase());if(t)return t;throw new Error(`invalid symbol: ${e}`)}function XF(e){if(e==null||JA(e))return[void 0,e];if(typeof e=="string"){let t=ZA.get(`${e}`.toLowerCase());if(t)return[void 0,t]}return[e,void 0]}function hn({filter:e,sort:t,reverse:n,transform:r,initializer:i,...o}={},s){if(r===void 0&&(e!=null&&(r=tT(e)),t!=null&&!Co(t)&&(r=QA(r,nT(t))),n&&(r=QA(r,eT))),s!=null&&i!=null)throw new Error("transforms cannot be applied after initializers");return{...o,...(t===null||Co(t))&&{sort:t},transform:QA(r,s)}}function _e({filter:e,sort:t,reverse:n,initializer:r,...i}={},o){return r===void 0&&(e!=null&&(r=tT(e)),t!=null&&!Co(t)&&(r=KA(r,nT(t))),n&&(r=KA(r,eT))),{...i,...(t===null||Co(t))&&{sort:t},initializer:KA(r,o)}}function QA(e,t){return e==null?t===null?void 0:t:t==null?e===null?void 0:e:function(n,r,i){return{data:n,facets:r}=e.call(this,n,r,i),t.call(this,qe(n),r,i)}}function KA(e,t){return e==null?t===null?void 0:t:t==null?e===null?void 0:e:function(n,r,i,...o){let s,a,c,l,u,f;return{data:a=n,facets:c=r,channels:s}=e.call(this,n,r,i,...o),{data:u=a,facets:f=c,channels:l}=t.call(this,a,c,{...i,...s},...o),{data:u,facets:f,channels:{...s,...l}}}}function uw(e,t){return(e.initializer!=null?_e:hn)(e,t)}function GF(e,t){return uw(t,tT(e))}function tT(e){return(t,n)=>{let r=pt(t,e);return{data:t,facets:n.map(i=>i.filter(o=>r[o]))}}}function WF({sort:e,...t}={}){return{...uw(t,eT),sort:Co(e)?e:null}}function eT(e,t){return{data:e,facets:t.map(n=>n.slice().reverse())}}function HF({seed:e,sort:t,...n}={}){return{...uw(n,ZF(e==null?Math.random:fl(e))),sort:Co(t)?t:null}}function fw(e,{sort:t,...n}={}){return{...(qr(e)&&e.channel!==void 0?_e:uw)(n,nT(e)),sort:Co(t)?t:null}}function nT(e){return(typeof e=="function"&&e.length!==1?QZ:ZF)(e)}function QZ(e){return(t,n)=>{let r=(i,o)=>e(t[i],t[o]);return{data:t,facets:n.map(i=>i.slice().sort(r))}}}function ZF(e){let t,n;({channel:t,value:e,order:n}={...pi(e)});let r=t?.startsWith("-");if(r&&(t=t.slice(1)),n===void 0&&(n=r?vl:ln),typeof n!="function")switch(`${n}`.toLowerCase()){case"ascending":n=ln;break;case"descending":n=vl;break;default:throw new Error(`invalid order: ${n}`)}return(i,o,s)=>{let a;if(t===void 0)a=pt(i,e);else{if(s===void 0)throw new Error("channel sort requires an initializer");if(a=s[t],!a)return{};a=a.value}let c=(l,u)=>n(a[l],a[u]);return{data:i,facets:o.map(l=>l.slice().sort(c))}}}function Pm(e,t){return dw(null,null,e,t)}function nc(e={y:"count"},t={}){let{x:n=G}=t;if(n==null)throw new Error("missing channel: x");return dw(n,null,e,t)}function rc(e={x:"count"},t={}){let{y:n=G}=t;if(n==null)throw new Error("missing channel: y");return dw(null,n,e,t)}function Um(e={fill:"count"},t={}){let{x:n,y:r}=t;if([n,r]=Re(n,r),n==null)throw new Error("missing channel: x");if(r==null)throw new Error("missing channel: y");return dw(n,r,e,t)}function dw(e,t,{data:n=mw,filter:r,sort:i,reverse:o,...s}={},a={}){s=iT(s,a),n=eR(n,G),i=i==null?void 0:KF("sort",i,a),r=r==null?void 0:tR("filter",r,a);let[c,l]=Tn(e),[u,f]=Tn(t),{z:d,fill:h,stroke:p,x1:m,x2:g,y1:y,y2:x,...b}=a,[w,_]=Tn(d),[v]=De(h),[M]=De(p),[E,D]=Tn(v),[I,T]=Tn(M);return{..."z"in a&&{z:w||d},..."fill"in a&&{fill:E||h},..."stroke"in a&&{stroke:I||p},...hn(b,(O,L,S)=>{let A=Ml(pt(O,e),S?.x),N=Ml(pt(O,t),S?.y),k=pt(O,d),R=pt(O,v),F=pt(O,M),$=zm(s,{z:k,fill:R,stroke:F}),P=[],U=[],W=A&&l([]),tt=N&&f([]),nt=k&&_([]),st=R&&D([]),Y=F&&T([]),rt=0;for(let q of s)q.initialize(O);i&&i.initialize(O),r&&r.initialize(O);for(let q of L){let H=[];for(let ot of s)ot.scope("facet",q);i&&i.scope("facet",q),r&&r.scope("facet",q);for(let[ot,z]of ec(q,$))for(let[kt,dt]of ec(z,N))for(let[Wt,Ht]of ec(dt,A)){let et={data:O};if(A&&(et.x=Wt),N&&(et.y=kt),!(r&&!r.reduce(Ht,et))){H.push(rt++),U.push(n.reduceIndex(Ht,O,et)),A&&W.push(Wt),N&&tt.push(kt),k&&nt.push($===k?ot:k[Ht[0]]),R&&st.push($===R?ot:R[Ht[0]]),F&&Y.push($===F?ot:F[Ht[0]]);for(let oe of s)oe.reduce(Ht,et);i&&i.reduce(Ht,et)}}P.push(H)}return oT(P,i,o),{data:U,facets:P}}),...!Ro(s,"x")&&(c?{x:c}:{x1:m,x2:g}),...!Ro(s,"y")&&(u?{y:u}:{y1:y,y2:x}),...Object.fromEntries(s.map(({name:O,output:L})=>[O,L]))}}function Ro(e,...t){for(let{name:n}of e)if(t.includes(n))return!0;return!1}function rT(e,t,n=hw){let r=Object.entries(e);return t.title!=null&&e.title===void 0&&r.push(["title",iJ]),t.href!=null&&e.href===void 0&&r.push(["href",yw]),r.filter(([,i])=>i!==void 0).map(([i,o])=>o===null?KZ(i):n(i,o,t))}function hw(e,t,n,r=pw){let i;fn(t)&&"reduce"in t&&(i=t.scale,t=t.reduce);let o=r(e,t,n),[s,a]=dn(o.label),c;return{name:e,output:i===void 0?s:{value:s,scale:i},initialize(l){o.initialize(l),c=a([])},scope(l,u){o.scope(l,u)},reduce(l,u){c.push(o.reduce(l,u))}}}function KZ(e){return{name:e,initialize(){},scope(){},reduce(){}}}function pw(e,t,n,r=Df){let i=sw(e,n),o=r(t,i),s,a;return{label:En(o===$m?null:i,o.label),initialize(c){s=i===void 0?c:pt(c,i),o.scope==="data"&&(a=o.reduceIndex(ir(c),s))},scope(c,l){o.scope===c&&(a=o.reduceIndex(l,s))},reduce(c,l){return o.scope==null?o.reduceIndex(c,s,l):o.reduceIndex(c,s,a,l)}}}function ec(e,t){return t?ho(on(e,n=>t[n]),Ws):[[,e]]}function Df(e,t,n=tJ){if(e==null)return n(e);if(typeof e.reduceIndex=="function")return e;if(typeof e.reduce=="function"&&fn(e))return nJ(e);if(typeof e=="function")return rJ(e);if(/^p\d{2}$/i.test(e))return Ks(Sf(e));switch(`${e}`.toLowerCase()){case"first":return yw;case"last":return oJ;case"identity":return mw;case"count":return $m;case"distinct":return sJ;case"sum":return t==null?$m:aJ;case"proportion":return QF(t,"data");case"proportion-facet":return QF(t,"facet");case"deviation":return Ks(ri);case"min":return Ks(ce);case"min-index":return Ks(Z0);case"max":return Ks(Gt);case"max-index":return Ks(H0);case"mean":return JF(Ts);case"median":return JF(Pi);case"variance":return Ks(Da);case"mode":return Ks(Ou)}return n(e)}function tJ(e){throw new Error(`invalid reduce: ${e}`)}function iT(e,t){return rT(e,t,KF)}function KF(e,t,n){return hw(e,t,n,tR)}function tR(e,t,n){return pw(e,t,n,eR)}function eR(e,t){return Df(e,t,eJ)}function eJ(e){switch(`${e}`.toLowerCase()){case"x":return cJ;case"y":return lJ}throw new Error(`invalid group reduce: ${e}`)}function zm(e,t){for(let n in t){let r=t[n];if(r!==void 0&&!e.some(i=>i.name===n))return r}}function oT(e,t,n){if(t){let r=t.output.transform(),i=(o,s)=>ln(r[o],r[s]);e.forEach(o=>o.sort(i))}n&&e.forEach(r=>r.reverse())}function nJ(e){return console.warn("deprecated reduce interface; implement reduceIndex instead."),{...e,reduceIndex:e.reduce.bind(e)}}function rJ(e){return{reduceIndex(t,n,r){return e(Fm(n,t),r)}}}function Ks(e){return{reduceIndex(t,n){return e(t,r=>n[r])}}}function JF(e){return{reduceIndex(t,n){let r=e(t,i=>n[i]);return Oe(n)?new Date(r):r}}}var mw={reduceIndex(e,t){return Fm(t,e)}},yw={reduceIndex(e,t){return t[e[0]]}},iJ={reduceIndex(e,t){let r=ho($i(e,o=>o.length,o=>t[o]),Ja),i=r.slice(-5).reverse();if(i.length<r.length){let o=r.slice(0,-4);i[4]=[`\u2026 ${o.length.toLocaleString("en-US")} more`,Sn(o,Ja)]}return i.map(([o,s])=>`${o} (${s.toLocaleString("en-US")})`).join(`
16
+ `)}},oJ={reduceIndex(e,t){return t[e[e.length-1]]}},$m={label:"Frequency",reduceIndex(e){return e.length}},sJ={label:"Distinct",reduceIndex(e,t){let n=new Wn;for(let r of e)n.add(t[r]);return n.size}},aJ=Ks(Sn);function QF(e,t){return e==null?{scope:t,label:"Frequency",reduceIndex:(n,r,i=1)=>n.length/i}:{scope:t,reduceIndex:(n,r,i=1)=>Sn(n,o=>r[o])/i}}var cJ={reduceIndex(e,t,{x:n}){return n}},lJ={reduceIndex(e,t,{y:n}){return n}};function nR(e){if(typeof e!="function")throw new Error(`invalid test function: ${e}`);return{reduceIndex(t,n,{data:r}){return n[t.find(i=>e(r[i],i,r))]}}}function Of(e,{scale:t,type:n,value:r,filter:i,hint:o,label:s=En(r)},a){return o===void 0&&typeof r?.transform=="function"&&(o=r.hint),aT(a,{scale:t,type:n,value:pt(e,r),label:s,filter:i,hint:o})}function gw(e,t){return Object.fromEntries(Object.entries(e).map(([n,r])=>[n,Of(t,r,n)]))}function Bf(e,t){let n=Object.fromEntries(Object.entries(e).map(([r,{scale:i,value:o}])=>{let s=i==null?null:t[i];return[r,s==null?o:Xt(o,s)]}));return n.channels=e,n}function aT(e,t){let{scale:n,value:r}=t;if(n===!0||n==="auto")switch(e){case"fill":case"stroke":case"color":t.scale=n!==!0&&cw(r,tc)?null:"color";break;case"fillOpacity":case"strokeOpacity":case"opacity":t.scale=n!==!0&&cw(r,PF)?null:"opacity";break;case"symbol":n!==!0&&cw(r,YF)?(t.scale=null,t.value=Xt(r,Nf)):t.scale="symbol";break;default:t.scale=fe.has(e)?e:null;break}else if(n===!1)t.scale=null;else if(n!=null&&!fe.has(n))throw new Error(`unknown scale: ${n}`);return t}function iR(e,t,n,r,i){let{order:o,reverse:s,reduce:a=!0,limit:c}=i;for(let l in i){if(!fe.has(l))continue;let{value:u,order:f=o,reverse:d=s,reduce:h=a,limit:p=c}=pi(i[l]),m=u?.startsWith("-");if(m&&(u=u.slice(1)),f=f===void 0?m!==(u==="width"||u==="height")?sR:oR:dJ(f),h==null||h===!1)continue;let g=l==="fx"||l==="fy"?fJ(t,r[l]):uJ(n,l);if(!g)throw new Error(`missing channel for scale: ${l}`);let y=g.value,[x=0,b=1/0]=or(p)?p:p<0?[p]:[0,p];if(u==null)g.domain=()=>{let w=Array.from(new Wn(y));return d&&(w=w.reverse()),(x!==0||b!==1/0)&&(w=w.slice(x,b)),w};else{let w=u==="data"?e:u==="height"?rR(n,"y1","y2"):u==="width"?rR(n,"x1","x2"):sT(n,u,u==="y"?"y2":u==="x"?"x2":void 0),_=Df(h===!0?"max":h,w);g.domain=()=>{let v=FS(ir(y),M=>_.reduceIndex(M,w),M=>y[M]);return f&&v.sort(f),d&&v.reverse(),(x!==0||b!==1/0)&&(v=v.slice(x,b)),v.map(Ws)}}}}function uJ(e,t){for(let n in e){let r=e[n];if(r.scale===t)return r}}function fJ(e,t){let n=e.original;if(n===e)return t;let r=t.value,i=t.value=[];for(let o=0;o<n.length;++o){let s=r[n[o][0]];for(let a of e[o])i[a]=s}return t}function rR(e,t,n){let r=sT(e,t),i=sT(e,n);return Xt(i,(o,s)=>Math.abs(o-r[s]),Float64Array)}function sT(e,t,n){let r=e[t];if(!r&&n!==void 0&&(r=e[n]),r)return r.value;throw new Error(`missing channel: ${t}`)}function dJ(e){if(e==null||typeof e=="function")return e;switch(`${e}`.toLowerCase()){case"ascending":return oR;case"descending":return sR}throw new Error(`invalid order: ${e}`)}function oR([e,t],[n,r]){return ln(t,r)||ln(e,n)}function sR([e,t],[n,r]){return vl(t,r)||ln(e,n)}function qm(e,t){let n=e[t];if(n){for(;n.source;)n=n.source;return n.source===null?null:n}}function xw(e){let t,n;return(...r)=>((n?.length!==r.length||n.some((i,o)=>i!==r[o]))&&(n=r,t=e(...r)),t)}var hJ=xw(e=>new Intl.NumberFormat(e)),pJ=xw((e,t)=>new Intl.DateTimeFormat(e,{timeZone:"UTC",...t&&{month:t}})),mJ=xw((e,t)=>new Intl.DateTimeFormat(e,{timeZone:"UTC",...t&&{weekday:t}}));function yJ(e="en-US"){let t=hJ(e);return n=>n!=null&&!isNaN(n)?t.format(n):void 0}function aR(e="en-US",t="short"){let n=pJ(e,t);return r=>r!=null&&!isNaN(r=+new Date(Date.UTC(2e3,+r)))?n.format(r):void 0}function cR(e="en-US",t="short"){let n=mJ(e,t);return r=>r!=null&&!isNaN(r=+new Date(Date.UTC(2001,0,+r)))?n.format(r):void 0}function cT(e){return bf(e,"Invalid Date")}function gJ(e="en-US"){let t=yJ(e);return n=>(n instanceof Date?cT:typeof n=="number"?t:ze)(n)}var ji=gJ();var lT=0,uT;function lR(){let e=lT;return lT=0,uT=void 0,e}function zn(e){e!==uT&&(uT=e,console.warn(e),++lT)}var Be=(typeof window<"u"?window.devicePixelRatio>1:typeof it>"u")?0:.5,xJ=0;function bw(){return`plot-clip-${++xJ}`}function ww(e,{title:t,href:n,ariaLabel:r,ariaDescription:i,ariaHidden:o,target:s,fill:a,fillOpacity:c,stroke:l,strokeWidth:u,strokeOpacity:f,strokeLinejoin:d,strokeLinecap:h,strokeMiterlimit:p,strokeDasharray:m,strokeDashoffset:g,opacity:y,mixBlendMode:x,imageFilter:b,paintOrder:w,pointerEvents:_,shapeRendering:v,channels:M},{ariaLabel:E,fill:D="currentColor",fillOpacity:I,stroke:T="none",strokeOpacity:O,strokeWidth:L,strokeLinecap:S,strokeLinejoin:A,strokeMiterlimit:N,paintOrder:k}){D===null&&(a=null,c=null),T===null&&(l=null,f=null),ne(D)?!ne(T)&&(!ne(a)||M?.fill)&&(T="none"):ne(T)&&(!ne(l)||M?.stroke)&&(D="none");let[R,F]=De(a,D),[$,P]=ie(c,I),[U,W]=De(l,T),[tt,nt]=ie(f,O),[st,Y]=ie(y);Qs(W)||(u===void 0&&(u=L),h===void 0&&(h=S),d===void 0&&(d=A),p===void 0&&!UF(d)&&(p=N),!Qs(F)&&w===void 0&&(w=k));let[rt,q]=ie(u);return D!==null&&(e.fill=le(F,"currentColor"),e.fillOpacity=jm(P,1)),T!==null&&(e.stroke=le(W,"none"),e.strokeWidth=jm(q,1),e.strokeOpacity=jm(nt,1),e.strokeLinejoin=le(d,"miter"),e.strokeLinecap=le(h,"butt"),e.strokeMiterlimit=jm(p,4),e.strokeDasharray=le(m,"none"),e.strokeDashoffset=le(g,"0")),e.target=ze(s),e.ariaLabel=ze(E),e.ariaDescription=ze(i),e.ariaHidden=ze(o),e.opacity=jm(Y,1),e.mixBlendMode=le(x,"normal"),e.imageFilter=le(b,"none"),e.paintOrder=le(w,"normal"),e.pointerEvents=le(_,"auto"),e.shapeRendering=le(v,"auto"),{title:{value:t,optional:!0,filter:null},href:{value:n,optional:!0,filter:null},ariaLabel:{value:r,optional:!0,filter:null},fill:{value:R,scale:"auto",optional:!0},fillOpacity:{value:$,scale:"auto",optional:!0},stroke:{value:U,scale:"auto",optional:!0},strokeOpacity:{value:tt,scale:"auto",optional:!0},strokeWidth:{value:rt,optional:!0},opacity:{value:st,scale:"auto",optional:!0}}}function bJ(e,t){t&&e.filter(n=>Bm(t[n])).append("title").call(vJ,t)}function wJ(e,t){t&&e.filter(([n])=>Bm(t[n])).append("title").call(_J,t)}function vJ(e,t){t&&e.text(n=>ji(t[n]))}function _J(e,t){t&&e.text(([n])=>ji(t[n]))}function Jt(e,{target:t,tip:n},{ariaLabel:r,title:i,fill:o,fillOpacity:s,stroke:a,strokeOpacity:c,strokeWidth:l,opacity:u,href:f}){r&&ft(e,"aria-label",d=>r[d]),o&&ft(e,"fill",d=>o[d]),s&&ft(e,"fill-opacity",d=>s[d]),a&&ft(e,"stroke",d=>a[d]),c&&ft(e,"stroke-opacity",d=>c[d]),l&&ft(e,"stroke-width",d=>l[d]),u&&ft(e,"opacity",d=>u[d]),f&&uR(e,d=>f[d],t),n||bJ(e,i)}function Nl(e,{target:t,tip:n},{ariaLabel:r,title:i,fill:o,fillOpacity:s,stroke:a,strokeOpacity:c,strokeWidth:l,opacity:u,href:f}){r&&ft(e,"aria-label",([d])=>r[d]),o&&ft(e,"fill",([d])=>o[d]),s&&ft(e,"fill-opacity",([d])=>s[d]),a&&ft(e,"stroke",([d])=>a[d]),c&&ft(e,"stroke-opacity",([d])=>c[d]),l&&ft(e,"stroke-width",([d])=>l[d]),u&&ft(e,"opacity",([d])=>u[d]),f&&uR(e,([d])=>f[d],t),n||wJ(e,i)}function SJ({ariaLabel:e,title:t,fill:n,fillOpacity:r,stroke:i,strokeOpacity:o,strokeWidth:s,opacity:a,href:c},{tip:l}){return[e,l?void 0:t,n,r,i,o,s,a,c].filter(u=>u!==void 0)}function Vm(e,t,n){let r=on(e,i=>t[i]);return n===void 0&&r.size>1+e.length>>1&&zn("Warning: the implicit z channel has high cardinality. This may occur when the fill or stroke channel is associated with quantitative data rather than ordinal or categorical data. You can suppress this warning by setting the z option explicitly; if this data represents a single series, set z to null."),r.values()}function*vw(e,t,n,r){let{z:i}=n,{z:o}=r,s=SJ(r,n),a=[...t,...s];for(let c of o?Vm(e,o,i):[e]){let l,u;t:for(let f of c){for(let d of a)if(!Ue(d[f])){u&&u.push(-1);continue t}if(l===void 0){u&&(yield u),l=s.map(d=>Zs(d[f])),u=[f];continue}u.push(f);for(let d=0;d<s.length;++d)if(Zs(s[d][f])!==l[d]){yield u,l=s.map(p=>Zs(p[f])),u=[f];continue t}}u&&(yield u)}}function _w(e){return e===!0?e="frame":e===!1?e=null:e!=null&&(e=Qe(e,"clip",["frame","sphere"])),e}function IJ(e,t,n,r){let i,{clip:o=r.clip}=t;switch(o){case"frame":{let{width:s,height:a,marginLeft:c,marginRight:l,marginTop:u,marginBottom:f}=n,d=bw();i=`url(#${d})`,e=ct("svg:g",r).call(h=>h.append("svg:clipPath").attr("id",d).append("rect").attr("x",c).attr("y",u).attr("width",s-l-c).attr("height",a-u-f)).each(function(){this.appendChild(e.node()),e.node=()=>this});break}case"sphere":{let{projection:s}=r;if(!s)throw new Error('the "sphere" clip option requires a projection');let a=bw();i=`url(#${a})`,e.append("clipPath").attr("id",a).append("path").attr("d",Mn(s)({type:"Sphere"}));break}}ft(e,"aria-label",t.ariaLabel),ft(e,"aria-description",t.ariaDescription),ft(e,"aria-hidden",t.ariaHidden),ft(e,"clip-path",i)}function Ct(e,t,n,r){IJ(e,t,n,r),ft(e,"fill",t.fill),ft(e,"fill-opacity",t.fillOpacity),ft(e,"stroke",t.stroke),ft(e,"stroke-width",t.strokeWidth),ft(e,"stroke-opacity",t.strokeOpacity),ft(e,"stroke-linejoin",t.strokeLinejoin),ft(e,"stroke-linecap",t.strokeLinecap),ft(e,"stroke-miterlimit",t.strokeMiterlimit),ft(e,"stroke-dasharray",t.strokeDasharray),ft(e,"stroke-dashoffset",t.strokeDashoffset),ft(e,"shape-rendering",t.shapeRendering),ft(e,"filter",t.imageFilter),ft(e,"paint-order",t.paintOrder);let{pointerEvents:i=r.pointerSticky===!1?"none":void 0}=t;ft(e,"pointer-events",i)}function Dt(e,t){MJ(e,"mix-blend-mode",t.mixBlendMode),ft(e,"opacity",t.opacity)}function uR(e,t,n){e.each(function(r){let i=t(r);if(i!=null){let o=this.ownerDocument.createElementNS(ii.svg,"a");o.setAttribute("fill","inherit"),o.setAttributeNS(ii.xlink,"href",i),n!=null&&o.setAttribute("target",n),this.parentNode.insertBefore(o,this).appendChild(this)}})}function ft(e,t,n){n!=null&&e.attr(t,n)}function MJ(e,t,n){n!=null&&e.style(t,n)}function It(e,t,{x:n,y:r},i=Be,o=Be){i+=t.dx,o+=t.dy,n?.bandwidth&&(i+=n.bandwidth()/2),r?.bandwidth&&(o+=r.bandwidth()/2),(i||o)&&e.attr("transform",`translate(${i},${o})`)}function le(e,t){if((e=ze(e))!==t)return e}function jm(e,t){if((e=Nt(e))!==t)return e}var AJ=/^-?([_a-z]|[\240-\377]|\\[0-9a-f]{1,6}(\r\n|[ \t\r\n\f])?|\\[^\r\n\f0-9a-f])([_a-z0-9-]|[\240-\377]|\\[0-9a-f]{1,6}(\r\n|[ \t\r\n\f])?|\\[^\r\n\f0-9a-f])*$/i;function Lf(e){if(e===void 0)return"plot-d6a7b5";if(e=`${e}`,!AJ.test(e))throw new Error(`invalid class name: ${e}`);return e}function Cf(e,t){if(typeof t=="string")e.property("style",t);else if(t!=null)for(let n of e)Object.assign(n.style,t)}function pn({frameAnchor:e},{width:t,height:n,marginTop:r,marginRight:i,marginBottom:o,marginLeft:s}){return[/left$/.test(e)?s:/right$/.test(e)?t-i:(s+t-i)/2,/^top/.test(e)?r:/^bottom/.test(e)?n-o:(r+n-o)/2]}function ic(e={}){let{document:t=typeof window<"u"?window.document:void 0,clip:n}=e;return{document:t,clip:_w(n)}}function ct(e,{document:t}){return jt(Ns(e).call(t.documentElement))}var dR=Math.PI,ta=2*dR,fR=.618;function hR({projection:e,inset:t=0,insetTop:n=t,insetRight:r=t,insetBottom:i=t,insetLeft:o=t}={},s){if(e==null)return;if(typeof e.stream=="function")return e;let a,c,l="frame";if(fn(e)){let _;if({type:e,domain:c,inset:_,insetTop:n=_!==void 0?_:n,insetRight:r=_!==void 0?_:r,insetBottom:i=_!==void 0?_:i,insetLeft:o=_!==void 0?_:o,clip:l=l,...a}=e,e==null)return}typeof e!="function"&&({type:e}=pR(e));let{width:u,height:f,marginLeft:d,marginRight:h,marginTop:p,marginBottom:m}=s,g=u-d-h-o-r,y=f-p-m-n-i;if(e=e?.({width:g,height:y,clip:l,...a}),e==null)return;l=TJ(l,d,p,u-h,f-m);let x=d+o,b=p+n,w;if(c!=null){let[[_,v],[M,E]]=Mn(e).bounds(c),D=Math.min(g/(M-_),y/(E-v));D>0?(x-=(D*(_+M)-g)/2,b-=(D*(v+E)-y)/2,w=Object.assign(ll({point(I,T){this.stream.point(I*D+x,T*D+b)}}),{invert:([I,T])=>[(I-x)/D,(T-b)/D]})):zn("Warning: the projection could not be fit to the specified domain; using the default scale.")}return w??=x===0&&b===0?mR():Object.assign(ll({point(_,v){this.stream.point(_+x,v+b)}}),{invert:([_,v])=>[_-x,v-b]}),{stream:_=>e.stream(w.stream(l(_))),invert:_=>e.invert(w.invert(_))}}function pR(e){switch(`${e}`.toLowerCase()){case"albers-usa":return Vi(cM,.7463,.4673);case"albers":return Sw(Vp,.7463,.4673);case"azimuthal-equal-area":return Vi(uM,4,4);case"azimuthal-equidistant":return Vi(dM,ta,ta);case"conic-conformal":return Sw(mM,ta,ta);case"conic-equal-area":return Sw(za,6.1702,2.9781);case"conic-equidistant":return Sw(gM,7.312,3.6282);case"equal-earth":return Vi(bM,5.4133,2.6347);case"equirectangular":return Vi(yM,ta,dR);case"gnomonic":return Vi(vM,3.4641,3.4641);case"identity":return{type:mR};case"reflect-y":return{type:EJ};case"mercator":return Vi(hM,ta,ta);case"orthographic":return Vi(SM,2,2);case"stereographic":return Vi(MM,2,2);case"transverse-mercator":return Vi(TM,ta,ta);default:throw new Error(`unknown projection type: ${e}`)}}function TJ(e,t,n,r,i){if(e===!1||e==null||typeof e=="number")return o=>o;switch(e===!0&&(e="frame"),`${e}`.toLowerCase()){case"frame":return Zu(t,n,r,i);default:throw new Error(`unknown projection clip type: ${e}`)}}function Vi(e,t,n){return{type:({width:r,height:i,rotate:o,precision:s=.15,clip:a})=>{let c=e();return s!=null&&c.precision?.(s),o!=null&&c.rotate?.(o),typeof a=="number"&&c.clipAngle?.(a),c.scale(Math.min(r/t,i/n)),c.translate([r/2,i/2]),c},aspectRatio:n/t}}function Sw(e,t,n){let{type:r,aspectRatio:i}=Vi(e,t,n);return{type:o=>{let{parallels:s,domain:a,width:c,height:l}=o,u=r(o);return s!=null&&(u.parallels(s),a===void 0&&u.fitSize([c,l],{type:"Sphere"})),u},aspectRatio:i}}var mR=un({stream:e=>e,invert:e=>e}),EJ=un(Object.assign(ll({point(e,t){this.stream.point(e,-t)}}),{invert:([e,t])=>[e,-t]}));function fT(e,t,n,r){let i=n[e],o=n[t],s=i.length,a=n[e]=new Float64Array(s).fill(NaN),c=n[t]=new Float64Array(s).fill(NaN),l,u=r.stream({point(f,d){a[l]=f,c[l]=d}});for(l=0;l<s;++l)u.point(i[l],o[l])}function yR({projection:e}={}){return e==null?!1:typeof e.stream=="function"?!0:(fn(e)&&(e=e.type),e!=null)}function gR(e){if(typeof e?.stream=="function")return fR;if(fn(e)&&(e=e.type),e!=null){if(typeof e!="function"){let{aspectRatio:t}=pR(e);if(t)return t}return fR}}function oc(e,t,{projection:n}){let{x:r,y:i}=e,o={};return r&&(o.x=r),i&&(o.y=i),o=Bf(o,t),n&&r?.scale==="x"&&i?.scale==="y"&&fT("x","y",o,n),r&&(o.x=Je(o.x)),i&&(o.y=Je(o.y)),o}function xR(e){let t=[],n=[],r={scale:"x",value:t},i={scale:"y",value:n},o={point(s,a){t.push(s),n.push(a)},lineStart(){},lineEnd(){},polygonStart(){},polygonEnd(){},sphere(){}};for(let s of e.value)$r(s,o);return[r,i]}var NJ=["#4269d0","#efb118","#ff725c","#6cc5b0","#3ca951","#ff8ab7","#a463f2","#97bbf5","#9c6b4e","#9498a0"],SR=new Map([["accent",JM],["category10",ZM],["dark2",QM],["observable10",NJ],["paired",KM],["pastel1",tA],["pastel2",eA],["set1",nA],["set2",rA],["set3",iA],["tableau10",oA]]);function IR(e){return e!=null&&SR.has(`${e}`.toLowerCase())}var bR=new Map([...SR,["brbg",ea(kb,Fb)],["prgn",ea(Rb,$b)],["piyg",ea(Pb,Ub)],["puor",ea(zb,qb)],["rdbu",ea(hm,lf)],["rdgy",ea(jb,Vb)],["rdylbu",ea(pm,uf)],["rdylgn",ea(Yb,Xb)],["spectral",ea(Gb,Wb)],["burd",wR(hm,lf)],["buylrd",wR(pm,uf)],["blues",mn(b1,w1)],["greens",mn(v1,_1)],["greys",mn(S1,I1)],["oranges",mn(N1,D1)],["purples",mn(M1,A1)],["reds",mn(T1,E1)],["turbo",na(P1)],["viridis",na(z1)],["magma",na(q1)],["inferno",na(j1)],["plasma",na(V1)],["cividis",na(O1)],["cubehelix",na(B1)],["warm",na(C1)],["cool",na(k1)],["bugn",mn(Hb,Zb)],["bupu",mn(Jb,Qb)],["gnbu",mn(Kb,t1)],["orrd",mn(e1,n1)],["pubu",mn(o1,s1)],["pubugn",mn(r1,i1)],["purd",mn(a1,c1)],["rdpu",mn(l1,u1)],["ylgn",mn(h1,p1)],["ylgnbu",mn(f1,d1)],["ylorbr",mn(m1,y1)],["ylorrd",mn(g1,x1)],["rainbow",vR(F1)],["sinebow",vR($1)]]);function mn(e,t){return({length:n})=>n===1?[e[3][1]]:n===2?[e[3][1],e[3][2]]:(n=Math.max(3,Math.floor(n)),n>9?Cn(t,n):e[n])}function ea(e,t){return({length:n})=>n===2?[e[3][0],e[3][2]]:(n=Math.max(3,Math.floor(n)),n>11?Cn(t,n):e[n])}function wR(e,t){return({length:n})=>n===2?[e[3][2],e[3][0]]:(n=Math.max(3,Math.floor(n)),n>11?Cn(r=>t(1-r),n):e[n].slice().reverse())}function na(e){return({length:t})=>Cn(e,Math.max(2,Math.floor(t)))}function vR(e){return({length:t})=>Cn(e,Math.floor(t)+1).slice(0,-1)}function dT(e){let t=`${e}`.toLowerCase();if(!bR.has(t))throw new Error(`unknown ordinal scheme: ${t}`);return bR.get(t)}function Ym(e,t){let n=dT(e),r=typeof n=="function"?n({length:t}):n;return r.length!==t?r.slice(0,t):r}function MR(e,t="greys"){let n=new Set,[r,i]=Ym(t,2);for(let o of e)if(o!=null)if(o===!0)n.add(i);else if(o===!1)n.add(r);else return;return[...n]}var _R=new Map([["brbg",Fb],["prgn",$b],["piyg",Ub],["puor",qb],["rdbu",lf],["rdgy",Vb],["rdylbu",uf],["rdylgn",Xb],["spectral",Wb],["burd",e=>lf(1-e)],["buylrd",e=>uf(1-e)],["blues",w1],["greens",_1],["greys",I1],["purples",A1],["reds",E1],["oranges",D1],["turbo",P1],["viridis",z1],["magma",q1],["inferno",j1],["plasma",V1],["cividis",O1],["cubehelix",B1],["warm",C1],["cool",k1],["bugn",Zb],["bupu",Qb],["gnbu",t1],["orrd",n1],["pubugn",i1],["pubu",s1],["purd",c1],["rdpu",u1],["ylgnbu",d1],["ylgn",p1],["ylorbr",y1],["ylorrd",x1],["rainbow",F1],["sinebow",$1]]);function kf(e){let t=`${e}`.toLowerCase();if(!_R.has(t))throw new Error(`unknown quantitative scheme: ${t}`);return _R.get(t)}var DJ=new Set(["brbg","prgn","piyg","puor","rdbu","rdgy","rdylbu","rdylgn","spectral","burd","buylrd"]);function AR(e){return e!=null&&DJ.has(`${e}`.toLowerCase())}var pT=e=>t=>e(1-t),hT=[0,1],TR=new Map([["number",we],["rgb",oi],["hsl",cI],["hcl",lI],["lab",xx]]);function mT(e){let t=`${e}`.toLowerCase();if(!TR.has(t))throw new Error(`unknown interpolator: ${t}`);return TR.get(t)}function Rf(e,t,n,{type:r,nice:i,clamp:o,zero:s,domain:a=kR(e,n),unknown:c,round:l,scheme:u,interval:f,range:d=fe.get(e)===Al?CJ(n,a):fe.get(e)===Tl?kJ(n,a):fe.get(e)===El?hT:void 0,interpolate:h=fe.get(e)===jr?u==null&&d!==void 0?oi:kf(u!==void 0?u:r==="cyclical"?"rainbow":"turbo"):l?tl:we,reverse:p}){if(f=ko(f,r),(r==="cyclical"||r==="sequential")&&(r="linear"),typeof h!="function"&&(h=mT(h)),p=!!p,d!==void 0){let m=(a=qe(a)).length,g=(d=qe(d)).length;if(m!==g){if(h.length===1)throw new Error("invalid piecewise interpolator");h=go(h,d),d=void 0}}if(h.length===1?(p&&(h=pT(h),p=!1),d===void 0&&(d=Float64Array.from(a,(m,g)=>g/(a.length-1)),d.length===2&&(d=hT)),t.interpolate((d===hT?un:Xm)(h))):t.interpolate(h),s){let[m,g]=ae(a);(m>0||g<0)&&(a=Qa(a),Gs(a)!==Math.sign(m)?a[a.length-1]=0:a[0]=0)}return p&&(a=Ba(a)),t.domain(a).unknown(c),i&&(t.nice(OJ(i,r)),a=t.domain()),d!==void 0&&t.range(d),o&&t.clamp(o),{type:r,domain:a,range:d,scale:t,interpolate:h,interval:f}}function OJ(e,t){return e===!0?void 0:typeof e=="number"?e:LF(e,t)}function ER(e,t,n){return Rf(e,Rs(),t,n)}function NR(e,t,n){return yT(e,t,{...n,exponent:.5})}function yT(e,t,{exponent:n=1,...r}){return Rf(e,nm().exponent(n),t,{...r,type:"pow"})}function DR(e,t,{base:n=10,domain:r=FJ(t),...i}){return Rf(e,tm().base(n),t,{...i,domain:r})}function OR(e,t,{constant:n=1,...r}){return Rf(e,em().constant(n),t,r)}function BR(e,t,{range:n,quantiles:r=n===void 0?5:(n=[...n]).length,n:i=r,scheme:o="rdylbu",domain:s=RJ(t),unknown:a,interpolate:c,reverse:l}){return n===void 0&&(n=c!==void 0?Cn(c,i):fe.get(e)===jr?Ym(o,i):void 0),s.length>0&&(s=rm(s,n===void 0?{length:i}:n).quantiles()),Iw(e,t,{domain:s,range:n,reverse:l,unknown:a})}function LR(e,t,{range:n,n:r=n===void 0?5:(n=[...n]).length,scheme:i="rdylbu",domain:o=kR(e,t),unknown:s,interpolate:a,reverse:c}){let[l,u]=ae(o),f;return n===void 0?(f=_n(l,u,r),f[0]<=l&&f.splice(0,1),f[f.length-1]>=u&&f.pop(),r=f.length+1,n=a!==void 0?Cn(a,r):fe.get(e)===jr?Ym(i,r):void 0):(f=Cn(we(l,u),r+1).slice(1,-1),l instanceof Date&&(f=f.map(d=>new Date(d)))),Gs(qe(o))<0&&f.reverse(),Iw(e,t,{domain:f,range:n,reverse:c,unknown:s})}function Iw(e,t,{domain:n=[0],unknown:r,scheme:i="rdylbu",interpolate:o,range:s=o!==void 0?Cn(o,n.length+1):fe.get(e)===jr?Ym(i,n.length+1):void 0,reverse:a}){n=qe(n);let c=Gs(n);if(!isNaN(c)&&!BJ(n,c))throw new Error(`the ${e} scale has a non-monotonic domain`);return a&&(s=Ba(s)),{type:"threshold",scale:im(c<0?Ba(n):n,s===void 0?[]:s).unknown(r),domain:n,range:s}}function BJ(e,t){for(let n=1,r=e.length,i=e[0];n<r;++n){let o=Xn(i,i=e[n]);if(o!==0&&o!==t)return!1}return!0}function CR(e){return{type:"identity",scale:VF(fe.get(e))?Qp():t=>t}}function Ff(e,t=xf){return e.length?[ce(e,({value:n})=>n===void 0?n:ce(n,t)),Gt(e,({value:n})=>n===void 0?n:Gt(n,t))]:[0,1]}function kR(e,t){let n=fe.get(e);return(n===Al||n===El||n===Tl?LJ:Ff)(t)}function LJ(e){return[0,e.length?Gt(e,({value:t})=>t===void 0?t:Gt(t,xf)):1]}function CJ(e,t){let n=e.find(({radius:s})=>s!==void 0);if(n!==void 0)return[0,n.radius];let r=Hn(e,.5,({value:s})=>s===void 0?NaN:Hn(s,.25,rr)),i=t.map(s=>3*Math.sqrt(s/r)),o=30/Gt(i);return o<1?i.map(s=>s*o):i}function kJ(e,t){let n=Pi(e,({value:o})=>o===void 0?NaN:Pi(o,Math.abs)),r=t.map(o=>12*o/n),i=60/Gt(r);return i<1?r.map(o=>o*i):r}function FJ(e){for(let{value:t}of e)if(t!==void 0)for(let n of t){if(n>0)return Ff(e,rr);if(n<0)return Ff(e,Xa)}return[1,10]}function RJ(e){let t=[];for(let{value:n}of e)if(n!==void 0)for(let r of n)t.push(r);return t}function Xm(e){return(t,n)=>r=>e(t+r*(n-t))}function Mw(e,t,n,r,{type:i,nice:o,clamp:s,domain:a=Ff(r),unknown:c,pivot:l=0,scheme:u,range:f,symmetric:d=!0,interpolate:h=fe.get(e)===jr?u==null&&f!==void 0?oi:kf(u!==void 0?u:"rdbu"):we,reverse:p}){l=+l,a=qe(a);let[m,g]=a;if(a.length>2&&zn(`Warning: the diverging ${e} scale domain contains extra elements.`),Xn(m,g)<0&&([m,g]=[g,m],p=!p),m=Math.min(m,l),g=Math.max(g,l),typeof h!="function"&&(h=mT(h)),f!==void 0&&(h=h.length===1?Xm(h)(...f):go(h,f)),p&&(h=pT(h)),d){let y=n.apply(l),x=y-n.apply(m),b=n.apply(g)-y;x<b?m=n.invert(y-b):x>b&&(g=n.invert(y+x))}return t.domain([m,l,g]).unknown(c).interpolator(h),s&&t.clamp(s),o&&t.nice(o),{type:i,domain:[m,g],pivot:l,interpolate:h,scale:t}}function FR(e,t,n){return Mw(e,dm(),$J,t,n)}function RR(e,t,n){return gT(e,t,{...n,exponent:.5})}function gT(e,t,{exponent:n=1,...r}){return Mw(e,Cb().exponent(n=+n),zJ(n),t,{...r,type:"diverging-pow"})}function $R(e,t,{base:n=10,pivot:r=1,domain:i=Ff(t,r<0?Xa:rr),...o}){return Mw(e,Bb().base(n=+n),PJ,t,{domain:i,pivot:r,...o})}function PR(e,t,{constant:n=1,...r}){return Mw(e,Lb().constant(n=+n),qJ(n),t,r)}var $J={apply(e){return e},invert(e){return e}},PJ={apply:Math.log,invert:Math.exp},UJ={apply(e){return Math.sign(e)*Math.sqrt(Math.abs(e))},invert(e){return Math.sign(e)*(e*e)}};function zJ(e){return e===.5?UJ:{apply(t){return Math.sign(t)*Math.pow(Math.abs(t),e)},invert(t){return Math.sign(t)*Math.pow(Math.abs(t),1/e)}}}function qJ(e){return{apply(t){return Math.sign(t)*Math.log1p(Math.abs(t/e))},invert(t){return Math.sign(t)*Math.expm1(Math.abs(t))*e}}}function UR(e,t,n,r){return Rf(e,t,n,r)}function zR(e,t,n){return UR(e,Nb(),t,n)}function qR(e,t,n){return UR(e,Db(),t,n)}var $f=Symbol("ordinal");function VR(e,t,n,{type:r,interval:i,domain:o,range:s,reverse:a,hint:c}){return i=ko(i,r),o===void 0&&(o=HR(n,i,e)),(r==="categorical"||r===$f)&&(r="ordinal"),a&&(o=Ba(o)),o=t.domain(o).domain(),s!==void 0&&(typeof s=="function"&&(s=s(o)),t.range(s)),{type:r,domain:o,range:s,scale:t,hint:c,interval:i}}function YR(e,t,{type:n,interval:r,domain:i,range:o,scheme:s,unknown:a,...c}){r=ko(r,n),i===void 0&&(i=HR(t,r,e));let l;if(fe.get(e)===Ef)l=jJ(t),o=o===void 0?VJ(l):Xt(o,Nf);else if(fe.get(e)===jr&&(o===void 0&&(n==="ordinal"||n===$f)&&(o=MR(i,s),o!==void 0&&(s=void 0)),s===void 0&&o===void 0&&(s=n==="ordinal"?"turbo":"observable10"),s!==void 0))if(o!==void 0){let u=kf(s),f=o[0],d=o[1]-o[0];o=({length:h})=>Cn(p=>u(f+d*p),h)}else o=dT(s);if(a===Zp)throw new Error(`implicit unknown on ${e} scale is not supported`);return VR(e,dl().unknown(a),t,{...c,type:n,domain:i,range:o,hint:l})}function XR(e,t,{align:n=.5,padding:r=.5,...i}){return WR(CM().align(n).padding(r),t,i,e)}function GR(e,t,{align:n=.5,padding:r=.1,paddingInner:i=r,paddingOuter:o=e==="fx"||e==="fy"?0:r,...s}){return WR(ja().align(n).paddingInner(i).paddingOuter(o),t,s,e)}function WR(e,t,n,r){let{round:i}=n;return i!==void 0&&e.round(i=!!i),e=VR(r,e,t,n),e.round=i,e}function HR(e,t,n){let r=new Wn;for(let{value:i,domain:o}of e){if(o!==void 0)return o();if(i!==void 0)for(let s of i)r.add(s)}if(t!==void 0){let[i,o]=ae(r).map(t.floor,t);return t.range(i,t.offset(o))}if(r.size>1e4&&fe.get(n)===mi)throw new Error(`implicit ordinal domain of ${n} scale has more than 10,000 values`);return ho(r,ln)}function jR(e,t){let n;for(let{hint:r}of e){let i=r?.[t];if(i!==void 0){if(n===void 0)n=i;else if(n!==i)return}}return n}function jJ(e){return{fill:jR(e,"fill"),stroke:jR(e,"stroke")}}function VJ(e){return ne(e.fill)?dA:Z1}function Gm(e,{label:t,inset:n=0,insetTop:r=n,insetRight:i=n,insetBottom:o=n,insetLeft:s=n,round:a,nice:c,clamp:l,zero:u,align:f,padding:d,projection:h,facet:{label:p=t}={},...m}={}){let g={};for(let[y,x]of e){let b=m[y],w=r7(y,x,{round:fe.get(y)===mi?a:void 0,nice:c,clamp:l,zero:u,align:f,padding:d,projection:h,...b});if(w){let{label:_=y==="fx"||y==="fy"?p:t,percent:v,transform:M,inset:E,insetTop:D=E!==void 0?E:y==="y"?r:0,insetRight:I=E!==void 0?E:y==="x"?i:0,insetBottom:T=E!==void 0?E:y==="y"?o:0,insetLeft:O=E!==void 0?E:y==="x"?s:0}=b||{};if(M==null)M=void 0;else if(typeof M!="function")throw new Error("invalid scale transform; not a function");w.percent=!!v,w.label=_===void 0?YJ(x,w):_,w.transform=M,y==="x"||y==="fx"?(w.insetLeft=+O,w.insetRight=+I):(y==="y"||y==="fy")&&(w.insetTop=+D,w.insetBottom=+T),g[y]=w}}return g}function bT(e){let t={},n={scales:t};for(let[r,i]of Object.entries(e)){let{scale:o,type:s,interval:a,label:c}=i;t[r]=o7(i),n[r]=o,o.type=s,a!=null&&(o.interval=a),c!=null&&(o.label=c)}return n}function t7(e,t){let{x:n,y:r,fx:i,fy:o}=e,s=i||o?Ew(t):t;i&&ZR(i,s),o&&JR(o,s);let a=i||o?wT(e,t):t;n&&ZR(n,a),r&&JR(r,a)}function YJ(e=[],t){let n;for(let{label:r}of e)if(r!==void 0){if(n===void 0)n=r;else if(n!==r)return}if(n!==void 0)return!$o(t)&&t.percent&&(n=`${n} (%)`),{inferred:!0,toString:()=>n}}function Tw(e){return Math.sign(Gs(e.domain()))*Math.sign(Gs(e.range()))}function Ew(e){let{marginTop:t,marginRight:n,marginBottom:r,marginLeft:i,width:o,height:s,facet:{marginTop:a,marginRight:c,marginBottom:l,marginLeft:u}}=e;return{marginTop:Math.max(t,a),marginRight:Math.max(n,c),marginBottom:Math.max(r,l),marginLeft:Math.max(i,u),width:o,height:s}}function wT({fx:e,fy:t},n){let{marginTop:r,marginRight:i,marginBottom:o,marginLeft:s,width:a,height:c}=Ew(n);return{marginTop:r,marginRight:i,marginBottom:o,marginLeft:s,width:e?e.scale.bandwidth()+s+i:a,height:t?t.scale.bandwidth()+r+o:c,facet:{width:a,height:c}}}function ZR(e,t){if(e.range===void 0){let{insetLeft:n,insetRight:r}=e,{width:i,marginLeft:o=0,marginRight:s=0}=t,a=o+n,c=i-s-r;e.range=[a,Math.max(a,c)],$o(e)||(e.range=n7(e)),e.scale.range(e.range)}e7(e)}function JR(e,t){if(e.range===void 0){let{insetTop:n,insetBottom:r}=e,{height:i,marginTop:o=0,marginBottom:s=0}=t,a=o+n,c=i-s-r;e.range=[Math.max(a,c),a],$o(e)?e.range.reverse():e.range=n7(e),e.scale.range(e.range)}e7(e)}function e7(e){e.round===void 0&&WJ(e)&&XJ(e)<=30&&e.scale.round(!0)}function XJ({scale:e}){let t=e.domain().length,[n,r]=e.range(),i=e.paddingInner?e.paddingInner():1,o=e.paddingOuter?e.paddingOuter():e.padding(),s=t-i,a=Math.abs(r-n)/Math.max(1,s+o*2);return(a-Math.floor(a))*s}function n7(e){let t=e.scale.domain().length+vT(e);if(!(t>2))return e.range;let[n,r]=e.range;return Array.from({length:t},(i,o)=>n+o/(t-1)*(r-n))}function Nw(e,t,n){return r7(e,n===void 0?void 0:[{hint:n}],{...t})}function r7(e,t=[],n={}){let r=GJ(e,t,n);if(n.type===void 0&&n.domain===void 0&&n.range===void 0&&n.interval==null&&e!=="fx"&&e!=="fy"&&$o({type:r})){let i=t.map(({value:o})=>o).filter(o=>o!==void 0);i.some(Oe)?zn(`Warning: some data associated with the ${e} scale are dates. Dates are typically associated with a "utc" or "time" scale rather than a "${Pf(r)}" scale. If you are using a bar mark, you probably want a rect mark with the interval option instead; if you are using a group transform, you probably want a bin transform instead. If you want to treat this data as ordinal, you can specify the interval of the ${e} scale (e.g., d3.utcDay), or you can suppress this warning by setting the type of the ${e} scale to "${Pf(r)}".`):i.some(RF)?zn(`Warning: some data associated with the ${e} scale are strings that appear to be dates (e.g., YYYY-MM-DD). If these strings represent dates, you should parse them to Date objects. Dates are typically associated with a "utc" or "time" scale rather than a "${Pf(r)}" scale. If you are using a bar mark, you probably want a rect mark with the interval option instead; if you are using a group transform, you probably want a bin transform instead. If you want to treat this data as ordinal, you can suppress this warning by setting the type of the ${e} scale to "${Pf(r)}".`):i.some($F)&&zn(`Warning: some data associated with the ${e} scale are strings that appear to be numbers. If these strings represent numbers, you should parse or coerce them to numbers. Numbers are typically associated with a "linear" scale rather than a "${Pf(r)}" scale. If you want to treat this data as ordinal, you can specify the interval of the ${e} scale (e.g., 1 for integers), or you can suppress this warning by setting the type of the ${e} scale to "${Pf(r)}".`)}switch(n.type=r,r){case"diverging":case"diverging-sqrt":case"diverging-pow":case"diverging-log":case"diverging-symlog":case"cyclical":case"sequential":case"linear":case"sqrt":case"threshold":case"quantile":case"pow":case"log":case"symlog":n=Aw(t,n,Je);break;case"identity":switch(fe.get(e)){case mi:n=Aw(t,n,Je);break;case Ef:n=Aw(t,n,HJ);break}break;case"utc":case"time":n=Aw(t,n,BF);break}switch(r){case"diverging":return FR(e,t,n);case"diverging-sqrt":return RR(e,t,n);case"diverging-pow":return gT(e,t,n);case"diverging-log":return $R(e,t,n);case"diverging-symlog":return PR(e,t,n);case"categorical":case"ordinal":case $f:return YR(e,t,n);case"cyclical":case"sequential":case"linear":return ER(e,t,n);case"sqrt":return NR(e,t,n);case"threshold":return Iw(e,t,n);case"quantile":return BR(e,t,n);case"quantize":return LR(e,t,n);case"pow":return yT(e,t,n);case"log":return DR(e,t,n);case"symlog":return OR(e,t,n);case"utc":return qR(e,t,n);case"time":return zR(e,t,n);case"point":return XR(e,t,n);case"band":return GR(e,t,n);case"identity":return CR(e);case void 0:return;default:throw new Error(`unknown scale type: ${r}`)}}function Pf(e){return typeof e=="symbol"?e.description:e}function QR(e){return typeof e=="string"?`${e}`.toLowerCase():e}var KR={toString:()=>"projection"};function GJ(e,t,{type:n,domain:r,range:i,scheme:o,pivot:s,projection:a}){if(n=QR(n),e==="fx"||e==="fy")return"band";(e==="x"||e==="y")&&a!=null&&(n=KR);for(let l of t){let u=QR(l.type);if(u!==void 0){if(n===void 0)n=u;else if(n!==u)throw new Error(`scale incompatible with channel: ${n} !== ${u}`)}}if(n===KR)return;if(n!==void 0)return n;if(r===void 0&&!t.some(({value:l})=>l!==void 0))return;let c=fe.get(e);if(c===Al)return"sqrt";if(c===El||c===Tl)return"linear";if(c===Ef)return"ordinal";if((r||i||[]).length>2)return xT(c);if(r!==void 0){if(Te(r))return xT(c);if(Oe(r))return"utc"}else{let l=t.map(({value:u})=>u).filter(u=>u!==void 0);if(l.some(Te))return xT(c);if(l.some(Oe))return"utc"}if(c===jr){if(s!=null||AR(o))return"diverging";if(IR(o))return"categorical"}return"linear"}function xT(e){switch(e){case mi:return"point";case jr:return $f;default:return"ordinal"}}function $o({type:e}){return e==="ordinal"||e==="point"||e==="band"||e===$f}function vT({type:e}){return e==="threshold"}function WJ({type:e}){return e==="point"||e==="band"}function sr(e){if(e===void 0)return!0;let t=e.domain(),n=e(t[0]);for(let r=1,i=t.length;r<i;++r)if(e(t[r])-n)return!1;return!0}function Aw(e,{domain:t,...n},r){for(let i of e)i.value!==void 0&&(t===void 0&&(t=i.value?.domain),i.value=r(i.value));return{domain:t===void 0?t:r(t),...n}}function HJ(e){return Xt(e,Nf)}function Uf(e={}){let t;for(let n in e)if(fe.has(n)&&Lo(e[n])){if(t!==void 0)throw new Error("ambiguous scale definition; multiple scales found");t=o7(Nw(n,e[n]))}if(t===void 0)throw new Error("invalid scale definition; no scale found");return t}function i7(e){return t=>{if(!fe.has(t=`${t}`))throw new Error(`unknown scale: ${t}`);return e[t]}}function o7({scale:e,type:t,domain:n,range:r,interpolate:i,interval:o,transform:s,percent:a,pivot:c}){if(t==="identity")return{type:"identity",apply:u=>u,invert:u=>u};let l=e.unknown?e.unknown():void 0;return{type:t,domain:Qa(n),...r!==void 0&&{range:Qa(r)},...s!==void 0&&{transform:s},...a&&{percent:a},...l!==void 0&&{unknown:l},...o!==void 0&&{interval:o},...i!==void 0&&{interpolate:i},...e.clamp&&{clamp:e.clamp()},...c!==void 0&&{pivot:c,symmetric:!1},...e.base&&{base:e.base()},...e.exponent&&{exponent:e.exponent()},...e.constant&&{constant:e.constant()},...e.align&&{align:e.align(),round:e.round()},...e.padding&&(e.paddingInner?{paddingInner:e.paddingInner(),paddingOuter:e.paddingOuter()}:{padding:e.padding()}),...e.bandwidth&&{bandwidth:e.bandwidth(),step:e.step()},apply:u=>e(u),...e.invert&&{invert:u=>e.invert(u)}}}function a7(e,t,n={}){let r=.5-Be,i=.5+Be,o=.5+Be,s=.5-Be;for(let{marginTop:m,marginRight:g,marginBottom:y,marginLeft:x}of t)m>r&&(r=m),g>i&&(i=g),y>o&&(o=y),x>s&&(s=x);let{margin:a,marginTop:c=a!==void 0?a:r,marginRight:l=a!==void 0?a:i,marginBottom:u=a!==void 0?a:o,marginLeft:f=a!==void 0?a:s}=n;c=+c,l=+l,u=+u,f=+f;let{width:d=640,height:h=ZJ(e,n,{width:d,marginTopDefault:r,marginRightDefault:i,marginBottomDefault:o,marginLeftDefault:s})+Math.max(0,c-r+u-o)}=n;d=+d,h=+h;let p={width:d,height:h,marginTop:c,marginRight:l,marginBottom:u,marginLeft:f};if(e.fx||e.fy){let{margin:m,marginTop:g=m!==void 0?m:c,marginRight:y=m!==void 0?m:l,marginBottom:x=m!==void 0?m:u,marginLeft:b=m!==void 0?m:f}=n.facet??{};g=+g,y=+y,x=+x,b=+b,p.facet={marginTop:g,marginRight:y,marginBottom:x,marginLeft:b}}return p}function ZJ({x:e,y:t,fy:n,fx:r},{projection:i,aspectRatio:o},{width:s,marginTopDefault:a,marginRightDefault:c,marginBottomDefault:l,marginLeftDefault:u}){let f=n?n.scale.domain().length:1,d=gR(i);if(d){let p=r?r.scale.domain().length:1,m=(1.1*f-.1)/(1.1*p-.1)*d,g=Math.max(.1,Math.min(10,m));return Math.round((s-u-c)*g+a+l)}let h=t?$o(t)?t.scale.domain().length:Math.max(7,17/f):1;if(o!=null){if(o=+o,!(isFinite(o)&&o>0))throw new Error(`invalid aspectRatio: ${o}`);let p=s7("y",t)/(s7("x",e)*o),m=r?r.scale.bandwidth():1,g=n?n.scale.bandwidth():1,y=m*(s-u-c)-e.insetLeft-e.insetRight;return(p*y+t.insetTop+t.insetBottom)/g+a+l}return!!(t||n)*Math.max(1,Math.min(60,h*f))*20+!!r*30+60}function s7(e,t){if(!t)throw new Error(`aspectRatio requires ${e} scale`);let{type:n,domain:r}=t,i;switch(n){case"linear":case"utc":case"time":i=Number;break;case"pow":{let a=t.scale.exponent();i=c=>Math.pow(c,a);break}case"log":i=Math.log;break;case"point":case"band":return r.length;default:throw new Error(`unsupported ${e} scale for aspectRatio: ${n}`)}let[o,s]=ae(r);return Math.abs(i(s)-i(o))}function l7(e,t){let{fx:n,fy:r}=Gm(e,t),i=n?.scale.domain(),o=r?.scale.domain();return i&&o?X0(i,o).map(([s,a],c)=>({x:s,y:a,i:c})):i?i.map((s,a)=>({x:s,i:a})):o?o.map((s,a)=>({y:s,i:a})):void 0}function u7(e,{x:t,y:n}){return t&&=AT(t),n&&=AT(n),e.filter(t&&n?r=>t.has(r.x)&&n.has(r.y):t?r=>t.has(r.x):r=>n.has(r.y)).sort(t&&n?(r,i)=>t.get(r.x)-t.get(i.x)||n.get(r.y)-n.get(i.y):t?(r,i)=>t.get(r.x)-t.get(i.x):(r,i)=>n.get(r.y)-n.get(i.y))}function Ow(e,{fx:t,fy:n}){let r=ir(e),i=t?.value,o=n?.value;return t&&n?$i(r,s=>(s.fx=i[s[0]],s.fy=o[s[0]],s),s=>i[s],s=>o[s]):t?$i(r,s=>(s.fx=i[s[0]],s),s=>i[s]):$i(r,s=>(s.fy=o[s[0]],s),s=>o[s])}function f7(e,t,{marginTop:n,marginLeft:r}){return e&&t?({x:i,y:o})=>`translate(${e(i)-r},${t(o)-n})`:e?({x:i})=>`translate(${e(i)-r},0)`:({y:i})=>`translate(0,${t(i)-n})`}function d7(e){let t=[],n=new Uint32Array(Sn(e,r=>r.length));for(let r of e){let i=0;for(let o of e)r!==o&&(n.set(o,i),i+=o.length);t.push(n.slice(0,i))}return t}var JJ=new Map([["top",_T],["right",MT],["bottom",ST],["left",IT],["top-left",Dw(_T,IT)],["top-right",Dw(_T,MT)],["bottom-left",Dw(ST,IT)],["bottom-right",Dw(ST,MT)],["top-empty",KJ],["right-empty",nQ],["bottom-empty",tQ],["left-empty",eQ],["empty",rQ]]);function h7(e){if(e==null)return null;let t=JJ.get(`${e}`.toLowerCase());if(t)return t;throw new Error(`invalid facet anchor: ${e}`)}var c7=new WeakMap;function AT(e){let t=c7.get(e);return t||c7.set(e,t=new Gn(Xt(e,(n,r)=>[n,r]))),t}function sc(e,t){return AT(e).get(t)}function QJ(e,t,n){return t=Zs(t),n=Zs(n),e.find(r=>Object.is(Zs(r.x),t)&&Object.is(Zs(r.y),n))}function Bw(e,t,n){return QJ(e,t,n)?.empty}function _T(e,{y:t},{y:n}){return t?sc(t,n)===0:!0}function ST(e,{y:t},{y:n}){return t?sc(t,n)===t.length-1:!0}function IT(e,{x:t},{x:n}){return t?sc(t,n)===0:!0}function MT(e,{x:t},{x:n}){return t?sc(t,n)===t.length-1:!0}function KJ(e,{y:t},{x:n,y:r,empty:i}){if(i)return!1;if(!t)return;let o=sc(t,r);if(o>0)return Bw(e,n,t[o-1])}function tQ(e,{y:t},{x:n,y:r,empty:i}){if(i)return!1;if(!t)return;let o=sc(t,r);if(o<t.length-1)return Bw(e,n,t[o+1])}function eQ(e,{x:t},{x:n,y:r,empty:i}){if(i)return!1;if(!t)return;let o=sc(t,n);if(o>0)return Bw(e,t[o-1],r)}function nQ(e,{x:t},{x:n,y:r,empty:i}){if(i)return!1;if(!t)return;let o=sc(t,n);if(o<t.length-1)return Bw(e,t[o+1],r)}function rQ(e,t,{empty:n}){return n}function Dw(e,t){return function(){return e.apply(null,arguments)&&t.apply(null,arguments)}}function Lw(e,{channels:{fx:t,fy:n},groups:r}){return t&&n?e.map(({x:i,y:o})=>r.get(i)?.get(o)??[]):t?e.map(({x:i})=>r.get(i)??[]):e.map(({y:i})=>r.get(i)??[])}var vt=class{constructor(t,n={},r={},i){let{facet:o="auto",facetAnchor:s,fx:a,fy:c,sort:l,dx:u=0,dy:f=0,margin:d=0,marginTop:h=d,marginRight:p=d,marginBottom:m=d,marginLeft:g=d,clip:y=i?.clip,channels:x,tip:b,render:w}=r;if(this.data=t,this.sort=Co(l)?l:null,this.initializer=_e(r).initializer,this.transform=this.initializer?r.transform:hn(r).transform,o===null||o===!1?this.facet=null:(this.facet=Qe(o===!0?"include":o,"facet",["auto","include","exclude","super"]),this.fx=t===Za&&typeof a=="string"?[a]:a,this.fy=t===Za&&typeof c=="string"?[c]:c),this.facetAnchor=h7(s),n=Rm(n),x!==void 0&&(n={...iQ(x),...n}),i!==void 0&&(n={...ww(this,r,i),...n}),this.channels=Object.fromEntries(Object.entries(n).map(([_,v])=>{if(qr(v.value)){let{value:M,label:E=v.label,scale:D=v.scale}=v.value;v={...v,label:E,scale:D,value:M}}if(t===Za&&typeof v.value=="string"){let{value:M}=v;v={...v,value:[M]}}return[_,v]}).filter(([_,{value:v,optional:M}])=>{if(v!=null)return!0;if(M)return!1;throw new Error(`missing channel value: ${_}`)})),this.dx=+u,this.dy=+f,this.marginTop=+h,this.marginRight=+p,this.marginBottom=+m,this.marginLeft=+g,this.clip=_w(y),this.tip=oQ(b),this.facet==="super"){if(a||c)throw new Error("super-faceting cannot use fx or fy");for(let _ in this.channels){let{scale:v}=n[_];if(!(v!=="x"&&v!=="y"))throw new Error("super-faceting cannot use x or y")}}w!=null&&(this.render=zf(w,this.render))}initialize(t,n,r){let i=qe(this.data);t===void 0&&i!=null&&(t=[ir(i)]);let o=t;this.transform!=null&&({facets:t,data:i}=this.transform(i,t,r),i=qe(i)),t!==void 0&&(t.original=o);let s=gw(this.channels,i);return this.sort!=null&&iR(i,t,s,n,this.sort),{data:i,facets:t,channels:s}}filter(t,n,r){for(let i in n){let{filter:o=Ue}=n[i];if(o!==null){let s=r[i];t=t.filter(a=>o(s[a]))}}return t}project(t,n,r){for(let i in t)if(t[i].scale==="x"&&/^x|x$/.test(i)){let o=i.replace(/^x|x$/,"y");o in t&&t[o].scale==="y"&&fT(i,o,n,r.projection)}}scale(t,n,r){let i=Bf(t,n);return r.projection&&this.project(t,i,r),i}};function Ke(...e){return e.plot=vt.prototype.plot,e}function zf(e,t){if(e==null)return t===null?void 0:t;if(t==null)return e===null?void 0:e;if(typeof e!="function")throw new TypeError(`invalid render transform: ${e}`);if(typeof t!="function")throw new TypeError(`invalid render transform: ${t}`);return function(n,r,i,o,s,a){return e.call(this,n,r,i,o,s,(c,l,u,f,d)=>t.call(this,c,l,u,f,d,a))}}function iQ(e){return Object.fromEntries(Object.entries(Rm(e)).map(([t,n])=>(n=typeof n=="string"?{value:n,label:t}:pi(n),n.filter===void 0&&n.scale==null&&(n={...n,filter:null}),[t,n])))}function oQ(e){return e===!0?"xy":e===!1||e==null?null:typeof e=="string"?Qe(e,"tip",["x","y","xy"]):e}function Yi(e,t){return e?.tip===!0?{...e,tip:t}:fn(e?.tip)&&e.tip.pointer===void 0?{...e,tip:{...e.tip,pointer:t}}:e}var p7=new WeakMap;function TT(e,t,{x:n,y:r,px:i,py:o,maxRadius:s=40,channels:a,render:c,...l}={}){return s=+s,i!=null&&(n??=null,a={...a,px:{value:i,scale:"x"}}),o!=null&&(r??=null,a={...a,py:{value:o,scale:"y"}}),{x:n,y:r,channels:a,...l,render:zf(function(u,f,d,h,p,m){p={...p,pointerSticky:!1};let g=p.ownerSVGElement,{data:y}=p.getMarkState(this),x=p7.get(g);x||p7.set(g,x={sticky:!1,roots:[],renders:[]});let b=x.renders.push(W)-1,{x:w,y:_,fx:v,fy:M}=f,E=v?v(u.fx)-h.marginLeft:0,D=M?M(u.fy)-h.marginTop:0;w?.bandwidth&&(E+=w.bandwidth()/2),_?.bandwidth&&(D+=_.bandwidth()/2);let I=u.fi!=null,T;if(I){let Y=x.facetStates;Y||(x.facetStates=Y=new Map),T=Y.get(this),T||Y.set(this,T=new Map)}let[O,L]=pn(this,h),{px:S,py:A}=d,N=S?Y=>S[Y]:ET(d,O),k=A?Y=>A[Y]:NT(d,L),R,F,$,P;function U(Y,rt){if(I)if(P&&(P=cancelAnimationFrame(P)),Y==null)T.delete(u.fi);else{T.set(u.fi,rt),P=requestAnimationFrame(()=>{P=null;for(let[q,H]of T)if(H<rt||H===rt&&q<u.fi){Y=null;break}W(Y)});return}W(Y)}function W(Y){if(R===Y&&$===x.sticky)return;R=Y,$=p.pointerSticky=x.sticky;let rt=R==null?[]:[R];I&&(rt.fx=u.fx,rt.fy=u.fy,rt.fi=u.fi);let q=m(rt,f,d,h,p);if(F){if(I){let H=F.parentNode,ot=F.getAttribute("transform"),z=q.getAttribute("transform");ot?q.setAttribute("transform",ot):q.removeAttribute("transform"),z?H.setAttribute("transform",z):H.removeAttribute("transform"),q.removeAttribute("aria-label"),q.removeAttribute("aria-description"),q.removeAttribute("aria-hidden")}F.replaceWith(q)}return x.roots[b]=F=q,R==null&&T?.size>1||p.dispatchValue(R==null?null:y[R]),q}function tt(Y){if(x.sticky||Y.pointerType==="mouse"&&Y.buttons===1)return;let[rt,q]=Ln(Y);rt-=E,q-=D;let H=rt<h.marginLeft||rt>h.width-h.marginRight?1:e,ot=q<h.marginTop||q>h.height-h.marginBottom?1:t,z=null,kt=s*s;for(let dt of u){let Wt=H*(N(dt)-rt),Ht=ot*(k(dt)-q),et=Wt*Wt+Ht*Ht;et<=kt&&(z=dt,kt=et)}if(z!=null&&(e!==1||t!==1)){let dt=N(z)-rt,Wt=k(z)-q;kt=dt*dt+Wt*Wt}U(z,kt)}function nt(Y){Y.pointerType==="mouse"&&R!=null&&(x.sticky&&x.roots.some(rt=>rt?.contains(Y.target))||(x.sticky?(x.sticky=!1,x.renders.forEach(rt=>rt(null))):(x.sticky=!0,W(R)),Y.stopImmediatePropagation()))}function st(Y){Y.pointerType==="mouse"&&(x.sticky||U(null))}return g.addEventListener("pointerenter",tt),g.addEventListener("pointermove",tt),g.addEventListener("pointerdown",nt),g.addEventListener("pointerleave",st),W(null)},c)}}function qf(e){return TT(1,1,e)}function jf(e){return TT(1,.01,e)}function Dl(e){return TT(.01,1,e)}function ET({x1:e,x2:t,x:n=e},r){return e&&t?i=>(e[i]+t[i])/2:n?i=>n[i]:()=>r}function NT({y1:e,y2:t,y:n=e},r){return e&&t?i=>(e[i]+t[i])/2:n?i=>n[i]:()=>r}function Cw(e){return $o(e)&&e.interval===void 0?void 0:"tabular-nums"}function m7(e,t){let{label:n=e.label,tickSize:r=6,width:i=240,height:o=44+r,marginTop:s=18,marginRight:a=0,marginBottom:c=16+r,marginLeft:l=0,style:u,ticks:f=(i-l-a)/64,tickFormat:d,fontVariant:h=Cw(e),round:p=!0,opacity:m,className:g}=t,y=ic(t);g=Lf(g),m=ie(m)[1],d===null&&(d=()=>null);let x=ct("svg",y).attr("class",`${g}-ramp`).attr("font-family","system-ui, sans-serif").attr("font-size",10).attr("width",i).attr("height",o).attr("viewBox",`0 0 ${i} ${o}`).call(O=>O.append("style").text(`:where(.${g}-ramp) {
17
17
  display: block;
18
18
  height: auto;
19
19
  height: intrinsic;
@@ -22,9 +22,9 @@ ${n}`}function dZ(e){return e==="time"?ew:e==="utc"?Bm:uZ}function rF(e,t,n){let
22
22
  }
23
23
  :where(.${g}-ramp text) {
24
24
  white-space: pre;
25
- }`)).call(Lf,u),b=O=>O.selectAll(".tick line").attr("y1",s+c-o),w,_=p?(O,B)=>O.rangeRound(B):(O,B)=>O.range(B),{type:v,domain:M,range:E,interpolate:D,scale:I,pivot:T}=e;if(D){let O=E===void 0?D:yo(D.length===1?Ym(D):D,E);w=_(I.copy(),Ln(we(l,i-a),Math.min(M.length+(T!==void 0),E===void 0?1/0:E.length)));let B=256,S=y.document.createElement("canvas");S.width=B,S.height=1;let A=S.getContext("2d");for(let N=0,k=B-1;N<B;++N)A.fillStyle=O(N/k),A.fillRect(N,0,1,1);x.append("image").attr("opacity",m).attr("x",l).attr("y",s).attr("width",i-l-a).attr("height",o-s-c).attr("preserveAspectRatio","none").attr("xlink:href",S.toDataURL())}else if(v==="threshold"){let O=M,B=d===void 0?S=>S:typeof d=="string"?ci(d):d;w=_(Rs().domain([-1,E.length-1]),[l,i-a]),x.append("g").attr("fill-opacity",m).selectAll().data(E).enter().append("rect").attr("x",(S,A)=>w(A-1)).attr("y",s).attr("width",(S,A)=>w(A)-w(A-1)).attr("height",o-s-c).attr("fill",S=>S),f=Xt(O,(S,A)=>A),d=S=>B(O[S],S)}else w=_(za().domain(M),[l,i-a]),x.append("g").attr("fill-opacity",m).selectAll().data(M).enter().append("rect").attr("x",w).attr("y",s).attr("width",Math.max(0,w.bandwidth()-1)).attr("height",o-s-c).attr("fill",I),b=()=>{};return x.append("g").attr("transform",`translate(0,${o-c})`).call(US(w).ticks(Array.isArray(f)?null:f,typeof d=="string"?d:void 0).tickFormat(typeof d=="function"?d:void 0).tickSize(r).tickValues(Array.isArray(f)?f:null)).attr("font-size",null).attr("font-family",null).attr("font-variant",le(h,"normal")).call(b).call(O=>O.select(".domain").remove()),n!==void 0&&x.append("text").attr("x",l).attr("y",s-6).attr("fill","currentColor").attr("font-weight","bold").text(n),x.node()}var jf=Math.PI/180;function Xi(e,{marker:t,markerStart:n=t,markerMid:r=t,markerEnd:i=t}={}){e.markerStart=AA(n),e.markerMid=AA(r),e.markerEnd=AA(i)}function AA(e){if(e==null||e===!1)return null;if(e===!0)return GR;if(typeof e=="function")return e;switch(`${e}`.toLowerCase()){case"none":return null;case"arrow":return XR("auto");case"arrow-reverse":return XR("auto-start-reverse");case"dot":return AJ;case"circle":case"circle-fill":return GR;case"circle-stroke":return EJ;case"tick":return EA("auto");case"tick-x":return EA(90);case"tick-y":return EA(0)}throw new Error(`invalid marker: ${e}`)}function XR(e){return(t,n)=>ct("svg:marker",n).attr("viewBox","-5 -5 10 10").attr("markerWidth",6.67).attr("markerHeight",6.67).attr("orient",e).attr("fill","none").attr("stroke",t).attr("stroke-width",1.5).attr("stroke-linecap","round").attr("stroke-linejoin","round").call(r=>r.append("path").attr("d","M-1.5,-3l3,3l-3,3")).node()}function AJ(e,t){return ct("svg:marker",t).attr("viewBox","-5 -5 10 10").attr("markerWidth",6.67).attr("markerHeight",6.67).attr("fill",e).attr("stroke","none").call(n=>n.append("circle").attr("r",2.5)).node()}function GR(e,t){return ct("svg:marker",t).attr("viewBox","-5 -5 10 10").attr("markerWidth",6.67).attr("markerHeight",6.67).attr("fill",e).attr("stroke","var(--plot-background)").attr("stroke-width",1.5).call(n=>n.append("circle").attr("r",3)).node()}function EJ(e,t){return ct("svg:marker",t).attr("viewBox","-5 -5 10 10").attr("markerWidth",6.67).attr("markerHeight",6.67).attr("fill","var(--plot-background)").attr("stroke",e).attr("stroke-width",1.5).call(n=>n.append("circle").attr("r",3)).node()}function EA(e){return(t,n)=>ct("svg:marker",n).attr("viewBox","-3 -3 6 6").attr("markerWidth",6).attr("markerHeight",6).attr("orient",e).attr("stroke",t).call(r=>r.append("path").attr("d","M0,-3v6")).node()}var NJ=0;function ra(e,t,{stroke:n},r){return HR(e,t,n&&(i=>n[i]),r)}function WR(e,t,{stroke:n},r){return HR(e,t,n&&(([i])=>n[i]),r)}function HR(e,{markerStart:t,markerMid:n,markerEnd:r,stroke:i},o=()=>i,s){let a=new Map;function c(l){return function(u){let f=o(u),d=a.get(l);d||a.set(l,d=new Map);let h=d.get(f);if(!h){let p=this.parentNode.insertBefore(l(f,s),this),m=`plot-marker-${++NJ}`;p.setAttribute("id",m),d.set(f,h=`url(#${m})`)}return h}}t&&e.attr("marker-start",c(t)),n&&e.attr("marker-mid",c(n)),r&&e.attr("marker-end",c(r))}function Dl({inset:e,insetLeft:t,insetRight:n,...r}={}){return[t,n]=ZR(e,t,n),{inset:e,insetLeft:t,insetRight:n,...r}}function Ol({inset:e,insetTop:t,insetBottom:n,...r}={}){return[t,n]=ZR(e,t,n),{inset:e,insetTop:t,insetBottom:n,...r}}function ZR(e,t,n){return e===void 0&&t===void 0&&n===void 0?Be?[1,0]:[.5,.5]:[t,n]}function JR(e,{interval:t}){return e={...pi(e)},e.interval=Tf(e.interval===void 0?t:e.interval),e}function Lw(e,t,n,r){let{[e]:i,[`${e}1`]:o,[`${e}2`]:s}=n,{value:a,interval:c}=JR(i,n);if(a==null||c==null&&!r)return n;let l=En(i);if(c==null){let h,p={transform:m=>h||(h=pt(m,a)),label:l};return{...n,[e]:void 0,[`${e}1`]:o===void 0?p:o,[`${e}2`]:s===void 0&&!(o===s&&r)?p:s}}let u,f;function d(h){return f!==void 0&&h===u?f:f=Xt(pt(u=h,a),p=>c.floor(p))}return t({...n,[e]:void 0,[`${e}1`]:o===void 0?{transform:d,label:l}:o,[`${e}2`]:s===void 0?{transform:h=>d(h).map(p=>c.offset(p)),label:l}:s})}function QR(e,t,n){let{[e]:r}=n,{value:i,interval:o}=JR(r,n);return i==null||o==null?n:t({...n,[e]:{label:En(r),transform:s=>{let a=Xt(pt(s,i),l=>o.floor(l)),c=a.map(l=>o.offset(l));return a.map(Oe(a)?(l,u)=>l==null||isNaN(l=+l)||(u=c[u],u==null)||isNaN(u=+u)?void 0:new Date((l+u)/2):(l,u)=>l==null||(u=c[u],u==null)?NaN:(+l+ +u)/2)}}})}function NA(e={}){return Lw("x",Dl,e,!0)}function DA(e={}){return Lw("y",Ol,e,!0)}function kw(e={}){return Lw("x",Dl,e)}function Cw(e={}){return Lw("y",Ol,e)}function Fw(e={}){return QR("x",Dl,e)}function Rw(e={}){return QR("y",Ol,e)}var KR={ariaLabel:"rule",fill:null,stroke:"currentColor"},Gm=class extends vt{constructor(t,n={}){let{x:r,y1:i,y2:o,inset:s=0,insetTop:a=s,insetBottom:c=s}=n;super(t,{x:{value:r,scale:"x",optional:!0},y1:{value:i,scale:"y",optional:!0},y2:{value:o,scale:"y",optional:!0}},Yi(n,"x"),KR),this.insetTop=Nt(a),this.insetBottom=Nt(c),Xi(this,n)}render(t,n,r,i,o){let{x:s,y:a}=n,{x:c,y1:l,y2:u}=r,{width:f,height:d,marginTop:h,marginRight:p,marginLeft:m,marginBottom:g}=i,{insetTop:y,insetBottom:x}=this;return ct("svg:g",o).call(kt,this,i,o).call(It,this,{x:c&&s},Be,0).call(b=>b.selectAll().data(t).enter().append("line").call(Dt,this).attr("x1",c?w=>c[w]:(m+f-p)/2).attr("x2",c?w=>c[w]:(m+f-p)/2).attr("y1",l&&!ir(a)?w=>l[w]+y:h+y).attr("y2",u&&!ir(a)?a.bandwidth?w=>u[w]+a.bandwidth()-x:w=>u[w]-x:d-g-x).call(Jt,this,r).call(ra,this,r,o)).node()}},Wm=class extends vt{constructor(t,n={}){let{x1:r,x2:i,y:o,inset:s=0,insetRight:a=s,insetLeft:c=s}=n;super(t,{y:{value:o,scale:"y",optional:!0},x1:{value:r,scale:"x",optional:!0},x2:{value:i,scale:"x",optional:!0}},Yi(n,"y"),KR),this.insetRight=Nt(a),this.insetLeft=Nt(c),Xi(this,n)}render(t,n,r,i,o){let{x:s,y:a}=n,{y:c,x1:l,x2:u}=r,{width:f,height:d,marginTop:h,marginRight:p,marginLeft:m,marginBottom:g}=i,{insetLeft:y,insetRight:x}=this;return ct("svg:g",o).call(kt,this,i,o).call(It,this,{y:c&&a},0,Be).call(b=>b.selectAll().data(t).enter().append("line").call(Dt,this).attr("x1",l&&!ir(s)?w=>l[w]+y:m+y).attr("x2",u&&!ir(s)?s.bandwidth?w=>u[w]+s.bandwidth()-x:w=>u[w]-x:f-p-x).attr("y1",c?w=>c[w]:(h+d-g)/2).attr("y2",c?w=>c[w]:(h+d-g)/2).call(Jt,this,r).call(ra,this,r,o)).node()}};function qr(e,t){let{x:n=G,y:r,y1:i,y2:o,...s}=Cw(t);return[i,o]=t7(r,i,o),new Gm(e,{...s,x:n,y1:i,y2:o})}function Vr(e,t){let{y:n=G,x:r,x1:i,x2:o,...s}=kw(t);return[i,o]=t7(r,i,o),new Wm(e,{...s,y:n,x1:i,x2:o})}function t7(e,t,n){if(e==null){if(t===void 0){if(n!==void 0)return[0,n]}else if(n===void 0)return[0,t]}else{if(t===void 0)return n===void 0?[0,e]:[e,n];if(n===void 0)return[e,t]}return[t,n]}function oc(e,...t){let n=t.length;for(let r=0,i=!0;r<n;++r)typeof t[r]!="function"&&(i&&(e=e.slice(),i=!1),e.splice(r,2,e[r]+t[r]+e[r+1]),t.splice(r,1),--r,--n);return r=>{let i=e[0];for(let o=0;o<n;++o)i+=t[o](r)+e[o+1];return i}}var DJ={ariaLabel:"text",strokeLinejoin:"round",strokeWidth:3,paintOrder:"stroke"},o7="\xAD",Ll=class extends vt{constructor(t,n={}){let{x:r,y:i,text:o=rr(t)&&ow(t)?G:Te,frameAnchor:s,textAnchor:a=/right$/i.test(s)?"end":/left$/i.test(s)?"start":"middle",lineAnchor:c=/^top/i.test(s)?"top":/^bottom/i.test(s)?"bottom":"middle",lineHeight:l=1,lineWidth:u=1/0,textOverflow:f,monospace:d,fontFamily:h=d?"ui-monospace, monospace":void 0,fontSize:p,fontStyle:m,fontVariant:g,fontWeight:y,rotate:x}=n,[b,w]=ie(x,0),[_,v]=kJ(p);if(super(t,{x:{value:r,scale:"x",optional:!0},y:{value:i,scale:"y",optional:!0},fontSize:{value:_,optional:!0},rotate:{value:fF(b),optional:!0},text:{value:o,filter:Om,optional:!0}},n,DJ),this.rotate=w,this.textAnchor=le(a,"middle"),this.lineAnchor=Qe(c,"lineAnchor",["top","middle","bottom"]),this.lineHeight=+l,this.lineWidth=+u,this.textOverflow=BA(f),this.monospace=!!d,this.fontFamily=ze(h),this.fontSize=v,this.fontStyle=ze(m),this.fontVariant=ze(g),this.fontWeight=ze(y),this.frameAnchor=Co(s),!(this.lineWidth>=0))throw new Error(`invalid lineWidth: ${u}`);this.splitLines=kA(this),this.clipLine=CA(this)}render(t,n,r,i,o){let{x:s,y:a}=n,{x:c,y:l,rotate:u,text:f,title:d,fontSize:h}=r,{rotate:p}=this,[m,g]=pn(this,i);return ct("svg:g",o).call(kt,this,i,o).call(LA,this,f,i).call(It,this,{x:c&&s,y:l&&a}).call(y=>y.selectAll().data(t).enter().append("text").call(Dt,this).call(OJ,this,f,d).attr("transform",oc`translate(${c?x=>c[x]:m},${l?x=>l[x]:g})${u?x=>` rotate(${u[x]})`:p?` rotate(${p})`:""}`).call(ft,"font-size",h&&(x=>h[x])).call(Jt,this,r)).node()}};function BA(e){return e==null?null:Qe(e,"textOverflow",["clip","ellipsis","clip-start","clip-end","ellipsis-start","ellipsis-middle","ellipsis-end"]).replace(/^(clip|ellipsis)$/,"$1-end")}function OJ(e,t,n,r){if(!n)return;let{lineAnchor:i,lineHeight:o,textOverflow:s,splitLines:a,clipLine:c}=t;e.each(function(l){let u=a(qi(n[l])??"").map(c),f=u.length,d=i==="top"?.71:i==="bottom"?1-f:(164-f*100)/200;if(f>1){let h=0;for(let p=0;p<f;++p){if(++h,!u[p])continue;let m=this.ownerDocument.createElementNS(ii.svg,"tspan");m.setAttribute("x",0),p===h-1?m.setAttribute("y",`${(d+p)*o}em`):m.setAttribute("dy",`${h*o}em`),m.textContent=u[p],this.appendChild(m),h=0}}else d&&this.setAttribute("y",`${d*o}em`),this.textContent=u[0];if(s&&!r&&u[0]!==n[l]){let h=this.ownerDocument.createElementNS(ii.svg,"title");h.textContent=n[l],this.appendChild(h)}})}function Po(e,{x:t,y:n,...r}={}){return r.frameAnchor===void 0&&([t,n]=Re(t,n)),new Ll(e,{...r,x:t,y:n})}function $w(e,{x:t=G,...n}={}){return new Ll(e,Rw({...n,x:t}))}function Pw(e,{y:t=G,...n}={}){return new Ll(e,Fw({...n,y:t}))}function LA(e,t,n){ft(e,"text-anchor",t.textAnchor),ft(e,"font-family",t.fontFamily),ft(e,"font-size",t.fontSize),ft(e,"font-style",t.fontStyle),ft(e,"font-variant",t.fontVariant===void 0?BJ(n):t.fontVariant),ft(e,"font-weight",t.fontWeight)}function BJ(e){return e&&(Js(e)||Oe(e))?"tabular-nums":void 0}var LJ=new Set(["inherit","initial","revert","unset","xx-small","x-small","small","medium","large","x-large","xx-large","xxx-large","larger","smaller"]);function kJ(e){return e==null||typeof e=="number"?[void 0,e]:typeof e!="string"?[e,void 0]:(e=e.trim().toLowerCase(),LJ.has(e)||/^[+-]?\d*\.?\d+(e[+-]?\d+)?(\w*|%)$/.test(e)?[void 0,e]:[e,void 0])}function CJ(e,t,n){let r=[],i,o=0;for(let[s,a,c]of FJ(e)){if(i===void 0&&(i=s),o>i&&n(e,i,a)>t&&(r.push(e.slice(i,o)+(e[o-1]===o7?"-":"")),i=s),c){r.push(e.slice(i,a)),i=void 0;continue}o=a}return r}function*FJ(e){let t=0,n=0,r=e.length;for(;n<r;){let i=1;switch(e[n]){case o7:case"-":++n,yield[t,n,!1],t=n;break;case" ":for(yield[t,n,!1];e[++n]===" ";);t=n;break;case"\r":e[n+1]===`
25
+ }`)).call(Cf,u),b=O=>O.selectAll(".tick line").attr("y1",s+c-o),w,_=p?(O,L)=>O.rangeRound(L):(O,L)=>O.range(L),{type:v,domain:M,range:E,interpolate:D,scale:I,pivot:T}=e;if(D){let O=E===void 0?D:go(D.length===1?Xm(D):D,E);w=_(I.copy(),Cn(we(l,i-a),Math.min(M.length+(T!==void 0),E===void 0?1/0:E.length)));let L=256,S=y.document.createElement("canvas");S.width=L,S.height=1;let A=S.getContext("2d");for(let N=0,k=L-1;N<L;++N)A.fillStyle=O(N/k),A.fillRect(N,0,1,1);x.append("image").attr("opacity",m).attr("x",l).attr("y",s).attr("width",i-l-a).attr("height",o-s-c).attr("preserveAspectRatio","none").attr("xlink:href",S.toDataURL())}else if(v==="threshold"){let O=M,L=d===void 0?S=>S:typeof d=="string"?ci(d):d;w=_(Rs().domain([-1,E.length-1]),[l,i-a]),x.append("g").attr("fill-opacity",m).selectAll().data(E).enter().append("rect").attr("x",(S,A)=>w(A-1)).attr("y",s).attr("width",(S,A)=>w(A)-w(A-1)).attr("height",o-s-c).attr("fill",S=>S),f=Xt(O,(S,A)=>A),d=S=>L(O[S],S)}else w=_(ja().domain(M),[l,i-a]),x.append("g").attr("fill-opacity",m).selectAll().data(M).enter().append("rect").attr("x",w).attr("y",s).attr("width",Math.max(0,w.bandwidth()-1)).attr("height",o-s-c).attr("fill",I),b=()=>{};return x.append("g").attr("transform",`translate(0,${o-c})`).call(jS(w).ticks(Array.isArray(f)?null:f,typeof d=="string"?d:void 0).tickFormat(typeof d=="function"?d:void 0).tickSize(r).tickValues(Array.isArray(f)?f:null)).attr("font-size",null).attr("font-family",null).attr("font-variant",le(h,"normal")).call(b).call(O=>O.select(".domain").remove()),n!==void 0&&x.append("text").attr("x",l).attr("y",s-6).attr("fill","currentColor").attr("font-weight","bold").text(n),x.node()}var Vf=Math.PI/180;function Xi(e,{marker:t,markerStart:n=t,markerMid:r=t,markerEnd:i=t}={}){e.markerStart=DT(n),e.markerMid=DT(r),e.markerEnd=DT(i)}function DT(e){if(e==null||e===!1)return null;if(e===!0)return g7;if(typeof e=="function")return e;switch(`${e}`.toLowerCase()){case"none":return null;case"arrow":return y7("auto");case"arrow-reverse":return y7("auto-start-reverse");case"dot":return sQ;case"circle":case"circle-fill":return g7;case"circle-stroke":return aQ;case"tick":return OT("auto");case"tick-x":return OT(90);case"tick-y":return OT(0)}throw new Error(`invalid marker: ${e}`)}function y7(e){return(t,n)=>ct("svg:marker",n).attr("viewBox","-5 -5 10 10").attr("markerWidth",6.67).attr("markerHeight",6.67).attr("orient",e).attr("fill","none").attr("stroke",t).attr("stroke-width",1.5).attr("stroke-linecap","round").attr("stroke-linejoin","round").call(r=>r.append("path").attr("d","M-1.5,-3l3,3l-3,3")).node()}function sQ(e,t){return ct("svg:marker",t).attr("viewBox","-5 -5 10 10").attr("markerWidth",6.67).attr("markerHeight",6.67).attr("fill",e).attr("stroke","none").call(n=>n.append("circle").attr("r",2.5)).node()}function g7(e,t){return ct("svg:marker",t).attr("viewBox","-5 -5 10 10").attr("markerWidth",6.67).attr("markerHeight",6.67).attr("fill",e).attr("stroke","var(--plot-background)").attr("stroke-width",1.5).call(n=>n.append("circle").attr("r",3)).node()}function aQ(e,t){return ct("svg:marker",t).attr("viewBox","-5 -5 10 10").attr("markerWidth",6.67).attr("markerHeight",6.67).attr("fill","var(--plot-background)").attr("stroke",e).attr("stroke-width",1.5).call(n=>n.append("circle").attr("r",3)).node()}function OT(e){return(t,n)=>ct("svg:marker",n).attr("viewBox","-3 -3 6 6").attr("markerWidth",6).attr("markerHeight",6).attr("orient",e).attr("stroke",t).call(r=>r.append("path").attr("d","M0,-3v6")).node()}var cQ=0;function ra(e,t,{stroke:n},r){return b7(e,t,n&&(i=>n[i]),r)}function x7(e,t,{stroke:n},r){return b7(e,t,n&&(([i])=>n[i]),r)}function b7(e,{markerStart:t,markerMid:n,markerEnd:r,stroke:i},o=()=>i,s){let a=new Map;function c(l){return function(u){let f=o(u),d=a.get(l);d||a.set(l,d=new Map);let h=d.get(f);if(!h){let p=this.parentNode.insertBefore(l(f,s),this),m=`plot-marker-${++cQ}`;p.setAttribute("id",m),d.set(f,h=`url(#${m})`)}return h}}t&&e.attr("marker-start",c(t)),n&&e.attr("marker-mid",c(n)),r&&e.attr("marker-end",c(r))}function Ol({inset:e,insetLeft:t,insetRight:n,...r}={}){return[t,n]=w7(e,t,n),{inset:e,insetLeft:t,insetRight:n,...r}}function Bl({inset:e,insetTop:t,insetBottom:n,...r}={}){return[t,n]=w7(e,t,n),{inset:e,insetTop:t,insetBottom:n,...r}}function w7(e,t,n){return e===void 0&&t===void 0&&n===void 0?Be?[1,0]:[.5,.5]:[t,n]}function v7(e,{interval:t}){return e={...pi(e)},e.interval=Tf(e.interval===void 0?t:e.interval),e}function kw(e,t,n,r){let{[e]:i,[`${e}1`]:o,[`${e}2`]:s}=n,{value:a,interval:c}=v7(i,n);if(a==null||c==null&&!r)return n;let l=En(i);if(c==null){let h,p={transform:m=>h||(h=pt(m,a)),label:l};return{...n,[e]:void 0,[`${e}1`]:o===void 0?p:o,[`${e}2`]:s===void 0&&!(o===s&&r)?p:s}}let u,f;function d(h){return f!==void 0&&h===u?f:f=Xt(pt(u=h,a),p=>c.floor(p))}return t({...n,[e]:void 0,[`${e}1`]:o===void 0?{transform:d,label:l}:o,[`${e}2`]:s===void 0?{transform:h=>d(h).map(p=>c.offset(p)),label:l}:s})}function _7(e,t,n){let{[e]:r}=n,{value:i,interval:o}=v7(r,n);return i==null||o==null?n:t({...n,[e]:{label:En(r),transform:s=>{let a=Xt(pt(s,i),l=>o.floor(l)),c=a.map(l=>o.offset(l));return a.map(Oe(a)?(l,u)=>l==null||isNaN(l=+l)||(u=c[u],u==null)||isNaN(u=+u)?void 0:new Date((l+u)/2):(l,u)=>l==null||(u=c[u],u==null)?NaN:(+l+ +u)/2)}}})}function BT(e={}){return kw("x",Ol,e,!0)}function LT(e={}){return kw("y",Bl,e,!0)}function Fw(e={}){return kw("x",Ol,e)}function Rw(e={}){return kw("y",Bl,e)}function $w(e={}){return _7("x",Ol,e)}function Pw(e={}){return _7("y",Bl,e)}var S7={ariaLabel:"rule",fill:null,stroke:"currentColor"},Wm=class extends vt{constructor(t,n={}){let{x:r,y1:i,y2:o,inset:s=0,insetTop:a=s,insetBottom:c=s}=n;super(t,{x:{value:r,scale:"x",optional:!0},y1:{value:i,scale:"y",optional:!0},y2:{value:o,scale:"y",optional:!0}},Yi(n,"x"),S7),this.insetTop=Nt(a),this.insetBottom=Nt(c),Xi(this,n)}render(t,n,r,i,o){let{x:s,y:a}=n,{x:c,y1:l,y2:u}=r,{width:f,height:d,marginTop:h,marginRight:p,marginLeft:m,marginBottom:g}=i,{insetTop:y,insetBottom:x}=this;return ct("svg:g",o).call(Ct,this,i,o).call(It,this,{x:c&&s},Be,0).call(b=>b.selectAll().data(t).enter().append("line").call(Dt,this).attr("x1",c?w=>c[w]:(m+f-p)/2).attr("x2",c?w=>c[w]:(m+f-p)/2).attr("y1",l&&!sr(a)?w=>l[w]+y:h+y).attr("y2",u&&!sr(a)?a.bandwidth?w=>u[w]+a.bandwidth()-x:w=>u[w]-x:d-g-x).call(Jt,this,r).call(ra,this,r,o)).node()}},Hm=class extends vt{constructor(t,n={}){let{x1:r,x2:i,y:o,inset:s=0,insetRight:a=s,insetLeft:c=s}=n;super(t,{y:{value:o,scale:"y",optional:!0},x1:{value:r,scale:"x",optional:!0},x2:{value:i,scale:"x",optional:!0}},Yi(n,"y"),S7),this.insetRight=Nt(a),this.insetLeft=Nt(c),Xi(this,n)}render(t,n,r,i,o){let{x:s,y:a}=n,{y:c,x1:l,x2:u}=r,{width:f,height:d,marginTop:h,marginRight:p,marginLeft:m,marginBottom:g}=i,{insetLeft:y,insetRight:x}=this;return ct("svg:g",o).call(Ct,this,i,o).call(It,this,{y:c&&a},0,Be).call(b=>b.selectAll().data(t).enter().append("line").call(Dt,this).attr("x1",l&&!sr(s)?w=>l[w]+y:m+y).attr("x2",u&&!sr(s)?s.bandwidth?w=>u[w]+s.bandwidth()-x:w=>u[w]-x:f-p-x).attr("y1",c?w=>c[w]:(h+d-g)/2).attr("y2",c?w=>c[w]:(h+d-g)/2).call(Jt,this,r).call(ra,this,r,o)).node()}};function Vr(e,t){let{x:n=G,y:r,y1:i,y2:o,...s}=Rw(t);return[i,o]=I7(r,i,o),new Wm(e,{...s,x:n,y1:i,y2:o})}function Yr(e,t){let{y:n=G,x:r,x1:i,x2:o,...s}=Fw(t);return[i,o]=I7(r,i,o),new Hm(e,{...s,y:n,x1:i,x2:o})}function I7(e,t,n){if(e==null){if(t===void 0){if(n!==void 0)return[0,n]}else if(n===void 0)return[0,t]}else{if(t===void 0)return n===void 0?[0,e]:[e,n];if(n===void 0)return[e,t]}return[t,n]}function ac(e,...t){let n=t.length;for(let r=0,i=!0;r<n;++r)typeof t[r]!="function"&&(i&&(e=e.slice(),i=!1),e.splice(r,2,e[r]+t[r]+e[r+1]),t.splice(r,1),--r,--n);return r=>{let i=e[0];for(let o=0;o<n;++o)i+=t[o](r)+e[o+1];return i}}var lQ={ariaLabel:"text",strokeLinejoin:"round",strokeWidth:3,paintOrder:"stroke"},N7="\xAD",Cl=class extends vt{constructor(t,n={}){let{x:r,y:i,text:o=or(t)&&aw(t)?G:Ae,frameAnchor:s,textAnchor:a=/right$/i.test(s)?"end":/left$/i.test(s)?"start":"middle",lineAnchor:c=/^top/i.test(s)?"top":/^bottom/i.test(s)?"bottom":"middle",lineHeight:l=1,lineWidth:u=1/0,textOverflow:f,monospace:d,fontFamily:h=d?"ui-monospace, monospace":void 0,fontSize:p,fontStyle:m,fontVariant:g,fontWeight:y,rotate:x}=n,[b,w]=ie(x,0),[_,v]=hQ(p);if(super(t,{x:{value:r,scale:"x",optional:!0},y:{value:i,scale:"y",optional:!0},fontSize:{value:_,optional:!0},rotate:{value:kF(b),optional:!0},text:{value:o,filter:Bm,optional:!0}},n,lQ),this.rotate=w,this.textAnchor=le(a,"middle"),this.lineAnchor=Qe(c,"lineAnchor",["top","middle","bottom"]),this.lineHeight=+l,this.lineWidth=+u,this.textOverflow=kT(f),this.monospace=!!d,this.fontFamily=ze(h),this.fontSize=v,this.fontStyle=ze(m),this.fontVariant=ze(g),this.fontWeight=ze(y),this.frameAnchor=Fo(s),!(this.lineWidth>=0))throw new Error(`invalid lineWidth: ${u}`);this.splitLines=RT(this),this.clipLine=$T(this)}render(t,n,r,i,o){let{x:s,y:a}=n,{x:c,y:l,rotate:u,text:f,title:d,fontSize:h}=r,{rotate:p}=this,[m,g]=pn(this,i);return ct("svg:g",o).call(Ct,this,i,o).call(FT,this,f,i).call(It,this,{x:c&&s,y:l&&a}).call(y=>y.selectAll().data(t).enter().append("text").call(Dt,this).call(uQ,this,f,d).attr("transform",ac`translate(${c?x=>c[x]:m},${l?x=>l[x]:g})${u?x=>` rotate(${u[x]})`:p?` rotate(${p})`:""}`).call(ft,"font-size",h&&(x=>h[x])).call(Jt,this,r)).node()}};function kT(e){return e==null?null:Qe(e,"textOverflow",["clip","ellipsis","clip-start","clip-end","ellipsis-start","ellipsis-middle","ellipsis-end"]).replace(/^(clip|ellipsis)$/,"$1-end")}function uQ(e,t,n,r){if(!n)return;let{lineAnchor:i,lineHeight:o,textOverflow:s,splitLines:a,clipLine:c}=t;e.each(function(l){let u=a(ji(n[l])??"").map(c),f=u.length,d=i==="top"?.71:i==="bottom"?1-f:(164-f*100)/200;if(f>1){let h=0;for(let p=0;p<f;++p){if(++h,!u[p])continue;let m=this.ownerDocument.createElementNS(ii.svg,"tspan");m.setAttribute("x",0),p===h-1?m.setAttribute("y",`${(d+p)*o}em`):m.setAttribute("dy",`${h*o}em`),m.textContent=u[p],this.appendChild(m),h=0}}else d&&this.setAttribute("y",`${d*o}em`),this.textContent=u[0];if(s&&!r&&u[0]!==n[l]){let h=this.ownerDocument.createElementNS(ii.svg,"title");h.textContent=n[l],this.appendChild(h)}})}function Po(e,{x:t,y:n,...r}={}){return r.frameAnchor===void 0&&([t,n]=Re(t,n)),new Cl(e,{...r,x:t,y:n})}function Uw(e,{x:t=G,...n}={}){return new Cl(e,Pw({...n,x:t}))}function zw(e,{y:t=G,...n}={}){return new Cl(e,$w({...n,y:t}))}function FT(e,t,n){ft(e,"text-anchor",t.textAnchor),ft(e,"font-family",t.fontFamily),ft(e,"font-size",t.fontSize),ft(e,"font-style",t.fontStyle),ft(e,"font-variant",t.fontVariant===void 0?fQ(n):t.fontVariant),ft(e,"font-weight",t.fontWeight)}function fQ(e){return e&&(Js(e)||Oe(e))?"tabular-nums":void 0}var dQ=new Set(["inherit","initial","revert","unset","xx-small","x-small","small","medium","large","x-large","xx-large","xxx-large","larger","smaller"]);function hQ(e){return e==null||typeof e=="number"?[void 0,e]:typeof e!="string"?[e,void 0]:(e=e.trim().toLowerCase(),dQ.has(e)||/^[+-]?\d*\.?\d+(e[+-]?\d+)?(\w*|%)$/.test(e)?[void 0,e]:[e,void 0])}function pQ(e,t,n){let r=[],i,o=0;for(let[s,a,c]of mQ(e)){if(i===void 0&&(i=s),o>i&&n(e,i,a)>t&&(r.push(e.slice(i,o)+(e[o-1]===N7?"-":"")),i=s),c){r.push(e.slice(i,a)),i=void 0;continue}o=a}return r}function*mQ(e){let t=0,n=0,r=e.length;for(;n<r;){let i=1;switch(e[n]){case N7:case"-":++n,yield[t,n,!1],t=n;break;case" ":for(yield[t,n,!1];e[++n]===" ";);t=n;break;case"\r":e[n+1]===`
26
26
  `&&++i;case`
27
- `:yield[t,n,!0],n+=i,t=n;break;default:++n;break}}yield[t,n,!0]}var e7={a:56,b:63,c:57,d:63,e:58,f:37,g:62,h:60,i:26,j:26,k:55,l:26,m:88,n:60,o:60,p:62,q:62,r:39,s:54,t:38,u:60,v:55,w:79,x:54,y:55,z:55,A:69,B:67,C:73,D:74,E:61,F:58,G:76,H:75,I:28,J:55,K:67,L:58,M:89,N:75,O:78,P:65,Q:78,R:67,S:65,T:65,U:75,V:69,W:98,X:69,Y:67,Z:67,0:64,1:48,2:62,3:64,4:66,5:63,6:65,7:58,8:65,9:65," ":29,"!":32,'"':49,"'":31,"(":39,")":39,",":31,"-":48,".":31,"/":32,":":31,";":31,"?":52,"\u2018":31,"\u2019":31,"\u201C":47,"\u201D":47,"\u2026":82};function Uw(e,t=0,n=e.length){let r=0;for(let i=t;i<n;i=qf(e,i))r+=e7[e[i]]??(a7(e,i)?120:e7.e);return r}function zw(e,t=0,n=e.length){let r=0;for(let i=t;i<n;i=qf(e,i))r+=a7(e,i)?126:63;return r}function kA({monospace:e,lineWidth:t,textOverflow:n}){if(n!=null||t==1/0)return o=>o.split(/\r\n?|\n/g);let r=e?zw:Uw,i=t*100;return o=>CJ(o,i,r)}function CA({monospace:e,lineWidth:t,textOverflow:n}){if(n==null||t==1/0)return o=>o;let r=e?zw:Uw,i=t*100;switch(n){case"clip-start":return o=>r7(o,i,r,"");case"clip-end":return o=>n7(o,i,r,"");case"ellipsis-start":return o=>r7(o,i,r,Bl);case"ellipsis-middle":return o=>RJ(o,i,r,Bl);case"ellipsis-end":return o=>n7(o,i,r,Bl)}}var Bl="\u2026";function kl(e,t,n,r){let i=[],o=0;for(let s=0,a=0,c=e.length;s<c;s=a){a=qf(e,s);let l=n(e,s,a);if(o+l>t){for(o+=r;o>t&&s>0;)a=s,s=i.pop(),o-=n(e,s,a);return[s,t-o]}o+=l,i.push(s)}return[-1,0]}function n7(e,t,n,r){e=e.trim();let i=n(r),[o]=kl(e,t,n,i);return o<0?e:e.slice(0,o).trimEnd()+r}function RJ(e,t,n,r){e=e.trim();let i=n(e);if(i<=t)return e;let o=n(r)/2,[s,a]=kl(e,t/2,n,o),[c]=kl(e,i-t/2-a+o,n,-o);return c<0?r:e.slice(0,s).trimEnd()+r+e.slice(qf(e,c)).trimStart()}function r7(e,t,n,r){e=e.trim();let i=n(e);if(i<=t)return e;let o=n(r),[s]=kl(e,i-t+o,n,-o);return s<0?r:r+e.slice(qf(e,s)).trimStart()}var OA=/[\p{Combining_Mark}\p{Emoji_Modifier}]+/uy,i7=/\p{Extended_Pictographic}/uy;function qf(e,t){return t+=$J(e,t)?2:1,UJ(e,t)&&(t=OA.lastIndex),PJ(e,t)?qf(e,t+1):t}function s7(e,t){return e.charCodeAt(t)<128}function $J(e,t){let n=e.charCodeAt(t);if(n>=55296&&n<56320){let r=e.charCodeAt(t+1);return r>=56320&&r<57344}return!1}function PJ(e,t){return e.charCodeAt(t)===8205}function UJ(e,t){return s7(e,t)?!1:(OA.lastIndex=t,OA.test(e))}function a7(e,t){return s7(e,t)?!1:(i7.lastIndex=t,i7.test(e))}var c7={ariaLabel:"vector",fill:"none",stroke:"currentColor",strokeWidth:1.5,strokeLinejoin:"round",strokeLinecap:"round"},l7=3.5,zJ=l7*5,u7={draw(e,t,n){let r=t*n/zJ;e.moveTo(0,0),e.lineTo(0,-t),e.moveTo(-r,r-t),e.lineTo(0,-t),e.lineTo(r,r-t)}},f7={draw(e,t,n){e.moveTo(-n,0),e.lineTo(0,-t),e.lineTo(n,0)}},jJ=new Map([["arrow",u7],["spike",f7]]);function qJ(e){return e&&typeof e.draw=="function"}function VJ(e){if(qJ(e))return e;let t=jJ.get(`${e}`.toLowerCase());if(t)return t;throw new Error(`invalid shape: ${e}`)}var Cl=class extends vt{constructor(t,n={}){let{x:r,y:i,r:o=l7,length:s,rotate:a,shape:c=u7,anchor:l="middle",frameAnchor:u}=n,[f,d]=ie(s,12),[h,p]=ie(a,0);super(t,{x:{value:r,scale:"x",optional:!0},y:{value:i,scale:"y",optional:!0},length:{value:f,scale:"length",optional:!0},rotate:{value:h,optional:!0}},n,c7),this.r=+o,this.length=d,this.rotate=p,this.shape=VJ(c),this.anchor=Qe(l,"anchor",["start","middle","end"]),this.frameAnchor=Co(u)}render(t,n,r,i,o){let{x:s,y:a}=n,{x:c,y:l,length:u,rotate:f}=r,{length:d,rotate:h,anchor:p,shape:m,r:g}=this,[y,x]=pn(this,i);return ct("svg:g",o).call(kt,this,i,o).call(It,this,{x:c&&s,y:l&&a}).call(b=>b.selectAll().data(t).enter().append("path").call(Dt,this).attr("transform",oc`translate(${c?w=>c[w]:y},${l?w=>l[w]:x})${f?w=>` rotate(${f[w]})`:h?` rotate(${h})`:""}${p==="start"?"":p==="end"?u?w=>` translate(0,${u[w]})`:` translate(0,${d})`:u?w=>` translate(0,${u[w]/2})`:` translate(0,${d/2})`}`).attr("d",u?w=>{let _=Zn();return m.draw(_,u[w],g),_}:(()=>{let w=Zn();return m.draw(w,d,g),w})()).call(Jt,this,r)).node()}};function FA(e,t={}){let{x:n,y:r,...i}=t;return t.frameAnchor===void 0&&([n,r]=Re(n,r)),new Cl(e,{...i,x:n,y:r})}function jw(e,t={}){let{x:n=G,...r}=t;return new Cl(e,{...r,x:n})}function qw(e,t={}){let{y:n=G,...r}=t;return new Cl(e,{...r,y:n})}function d7(e,t={}){let{shape:n=f7,stroke:r=c7.stroke,strokeWidth:i=1,fill:o=r,fillOpacity:s=.3,anchor:a="start",...c}=t;return FA(e,{...c,shape:n,stroke:r,strokeWidth:i,fill:o,fillOpacity:s,anchor:a})}function sc(e,t){return arguments.length<2&&!rr(e)&&(t=e,e=null),t===void 0&&(t={}),[e,t]}function Vw({anchor:e}={},t){return e===void 0?t[0]:Qe(e,"anchor",t)}function h7(e){return Vw(e,["left","right"])}function p7(e){return Vw(e,["right","left"])}function m7(e){return Vw(e,["bottom","top"])}function y7(e){return Vw(e,["top","bottom"])}function Hm(){let[e,t]=sc(...arguments);return g7("y",h7(t),e,t)}function Yw(){let[e,t]=sc(...arguments);return g7("fy",p7(t),e,t)}function Zm(){let[e,t]=sc(...arguments);return x7("x",m7(t),e,t)}function Xw(){let[e,t]=sc(...arguments);return x7("fx",y7(t),e,t)}function g7(e,t,n,{color:r="currentColor",opacity:i=1,stroke:o=r,strokeOpacity:s=i,strokeWidth:a=1,fill:c=r,fillOpacity:l=i,textAnchor:u,textStroke:f,textStrokeOpacity:d,textStrokeWidth:h,tickSize:p=e==="y"?6:0,tickPadding:m,tickRotate:g,x:y,margin:x,marginTop:b=x===void 0?20:x,marginRight:w=x===void 0?t==="right"?40:0:x,marginBottom:_=x===void 0?20:x,marginLeft:v=x===void 0?t==="left"?40:0:x,label:M,labelAnchor:E,labelArrow:D,labelOffset:I,...T}){return p=Nt(p),m=Nt(m),g=Nt(g),E!==void 0&&(E=Qe(E,"labelAnchor",["center","top","bottom"])),D=T7(D),Ke(p&&!ne(o)?YJ(e,t,n,{stroke:o,strokeOpacity:s,strokeWidth:a,tickSize:p,tickPadding:m,tickRotate:g,x:y,...T}):null,ne(c)?null:GJ(e,t,n,{fill:c,fillOpacity:l,stroke:f,strokeOpacity:d,strokeWidth:h,textAnchor:u,tickSize:p,tickPadding:m,tickRotate:g,x:y,marginTop:b,marginRight:w,marginBottom:_,marginLeft:v,...T}),!ne(c)&&M!==null?Po([],_7({fill:c,fillOpacity:l,...T},function(O,B,S,A,N){let k=A[e],{marginTop:R,marginRight:F,marginBottom:$,marginLeft:P}=e==="y"&&N.inset||N,U=E??(k.bandwidth?"center":"top"),W=I??(t==="right"?F:P)-3;return U==="center"?(this.textAnchor=void 0,this.lineAnchor=t==="right"?"bottom":"top",this.frameAnchor=t,this.rotate=-90):(this.textAnchor=t==="right"?"end":"start",this.lineAnchor=U,this.frameAnchor=`${U}-${t}`,this.rotate=0),this.dy=U==="top"?3-R:U==="bottom"?$-3:0,this.dx=t==="right"?W:-W,this.ariaLabel=`${e}-axis label`,{facets:[[0]],channels:{text:{value:[M7(e,k,{anchor:t,label:M,labelAnchor:U,labelArrow:D})]}}}})):null)}function x7(e,t,n,{color:r="currentColor",opacity:i=1,stroke:o=r,strokeOpacity:s=i,strokeWidth:a=1,fill:c=r,fillOpacity:l=i,textAnchor:u,textStroke:f,textStrokeOpacity:d,textStrokeWidth:h,tickSize:p=e==="x"?6:0,tickPadding:m,tickRotate:g,y,margin:x,marginTop:b=x===void 0?t==="top"?30:0:x,marginRight:w=x===void 0?20:x,marginBottom:_=x===void 0?t==="bottom"?30:0:x,marginLeft:v=x===void 0?20:x,label:M,labelAnchor:E,labelArrow:D,labelOffset:I,...T}){return p=Nt(p),m=Nt(m),g=Nt(g),E!==void 0&&(E=Qe(E,"labelAnchor",["center","left","right"])),D=T7(D),Ke(p&&!ne(o)?XJ(e,t,n,{stroke:o,strokeOpacity:s,strokeWidth:a,tickSize:p,tickPadding:m,tickRotate:g,y,...T}):null,ne(c)?null:WJ(e,t,n,{fill:c,fillOpacity:l,stroke:f,strokeOpacity:d,strokeWidth:h,textAnchor:u,tickSize:p,tickPadding:m,tickRotate:g,y,marginTop:b,marginRight:w,marginBottom:_,marginLeft:v,...T}),!ne(c)&&M!==null?Po([],_7({fill:c,fillOpacity:l,...T},function(O,B,S,A,N){let k=A[e],{marginTop:R,marginRight:F,marginBottom:$,marginLeft:P}=e==="x"&&N.inset||N,U=E??(k.bandwidth?"center":"right"),W=I??(t==="top"?R:$)-3;return U==="center"?(this.frameAnchor=t,this.textAnchor=void 0):(this.frameAnchor=`${t}-${U}`,this.textAnchor=U==="right"?"end":"start"),this.lineAnchor=t,this.dy=t==="top"?-W:W,this.dx=U==="right"?F-3:U==="left"?3-P:0,this.ariaLabel=`${e}-axis label`,{facets:[[0]],channels:{text:{value:[M7(e,k,{anchor:t,label:M,labelAnchor:U,labelArrow:D})]}}}})):null)}function YJ(e,t,n,{strokeWidth:r=1,strokeLinecap:i=null,strokeLinejoin:o=null,facetAnchor:s=t+(e==="y"?"-empty":""),frameAnchor:a=t,tickSize:c,inset:l=0,insetLeft:u=l,insetRight:f=l,dx:d=0,y:h=e==="y"?void 0:null,...p}){return Vf(qw,e,t,`${e}-axis tick`,n,{strokeWidth:r,strokeLinecap:i,strokeLinejoin:o,facetAnchor:s,frameAnchor:a,y:h,...p,dx:t==="left"?+d-Be+ +u:+d+Be-f,anchor:"start",length:c,shape:t==="left"?QJ:KJ})}function XJ(e,t,n,{strokeWidth:r=1,strokeLinecap:i=null,strokeLinejoin:o=null,facetAnchor:s=t+(e==="x"?"-empty":""),frameAnchor:a=t,tickSize:c,inset:l=0,insetTop:u=l,insetBottom:f=l,dy:d=0,x:h=e==="x"?void 0:null,...p}){return Vf(jw,e,t,`${e}-axis tick`,n,{strokeWidth:r,strokeLinejoin:o,strokeLinecap:i,facetAnchor:s,frameAnchor:a,x:h,...p,dy:t==="bottom"?+d-Be-f:+d+Be+ +u,anchor:"start",length:c,shape:t==="bottom"?ZJ:JJ})}function GJ(e,t,n,{facetAnchor:r=t+(e==="y"?"-empty":""),frameAnchor:i=t,tickSize:o,tickRotate:s=0,tickPadding:a=Math.max(3,9-o)+(Math.abs(s)>60?4*Math.cos(s*jf):0),text:c,textAnchor:l=Math.abs(s)>60?"middle":t==="left"?"end":"start",lineAnchor:u=s>60?"top":s<-60?"bottom":"middle",fontVariant:f,inset:d=0,insetLeft:h=d,insetRight:p=d,dx:m=0,y:g=e==="y"?void 0:null,...y}){return Vf(Pw,e,t,`${e}-axis tick label`,n,{facetAnchor:r,frameAnchor:i,text:c,textAnchor:l,lineAnchor:u,fontVariant:f,rotate:s,y:g,...y,dx:t==="left"?+m-o-a+ +h:+m+ +o+ +a-p},function(x,b,w,_,v){f===void 0&&(this.fontVariant=I7(x)),c===void 0&&(v.text=S7(x,b,w,_,t))})}function WJ(e,t,n,{facetAnchor:r=t+(e==="x"?"-empty":""),frameAnchor:i=t,tickSize:o,tickRotate:s=0,tickPadding:a=Math.max(3,9-o)+(Math.abs(s)>=10?4*Math.cos(s*jf):0),text:c,textAnchor:l=Math.abs(s)>=10?s<0^t==="bottom"?"start":"end":"middle",lineAnchor:u=Math.abs(s)>=10?"middle":t==="bottom"?"top":"bottom",fontVariant:f,inset:d=0,insetTop:h=d,insetBottom:p=d,dy:m=0,x:g=e==="x"?void 0:null,...y}){return Vf($w,e,t,`${e}-axis tick label`,n,{facetAnchor:r,frameAnchor:i,text:c===void 0?null:c,textAnchor:l,lineAnchor:u,fontVariant:f,rotate:s,x:g,...y,dy:t==="bottom"?+m+ +o+ +a-p:+m-o-a+ +h},function(x,b,w,_,v){f===void 0&&(this.fontVariant=I7(x)),c===void 0&&(v.text=S7(x,b,w,_,t))})}function Gw(){let[e,t]=sc(...arguments);return b7("y",h7(t),e,t)}function Ww(){let[e,t]=sc(...arguments);return b7("fy",p7(t),e,t)}function Hw(){let[e,t]=sc(...arguments);return w7("x",m7(t),e,t)}function Zw(){let[e,t]=sc(...arguments);return w7("fx",y7(t),e,t)}function b7(e,t,n,{y:r=e==="y"?void 0:null,x:i=null,x1:o=t==="left"?i:null,x2:s=t==="right"?i:null,...a}){return Vf(Vr,e,t,`${e}-grid`,n,{y:r,x1:o,x2:s,...v7(a)})}function w7(e,t,n,{x:r=e==="x"?void 0:null,y:i=null,y1:o=t==="top"?i:null,y2:s=t==="bottom"?i:null,...a}){return Vf(qr,e,t,`${e}-grid`,n,{x:r,y1:o,y2:s,...v7(a)})}function v7({color:e="currentColor",opacity:t=.1,stroke:n=e,strokeOpacity:r=t,strokeWidth:i=1,...o}){return{stroke:n,strokeOpacity:r,strokeWidth:i,...o}}function _7({fill:e,fillOpacity:t,fontFamily:n,fontSize:r,fontStyle:i,fontVariant:o,fontWeight:s,monospace:a,pointerEvents:c,shapeRendering:l,clip:u=!1},f){return[,e]=De(e),[,t]=ie(t),{facet:"super",x:null,y:null,fill:e,fillOpacity:t,fontFamily:n,fontSize:r,fontStyle:i,fontVariant:o,fontWeight:s,monospace:a,pointerEvents:c,shapeRendering:l,clip:u,initializer:f}}function Vf(e,t,n,r,i,o,s){let a;function c(f,d,h,p,m,g){let y=f==null&&(t==="fx"||t==="fy"),{[t]:x}=p;if(!x)throw new Error(`missing scale: ${t}`);let b=x.domain(),{interval:w,ticks:_,tickFormat:v,tickSpacing:M=t==="x"?80:35}=o;if(typeof _=="string"&&A7(x)&&(w=_,_=void 0),_===void 0&&(_=ko(w,x.type)??HJ(x,M)),f==null){if(rr(_))f=je(_);else if(Ja(_))f=RA(_,...ae(b));else if(x.interval){let D=x.interval;if(x.ticks){let[I,T]=ae(b),O=(T-I)/D[vf];D=CT(D,O/_)??D,f=RA(D,I,T)}else{f=b;let I=f.length;D=CT(D,I/_)??D,D!==x.interval&&(f=RA(D,...ae(f)))}if(D===x.interval){let I=Math.round(f.length/_);I>1&&(f=f.filter((T,O)=>O%I===0))}}else x.ticks?f=x.ticks(_):f=b;if(!x.ticks&&f.length&&f!==b){let D=new kr(b);f=f.filter(I=>D.has(I)),f.length||Un(`Warning: the ${t}-axis ticks appear to not align with the scale domain, resulting in no ticks. Try different ticks?`)}t==="y"||t==="x"?d=[nr(f)]:a[t]={scale:t,value:G}}s?.call(this,x,f,_,v,a);let E=Object.fromEntries(Object.entries(a).map(([D,I])=>[D,{...I,value:pt(f,I.value)}]));return y&&(d=g.filterFacets(f,E)),{data:f,facets:d,channels:E}}let l=_e(o).initializer,u=e(i,_e({...o,initializer:c},l));return i==null?(a=u.channels,u.channels={}):a={},u.ariaLabel=r,u.clip===void 0&&(u.clip=!1),u}function HJ(e,t){let[n,r]=ae(e.range());return(r-n)/t}function S7(e,t,n,r,i){return{value:Jm(e,t,n,r,i)}}function Jm(e,t,n,r,i){return typeof r=="function"?r:r===void 0&&t&&Oe(t)?rF(e.type,t,i)??qi:e.tickFormat?e.tickFormat(typeof n=="number"?n:null,r):r===void 0?qi:typeof r=="string"?(Oe(e.domain())?No:ci)(r):un(r)}function RA(e,t,n){return e.range(t,e.offset(e.floor(n)))}var ZJ={draw(e,t){e.moveTo(0,0),e.lineTo(0,t)}},JJ={draw(e,t){e.moveTo(0,0),e.lineTo(0,-t)}},QJ={draw(e,t){e.moveTo(0,0),e.lineTo(-t,0)}},KJ={draw(e,t){e.moveTo(0,0),e.lineTo(t,0)}};function I7(e){return e.bandwidth&&!e.interval?void 0:"tabular-nums"}function M7(e,t,{anchor:n,label:r=t.label,labelAnchor:i,labelArrow:o}={}){if(!(r==null||r.inferred&&A7(t)&&/^(date|time|year)$/i.test(r))){if(r=String(r),o==="auto"&&(o=(!t.bandwidth||t.interval)&&!/[↑↓→←]/.test(r)),!o)return r;if(o===!0){let s=Mw(t);s&&(o=/x$/.test(e)||i==="center"?/x$/.test(e)===s<0?"left":"right":s<0?"up":"down")}switch(o){case"left":return`\u2190 ${r}`;case"right":return`${r} \u2192`;case"up":return n==="right"?`${r} \u2191`:`\u2191 ${r}`;case"down":return n==="right"?`${r} \u2193`:`\u2193 ${r}`}return r}}function T7(e="auto"){return ne(e)?!1:typeof e=="boolean"?e:Qe(e,"labelArrow",["auto","up","right","down","left"])}function A7(e){return Oe(e.domain())}function E7(e,t){if(t==null)return t;let n=e(t);if(!n)throw new Error(`scale not found: ${t}`);return n}function N7(e,{opacity:t,...n}={}){if(!Ro(e)&&!xA(e))throw new Error(`swatches legend requires ordinal or threshold color scale (not ${e.type})`);return O7(e,n,(r,i,o,s)=>r.append("svg").attr("width",o).attr("height",s).attr("fill",i.scale).attr("fill-opacity",ie(t)[1]).append("rect").attr("width","100%").attr("height","100%"))}function D7(e,{fill:t=e.hint?.fill!==void 0?e.hint.fill:"none",fillOpacity:n=1,stroke:r=e.hint?.stroke!==void 0?e.hint.stroke:ne(t)?"currentColor":"none",strokeOpacity:i=1,strokeWidth:o=1.5,r:s=4.5,...a}={},c){let[l,u]=De(t),[f,d]=De(r),h=E7(c,l),p=E7(c,f),m=s*s*Math.PI;return n=ie(n)[1],i=ie(i)[1],o=ie(o)[1],O7(e,a,(g,y,x,b)=>g.append("svg").attr("viewBox","-8 -8 16 16").attr("width",x).attr("height",b).attr("fill",l==="color"?w=>h.scale(w):u).attr("fill-opacity",n).attr("stroke",f==="color"?w=>p.scale(w):d).attr("stroke-opacity",i).attr("stroke-width",o).append("path").attr("d",w=>{let _=Zn();return e.scale(w).draw(_,m),_}))}function O7(e,t={},n){let{columns:r,tickFormat:i,fontVariant:o=Bw(e),swatchSize:s=15,swatchWidth:a=s,swatchHeight:c=s,marginLeft:l=0,className:u,style:f,width:d}=t,h=nc(t);u=Bf(u),i=Jm(e.scale,e.domain,void 0,i);let p=ct("div",h).attr("class",`${u}-swatches ${u}-swatches-${r!=null?"columns":"wrap"}`),m;return r!=null?(m=`:where(.${u}-swatches-columns .${u}-swatch) {
27
+ `:yield[t,n,!0],n+=i,t=n;break;default:++n;break}}yield[t,n,!0]}var M7={a:56,b:63,c:57,d:63,e:58,f:37,g:62,h:60,i:26,j:26,k:55,l:26,m:88,n:60,o:60,p:62,q:62,r:39,s:54,t:38,u:60,v:55,w:79,x:54,y:55,z:55,A:69,B:67,C:73,D:74,E:61,F:58,G:76,H:75,I:28,J:55,K:67,L:58,M:89,N:75,O:78,P:65,Q:78,R:67,S:65,T:65,U:75,V:69,W:98,X:69,Y:67,Z:67,0:64,1:48,2:62,3:64,4:66,5:63,6:65,7:58,8:65,9:65," ":29,"!":32,'"':49,"'":31,"(":39,")":39,",":31,"-":48,".":31,"/":32,":":31,";":31,"?":52,"\u2018":31,"\u2019":31,"\u201C":47,"\u201D":47,"\u2026":82};function qw(e,t=0,n=e.length){let r=0;for(let i=t;i<n;i=Yf(e,i))r+=M7[e[i]]??(O7(e,i)?120:M7.e);return r}function jw(e,t=0,n=e.length){let r=0;for(let i=t;i<n;i=Yf(e,i))r+=O7(e,i)?126:63;return r}function RT({monospace:e,lineWidth:t,textOverflow:n}){if(n!=null||t==1/0)return o=>o.split(/\r\n?|\n/g);let r=e?jw:qw,i=t*100;return o=>pQ(o,i,r)}function $T({monospace:e,lineWidth:t,textOverflow:n}){if(n==null||t==1/0)return o=>o;let r=e?jw:qw,i=t*100;switch(n){case"clip-start":return o=>T7(o,i,r,"");case"clip-end":return o=>A7(o,i,r,"");case"ellipsis-start":return o=>T7(o,i,r,Ll);case"ellipsis-middle":return o=>yQ(o,i,r,Ll);case"ellipsis-end":return o=>A7(o,i,r,Ll)}}var Ll="\u2026";function kl(e,t,n,r){let i=[],o=0;for(let s=0,a=0,c=e.length;s<c;s=a){a=Yf(e,s);let l=n(e,s,a);if(o+l>t){for(o+=r;o>t&&s>0;)a=s,s=i.pop(),o-=n(e,s,a);return[s,t-o]}o+=l,i.push(s)}return[-1,0]}function A7(e,t,n,r){e=e.trim();let i=n(r),[o]=kl(e,t,n,i);return o<0?e:e.slice(0,o).trimEnd()+r}function yQ(e,t,n,r){e=e.trim();let i=n(e);if(i<=t)return e;let o=n(r)/2,[s,a]=kl(e,t/2,n,o),[c]=kl(e,i-t/2-a+o,n,-o);return c<0?r:e.slice(0,s).trimEnd()+r+e.slice(Yf(e,c)).trimStart()}function T7(e,t,n,r){e=e.trim();let i=n(e);if(i<=t)return e;let o=n(r),[s]=kl(e,i-t+o,n,-o);return s<0?r:r+e.slice(Yf(e,s)).trimStart()}var CT=/[\p{Combining_Mark}\p{Emoji_Modifier}]+/uy,E7=/\p{Extended_Pictographic}/uy;function Yf(e,t){return t+=gQ(e,t)?2:1,bQ(e,t)&&(t=CT.lastIndex),xQ(e,t)?Yf(e,t+1):t}function D7(e,t){return e.charCodeAt(t)<128}function gQ(e,t){let n=e.charCodeAt(t);if(n>=55296&&n<56320){let r=e.charCodeAt(t+1);return r>=56320&&r<57344}return!1}function xQ(e,t){return e.charCodeAt(t)===8205}function bQ(e,t){return D7(e,t)?!1:(CT.lastIndex=t,CT.test(e))}function O7(e,t){return D7(e,t)?!1:(E7.lastIndex=t,E7.test(e))}var B7={ariaLabel:"vector",fill:"none",stroke:"currentColor",strokeWidth:1.5,strokeLinejoin:"round",strokeLinecap:"round"},L7=3.5,wQ=L7*5,C7={draw(e,t,n){let r=t*n/wQ;e.moveTo(0,0),e.lineTo(0,-t),e.moveTo(-r,r-t),e.lineTo(0,-t),e.lineTo(r,r-t)}},k7={draw(e,t,n){e.moveTo(-n,0),e.lineTo(0,-t),e.lineTo(n,0)}},vQ=new Map([["arrow",C7],["spike",k7]]);function _Q(e){return e&&typeof e.draw=="function"}function SQ(e){if(_Q(e))return e;let t=vQ.get(`${e}`.toLowerCase());if(t)return t;throw new Error(`invalid shape: ${e}`)}var Fl=class extends vt{constructor(t,n={}){let{x:r,y:i,r:o=L7,length:s,rotate:a,shape:c=C7,anchor:l="middle",frameAnchor:u}=n,[f,d]=ie(s,12),[h,p]=ie(a,0);super(t,{x:{value:r,scale:"x",optional:!0},y:{value:i,scale:"y",optional:!0},length:{value:f,scale:"length",optional:!0},rotate:{value:h,optional:!0}},n,B7),this.r=+o,this.length=d,this.rotate=p,this.shape=SQ(c),this.anchor=Qe(l,"anchor",["start","middle","end"]),this.frameAnchor=Fo(u)}render(t,n,r,i,o){let{x:s,y:a}=n,{x:c,y:l,length:u,rotate:f}=r,{length:d,rotate:h,anchor:p,shape:m,r:g}=this,[y,x]=pn(this,i);return ct("svg:g",o).call(Ct,this,i,o).call(It,this,{x:c&&s,y:l&&a}).call(b=>b.selectAll().data(t).enter().append("path").call(Dt,this).attr("transform",ac`translate(${c?w=>c[w]:y},${l?w=>l[w]:x})${f?w=>` rotate(${f[w]})`:h?` rotate(${h})`:""}${p==="start"?"":p==="end"?u?w=>` translate(0,${u[w]})`:` translate(0,${d})`:u?w=>` translate(0,${u[w]/2})`:` translate(0,${d/2})`}`).attr("d",u?w=>{let _=Qn();return m.draw(_,u[w],g),_}:(()=>{let w=Qn();return m.draw(w,d,g),w})()).call(Jt,this,r)).node()}};function PT(e,t={}){let{x:n,y:r,...i}=t;return t.frameAnchor===void 0&&([n,r]=Re(n,r)),new Fl(e,{...i,x:n,y:r})}function Vw(e,t={}){let{x:n=G,...r}=t;return new Fl(e,{...r,x:n})}function Yw(e,t={}){let{y:n=G,...r}=t;return new Fl(e,{...r,y:n})}function F7(e,t={}){let{shape:n=k7,stroke:r=B7.stroke,strokeWidth:i=1,fill:o=r,fillOpacity:s=.3,anchor:a="start",...c}=t;return PT(e,{...c,shape:n,stroke:r,strokeWidth:i,fill:o,fillOpacity:s,anchor:a})}function cc(e,t){return arguments.length<2&&!or(e)&&(t=e,e=null),t===void 0&&(t={}),[e,t]}function Xw({anchor:e}={},t){return e===void 0?t[0]:Qe(e,"anchor",t)}function R7(e){return Xw(e,["left","right"])}function $7(e){return Xw(e,["right","left"])}function P7(e){return Xw(e,["bottom","top"])}function U7(e){return Xw(e,["top","bottom"])}function Zm(){let[e,t]=cc(...arguments);return z7("y",R7(t),e,t)}function Gw(){let[e,t]=cc(...arguments);return z7("fy",$7(t),e,t)}function Jm(){let[e,t]=cc(...arguments);return q7("x",P7(t),e,t)}function Ww(){let[e,t]=cc(...arguments);return q7("fx",U7(t),e,t)}function z7(e,t,n,{color:r="currentColor",opacity:i=1,stroke:o=r,strokeOpacity:s=i,strokeWidth:a=1,fill:c=r,fillOpacity:l=i,textAnchor:u,textStroke:f,textStrokeOpacity:d,textStrokeWidth:h,tickSize:p=e==="y"?6:0,tickPadding:m,tickRotate:g,x:y,margin:x,marginTop:b=x===void 0?20:x,marginRight:w=x===void 0?t==="right"?40:0:x,marginBottom:_=x===void 0?20:x,marginLeft:v=x===void 0?t==="left"?40:0:x,label:M,labelAnchor:E,labelArrow:D,labelOffset:I,...T}){return p=Nt(p),m=Nt(m),g=Nt(g),E!==void 0&&(E=Qe(E,"labelAnchor",["center","top","bottom"])),D=Z7(D),Ke(p&&!ne(o)?IQ(e,t,n,{stroke:o,strokeOpacity:s,strokeWidth:a,tickSize:p,tickPadding:m,tickRotate:g,x:y,...T}):null,ne(c)?null:AQ(e,t,n,{fill:c,fillOpacity:l,stroke:f,strokeOpacity:d,strokeWidth:h,textAnchor:u,tickSize:p,tickPadding:m,tickRotate:g,x:y,marginTop:b,marginRight:w,marginBottom:_,marginLeft:v,...T}),!ne(c)&&M!==null?Po([],X7({fill:c,fillOpacity:l,...T},function(O,L,S,A,N){let k=A[e],{marginTop:R,marginRight:F,marginBottom:$,marginLeft:P}=e==="y"&&N.inset||N,U=E??(k.bandwidth?"center":"top"),W=I??(t==="right"?F:P)-3;return U==="center"?(this.textAnchor=void 0,this.lineAnchor=t==="right"?"bottom":"top",this.frameAnchor=t,this.rotate=-90):(this.textAnchor=t==="right"?"end":"start",this.lineAnchor=U,this.frameAnchor=`${U}-${t}`,this.rotate=0),this.dy=U==="top"?3-R:U==="bottom"?$-3:0,this.dx=t==="right"?W:-W,this.ariaLabel=`${e}-axis label`,{facets:[[0]],channels:{text:{value:[H7(e,k,{anchor:t,label:M,labelAnchor:U,labelArrow:D})]}}}})):null)}function q7(e,t,n,{color:r="currentColor",opacity:i=1,stroke:o=r,strokeOpacity:s=i,strokeWidth:a=1,fill:c=r,fillOpacity:l=i,textAnchor:u,textStroke:f,textStrokeOpacity:d,textStrokeWidth:h,tickSize:p=e==="x"?6:0,tickPadding:m,tickRotate:g,y,margin:x,marginTop:b=x===void 0?t==="top"?30:0:x,marginRight:w=x===void 0?20:x,marginBottom:_=x===void 0?t==="bottom"?30:0:x,marginLeft:v=x===void 0?20:x,label:M,labelAnchor:E,labelArrow:D,labelOffset:I,...T}){return p=Nt(p),m=Nt(m),g=Nt(g),E!==void 0&&(E=Qe(E,"labelAnchor",["center","left","right"])),D=Z7(D),Ke(p&&!ne(o)?MQ(e,t,n,{stroke:o,strokeOpacity:s,strokeWidth:a,tickSize:p,tickPadding:m,tickRotate:g,y,...T}):null,ne(c)?null:TQ(e,t,n,{fill:c,fillOpacity:l,stroke:f,strokeOpacity:d,strokeWidth:h,textAnchor:u,tickSize:p,tickPadding:m,tickRotate:g,y,marginTop:b,marginRight:w,marginBottom:_,marginLeft:v,...T}),!ne(c)&&M!==null?Po([],X7({fill:c,fillOpacity:l,...T},function(O,L,S,A,N){let k=A[e],{marginTop:R,marginRight:F,marginBottom:$,marginLeft:P}=e==="x"&&N.inset||N,U=E??(k.bandwidth?"center":"right"),W=I??(t==="top"?R:$)-3;return U==="center"?(this.frameAnchor=t,this.textAnchor=void 0):(this.frameAnchor=`${t}-${U}`,this.textAnchor=U==="right"?"end":"start"),this.lineAnchor=t,this.dy=t==="top"?-W:W,this.dx=U==="right"?F-3:U==="left"?3-P:0,this.ariaLabel=`${e}-axis label`,{facets:[[0]],channels:{text:{value:[H7(e,k,{anchor:t,label:M,labelAnchor:U,labelArrow:D})]}}}})):null)}function IQ(e,t,n,{strokeWidth:r=1,strokeLinecap:i=null,strokeLinejoin:o=null,facetAnchor:s=t+(e==="y"?"-empty":""),frameAnchor:a=t,tickSize:c,inset:l=0,insetLeft:u=l,insetRight:f=l,dx:d=0,y:h=e==="y"?void 0:null,...p}){return Xf(Yw,e,t,`${e}-axis tick`,n,{strokeWidth:r,strokeLinecap:i,strokeLinejoin:o,facetAnchor:s,frameAnchor:a,y:h,...p,dx:t==="left"?+d-Be+ +u:+d+Be-f,anchor:"start",length:c,shape:t==="left"?OQ:BQ})}function MQ(e,t,n,{strokeWidth:r=1,strokeLinecap:i=null,strokeLinejoin:o=null,facetAnchor:s=t+(e==="x"?"-empty":""),frameAnchor:a=t,tickSize:c,inset:l=0,insetTop:u=l,insetBottom:f=l,dy:d=0,x:h=e==="x"?void 0:null,...p}){return Xf(Vw,e,t,`${e}-axis tick`,n,{strokeWidth:r,strokeLinejoin:o,strokeLinecap:i,facetAnchor:s,frameAnchor:a,x:h,...p,dy:t==="bottom"?+d-Be-f:+d+Be+ +u,anchor:"start",length:c,shape:t==="bottom"?NQ:DQ})}function AQ(e,t,n,{facetAnchor:r=t+(e==="y"?"-empty":""),frameAnchor:i=t,tickSize:o,tickRotate:s=0,tickPadding:a=Math.max(3,9-o)+(Math.abs(s)>60?4*Math.cos(s*Vf):0),text:c,textAnchor:l=Math.abs(s)>60?"middle":t==="left"?"end":"start",lineAnchor:u=s>60?"top":s<-60?"bottom":"middle",fontVariant:f,inset:d=0,insetLeft:h=d,insetRight:p=d,dx:m=0,y:g=e==="y"?void 0:null,...y}){return Xf(zw,e,t,`${e}-axis tick label`,n,{facetAnchor:r,frameAnchor:i,text:c,textAnchor:l,lineAnchor:u,fontVariant:f,rotate:s,y:g,...y,dx:t==="left"?+m-o-a+ +h:+m+ +o+ +a-p},function(x,b,w,_,v){f===void 0&&(this.fontVariant=W7(x)),c===void 0&&(v.text=G7(x,b,w,_,t))})}function TQ(e,t,n,{facetAnchor:r=t+(e==="x"?"-empty":""),frameAnchor:i=t,tickSize:o,tickRotate:s=0,tickPadding:a=Math.max(3,9-o)+(Math.abs(s)>=10?4*Math.cos(s*Vf):0),text:c,textAnchor:l=Math.abs(s)>=10?s<0^t==="bottom"?"start":"end":"middle",lineAnchor:u=Math.abs(s)>=10?"middle":t==="bottom"?"top":"bottom",fontVariant:f,inset:d=0,insetTop:h=d,insetBottom:p=d,dy:m=0,x:g=e==="x"?void 0:null,...y}){return Xf(Uw,e,t,`${e}-axis tick label`,n,{facetAnchor:r,frameAnchor:i,text:c===void 0?null:c,textAnchor:l,lineAnchor:u,fontVariant:f,rotate:s,x:g,...y,dy:t==="bottom"?+m+ +o+ +a-p:+m-o-a+ +h},function(x,b,w,_,v){f===void 0&&(this.fontVariant=W7(x)),c===void 0&&(v.text=G7(x,b,w,_,t))})}function Hw(){let[e,t]=cc(...arguments);return j7("y",R7(t),e,t)}function Zw(){let[e,t]=cc(...arguments);return j7("fy",$7(t),e,t)}function Jw(){let[e,t]=cc(...arguments);return V7("x",P7(t),e,t)}function Qw(){let[e,t]=cc(...arguments);return V7("fx",U7(t),e,t)}function j7(e,t,n,{y:r=e==="y"?void 0:null,x:i=null,x1:o=t==="left"?i:null,x2:s=t==="right"?i:null,...a}){return Xf(Yr,e,t,`${e}-grid`,n,{y:r,x1:o,x2:s,...Y7(a)})}function V7(e,t,n,{x:r=e==="x"?void 0:null,y:i=null,y1:o=t==="top"?i:null,y2:s=t==="bottom"?i:null,...a}){return Xf(Vr,e,t,`${e}-grid`,n,{x:r,y1:o,y2:s,...Y7(a)})}function Y7({color:e="currentColor",opacity:t=.1,stroke:n=e,strokeOpacity:r=t,strokeWidth:i=1,...o}){return{stroke:n,strokeOpacity:r,strokeWidth:i,...o}}function X7({fill:e,fillOpacity:t,fontFamily:n,fontSize:r,fontStyle:i,fontVariant:o,fontWeight:s,monospace:a,pointerEvents:c,shapeRendering:l,clip:u=!1},f){return[,e]=De(e),[,t]=ie(t),{facet:"super",x:null,y:null,fill:e,fillOpacity:t,fontFamily:n,fontSize:r,fontStyle:i,fontVariant:o,fontWeight:s,monospace:a,pointerEvents:c,shapeRendering:l,clip:u,initializer:f}}function Xf(e,t,n,r,i,o,s){let a;function c(f,d,h,p,m,g){let y=f==null&&(t==="fx"||t==="fy"),{[t]:x}=p;if(!x)throw new Error(`missing scale: ${t}`);let b=x.domain(),{interval:w,ticks:_,tickFormat:v,tickSpacing:M=t==="x"?80:35}=o;if(typeof _=="string"&&J7(x)&&(w=_,_=void 0),_===void 0&&(_=ko(w,x.type)??EQ(x,M)),f==null){if(or(_))f=qe(_);else if(Ka(_))f=UT(_,...ae(b));else if(x.interval){let D=x.interval;if(x.ticks){let[I,T]=ae(b),O=(T-I)/D[_f];D=$A(D,O/_)??D,f=UT(D,I,T)}else{f=b;let I=f.length;D=$A(D,I/_)??D,D!==x.interval&&(f=UT(D,...ae(f)))}if(D===x.interval){let I=Math.round(f.length/_);I>1&&(f=f.filter((T,O)=>O%I===0))}}else x.ticks?f=x.ticks(_):f=b;if(!x.ticks&&f.length&&f!==b){let D=new Wn(b);f=f.filter(I=>D.has(I)),f.length||zn(`Warning: the ${t}-axis ticks appear to not align with the scale domain, resulting in no ticks. Try different ticks?`)}t==="y"||t==="x"?d=[ir(f)]:a[t]={scale:t,value:G}}s?.call(this,x,f,_,v,a);let E=Object.fromEntries(Object.entries(a).map(([D,I])=>[D,{...I,value:pt(f,I.value)}]));return y&&(d=g.filterFacets(f,E)),{data:f,facets:d,channels:E}}let l=_e(o).initializer,u=e(i,_e({...o,initializer:c},l));return i==null?(a=u.channels,u.channels={}):a={},u.ariaLabel=r,u.clip===void 0&&(u.clip=!1),u}function EQ(e,t){let[n,r]=ae(e.range());return(r-n)/t}function G7(e,t,n,r,i){return{value:Qm(e,t,n,r,i)}}function Qm(e,t,n,r,i){return typeof r=="function"?r:r===void 0&&t&&Oe(t)?TF(e.type,t,i)??ji:e.tickFormat?e.tickFormat(typeof n=="number"?n:null,r):r===void 0?ji:typeof r=="string"?(Oe(e.domain())?Do:ci)(r):un(r)}function UT(e,t,n){return e.range(t,e.offset(e.floor(n)))}var NQ={draw(e,t){e.moveTo(0,0),e.lineTo(0,t)}},DQ={draw(e,t){e.moveTo(0,0),e.lineTo(0,-t)}},OQ={draw(e,t){e.moveTo(0,0),e.lineTo(-t,0)}},BQ={draw(e,t){e.moveTo(0,0),e.lineTo(t,0)}};function W7(e){return e.bandwidth&&!e.interval?void 0:"tabular-nums"}function H7(e,t,{anchor:n,label:r=t.label,labelAnchor:i,labelArrow:o}={}){if(!(r==null||r.inferred&&J7(t)&&/^(date|time|year)$/i.test(r))){if(r=String(r),o==="auto"&&(o=(!t.bandwidth||t.interval)&&!/[↑↓→←]/.test(r)),!o)return r;if(o===!0){let s=Tw(t);s&&(o=/x$/.test(e)||i==="center"?/x$/.test(e)===s<0?"left":"right":s<0?"up":"down")}switch(o){case"left":return`\u2190 ${r}`;case"right":return`${r} \u2192`;case"up":return n==="right"?`${r} \u2191`:`\u2191 ${r}`;case"down":return n==="right"?`${r} \u2193`:`\u2193 ${r}`}return r}}function Z7(e="auto"){return ne(e)?!1:typeof e=="boolean"?e:Qe(e,"labelArrow",["auto","up","right","down","left"])}function J7(e){return Oe(e.domain())}function Q7(e,t){if(t==null)return t;let n=e(t);if(!n)throw new Error(`scale not found: ${t}`);return n}function K7(e,{opacity:t,...n}={}){if(!$o(e)&&!vT(e))throw new Error(`swatches legend requires ordinal or threshold color scale (not ${e.type})`);return e$(e,n,(r,i,o,s)=>r.append("svg").attr("width",o).attr("height",s).attr("fill",i.scale).attr("fill-opacity",ie(t)[1]).append("rect").attr("width","100%").attr("height","100%"))}function t$(e,{fill:t=e.hint?.fill!==void 0?e.hint.fill:"none",fillOpacity:n=1,stroke:r=e.hint?.stroke!==void 0?e.hint.stroke:ne(t)?"currentColor":"none",strokeOpacity:i=1,strokeWidth:o=1.5,r:s=4.5,...a}={},c){let[l,u]=De(t),[f,d]=De(r),h=Q7(c,l),p=Q7(c,f),m=s*s*Math.PI;return n=ie(n)[1],i=ie(i)[1],o=ie(o)[1],e$(e,a,(g,y,x,b)=>g.append("svg").attr("viewBox","-8 -8 16 16").attr("width",x).attr("height",b).attr("fill",l==="color"?w=>h.scale(w):u).attr("fill-opacity",n).attr("stroke",f==="color"?w=>p.scale(w):d).attr("stroke-opacity",i).attr("stroke-width",o).append("path").attr("d",w=>{let _=Qn();return e.scale(w).draw(_,m),_}))}function e$(e,t={},n){let{columns:r,tickFormat:i,fontVariant:o=Cw(e),swatchSize:s=15,swatchWidth:a=s,swatchHeight:c=s,marginLeft:l=0,className:u,style:f,width:d}=t,h=ic(t);u=Lf(u),i=Qm(e.scale,e.domain,void 0,i);let p=ct("div",h).attr("class",`${u}-swatches ${u}-swatches-${r!=null?"columns":"wrap"}`),m;return r!=null?(m=`:where(.${u}-swatches-columns .${u}-swatch) {
28
28
  display: flex;
29
29
  align-items: center;
30
30
  break-inside: avoid;
@@ -56,7 +56,7 @@ ${n}`}function dZ(e){return e==="time"?ew:e==="utc"?Bm:uZ}function rF(e,t,n){let
56
56
  margin-right: 0.5em;
57
57
  overflow: visible;
58
58
  }
59
- ${m}`)).style("margin-left",l?`${+l}px`:null).style("width",d===void 0?null:`${+d}px`).style("font-variant",le(o,"normal")).call(Lf,f).node()}var Jw=new Map([["symbol",D7],["color",k7],["opacity",tQ]]);function B7(e={}){for(let[t,n]of Jw){let r=e[t];if(Bo(r)){let i=nc(e),o;if(t==="symbol"){let{fill:s,stroke:a=s===void 0&&Bo(e.color)?"color":void 0}=e;o={fill:s,stroke:a}}return n(Aw(t,r,o),$A(i,r,e),s=>Bo(e[s])?Aw(s,e[s]):null)}}throw new Error("unknown legend type; no scale found")}function L7(e,t,n={}){return(r,i)=>{if(!Jw.has(r))throw new Error(`unknown legend type: ${r}`);if(r in e)return Jw.get(r)(e[r],$A(t,n[r],i),o=>e[o])}}function $A({className:e,...t},{label:n,ticks:r,tickFormat:i}={},o){return gF(o,{className:e,...t},{label:n,ticks:r,tickFormat:i})}function k7(e,{legend:t=!0,...n}){if(t===!0&&(t=e.type==="ordinal"?"swatches":"ramp"),e.domain!==void 0)switch(`${t}`.toLowerCase()){case"swatches":return N7(e,n);case"ramp":return YR(e,n);default:throw new Error(`unknown legend type: ${t}`)}}function tQ({type:e,interpolate:t,...n},{legend:r=!0,color:i=on(0,0,0),...o}){if(!t)throw new Error(`${e} opacity scales are not supported`);if(r===!0&&(r="ramp"),`${r}`.toLowerCase()!=="ramp")throw new Error(`${r} opacity legends are not supported`);return k7({type:e,...n,interpolate:eQ(i)},{legend:r,...o})}function eQ(e){let{r:t,g:n,b:r}=on(e)||on(0,0,0);return i=>`rgba(${t},${n},${r},${i})`}function C7(e,t,n){let r=[];for(let[i,o]of Jw){let s=n[i];if(s?.legend&&i in e){let a=o(e[i],$A(t,e[i],s),c=>e[c]);a!=null&&r.push(a)}}return r}var nQ={ariaLabel:"frame",fill:"none",stroke:"currentColor",clip:!1},rQ={ariaLabel:"frame",fill:null,stroke:"currentColor",strokeLinecap:"square",clip:!1},Qm=class extends vt{constructor(t={}){let{anchor:n=null,inset:r=0,insetTop:i=r,insetRight:o=r,insetBottom:s=r,insetLeft:a=r,rx:c,ry:l}=t;super(Wa,void 0,t,n==null?nQ:rQ),this.anchor=UT(n,"anchor",["top","right","bottom","left"]),this.insetTop=Nt(i),this.insetRight=Nt(o),this.insetBottom=Nt(s),this.insetLeft=Nt(a),this.rx=Nt(c),this.ry=Nt(l)}render(t,n,r,i,o){let{marginTop:s,marginRight:a,marginBottom:c,marginLeft:l,width:u,height:f}=i,{anchor:d,insetTop:h,insetRight:p,insetBottom:m,insetLeft:g,rx:y,ry:x}=this,b=l+g,w=u-a-p,_=s+h,v=f-c-m;return ct(d?"svg:line":"svg:rect",o).datum(0).call(kt,this,i,o).call(Dt,this).call(Jt,this,r).call(It,this,{}).call(d==="left"?M=>M.attr("x1",b).attr("x2",b).attr("y1",_).attr("y2",v):d==="right"?M=>M.attr("x1",w).attr("x2",w).attr("y1",_).attr("y2",v):d==="top"?M=>M.attr("x1",b).attr("x2",w).attr("y1",_).attr("y2",_):d==="bottom"?M=>M.attr("x1",b).attr("x2",w).attr("y1",v).attr("y2",v):M=>M.attr("x",b).attr("y",_).attr("width",w-b).attr("height",v-_).attr("rx",y).attr("ry",x)).node()}};function Yf(e){return new Qm(e)}var PA={ariaLabel:"tip",fill:"var(--plot-background)",stroke:"currentColor"},iQ=new Set(["geometry","href","src","ariaLabel","scales"]),Km=class extends vt{constructor(t,n={}){n.tip&&(n={...n,tip:!1}),n.title===void 0&&rr(t)&&ow(t)&&(n={...n,title:G});let{x:r,y:i,x1:o,x2:s,y1:a,y2:c,anchor:l,preferredAnchor:u="bottom",monospace:f,fontFamily:d=f?"ui-monospace, monospace":void 0,fontSize:h,fontStyle:p,fontVariant:m,fontWeight:g,lineHeight:y=1,lineWidth:x=20,frameAnchor:b,format:w,textAnchor:_="start",textOverflow:v,textPadding:M=8,title:E,pointerSize:D=12,pathFilter:I="drop-shadow(0 3px 4px rgba(0,0,0,0.2))"}=n;super(t,{x:{value:o!=null&&s!=null?null:r,scale:"x",optional:!0},y:{value:a!=null&&c!=null?null:i,scale:"y",optional:!0},x1:{value:o,scale:"x",optional:s==null},y1:{value:a,scale:"y",optional:c==null},x2:{value:s,scale:"x",optional:o==null},y2:{value:c,scale:"y",optional:a==null},title:{value:E,optional:!0}},n,PA),this.anchor=aw(l,"anchor"),this.preferredAnchor=aw(u,"preferredAnchor"),this.frameAnchor=Co(b),this.textAnchor=le(_,"middle"),this.textPadding=+M,this.pointerSize=+D,this.pathFilter=ze(I),this.lineHeight=+y,this.lineWidth=+x,this.textOverflow=BA(v),this.monospace=!!f,this.fontFamily=ze(d),this.fontSize=Nt(h),this.fontStyle=ze(p),this.fontVariant=ze(m),this.fontWeight=ze(g);for(let T in PA)T in this.channels&&(this[T]=PA[T]);this.splitLines=kA(this),this.clipLine=CA(this),this.format={...w}}render(t,n,r,i,o){let s=this,{x:a,y:c,fx:l,fy:u}=n,{ownerSVGElement:f,document:d}=o,{anchor:h,monospace:p,lineHeight:m,lineWidth:g}=this,{textPadding:y,pointerSize:x,pathFilter:b}=this,{marginTop:w,marginLeft:_}=i,{x1:v,y1:M,x2:E,y2:D,x:I=v??E,y:T=M??D}=r,O=l?l(t.fx)-_:0,B=u?u(t.fy)-w:0,[S,A]=pn(this,i),N=MA(r,S),k=TA(r,A),R=p?zw:Uw,F=R(Bl),$,P;"title"in r?($=r.channels,P=lQ):($=cQ.call(this,r,n),P=uQ);let U=ct("svg:g",o).call(kt,this,i,o).call(LA,this).call(It,this,{x:I&&a,y:T&&c}).call(nt=>nt.selectAll().data(t).enter().append("g").attr("transform",st=>`translate(${Math.round(N(st))},${Math.round(k(st))})`).call(Dt,this).call(st=>st.append("path").attr("filter",b)).call(st=>st.append("text").each(function(Y){let rt=jt(this);this.setAttribute("fill","currentColor"),this.setAttribute("fill-opacity",1),this.setAttribute("stroke","none");let j=P.call(s,Y,t,$,n,r);if(typeof j=="string")for(let H of s.splitLines(j))W(rt,{value:s.clipLine(H)});else{let H=new Set;for(let ot of j){let{label:z=""}=ot;z&&H.has(z)||(H.add(z),W(rt,ot))}}})));function W(nt,{label:st,value:Y,color:rt,opacity:j}){st??="",Y??="";let H=rt!=null||j!=null,ot,z=g*100,[Ct]=kl(st,z,R,F);if(Ct>=0)st=st.slice(0,Ct).trimEnd()+Bl,ot=Y.trim(),Y="";else{(st||!Y&&!H)&&(Y=" "+Y);let[Wt]=kl(Y,z-R(st),R,F);Wt>=0&&(ot=Y.trim(),Y=Y.slice(0,Wt).trimEnd()+Bl)}let dt=nt.append("tspan").attr("x",0).attr("dy",`${m}em`).text("\u200B");st&&dt.append("tspan").attr("font-weight","bold").text(st),Y&&dt.append(()=>d.createTextNode(Y)),H&&dt.append("tspan").text(" \u25A0").attr("fill",rt).attr("fill-opacity",j).style("user-select","none"),ot&&dt.append("title").text(ot)}function tt(){let{width:nt,height:st}=i.facet??i;U.selectChildren().each(function(Y){let{x:rt,width:j,height:H}=this.getBBox();j=Math.round(j),H=Math.round(H);let ot=h;if(ot===void 0){let dt=N(Y)+O,Wt=k(Y)+B,Ht=dt+j+x+y*2<nt,et=dt-j-x-y*2>0,oe=Wt+H+x+y*2<st,br=Wt-H-x-y*2>0;ot=Ht&&et?oe&&br?s.preferredAnchor:br?"bottom":"top":oe&&br?Ht?"left":"right":(Ht||et)&&(oe||br)?`${br?"bottom":"top"}-${Ht?"left":"right"}`:s.preferredAnchor}let z=this.firstChild,Ct=this.lastChild;if(z.setAttribute("d",aQ(ot,x,y,j,H)),rt)for(let dt of Ct.childNodes)dt.setAttribute("x",-rt);Ct.setAttribute("y",`${+oQ(ot,Ct.childNodes.length,m).toFixed(6)}em`),Ct.setAttribute("transform",`translate(${sQ(ot,x,y,j,H)})`)}),U.attr("visibility",null)}return t.length&&(U.attr("visibility","hidden"),f.isConnected?Promise.resolve().then(tt):typeof requestAnimationFrame<"u"&&requestAnimationFrame(tt)),U.node()}};function Kw(e,{x:t,y:n,...r}={}){return r.frameAnchor===void 0&&([t,n]=Re(t,n)),new Km(e,{...r,x:t,y:n})}function oQ(e,t,n){return/^top(?:-|$)/.test(e)?.94-n:-.29-t*n}function sQ(e,t,n,r,i){switch(e){case"middle":return[-r/2,i/2];case"top-left":return[n,t+n];case"top":return[-r/2,t/2+n];case"top-right":return[-r-n,t+n];case"right":return[-t/2-r-n,i/2];case"bottom-left":return[n,-t-n];case"bottom":return[-r/2,-t/2-n];case"bottom-right":return[-r-n,-t-n];case"left":return[n+t/2,i/2]}}function aQ(e,t,n,r,i){let o=r+n*2,s=i+n*2;switch(e){case"middle":return`M${-o/2},${-s/2}h${o}v${s}h${-o}z`;case"top-left":return`M0,0l${t},${t}h${o-t}v${s}h${-o}z`;case"top":return`M0,0l${t/2},${t/2}h${(o-t)/2}v${s}h${-o}v${-s}h${(o-t)/2}z`;case"top-right":return`M0,0l${-t},${t}h${t-o}v${s}h${o}z`;case"right":return`M0,0l${-t/2},${-t/2}v${t/2-s/2}h${-o}v${s}h${o}v${t/2-s/2}z`;case"bottom-left":return`M0,0l${t},${-t}h${o-t}v${-s}h${-o}z`;case"bottom":return`M0,0l${t/2},${-t/2}h${(o-t)/2}v${-s}h${-o}v${s}h${(o-t)/2}z`;case"bottom-right":return`M0,0l${-t},${-t}h${t-o}v${-s}h${o}z`;case"left":return`M0,0l${t/2},${-t/2}v${t/2-s/2}h${o}v${s}h${-o}v${t/2-s/2}z`}}function cQ({channels:e},t){let n={},r=this.format;r=F7(r,e,"x"),r=F7(r,e,"y"),this.format=r;for(let i in r){let o=r[i];if(!(o===null||o===!1))if(i==="fx"||i==="fy")n[i]=!0;else{let s=zm(e,i);s&&(n[i]=s)}}for(let i in e){if(i in n||i in r||iQ.has(i))continue;let o=zm(e,i);o&&(n[i]=o)}this.facet&&(t.fx&&!("fx"in r)&&(n.fx=!0),t.fy&&!("fy"in r)&&(n.fy=!0));for(let i in n){let o=this.format[i];if(typeof o=="string"){let s=n[i]?.value??t[i]?.domain()??[];this.format[i]=(Oe(s)?No:ci)(o)}else if(o===void 0||o===!0){let s=t[i];this.format[i]=s?.bandwidth?Jm(s,s.domain()):qi}}return n}function F7(e,t,n){if(!(n in e))return e;let r=`${n}1`,i=`${n}2`;if((r in e||!(r in t))&&(i in e||!(i in t)))return e;let o=Object.entries(e),s=e[n];return o.splice(o.findIndex(([a])=>a===n)+1,0,[r,s],[i,s]),Object.fromEntries(o)}function lQ(e,t,{title:n}){return qi(n.value[e],e)}function*uQ(e,t,n,r,i){for(let o in n){if(o==="fx"||o==="fy"){yield{label:Qw(r,n,o),value:this.format[o](t[o],e)};continue}if(o==="x1"&&"x2"in n||o==="y1"&&"y2"in n)continue;let s=n[o];if(o==="x2"&&"x1"in n)yield{label:$7(r,n,"x"),value:R7(this.format.x2,n.x1,s,e)};else if(o==="y2"&&"y1"in n)yield{label:$7(r,n,"y"),value:R7(this.format.y2,n.y1,s,e)};else{let a=s.value[e],c=s.scale;if(!Ue(a)&&c==null)continue;yield{label:Qw(r,n,o),value:this.format[o](a,e),color:c==="color"?i[o][e]:null,opacity:c==="opacity"?i[o][e]:null}}}}function R7(e,t,n,r){return n.hint?.length?`${e(n.value[r]-t.value[r],r)}`:`${e(t.value[r],r)}\u2013${e(n.value[r],r)}`}function $7(e,t,n){let r=Qw(e,t,`${n}1`,n),i=Qw(e,t,`${n}2`,n);return r===i?r:`${r}\u2013${i}`}function Qw(e,t,n,r=n){let i=t[n],o=e[i?.scale??n];return String(o?.label??i?.label??r)}function ey(e={}){let{facet:t,style:n,title:r,subtitle:i,caption:o,ariaLabel:s,ariaDescription:a}=e,c=Bf(e.className),l=e.marks===void 0?[]:U7(e.marks);l.push(...gQ(l));let u=mQ(t,e),f=new Map;for(let F of l){let $=z7(F,u,e);$&&f.set(F,$)}let d=new Map;u&&ty(d,[u],e),ty(d,f,e);let h=U7(xQ(l,d,e));for(let F of h){let $=z7(F,u,e);$&&f.set(F,$)}l.unshift(...h);let p=PR(d,e);if(p!==void 0){let F=u?Ow(p,u):void 0;for(let P of l){if(P.facet===null||P.facet==="super")continue;let U=f.get(P);U!==void 0&&(U.facetsIndex=P.fx!=null||P.fy!=null?Ow(p,U):F)}let $=new Set;for(let{facetsIndex:P}of f.values())P?.forEach((U,W)=>{U?.length>0&&$.add(W)});p.forEach(0<$.size&&$.size<p.length?(P,U)=>P.empty=!$.has(U):P=>P.empty=!1);for(let P of l)if(P.facet==="exclude"){let U=f.get(P);U!==void 0&&(U.facetsIndex=jR(U.facetsIndex))}}for(let F of fe.keys())Bo(e[F])&&F!=="fx"&&F!=="fy"&&d.set(F,[]);let m=new Map;for(let F of l){if(m.has(F))throw new Error("duplicate mark; each mark must be unique");let{facetsIndex:$,channels:P}=f.get(F)??{},{data:U,facets:W,channels:tt}=F.initialize($,P,e);jA(tt,e),m.set(F,{data:U,facets:W,channels:tt})}let g=Xm(ty(d,m,e),e),y=RR(g,l,e);DR(g,y);let x=yA(g),{fx:b,fy:w}=x,_=b||w?gA(g,y):y,v=b||w?MQ(x,y):y,M=nc(e),E=M.document,D=Ns("svg").call(E.documentElement),I=D;M.ownerSVGElement=D,M.className=c,M.projection=qF(e,_),M.filterFacets=(F,$)=>Ow(p,{channels:$,groups:Nw(F,$)}),M.getMarkState=F=>{let $=m.get(F),P=f.get(F);return{...$,channels:{...$.channels,...P?.channels}}},M.dispatchValue=F=>{I.value!==F&&(I.value=F,I.dispatchEvent(new Event("input",{bubbles:!0})))};let T=new Set;for(let[F,$]of m)if(F.initializer!=null){let P=F.facet==="super"?v:_,U=F.initializer($.data,$.facets,$.channels,x,P,M);if(U.data!==void 0&&($.data=U.data),U.facets!==void 0&&($.facets=U.facets),U.channels!==void 0){let{fx:W,fy:tt,...nt}=U.channels;pQ(nt),Object.assign($.channels,nt);for(let st of Object.values(nt)){let{scale:Y}=st;Y!=null&&!bF(fe.get(Y))&&(V7(st,e),T.add(Y))}(W!=null||tt!=null)&&f.set(F,!0)}}if(T.size){let F=new Map;ty(F,m,e,W=>T.has(W)),ty(d,m,e,W=>T.has(W));let $=IQ(Xm(F,e),g),{scales:P,...U}=yA($);Object.assign(g,$),Object.assign(x,U),Object.assign(x.scales,P)}let O,B;p!==void 0&&(O={x:b?.domain(),y:w?.domain()},p=UR(p,O),B=zR(b,w,y));for(let[F,$]of m)$.values=F.scale($.channels,x,M);let{width:S,height:A}=y;jt(D).attr("class",c).attr("fill","currentColor").attr("font-family","system-ui, sans-serif").attr("font-size",10).attr("text-anchor","middle").attr("width",S).attr("height",A).attr("viewBox",`0 0 ${S} ${A}`).attr("aria-label",s).attr("aria-description",a).call(F=>F.append("style").text(`:where(.${c}) {
59
+ ${m}`)).style("margin-left",l?`${+l}px`:null).style("width",d===void 0?null:`${+d}px`).style("font-variant",le(o,"normal")).call(Cf,f).node()}var Kw=new Map([["symbol",t$],["color",i$],["opacity",LQ]]);function n$(e={}){for(let[t,n]of Kw){let r=e[t];if(Lo(r)){let i=ic(e),o;if(t==="symbol"){let{fill:s,stroke:a=s===void 0&&Lo(e.color)?"color":void 0}=e;o={fill:s,stroke:a}}return n(Nw(t,r,o),zT(i,r,e),s=>Lo(e[s])?Nw(s,e[s]):null)}}throw new Error("unknown legend type; no scale found")}function r$(e,t,n={}){return(r,i)=>{if(!Kw.has(r))throw new Error(`unknown legend type: ${r}`);if(r in e)return Kw.get(r)(e[r],zT(t,n[r],i),o=>e[o])}}function zT({className:e,...t},{label:n,ticks:r,tickFormat:i}={},o){return zF(o,{className:e,...t},{label:n,ticks:r,tickFormat:i})}function i$(e,{legend:t=!0,...n}){if(t===!0&&(t=e.type==="ordinal"?"swatches":"ramp"),e.domain!==void 0)switch(`${t}`.toLowerCase()){case"swatches":return K7(e,n);case"ramp":return m7(e,n);default:throw new Error(`unknown legend type: ${t}`)}}function LQ({type:e,interpolate:t,...n},{legend:r=!0,color:i=nn(0,0,0),...o}){if(!t)throw new Error(`${e} opacity scales are not supported`);if(r===!0&&(r="ramp"),`${r}`.toLowerCase()!=="ramp")throw new Error(`${r} opacity legends are not supported`);return i$({type:e,...n,interpolate:CQ(i)},{legend:r,...o})}function CQ(e){let{r:t,g:n,b:r}=nn(e)||nn(0,0,0);return i=>`rgba(${t},${n},${r},${i})`}function o$(e,t,n){let r=[];for(let[i,o]of Kw){let s=n[i];if(s?.legend&&i in e){let a=o(e[i],zT(t,e[i],s),c=>e[c]);a!=null&&r.push(a)}}return r}var kQ={ariaLabel:"frame",fill:"none",stroke:"currentColor",clip:!1},FQ={ariaLabel:"frame",fill:null,stroke:"currentColor",strokeLinecap:"square",clip:!1},Km=class extends vt{constructor(t={}){let{anchor:n=null,inset:r=0,insetTop:i=r,insetRight:o=r,insetBottom:s=r,insetLeft:a=r,rx:c,ry:l}=t;super(Za,void 0,t,n==null?kQ:FQ),this.anchor=jA(n,"anchor",["top","right","bottom","left"]),this.insetTop=Nt(i),this.insetRight=Nt(o),this.insetBottom=Nt(s),this.insetLeft=Nt(a),this.rx=Nt(c),this.ry=Nt(l)}render(t,n,r,i,o){let{marginTop:s,marginRight:a,marginBottom:c,marginLeft:l,width:u,height:f}=i,{anchor:d,insetTop:h,insetRight:p,insetBottom:m,insetLeft:g,rx:y,ry:x}=this,b=l+g,w=u-a-p,_=s+h,v=f-c-m;return ct(d?"svg:line":"svg:rect",o).datum(0).call(Ct,this,i,o).call(Dt,this).call(Jt,this,r).call(It,this,{}).call(d==="left"?M=>M.attr("x1",b).attr("x2",b).attr("y1",_).attr("y2",v):d==="right"?M=>M.attr("x1",w).attr("x2",w).attr("y1",_).attr("y2",v):d==="top"?M=>M.attr("x1",b).attr("x2",w).attr("y1",_).attr("y2",_):d==="bottom"?M=>M.attr("x1",b).attr("x2",w).attr("y1",v).attr("y2",v):M=>M.attr("x",b).attr("y",_).attr("width",w-b).attr("height",v-_).attr("rx",y).attr("ry",x)).node()}};function Gf(e){return new Km(e)}var qT={ariaLabel:"tip",fill:"var(--plot-background)",stroke:"currentColor"},RQ=new Set(["geometry","href","src","ariaLabel","scales"]),ty=class extends vt{constructor(t,n={}){n.tip&&(n={...n,tip:!1}),n.title===void 0&&or(t)&&aw(t)&&(n={...n,title:G});let{x:r,y:i,x1:o,x2:s,y1:a,y2:c,anchor:l,preferredAnchor:u="bottom",monospace:f,fontFamily:d=f?"ui-monospace, monospace":void 0,fontSize:h,fontStyle:p,fontVariant:m,fontWeight:g,lineHeight:y=1,lineWidth:x=20,frameAnchor:b,format:w,textAnchor:_="start",textOverflow:v,textPadding:M=8,title:E,pointerSize:D=12,pathFilter:I="drop-shadow(0 3px 4px rgba(0,0,0,0.2))"}=n;super(t,{x:{value:o!=null&&s!=null?null:r,scale:"x",optional:!0},y:{value:a!=null&&c!=null?null:i,scale:"y",optional:!0},x1:{value:o,scale:"x",optional:s==null},y1:{value:a,scale:"y",optional:c==null},x2:{value:s,scale:"x",optional:o==null},y2:{value:c,scale:"y",optional:a==null},title:{value:E,optional:!0}},n,qT),this.anchor=lw(l,"anchor"),this.preferredAnchor=lw(u,"preferredAnchor"),this.frameAnchor=Fo(b),this.textAnchor=le(_,"middle"),this.textPadding=+M,this.pointerSize=+D,this.pathFilter=ze(I),this.lineHeight=+y,this.lineWidth=+x,this.textOverflow=kT(v),this.monospace=!!f,this.fontFamily=ze(d),this.fontSize=Nt(h),this.fontStyle=ze(p),this.fontVariant=ze(m),this.fontWeight=ze(g);for(let T in qT)T in this.channels&&(this[T]=qT[T]);this.splitLines=RT(this),this.clipLine=$T(this),this.format={...w}}render(t,n,r,i,o){let s=this,{x:a,y:c,fx:l,fy:u}=n,{ownerSVGElement:f,document:d}=o,{anchor:h,monospace:p,lineHeight:m,lineWidth:g}=this,{textPadding:y,pointerSize:x,pathFilter:b}=this,{marginTop:w,marginLeft:_}=i,{x1:v,y1:M,x2:E,y2:D,x:I=v??E,y:T=M??D}=r,O=l?l(t.fx)-_:0,L=u?u(t.fy)-w:0,[S,A]=pn(this,i),N=ET(r,S),k=NT(r,A),R=p?jw:qw,F=R(Ll),$,P;"title"in r?($=r.channels,P=qQ):($=zQ.call(this,r,n),P=jQ);let U=ct("svg:g",o).call(Ct,this,i,o).call(FT,this).call(It,this,{x:I&&a,y:T&&c}).call(nt=>nt.selectAll().data(t).enter().append("g").attr("transform",st=>`translate(${Math.round(N(st))},${Math.round(k(st))})`).call(Dt,this).call(st=>st.append("path").attr("filter",b)).call(st=>st.append("text").each(function(Y){let rt=jt(this);this.setAttribute("fill","currentColor"),this.setAttribute("fill-opacity",1),this.setAttribute("stroke","none");let q=P.call(s,Y,t,$,n,r);if(typeof q=="string")for(let H of s.splitLines(q))W(rt,{value:s.clipLine(H)});else{let H=new Set;for(let ot of q){let{label:z=""}=ot;z&&H.has(z)||(H.add(z),W(rt,ot))}}})));function W(nt,{label:st,value:Y,color:rt,opacity:q}){st??="",Y??="";let H=rt!=null||q!=null,ot,z=g*100,[kt]=kl(st,z,R,F);if(kt>=0)st=st.slice(0,kt).trimEnd()+Ll,ot=Y.trim(),Y="";else{(st||!Y&&!H)&&(Y=" "+Y);let[Wt]=kl(Y,z-R(st),R,F);Wt>=0&&(ot=Y.trim(),Y=Y.slice(0,Wt).trimEnd()+Ll)}let dt=nt.append("tspan").attr("x",0).attr("dy",`${m}em`).text("\u200B");st&&dt.append("tspan").attr("font-weight","bold").text(st),Y&&dt.append(()=>d.createTextNode(Y)),H&&dt.append("tspan").text(" \u25A0").attr("fill",rt).attr("fill-opacity",q).style("user-select","none"),ot&&dt.append("title").text(ot)}function tt(){let{width:nt,height:st}=i.facet??i;U.selectChildren().each(function(Y){let{x:rt,width:q,height:H}=this.getBBox();q=Math.round(q),H=Math.round(H);let ot=h;if(ot===void 0){let dt=N(Y)+O,Wt=k(Y)+L,Ht=dt+q+x+y*2<nt,et=dt-q-x-y*2>0,oe=Wt+H+x+y*2<st,vr=Wt-H-x-y*2>0;ot=Ht&&et?oe&&vr?s.preferredAnchor:vr?"bottom":"top":oe&&vr?Ht?"left":"right":(Ht||et)&&(oe||vr)?`${vr?"bottom":"top"}-${Ht?"left":"right"}`:s.preferredAnchor}let z=this.firstChild,kt=this.lastChild;if(z.setAttribute("d",UQ(ot,x,y,q,H)),rt)for(let dt of kt.childNodes)dt.setAttribute("x",-rt);kt.setAttribute("y",`${+$Q(ot,kt.childNodes.length,m).toFixed(6)}em`),kt.setAttribute("transform",`translate(${PQ(ot,x,y,q,H)})`)}),U.attr("visibility",null)}return t.length&&(U.attr("visibility","hidden"),f.isConnected?Promise.resolve().then(tt):typeof requestAnimationFrame<"u"&&requestAnimationFrame(tt)),U.node()}};function ev(e,{x:t,y:n,...r}={}){return r.frameAnchor===void 0&&([t,n]=Re(t,n)),new ty(e,{...r,x:t,y:n})}function $Q(e,t,n){return/^top(?:-|$)/.test(e)?.94-n:-.29-t*n}function PQ(e,t,n,r,i){switch(e){case"middle":return[-r/2,i/2];case"top-left":return[n,t+n];case"top":return[-r/2,t/2+n];case"top-right":return[-r-n,t+n];case"right":return[-t/2-r-n,i/2];case"bottom-left":return[n,-t-n];case"bottom":return[-r/2,-t/2-n];case"bottom-right":return[-r-n,-t-n];case"left":return[n+t/2,i/2]}}function UQ(e,t,n,r,i){let o=r+n*2,s=i+n*2;switch(e){case"middle":return`M${-o/2},${-s/2}h${o}v${s}h${-o}z`;case"top-left":return`M0,0l${t},${t}h${o-t}v${s}h${-o}z`;case"top":return`M0,0l${t/2},${t/2}h${(o-t)/2}v${s}h${-o}v${-s}h${(o-t)/2}z`;case"top-right":return`M0,0l${-t},${t}h${t-o}v${s}h${o}z`;case"right":return`M0,0l${-t/2},${-t/2}v${t/2-s/2}h${-o}v${s}h${o}v${t/2-s/2}z`;case"bottom-left":return`M0,0l${t},${-t}h${o-t}v${-s}h${-o}z`;case"bottom":return`M0,0l${t/2},${-t/2}h${(o-t)/2}v${-s}h${-o}v${s}h${(o-t)/2}z`;case"bottom-right":return`M0,0l${-t},${-t}h${t-o}v${-s}h${o}z`;case"left":return`M0,0l${t/2},${-t/2}v${t/2-s/2}h${o}v${s}h${-o}v${t/2-s/2}z`}}function zQ({channels:e},t){let n={},r=this.format;r=s$(r,e,"x"),r=s$(r,e,"y"),this.format=r;for(let i in r){let o=r[i];if(!(o===null||o===!1))if(i==="fx"||i==="fy")n[i]=!0;else{let s=qm(e,i);s&&(n[i]=s)}}for(let i in e){if(i in n||i in r||RQ.has(i))continue;let o=qm(e,i);o&&(n[i]=o)}this.facet&&(t.fx&&!("fx"in r)&&(n.fx=!0),t.fy&&!("fy"in r)&&(n.fy=!0));for(let i in n){let o=this.format[i];if(typeof o=="string"){let s=n[i]?.value??t[i]?.domain()??[];this.format[i]=(Oe(s)?Do:ci)(o)}else if(o===void 0||o===!0){let s=t[i];this.format[i]=s?.bandwidth?Qm(s,s.domain()):ji}}return n}function s$(e,t,n){if(!(n in e))return e;let r=`${n}1`,i=`${n}2`;if((r in e||!(r in t))&&(i in e||!(i in t)))return e;let o=Object.entries(e),s=e[n];return o.splice(o.findIndex(([a])=>a===n)+1,0,[r,s],[i,s]),Object.fromEntries(o)}function qQ(e,t,{title:n}){return ji(n.value[e],e)}function*jQ(e,t,n,r,i){for(let o in n){if(o==="fx"||o==="fy"){yield{label:tv(r,n,o),value:this.format[o](t[o],e)};continue}if(o==="x1"&&"x2"in n||o==="y1"&&"y2"in n)continue;let s=n[o];if(o==="x2"&&"x1"in n)yield{label:c$(r,n,"x"),value:a$(this.format.x2,n.x1,s,e)};else if(o==="y2"&&"y1"in n)yield{label:c$(r,n,"y"),value:a$(this.format.y2,n.y1,s,e)};else{let a=s.value[e],c=s.scale;if(!Ue(a)&&c==null)continue;yield{label:tv(r,n,o),value:this.format[o](a,e),color:c==="color"?i[o][e]:null,opacity:c==="opacity"?i[o][e]:null}}}}function a$(e,t,n,r){return n.hint?.length?`${e(n.value[r]-t.value[r],r)}`:`${e(t.value[r],r)}\u2013${e(n.value[r],r)}`}function c$(e,t,n){let r=tv(e,t,`${n}1`,n),i=tv(e,t,`${n}2`,n);return r===i?r:`${r}\u2013${i}`}function tv(e,t,n,r=n){let i=t[n],o=e[i?.scale??n];return String(o?.label??i?.label??r)}function ny(e={}){let{facet:t,style:n,title:r,subtitle:i,caption:o,ariaLabel:s,ariaDescription:a}=e,c=Lf(e.className),l=e.marks===void 0?[]:u$(e.marks);l.push(...ZQ(l));let u=WQ(t,e),f=new Map;for(let F of l){let $=f$(F,u,e);$&&f.set(F,$)}let d=new Map;u&&ey(d,[u],e),ey(d,f,e);let h=u$(JQ(l,d,e));for(let F of h){let $=f$(F,u,e);$&&f.set(F,$)}l.unshift(...h);let p=l7(d,e);if(p!==void 0){let F=u?Lw(p,u):void 0;for(let P of l){if(P.facet===null||P.facet==="super")continue;let U=f.get(P);U!==void 0&&(U.facetsIndex=P.fx!=null||P.fy!=null?Lw(p,U):F)}let $=new Set;for(let{facetsIndex:P}of f.values())P?.forEach((U,W)=>{U?.length>0&&$.add(W)});p.forEach(0<$.size&&$.size<p.length?(P,U)=>P.empty=!$.has(U):P=>P.empty=!1);for(let P of l)if(P.facet==="exclude"){let U=f.get(P);U!==void 0&&(U.facetsIndex=d7(U.facetsIndex))}}for(let F of fe.keys())Lo(e[F])&&F!=="fx"&&F!=="fy"&&d.set(F,[]);let m=new Map;for(let F of l){if(m.has(F))throw new Error("duplicate mark; each mark must be unique");let{facetsIndex:$,channels:P}=f.get(F)??{},{data:U,facets:W,channels:tt}=F.initialize($,P,e);YT(tt,e),m.set(F,{data:U,facets:W,channels:tt})}let g=Gm(ey(d,m,e),e),y=a7(g,l,e);t7(g,y);let x=bT(g),{fx:b,fy:w}=x,_=b||w?wT(g,y):y,v=b||w?iK(x,y):y,M=ic(e),E=M.document,D=Ns("svg").call(E.documentElement),I=D;M.ownerSVGElement=D,M.className=c,M.projection=hR(e,_),M.filterFacets=(F,$)=>Lw(p,{channels:$,groups:Ow(F,$)}),M.getMarkState=F=>{let $=m.get(F),P=f.get(F);return{...$,channels:{...$.channels,...P?.channels}}},M.dispatchValue=F=>{I.value!==F&&(I.value=F,I.dispatchEvent(new Event("input",{bubbles:!0})))};let T=new Set;for(let[F,$]of m)if(F.initializer!=null){let P=F.facet==="super"?v:_,U=F.initializer($.data,$.facets,$.channels,x,P,M);if(U.data!==void 0&&($.data=U.data),U.facets!==void 0&&($.facets=U.facets),U.channels!==void 0){let{fx:W,fy:tt,...nt}=U.channels;GQ(nt),Object.assign($.channels,nt);for(let st of Object.values(nt)){let{scale:Y}=st;Y!=null&&!jF(fe.get(Y))&&(p$(st,e),T.add(Y))}(W!=null||tt!=null)&&f.set(F,!0)}}if(T.size){let F=new Map;ey(F,m,e,W=>T.has(W)),ey(d,m,e,W=>T.has(W));let $=rK(Gm(F,e),g),{scales:P,...U}=bT($);Object.assign(g,$),Object.assign(x,U),Object.assign(x.scales,P)}let O,L;p!==void 0&&(O={x:b?.domain(),y:w?.domain()},p=u7(p,O),L=f7(b,w,y));for(let[F,$]of m)$.values=F.scale($.channels,x,M);let{width:S,height:A}=y;jt(D).attr("class",c).attr("fill","currentColor").attr("font-family","system-ui, sans-serif").attr("font-size",10).attr("text-anchor","middle").attr("width",S).attr("height",A).attr("viewBox",`0 0 ${S} ${A}`).attr("aria-label",s).attr("aria-description",a).call(F=>F.append("style").text(`:where(.${c}) {
60
60
  --plot-background: white;
61
61
  display: block;
62
62
  height: auto;
@@ -66,24 +66,24 @@ ${m}`)).style("margin-left",l?`${+l}px`:null).style("width",d===void 0?null:`${+
66
66
  :where(.${c} text),
67
67
  :where(.${c} tspan) {
68
68
  white-space: pre;
69
- }`)).call(Lf,n);for(let F of l){let{channels:$,values:P,facets:U}=m.get(F);if(p===void 0||F.facet==="super"){let W=null;if(U&&(W=U[0],W=F.filter(W,$,P),W.length===0))continue;let tt=F.render(W,x,P,v,M);if(tt==null)continue;D.appendChild(tt)}else{let W;for(let tt of p){if(!(F.facetAnchor?.(p,O,tt)??!tt.empty))continue;let nt=null;if(U){let Y=f.has(F);if(nt=U[Y?tt.i:0],nt=F.filter(nt,$,P),nt.length===0)continue;!Y&&nt===U[0]&&(nt=Hs(nt)),nt.fx=tt.x,nt.fy=tt.y,nt.fi=tt.i}let st=F.render(nt,x,P,_,M);if(st!=null){(W??=jt(D).append("g")).append(()=>st).datum(tt);for(let Y of["aria-label","aria-description","aria-hidden","transform"])st.hasAttribute(Y)&&(W.attr(Y,st.getAttribute(Y)),st.removeAttribute(Y))}}W?.selectChildren().attr("transform",B)}}let N=C7(g,M,e),{figure:k=r!=null||i!=null||o!=null||N.length>0}=e;k&&(I=E.createElement("figure"),I.className=`${c}-figure`,I.style.maxWidth="initial",r!=null&&I.append(P7(E,r,"h2")),i!=null&&I.append(P7(E,i,"h3")),I.append(...N,D),o!=null&&I.append(fQ(E,o))),I.scale=kR(x.scales),I.legend=L7(g,M,e),I.projection=M.projection;let R=PF();return R>0&&jt(D).append("text").attr("x",S).attr("y",20).attr("dy","-1em").attr("text-anchor","end").attr("font-family","initial").text("\u26A0\uFE0F").append("title").text(`${R.toLocaleString("en-US")} warning${R===1?"":"s"}. Please check the console.`),I}function P7(e,t,n){if(t.ownerDocument)return t;let r=e.createElement(n);return r.append(t),r}function fQ(e,t){let n=e.createElement("figcaption");return n.append(t),n}function dQ({marks:e=[],...t}={}){return ey({...t,marks:[...e,this]})}vt.prototype.plot=dQ;function U7(e){return e.flat(1/0).filter(t=>t!=null).map(hQ)}function hQ(e){return typeof e.render=="function"?e:new zA(e)}var zA=class extends vt{constructor(t){if(typeof t!="function")throw new TypeError("invalid mark; missing render function");super(),this.render=t}render(){}};function jA(e,t){for(let n in e)V7(e[n],t);return e}function V7(e,t){let{scale:n,transform:r=!0}=e;if(n==null||!r)return;let{type:i,percent:o,interval:s,transform:a=o?c=>c*100:VT(s,i)}=t[n]??{};a!=null&&(e.value=Xt(e.value,a),e.transform=!1)}function pQ(e){for(let t in e)iA(t,e[t])}function ty(e,t,n,r=sF){for(let{channels:i}of t.values())for(let o in i){let s=i[o],{scale:a}=s;if(a!=null&&r(a))if(a==="projection"){if(!XF(n)){let c=n.x?.domain===void 0,l=n.y?.domain===void 0;if(c||l){let[u,f]=WF(s);c&&UA(e,"x",u),l&&UA(e,"y",f)}}}else UA(e,a,s)}return e}function UA(e,t,n){let r=e.get(t);r!==void 0?r.push(n):e.set(t,[n])}function mQ(e,t){if(e==null)return;let{x:n,y:r}=e;if(n==null&&r==null)return;let i=je(e.data);if(i==null)throw new Error("missing facet data");let o={};n!=null&&(o.fx=Df(i,{value:n,scale:"fx"})),r!=null&&(o.fy=Df(i,{value:r,scale:"fy"})),jA(o,t);let s=Nw(i,o);return{channels:o,groups:s,data:e.data}}function z7(e,t,n){if(e.facet===null||e.facet==="super")return;let{fx:r,fy:i}=e;if(r!=null||i!=null){let c=je(e.data??r??i);if(c===void 0)throw new Error(`missing facet data in ${e.ariaLabel}`);if(c===null)return;let l={};return r!=null&&(l.fx=Df(c,{value:r,scale:"fx"})),i!=null&&(l.fy=Df(c,{value:i,scale:"fy"})),jA(l,n),{channels:l,groups:Nw(c,l)}}if(t===void 0)return;let{channels:o,groups:s,data:a}=t;if(e.facet!=="auto"||e.data===a)return{channels:o,groups:s};a.length>0&&(s.size>1||s.size===1&&o.fx&&o.fy&&[...s][0][1].size>1)&&je(e.data)?.length===a.length&&Un(`Warning: the ${e.ariaLabel} mark appears to use faceted data, but isn\u2019t faceted. The mark data has the same length as the facet data and the mark facet option is "auto", but the mark data and facet data are distinct. If this mark should be faceted, set the mark facet option to true; otherwise, suppress this warning by setting the mark facet option to false.`)}function yQ(e,t={}){return _e({...t,x:null,y:null},(n,r,i,o,s,a)=>a.getMarkState(e))}function gQ(e){let t=[];for(let n of e){let r=n.tip;if(r){r===!0?r={}:typeof r=="string"&&(r={pointer:r});let{pointer:i,preferredAnchor:o}=r;i=/^x$/i.test(i)?zf:/^y$/i.test(i)?Nl:Uf,r=i(yQ(n,r)),r.title=null,o===void 0&&(r.preferredAnchor=i===Nl?"left":"bottom");let s=Kw(n.data,r);s.facet=n.facet,s.facetAnchor=n.facetAnchor,t.push(s)}}return t}function xQ(e,t,n){let{projection:r,x:i={},y:o={},fx:s={},fy:a={},axis:c,grid:l,facet:u={},facet:{axis:f=c,grid:d}=u,x:{axis:h=c,grid:p=h===null?null:l}=i,y:{axis:m=c,grid:g=m===null?null:l}=o,fx:{axis:y=f,grid:x=y===null?null:d}=s,fy:{axis:b=f,grid:w=b===null?null:d}=a}=n;(r||!Bo(i)&&!j7("x",e))&&(h=p=null),(r||!Bo(o)&&!j7("y",e))&&(m=g=null),t.has("fx")||(y=x=null),t.has("fy")||(b=w=null),h===void 0&&(h=!nv(e,"x")),m===void 0&&(m=!nv(e,"y")),y===void 0&&(y=!nv(e,"fx")),b===void 0&&(b=!nv(e,"fy")),h===!0&&(h="bottom"),m===!0&&(m="left"),y===!0&&(y=h==="top"||h===null?"bottom":"top"),b===!0&&(b=m==="right"||m===null?"left":"right");let _=[];return ev(_,w,Ww,a),tv(_,b,Yw,"right","left",u,a),ev(_,x,Zw,s),tv(_,y,Xw,"top","bottom",u,s),ev(_,g,Gw,o),tv(_,m,Hm,"left","right",n,o),ev(_,p,Hw,i),tv(_,h,Zm,"bottom","top",n,i),_}function tv(e,t,n,r,i,o,s){if(!t)return;let a=bQ(t);s=wQ(a?r:t,o,s);let{line:c}=s;(n===Hm||n===Zm)&&c&&!Qs(c)&&e.push(Yf(vQ(s))),e.push(n(s)),a&&e.push(n({...s,anchor:i,label:null}))}function ev(e,t,n,r){!t||Qs(t)||e.push(n(_Q(t,r)))}function bQ(e){return/^\s*both\s*$/i.test(e)}function wQ(e,t,{line:n=t.line,ticks:r,tickSize:i,tickSpacing:o,tickPadding:s,tickFormat:a,tickRotate:c,fontVariant:l,ariaLabel:u,ariaDescription:f,label:d=t.label,labelAnchor:h,labelArrow:p=t.labelArrow,labelOffset:m}){return{anchor:e,line:n,ticks:r,tickSize:i,tickSpacing:o,tickPadding:s,tickFormat:a,tickRotate:c,fontVariant:l,ariaLabel:u,ariaDescription:f,label:d,labelAnchor:h,labelArrow:p,labelOffset:m}}function vQ(e){let{anchor:t,line:n}=e;return{anchor:t,facetAnchor:t+"-empty",stroke:n===!0?void 0:n}}function _Q(e,{stroke:t=Qa(e)?e:void 0,ticks:n=SQ(e)?e:void 0,tickSpacing:r,ariaLabel:i,ariaDescription:o}){return{stroke:t,ticks:n,tickSpacing:r,ariaLabel:i,ariaDescription:o}}function SQ(e){switch(typeof e){case"number":return!0;case"string":return!Qa(e)}return rr(e)||typeof e?.range=="function"}function nv(e,t){let n=`${t}-axis `;return e.some(r=>r.ariaLabel?.startsWith(n))}function j7(e,t){for(let n of t)for(let r in n.channels){let{scale:i}=n.channels[r];if(i===e||i==="projection")return!0}return!1}function IQ(e,t){for(let n in e){let r=e[n],i=t[n];r.label===void 0&&i&&(r.label=i.label)}return e}function MQ({fx:e,fy:t},n){let{marginTop:r,marginRight:i,marginBottom:o,marginLeft:s,width:a,height:c}=Tw(n),l=e&&q7(e),u=t&&q7(t);return{marginTop:t?u[0]:r,marginRight:e?a-l[1]:i,marginBottom:t?c-u[1]:o,marginLeft:e?l[0]:s,inset:{marginTop:n.marginTop,marginRight:n.marginRight,marginBottom:n.marginBottom,marginLeft:n.marginLeft},width:a,height:c}}function q7(e){let t=e.domain(),n=e(t[0]),r=e(t[t.length-1]);return r<n&&([n,r]=[r,n]),[n,r+e.bandwidth()]}var TQ=new Map([["basis",uT],["basis-closed",fT],["basis-open",dT],["bundle",hT],["bump-x",oT],["bump-y",sT],["cardinal",pT],["cardinal-closed",mT],["cardinal-open",yT],["catmull-rom",gT],["catmull-rom-closed",xT],["catmull-rom-open",bT],["linear",Vs],["linear-closed",wT],["monotone-x",_T],["monotone-y",ST],["natural",IT],["step",MT],["step-after",AT],["step-before",TT]]);function ny(e=Vs,t){if(typeof e=="function")return e;let n=TQ.get(`${e}`.toLowerCase());if(!n)throw new Error(`unknown curve: ${e}`);if(t!==void 0){if("beta"in n)return n.beta(t);if("tension"in n)return n.tension(t);if("alpha"in n)return n.alpha(t)}return n}function rv(e=ac,t){return typeof e!="function"&&`${e}`.toLowerCase()==="auto"?ac:ny(e,t)}function ac(e){return Vs(e)}function Uo(e={y:"count"},t={}){[e,t]=VA(e,t);let{x:n,y:r}=t;return qA(iv(n,t,G),null,null,r,e,Dl(t))}function zo(e={x:"count"},t={}){[e,t]=VA(e,t);let{x:n,y:r}=t;return qA(null,iv(r,t,G),n,null,e,Ol(t))}function ia(e={fill:"count"},t={}){[e,t]=VA(e,t);let{x:n,y:r}=AQ(t);return qA(n,r,null,null,e,Dl(Ol(t)))}function G7(e,t,n={}){if(n?.interval==null)return n;let{reduce:r=pw}=n,i={filter:null};return n[t]!=null&&(i[t]=r),n[`${t}1`]!=null&&(i[`${t}1`]=r),n[`${t}2`]!=null&&(i[`${t}2`]=r),e(i,n)}function Xf(e={}){return G7(Uo,"y",Yi(e,"x"))}function Gf(e={}){return G7(zo,"x",Yi(e,"y"))}function qA(e,t,n,r,{data:i=hw,filter:o=Rm,sort:s,reverse:a,...c}={},l={}){e=Y7(e),t=Y7(t),c=EQ(c,l),i=Z7(i,G),s=s==null?void 0:W7("sort",s,l),o=o==null?void 0:H7("filter",o,l),n!=null&&Fo(c,"x","x1","x2")&&(n=null),r!=null&&Fo(c,"y","y1","y2")&&(r=null);let[u,f]=An(e),[d,h]=An(e),[p,m]=An(t),[g,y]=An(t),[x,b]=n!=null?[n,"x"]:r!=null?[r,"y"]:[],[w,_]=An(x),{x:v,y:M,z:E,fill:D,stroke:I,x1:T,x2:O,y1:B,y2:S,domain:A,cumulative:N,thresholds:k,interval:R,...F}=l,[$,P]=An(E),[U]=De(D),[W]=De(I),[tt,nt]=An(U),[st,Y]=An(W);return{..."z"in l&&{z:$||E},..."fill"in l&&{fill:tt||D},..."stroke"in l&&{stroke:st||I},...hn(F,(rt,j,H)=>{let ot=Il(pt(rt,x),H?.[b]),z=pt(rt,E),Ct=pt(rt,U),dt=pt(rt,W),Wt=Um(c,{z,fill:Ct,stroke:dt}),Ht=[],et=[],oe=ot&&_([]),br=z&&P([]),Wi=Ct&&nt([]),gU=dt&&Y([]),JN=e&&f([]),xU=e&&h([]),QN=t&&m([]),bU=t&&y([]),wU=OQ(e,t,rt),vU=0;for(let Hl of c)Hl.initialize(rt);s&&s.initialize(rt),o&&o.initialize(rt);for(let Hl of j){let KN=[];for(let kd of c)kd.scope("facet",Hl);s&&s.scope("facet",Hl),o&&o.scope("facet",Hl);for(let[kd,_U]of Ka(Hl,Wt))for(let[SU,rg]of Ka(_U,ot))for(let[Hi,bc]of wU(rg))if(!(o&&!o.reduce(Hi,bc))){KN.push(vU++),et.push(i.reduceIndex(Hi,rt,bc)),ot&&oe.push(SU),z&&br.push(Wt===z?kd:z[(Hi.length>0?Hi:rg)[0]]),Ct&&Wi.push(Wt===Ct?kd:Ct[(Hi.length>0?Hi:rg)[0]]),dt&&gU.push(Wt===dt?kd:dt[(Hi.length>0?Hi:rg)[0]]),JN&&(JN.push(bc.x1),xU.push(bc.x2)),QN&&(QN.push(bc.y1),bU.push(bc.y2));for(let IU of c)IU.reduce(Hi,bc);s&&s.reduce(Hi)}Ht.push(KN)}return nA(Ht,s,a),{data:et,facets:Ht}}),...!Fo(c,"x")&&(u?{x1:u,x2:d,x:Mf(u,d)}:{x:v,x1:T,x2:O}),...!Fo(c,"y")&&(p?{y1:p,y2:g,y:Mf(p,g)}:{y:M,y1:B,y2:S}),...w&&{[b]:w},...Object.fromEntries(c.map(({name:rt,output:j})=>[rt,j]))}}function VA({cumulative:e,domain:t,thresholds:n,interval:r,...i},o){return[i,{cumulative:e,domain:t,thresholds:n,interval:r,...o}]}function iv(e,{cumulative:t,domain:n,thresholds:r,interval:i},o){return e={...pi(e)},e.domain===void 0&&(e.domain=n),e.cumulative===void 0&&(e.cumulative=t),e.thresholds===void 0&&(e.thresholds=r),e.interval===void 0&&(e.interval=i),e.value===void 0&&(e.value=o),e.thresholds=YA(e.thresholds,e.interval),e}function AQ(e){let{x:t,y:n}=e;return t=iv(t,e),n=iv(n,e),[t.value,n.value]=Re(t.value,n.value),{x:t,y:n}}function Y7(e){if(e==null)return;let{value:t,cumulative:n,domain:r=ae,thresholds:i}=e,o=s=>{let a=pt(s,t),c;if(Oe(a)||DQ(i)){a=Xt(a,PT,Float64Array);let[u,f]=typeof r=="function"?r(a):r,d=typeof i=="function"&&!Ja(i)?i(a,u,f):i;typeof d=="number"&&(d=sm(u,f,d)),Ja(d)&&(r===ae&&(u=d.floor(u),f=d.offset(d.floor(f))),d=d.range(u,d.offset(f))),c=d}else{a=Je(a);let[u,f]=typeof r=="function"?r(a):r,d=typeof i=="function"&&!Ja(i)?i(a,u,f):i;if(typeof d=="number")if(r===ae){let h=Ts(u,f,d);if(isFinite(h))if(h>0){let p=Math.round(u/h),m=Math.round(f/h);p*h<=u||--p,m*h>f||++m;let g=m-p+1;d=new Float64Array(g);for(let y=0;y<g;++y)d[y]=(p+y)*h}else if(h<0){h=-h;let p=Math.round(u*h),m=Math.round(f*h);p/h<=u||--p,m/h>f||++m;let g=m-p+1;d=new Float64Array(g);for(let y=0;y<g;++y)d[y]=(p+y)/h}else d=[u];else d=[u]}else d=_n(u,f,d);else Ja(d)&&(r===ae&&(u=d.floor(u),f=d.offset(d.floor(f))),d=d.range(u,d.offset(f)));c=d}let l=[];if(c.length===1)l.push([c[0],c[0]]);else for(let u=1;u<c.length;++u)l.push([c[u-1],c[u]]);return l.bin=(n<0?LQ:n>0?BQ:XA)(l,c,a),l};return o.label=En(t),o}function YA(e,t,n=X7){if(e===void 0)return t===void 0?n:ko(t);if(typeof e=="string"){switch(e.toLowerCase()){case"freedman-diaconis":return Z0;case"scott":return ep;case"sturges":return Na;case"auto":return X7}return Lm(e)}return e}function EQ(e,t){return tA(e,t,W7)}function W7(e,t,n){return fw(e,t,n,H7)}function H7(e,t,n){return dw(e,t,n,Z7)}function Z7(e,t){return Nf(e,t,NQ)}function NQ(e){switch(`${e}`.toLowerCase()){case"x":return kQ;case"x1":return FQ;case"x2":return RQ;case"y":return CQ;case"y1":return $Q;case"y2":return PQ}throw new Error(`invalid bin reduce: ${e}`)}function X7(e,t,n){return Math.min(200,ep(e,t,n))}function DQ(e){return uF(e)||rr(e)&&Oe(e)}function OQ(e,t,n){let r=e?.(n),i=t?.(n);return r&&i?function*(o){let s=r.bin(o);for(let[a,[c,l]]of r.entries()){let u=i.bin(s[a]);for(let[f,[d,h]]of i.entries())yield[u[f],{data:n,x1:c,y1:d,x2:l,y2:h}]}}:r?function*(o){let s=r.bin(o);for(let[a,[c,l]]of r.entries())yield[s[a],{data:n,x1:c,x2:l}]}:function*(o){let s=i.bin(o);for(let[a,[c,l]]of i.entries())yield[s[a],{data:n,y1:c,y2:l}]}}function XA(e,t,n){return t=Je(t),r=>{let i=e.map(()=>[]);for(let o of r)i[Ms(t,n[o])-1]?.push(o);return i}}function BQ(e,t,n){let r=XA(e,t,n);return i=>{let o=r(i);for(let s=1,a=o.length;s<a;++s){let c=o[s-1],l=o[s];for(let u of c)l.push(u)}return o}}function LQ(e,t,n){let r=XA(e,t,n);return i=>{let o=r(i);for(let s=o.length-2;s>=0;--s){let a=o[s+1],c=o[s];for(let l of a)c.push(l)}return o}}function J7(e,t){let n=(+e+ +t)/2;return e instanceof Date?new Date(n):n}var kQ={reduceIndex(e,t,{x1:n,x2:r}){return J7(n,r)}},CQ={reduceIndex(e,t,{y1:n,y2:r}){return J7(n,r)}},FQ={reduceIndex(e,t,{x1:n}){return n}},RQ={reduceIndex(e,t,{x2:n}){return n}},$Q={reduceIndex(e,t,{y1:n}){return n}},PQ={reduceIndex(e,t,{y2:n}){return n}};function Wf(e={}){return zT(e)?e:{...e,x:G}}function Hf(e={}){return jT(e)?e:{...e,y:G}}function Q7(e,t){if(t.length===1)return{data:e,facets:t};let n=e.length,r=new Uint8Array(n),i=0;for(let a of t)for(let c of a)r[c]&&++i,r[c]=1;if(i===0)return{data:e,facets:t};e=Za(e);let o=e[FT]=new Uint32Array(n+i);t=t.map(a=>Za(a,Uint32Array));let s=n;r.fill(0);for(let a of t)for(let c=0,l=a.length;c<l;++c){let u=a[c];r[u]?(a[c]=s,e[s]=e[u],o[s]=u,++s):o[u]=u,r[u]=1}return{data:e,facets:t}}function GA(e={},t={}){arguments.length===1&&([e,t]=Qf(e));let{y1:n,y:r=n,x:i,...o}=t,[s,a,c,l]=Kf(r,i,"y","x",e,o);return{...s,y1:n,y:a,x1:c,x2:l,x:Mf(c,l)}}function e$(e={},t={}){arguments.length===1&&([e,t]=Qf(e));let{y1:n,y:r=n,x:i}=t,[o,s,a]=Kf(r,i,"y","x",e,t);return{...o,y1:n,y:s,x:a}}function n$(e={},t={}){arguments.length===1&&([e,t]=Qf(e));let{y1:n,y:r=n,x:i}=t,[o,s,,a]=Kf(r,i,"y","x",e,t);return{...o,y1:n,y:s,x:a}}function WA(e={},t={}){arguments.length===1&&([e,t]=Qf(e));let{x1:n,x:r=n,y:i,...o}=t,[s,a,c,l]=Kf(r,i,"x","y",e,o);return{...s,x1:n,x:a,y1:c,y2:l,y:Mf(c,l)}}function r$(e={},t={}){arguments.length===1&&([e,t]=Qf(e));let{x1:n,x:r=n,y:i}=t,[o,s,a]=Kf(r,i,"x","y",e,t);return{...o,x1:n,x:s,y:a}}function i$(e={},t={}){arguments.length===1&&([e,t]=Qf(e));let{x1:n,x:r=n,y:i}=t,[o,s,,a]=Kf(r,i,"x","y",e,t);return{...o,x1:n,x:s,y:a}}function Zf({x:e,x1:t,x2:n,...r}={}){return r=Yi(r,"y"),t===void 0&&n===void 0?GA({x:e,...r}):([t,n]=qT(e,t,n),{...r,x1:t,x2:n})}function Jf({y:e,y1:t,y2:n,...r}={}){return r=Yi(r,"x"),t===void 0&&n===void 0?WA({y:e,...r}):([t,n]=qT(e,t,n),{...r,y1:t,y2:n})}function Qf(e){let{offset:t,order:n,reverse:r,...i}=e;return[{offset:t,order:n,reverse:r},i]}var UQ={length:!0};function Kf(e,t=km,n,r,{offset:i,order:o,reverse:s},a){if(t===null)throw new Error(`stack requires ${r}`);let c=Pn(a),[l,u]=An(e),[f,d]=dn(t),[h,p]=dn(t);return f.hint=h.hint=UQ,i=zQ(i),o=VQ(o,i,r),[hn(a,(m,g,y)=>{({data:m,facets:g}=Q7(m,g));let x=e==null?void 0:u(Il(pt(m,e),y?.[n])),b=pt(m,t,Float64Array),w=pt(m,c),_=o&&o(m,x,b,w),v=m.length,M=d(new Float64Array(v)),E=p(new Float64Array(v)),D=[];for(let I of g){let T=x?Array.from(rn(I,O=>x[O]).values()):[I];if(_)for(let O of T)O.sort(_);for(let O of T){let B=0,S=0;s&&O.reverse();for(let A of O){let N=b[A];N<0?B=E[A]=(M[A]=B)+N:N>0?S=E[A]=(M[A]=S)+N:E[A]=M[A]=S}}D.push(T)}return i&&i(D,M,E,w),{data:m,facets:g}}),l,f,h]}function zQ(e){if(e!=null){if(typeof e=="function")return e;switch(`${e}`.toLowerCase()){case"expand":case"normalize":return jQ;case"center":case"silhouette":return qQ;case"wiggle":return s$}throw new Error(`unknown offset: ${e}`)}}function o$(e,t){let n=0,r=0;for(let i of e){let o=t[i];o<n&&(n=o),o>r&&(r=o)}return[n,r]}function jQ(e,t,n){for(let r of e)for(let i of r){let[o,s]=o$(i,n);for(let a of i){let c=1/(s-o||1);t[a]=c*(t[a]-o),n[a]=c*(n[a]-o)}}}function qQ(e,t,n){for(let r of e){for(let i of r){let[o,s]=o$(i,n);for(let a of i){let c=(s+o)/2;t[a]-=c,n[a]-=c}}a$(r,t,n)}c$(e,t,n)}function s$(e,t,n,r){for(let i of e){let o=new Xn,s=0;for(let a of i){let c=-1,l=a.map(h=>Math.abs(n[h]-t[h])),u=a.map(h=>{c=r?r[h]:++c;let p=n[h]-t[h],m=o.has(c)?p-o.get(c):0;return o.set(c,p),m}),f=[0,...Y0(u)];for(let h of a)t[h]+=s,n[h]+=s;let d=Sn(l);d&&(s-=Sn(l,(h,p)=>(u[p]/2+f[p])*h)/d)}a$(i,t,n)}c$(e,t,n)}function a$(e,t,n){let r=ce(e,i=>ce(i,o=>t[o]));for(let i of e)for(let o of i)t[o]-=r,n[o]-=r}function c$(e,t,n){let r=e.length;if(r===1)return;let i=e.map(a=>a.flat()),o=i.map(a=>(ce(a,c=>t[c])+zt(a,c=>n[c]))/2),s=ce(o);for(let a=0;a<r;a++){let c=s-o[a];for(let l of i[a])t[l]+=c,n[l]+=c}}function VQ(e,t,n){if(e===void 0&&t===s$)return K7(ln);if(e!=null){if(typeof e=="string"){let r=e.startsWith("-"),i=r?wl:ln;switch((r?e.slice(1):e).toLowerCase()){case"value":case n:return YQ(i);case"z":return XQ(i);case"sum":return GQ(i);case"appearance":return WQ(i);case"inside-out":return K7(i)}return t$(RT(e))}if(typeof e=="function")return(e.length===1?t$:HQ)(e);if(Array.isArray(e))return ZQ(e);throw new Error(`invalid order: ${e}`)}}function YQ(e){return(t,n,r)=>(i,o)=>e(r[i],r[o])}function XQ(e){return(t,n,r,i)=>(o,s)=>e(i[o],i[s])}function GQ(e){return ov(e,(t,n,r,i)=>Tu(nr(t),o=>Sn(o,s=>r[s]),o=>i[o]))}function WQ(e){return ov(e,(t,n,r,i)=>Tu(nr(t),o=>n[Xc(o,s=>r[s])],o=>i[o]))}function K7(e){return ov(e,(t,n,r,i)=>{let o=nr(t),s=Tu(o,f=>n[Xc(f,d=>r[d])],f=>i[f]),a=$i(o,f=>Sn(f,d=>r[d]),f=>i[f]),c=[],l=[],u=0;for(let f of s)u<0?(u+=a.get(f),c.push(f)):(u-=a.get(f),l.push(f));return l.reverse().concat(c)})}function t$(e){return t=>{let n=pt(t,e);return(r,i)=>ln(n[r],n[i])}}function HQ(e){return t=>(n,r)=>e(t[n],t[r])}function ZQ(e){return ov(ln,()=>e)}function ov(e,t){return(n,r,i,o)=>{if(!o)throw new Error("missing channel: z");let s=new Xn(t(n,r,i,o).map((a,c)=>[a,c]));return(a,c)=>e(s.get(o[a]),s.get(o[c]))}}var JQ={ariaLabel:"area",strokeWidth:1,strokeLinecap:"round",strokeLinejoin:"round",strokeMiterlimit:1},Fl=class extends vt{constructor(t,n={}){let{x1:r,y1:i,x2:o,y2:s,z:a,curve:c,tension:l}=n;super(t,{x1:{value:r,scale:"x"},y1:{value:i,scale:"y"},x2:{value:o,scale:"x",optional:!0},y2:{value:s,scale:"y",optional:!0},z:{value:Pn(n),optional:!0}},n,JQ),this.z=a,this.curve=ny(c,l)}filter(t){return t}render(t,n,r,i,o){let{x1:s,y1:a,x2:c=s,y2:l=a}=r;return ct("svg:g",o).call(kt,this,i,o).call(It,this,n,0,0).call(u=>u.selectAll().data(bw(t,[s,a,c,l],this,r)).enter().append("path").call(Dt,this).call(El,this,r).attr("d",df().curve(this.curve).defined(f=>f>=0).x0(f=>s[f]).y0(f=>a[f]).x1(f=>c[f]).y1(f=>l[f]))).node()}};function ry(e,t){return t===void 0?oa(e,{x:Ws,y:Ha}):new Fl(e,t)}function cc(e,t){let{y:n=Te,...r}=Gf(t);return new Fl(e,Zf(Wf({...r,y1:n,y2:void 0})))}function oa(e,t){let{x:n=Te,...r}=Xf(t);return new Fl(e,Jf(Hf({...r,x1:n,x2:void 0})))}var QQ={ariaLabel:"link",fill:"none",stroke:"currentColor",strokeMiterlimit:1},iy=class extends vt{constructor(t,n={}){let{x1:r,y1:i,x2:o,y2:s,curve:a,tension:c}=n;super(t,{x1:{value:r,scale:"x"},y1:{value:i,scale:"y"},x2:{value:o,scale:"x",optional:!0},y2:{value:s,scale:"y",optional:!0}},n,QQ),this.curve=rv(a,c),Xi(this,n)}project(t,n,r){this.curve!==ac&&super.project(t,n,r)}render(t,n,r,i,o){let{x1:s,y1:a,x2:c=s,y2:l=a}=r,{curve:u}=this;return ct("svg:g",o).call(kt,this,i,o).call(It,this,n).call(f=>f.selectAll().data(t).enter().append("path").call(Dt,this).attr("d",u===ac&&o.projection?KQ(o.projection,s,a,c,l):d=>{let h=Zn(),p=u(h);return p.lineStart(),p.point(s[d],a[d]),p.point(c[d],l[d]),p.lineEnd(),h}).call(Jt,this,r).call(ra,this,r,o)).node()}};function KQ(e,t,n,r,i){let o=Mn(e);return t=Je(t),n=Je(n),r=Je(r),i=Je(i),s=>o({type:"LineString",coordinates:[[t[s],n[s]],[r[s],i[s]]]})}function sv(e,{x:t,x1:n,x2:r,y:i,y1:o,y2:s,...a}={}){return[n,r]=oy(t,n,r),[o,s]=oy(i,o,s),new iy(e,{...a,x1:n,x2:r,y1:o,y2:s})}function oy(e,t,n){if(e===void 0){if(t===void 0){if(n!==void 0)return[n]}else if(n===void 0)return[t]}else{if(t===void 0)return n===void 0?[e]:[e,n];if(n===void 0)return[e,t]}return[t,n]}var tK={ariaLabel:"arrow",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeMiterlimit:1,strokeWidth:1.5},sy=class extends vt{constructor(t,n={}){let{x1:r,y1:i,x2:o,y2:s,bend:a=0,headAngle:c=60,headLength:l=8,inset:u=0,insetStart:f=u,insetEnd:d=u,sweep:h}=n;super(t,{x1:{value:r,scale:"x"},y1:{value:i,scale:"y"},x2:{value:o,scale:"x",optional:!0},y2:{value:s,scale:"y",optional:!0}},n,tK),this.bend=a===!0?22.5:Math.max(-90,Math.min(90,a)),this.headAngle=+c,this.headLength=+l,this.insetStart=+f,this.insetEnd=+d,this.sweep=eK(h)}render(t,n,r,i,o){let{x1:s,y1:a,x2:c=s,y2:l=a,SW:u}=r,{strokeWidth:f,bend:d,headAngle:h,headLength:p,insetStart:m,insetEnd:g}=this,y=u?w=>u[w]:un(f===void 0?1:f),x=h*jf/2,b=p/1.5;return ct("svg:g",o).call(kt,this,i,o).call(It,this,n).call(w=>w.selectAll().data(t).enter().append("path").call(Dt,this).attr("d",_=>{let v=s[_],M=a[_],E=c[_],D=l[_],I=Math.hypot(E-v,D-M);if(I<=m+g)return null;let T=Math.atan2(D-M,E-v),O=Math.min(b*y(_),I/3),B=this.sweep(v,M,E,D)*d*jf,S=Math.hypot(I/Math.tan(B),I)/2;if(m||g)if(S<1e5){let tt=Math.sign(B),[nt,st]=nK([v,M],[E,D],S,tt);if(m&&([v,M]=l$([nt,st,S],[v,M,m],-tt*Math.sign(m))),g){let[Y,rt]=l$([nt,st,S],[E,D,g],tt*Math.sign(g));T+=Math.atan2(rt-st,Y-nt)-Math.atan2(D-st,E-nt),E=Y,D=rt}}else{let tt=E-v,nt=D-M,st=Math.hypot(tt,nt);m&&(v+=tt/st*m,M+=nt/st*m),g&&(E-=tt/st*g,D-=nt/st*g)}let A=T+B,N=A+x,k=A-x,R=E-O*Math.cos(N),F=D-O*Math.sin(N),$=E-O*Math.cos(k),P=D-O*Math.sin(k),U=S<1e5?`A${S},${S} 0,0,${B>0?1:0} `:"L",W=O?`M${R},${F}L${E},${D}L${$},${P}`:"";return`M${v},${M}${U}${E},${D}${W}`}).call(Jt,this,r)).node()}};function eK(e=1){if(typeof e=="number")return un(Math.sign(e));if(typeof e=="function")return(t,n,r,i)=>Math.sign(e(t,n,r,i));switch(Qe(e,"sweep",["+x","-x","+y","-y"])){case"+x":return(t,n,r)=>Gt(t,r);case"-x":return(t,n,r)=>Yn(t,r);case"+y":return(t,n,r,i)=>Gt(n,i);case"-y":return(t,n,r,i)=>Yn(n,i)}}function nK([e,t],[n,r],i,o){let s=n-e,a=r-t,c=Math.hypot(s,a),l=o*Math.sqrt(i*i-c*c/4)/c;return[(e+n)/2-a*l,(t+r)/2+s*l]}function l$([e,t,n],[r,i,o],s){let a=r-e,c=i-t,l=Math.hypot(a,c),u=(a*a+c*c-o*o+n*n)/(2*l),f=s*Math.sqrt(n*n-u*u);return[e+(a*u+c*f)/l,t+(c*u-a*f)/l]}function u$(e,{x:t,x1:n,x2:r,y:i,y1:o,y2:s,...a}={}){return[n,r]=oy(t,n,r),[o,s]=oy(i,o,s),new sy(e,{...a,x1:n,x2:r,y1:o,y2:s})}var td=class extends vt{constructor(t,n,r={},i){super(t,n,r,i);let{inset:o=0,insetTop:s=o,insetRight:a=o,insetBottom:c=o,insetLeft:l=o,rx:u,ry:f}=r;this.insetTop=Nt(s),this.insetRight=Nt(a),this.insetBottom=Nt(c),this.insetLeft=Nt(l),this.rx=le(u,"auto"),this.ry=le(f,"auto")}render(t,n,r,i,o){let{rx:s,ry:a}=this;return ct("svg:g",o).call(kt,this,i,o).call(this._transform,this,n).call(c=>c.selectAll().data(t).enter().append("rect").call(Dt,this).attr("x",this._x(n,r,i)).attr("width",this._width(n,r,i)).attr("y",this._y(n,r,i)).attr("height",this._height(n,r,i)).call(ft,"rx",s).call(ft,"ry",a).call(Jt,this,r)).node()}_x(t,{x:n},{marginLeft:r}){let{insetLeft:i}=this;return n?o=>n[o]+i:r+i}_y(t,{y:n},{marginTop:r}){let{insetTop:i}=this;return n?o=>n[o]+i:r+i}_width({x:t},{x:n},{marginRight:r,marginLeft:i,width:o}){let{insetLeft:s,insetRight:a}=this,c=n&&t?t.bandwidth():o-r-i;return Math.max(0,c-s-a)}_height({y:t},{y:n},{marginTop:r,marginBottom:i,height:o}){let{insetTop:s,insetBottom:a}=this,c=n&&t?t.bandwidth():o-r-i;return Math.max(0,c-s-a)}},f$={ariaLabel:"bar"},ay=class extends td{constructor(t,n={}){let{x1:r,x2:i,y:o}=n;super(t,{x1:{value:r,scale:"x"},x2:{value:i,scale:"x"},y:{value:o,scale:"y",type:"band",optional:!0}},n,f$)}_transform(t,n,{x:r}){t.call(It,n,{x:r},0,0)}_x({x:t},{x1:n,x2:r},{marginLeft:i}){let{insetLeft:o}=this;return ir(t)?i+o:s=>Math.min(n[s],r[s])+o}_width({x:t},{x1:n,x2:r},{marginRight:i,marginLeft:o,width:s}){let{insetLeft:a,insetRight:c}=this;return ir(t)?s-i-o-a-c:l=>Math.max(0,Math.abs(r[l]-n[l])-a-c)}},cy=class extends td{constructor(t,n={}){let{x:r,y1:i,y2:o}=n;super(t,{y1:{value:i,scale:"y"},y2:{value:o,scale:"y"},x:{value:r,scale:"x",type:"band",optional:!0}},n,f$)}_transform(t,n,{y:r}){t.call(It,n,{y:r},0,0)}_y({y:t},{y1:n,y2:r},{marginTop:i}){let{insetTop:o}=this;return ir(t)?i+o:s=>Math.min(n[s],r[s])+o}_height({y:t},{y1:n,y2:r},{marginTop:i,marginBottom:o,height:s}){let{insetTop:a,insetBottom:c}=this;return ir(t)?s-i-o-a-c:l=>Math.max(0,Math.abs(r[l]-n[l])-a-c)}};function jo(e,t={}){return Sf(t)||(t={...t,y:Te,x2:G}),new ay(e,Zf(kw(Wf(t))))}function qo(e,t={}){return Sf(t)||(t={...t,x:Te,y2:G}),new cy(e,Jf(Cw(Hf(t))))}var rK={ariaLabel:"cell"},Rl=class extends td{constructor(t,{x:n,y:r,...i}={}){super(t,{x:{value:n,scale:"x",type:"band",optional:!0},y:{value:r,scale:"y",type:"band",optional:!0}},i,rK)}_transform(t,n){t.call(It,n,{},0,0)}};function lc(e,{x:t,y:n,...r}={}){return[t,n]=Re(t,n),new Rl(e,{...r,x:t,y:n})}function d$(e,{x:t=Te,fill:n,stroke:r,...i}={}){return n===void 0&&De(r)[0]===void 0&&(n=G),new Rl(e,{...i,x:t,fill:n,stroke:r})}function h$(e,{y:t=Te,fill:n,stroke:r,...i}={}){return n===void 0&&De(r)[0]===void 0&&(n=G),new Rl(e,{...i,y:t,fill:n,stroke:r})}var iK={ariaLabel:"dot",fill:"none",stroke:"currentColor",strokeWidth:1.5};function ly(e){return e.sort===void 0&&e.reverse===void 0?lw({channel:"-r"},e):e}var $l=class extends vt{constructor(t,n={}){let{x:r,y:i,r:o,rotate:s,symbol:a=Ys,frameAnchor:c}=n,[l,u]=ie(s,0),[f,d]=_F(a),[h,p]=ie(o,f==null?3:4.5);super(t,{x:{value:r,scale:"x",optional:!0},y:{value:i,scale:"y",optional:!0},r:{value:h,scale:"r",filter:er,optional:!0},rotate:{value:l,optional:!0},symbol:{value:f,scale:"auto",optional:!0}},ly(n),iK),this.r=p,this.rotate=u,this.symbol=d,this.frameAnchor=Co(c);let{channels:m}=this,{symbol:g}=m;if(g){let{fill:y,stroke:x}=m;g.hint={fill:y?y.value===g.value?"color":"currentColor":this.fill??"currentColor",stroke:x?x.value===g.value?"color":"currentColor":this.stroke??"none"}}}render(t,n,r,i,o){let{x:s,y:a}=n,{x:c,y:l,r:u,rotate:f,symbol:d}=r,{r:h,rotate:p,symbol:m}=this,[g,y]=pn(this,i),x=m===Ys,b=u?void 0:h*h*Math.PI;return Va(h)&&(t=[]),ct("svg:g",o).call(kt,this,i,o).call(It,this,{x:c&&s,y:l&&a}).call(w=>w.selectAll().data(t).enter().append(x?"circle":"path").call(Dt,this).call(x?_=>{_.attr("cx",c?v=>c[v]:g).attr("cy",l?v=>l[v]:y).attr("r",u?v=>u[v]:h)}:_=>{_.attr("transform",oc`translate(${c?v=>c[v]:g},${l?v=>l[v]:y})${f?v=>` rotate(${f[v]})`:p?` rotate(${p})`:""}`).attr("d",u&&d?v=>{let M=Zn();return d[v].draw(M,u[v]*u[v]*Math.PI),M}:u?v=>{let M=Zn();return m.draw(M,u[v]*u[v]*Math.PI),M}:d?v=>{let M=Zn();return d[v].draw(M,b),M}:(()=>{let v=Zn();return m.draw(v,b),v})())}).call(Jt,this,r)).node()}};function yi(e,{x:t,y:n,...r}={}){return r.frameAnchor===void 0&&([t,n]=Re(t,n)),new $l(e,{...r,x:t,y:n})}function p$(e,{x:t=G,...n}={}){return new $l(e,Rw({...n,x:t}))}function m$(e,{y:t=G,...n}={}){return new $l(e,Fw({...n,y:t}))}function y$(e,t){return yi(e,{...t,symbol:"circle"})}function g$(e,t){return yi(e,{...t,symbol:"hexagon"})}var oK={ariaLabel:"line",fill:"none",stroke:"currentColor",strokeWidth:1.5,strokeLinecap:"round",strokeLinejoin:"round",strokeMiterlimit:1},Pl=class extends vt{constructor(t,n={}){let{x:r,y:i,z:o,curve:s,tension:a}=n;super(t,{x:{value:r,scale:"x"},y:{value:i,scale:"y"},z:{value:Pn(n),optional:!0}},n,oK),this.z=o,this.curve=rv(s,a),Xi(this,n)}filter(t){return t}project(t,n,r){this.curve!==ac&&super.project(t,n,r)}render(t,n,r,i,o){let{x:s,y:a}=r,{curve:c}=this;return ct("svg:g",o).call(kt,this,i,o).call(It,this,n).call(l=>l.selectAll().data(bw(t,[s,a],this,r)).enter().append("path").call(Dt,this).call(El,this,r).call(WR,this,r,o).attr("d",c===ac&&o.projection?sK(o.projection,s,a):mm().curve(c).defined(u=>u>=0).x(u=>s[u]).y(u=>a[u]))).node()}};function sK(e,t,n){let r=Mn(e);return t=Je(t),n=Je(n),i=>{let o=[],s=[o];for(let a of i)a===-1?(o=[],s.push(o)):o.push([t[a],n[a]]);return r({type:"MultiLineString",coordinates:s})}}function Ul(e,{x:t,y:n,...r}={}){return[t,n]=Re(t,n),new Pl(e,{...r,x:t,y:n})}function uc(e,{x:t=G,y:n=Te,...r}={}){return new Pl(e,Gf({...r,x:t,y:n}))}function fc(e,{x:t=Te,y:n=G,...r}={}){return new Pl(e,Xf({...r,x:t,y:n}))}var aK={ariaLabel:"rect"},zl=class extends vt{constructor(t,n={}){let{x1:r,y1:i,x2:o,y2:s,inset:a=0,insetTop:c=a,insetRight:l=a,insetBottom:u=a,insetLeft:f=a,rx:d,ry:h}=n;super(t,{x1:{value:r,scale:"x",type:r!=null&&o==null?"band":void 0,optional:!0},y1:{value:i,scale:"y",type:i!=null&&s==null?"band":void 0,optional:!0},x2:{value:o,scale:"x",optional:!0},y2:{value:s,scale:"y",optional:!0}},n,aK),this.insetTop=Nt(c),this.insetRight=Nt(l),this.insetBottom=Nt(u),this.insetLeft=Nt(f),this.rx=le(d,"auto"),this.ry=le(h,"auto")}render(t,n,r,i,o){let{x:s,y:a}=n,{x1:c,y1:l,x2:u,y2:f}=r,{marginTop:d,marginRight:h,marginBottom:p,marginLeft:m,width:g,height:y}=i,{projection:x}=o,{insetTop:b,insetRight:w,insetBottom:_,insetLeft:v,rx:M,ry:E}=this,D=(s?.bandwidth?s.bandwidth():0)-v-w,I=(a?.bandwidth?a.bandwidth():0)-b-_;return ct("svg:g",o).call(kt,this,i,o).call(It,this,{},0,0).call(T=>T.selectAll().data(t).enter().append("rect").call(Dt,this).attr("x",c&&(x||!ir(s))?u?O=>Math.min(c[O],u[O])+v:O=>c[O]+v:m+v).attr("y",l&&(x||!ir(a))?f?O=>Math.min(l[O],f[O])+b:O=>l[O]+b:d+b).attr("width",c&&(x||!ir(s))?u?O=>Math.max(0,Math.abs(u[O]-c[O])+D):D:g-h-m-w-v).attr("height",l&&(x||!ir(a))?f?O=>Math.max(0,Math.abs(l[O]-f[O])+I):I:y-d-p-b-_).call(ft,"rx",M).call(ft,"ry",E).call(Jt,this,r)).node()}};function uy(e,t){return new zl(e,NA(DA(t)))}function ed(e,t={}){return Sf(t)||(t={...t,y:Te,x2:G,interval:1}),new zl(e,Zf(DA(Wf(t))))}function nd(e,t={}){return Sf(t)||(t={...t,x:Te,y2:G,interval:1}),new zl(e,Jf(NA(Hf(t))))}function ZA(e,t){t=cK(t);let{x:n,y:r,color:i,size:o}=t,s=av(e,n),a=av(e,r),c=av(e,i),l=av(e,o),{fx:u,fy:f,x:{value:d,reduce:h,zero:p,...m},y:{value:g,reduce:y,zero:x,...b},color:{value:w,color:_,reduce:v},size:{value:M,reduce:E},mark:D}=t;if(h===void 0&&(h=y==null&&d==null&&M==null&&g!=null?"count":null),y===void 0&&(y=h==null&&g==null&&M==null&&d!=null?"count":null),E===void 0&&M==null&&v==null&&h==null&&y==null&&(d==null||Ae(s))&&(g==null||Ae(a))&&(E="count"),p===void 0&&(p=cv(h)?!0:void 0),x===void 0&&(x=cv(y)?!0:void 0),d==null&&g==null)throw new Error("must specify x or y");if(h!=null&&g==null)throw new Error("reducing x requires y");if(y!=null&&d==null)throw new Error("reducing y requires x");D===void 0&&(D=M!=null||E!=null?"dot":cv(h)||cv(y)||v!=null?"bar":d!=null&&g!=null?Ae(s)||Ae(a)||h==null&&y==null&&!fy(s)&&!fy(a)?"dot":"line":d!=null||g!=null?"rule":null);let I,T,O;switch(D){case"dot":O=yi,T="stroke";break;case"line":O=s&&a||h!=null||y!=null?x||y!=null||s&&fy(s)?fc:p||h!=null||a&&fy(a)?uc:Ul:s?uc:fc,T="stroke",b$(c)&&(I=null);break;case"area":O=!(x||y!=null)&&(p||h!=null||a&&fy(a))?cc:oa,T="fill",b$(c)&&(I=null);break;case"rule":O=s?qr:Vr,T="stroke";break;case"bar":O=h!=null?Ae(a)?x$(h)&&s&&Ae(s)?lc:jo:ed:y!=null?Ae(s)?x$(y)&&a&&Ae(a)?lc:qo:nd:v!=null||E!=null?s&&Ae(s)&&a&&Ae(a)?lc:s&&Ae(s)?qo:a&&Ae(a)?jo:uy:s&&Js(s)&&!(a&&Js(a))?jo:a&&Js(a)&&!(s&&Js(s))?qo:lc,T="fill";break;default:throw new Error(`invalid mark: ${D}`)}let B={fx:u,fy:f,x:s??void 0,y:a??void 0,[T]:c??_,z:I,r:l??void 0,tip:!0},S,A={[T]:v??void 0,r:E??void 0};if(h!=null&&y!=null)throw new Error("cannot reduce both x and y");return y!=null?(A.y=y,S=Ae(s)?tc:Uo):h!=null?(A.x=h,S=Ae(a)?ec:zo):(v!=null||E!=null)&&(s&&a?S=Ae(s)&&Ae(a)?Pm:Ae(s)?zo:Ae(a)?Uo:ia:s?S=Ae(s)?tc:Uo:a&&(S=Ae(a)?ec:zo)),(S===ia||S===Uo)&&(B.x={value:s,...m}),(S===ia||S===zo)&&(B.y={value:a,...b}),p===void 0&&(p=s&&!(S===ia||S===Uo)&&(O===jo||O===cc||O===ed||O===Vr)),x===void 0&&(x=a&&!(S===ia||S===zo)&&(O===qo||O===oa||O===nd||O===qr)),{fx:u??null,fy:f??null,x:{value:d??null,reduce:h??null,zero:!!p,...m},y:{value:g??null,reduce:y??null,zero:!!x,...b},color:{value:w??null,reduce:v??null,..._!==void 0&&{color:_}},size:{value:M??null,reduce:E??null},mark:D,markImpl:w$[O],markOptions:B,transformImpl:w$[S],transformOptions:A,colorMode:T}}function v$(e,t){let n=ZA(e,t),{fx:r,fy:i,x:{zero:o},y:{zero:s},markOptions:a,transformOptions:c,colorMode:l}=n,u=HA[n.markImpl],f=HA[n.transformImpl],d=r!=null||i!=null?Yf({strokeOpacity:.1}):null,h=[o?qr([0]):null,s?Vr([0]):null],p=u(e,f?f(c,a):a);return l==="stroke"?Ke(d,h,p):Ke(d,p,h)}function fy(e){let t,n;for(let r of e){if(r==null)continue;if(t===void 0){t=r;continue}let i=Math.sign(Gt(t,r));if(i){if(n!==void 0&&i!==n)return!1;t=r,n=i}}return!0}function cK({x:e,y:t,color:n,size:r,fx:i,fy:o,mark:s}={}){return zr(e)||(e=rd(e)),zr(t)||(t=rd(t)),zr(n)||(n=Qa(n)?{color:n}:rd(n)),zr(r)||(r=rd(r)),zr(i)&&({value:i}=rd(i)),zr(o)&&({value:o}=rd(o)),s!=null&&(s=`${s}`.toLowerCase()),{x:e,y:t,color:n,size:r,fx:i,fy:o,mark:s}}function av(e,t){let n=pt(e,t.value);return n&&(n.label=En(t.value)),n}function rd(e){return lK(e)?{reduce:e}:{value:e}}function cv(e){return/^(?:distinct|count|sum|proportion)$/i.test(e)}function x$(e){return/^(?:first|last|mode)$/i.test(e)}function lK(e){if(e==null)return!1;if(typeof e.reduceIndex=="function"||typeof e.reduce=="function"&&fn(e)||/^p\d{2}$/i.test(e))return!0;switch(`${e}`.toLowerCase()){case"first":case"last":case"count":case"distinct":case"sum":case"proportion":case"proportion-facet":case"deviation":case"min":case"min-index":case"max":case"max-index":case"mean":case"median":case"variance":case"mode":return!0}return!1}function b$(e){return e?new kr(e).size>e.length>>1:!1}var HA={dot:yi,line:Ul,lineX:uc,lineY:fc,areaX:cc,areaY:oa,ruleX:qr,ruleY:Vr,barX:jo,barY:qo,rect:uy,rectX:ed,rectY:nd,cell:lc,bin:ia,binX:Uo,binY:zo,group:Pm,groupX:tc,groupY:ec},w$=Object.fromEntries(Object.entries(HA).map(([e,t])=>[t,e]));function id(e,t={}){let{x:n,x1:r,x2:i}=t;n===void 0&&r===void 0&&i===void 0&&(t={...t,x:n=G});let o={};return n!=null&&(o.x=e),r!=null&&(o.x1=e),i!=null&&(o.x2=e),gr(o,t)}function od(e,t={}){let{y:n,y1:r,y2:i}=t;n===void 0&&r===void 0&&i===void 0&&(t={...t,y:n=G});let o={};return n!=null&&(o.y=e),r!=null&&(o.y1=e),i!=null&&(o.y2=e),gr(o,t)}function gr(e={},t={}){let n=Pn(t),r=Object.entries(e).map(([i,o])=>{let s=iw(i,t);if(s==null)throw new Error(`missing channel: ${i}`);let[a,c]=dn(s);return{key:i,input:s,output:a,setOutput:c,map:uK(o)}});return{...hn(t,(i,o)=>{let s=pt(i,n),a=r.map(({input:l})=>pt(i,l)),c=r.map(({setOutput:l})=>l(new Array(i.length)));for(let l of o)for(let u of s?rn(l,f=>s[f]).values():[l])r.forEach(({map:f},d)=>f.mapIndex(u,a[d],c[d]));return{data:i,facets:o}}),...Object.fromEntries(r.map(({key:i,output:o})=>[i,o]))}}function uK(e){if(e==null)throw new Error("missing map");if(typeof e.mapIndex=="function")return e;if(typeof e.map=="function"&&fn(e))return fK(e);if(typeof e=="function")return JA(If(e));switch(`${e}`.toLowerCase()){case"cumsum":return hK;case"rank":return JA((t,n)=>np(t,r=>n[r]));case"quantile":return JA((t,n)=>dK(t,r=>n[r]))}throw new Error(`invalid map: ${e}`)}function fK(e){return console.warn("deprecated map interface; implement mapIndex instead."),{mapIndex:e.map.bind(e)}}function dK(e,t){let n=uo(e,t)-1;return np(e,t).map(r=>r/n)}function JA(e){return{mapIndex(t,n,r){let i=e(t,n);if(i.length!==t.length)throw new Error("map function returned a mismatched length");for(let o=0,s=t.length;o<s;++o)r[t[o]]=i[o]}}}var hK={mapIndex(e,t,n){let r=0;for(let i of e)n[i]=r+=t[i]}};function _$(e={},t){return arguments.length===1&&(t=e),id(sd(e),t)}function S$(e={},t){return arguments.length===1&&(t=e),od(sd(e),t)}function sd(e={}){typeof e=="number"&&(e={k:e});let{k:t,reduce:n,shift:r,anchor:i,strict:o}=e;if(i===void 0&&r!==void 0&&(i=mK(r),Un(`Warning: the shift option is deprecated; please use anchor "${i}" instead.`)),!((t=Math.floor(t))>0))throw new Error(`invalid k: ${t}`);return yK(n)(t,pK(i,t),o)}function pK(e="middle",t){switch(`${e}`.toLowerCase()){case"middle":return t-1>>1;case"start":return 0;case"end":return t-1}throw new Error(`invalid anchor: ${e}`)}function mK(e){switch(`${e}`.toLowerCase()){case"centered":return"middle";case"leading":return"start";case"trailing":return"end"}throw new Error(`invalid shift: ${e}`)}function yK(e="mean"){if(typeof e=="string"){if(/^p\d{2}$/i.test(e))return lv(_f(e));switch(e.toLowerCase()){case"deviation":return lv(ri);case"max":return uv((t,n)=>zt(t,r=>n[r]));case"mean":return gK;case"median":return lv(Pi);case"min":return uv((t,n)=>ce(t,r=>n[r]));case"mode":return uv((t,n)=>Du(t,r=>n[r]));case"sum":return I$;case"variance":return lv(Ea);case"difference":return wK;case"ratio":return vK;case"first":return _K;case"last":return SK}}if(typeof e!="function")throw new Error(`invalid reduce: ${e}`);return uv(If(e))}function lv(e){return(t,n,r)=>r?{mapIndex(i,o,s){let a=l=>o[l]==null?NaN:+o[l],c=0;for(let l=0;l<t-1;++l)isNaN(a(l))&&++c;for(let l=0,u=i.length-t+1;l<u;++l)isNaN(a(l+t-1))&&++c,s[i[l+n]]=c===0?e(Hs(i,l,l+t),a):NaN,isNaN(a(l))&&--c}}:{mapIndex(i,o,s){let a=c=>o[c]==null?NaN:+o[c];for(let c=-n;c<0;++c)s[i[c+n]]=e(Hs(i,0,c+t),a);for(let c=0,l=i.length-n;c<l;++c)s[i[c+n]]=e(Hs(i,c,c+t),a)}}}function uv(e){return(t,n,r)=>r?{mapIndex(i,o,s){let a=0;for(let c=0;c<t-1;++c)a+=Ue(o[i[c]]);for(let c=0,l=i.length-t+1;c<l;++c)a+=Ue(o[i[c+t-1]]),a===t&&(s[i[c+n]]=e(Hs(i,c,c+t),o)),a-=Ue(o[i[c]])}}:{mapIndex(i,o,s){for(let a=-n;a<0;++a)s[i[a+n]]=e(Hs(i,0,a+t),o);for(let a=0,c=i.length-n;a<c;++a)s[i[a+n]]=e(Hs(i,a,a+t),o)}}}function I$(e,t,n){return n?{mapIndex(r,i,o){let s=0,a=0;for(let c=0;c<e-1;++c){let l=i[r[c]];l===null||isNaN(l)?++s:a+=+l}for(let c=0,l=r.length-e+1;c<l;++c){let u=i[r[c]],f=i[r[c+e-1]];f===null||isNaN(f)?++s:a+=+f,o[r[c+t]]=s===0?a:NaN,u===null||isNaN(u)?--s:a-=+u}}}:{mapIndex(r,i,o){let s=0,a=r.length;for(let c=0,l=Math.min(a,e-t-1);c<l;++c)s+=+i[r[c]]||0;for(let c=-t,l=a-t;c<l;++c)s+=+i[r[c+e-1]]||0,o[r[c+t]]=s,s-=+i[r[c]]||0}}}function gK(e,t,n){if(n){let r=I$(e,t,n);return{mapIndex(i,o,s){r.mapIndex(i,o,s);for(let a=0,c=i.length-e+1;a<c;++a)s[i[a+t]]/=e}}}else return{mapIndex(r,i,o){let s=0,a=0,c=r.length;for(let l=0,u=Math.min(c,e-t-1);l<u;++l){let f=i[r[l]];f!==null&&!isNaN(f=+f)&&(s+=f,++a)}for(let l=-t,u=c-t;l<u;++l){let f=i[r[l+e-1]],d=i[r[l]];f!==null&&!isNaN(f=+f)&&(s+=f,++a),o[r[l+t]]=s/a,d!==null&&!isNaN(d=+d)&&(s-=d,--a)}}}}function xK(e,t,n,r){for(let i=n+r;n<i;++n){let o=e[t[n]];if(Ue(o))return o}}function bK(e,t,n,r){for(let i=n+r-1;i>=n;--i){let o=e[t[i]];if(Ue(o))return o}}function M$(e,t,n,r){for(let i=n+r;n<i;++n){let o=e[t[n]];if(o!==null&&!isNaN(o=+o))return o}}function T$(e,t,n,r){for(let i=n+r-1;i>=n;--i){let o=e[t[i]];if(o!==null&&!isNaN(o=+o))return o}}function wK(e,t,n){return n?{mapIndex(r,i,o){for(let s=0,a=r.length-e;s<a;++s){let c=i[r[s]],l=i[r[s+e-1]];o[r[s+t]]=c===null||l===null?NaN:l-c}}}:{mapIndex(r,i,o){for(let s=-t,a=r.length-e+t+1;s<a;++s)o[r[s+t]]=T$(i,r,s,e)-M$(i,r,s,e)}}}function vK(e,t,n){return n?{mapIndex(r,i,o){for(let s=0,a=r.length-e;s<a;++s){let c=i[r[s]],l=i[r[s+e-1]];o[r[s+t]]=c===null||l===null?NaN:l/c}}}:{mapIndex(r,i,o){for(let s=-t,a=r.length-e+t+1;s<a;++s)o[r[s+t]]=T$(i,r,s,e)/M$(i,r,s,e)}}}function _K(e,t,n){return n?{mapIndex(r,i,o){for(let s=0,a=r.length-e;s<a;++s)o[r[s+t]]=i[r[s]]}}:{mapIndex(r,i,o){for(let s=-t,a=r.length-e+t+1;s<a;++s)o[r[s+t]]=xK(i,r,s,e)}}}function SK(e,t,n){return n?{mapIndex(r,i,o){for(let s=0,a=r.length-e;s<a;++s)o[r[s+t]]=i[r[s+e-1]]}}:{mapIndex(r,i,o){for(let s=-t,a=r.length-e+t+1;s<a;++s)o[r[s+t]]=bK(i,r,s,e)}}}var sa={n:20,k:2,color:"currentColor",opacity:.2,strict:!0,anchor:"end"};function A$(e,{x:t=G,y:n,k:r=sa.k,color:i=sa.color,opacity:o=sa.opacity,fill:s=i,fillOpacity:a=o,stroke:c=i,strokeOpacity:l,strokeWidth:u,...f}={}){return Ke(ne(s)?null:cc(e,gr({x1:dc({k:-r,...f}),x2:dc({k:r,...f})},{x1:t,x2:t,y:n,fill:s,fillOpacity:a,...f})),ne(c)?null:uc(e,gr({x:dc(f)},{x:t,y:n,stroke:c,strokeOpacity:l,strokeWidth:u,...f})))}function E$(e,{x:t,y:n=G,k:r=sa.k,color:i=sa.color,opacity:o=sa.opacity,fill:s=i,fillOpacity:a=o,stroke:c=i,strokeOpacity:l,strokeWidth:u,...f}={}){return Ke(ne(s)?null:oa(e,gr({y1:dc({k:-r,...f}),y2:dc({k:r,...f})},{x:t,y1:n,y2:n,fill:s,fillOpacity:a,...f})),ne(c)?null:fc(e,gr({y:dc(f)},{x:t,y:n,stroke:c,strokeOpacity:l,strokeWidth:u,...f})))}function dc({n:e=sa.n,k:t=0,strict:n=sa.strict,anchor:r=sa.anchor}={}){return sd({k:e,reduce:i=>As(i)+t*(ri(i)||0),strict:n,anchor:r})}var IK={ariaLabel:"tick",fill:null,stroke:"currentColor"},fv=class extends vt{constructor(t,n,r){super(t,n,r,IK),Xi(this,r)}render(t,n,r,i,o){return ct("svg:g",o).call(kt,this,i,o).call(this._transform,this,n).call(s=>s.selectAll().data(t).enter().append("line").call(Dt,this).attr("x1",this._x1(n,r,i)).attr("x2",this._x2(n,r,i)).attr("y1",this._y1(n,r,i)).attr("y2",this._y2(n,r,i)).call(Jt,this,r).call(ra,this,r,o)).node()}},dy=class extends fv{constructor(t,n={}){let{x:r,y:i,inset:o=0,insetTop:s=o,insetBottom:a=o}=n;super(t,{x:{value:r,scale:"x"},y:{value:i,scale:"y",type:"band",optional:!0}},n),this.insetTop=Nt(s),this.insetBottom=Nt(a)}_transform(t,n,{x:r}){t.call(It,n,{x:r},Be,0)}_x1(t,{x:n}){return r=>n[r]}_x2(t,{x:n}){return r=>n[r]}_y1({y:t},{y:n},{marginTop:r}){let{insetTop:i}=this;return n&&t?o=>n[o]+i:r+i}_y2({y:t},{y:n},{height:r,marginBottom:i}){let{insetBottom:o}=this;return n&&t?s=>n[s]+t.bandwidth()-o:r-i-o}},hy=class extends fv{constructor(t,n={}){let{x:r,y:i,inset:o=0,insetRight:s=o,insetLeft:a=o}=n;super(t,{y:{value:i,scale:"y"},x:{value:r,scale:"x",type:"band",optional:!0}},n),this.insetRight=Nt(s),this.insetLeft=Nt(a)}_transform(t,n,{y:r}){t.call(It,n,{y:r},0,Be)}_x1({x:t},{x:n},{marginLeft:r}){let{insetLeft:i}=this;return n&&t?o=>n[o]+i:r+i}_x2({x:t},{x:n},{width:r,marginRight:i}){let{insetRight:o}=this;return n&&t?s=>n[s]+t.bandwidth()-o:r-i-o}_y1(t,{y:n}){return r=>n[r]}_y2(t,{y:n}){return r=>n[r]}};function dv(e,{x:t=G,...n}={}){return new dy(e,{...n,x:t})}function hv(e,{y:t=G,...n}={}){return new hy(e,{...n,y:t})}function N$(e,{x:t=G,y:n=null,fill:r="#ccc",fillOpacity:i,stroke:o="currentColor",strokeOpacity:s,strokeWidth:a=2,sort:c,...l}={}){let u=n!=null?ec:$m;return Ke(Vr(e,u({x1:QA,x2:KA},{x:t,y:n,stroke:o,strokeOpacity:s,...l})),jo(e,u({x1:"p25",x2:"p75"},{x:t,y:n,fill:r,fillOpacity:i,...l})),dv(e,u({x:"p50"},{x:t,y:n,stroke:o,strokeOpacity:s,strokeWidth:a,sort:c,...l})),yi(e,gr({x:O$},{x:t,y:n,z:n,stroke:o,strokeOpacity:s,...l})))}function D$(e,{y:t=G,x:n=null,fill:r="#ccc",fillOpacity:i,stroke:o="currentColor",strokeOpacity:s,strokeWidth:a=2,sort:c,...l}={}){let u=n!=null?tc:$m;return Ke(qr(e,u({y1:QA,y2:KA},{x:n,y:t,stroke:o,strokeOpacity:s,...l})),qo(e,u({y1:"p25",y2:"p75"},{x:n,y:t,fill:r,fillOpacity:i,...l})),hv(e,u({y:"p50"},{x:n,y:t,stroke:o,strokeOpacity:s,strokeWidth:a,sort:c,...l})),yi(e,gr({y:O$},{x:n,y:t,z:n,stroke:o,strokeOpacity:s,...l})))}function O$(e){let t=QA(e),n=KA(e);return e.map(r=>r<t||r>n?r:NaN)}function QA(e){let t=B$(e)*2.5-L$(e)*1.5;return ce(e,n=>n>=t?n:NaN)}function KA(e){let t=L$(e)*2.5-B$(e)*1.5;return zt(e,n=>n<=t?n:NaN)}function B$(e){return Gn(e,.25)}function L$(e){return Gn(e,.75)}var MK={ariaLabel:"raster",stroke:null,pixelSize:1};function ad(e,t){let n=+e;if(isNaN(n))throw new Error(`invalid ${t}: ${e}`);return n}function k$(e,t){let n=Math.floor(e);if(isNaN(n))throw new Error(`invalid ${t}: ${e}`);return n}var my=class extends vt{constructor(t,n,r={},i){let{width:o,height:s,x:a,y:c,x1:l=a==null?0:void 0,y1:u=c==null?0:void 0,x2:f=a==null?o:void 0,y2:d=c==null?s:void 0,pixelSize:h=i.pixelSize,blur:p=0,interpolate:m}=r;if(o!=null&&(o=k$(o,"width")),s!=null&&(s=k$(s,"height")),l!=null&&(l=ad(l,"x1")),u!=null&&(u=ad(u,"y1")),f!=null&&(f=ad(f,"x2")),d!=null&&(d=ad(d,"y2")),a==null&&(l==null||f==null))throw new Error("missing x");if(c==null&&(u==null||d==null))throw new Error("missing y");t!=null&&o!=null&&s!=null&&(a===void 0&&l!=null&&f!=null&&(a=LK(l,f,o,s)),c===void 0&&u!=null&&d!=null&&(c=kK(u,d,o,s))),super(t,{x:{value:a,scale:"x",optional:!0},y:{value:c,scale:"y",optional:!0},x1:{value:l==null?null:[l],scale:"x",optional:!0,filter:null},y1:{value:u==null?null:[u],scale:"y",optional:!0,filter:null},x2:{value:f==null?null:[f],scale:"x",optional:!0,filter:null},y2:{value:d==null?null:[d],scale:"y",optional:!0,filter:null},...n},r,i),this.width=o,this.height=s,this.pixelSize=ad(h,"pixelSize"),this.blur=ad(p,"blur"),this.interpolate=a==null||c==null?null:TK(m)}},yy=class extends my{constructor(t,n={}){let{imageRendering:r}=n;if(t==null){let{fill:i,fillOpacity:o}=n;ie(o)[0]!==void 0&&(n=pv("fillOpacity",n)),De(i)[0]!==void 0&&(n=pv("fill",n))}super(t,void 0,n,MK),this.imageRendering=le(r,"auto")}scale(t,{color:n,...r},i){return super.scale(t,r,i)}render(t,n,r,i,o){let s=n[r.channels.fill?.scale]??(A=>A),{x:a,y:c}=r,{document:l}=o,[u,f,d,h]=F$(r,i,o),p=d-u,m=h-f,{pixelSize:g,width:y=Math.round(Math.abs(p)/g),height:x=Math.round(Math.abs(m)/g)}=this,b=y*x,{fill:w,fillOpacity:_}=r,v=0;if(this.interpolate){let A=y/p,N=x/m,k=Xt(a,F=>(F-u)*A,Float64Array),R=Xt(c,F=>(F-f)*N,Float64Array);w&&(w=this.interpolate(t,y,x,k,R,w)),_&&(_=this.interpolate(t,y,x,k,R,_))}else this.data==null&&t&&(v=t.fi*b);let M=l.createElement("canvas");M.width=y,M.height=x;let E=M.getContext("2d"),D=E.createImageData(y,x),I=D.data,{r:T,g:O,b:B}=on(this.fill)??{r:0,g:0,b:0},S=(this.fillOpacity??1)*255;for(let A=0;A<b;++A){let N=A<<2;if(w){let k=s(w[A+v]);if(k==null){I[N+3]=0;continue}({r:T,g:O,b:B}=on(k))}_&&(S=_[A+v]*255),I[N+0]=T,I[N+1]=O,I[N+2]=B,I[N+3]=S}return this.blur>0&&OS(D,this.blur),E.putImageData(D,0,0),ct("svg:g",o).call(kt,this,i,o).call(It,this,n).call(A=>A.append("image").attr("transform",`translate(${u},${f}) scale(${Math.sign(d-u)},${Math.sign(h-f)})`).attr("width",Math.abs(p)).attr("height",Math.abs(m)).attr("preserveAspectRatio","none").call(ft,"image-rendering",this.imageRendering).call(Dt,this).attr("xlink:href",M.toDataURL())).node()}};function t3(e,t,n){arguments.length<3&&(n=t,t=null);let{x:r,y:i,[e]:o,...s}=n;return r===void 0&&i===void 0&&dF(t)&&(r=Ws,i=Ha,o===void 0&&(o=aF)),[t,{...s,x:r,y:i,[e]:o}]}function C$(){let[e,t]=t3("fill",...arguments);return new yy(e,e==null||t.fill!==void 0||t.fillOpacity!==void 0?t:{...t,fill:G})}function F$({x1:e,y1:t,x2:n,y2:r},i,{projection:o}){let{width:s,height:a,marginTop:c,marginRight:l,marginBottom:u,marginLeft:f}=i;return[e&&o==null?e[0]:f,t&&o==null?t[0]:c,n&&o==null?n[0]:s-l,r&&o==null?r[0]:a-u]}function e3({x1:e,y1:t,x2:n,y2:r},i,o,s){let a={};return e&&(a.x1=e),t&&(a.y1=t),n&&(a.x2=n),r&&(a.y2=r),F$(Of(a,i),o,s)}function pv(e,t={}){let{[e]:n}=t;if(typeof n!="function")throw new Error(`invalid ${e}: not a function`);return _e({...t,[e]:void 0},function(r,i,o,s,a,c){let{x:l,y:u}=s;if(!l)throw new Error("missing scale: x");if(!u)throw new Error("missing scale: y");let[f,d,h,p]=e3(o,s,a,c),m=h-f,g=p-d,{pixelSize:y}=this,{width:x=Math.round(Math.abs(m)/y),height:b=Math.round(Math.abs(g)/y)}=t,w=new Array(x*b*(i?i.length:1)),_=m/x,v=g/b,M=0;for(let E of i??[void 0])for(let D=.5;D<b;++D)for(let I=.5;I<x;++I,++M)w[M]=n(l.invert(f+I*_),u.invert(d+D*v),E);return{data:w,facets:i,channels:{[e]:{value:w,scale:"auto"}}}})}function TK(e){if(typeof e=="function")return e;if(e==null)return mv;switch(`${e}`.toLowerCase()){case"none":return mv;case"nearest":return r3;case"barycentric":return n3();case"random-walk":return i3()}throw new Error(`invalid interpolate: ${e}`)}function mv(e,t,n,r,i,o){let s=new Array(t*n);for(let a of e)r[a]<0||r[a]>=t||i[a]<0||i[a]>=n||(s[Math.floor(i[a])*t+Math.floor(r[a])]=o[a]);return s}function n3({random:e=ul(42)}={}){return(t,n,r,i,o,s)=>{let{points:a,triangles:c,hull:l}=ai.from(t,h=>i[h],h=>o[h]),u=new s.constructor(n*r).fill(NaN),f=new Uint8Array(n*r),d=BK(s,e);for(let h=0;h<c.length;h+=3){let p=c[h],m=c[h+1],g=c[h+2],y=a[2*p],x=a[2*m],b=a[2*g],w=a[2*p+1],_=a[2*m+1],v=a[2*g+1],M=Math.min(y,x,b),E=Math.max(y,x,b),D=Math.min(w,_,v),I=Math.max(w,_,v),T=(_-v)*(y-b)+(w-v)*(b-x);if(!T)continue;let O=s[t[p]],B=s[t[m]],S=s[t[g]];for(let A=Math.floor(M);A<E;++A)for(let N=Math.floor(D);N<I;++N){if(A<0||A>=n||N<0||N>=r)continue;let k=A+.5,R=N+.5,F=((_-v)*(k-b)+(R-v)*(b-x))/T;if(F<0)continue;let $=((v-w)*(k-b)+(R-v)*(y-b))/T;if($<0)continue;let P=1-F-$;if(P<0)continue;let U=A+n*N;u[U]=d(O,F,B,$,S,P,A,N),f[U]=1}}return AK(u,f,i,o,s,n,r,l,t,d),u}}function AK(e,t,n,r,i,o,s,a,c,l){n=Float64Array.from(a,h=>n[c[h]]),r=Float64Array.from(a,h=>r[c[h]]),i=Array.from(a,h=>i[c[h]]);let u=n.length,f=Array.from({length:u},(h,p)=>NK(p,n,r)),d=0;for(let h=0;h<s;++h){let p=h+.5;for(let m=0;m<o;++m){let g=m+o*h;if(!t[g]){let y=m+.5;for(let x=0;x<u;++x){let b=(u+d+(x%2?(x+1)/2:-x/2))%u;if(f[b](y,p)){let w=EK(n.at(b-1),r.at(b-1),n[b],r[b],y,p);e[g]=l(i.at(b-1),w,i[b],1-w,i[b],0,m,h),d=b;break}}}}}}function EK(e,t,n,r,i,o){let s=n-e,a=r-t,c=s*(n-i)+a*(r-o),l=s*(i-e)+a*(o-t);return c>0&&l>0?c/(c+l):+(c>l)}function py(e,t,n,r){return e*r-n*t}function NK(e,t,n){let r=t.length,i=t.at(e-2),o=n.at(e-2),s=t.at(e-1),a=n.at(e-1),c=t[e],l=n[e],u=t.at(e+1-r),f=n.at(e+1-r),d=s-c,h=a-l,p=i-s,m=o-a,g=c-u,y=l-f,x=Math.hypot(d,h),b=Math.hypot(p,m),w=Math.hypot(g,y);return(_,v)=>{let M=_-s,E=v-a,D=_-c,I=v-l;return py(M,E,D,I)>-1e-6&&py(M,E,d,h)*b-py(M,E,p,m)*x>-1e-6&&py(D,I,g,y)*x-py(D,I,d,h)*w<=0}}function r3(e,t,n,r,i,o){let s=new o.constructor(t*n),a=ai.from(e,u=>r[u],u=>i[u]),c,l;for(let u=.5,f=0;u<n;++u){l=c;for(let d=.5;d<t;++d,++f)l=a.find(d,u,l),d===.5&&(c=l),s[f]=o[e[l]]}return s}function i3({random:e=ul(42),minDistance:t=.5,maxSteps:n=2}={}){return(r,i,o,s,a,c)=>{let l=new c.constructor(i*o),u=ai.from(r,p=>s[p],p=>a[p]),f,d,h;for(let p=.5,m=0;p<o;++p){d=f;for(let g=.5;g<i;++g,++m){let y=g,x=p;h=d=u.find(y,x,d),g===.5&&(f=d);let b,w=0;for(;(b=Math.hypot(s[r[h]]-y,a[r[h]]-x))>t&&w<n;){let _=e(g,p,w)*2*Math.PI;y+=Math.cos(_)*b,x+=Math.sin(_)*b,h=u.find(y,x,h),++w}l[m]=c[r[h]]}}return l}}function DK(e,t,n,r,i,o){return t*e+r*n+o*i}function OK(e){return(t,n,r,i,o,s,a,c)=>{let l=e(a,c);return l<n?t:l<n+i?r:o}}function BK(e,t){return Js(e)||Oe(e)?DK:OK(t)}function LK(e,t,n){return{transform(r){let i=r.length,o=new Float64Array(i),s=(t-e)/n,a=e+s/2;for(let c=0;c<i;++c)o[c]=c%n*s+a;return o}}}function kK(e,t,n,r){return{transform(i){let o=i.length,s=new Float64Array(o),a=(t-e)/r,c=e+a/2;for(let l=0;l<o;++l)s[l]=Math.floor(l/n)%r*a+c;return s}}}var R$={ariaLabel:"contour",fill:"none",stroke:"currentColor",strokeMiterlimit:1,pixelSize:2},gy=class extends my{constructor(t,{smooth:n=!0,value:r,...i}={}){let o=xw({},i,R$);if(r===void 0){for(let a in o)if(o[a].value!=null){if(r!==void 0)throw new Error("ambiguous contour value");r=i[a],i[a]="value"}}if(r!=null){let a={transform:c=>c.map(l=>l.value),label:En(r)};for(let c in o)i[c]==="value"&&(i[c]=a)}if(t==null){if(r==null)throw new Error("missing contour value");i=pv("value",{value:r,...i}),r=null}else{let{interpolate:a}=i;r===void 0&&(r=G),a===void 0&&(i.interpolate="nearest")}super(t,{value:{value:r,optional:!0}},CK(i),R$);let s={geometry:{value:G}};for(let a in this.channels){let c=this.channels[a],{scale:l}=c;l==="x"||l==="y"||a==="value"||(s[a]=c,delete this.channels[a])}this.contourChannels=s,this.smooth=!!n}filter(t,{x:n,y:r,value:i,...o},s){return super.filter(t,o,s)}render(t,n,r,i,o){let{geometry:s}=r,a=Mn();return ct("svg:g",o).call(kt,this,i,o).call(It,this,n).call(c=>{c.selectAll().data(t).enter().append("path").call(Dt,this).attr("d",l=>a(s[l])).call(Jt,this,r)}).node()}};function CK({thresholds:e,interval:t,...n}){return e=YA(e,t,Na),_e(n,function(r,i,o,s,a,c){let[l,u,f,d]=e3(o,s,a,c),h=f-l,p=d-u,{pixelSize:m,width:g=Math.round(Math.abs(h)/m),height:y=Math.round(Math.abs(p)/m)}=this,x=g/h,b=y/p,w=o.value.value,_=[];if(this.interpolate){let{x:I,y:T}=rc(o,s,c),O=Xt(I,N=>(N-l)*x,Float64Array),B=Xt(T,N=>(N-u)*b,Float64Array),S=[o.x,o.y,o.value],A=[O,B,w];for(let N of i){let k=this.filter(N,S,A);_.push(this.interpolate(k,g,y,O,B,w))}}else if(i){let I=g*y,T=i.length;for(let O=0;O<T;++O)_.push(w.slice(O*I,O*I+I))}else _.push(w);if(this.blur>0)for(let I of _)Jh({data:I,width:g,height:y},this.blur);let v=FK(e,w,...RK(_));if(v===null)throw new Error(`unsupported thresholds: ${e}`);let{contour:M}=Fa().size([g,y]).smooth(this.smooth),E=[],D=[];for(let I of _)D.push(Pe(E.length,E.push(...Xt(v,T=>M(I,T)))));for(let{coordinates:I}of E)for(let T of I)for(let O of T)for(let B of O)B[0]=B[0]/x+l,B[1]=B[1]/b+u;return{data:E,facets:D,channels:mw(this.contourChannels,E)}})}function FK(e,t,n,r){if(typeof e?.range=="function")return e.range(e.floor(n),r);if(typeof e=="function"&&(e=e(t,n,r)),typeof e!="number")return je(e);let i=_n(...Eu(n,r,e),e);for(;i[i.length-1]>=r;)i.pop();for(;i[1]<n;)i.shift();return i}function P$(){return new gy(...t3("value",...arguments))}function RK(e){return[ce(e,t=>ce(t,$$)),zt(e,t=>zt(t,$$))]}function $$(e){return isFinite(e)?e:NaN}function j$(e,t){return o3(Uf,e,t)}function q$(e,t={}){return o3(zf,e,t)}function V$(e,t={}){return o3(Nl,e,t)}function o3(e,t,n={}){let{x:r,y:i,maxRadius:o}=n,s=e({px:r,py:i,maxRadius:o}),a=[];r!=null&&a.push(qr(t,U$("x",{...s,inset:-6},n))),i!=null&&a.push(Vr(t,U$("y",{...s,inset:-6},n))),r!=null&&a.push(Po(t,z$("x",{...s,dy:9,frameAnchor:"bottom",lineAnchor:"top"},n))),i!=null&&a.push(Po(t,z$("y",{...s,dx:-9,frameAnchor:"left",textAnchor:"end"},n)));for(let c of a)c.ariaLabel=`crosshair ${c.ariaLabel}`;return Ke(...a)}function Y$(e,{channels:t,...n},{facet:r,facetAnchor:i,fx:o,fy:s,[e]:a,channels:c,transform:l,initializer:u}){return{...n,facet:r,facetAnchor:i,fx:o,fy:s,[e]:a,channels:{...t,...c},transform:l,initializer:$K(e,u)}}function $K(e,t){return t==null?t:function(n,r,{x:i,y:o,px:s,py:a,...c},...l){let{channels:{x:u,y:f,...d}={},...h}=t.call(this,n,r,{...c,x:s,y:a},...l);return{channels:{...d,...u&&{px:u,...e==="x"&&{x:u}},...f&&{py:f,...e==="y"&&{y:f}}},...h}}}function U$(e,t,n){let{color:r="currentColor",opacity:i=.2,ruleStroke:o=r,ruleStrokeOpacity:s=i,ruleStrokeWidth:a}=n;return{...Y$(e,t,n),stroke:o,strokeOpacity:s,strokeWidth:a}}function z$(e,t,n){let{color:r="currentColor",textFill:i=r,textFillOpacity:o,textStroke:s="var(--plot-background)",textStrokeOpacity:a,textStrokeWidth:c=5}=n;return{...Y$(e,t,PK(e,n)),fill:i,fillOpacity:o,stroke:s,strokeOpacity:a,strokeWidth:c}}function PK(e,t){return _e(t,(n,r,i)=>({channels:{text:{value:zm(i,e)?.value}}}))}var UK={ariaLabel:"delaunay link",fill:"none",stroke:"currentColor",strokeMiterlimit:1},zK={ariaLabel:"delaunay mesh",fill:null,stroke:"currentColor",strokeOpacity:.2},jK={ariaLabel:"hull",fill:"none",stroke:"currentColor",strokeWidth:1.5,strokeMiterlimit:1},qK={ariaLabel:"voronoi",fill:"none",stroke:"currentColor",strokeMiterlimit:1},VK={ariaLabel:"voronoi mesh",fill:null,stroke:"currentColor",strokeOpacity:.2},s3=class extends vt{constructor(t,n={}){let{x:r,y:i,z:o,curve:s,tension:a}=n;super(t,{x:{value:r,scale:"x",optional:!0},y:{value:i,scale:"y",optional:!0},z:{value:o,optional:!0}},n,UK),this.curve=ny(s,a),Xi(this,n)}render(t,n,r,i,o){let{x:s,y:a}=n,{x:c,y:l,z:u}=r,{curve:f}=this,[d,h]=pn(this,i),p=c?x=>c[x]:un(d),m=l?x=>l[x]:un(h),g=this;function y(x){let b=-1,w=[],_={};for(let S in r)_[S]=[];let v=[],M=[],E=[],D=[];function I(S,A){S=x[S],A=x[A],w.push(++b),v[b]=p(S),E[b]=m(S),M[b]=p(A),D[b]=m(A);for(let N in r)_[N].push(r[N][A])}let{halfedges:T,hull:O,triangles:B}=ai.from(x,p,m);for(let S=0;S<T.length;++S){let A=T[S];A>S&&I(B[S],B[A])}for(let S=0;S<O.length;++S)I(O[S],O[(S+1)%O.length]);jt(this).selectAll().data(w).enter().append("path").call(Dt,g).attr("d",S=>{let A=Zn(),N=f(A);return N.lineStart(),N.point(v[S],E[S]),N.point(M[S],D[S]),N.lineEnd(),A}).call(Jt,g,_).call(ra,g,_,o)}return ct("svg:g",o).call(kt,this,i,o).call(It,this,{x:c&&s,y:l&&a}).call(u?x=>x.selectAll().data(rn(t,b=>u[b]).values()).enter().append("g").each(y):x=>x.datum(t).each(y)).node()}},xy=class extends vt{constructor(t,n={},r,i=({z:o})=>o){let{x:o,y:s}=n;super(t,{x:{value:o,scale:"x",optional:!0},y:{value:s,scale:"y",optional:!0},z:{value:i(n),optional:!0}},n,r)}render(t,n,r,i,o){let{x:s,y:a}=n,{x:c,y:l,z:u}=r,[f,d]=pn(this,i),h=c?y=>c[y]:un(f),p=l?y=>l[y]:un(d),m=this;function g(y){let x=ai.from(y,h,p);jt(this).append("path").datum(y[0]).call(Dt,m).attr("d",m._render(x,i)).call(Jt,m,r)}return ct("svg:g",o).call(kt,this,i,o).call(It,this,{x:c&&s,y:l&&a}).call(u?y=>y.selectAll().data(rn(t,x=>u[x]).values()).enter().append("g").each(g):y=>y.datum(t).each(g)).node()}},a3=class extends xy{constructor(t,n={}){super(t,n,zK),this.fill="none"}_render(t){return t.render()}},c3=class extends xy{constructor(t,n={}){super(t,n,jK,Pn)}_render(t){return t.renderHull()}},l3=class extends vt{constructor(t,n={}){let{x:r,y:i,z:o}=n;super(t,{x:{value:r,scale:"x",optional:!0},y:{value:i,scale:"y",optional:!0},z:{value:o,optional:!0}},n,qK)}render(t,n,r,i,o){let{x:s,y:a}=n,{x:c,y:l,z:u}=r,[f,d]=pn(this,i),h=c?y=>c[y]:un(f),p=l?y=>l[y]:un(d),m=this;function g(y){let x=ai.from(y,h,p),b=X$(x,i);jt(this).selectAll().data(y).enter().append("path").call(Dt,m).attr("d",(w,_)=>b.renderCell(_)).call(Jt,m,r)}return ct("svg:g",o).call(kt,this,i,o).call(It,this,{x:c&&s,y:l&&a}).call(u?y=>y.selectAll().data(rn(t,x=>u[x]).values()).enter().append("g").each(g):y=>y.datum(t).each(g)).node()}},u3=class extends xy{constructor(t,n){super(t,n,VK),this.fill="none"}_render(t,n){return X$(t,n).render()}};function X$(e,t){let{width:n,height:r,marginTop:i,marginRight:o,marginBottom:s,marginLeft:a}=t;return e.voronoi([a,i,n-o,r-s])}function by(e,t,{x:n,y:r,...i}={}){return[n,r]=Re(n,r),new e(t,{...i,x:n,y:r})}function G$(e,t){return by(s3,e,t)}function W$(e,t){return by(a3,e,t)}function H$(e,t){return by(c3,e,t)}function Z$(e,t){return by(l3,e,t)}function J$(e,t){return by(u3,e,t)}var YK={ariaLabel:"density",fill:"none",stroke:"currentColor",strokeMiterlimit:1},wy=class extends vt{constructor(t,{x:n,y:r,z:i,weight:o,fill:s,stroke:a,...c}={}){let l=Q$(s)&&(s="currentColor",!0),u=Q$(a)&&(a="currentColor",!0);super(t,{x:{value:n,scale:"x",optional:!0},y:{value:r,scale:"y",optional:!0},z:{value:Pn({z:i,fill:s,stroke:a}),optional:!0},weight:{value:o,optional:!0}},GK({...c,fill:s,stroke:a},l,u),YK),l&&(this.fill=void 0),u&&(this.stroke=void 0),this.z=i}filter(t){return t}render(t,n,r,i,o){let{contours:s}=r,a=Mn();return ct("svg:g",o).call(kt,this,i,o).call(It,this,{}).call(c=>c.selectAll().data(t).enter().append("path").call(Dt,this).call(Jt,this,r).attr("d",l=>a(s[l]))).node()}};function K$(e,{x:t,y:n,...r}={}){return[t,n]=Re(t,n),new wy(e,{...r,x:t,y:n})}var XK=new Set(["x","y","z","weight"]);function GK(e,t,n){let{bandwidth:i,thresholds:o}=e;return i=i===void 0?20:+i,o=o===void 0?20:typeof o?.[Symbol.iterator]=="function"?Je(o):+o,_e(e,function(s,a,c,l,u,f){let d=c.weight?Je(c.weight.value):null,h=c.z?.value,{z:p}=this,[m,g]=pn(this,u),{width:y,height:x}=u,{x:b,y:w}=rc(c,l,f),_=Object.fromEntries(Object.entries(c).filter(([B])=>!XK.has(B)).map(([B,S])=>[B,{...S,value:[]}])),v=t&&[],M=n&&[],E=bI().x(b?B=>b[B]:m).y(w?B=>w[B]:g).weight(d?B=>d[B]:1).size([y,x]).bandwidth(i),D=[];for(let B of a){let S=[];D.push(S);for(let A of h?qm(B,h,p):[B]){let N=E.contours(A);S.push([A,N])}}let I=o;if(!(I instanceof Sl)){let B=0;for(let S of D)for(let[,A]of S){let N=A.max;N>B&&(B=N)}I=Float64Array.from({length:o-1},(S,A)=>B*100*(A+1)/o)}let T=[],O=[];for(let B of D){let S=[];T.push(S);for(let[A,N]of B)for(let k of I){S.push(O.length),O.push(N(k/100)),v&&v.push(k),M&&M.push(k);for(let R in _)_[R].value.push(c[R].value[A[0]])}}return v&&v.push(0),M&&M.push(0),{data:s,facets:T,channels:{..._,...v&&{fill:{value:v,scale:"color"}},...M&&{stroke:{value:M,scale:"color"}},contours:{value:O}}}})}function Q$(e){return/^density$/i.test(e)}function n9(e,{x1:t,x2:n,y1:r,y2:i,x:o=t===void 0&&n===void 0?Te:void 0,y:s=r===void 0&&i===void 0?G:void 0,fill:a,positiveFill:c="#3ca951",negativeFill:l="#4269d0",fillOpacity:u=1,positiveFillOpacity:f=u,negativeFillOpacity:d=u,stroke:h,strokeOpacity:p,z:m=De(h)[0],clip:g,tip:y,render:x,...b}={}){return[t,n]=t9(o,t,n),[r,i]=t9(s,r,i),t===n&&r===i&&(r=hc(0)),{tip:y}=Yi({tip:y},"x"),Ke(ne(c)?null:Object.assign(ry(e,{x1:t,x2:n,y1:r,y2:i,z:m,fill:c,fillOpacity:f,render:Pf(x,e9(!0)),clip:g,...b}),{ariaLabel:"positive difference"}),ne(l)?null:Object.assign(ry(e,{x1:t,x2:n,y1:r,y2:i,z:m,fill:l,fillOpacity:d,render:Pf(x,e9(!1)),clip:g,...b}),{ariaLabel:"negative difference"}),Ul(e,{x:n,y:i,z:m,stroke:h,strokeOpacity:p,tip:y,clip:!0,...b}))}function t9(e,t,n){return t===void 0&&n===void 0?t=n=hc(e):t===void 0?(n=hc(n),t=e===void 0?n:hc(e)):n===void 0?(t=hc(t),n=e===void 0?t:hc(e)):(t=hc(t),n=hc(n)),[t,n]}function hc(e){let t,{value:n,label:r=En(n)}=pi(e);return{transform:i=>t||(t=pt(i,n)),label:r}}function e9(e){return(t,n,r,i,o,s)=>{let{x1:a,x2:c}=r,{height:l}=i,u=new Float32Array(a.length),f=new Float32Array(c.length);(e===Mw(n.y)<0?u:f).fill(l);let d=s(t,n,{...r,x2:a,y2:f},i,o),h=s(t,n,{...r,x1:c,y1:u},i,o),p=d.querySelector("g")??d,m=h.querySelector("g")??h;for(let g=0;p.firstChild;g+=2){let y=gw(),x=ct("svg:clipPath",o).attr("id",y).node();x.appendChild(p.firstChild),m.childNodes[g].setAttribute("clip-path",`url(#${y})`),m.insertBefore(x,m.childNodes[g])}return h}}var WK={ariaLabel:"geo",fill:"none",stroke:"currentColor",strokeWidth:1,strokeLinecap:"round",strokeLinejoin:"round",strokeMiterlimit:1},vy=class extends vt{constructor(t,n={}){let[r,i]=ie(n.r,3);super(t,{geometry:{value:n.geometry,scale:"projection"},r:{value:r,scale:"r",filter:er,optional:!0}},ly(n),WK),this.r=i}render(t,n,r,i,o){let{geometry:s,r:a}=r,c=Mn(o.projection??HK(n)),{r:l}=this;return Va(l)?t=[]:l!==void 0&&c.pointRadius(l),ct("svg:g",o).call(kt,this,i,o).call(It,this,n).call(u=>{u.selectAll().data(t).enter().append("path").call(Dt,this).attr("d",a?f=>c.pointRadius(a[f])(s[f]):f=>c(s[f])).call(Jt,this,r)}).node()}};function HK({x:e,y:t}){if(e||t)return e??=n=>n,t??=n=>n,cl({point(n,r){this.stream.point(e(n),t(r))}})}function yv(e,{geometry:t=G,...n}={}){switch(e?.type){case"FeatureCollection":e=e.features;break;case"GeometryCollection":e=e.geometries;break;case"Feature":case"LineString":case"MultiLineString":case"MultiPoint":case"MultiPolygon":case"Point":case"Polygon":case"Sphere":e=[e];break}return new vy(e,{geometry:t,...n})}function r9({strokeWidth:e=1.5,...t}={}){return yv({type:"Sphere"},{strokeWidth:e,...t})}function i9({strokeOpacity:e=.1,...t}={}){return yv(zI(),{strokeOpacity:e,...t})}var cd=.5,ld=0;function o9(e={fill:"count"},{binWidth:t,...n}={}){let{z:r}=n;return t=t===void 0?20:Nt(t),e=eA(e,n),Fo(e,"fill")&&(n.channels={...n.channels,fill:{value:[]}}),n.symbol===void 0&&(n.symbol="hexagon"),n.r===void 0&&!Fo(e,"r")&&(n.r=t/2),_e(n,(i,o,s,a,c,l)=>{let{x:u,y:f,z:d,fill:h,stroke:p,symbol:m}=s;if(u===void 0)throw new Error("missing channel: x");if(f===void 0)throw new Error("missing channel: y");({x:u,y:f}=rc(s,a,l)),d=d?d.value:pt(i,r),h=h?.value,p=p?.value,m=m?.value;let g=Um(e,{z:d,fill:h,stroke:p,symbol:m}),y=d&&[],x=h&&[],b=p&&[],w=m&&[],_=[],v=[],M=[],E=-1;for(let O of e)O.initialize(i);for(let O of o){let B=[];for(let S of e)S.scope("facet",O);for(let[S,A]of Ka(O,g))for(let{index:N,extent:k}of ZK(i,A,u,f,t)){B.push(++E),v.push(k.x),M.push(k.y),d&&y.push(g===d?S:d[N[0]]),h&&x.push(g===h?S:h[N[0]]),p&&b.push(g===p?S:p[N[0]]),m&&w.push(g===m?S:m[N[0]]);for(let R of e)R.reduce(N,k)}_.push(B)}let D=s.x.scale,I=s.y.scale,T={x:{value:v,source:a[D]?{value:Xt(v,a[D].invert),scale:D}:null},y:{value:M,source:a[I]?{value:Xt(M,a[I].invert),scale:I}:null},...d&&{z:{value:y}},...h&&{fill:{value:x,scale:"auto"}},...p&&{stroke:{value:b,scale:"auto"}},...m&&{symbol:{value:w,scale:"auto"}},...Object.fromEntries(e.map(({name:O,output:B})=>[O,{scale:"auto",label:B.label,radius:O==="r"?t/2:void 0,value:B.transform()}]))};return{data:i,facets:_,channels:T}})}function ZK(e,t,n,r,i){let o=i*(1.5/YT),s=new Map;for(let a of t){let c=n[a],l=r[a];if(isNaN(c)||isNaN(l))continue;let u=Math.round(l=(l-ld)/o),f=Math.round(c=(c-cd)/i-(u&1)/2),d=l-u;if(Math.abs(d)*3>1){let m=c-f,g=f+(c<f?-1:1)/2,y=u+(l<u?-1:1),x=c-g,b=l-y;m*m+d*d>x*x+b*b&&(f=g+(u&1?1:-1)/2,u=y)}let h=`${f},${u}`,p=s.get(h);p===void 0&&(p={index:[],extent:{data:e,x:(f+(u&1)/2)*i+cd,y:u*o+ld}},s.set(h,p)),p.index.push(a)}return s.values()}var JK={ariaLabel:"hexgrid",fill:"none",stroke:"currentColor",strokeOpacity:.1};function s9(e){return new _y(e)}var _y=class extends vt{constructor({binWidth:t=20,clip:n=!0,...r}={}){super(Wa,void 0,{clip:n,...r},JK),this.binWidth=Nt(t)}render(t,n,r,i,o){let{binWidth:s}=this,{marginTop:a,marginRight:c,marginBottom:l,marginLeft:u,width:f,height:d}=i,h=u-cd,p=f-c-cd,m=a-ld,g=d-l-ld,y=s/2,x=y*XT,b=x/2,w=y*2,_=x*1.5,v=Math.floor(h/w),M=Math.ceil(p/w),E=Math.floor((m+b)/_),D=Math.ceil((g-b)/_)+1,I=`m0,${pc(-x)}l${pc(y)},${pc(b)}v${pc(x)}l${pc(-y)},${pc(b)}`,T=I;for(let O=E;O<D;++O)for(let B=v;B<M;++B)T+=`M${pc(B*w+(O&1)*y)},${pc(O*_)}${I}`;return ct("svg:g",o).datum(0).call(kt,this,i,o).call(It,this,{},Be+cd,Be+ld).call(O=>O.append("path").call(Dt,this).call(Jt,this,r).attr("d",T)).node()}};function pc(e){return Math.round(e*1e3)/1e3}var QK={ariaLabel:"image",fill:null,stroke:null};function KK(e){return/^\.*\//.test(e)}function ttt(e){return/^(blob|data|file|http|https):/i.test(e)}function ett(e){return typeof e=="string"&&(KK(e)||ttt(e))?[void 0,e]:[e,void 0]}var Sy=class extends vt{constructor(t,n={}){let{x:r,y:i,r:o,width:s,height:a,rotate:c,src:l,preserveAspectRatio:u,crossOrigin:f,frameAnchor:d,imageRendering:h}=n;o==null&&(o=void 0),o===void 0&&s===void 0&&a===void 0?s=a=16:s===void 0&&a!==void 0?s=a:a===void 0&&s!==void 0&&(a=s);let[p,m]=ett(l),[g,y]=ie(o),[x,b]=ie(s,y!==void 0?y*2:void 0),[w,_]=ie(a,y!==void 0?y*2:void 0),[v,M]=ie(c,0);super(t,{x:{value:r,scale:"x",optional:!0},y:{value:i,scale:"y",optional:!0},r:{value:g,scale:"r",filter:er,optional:!0},width:{value:x,filter:er,optional:!0},height:{value:w,filter:er,optional:!0},rotate:{value:v,optional:!0},src:{value:p,optional:!0}},ly(n),QK),this.src=m,this.width=b,this.rotate=M,this.height=_,this.r=y,this.preserveAspectRatio=le(u,"xMidYMid"),this.crossOrigin=ze(f),this.frameAnchor=Co(d),this.imageRendering=le(h,"auto")}render(t,n,r,i,o){let{x:s,y:a}=n,{x:c,y:l,width:u,height:f,r:d,rotate:h,src:p}=r,{r:m,width:g,height:y,rotate:x}=this,[b,w]=pn(this,i);return ct("svg:g",o).call(kt,this,i,o).call(It,this,{x:c&&s,y:l&&a}).call(_=>_.selectAll().data(t).enter().append("image").call(Dt,this).attr("x",a9(c,u,d,b,g,m)).attr("y",a9(l,f,d,w,y,m)).attr("width",u?v=>u[v]:g!==void 0?g:d?v=>d[v]*2:m*2).attr("height",f?v=>f[v]:y!==void 0?y:d?v=>d[v]*2:m*2).attr("transform",h?v=>`rotate(${h[v]})`:x?`rotate(${x})`:null).attr("transform-origin",h||x?oc`${c?v=>c[v]:b}px ${l?v=>l[v]:w}px`:null).call(ft,"href",p?v=>p[v]:this.src).call(ft,"preserveAspectRatio",this.preserveAspectRatio).call(ft,"crossorigin",this.crossOrigin).call(ft,"image-rendering",this.imageRendering).call(ft,"clip-path",d?v=>`circle(${d[v]}px)`:m!==void 0?`circle(${m}px)`:null).call(Jt,this,r)).node()}};function a9(e,t,n,r,i,o){return t&&e?s=>e[s]-t[s]/2:t?s=>r-t[s]/2:e&&i!==void 0?s=>e[s]-i/2:i!==void 0?r-i/2:n&&e?s=>e[s]-n[s]:n?s=>r-n[s]:e?s=>e[s]-o:r-o}function c9(e,{x:t,y:n,...r}={}){return r.frameAnchor===void 0&&([t,n]=Re(t,n)),new Sy(e,{...r,x:t,y:n})}function ntt(e,t,n){var r=1e-8,i=t-1,o=n-1,s=0,a,c,l,u,f,d,h,p,m,g,y;if(e<=0)return 0;if(e>=1)return 1;for(t>=1&&n>=1?(l=e<.5?e:1-e,u=Math.sqrt(-2*Math.log(l)),h=(2.30753+u*.27061)/(1+u*(.99229+u*.04481))-u,e<.5&&(h=-h),p=(h*h-3)/6,m=2/(1/(2*t-1)+1/(2*n-1)),g=h*Math.sqrt(p+m)/m-(1/(2*n-1)-1/(2*t-1))*(p+5/6-2/(3*m)),h=t/(t+n*Math.exp(2*g))):(a=Math.log(t/(t+n)),c=Math.log(n/(t+n)),u=Math.exp(t*a)/t,f=Math.exp(n*c)/n,g=u+f,e<u/g?h=Math.pow(t*g*e,1/t):h=1-Math.pow(n*g*(1-e),1/n)),y=-ud(t)-ud(n)+ud(t+n);s<10;s++){if(h===0||h===1)return h;if(d=rtt(h,t,n)-e,u=Math.exp(i*Math.log(h)+o*Math.log(1-h)+y),f=d/u,h-=u=f/(1-.5*Math.min(1,f*(i/h-o/(1-h)))),h<=0&&(h=.5*(h+u)),h>=1&&(h=.5*(h+u+1)),Math.abs(u)<r*h&&s>0)break}return h}function rtt(e,t,n){var r=e===0||e===1?0:Math.exp(ud(t+n)-ud(t)-ud(n)+t*Math.log(e)+n*Math.log(1-e));return e<0||e>1?!1:e<(t+1)/(t+n+2)?r*l9(e,t,n)/t:1-r*l9(1-e,n,t)/n}function l9(e,t,n){var r=1e-30,i=1,o=t+n,s=t+1,a=t-1,c=1,l=1-o*e/s,u,f,d,h;for(Math.abs(l)<r&&(l=r),l=1/l,h=l;i<=100&&(u=2*i,f=i*(n-i)*e/((a+u)*(t+u)),l=1+f*l,Math.abs(l)<r&&(l=r),c=1+f/c,Math.abs(c)<r&&(c=r),l=1/l,h*=l*c,f=-(t+i)*(o+i)*e/((t+u)*(s+u)),l=1+f*l,Math.abs(l)<r&&(l=r),c=1+f/c,Math.abs(c)<r&&(c=r),l=1/l,d=l*c,h*=d,!(Math.abs(d-1)<3e-7));i++);return h}function ud(e){var t=0,n=[76.18009172947146,-86.5053203294167,24.01409824083091,-1.231739572450155,.001208650973866179,-5395239384953e-18],r=1.000000000190015,i,o,s;for(s=(o=i=e)+5.5,s-=(i+.5)*Math.log(s);t<6;t++)r+=n[t]/++o;return Math.log(2.506628274631*r/i)-s}function u9(e,t){var n=ntt(2*Math.min(e,1-e),.5*t,.5);return n=Math.sqrt(t*(1-n)/n),e>.5?n:-n}var itt={ariaLabel:"linear-regression",fill:"currentColor",fillOpacity:.1,stroke:"currentColor",strokeWidth:1.5,strokeLinecap:"round",strokeLinejoin:"round",strokeMiterlimit:1},gv=class extends vt{constructor(t,n={}){let{x:r,y:i,z:o,ci:s=.95,precision:a=4}=n;if(super(t,{x:{value:r,scale:"x"},y:{value:i,scale:"y"},z:{value:Pn(n),optional:!0}},n,itt),this.z=o,this.ci=+s,this.precision=+a,!(0<=this.ci&&this.ci<1))throw new Error(`invalid ci; not in [0, 1): ${s}`);if(!(this.precision>0))throw new Error(`invalid precision: ${a}`)}render(t,n,r,i,o){let{x:s,y:a,z:c}=r,{ci:l}=this;return ct("svg:g",o).call(kt,this,i,o).call(It,this,n).call(u=>u.selectAll().data(c?qm(t,c,this.z):[t]).enter().call(f=>f.append("path").attr("fill","none").call(Dt,this).call(El,this,{...r,fill:null,fillOpacity:null}).attr("d",d=>this._renderLine(d,s,a)).call(l&&!Qs(this.fill)?d=>d.select(ott).attr("stroke","none").call(Dt,this).call(El,this,{...r,stroke:null,strokeOpacity:null,strokeWidth:null}).attr("d",h=>this._renderBand(h,s,a)):()=>{}))).node()}};function ott(){return this.parentNode.insertBefore(this.ownerDocument.createElementNS(ii.svg,"path"),this)}var f3=class extends gv{constructor(t,n){super(t,n)}_renderBand(t,n,r){let{ci:i,precision:o}=this,[s,a]=ae(t,u=>r[u]),c=xv(t,r,n),l=h9(t,r,n,(1-i)/2,c);return df().y(u=>u).x0(u=>l(u,-1)).x1(u=>l(u,1))(Pe(s,a-o/2,o).concat(a))}_renderLine(t,n,r){let[i,o]=ae(t,a=>r[a]),s=xv(t,r,n);return`M${s(i)},${i}L${s(o)},${o}`}},d3=class extends gv{constructor(t,n){super(t,n)}_renderBand(t,n,r){let{ci:i,precision:o}=this,[s,a]=ae(t,u=>n[u]),c=xv(t,n,r),l=h9(t,n,r,(1-i)/2,c);return df().x(u=>u).y0(u=>l(u,-1)).y1(u=>l(u,1))(Pe(s,a-o/2,o).concat(a))}_renderLine(t,n,r){let[i,o]=ae(t,a=>n[a]),s=xv(t,n,r);return`M${i},${s(i)}L${o},${s(o)}`}};function f9(e,{y:t=Te,x:n=G,stroke:r,fill:i=ne(r)?"currentColor":r,...o}={}){return new f3(e,Gf({...o,x:n,y:t,fill:i,stroke:r}))}function d9(e,{x:t=Te,y:n=G,stroke:r,fill:i=ne(r)?"currentColor":r,...o}={}){return new d3(e,Xf({...o,x:t,y:n,fill:i,stroke:r}))}function xv(e,t,n){let r=0,i=0,o=0,s=0;for(let u of e){let f=t[u],d=n[u];r+=f,i+=d,o+=f*d,s+=f*f}let a=e.length,c=(a*o-r*i)/(a*s-r*r),l=(i-c*r)/a;return u=>c*u+l}function h9(e,t,n,r,i){let o=Sn(e,u=>t[u])/e.length,s=0,a=0;for(let u of e)s+=(t[u]-o)**2,a+=(n[u]-i(t[u]))**2;let c=Math.sqrt(a/(e.length-2)),l=u9(r,e.length-2);return(u,f)=>{let d=i(u),h=c*Math.sqrt(1/e.length+(u-o)**2/s);return d+f*l*h}}function Iy({path:e=G,delimiter:t,frameAnchor:n,treeLayout:r=ll,treeSort:i,treeSeparation:o,treeAnchor:s,treeFilter:a,...c}={}){s=_v(s),i=y9(i),a!=null&&(a=p3(a)),n===void 0&&(n=s.frameAnchor);let l=g9(t),u=I9(c,p3),[f,d]=dn(),[h,p]=dn();return{x:f,y:h,frameAnchor:n,...hn(c,(m,g)=>{let y=l(pt(m,e)),x=d([]),b=p([]),w=-1,_=[],v=[],M=yb().path(D=>y[D]),E=r();E.nodeSize&&E.nodeSize([1,1]),E.separation&&o!==void 0&&E.separation(o??km);for(let D of u)D[wv]=D[_9]([]);for(let D of g){let I=[],T=M(D.filter(O=>y[O]!=null)).each(O=>O.data=m[O.data]);i!=null&&T.sort(i),E(T);for(let O of T.descendants())if(!(a!=null&&!a(O))){I.push(++w),_[w]=O.data,s.position(O,w,x,b);for(let B of u)B[wv][w]=B[S9](O)}v.push(I)}return{data:_,facets:v}}),...Object.fromEntries(u)}}function vv({path:e=G,delimiter:t,curve:n="bump-x",stroke:r="#555",strokeWidth:i=1.5,strokeOpacity:o=.5,treeLayout:s=ll,treeSort:a,treeSeparation:c,treeAnchor:l,treeFilter:u,...f}={}){l=_v(l),a=y9(a),u!=null&&(u=m9(u)),f={curve:n,stroke:r,strokeWidth:i,strokeOpacity:o,...f};let d=g9(t),h=I9(f,m9),[p,m]=dn(),[g,y]=dn(),[x,b]=dn(),[w,_]=dn();return{x1:p,x2:g,y1:x,y2:w,...hn(f,(v,M)=>{let E=d(pt(v,e)),D=m([]),I=y([]),T=b([]),O=_([]),B=-1,S=[],A=[],N=yb().path(R=>E[R]),k=s();k.nodeSize&&k.nodeSize([1,1]),k.separation&&c!==void 0&&k.separation(c??km);for(let R of h)R[wv]=R[_9]([]);for(let R of M){let F=[],$=N(R.filter(P=>E[P]!=null)).each(P=>P.data=v[P.data]);a!=null&&$.sort(a),k($);for(let{source:P,target:U}of $.links())if(!(u!=null&&!u(U,P))){F.push(++B),S[B]=U.data,l.position(P,B,D,T),l.position(U,B,I,O);for(let W of h)W[wv][B]=W[S9](U,P)}A.push(F)}return{data:S,facets:A}}),...Object.fromEntries(h)}}function _v(e="left"){switch(`${e}`.trim().toLowerCase()){case"left":return stt;case"right":return att}throw new Error(`invalid tree anchor: ${e}`)}var stt={frameAnchor:"left",dx:6,position({x:e,y:t},n,r,i){r[n]=t,i[n]=-e}},att={frameAnchor:"right",dx:-6,position({x:e,y:t},n,r,i){r[n]=-t,i[n]=-e}};function y9(e){return e==null||typeof e=="function"?e:`${e}`.trim().toLowerCase().startsWith("node:")?p9(p3(e)):p9(ctt(e))}function p9(e){return(t,n)=>ln(e(t),e(n))}function ctt(e){return t=>t.data?.[e]}function g9(e="/"){if(e=`${e}`,e==="/")return n=>n;if(e.length!==1)throw new Error("delimiter must be exactly one character");let t=e.charCodeAt(0);return n=>n.map(r=>ltt(r,t))}var h3=92,x9=47;function ltt(e,t){if(t===h3)throw new Error("delimiter cannot be backslash");let n=!1;for(let r=0,i=e.length;r<i;++r){switch(e.charCodeAt(r)){case h3:if(!n){n=!0;continue}break;case t:n?(e=e.slice(0,r-1)+e.slice(r),--r,--i):e=e.slice(0,r)+"/"+e.slice(r+1);break;case x9:n?(e=e.slice(0,r)+"\\\\"+e.slice(r),r+=2,i+=2):(e=e.slice(0,r)+"\\"+e.slice(r),++r,++i);break}n=!1}return e}function utt(e){let t=!1;for(let n=0,r=e.length;n<r;++n){switch(e.charCodeAt(n)){case h3:if(!t){t=!0;continue}case x9:t&&(e=e.slice(0,n-1)+e.slice(n),--n,--r);break}t=!1}return e}function b9(e){return fn(e)&&typeof e.node=="function"}function ftt(e){return fn(e)&&typeof e.link=="function"}function p3(e){if(b9(e))return e.node;if(e=`${e}`.trim().toLowerCase(),!!e.startsWith("node:")){switch(e){case"node:name":return y3;case"node:path":return m3;case"node:internal":return w9;case"node:external":return v9;case"node:depth":return g3;case"node:height":return x3}throw new Error(`invalid node value: ${e}`)}}function m9(e){if(b9(e))return e.node;if(ftt(e))return e.link;if(e=`${e}`.trim().toLowerCase(),!(!e.startsWith("node:")&&!e.startsWith("parent:"))){switch(e){case"parent:name":return bv(y3);case"parent:path":return bv(m3);case"parent:depth":return bv(g3);case"parent:height":return bv(x3);case"node:name":return y3;case"node:path":return m3;case"node:internal":return w9;case"node:external":return v9;case"node:depth":return g3;case"node:height":return x3}throw new Error(`invalid link value: ${e}`)}}function m3(e){return e.id}function y3(e){return dtt(e.id)}function g3(e){return e.depth}function x3(e){return e.height}function w9(e){return!!e.children}function v9(e){return!e.children}function bv(e){return(t,n)=>n==null?void 0:e(n)}function dtt(e){let t=e.length;for(;--t>0&&!htt(e,t););return utt(e.slice(t+1))}function htt(e,t){if(e[t]==="/"){let n=0;for(;t>0&&e[--t]==="\\";)++n;if(!(n&1))return!0}return!1}var _9=2,S9=3,wv=4;function I9(e,t){let n=[];for(let r in e){let i=e[r],o=t(i);o!==void 0&&n.push([r,...dn(i),o])}return n}function b3(e,{fill:t,stroke:n,strokeWidth:r,strokeOpacity:i,strokeLinejoin:o,strokeLinecap:s,strokeMiterlimit:a,strokeDasharray:c,strokeDashoffset:l,marker:u,markerStart:f=u,markerEnd:d=u,dot:h=ne(f)&&ne(d),text:p="node:name",textStroke:m="var(--plot-background)",title:g="node:path",dx:y,dy:x,textAnchor:b,treeLayout:w=ll,textLayout:_=w===ll||w===pb?"mirrored":"normal",tip:v,...M}={}){if(y===void 0&&(y=_v(M.treeAnchor).dx),b!==void 0)throw new Error("textAnchor is not a configurable tree option");_=Qe(_,"textLayout",["mirrored","normal"]);function E(D){return Po(e,Iy({treeLayout:w,text:p,fill:t===void 0?"currentColor":t,stroke:m,dx:y,dy:x,title:g,...D,...M}))}return Ke(sv(e,vv({treeLayout:w,markerStart:f,markerEnd:d,stroke:n!==void 0?n:t===void 0?"node:internal":t,strokeWidth:r,strokeOpacity:i,strokeLinejoin:o,strokeLinecap:s,strokeMiterlimit:a,strokeDasharray:c,strokeDashoffset:l,...M})),h?yi(e,Iy({treeLayout:w,fill:t===void 0?"node:internal":t,title:g,tip:v,...M})):null,p!=null?_==="mirrored"?[E({textAnchor:"start",treeFilter:"node:external"}),E({textAnchor:"end",treeFilter:"node:internal",dx:-y})]:E():null)}function M9(e,t){return b3(e,{...t,treeLayout:pb})}function T9({geometry:e=G,...t}={}){return _e({...t,x:null,y:null},(n,r,i,o,s,{projection:a})=>{let c=pt(n,e),l=c.length,u=new Float64Array(l),f=new Float64Array(l),d=Mn(a);for(let h=0;h<l;++h)[u[h],f[h]]=d.centroid(c[h]);return{data:n,facets:r,channels:{x:{value:u,scale:a==null?"x":null,source:null},y:{value:f,scale:a==null?"y":null,source:null}}}})}function A9({geometry:e=G,...t}={}){let n;return{...t,x:{transform:r=>Float64Array.from(n=pt(pt(r,e),CI),([i])=>i)},y:{transform:()=>Float64Array.from(n,([,r])=>r)}}}var $9=OU(R9(),1);var vtt=({marginLeft:e})=>[1,e],_tt=({width:e,marginRight:t})=>[-1,e-t],Stt=({width:e,marginLeft:t,marginRight:n})=>[0,(t+e-n)/2],Itt=({marginTop:e})=>[1,e],Mtt=({height:e,marginBottom:t})=>[-1,e-t],Ttt=({height:e,marginTop:t,marginBottom:n})=>[0,(t+e-n)/2];function P9(e){return typeof e=="string"?{anchor:e}:e}function U9(e={},t={}){arguments.length===1&&([e,t]=j9(e));let{anchor:n="left",padding:r=1,r:i=t.r}=P9(e);switch(`${n}`.toLowerCase()){case"left":n=vtt;break;case"right":n=_tt;break;case"middle":n=Stt;break;default:throw new Error(`unknown dodge anchor: ${n}`)}return q9("x","y",n,Nt(r),i,t)}function z9(e={},t={}){arguments.length===1&&([e,t]=j9(e));let{anchor:n="bottom",padding:r=1,r:i=t.r}=P9(e);switch(`${n}`.toLowerCase()){case"top":n=Itt;break;case"bottom":n=Mtt;break;case"middle":n=Ttt;break;default:throw new Error(`unknown dodge anchor: ${n}`)}return q9("y","x",n,Nt(r),i,t)}function j9(e){let{anchor:t,padding:n,...r}=e,{r:i}=r;return[{anchor:t,padding:n,r:i},r]}function q9(e,t,n,r,i,o){if(i!=null&&typeof i!="number"){let{channels:s,sort:a,reverse:c}=o;s=Fm(s),s?.r===void 0&&(o={...o,channels:{...s,r:{value:i,scale:"r"}}}),a===void 0&&c===void 0&&(o.sort={channel:"-r"})}return _e(o,function(s,a,c,l,u,f){let{[t]:d,r:h}=c;if(!c[t])throw new Error(`missing channel: ${t}`);({[t]:d}=rc(c,l,f));let p=h?void 0:i!==void 0?Nt(i):this.r!==void 0?this.r:3;h&&(h=pt(h.value,l[h.scale]||G,Float64Array));let[m,g]=n(u),y=m?Ett:Att,x=new Float64Array(d.length),b=h?w=>h[w]:()=>p;for(let w of a){let _=(0,$9.default)();w=w.filter(h?M=>gf(d[M])&&er(h[M]):M=>gf(d[M]));let v=new Float64Array(2*w.length+2);for(let M of w){let E=b(M),D=m?E+r:0,I=d[M]-E,T=d[M]+E,O=2;_.queryInterval(I-r,T+r,([,,S])=>{let A=x[S]-D,N=d[M]-d[S],k=r+(h?h[M]+h[S]:2*p),R=Math.sqrt(k*k-N*N);v[O++]=A-R,v[O++]=A+R});let B=v.slice(0,O);m&&(B=B.filter(S=>S>=0));t:for(let S of B.sort(y)){for(let A=0;A<O;A+=2)if(v[A]+1e-6<S&&S<v[A+1]-1e-6)continue t;x[M]=S+D;break}_.insert([I,T,M])}}m||(m=1);for(let w of a)for(let _ of w)x[_]=x[_]*m+g;return{data:s,facets:a,channels:{[e]:{value:x,source:null},[t]:{value:d,source:c[t]},...h&&{r:{value:h,source:c.r}}}}})}function Att(e,t){return Math.abs(e)-Math.abs(t)}function Ett(e,t){return e-t}function Y9(e,t){return arguments.length===1&&({basis:e,...t}=e),id(Mv(e),t)}function X9(e,t){return arguments.length===1&&({basis:e,...t}=e),od(Mv(e),t)}function Mv(e){if(e===void 0)return V9;if(typeof e=="function")return Tv(If(e));if(/^p\d{2}$/i.test(e))return pd(_f(e));switch(`${e}`.toLowerCase()){case"deviation":return Ott;case"first":return V9;case"last":return Dtt;case"max":return Btt;case"mean":return Ltt;case"median":return ktt;case"min":return Ctt;case"sum":return Ftt;case"extent":return Ntt}throw new Error(`invalid basis: ${e}`)}function Tv(e){return{mapIndex(t,n,r){let i=+e(t,n);for(let o of t)r[o]=n[o]===null?NaN:n[o]/i}}}function pd(e){return Tv((t,n)=>e(t,r=>n[r]))}var Ntt={mapIndex(e,t,n){let[r,i]=ae(e,s=>t[s]),o=i-r;for(let s of e)n[s]=t[s]===null?NaN:(t[s]-r)/o}},V9=Tv((e,t)=>{for(let n=0;n<e.length;++n){let r=t[e[n]];if(Ue(r))return r}}),Dtt=Tv((e,t)=>{for(let n=e.length-1;n>=0;--n){let r=t[e[n]];if(Ue(r))return r}}),Ott={mapIndex(e,t,n){let r=As(e,o=>t[o]),i=ri(e,o=>t[o]);for(let o of e)n[o]=t[o]===null?NaN:i?(t[o]-r)/i:0}},Btt=pd(zt),Ltt=pd(As),ktt=pd(Pi),Ctt=pd(ce),Ftt=pd(Sn);function G9(e,t){return Rtt("x",e,t)}function Rtt(e,t,n={}){let r,i=1;if(typeof t=="number")i=t,r=(l,u)=>+l+u;else{if(typeof t=="string"){let l=t.startsWith("-")?-1:1;[t,i]=rw(t.replace(/^[+-]/,"")),i*=l}t=Tf(t),r=(l,u)=>t.offset(l,u)}let o=`${e}1`,s=`${e}2`,a=gr({[o]:l=>l.map(u=>r(u,i)),[s]:l=>l},n),c=a[s].transform;return a[s].transform=()=>{let l=c(),[u,f]=ae(l);return l.domain=i<0?[u,r(f,i)]:[r(u,i),f],l},a}function W9(e,t={}){if(typeof e=="string")switch(e.toLowerCase()){case"first":return M3(t);case"last":return T3(t)}if(typeof e=="function")return mc(null,e,t);let n,r;for(n in e){if(r!==void 0)throw new Error("ambiguous selector; multiple inputs");r=$tt(e[n])}if(r===void 0)throw new Error(`invalid selector: ${e}`);return mc(n,r,t)}function $tt(e){if(typeof e=="function")return e;switch(`${e}`.toLowerCase()){case"min":return A3;case"max":return E3}throw new Error(`unknown selector: ${e}`)}function M3(e){return mc(null,Ptt,e)}function T3(e){return mc(null,Utt,e)}function H9(e){return mc("x",A3,e)}function Z9(e){return mc("y",A3,e)}function J9(e){return mc("x",E3,e)}function Q9(e){return mc("y",E3,e)}function*Ptt(e){yield e[0]}function*Utt(e){yield e[e.length-1]}function*A3(e,t){yield Q0(e,n=>t[n])}function*E3(e,t){yield Xc(e,n=>t[n])}function mc(e,t,n){if(e!=null){if(n[e]==null)throw new Error(`missing channel: ${e}`);e=n[e]}let r=Pn(n);return hn(n,(i,o)=>{let s=pt(i,r),a=pt(i,e),c=[];for(let l of o){let u=[];for(let f of s?rn(l,d=>s[d]).values():[l])for(let d of t(f,a))u.push(d);c.push(u)}return{data:i,facets:c}})}var ztt=new Map([["style","style"],["width","width"],["height","height"],["margin","margin"],["marginLeft","marginLeft"],["marginRight","marginRight"],["marginTop","marginTop"],["marginBottom","marginBottom"],["align","align"],["aspectRatio","aspectRatio"],["axis","axis"],["inset","inset"],["grid","grid"],["label","label"],["padding","padding"],["round","round"],["xScale","x.type"],["xDomain","x.domain"],["xRange","x.range"],["xNice","x.nice"],["xInset","x.inset"],["xInsetLeft","x.insetLeft"],["xInsetRight","x.insetRight"],["xClamp","x.clamp"],["xRound","x.round"],["xAlign","x.align"],["xPadding","x.padding"],["xPaddingInner","x.paddingInner"],["xPaddingOuter","x.paddingOuter"],["xAxis","x.axis"],["xTicks","x.ticks"],["xTickSize","x.tickSize"],["xTickSpacing","x.tickSpacing"],["xTickPadding","x.tickPadding"],["xTickFormat","x.tickFormat"],["xTickRotate","x.tickRotate"],["xGrid","x.grid"],["xLine","x.line"],["xLabel","x.label"],["xLabelAnchor","x.labelAnchor"],["xLabelOffset","x.labelOffset"],["xFontVariant","x.fontVariant"],["xAriaLabel","x.ariaLabel"],["xAriaDescription","x.ariaDescription"],["xReverse","x.reverse"],["xZero","x.zero"],["yScale","y.type"],["yDomain","y.domain"],["yRange","y.range"],["yNice","y.nice"],["yInset","y.inset"],["yInsetTop","y.insetTop"],["yInsetBottom","y.insetBottom"],["yClamp","y.clamp"],["yRound","y.round"],["yAlign","y.align"],["yPadding","y.padding"],["yPaddingInner","y.paddingInner"],["yPaddingOuter","y.paddingOuter"],["yAxis","y.axis"],["yTicks","y.ticks"],["yTickSize","y.tickSize"],["yTickSpacing","y.tickSpacing"],["yTickPadding","y.tickPadding"],["yTickFormat","y.tickFormat"],["yTickRotate","y.tickRotate"],["yGrid","y.grid"],["yLine","y.line"],["yLabel","y.label"],["yLabelAnchor","y.labelAnchor"],["yLabelOffset","y.labelOffset"],["yFontVariant","y.fontVariant"],["yAriaLabel","y.ariaLabel"],["yAriaDescription","y.ariaDescription"],["yReverse","y.reverse"],["yZero","y.zero"],["facetMargin","facet.margin"],["facetMarginTop","facet.marginTop"],["facetMarginBottom","facet.marginBottom"],["facetMarginLeft","facet.marginLeft"],["facetMarginRight","facet.marginRight"],["facetGrid","facet.grid"],["facetLabel","facet.label"],["fxDomain","fx.domain"],["fxRange","fx.range"],["fxNice","fx.nice"],["fxInset","fx.inset"],["fxInsetLeft","fx.insetLeft"],["fxInsetRight","fx.insetRight"],["fxRound","fx.round"],["fxAlign","fx.align"],["fxPadding","fx.padding"],["fxPaddingInner","fx.paddingInner"],["fxPaddingOuter","fx.paddingOuter"],["fxAxis","fx.axis"],["fxTicks","fx.ticks"],["fxTickSize","fx.tickSize"],["fxTickSpacing","fx.tickSpacing"],["fxTickPadding","fx.tickPadding"],["fxTickFormat","fx.tickFormat"],["fxTickRotate","fx.tickRotate"],["fxGrid","fx.grid"],["fxLine","fx.line"],["fxLabel","fx.label"],["fxLabelAnchor","fx.labelAnchor"],["fxLabelOffset","fx.labelOffset"],["fxFontVariant","fx.fontVariant"],["fxAriaLabel","fx.ariaLabel"],["fxAriaDescription","fx.ariaDescription"],["fxReverse","fx.reverse"],["fyDomain","fy.domain"],["fyRange","fy.range"],["fyNice","fy.mice"],["fyInset","fy,inset"],["fyInsetTop","fy.insetTop"],["fyInsetBottom","fy.insetBottom"],["fyRound","fy.round"],["fyAlign","fy.align"],["fyPadding","fy.padding"],["fyPaddingInner","fy.paddingInner"],["fyPaddingOuter","fy.paddingOuter"],["fyAxis","fy.axis"],["fyTicks","fy.ticks"],["fyTickSize","fy.tickSize"],["fyTickSpacing","fy.tickSpacing"],["fyTickPadding","fy.tickPadding"],["fyTickFormat","fy.tickFormat"],["fyTickRotate","fy.tickRotate"],["fyGrid","fy.grid"],["fyLine","fy.line"],["fyLabel","fy.label"],["fyLabelAnchor","fy.labelAnchor"],["fyLabelOffset","fy.labelOffset"],["fyFontVariant","fy.fontVariant"],["fyAriaLabel","fy.ariaLabel"],["fyAriaDescription","fy.ariaDescription"],["fyReverse","fy.reverse"],["colorScale","color.type"],["colorDomain","color.domain"],["colorRange","color.range"],["colorClamp","color.clamp"],["colorN","color.n"],["colorNice","color.nice"],["colorScheme","color.scheme"],["colorInterpolate","color.interpolate"],["colorPivot","color.pivot"],["colorSymmetric","color.symmetric"],["colorLabel","color.label"],["colorReverse","color.reverse"],["colorZero","color.zero"],["colorTickFormat","color.tickFormat"],["opacityScale","opacity.type"],["opacityDomain","opacity.domain"],["opacityRange","opacity.range"],["opacityClamp","opacity.clamp"],["opacityNice","opacity.nice"],["opacityLabel","opacity.label"],["opacityReverse","opacity.reverse"],["opacityZero","opacity.zero"],["opacityTickFormat","opacity.tickFormat"],["rScale","r.type"],["rDomain","r.domain"],["rRange","r.range"],["rClamp","r.clamp"],["rNice","r.nice"],["rZero","r.zero"],["lengthScale","length.type"],["lengthDomain","length.domain"],["lengthRange","length.range"],["lengthClamp","length.clamp"],["lengthNice","length.nice"],["lengthZero","length.zero"],["projectionType","projection.type"],["projectionParallels","projection.parallels"],["projectionPrecision","projection.precision"],["projectionRotate","projection.rotate"],["projectionDomain","projection.domain"],["projectionInset","projection.inset"],["projectionInsetLeft","projection.insetLeft"],["projectionInsetRight","projection.insetRight"],["projectionInsetTop","projection.insetTop"],["projectionInsetBottom","projection.insetBottom"],["projectionClip","projection.clip"]]);function jtt(e,t,n){for(let r=0;r<t.length;++r){let i=t[r];r===t.length-1?e[i]=n:e=e[i]||(e[i]={})}}function K9(e,t,n){for(let r in e){let i=ztt.get(r);if(i==null)throw new Error(`Unrecognized plot attribute: ${r}`);let o=e[r];typeof o=="symbol"?n.push(r):o!==void 0&&jtt(t,i.split("."),o)}}var qtt=new Set(["frame","hexgrid","sphere","graticule"]);async function eP(e){let t={marks:[]},n=[],{attributes:r,marks:i}=e;K9(r,t,n);let o=[];for(let a of i)for(let{type:c,data:l,options:u}of a.plotSpecs())qtt.has(c)?t.marks.push(Av[c](u)):t.marks.push(Av[c](l,u)),o.push(a.index);Ytt(t,e);let s=ey(t);Xtt(s,o),Vtt(e,s,r,n);for(let a of e.interactors)await a.init(s);return s}function Vtt(e,t,n,r){r.forEach(i=>{let o=n[i];if(o===Vc){if(!i.endsWith("Domain"))throw new Error(`Unsupported fixed attribute: ${i}`);let s=i.slice(0,-6),a=t.scale(s);a?.domain&&e.setAttribute(i,n[`${s}Reverse`]?a.domain.slice().reverse():a.domain)}else throw new Error(`Unrecognized symbol: ${o}`)})}function Ytt(e,t){let{marks:n}=t;Ev("x",e,n,["x","x1","x2"]),Ev("y",e,n,["y","y1","y2"]),Ev("fx",e,n),Ev("fy",e,n)}function Ev(e,t,n,r=[e]){let i=t[e]||{};if(i.axis===null||i.label!==void 0)return;let o=n.map(u=>u.channelField(r)?.field);if(o.every(u=>u==null))return;let s,a,c;for(let u=0;u<o.length;++u){let{column:f,label:d}=o[u]||{};f===void 0&&d===void 0||(s===void 0&&a===void 0?(s=f,a=d,c=Gtt(n[u].data,r)||"number"):a!==d?a=void 0:s!==f&&(s=void 0))}let l=a||s;if(l!==void 0){if((c==="number"||c==="date")&&(e==="x"||e==="y")){i.percent&&(l=`${l} (%)`);let u=(e==="x"?1:-1)*(i.reverse?-1:1);e==="x"||i.labelAnchor==="center"?l=e==="x"==u<0?`\u2190 ${l}`:`${l} \u2192`:l=`${u<0?"\u2191 ":"\u2193 "}${l}`}t[e]={...i,label:l}}}function Xtt(e,t){let n=e.querySelectorAll('g[aria-label="facet"]');if(n.length)for(let r of n)tP(r,t);else tP(e,t)}function tP(e,t){let n=-1;for(let r of e.children){let i=r.getAttribute("aria-label")||"";r.nodeName==="style"||i.includes("-axis")||i.includes("-grid")||r.setAttribute("data-index",t[++n])}}function Gtt(e,t){for(let n of e)for(let r=0;r<t.length;++r){let i=n[t[r]];if(i!=null)return i instanceof Date?"date":typeof i}}var Wtt={width:640,marginLeft:40,marginRight:20,marginTop:20,marginBottom:30},Ay=class{constructor(t){this.attributes={...Wtt},this.listeners=null,this.interactors=[],this.legends=[],this.marks=[],this.markset=null,this.element=t||document.createElement("div"),this.element.setAttribute("class","plot"),this.element.style.display="flex",this.element.value=this,this.params=new Map,this.synch=DS()}margins(){return{left:this.getAttribute("marginLeft"),top:this.getAttribute("marginTop"),bottom:this.getAttribute("marginBottom"),right:this.getAttribute("marginRight")}}innerWidth(){let{left:t,right:n}=this.margins();return this.getAttribute("width")-t-n}innerHeight(){let{top:t,bottom:n}=this.margins();return this.getAttribute("height")-t-n}pending(t){this.synch.pending(t)}update(t){return this.synch.ready(t)&&!this.pendingRender&&(this.pendingRender=!0,requestAnimationFrame(()=>this.render())),this.synch.promise}async render(){this.pendingRender=!1;let t=await eP(this),n=this.legends.flatMap(({legend:r,include:i})=>{let o=r.init(t);return i?o:[]});this.element.replaceChildren(t,...n),this.synch.resolve()}getAttribute(t){return this.attributes[t]}setAttribute(t,n,r){return Wh(this.attributes[t],n)?(n===void 0?delete this.attributes[t]:this.attributes[t]=n,r?.silent||this.listeners?.get(t)?.forEach(i=>i(t,n)),!0):!1}addAttributeListener(t,n){let r=this.listeners||(this.listeners=new Map);return r.has(t)||r.set(t,new Set),r.get(t).add(n),this}removeAttributeListener(t,n){return this.listeners?.get(t)?.delete(n)}addParams(t,n){let{params:r}=this;for(let i of n)r.has(i)?r.get(i).push(t):(r.set(i,[t]),i.addEventListener("value",()=>Promise.allSettled(r.get(i).map(o=>o.requestQuery()))))}addMark(t){return t.setPlot(this,this.marks.length),this.marks.push(t),this.markset=null,this}get markSet(){return this.markset||(this.markset=new Set(this.marks))}addInteractor(t){return this.interactors.push(t),this}addLegend(t,n=!0){t.setPlot(this),this.legends.push({legend:t,include:n})}};function md(e){return typeof e!="string"?!1:(e=e.toLowerCase().trim(),e==="none"||e==="currentcolor"||e.startsWith("url(")&&e.endsWith(")")||e.startsWith("var(")&&e.endsWith(")")||Cr(e)!==null)}var Htt=new Set(["order","sort","label","anchor","curve","tension","marker","markerStart","markerMid","markerEnd","textAnchor","lineAnchor","lineHeight","textOverflow","monospace","fontFamily","fontSize","fontStyle","fontVariant","fontWeight","frameAnchor","strokeLinejoin","strokeLinecap","strokeMiterlimit","strokeDasharray","strokeDashoffset","mixBlendMode","shapeRendering","imageRendering","preserveAspectRatio","interpolate","crossOrigin","paintOrder","pointerEvents","target"]);function nP(e){return Htt.has(e)}var Ztt=new Set(["asterisk","circle","cross","diamond","diamond2","hexagon","plus","square","square2","star","times","triangle","triangle2","wye"]);function rP(e){return Ztt.has(`${e}`.toLowerCase())}function Ey(e){return typeof e?.getChild=="function"}var Jtt=2,Qtt=10;function Nv(e){return Ey(e)?Ktt(e):e}function Ktt(e){let{batches:t,numRows:n}=e;if(!n)return[];let r=Array.from({length:n},()=>({}));for(let i=0,o=0;o<t.length;++o){let s=t[o],{schema:a,numRows:c,numCols:l}=s;for(let u=0;u<l;++u){let f=s.getChildAt(u),{name:d,type:h}=a.fields[u],p=tet(h);for(let m=i,g=0;g<c;++g,++m)r[m][d]=p(f.get(g))}i+=c}return r}function tet(e){let{typeId:t}=e;return t===Qtt?n=>n==null?n:new Date(n):t===Jtt&&e.bitWidth>=64?n=>n==null?n:Number(n):n=>n}var iP=e=>e==="stroke"||e==="fill",eet=e=>e==="symbol",net=(e,t)=>e!=="sort"&&e!=="tip"&&t!=null&&!Array.isArray(t),N3=(e,t)=>({channel:e,field:t,as:t instanceof pr?t.column:e}),D3=(e,t)=>({channel:e,value:t}),Dv=e=>Array.isArray(e),Nn=class extends or{constructor(t,n,r,i={}){super(n?.options?.filterBy),this.type=t,this.reqs=i,this.source=n,Dv(this.source)&&(this.data=this.source);let o=this.channels=[],s=this.detail=new Set,a=this.params=new Set,c=(l,u)=>{let f=typeof u;if(l==="channels")for(let d in u)s.add(d),c(d,u[d]);else if(f==="function"&&u[Hh]){let d=u(this,l);for(let h in d)c(h,d[h])}else if(f==="string")nP(l)||iP(l)&&md(u)||eet(l)&&rP(u)?o.push(D3(l,u)):o.push(N3(l,Ia(u)));else if(xs(u))if(Array.isArray(u.columns))o.push(N3(l,u)),a.add(u);else{let d=D3(l,u.value);o.push(d),u.addEventListener("value",h=>(d.value=h,this.update()))}else f==="object"&&net(l,u)?o.push(N3(l,u)):u!==void 0&&o.push(D3(l,u))};for(let l in r)c(l,r[l])}setPlot(t,n){this.plot=t,this.index=n,t.addParams(this,this.params),this.source?.table&&this.queryPending()}hasOwnData(){return this.source==null||Dv(this.source)}channel(t){return this.channels.find(n=>n.channel===t)}channelField(...t){let n=t.flat();for(let r of n){let i=this.channel(r);if(i?.field)return i}return null}fields(){if(this.hasOwnData())return null;let{source:{table:t},channels:n,reqs:r}=this,i=new Map;for(let{channel:o,field:s}of n){let a=s?.column;if(a){if(s.stats?.length||r[o]){i.has(a)||i.set(a,new Set);let c=i.get(a);r[o]?.forEach(l=>c.add(l)),s.stats?.forEach(l=>c.add(l))}}else continue}return Array.from(i,([o,s])=>({table:t,column:o,stats:Array.from(s)}))}fieldInfo(t){return this.stats=t.reduce((n,r)=>(n[r.column]=r,n),Object.create(null)),this}query(t=[]){if(this.hasOwnData())return null;let{channels:n,source:{table:r}}=this;return O3(n,r).where(t)}queryPending(){return this.plot.pending(this),this}queryResult(t){return this.data=Nv(t),this}update(){return this.plot.update(this)}plotSpecs(){let{type:t,data:n,detail:r,channels:i}=this,o={},s={};for(let a of i){let c=r.has(a.channel)?s:o;c[a.channel]=gi(a)}return r.size&&(o.channels=s),[{type:t,data:n,options:o}]}};function gi(e){return Object.hasOwn(e,"value")?e.value:iP(e.channel)?{value:e.as,scale:"color"}:e.as}function O3(e,t,n=[]){let r=yt.from({source:t}),i=new Set,o=!1;for(let s of e){let{channel:a,field:c,as:l}=s;if(!n.includes(a)){if(a==="orderby")r.orderby(s.value);else if(c){if(c.aggregate)o=!0;else{if(i.has(l))continue;i.add(l)}r.select({[l]:c})}}}return o&&r.groupby(Array.from(i)),r}function Yr(e,t,n){if(!e.stats)return r;let{field:r}=e.channelField(t),{type:i}=e.stats[r.column];return n=n??r,i==="date"?qh(n):n}function Ny(e,t,n,r,i=!1,o=1){let s=(r-o)/(n-t),a=s!==1?` * ${s}::DOUBLE`:"";return i?q`(${+n} - ${e}::DOUBLE)${a}`:q`(${e}::DOUBLE - ${+t})${a}`}var B3={x:["min","max"]},L3={y:["min","max"]},Ov={...B3,...L3};function oP(e,t,n,r,i){let{plot:o,stats:s}=e,a=o.getAttribute(r),c=o.getAttribute(i);if(Array.isArray(a)&&!a[ni])return a;{let{field:l}=e.channelField(n),{column:u}=l,{min:f,max:d}=s[u],h=k3(t,u)||(c?Rs().domain([f,d]).nice().domain():[f,d]);return a!==Vc&&(h[ni]=!0),o.setAttribute(r,h,{silent:!0}),h}}function Vo(e,t){return oP(e,t,"x","xDomain","xNice")}function Yo(e,t){return oP(e,t,"y","yDomain","yNice")}function k3(e,t){if(!e)return;let n,r,i=(o,s)=>{if(o==="BETWEEN"&&s.field.column===t){let{range:a}=s;a&&(n==null||a[0]<n)&&(n=a[0]),a&&(r==null||a[1]>r)&&(r=a[1])}};return Array.isArray(e)?e.forEach(o=>o.visit?.(i)):e.visit&&e.visit(i),n!=null&&r!=null&&n!==r?[n,r]:void 0}var Dy=class extends Nn{constructor(t,n,r){let i=t.endsWith("X")?"y":t.endsWith("Y")?"x":null,o={[i]:["count","min","max"]};super(t,n,r,o),this.dim=i}query(t=[]){let{plot:n,dim:r,source:i,stats:o}=this,{optimize:s=!0}=i.options||{},a=super.query(t);if(s&&r){let{field:c,as:l}=this.channelField(r),{column:u}=c,{count:f,max:d,min:h}=o[u],p=r==="x"?n.innerWidth():n.innerHeight(),[m,g]=k3(t,u)||[h,d],y=(g-m)/(d-h);if(f*y>p*4){let x=Yr(this,r,l),b=this.channelField(r==="x"?"y":"x").as,w=a.select().map(_=>_.as).filter(_=>_!==l&&_!==b);return ret(a,x,l,b,m,g,p,w)}a.orderby(l)}return a}};function ret(e,t,n,r,i,o,s,a=[]){let c=q`FLOOR(${s/(o-i)}::DOUBLE * (${t} - ${+i}::DOUBLE))::INTEGER`,l=u=>yt.from(e).select(u).groupby(c,a);return yt.union(l([{[n]:Kr(n),[r]:vu(r,n)},...a]),l([{[n]:Qr(n),[r]:_u(r,n)},...a]),l([{[n]:vu(n,r),[r]:Kr(r)},...a]),l([{[n]:_u(n,r),[r]:Qr(r)},...a])).orderby(a,n)}function yn(e,t,n,r){mr(n)?(r=r||(()=>e.requestUpdate()),n.addEventListener("value",i=>(e[t]=i,r())),e[t]=n.value):e[t]=n}function Oy(e,t=!1){let n=new Float64Array(5),r=new Float64Array(4);iet(n,r,e);let i=Float64Array.of(0,r[1]-n[1]*r[0],r[2]-n[2]*r[0],r[3]-n[3]*r[0],-n[4]*r[0]),o=1+n[1]+n[2]+n[3]+n[4],s=(r[0]+r[1]+r[2]+r[3])/o,a=(i[1]+i[2]+i[3]+i[4])/o;return{sigma:e,negative:t,a:n,b_causal:r,b_anticausal:i,sum_causal:s,sum_anticausal:a}}function iet(e,t,n){let i=Float64Array.of(.84,1.8675,.84,-1.8675,-.34015,-.1299,-.34015,.1299),o=Math.exp(-1.783/n),s=Math.exp(-1.723/n),a=.6318/n,c=1.997/n,l=Float64Array.of(-o*Math.cos(a),o*Math.sin(a),-o*Math.cos(-a),o*Math.sin(-a),-s*Math.cos(c),s*Math.sin(c),-s*Math.cos(-c),s*Math.sin(-c)),u=n*2.5066282746310007,f=Float64Array.of(i[0],i[1],0,0,0,0,0,0),d=Float64Array.of(1,0,l[0],l[1],0,0,0,0,0,0),h,p;for(p=2;p<8;p+=2){for(f[p]=l[p]*f[p-2]-l[p+1]*f[p-1],f[p+1]=l[p]*f[p-1]+l[p+1]*f[p-2],h=p-2;h>0;h-=2)f[h]+=l[p]*f[h-2]-l[p+1]*f[h-1],f[h+1]+=l[p]*f[h-1]+l[p+1]*f[h-2];for(h=0;h<=p;h+=2)f[h]+=i[p]*d[h]-i[p+1]*d[h+1],f[h+1]+=i[p]*d[h+1]+i[p+1]*d[h];for(d[p+2]=l[p]*d[p]-l[p+1]*d[p+1],d[p+3]=l[p]*d[p+1]+l[p+1]*d[p],h=p;h>0;h-=2)d[h]+=l[p]*d[h-2]-l[p+1]*d[h-1],d[h+1]+=l[p]*d[h-1]+l[p+1]*d[h-2]}for(p=0;p<4;++p)h=p<<1,t[p]=f[h]/u,e[p+1]=d[h+2]}function sP(e,t,n,[r,i]){let o=new Float64Array(Math.max(r,i)),s=new Float64Array(Math.max(r,i)),a=new Float64Array(5),c=new Float64Array(n.length);for(let l=0,u=0;l<i;++l,u+=r){let f=c.subarray(u);Bv(e,n.subarray(u),r,1,o,s,a,f)}for(let l=0;l<r;++l){let u=c.subarray(l);Bv(t,u,i,r,o,s,a,u)}return c}function Bv(e,t,n,r=1,i=new Float64Array(n),o=new Float64Array(n),s=new Float64Array(5),a=i,c=oet){let l=r*2,u=r*3,f=r*4,d=r*n,h,p;for(c(i,t,n,r,e.b_causal,3,e.a,4,e.sum_causal,s,e.sigma),p=4,h=f;p<n;++p,h+=r)i[p]=e.b_causal[0]*t[h]+e.b_causal[1]*t[h-r]+e.b_causal[2]*t[h-l]+e.b_causal[3]*t[h-u]-e.a[1]*i[p-1]-e.a[2]*i[p-2]-e.a[3]*i[p-3]-e.a[4]*i[p-4];for(c(o,t,n,-r,e.b_anticausal,4,e.a,4,e.sum_anticausal,s,e.sigma),p=4,h=d-r*5;p<n;++p,h-=r)o[p]=e.b_anticausal[1]*t[h+r]+e.b_anticausal[2]*t[h+l]+e.b_anticausal[3]*t[h+u]+e.b_anticausal[4]*t[h+f]-e.a[1]*o[p-1]-e.a[2]*o[p-2]-e.a[3]*o[p-3]-e.a[4]*o[p-4];if(e.negative)for(p=0,h=0;p<n;++p,h+=r)a[h]=i[p]+o[n-p-1];else for(p=0,h=0;p<n;++p,h+=r)a[h]=Math.max(0,i[p]+o[n-p-1]);return a}function oet(e,t,n,r,i,o,s,a,c,l){let u=Math.abs(r)*n,f=r<0?u+r:0,d,h,p;for(h=0;h<a;++h)for(l[h]=h<=o?i[h]:0,p=1;p<=a&&p<=h;++p)l[h]-=s[p]*l[h-p];for(p=0;p<a;++p)for(e[p]=0,h=1;h<=p;++h)d=f+r*h,d>=0&&d<u&&(e[p]+=l[p-h]*t[d]);let m=t[f];if(m>0)for(p=0;p<a;++p)e[p]+=l[p]*m}function aP(e,t){return lP(new Float64Array(e),t)}function cP(e,t,n,r=[]){return r.length?Object.values(set(e*t,n,r)):[{grid:lP(new Float64Array(e*t),n)}]}function lP(e,t){if(Ey(t)){let n=t.numRows;if(n===0)return e;let r=t.getChild("index").toArray(),i=t.getChild("value").toArray();for(let o=0;o<n;++o)e[r[o]]=i[o]}else for(let n of t)e[n.index]=n.value;return e}function set(e,t,n){let r={},i=o=>(r[o]||(r[o]={key:o,grid:new Float64Array(e)})).grid;if(Ey(t)){let o=t.numRows;if(o===0)return r;let s=t.getChild("index").toArray(),a=t.getChild("value").toArray(),c=n.map(l=>t.getChild(l));for(let l=0;l<o;++l){let u=c.map(f=>f.get(l));i(u)[s[l]]=a[l]}}else for(let o of t){let s=n.map(a=>o[a]);i(s)[o.index]=o.value}return r}var Gi=class extends Nn{constructor(t,n,r){let{bandwidth:i=20,binType:o="linear",binWidth:s=2,binPad:a=1,...c}=r,l=aet(c);super(t,n,c,Ov),this.densityMap=l,yn(this,"bandwidth",i,()=>this.grids?this.convolve().update():null),yn(this,"binWidth",s),yn(this,"binType",o),yn(this,"binPad",a)}setPlot(t,n){let r=()=>{this.stats&&this.requestUpdate()};return t.addAttributeListener("domainX",r),t.addAttributeListener("domainY",r),super.setPlot(t,n)}get filterIndexable(){let t=this.plot.getAttribute("xDomain"),n=this.plot.getAttribute("yDomain");return t&&n&&!t[ni]&&!n[ni]}query(t=[]){let{plot:n,binType:r,binPad:i,channels:o,densityMap:s,source:a}=this,[c,l]=this.extentX=Vo(this,t),[u,f]=this.extentY=Yo(this,t),[d,h]=this.bins=this.binDimensions(this),p=Yr(this,"x"),m=Yr(this,"y"),g=!!n.getAttribute("xReverse"),y=!!n.getAttribute("yReverse"),x=uP(p,c,l,d,g,this.binPad),b=uP(m,u,f,h,y,this.binPad),w=i?[Ie(p,[c,l]),Ie(m,[u,f])]:[_s(c,p),vs(p,l),_s(u,m),vs(m,f)],_=yt.from(a.table).where(t.concat(w)),v=this.groupby=[],M=Br();for(let E of o)if(Object.hasOwn(E,"field")){let{as:D,channel:I,field:T}=E;T.aggregate?(M=T,s[I]=!0):I==="weight"?M=Lr(T):I!=="x"&&I!=="y"&&(_.select({[D]:T}),v.push(D))}return r==="linear"?uet(_,x,b,M,d,v):cet(_,x,b,M,d,v)}binDimensions(){let{plot:t,binWidth:n}=this;return[Math.round(t.innerWidth()/n),Math.round(t.innerHeight()/n)]}queryResult(t){let[n,r]=this.bins;return this.grids=cP(n,r,t,this.groupby),this.convolve()}convolve(){let{bandwidth:t,bins:n,grids:r,plot:i}=this;if(t<=0)this.kde=this.grids.map(({key:o,grid:s})=>(s.key=o,s));else{let o=i.innerWidth(),s=i.innerHeight(),[a,c]=n,l=r.some(({grid:d})=>d.some(h=>h<0)),u=Oy(t*(a-1)/o,l),f=Oy(t*(c-1)/s,l);this.kde=this.grids.map(({key:d,grid:h})=>{let p=sP(u,f,h,n);return p.key=d,p})}return this}plotSpecs(){throw new Error("Unimplemented. Use a Grid2D mark subclass.")}};function aet(e){let t={};for(let n in e)e[n]==="density"&&(delete e[n],t[n]=!0);return t}function uP(e,t,n,r,i,o){let s=(r-o)/(n-t),a=s!==1?` * ${s}::DOUBLE`:"";return i?q`(${n} - ${e}::DOUBLE)${a}`:q`(${e}::DOUBLE - ${t})${a}`}function cet(e,t,n,r,i,o){return e.select({index:q`FLOOR(${t})::INTEGER + FLOOR(${n})::INTEGER * ${i}`,value:r}).groupby("index",o)}function uet(e,t,n,r,i,o){let s=r.column?`* ${r.column}`:"",a=(d,h)=>e.clone().select({xp:t,yp:n,i:d,w:h}),c=a(q`FLOOR(xp)::INTEGER + FLOOR(yp)::INTEGER * ${i}`,q`(FLOOR(xp)::INTEGER + 1 - xp) * (FLOOR(yp)::INTEGER + 1 - yp)${s}`),l=a(q`FLOOR(xp)::INTEGER + (FLOOR(yp)::INTEGER + 1) * ${i}`,q`(FLOOR(xp)::INTEGER + 1 - xp) * (yp - FLOOR(yp)::INTEGER)${s}`),u=a(q`FLOOR(xp)::INTEGER + 1 + FLOOR(yp)::INTEGER * ${i}`,q`(xp - FLOOR(xp)::INTEGER) * (FLOOR(yp)::INTEGER + 1 - yp)${s}`),f=a(q`FLOOR(xp)::INTEGER + 1 + (FLOOR(yp)::INTEGER + 1) * ${i}`,q`(xp - FLOOR(xp)::INTEGER) * (yp - FLOOR(yp)::INTEGER)${s}`);return yt.from(yt.unionAll(c,l,u,f)).select({index:"i",value:Lr("w")},o).groupby("index",o).having(Uc("value",0))}var By=class extends Gi{constructor(t,n){let{thresholds:r=10,...i}=n;super("geo",t,i),yn(this,"thresholds",r,()=>this.grids?this.contours().update():null)}convolve(){return super.convolve().contours()}contours(){let{bins:t,densityMap:n,kde:r,thresholds:i,groupby:o,plot:s}=this,a=i;if(!Array.isArray(a)){let _=zt(r.map(v=>zt(v)));a=Array.from({length:a-1},(v,M)=>_*(M+1)/a)}(n.fill||n.stroke)&&this.plot.getAttribute("colorScale")!=="log"&&this.plot.setAttribute("colorZero",!0);let[c,l]=t,[u,f]=s.getAttribute("xDomain"),[d,h]=s.getAttribute("yDomain"),p=(f-u)/c,m=(h-d)/l,g=+u,y=+d,x=_=>g+_*p,b=_=>y+_*m,w=Fa().size(t);return this.data=r.flatMap(_=>a.map(v=>{let M=fet(w.contour(_,v),x,b);return o.forEach((E,D)=>M[E]=_.key[D]),M.density=v,M})),this}plotSpecs(){let{type:t,channels:n,densityMap:r,data:i}=this,o={};for(let s of n){let{channel:a}=s;a!=="x"&&a!=="y"&&(o[a]=gi(s))}return r.fill&&(o.fill="density"),r.stroke&&(o.stroke="density"),[{type:t,data:i,options:o}]}};function fet(e,t,n){function r(s){s.forEach(i)}function i(s){s.forEach(o)}function o(s){s[0]=t(s[0]),s[1]=n(s[1])}return e.coordinates.forEach(r),e}function Lv(e,t,n,r,i,o){let s=(o.length>>2)-1;for(let a=0,c=0;a<r;++a)for(let l=0,u=(r-a-1)*n;l<n;++l,c+=4){let f=s*i(e[l+u])<<2;t[c+0]=o[f+0],t[c+1]=o[f+1],t[c+2]=o[f+2],t[c+3]=o[f+3]}}function yd(e,t){let n=new Uint8ClampedArray(4*e),r=e-1;for(let i=0;i<=r;++i){let o=t(i/r),{r:s,g:a,b:c,opacity:l=1}=typeof o=="string"?on(o):o,u=i<<2;n[u+0]=s,n[u+1]=a,n[u+2]=c,n[u+3]=255*l|0}return n}function kv(e,t){if(typeof document<"u"){let n=document.createElement("canvas");return n.setAttribute("width",e),n.setAttribute("height",t),n}throw new Error("Can not create a canvas instance.")}function Cv(e="black"){let{r:t,g:n,b:r}=on(e);return i=>({r:t,g:n,b:r,opacity:i})}var ql=class extends Gi{constructor(t,n){super("image",t,n)}setPlot(t,n){let r=()=>{this.stats&&this.rasterize()};t.addAttributeListener("schemeColor",r),super.setPlot(t,n)}convolve(){return super.convolve().rasterize()}rasterize(){let{bins:t,kde:n,groupby:r}=this,[i,o]=t,{canvas:s,ctx:a,img:c}=det(this,i,o),l=het(this),u=r.indexOf(this.channelField("fill")?.as),f=u<0?[]:n.map(({key:d})=>d[u]);return this.data=n.map(d=>{let h=pet(this,f,d.key?.[u]);return Lv(d,c.data,i,o,l,h),a.putImageData(c,0,0),{src:s.toDataURL()}}),this}plotSpecs(){let{type:t,plot:n,data:r}=this,i={src:"src",width:n.innerWidth(),height:n.innerHeight(),preserveAspectRatio:"none",imageRendering:this.channel("imageRendering")?.value,frameAnchor:"middle"};return[{type:t,data:r,options:i}]}};function det(e,t,n){if(!e.image||e.image.w!==t||e.image.h!==n){let r=kv(t,n),i=r.getContext("2d",{willReadFrequently:!0}),o=i.getImageData(0,0,t,n);e.image={canvas:r,ctx:i,img:o,w:t,h:n}}return e.image}function het(e){let{densityMap:t,kde:n,plot:r}=e,i=t.fill&&r.getAttribute("colorDomain");if(!i){let s=0,a=0;n.forEach(c=>{for(let l of c)l<s&&(s=l),l>a&&(a=l)}),i=s===0&&a===0?[0,1]:[s,a]}let o=r.getAttribute("colorScale");return $o({x:{type:o,domain:i,range:[0,1]}}).apply}function pet(e,t,n,r=1024){let{densityMap:i,plot:o}=e,s=o.getAttribute("colorScheme"),a=e.channel("fill"),c=md(a?.value)?a.value:void 0;if(i.fill||s&&!c){if(s)try{return yd(r,$o({color:{scheme:s,domain:[0,1]}}).interpolate)}catch(l){console.warn(l)}}else if(t.length){let l=o.getAttribute("colorRange");c=$o({color:{domain:t,range:l,scheme:s||(l?void 0:"tableau10")}}).apply(n)}return yd(r,Cv(c))}var Ly=class extends ql{constructor(t,n){let{normalize:r=!0,...i}=n;super(t,{bandwidth:0,...i}),yn(this,"normalize",r)}query(t=[]){let{plot:n,channels:r,normalize:i,source:o}=this,[s,a]=Vo(this,t),[c,l]=Yo(this,t),[u,f]=this.bins=this.binDimensions(this),d=Yr(this,"x"),h=Yr(this,"y"),p=!!n.getAttribute("xReverse"),m=!!n.getAttribute("yReverse"),g=Ny(d,s,a,u,p,this.binPad),y=Ny(h,c,l,f,m,this.binPad),x=yt.from(o.table).where(met(this,t)),b=this.groupby=[],w=[];for(let _ of r)if(Object.hasOwn(_,"field")){let{channel:v,field:M}=_;v==="z"?(x.select({[v]:M}),w.push("z")):v!=="x"&&v!=="y"&&(x.select({[v]:M}),b.push(v))}return yet(x,g,y,w,u,f,b,i)}};function met(e,t){if(Array.isArray(t)&&!t.length)return t;let n=e.channelField("x").field.column,r=e.channelField("y").field.column,i=s=>s.op!=="BETWEEN"||s.field.column!==n&&s.field.column!==r,o=s=>s.op==="AND"?Vn(s.children.filter(a=>i(a))):s;return Array.isArray(t)?t.filter(s=>i(s)).map(s=>o(s)):o(t)}function yet(e,t,n,r,i,o,s=[],a=!0){e.select({x:q`FLOOR(${t})::INTEGER`,y:q`FLOOR(${n})::INTEGER`});let c=s.concat(r),l=c.length?`PARTITION BY ${c.join(", ")} `:"",u=yt.from(e).select(c,{x0:"x",y0:"y",dx:q`(lead(x) OVER sw - x)`,dy:q`(lead(y) OVER sw - y)`}).window({sw:q`${l}ORDER BY x ASC`}).qualify(Vn(q`(x0 < ${i} OR x0 + dx < ${i})`,q`(y0 < ${o} OR y0 + dy < ${o})`,q`(x0 > 0 OR x0 + dx > 0)`,q`(y0 > 0 OR y0 + dy > 0)`)),f=yt.select({x:q`GREATEST(MAX(ABS(dx)), MAX(ABS(dy)))`}).from("pairs"),d=yt.select({i:q`UNNEST(range((${f})))::INTEGER`}),h=yt.unionAll(yt.select(c,{x:q`x0 + i`,y:q`y0 + ROUND(i * dy / dx::FLOAT)::INTEGER`}).from("pairs","indices").where(q`ABS(dy) <= ABS(dx) AND i < ABS(dx)`),yt.select(c,{x:q`x0 + ROUND(SIGN(dy) * i * dx / dy::FLOAT)::INTEGER`,y:q`y0 + SIGN(dy) * i`}).from("pairs","indices").where(q`ABS(dy) > ABS(dx) AND i < ABS(dy)`),yt.select(c,{x:"x0",y:"y0"}).from("pairs").where(Pc("dx"))),p=["x"].concat(c).join(", "),m=yt.from("raster").select(c,"x","y",a?{w:q`1.0 / COUNT(*) OVER (PARTITION BY ${p})`}:null).where(Vn(Ie("x",[0,i]),Ie("y",[0,o])));return yt.with({pairs:u,indices:d,raster:h,points:m}).from("points").select(s,{index:q`x + y * ${i}::INTEGER`,value:a?Lr("w"):Br()}).groupby("index",s)}var gd=class extends Nn{constructor(t,n,r){let{bins:i=1024,bandwidth:o=20,...s}=r,a=t.endsWith("X")?"y":"x";super(t,n,s,a==="x"?B3:L3),this.dim=a,yn(this,"bins",i),yn(this,"bandwidth",o,()=>this.grid?this.convolve().update():null)}get filterIndexable(){let t=this.dim==="x"?"xDomain":"yDomain",n=this.plot.getAttribute(t);return n&&!n[ni]}query(t=[]){if(this.hasOwnData())throw new Error("Density1DMark requires a data source");let{bins:n,channels:r,dim:i,source:{table:o}}=this,[s,a]=this.extent=(i==="x"?Vo:Yo)(this,t),c=Yr(this,i);return get(O3(r,o,[i]).where(t.concat(Ie(c,[s,a]))),Ny(c,s,a,n),this.channelField("weight")?"weight":null)}queryResult(t){return this.grid=aP(this.bins,t),this.convolve()}convolve(){let{bins:t,bandwidth:n,dim:r,grid:i,plot:o,extent:[s,a]}=this,c=i.some(x=>x<0),l=r==="x"?o.innerWidth():o.innerHeight(),u=Oy(n*(t-1)/l,c),f=Bv(u,i,t),d=this.data=[],h=r==="x"?"y":"x",p=this.channelField(r).as,m=+s,g=(a-m)/(t-1),y=1/g;for(let x=0;x<t;++x)d.push({[p]:m+x*g,[h]:f[x]*y});return this}plotSpecs(){let{type:t,data:n,channels:r,dim:i}=this,o=i==="x"?{y:"y"}:{x:"x"};for(let s of r)o[s.channel]=gi(s);return[{type:t,data:n,options:o}]}};function get(e,t,n){let r=n?`* ${n}`:"",i=e.clone().select({p:t,i:q`FLOOR(p)::INTEGER`,w:q`(FLOOR(p) + 1 - p)${r}`}),o=e.clone().select({p:t,i:q`FLOOR(p)::INTEGER + 1`,w:q`(p - FLOOR(p))${r}`});return yt.from(yt.unionAll(i,o)).select({index:"i",value:Lr("w")}).groupby("index").having(Uc("value",0))}var ky=class extends Gi{constructor(t,n){let{type:r="dot",binsX:i,binsY:o,...s}=n;s.binPad=s.binPad??0,super(r,t,s),yn(this,"binsX",i),yn(this,"binsY",o)}convolve(){super.convolve();let{bins:t,binPad:n,extentX:r,extentY:i}=this,[o,s]=t,[a,c]=r,[l,u]=i,f=(c-a)/(o-n),d=(u-l)/(s-n),h=n?0:.5;return this.data=xet(this.kde,t,a,l,f,d,h),this}binDimensions(){let{plot:t,binWidth:n,binsX:r,binsY:i}=this;return[r??Math.round(t.innerWidth()/n),i??Math.round(t.innerHeight()/n)]}plotSpecs(){let{type:t,channels:n,densityMap:r,data:i}=this,o={};for(let s of n){let{channel:a}=s;o[a]=a==="x"||a==="y"?a:gi(s)}for(let s in r)r[s]&&(o[s]="density");return[{type:t,data:i,options:o}]}};function xet(e,t,n,r,i,o,s){let a=1/(i*o),[c,l]=t,u=[];for(let f of e)for(let d=0,h=0;h<l;++h)for(let p=0;p<c;++p,++d)u.push({x:n+(p+s)*i,y:r+(h+s)*o,density:f[d]*a});return u}var bet="geom",Cy=class extends Nn{constructor(t,n={},r){!Dv(t)&&!n?.geometry&&(n.geometry=Vh(bet)),super("geo",t,n,r)}queryResult(t){super.queryResult(t);let n=this.channelField("geometry")?.as;return n&&this.data&&this.data.forEach(r=>{typeof r[n]=="string"&&(r[n]=JSON.parse(r[n]))}),this}};var Fy=class extends Nn{constructor(t,n){let{type:r="hexagon",binWidth:i=20,...o}=n;super(r,t,{r:i/2,clip:!0,...o},Ov),this.binWidth=i}get filterIndexable(){let t=this.plot.getAttribute("xDomain"),n=this.plot.getAttribute("yDomain");return t&&n&&!t[ni]&&!n[ni]}query(t=[]){if(this.hasOwnData())return null;let{plot:n,binWidth:r,channels:i,source:o}=this,[s,a]=Vo(this,t),[c,l]=Yo(this,t),u=.5-n.getAttribute("marginLeft"),f=0-n.getAttribute("marginTop"),d=`${r}::DOUBLE`,h=`${r*(1.5/Math.sqrt(3))}::DOUBLE`,p=`${n.innerWidth()/(a-s)}::DOUBLE`,m=`${n.innerHeight()/(l-c)}::DOUBLE`,g,y,x=new Set,b={};for(let E of i)E.channel==="orderby"?w.orderby(E.value):E.channel==="x"?g=E:E.channel==="y"?y=E:Object.hasOwn(E,"field")&&(b[E.as]=E.field,E.field.aggregate&&E.field.columns.forEach(D=>x.add(D)));let w=yt.select({[g.as]:q`${s}::DOUBLE + ((x + 0.5 * (y & 1)) * ${d} + ${u})::DOUBLE / ${p}`,[y.as]:q`${l}::DOUBLE - (y * ${h} + ${f})::DOUBLE / ${m}`,...b}).groupby("x","y"),_=`${p} * (${g.field} - ${s}::DOUBLE)`,v=`${m} * (${l}::DOUBLE - ${y.field})`,M=yt.select({py:q`(${v} - ${f}) / ${h}`,pj:q`ROUND(py)::INTEGER`,px:q`(${_} - ${u}) / ${d} - 0.5 * (pj & 1)`,pi:q`ROUND(px)::INTEGER`,tt:q`ABS(py-pj) * 3 > 1 AND (px-pi)**2 + (py-pj)**2 > (px - pi - 0.5 * CASE WHEN px < pi THEN -1 ELSE 1 END)**2 + (py - pj - CASE WHEN py < pj THEN -1 ELSE 1 END)**2`,x:q`CASE WHEN tt THEN (pi + (CASE WHEN px < pi THEN -0.5 ELSE 0.5 END) + (CASE WHEN pj & 1 <> 0 THEN 0.5 ELSE -0.5 END))::INTEGER ELSE pi END`,y:q`CASE WHEN tt THEN (pj + CASE WHEN py < pj THEN -1 ELSE 1 END)::INTEGER ELSE pj END`}).select(Array.from(x)).from(o.table).where(bs(g.field),bs(y.field),t);return w.from(M)}};var Ry=class extends Gi{constructor(t,n){let{origin:r=[0,0],dim:i="xy",...o}=n;super("image",t,o),this.origin=r,this.tileX=i.toLowerCase().includes("x"),this.tileY=i.toLowerCase().includes("y")}setPlot(t,n){let r=()=>{this.stats&&this.rasterize()};t.addAttributeListener("schemeColor",r),super.setPlot(t,n)}requestQuery(){return this.requestTiles()}query(t=[]){return this._filter=t,null}tileQuery(t){let{plot:n,binType:r,binPad:i,channels:o,densityMap:s,source:a}=this,[[c,l],[u,f]]=t,[d,h]=this.bins,p=Yr(this,"x"),m=Yr(this,"y"),g=!!n.getAttribute("xReverse"),y=!!n.getAttribute("yReverse"),x=fP(p,c,l,d,g,i),b=fP(m,u,f,h,y,i),w=i?[Ie(p,[c,l]),Ie(m,[u,f])]:[_s(c,p),vs(p,l),_s(u,m),vs(m,f)],_=yt.from(a.table).where(w),v=this.groupby=[],M=Br();for(let E of o)if(Object.hasOwn(E,"field")){let{channel:D,field:I}=E;I.aggregate?(M=I,s[D]=!0):D==="weight"?M=Lr(I):D!=="x"&&D!=="y"&&(_.select({[D]:I}),v.push(D))}return r==="linear"?Aet(_,x,b,M,d,v):Tet(_,x,b,M,d,v)}async requestTiles(){let t=ti();this.prefetch&&t.cancel(this.prefetch);let{binPad:n,tileX:r,tileY:i,origin:[o,s]}=this,[a,c]=this.bins=this.binDimensions(this),[l,u]=Vo(this,this._filter),[f,d]=Yo(this,this._filter),h=u-l,p=d-f,m=Math.floor((l-o)*(a-n)/h),g=Math.floor((f-s)*(c-n)/p),y=(I,T)=>[[o+I*h,o+(I+1)*h],[s+T*p,s+(T+1)*p]],x=Math.floor((l-o)/h),b=r?dP((u-o)/h):x,w=Math.floor((f-s)/p),_=i?dP((d-s)/p):w,v=[];for(let I=x;I<=b;++I)for(let T=w;T<=_;++T)v.push([I,T]);let M=v.map(([I,T])=>t.query(this.tileQuery(y(I,T)))),E=[];if(r)for(let I=w;I<=_;++I)E.push([b+1,I]),E.push([x-1,I]);if(i){let I=r?x-1:x,T=r?b+1:b;for(let O=I;O<=T;++O)E.push([O,_+1]),E.push([O,w-1])}this.prefetch=E.map(([I,T])=>t.prefetch(this.tileQuery(y(I,T))));let D=await Promise.all(M);this.grids=[{grid:wet(a,c,m,g,v,D)}],this.convolve().update()}convolve(){return super.convolve().rasterize()}rasterize(){let{bins:t,kde:n,groupby:r}=this,[i,o]=t,{canvas:s,ctx:a,img:c}=_et(this,i,o),l=Iet(this),u=r.indexOf(this.channelField("fill")?.as),f=u<0?[]:n.map(({key:d})=>d[u]);return this.data=n.map(d=>{let h=Met(this,f,d.key?.[u]);return Lv(d,c.data,i,o,l,h),a.putImageData(c,0,0),{src:s.toDataURL()}}),this}plotSpecs(){let{type:t,data:n,plot:r}=this,i={src:"src",width:r.innerWidth(),height:r.innerHeight(),preserveAspectRatio:"none",imageRendering:this.channel("imageRendering")?.value,frameAnchor:"middle"};return[{type:t,data:n,options:i}]}};function wet(e,t,n,r,i,o){let s=new Float64Array(e*t);return o.forEach((a,c)=>{let[l,u]=i[c],f=l*e-n,d=u*t-r;vet(e,t,s,a,f,d)}),s}function vet(e,t,n,r,i,o){let s=r.numRows;if(s===0)return;let a=r.getChild("index").toArray(),c=r.getChild("value").toArray();for(let l=0;l<s;++l){let u=a[l],f=i+u%e,d=o+Math.floor(u/e);0<=f&&f<e&&0<=d&&d<t&&(n[f+d*e]=c[l])}}function _et(e,t,n){if(!e.image||e.image.w!==t||e.image.h!==n){let r=kv(t,n),i=r.getContext("2d",{willReadFrequently:!0}),o=i.getImageData(0,0,t,n);e.image={canvas:r,ctx:i,img:o,w:t,h:n}}return e.image}function Iet(e){let{densityMap:t,kde:n,plot:r}=e,i=t.fill&&r.getAttribute("colorDomain");if(!i){let s=0,a=0;n.forEach(c=>{for(let l of c)l<s&&(s=l),l>a&&(a=l)}),i=s===0&&a===0?[0,1]:[s,a]}let o=r.getAttribute("colorScale");return $o({x:{type:o,domain:i,range:[0,1]}}).apply}function Met(e,t,n,r=1024){let{densityMap:i,plot:o}=e,s=o.getAttribute("colorScheme"),a=e.channel("fill"),c=md(a?.value)?a.value:void 0;if(i.fill||s&&!c){if(s)try{return yd(r,$o({color:{scheme:s,domain:[0,1]}}).interpolate)}catch(l){console.warn(l)}}else if(t.length){let l=o.getAttribute("colorRange");c=$o({color:{domain:t,range:l,scheme:s||(l?void 0:"tableau10")}}).apply(n)}return yd(r,Cv(c))}function fP(e,t,n,r,i,o){let s=(r-o)/(n-t),a=s!==1?` * ${s}::DOUBLE`:"";return i?q`(${n} - ${e}::DOUBLE)${a}`:q`(${e}::DOUBLE - ${t})${a}`}function Tet(e,t,n,r,i,o){return e.select({index:q`FLOOR(${t})::INTEGER + FLOOR(${n})::INTEGER * ${i}`,value:r}).groupby("index",o)}function Aet(e,t,n,r,i,o){let s=r.column?`* ${r.column}`:"",a=(d,h)=>e.clone().select({xp:t,yp:n,i:d,w:h}),c=a(q`FLOOR(xp)::INTEGER + FLOOR(yp)::INTEGER * ${i}`,q`(FLOOR(xp)::INTEGER + 1 - xp) * (FLOOR(yp)::INTEGER + 1 - yp)${s}`),l=a(q`FLOOR(xp)::INTEGER + (FLOOR(yp)::INTEGER + 1) * ${i}`,q`(FLOOR(xp)::INTEGER + 1 - xp) * (yp - FLOOR(yp)::INTEGER)${s}`),u=a(q`FLOOR(xp)::INTEGER + 1 + FLOOR(yp)::INTEGER * ${i}`,q`(xp - FLOOR(xp)::INTEGER) * (FLOOR(yp)::INTEGER + 1 - yp)${s}`),f=a(q`FLOOR(xp)::INTEGER + 1 + (FLOOR(yp)::INTEGER + 1) * ${i}`,q`(xp - FLOOR(xp)::INTEGER) * (yp - FLOOR(yp)::INTEGER)${s}`);return yt.from(yt.unionAll(c,l,u,f)).select({index:"i",value:Lr("w")},o).groupby("index",o).having(Ph("value",0))}function dP(e){let t=Math.floor(e);return t===e?t-1:t}function Eet(e,t,n){var r=1e-8,i=t-1,o=n-1,s=0,a,c,l,u,f,d,h,p,m,g,y;if(e<=0)return 0;if(e>=1)return 1;for(t>=1&&n>=1?(l=e<.5?e:1-e,u=Math.sqrt(-2*Math.log(l)),h=(2.30753+u*.27061)/(1+u*(.99229+u*.04481))-u,e<.5&&(h=-h),p=(h*h-3)/6,m=2/(1/(2*t-1)+1/(2*n-1)),g=h*Math.sqrt(p+m)/m-(1/(2*n-1)-1/(2*t-1))*(p+5/6-2/(3*m)),h=t/(t+n*Math.exp(2*g))):(a=Math.log(t/(t+n)),c=Math.log(n/(t+n)),u=Math.exp(t*a)/t,f=Math.exp(n*c)/n,g=u+f,e<u/g?h=Math.pow(t*g*e,1/t):h=1-Math.pow(n*g*(1-e),1/n)),y=-xd(t)-xd(n)+xd(t+n);s<10;s++){if(h===0||h===1)return h;if(d=Net(h,t,n)-e,u=Math.exp(i*Math.log(h)+o*Math.log(1-h)+y),f=d/u,h-=u=f/(1-.5*Math.min(1,f*(i/h-o/(1-h)))),h<=0&&(h=.5*(h+u)),h>=1&&(h=.5*(h+u+1)),Math.abs(u)<r*h&&s>0)break}return h}function Net(e,t,n){var r=e===0||e===1?0:Math.exp(xd(t+n)-xd(t)-xd(n)+t*Math.log(e)+n*Math.log(1-e));return e<0||e>1?!1:e<(t+1)/(t+n+2)?r*hP(e,t,n)/t:1-r*hP(1-e,n,t)/n}function hP(e,t,n){var r=1e-30,i=1,o=t+n,s=t+1,a=t-1,c=1,l=1-o*e/s,u,f,d,h;for(Math.abs(l)<r&&(l=r),l=1/l,h=l;i<=100&&(u=2*i,f=i*(n-i)*e/((a+u)*(t+u)),l=1+f*l,Math.abs(l)<r&&(l=r),c=1+f/c,Math.abs(c)<r&&(c=r),l=1/l,h*=l*c,f=-(t+i)*(o+i)*e/((t+u)*(s+u)),l=1+f*l,Math.abs(l)<r&&(l=r),c=1+f/c,Math.abs(c)<r&&(c=r),l=1/l,d=l*c,h*=d,!(Math.abs(d-1)<3e-7));i++);return h}function xd(e){var t=0,n=[76.18009172947146,-86.5053203294167,24.01409824083091,-1.231739572450155,.001208650973866179,-5395239384953e-18],r=1.000000000190015,i,o,s;for(s=(o=i=e)+5.5,s-=(i+.5)*Math.log(s);t<6;t++)r+=n[t]/++o;return Math.log(2.506628274631*r/i)-s}function pP(e,t){var n=Eet(2*Math.min(e,1-e),.5*t,.5);return n=Math.sqrt(t*(1-n)/n),e>.5?n:-n}var $y=class extends Nn{constructor(t,n){let{ci:r=.95,precision:i=4,...o}=n;super("line",t,o);let s=()=>this.modelFit?this.confidenceBand().update():null;yn(this,"ci",r,s),yn(this,"precision",i,s)}query(t=[]){let n=this.channelField("x").as,r=this.channelField("y").as,i=Array.from(new Set(["stroke","z","fx","fy"].flatMap(o=>this.channelField(o)?.as||[])));return yt.from(super.query(t)).select({intercept:aS(r,n),slope:cS(r,n),n:lS(r,n),ssy:uS(r,n),ssx:fS(r,n),xm:dS(r,n),x0:Su(Kr(n).where(bs(r))),x1:Su(Qr(n).where(bs(r)))}).select(i).groupby(i)}queryResult(t){return this.modelFit=Nv(t),this.lineData=this.modelFit.flatMap(n=>Det(n)),this.confidenceBand()}confidenceBand(){let{ci:t,modelFit:n,precision:r,plot:i}=this,o=i.innerWidth();return this.areaData=t?n.flatMap(s=>Oet(t,r,s,o)):null,this}plotSpecs(){let{lineData:t,areaData:n,channels:r,ci:i}=this,o={x:"x",y:"y"},s={x:"x",y1:"y1",y2:"y2",fillOpacity:.1};for(let a of r)switch(a.channel){case"x":case"y":case"fill":break;case"stroke":o.stroke=s.fill=gi(a);break;case"strokeOpacity":o.strokeOpacity=gi(a);break;case"fillOpacity":s.fillOpacity=gi(a);break;default:o[a.channel]=s[a.channel]=gi(a);break}return[...i?[{type:"areaY",data:n,options:s}]:[],{type:"line",data:t,options:o}]}};function Det(e){let{x0:t,x1:n,xm:r,intercept:i,slope:o,n:s,ssx:a,ssy:c,...l}=e;return[{x:t,y:i+t*o,...l},{x:n,y:i+n*o,...l}]}function Oet(e,t,n,r){let{x0:i,x1:o,xm:s,intercept:a,slope:c,n:l,ssx:u,ssy:f,...d}=n,h=t*(o-i)/r,p=pP((1-e)/2,l-2)*Math.sqrt(f/(l-2));return Pe(i,o-h/2,h).concat(o).map(m=>{let g=a+m*c,y=p*Math.sqrt(1/l+(m-s)**2/u);return{x:m,y1:g-y,y2:g+y,...d}})}function mP(e){let t=e.toLowerCase(),n=e.length,r="";for(let i=0;i<n;++i)r+=(e[i]!==t[i]?"-":"")+t[i];return r}function bd(e){let t={};for(let n in e)t[mP(n)]=e[n];return t}function Bet(e){let{channels:t}=e,n=new Set,r=!1,i=!1;for(let o of t){let{channel:s,field:a,as:c}=o;if(s==="orderby")r=!0;else if(a)if(a.aggregate)i=!0;else{if(n.has(c))continue;n.add(c)}}return!r&&i&&n.size&&e.channels.push({channel:"orderby",value:Array.from(n)}),e}var Py=class{constructor(t,{selection:n,channels:r={}}){this.mark=Bet(t),this.selection=n;let i=Object.entries(bd(r));this.channels=i.length?i:[["opacity",.2]],this.selection.addEventListener("value",Cd(()=>this.update()))}init(t){this.svg=t;let n=this.values=[],r=this.mark.index,i=this.nodes=t.querySelectorAll(`[data-index="${r}"] > *`),{channels:o}=this;for(let s=0;s<i.length;++s){let a=i[s];n.push(o.map(c=>a.getAttribute(c[0])))}return this.update()}async update(){let{svg:t,nodes:n,channels:r,values:i,mark:o,selection:s}=this;if(!t)return;let a=await Let(o,s);for(let c=0;c<n.length;++c){let l=n[c],u=i[c],f=a(l.__data__);for(let d=0;d<r.length;++d){let[h,p]=r[d];l.setAttribute(h,f?u[d]:p)}}}};async function Let(e,t){let n=t?.predicate(e);if(!n||n.length===0)return()=>!0;let r=e.filterBy?.predicate(e,!0),i={__:Vn(n)},o=e.query(r),s=o.groupby().length?o.select(i):o.$select(i),a=await e.coordinator.query(s),c=a.getChild?.("__");return a.numRows||a.length?c?l=>c.get(l):l=>a[l].__:()=>!1}function C3(e){let t=e.on,n=!0;function r(i){n=!1,i(),n=!0}return e.reset=(...i)=>{r(()=>e.clear(...i))},e.moveSilent=(...i)=>{r(()=>e.move(...i))},e.on=(...i)=>{if(i.length>1&&i[1]){let o=i[1];i[1]=(...s)=>n&&o(...s)}return t(...i)},e}function yP(){return C3(pI())}function gP(){return C3(dI())}function xP(){return C3(hI())}function Uy(e,t){return e===t||e&&t&&Math.abs(e[0]-t[0])<1e-12&&Math.abs(e[1]-t[1])<1e-12||!1}function Xo(e,t){let n=e.channelField(t)?.field;return n?.basis||n}function zy(e,t,n=1){return t.invert(n*Math.floor(e/n))}function Fv(){let e=this,t=e.getScreenCTM,n;e.getScreenCTM=()=>e.isConnected?n=t.call(e):n}var wd=class{constructor(t,{channel:n,selection:r,field:i,pixelSize:o=1,peers:s=!0,brush:a}){this.mark=t,this.channel=n,this.pixelSize=o||1,this.selection=r,this.peers=s,this.field=i||Xo(t,[n,n+"1",n+"2"]),this.style=a&&bd(a),this.brush=n==="y"?xP():gP(),this.brush.on("brush end",({selection:c})=>this.publish(c))}reset(){this.value=void 0,this.g&&this.brush.reset(this.g)}activate(){this.selection.activate(this.clause(this.value||[0,1]))}publish(t){let n;t&&(n=t.map(r=>zy(r,this.scale,this.pixelSize)).sort((r,i)=>r-i)),Uy(n,this.value)||(this.value=n,this.g.call(this.brush.moveSilent,t),this.selection.update(this.clause(n)))}clause(t){let{mark:n,pixelSize:r,field:i,scale:o}=this;return{source:this,schema:{type:"interval",pixelSize:r,scales:[o]},clients:this.peers?n.plot.markSet:new Set().add(n),value:t,predicate:t?Ie(i,t):null}}init(t){let{brush:n,channel:r,style:i}=this;this.scale=t.scale(r);let o=t.scale("x").range,s=t.scale("y").range;n.extent([[ce(o),ce(s)],[zt(o),zt(s)]]);let a=jt(t).selectAll('g[aria-label="facet"]'),c=a.size()?a:jt(t);if(this.g=c.append("g").attr("class",`interval-${r}`).each(Fv).call(n).call(n.moveSilent,this.value?.map(this.scale.apply)),i){let l=this.g.selectAll("rect.selection");for(let u in i)l.attr(u,i[u])}t.addEventListener("pointerenter",()=>this.activate())}};var Rv=(e,t)=>e-t,jy=class{constructor(t,{selection:n,xfield:r,yfield:i,pixelSize:o=1,peers:s=!0,brush:a}){this.mark=t,this.pixelSize=o||1,this.selection=n,this.peers=s,this.xfield=r||Xo(t,["x","x1","x2"]),this.yfield=i||Xo(t,["y","y1","y2"]),this.style=a&&bd(a),this.brush=yP(),this.brush.on("brush end",({selection:c})=>this.publish(c))}reset(){this.value=void 0,this.g&&this.brush.reset(this.g)}activate(){this.selection.activate(this.clause(this.value||[[0,1],[0,1]]))}publish(t){let{value:n,pixelSize:r,xscale:i,yscale:o}=this,s,a;if(t){let[c,l]=t;s=[c[0],l[0]].map(u=>zy(u,i,r)).sort(Rv),a=[c[1],l[1]].map(u=>zy(u,o,r)).sort(Rv)}(!Uy(s,n?.[0])||!Uy(a,n?.[1]))&&(this.value=t?[s,a]:void 0,this.g.call(this.brush.moveSilent,t),this.selection.update(this.clause(this.value)))}clause(t){let{mark:n,pixelSize:r,xfield:i,yfield:o,xscale:s,yscale:a}=this;return{source:this,schema:{type:"interval",pixelSize:r,scales:[s,a]},clients:this.peers?n.plot.markSet:new Set().add(n),value:t,predicate:t?Vn(Ie(i,t[0]),Ie(o,t[1])):null}}init(t){let{brush:n,style:r}=this,i=this.xscale=t.scale("x"),o=this.yscale=t.scale("y"),s=i.range,a=o.range;n.extent([[ce(s),ce(a)],[zt(s),zt(a)]]);let c=jt(t).selectAll('g[aria-label="facet"]'),l=c.size()?c:jt(t);if(this.g=l.append("g").attr("class","interval-xy").each(Fv).call(n),r){let u=this.g.selectAll("rect.selection");for(let f in r)u.attr(f,r[f])}if(this.value){let[u,f]=this.value[0].map(i.apply).sort(Rv),[d,h]=this.value[1].map(o.apply).sort(Rv);this.g.call(n.moveSilent,[[u,d],[f,h]])}t.addEventListener("pointerenter",()=>this.activate())}};var vd=class{constructor(t,{selection:n,channel:r,field:i}){this.mark=t,this.selection=n,this.clients=new Set().add(t),this.channel=r,this.field=i||Xo(t,[r])}clause(t){let{clients:n,field:r}=this,i=t?ws(r,Or(t)):null;return{source:this,schema:{type:"point"},clients:n,value:t,predicate:i}}init(t){let n=this,{mark:r,channel:i,selection:o}=this,{data:s}=r,a=r.channelField(i).as,c=jt(t).selectAll('g[aria-label="facet"]'),l=c.size()?c:jt(t),u=t.scale(i),f=!ei(o);l.on("pointerdown pointermove",function(d){let[h,p]=Bn(d,this),m=ket(s,a,u.invert(i==="x"?h:p));o.update(f?m:n.clause(m))}),!f&&t.addEventListener("pointerenter",()=>{this.selection.activate(this.clause(0))})}};function ket(e,t,n){let r=1/0,i;return e.forEach(o=>{let s=Math.abs(o[t]-n);s<r&&(r=s,i=o[t])}),i}var bP=(e,t)=>e-t,qy=class{constructor(t,{x:n=new Ss,y:r=new Ss,xfield:i,yfield:o,zoom:s=!0,panx:a=!0,pany:c=!0}){this.mark=t,this.xsel=n,this.ysel=r,this.xfield=i||Xo(t,["x","x1","x2"]),this.yfield=o||Xo(t,["y","y1","y2"]),this.zoom=F3(s,[0,1/0],[1,1]),this.panx=this.xsel&&a,this.pany=this.ysel&&c;let{plot:l}=t;a&&this.xsel.addEventListener("value",u=>{l.setAttribute("xDomain",u)&&l.update()}),c&&this.ysel.addEventListener("value",u=>{l.setAttribute("yDomain",u)&&l.update()})}publish(t){if(this.panx){let n=Cet(t,this.xscale);this.xsel.update(this.clause(n,this.xfield,this.xscale))}if(this.pany){let n=Fet(t,this.yscale);this.ysel.update(this.clause(n,this.yfield,this.yscale))}}clause(t,n,r){return{source:this,schema:{type:"interval",scales:[r]},clients:this.mark.plot.markSet,value:t,predicate:t?Ie(n,t):null}}init(t){if(this.svg=t,this.initialized)return;this.initialized=!0;let{panx:n,pany:r,mark:{plot:{element:i}},xsel:o,ysel:s}=this;this.xscale=t.scale("x"),this.yscale=t.scale("y");let a=this.xscale.range.slice().sort(bP),c=this.yscale.range.slice().sort(bP),l=F3(n,[-1/0,1/0],a),u=F3(r,[-1/0,1/0],c),f=DT().extent([[a[0],c[0]],[a[1],c[1]]]).scaleExtent(this.zoom).translateExtent([[l[0],u[0]],[l[1],u[1]]]).on("start",()=>{this.xscale=this.svg.scale("x"),this.yscale=this.svg.scale("y")}).on("end",()=>i.__zoom=new Ur(1,0,0)).on("zoom",({transform:d})=>this.publish(d));if(jt(i).call(f),n||r){let d=!1;i.addEventListener("mouseenter",()=>{if(!d){if(d=!0,n){let{xscale:h,xfield:p}=this;o.activate(this.clause(h.domain,p,h))}if(r){let{yscale:h,yfield:p}=this;s.activate(this.clause(h.domain,p,h))}}}),i.addEventListener("mouseleave",()=>d=!1)}}};function F3(e,t,n){return e?Array.isArray(e)?e:t:n}function Cet(e,t){return t.range.map(e.invertX,e).map(t.invert,t)}function Fet(e,t){return t.range.map(e.invertY,e).map(t.invert,t)}var Vl=class{constructor(t,{selection:n,channels:r,peers:i=!0}){this.value=null,this.mark=t,this.selection=n,this.peers=i,this.channels=r.map(o=>{let s=o==="color"?["fill","stroke"]:o==="x"?["x","x1","x2"]:o==="y"?["y","y1","y2"]:[o];for(let a=0;a<s.length;++a){let c=t.channelField(s[a]);if(c)return{field:c.field?.basis||c.field,as:c.as}}throw new Error(`Missing channel: ${o}`)})}clause(t){let{channels:n,mark:r}=this,i=null;if(t){let o=t.map(s=>{let a=s.map((c,l)=>Uh(n[l].field,Or(c)));return a.length>1?Vn(a):a[0]});i=o.length>1?$c(o):o[0]}return{source:this,schema:{type:"point"},clients:this.peers?r.plot.markSet:new Set().add(r),value:t,predicate:i}}init(t,n,r){let{mark:i,channels:o,selection:s}=this,{data:a}=i;r=r||(l=>{let u=a[l.__data__];return o.map(f=>u[f.as])}),n=n||`[data-index="${i.index}"]`;let c=new Set(t.querySelectorAll(n));t.addEventListener("pointerdown",l=>{let u=s.single?s.value:this.value,f=l.target,d=null;if(Ret(c,f)){let h=r(f);l.shiftKey&&u?.length?(d=u.filter(p=>R3(p,h)),d.length===u.length&&d.push(h)):u?.length===1&&!R3(u[0],h)?d=null:d=[h]}this.value=d,$et(u,d)&&s.update(this.clause(d))}),t.addEventListener("pointerenter",()=>{this.selection.activate(this.clause([this.channels.map(()=>0)]))})}};function Ret(e,t){return e.has(t)||e.has(t.parentNode)||e.has(t.parentNode?.parentNode)}function $et(e,t){return e==null||t==null?e!=null||t!=null:e.length!==t.length||e.some((n,r)=>R3(n,t[r]))}function R3(e,t){let n=e.length;if(t.length!==n)return!0;for(let r=0;r<n;++r)if(e[r]!==t[r])return!0;return!1}var _d=class{constructor(t,n){let{as:r,...i}=n;this.channel=t,this.options={label:null,...i},this.selection=r,this.element=document.createElement("div"),this.element.setAttribute("class","legend"),this.element.value=this}setPlot(t){let{channel:n,selection:r}=this,i=Pet(t,n);this.selection&&i&&(this.handler=new Vl(i,{selection:r,channels:[n]}),this.selection.addEventListener("value",()=>this.update()))}init(t){let{channel:n,options:r,handler:i}=this,s=t.scale(n).type==="ordinal"?r:{marginTop:1,tickSize:2,height:28,...r};return this.legend=t.legend(n,s),i&&(i.init(this.legend,":scope > div",a=>[a.__data__]),this.update()),this.element.replaceChildren(this.legend),this.element}update(){if(!this.legend)return;let{value:t}=this.selection,n=t&&t.length?new Set(t.map(i=>i[0])):null,r=this.legend.querySelectorAll(":scope > div");for(let i of r){let o=n?n.has(i.__data__):!0;i.style.opacity=o?1:.2}}};function Pet({marks:e},t){let n=t==="color"?["fill","stroke"]:t==="opacity"?["opacity","fillOpacity","strokeOpacity"]:null;if(n==null)return null;for(let r=e.length-1;r>-1;--r)if(e[r].channelField(n))return e[r];return null}var Uet=["rectY-x","rectX-y","rect-x","rect-y"];function zet(e,t){return Uet.includes(`${t}-${e}`)}function $v(e,t={steps:25}){let n=(r,i)=>zet(i,r.type)?{[`${i}1`]:$3(r,e,t),[`${i}2`]:$3(r,e,{...t,offset:1})}:{[i]:$3(r,e,t)};return n[Hh]=!0,n}function $3(e,t,n){return{column:t,label:t,get stats(){return["min","max"]},get columns(){return[t]},get basis(){return t},toString(){let{min:r,max:i}=e.stats[t],o=jet(r,i,n),s=Yt(t),a=o.min===0?s:`(${s} - ${o.min})`,c=`${(o.max-o.min)/o.steps}::DOUBLE`,l=n.offset?`${n.offset} + `:"";return`${o.min} + ${c} * (${l}FLOOR(${a} / ${c})::INTEGER)`}}}function jet(e,t,n){let{steps:r=25,minstep:i=0,nice:o=!0}=n;if(o!==!1){let s=t-e,a=r,c=Math.LN10,l=Math.ceil(Math.log(a)/c),u=Math.max(i,Math.pow(10,Math.round(Math.log(s)/c)-l));for(;Math.ceil(s/u)>a;)u*=10;let f=[5,2],d;for(let m=0,g=f.length;m<g;++m)d=u/f[m],d>=i&&s/d<=a&&(u=d);d=Math.log(u);let h=d>=0?0:~~(-d/c)+1,p=Math.pow(10,-h-1);d=Math.floor(e/u+p)*u,e=e<d?d-u:d,t=Math.ceil(t/u)*u,r=Math.round((t-e)/u)}return{min:e,max:t,steps:r}}var qet=e=>e&&typeof e=="object"&&!Array.isArray(e);var Vy=class extends or{constructor({element:t,filterBy:n,from:r,column:i,label:o=i,format:s=u=>u,options:a,value:c,as:l}={}){super(n),this.from=r,this.column=i,this.selection=l,this.format=s,this.element=t??document.createElement("div"),this.element.setAttribute("class","input"),this.element.value=this;let u=document.createElement("label");u.innerText=o||i,this.element.appendChild(u),this.select=document.createElement("select"),a&&(this.data=a.map(f=>qet(f)?f:{value:f}),this.update()),c=c??this.selection?.value??this.data?.[0]?.value,this.selection?.value===void 0&&this.publish(c),this.element.appendChild(this.select),this.selection&&(this.select.addEventListener("input",()=>{this.publish(this.selectedValue()??null)}),ei(this.selection)||this.selection.addEventListener("value",f=>{f!==this.select.value&&this.selectedValue(f)}))}selectedValue(t){if(arguments.length===0){let n=this.select.selectedIndex;return this.data[n].value}else{let n=this.data?.findIndex(r=>r.value===t);n>=0?this.select.selectedIndex=n:this.select.value=String(t)}}reset(){this.select.selectedIndex=this.from?0:-1}publish(t){let{selection:n,column:r}=this;ei(n)?n.update({source:this,schema:{type:"point"},value:t,predicate:t!==""&&t!==void 0?ws(r,Or(t)):null}):mr(n)&&n.update(t)}query(t=[]){let{from:n,column:r}=this;return n?yt.from(n).select({value:r}).distinct().where(t).orderby(r):null}queryResult(t){return this.data=[{value:"",label:"All"},...t],this}update(){let{data:t,format:n,select:r}=this;r.replaceChildren();for(let{value:i,label:o}of t){let s=document.createElement("option");s.setAttribute("value",i),s.innerText=o??n(i),this.select.appendChild(s)}return this.selection&&this.selectedValue(this.selection?.value??""),this}};var Vet={contains:D2,prefix:O2,suffix:B2,regexp:N2},Yet=0;var Yy=class extends or{constructor({element:t,filterBy:n,from:r,column:i,label:o,type:s="contains",as:a}={}){if(super(n),this.id="search_"+ ++Yet,this.type=s,this.from=r,this.column=i,this.selection=a,this.element=t??document.createElement("div"),this.element.setAttribute("class","input"),this.element.value=this,o){let c=document.createElement("label");c.setAttribute("for",this.id),c.innerText=o,this.element.appendChild(c)}this.searchbox=document.createElement("input"),this.searchbox.setAttribute("id",this.id),this.searchbox.setAttribute("type","text"),this.searchbox.setAttribute("placeholder","Query"),this.element.appendChild(this.searchbox),this.selection&&(this.searchbox.addEventListener("input",()=>{this.publish(this.searchbox.value||null)}),ei(this.selection)||this.selection.addEventListener("value",c=>{c!==this.searchbox.value&&(this.searchbox.value=c)}))}reset(){this.searchbox.value=""}publish(t){let{selection:n,column:r,type:i}=this;ei(n)?n.update({source:this,schema:{type:i},value:t,predicate:t?Vet[i](r,Or(t)):null}):mr(n)&&n.update(t)}query(t=[]){let{from:n,column:r}=this;return n?yt.from(n).select({list:r}).distinct().where(t):null}queryResult(t){return this.data=t,this}update(){let t=document.createElement("datalist"),n=`${this.id}_list`;t.setAttribute("id",n);for(let r of this.data){let i=document.createElement("option");i.setAttribute("value",r.list),t.append(i)}return this.datalist&&this.datalist.remove(),this.element.appendChild(this.datalist=t),this.searchbox.setAttribute("list",n),this}};var Xet=0;var Xy=class extends or{constructor({element:t,filterBy:n,as:r,min:i,max:o,step:s,from:a,column:c,label:l=c,value:u=r?.value,width:f}={}){if(super(n),this.id="slider_"+ ++Xet,this.from=a,this.column=c||"value",this.selection=r,this.min=i,this.max=o,this.step=s,this.element=t||document.createElement("div"),this.element.setAttribute("class","input"),this.element.value=this,l){let d=document.createElement("label");d.setAttribute("for",this.id),d.innerText=l,this.element.appendChild(d)}this.slider=document.createElement("input"),this.slider.setAttribute("id",this.id),this.slider.setAttribute("type","range"),f!=null&&(this.slider.style.width=`${+f}px`),i!=null&&this.slider.setAttribute("min",i),o!=null&&this.slider.setAttribute("max",o),s!=null&&this.slider.setAttribute("step",s),u!=null&&(this.slider.setAttribute("value",u),this.selection?.value===void 0&&this.publish(u)),this.element.appendChild(this.slider),this.selection&&(this.slider.addEventListener("input",()=>{this.publish(+this.slider.value)}),ei(this.selection)||this.selection.addEventListener("value",d=>{d!==+this.slider.value&&(this.slider.value=d)}))}query(t=[]){let{from:n,column:r}=this;return!n||this.min!=null&&this.max!=null?null:yt.select({min:Kr(r),max:Qr(r)}).from(n).where(t)}queryResult(t){let{min:n,max:r}=Array.from(t)[0];return this.min==null&&this.slider.setAttribute("min",n),this.max==null&&this.slider.setAttribute("max",r),this.step==null&&this.slider.setAttribute("step",(r-n)/500),this}publish(t){let{selection:n,column:r}=this;ei(n)?n.update({source:this,schema:{type:"point"},value:t,predicate:ws(r,Or(t))}):mr(this.selection)&&n.update(t)}};var U3=j3(e=>{let t=Pv(e);return n=>n==null?"":typeof n=="number"?t(n):n instanceof Date?z3(n):`${n}`}),Pv=j3(e=>t=>t===0?"0":t.toLocaleString(e)),Mjt=U3(),Tjt=Pv();function z3(e){return xf(e,"Invalid Date")}function j3(e){let t=j3,n;return(r="en")=>r===t?n:n=e(t=r)}var Get=-1;var Gy=class extends or{constructor({element:t,filterBy:n,from:r,columns:i=["*"],align:o={},format:s,width:a,maxWidth:c,height:l=500,rowBatch:u=100}={}){super(n),this.id=`table-${++Get}`,this.from=r,this.columns=i,this.format=s,this.align=o,this.widths=typeof a=="object"?a:{},this.offset=0,this.limit=+u,this.pending=!1,this.sortHeader=null,this.sortColumn=null,this.sortDesc=!1,this.element=t||document.createElement("div"),this.element.setAttribute("id",this.id),this.element.value=this,typeof a=="number"&&(this.element.style.width=`${a}px`),c&&(this.element.style.maxWidth=`${c}px`),this.element.style.maxHeight=`${l}px`,this.element.style.overflow="auto";let f=-1;this.element.addEventListener("scroll",d=>{let{pending:h,loaded:p}=this,{scrollHeight:m,scrollTop:g,clientHeight:y}=d.target,x=g<f;f=g,!(x||h||p)&&m-g<2*y&&(this.pending=!0,this.requestData(this.offset+this.limit))}),this.tbl=document.createElement("table"),this.element.appendChild(this.tbl),this.head=document.createElement("thead"),this.tbl.appendChild(this.head),this.body=document.createElement("tbody"),this.tbl.appendChild(this.body),this.style=document.createElement("style"),this.element.appendChild(this.style)}requestData(t=0){this.offset=t;let n=this.query(this.filterBy?.predicate(this));this.requestQuery(n),ti().prefetch(n.clone().offset(t+this.limit))}fields(){return this.columns.map(t=>Ia(this.from,t))}fieldInfo(t){this.schema=t;let n=this.head;n.innerHTML="";let r=document.createElement("tr");for(let{column:i}of t){let o=document.createElement("th");o.addEventListener("click",s=>this.sort(s,i)),o.appendChild(document.createElement("span")),o.appendChild(document.createTextNode(i)),r.appendChild(o)}return n.appendChild(r),this.formats=Wet(this.format,t),this.style.innerText=Jet(this.id,Het(this.align,t),Zet(this.widths,t)),this}query(t=[]){let{from:n,limit:r,offset:i,schema:o,sortColumn:s,sortDesc:a}=this;return yt.from(n).select(o.map(c=>c.column)).where(t).orderby(s?a?I2(s):s:[]).limit(r).offset(i)}queryResult(t){return this.pending||(this.loaded=!1,this.body.replaceChildren()),this.data=t,this}update(){let{body:t,formats:n,data:r,schema:i,limit:o}=this,s=i.length,a=0;for(let c of r){++a;let l=document.createElement("tr");for(let u=0;u<s;++u){let f=c[i[u].column],d=document.createElement("td");d.innerText=f==null?"":n[u](f),l.appendChild(d)}t.appendChild(l)}return a<o&&(this.loaded=!0),this.pending=!1,this}sort(t,n){n===this.sortColumn?this.sortDesc=!this.sortDesc:(this.sortColumn=n,this.sortDesc=!1);let r=t.currentTarget,i=this.sortHeader;i===r&&t.metaKey?(i.firstChild.textContent="",this.sortHeader=null,this.sortColumn=null):(i&&(i.firstChild.textContent=""),this.sortHeader=r,r.firstChild.textContent=this.sortDesc?"\u25BE":"\u25B4"),this.requestData()}};function Wet(e={},t,n){return t.map(({column:r,type:i})=>{if(r in e)return e[r];switch(i){case"number":return Pv(n);case"date":return z3;default:return U3(n)}})}function Het(e={},t){return t.map(({column:n,type:r})=>n in e?e[n]:r==="number"?"right":"left")}function Zet(e={},t){return t.map(({column:n})=>e[n])}function Jet(e,t,n){let r=[];return t.forEach((i,o)=>{let s=+n[o];if(i!=="left"||s){let a=i!=="left"?`text-align:${i};`:"",c=s?`width:${s}px;max-width:${s}px;`:"";r.push(`#${e} tr>:nth-child(${o+1}) {${a}${c}}`)}}),r.join(" ")}function Wy(e,...t){let n=e?.context?.coordinator??ti();for(let r of t)n.connect(r)}function Uv(e,t,n){let r=new t(n);return Wy(e,r),r.element}function wP(e){return Uv(this,Vy,e)}function vP(e){return Uv(this,Yy,e)}function _P(e){return Uv(this,Xy,e)}function SP(e){return Uv(this,Gy,e)}function IP({direction:e="vertical",wrap:t=!1},n){let r=document.createElement("div");return r.style.display="flex",r.style.flexDirection=e==="vertical"?"column":"row",r.style.flexWrap=t?t===!0?"wrap":t:"nowrap",r.style.justifyContent="flex-start",r.style.alignItems="flex-start",n.forEach(i=>r.appendChild(i)),r.value={element:r},r}function MP(...e){return IP({direction:"vertical"},e.flat())}function TP(...e){return IP({direction:"horizontal"},e.flat())}function AP({dim:e="width",size:t=10}){let n=document.createElement("span");n.style.display="inline-block",n.style[e]=Number.isNaN(+t)?t:`${t}px`;let r={element:n};return n.value=r,n}function EP(e){return AP({dim:"height",size:e})}function NP(e){return AP({dim:"width",size:e})}var zv={};wr(zv,{align:()=>r6,aspectRatio:()=>i6,axis:()=>o6,colorClamp:()=>AE,colorDomain:()=>ME,colorInterpolate:()=>OE,colorLabel:()=>kE,colorN:()=>EE,colorNice:()=>NE,colorPivot:()=>BE,colorRange:()=>TE,colorReverse:()=>CE,colorScale:()=>IE,colorScheme:()=>DE,colorSymmetric:()=>LE,colorTickFormat:()=>RE,colorZero:()=>FE,facetGrid:()=>_4,facetLabel:()=>S4,facetMargin:()=>g4,facetMarginBottom:()=>b4,facetMarginLeft:()=>w4,facetMarginRight:()=>v4,facetMarginTop:()=>x4,fxAlign:()=>O4,fxAriaDescription:()=>H4,fxAriaLabel:()=>W4,fxAxis:()=>C4,fxDomain:()=>I4,fxFontVariant:()=>G4,fxGrid:()=>j4,fxInset:()=>A4,fxInsetLeft:()=>E4,fxInsetRight:()=>N4,fxLabel:()=>V4,fxLabelAnchor:()=>Y4,fxLabelOffset:()=>X4,fxLine:()=>q4,fxNice:()=>T4,fxPadding:()=>B4,fxPaddingInner:()=>L4,fxPaddingOuter:()=>k4,fxRange:()=>M4,fxReverse:()=>Z4,fxRound:()=>D4,fxTickFormat:()=>U4,fxTickPadding:()=>P4,fxTickRotate:()=>z4,fxTickSize:()=>R4,fxTickSpacing:()=>$4,fxTicks:()=>F4,fyAlign:()=>iE,fyAriaDescription:()=>_E,fyAriaLabel:()=>vE,fyAxis:()=>cE,fyDomain:()=>J4,fyFontVariant:()=>wE,fyGrid:()=>mE,fyInset:()=>tE,fyInsetBottom:()=>nE,fyInsetTop:()=>eE,fyLabel:()=>gE,fyLabelAnchor:()=>xE,fyLabelOffset:()=>bE,fyLine:()=>yE,fyNice:()=>K4,fyPadding:()=>oE,fyPaddingInner:()=>sE,fyPaddingOuter:()=>aE,fyRange:()=>Q4,fyReverse:()=>SE,fyRound:()=>rE,fyTickFormat:()=>hE,fyTickPadding:()=>dE,fyTickRotate:()=>pE,fyTickSize:()=>uE,fyTickSpacing:()=>fE,fyTicks:()=>lE,grid:()=>a6,height:()=>Q3,inset:()=>s6,label:()=>c6,lengthClamp:()=>n8,lengthDomain:()=>t8,lengthNice:()=>r8,lengthRange:()=>e8,lengthScale:()=>KE,lengthZero:()=>i8,margin:()=>W3,marginBottom:()=>n6,marginLeft:()=>K3,marginRight:()=>t6,marginTop:()=>e6,margins:()=>G3,name:()=>Y3,opacityClamp:()=>zE,opacityDomain:()=>PE,opacityLabel:()=>qE,opacityNice:()=>jE,opacityRange:()=>UE,opacityReverse:()=>VE,opacityScale:()=>$E,opacityTickFormat:()=>XE,opacityZero:()=>YE,padding:()=>l6,projectionClip:()=>m8,projectionDomain:()=>l8,projectionInset:()=>u8,projectionInsetBottom:()=>p8,projectionInsetLeft:()=>f8,projectionInsetRight:()=>d8,projectionInsetTop:()=>h8,projectionParallels:()=>s8,projectionPrecision:()=>a8,projectionRotate:()=>c8,projectionType:()=>o8,rClamp:()=>ZE,rDomain:()=>WE,rNice:()=>JE,rRange:()=>HE,rScale:()=>GE,rZero:()=>QE,round:()=>u6,style:()=>Z3,width:()=>J3,xAlign:()=>w6,xAriaDescription:()=>$6,xAriaLabel:()=>R6,xAxis:()=>I6,xClamp:()=>x6,xDomain:()=>d6,xFontVariant:()=>F6,xGrid:()=>O6,xInset:()=>m6,xInsetLeft:()=>y6,xInsetRight:()=>g6,xLabel:()=>L6,xLabelAnchor:()=>k6,xLabelOffset:()=>C6,xLine:()=>B6,xNice:()=>p6,xPadding:()=>v6,xPaddingInner:()=>_6,xPaddingOuter:()=>S6,xRange:()=>h6,xReverse:()=>P6,xRound:()=>b6,xScale:()=>f6,xTickFormat:()=>N6,xTickPadding:()=>E6,xTickRotate:()=>D6,xTickSize:()=>T6,xTickSpacing:()=>A6,xTicks:()=>M6,xZero:()=>U6,xyDomain:()=>H3,yAlign:()=>Z6,yAriaDescription:()=>p4,yAriaLabel:()=>h4,yAxis:()=>t4,yClamp:()=>W6,yDomain:()=>j6,yFontVariant:()=>d4,yGrid:()=>a4,yInset:()=>Y6,yInsetBottom:()=>G6,yInsetTop:()=>X6,yLabel:()=>l4,yLabelAnchor:()=>u4,yLabelOffset:()=>f4,yLine:()=>c4,yNice:()=>V6,yPadding:()=>J6,yPaddingInner:()=>Q6,yPaddingOuter:()=>K6,yRange:()=>q6,yReverse:()=>m4,yRound:()=>H6,yScale:()=>z6,yTickFormat:()=>o4,yTickPadding:()=>i4,yTickRotate:()=>s4,yTickSize:()=>n4,yTickSpacing:()=>r4,yTicks:()=>e4,yZero:()=>y4});var Hy=class extends Map{request(t,n){if(this.has(t))n(this.get(t));else{let r=this.waiting||(this.waiting=new Map),i=r.get(t)||[];r.set(t,i.concat(n))}}set(t,n){this.has(t)&&console.warn(`Overwriting named plot "${t}".`);let{waiting:r}=this;return r?.has(t)&&(r.get(t).forEach(i=>i(n)),r.delete(t)),super.set(t,n)}},q3=new Hy;function V3(e,t,n){(e?.context?.namedPlots??q3).request(t,n)}function DP(e,t,n){(e?.context?.namedPlots??q3).set(t,n)}function Y3(e){return t=>DP(this,e,t)}function OP(e,t,n){mr(n)?(n.addEventListener("value",r=>{e.setAttribute(t,r),e.update()}),n.value!==void 0&&e.setAttribute(t,n.value)):e.setAttribute(t,n)}function Qet(e,t){return n=>{OP(n,e,t)}}function X3(e){return t=>{for(let[n,r]of Object.entries(e))OP(t,n,r)}}function G3(e){let{top:t,bottom:n,left:r,right:i}=e,o={};return t!==void 0&&(o.marginTop=t),n!==void 0&&(o.marginBottom=n),r!==void 0&&(o.marginLeft=r),i!==void 0&&(o.marginRight=i),X3(o)}function W3(e){return X3({marginTop:e,marginBottom:e,marginLeft:e,marginRight:e})}function H3(e){return X3({xDomain:e,yDomain:e})}var C=e=>t=>Qet(e,t),Z3=C("style"),J3=C("width"),Q3=C("height"),K3=C("marginLeft"),t6=C("marginRight"),e6=C("marginTop"),n6=C("marginBottom"),r6=C("align"),i6=C("aspectRatio"),o6=C("axis"),s6=C("inset"),a6=C("grid"),c6=C("label"),l6=C("padding"),u6=C("round"),f6=C("xScale"),d6=C("xDomain"),h6=C("xRange"),p6=C("xNice"),m6=C("xInset"),y6=C("xInsetLeft"),g6=C("xInsetRight"),x6=C("xClamp"),b6=C("xRound"),w6=C("xAlign"),v6=C("xPadding"),_6=C("xPaddingInner"),S6=C("xPaddingOuter"),I6=C("xAxis"),M6=C("xTicks"),T6=C("xTickSize"),A6=C("xTickSpacing"),E6=C("xTickPadding"),N6=C("xTickFormat"),D6=C("xTickRotate"),O6=C("xGrid"),B6=C("xLine"),L6=C("xLabel"),k6=C("xLabelAnchor"),C6=C("xLabelOffset"),F6=C("xFontVariant"),R6=C("xAriaLabel"),$6=C("xAriaDescription"),P6=C("xReverse"),U6=C("xZero"),z6=C("yScale"),j6=C("yDomain"),q6=C("yRange"),V6=C("yNice"),Y6=C("yInset"),X6=C("yInsetTop"),G6=C("yInsetBottom"),W6=C("yClamp"),H6=C("yRound"),Z6=C("yAlign"),J6=C("yPadding"),Q6=C("yPaddingInner"),K6=C("yPaddingOuter"),t4=C("yAxis"),e4=C("yTicks"),n4=C("yTickSize"),r4=C("yTickSpacing"),i4=C("yTickPadding"),o4=C("yTickFormat"),s4=C("yTickRotate"),a4=C("yGrid"),c4=C("yLine"),l4=C("yLabel"),u4=C("yLabelAnchor"),f4=C("yLabelOffset"),d4=C("yFontVariant"),h4=C("yAriaLabel"),p4=C("yAriaDescription"),m4=C("yReverse"),y4=C("yZero"),g4=C("facetMargin"),x4=C("facetMarginTop"),b4=C("facetMarginBottom"),w4=C("facetMarginLeft"),v4=C("facetMarginRight"),_4=C("facetGrid"),S4=C("facetLabel"),I4=C("fxDomain"),M4=C("fxRange"),T4=C("fxNice"),A4=C("fxInset"),E4=C("fxInsetLeft"),N4=C("fxInsetRight"),D4=C("fxRound"),O4=C("fxAlign"),B4=C("fxPadding"),L4=C("fxPaddingInner"),k4=C("fxPaddingOuter"),C4=C("fxAxis"),F4=C("fxTicks"),R4=C("fxTickSize"),$4=C("fxTickSpacing"),P4=C("fxTickPadding"),U4=C("fxTickFormat"),z4=C("fxTickRotate"),j4=C("fxGrid"),q4=C("fxLine"),V4=C("fxLabel"),Y4=C("fxLabelAnchor"),X4=C("fxLabelOffset"),G4=C("fxFontVariant"),W4=C("fxAriaLabel"),H4=C("fxAriaDescription"),Z4=C("fxReverse"),J4=C("fyDomain"),Q4=C("fyRange"),K4=C("fyNice"),tE=C("fyInset"),eE=C("fyInsetTop"),nE=C("fyInsetBottom"),rE=C("fyRound"),iE=C("fyAlign"),oE=C("fyPadding"),sE=C("fyPaddingInner"),aE=C("fyPaddingOuter"),cE=C("fyAxis"),lE=C("fyTicks"),uE=C("fyTickSize"),fE=C("fyTickSpacing"),dE=C("fyTickPadding"),hE=C("fyTickFormat"),pE=C("fyTickRotate"),mE=C("fyGrid"),yE=C("fyLine"),gE=C("fyLabel"),xE=C("fyLabelAnchor"),bE=C("fyLabelOffset"),wE=C("fyFontVariant"),vE=C("fyAriaLabel"),_E=C("fyAriaDescription"),SE=C("fyReverse"),IE=C("colorScale"),ME=C("colorDomain"),TE=C("colorRange"),AE=C("colorClamp"),EE=C("colorN"),NE=C("colorNice"),DE=C("colorScheme"),OE=C("colorInterpolate"),BE=C("colorPivot"),LE=C("colorSymmetric"),kE=C("colorLabel"),CE=C("colorReverse"),FE=C("colorZero"),RE=C("colorTickFormat"),$E=C("opacityScale"),PE=C("opacityDomain"),UE=C("opacityRange"),zE=C("opacityClamp"),jE=C("opacityNice"),qE=C("opacityLabel"),VE=C("opacityReverse"),YE=C("opacityZero"),XE=C("opacityTickFormat"),GE=C("rScale"),WE=C("rDomain"),HE=C("rRange"),ZE=C("rClamp"),JE=C("rNice"),QE=C("rZero"),KE=C("lengthScale"),t8=C("lengthDomain"),e8=C("lengthRange"),n8=C("lengthClamp"),r8=C("lengthNice"),i8=C("lengthZero"),o8=C("projectionType"),s8=C("projectionParallels"),a8=C("projectionPrecision"),c8=C("projectionRotate"),l8=C("projectionDomain"),u8=C("projectionInset"),f8=C("projectionInsetLeft"),d8=C("projectionInsetRight"),h8=C("projectionInsetTop"),p8=C("projectionInsetBottom"),m8=C("projectionClip");function BP(e,t){return{table:e,options:t}}var jv={};wr(jv,{area:()=>g8,areaX:()=>x8,areaY:()=>b8,arrow:()=>lN,axisFx:()=>pN,axisFy:()=>mN,axisX:()=>dN,axisY:()=>hN,barX:()=>S8,barY:()=>I8,cell:()=>M8,cellX:()=>T8,cellY:()=>A8,circle:()=>k8,contour:()=>Q8,delaunayLink:()=>sN,delaunayMesh:()=>aN,denseLine:()=>J8,density:()=>Z8,densityX:()=>W8,densityY:()=>H8,dot:()=>O8,dotX:()=>B8,dotY:()=>L8,frame:()=>fN,geo:()=>wN,graticule:()=>_N,gridFx:()=>xN,gridFy:()=>bN,gridX:()=>yN,gridY:()=>gN,hexagon:()=>C8,hexbin:()=>eN,hexgrid:()=>nN,hull:()=>cN,image:()=>G8,line:()=>w8,lineX:()=>v8,lineY:()=>_8,link:()=>uN,raster:()=>K8,rasterTile:()=>tN,rect:()=>E8,rectX:()=>N8,rectY:()=>D8,regressionY:()=>rN,ruleX:()=>P8,ruleY:()=>U8,sphere:()=>vN,spike:()=>X8,text:()=>F8,textX:()=>R8,textY:()=>$8,tickX:()=>z8,tickY:()=>j8,vector:()=>q8,vectorX:()=>V8,vectorY:()=>Y8,voronoi:()=>iN,voronoiMesh:()=>oN});var Ket=new Set(["frame","axisX","axisY","axisFx","axisFy","gridX","gridY","gridFx","gridFy","hexgrid","graticule","sphere"]);function St(e,t,n={}){arguments.length===2&&!Array.isArray(t)&&(n=t,t=Ket.has(e)?null:[{}]);let r=e.startsWith("area")||e.startsWith("line")?Dy:Nn;return y8(r,e,t,n)}function y8(e,t,n,r){return i=>{i.addMark(new e(t,n,r))}}function yc(e,t,n){return r=>{r.addMark(new e(t,n))}}var g8=(...e)=>St("area",...e),x8=(...e)=>St("areaX",...e),b8=(...e)=>St("areaY",...e),w8=(...e)=>St("line",...e),v8=(...e)=>St("lineX",...e),_8=(...e)=>St("lineY",...e),S8=(...e)=>St("barX",...e),I8=(...e)=>St("barY",...e),M8=(...e)=>St("cell",...e),T8=(...e)=>St("cellX",...e),A8=(...e)=>St("cellY",...e),E8=(...e)=>St("rect",...e),N8=(...e)=>St("rectX",...e),D8=(...e)=>St("rectY",...e),O8=(...e)=>St("dot",...e),B8=(...e)=>St("dotX",...e),L8=(...e)=>St("dotY",...e),k8=(...e)=>St("circle",...e),C8=(...e)=>St("hexagon",...e),F8=(...e)=>St("text",...e),R8=(...e)=>St("textX",...e),$8=(...e)=>St("textY",...e),P8=(...e)=>St("ruleX",...e),U8=(...e)=>St("ruleY",...e),z8=(...e)=>St("tickX",...e),j8=(...e)=>St("tickY",...e),q8=(...e)=>St("vector",...e),V8=(...e)=>St("vectoX",...e),Y8=(...e)=>St("vectorY",...e),X8=(...e)=>St("spike",...e),G8=(...e)=>St("image",...e),W8=(...e)=>y8(gd,"areaX",...e),H8=(...e)=>y8(gd,"areaY",...e),Z8=(...e)=>yc(ky,...e),J8=(...e)=>yc(Ly,...e),Q8=(...e)=>yc(By,...e),K8=(...e)=>yc(ql,...e),tN=(...e)=>yc(Ry,...e),eN=(...e)=>yc(Fy,...e),nN=(...e)=>St("hexgrid",...e),rN=(...e)=>yc($y,...e),iN=(...e)=>St("voronoi",...e),oN=(...e)=>St("voronoiMesh",...e),sN=(...e)=>St("delaunayLink",...e),aN=(...e)=>St("delaunayMesh",...e),cN=(...e)=>St("hull",...e),lN=(...e)=>St("arrow",...e),uN=(...e)=>St("link",...e),fN=(...e)=>St("frame",...e),dN=(...e)=>St("axisX",...e),hN=(...e)=>St("axisY",...e),pN=(...e)=>St("axisFx",...e),mN=(...e)=>St("axisFy",...e),yN=(...e)=>St("gridX",...e),gN=(...e)=>St("gridY",...e),xN=(...e)=>St("gridFx",...e),bN=(...e)=>St("gridFy",...e),wN=(...e)=>yc(Cy,...e),vN=(...e)=>St("sphere",...e),_N=(...e)=>St("graticule",...e);var qv={};wr(qv,{highlight:()=>SN,intervalX:()=>NN,intervalXY:()=>ON,intervalY:()=>DN,nearestX:()=>AN,nearestY:()=>EN,pan:()=>BN,panX:()=>LN,panY:()=>kN,panZoom:()=>CN,panZoomX:()=>FN,panZoomY:()=>RN,toggle:()=>Sd,toggleColor:()=>TN,toggleX:()=>IN,toggleY:()=>MN});function gc(e,t){return n=>{let r=n.marks[n.marks.length-1];n.addInteractor(new e(r,t))}}function SN({by:e,...t}){return gc(Py,{selection:e,channels:t})}function Sd({as:e,...t}){return gc(Vl,{...t,selection:e})}function IN(e){return Sd({...e,channels:["x"]})}function MN(e){return Sd({...e,channels:["y"]})}function TN(e){return Sd({...e,channels:["color"]})}function AN({as:e,...t}){return gc(vd,{...t,selection:e,channel:"x"})}function EN({as:e,...t}){return gc(vd,{...t,selection:e,channel:"y"})}function NN({as:e,...t}){return gc(wd,{...t,selection:e,channel:"x"})}function DN({as:e,...t}){return gc(wd,{...t,selection:e,channel:"y"})}function ON({as:e,...t}){return gc(jy,{...t,selection:e})}function Id(e){return gc(qy,e)}function BN(e={}){return Id({...e,zoom:!1})}function LN(e={}){return Id({...e,zoom:!1,pany:!1})}function kN(e={}){return Id({...e,zoom:!1,panx:!1})}function CN(e={}){return Id(e)}function FN(e={}){return Id({...e,pany:!1})}function RN(e={}){return Id({...e,panx:!1})}var Vv={};wr(Vv,{colorLegend:()=>PN,opacityLegend:()=>UN,symbolLegend:()=>zN});function $N(e,t={}){if(t.for){let{for:n,...r}=t,i=new _d(e,r),o=typeof n,s=a=>a.addLegend(i,!1);return o==="string"?V3(this,n,s):n.value&&s(n.value),i.element}else return n=>n.addLegend(new _d(e,t))}function PN(e){return $N.call(this,"color",e)}function UN(e){return $N.call(this,"opacity",e)}function zN(e){return $N.call(this,"symbol",e)}function LP(...e){let t=new Ay;return e.flat().forEach(n=>n(t)),Wy(this,...t.marks),t.element}function qN({coordinator:e=ti(),namedPlots:t=new Hy,extensions:n=null,...r}={}){return{...jN,...n,context:{coordinator:e,namedPlots:t,...r}}}var kP="spec",Yv="literal",Aqt="dataref",CP="options",FP="selection",RP="paramref",$P="param",VN="select",Xv="value",PP="crossfilter",Gv="intersect",UP="union",zP="single",jP="data",qP="expression",xc="sql",aa="agg",Zy="input",Md="hconcat",Td="vconcat",Ad="hspace",Ed="vspace",Wv="mark",YN="from",Nd="plot",Jy="legend",VP="attribute",YP="transform",XP="interactor",Qy="Fixed";var $t=class{constructor(t,n=null){this.type=t,this.children=n}instantiate(){throw Error("instantiate not implemented")}codegen(){return Error("codegen not implemented")}toJSON(){return Error("toJSON not implemented")}};var Ky=class extends $t{constructor(t,n,r,i,o,s){super(kP,[t]),this.root=t,this.meta=n,this.config=r,this.data=i,this.params=o,this.plotDefaults=s}toJSON(){let{root:t,meta:n,config:r,plotDefaults:i}=this,o=new Map(Object.entries(this.data)),s=new Map(Object.entries(this.params)),a={};if(n&&(a.meta={...n}),r&&(a.config={...r}),o?.size){let c=a.data={};for(let[l,u]of o)c[l]=u.toJSON()}if(s?.size){let c=a.params={};for(let[l,u]of s)c[l]=u.toJSON()}if(i?.length){let c=a.plotDefaults={};for(let l of i)Object.assign(c,l.toJSON())}return Object.assign(a,t.toJSON())}};function GP(e){let t=typeof e;return t==="object"?e?.param:t==="string"?tnt(e):null}function tnt(e){return e?.[0]==="$"?e.slice(1):null}function tg(e){return`$${e}`}function WP(e){return[e].flat()}function xi(e){return Array.isArray(e)}function Dd(e){return e!==null&&typeof e=="object"&&!xi(e)}function Go(e){return typeof e=="string"}function Od(e,t){throw Object.assign(Error(e),{data:t})}function xr(e,t){let n={};for(let r in e)n[r]=t.maybeSelection(e[r]);return new Bd(n)}var Bd=class e extends $t{constructor(t){super(CP),this.options=t}filter(t){let n=Object.fromEntries(Object.entries(this.options).filter(([r,i])=>t(r,i)));return new e(n)}instantiate(t){let{options:n}=this,r={};for(let i in n)r[i]=n[i].instantiate(t);return r}codegen(t){let{options:n}=this,r=[];for(let i in n)r.push(`${i}: ${n[i].codegen(t)}`);return r.length?`{${t.maybeLineWrap(r)}}`:""}toJSON(){let{options:t}=this,n={};for(let r in t)n[r]=t[r].toJSON();return n}};var JP="table",QP="parquet",KP="csv",XN="json",n_="spatial",HP=new Map([[JP,ent],[QP,nnt],[KP,rnt],[XN,int],[n_,ont]]);function tU(e,t,n){if(t=snt(t),HP.has(t.type))return HP.get(t.type)(e,t,n);n.error("Unrecognized data format type.",t)}function ent(e,t,n){let{query:r,type:i,...o}=t;return new Zv(e,r,xr(o,n))}function nnt(e,t,n){let{file:r,type:i,...o}=t;return new Qv(e,r,xr(o,n))}function rnt(e,t,n){let{file:r,type:i,...o}=t;return new Kv(e,r,xr(o,n))}function int(e,t,n){let{data:r,file:i,type:o,...s}=t,a=xr(s,n);return r?new e_(e,r,a):new t_(e,i,a)}function ont(e,t,n){let{file:r,type:i,...o}=t;return new Jv(e,r,xr(o,n))}function snt(e){return xi(e)&&(e={type:"json",data:e}),Go(e)&&(e={type:"table",query:e}),{...e,type:ant(e)}}function ant(e){return e.type||cnt(e.file)||"table"}function cnt(e){let t=e?.lastIndexOf(".");return t>0?e.slice(t+1):null}function ZP(e,t){return t?new URL(e,t).toString():e}function lnt(e,t){let n=e?.codegen(t);return n?`, ${n}`:""}var Hv=class extends $t{constructor(t,n){super(jP),this.name=t,this.format=n}},Ld=class extends Hv{constructor(t,n){super(t,n)}instantiateQuery(t){t.error("instantiateQuery not implemented")}codegenQuery(t){t.error("codegenQuery not implemented")}instantiate(t){let n=this.instantiateQuery(t);if(n)return n}codegen(t){let n=this.codegenQuery(t);if(n)return n}},Zv=class extends Ld{constructor(t,n,r){super(t,JP),this.query=n?.trim(),this.options=r}instantiateQuery(t){let{name:n,query:r,options:i}=this;if(r)return t.api.create(n,r,i.instantiate(t))}codegenQuery(t){let{name:n,query:r,options:i}=this;if(r)return`\`${co(n,r,i.instantiate(t))}\``}toJSON(){let{format:t,query:n,options:r}=this;return{type:t,query:n,...r.toJSON()}}},Yl=class extends Ld{constructor(t,n,r,i,o){super(t,n),this.file=i,this.method=r,this.options=o}instantiateQuery(t){let{name:n,method:r,file:i,options:o}=this,s=ZP(i,t.baseURL),a=o?.instantiate(t);return t.api[r](n,s,a)}codegenQuery(t){let{name:n,method:r,file:i,options:o}=this,s=ZP(i,t.baseURL),a=lnt(o,t);return`${t.ns()}${r}("${n}", "${s}"${a})`}toJSON(){let{format:t,file:n,options:r}=this;return{type:t,file:n,...r.toJSON()}}},Jv=class extends Yl{constructor(t,n,r){super(t,n_,"loadSpatial",n,r)}},Qv=class extends Yl{constructor(t,n,r){super(t,QP,"loadParquet",n,r)}},Kv=class extends Yl{constructor(t,n,r){super(t,KP,"loadCSV",n,r)}},t_=class extends Yl{constructor(t,n,r){super(t,XN,"loadJSON",n,r)}},e_=class extends Ld{constructor(t,n,r){super(t,XN),this.data=n,this.options=r}instantiateQuery(t){let{name:n,data:r,options:i}=this;return t.api.loadObjects(n,r,i.instantiate(t))}codegenQuery(t){let{name:n,data:r,options:i}=this,o=i?","+i.codegen(t):"",s=`[
69
+ }`)).call(Cf,n);for(let F of l){let{channels:$,values:P,facets:U}=m.get(F);if(p===void 0||F.facet==="super"){let W=null;if(U&&(W=U[0],W=F.filter(W,$,P),W.length===0))continue;let tt=F.render(W,x,P,v,M);if(tt==null)continue;D.appendChild(tt)}else{let W;for(let tt of p){if(!(F.facetAnchor?.(p,O,tt)??!tt.empty))continue;let nt=null;if(U){let Y=f.has(F);if(nt=U[Y?tt.i:0],nt=F.filter(nt,$,P),nt.length===0)continue;!Y&&nt===U[0]&&(nt=Hs(nt)),nt.fx=tt.x,nt.fy=tt.y,nt.fi=tt.i}let st=F.render(nt,x,P,_,M);if(st!=null){(W??=jt(D).append("g")).append(()=>st).datum(tt);for(let Y of["aria-label","aria-description","aria-hidden","transform"])st.hasAttribute(Y)&&(W.attr(Y,st.getAttribute(Y)),st.removeAttribute(Y))}}W?.selectChildren().attr("transform",L)}}let N=o$(g,M,e),{figure:k=r!=null||i!=null||o!=null||N.length>0}=e;k&&(I=E.createElement("figure"),I.className=`${c}-figure`,I.style.maxWidth="initial",r!=null&&I.append(l$(E,r,"h2")),i!=null&&I.append(l$(E,i,"h3")),I.append(...N,D),o!=null&&I.append(VQ(E,o))),I.scale=i7(x.scales),I.legend=r$(g,M,e),I.projection=M.projection;let R=lR();return R>0&&jt(D).append("text").attr("x",S).attr("y",20).attr("dy","-1em").attr("text-anchor","end").attr("font-family","initial").text("\u26A0\uFE0F").append("title").text(`${R.toLocaleString("en-US")} warning${R===1?"":"s"}. Please check the console.`),I}function l$(e,t,n){if(t.ownerDocument)return t;let r=e.createElement(n);return r.append(t),r}function VQ(e,t){let n=e.createElement("figcaption");return n.append(t),n}function YQ({marks:e=[],...t}={}){return ny({...t,marks:[...e,this]})}vt.prototype.plot=YQ;function u$(e){return e.flat(1/0).filter(t=>t!=null).map(XQ)}function XQ(e){return typeof e.render=="function"?e:new VT(e)}var VT=class extends vt{constructor(t){if(typeof t!="function")throw new TypeError("invalid mark; missing render function");super(),this.render=t}render(){}};function YT(e,t){for(let n in e)p$(e[n],t);return e}function p$(e,t){let{scale:n,transform:r=!0}=e;if(n==null||!r)return;let{type:i,percent:o,interval:s,transform:a=o?c=>c*100:GA(s,i)}=t[n]??{};a!=null&&(e.value=Xt(e.value,a),e.transform=!1)}function GQ(e){for(let t in e)aT(t,e[t])}function ey(e,t,n,r=DF){for(let{channels:i}of t.values())for(let o in i){let s=i[o],{scale:a}=s;if(a!=null&&r(a))if(a==="projection"){if(!yR(n)){let c=n.x?.domain===void 0,l=n.y?.domain===void 0;if(c||l){let[u,f]=xR(s);c&&jT(e,"x",u),l&&jT(e,"y",f)}}}else jT(e,a,s)}return e}function jT(e,t,n){let r=e.get(t);r!==void 0?r.push(n):e.set(t,[n])}function WQ(e,t){if(e==null)return;let{x:n,y:r}=e;if(n==null&&r==null)return;let i=qe(e.data);if(i==null)throw new Error("missing facet data");let o={};n!=null&&(o.fx=Of(i,{value:n,scale:"fx"})),r!=null&&(o.fy=Of(i,{value:r,scale:"fy"})),YT(o,t);let s=Ow(i,o);return{channels:o,groups:s,data:e.data}}function f$(e,t,n){if(e.facet===null||e.facet==="super")return;let{fx:r,fy:i}=e;if(r!=null||i!=null){let c=qe(e.data??r??i);if(c===void 0)throw new Error(`missing facet data in ${e.ariaLabel}`);if(c===null)return;let l={};return r!=null&&(l.fx=Of(c,{value:r,scale:"fx"})),i!=null&&(l.fy=Of(c,{value:i,scale:"fy"})),YT(l,n),{channels:l,groups:Ow(c,l)}}if(t===void 0)return;let{channels:o,groups:s,data:a}=t;if(e.facet!=="auto"||e.data===a)return{channels:o,groups:s};a.length>0&&(s.size>1||s.size===1&&o.fx&&o.fy&&[...s][0][1].size>1)&&qe(e.data)?.length===a.length&&zn(`Warning: the ${e.ariaLabel} mark appears to use faceted data, but isn\u2019t faceted. The mark data has the same length as the facet data and the mark facet option is "auto", but the mark data and facet data are distinct. If this mark should be faceted, set the mark facet option to true; otherwise, suppress this warning by setting the mark facet option to false.`)}function HQ(e,t={}){return _e({...t,x:null,y:null},(n,r,i,o,s,a)=>a.getMarkState(e))}function ZQ(e){let t=[];for(let n of e){let r=n.tip;if(r){r===!0?r={}:typeof r=="string"&&(r={pointer:r});let{pointer:i,preferredAnchor:o}=r;i=/^x$/i.test(i)?jf:/^y$/i.test(i)?Dl:qf,r=i(HQ(n,r)),r.title=null,o===void 0&&(r.preferredAnchor=i===Dl?"left":"bottom");let s=ev(n.data,r);s.facet=n.facet,s.facetAnchor=n.facetAnchor,t.push(s)}}return t}function JQ(e,t,n){let{projection:r,x:i={},y:o={},fx:s={},fy:a={},axis:c,grid:l,facet:u={},facet:{axis:f=c,grid:d}=u,x:{axis:h=c,grid:p=h===null?null:l}=i,y:{axis:m=c,grid:g=m===null?null:l}=o,fx:{axis:y=f,grid:x=y===null?null:d}=s,fy:{axis:b=f,grid:w=b===null?null:d}=a}=n;(r||!Lo(i)&&!d$("x",e))&&(h=p=null),(r||!Lo(o)&&!d$("y",e))&&(m=g=null),t.has("fx")||(y=x=null),t.has("fy")||(b=w=null),h===void 0&&(h=!iv(e,"x")),m===void 0&&(m=!iv(e,"y")),y===void 0&&(y=!iv(e,"fx")),b===void 0&&(b=!iv(e,"fy")),h===!0&&(h="bottom"),m===!0&&(m="left"),y===!0&&(y=h==="top"||h===null?"bottom":"top"),b===!0&&(b=m==="right"||m===null?"left":"right");let _=[];return rv(_,w,Zw,a),nv(_,b,Gw,"right","left",u,a),rv(_,x,Qw,s),nv(_,y,Ww,"top","bottom",u,s),rv(_,g,Hw,o),nv(_,m,Zm,"left","right",n,o),rv(_,p,Jw,i),nv(_,h,Jm,"bottom","top",n,i),_}function nv(e,t,n,r,i,o,s){if(!t)return;let a=QQ(t);s=KQ(a?r:t,o,s);let{line:c}=s;(n===Zm||n===Jm)&&c&&!Qs(c)&&e.push(Gf(tK(s))),e.push(n(s)),a&&e.push(n({...s,anchor:i,label:null}))}function rv(e,t,n,r){!t||Qs(t)||e.push(n(eK(t,r)))}function QQ(e){return/^\s*both\s*$/i.test(e)}function KQ(e,t,{line:n=t.line,ticks:r,tickSize:i,tickSpacing:o,tickPadding:s,tickFormat:a,tickRotate:c,fontVariant:l,ariaLabel:u,ariaDescription:f,label:d=t.label,labelAnchor:h,labelArrow:p=t.labelArrow,labelOffset:m}){return{anchor:e,line:n,ticks:r,tickSize:i,tickSpacing:o,tickPadding:s,tickFormat:a,tickRotate:c,fontVariant:l,ariaLabel:u,ariaDescription:f,label:d,labelAnchor:h,labelArrow:p,labelOffset:m}}function tK(e){let{anchor:t,line:n}=e;return{anchor:t,facetAnchor:t+"-empty",stroke:n===!0?void 0:n}}function eK(e,{stroke:t=tc(e)?e:void 0,ticks:n=nK(e)?e:void 0,tickSpacing:r,ariaLabel:i,ariaDescription:o}){return{stroke:t,ticks:n,tickSpacing:r,ariaLabel:i,ariaDescription:o}}function nK(e){switch(typeof e){case"number":return!0;case"string":return!tc(e)}return or(e)||typeof e?.range=="function"}function iv(e,t){let n=`${t}-axis `;return e.some(r=>r.ariaLabel?.startsWith(n))}function d$(e,t){for(let n of t)for(let r in n.channels){let{scale:i}=n.channels[r];if(i===e||i==="projection")return!0}return!1}function rK(e,t){for(let n in e){let r=e[n],i=t[n];r.label===void 0&&i&&(r.label=i.label)}return e}function iK({fx:e,fy:t},n){let{marginTop:r,marginRight:i,marginBottom:o,marginLeft:s,width:a,height:c}=Ew(n),l=e&&h$(e),u=t&&h$(t);return{marginTop:t?u[0]:r,marginRight:e?a-l[1]:i,marginBottom:t?c-u[1]:o,marginLeft:e?l[0]:s,inset:{marginTop:n.marginTop,marginRight:n.marginRight,marginBottom:n.marginBottom,marginLeft:n.marginLeft},width:a,height:c}}function h$(e){let t=e.domain(),n=e(t[0]),r=e(t[t.length-1]);return r<n&&([n,r]=[r,n]),[n,r+e.bandwidth()]}var oK=new Map([["basis",hA],["basis-closed",pA],["basis-open",mA],["bundle",yA],["bump-x",cA],["bump-y",lA],["cardinal",gA],["cardinal-closed",xA],["cardinal-open",bA],["catmull-rom",wA],["catmull-rom-closed",vA],["catmull-rom-open",_A],["linear",Vs],["linear-closed",SA],["monotone-x",MA],["monotone-y",AA],["natural",TA],["step",EA],["step-after",DA],["step-before",NA]]);function ry(e=Vs,t){if(typeof e=="function")return e;let n=oK.get(`${e}`.toLowerCase());if(!n)throw new Error(`unknown curve: ${e}`);if(t!==void 0){if("beta"in n)return n.beta(t);if("tension"in n)return n.tension(t);if("alpha"in n)return n.alpha(t)}return n}function ov(e=lc,t){return typeof e!="function"&&`${e}`.toLowerCase()==="auto"?lc:ry(e,t)}function lc(e){return Vs(e)}function Uo(e={y:"count"},t={}){[e,t]=GT(e,t);let{x:n,y:r}=t;return XT(sv(n,t,G),null,null,r,e,Ol(t))}function zo(e={x:"count"},t={}){[e,t]=GT(e,t);let{x:n,y:r}=t;return XT(null,sv(r,t,G),n,null,e,Bl(t))}function ia(e={fill:"count"},t={}){[e,t]=GT(e,t);let{x:n,y:r}=sK(t);return XT(n,r,null,null,e,Ol(Bl(t)))}function g$(e,t,n={}){if(n?.interval==null)return n;let{reduce:r=yw}=n,i={filter:null};return n[t]!=null&&(i[t]=r),n[`${t}1`]!=null&&(i[`${t}1`]=r),n[`${t}2`]!=null&&(i[`${t}2`]=r),e(i,n)}function Wf(e={}){return g$(Uo,"y",Yi(e,"x"))}function Hf(e={}){return g$(zo,"x",Yi(e,"y"))}function XT(e,t,n,r,{data:i=mw,filter:o=$m,sort:s,reverse:a,...c}={},l={}){e=m$(e),t=m$(t),c=aK(c,l),i=w$(i,G),s=s==null?void 0:x$("sort",s,l),o=o==null?void 0:b$("filter",o,l),n!=null&&Ro(c,"x","x1","x2")&&(n=null),r!=null&&Ro(c,"y","y1","y2")&&(r=null);let[u,f]=Tn(e),[d,h]=Tn(e),[p,m]=Tn(t),[g,y]=Tn(t),[x,b]=n!=null?[n,"x"]:r!=null?[r,"y"]:[],[w,_]=Tn(x),{x:v,y:M,z:E,fill:D,stroke:I,x1:T,x2:O,y1:L,y2:S,domain:A,cumulative:N,thresholds:k,interval:R,...F}=l,[$,P]=Tn(E),[U]=De(D),[W]=De(I),[tt,nt]=Tn(U),[st,Y]=Tn(W);return{..."z"in l&&{z:$||E},..."fill"in l&&{fill:tt||D},..."stroke"in l&&{stroke:st||I},...hn(F,(rt,q,H)=>{let ot=Ml(pt(rt,x),H?.[b]),z=pt(rt,E),kt=pt(rt,U),dt=pt(rt,W),Wt=zm(c,{z,fill:kt,stroke:dt}),Ht=[],et=[],oe=ot&&_([]),vr=z&&P([]),Wi=kt&&nt([]),XU=dt&&Y([]),vD=e&&f([]),GU=e&&h([]),_D=t&&m([]),WU=t&&y([]),HU=uK(e,t,rt),ZU=0;for(let Zl of c)Zl.initialize(rt);s&&s.initialize(rt),o&&o.initialize(rt);for(let Zl of q){let SD=[];for(let kd of c)kd.scope("facet",Zl);s&&s.scope("facet",Zl),o&&o.scope("facet",Zl);for(let[kd,JU]of ec(Zl,Wt))for(let[QU,ig]of ec(JU,ot))for(let[Hi,vc]of HU(ig))if(!(o&&!o.reduce(Hi,vc))){SD.push(ZU++),et.push(i.reduceIndex(Hi,rt,vc)),ot&&oe.push(QU),z&&vr.push(Wt===z?kd:z[(Hi.length>0?Hi:ig)[0]]),kt&&Wi.push(Wt===kt?kd:kt[(Hi.length>0?Hi:ig)[0]]),dt&&XU.push(Wt===dt?kd:dt[(Hi.length>0?Hi:ig)[0]]),vD&&(vD.push(vc.x1),GU.push(vc.x2)),_D&&(_D.push(vc.y1),WU.push(vc.y2));for(let KU of c)KU.reduce(Hi,vc);s&&s.reduce(Hi)}Ht.push(SD)}return oT(Ht,s,a),{data:et,facets:Ht}}),...!Ro(c,"x")&&(u?{x1:u,x2:d,x:Af(u,d)}:{x:v,x1:T,x2:O}),...!Ro(c,"y")&&(p?{y1:p,y2:g,y:Af(p,g)}:{y:M,y1:L,y2:S}),...w&&{[b]:w},...Object.fromEntries(c.map(({name:rt,output:q})=>[rt,q]))}}function GT({cumulative:e,domain:t,thresholds:n,interval:r,...i},o){return[i,{cumulative:e,domain:t,thresholds:n,interval:r,...o}]}function sv(e,{cumulative:t,domain:n,thresholds:r,interval:i},o){return e={...pi(e)},e.domain===void 0&&(e.domain=n),e.cumulative===void 0&&(e.cumulative=t),e.thresholds===void 0&&(e.thresholds=r),e.interval===void 0&&(e.interval=i),e.value===void 0&&(e.value=o),e.thresholds=WT(e.thresholds,e.interval),e}function sK(e){let{x:t,y:n}=e;return t=sv(t,e),n=sv(n,e),[t.value,n.value]=Re(t.value,n.value),{x:t,y:n}}function m$(e){if(e==null)return;let{value:t,cumulative:n,domain:r=ae,thresholds:i}=e,o=s=>{let a=pt(s,t),c;if(Oe(a)||lK(i)){a=Xt(a,qA,Float64Array);let[u,f]=typeof r=="function"?r(a):r,d=typeof i=="function"&&!Ka(i)?i(a,u,f):i;typeof d=="number"&&(d=am(u,f,d)),Ka(d)&&(r===ae&&(u=d.floor(u),f=d.offset(d.floor(f))),d=d.range(u,d.offset(f))),c=d}else{a=Je(a);let[u,f]=typeof r=="function"?r(a):r,d=typeof i=="function"&&!Ka(i)?i(a,u,f):i;if(typeof d=="number")if(r===ae){let h=As(u,f,d);if(isFinite(h))if(h>0){let p=Math.round(u/h),m=Math.round(f/h);p*h<=u||--p,m*h>f||++m;let g=m-p+1;d=new Float64Array(g);for(let y=0;y<g;++y)d[y]=(p+y)*h}else if(h<0){h=-h;let p=Math.round(u*h),m=Math.round(f*h);p/h<=u||--p,m/h>f||++m;let g=m-p+1;d=new Float64Array(g);for(let y=0;y<g;++y)d[y]=(p+y)/h}else d=[u];else d=[u]}else d=_n(u,f,d);else Ka(d)&&(r===ae&&(u=d.floor(u),f=d.offset(d.floor(f))),d=d.range(u,d.offset(f)));c=d}let l=[];if(c.length===1)l.push([c[0],c[0]]);else for(let u=1;u<c.length;++u)l.push([c[u-1],c[u]]);return l.bin=(n<0?dK:n>0?fK:HT)(l,c,a),l};return o.label=En(t),o}function WT(e,t,n=y$){if(e===void 0)return t===void 0?n:ko(t);if(typeof e=="string"){switch(e.toLowerCase()){case"freedman-diaconis":return Q0;case"scott":return np;case"sturges":return Oa;case"auto":return y$}return Cm(e)}return e}function aK(e,t){return rT(e,t,x$)}function x$(e,t,n){return hw(e,t,n,b$)}function b$(e,t,n){return pw(e,t,n,w$)}function w$(e,t){return Df(e,t,cK)}function cK(e){switch(`${e}`.toLowerCase()){case"x":return hK;case"x1":return mK;case"x2":return yK;case"y":return pK;case"y1":return gK;case"y2":return xK}throw new Error(`invalid bin reduce: ${e}`)}function y$(e,t,n){return Math.min(200,np(e,t,n))}function lK(e){return CF(e)||or(e)&&Oe(e)}function uK(e,t,n){let r=e?.(n),i=t?.(n);return r&&i?function*(o){let s=r.bin(o);for(let[a,[c,l]]of r.entries()){let u=i.bin(s[a]);for(let[f,[d,h]]of i.entries())yield[u[f],{data:n,x1:c,y1:d,x2:l,y2:h}]}}:r?function*(o){let s=r.bin(o);for(let[a,[c,l]]of r.entries())yield[s[a],{data:n,x1:c,x2:l}]}:function*(o){let s=i.bin(o);for(let[a,[c,l]]of i.entries())yield[s[a],{data:n,y1:c,y2:l}]}}function HT(e,t,n){return t=Je(t),r=>{let i=e.map(()=>[]);for(let o of r)i[Ms(t,n[o])-1]?.push(o);return i}}function fK(e,t,n){let r=HT(e,t,n);return i=>{let o=r(i);for(let s=1,a=o.length;s<a;++s){let c=o[s-1],l=o[s];for(let u of c)l.push(u)}return o}}function dK(e,t,n){let r=HT(e,t,n);return i=>{let o=r(i);for(let s=o.length-2;s>=0;--s){let a=o[s+1],c=o[s];for(let l of a)c.push(l)}return o}}function v$(e,t){let n=(+e+ +t)/2;return e instanceof Date?new Date(n):n}var hK={reduceIndex(e,t,{x1:n,x2:r}){return v$(n,r)}},pK={reduceIndex(e,t,{y1:n,y2:r}){return v$(n,r)}},mK={reduceIndex(e,t,{x1:n}){return n}},yK={reduceIndex(e,t,{x2:n}){return n}},gK={reduceIndex(e,t,{y1:n}){return n}},xK={reduceIndex(e,t,{y2:n}){return n}};function Zf(e={}){return VA(e)?e:{...e,x:G}}function Jf(e={}){return YA(e)?e:{...e,y:G}}function _$(e,t){if(t.length===1)return{data:e,facets:t};let n=e.length,r=new Uint8Array(n),i=0;for(let a of t)for(let c of a)r[c]&&++i,r[c]=1;if(i===0)return{data:e,facets:t};e=Qa(e);let o=e[PA]=new Uint32Array(n+i);t=t.map(a=>Qa(a,Uint32Array));let s=n;r.fill(0);for(let a of t)for(let c=0,l=a.length;c<l;++c){let u=a[c];r[u]?(a[c]=s,e[s]=e[u],o[s]=u,++s):o[u]=u,r[u]=1}return{data:e,facets:t}}function ZT(e={},t={}){arguments.length===1&&([e,t]=td(e));let{y1:n,y:r=n,x:i,...o}=t,[s,a,c,l]=ed(r,i,"y","x",e,o);return{...s,y1:n,y:a,x1:c,x2:l,x:Af(c,l)}}function M$(e={},t={}){arguments.length===1&&([e,t]=td(e));let{y1:n,y:r=n,x:i}=t,[o,s,a]=ed(r,i,"y","x",e,t);return{...o,y1:n,y:s,x:a}}function A$(e={},t={}){arguments.length===1&&([e,t]=td(e));let{y1:n,y:r=n,x:i}=t,[o,s,,a]=ed(r,i,"y","x",e,t);return{...o,y1:n,y:s,x:a}}function JT(e={},t={}){arguments.length===1&&([e,t]=td(e));let{x1:n,x:r=n,y:i,...o}=t,[s,a,c,l]=ed(r,i,"x","y",e,o);return{...s,x1:n,x:a,y1:c,y2:l,y:Af(c,l)}}function T$(e={},t={}){arguments.length===1&&([e,t]=td(e));let{x1:n,x:r=n,y:i}=t,[o,s,a]=ed(r,i,"x","y",e,t);return{...o,x1:n,x:s,y:a}}function E$(e={},t={}){arguments.length===1&&([e,t]=td(e));let{x1:n,x:r=n,y:i}=t,[o,s,,a]=ed(r,i,"x","y",e,t);return{...o,x1:n,x:s,y:a}}function Qf({x:e,x1:t,x2:n,...r}={}){return r=Yi(r,"y"),t===void 0&&n===void 0?ZT({x:e,...r}):([t,n]=XA(e,t,n),{...r,x1:t,x2:n})}function Kf({y:e,y1:t,y2:n,...r}={}){return r=Yi(r,"x"),t===void 0&&n===void 0?JT({y:e,...r}):([t,n]=XA(e,t,n),{...r,y1:t,y2:n})}function td(e){let{offset:t,order:n,reverse:r,...i}=e;return[{offset:t,order:n,reverse:r},i]}var bK={length:!0};function ed(e,t=km,n,r,{offset:i,order:o,reverse:s},a){if(t===null)throw new Error(`stack requires ${r}`);let c=Un(a),[l,u]=Tn(e),[f,d]=dn(t),[h,p]=dn(t);return f.hint=h.hint=bK,i=wK(i),o=SK(o,i,r),[hn(a,(m,g,y)=>{({data:m,facets:g}=_$(m,g));let x=e==null?void 0:u(Ml(pt(m,e),y?.[n])),b=pt(m,t,Float64Array),w=pt(m,c),_=o&&o(m,x,b,w),v=m.length,M=d(new Float64Array(v)),E=p(new Float64Array(v)),D=[];for(let I of g){let T=x?Array.from(on(I,O=>x[O]).values()):[I];if(_)for(let O of T)O.sort(_);for(let O of T){let L=0,S=0;s&&O.reverse();for(let A of O){let N=b[A];N<0?L=E[A]=(M[A]=L)+N:N>0?S=E[A]=(M[A]=S)+N:E[A]=M[A]=S}}D.push(T)}return i&&i(D,M,E,w),{data:m,facets:g}}),l,f,h]}function wK(e){if(e!=null){if(typeof e=="function")return e;switch(`${e}`.toLowerCase()){case"expand":case"normalize":return vK;case"center":case"silhouette":return _K;case"wiggle":return D$}throw new Error(`unknown offset: ${e}`)}}function N$(e,t){let n=0,r=0;for(let i of e){let o=t[i];o<n&&(n=o),o>r&&(r=o)}return[n,r]}function vK(e,t,n){for(let r of e)for(let i of r){let[o,s]=N$(i,n);for(let a of i){let c=1/(s-o||1);t[a]=c*(t[a]-o),n[a]=c*(n[a]-o)}}}function _K(e,t,n){for(let r of e){for(let i of r){let[o,s]=N$(i,n);for(let a of i){let c=(s+o)/2;t[a]-=c,n[a]-=c}}O$(r,t,n)}B$(e,t,n)}function D$(e,t,n,r){for(let i of e){let o=new Gn,s=0;for(let a of i){let c=-1,l=a.map(h=>Math.abs(n[h]-t[h])),u=a.map(h=>{c=r?r[h]:++c;let p=n[h]-t[h],m=o.has(c)?p-o.get(c):0;return o.set(c,p),m}),f=[0,...G0(u)];for(let h of a)t[h]+=s,n[h]+=s;let d=Sn(l);d&&(s-=Sn(l,(h,p)=>(u[p]/2+f[p])*h)/d)}O$(i,t,n)}B$(e,t,n)}function O$(e,t,n){let r=ce(e,i=>ce(i,o=>t[o]));for(let i of e)for(let o of i)t[o]-=r,n[o]-=r}function B$(e,t,n){let r=e.length;if(r===1)return;let i=e.map(a=>a.flat()),o=i.map(a=>(ce(a,c=>t[c])+Gt(a,c=>n[c]))/2),s=ce(o);for(let a=0;a<r;a++){let c=s-o[a];for(let l of i[a])t[l]+=c,n[l]+=c}}function SK(e,t,n){if(e===void 0&&t===D$)return S$(ln);if(e!=null){if(typeof e=="string"){let r=e.startsWith("-"),i=r?vl:ln;switch((r?e.slice(1):e).toLowerCase()){case"value":case n:return IK(i);case"z":return MK(i);case"sum":return AK(i);case"appearance":return TK(i);case"inside-out":return S$(i)}return I$(UA(e))}if(typeof e=="function")return(e.length===1?I$:EK)(e);if(Array.isArray(e))return NK(e);throw new Error(`invalid order: ${e}`)}}function IK(e){return(t,n,r)=>(i,o)=>e(r[i],r[o])}function MK(e){return(t,n,r,i)=>(o,s)=>e(i[o],i[s])}function AK(e){return av(e,(t,n,r,i)=>Tu(ir(t),o=>Sn(o,s=>r[s]),o=>i[o]))}function TK(e){return av(e,(t,n,r,i)=>Tu(ir(t),o=>n[Gc(o,s=>r[s])],o=>i[o]))}function S$(e){return av(e,(t,n,r,i)=>{let o=ir(t),s=Tu(o,f=>n[Gc(f,d=>r[d])],f=>i[f]),a=$i(o,f=>Sn(f,d=>r[d]),f=>i[f]),c=[],l=[],u=0;for(let f of s)u<0?(u+=a.get(f),c.push(f)):(u-=a.get(f),l.push(f));return l.reverse().concat(c)})}function I$(e){return t=>{let n=pt(t,e);return(r,i)=>ln(n[r],n[i])}}function EK(e){return t=>(n,r)=>e(t[n],t[r])}function NK(e){return av(ln,()=>e)}function av(e,t){return(n,r,i,o)=>{if(!o)throw new Error("missing channel: z");let s=new Gn(t(n,r,i,o).map((a,c)=>[a,c]));return(a,c)=>e(s.get(o[a]),s.get(o[c]))}}var DK={ariaLabel:"area",strokeWidth:1,strokeLinecap:"round",strokeLinejoin:"round",strokeMiterlimit:1},Rl=class extends vt{constructor(t,n={}){let{x1:r,y1:i,x2:o,y2:s,z:a,curve:c,tension:l}=n;super(t,{x1:{value:r,scale:"x"},y1:{value:i,scale:"y"},x2:{value:o,scale:"x",optional:!0},y2:{value:s,scale:"y",optional:!0},z:{value:Un(n),optional:!0}},n,DK),this.z=a,this.curve=ry(c,l)}filter(t){return t}render(t,n,r,i,o){let{x1:s,y1:a,x2:c=s,y2:l=a}=r;return ct("svg:g",o).call(Ct,this,i,o).call(It,this,n,0,0).call(u=>u.selectAll().data(vw(t,[s,a,c,l],this,r)).enter().append("path").call(Dt,this).call(Nl,this,r).attr("d",hf().curve(this.curve).defined(f=>f>=0).x0(f=>s[f]).y0(f=>a[f]).x1(f=>c[f]).y1(f=>l[f]))).node()}};function iy(e,t){return t===void 0?oa(e,{x:Ws,y:Ja}):new Rl(e,t)}function uc(e,t){let{y:n=Ae,...r}=Hf(t);return new Rl(e,Qf(Zf({...r,y1:n,y2:void 0})))}function oa(e,t){let{x:n=Ae,...r}=Wf(t);return new Rl(e,Kf(Jf({...r,x1:n,x2:void 0})))}var OK={ariaLabel:"link",fill:"none",stroke:"currentColor",strokeMiterlimit:1},oy=class extends vt{constructor(t,n={}){let{x1:r,y1:i,x2:o,y2:s,curve:a,tension:c}=n;super(t,{x1:{value:r,scale:"x"},y1:{value:i,scale:"y"},x2:{value:o,scale:"x",optional:!0},y2:{value:s,scale:"y",optional:!0}},n,OK),this.curve=ov(a,c),Xi(this,n)}project(t,n,r){this.curve!==lc&&super.project(t,n,r)}render(t,n,r,i,o){let{x1:s,y1:a,x2:c=s,y2:l=a}=r,{curve:u}=this;return ct("svg:g",o).call(Ct,this,i,o).call(It,this,n).call(f=>f.selectAll().data(t).enter().append("path").call(Dt,this).attr("d",u===lc&&o.projection?BK(o.projection,s,a,c,l):d=>{let h=Qn(),p=u(h);return p.lineStart(),p.point(s[d],a[d]),p.point(c[d],l[d]),p.lineEnd(),h}).call(Jt,this,r).call(ra,this,r,o)).node()}};function BK(e,t,n,r,i){let o=Mn(e);return t=Je(t),n=Je(n),r=Je(r),i=Je(i),s=>o({type:"LineString",coordinates:[[t[s],n[s]],[r[s],i[s]]]})}function cv(e,{x:t,x1:n,x2:r,y:i,y1:o,y2:s,...a}={}){return[n,r]=sy(t,n,r),[o,s]=sy(i,o,s),new oy(e,{...a,x1:n,x2:r,y1:o,y2:s})}function sy(e,t,n){if(e===void 0){if(t===void 0){if(n!==void 0)return[n]}else if(n===void 0)return[t]}else{if(t===void 0)return n===void 0?[e]:[e,n];if(n===void 0)return[e,t]}return[t,n]}var LK={ariaLabel:"arrow",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeMiterlimit:1,strokeWidth:1.5},ay=class extends vt{constructor(t,n={}){let{x1:r,y1:i,x2:o,y2:s,bend:a=0,headAngle:c=60,headLength:l=8,inset:u=0,insetStart:f=u,insetEnd:d=u,sweep:h}=n;super(t,{x1:{value:r,scale:"x"},y1:{value:i,scale:"y"},x2:{value:o,scale:"x",optional:!0},y2:{value:s,scale:"y",optional:!0}},n,LK),this.bend=a===!0?22.5:Math.max(-90,Math.min(90,a)),this.headAngle=+c,this.headLength=+l,this.insetStart=+f,this.insetEnd=+d,this.sweep=CK(h)}render(t,n,r,i,o){let{x1:s,y1:a,x2:c=s,y2:l=a,SW:u}=r,{strokeWidth:f,bend:d,headAngle:h,headLength:p,insetStart:m,insetEnd:g}=this,y=u?w=>u[w]:un(f===void 0?1:f),x=h*Vf/2,b=p/1.5;return ct("svg:g",o).call(Ct,this,i,o).call(It,this,n).call(w=>w.selectAll().data(t).enter().append("path").call(Dt,this).attr("d",_=>{let v=s[_],M=a[_],E=c[_],D=l[_],I=Math.hypot(E-v,D-M);if(I<=m+g)return null;let T=Math.atan2(D-M,E-v),O=Math.min(b*y(_),I/3),L=this.sweep(v,M,E,D)*d*Vf,S=Math.hypot(I/Math.tan(L),I)/2;if(m||g)if(S<1e5){let tt=Math.sign(L),[nt,st]=kK([v,M],[E,D],S,tt);if(m&&([v,M]=L$([nt,st,S],[v,M,m],-tt*Math.sign(m))),g){let[Y,rt]=L$([nt,st,S],[E,D,g],tt*Math.sign(g));T+=Math.atan2(rt-st,Y-nt)-Math.atan2(D-st,E-nt),E=Y,D=rt}}else{let tt=E-v,nt=D-M,st=Math.hypot(tt,nt);m&&(v+=tt/st*m,M+=nt/st*m),g&&(E-=tt/st*g,D-=nt/st*g)}let A=T+L,N=A+x,k=A-x,R=E-O*Math.cos(N),F=D-O*Math.sin(N),$=E-O*Math.cos(k),P=D-O*Math.sin(k),U=S<1e5?`A${S},${S} 0,0,${L>0?1:0} `:"L",W=O?`M${R},${F}L${E},${D}L${$},${P}`:"";return`M${v},${M}${U}${E},${D}${W}`}).call(Jt,this,r)).node()}};function CK(e=1){if(typeof e=="number")return un(Math.sign(e));if(typeof e=="function")return(t,n,r,i)=>Math.sign(e(t,n,r,i));switch(Qe(e,"sweep",["+x","-x","+y","-y"])){case"+x":return(t,n,r)=>zt(t,r);case"-x":return(t,n,r)=>Xn(t,r);case"+y":return(t,n,r,i)=>zt(n,i);case"-y":return(t,n,r,i)=>Xn(n,i)}}function kK([e,t],[n,r],i,o){let s=n-e,a=r-t,c=Math.hypot(s,a),l=o*Math.sqrt(i*i-c*c/4)/c;return[(e+n)/2-a*l,(t+r)/2+s*l]}function L$([e,t,n],[r,i,o],s){let a=r-e,c=i-t,l=Math.hypot(a,c),u=(a*a+c*c-o*o+n*n)/(2*l),f=s*Math.sqrt(n*n-u*u);return[e+(a*u+c*f)/l,t+(c*u-a*f)/l]}function C$(e,{x:t,x1:n,x2:r,y:i,y1:o,y2:s,...a}={}){return[n,r]=sy(t,n,r),[o,s]=sy(i,o,s),new ay(e,{...a,x1:n,x2:r,y1:o,y2:s})}var nd=class extends vt{constructor(t,n,r={},i){super(t,n,r,i);let{inset:o=0,insetTop:s=o,insetRight:a=o,insetBottom:c=o,insetLeft:l=o,rx:u,ry:f}=r;this.insetTop=Nt(s),this.insetRight=Nt(a),this.insetBottom=Nt(c),this.insetLeft=Nt(l),this.rx=le(u,"auto"),this.ry=le(f,"auto")}render(t,n,r,i,o){let{rx:s,ry:a}=this;return ct("svg:g",o).call(Ct,this,i,o).call(this._transform,this,n).call(c=>c.selectAll().data(t).enter().append("rect").call(Dt,this).attr("x",this._x(n,r,i)).attr("width",this._width(n,r,i)).attr("y",this._y(n,r,i)).attr("height",this._height(n,r,i)).call(ft,"rx",s).call(ft,"ry",a).call(Jt,this,r)).node()}_x(t,{x:n},{marginLeft:r}){let{insetLeft:i}=this;return n?o=>n[o]+i:r+i}_y(t,{y:n},{marginTop:r}){let{insetTop:i}=this;return n?o=>n[o]+i:r+i}_width({x:t},{x:n},{marginRight:r,marginLeft:i,width:o}){let{insetLeft:s,insetRight:a}=this,c=n&&t?t.bandwidth():o-r-i;return Math.max(0,c-s-a)}_height({y:t},{y:n},{marginTop:r,marginBottom:i,height:o}){let{insetTop:s,insetBottom:a}=this,c=n&&t?t.bandwidth():o-r-i;return Math.max(0,c-s-a)}},k$={ariaLabel:"bar"},cy=class extends nd{constructor(t,n={}){let{x1:r,x2:i,y:o}=n;super(t,{x1:{value:r,scale:"x"},x2:{value:i,scale:"x"},y:{value:o,scale:"y",type:"band",optional:!0}},n,k$)}_transform(t,n,{x:r}){t.call(It,n,{x:r},0,0)}_x({x:t},{x1:n,x2:r},{marginLeft:i}){let{insetLeft:o}=this;return sr(t)?i+o:s=>Math.min(n[s],r[s])+o}_width({x:t},{x1:n,x2:r},{marginRight:i,marginLeft:o,width:s}){let{insetLeft:a,insetRight:c}=this;return sr(t)?s-i-o-a-c:l=>Math.max(0,Math.abs(r[l]-n[l])-a-c)}},ly=class extends nd{constructor(t,n={}){let{x:r,y1:i,y2:o}=n;super(t,{y1:{value:i,scale:"y"},y2:{value:o,scale:"y"},x:{value:r,scale:"x",type:"band",optional:!0}},n,k$)}_transform(t,n,{y:r}){t.call(It,n,{y:r},0,0)}_y({y:t},{y1:n,y2:r},{marginTop:i}){let{insetTop:o}=this;return sr(t)?i+o:s=>Math.min(n[s],r[s])+o}_height({y:t},{y1:n,y2:r},{marginTop:i,marginBottom:o,height:s}){let{insetTop:a,insetBottom:c}=this;return sr(t)?s-i-o-a-c:l=>Math.max(0,Math.abs(r[l]-n[l])-a-c)}};function qo(e,t={}){return If(t)||(t={...t,y:Ae,x2:G}),new cy(e,Qf(Fw(Zf(t))))}function jo(e,t={}){return If(t)||(t={...t,x:Ae,y2:G}),new ly(e,Kf(Rw(Jf(t))))}var FK={ariaLabel:"cell"},$l=class extends nd{constructor(t,{x:n,y:r,...i}={}){super(t,{x:{value:n,scale:"x",type:"band",optional:!0},y:{value:r,scale:"y",type:"band",optional:!0}},i,FK)}_transform(t,n){t.call(It,n,{},0,0)}};function fc(e,{x:t,y:n,...r}={}){return[t,n]=Re(t,n),new $l(e,{...r,x:t,y:n})}function F$(e,{x:t=Ae,fill:n,stroke:r,...i}={}){return n===void 0&&De(r)[0]===void 0&&(n=G),new $l(e,{...i,x:t,fill:n,stroke:r})}function R$(e,{y:t=Ae,fill:n,stroke:r,...i}={}){return n===void 0&&De(r)[0]===void 0&&(n=G),new $l(e,{...i,y:t,fill:n,stroke:r})}var RK={ariaLabel:"dot",fill:"none",stroke:"currentColor",strokeWidth:1.5};function uy(e){return e.sort===void 0&&e.reverse===void 0?fw({channel:"-r"},e):e}var Pl=class extends vt{constructor(t,n={}){let{x:r,y:i,r:o,rotate:s,symbol:a=Ys,frameAnchor:c}=n,[l,u]=ie(s,0),[f,d]=XF(a),[h,p]=ie(o,f==null?3:4.5);super(t,{x:{value:r,scale:"x",optional:!0},y:{value:i,scale:"y",optional:!0},r:{value:h,scale:"r",filter:rr,optional:!0},rotate:{value:l,optional:!0},symbol:{value:f,scale:"auto",optional:!0}},uy(n),RK),this.r=p,this.rotate=u,this.symbol=d,this.frameAnchor=Fo(c);let{channels:m}=this,{symbol:g}=m;if(g){let{fill:y,stroke:x}=m;g.hint={fill:y?y.value===g.value?"color":"currentColor":this.fill??"currentColor",stroke:x?x.value===g.value?"color":"currentColor":this.stroke??"none"}}}render(t,n,r,i,o){let{x:s,y:a}=n,{x:c,y:l,r:u,rotate:f,symbol:d}=r,{r:h,rotate:p,symbol:m}=this,[g,y]=pn(this,i),x=m===Ys,b=u?void 0:h*h*Math.PI;return Xa(h)&&(t=[]),ct("svg:g",o).call(Ct,this,i,o).call(It,this,{x:c&&s,y:l&&a}).call(w=>w.selectAll().data(t).enter().append(x?"circle":"path").call(Dt,this).call(x?_=>{_.attr("cx",c?v=>c[v]:g).attr("cy",l?v=>l[v]:y).attr("r",u?v=>u[v]:h)}:_=>{_.attr("transform",ac`translate(${c?v=>c[v]:g},${l?v=>l[v]:y})${f?v=>` rotate(${f[v]})`:p?` rotate(${p})`:""}`).attr("d",u&&d?v=>{let M=Qn();return d[v].draw(M,u[v]*u[v]*Math.PI),M}:u?v=>{let M=Qn();return m.draw(M,u[v]*u[v]*Math.PI),M}:d?v=>{let M=Qn();return d[v].draw(M,b),M}:(()=>{let v=Qn();return m.draw(v,b),v})())}).call(Jt,this,r)).node()}};function yi(e,{x:t,y:n,...r}={}){return r.frameAnchor===void 0&&([t,n]=Re(t,n)),new Pl(e,{...r,x:t,y:n})}function $$(e,{x:t=G,...n}={}){return new Pl(e,Pw({...n,x:t}))}function P$(e,{y:t=G,...n}={}){return new Pl(e,$w({...n,y:t}))}function U$(e,t){return yi(e,{...t,symbol:"circle"})}function z$(e,t){return yi(e,{...t,symbol:"hexagon"})}var $K={ariaLabel:"line",fill:"none",stroke:"currentColor",strokeWidth:1.5,strokeLinecap:"round",strokeLinejoin:"round",strokeMiterlimit:1},Ul=class extends vt{constructor(t,n={}){let{x:r,y:i,z:o,curve:s,tension:a}=n;super(t,{x:{value:r,scale:"x"},y:{value:i,scale:"y"},z:{value:Un(n),optional:!0}},n,$K),this.z=o,this.curve=ov(s,a),Xi(this,n)}filter(t){return t}project(t,n,r){this.curve!==lc&&super.project(t,n,r)}render(t,n,r,i,o){let{x:s,y:a}=r,{curve:c}=this;return ct("svg:g",o).call(Ct,this,i,o).call(It,this,n).call(l=>l.selectAll().data(vw(t,[s,a],this,r)).enter().append("path").call(Dt,this).call(Nl,this,r).call(x7,this,r,o).attr("d",c===lc&&o.projection?PK(o.projection,s,a):ym().curve(c).defined(u=>u>=0).x(u=>s[u]).y(u=>a[u]))).node()}};function PK(e,t,n){let r=Mn(e);return t=Je(t),n=Je(n),i=>{let o=[],s=[o];for(let a of i)a===-1?(o=[],s.push(o)):o.push([t[a],n[a]]);return r({type:"MultiLineString",coordinates:s})}}function zl(e,{x:t,y:n,...r}={}){return[t,n]=Re(t,n),new Ul(e,{...r,x:t,y:n})}function dc(e,{x:t=G,y:n=Ae,...r}={}){return new Ul(e,Hf({...r,x:t,y:n}))}function hc(e,{x:t=Ae,y:n=G,...r}={}){return new Ul(e,Wf({...r,x:t,y:n}))}var UK={ariaLabel:"rect"},ql=class extends vt{constructor(t,n={}){let{x1:r,y1:i,x2:o,y2:s,inset:a=0,insetTop:c=a,insetRight:l=a,insetBottom:u=a,insetLeft:f=a,rx:d,ry:h}=n;super(t,{x1:{value:r,scale:"x",type:r!=null&&o==null?"band":void 0,optional:!0},y1:{value:i,scale:"y",type:i!=null&&s==null?"band":void 0,optional:!0},x2:{value:o,scale:"x",optional:!0},y2:{value:s,scale:"y",optional:!0}},n,UK),this.insetTop=Nt(c),this.insetRight=Nt(l),this.insetBottom=Nt(u),this.insetLeft=Nt(f),this.rx=le(d,"auto"),this.ry=le(h,"auto")}render(t,n,r,i,o){let{x:s,y:a}=n,{x1:c,y1:l,x2:u,y2:f}=r,{marginTop:d,marginRight:h,marginBottom:p,marginLeft:m,width:g,height:y}=i,{projection:x}=o,{insetTop:b,insetRight:w,insetBottom:_,insetLeft:v,rx:M,ry:E}=this,D=(s?.bandwidth?s.bandwidth():0)-v-w,I=(a?.bandwidth?a.bandwidth():0)-b-_;return ct("svg:g",o).call(Ct,this,i,o).call(It,this,{},0,0).call(T=>T.selectAll().data(t).enter().append("rect").call(Dt,this).attr("x",c&&(x||!sr(s))?u?O=>Math.min(c[O],u[O])+v:O=>c[O]+v:m+v).attr("y",l&&(x||!sr(a))?f?O=>Math.min(l[O],f[O])+b:O=>l[O]+b:d+b).attr("width",c&&(x||!sr(s))?u?O=>Math.max(0,Math.abs(u[O]-c[O])+D):D:g-h-m-w-v).attr("height",l&&(x||!sr(a))?f?O=>Math.max(0,Math.abs(l[O]-f[O])+I):I:y-d-p-b-_).call(ft,"rx",M).call(ft,"ry",E).call(Jt,this,r)).node()}};function fy(e,t){return new ql(e,BT(LT(t)))}function rd(e,t={}){return If(t)||(t={...t,y:Ae,x2:G,interval:1}),new ql(e,Qf(LT(Zf(t))))}function id(e,t={}){return If(t)||(t={...t,x:Ae,y2:G,interval:1}),new ql(e,Kf(BT(Jf(t))))}function KT(e,t){t=zK(t);let{x:n,y:r,color:i,size:o}=t,s=lv(e,n),a=lv(e,r),c=lv(e,i),l=lv(e,o),{fx:u,fy:f,x:{value:d,reduce:h,zero:p,...m},y:{value:g,reduce:y,zero:x,...b},color:{value:w,color:_,reduce:v},size:{value:M,reduce:E},mark:D}=t;if(h===void 0&&(h=y==null&&d==null&&M==null&&g!=null?"count":null),y===void 0&&(y=h==null&&g==null&&M==null&&d!=null?"count":null),E===void 0&&M==null&&v==null&&h==null&&y==null&&(d==null||Te(s))&&(g==null||Te(a))&&(E="count"),p===void 0&&(p=uv(h)?!0:void 0),x===void 0&&(x=uv(y)?!0:void 0),d==null&&g==null)throw new Error("must specify x or y");if(h!=null&&g==null)throw new Error("reducing x requires y");if(y!=null&&d==null)throw new Error("reducing y requires x");D===void 0&&(D=M!=null||E!=null?"dot":uv(h)||uv(y)||v!=null?"bar":d!=null&&g!=null?Te(s)||Te(a)||h==null&&y==null&&!dy(s)&&!dy(a)?"dot":"line":d!=null||g!=null?"rule":null);let I,T,O;switch(D){case"dot":O=yi,T="stroke";break;case"line":O=s&&a||h!=null||y!=null?x||y!=null||s&&dy(s)?hc:p||h!=null||a&&dy(a)?dc:zl:s?dc:hc,T="stroke",j$(c)&&(I=null);break;case"area":O=!(x||y!=null)&&(p||h!=null||a&&dy(a))?uc:oa,T="fill",j$(c)&&(I=null);break;case"rule":O=s?Vr:Yr,T="stroke";break;case"bar":O=h!=null?Te(a)?q$(h)&&s&&Te(s)?fc:qo:rd:y!=null?Te(s)?q$(y)&&a&&Te(a)?fc:jo:id:v!=null||E!=null?s&&Te(s)&&a&&Te(a)?fc:s&&Te(s)?jo:a&&Te(a)?qo:fy:s&&Js(s)&&!(a&&Js(a))?qo:a&&Js(a)&&!(s&&Js(s))?jo:fc,T="fill";break;default:throw new Error(`invalid mark: ${D}`)}let L={fx:u,fy:f,x:s??void 0,y:a??void 0,[T]:c??_,z:I,r:l??void 0,tip:!0},S,A={[T]:v??void 0,r:E??void 0};if(h!=null&&y!=null)throw new Error("cannot reduce both x and y");return y!=null?(A.y=y,S=Te(s)?nc:Uo):h!=null?(A.x=h,S=Te(a)?rc:zo):(v!=null||E!=null)&&(s&&a?S=Te(s)&&Te(a)?Um:Te(s)?zo:Te(a)?Uo:ia:s?S=Te(s)?nc:Uo:a&&(S=Te(a)?rc:zo)),(S===ia||S===Uo)&&(L.x={value:s,...m}),(S===ia||S===zo)&&(L.y={value:a,...b}),p===void 0&&(p=s&&!(S===ia||S===Uo)&&(O===qo||O===uc||O===rd||O===Yr)),x===void 0&&(x=a&&!(S===ia||S===zo)&&(O===jo||O===oa||O===id||O===Vr)),{fx:u??null,fy:f??null,x:{value:d??null,reduce:h??null,zero:!!p,...m},y:{value:g??null,reduce:y??null,zero:!!x,...b},color:{value:w??null,reduce:v??null,..._!==void 0&&{color:_}},size:{value:M??null,reduce:E??null},mark:D,markImpl:V$[O],markOptions:L,transformImpl:V$[S],transformOptions:A,colorMode:T}}function Y$(e,t){let n=KT(e,t),{fx:r,fy:i,x:{zero:o},y:{zero:s},markOptions:a,transformOptions:c,colorMode:l}=n,u=QT[n.markImpl],f=QT[n.transformImpl],d=r!=null||i!=null?Gf({strokeOpacity:.1}):null,h=[o?Vr([0]):null,s?Yr([0]):null],p=u(e,f?f(c,a):a);return l==="stroke"?Ke(d,h,p):Ke(d,p,h)}function dy(e){let t,n;for(let r of e){if(r==null)continue;if(t===void 0){t=r;continue}let i=Math.sign(zt(t,r));if(i){if(n!==void 0&&i!==n)return!1;t=r,n=i}}return!0}function zK({x:e,y:t,color:n,size:r,fx:i,fy:o,mark:s}={}){return qr(e)||(e=od(e)),qr(t)||(t=od(t)),qr(n)||(n=tc(n)?{color:n}:od(n)),qr(r)||(r=od(r)),qr(i)&&({value:i}=od(i)),qr(o)&&({value:o}=od(o)),s!=null&&(s=`${s}`.toLowerCase()),{x:e,y:t,color:n,size:r,fx:i,fy:o,mark:s}}function lv(e,t){let n=pt(e,t.value);return n&&(n.label=En(t.value)),n}function od(e){return qK(e)?{reduce:e}:{value:e}}function uv(e){return/^(?:distinct|count|sum|proportion)$/i.test(e)}function q$(e){return/^(?:first|last|mode)$/i.test(e)}function qK(e){if(e==null)return!1;if(typeof e.reduceIndex=="function"||typeof e.reduce=="function"&&fn(e)||/^p\d{2}$/i.test(e))return!0;switch(`${e}`.toLowerCase()){case"first":case"last":case"count":case"distinct":case"sum":case"proportion":case"proportion-facet":case"deviation":case"min":case"min-index":case"max":case"max-index":case"mean":case"median":case"variance":case"mode":return!0}return!1}function j$(e){return e?new Wn(e).size>e.length>>1:!1}var QT={dot:yi,line:zl,lineX:dc,lineY:hc,areaX:uc,areaY:oa,ruleX:Vr,ruleY:Yr,barX:qo,barY:jo,rect:fy,rectX:rd,rectY:id,cell:fc,bin:ia,binX:Uo,binY:zo,group:Um,groupX:nc,groupY:rc},V$=Object.fromEntries(Object.entries(QT).map(([e,t])=>[t,e]));function sd(e,t={}){let{x:n,x1:r,x2:i}=t;n===void 0&&r===void 0&&i===void 0&&(t={...t,x:n=G});let o={};return n!=null&&(o.x=e),r!=null&&(o.x1=e),i!=null&&(o.x2=e),br(o,t)}function ad(e,t={}){let{y:n,y1:r,y2:i}=t;n===void 0&&r===void 0&&i===void 0&&(t={...t,y:n=G});let o={};return n!=null&&(o.y=e),r!=null&&(o.y1=e),i!=null&&(o.y2=e),br(o,t)}function br(e={},t={}){let n=Un(t),r=Object.entries(e).map(([i,o])=>{let s=sw(i,t);if(s==null)throw new Error(`missing channel: ${i}`);let[a,c]=dn(s);return{key:i,input:s,output:a,setOutput:c,map:jK(o)}});return{...hn(t,(i,o)=>{let s=pt(i,n),a=r.map(({input:l})=>pt(i,l)),c=r.map(({setOutput:l})=>l(new Array(i.length)));for(let l of o)for(let u of s?on(l,f=>s[f]).values():[l])r.forEach(({map:f},d)=>f.mapIndex(u,a[d],c[d]));return{data:i,facets:o}}),...Object.fromEntries(r.map(({key:i,output:o})=>[i,o]))}}function jK(e){if(e==null)throw new Error("missing map");if(typeof e.mapIndex=="function")return e;if(typeof e.map=="function"&&fn(e))return VK(e);if(typeof e=="function")return t3(Mf(e));switch(`${e}`.toLowerCase()){case"cumsum":return XK;case"rank":return t3((t,n)=>rp(t,r=>n[r]));case"quantile":return t3((t,n)=>YK(t,r=>n[r]))}throw new Error(`invalid map: ${e}`)}function VK(e){return console.warn("deprecated map interface; implement mapIndex instead."),{mapIndex:e.map.bind(e)}}function YK(e,t){let n=fo(e,t)-1;return rp(e,t).map(r=>r/n)}function t3(e){return{mapIndex(t,n,r){let i=e(t,n);if(i.length!==t.length)throw new Error("map function returned a mismatched length");for(let o=0,s=t.length;o<s;++o)r[t[o]]=i[o]}}}var XK={mapIndex(e,t,n){let r=0;for(let i of e)n[i]=r+=t[i]}};function X$(e={},t){return arguments.length===1&&(t=e),sd(cd(e),t)}function G$(e={},t){return arguments.length===1&&(t=e),ad(cd(e),t)}function cd(e={}){typeof e=="number"&&(e={k:e});let{k:t,reduce:n,shift:r,anchor:i,strict:o}=e;if(i===void 0&&r!==void 0&&(i=WK(r),zn(`Warning: the shift option is deprecated; please use anchor "${i}" instead.`)),!((t=Math.floor(t))>0))throw new Error(`invalid k: ${t}`);return HK(n)(t,GK(i,t),o)}function GK(e="middle",t){switch(`${e}`.toLowerCase()){case"middle":return t-1>>1;case"start":return 0;case"end":return t-1}throw new Error(`invalid anchor: ${e}`)}function WK(e){switch(`${e}`.toLowerCase()){case"centered":return"middle";case"leading":return"start";case"trailing":return"end"}throw new Error(`invalid shift: ${e}`)}function HK(e="mean"){if(typeof e=="string"){if(/^p\d{2}$/i.test(e))return fv(Sf(e));switch(e.toLowerCase()){case"deviation":return fv(ri);case"max":return dv((t,n)=>Gt(t,r=>n[r]));case"mean":return ZK;case"median":return fv(Pi);case"min":return dv((t,n)=>ce(t,r=>n[r]));case"mode":return dv((t,n)=>Ou(t,r=>n[r]));case"sum":return W$;case"variance":return fv(Da);case"difference":return KK;case"ratio":return ttt;case"first":return ett;case"last":return ntt}}if(typeof e!="function")throw new Error(`invalid reduce: ${e}`);return dv(Mf(e))}function fv(e){return(t,n,r)=>r?{mapIndex(i,o,s){let a=l=>o[l]==null?NaN:+o[l],c=0;for(let l=0;l<t-1;++l)isNaN(a(l))&&++c;for(let l=0,u=i.length-t+1;l<u;++l)isNaN(a(l+t-1))&&++c,s[i[l+n]]=c===0?e(Hs(i,l,l+t),a):NaN,isNaN(a(l))&&--c}}:{mapIndex(i,o,s){let a=c=>o[c]==null?NaN:+o[c];for(let c=-n;c<0;++c)s[i[c+n]]=e(Hs(i,0,c+t),a);for(let c=0,l=i.length-n;c<l;++c)s[i[c+n]]=e(Hs(i,c,c+t),a)}}}function dv(e){return(t,n,r)=>r?{mapIndex(i,o,s){let a=0;for(let c=0;c<t-1;++c)a+=Ue(o[i[c]]);for(let c=0,l=i.length-t+1;c<l;++c)a+=Ue(o[i[c+t-1]]),a===t&&(s[i[c+n]]=e(Hs(i,c,c+t),o)),a-=Ue(o[i[c]])}}:{mapIndex(i,o,s){for(let a=-n;a<0;++a)s[i[a+n]]=e(Hs(i,0,a+t),o);for(let a=0,c=i.length-n;a<c;++a)s[i[a+n]]=e(Hs(i,a,a+t),o)}}}function W$(e,t,n){return n?{mapIndex(r,i,o){let s=0,a=0;for(let c=0;c<e-1;++c){let l=i[r[c]];l===null||isNaN(l)?++s:a+=+l}for(let c=0,l=r.length-e+1;c<l;++c){let u=i[r[c]],f=i[r[c+e-1]];f===null||isNaN(f)?++s:a+=+f,o[r[c+t]]=s===0?a:NaN,u===null||isNaN(u)?--s:a-=+u}}}:{mapIndex(r,i,o){let s=0,a=r.length;for(let c=0,l=Math.min(a,e-t-1);c<l;++c)s+=+i[r[c]]||0;for(let c=-t,l=a-t;c<l;++c)s+=+i[r[c+e-1]]||0,o[r[c+t]]=s,s-=+i[r[c]]||0}}}function ZK(e,t,n){if(n){let r=W$(e,t,n);return{mapIndex(i,o,s){r.mapIndex(i,o,s);for(let a=0,c=i.length-e+1;a<c;++a)s[i[a+t]]/=e}}}else return{mapIndex(r,i,o){let s=0,a=0,c=r.length;for(let l=0,u=Math.min(c,e-t-1);l<u;++l){let f=i[r[l]];f!==null&&!isNaN(f=+f)&&(s+=f,++a)}for(let l=-t,u=c-t;l<u;++l){let f=i[r[l+e-1]],d=i[r[l]];f!==null&&!isNaN(f=+f)&&(s+=f,++a),o[r[l+t]]=s/a,d!==null&&!isNaN(d=+d)&&(s-=d,--a)}}}}function JK(e,t,n,r){for(let i=n+r;n<i;++n){let o=e[t[n]];if(Ue(o))return o}}function QK(e,t,n,r){for(let i=n+r-1;i>=n;--i){let o=e[t[i]];if(Ue(o))return o}}function H$(e,t,n,r){for(let i=n+r;n<i;++n){let o=e[t[n]];if(o!==null&&!isNaN(o=+o))return o}}function Z$(e,t,n,r){for(let i=n+r-1;i>=n;--i){let o=e[t[i]];if(o!==null&&!isNaN(o=+o))return o}}function KK(e,t,n){return n?{mapIndex(r,i,o){for(let s=0,a=r.length-e;s<a;++s){let c=i[r[s]],l=i[r[s+e-1]];o[r[s+t]]=c===null||l===null?NaN:l-c}}}:{mapIndex(r,i,o){for(let s=-t,a=r.length-e+t+1;s<a;++s)o[r[s+t]]=Z$(i,r,s,e)-H$(i,r,s,e)}}}function ttt(e,t,n){return n?{mapIndex(r,i,o){for(let s=0,a=r.length-e;s<a;++s){let c=i[r[s]],l=i[r[s+e-1]];o[r[s+t]]=c===null||l===null?NaN:l/c}}}:{mapIndex(r,i,o){for(let s=-t,a=r.length-e+t+1;s<a;++s)o[r[s+t]]=Z$(i,r,s,e)/H$(i,r,s,e)}}}function ett(e,t,n){return n?{mapIndex(r,i,o){for(let s=0,a=r.length-e;s<a;++s)o[r[s+t]]=i[r[s]]}}:{mapIndex(r,i,o){for(let s=-t,a=r.length-e+t+1;s<a;++s)o[r[s+t]]=JK(i,r,s,e)}}}function ntt(e,t,n){return n?{mapIndex(r,i,o){for(let s=0,a=r.length-e;s<a;++s)o[r[s+t]]=i[r[s+e-1]]}}:{mapIndex(r,i,o){for(let s=-t,a=r.length-e+t+1;s<a;++s)o[r[s+t]]=QK(i,r,s,e)}}}var sa={n:20,k:2,color:"currentColor",opacity:.2,strict:!0,anchor:"end"};function J$(e,{x:t=G,y:n,k:r=sa.k,color:i=sa.color,opacity:o=sa.opacity,fill:s=i,fillOpacity:a=o,stroke:c=i,strokeOpacity:l,strokeWidth:u,...f}={}){return Ke(ne(s)?null:uc(e,br({x1:pc({k:-r,...f}),x2:pc({k:r,...f})},{x1:t,x2:t,y:n,fill:s,fillOpacity:a,...f})),ne(c)?null:dc(e,br({x:pc(f)},{x:t,y:n,stroke:c,strokeOpacity:l,strokeWidth:u,...f})))}function Q$(e,{x:t,y:n=G,k:r=sa.k,color:i=sa.color,opacity:o=sa.opacity,fill:s=i,fillOpacity:a=o,stroke:c=i,strokeOpacity:l,strokeWidth:u,...f}={}){return Ke(ne(s)?null:oa(e,br({y1:pc({k:-r,...f}),y2:pc({k:r,...f})},{x:t,y1:n,y2:n,fill:s,fillOpacity:a,...f})),ne(c)?null:hc(e,br({y:pc(f)},{x:t,y:n,stroke:c,strokeOpacity:l,strokeWidth:u,...f})))}function pc({n:e=sa.n,k:t=0,strict:n=sa.strict,anchor:r=sa.anchor}={}){return cd({k:e,reduce:i=>Ts(i)+t*(ri(i)||0),strict:n,anchor:r})}var rtt={ariaLabel:"tick",fill:null,stroke:"currentColor"},hv=class extends vt{constructor(t,n,r){super(t,n,r,rtt),Xi(this,r)}render(t,n,r,i,o){return ct("svg:g",o).call(Ct,this,i,o).call(this._transform,this,n).call(s=>s.selectAll().data(t).enter().append("line").call(Dt,this).attr("x1",this._x1(n,r,i)).attr("x2",this._x2(n,r,i)).attr("y1",this._y1(n,r,i)).attr("y2",this._y2(n,r,i)).call(Jt,this,r).call(ra,this,r,o)).node()}},hy=class extends hv{constructor(t,n={}){let{x:r,y:i,inset:o=0,insetTop:s=o,insetBottom:a=o}=n;super(t,{x:{value:r,scale:"x"},y:{value:i,scale:"y",type:"band",optional:!0}},n),this.insetTop=Nt(s),this.insetBottom=Nt(a)}_transform(t,n,{x:r}){t.call(It,n,{x:r},Be,0)}_x1(t,{x:n}){return r=>n[r]}_x2(t,{x:n}){return r=>n[r]}_y1({y:t},{y:n},{marginTop:r}){let{insetTop:i}=this;return n&&t?o=>n[o]+i:r+i}_y2({y:t},{y:n},{height:r,marginBottom:i}){let{insetBottom:o}=this;return n&&t?s=>n[s]+t.bandwidth()-o:r-i-o}},py=class extends hv{constructor(t,n={}){let{x:r,y:i,inset:o=0,insetRight:s=o,insetLeft:a=o}=n;super(t,{y:{value:i,scale:"y"},x:{value:r,scale:"x",type:"band",optional:!0}},n),this.insetRight=Nt(s),this.insetLeft=Nt(a)}_transform(t,n,{y:r}){t.call(It,n,{y:r},0,Be)}_x1({x:t},{x:n},{marginLeft:r}){let{insetLeft:i}=this;return n&&t?o=>n[o]+i:r+i}_x2({x:t},{x:n},{width:r,marginRight:i}){let{insetRight:o}=this;return n&&t?s=>n[s]+t.bandwidth()-o:r-i-o}_y1(t,{y:n}){return r=>n[r]}_y2(t,{y:n}){return r=>n[r]}};function pv(e,{x:t=G,...n}={}){return new hy(e,{...n,x:t})}function mv(e,{y:t=G,...n}={}){return new py(e,{...n,y:t})}function K$(e,{x:t=G,y:n=null,fill:r="#ccc",fillOpacity:i,stroke:o="currentColor",strokeOpacity:s,strokeWidth:a=2,sort:c,...l}={}){let u=n!=null?rc:Pm;return Ke(Yr(e,u({x1:e3,x2:n3},{x:t,y:n,stroke:o,strokeOpacity:s,...l})),qo(e,u({x1:"p25",x2:"p75"},{x:t,y:n,fill:r,fillOpacity:i,...l})),pv(e,u({x:"p50"},{x:t,y:n,stroke:o,strokeOpacity:s,strokeWidth:a,sort:c,...l})),yi(e,br({x:e9},{x:t,y:n,z:n,stroke:o,strokeOpacity:s,...l})))}function t9(e,{y:t=G,x:n=null,fill:r="#ccc",fillOpacity:i,stroke:o="currentColor",strokeOpacity:s,strokeWidth:a=2,sort:c,...l}={}){let u=n!=null?nc:Pm;return Ke(Vr(e,u({y1:e3,y2:n3},{x:n,y:t,stroke:o,strokeOpacity:s,...l})),jo(e,u({y1:"p25",y2:"p75"},{x:n,y:t,fill:r,fillOpacity:i,...l})),mv(e,u({y:"p50"},{x:n,y:t,stroke:o,strokeOpacity:s,strokeWidth:a,sort:c,...l})),yi(e,br({y:e9},{x:n,y:t,z:n,stroke:o,strokeOpacity:s,...l})))}function e9(e){let t=e3(e),n=n3(e);return e.map(r=>r<t||r>n?r:NaN)}function e3(e){let t=n9(e)*2.5-r9(e)*1.5;return ce(e,n=>n>=t?n:NaN)}function n3(e){let t=r9(e)*2.5-n9(e)*1.5;return Gt(e,n=>n<=t?n:NaN)}function n9(e){return Hn(e,.25)}function r9(e){return Hn(e,.75)}var itt={ariaLabel:"raster",stroke:null,pixelSize:1};function ld(e,t){let n=+e;if(isNaN(n))throw new Error(`invalid ${t}: ${e}`);return n}function i9(e,t){let n=Math.floor(e);if(isNaN(n))throw new Error(`invalid ${t}: ${e}`);return n}var yy=class extends vt{constructor(t,n,r={},i){let{width:o,height:s,x:a,y:c,x1:l=a==null?0:void 0,y1:u=c==null?0:void 0,x2:f=a==null?o:void 0,y2:d=c==null?s:void 0,pixelSize:h=i.pixelSize,blur:p=0,interpolate:m}=r;if(o!=null&&(o=i9(o,"width")),s!=null&&(s=i9(s,"height")),l!=null&&(l=ld(l,"x1")),u!=null&&(u=ld(u,"y1")),f!=null&&(f=ld(f,"x2")),d!=null&&(d=ld(d,"y2")),a==null&&(l==null||f==null))throw new Error("missing x");if(c==null&&(u==null||d==null))throw new Error("missing y");t!=null&&o!=null&&s!=null&&(a===void 0&&l!=null&&f!=null&&(a=dtt(l,f,o,s)),c===void 0&&u!=null&&d!=null&&(c=htt(u,d,o,s))),super(t,{x:{value:a,scale:"x",optional:!0},y:{value:c,scale:"y",optional:!0},x1:{value:l==null?null:[l],scale:"x",optional:!0,filter:null},y1:{value:u==null?null:[u],scale:"y",optional:!0,filter:null},x2:{value:f==null?null:[f],scale:"x",optional:!0,filter:null},y2:{value:d==null?null:[d],scale:"y",optional:!0,filter:null},...n},r,i),this.width=o,this.height=s,this.pixelSize=ld(h,"pixelSize"),this.blur=ld(p,"blur"),this.interpolate=a==null||c==null?null:ott(m)}},gy=class extends yy{constructor(t,n={}){let{imageRendering:r}=n;if(t==null){let{fill:i,fillOpacity:o}=n;ie(o)[0]!==void 0&&(n=yv("fillOpacity",n)),De(i)[0]!==void 0&&(n=yv("fill",n))}super(t,void 0,n,itt),this.imageRendering=le(r,"auto")}scale(t,{color:n,...r},i){return super.scale(t,r,i)}render(t,n,r,i,o){let s=n[r.channels.fill?.scale]??(A=>A),{x:a,y:c}=r,{document:l}=o,[u,f,d,h]=s9(r,i,o),p=d-u,m=h-f,{pixelSize:g,width:y=Math.round(Math.abs(p)/g),height:x=Math.round(Math.abs(m)/g)}=this,b=y*x,{fill:w,fillOpacity:_}=r,v=0;if(this.interpolate){let A=y/p,N=x/m,k=Xt(a,F=>(F-u)*A,Float64Array),R=Xt(c,F=>(F-f)*N,Float64Array);w&&(w=this.interpolate(t,y,x,k,R,w)),_&&(_=this.interpolate(t,y,x,k,R,_))}else this.data==null&&t&&(v=t.fi*b);let M=l.createElement("canvas");M.width=y,M.height=x;let E=M.getContext("2d"),D=E.createImageData(y,x),I=D.data,{r:T,g:O,b:L}=nn(this.fill)??{r:0,g:0,b:0},S=(this.fillOpacity??1)*255;for(let A=0;A<b;++A){let N=A<<2;if(w){let k=s(w[A+v]);if(k==null){I[N+3]=0;continue}({r:T,g:O,b:L}=nn(k))}_&&(S=_[A+v]*255),I[N+0]=T,I[N+1]=O,I[N+2]=L,I[N+3]=S}return this.blur>0&&CS(D,this.blur),E.putImageData(D,0,0),ct("svg:g",o).call(Ct,this,i,o).call(It,this,n).call(A=>A.append("image").attr("transform",`translate(${u},${f}) scale(${Math.sign(d-u)},${Math.sign(h-f)})`).attr("width",Math.abs(p)).attr("height",Math.abs(m)).attr("preserveAspectRatio","none").call(ft,"image-rendering",this.imageRendering).call(Dt,this).attr("xlink:href",M.toDataURL())).node()}};function r3(e,t,n){arguments.length<3&&(n=t,t=null);let{x:r,y:i,[e]:o,...s}=n;return r===void 0&&i===void 0&&FF(t)&&(r=Ws,i=Ja,o===void 0&&(o=OF)),[t,{...s,x:r,y:i,[e]:o}]}function o9(){let[e,t]=r3("fill",...arguments);return new gy(e,e==null||t.fill!==void 0||t.fillOpacity!==void 0?t:{...t,fill:G})}function s9({x1:e,y1:t,x2:n,y2:r},i,{projection:o}){let{width:s,height:a,marginTop:c,marginRight:l,marginBottom:u,marginLeft:f}=i;return[e&&o==null?e[0]:f,t&&o==null?t[0]:c,n&&o==null?n[0]:s-l,r&&o==null?r[0]:a-u]}function i3({x1:e,y1:t,x2:n,y2:r},i,o,s){let a={};return e&&(a.x1=e),t&&(a.y1=t),n&&(a.x2=n),r&&(a.y2=r),s9(Bf(a,i),o,s)}function yv(e,t={}){let{[e]:n}=t;if(typeof n!="function")throw new Error(`invalid ${e}: not a function`);return _e({...t,[e]:void 0},function(r,i,o,s,a,c){let{x:l,y:u}=s;if(!l)throw new Error("missing scale: x");if(!u)throw new Error("missing scale: y");let[f,d,h,p]=i3(o,s,a,c),m=h-f,g=p-d,{pixelSize:y}=this,{width:x=Math.round(Math.abs(m)/y),height:b=Math.round(Math.abs(g)/y)}=t,w=new Array(x*b*(i?i.length:1)),_=m/x,v=g/b,M=0;for(let E of i??[void 0])for(let D=.5;D<b;++D)for(let I=.5;I<x;++I,++M)w[M]=n(l.invert(f+I*_),u.invert(d+D*v),E);return{data:w,facets:i,channels:{[e]:{value:w,scale:"auto"}}}})}function ott(e){if(typeof e=="function")return e;if(e==null)return gv;switch(`${e}`.toLowerCase()){case"none":return gv;case"nearest":return s3;case"barycentric":return o3();case"random-walk":return a3()}throw new Error(`invalid interpolate: ${e}`)}function gv(e,t,n,r,i,o){let s=new Array(t*n);for(let a of e)r[a]<0||r[a]>=t||i[a]<0||i[a]>=n||(s[Math.floor(i[a])*t+Math.floor(r[a])]=o[a]);return s}function o3({random:e=fl(42)}={}){return(t,n,r,i,o,s)=>{let{points:a,triangles:c,hull:l}=ai.from(t,h=>i[h],h=>o[h]),u=new s.constructor(n*r).fill(NaN),f=new Uint8Array(n*r),d=ftt(s,e);for(let h=0;h<c.length;h+=3){let p=c[h],m=c[h+1],g=c[h+2],y=a[2*p],x=a[2*m],b=a[2*g],w=a[2*p+1],_=a[2*m+1],v=a[2*g+1],M=Math.min(y,x,b),E=Math.max(y,x,b),D=Math.min(w,_,v),I=Math.max(w,_,v),T=(_-v)*(y-b)+(w-v)*(b-x);if(!T)continue;let O=s[t[p]],L=s[t[m]],S=s[t[g]];for(let A=Math.floor(M);A<E;++A)for(let N=Math.floor(D);N<I;++N){if(A<0||A>=n||N<0||N>=r)continue;let k=A+.5,R=N+.5,F=((_-v)*(k-b)+(R-v)*(b-x))/T;if(F<0)continue;let $=((v-w)*(k-b)+(R-v)*(y-b))/T;if($<0)continue;let P=1-F-$;if(P<0)continue;let U=A+n*N;u[U]=d(O,F,L,$,S,P,A,N),f[U]=1}}return stt(u,f,i,o,s,n,r,l,t,d),u}}function stt(e,t,n,r,i,o,s,a,c,l){n=Float64Array.from(a,h=>n[c[h]]),r=Float64Array.from(a,h=>r[c[h]]),i=Array.from(a,h=>i[c[h]]);let u=n.length,f=Array.from({length:u},(h,p)=>ctt(p,n,r)),d=0;for(let h=0;h<s;++h){let p=h+.5;for(let m=0;m<o;++m){let g=m+o*h;if(!t[g]){let y=m+.5;for(let x=0;x<u;++x){let b=(u+d+(x%2?(x+1)/2:-x/2))%u;if(f[b](y,p)){let w=att(n.at(b-1),r.at(b-1),n[b],r[b],y,p);e[g]=l(i.at(b-1),w,i[b],1-w,i[b],0,m,h),d=b;break}}}}}}function att(e,t,n,r,i,o){let s=n-e,a=r-t,c=s*(n-i)+a*(r-o),l=s*(i-e)+a*(o-t);return c>0&&l>0?c/(c+l):+(c>l)}function my(e,t,n,r){return e*r-n*t}function ctt(e,t,n){let r=t.length,i=t.at(e-2),o=n.at(e-2),s=t.at(e-1),a=n.at(e-1),c=t[e],l=n[e],u=t.at(e+1-r),f=n.at(e+1-r),d=s-c,h=a-l,p=i-s,m=o-a,g=c-u,y=l-f,x=Math.hypot(d,h),b=Math.hypot(p,m),w=Math.hypot(g,y);return(_,v)=>{let M=_-s,E=v-a,D=_-c,I=v-l;return my(M,E,D,I)>-1e-6&&my(M,E,d,h)*b-my(M,E,p,m)*x>-1e-6&&my(D,I,g,y)*x-my(D,I,d,h)*w<=0}}function s3(e,t,n,r,i,o){let s=new o.constructor(t*n),a=ai.from(e,u=>r[u],u=>i[u]),c,l;for(let u=.5,f=0;u<n;++u){l=c;for(let d=.5;d<t;++d,++f)l=a.find(d,u,l),d===.5&&(c=l),s[f]=o[e[l]]}return s}function a3({random:e=fl(42),minDistance:t=.5,maxSteps:n=2}={}){return(r,i,o,s,a,c)=>{let l=new c.constructor(i*o),u=ai.from(r,p=>s[p],p=>a[p]),f,d,h;for(let p=.5,m=0;p<o;++p){d=f;for(let g=.5;g<i;++g,++m){let y=g,x=p;h=d=u.find(y,x,d),g===.5&&(f=d);let b,w=0;for(;(b=Math.hypot(s[r[h]]-y,a[r[h]]-x))>t&&w<n;){let _=e(g,p,w)*2*Math.PI;y+=Math.cos(_)*b,x+=Math.sin(_)*b,h=u.find(y,x,h),++w}l[m]=c[r[h]]}}return l}}function ltt(e,t,n,r,i,o){return t*e+r*n+o*i}function utt(e){return(t,n,r,i,o,s,a,c)=>{let l=e(a,c);return l<n?t:l<n+i?r:o}}function ftt(e,t){return Js(e)||Oe(e)?ltt:utt(t)}function dtt(e,t,n){return{transform(r){let i=r.length,o=new Float64Array(i),s=(t-e)/n,a=e+s/2;for(let c=0;c<i;++c)o[c]=c%n*s+a;return o}}}function htt(e,t,n,r){return{transform(i){let o=i.length,s=new Float64Array(o),a=(t-e)/r,c=e+a/2;for(let l=0;l<o;++l)s[l]=Math.floor(l/n)%r*a+c;return s}}}var a9={ariaLabel:"contour",fill:"none",stroke:"currentColor",strokeMiterlimit:1,pixelSize:2},xy=class extends yy{constructor(t,{smooth:n=!0,value:r,...i}={}){let o=ww({},i,a9);if(r===void 0){for(let a in o)if(o[a].value!=null){if(r!==void 0)throw new Error("ambiguous contour value");r=i[a],i[a]="value"}}if(r!=null){let a={transform:c=>c.map(l=>l.value),label:En(r)};for(let c in o)i[c]==="value"&&(i[c]=a)}if(t==null){if(r==null)throw new Error("missing contour value");i=yv("value",{value:r,...i}),r=null}else{let{interpolate:a}=i;r===void 0&&(r=G),a===void 0&&(i.interpolate="nearest")}super(t,{value:{value:r,optional:!0}},ptt(i),a9);let s={geometry:{value:G}};for(let a in this.channels){let c=this.channels[a],{scale:l}=c;l==="x"||l==="y"||a==="value"||(s[a]=c,delete this.channels[a])}this.contourChannels=s,this.smooth=!!n}filter(t,{x:n,y:r,value:i,...o},s){return super.filter(t,o,s)}render(t,n,r,i,o){let{geometry:s}=r,a=Mn();return ct("svg:g",o).call(Ct,this,i,o).call(It,this,n).call(c=>{c.selectAll().data(t).enter().append("path").call(Dt,this).attr("d",l=>a(s[l])).call(Jt,this,r)}).node()}};function ptt({thresholds:e,interval:t,...n}){return e=WT(e,t,Oa),_e(n,function(r,i,o,s,a,c){let[l,u,f,d]=i3(o,s,a,c),h=f-l,p=d-u,{pixelSize:m,width:g=Math.round(Math.abs(h)/m),height:y=Math.round(Math.abs(p)/m)}=this,x=g/h,b=y/p,w=o.value.value,_=[];if(this.interpolate){let{x:I,y:T}=oc(o,s,c),O=Xt(I,N=>(N-l)*x,Float64Array),L=Xt(T,N=>(N-u)*b,Float64Array),S=[o.x,o.y,o.value],A=[O,L,w];for(let N of i){let k=this.filter(N,S,A);_.push(this.interpolate(k,g,y,O,L,w))}}else if(i){let I=g*y,T=i.length;for(let O=0;O<T;++O)_.push(w.slice(O*I,O*I+I))}else _.push(w);if(this.blur>0)for(let I of _)Qh({data:I,width:g,height:y},this.blur);let v=mtt(e,w,...ytt(_));if(v===null)throw new Error(`unsupported thresholds: ${e}`);let{contour:M}=$a().size([g,y]).smooth(this.smooth),E=[],D=[];for(let I of _)D.push(Pe(E.length,E.push(...Xt(v,T=>M(I,T)))));for(let{coordinates:I}of E)for(let T of I)for(let O of T)for(let L of O)L[0]=L[0]/x+l,L[1]=L[1]/b+u;return{data:E,facets:D,channels:gw(this.contourChannels,E)}})}function mtt(e,t,n,r){if(typeof e?.range=="function")return e.range(e.floor(n),r);if(typeof e=="function"&&(e=e(t,n,r)),typeof e!="number")return qe(e);let i=_n(...Nu(n,r,e),e);for(;i[i.length-1]>=r;)i.pop();for(;i[1]<n;)i.shift();return i}function l9(){return new xy(...r3("value",...arguments))}function ytt(e){return[ce(e,t=>ce(t,c9)),Gt(e,t=>Gt(t,c9))]}function c9(e){return isFinite(e)?e:NaN}function d9(e,t){return c3(qf,e,t)}function h9(e,t={}){return c3(jf,e,t)}function p9(e,t={}){return c3(Dl,e,t)}function c3(e,t,n={}){let{x:r,y:i,maxRadius:o}=n,s=e({px:r,py:i,maxRadius:o}),a=[];r!=null&&a.push(Vr(t,u9("x",{...s,inset:-6},n))),i!=null&&a.push(Yr(t,u9("y",{...s,inset:-6},n))),r!=null&&a.push(Po(t,f9("x",{...s,dy:9,frameAnchor:"bottom",lineAnchor:"top"},n))),i!=null&&a.push(Po(t,f9("y",{...s,dx:-9,frameAnchor:"left",textAnchor:"end"},n)));for(let c of a)c.ariaLabel=`crosshair ${c.ariaLabel}`;return Ke(...a)}function m9(e,{channels:t,...n},{facet:r,facetAnchor:i,fx:o,fy:s,[e]:a,channels:c,transform:l,initializer:u}){return{...n,facet:r,facetAnchor:i,fx:o,fy:s,[e]:a,channels:{...t,...c},transform:l,initializer:gtt(e,u)}}function gtt(e,t){return t==null?t:function(n,r,{x:i,y:o,px:s,py:a,...c},...l){let{channels:{x:u,y:f,...d}={},...h}=t.call(this,n,r,{...c,x:s,y:a},...l);return{channels:{...d,...u&&{px:u,...e==="x"&&{x:u}},...f&&{py:f,...e==="y"&&{y:f}}},...h}}}function u9(e,t,n){let{color:r="currentColor",opacity:i=.2,ruleStroke:o=r,ruleStrokeOpacity:s=i,ruleStrokeWidth:a}=n;return{...m9(e,t,n),stroke:o,strokeOpacity:s,strokeWidth:a}}function f9(e,t,n){let{color:r="currentColor",textFill:i=r,textFillOpacity:o,textStroke:s="var(--plot-background)",textStrokeOpacity:a,textStrokeWidth:c=5}=n;return{...m9(e,t,xtt(e,n)),fill:i,fillOpacity:o,stroke:s,strokeOpacity:a,strokeWidth:c}}function xtt(e,t){return _e(t,(n,r,i)=>({channels:{text:{value:qm(i,e)?.value}}}))}var btt={ariaLabel:"delaunay link",fill:"none",stroke:"currentColor",strokeMiterlimit:1},wtt={ariaLabel:"delaunay mesh",fill:null,stroke:"currentColor",strokeOpacity:.2},vtt={ariaLabel:"hull",fill:"none",stroke:"currentColor",strokeWidth:1.5,strokeMiterlimit:1},_tt={ariaLabel:"voronoi",fill:"none",stroke:"currentColor",strokeMiterlimit:1},Stt={ariaLabel:"voronoi mesh",fill:null,stroke:"currentColor",strokeOpacity:.2},l3=class extends vt{constructor(t,n={}){let{x:r,y:i,z:o,curve:s,tension:a}=n;super(t,{x:{value:r,scale:"x",optional:!0},y:{value:i,scale:"y",optional:!0},z:{value:o,optional:!0}},n,btt),this.curve=ry(s,a),Xi(this,n)}render(t,n,r,i,o){let{x:s,y:a}=n,{x:c,y:l,z:u}=r,{curve:f}=this,[d,h]=pn(this,i),p=c?x=>c[x]:un(d),m=l?x=>l[x]:un(h),g=this;function y(x){let b=-1,w=[],_={};for(let S in r)_[S]=[];let v=[],M=[],E=[],D=[];function I(S,A){S=x[S],A=x[A],w.push(++b),v[b]=p(S),E[b]=m(S),M[b]=p(A),D[b]=m(A);for(let N in r)_[N].push(r[N][A])}let{halfedges:T,hull:O,triangles:L}=ai.from(x,p,m);for(let S=0;S<T.length;++S){let A=T[S];A>S&&I(L[S],L[A])}for(let S=0;S<O.length;++S)I(O[S],O[(S+1)%O.length]);jt(this).selectAll().data(w).enter().append("path").call(Dt,g).attr("d",S=>{let A=Qn(),N=f(A);return N.lineStart(),N.point(v[S],E[S]),N.point(M[S],D[S]),N.lineEnd(),A}).call(Jt,g,_).call(ra,g,_,o)}return ct("svg:g",o).call(Ct,this,i,o).call(It,this,{x:c&&s,y:l&&a}).call(u?x=>x.selectAll().data(on(t,b=>u[b]).values()).enter().append("g").each(y):x=>x.datum(t).each(y)).node()}},by=class extends vt{constructor(t,n={},r,i=({z:o})=>o){let{x:o,y:s}=n;super(t,{x:{value:o,scale:"x",optional:!0},y:{value:s,scale:"y",optional:!0},z:{value:i(n),optional:!0}},n,r)}render(t,n,r,i,o){let{x:s,y:a}=n,{x:c,y:l,z:u}=r,[f,d]=pn(this,i),h=c?y=>c[y]:un(f),p=l?y=>l[y]:un(d),m=this;function g(y){let x=ai.from(y,h,p);jt(this).append("path").datum(y[0]).call(Dt,m).attr("d",m._render(x,i)).call(Jt,m,r)}return ct("svg:g",o).call(Ct,this,i,o).call(It,this,{x:c&&s,y:l&&a}).call(u?y=>y.selectAll().data(on(t,x=>u[x]).values()).enter().append("g").each(g):y=>y.datum(t).each(g)).node()}},u3=class extends by{constructor(t,n={}){super(t,n,wtt),this.fill="none"}_render(t){return t.render()}},f3=class extends by{constructor(t,n={}){super(t,n,vtt,Un)}_render(t){return t.renderHull()}},d3=class extends vt{constructor(t,n={}){let{x:r,y:i,z:o}=n;super(t,{x:{value:r,scale:"x",optional:!0},y:{value:i,scale:"y",optional:!0},z:{value:o,optional:!0}},n,_tt)}render(t,n,r,i,o){let{x:s,y:a}=n,{x:c,y:l,z:u}=r,[f,d]=pn(this,i),h=c?y=>c[y]:un(f),p=l?y=>l[y]:un(d),m=this;function g(y){let x=ai.from(y,h,p),b=y9(x,i);jt(this).selectAll().data(y).enter().append("path").call(Dt,m).attr("d",(w,_)=>b.renderCell(_)).call(Jt,m,r)}return ct("svg:g",o).call(Ct,this,i,o).call(It,this,{x:c&&s,y:l&&a}).call(u?y=>y.selectAll().data(on(t,x=>u[x]).values()).enter().append("g").each(g):y=>y.datum(t).each(g)).node()}},h3=class extends by{constructor(t,n){super(t,n,Stt),this.fill="none"}_render(t,n){return y9(t,n).render()}};function y9(e,t){let{width:n,height:r,marginTop:i,marginRight:o,marginBottom:s,marginLeft:a}=t;return e.voronoi([a,i,n-o,r-s])}function wy(e,t,{x:n,y:r,...i}={}){return[n,r]=Re(n,r),new e(t,{...i,x:n,y:r})}function g9(e,t){return wy(l3,e,t)}function x9(e,t){return wy(u3,e,t)}function b9(e,t){return wy(f3,e,t)}function w9(e,t){return wy(d3,e,t)}function v9(e,t){return wy(h3,e,t)}var Itt={ariaLabel:"density",fill:"none",stroke:"currentColor",strokeMiterlimit:1},vy=class extends vt{constructor(t,{x:n,y:r,z:i,weight:o,fill:s,stroke:a,...c}={}){let l=_9(s)&&(s="currentColor",!0),u=_9(a)&&(a="currentColor",!0);super(t,{x:{value:n,scale:"x",optional:!0},y:{value:r,scale:"y",optional:!0},z:{value:Un({z:i,fill:s,stroke:a}),optional:!0},weight:{value:o,optional:!0}},Att({...c,fill:s,stroke:a},l,u),Itt),l&&(this.fill=void 0),u&&(this.stroke=void 0),this.z=i}filter(t){return t}render(t,n,r,i,o){let{contours:s}=r,a=Mn();return ct("svg:g",o).call(Ct,this,i,o).call(It,this,{}).call(c=>c.selectAll().data(t).enter().append("path").call(Dt,this).call(Jt,this,r).attr("d",l=>a(s[l]))).node()}};function S9(e,{x:t,y:n,...r}={}){return[t,n]=Re(t,n),new vy(e,{...r,x:t,y:n})}var Mtt=new Set(["x","y","z","weight"]);function Att(e,t,n){let{bandwidth:i,thresholds:o}=e;return i=i===void 0?20:+i,o=o===void 0?20:typeof o?.[Symbol.iterator]=="function"?Je(o):+o,_e(e,function(s,a,c,l,u,f){let d=c.weight?Je(c.weight.value):null,h=c.z?.value,{z:p}=this,[m,g]=pn(this,u),{width:y,height:x}=u,{x:b,y:w}=oc(c,l,f),_=Object.fromEntries(Object.entries(c).filter(([L])=>!Mtt.has(L)).map(([L,S])=>[L,{...S,value:[]}])),v=t&&[],M=n&&[],E=_I().x(b?L=>b[L]:m).y(w?L=>w[L]:g).weight(d?L=>d[L]:1).size([y,x]).bandwidth(i),D=[];for(let L of a){let S=[];D.push(S);for(let A of h?Vm(L,h,p):[L]){let N=E.contours(A);S.push([A,N])}}let I=o;if(!(I instanceof Il)){let L=0;for(let S of D)for(let[,A]of S){let N=A.max;N>L&&(L=N)}I=Float64Array.from({length:o-1},(S,A)=>L*100*(A+1)/o)}let T=[],O=[];for(let L of D){let S=[];T.push(S);for(let[A,N]of L)for(let k of I){S.push(O.length),O.push(N(k/100)),v&&v.push(k),M&&M.push(k);for(let R in _)_[R].value.push(c[R].value[A[0]])}}return v&&v.push(0),M&&M.push(0),{data:s,facets:T,channels:{..._,...v&&{fill:{value:v,scale:"color"}},...M&&{stroke:{value:M,scale:"color"}},contours:{value:O}}}})}function _9(e){return/^density$/i.test(e)}function A9(e,{x1:t,x2:n,y1:r,y2:i,x:o=t===void 0&&n===void 0?Ae:void 0,y:s=r===void 0&&i===void 0?G:void 0,fill:a,positiveFill:c="#3ca951",negativeFill:l="#4269d0",fillOpacity:u=1,positiveFillOpacity:f=u,negativeFillOpacity:d=u,stroke:h,strokeOpacity:p,z:m=De(h)[0],clip:g,tip:y,render:x,...b}={}){return[t,n]=I9(o,t,n),[r,i]=I9(s,r,i),t===n&&r===i&&(r=mc(0)),{tip:y}=Yi({tip:y},"x"),Ke(ne(c)?null:Object.assign(iy(e,{x1:t,x2:n,y1:r,y2:i,z:m,fill:c,fillOpacity:f,render:zf(x,M9(!0)),clip:g,...b}),{ariaLabel:"positive difference"}),ne(l)?null:Object.assign(iy(e,{x1:t,x2:n,y1:r,y2:i,z:m,fill:l,fillOpacity:d,render:zf(x,M9(!1)),clip:g,...b}),{ariaLabel:"negative difference"}),zl(e,{x:n,y:i,z:m,stroke:h,strokeOpacity:p,tip:y,clip:!0,...b}))}function I9(e,t,n){return t===void 0&&n===void 0?t=n=mc(e):t===void 0?(n=mc(n),t=e===void 0?n:mc(e)):n===void 0?(t=mc(t),n=e===void 0?t:mc(e)):(t=mc(t),n=mc(n)),[t,n]}function mc(e){let t,{value:n,label:r=En(n)}=pi(e);return{transform:i=>t||(t=pt(i,n)),label:r}}function M9(e){return(t,n,r,i,o,s)=>{let{x1:a,x2:c}=r,{height:l}=i,u=new Float32Array(a.length),f=new Float32Array(c.length);(e===Tw(n.y)<0?u:f).fill(l);let d=s(t,n,{...r,x2:a,y2:f},i,o),h=s(t,n,{...r,x1:c,y1:u},i,o),p=d.querySelector("g")??d,m=h.querySelector("g")??h;for(let g=0;p.firstChild;g+=2){let y=bw(),x=ct("svg:clipPath",o).attr("id",y).node();x.appendChild(p.firstChild),m.childNodes[g].setAttribute("clip-path",`url(#${y})`),m.insertBefore(x,m.childNodes[g])}return h}}var Ttt={ariaLabel:"geo",fill:"none",stroke:"currentColor",strokeWidth:1,strokeLinecap:"round",strokeLinejoin:"round",strokeMiterlimit:1},_y=class extends vt{constructor(t,n={}){let[r,i]=ie(n.r,3);super(t,{geometry:{value:n.geometry,scale:"projection"},r:{value:r,scale:"r",filter:rr,optional:!0}},uy(n),Ttt),this.r=i}render(t,n,r,i,o){let{geometry:s,r:a}=r,c=Mn(o.projection??Ett(n)),{r:l}=this;return Xa(l)?t=[]:l!==void 0&&c.pointRadius(l),ct("svg:g",o).call(Ct,this,i,o).call(It,this,n).call(u=>{u.selectAll().data(t).enter().append("path").call(Dt,this).attr("d",a?f=>c.pointRadius(a[f])(s[f]):f=>c(s[f])).call(Jt,this,r)}).node()}};function Ett({x:e,y:t}){if(e||t)return e??=n=>n,t??=n=>n,ll({point(n,r){this.stream.point(e(n),t(r))}})}function xv(e,{geometry:t=G,...n}={}){switch(e?.type){case"FeatureCollection":e=e.features;break;case"GeometryCollection":e=e.geometries;break;case"Feature":case"LineString":case"MultiLineString":case"MultiPoint":case"MultiPolygon":case"Point":case"Polygon":case"Sphere":e=[e];break}return new _y(e,{geometry:t,...n})}function T9({strokeWidth:e=1.5,...t}={}){return xv({type:"Sphere"},{strokeWidth:e,...t})}function E9({strokeOpacity:e=.1,...t}={}){return xv(VI(),{strokeOpacity:e,...t})}var ud=.5,fd=0;function N9(e={fill:"count"},{binWidth:t,...n}={}){let{z:r}=n;return t=t===void 0?20:Nt(t),e=iT(e,n),Ro(e,"fill")&&(n.channels={...n.channels,fill:{value:[]}}),n.symbol===void 0&&(n.symbol="hexagon"),n.r===void 0&&!Ro(e,"r")&&(n.r=t/2),_e(n,(i,o,s,a,c,l)=>{let{x:u,y:f,z:d,fill:h,stroke:p,symbol:m}=s;if(u===void 0)throw new Error("missing channel: x");if(f===void 0)throw new Error("missing channel: y");({x:u,y:f}=oc(s,a,l)),d=d?d.value:pt(i,r),h=h?.value,p=p?.value,m=m?.value;let g=zm(e,{z:d,fill:h,stroke:p,symbol:m}),y=d&&[],x=h&&[],b=p&&[],w=m&&[],_=[],v=[],M=[],E=-1;for(let O of e)O.initialize(i);for(let O of o){let L=[];for(let S of e)S.scope("facet",O);for(let[S,A]of ec(O,g))for(let{index:N,extent:k}of Ntt(i,A,u,f,t)){L.push(++E),v.push(k.x),M.push(k.y),d&&y.push(g===d?S:d[N[0]]),h&&x.push(g===h?S:h[N[0]]),p&&b.push(g===p?S:p[N[0]]),m&&w.push(g===m?S:m[N[0]]);for(let R of e)R.reduce(N,k)}_.push(L)}let D=s.x.scale,I=s.y.scale,T={x:{value:v,source:a[D]?{value:Xt(v,a[D].invert),scale:D}:null},y:{value:M,source:a[I]?{value:Xt(M,a[I].invert),scale:I}:null},...d&&{z:{value:y}},...h&&{fill:{value:x,scale:"auto"}},...p&&{stroke:{value:b,scale:"auto"}},...m&&{symbol:{value:w,scale:"auto"}},...Object.fromEntries(e.map(({name:O,output:L})=>[O,{scale:"auto",label:L.label,radius:O==="r"?t/2:void 0,value:L.transform()}]))};return{data:i,facets:_,channels:T}})}function Ntt(e,t,n,r,i){let o=i*(1.5/WA),s=new Map;for(let a of t){let c=n[a],l=r[a];if(isNaN(c)||isNaN(l))continue;let u=Math.round(l=(l-fd)/o),f=Math.round(c=(c-ud)/i-(u&1)/2),d=l-u;if(Math.abs(d)*3>1){let m=c-f,g=f+(c<f?-1:1)/2,y=u+(l<u?-1:1),x=c-g,b=l-y;m*m+d*d>x*x+b*b&&(f=g+(u&1?1:-1)/2,u=y)}let h=`${f},${u}`,p=s.get(h);p===void 0&&(p={index:[],extent:{data:e,x:(f+(u&1)/2)*i+ud,y:u*o+fd}},s.set(h,p)),p.index.push(a)}return s.values()}var Dtt={ariaLabel:"hexgrid",fill:"none",stroke:"currentColor",strokeOpacity:.1};function D9(e){return new Sy(e)}var Sy=class extends vt{constructor({binWidth:t=20,clip:n=!0,...r}={}){super(Za,void 0,{clip:n,...r},Dtt),this.binWidth=Nt(t)}render(t,n,r,i,o){let{binWidth:s}=this,{marginTop:a,marginRight:c,marginBottom:l,marginLeft:u,width:f,height:d}=i,h=u-ud,p=f-c-ud,m=a-fd,g=d-l-fd,y=s/2,x=y*HA,b=x/2,w=y*2,_=x*1.5,v=Math.floor(h/w),M=Math.ceil(p/w),E=Math.floor((m+b)/_),D=Math.ceil((g-b)/_)+1,I=`m0,${yc(-x)}l${yc(y)},${yc(b)}v${yc(x)}l${yc(-y)},${yc(b)}`,T=I;for(let O=E;O<D;++O)for(let L=v;L<M;++L)T+=`M${yc(L*w+(O&1)*y)},${yc(O*_)}${I}`;return ct("svg:g",o).datum(0).call(Ct,this,i,o).call(It,this,{},Be+ud,Be+fd).call(O=>O.append("path").call(Dt,this).call(Jt,this,r).attr("d",T)).node()}};function yc(e){return Math.round(e*1e3)/1e3}var Ott={ariaLabel:"image",fill:null,stroke:null};function Btt(e){return/^\.*\//.test(e)}function Ltt(e){return/^(blob|data|file|http|https):/i.test(e)}function Ctt(e){return typeof e=="string"&&(Btt(e)||Ltt(e))?[void 0,e]:[e,void 0]}var Iy=class extends vt{constructor(t,n={}){let{x:r,y:i,r:o,width:s,height:a,rotate:c,src:l,preserveAspectRatio:u,crossOrigin:f,frameAnchor:d,imageRendering:h}=n;o==null&&(o=void 0),o===void 0&&s===void 0&&a===void 0?s=a=16:s===void 0&&a!==void 0?s=a:a===void 0&&s!==void 0&&(a=s);let[p,m]=Ctt(l),[g,y]=ie(o),[x,b]=ie(s,y!==void 0?y*2:void 0),[w,_]=ie(a,y!==void 0?y*2:void 0),[v,M]=ie(c,0);super(t,{x:{value:r,scale:"x",optional:!0},y:{value:i,scale:"y",optional:!0},r:{value:g,scale:"r",filter:rr,optional:!0},width:{value:x,filter:rr,optional:!0},height:{value:w,filter:rr,optional:!0},rotate:{value:v,optional:!0},src:{value:p,optional:!0}},uy(n),Ott),this.src=m,this.width=b,this.rotate=M,this.height=_,this.r=y,this.preserveAspectRatio=le(u,"xMidYMid"),this.crossOrigin=ze(f),this.frameAnchor=Fo(d),this.imageRendering=le(h,"auto")}render(t,n,r,i,o){let{x:s,y:a}=n,{x:c,y:l,width:u,height:f,r:d,rotate:h,src:p}=r,{r:m,width:g,height:y,rotate:x}=this,[b,w]=pn(this,i);return ct("svg:g",o).call(Ct,this,i,o).call(It,this,{x:c&&s,y:l&&a}).call(_=>_.selectAll().data(t).enter().append("image").call(Dt,this).attr("x",O9(c,u,d,b,g,m)).attr("y",O9(l,f,d,w,y,m)).attr("width",u?v=>u[v]:g!==void 0?g:d?v=>d[v]*2:m*2).attr("height",f?v=>f[v]:y!==void 0?y:d?v=>d[v]*2:m*2).attr("transform",h?v=>`rotate(${h[v]})`:x?`rotate(${x})`:null).attr("transform-origin",h||x?ac`${c?v=>c[v]:b}px ${l?v=>l[v]:w}px`:null).call(ft,"href",p?v=>p[v]:this.src).call(ft,"preserveAspectRatio",this.preserveAspectRatio).call(ft,"crossorigin",this.crossOrigin).call(ft,"image-rendering",this.imageRendering).call(ft,"clip-path",d?v=>`circle(${d[v]}px)`:m!==void 0?`circle(${m}px)`:null).call(Jt,this,r)).node()}};function O9(e,t,n,r,i,o){return t&&e?s=>e[s]-t[s]/2:t?s=>r-t[s]/2:e&&i!==void 0?s=>e[s]-i/2:i!==void 0?r-i/2:n&&e?s=>e[s]-n[s]:n?s=>r-n[s]:e?s=>e[s]-o:r-o}function B9(e,{x:t,y:n,...r}={}){return r.frameAnchor===void 0&&([t,n]=Re(t,n)),new Iy(e,{...r,x:t,y:n})}function ktt(e,t,n){var r=1e-8,i=t-1,o=n-1,s=0,a,c,l,u,f,d,h,p,m,g,y;if(e<=0)return 0;if(e>=1)return 1;for(t>=1&&n>=1?(l=e<.5?e:1-e,u=Math.sqrt(-2*Math.log(l)),h=(2.30753+u*.27061)/(1+u*(.99229+u*.04481))-u,e<.5&&(h=-h),p=(h*h-3)/6,m=2/(1/(2*t-1)+1/(2*n-1)),g=h*Math.sqrt(p+m)/m-(1/(2*n-1)-1/(2*t-1))*(p+5/6-2/(3*m)),h=t/(t+n*Math.exp(2*g))):(a=Math.log(t/(t+n)),c=Math.log(n/(t+n)),u=Math.exp(t*a)/t,f=Math.exp(n*c)/n,g=u+f,e<u/g?h=Math.pow(t*g*e,1/t):h=1-Math.pow(n*g*(1-e),1/n)),y=-dd(t)-dd(n)+dd(t+n);s<10;s++){if(h===0||h===1)return h;if(d=Ftt(h,t,n)-e,u=Math.exp(i*Math.log(h)+o*Math.log(1-h)+y),f=d/u,h-=u=f/(1-.5*Math.min(1,f*(i/h-o/(1-h)))),h<=0&&(h=.5*(h+u)),h>=1&&(h=.5*(h+u+1)),Math.abs(u)<r*h&&s>0)break}return h}function Ftt(e,t,n){var r=e===0||e===1?0:Math.exp(dd(t+n)-dd(t)-dd(n)+t*Math.log(e)+n*Math.log(1-e));return e<0||e>1?!1:e<(t+1)/(t+n+2)?r*L9(e,t,n)/t:1-r*L9(1-e,n,t)/n}function L9(e,t,n){var r=1e-30,i=1,o=t+n,s=t+1,a=t-1,c=1,l=1-o*e/s,u,f,d,h;for(Math.abs(l)<r&&(l=r),l=1/l,h=l;i<=100&&(u=2*i,f=i*(n-i)*e/((a+u)*(t+u)),l=1+f*l,Math.abs(l)<r&&(l=r),c=1+f/c,Math.abs(c)<r&&(c=r),l=1/l,h*=l*c,f=-(t+i)*(o+i)*e/((t+u)*(s+u)),l=1+f*l,Math.abs(l)<r&&(l=r),c=1+f/c,Math.abs(c)<r&&(c=r),l=1/l,d=l*c,h*=d,!(Math.abs(d-1)<3e-7));i++);return h}function dd(e){var t=0,n=[76.18009172947146,-86.5053203294167,24.01409824083091,-1.231739572450155,.001208650973866179,-5395239384953e-18],r=1.000000000190015,i,o,s;for(s=(o=i=e)+5.5,s-=(i+.5)*Math.log(s);t<6;t++)r+=n[t]/++o;return Math.log(2.506628274631*r/i)-s}function C9(e,t){var n=ktt(2*Math.min(e,1-e),.5*t,.5);return n=Math.sqrt(t*(1-n)/n),e>.5?n:-n}var Rtt={ariaLabel:"linear-regression",fill:"currentColor",fillOpacity:.1,stroke:"currentColor",strokeWidth:1.5,strokeLinecap:"round",strokeLinejoin:"round",strokeMiterlimit:1},bv=class extends vt{constructor(t,n={}){let{x:r,y:i,z:o,ci:s=.95,precision:a=4}=n;if(super(t,{x:{value:r,scale:"x"},y:{value:i,scale:"y"},z:{value:Un(n),optional:!0}},n,Rtt),this.z=o,this.ci=+s,this.precision=+a,!(0<=this.ci&&this.ci<1))throw new Error(`invalid ci; not in [0, 1): ${s}`);if(!(this.precision>0))throw new Error(`invalid precision: ${a}`)}render(t,n,r,i,o){let{x:s,y:a,z:c}=r,{ci:l}=this;return ct("svg:g",o).call(Ct,this,i,o).call(It,this,n).call(u=>u.selectAll().data(c?Vm(t,c,this.z):[t]).enter().call(f=>f.append("path").attr("fill","none").call(Dt,this).call(Nl,this,{...r,fill:null,fillOpacity:null}).attr("d",d=>this._renderLine(d,s,a)).call(l&&!Qs(this.fill)?d=>d.select($tt).attr("stroke","none").call(Dt,this).call(Nl,this,{...r,stroke:null,strokeOpacity:null,strokeWidth:null}).attr("d",h=>this._renderBand(h,s,a)):()=>{}))).node()}};function $tt(){return this.parentNode.insertBefore(this.ownerDocument.createElementNS(ii.svg,"path"),this)}var p3=class extends bv{constructor(t,n){super(t,n)}_renderBand(t,n,r){let{ci:i,precision:o}=this,[s,a]=ae(t,u=>r[u]),c=wv(t,r,n),l=R9(t,r,n,(1-i)/2,c);return hf().y(u=>u).x0(u=>l(u,-1)).x1(u=>l(u,1))(Pe(s,a-o/2,o).concat(a))}_renderLine(t,n,r){let[i,o]=ae(t,a=>r[a]),s=wv(t,r,n);return`M${s(i)},${i}L${s(o)},${o}`}},m3=class extends bv{constructor(t,n){super(t,n)}_renderBand(t,n,r){let{ci:i,precision:o}=this,[s,a]=ae(t,u=>n[u]),c=wv(t,n,r),l=R9(t,n,r,(1-i)/2,c);return hf().x(u=>u).y0(u=>l(u,-1)).y1(u=>l(u,1))(Pe(s,a-o/2,o).concat(a))}_renderLine(t,n,r){let[i,o]=ae(t,a=>n[a]),s=wv(t,n,r);return`M${i},${s(i)}L${o},${s(o)}`}};function k9(e,{y:t=Ae,x:n=G,stroke:r,fill:i=ne(r)?"currentColor":r,...o}={}){return new p3(e,Hf({...o,x:n,y:t,fill:i,stroke:r}))}function F9(e,{x:t=Ae,y:n=G,stroke:r,fill:i=ne(r)?"currentColor":r,...o}={}){return new m3(e,Wf({...o,x:t,y:n,fill:i,stroke:r}))}function wv(e,t,n){let r=0,i=0,o=0,s=0;for(let u of e){let f=t[u],d=n[u];r+=f,i+=d,o+=f*d,s+=f*f}let a=e.length,c=(a*o-r*i)/(a*s-r*r),l=(i-c*r)/a;return u=>c*u+l}function R9(e,t,n,r,i){let o=Sn(e,u=>t[u])/e.length,s=0,a=0;for(let u of e)s+=(t[u]-o)**2,a+=(n[u]-i(t[u]))**2;let c=Math.sqrt(a/(e.length-2)),l=C9(r,e.length-2);return(u,f)=>{let d=i(u),h=c*Math.sqrt(1/e.length+(u-o)**2/s);return d+f*l*h}}function My({path:e=G,delimiter:t,frameAnchor:n,treeLayout:r=ul,treeSort:i,treeSeparation:o,treeAnchor:s,treeFilter:a,...c}={}){s=Iv(s),i=U9(i),a!=null&&(a=g3(a)),n===void 0&&(n=s.frameAnchor);let l=z9(t),u=W9(c,g3),[f,d]=dn(),[h,p]=dn();return{x:f,y:h,frameAnchor:n,...hn(c,(m,g)=>{let y=l(pt(m,e)),x=d([]),b=p([]),w=-1,_=[],v=[],M=xb().path(D=>y[D]),E=r();E.nodeSize&&E.nodeSize([1,1]),E.separation&&o!==void 0&&E.separation(o??km);for(let D of u)D[_v]=D[X9]([]);for(let D of g){let I=[],T=M(D.filter(O=>y[O]!=null)).each(O=>O.data=m[O.data]);i!=null&&T.sort(i),E(T);for(let O of T.descendants())if(!(a!=null&&!a(O))){I.push(++w),_[w]=O.data,s.position(O,w,x,b);for(let L of u)L[_v][w]=L[G9](O)}v.push(I)}return{data:_,facets:v}}),...Object.fromEntries(u)}}function Sv({path:e=G,delimiter:t,curve:n="bump-x",stroke:r="#555",strokeWidth:i=1.5,strokeOpacity:o=.5,treeLayout:s=ul,treeSort:a,treeSeparation:c,treeAnchor:l,treeFilter:u,...f}={}){l=Iv(l),a=U9(a),u!=null&&(u=P9(u)),f={curve:n,stroke:r,strokeWidth:i,strokeOpacity:o,...f};let d=z9(t),h=W9(f,P9),[p,m]=dn(),[g,y]=dn(),[x,b]=dn(),[w,_]=dn();return{x1:p,x2:g,y1:x,y2:w,...hn(f,(v,M)=>{let E=d(pt(v,e)),D=m([]),I=y([]),T=b([]),O=_([]),L=-1,S=[],A=[],N=xb().path(R=>E[R]),k=s();k.nodeSize&&k.nodeSize([1,1]),k.separation&&c!==void 0&&k.separation(c??km);for(let R of h)R[_v]=R[X9]([]);for(let R of M){let F=[],$=N(R.filter(P=>E[P]!=null)).each(P=>P.data=v[P.data]);a!=null&&$.sort(a),k($);for(let{source:P,target:U}of $.links())if(!(u!=null&&!u(U,P))){F.push(++L),S[L]=U.data,l.position(P,L,D,T),l.position(U,L,I,O);for(let W of h)W[_v][L]=W[G9](U,P)}A.push(F)}return{data:S,facets:A}}),...Object.fromEntries(h)}}function Iv(e="left"){switch(`${e}`.trim().toLowerCase()){case"left":return Ptt;case"right":return Utt}throw new Error(`invalid tree anchor: ${e}`)}var Ptt={frameAnchor:"left",dx:6,position({x:e,y:t},n,r,i){r[n]=t,i[n]=-e}},Utt={frameAnchor:"right",dx:-6,position({x:e,y:t},n,r,i){r[n]=-t,i[n]=-e}};function U9(e){return e==null||typeof e=="function"?e:`${e}`.trim().toLowerCase().startsWith("node:")?$9(g3(e)):$9(ztt(e))}function $9(e){return(t,n)=>ln(e(t),e(n))}function ztt(e){return t=>t.data?.[e]}function z9(e="/"){if(e=`${e}`,e==="/")return n=>n;if(e.length!==1)throw new Error("delimiter must be exactly one character");let t=e.charCodeAt(0);return n=>n.map(r=>qtt(r,t))}var y3=92,q9=47;function qtt(e,t){if(t===y3)throw new Error("delimiter cannot be backslash");let n=!1;for(let r=0,i=e.length;r<i;++r){switch(e.charCodeAt(r)){case y3:if(!n){n=!0;continue}break;case t:n?(e=e.slice(0,r-1)+e.slice(r),--r,--i):e=e.slice(0,r)+"/"+e.slice(r+1);break;case q9:n?(e=e.slice(0,r)+"\\\\"+e.slice(r),r+=2,i+=2):(e=e.slice(0,r)+"\\"+e.slice(r),++r,++i);break}n=!1}return e}function jtt(e){let t=!1;for(let n=0,r=e.length;n<r;++n){switch(e.charCodeAt(n)){case y3:if(!t){t=!0;continue}case q9:t&&(e=e.slice(0,n-1)+e.slice(n),--n,--r);break}t=!1}return e}function j9(e){return fn(e)&&typeof e.node=="function"}function Vtt(e){return fn(e)&&typeof e.link=="function"}function g3(e){if(j9(e))return e.node;if(e=`${e}`.trim().toLowerCase(),!!e.startsWith("node:")){switch(e){case"node:name":return b3;case"node:path":return x3;case"node:internal":return V9;case"node:external":return Y9;case"node:depth":return w3;case"node:height":return v3}throw new Error(`invalid node value: ${e}`)}}function P9(e){if(j9(e))return e.node;if(Vtt(e))return e.link;if(e=`${e}`.trim().toLowerCase(),!(!e.startsWith("node:")&&!e.startsWith("parent:"))){switch(e){case"parent:name":return vv(b3);case"parent:path":return vv(x3);case"parent:depth":return vv(w3);case"parent:height":return vv(v3);case"node:name":return b3;case"node:path":return x3;case"node:internal":return V9;case"node:external":return Y9;case"node:depth":return w3;case"node:height":return v3}throw new Error(`invalid link value: ${e}`)}}function x3(e){return e.id}function b3(e){return Ytt(e.id)}function w3(e){return e.depth}function v3(e){return e.height}function V9(e){return!!e.children}function Y9(e){return!e.children}function vv(e){return(t,n)=>n==null?void 0:e(n)}function Ytt(e){let t=e.length;for(;--t>0&&!Xtt(e,t););return jtt(e.slice(t+1))}function Xtt(e,t){if(e[t]==="/"){let n=0;for(;t>0&&e[--t]==="\\";)++n;if(!(n&1))return!0}return!1}var X9=2,G9=3,_v=4;function W9(e,t){let n=[];for(let r in e){let i=e[r],o=t(i);o!==void 0&&n.push([r,...dn(i),o])}return n}function _3(e,{fill:t,stroke:n,strokeWidth:r,strokeOpacity:i,strokeLinejoin:o,strokeLinecap:s,strokeMiterlimit:a,strokeDasharray:c,strokeDashoffset:l,marker:u,markerStart:f=u,markerEnd:d=u,dot:h=ne(f)&&ne(d),text:p="node:name",textStroke:m="var(--plot-background)",title:g="node:path",dx:y,dy:x,textAnchor:b,treeLayout:w=ul,textLayout:_=w===ul||w===yb?"mirrored":"normal",tip:v,...M}={}){if(y===void 0&&(y=Iv(M.treeAnchor).dx),b!==void 0)throw new Error("textAnchor is not a configurable tree option");_=Qe(_,"textLayout",["mirrored","normal"]);function E(D){return Po(e,My({treeLayout:w,text:p,fill:t===void 0?"currentColor":t,stroke:m,dx:y,dy:x,title:g,...D,...M}))}return Ke(cv(e,Sv({treeLayout:w,markerStart:f,markerEnd:d,stroke:n!==void 0?n:t===void 0?"node:internal":t,strokeWidth:r,strokeOpacity:i,strokeLinejoin:o,strokeLinecap:s,strokeMiterlimit:a,strokeDasharray:c,strokeDashoffset:l,...M})),h?yi(e,My({treeLayout:w,fill:t===void 0?"node:internal":t,title:g,tip:v,...M})):null,p!=null?_==="mirrored"?[E({textAnchor:"start",treeFilter:"node:external"}),E({textAnchor:"end",treeFilter:"node:internal",dx:-y})]:E():null)}function H9(e,t){return _3(e,{...t,treeLayout:yb})}function Z9({geometry:e=G,...t}={}){return _e({...t,x:null,y:null},(n,r,i,o,s,{projection:a})=>{let c=pt(n,e),l=c.length,u=new Float64Array(l),f=new Float64Array(l),d=Mn(a);for(let h=0;h<l;++h)[u[h],f[h]]=d.centroid(c[h]);return{data:n,facets:r,channels:{x:{value:u,scale:a==null?"x":null,source:null},y:{value:f,scale:a==null?"y":null,source:null}}}})}function J9({geometry:e=G,...t}={}){let n;return{...t,x:{transform:r=>Float64Array.from(n=pt(pt(r,e),$I),([i])=>i)},y:{transform:()=>Float64Array.from(n,([,r])=>r)}}}var cP=sz(aP(),1);var tet=({marginLeft:e})=>[1,e],eet=({width:e,marginRight:t})=>[-1,e-t],net=({width:e,marginLeft:t,marginRight:n})=>[0,(t+e-n)/2],ret=({marginTop:e})=>[1,e],iet=({height:e,marginBottom:t})=>[-1,e-t],oet=({height:e,marginTop:t,marginBottom:n})=>[0,(t+e-n)/2];function lP(e){return typeof e=="string"?{anchor:e}:e}function uP(e={},t={}){arguments.length===1&&([e,t]=dP(e));let{anchor:n="left",padding:r=1,r:i=t.r}=lP(e);switch(`${n}`.toLowerCase()){case"left":n=tet;break;case"right":n=eet;break;case"middle":n=net;break;default:throw new Error(`unknown dodge anchor: ${n}`)}return hP("x","y",n,Nt(r),i,t)}function fP(e={},t={}){arguments.length===1&&([e,t]=dP(e));let{anchor:n="bottom",padding:r=1,r:i=t.r}=lP(e);switch(`${n}`.toLowerCase()){case"top":n=ret;break;case"bottom":n=iet;break;case"middle":n=oet;break;default:throw new Error(`unknown dodge anchor: ${n}`)}return hP("y","x",n,Nt(r),i,t)}function dP(e){let{anchor:t,padding:n,...r}=e,{r:i}=r;return[{anchor:t,padding:n,r:i},r]}function hP(e,t,n,r,i,o){if(i!=null&&typeof i!="number"){let{channels:s,sort:a,reverse:c}=o;s=Rm(s),s?.r===void 0&&(o={...o,channels:{...s,r:{value:i,scale:"r"}}}),a===void 0&&c===void 0&&(o.sort={channel:"-r"})}return _e(o,function(s,a,c,l,u,f){let{[t]:d,r:h}=c;if(!c[t])throw new Error(`missing channel: ${t}`);({[t]:d}=oc(c,l,f));let p=h?void 0:i!==void 0?Nt(i):this.r!==void 0?this.r:3;h&&(h=pt(h.value,l[h.scale]||G,Float64Array));let[m,g]=n(u),y=m?aet:set,x=new Float64Array(d.length),b=h?w=>h[w]:()=>p;for(let w of a){let _=(0,cP.default)();w=w.filter(h?M=>xf(d[M])&&rr(h[M]):M=>xf(d[M]));let v=new Float64Array(2*w.length+2);for(let M of w){let E=b(M),D=m?E+r:0,I=d[M]-E,T=d[M]+E,O=2;_.queryInterval(I-r,T+r,([,,S])=>{let A=x[S]-D,N=d[M]-d[S],k=r+(h?h[M]+h[S]:2*p),R=Math.sqrt(k*k-N*N);v[O++]=A-R,v[O++]=A+R});let L=v.slice(0,O);m&&(L=L.filter(S=>S>=0));t:for(let S of L.sort(y)){for(let A=0;A<O;A+=2)if(v[A]+1e-6<S&&S<v[A+1]-1e-6)continue t;x[M]=S+D;break}_.insert([I,T,M])}}m||(m=1);for(let w of a)for(let _ of w)x[_]=x[_]*m+g;return{data:s,facets:a,channels:{[e]:{value:x,source:null},[t]:{value:d,source:c[t]},...h&&{r:{value:h,source:c.r}}}}})}function set(e,t){return Math.abs(e)-Math.abs(t)}function aet(e,t){return e-t}function mP(e,t){return arguments.length===1&&({basis:e,...t}=e),sd(Tv(e),t)}function yP(e,t){return arguments.length===1&&({basis:e,...t}=e),ad(Tv(e),t)}function Tv(e){if(e===void 0)return pP;if(typeof e=="function")return Ev(Mf(e));if(/^p\d{2}$/i.test(e))return yd(Sf(e));switch(`${e}`.toLowerCase()){case"deviation":return fet;case"first":return pP;case"last":return uet;case"max":return det;case"mean":return het;case"median":return pet;case"min":return met;case"sum":return yet;case"extent":return cet}throw new Error(`invalid basis: ${e}`)}function Ev(e){return{mapIndex(t,n,r){let i=+e(t,n);for(let o of t)r[o]=n[o]===null?NaN:n[o]/i}}}function yd(e){return Ev((t,n)=>e(t,r=>n[r]))}var cet={mapIndex(e,t,n){let[r,i]=ae(e,s=>t[s]),o=i-r;for(let s of e)n[s]=t[s]===null?NaN:(t[s]-r)/o}},pP=Ev((e,t)=>{for(let n=0;n<e.length;++n){let r=t[e[n]];if(Ue(r))return r}}),uet=Ev((e,t)=>{for(let n=e.length-1;n>=0;--n){let r=t[e[n]];if(Ue(r))return r}}),fet={mapIndex(e,t,n){let r=Ts(e,o=>t[o]),i=ri(e,o=>t[o]);for(let o of e)n[o]=t[o]===null?NaN:i?(t[o]-r)/i:0}},det=yd(Gt),het=yd(Ts),pet=yd(Pi),met=yd(ce),yet=yd(Sn);function gP(e,t){return get("x",e,t)}function get(e,t,n={}){let r,i=1;if(typeof t=="number")i=t,r=(l,u)=>+l+u;else{if(typeof t=="string"){let l=t.startsWith("-")?-1:1;[t,i]=ow(t.replace(/^[+-]/,"")),i*=l}t=Tf(t),r=(l,u)=>t.offset(l,u)}let o=`${e}1`,s=`${e}2`,a=br({[o]:l=>l.map(u=>r(u,i)),[s]:l=>l},n),c=a[s].transform;return a[s].transform=()=>{let l=c(),[u,f]=ae(l);return l.domain=i<0?[u,r(f,i)]:[r(u,i),f],l},a}function xP(e,t={}){if(typeof e=="string")switch(e.toLowerCase()){case"first":return E3(t);case"last":return N3(t)}if(typeof e=="function")return gc(null,e,t);let n,r;for(n in e){if(r!==void 0)throw new Error("ambiguous selector; multiple inputs");r=xet(e[n])}if(r===void 0)throw new Error(`invalid selector: ${e}`);return gc(n,r,t)}function xet(e){if(typeof e=="function")return e;switch(`${e}`.toLowerCase()){case"min":return D3;case"max":return O3}throw new Error(`unknown selector: ${e}`)}function E3(e){return gc(null,bet,e)}function N3(e){return gc(null,wet,e)}function bP(e){return gc("x",D3,e)}function wP(e){return gc("y",D3,e)}function vP(e){return gc("x",O3,e)}function _P(e){return gc("y",O3,e)}function*bet(e){yield e[0]}function*wet(e){yield e[e.length-1]}function*D3(e,t){yield tx(e,n=>t[n])}function*O3(e,t){yield Gc(e,n=>t[n])}function gc(e,t,n){if(e!=null){if(n[e]==null)throw new Error(`missing channel: ${e}`);e=n[e]}let r=Un(n);return hn(n,(i,o)=>{let s=pt(i,r),a=pt(i,e),c=[];for(let l of o){let u=[];for(let f of s?on(l,d=>s[d]).values():[l])for(let d of t(f,a))u.push(d);c.push(u)}return{data:i,facets:c}})}var vet=new Map([["style","style"],["width","width"],["height","height"],["margin","margin"],["marginLeft","marginLeft"],["marginRight","marginRight"],["marginTop","marginTop"],["marginBottom","marginBottom"],["align","align"],["aspectRatio","aspectRatio"],["axis","axis"],["inset","inset"],["grid","grid"],["label","label"],["padding","padding"],["round","round"],["xScale","x.type"],["xDomain","x.domain"],["xRange","x.range"],["xNice","x.nice"],["xInset","x.inset"],["xInsetLeft","x.insetLeft"],["xInsetRight","x.insetRight"],["xClamp","x.clamp"],["xRound","x.round"],["xAlign","x.align"],["xPadding","x.padding"],["xPaddingInner","x.paddingInner"],["xPaddingOuter","x.paddingOuter"],["xAxis","x.axis"],["xTicks","x.ticks"],["xTickSize","x.tickSize"],["xTickSpacing","x.tickSpacing"],["xTickPadding","x.tickPadding"],["xTickFormat","x.tickFormat"],["xTickRotate","x.tickRotate"],["xGrid","x.grid"],["xLine","x.line"],["xLabel","x.label"],["xLabelAnchor","x.labelAnchor"],["xLabelOffset","x.labelOffset"],["xFontVariant","x.fontVariant"],["xAriaLabel","x.ariaLabel"],["xAriaDescription","x.ariaDescription"],["xReverse","x.reverse"],["xZero","x.zero"],["xBase","x.base"],["xExponent","x.exponent"],["xConstant","x.constant"],["yScale","y.type"],["yDomain","y.domain"],["yRange","y.range"],["yNice","y.nice"],["yInset","y.inset"],["yInsetTop","y.insetTop"],["yInsetBottom","y.insetBottom"],["yClamp","y.clamp"],["yRound","y.round"],["yAlign","y.align"],["yPadding","y.padding"],["yPaddingInner","y.paddingInner"],["yPaddingOuter","y.paddingOuter"],["yAxis","y.axis"],["yTicks","y.ticks"],["yTickSize","y.tickSize"],["yTickSpacing","y.tickSpacing"],["yTickPadding","y.tickPadding"],["yTickFormat","y.tickFormat"],["yTickRotate","y.tickRotate"],["yGrid","y.grid"],["yLine","y.line"],["yLabel","y.label"],["yLabelAnchor","y.labelAnchor"],["yLabelOffset","y.labelOffset"],["yFontVariant","y.fontVariant"],["yAriaLabel","y.ariaLabel"],["yAriaDescription","y.ariaDescription"],["yReverse","y.reverse"],["yZero","y.zero"],["yBase","y.base"],["yExponent","y.exponent"],["yConstant","y.constant"],["facetMargin","facet.margin"],["facetMarginTop","facet.marginTop"],["facetMarginBottom","facet.marginBottom"],["facetMarginLeft","facet.marginLeft"],["facetMarginRight","facet.marginRight"],["facetGrid","facet.grid"],["facetLabel","facet.label"],["fxDomain","fx.domain"],["fxRange","fx.range"],["fxNice","fx.nice"],["fxInset","fx.inset"],["fxInsetLeft","fx.insetLeft"],["fxInsetRight","fx.insetRight"],["fxRound","fx.round"],["fxAlign","fx.align"],["fxPadding","fx.padding"],["fxPaddingInner","fx.paddingInner"],["fxPaddingOuter","fx.paddingOuter"],["fxAxis","fx.axis"],["fxTicks","fx.ticks"],["fxTickSize","fx.tickSize"],["fxTickSpacing","fx.tickSpacing"],["fxTickPadding","fx.tickPadding"],["fxTickFormat","fx.tickFormat"],["fxTickRotate","fx.tickRotate"],["fxGrid","fx.grid"],["fxLine","fx.line"],["fxLabel","fx.label"],["fxLabelAnchor","fx.labelAnchor"],["fxLabelOffset","fx.labelOffset"],["fxFontVariant","fx.fontVariant"],["fxAriaLabel","fx.ariaLabel"],["fxAriaDescription","fx.ariaDescription"],["fxReverse","fx.reverse"],["fyDomain","fy.domain"],["fyRange","fy.range"],["fyNice","fy.mice"],["fyInset","fy,inset"],["fyInsetTop","fy.insetTop"],["fyInsetBottom","fy.insetBottom"],["fyRound","fy.round"],["fyAlign","fy.align"],["fyPadding","fy.padding"],["fyPaddingInner","fy.paddingInner"],["fyPaddingOuter","fy.paddingOuter"],["fyAxis","fy.axis"],["fyTicks","fy.ticks"],["fyTickSize","fy.tickSize"],["fyTickSpacing","fy.tickSpacing"],["fyTickPadding","fy.tickPadding"],["fyTickFormat","fy.tickFormat"],["fyTickRotate","fy.tickRotate"],["fyGrid","fy.grid"],["fyLine","fy.line"],["fyLabel","fy.label"],["fyLabelAnchor","fy.labelAnchor"],["fyLabelOffset","fy.labelOffset"],["fyFontVariant","fy.fontVariant"],["fyAriaLabel","fy.ariaLabel"],["fyAriaDescription","fy.ariaDescription"],["fyReverse","fy.reverse"],["colorScale","color.type"],["colorDomain","color.domain"],["colorRange","color.range"],["colorClamp","color.clamp"],["colorN","color.n"],["colorNice","color.nice"],["colorScheme","color.scheme"],["colorInterpolate","color.interpolate"],["colorPivot","color.pivot"],["colorSymmetric","color.symmetric"],["colorLabel","color.label"],["colorReverse","color.reverse"],["colorZero","color.zero"],["colorTickFormat","color.tickFormat"],["colorBase","color.base"],["colorExponent","color.exponent"],["colorConstant","color.constant"],["opacityScale","opacity.type"],["opacityDomain","opacity.domain"],["opacityRange","opacity.range"],["opacityClamp","opacity.clamp"],["opacityNice","opacity.nice"],["opacityLabel","opacity.label"],["opacityReverse","opacity.reverse"],["opacityZero","opacity.zero"],["opacityTickFormat","opacity.tickFormat"],["opacityBase","opacity.base"],["opacityExponent","opacity.exponent"],["opacityConstant","opacity.constant"],["rScale","r.type"],["rDomain","r.domain"],["rRange","r.range"],["rClamp","r.clamp"],["rNice","r.nice"],["rZero","r.zero"],["rBase","r.base"],["rExponent","r.exponent"],["rConstant","r.constant"],["lengthScale","length.type"],["lengthDomain","length.domain"],["lengthRange","length.range"],["lengthClamp","length.clamp"],["lengthNice","length.nice"],["lengthZero","length.zero"],["lengthBase","length.base"],["lengthExponent","length.exponent"],["lengthConstant","length.constant"],["projectionType","projection.type"],["projectionParallels","projection.parallels"],["projectionPrecision","projection.precision"],["projectionRotate","projection.rotate"],["projectionDomain","projection.domain"],["projectionInset","projection.inset"],["projectionInsetLeft","projection.insetLeft"],["projectionInsetRight","projection.insetRight"],["projectionInsetTop","projection.insetTop"],["projectionInsetBottom","projection.insetBottom"],["projectionClip","projection.clip"]]);function _et(e,t,n){for(let r=0;r<t.length;++r){let i=t[r];r===t.length-1?e[i]=n:e=e[i]||(e[i]={})}}function SP(e,t,n){for(let r in e){let i=vet.get(r);if(i==null)throw new Error(`Unrecognized plot attribute: ${r}`);let o=e[r];typeof o=="symbol"?n.push(r):o!==void 0&&_et(t,i.split("."),o)}}var Iet=new Set(["frame","hexgrid","sphere","graticule"]);async function MP(e){let t={marks:[]},n=[],{attributes:r,marks:i}=e;SP(r,t,n);let o=[];for(let a of i)for(let{type:c,data:l,options:u}of a.plotSpecs())Iet.has(c)?t.marks.push(Nv[c](u)):t.marks.push(Nv[c](l,u)),o.push(a.index);Aet(t,e);let s=ny(t);Tet(s,o),Met(e,s,r,n);for(let a of e.interactors)await a.init(s);return s}function Met(e,t,n,r){r.forEach(i=>{let o=n[i];if(o===uo){if(!i.endsWith("Domain"))throw new Error(`Unsupported fixed attribute: ${i}`);let s=i.slice(0,-6),a=t.scale(s);a?.domain&&e.setAttribute(i,n[`${s}Reverse`]?a.domain.slice().reverse():a.domain)}else throw new Error(`Unrecognized symbol: ${o}`)})}function Aet(e,t){let{marks:n}=t;Dv("x",e,n,["x","x1","x2"]),Dv("y",e,n,["y","y1","y2"]),Dv("fx",e,n),Dv("fy",e,n)}function Dv(e,t,n,r=[e]){let i=t[e]||{};if(i.axis===null||i.label!==void 0)return;let o=n.map(u=>u.channelField(r)?.field);if(o.every(u=>u==null))return;let s,a,c;for(let u=0;u<o.length;++u){let{column:f,label:d}=o[u]||{};f===void 0&&d===void 0||(s===void 0&&a===void 0?(s=f,a=d,c=Eet(n[u].data,r)||"number"):a!==d?a=void 0:s!==f&&(s=void 0))}let l=a||s;if(l!==void 0){if((c==="number"||c==="date")&&(e==="x"||e==="y")){i.percent&&(l=`${l} (%)`);let u=(e==="x"?1:-1)*(i.reverse?-1:1);e==="x"||i.labelAnchor==="center"?l=e==="x"==u<0?`\u2190 ${l}`:`${l} \u2192`:l=`${u<0?"\u2191 ":"\u2193 "}${l}`}t[e]={...i,label:l}}}function Tet(e,t){let n=e.querySelectorAll('g[aria-label="facet"]');if(n.length)for(let r of n)IP(r,t);else IP(e,t)}function IP(e,t){let n=-1;for(let r of e.children){let i=r.getAttribute("aria-label")||"";r.nodeName==="style"||i.includes("-axis")||i.includes("-grid")||r.setAttribute("data-index",t[++n])}}function Eet(e,t){for(let n of e)for(let r=0;r<t.length;++r){let i=n[t[r]];if(i!=null)return i instanceof Date?"date":typeof i}}var Net={width:640,marginLeft:40,marginRight:20,marginTop:20,marginBottom:30},Ey=class{constructor(t){this.attributes={...Net},this.listeners=null,this.interactors=[],this.legends=[],this.marks=[],this.markset=null,this.element=t||document.createElement("div"),this.element.setAttribute("class","plot"),this.element.style.display="flex",this.element.value=this,this.params=new Map,this.synch=LS()}margins(){return{left:this.getAttribute("marginLeft"),top:this.getAttribute("marginTop"),bottom:this.getAttribute("marginBottom"),right:this.getAttribute("marginRight")}}innerWidth(){let{left:t,right:n}=this.margins();return this.getAttribute("width")-t-n}innerHeight(){let{top:t,bottom:n}=this.margins();return this.getAttribute("height")-t-n}pending(t){this.synch.pending(t)}update(t){return this.synch.ready(t)&&!this.pendingRender&&(this.pendingRender=!0,requestAnimationFrame(()=>this.render())),this.synch.promise}async render(){this.pendingRender=!1;let t=await MP(this),n=this.legends.flatMap(({legend:r,include:i})=>{let o=r.init(t);return i?o:[]});this.element.replaceChildren(t,...n),this.synch.resolve()}getAttribute(t){return this.attributes[t]}setAttribute(t,n,r){return Hh(this.attributes[t],n)?(n===void 0?delete this.attributes[t]:this.attributes[t]=n,r?.silent||this.listeners?.get(t)?.forEach(i=>i(t,n)),!0):!1}addAttributeListener(t,n){let r=this.listeners||(this.listeners=new Map);return r.has(t)||r.set(t,new Set),r.get(t).add(n),this}removeAttributeListener(t,n){return this.listeners?.get(t)?.delete(n)}addParams(t,n){let{params:r}=this;for(let i of n)r.has(i)?r.get(i).push(t):(r.set(i,[t]),i.addEventListener("value",()=>Promise.allSettled(r.get(i).map(o=>o.requestQuery()))))}addMark(t){return t.setPlot(this,this.marks.length),this.marks.push(t),this.markset=null,this}get markSet(){return this.markset||(this.markset=new Set(this.marks))}addInteractor(t){return this.interactors.push(t),this}addLegend(t,n=!0){t.setPlot(this),this.legends.push({legend:t,include:n})}};function Ov(e){return typeof e!="string"?!1:(e=e.toLowerCase().trim(),e==="none"||e==="currentcolor"||e.startsWith("url(")&&e.endsWith(")")||e.startsWith("var(")&&e.endsWith(")")||Fr(e)!==null)}var Det=new Set(["order","sort","label","anchor","curve","tension","marker","markerStart","markerMid","markerEnd","textAnchor","lineAnchor","lineHeight","textOverflow","monospace","fontFamily","fontSize","fontStyle","fontVariant","fontWeight","frameAnchor","strokeLinejoin","strokeLinecap","strokeMiterlimit","strokeDasharray","strokeDashoffset","mixBlendMode","shapeRendering","imageRendering","preserveAspectRatio","interpolate","crossOrigin","paintOrder","pointerEvents","target"]);function AP(e){return Det.has(e)}var Oet=new Set(["asterisk","circle","cross","diamond","diamond2","hexagon","plus","square","square2","star","times","triangle","triangle2","wye"]);function TP(e){return Oet.has(`${e}`.toLowerCase())}function gd(e){return typeof e?.getChild=="function"}function EP(e){let{typeId:t}=e;return t===10?n=>n==null?n:new Date(n):t===2&&e.bitWidth>=64?n=>n==null?n:Number(n):n=>n}function Bv(e){return gd(e)?Bet(e):e}function Bet(e){let{batches:t,numRows:n}=e;if(!n)return[];let r=Array.from({length:n},()=>({}));for(let i=0,o=0;o<t.length;++o){let s=t[o],{schema:a,numRows:c,numCols:l}=s;for(let u=0;u<l;++u){let f=s.getChildAt(u),{name:d,type:h}=a.fields[u],p=EP(h);for(let m=i,g=0;g<c;++g,++m)r[m][d]=p(f.get(g))}i+=c}return r}var NP=e=>e==="stroke"||e==="fill",Let=e=>e==="symbol",Cet=(e,t)=>e!=="sort"&&e!=="tip"&&t!=null&&!Array.isArray(t),B3=(e,t)=>({channel:e,field:t,as:t instanceof yr?t.column:e}),L3=(e,t)=>({channel:e,value:t}),Lv=e=>Array.isArray(e),Nn=class extends ar{constructor(t,n,r,i={}){super(n?.options?.filterBy),this.type=t,this.reqs=i,this.source=n,Lv(this.source)&&(this.data=this.source);let o=this.channels=[],s=this.detail=new Set,a=this.params=new Set,c=(l,u)=>{let f=typeof u;if(l==="channels")for(let d in u)s.add(d),c(d,u[d]);else if(f==="function"&&u[Zh]){let d=u(this,l);for(let h in d)c(h,d[h])}else if(f==="string")AP(l)||NP(l)&&Ov(u)||Let(l)&&TP(u)?o.push(L3(l,u)):o.push(B3(l,Aa(u)));else if(xs(u))if(Array.isArray(u.columns))o.push(B3(l,u)),a.add(u);else{let d=L3(l,u.value);o.push(d),u.addEventListener("value",h=>(d.value=h,this.update()))}else f==="object"&&Cet(l,u)?o.push(B3(l,u)):u!==void 0&&o.push(L3(l,u))};for(let l in r)c(l,r[l])}setPlot(t,n){this.plot=t,this.index=n,t.addParams(this,this.params),this.source?.table&&this.queryPending()}hasOwnData(){return this.source==null||Lv(this.source)}channel(t){return this.channels.find(n=>n.channel===t)}channelField(...t){let n=t.flat();for(let r of n){let i=this.channel(r);if(i?.field)return i}return null}fields(){if(this.hasOwnData())return null;let{source:{table:t},channels:n,reqs:r}=this,i=new Map;for(let{channel:o,field:s}of n){let a=s?.column;if(a){if(s.stats?.length||r[o]){i.has(a)||i.set(a,new Set);let c=i.get(a);r[o]?.forEach(l=>c.add(l)),s.stats?.forEach(l=>c.add(l))}}else continue}return Array.from(i,([o,s])=>({table:t,column:o,stats:Array.from(s)}))}fieldInfo(t){return this.stats=t.reduce((n,r)=>(n[r.column]=r,n),Object.create(null)),this}query(t=[]){if(this.hasOwnData())return null;let{channels:n,source:{table:r}}=this;return C3(n,r).where(t)}queryPending(){return this.plot.pending(this),this}queryResult(t){return this.data=Bv(t),this}update(){return this.plot.update(this)}plotSpecs(){let{type:t,data:n,detail:r,channels:i}=this,o={},s={};for(let a of i){let c=r.has(a.channel)?s:o;c[a.channel]=gi(a)}return r.size&&(o.channels=s),[{type:t,data:n,options:o}]}};function gi(e){return Object.hasOwn(e,"value")?e.value:NP(e.channel)?{value:e.as,scale:"color"}:e.as}function C3(e,t,n=[]){let r=yt.from({source:t}),i=new Set,o=!1;for(let s of e){let{channel:a,field:c,as:l}=s;if(!n.includes(a)){if(a==="orderby")r.orderby(s.value);else if(c){if(c.aggregate)o=!0;else{if(i.has(l))continue;i.add(l)}r.select({[l]:c})}}}return o&&r.groupby(Array.from(i)),r}function Vl(e,t){let{plot:n}=e,r=n.getAttribute(`${t}Scale`);if(!r){let{field:o}=e.channelField(t,`${t}1`,`${t}2`),{type:s}=e.stats[o.column];r=s==="date"?"time":"linear"}let i={type:r};switch(r){case"log":i.base=n.getAttribute(`${t}Base`)??10;break;case"pow":i.exponent=n.getAttribute(`${t}Exponent`)??1;break;case"symlog":i.constant=n.getAttribute(`${t}Constant`)??1;break}return Xh(i)}function Xr(e,t,n,r,i=1,o){let{field:s}=e.channelField(t);o=o??s;let{type:a,apply:c,sqlApply:l}=Vl(e,t),u=!!e.plot.getAttribute(`${t}Reverse`),[f,d]=r.map(x=>c(x)),h=l(o),p=a==="time"||a==="utc"?h:o,m=d===f?0:(n-i)/(d-f),g=m!==1?` * ${m}::DOUBLE`:"";return[u?j`(${d} - ${h}::DOUBLE)${g}`:j`(${h}::DOUBLE - ${f})${g}`,p]}var k3={x:["min","max"]},F3={y:["min","max"]},Cv={...k3,...F3};function DP(e,t,n,r,i){let{plot:o,stats:s}=e,a=o.getAttribute(r),c=o.getAttribute(i);if(Array.isArray(a)&&!a[wn])return a;{let{field:l}=e.channelField(n),{column:u}=l,{min:f,max:d}=s[u],h=R3(t,u)||(c?Rs().domain([f,d]).nice().domain():[f,d]);return a!==uo&&(h[wn]=!0),o.setAttribute(r,h,{silent:!0}),h}}function Vo(e,t){return DP(e,t,"x","xDomain","xNice")}function Yo(e,t){return DP(e,t,"y","yDomain","yNice")}function R3(e,t){if(!e)return;let n,r,i=(o,s)=>{if(o==="BETWEEN"&&s.field.column===t){let{range:a}=s;a&&(n==null||a[0]<n)&&(n=a[0]),a&&(r==null||a[1]>r)&&(r=a[1])}};return Array.isArray(e)?e.forEach(o=>o.visit?.(i)):e.visit&&e.visit(i),n!=null&&r!=null&&n!==r?[n,r]:void 0}var Ny=class extends Nn{constructor(t,n,r){let i=t.endsWith("X")?"y":t.endsWith("Y")?"x":null,o={[i]:["min","max"]};super(t,n,r,o),this.dim=i}query(t=[]){let{plot:n,dim:r,source:i,stats:o}=this,{optimize:s=!0}=i.options||{},a=super.query(t);if(!r)return a;let c=r==="x"?"y":"x",l=this.channelField(c)?.as,{field:u,as:f}=this.channelField(r),{type:d}=o[u.column];if(s&&(d==="date"||d==="number")&&l){let{column:p}=u,{max:m,min:g}=o[p],y=r==="x"?n.innerWidth():n.innerHeight(),[x,b]=R3(t,p)||[g,m],[w]=Xr(this,r,y,[x,b],1,f),_=a.select().map(v=>v.as).filter(v=>v!==f&&v!==l);return ket(a,w,f,l,_)}else return a.orderby(u)}};function ket(e,t,n,r,i=[]){let o=j`FLOOR(${t})::INTEGER`,s=a=>yt.from(e).select(a).groupby(o,i);return yt.union(s([{[n]:ti(n),[r]:_u(r,n)},...i]),s([{[n]:Kr(n),[r]:Su(r,n)},...i]),s([{[n]:_u(n,r),[r]:ti(r)},...i]),s([{[n]:Su(n,r),[r]:Kr(r)},...i])).orderby(i,n)}function $3(e,t="density"){if(gd(e))switch(e.getChild(t).type.typeId){case 2:case 3:case 7:return Float64Array;default:return Array}else return typeof e[0][t]=="number"?Float64Array:Array}function OP(e,t){let n=$3(t);return LP(new n(e),t)}function BP(e,t,n,r,i=[]){if(i.length)return Pet(e*t,n,r,i);{let o={};return r.forEach(s=>{let a=$3(n,s);o[s]=LP(new a(e*t),n,s)}),[o]}}function LP(e,t,n="density"){if(gd(t)){let r=t.numRows;if(r===0)return e;let i=t.getChild("index").toArray(),o=t.getChild(n).toArray();for(let s=0;s<r;++s)e[i[s]]=o[s]}else for(let r of t)e[r.index]=r[n];return e}function Pet(e,t,n,r){let i=n.map(c=>$3(t,c)),o=n.length,s={},a=c=>{let l=s[c];return l||(l=s[c]={},r.forEach((u,f)=>l[u]=c[f]),n.forEach((u,f)=>l[u]=new i[f](e))),l};if(gd(t)){let c=t.numRows;if(c===0)return[];let l=t.getChild("index").toArray(),u=n.map(d=>t.getChild(d).toArray()),f=r.map(d=>t.getChild(d));for(let d=0;d<c;++d){let h=f.map(m=>m.get(d)),p=a(h);for(let m=0;m<o;++m)p[n[m]][l[d]]=u[m][d]}}else for(let c of t){let l=r.map(f=>c[f]),u=a(l);for(let f=0;f<o;++f)u[n[f]][c.index]=c[n[f]]}return Object.values(s)}function Dy(e,t){let n=0,r=0;return e.forEach(i=>{let o=i[t],s=o.length;for(let a=0;a<s;++a){let c=o[a];c<n&&(n=c),c>r&&(r=c)}}),n===0&&r===0?[0,1]:[n,r]}function CP(e,t){let n=new Wn;return e.forEach(r=>{let i=r[t],o=i.length;for(let s=0;s<o;++s)n.add(i[s])}),Array.from(n).sort(zt)}function Dn(e,t,n,r){gr(n)?(r=r||(()=>e.requestUpdate()),n.addEventListener("value",i=>(e[t]=i,r())),e[t]=n.value):e[t]=n}function Oy(e,t=!1){let n=new Float64Array(5),r=new Float64Array(4);Uet(n,r,e);let i=Float64Array.of(0,r[1]-n[1]*r[0],r[2]-n[2]*r[0],r[3]-n[3]*r[0],-n[4]*r[0]),o=1+n[1]+n[2]+n[3]+n[4],s=(r[0]+r[1]+r[2]+r[3])/o,a=(i[1]+i[2]+i[3]+i[4])/o;return{sigma:e,negative:t,a:n,b_causal:r,b_anticausal:i,sum_causal:s,sum_anticausal:a}}function Uet(e,t,n){let i=Float64Array.of(.84,1.8675,.84,-1.8675,-.34015,-.1299,-.34015,.1299),o=Math.exp(-1.783/n),s=Math.exp(-1.723/n),a=.6318/n,c=1.997/n,l=Float64Array.of(-o*Math.cos(a),o*Math.sin(a),-o*Math.cos(-a),o*Math.sin(-a),-s*Math.cos(c),s*Math.sin(c),-s*Math.cos(-c),s*Math.sin(-c)),u=n*2.5066282746310007,f=Float64Array.of(i[0],i[1],0,0,0,0,0,0),d=Float64Array.of(1,0,l[0],l[1],0,0,0,0,0,0),h,p;for(p=2;p<8;p+=2){for(f[p]=l[p]*f[p-2]-l[p+1]*f[p-1],f[p+1]=l[p]*f[p-1]+l[p+1]*f[p-2],h=p-2;h>0;h-=2)f[h]+=l[p]*f[h-2]-l[p+1]*f[h-1],f[h+1]+=l[p]*f[h-1]+l[p+1]*f[h-2];for(h=0;h<=p;h+=2)f[h]+=i[p]*d[h]-i[p+1]*d[h+1],f[h+1]+=i[p]*d[h+1]+i[p+1]*d[h];for(d[p+2]=l[p]*d[p]-l[p+1]*d[p+1],d[p+3]=l[p]*d[p+1]+l[p+1]*d[p],h=p;h>0;h-=2)d[h]+=l[p]*d[h-2]-l[p+1]*d[h-1],d[h+1]+=l[p]*d[h-1]+l[p+1]*d[h-2]}for(p=0;p<4;++p)h=p<<1,t[p]=f[h]/u,e[p+1]=d[h+2]}function kP(e,t,n,[r,i]){let o=new Float64Array(Math.max(r,i)),s=new Float64Array(Math.max(r,i)),a=new Float64Array(5),c=new Float64Array(n.length);for(let l=0,u=0;l<i;++l,u+=r){let f=c.subarray(u);kv(e,n.subarray(u),r,1,o,s,a,f)}for(let l=0;l<r;++l){let u=c.subarray(l);kv(t,u,i,r,o,s,a,u)}return c}function kv(e,t,n,r=1,i=new Float64Array(n),o=new Float64Array(n),s=new Float64Array(5),a=i,c=zet){let l=r*2,u=r*3,f=r*4,d=r*n,h,p;for(c(i,t,n,r,e.b_causal,3,e.a,4,e.sum_causal,s,e.sigma),p=4,h=f;p<n;++p,h+=r)i[p]=e.b_causal[0]*t[h]+e.b_causal[1]*t[h-r]+e.b_causal[2]*t[h-l]+e.b_causal[3]*t[h-u]-e.a[1]*i[p-1]-e.a[2]*i[p-2]-e.a[3]*i[p-3]-e.a[4]*i[p-4];for(c(o,t,n,-r,e.b_anticausal,4,e.a,4,e.sum_anticausal,s,e.sigma),p=4,h=d-r*5;p<n;++p,h-=r)o[p]=e.b_anticausal[1]*t[h+r]+e.b_anticausal[2]*t[h+l]+e.b_anticausal[3]*t[h+u]+e.b_anticausal[4]*t[h+f]-e.a[1]*o[p-1]-e.a[2]*o[p-2]-e.a[3]*o[p-3]-e.a[4]*o[p-4];if(e.negative)for(p=0,h=0;p<n;++p,h+=r)a[h]=i[p]+o[n-p-1];else for(p=0,h=0;p<n;++p,h+=r)a[h]=Math.max(0,i[p]+o[n-p-1]);return a}function zet(e,t,n,r,i,o,s,a,c,l){let u=Math.abs(r)*n,f=r<0?u+r:0,d,h,p;for(h=0;h<a;++h)for(l[h]=h<=o?i[h]:0,p=1;p<=a&&p<=h;++p)l[h]-=s[p]*l[h-p];for(p=0;p<a;++p)for(e[p]=0,h=1;h<=p;++h)d=f+r*h,d>=0&&d<u&&(e[p]+=l[p-h]*t[d]);let m=t[f];if(m>0)for(p=0;p<a;++p)e[p]+=l[p]*m}var aa="density",Gi=class extends Nn{constructor(t,n,r){let{bandwidth:i=0,interpolate:o="none",pixelSize:s=1,pad:a=1,width:c,height:l,...u}=r,f=qet(u);super(t,n,u,Cv),this.densityMap=f,Dn(this,"bandwidth",i,()=>this.grids?this.convolve().update():null),Dn(this,"pixelSize",s),Dn(this,"interpolate",o),Dn(this,"pad",a),Dn(this,"width",c),Dn(this,"height",l)}setPlot(t,n){let r=()=>{this.stats&&this.requestUpdate()};return t.addAttributeListener("domainX",r),t.addAttributeListener("domainY",r),super.setPlot(t,n)}get filterIndexable(){let t=this.plot.getAttribute("xDomain"),n=this.plot.getAttribute("yDomain");return t&&n&&!t[wn]&&!n[wn]}query(t=[]){let{interpolate:n,pad:r,channels:i,densityMap:o,source:s}=this,[a,c]=this.extentX=Vo(this,t),[l,u]=this.extentY=Yo(this,t),[f,d]=this.bins=this.binDimensions(this),[h,p]=Xr(this,"x",f,[a,c],r),[m,g]=Xr(this,"y",d,[l,u],r),y=r?[Ie(p,[+a,+c]),Ie(g,[+l,+u])]:[_s(+a,p),vs(p,+c),_s(+l,g),vs(g,+u)],x=yt.from(s.table).where(t.concat(y)),b=this.groupby=[],w={};for(let v of i)if(Object.hasOwn(v,"field")){let{as:M,channel:E,field:D}=v;D.aggregate?(w[E]=D,o[E]=!0):E==="weight"?w[aa]=kr(D):E!=="x"&&E!=="y"&&(x.select({[M]:D}),b.push(M))}let _=this.aggr=Object.keys(w);if(w.density&&_.length>1)throw new Error("Weight option can not be used with custom aggregates.");if(_.length||(_.push(aa),w.density=Cr()),n==="linear"){if(_.length>1)throw new Error("Linear binning not applicable to multiple aggregates.");if(!w.density)throw new Error("Linear binning not applicable to custom aggregates.");return Vet(x,h,m,w[aa],f,b)}else return jet(x,h,m,w,f,b)}binDimensions(){let{plot:t,pixelSize:n,width:r,height:i}=this;return[r??Math.round(t.innerWidth()/n),i??Math.round(t.innerHeight()/n)]}queryResult(t){let[n,r]=this.bins;return this.grids=BP(n,r,t,this.aggr,this.groupby),this.convolve()}convolve(){let{aggr:t,bandwidth:n,bins:r,grids:i,plot:o}=this;if(this.kde=this.grids,n>0){let s=t.length===1?t[0]:t.includes(aa)?aa:null;if(!s)return console.warn("No compatible grid found for smoothing."),this;let a=o.innerWidth(),c=o.innerHeight(),[l,u]=r,f=i.some(p=>p[s].some(m=>m<0)),d=Oy(n*(l-1)/a,f),h=Oy(n*(u-1)/c,f);this.kde=this.grids.map(p=>{let m=kP(d,h,p[s],r);return{...p,[s]:m}})}return this}plotSpecs(){throw new Error("Unimplemented. Use a Grid2D mark subclass.")}};function qet(e){let t={};for(let n in e)e[n]==="density"&&(delete e[n],t[n]=!0);return t}function jet(e,t,n,r,i,o){return e.select({index:j`FLOOR(${t})::INTEGER + FLOOR(${n})::INTEGER * ${i}`,...r}).groupby("index",o)}function Vet(e,t,n,r,i,o){let s=r?.column?`* ${r.column}`:"",a=(d,h)=>e.clone().select({xp:t,yp:n,i:d,w:h}),c=a(j`FLOOR(xp)::INTEGER + FLOOR(yp)::INTEGER * ${i}`,j`(FLOOR(xp)::INTEGER + 1 - xp) * (FLOOR(yp)::INTEGER + 1 - yp)${s}`),l=a(j`FLOOR(xp)::INTEGER + (FLOOR(yp)::INTEGER + 1) * ${i}`,j`(FLOOR(xp)::INTEGER + 1 - xp) * (yp - FLOOR(yp)::INTEGER)${s}`),u=a(j`FLOOR(xp)::INTEGER + 1 + FLOOR(yp)::INTEGER * ${i}`,j`(xp - FLOOR(xp)::INTEGER) * (FLOOR(yp)::INTEGER + 1 - yp)${s}`),f=a(j`FLOOR(xp)::INTEGER + 1 + (FLOOR(yp)::INTEGER + 1) * ${i}`,j`(xp - FLOOR(xp)::INTEGER) * (yp - FLOOR(yp)::INTEGER)${s}`);return yt.from(yt.unionAll(c,l,u,f)).select({index:"i",density:kr("w")},o).groupby("index",o).having(qc("density",0))}var By=class extends Gi{constructor(t,n){let{thresholds:r=10,...i}=n;super("geo",t,{bandwidth:20,interpolate:"linear",pixelSize:2,...i}),Dn(this,"thresholds",r,()=>this.grids?this.contours().update():null)}convolve(){return super.convolve().contours()}contours(){let{bins:t,densityMap:n,kde:r,thresholds:i,plot:o}=this,s=i;if(!Array.isArray(s)){let[,w]=Dy(r,"density");s=Array.from({length:s-1},(_,v)=>w*(v+1)/s)}(n.fill||n.stroke)&&this.plot.getAttribute("colorScale")!=="log"&&this.plot.setAttribute("colorZero",!0);let[a,c]=t,[l,u]=o.getAttribute("xDomain"),[f,d]=o.getAttribute("yDomain"),h=(u-l)/a,p=(d-f)/c,m=+l,g=+f,y=w=>m+w*h,x=w=>g+w*p,b=$a().size(t);return this.data=r.flatMap(w=>s.map(_=>Object.assign(Yet(b.contour(w.density,_),y,x),{...w,density:_}))),this}plotSpecs(){let{type:t,channels:n,densityMap:r,data:i}=this,o={};for(let s of n){let{channel:a}=s;a!=="x"&&a!=="y"&&(o[a]=gi(s))}return r.fill&&(o.fill="density"),r.stroke&&(o.stroke="density"),[{type:t,data:i,options:o}]}};function Yet(e,t,n){function r(s){s.forEach(i)}function i(s){s.forEach(o)}function o(s){s[0]=t(s[0]),s[1]=n(s[1])}return e.coordinates.forEach(r),e}function Fv(e,t){if(typeof document<"u"){let n=document.createElement("canvas");return n.setAttribute("width",e),n.setAttribute("height",t),n}throw new Error("Can not create a canvas instance.")}function FP(e=1){let t=255*e|0;return(n,r,i)=>{for(let o=0,s=0;o<i;++o)for(let a=0;a<r;++a,s+=4)n[s+3]=t}}function RP(e){let{apply:t}=e;return(n,r,i,o)=>{for(let s=0,a=0;s<i;++s)for(let c=0,l=(i-s-1)*r;c<r;++c,a+=4)n[a+3]=255*t(o[c+l])|0}}function $P(e={}){let{r:t=0,g:n=0,b:r=0,opacity:i=1}=typeof e=="string"?nn(e):e,o=new Uint8ClampedArray([t,n,r,255*i|0]);return(s,a,c)=>{for(let l=0,u=0;l<c;++l)for(let f=0;f<a;++f,u+=4)s[u+0]=o[0],s[u+1]=o[1],s[u+2]=o[2],s[u+3]=o[3]}}function PP(e){let{domain:t,range:n}=e,r=Object.create(null),i=new Uint8ClampedArray(4*t.length),o=t.length-1,s=n.length;for(let a=0;a<=o;++a){let c=n[a%s],{r:l,g:u,b:f,opacity:d=1}=typeof c=="string"?nn(c):c,h=a<<2;i[h+0]=l,i[h+1]=u,i[h+2]=f,i[h+3]=255*d|0,r[t[a]]=h}return(a,c,l,u)=>{if(u.map)for(let f=0,d=0;f<l;++f)for(let h=0,p=(l-f-1)*c;h<c;++h,d+=4){let m=r[u[h+p]];a[d+0]=i[m+0],a[d+1]=i[m+1],a[d+2]=i[m+2],a[d+3]=i[m+3]}else{let f=r[u];for(let d=0,h=0;d<l;++d)for(let p=0;p<c;++p,h+=4)a[h+0]=i[f+0],a[h+1]=i[f+1],a[h+2]=i[f+2],a[h+3]=i[f+3]}}}function UP(e,t,n){let{interpolate:r}=t,i=new Uint8ClampedArray(4*e),o=e-1;for(let s=0;s<=o;++s){let a=r(s/o),{r:c,g:l,b:u,opacity:f=1}=typeof a=="string"?nn(a):a,d=s<<2;i[d+0]=c,i[d+1]=l,i[d+2]=u,i[d+3]=255*f|0}return(s,a,c,l)=>{for(let u=0,f=0;u<c;++u)for(let d=0,h=(c-u-1)*a;d<a;++d,f+=4){let p=o*n(l[d+h])<<2;s[f+0]=i[p+0],s[f+1]=i[p+1],s[f+2]=i[p+2],s[f+3]=i[p+3]}}}var xc=class extends Gi{constructor(t,n){super("image",t,n)}setPlot(t,n){let r=()=>{this.stats&&this.rasterize()};t.addAttributeListener("schemeColor",r),super.setPlot(t,n)}convolve(){return super.convolve().rasterize()}rasterize(){let{bins:t,kde:n}=this,[r,i]=t,{canvas:o,ctx:s,img:a}=Het(this,r,i),{alpha:c,alphaProp:l,color:u,colorProp:f}=P3(this);return this.data=n.map(d=>(u?.(a.data,r,i,d[f]),c?.(a.data,r,i,d[l]),s.putImageData(a,0,0),{src:o.toDataURL()})),this}plotSpecs(){let{type:t,plot:n,data:r}=this,i={src:"src",width:n.innerWidth(),height:n.innerHeight(),preserveAspectRatio:"none",imageRendering:this.channel("imageRendering")?.value,frameAnchor:"middle"};return[{type:t,data:r,options:i}]}},Ly=class extends xc{constructor(t,n){super(t,{bandwidth:20,interpolate:"linear",pixelSize:2,...n})}};function P3(e){let{aggr:t,densityMap:n,groupby:r,plot:i}=e,o=t.includes(aa),s=t.includes("fillOpacity"),a=e.channel("fill"),c=e.channel("fillOpacity");if(t.length>2||o&&s)throw new Error("Invalid raster encodings. Try dropping an aggregate?");if(r.includes(c?.as))throw new Error("Raster fillOpacity must be an aggregate or constant.");let l=n.fill||t.includes("fill")?"grid":r.includes(a?.as)?"group":Ov(a?.value)?a.value:o&&i.getAttribute("colorScheme")?"grid":void 0,u=n.fillOpacity||t.includes("fillOpacity")?"grid":typeof c?.value=="number"?c.value:o&&l!=="grid"?"grid":void 0;if(l!=="grid"&&u!=="grid")throw new Error("Raster mark missing density values.");let f=a?.as??(l==="grid"?aa:null),d=c?.as??(u==="grid"?aa:null),h=l!=="grid"&&l!=="group"?$P(l):Get(e,f),p=u!=="grid"?FP(u):Xet(e,d);return{alphaProp:d,colorProp:f,alpha:p,color:h}}function Xet(e,t){let{plot:n,kde:r}=e,i=n.getAttribute("opacityDomain"),o=i===uo,s=i?.[wn],a=!o&&!s&&i||Dy(r,t);(o||s)&&(s&&(a[wn]=!0),n.setAttribute("colorDomain",a));let c=Uf({opacity:{type:n.getAttribute("opacityScale"),domain:a,clamp:n.getAttribute("opacityClamp"),nice:n.getAttribute("opacityNice"),reverse:n.getAttribute("opacityReverse"),zero:n.getAttribute("opacityZero"),base:n.getAttribute("opacityBase"),exponent:n.getAttribute("opacityExponent"),constant:n.getAttribute("opacityConstant")}});return RP(c)}function Get(e,t){let{plot:n,kde:r}=e,i=!r[0][t]?.map,o=i||Array.isArray(r[0][t]),s=n.getAttribute("colorDomain"),a=s===uo,c=s?.[wn],l=!a&&!c&&s||(i?r.map(f=>f[t]).sort(zt):o?CP(r,t):Dy(r,t));(a||c)&&(c&&(l[wn]=!0),n.setAttribute("colorDomain",l));let u=Uf({color:{type:n.getAttribute("colorScale"),domain:l,range:n.getAttribute("colorRange"),clamp:n.getAttribute("colorClamp"),n:n.getAttribute("colorN"),nice:n.getAttribute("colorNice"),reverse:n.getAttribute("colorReverse"),scheme:n.getAttribute("colorScheme"),interpolate:n.getAttribute("colorInterpolate"),pivot:n.getAttribute("colorPivot"),symmetric:n.getAttribute("colorSymmetric"),zero:n.getAttribute("colorZero"),base:n.getAttribute("colorBase"),exponent:n.getAttribute("colorExponent"),constant:n.getAttribute("colorConstant")}});if(o)return PP(u);{let f=Uf({x:{type:Wet(u.type),domain:u.domain,reverse:u.reverse,range:[0,1],clamp:u.clamp,base:u.base,exponent:u.exponent,constant:u.constant}});return UP(1024,u,f.apply)}}function Wet(e){return e.endsWith("symlog")?"symlog":e.endsWith("log")?"log":e.endsWith("pow")?"pow":e.endsWith("sqrt")?"sqrt":e==="diverging"?"linear":e}function Het(e,t,n){if(!e.image||e.image.w!==t||e.image.h!==n){let r=Fv(t,n),i=r.getContext("2d",{willReadFrequently:!0}),o=i.getImageData(0,0,t,n);e.image={canvas:r,ctx:i,img:o,w:t,h:n}}return e.image}var Cy=class extends xc{constructor(t,n){let{normalize:r=!0,...i}=n;super(t,i),Dn(this,"normalize",r)}query(t=[]){let{channels:n,normalize:r,source:i,binPad:o}=this,[s,a]=this.bins=this.binDimensions(this),[c]=Xr(this,"x",s,Vo(this,t),o),[l]=Xr(this,"y",a,Yo(this,t),o),u=yt.from(i.table).where(Zet(this,t));this.aggr=["density"];let f=this.groupby=[],d=[];for(let h of n)if(Object.hasOwn(h,"field")){let{channel:p,field:m}=h;p==="z"?(u.select({[p]:m}),d.push("z")):p!=="x"&&p!=="y"&&(u.select({[p]:m}),f.push(p))}return Jet(u,c,l,d,s,a,f,r)}};function Zet(e,t){if(Array.isArray(t)&&!t.length)return t;let n=e.channelField("x").field.column,r=e.channelField("y").field.column,i=s=>s.op!=="BETWEEN"||s.field.column!==n&&s.field.column!==r,o=s=>s.op==="AND"?Yn(s.children.filter(a=>i(a))):s;return Array.isArray(t)?t.filter(s=>i(s)).map(s=>o(s)):o(t)}function Jet(e,t,n,r,i,o,s=[],a=!0){e.select({x:j`FLOOR(${t})::INTEGER`,y:j`FLOOR(${n})::INTEGER`});let c=s.concat(r),l=c.length?`PARTITION BY ${c.join(", ")} `:"",u=yt.from(e).select(c,{x0:"x",y0:"y",dx:j`(lead(x) OVER sw - x)`,dy:j`(lead(y) OVER sw - y)`}).window({sw:j`${l}ORDER BY x ASC`}).qualify(Yn(j`(x0 < ${i} OR x0 + dx < ${i})`,j`(y0 < ${o} OR y0 + dy < ${o})`,j`(x0 > 0 OR x0 + dx > 0)`,j`(y0 > 0 OR y0 + dy > 0)`)),f=yt.select({x:j`GREATEST(MAX(ABS(dx)), MAX(ABS(dy)))`}).from("pairs"),d=yt.select({i:j`UNNEST(range((${f})))::INTEGER`}),h=yt.unionAll(yt.select(c,{x:j`x0 + i`,y:j`y0 + ROUND(i * dy / dx::FLOAT)::INTEGER`}).from("pairs","indices").where(j`ABS(dy) <= ABS(dx) AND i < ABS(dx)`),yt.select(c,{x:j`x0 + ROUND(SIGN(dy) * i * dx / dy::FLOAT)::INTEGER`,y:j`y0 + SIGN(dy) * i`}).from("pairs","indices").where(j`ABS(dy) > ABS(dx) AND i < ABS(dy)`),yt.select(c,{x:"x0",y:"y0"}).from("pairs").where(zc("dx"))),p=["x"].concat(c).join(", "),m=yt.from("raster").select(c,"x","y",a?{w:j`1.0 / COUNT(*) OVER (PARTITION BY ${p})`}:null).where(Yn(Ie("x",[0,i],!0),Ie("y",[0,o],!0)));return yt.with({pairs:u,indices:d,raster:h,points:m}).from("points").select(s,{index:j`x + y * ${i}::INTEGER`,density:a?kr("w"):Cr()}).groupby("index",s)}var xd=class extends Nn{constructor(t,n,r){let{bins:i=1024,bandwidth:o=20,...s}=r,a=t.endsWith("X")?"y":"x";super(t,n,s,a==="x"?k3:F3),this.dim=a,Dn(this,"bins",i),Dn(this,"bandwidth",o,()=>this.grid?this.convolve().update():null)}get filterIndexable(){let t=this.dim==="x"?"xDomain":"yDomain",n=this.plot.getAttribute(t);return n&&!n[wn]}query(t=[]){if(this.hasOwnData())throw new Error("Density1DMark requires a data source");let{bins:n,channels:r,dim:i,source:{table:o}}=this,s=this.extent=(i==="x"?Vo:Yo)(this,t),[a,c]=Xr(this,i,n,s),l=C3(r,o,[i]).where(t.concat(Ie(c,s))),u=this.channelField("weight")?"weight":null;return Qet(l,a,u)}queryResult(t){return this.grid=OP(this.bins,t),this.convolve()}convolve(){let{bins:t,bandwidth:n,dim:r,grid:i,plot:o,extent:[s,a]}=this,c=i.some(x=>x<0),l=r==="x"?o.innerWidth():o.innerHeight(),u=Oy(n*(t-1)/l,c),f=kv(u,i,t),d=this.data=[],h=r==="x"?"y":"x",p=this.channelField(r).as,m=+s,g=(a-m)/(t-1),y=1/g;for(let x=0;x<t;++x)d.push({[p]:m+x*g,[h]:f[x]*y});return this}plotSpecs(){let{type:t,data:n,channels:r,dim:i}=this,o=i==="x"?{y:"y"}:{x:"x"};for(let s of r)o[s.channel]=gi(s);return[{type:t,data:n,options:o}]}};function Qet(e,t,n){let r=n?`* ${n}`:"",i=e.clone().select({p:t,i:j`FLOOR(p)::INTEGER`,w:j`(FLOOR(p) + 1 - p)${r}`}),o=e.clone().select({p:t,i:j`FLOOR(p)::INTEGER + 1`,w:j`(p - FLOOR(p))${r}`});return yt.from(yt.unionAll(i,o)).select({index:"i",density:kr("w")}).groupby("index").having(Uh("density",0))}var ky=class extends Gi{constructor(t,n){let{type:r="dot",...i}=n;super(r,t,{bandwidth:20,interpolate:"linear",pad:0,pixelSize:2,...i})}convolve(){super.convolve();let{bins:t,pad:n,extentX:r,extentY:i}=this,[o,s]=t,a=Vl(this,"x"),c=Vl(this,"y"),[l,u]=r.map(g=>a.apply(g)),[f,d]=i.map(g=>c.apply(g)),h=(u-l)/(o-n),p=(d-f)/(s-n),m=n?0:.5;return this.data=Ket(this.kde,t,l,f,h,p,a.invert,c.invert,m),this}plotSpecs(){let{type:t,channels:n,densityMap:r,data:i}=this,o={};for(let s of n){let{channel:a}=s;o[a]=a==="x"||a==="y"?a:gi(s)}for(let s in r)r[s]&&(o[s]="density");return[{type:t,data:i,options:o}]}};function Ket(e,t,n,r,i,o,s,a,c){let l=1/(i*o),[u,f]=t,d=[];for(let h of e){let p=h.density;for(let m=0,g=0;g<f;++g)for(let y=0;y<u;++y,++m)d.push({...h,x:s(n+(y+c)*i),y:a(r+(g+c)*o),density:p[m]*l})}return d}var tnt="geom",Fy=class extends Nn{constructor(t,n={},r){!Lv(t)&&!n?.geometry&&(n.geometry=Vh(tnt)),super("geo",t,n,r)}queryResult(t){super.queryResult(t);let n=this.channelField("geometry")?.as;return n&&this.data&&this.data.forEach(r=>{typeof r[n]=="string"&&(r[n]=JSON.parse(r[n]))}),this}};var Ry=class extends Nn{constructor(t,n){let{type:r="hexagon",binWidth:i=20,...o}=n;super(r,t,{r:i/2,clip:!0,...o},Cv),this.binWidth=i}get filterIndexable(){let t=this.plot.getAttribute("xDomain"),n=this.plot.getAttribute("yDomain");return t&&n&&!t[wn]&&!n[wn]}query(t=[]){if(this.hasOwnData())return null;let{plot:n,binWidth:r,channels:i,source:o}=this,[s,a]=Vo(this,t),[c,l]=Yo(this,t),u=.5-n.getAttribute("marginLeft"),f=0-n.getAttribute("marginTop"),d=`${r}::DOUBLE`,h=`${r*(1.5/Math.sqrt(3))}::DOUBLE`,p=`${n.innerWidth()/(a-s)}::DOUBLE`,m=`${n.innerHeight()/(l-c)}::DOUBLE`,g,y,x=new Set,b={};for(let E of i)E.channel==="orderby"?w.orderby(E.value):E.channel==="x"?g=E:E.channel==="y"?y=E:Object.hasOwn(E,"field")&&(b[E.as]=E.field,E.field.aggregate&&E.field.columns.forEach(D=>x.add(D)));let w=yt.select({[g.as]:j`${s}::DOUBLE + ((x + 0.5 * (y & 1)) * ${d} + ${u})::DOUBLE / ${p}`,[y.as]:j`${l}::DOUBLE - (y * ${h} + ${f})::DOUBLE / ${m}`,...b}).groupby("x","y"),_=`${p} * (${g.field} - ${s}::DOUBLE)`,v=`${m} * (${l}::DOUBLE - ${y.field})`,M=yt.select({py:j`(${v} - ${f}) / ${h}`,pj:j`ROUND(py)::INTEGER`,px:j`(${_} - ${u}) / ${d} - 0.5 * (pj & 1)`,pi:j`ROUND(px)::INTEGER`,tt:j`ABS(py-pj) * 3 > 1 AND (px-pi)**2 + (py-pj)**2 > (px - pi - 0.5 * CASE WHEN px < pi THEN -1 ELSE 1 END)**2 + (py - pj - CASE WHEN py < pj THEN -1 ELSE 1 END)**2`,x:j`CASE WHEN tt THEN (pi + (CASE WHEN px < pi THEN -0.5 ELSE 0.5 END) + (CASE WHEN pj & 1 <> 0 THEN 0.5 ELSE -0.5 END))::INTEGER ELSE pi END`,y:j`CASE WHEN tt THEN (pj + CASE WHEN py < pj THEN -1 ELSE 1 END)::INTEGER ELSE pj END`}).select(Array.from(x)).from(o.table).where(bs(g.field),bs(y.field),t);return w.from(M)}};var $y=class extends Gi{constructor(t,n){let{origin:r=[0,0],dim:i="xy",...o}=n;super("image",t,o),this.origin=r,this.tileX=i.toLowerCase().includes("x"),this.tileY=i.toLowerCase().includes("y")}setPlot(t,n){let r=()=>{this.stats&&this.rasterize()};t.addAttributeListener("schemeColor",r),super.setPlot(t,n)}requestQuery(){return this.requestTiles()}query(t=[]){return this._filter=t,null}tileQuery(t){let{binType:n,binPad:r,channels:i,densityMap:o,source:s}=this,[[a,c],[l,u]]=t,[f,d]=this.bins,[h,p]=Xr(this,"x",f,[a,c],r),[m,g]=Xr(this,"y",d,[l,u],r),y=r?[Ie(p,[+a,+c]),Ie(g,[+l,+u])]:[_s(+a,p),vs(p,+c),_s(+l,g),vs(g,+u)],x=yt.from(s.table).where(y),b=this.groupby=[],w={};for(let v of i)if(Object.hasOwn(v,"field")){let{as:M,channel:E,field:D}=v;D.aggregate?(w[E]=D,o[E]=!0):E==="weight"?w.density=kr(D):E!=="x"&&E!=="y"&&(x.select({[M]:D}),b.push(M))}let _=this.aggr=Object.keys(w);if(w.density&&_.length>1)throw new Error("Weight option can not be used with custom aggregates.");if(_.length||(_.push("density"),w.density=Cr()),n==="linear"){if(_.length>1)throw new Error("Linear binning not applicable to multiple aggregates.");if(!w.density)throw new Error("Linear binning not applicable to custom aggregates.");return ont(x,h,m,w.density,f,b)}else return int(x,h,m,w,f,b)}async requestTiles(){let t=ei();this.prefetch&&t.cancel(this.prefetch);let{binPad:n,tileX:r,tileY:i,origin:[o,s]}=this,[a,c]=this.bins=this.binDimensions(this),[l,u]=Vo(this,this._filter),[f,d]=Yo(this,this._filter),h=u-l,p=d-f,m=Math.floor((l-o)*(a-n)/h),g=Math.floor((f-s)*(c-n)/p),y=(I,T)=>[[o+I*h,o+(I+1)*h],[s+T*p,s+(T+1)*p]],x=Math.floor((l-o)/h),b=r?zP((u-o)/h):x,w=Math.floor((f-s)/p),_=i?zP((d-s)/p):w,v=[];for(let I=x;I<=b;++I)for(let T=w;T<=_;++T)v.push([I,T]);let M=v.map(([I,T])=>t.query(this.tileQuery(y(I,T)))),E=[];if(r)for(let I=w;I<=_;++I)E.push([b+1,I]),E.push([x-1,I]);if(i){let I=r?x-1:x,T=r?b+1:b;for(let O=I;O<=T;++O)E.push([O,_+1]),E.push([O,w-1])}this.prefetch=E.map(([I,T])=>t.prefetch(this.tileQuery(y(I,T))));let D=await Promise.all(M);this.grids=[{density:ent(a,c,m,g,v,D)}],this.convolve().update()}convolve(){return super.convolve().rasterize()}rasterize(){let{bins:t,kde:n}=this,[r,i]=t,{canvas:o,ctx:s,img:a}=rnt(this,r,i),{alpha:c,alphaProp:l,color:u,colorProp:f}=P3(this);return this.data=n.map(d=>(u?.(a.data,r,i,d[f]),c?.(a.data,r,i,d[l]),s.putImageData(a,0,0),{src:o.toDataURL()})),this}plotSpecs(){let{type:t,data:n,plot:r}=this,i={src:"src",width:r.innerWidth(),height:r.innerHeight(),preserveAspectRatio:"none",imageRendering:this.channel("imageRendering")?.value,frameAnchor:"middle"};return[{type:t,data:n,options:i}]}};function ent(e,t,n,r,i,o){let s=new Float64Array(e*t);return o.forEach((a,c)=>{let[l,u]=i[c],f=l*e-n,d=u*t-r;nnt(e,t,s,a,f,d)}),s}function nnt(e,t,n,r,i,o){let s=r.numRows;if(s===0)return;let a=r.getChild("index").toArray(),c=r.getChild("density").toArray();for(let l=0;l<s;++l){let u=a[l],f=i+u%e,d=o+Math.floor(u/e);0<=f&&f<e&&0<=d&&d<t&&(n[f+d*e]=c[l])}}function rnt(e,t,n){if(!e.image||e.image.w!==t||e.image.h!==n){let r=Fv(t,n),i=r.getContext("2d",{willReadFrequently:!0}),o=i.getImageData(0,0,t,n);e.image={canvas:r,ctx:i,img:o,w:t,h:n}}return e.image}function int(e,t,n,r,i,o){return e.select({index:j`FLOOR(${t})::INTEGER + FLOOR(${n})::INTEGER * ${i}`,...r}).groupby("index",o)}function ont(e,t,n,r,i,o){let s=r.column?`* ${r.column}`:"",a=(d,h)=>e.clone().select({xp:t,yp:n,i:d,w:h}),c=a(j`FLOOR(xp)::INTEGER + FLOOR(yp)::INTEGER * ${i}`,j`(FLOOR(xp)::INTEGER + 1 - xp) * (FLOOR(yp)::INTEGER + 1 - yp)${s}`),l=a(j`FLOOR(xp)::INTEGER + (FLOOR(yp)::INTEGER + 1) * ${i}`,j`(FLOOR(xp)::INTEGER + 1 - xp) * (yp - FLOOR(yp)::INTEGER)${s}`),u=a(j`FLOOR(xp)::INTEGER + 1 + FLOOR(yp)::INTEGER * ${i}`,j`(xp - FLOOR(xp)::INTEGER) * (FLOOR(yp)::INTEGER + 1 - yp)${s}`),f=a(j`FLOOR(xp)::INTEGER + 1 + (FLOOR(yp)::INTEGER + 1) * ${i}`,j`(xp - FLOOR(xp)::INTEGER) * (yp - FLOOR(yp)::INTEGER)${s}`);return yt.from(yt.unionAll(c,l,u,f)).select({index:"i",density:kr("w")},o).groupby("index",o).having(qc("density",0))}function zP(e){let t=Math.floor(e);return t===e?t-1:t}function snt(e,t,n){var r=1e-8,i=t-1,o=n-1,s=0,a,c,l,u,f,d,h,p,m,g,y;if(e<=0)return 0;if(e>=1)return 1;for(t>=1&&n>=1?(l=e<.5?e:1-e,u=Math.sqrt(-2*Math.log(l)),h=(2.30753+u*.27061)/(1+u*(.99229+u*.04481))-u,e<.5&&(h=-h),p=(h*h-3)/6,m=2/(1/(2*t-1)+1/(2*n-1)),g=h*Math.sqrt(p+m)/m-(1/(2*n-1)-1/(2*t-1))*(p+5/6-2/(3*m)),h=t/(t+n*Math.exp(2*g))):(a=Math.log(t/(t+n)),c=Math.log(n/(t+n)),u=Math.exp(t*a)/t,f=Math.exp(n*c)/n,g=u+f,e<u/g?h=Math.pow(t*g*e,1/t):h=1-Math.pow(n*g*(1-e),1/n)),y=-bd(t)-bd(n)+bd(t+n);s<10;s++){if(h===0||h===1)return h;if(d=ant(h,t,n)-e,u=Math.exp(i*Math.log(h)+o*Math.log(1-h)+y),f=d/u,h-=u=f/(1-.5*Math.min(1,f*(i/h-o/(1-h)))),h<=0&&(h=.5*(h+u)),h>=1&&(h=.5*(h+u+1)),Math.abs(u)<r*h&&s>0)break}return h}function ant(e,t,n){var r=e===0||e===1?0:Math.exp(bd(t+n)-bd(t)-bd(n)+t*Math.log(e)+n*Math.log(1-e));return e<0||e>1?!1:e<(t+1)/(t+n+2)?r*qP(e,t,n)/t:1-r*qP(1-e,n,t)/n}function qP(e,t,n){var r=1e-30,i=1,o=t+n,s=t+1,a=t-1,c=1,l=1-o*e/s,u,f,d,h;for(Math.abs(l)<r&&(l=r),l=1/l,h=l;i<=100&&(u=2*i,f=i*(n-i)*e/((a+u)*(t+u)),l=1+f*l,Math.abs(l)<r&&(l=r),c=1+f/c,Math.abs(c)<r&&(c=r),l=1/l,h*=l*c,f=-(t+i)*(o+i)*e/((t+u)*(s+u)),l=1+f*l,Math.abs(l)<r&&(l=r),c=1+f/c,Math.abs(c)<r&&(c=r),l=1/l,d=l*c,h*=d,!(Math.abs(d-1)<3e-7));i++);return h}function bd(e){var t=0,n=[76.18009172947146,-86.5053203294167,24.01409824083091,-1.231739572450155,.001208650973866179,-5395239384953e-18],r=1.000000000190015,i,o,s;for(s=(o=i=e)+5.5,s-=(i+.5)*Math.log(s);t<6;t++)r+=n[t]/++o;return Math.log(2.506628274631*r/i)-s}function jP(e,t){var n=snt(2*Math.min(e,1-e),.5*t,.5);return n=Math.sqrt(t*(1-n)/n),e>.5?n:-n}var Py=class extends Nn{constructor(t,n){let{ci:r=.95,precision:i=4,...o}=n;super("line",t,o);let s=()=>this.modelFit?this.confidenceBand().update():null;Dn(this,"ci",r,s),Dn(this,"precision",i,s)}query(t=[]){let n=this.channelField("x").as,r=this.channelField("y").as,i=Array.from(new Set(["stroke","z","fx","fy"].flatMap(o=>this.channelField(o)?.as||[])));return yt.from(super.query(t)).select({intercept:cS(r,n),slope:lS(r,n),n:uS(r,n),ssy:fS(r,n),ssx:dS(r,n),xm:hS(r,n),x0:Iu(ti(n).where(bs(r))),x1:Iu(Kr(n).where(bs(r)))}).select(i).groupby(i)}queryResult(t){return this.modelFit=Bv(t),this.lineData=this.modelFit.flatMap(n=>cnt(n)),this.confidenceBand()}confidenceBand(){let{ci:t,modelFit:n,precision:r,plot:i}=this,o=i.innerWidth();return this.areaData=t?n.flatMap(s=>lnt(t,r,s,o)):null,this}plotSpecs(){let{lineData:t,areaData:n,channels:r,ci:i}=this,o={x:"x",y:"y"},s={x:"x",y1:"y1",y2:"y2",fillOpacity:.1};for(let a of r)switch(a.channel){case"x":case"y":case"fill":break;case"stroke":o.stroke=s.fill=gi(a);break;case"strokeOpacity":o.strokeOpacity=gi(a);break;case"fillOpacity":s.fillOpacity=gi(a);break;default:o[a.channel]=s[a.channel]=gi(a);break}return[...i?[{type:"areaY",data:n,options:s}]:[],{type:"line",data:t,options:o}]}};function cnt(e){let{x0:t,x1:n,xm:r,intercept:i,slope:o,n:s,ssx:a,ssy:c,...l}=e;return[{x:t,y:i+t*o,...l},{x:n,y:i+n*o,...l}]}function lnt(e,t,n,r){let{x0:i,x1:o,xm:s,intercept:a,slope:c,n:l,ssx:u,ssy:f,...d}=n,h=t*(o-i)/r,p=jP((1-e)/2,l-2)*Math.sqrt(f/(l-2));return Pe(i,o-h/2,h).concat(o).map(m=>{let g=a+m*c,y=p*Math.sqrt(1/l+(m-s)**2/u);return{x:m,y1:g-y,y2:g+y,...d}})}function VP(e){let t=e.toLowerCase(),n=e.length,r="";for(let i=0;i<n;++i)r+=(e[i]!==t[i]?"-":"")+t[i];return r}function wd(e){let t={};for(let n in e)t[VP(n)]=e[n];return t}function unt(e){let{channels:t}=e,n=new Set,r=!1,i=!1;for(let o of t){let{channel:s,field:a,as:c}=o;if(s==="orderby")r=!0;else if(a)if(a.aggregate)i=!0;else{if(n.has(c))continue;n.add(c)}}return!r&&i&&n.size&&e.channels.push({channel:"orderby",value:Array.from(n)}),e}var Uy=class{constructor(t,{selection:n,channels:r={}}){this.mark=unt(t),this.selection=n;let i=Object.entries(wd(r));this.channels=i.length?i:[["opacity",.2]],this.selection.addEventListener("value",Fd(()=>this.update()))}init(t){this.svg=t;let n=this.values=[],r=this.mark.index,i=this.nodes=t.querySelectorAll(`[data-index="${r}"] > *`),{channels:o}=this;for(let s=0;s<i.length;++s){let a=i[s];n.push(o.map(c=>a.getAttribute(c[0])))}return this.update()}async update(){let{svg:t,nodes:n,channels:r,values:i,mark:o,selection:s}=this;if(!t)return;let a=await fnt(o,s);for(let c=0;c<n.length;++c){let l=n[c],u=i[c],f=a(l.__data__);for(let d=0;d<r.length;++d){let[h,p]=r[d];l.setAttribute(h,f?u[d]:p)}}}};async function fnt(e,t){let n=t?.predicate(e);if(!n||n.length===0)return()=>!0;let r=e.filterBy?.predicate(e,!0),i={__:Yn(n)},o=e.query(r),s=o.groupby().length?o.select(i):o.$select(i),a=await e.coordinator.query(s),c=a.getChild?.("__");return a.numRows||a.length?c?l=>c.get(l):l=>a[l].__:()=>!1}function U3(e){let t=e.on,n=!0;function r(i){n=!1,i(),n=!0}return e.reset=(...i)=>{r(()=>e.clear(...i))},e.moveSilent=(...i)=>{r(()=>e.move(...i))},e.on=(...i)=>{if(i.length>1&&i[1]){let o=i[1];i[1]=(...s)=>n&&o(...s)}return t(...i)},e}function YP(){return U3(gI())}function XP(){return U3(mI())}function GP(){return U3(yI())}function zy(e,t){return e===t||e&&t&&Math.abs(e[0]-t[0])<1e-12&&Math.abs(e[1]-t[1])<1e-12||!1}function Xo(e,t){let n=e.channelField(t)?.field;return n?.basis||n}function qy(e,t,n=1){return t.invert(n*Math.floor(e/n))}function Rv(){let e=this,t=e.getScreenCTM,n;e.getScreenCTM=()=>e.isConnected?n=t.call(e):n}var vd=class{constructor(t,{channel:n,selection:r,field:i,pixelSize:o=1,peers:s=!0,brush:a}){this.mark=t,this.channel=n,this.pixelSize=o||1,this.selection=r,this.peers=s,this.field=i||Xo(t,[n,n+"1",n+"2"]),this.style=a&&wd(a),this.brush=n==="y"?GP():XP(),this.brush.on("brush end",({selection:c})=>this.publish(c))}reset(){this.value=void 0,this.g&&this.brush.reset(this.g)}activate(){this.selection.activate(this.clause(this.value||[0,1]))}publish(t){let n;t&&(n=t.map(r=>qy(r,this.scale,this.pixelSize)).sort((r,i)=>r-i)),zy(n,this.value)||(this.value=n,this.g.call(this.brush.moveSilent,t),this.selection.update(this.clause(n)))}clause(t){let{mark:n,pixelSize:r,field:i,scale:o}=this;return{source:this,schema:{type:"interval",pixelSize:r,scales:[o]},clients:this.peers?n.plot.markSet:new Set().add(n),value:t,predicate:t?Ie(i,t):null}}init(t){let{brush:n,channel:r,style:i}=this;this.scale=t.scale(r);let o=t.scale("x").range,s=t.scale("y").range;n.extent([[ce(o),ce(s)],[Gt(o),Gt(s)]]);let a=jt(t).selectAll('g[aria-label="facet"]'),c=a.size()?a:jt(t);if(this.g=c.append("g").attr("class",`interval-${r}`).each(Rv).call(n).call(n.moveSilent,this.value?.map(this.scale.apply)),i){let l=this.g.selectAll("rect.selection");for(let u in i)l.attr(u,i[u])}t.addEventListener("pointerenter",()=>this.activate())}};var $v=(e,t)=>e-t,jy=class{constructor(t,{selection:n,xfield:r,yfield:i,pixelSize:o=1,peers:s=!0,brush:a}){this.mark=t,this.pixelSize=o||1,this.selection=n,this.peers=s,this.xfield=r||Xo(t,["x","x1","x2"]),this.yfield=i||Xo(t,["y","y1","y2"]),this.style=a&&wd(a),this.brush=YP(),this.brush.on("brush end",({selection:c})=>this.publish(c))}reset(){this.value=void 0,this.g&&this.brush.reset(this.g)}activate(){this.selection.activate(this.clause(this.value||[[0,1],[0,1]]))}publish(t){let{value:n,pixelSize:r,xscale:i,yscale:o}=this,s,a;if(t){let[c,l]=t;s=[c[0],l[0]].map(u=>qy(u,i,r)).sort($v),a=[c[1],l[1]].map(u=>qy(u,o,r)).sort($v)}(!zy(s,n?.[0])||!zy(a,n?.[1]))&&(this.value=t?[s,a]:void 0,this.g.call(this.brush.moveSilent,t),this.selection.update(this.clause(this.value)))}clause(t){let{mark:n,pixelSize:r,xfield:i,yfield:o,xscale:s,yscale:a}=this;return{source:this,schema:{type:"interval",pixelSize:r,scales:[s,a]},clients:this.peers?n.plot.markSet:new Set().add(n),value:t,predicate:t?Yn(Ie(i,t[0]),Ie(o,t[1])):null}}init(t){let{brush:n,style:r}=this,i=this.xscale=t.scale("x"),o=this.yscale=t.scale("y"),s=i.range,a=o.range;n.extent([[ce(s),ce(a)],[Gt(s),Gt(a)]]);let c=jt(t).selectAll('g[aria-label="facet"]'),l=c.size()?c:jt(t);if(this.g=l.append("g").attr("class","interval-xy").each(Rv).call(n),r){let u=this.g.selectAll("rect.selection");for(let f in r)u.attr(f,r[f])}if(this.value){let[u,f]=this.value[0].map(i.apply).sort($v),[d,h]=this.value[1].map(o.apply).sort($v);this.g.call(n.moveSilent,[[u,d],[f,h]])}t.addEventListener("pointerenter",()=>this.activate())}};var _d=class{constructor(t,{selection:n,channel:r,field:i}){this.mark=t,this.selection=n,this.clients=new Set().add(t),this.channel=r,this.field=i||Xo(t,[r])}clause(t){let{clients:n,field:r}=this,i=t?ws(r,Lr(t)):null;return{source:this,schema:{type:"point"},clients:n,value:t,predicate:i}}init(t){let n=this,{mark:r,channel:i,selection:o}=this,{data:s}=r,a=r.channelField(i).as,c=jt(t).selectAll('g[aria-label="facet"]'),l=c.size()?c:jt(t),u=t.scale(i),f=!ni(o);l.on("pointerdown pointermove",function(d){let[h,p]=Ln(d,this),m=dnt(s,a,u.invert(i==="x"?h:p));o.update(f?m:n.clause(m))}),!f&&t.addEventListener("pointerenter",()=>{this.selection.activate(this.clause(0))})}};function dnt(e,t,n){let r=1/0,i;return e.forEach(o=>{let s=Math.abs(o[t]-n);s<r&&(r=s,i=o[t])}),i}var WP=(e,t)=>e-t,Vy=class{constructor(t,{x:n=new Ss,y:r=new Ss,xfield:i,yfield:o,zoom:s=!0,panx:a=!0,pany:c=!0}){this.mark=t,this.xsel=n,this.ysel=r,this.xfield=i||Xo(t,["x","x1","x2"]),this.yfield=o||Xo(t,["y","y1","y2"]),this.zoom=z3(s,[0,1/0],[1,1]),this.panx=this.xsel&&a,this.pany=this.ysel&&c;let{plot:l}=t;a&&this.xsel.addEventListener("value",u=>{l.setAttribute("xDomain",u)&&l.update()}),c&&this.ysel.addEventListener("value",u=>{l.setAttribute("yDomain",u)&&l.update()})}publish(t){if(this.panx){let n=hnt(t,this.xscale);this.xsel.update(this.clause(n,this.xfield,this.xscale))}if(this.pany){let n=pnt(t,this.yscale);this.ysel.update(this.clause(n,this.yfield,this.yscale))}}clause(t,n,r){return{source:this,schema:{type:"interval",scales:[r]},clients:this.mark.plot.markSet,value:t,predicate:t?Ie(n,t):null}}init(t){if(this.svg=t,this.initialized)return;this.initialized=!0;let{panx:n,pany:r,mark:{plot:{element:i}},xsel:o,ysel:s}=this;this.xscale=t.scale("x"),this.yscale=t.scale("y");let a=this.xscale.range.slice().sort(WP),c=this.yscale.range.slice().sort(WP),l=z3(n,[-1/0,1/0],a),u=z3(r,[-1/0,1/0],c),f=LA().extent([[a[0],c[0]],[a[1],c[1]]]).scaleExtent(this.zoom).translateExtent([[l[0],u[0]],[l[1],u[1]]]).on("start",()=>{this.xscale=this.svg.scale("x"),this.yscale=this.svg.scale("y")}).on("end",()=>i.__zoom=new zr(1,0,0)).on("zoom",({transform:d})=>this.publish(d));if(jt(i).call(f),n||r){let d=!1;i.addEventListener("mouseenter",()=>{if(!d){if(d=!0,n){let{xscale:h,xfield:p}=this;o.activate(this.clause(h.domain,p,h))}if(r){let{yscale:h,yfield:p}=this;s.activate(this.clause(h.domain,p,h))}}}),i.addEventListener("mouseleave",()=>d=!1)}}};function z3(e,t,n){return e?Array.isArray(e)?e:t:n}function hnt(e,t){return t.range.map(e.invertX,e).map(t.invert,t)}function pnt(e,t){return t.range.map(e.invertY,e).map(t.invert,t)}var Yl=class{constructor(t,{selection:n,channels:r,peers:i=!0}){this.value=null,this.mark=t,this.selection=n,this.peers=i,this.channels=r.map(o=>{let s=o==="color"?["fill","stroke"]:o==="x"?["x","x1","x2"]:o==="y"?["y","y1","y2"]:[o];for(let a=0;a<s.length;++a){let c=t.channelField(s[a]);if(c)return{field:c.field?.basis||c.field,as:c.as}}throw new Error(`Missing channel: ${o}`)})}clause(t){let{channels:n,mark:r}=this,i=null;if(t){let o=t.map(s=>{let a=s.map((c,l)=>zh(n[l].field,Lr(c)));return a.length>1?Yn(a):a[0]});i=o.length>1?Uc(o):o[0]}return{source:this,schema:{type:"point"},clients:this.peers?r.plot.markSet:new Set().add(r),value:t,predicate:i}}init(t,n,r){let{mark:i,channels:o,selection:s}=this,{data:a}=i;r=r||(l=>{let u=a[l.__data__];return o.map(f=>u[f.as])}),n=n||`[data-index="${i.index}"]`;let c=new Set(t.querySelectorAll(n));t.addEventListener("pointerdown",l=>{let u=s.single?s.value:this.value,f=l.target,d=null;if(mnt(c,f)){let h=r(f);l.shiftKey&&u?.length?(d=u.filter(p=>q3(p,h)),d.length===u.length&&d.push(h)):u?.length===1&&!q3(u[0],h)?d=null:d=[h]}this.value=d,ynt(u,d)&&s.update(this.clause(d))}),t.addEventListener("pointerenter",()=>{this.selection.activate(this.clause([this.channels.map(()=>0)]))})}};function mnt(e,t){return e.has(t)||e.has(t.parentNode)||e.has(t.parentNode?.parentNode)}function ynt(e,t){return e==null||t==null?e!=null||t!=null:e.length!==t.length||e.some((n,r)=>q3(n,t[r]))}function q3(e,t){let n=e.length;if(t.length!==n)return!0;for(let r=0;r<n;++r)if(e[r]!==t[r])return!0;return!1}var Sd=class{constructor(t,n){let{as:r,...i}=n;this.channel=t,this.options={label:null,...i},this.selection=r,this.element=document.createElement("div"),this.element.setAttribute("class","legend"),this.element.value=this}setPlot(t){let{channel:n,selection:r}=this,i=gnt(t,n);this.selection&&i&&(this.handler=new Yl(i,{selection:r,channels:[n]}),this.selection.addEventListener("value",()=>this.update()))}init(t){let{channel:n,options:r,handler:i}=this,s=t.scale(n).type==="ordinal"?r:{marginTop:1,tickSize:2,height:28,...r};return this.legend=t.legend(n,s),i&&(i.init(this.legend,":scope > div",a=>[a.__data__]),this.update()),this.element.replaceChildren(this.legend),this.element}update(){if(!this.legend)return;let{value:t}=this.selection,n=t&&t.length?new Set(t.map(i=>i[0])):null,r=this.legend.querySelectorAll(":scope > div");for(let i of r){let o=n?n.has(i.__data__):!0;i.style.opacity=o?1:.2}}};function gnt({marks:e},t){let n=t==="color"?["fill","stroke"]:t==="opacity"?["opacity","fillOpacity","strokeOpacity"]:null;if(n==null)return null;for(let r=e.length-1;r>-1;--r)if(e[r].channelField(n))return e[r];return null}var xnt=new Set(["rectY-x","rectX-y","rect-x","rect-y"]);function Pv(e,t={steps:25}){let n=(r,i)=>xnt.has(`${r.type}-${i}`)?{[`${i}1`]:j3(r,i,e,t),[`${i}2`]:j3(r,i,e,{...t,offset:1})}:{[i]:j3(r,i,e,t)};return n[Zh]=!0,n}function j3(e,t,n,r){return{column:n,label:n,get stats(){return["min","max"]},get columns(){return[n]},get basis(){return n},toString(){let{apply:i,sqlApply:o,sqlInvert:s}=Vl(e,t),{min:a,max:c}=e.stats[n],l=bnt(i(a),i(c),r),u=o(n),f=l.min===0?u:`(${u} - ${l.min})`,d=`${(l.max-l.min)/l.steps}::DOUBLE`,h=r.offset?`${r.offset} + `:"",p=`${l.min} + ${d} * (${h}FLOOR(${f} / ${d}))`;return`${s(p)}`}}}function bnt(e,t,n){let{steps:r=25,minstep:i=0,nice:o=!0}=n;if(o!==!1){let s=t-e,a=r,c=Math.LN10,l=Math.ceil(Math.log(a)/c),u=Math.max(i,Math.pow(10,Math.round(Math.log(s)/c)-l));for(;Math.ceil(s/u)>a;)u*=10;let f=[5,2],d;for(let m=0,g=f.length;m<g;++m)d=u/f[m],d>=i&&s/d<=a&&(u=d);d=Math.log(u);let h=d>=0?0:~~(-d/c)+1,p=Math.pow(10,-h-1);d=Math.floor(e/u+p)*u,e=e<d?d-u:d,t=Math.ceil(t/u)*u,r=Math.round((t-e)/u)}return{min:e,max:t,steps:r}}var wnt=e=>e&&typeof e=="object"&&!Array.isArray(e);var Yy=class extends ar{constructor({element:t,filterBy:n,from:r,column:i,label:o=i,format:s=u=>u,options:a,value:c,as:l}={}){super(n),this.from=r,this.column=i,this.selection=l,this.format=s,this.element=t??document.createElement("div"),this.element.setAttribute("class","input"),this.element.value=this;let u=document.createElement("label");u.innerText=o||i,this.element.appendChild(u),this.select=document.createElement("select"),a&&(this.data=a.map(f=>wnt(f)?f:{value:f}),this.update()),c=c??this.selection?.value??this.data?.[0]?.value,this.selection?.value===void 0&&this.publish(c),this.element.appendChild(this.select),this.selection&&(this.select.addEventListener("input",()=>{this.publish(this.selectedValue()??null)}),ni(this.selection)||this.selection.addEventListener("value",f=>{f!==this.select.value&&this.selectedValue(f)}))}selectedValue(t){if(arguments.length===0){let n=this.select.selectedIndex;return this.data[n].value}else{let n=this.data?.findIndex(r=>r.value===t);n>=0?this.select.selectedIndex=n:this.select.value=String(t)}}reset(){this.select.selectedIndex=this.from?0:-1}publish(t){let{selection:n,column:r}=this;ni(n)?n.update({source:this,schema:{type:"point"},value:t,predicate:t!==""&&t!==void 0?ws(r,Lr(t)):null}):gr(n)&&n.update(t)}query(t=[]){let{from:n,column:r}=this;return n?yt.from(n).select({value:r}).distinct().where(t).orderby(r):null}queryResult(t){return this.data=[{value:"",label:"All"},...t],this}update(){let{data:t,format:n,select:r}=this;r.replaceChildren();for(let{value:i,label:o}of t){let s=document.createElement("option");s.setAttribute("value",i),s.innerText=o??n(i),this.select.appendChild(s)}return this.selection&&this.selectedValue(this.selection?.value??""),this}};var vnt={contains:O2,prefix:B2,suffix:L2,regexp:D2},_nt=0;var Xy=class extends ar{constructor({element:t,filterBy:n,from:r,column:i,label:o,type:s="contains",as:a}={}){if(super(n),this.id="search_"+ ++_nt,this.type=s,this.from=r,this.column=i,this.selection=a,this.element=t??document.createElement("div"),this.element.setAttribute("class","input"),this.element.value=this,o){let c=document.createElement("label");c.setAttribute("for",this.id),c.innerText=o,this.element.appendChild(c)}this.searchbox=document.createElement("input"),this.searchbox.setAttribute("id",this.id),this.searchbox.setAttribute("type","text"),this.searchbox.setAttribute("placeholder","Query"),this.element.appendChild(this.searchbox),this.selection&&(this.searchbox.addEventListener("input",()=>{this.publish(this.searchbox.value||null)}),ni(this.selection)||this.selection.addEventListener("value",c=>{c!==this.searchbox.value&&(this.searchbox.value=c)}))}reset(){this.searchbox.value=""}publish(t){let{selection:n,column:r,type:i}=this;ni(n)?n.update({source:this,schema:{type:i},value:t,predicate:t?vnt[i](r,Lr(t)):null}):gr(n)&&n.update(t)}query(t=[]){let{from:n,column:r}=this;return n?yt.from(n).select({list:r}).distinct().where(t):null}queryResult(t){return this.data=t,this}update(){let t=document.createElement("datalist"),n=`${this.id}_list`;t.setAttribute("id",n);for(let r of this.data){let i=document.createElement("option");i.setAttribute("value",r.list),t.append(i)}return this.datalist&&this.datalist.remove(),this.element.appendChild(this.datalist=t),this.searchbox.setAttribute("list",n),this}};var Snt=0;var Gy=class extends ar{constructor({element:t,filterBy:n,as:r,min:i,max:o,step:s,from:a,column:c,label:l=c,value:u=r?.value,width:f}={}){if(super(n),this.id="slider_"+ ++Snt,this.from=a,this.column=c||"value",this.selection=r,this.min=i,this.max=o,this.step=s,this.element=t||document.createElement("div"),this.element.setAttribute("class","input"),this.element.value=this,l){let d=document.createElement("label");d.setAttribute("for",this.id),d.innerText=l,this.element.appendChild(d)}this.slider=document.createElement("input"),this.slider.setAttribute("id",this.id),this.slider.setAttribute("type","range"),f!=null&&(this.slider.style.width=`${+f}px`),i!=null&&this.slider.setAttribute("min",i),o!=null&&this.slider.setAttribute("max",o),s!=null&&this.slider.setAttribute("step",s),u!=null&&(this.slider.setAttribute("value",u),this.selection?.value===void 0&&this.publish(u)),this.element.appendChild(this.slider),this.selection&&(this.slider.addEventListener("input",()=>{this.publish(+this.slider.value)}),ni(this.selection)||this.selection.addEventListener("value",d=>{d!==+this.slider.value&&(this.slider.value=d)}))}query(t=[]){let{from:n,column:r}=this;return!n||this.min!=null&&this.max!=null?null:yt.select({min:ti(r),max:Kr(r)}).from(n).where(t)}queryResult(t){let{min:n,max:r}=Array.from(t)[0];return this.min==null&&this.slider.setAttribute("min",n),this.max==null&&this.slider.setAttribute("max",r),this.step==null&&this.slider.setAttribute("step",(r-n)/500),this}publish(t){let{selection:n,column:r}=this;ni(n)?n.update({source:this,schema:{type:"point"},value:t,predicate:ws(r,Lr(t))}):gr(this.selection)&&n.update(t)}};var Y3=G3(e=>{let t=Uv(e);return n=>n==null?"":typeof n=="number"?t(n):n instanceof Date?X3(n):`${n}`}),Uv=G3(e=>t=>t===0?"0":t.toLocaleString(e)),pjt=Y3(),mjt=Uv();function X3(e){return bf(e,"Invalid Date")}function G3(e){let t=G3,n;return(r="en")=>r===t?n:n=e(t=r)}var Int=-1;var Wy=class extends ar{constructor({element:t,filterBy:n,from:r,columns:i=["*"],align:o={},format:s,width:a,maxWidth:c,height:l=500,rowBatch:u=100}={}){super(n),this.id=`table-${++Int}`,this.from=r,this.columns=i,this.format=s,this.align=o,this.widths=typeof a=="object"?a:{},this.offset=0,this.limit=+u,this.pending=!1,this.sortHeader=null,this.sortColumn=null,this.sortDesc=!1,this.element=t||document.createElement("div"),this.element.setAttribute("id",this.id),this.element.value=this,typeof a=="number"&&(this.element.style.width=`${a}px`),c&&(this.element.style.maxWidth=`${c}px`),this.element.style.maxHeight=`${l}px`,this.element.style.overflow="auto";let f=-1;this.element.addEventListener("scroll",d=>{let{pending:h,loaded:p}=this,{scrollHeight:m,scrollTop:g,clientHeight:y}=d.target,x=g<f;f=g,!(x||h||p)&&m-g<2*y&&(this.pending=!0,this.requestData(this.offset+this.limit))}),this.tbl=document.createElement("table"),this.element.appendChild(this.tbl),this.head=document.createElement("thead"),this.tbl.appendChild(this.head),this.body=document.createElement("tbody"),this.tbl.appendChild(this.body),this.style=document.createElement("style"),this.element.appendChild(this.style)}requestData(t=0){this.offset=t;let n=this.query(this.filterBy?.predicate(this));this.requestQuery(n),ei().prefetch(n.clone().offset(t+this.limit))}fields(){return this.columns.map(t=>Aa(this.from,t))}fieldInfo(t){this.schema=t;let n=this.head;n.innerHTML="";let r=document.createElement("tr");for(let{column:i}of t){let o=document.createElement("th");o.addEventListener("click",s=>this.sort(s,i)),o.appendChild(document.createElement("span")),o.appendChild(document.createTextNode(i)),r.appendChild(o)}return n.appendChild(r),this.formats=Mnt(this.format,t),this.style.innerText=Ent(this.id,Ant(this.align,t),Tnt(this.widths,t)),this}query(t=[]){let{from:n,limit:r,offset:i,schema:o,sortColumn:s,sortDesc:a}=this;return yt.from(n).select(o.map(c=>c.column)).where(t).orderby(s?a?M2(s):s:[]).limit(r).offset(i)}queryResult(t){return this.pending||(this.loaded=!1,this.body.replaceChildren()),this.data=t,this}update(){let{body:t,formats:n,data:r,schema:i,limit:o}=this,s=i.length,a=0;for(let c of r){++a;let l=document.createElement("tr");for(let u=0;u<s;++u){let f=c[i[u].column],d=document.createElement("td");d.innerText=f==null?"":n[u](f),l.appendChild(d)}t.appendChild(l)}return a<o&&(this.loaded=!0),this.pending=!1,this}sort(t,n){n===this.sortColumn?this.sortDesc=!this.sortDesc:(this.sortColumn=n,this.sortDesc=!1);let r=t.currentTarget,i=this.sortHeader;i===r&&t.metaKey?(i.firstChild.textContent="",this.sortHeader=null,this.sortColumn=null):(i&&(i.firstChild.textContent=""),this.sortHeader=r,r.firstChild.textContent=this.sortDesc?"\u25BE":"\u25B4"),this.requestData()}};function Mnt(e={},t,n){return t.map(({column:r,type:i})=>{if(r in e)return e[r];switch(i){case"number":return Uv(n);case"date":return X3;default:return Y3(n)}})}function Ant(e={},t){return t.map(({column:n,type:r})=>n in e?e[n]:r==="number"?"right":"left")}function Tnt(e={},t){return t.map(({column:n})=>e[n])}function Ent(e,t,n){let r=[];return t.forEach((i,o)=>{let s=+n[o];if(i!=="left"||s){let a=i!=="left"?`text-align:${i};`:"",c=s?`width:${s}px;max-width:${s}px;`:"";r.push(`#${e} tr>:nth-child(${o+1}) {${a}${c}}`)}}),r.join(" ")}function Hy(e,...t){let n=e?.context?.coordinator??ei();for(let r of t)n.connect(r)}function zv(e,t,n){let r=new t(n);return Hy(e,r),r.element}function HP(e){return zv(this,Yy,e)}function ZP(e){return zv(this,Xy,e)}function JP(e){return zv(this,Gy,e)}function QP(e){return zv(this,Wy,e)}function KP({direction:e="vertical",wrap:t=!1},n){let r=document.createElement("div");return r.style.display="flex",r.style.flexDirection=e==="vertical"?"column":"row",r.style.flexWrap=t?t===!0?"wrap":t:"nowrap",r.style.justifyContent="flex-start",r.style.alignItems="flex-start",n.forEach(i=>r.appendChild(i)),r.value={element:r},r}function tU(...e){return KP({direction:"vertical"},e.flat())}function eU(...e){return KP({direction:"horizontal"},e.flat())}function nU({dim:e="width",size:t=10}){let n=document.createElement("span");n.style.display="inline-block",n.style[e]=Number.isNaN(+t)?t:`${t}px`;let r={element:n};return n.value=r,n}function rU(e){return nU({dim:"height",size:e})}function iU(e){return nU({dim:"width",size:e})}var qv={};_r(qv,{align:()=>c6,aspectRatio:()=>l6,axis:()=>u6,colorBase:()=>H4,colorClamp:()=>$4,colorConstant:()=>J4,colorDomain:()=>F4,colorExponent:()=>Z4,colorInterpolate:()=>q4,colorLabel:()=>Y4,colorN:()=>P4,colorNice:()=>U4,colorPivot:()=>j4,colorRange:()=>R4,colorReverse:()=>X4,colorScale:()=>k4,colorScheme:()=>z4,colorSymmetric:()=>V4,colorTickFormat:()=>W4,colorZero:()=>G4,facetGrid:()=>LE,facetLabel:()=>CE,facetMargin:()=>EE,facetMarginBottom:()=>DE,facetMarginLeft:()=>OE,facetMarginRight:()=>BE,facetMarginTop:()=>NE,fxAlign:()=>qE,fxAriaDescription:()=>s4,fxAriaLabel:()=>o4,fxAxis:()=>XE,fxDomain:()=>kE,fxFontVariant:()=>i4,fxGrid:()=>KE,fxInset:()=>$E,fxInsetLeft:()=>PE,fxInsetRight:()=>UE,fxLabel:()=>e4,fxLabelAnchor:()=>n4,fxLabelOffset:()=>r4,fxLine:()=>t4,fxNice:()=>RE,fxPadding:()=>jE,fxPaddingInner:()=>VE,fxPaddingOuter:()=>YE,fxRange:()=>FE,fxReverse:()=>a4,fxRound:()=>zE,fxTickFormat:()=>JE,fxTickPadding:()=>ZE,fxTickRotate:()=>QE,fxTickSize:()=>WE,fxTickSpacing:()=>HE,fxTicks:()=>GE,fyAlign:()=>m4,fyAriaDescription:()=>L4,fyAriaLabel:()=>B4,fyAxis:()=>b4,fyDomain:()=>c4,fyFontVariant:()=>O4,fyGrid:()=>A4,fyInset:()=>f4,fyInsetBottom:()=>h4,fyInsetTop:()=>d4,fyLabel:()=>E4,fyLabelAnchor:()=>N4,fyLabelOffset:()=>D4,fyLine:()=>T4,fyNice:()=>u4,fyPadding:()=>y4,fyPaddingInner:()=>g4,fyPaddingOuter:()=>x4,fyRange:()=>l4,fyReverse:()=>C4,fyRound:()=>p4,fyTickFormat:()=>I4,fyTickPadding:()=>S4,fyTickRotate:()=>M4,fyTickSize:()=>v4,fyTickSpacing:()=>_4,fyTicks:()=>w4,grid:()=>d6,height:()=>r6,inset:()=>f6,label:()=>h6,lengthBase:()=>M8,lengthClamp:()=>_8,lengthConstant:()=>T8,lengthDomain:()=>w8,lengthExponent:()=>A8,lengthNice:()=>S8,lengthRange:()=>v8,lengthScale:()=>b8,lengthZero:()=>I8,margin:()=>K3,marginBottom:()=>a6,marginLeft:()=>i6,marginRight:()=>o6,marginTop:()=>s6,margins:()=>Q3,name:()=>Z3,opacityBase:()=>a8,opacityClamp:()=>e8,opacityConstant:()=>l8,opacityDomain:()=>K4,opacityExponent:()=>c8,opacityLabel:()=>r8,opacityNice:()=>n8,opacityRange:()=>t8,opacityReverse:()=>i8,opacityScale:()=>Q4,opacityTickFormat:()=>s8,opacityZero:()=>o8,padding:()=>p6,projectionClip:()=>$8,projectionDomain:()=>B8,projectionInset:()=>L8,projectionInsetBottom:()=>R8,projectionInsetLeft:()=>C8,projectionInsetRight:()=>k8,projectionInsetTop:()=>F8,projectionParallels:()=>N8,projectionPrecision:()=>D8,projectionRotate:()=>O8,projectionType:()=>E8,rBase:()=>y8,rClamp:()=>h8,rConstant:()=>x8,rDomain:()=>f8,rExponent:()=>g8,rNice:()=>p8,rRange:()=>d8,rScale:()=>u8,rZero:()=>m8,round:()=>m6,style:()=>e6,width:()=>n6,xAlign:()=>M6,xAriaDescription:()=>j6,xAriaLabel:()=>q6,xAxis:()=>N6,xBase:()=>X6,xClamp:()=>S6,xConstant:()=>W6,xDomain:()=>g6,xExponent:()=>G6,xFontVariant:()=>z6,xGrid:()=>F6,xInset:()=>w6,xInsetLeft:()=>v6,xInsetRight:()=>_6,xLabel:()=>$6,xLabelAnchor:()=>P6,xLabelOffset:()=>U6,xLine:()=>R6,xNice:()=>b6,xPadding:()=>A6,xPaddingInner:()=>T6,xPaddingOuter:()=>E6,xRange:()=>x6,xReverse:()=>V6,xRound:()=>I6,xScale:()=>y6,xTickFormat:()=>C6,xTickPadding:()=>L6,xTickRotate:()=>k6,xTickSize:()=>O6,xTickSpacing:()=>B6,xTicks:()=>D6,xZero:()=>Y6,xyDomain:()=>t6,yAlign:()=>iE,yAriaDescription:()=>_E,yAriaLabel:()=>vE,yAxis:()=>cE,yBase:()=>ME,yClamp:()=>nE,yConstant:()=>TE,yDomain:()=>Z6,yExponent:()=>AE,yFontVariant:()=>wE,yGrid:()=>mE,yInset:()=>K6,yInsetBottom:()=>eE,yInsetTop:()=>tE,yLabel:()=>gE,yLabelAnchor:()=>xE,yLabelOffset:()=>bE,yLine:()=>yE,yNice:()=>Q6,yPadding:()=>oE,yPaddingInner:()=>sE,yPaddingOuter:()=>aE,yRange:()=>J6,yReverse:()=>SE,yRound:()=>rE,yScale:()=>H6,yTickFormat:()=>hE,yTickPadding:()=>dE,yTickRotate:()=>pE,yTickSize:()=>uE,yTickSpacing:()=>fE,yTicks:()=>lE,yZero:()=>IE});var Zy=class extends Map{request(t,n){if(this.has(t))n(this.get(t));else{let r=this.waiting||(this.waiting=new Map),i=r.get(t)||[];r.set(t,i.concat(n))}}set(t,n){this.has(t)&&console.warn(`Overwriting named plot "${t}".`);let{waiting:r}=this;return r?.has(t)&&(r.get(t).forEach(i=>i(n)),r.delete(t)),super.set(t,n)}},W3=new Zy;function H3(e,t,n){(e?.context?.namedPlots??W3).request(t,n)}function oU(e,t,n){(e?.context?.namedPlots??W3).set(t,n)}function Z3(e){return t=>oU(this,e,t)}function sU(e,t,n){gr(n)?(n.addEventListener("value",r=>{e.setAttribute(t,r),e.update()}),n.value!==void 0&&e.setAttribute(t,n.value)):e.setAttribute(t,n)}function Nnt(e,t){return n=>{sU(n,e,t)}}function J3(e){return t=>{for(let[n,r]of Object.entries(e))sU(t,n,r)}}function Q3(e){let{top:t,bottom:n,left:r,right:i}=e,o={};return t!==void 0&&(o.marginTop=t),n!==void 0&&(o.marginBottom=n),r!==void 0&&(o.marginLeft=r),i!==void 0&&(o.marginRight=i),J3(o)}function K3(e){return J3({marginTop:e,marginBottom:e,marginLeft:e,marginRight:e})}function t6(e){return J3({xDomain:e,yDomain:e})}var B=e=>t=>Nnt(e,t),e6=B("style"),n6=B("width"),r6=B("height"),i6=B("marginLeft"),o6=B("marginRight"),s6=B("marginTop"),a6=B("marginBottom"),c6=B("align"),l6=B("aspectRatio"),u6=B("axis"),f6=B("inset"),d6=B("grid"),h6=B("label"),p6=B("padding"),m6=B("round"),y6=B("xScale"),g6=B("xDomain"),x6=B("xRange"),b6=B("xNice"),w6=B("xInset"),v6=B("xInsetLeft"),_6=B("xInsetRight"),S6=B("xClamp"),I6=B("xRound"),M6=B("xAlign"),A6=B("xPadding"),T6=B("xPaddingInner"),E6=B("xPaddingOuter"),N6=B("xAxis"),D6=B("xTicks"),O6=B("xTickSize"),B6=B("xTickSpacing"),L6=B("xTickPadding"),C6=B("xTickFormat"),k6=B("xTickRotate"),F6=B("xGrid"),R6=B("xLine"),$6=B("xLabel"),P6=B("xLabelAnchor"),U6=B("xLabelOffset"),z6=B("xFontVariant"),q6=B("xAriaLabel"),j6=B("xAriaDescription"),V6=B("xReverse"),Y6=B("xZero"),X6=B("xBase"),G6=B("xExponent"),W6=B("xConstant"),H6=B("yScale"),Z6=B("yDomain"),J6=B("yRange"),Q6=B("yNice"),K6=B("yInset"),tE=B("yInsetTop"),eE=B("yInsetBottom"),nE=B("yClamp"),rE=B("yRound"),iE=B("yAlign"),oE=B("yPadding"),sE=B("yPaddingInner"),aE=B("yPaddingOuter"),cE=B("yAxis"),lE=B("yTicks"),uE=B("yTickSize"),fE=B("yTickSpacing"),dE=B("yTickPadding"),hE=B("yTickFormat"),pE=B("yTickRotate"),mE=B("yGrid"),yE=B("yLine"),gE=B("yLabel"),xE=B("yLabelAnchor"),bE=B("yLabelOffset"),wE=B("yFontVariant"),vE=B("yAriaLabel"),_E=B("yAriaDescription"),SE=B("yReverse"),IE=B("yZero"),ME=B("yBase"),AE=B("yExponent"),TE=B("yConstant"),EE=B("facetMargin"),NE=B("facetMarginTop"),DE=B("facetMarginBottom"),OE=B("facetMarginLeft"),BE=B("facetMarginRight"),LE=B("facetGrid"),CE=B("facetLabel"),kE=B("fxDomain"),FE=B("fxRange"),RE=B("fxNice"),$E=B("fxInset"),PE=B("fxInsetLeft"),UE=B("fxInsetRight"),zE=B("fxRound"),qE=B("fxAlign"),jE=B("fxPadding"),VE=B("fxPaddingInner"),YE=B("fxPaddingOuter"),XE=B("fxAxis"),GE=B("fxTicks"),WE=B("fxTickSize"),HE=B("fxTickSpacing"),ZE=B("fxTickPadding"),JE=B("fxTickFormat"),QE=B("fxTickRotate"),KE=B("fxGrid"),t4=B("fxLine"),e4=B("fxLabel"),n4=B("fxLabelAnchor"),r4=B("fxLabelOffset"),i4=B("fxFontVariant"),o4=B("fxAriaLabel"),s4=B("fxAriaDescription"),a4=B("fxReverse"),c4=B("fyDomain"),l4=B("fyRange"),u4=B("fyNice"),f4=B("fyInset"),d4=B("fyInsetTop"),h4=B("fyInsetBottom"),p4=B("fyRound"),m4=B("fyAlign"),y4=B("fyPadding"),g4=B("fyPaddingInner"),x4=B("fyPaddingOuter"),b4=B("fyAxis"),w4=B("fyTicks"),v4=B("fyTickSize"),_4=B("fyTickSpacing"),S4=B("fyTickPadding"),I4=B("fyTickFormat"),M4=B("fyTickRotate"),A4=B("fyGrid"),T4=B("fyLine"),E4=B("fyLabel"),N4=B("fyLabelAnchor"),D4=B("fyLabelOffset"),O4=B("fyFontVariant"),B4=B("fyAriaLabel"),L4=B("fyAriaDescription"),C4=B("fyReverse"),k4=B("colorScale"),F4=B("colorDomain"),R4=B("colorRange"),$4=B("colorClamp"),P4=B("colorN"),U4=B("colorNice"),z4=B("colorScheme"),q4=B("colorInterpolate"),j4=B("colorPivot"),V4=B("colorSymmetric"),Y4=B("colorLabel"),X4=B("colorReverse"),G4=B("colorZero"),W4=B("colorTickFormat"),H4=B("colorBase"),Z4=B("colorExponent"),J4=B("colorConstant"),Q4=B("opacityScale"),K4=B("opacityDomain"),t8=B("opacityRange"),e8=B("opacityClamp"),n8=B("opacityNice"),r8=B("opacityLabel"),i8=B("opacityReverse"),o8=B("opacityZero"),s8=B("opacityTickFormat"),a8=B("opacityBase"),c8=B("opacityExponent"),l8=B("opacityConstant"),u8=B("rScale"),f8=B("rDomain"),d8=B("rRange"),h8=B("rClamp"),p8=B("rNice"),m8=B("rZero"),y8=B("rBase"),g8=B("rExponent"),x8=B("rConstant"),b8=B("lengthScale"),w8=B("lengthDomain"),v8=B("lengthRange"),_8=B("lengthClamp"),S8=B("lengthNice"),I8=B("lengthZero"),M8=B("lengthBase"),A8=B("lengthExponent"),T8=B("lengthConstant"),E8=B("projectionType"),N8=B("projectionParallels"),D8=B("projectionPrecision"),O8=B("projectionRotate"),B8=B("projectionDomain"),L8=B("projectionInset"),C8=B("projectionInsetLeft"),k8=B("projectionInsetRight"),F8=B("projectionInsetTop"),R8=B("projectionInsetBottom"),$8=B("projectionClip");function aU(e,t){return{table:e,options:t}}var jv={};_r(jv,{area:()=>U8,areaX:()=>z8,areaY:()=>q8,arrow:()=>LN,axisFx:()=>$N,axisFy:()=>PN,axisX:()=>FN,axisY:()=>RN,barX:()=>X8,barY:()=>G8,cell:()=>W8,cellX:()=>H8,cellY:()=>Z8,circle:()=>rN,contour:()=>vN,delaunayLink:()=>DN,delaunayMesh:()=>ON,denseLine:()=>wN,density:()=>bN,densityX:()=>gN,densityY:()=>xN,dot:()=>tN,dotX:()=>eN,dotY:()=>nN,frame:()=>kN,geo:()=>VN,graticule:()=>XN,gridFx:()=>qN,gridFy:()=>jN,gridX:()=>UN,gridY:()=>zN,heatmap:()=>_N,hexagon:()=>iN,hexbin:()=>MN,hexgrid:()=>AN,hull:()=>BN,image:()=>yN,line:()=>j8,lineX:()=>V8,lineY:()=>Y8,link:()=>CN,raster:()=>SN,rasterTile:()=>IN,rect:()=>J8,rectX:()=>Q8,rectY:()=>K8,regressionY:()=>TN,ruleX:()=>cN,ruleY:()=>lN,sphere:()=>YN,spike:()=>mN,text:()=>oN,textX:()=>sN,textY:()=>aN,tickX:()=>uN,tickY:()=>fN,vector:()=>dN,vectorX:()=>hN,vectorY:()=>pN,voronoi:()=>EN,voronoiMesh:()=>NN});var Dnt=new Set(["frame","axisX","axisY","axisFx","axisFy","gridX","gridY","gridFx","gridFy","hexgrid","graticule","sphere"]);function St(e,t,n={}){arguments.length===2&&!Array.isArray(t)&&(n=t,t=Dnt.has(e)?null:[{}]);let r=e.startsWith("area")||e.startsWith("line")?Ny:Nn;return P8(r,e,t,n)}function P8(e,t,n,r){return i=>{i.addMark(new e(t,n,r))}}function ca(e,t,n){return r=>{r.addMark(new e(t,n))}}var U8=(...e)=>St("area",...e),z8=(...e)=>St("areaX",...e),q8=(...e)=>St("areaY",...e),j8=(...e)=>St("line",...e),V8=(...e)=>St("lineX",...e),Y8=(...e)=>St("lineY",...e),X8=(...e)=>St("barX",...e),G8=(...e)=>St("barY",...e),W8=(...e)=>St("cell",...e),H8=(...e)=>St("cellX",...e),Z8=(...e)=>St("cellY",...e),J8=(...e)=>St("rect",...e),Q8=(...e)=>St("rectX",...e),K8=(...e)=>St("rectY",...e),tN=(...e)=>St("dot",...e),eN=(...e)=>St("dotX",...e),nN=(...e)=>St("dotY",...e),rN=(...e)=>St("circle",...e),iN=(...e)=>St("hexagon",...e),oN=(...e)=>St("text",...e),sN=(...e)=>St("textX",...e),aN=(...e)=>St("textY",...e),cN=(...e)=>St("ruleX",...e),lN=(...e)=>St("ruleY",...e),uN=(...e)=>St("tickX",...e),fN=(...e)=>St("tickY",...e),dN=(...e)=>St("vector",...e),hN=(...e)=>St("vectoX",...e),pN=(...e)=>St("vectorY",...e),mN=(...e)=>St("spike",...e),yN=(...e)=>St("image",...e),gN=(...e)=>P8(xd,"areaX",...e),xN=(...e)=>P8(xd,"areaY",...e),bN=(...e)=>ca(ky,...e),wN=(...e)=>ca(Cy,...e),vN=(...e)=>ca(By,...e),_N=(...e)=>ca(Ly,...e),SN=(...e)=>ca(xc,...e),IN=(...e)=>ca($y,...e),MN=(...e)=>ca(Ry,...e),AN=(...e)=>St("hexgrid",...e),TN=(...e)=>ca(Py,...e),EN=(...e)=>St("voronoi",...e),NN=(...e)=>St("voronoiMesh",...e),DN=(...e)=>St("delaunayLink",...e),ON=(...e)=>St("delaunayMesh",...e),BN=(...e)=>St("hull",...e),LN=(...e)=>St("arrow",...e),CN=(...e)=>St("link",...e),kN=(...e)=>St("frame",...e),FN=(...e)=>St("axisX",...e),RN=(...e)=>St("axisY",...e),$N=(...e)=>St("axisFx",...e),PN=(...e)=>St("axisFy",...e),UN=(...e)=>St("gridX",...e),zN=(...e)=>St("gridY",...e),qN=(...e)=>St("gridFx",...e),jN=(...e)=>St("gridFy",...e),VN=(...e)=>ca(Fy,...e),YN=(...e)=>St("sphere",...e),XN=(...e)=>St("graticule",...e);var Vv={};_r(Vv,{highlight:()=>GN,intervalX:()=>KN,intervalXY:()=>eD,intervalY:()=>tD,nearestX:()=>JN,nearestY:()=>QN,pan:()=>nD,panX:()=>rD,panY:()=>iD,panZoom:()=>oD,panZoomX:()=>sD,panZoomY:()=>aD,toggle:()=>Id,toggleColor:()=>ZN,toggleX:()=>WN,toggleY:()=>HN});function bc(e,t){return n=>{let r=n.marks[n.marks.length-1];n.addInteractor(new e(r,t))}}function GN({by:e,...t}){return bc(Uy,{selection:e,channels:t})}function Id({as:e,...t}){return bc(Yl,{...t,selection:e})}function WN(e){return Id({...e,channels:["x"]})}function HN(e){return Id({...e,channels:["y"]})}function ZN(e){return Id({...e,channels:["color"]})}function JN({as:e,...t}){return bc(_d,{...t,selection:e,channel:"x"})}function QN({as:e,...t}){return bc(_d,{...t,selection:e,channel:"y"})}function KN({as:e,...t}){return bc(vd,{...t,selection:e,channel:"x"})}function tD({as:e,...t}){return bc(vd,{...t,selection:e,channel:"y"})}function eD({as:e,...t}){return bc(jy,{...t,selection:e})}function Md(e){return bc(Vy,e)}function nD(e={}){return Md({...e,zoom:!1})}function rD(e={}){return Md({...e,zoom:!1,pany:!1})}function iD(e={}){return Md({...e,zoom:!1,panx:!1})}function oD(e={}){return Md(e)}function sD(e={}){return Md({...e,pany:!1})}function aD(e={}){return Md({...e,panx:!1})}var Yv={};_r(Yv,{colorLegend:()=>lD,opacityLegend:()=>uD,symbolLegend:()=>fD});function cD(e,t={}){if(t.for){let{for:n,...r}=t,i=new Sd(e,r),o=typeof n,s=a=>a.addLegend(i,!1);return o==="string"?H3(this,n,s):n.value&&s(n.value),i.element}else return n=>n.addLegend(new Sd(e,t))}function lD(e){return cD.call(this,"color",e)}function uD(e){return cD.call(this,"opacity",e)}function fD(e){return cD.call(this,"symbol",e)}function cU(...e){let t=new Ey;return e.flat().forEach(n=>n(t)),Hy(this,...t.marks),t.element}function hD({coordinator:e=ei(),namedPlots:t=new Zy,extensions:n=null,...r}={}){return{...dD,...n,context:{coordinator:e,namedPlots:t,...r}}}var lU="spec",Xv="literal",yVt="dataref",uU="options",fU="selection",dU="paramref",hU="param",pD="select",Gv="value",pU="crossfilter",Wv="intersect",mU="union",yU="single",gU="data",xU="expression",wc="sql",la="agg",Jy="input",Ad="hconcat",Td="vconcat",Ed="hspace",Nd="vspace",Hv="mark",mD="from",Dd="plot",Qy="legend",bU="attribute",wU="transform",vU="interactor",Ky="Fixed";var $t=class{constructor(t,n=null){this.type=t,this.children=n}instantiate(){throw Error("instantiate not implemented")}codegen(){return Error("codegen not implemented")}toJSON(){return Error("toJSON not implemented")}};var tg=class extends $t{constructor(t,n,r,i,o,s){super(lU,[t]),this.root=t,this.meta=n,this.config=r,this.data=i,this.params=o,this.plotDefaults=s}toJSON(){let{root:t,meta:n,config:r,plotDefaults:i}=this,o=new Map(Object.entries(this.data)),s=new Map(Object.entries(this.params)),a={};if(n&&(a.meta={...n}),r&&(a.config={...r}),o?.size){let c=a.data={};for(let[l,u]of o)c[l]=u.toJSON()}if(s?.size){let c=a.params={};for(let[l,u]of s)c[l]=u.toJSON()}if(i?.length){let c=a.plotDefaults={};for(let l of i)Object.assign(c,l.toJSON())}return Object.assign(a,t.toJSON())}};function _U(e){let t=typeof e;return t==="object"?e?.param:t==="string"?Ont(e):null}function Ont(e){return e?.[0]==="$"?e.slice(1):null}function eg(e){return`$${e}`}function SU(e){return[e].flat()}function xi(e){return Array.isArray(e)}function Od(e){return e!==null&&typeof e=="object"&&!xi(e)}function Go(e){return typeof e=="string"}function Bd(e,t){throw Object.assign(Error(e),{data:t})}function wr(e,t){let n={};for(let r in e)n[r]=t.maybeSelection(e[r]);return new Ld(n)}var Ld=class e extends $t{constructor(t){super(uU),this.options=t}filter(t){let n=Object.fromEntries(Object.entries(this.options).filter(([r,i])=>t(r,i)));return new e(n)}instantiate(t){let{options:n}=this,r={};for(let i in n)r[i]=n[i].instantiate(t);return r}codegen(t){let{options:n}=this,r=[];for(let i in n)r.push(`${i}: ${n[i].codegen(t)}`);return r.length?`{${t.maybeLineWrap(r)}}`:""}toJSON(){let{options:t}=this,n={};for(let r in t)n[r]=t[r].toJSON();return n}};var AU="table",TU="parquet",EU="csv",yD="json",r_="spatial",IU=new Map([[AU,Bnt],[TU,Lnt],[EU,Cnt],[yD,knt],[r_,Fnt]]);function NU(e,t,n){if(t=Rnt(t),IU.has(t.type))return IU.get(t.type)(e,t,n);n.error("Unrecognized data format type.",t)}function Bnt(e,t,n){let{query:r,type:i,...o}=t;return new Jv(e,r,wr(o,n))}function Lnt(e,t,n){let{file:r,type:i,...o}=t;return new Kv(e,r,wr(o,n))}function Cnt(e,t,n){let{file:r,type:i,...o}=t;return new t_(e,r,wr(o,n))}function knt(e,t,n){let{data:r,file:i,type:o,...s}=t,a=wr(s,n);return r?new n_(e,r,a):new e_(e,i,a)}function Fnt(e,t,n){let{file:r,type:i,...o}=t;return new Qv(e,r,wr(o,n))}function Rnt(e){return xi(e)&&(e={type:"json",data:e}),Go(e)&&(e={type:"table",query:e}),{...e,type:$nt(e)}}function $nt(e){return e.type||Pnt(e.file)||"table"}function Pnt(e){let t=e?.lastIndexOf(".");return t>0?e.slice(t+1):null}function MU(e,t){return t?new URL(e,t).toString():e}function Unt(e,t){let n=e?.codegen(t);return n?`, ${n}`:""}var Zv=class extends $t{constructor(t,n){super(gU),this.name=t,this.format=n}},Cd=class extends Zv{constructor(t,n){super(t,n)}instantiateQuery(t){t.error("instantiateQuery not implemented")}codegenQuery(t){t.error("codegenQuery not implemented")}instantiate(t){let n=this.instantiateQuery(t);if(n)return n}codegen(t){let n=this.codegenQuery(t);if(n)return n}},Jv=class extends Cd{constructor(t,n,r){super(t,AU),this.query=n?.trim(),this.options=r}instantiateQuery(t){let{name:n,query:r,options:i}=this;if(r)return t.api.create(n,r,i.instantiate(t))}codegenQuery(t){let{name:n,query:r,options:i}=this;if(r)return`\`${co(n,r,i.instantiate(t))}\``}toJSON(){let{format:t,query:n,options:r}=this;return{type:t,query:n,...r.toJSON()}}},Xl=class extends Cd{constructor(t,n,r,i,o){super(t,n),this.file=i,this.method=r,this.options=o}instantiateQuery(t){let{name:n,method:r,file:i,options:o}=this,s=MU(i,t.baseURL),a=o?.instantiate(t);return t.api[r](n,s,a)}codegenQuery(t){let{name:n,method:r,file:i,options:o}=this,s=MU(i,t.baseURL),a=Unt(o,t);return`${t.ns()}${r}("${n}", "${s}"${a})`}toJSON(){let{format:t,file:n,options:r}=this;return{type:t,file:n,...r.toJSON()}}},Qv=class extends Xl{constructor(t,n,r){super(t,r_,"loadSpatial",n,r)}},Kv=class extends Xl{constructor(t,n,r){super(t,TU,"loadParquet",n,r)}},t_=class extends Xl{constructor(t,n,r){super(t,EU,"loadCSV",n,r)}},e_=class extends Xl{constructor(t,n,r){super(t,yD,"loadJSON",n,r)}},n_=class extends Cd{constructor(t,n,r){super(t,yD),this.data=n,this.options=r}instantiateQuery(t){let{name:n,data:r,options:i}=this;return t.api.loadObjects(n,r,i.instantiate(t))}codegenQuery(t){let{name:n,data:r,options:i}=this,o=i?","+i.codegen(t):"",s=`[
70
70
  `+r.map(a=>JSON.stringify(a)).join(`,
71
71
  `)+`
72
- ]`;return`${t.ns()}loadObjects("${n}", ${s}${o})`}toJSON(){let{format:t,data:n,options:r}=this;return{type:t,data:n,...r.toJSON()}}};function r_(e){let t=e.config?.extensions,n=new Set(t?WP(t):[]);for(let r of Object.values(e.data))r.format===n_&&n.add("spatial");return n}async function unt(e,t){let{data:n,params:r,plotDefaults:i}=e,o=new i_({plotDefaults:i,...t}),s=[],a=r_(e);s.push(...Array.from(a).map(c=>Xh(c)));for(let c of Object.values(n)){let l=c.instantiate(o);l&&s.push(l)}s.length>0&&await o.coordinator.exec(s);for(let[c,l]of Object.entries(r)){let u=l.instantiate(o);o.activeParams.set(c,u)}return{element:e.root.instantiate(o),params:o.activeParams}}var i_=class{constructor({api:t=qN(),plotDefaults:n=[],activeParams:r=new Map,baseURL:i=null}={}){this.api=t,this.plotDefaults=n,this.activeParams=r,this.baseURL=i,this.coordinator=t.context.coordinator}error(t,n){Od(t,n)}};function fnt(e,t){let{root:n,data:r,params:i,plotDefaults:o}=e,s=new o_({plotDefaults:o,...t}),a=[];for(let[m,g]of s.imports)a.push(Go(g)?`import ${g} from "${m}";`:`import { ${g.join(", ")} } from "${m}";`);let c=[];if(s.connector){let m=`${s.ns()}${s.connector}Connector()`;c.push(`${s.tab()}${s.ns()}coordinator().databaseConnector(${m});`)}let l=[];for(let m of r_(e))l.push(`${s.ns()}loadExtension("${m}")`);for(let m of Object.values(r)){let g=m.codegen(s);g&&l.push(g)}let u=[];l.length&&(u.push(`${s.tab()}await ${s.ns()}coordinator().exec([`),s.indent(),u.push(l.map(m=>`${s.tab()}${m}`).join(`,
73
- `)),s.undent(),u.push(`${s.tab()}]);`));let f=[];for(let[m,g]of Object.entries(i))f.push(`const ${tg(m)} = ${g.codegen(s)};`);let d=[],h=o;h.length&&(d=["const defaultAttributes = [",h.map(m=>" "+m.codegen(s)).join(`,
74
- `),"];"]);let p=[`export default ${n.codegen(s)};`];return[...a,...eg(a),...c,...eg(c),...u,...eg(u),...f,...eg(f),...d,...eg(d),...p].join(`
75
- `)}var o_=class{constructor({plotDefaults:t=null,namespace:n="vg",connector:r=null,imports:i=new Map([["@uwdata/vgplot","* as vg"]]),baseURL:o=null,depth:s=0}={}){this.plotDefaults=t,this.namespace=`${n}.`,this.connector=r,this.imports=i,this.baseURL=o,this.depth=s}addImport(t,n){this.imports.has(t)||this.imports.set(t,[]),this.imports.get(t).push(n)}setImports(t,n){this.imports.set(t,n)}ns(){return this.namespace}indent(){this.depth+=1}undent(){this.depth-=1}tab(){return Array.from({length:this.depth},()=>" ").join("")}stringify(t){if(xi(t)){let n=t.map(r=>this.stringify(r));return`[${this.maybeLineWrap(n)}]`}else if(Dd(t)){let n=Object.entries(t).map(([r,i])=>`${dnt(r)}: ${this.stringify(i)}`);return`{${this.maybeLineWrap(n)}}`}else return JSON.stringify(t)}maybeLineWrap(t){let n=80-2*this.depth;if(2*t.length+t.reduce((i,o)=>i+o.length,0)>n){this.indent();let i=t.map(o=>`
72
+ ]`;return`${t.ns()}loadObjects("${n}", ${s}${o})`}toJSON(){let{format:t,data:n,options:r}=this;return{type:t,data:n,...r.toJSON()}}};function i_(e){let t=e.config?.extensions,n=new Set(t?SU(t):[]);for(let r of Object.values(e.data))r.format===r_&&n.add("spatial");return n}async function znt(e,t){let{data:n,params:r,plotDefaults:i}=e,o=new o_({plotDefaults:i,...t}),s=[],a=i_(e);s.push(...Array.from(a).map(c=>Gh(c)));for(let c of Object.values(n)){let l=c.instantiate(o);l&&s.push(l)}s.length>0&&await o.coordinator.exec(s);for(let[c,l]of Object.entries(r)){let u=l.instantiate(o);o.activeParams.set(c,u)}return{element:e.root.instantiate(o),params:o.activeParams}}var o_=class{constructor({api:t=hD(),plotDefaults:n=[],activeParams:r=new Map,baseURL:i=null}={}){this.api=t,this.plotDefaults=n,this.activeParams=r,this.baseURL=i,this.coordinator=t.context.coordinator}error(t,n){Bd(t,n)}};function qnt(e,t){let{root:n,data:r,params:i,plotDefaults:o}=e,s=new s_({plotDefaults:o,...t}),a=[];for(let[m,g]of s.imports)a.push(Go(g)?`import ${g} from "${m}";`:`import { ${g.join(", ")} } from "${m}";`);let c=[];if(s.connector){let m=`${s.ns()}${s.connector}Connector()`;c.push(`${s.tab()}${s.ns()}coordinator().databaseConnector(${m});`)}let l=[];for(let m of i_(e))l.push(`${s.ns()}loadExtension("${m}")`);for(let m of Object.values(r)){let g=m.codegen(s);g&&l.push(g)}let u=[];l.length&&(u.push(`${s.tab()}await ${s.ns()}coordinator().exec([`),s.indent(),u.push(l.map(m=>`${s.tab()}${m}`).join(`,
73
+ `)),s.undent(),u.push(`${s.tab()}]);`));let f=[];for(let[m,g]of Object.entries(i))f.push(`const ${eg(m)} = ${g.codegen(s)};`);let d=[],h=o;h.length&&(d=["const defaultAttributes = [",h.map(m=>" "+m.codegen(s)).join(`,
74
+ `),"];"]);let p=[`export default ${n.codegen(s)};`];return[...a,...ng(a),...c,...ng(c),...u,...ng(u),...f,...ng(f),...d,...ng(d),...p].join(`
75
+ `)}var s_=class{constructor({plotDefaults:t=null,namespace:n="vg",connector:r=null,imports:i=new Map([["@uwdata/vgplot","* as vg"]]),baseURL:o=null,depth:s=0}={}){this.plotDefaults=t,this.namespace=`${n}.`,this.connector=r,this.imports=i,this.baseURL=o,this.depth=s}addImport(t,n){this.imports.has(t)||this.imports.set(t,[]),this.imports.get(t).push(n)}setImports(t,n){this.imports.set(t,n)}ns(){return this.namespace}indent(){this.depth+=1}undent(){this.depth-=1}tab(){return Array.from({length:this.depth},()=>" ").join("")}stringify(t){if(xi(t)){let n=t.map(r=>this.stringify(r));return`[${this.maybeLineWrap(n)}]`}else if(Od(t)){let n=Object.entries(t).map(([r,i])=>`${jnt(r)}: ${this.stringify(i)}`);return`{${this.maybeLineWrap(n)}}`}else return JSON.stringify(t)}maybeLineWrap(t){let n=80-2*this.depth;if(2*t.length+t.reduce((i,o)=>i+o.length,0)>n){this.indent();let i=t.map(o=>`
76
76
  ${this.tab()}${o}`).join(",");return this.undent(),i+`
77
- `+this.tab()}else return t.join(", ")}error(t,n){Od(t,n)}};function dnt(e){return/^[A-Za-z_$]\w*/.test(e)?e:JSON.stringify(e)}function eg(e){return e?.length?[""]:[]}var Xl=class extends $t{constructor(t){super(Yv),this.value=t}instantiate(){return this.value}codegen(t){return t.stringify(this.value)}toJSON(){return this.value}};var Gl=class extends $t{constructor(t=Gv,n){super(FP),this.select=t,this.cross=n}instantiate(t){let{select:n,cross:r}=this;return t.api.Selection[n]({cross:r})}codegen(t){let{select:n,cross:r}=this,i=r!=null?`{ cross: ${r} }`:"";return`${t.ns()}Selection.${n}(${i})`}toJSON(){let{select:t,cross:n}=this;return{select:t,cross:n}}};var hnt=new Set([Xv,zP,PP,Gv,UP]);function eU(e,t){let n=Dd(e)?e:{value:e},{select:r=Xv,cross:i,date:o,value:s}=n;return hnt.has(r)||t.error(`Unrecognized param type: ${r}`,n),r!==Xv?new Gl(r,i):xi(s)?new Wl(s.map(a=>t.maybeParam(a))):new Wl(s,o)}var Wl=class extends $t{constructor(t,n){super($P),this.value=t,this.date=n}instantiate(t){let{date:n,value:r}=this,{Param:i}=t.api;return xi(r)?i.array(r.map(o=>o.instantiate(t))):i.value(vl(n,r))}codegen(t){let{value:n,date:r}=this,i=`${t.ns()}Param.`;return xi(n)?`${i}array([${n.map(o=>o.codegen(t)).join(", ")}])`:r?`${i}value(new Date(${JSON.stringify(r)}))`:`${i}value(${JSON.stringify(n)})`}toJSON(){let{date:t,value:n}=this;return xi(n)?n.map(r=>r.toJSON()):t?{date:t}:n}};var ng=class extends $t{constructor(t){super(RP),this.name=t}instantiate(t){return t.activeParams?.get(this.name)}codegen(){return tg(this.name)}toJSON(){return tg(this.name)}};function c_(e,t,n){return n.plot?.attributes?.has(e)||n.error(`Unrecognized attribute: ${e}`),new s_(e,t===Qy?new a_:n.maybeParam(t))}var s_=class extends $t{constructor(t,n){super(VP),this.name=t,this.value=n}instantiate(t){let{name:n,value:r}=this,i=t.api[n];return i(r.instantiate(t))}codegen(t){let{name:n,value:r}=this;return`${t.tab()}${t.ns()}${n}(${r.codegen(t)})`}toJSON(){let{name:t,value:n}=this;return{[t]:n.toJSON()}}},a_=class extends $t{constructor(){super(Yv),this.value=Qy}instantiate(t){return t.api[Qy]}codegen(t){return`${t.ns()}${Qy}`}toJSON(){return this.value}};function nU(e,t){let n=e[Md].map(r=>t.parseComponent(r));return new l_(n)}var l_=class extends $t{constructor(t){super(Md,t)}instantiate(t){return t.api[Md](this.children.map(n=>n.instantiate(t)))}codegen(t){t.indent();let n=this.children.map(r=>r.codegen(t));return t.undent(),`${t.tab()}${t.ns()}${this.type}(
77
+ `+this.tab()}else return t.join(", ")}error(t,n){Bd(t,n)}};function jnt(e){return/^[A-Za-z_$]\w*/.test(e)?e:JSON.stringify(e)}function ng(e){return e?.length?[""]:[]}var Gl=class extends $t{constructor(t){super(Xv),this.value=t}instantiate(){return this.value}codegen(t){return t.stringify(this.value)}toJSON(){return this.value}};var Wl=class extends $t{constructor(t=Wv,n){super(fU),this.select=t,this.cross=n}instantiate(t){let{select:n,cross:r}=this;return t.api.Selection[n]({cross:r})}codegen(t){let{select:n,cross:r}=this,i=r!=null?`{ cross: ${r} }`:"";return`${t.ns()}Selection.${n}(${i})`}toJSON(){let{select:t,cross:n}=this;return{select:t,cross:n}}};var Vnt=new Set([Gv,yU,pU,Wv,mU]);function DU(e,t){let n=Od(e)?e:{value:e},{select:r=Gv,cross:i,date:o,value:s}=n;return Vnt.has(r)||t.error(`Unrecognized param type: ${r}`,n),r!==Gv?new Wl(r,i):xi(s)?new Hl(s.map(a=>t.maybeParam(a))):new Hl(s,o)}var Hl=class extends $t{constructor(t,n){super(hU),this.value=t,this.date=n}instantiate(t){let{date:n,value:r}=this,{Param:i}=t.api;return xi(r)?i.array(r.map(o=>o.instantiate(t))):i.value(_l(n,r))}codegen(t){let{value:n,date:r}=this,i=`${t.ns()}Param.`;return xi(n)?`${i}array([${n.map(o=>o.codegen(t)).join(", ")}])`:r?`${i}value(new Date(${JSON.stringify(r)}))`:`${i}value(${JSON.stringify(n)})`}toJSON(){let{date:t,value:n}=this;return xi(n)?n.map(r=>r.toJSON()):t?{date:t}:n}};var rg=class extends $t{constructor(t){super(dU),this.name=t}instantiate(t){return t.activeParams?.get(this.name)}codegen(){return eg(this.name)}toJSON(){return eg(this.name)}};function l_(e,t,n){return n.plot?.attributes?.has(e)||n.error(`Unrecognized attribute: ${e}`),new a_(e,t===Ky?new c_:n.maybeParam(t))}var a_=class extends $t{constructor(t,n){super(bU),this.name=t,this.value=n}instantiate(t){let{name:n,value:r}=this,i=t.api[n];return i(r.instantiate(t))}codegen(t){let{name:n,value:r}=this;return`${t.tab()}${t.ns()}${n}(${r.codegen(t)})`}toJSON(){let{name:t,value:n}=this;return{[t]:n.toJSON()}}},c_=class extends $t{constructor(){super(Xv),this.value=Ky}instantiate(t){return t.api[Ky]}codegen(t){return`${t.ns()}${Ky}`}toJSON(){return this.value}};function OU(e,t){let n=e[Ad].map(r=>t.parseComponent(r));return new u_(n)}var u_=class extends $t{constructor(t){super(Ad,t)}instantiate(t){return t.api[Ad](this.children.map(n=>n.instantiate(t)))}codegen(t){t.indent();let n=this.children.map(r=>r.codegen(t));return t.undent(),`${t.tab()}${t.ns()}${this.type}(
78
78
  ${n.join(`,
79
79
  `)}
80
- ${t.tab()})`}toJSON(){return{[this.type]:this.children.map(t=>t.toJSON())}}};function rU(e){return new u_(e[Ad])}var u_=class extends $t{constructor(t){super(Ad),this.value=t}instantiate(t){return t.api[Ad](this.value)}codegen(t){return`${t.tab()}${t.ns()}${this.type}(${this.value})`}toJSON(){return{[this.type]:this.value}}};function iU(e,t){let{[Zy]:n,...r}=e;return t.inputs?.has(n)||t.error(`Unrecognized input type: ${n}`,e),new f_(n,xr(r,t))}var f_=class extends $t{constructor(t,n){super(Zy),this.name=t,this.options=n}instantiate(t){let n=t.api[this.name];return n(this.options.instantiate(t))}codegen(t){let n=this.options.codegen(t);return`${t.tab()}${t.ns()}${this.name}(${n})`}toJSON(){let{type:t,name:n,options:r}=this;return{[t]:n,...r.toJSON()}}};function h_(e,t){let{[Jy]:n,...r}=e,i=`${n}Legend`;return t.plot?.legends?.has(i)||t.error(`Unrecognized legend type: ${n}`,e),new d_(i,n,xr(r,t))}var d_=class extends $t{constructor(t,n,r){super(Jy),this.key=t,this.name=n,this.options=r}instantiate(t){let n=t.api[this.key];return n(this.options.instantiate(t))}codegen(t){let n=this.options.codegen(t);return`${t.tab()}${t.ns()}${this.key}(${n})`}toJSON(){let{type:t,name:n,options:r}=this;return{[t]:n,...r.toJSON()}}};function oU(e,t){let{[VN]:n,...r}=e;return t.plot?.interactors?.has(n)||t.error(`Unrecognized interactor type: ${n}`,e),new p_(n,xr(r,t))}var p_=class extends $t{constructor(t,n){super(XP),this.name=t,this.options=n}instantiate(t){let n=t.api[this.name];return n(this.options.instantiate(t))}codegen(t){let n=this.options.codegen(t);return`${t.tab()}${t.ns()}${this.name}(${n})`}toJSON(){let{name:t,options:n}=this;return{[VN]:t,...n.toJSON()}}};function sU(e,t){let{label:n}=e,r=e[xc]?xc:e[aa]?aa:t.error("Unrecognized expression type",e),i=e[r],o=i.split(/(\\'|\\"|"(?:\\"|[^"])*"|'(?:\\'|[^'])*'|\$\w+)/g),s=[""],a=[];for(let c=0,l=0;c<o.length;++c){let u=o[c];u.startsWith("$")?(a[l]=t.maybeParam(u),s[++l]=""):s[l]+=u}return new m_(i,s,a,n,r===aa)}var m_=class extends $t{constructor(t,n,r,i,o){super(qP),this.value=t,this.spans=n,this.params=r,this.label=i,this.aggregate=o}instantiate(t){let{spans:n,params:r,label:i,aggregate:o}=this,s=t.api[o?aa:xc],a=r.map(c=>c.instantiate(t));return s(n,...a).annotate({label:i})}codegen(t){let{spans:n,params:r,label:i,aggregate:o}=this,s=o?aa:xc,a="",c=r.length;for(let l=0;l<c;++l)a+=n[l]+"${"+r[l].codegen(t)+"}";return a+=n[c],`${t.ns()}${s}\`${a}\``+(i?`.annotate({ label: ${JSON.stringify(i)} })`:"")}toJSON(){return{[this.aggregate?aa:xc]:this.value}}};function aU(e,t){if(!e)return null;if(xi(e))return new Xl(e);let{from:n,...r}=e;return new y_(n,xr(r,t))}var y_=class extends $t{constructor(t,n){super(YN),this.table=t,this.options=n}instantiate(t){let{table:n,options:r}=this;return t.api[YN](n,r.instantiate(t))}codegen(t){let{type:n,table:r,options:i}=this,o=i.codegen(t);return`${t.ns()}${n}("${r}"${o?", "+o:""})`}toJSON(){let{type:t,table:n,options:r}=this;return{[t]:n,...r.toJSON()}}};function GN(e){return e==null?[]:[e].flat()}function cU(e,t){let n;for(let o in e)t.transforms.has(o)&&(n=o);if(!n)return;let r=n==="count"||n==null?[]:GN(e[n]),i={distinct:e.distinct,orderby:GN(e.orderby).map(o=>t.maybeParam(o)),partitionby:GN(e.partitionby).map(o=>t.maybeParam(o)),rows:e.rows?t.maybeParam(e.rows):null,range:e.range?t.maybeParam(e.range):null};return new g_(n,r,i)}var g_=class extends $t{constructor(t,n,r){super(YP),this.name=t,this.args=n,this.options=r}instantiate(t){let{name:n,args:r,options:i}=this,{distinct:o,orderby:s,partitionby:a,rows:c,range:l}=i,u=t.api[n],f=u(...r);return o&&(f=f.distinct()),s.length&&(f=f.orderby(s.map(d=>d.instantiate(t)))),a.length&&(f=f.partitionby(a.map(d=>d.instantiate(t)))),c!=null?f=f.rows(c.instantiate(t)):l!=null&&(f=f.range(l.instantiate(t))),f}codegen(t){let{name:n,args:r,options:i}=this,{distinct:o,orderby:s,partitionby:a,rows:c,range:l}=i,u=`${t.ns()}${n}(`+r.map(f=>JSON.stringify(f)).join(", ")+")";if(o&&(u+=".distinct()"),s.length){let f=s.map(d=>d.codegen(t));u+=`.orderby(${f.join(", ")})`}if(a.length){let f=a.map(d=>d.codegen(t));u+=`.partitionby(${f.join(", ")})`}return c?u+=`.rows(${c.codegen(t)})`:l&&(u+=`.range(${l.codegen(t)})`),u}toJSON(){let{name:t,args:n,options:r}=this,{distinct:i,orderby:o,partitionby:s,rows:a,range:c}=r,l={[t]:WN(n)};return i&&(l.distinct=!0),o.length&&(l.orderby=WN(o.map(u=>u.toJSON()))),s.length&&(l.partitionby=WN(s.map(u=>u.toJSON()))),a?l.rows=a.toJSON():c&&(l.range=c.toJSON()),l}};function WN(e){return e.length===0?"":e.length===1?e[0]:e}function pnt(e,t){if(Dd(e))return e[xc]||e[aa]?sU(e,t):cU(e,t)}function lU(e,t){let{mark:n,data:r,...i}=e;t.plot?.marks?.has(n)||t.error(`Unrecognized mark type: ${n}`,e);let o=aU(r,t),s={};for(let a in i){let c=i[a];s[a]=pnt(c,t)||t.maybeParam(c)}return new x_(n,o,new Bd(s))}var x_=class extends $t{constructor(t,n,r){super(Wv),this.name=t,this.data=n,this.options=r}instantiate(t){let{name:n,data:r,options:i}=this,o=t.api[n],s=i.instantiate(t);return r?o(r.instantiate(t),s):o(s)}codegen(t){let{name:n,data:r,options:i}=this,o=r?r.codegen(t):"",s=i.codegen(t),a;if(o&&s){t.indent();let c=i.codegen(t);a=`
80
+ ${t.tab()})`}toJSON(){return{[this.type]:this.children.map(t=>t.toJSON())}}};function BU(e){return new f_(e[Ed])}var f_=class extends $t{constructor(t){super(Ed),this.value=t}instantiate(t){return t.api[Ed](this.value)}codegen(t){return`${t.tab()}${t.ns()}${this.type}(${this.value})`}toJSON(){return{[this.type]:this.value}}};function LU(e,t){let{[Jy]:n,...r}=e;return t.inputs?.has(n)||t.error(`Unrecognized input type: ${n}`,e),new d_(n,wr(r,t))}var d_=class extends $t{constructor(t,n){super(Jy),this.name=t,this.options=n}instantiate(t){let n=t.api[this.name];return n(this.options.instantiate(t))}codegen(t){let n=this.options.codegen(t);return`${t.tab()}${t.ns()}${this.name}(${n})`}toJSON(){let{type:t,name:n,options:r}=this;return{[t]:n,...r.toJSON()}}};function p_(e,t){let{[Qy]:n,...r}=e,i=`${n}Legend`;return t.plot?.legends?.has(i)||t.error(`Unrecognized legend type: ${n}`,e),new h_(i,n,wr(r,t))}var h_=class extends $t{constructor(t,n,r){super(Qy),this.key=t,this.name=n,this.options=r}instantiate(t){let n=t.api[this.key];return n(this.options.instantiate(t))}codegen(t){let n=this.options.codegen(t);return`${t.tab()}${t.ns()}${this.key}(${n})`}toJSON(){let{type:t,name:n,options:r}=this;return{[t]:n,...r.toJSON()}}};function CU(e,t){let{[pD]:n,...r}=e;return t.plot?.interactors?.has(n)||t.error(`Unrecognized interactor type: ${n}`,e),new m_(n,wr(r,t))}var m_=class extends $t{constructor(t,n){super(vU),this.name=t,this.options=n}instantiate(t){let n=t.api[this.name];return n(this.options.instantiate(t))}codegen(t){let n=this.options.codegen(t);return`${t.tab()}${t.ns()}${this.name}(${n})`}toJSON(){let{name:t,options:n}=this;return{[pD]:t,...n.toJSON()}}};function kU(e,t){let{label:n}=e,r=e[wc]?wc:e[la]?la:t.error("Unrecognized expression type",e),i=e[r],o=i.split(/(\\'|\\"|"(?:\\"|[^"])*"|'(?:\\'|[^'])*'|\$\w+)/g),s=[""],a=[];for(let c=0,l=0;c<o.length;++c){let u=o[c];u.startsWith("$")?(a[l]=t.maybeParam(u),s[++l]=""):s[l]+=u}return new y_(i,s,a,n,r===la)}var y_=class extends $t{constructor(t,n,r,i,o){super(xU),this.value=t,this.spans=n,this.params=r,this.label=i,this.aggregate=o}instantiate(t){let{spans:n,params:r,label:i,aggregate:o}=this,s=t.api[o?la:wc],a=r.map(c=>c.instantiate(t));return s(n,...a).annotate({label:i})}codegen(t){let{spans:n,params:r,label:i,aggregate:o}=this,s=o?la:wc,a="",c=r.length;for(let l=0;l<c;++l)a+=n[l]+"${"+r[l].codegen(t)+"}";return a+=n[c],`${t.ns()}${s}\`${a}\``+(i?`.annotate({ label: ${JSON.stringify(i)} })`:"")}toJSON(){return{[this.aggregate?la:wc]:this.value}}};function FU(e,t){if(!e)return null;if(xi(e))return new Gl(e);let{from:n,...r}=e;return new g_(n,wr(r,t))}var g_=class extends $t{constructor(t,n){super(mD),this.table=t,this.options=n}instantiate(t){let{table:n,options:r}=this;return t.api[mD](n,r.instantiate(t))}codegen(t){let{type:n,table:r,options:i}=this,o=i.codegen(t);return`${t.ns()}${n}("${r}"${o?", "+o:""})`}toJSON(){let{type:t,table:n,options:r}=this;return{[t]:n,...r.toJSON()}}};function gD(e){return e==null?[]:[e].flat()}function RU(e,t){let n;for(let o in e)t.transforms.has(o)&&(n=o);if(!n)return;let r=n==="count"||n==null?[]:gD(e[n]),i={distinct:e.distinct,orderby:gD(e.orderby).map(o=>t.maybeParam(o)),partitionby:gD(e.partitionby).map(o=>t.maybeParam(o)),rows:e.rows?t.maybeParam(e.rows):null,range:e.range?t.maybeParam(e.range):null};return new x_(n,r,i)}var x_=class extends $t{constructor(t,n,r){super(wU),this.name=t,this.args=n,this.options=r}instantiate(t){let{name:n,args:r,options:i}=this,{distinct:o,orderby:s,partitionby:a,rows:c,range:l}=i,u=t.api[n],f=u(...r);return o&&(f=f.distinct()),s.length&&(f=f.orderby(s.map(d=>d.instantiate(t)))),a.length&&(f=f.partitionby(a.map(d=>d.instantiate(t)))),c!=null?f=f.rows(c.instantiate(t)):l!=null&&(f=f.range(l.instantiate(t))),f}codegen(t){let{name:n,args:r,options:i}=this,{distinct:o,orderby:s,partitionby:a,rows:c,range:l}=i,u=`${t.ns()}${n}(`+r.map(f=>JSON.stringify(f)).join(", ")+")";if(o&&(u+=".distinct()"),s.length){let f=s.map(d=>d.codegen(t));u+=`.orderby(${f.join(", ")})`}if(a.length){let f=a.map(d=>d.codegen(t));u+=`.partitionby(${f.join(", ")})`}return c?u+=`.rows(${c.codegen(t)})`:l&&(u+=`.range(${l.codegen(t)})`),u}toJSON(){let{name:t,args:n,options:r}=this,{distinct:i,orderby:o,partitionby:s,rows:a,range:c}=r,l={[t]:xD(n)};return i&&(l.distinct=!0),o.length&&(l.orderby=xD(o.map(u=>u.toJSON()))),s.length&&(l.partitionby=xD(s.map(u=>u.toJSON()))),a?l.rows=a.toJSON():c&&(l.range=c.toJSON()),l}};function xD(e){return e.length===0?"":e.length===1?e[0]:e}function Ynt(e,t){if(Od(e))return e[wc]||e[la]?kU(e,t):RU(e,t)}function $U(e,t){let{mark:n,data:r,...i}=e;t.plot?.marks?.has(n)||t.error(`Unrecognized mark type: ${n}`,e);let o=FU(r,t),s={};for(let a in i){let c=i[a];s[a]=Ynt(c,t)||t.maybeParam(c)}return new b_(n,o,new Ld(s))}var b_=class extends $t{constructor(t,n,r){super(Hv),this.name=t,this.data=n,this.options=r}instantiate(t){let{name:n,data:r,options:i}=this,o=t.api[n],s=i.instantiate(t);return r?o(r.instantiate(t),s):o(s)}codegen(t){let{name:n,data:r,options:i}=this,o=r?r.codegen(t):"",s=i.codegen(t),a;if(o&&s){t.indent();let c=i.codegen(t);a=`
81
81
  ${t.tab()}${o},
82
82
  ${t.tab()}${c}
83
- `,t.undent(),a+=t.tab()}else a=`${o}${s}`;return`${t.tab()}${t.ns()}${n}(${a})`}toJSON(){let{type:t,name:n,data:r,options:i}=this;return{[t]:n,...r?{data:r.toJSON()}:{},...i.toJSON()}}};function uU(e,t){return HN({plot:[e]},t)}function HN(e,t){let{[Nd]:n,...r}=e,i=Object.entries(r).map(([s,a])=>c_(s,a,t)),o=n.map(s=>Go(s.mark)?lU(s,t):Go(s.legend)?h_(s,t):Go(s.select)?oU(s,t):t.error("Invalid plot entry.",s));return new b_(o,i)}var b_=class extends $t{constructor(t,n){super(Nd,t),this.attributes=n}instantiate(t){let n=[...t.plotDefaults||[],...this.attributes||[]];return t.api[Nd](this.children.map(r=>r.instantiate(t)),n.map(r=>r.instantiate(t)))}codegen(t){let{type:n,children:r,attributes:i}=this;t.indent();let o=[...r.map(s=>s.codegen(t)),...t.plotDefaults?.length?[`${t.tab()}...defaultAttributes`]:[],...i.map(s=>s.codegen(t))].join(`,
83
+ `,t.undent(),a+=t.tab()}else a=`${o}${s}`;return`${t.tab()}${t.ns()}${n}(${a})`}toJSON(){let{type:t,name:n,data:r,options:i}=this;return{[t]:n,...r?{data:r.toJSON()}:{},...i.toJSON()}}};function PU(e,t){return bD({plot:[e]},t)}function bD(e,t){let{[Dd]:n,...r}=e,i=Object.entries(r).map(([s,a])=>l_(s,a,t)),o=n.map(s=>Go(s.mark)?$U(s,t):Go(s.legend)?p_(s,t):Go(s.select)?CU(s,t):t.error("Invalid plot entry.",s));return new w_(o,i)}var w_=class extends $t{constructor(t,n){super(Dd,t),this.attributes=n}instantiate(t){let n=[...t.plotDefaults||[],...this.attributes||[]];return t.api[Dd](this.children.map(r=>r.instantiate(t)),n.map(r=>r.instantiate(t)))}codegen(t){let{type:n,children:r,attributes:i}=this;t.indent();let o=[...r.map(s=>s.codegen(t)),...t.plotDefaults?.length?[`${t.tab()}...defaultAttributes`]:[],...i.map(s=>s.codegen(t))].join(`,
84
84
  `);return t.undent(),`${t.tab()}${t.ns()}${n}(
85
85
  ${o}
86
- ${t.tab()})`}toJSON(){let{type:t,children:n,attributes:r}=this,i={[t]:n.map(o=>o.toJSON())};for(let o of r)Object.assign(i,o.toJSON());return i}};function fU(e,t){let n=e[Td].map(r=>t.parseComponent(r));return new w_(n)}var w_=class extends $t{constructor(t){super(Td,t)}instantiate(t){return t.api[Td](this.children.map(n=>n.instantiate(t)))}codegen(t){t.indent();let n=this.children.map(r=>r.codegen(t));return t.undent(),`${t.tab()}${t.ns()}${this.type}(
86
+ ${t.tab()})`}toJSON(){let{type:t,children:n,attributes:r}=this,i={[t]:n.map(o=>o.toJSON())};for(let o of r)Object.assign(i,o.toJSON());return i}};function UU(e,t){let n=e[Td].map(r=>t.parseComponent(r));return new v_(n)}var v_=class extends $t{constructor(t){super(Td,t)}instantiate(t){return t.api[Td](this.children.map(n=>n.instantiate(t)))}codegen(t){t.indent();let n=this.children.map(r=>r.codegen(t));return t.undent(),`${t.tab()}${t.ns()}${this.type}(
87
87
  ${n.join(`,
88
88
  `)}
89
- ${t.tab()})`}toJSON(){return{[this.type]:this.children.map(t=>t.toJSON())}}};function dU(e){return new v_(e[Ed])}var v_=class extends $t{constructor(t){super(Ed),this.value=t}instantiate(t){return t.api[Ed](this.value)}codegen(t){return`${t.tab()}${t.ns()}${this.type}(${this.value})`}toJSON(){return{[this.type]:this.value}}};function hU(e=[]){return new Map([[Nd,HN],[Wv,uU],[Jy,h_],[Zy,iU],[Md,nU],[Td,fU],[Ad,rU],[Ed,dU],...e])}function pU(e=[]){return new Set(["menu","search","slider","table",...e])}function mU({attributes:e=mnt(),interactors:t=ynt(),legends:n=gnt(),marks:r=xnt()}={}){return{attributes:e,interactors:t,legends:n,marks:r}}function mnt(e=[]){return new Set([...Object.keys(zv),...e])}function ynt(e=[]){return new Set([...Object.keys(qv),...e])}function gnt(e=[]){return new Set([...Object.keys(Vv),...e])}function xnt(e=[]){return new Set([...Object.keys(jv),...e])}function yU(e=[]){return new Set(["avg","bin","centroid","centroidX","centroidY","count","dateMonth","dateMonthDay","dateDay","geojson","max","median","min","mode","quantile","sum","row_number","rank","dense_rank","percent_rank","cume_dist","ntile","lag","lead","first_value","last_value","nth_value",...e])}function bnt(e,t){return e=Go(e)?JSON.parse(e):e,new ZN(t).parse(e)}var ZN=class{constructor({components:t=hU(),transforms:n=yU(),inputs:r=pU(),plot:i=mU(),params:o=[],datasets:s=[]}={}){this.components=t,this.transforms=n,this.inputs=r,this.plot=i,this.params=new Map(o),this.datasets=new Map(s)}parse(t){let{meta:n,config:r,data:i={},params:o,plotDefaults:s={},...a}=t;for(let c in i)this.datasets.set(c,tU(c,i[c],this));this.plotDefaults=Object.entries(s).map(([c,l])=>c_(c,l,this));for(let c in o)this.params.set(c,eU(o[c],this));return new Ky(this.parseComponent(a),n?{...n}:void 0,r?{...r}:void 0,Object.fromEntries(this.datasets),Object.fromEntries(this.params),this.plotDefaults)}parseComponent(t){for(let[n,r]of this.components)if(t[n]!=null)return r(t,this);this.error("Invalid specification.",t)}maybeParam(t,n=()=>new Wl){let{params:r}=this,i=GP(t);if(i){if(!r.has(i)){let o=n();r.set(i,o)}return new ng(i)}return new Xl(t)}maybeSelection(t){return this.maybeParam(t,()=>new Gl)}error(t,n){Od(t,n)}};export{aa as AGG,$t as ASTNode,VP as ATTRIBUTE,PP as CROSSFILTER,Kv as CSVDataNode,o_ as CodegenContext,jP as DATA,Aqt as DATAREF,Hv as DataNode,qP as EXPRESSION,m_ as ExpressionNode,Qy as FIXED,YN as FROM,Yl as FileDataNode,Md as HCONCAT,l_ as HConcatNode,Ad as HSPACE,u_ as HSpaceNode,Zy as INPUT,XP as INTERACTOR,Gv as INTERSECT,f_ as InputNode,i_ as InstantiateContext,t_ as JSONDataNode,Jy as LEGEND,Yv as LITERAL,e_ as LiteralJSONDataNode,Xl as LiteralNode,Wv as MARK,CP as OPTIONS,Bd as OptionsNode,$P as PARAM,RP as PARAMREF,Nd as PLOT,Wl as ParamNode,ng as ParamRefNode,Qv as ParquetDataNode,s_ as PlotAttributeNode,a_ as PlotFixedNode,y_ as PlotFromNode,p_ as PlotInteractorNode,d_ as PlotLegendNode,x_ as PlotMarkNode,b_ as PlotNode,Ld as QueryDataNode,VN as SELECT,FP as SELECTION,zP as SINGLE,kP as SPEC,xc as SQL,Gl as SelectionNode,Jv as SpatialDataNode,Ky as SpecNode,YP as TRANSFORM,Zv as TableDataNode,g_ as TransformNode,UP as UNION,Xv as VALUE,Td as VCONCAT,w_ as VConcatNode,Ed as VSPACE,v_ as VSpaceNode,unt as astToDOM,fnt as astToESM,bnt as parseSpec};
89
+ ${t.tab()})`}toJSON(){return{[this.type]:this.children.map(t=>t.toJSON())}}};function zU(e){return new __(e[Nd])}var __=class extends $t{constructor(t){super(Nd),this.value=t}instantiate(t){return t.api[Nd](this.value)}codegen(t){return`${t.tab()}${t.ns()}${this.type}(${this.value})`}toJSON(){return{[this.type]:this.value}}};function qU(e=[]){return new Map([[Dd,bD],[Hv,PU],[Qy,p_],[Jy,LU],[Ad,OU],[Td,UU],[Ed,BU],[Nd,zU],...e])}function jU(e=[]){return new Set(["menu","search","slider","table",...e])}function VU({attributes:e=Xnt(),interactors:t=Gnt(),legends:n=Wnt(),marks:r=Hnt()}={}){return{attributes:e,interactors:t,legends:n,marks:r}}function Xnt(e=[]){return new Set([...Object.keys(qv),...e])}function Gnt(e=[]){return new Set([...Object.keys(Vv),...e])}function Wnt(e=[]){return new Set([...Object.keys(Yv),...e])}function Hnt(e=[]){return new Set([...Object.keys(jv),...e])}function YU(e=[]){return new Set(["argmin","argmax","avg","bin","centroid","centroidX","centroidY","count","dateMonth","dateMonthDay","dateDay","first","geojson","last","max","median","min","mode","product","quantile","sum","row_number","rank","dense_rank","percent_rank","cume_dist","ntile","lag","lead","first_value","last_value","nth_value",...e])}function Znt(e,t){return e=Go(e)?JSON.parse(e):e,new wD(t).parse(e)}var wD=class{constructor({components:t=qU(),transforms:n=YU(),inputs:r=jU(),plot:i=VU(),params:o=[],datasets:s=[]}={}){this.components=t,this.transforms=n,this.inputs=r,this.plot=i,this.params=new Map(o),this.datasets=new Map(s)}parse(t){let{meta:n,config:r,data:i={},params:o,plotDefaults:s={},...a}=t;for(let c in i)this.datasets.set(c,NU(c,i[c],this));this.plotDefaults=Object.entries(s).map(([c,l])=>l_(c,l,this));for(let c in o)this.params.set(c,DU(o[c],this));return new tg(this.parseComponent(a),n?{...n}:void 0,r?{...r}:void 0,Object.fromEntries(this.datasets),Object.fromEntries(this.params),this.plotDefaults)}parseComponent(t){for(let[n,r]of this.components)if(t[n]!=null)return r(t,this);this.error("Invalid specification.",t)}maybeParam(t,n=()=>new Hl){let{params:r}=this,i=_U(t);if(i){if(!r.has(i)){let o=n();r.set(i,o)}return new rg(i)}return new Gl(t)}maybeSelection(t){return this.maybeParam(t,()=>new Wl)}error(t,n){Bd(t,n)}};export{la as AGG,$t as ASTNode,bU as ATTRIBUTE,pU as CROSSFILTER,t_ as CSVDataNode,s_ as CodegenContext,gU as DATA,yVt as DATAREF,Zv as DataNode,xU as EXPRESSION,y_ as ExpressionNode,Ky as FIXED,mD as FROM,Xl as FileDataNode,Ad as HCONCAT,u_ as HConcatNode,Ed as HSPACE,f_ as HSpaceNode,Jy as INPUT,vU as INTERACTOR,Wv as INTERSECT,d_ as InputNode,o_ as InstantiateContext,e_ as JSONDataNode,Qy as LEGEND,Xv as LITERAL,n_ as LiteralJSONDataNode,Gl as LiteralNode,Hv as MARK,uU as OPTIONS,Ld as OptionsNode,hU as PARAM,dU as PARAMREF,Dd as PLOT,Hl as ParamNode,rg as ParamRefNode,Kv as ParquetDataNode,a_ as PlotAttributeNode,c_ as PlotFixedNode,g_ as PlotFromNode,m_ as PlotInteractorNode,h_ as PlotLegendNode,b_ as PlotMarkNode,w_ as PlotNode,Cd as QueryDataNode,pD as SELECT,fU as SELECTION,yU as SINGLE,lU as SPEC,wc as SQL,Wl as SelectionNode,Qv as SpatialDataNode,tg as SpecNode,wU as TRANSFORM,Jv as TableDataNode,x_ as TransformNode,mU as UNION,Gv as VALUE,Td as VCONCAT,v_ as VConcatNode,Nd as VSPACE,__ as VSpaceNode,znt as astToDOM,qnt as astToESM,Znt as parseSpec};