@uwdata/mosaic-plot 0.8.0 → 0.9.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 fF=Object.create;var Nw=Object.defineProperty;var hF=Object.getOwnPropertyDescriptor;var dF=Object.getOwnPropertyNames;var pF=Object.getPrototypeOf,mF=Object.prototype.hasOwnProperty;var E3=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),Vs=(e,t)=>{for(var n in t)Nw(e,n,{get:t[n],enumerable:!0})},yF=(e,t,n,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of dF(t))!mF.call(e,i)&&i!==n&&Nw(e,i,{get:()=>t[i],enumerable:!(r=hF(t,i))||r.enumerable});return e};var gF=(e,t,n)=>(n=e!=null?fF(pF(e)):{},yF(t||!e||!e.__esModule?Nw(n,"default",{value:e,enumerable:!0}):n,e));var oL=E3((xOt,iL)=>{"use strict";function HW(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 ZW(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 KW(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 QW(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 JW(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 Wm(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)}iL.exports={ge:function(e,t,n,r,i){return Wm(e,t,n,r,i,HW)},gt:function(e,t,n,r,i){return Wm(e,t,n,r,i,ZW)},lt:function(e,t,n,r,i){return Wm(e,t,n,r,i,KW)},le:function(e,t,n,r,i){return Wm(e,t,n,r,i,QW)},eq:function(e,t,n,r,i){return Wm(e,t,n,r,i,JW)}}});var dL=E3((wOt,hL)=>{"use strict";var bw=oL(),kf=0,xl=1,gw=2;hL.exports=eG;function jM(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 Gm=jM.prototype;function qM(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 cL(e,t){var n=Rf(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 sL(e,t){var n=e.intervals([]);n.push(t),cL(e,n)}function aL(e,t){var n=e.intervals([]),r=n.indexOf(t);return r<0?kf:(n.splice(r,1),cL(e,n),xl)}Gm.intervals=function(e){return e.push.apply(e,this.leftPoints),this.left&&this.left.intervals(e),this.right&&this.right.intervals(e),e};Gm.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)?sL(this,e):this.left.insert(e):this.left=Rf([e]);else if(e[0]>this.mid)this.right?4*(this.right.count+1)>3*(t+1)?sL(this,e):this.right.insert(e):this.right=Rf([e]);else{var n=bw.ge(this.leftPoints,e,YM),r=bw.ge(this.rightPoints,e,WM);this.leftPoints.splice(n,0,e),this.rightPoints.splice(r,0,e)}};Gm.remove=function(e){var t=this.count-this.leftPoints;if(e[1]<this.mid){if(!this.left)return kf;var n=this.right?this.right.count:0;if(4*n>3*(t-1))return aL(this,e);var r=this.left.remove(e);return r===gw?(this.left=null,this.count-=1,xl):(r===xl&&(this.count-=1),r)}else if(e[0]>this.mid){if(!this.right)return kf;var i=this.left?this.left.count:0;if(4*i>3*(t-1))return aL(this,e);var r=this.right.remove(e);return r===gw?(this.right=null,this.count-=1,xl):(r===xl&&(this.count-=1),r)}else{if(this.count===1)return this.leftPoints[0]===e?gw:kf;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}qM(this,s),this.count=(this.left?this.left.count:0)+(this.right?this.right.count:0)+this.leftPoints.length}else this.left?qM(this,this.left):qM(this,this.right);return xl}for(var a=bw.ge(this.leftPoints,e,YM);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=bw.ge(this.rightPoints,e,WM);r<this.rightPoints.length&&this.rightPoints[r][1]===e[1];++r)if(this.rightPoints[r]===e)return this.rightPoints.splice(r,1),xl}return kf}};function lL(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 uL(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 fL(e,t){for(var n=0;n<e.length;++n){var r=t(e[n]);if(r)return r}}Gm.queryPoint=function(e,t){if(e<this.mid){if(this.left){var n=this.left.queryPoint(e,t);if(n)return n}return lL(this.leftPoints,e,t)}else if(e>this.mid){if(this.right){var n=this.right.queryPoint(e,t);if(n)return n}return uL(this.rightPoints,e,t)}else return fL(this.leftPoints,t)};Gm.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?lL(this.leftPoints,t,n):e>this.mid?uL(this.rightPoints,e,n):fL(this.leftPoints,n)};function tG(e,t){return e-t}function YM(e,t){var n=e[0]-t[0];return n||e[1]-t[1]}function WM(e,t){var n=e[1]-t[1];return n||e[0]-t[0]}function Rf(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(tG);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(YM),l.sort(WM),new jM(r,Rf(i),Rf(o),c,l)}function VM(e){this.root=e}var $f=VM.prototype;$f.insert=function(e){this.root?this.root.insert(e):this.root=new jM(e[0],null,null,[e],[e])};$f.remove=function(e){if(this.root){var t=this.root.remove(e);return t===gw&&(this.root=null),t!==kf}return!1};$f.queryPoint=function(e,t){if(this.root)return this.root.queryPoint(e,t)};$f.queryInterval=function(e,t,n){if(e<=t&&this.root)return this.root.queryInterval(e,t,n)};Object.defineProperty($f,"count",{get:function(){return this.root?this.root.count:0}});Object.defineProperty($f,"intervals",{get:function(){return this.root?this.root.intervals([]):[]}});function eG(e){return!e||e.length===0?new VM(null):new VM(Rf(e))}});var js=Symbol("Fixed"),gn=Symbol("Transient"),Vf=Symbol("Transform");var D3={};function jf(e,t=!1){let n,r,i=D3;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=D3,a(u)}),i=l}return t?c:a}var Yf=class{constructor(t){this._filterBy=t,this._requestUpdate=jf(()=>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(t){return this}query(t){return null}queryPending(){return this}queryResult(t){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 B3(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 N3(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 Lt(e){return this instanceof Lt?(this.v=e,this):new Lt(e)}function br(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(h){r[h]&&(i[h]=function(d){return new Promise(function(p,m){o.push([h,d,p,m])>1||a(h,d)})})}function a(h,d){try{c(r[h](d))}catch(p){f(o[0][3],p)}}function c(h){h.value instanceof Lt?Promise.resolve(h.value.v).then(l,u):f(o[0][2],h)}function l(h){a("next",h)}function u(h){a("throw",h)}function f(h,d){h(d),o.shift(),o.length&&a(o[0][0],o[0][1])}}function Sl(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:Lt(e[i](s)),done:!1}:o?o(s):s}:o}}function li(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 N3=="function"?N3(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 kw={};Vs(kw,{compareArrayLike:()=>Cw,joinUint8Arrays:()=>wr,memcpy:()=>Xf,rebaseValueOffsets:()=>ly,toArrayBufferView:()=>kt,toArrayBufferViewAsyncIterator:()=>fi,toArrayBufferViewIterator:()=>Ui,toBigInt64Array:()=>cy,toBigUint64Array:()=>AF,toFloat32Array:()=>TF,toFloat32ArrayAsyncIterator:()=>VF,toFloat32ArrayIterator:()=>CF,toFloat64Array:()=>EF,toFloat64ArrayAsyncIterator:()=>jF,toFloat64ArrayIterator:()=>kF,toInt16Array:()=>SF,toInt16ArrayAsyncIterator:()=>UF,toInt16ArrayIterator:()=>BF,toInt32Array:()=>Za,toInt32ArrayAsyncIterator:()=>PF,toInt32ArrayIterator:()=>OF,toInt8Array:()=>vF,toInt8ArrayAsyncIterator:()=>$F,toInt8ArrayIterator:()=>NF,toUint16Array:()=>IF,toUint16ArrayAsyncIterator:()=>zF,toUint16ArrayIterator:()=>LF,toUint32Array:()=>MF,toUint32ArrayAsyncIterator:()=>qF,toUint32ArrayIterator:()=>FF,toUint8Array:()=>wt,toUint8ArrayAsyncIterator:()=>Fw,toUint8ArrayIterator:()=>Lw,toUint8ClampedArray:()=>DF,toUint8ClampedArrayAsyncIterator:()=>YF,toUint8ClampedArrayIterator:()=>RF});var bF=new TextDecoder("utf-8"),Wf=e=>bF.decode(e),xF=new TextEncoder,$i=e=>xF.encode(e);var wF=e=>typeof e=="number",O3=e=>typeof e=="boolean",Qe=e=>typeof e=="function",qn=e=>e!=null&&Object(e)===e,xr=e=>qn(e)&&Qe(e.then);var ui=e=>qn(e)&&Qe(e[Symbol.iterator]),$r=e=>qn(e)&&Qe(e[Symbol.asyncIterator]),ny=e=>qn(e)&&qn(e.schema);var ry=e=>qn(e)&&"done"in e&&"value"in e;var iy=e=>qn(e)&&Qe(e.stat)&&wF(e.fd);var oy=e=>qn(e)&&Gf(e.body),sy=e=>"_getDOMStream"in e&&"_getNodeStream"in e,L3=e=>qn(e)&&Qe(e.abort)&&Qe(e.getWriter)&&!sy(e),Gf=e=>qn(e)&&Qe(e.cancel)&&Qe(e.getReader)&&!sy(e),F3=e=>qn(e)&&Qe(e.end)&&Qe(e.write)&&O3(e.writable)&&!sy(e),ay=e=>qn(e)&&Qe(e.read)&&Qe(e.pipe)&&O3(e.readable)&&!sy(e),C3=e=>qn(e)&&Qe(e.clear)&&Qe(e.bytes)&&Qe(e.position)&&Qe(e.setPosition)&&Qe(e.capacity)&&Qe(e.getBufferIdentifier)&&Qe(e.createLong);var Ow=typeof SharedArrayBuffer<"u"?SharedArrayBuffer:ArrayBuffer;function _F(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 Xf(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 wr(e,t){let n=_F(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?Xf(s,o,a):s=o;break}Xf(s||(s=new Uint8Array(l)),o,a),a+=o.length}return[s||new Uint8Array(0),n.slice(c),r-(s?s.byteLength:0)]}function kt(e,t){let n=ry(t)?t.value:t;return n instanceof e?e===Uint8Array?new e(n.buffer,n.byteOffset,n.byteLength):n:n?(typeof n=="string"&&(n=$i(n)),n instanceof ArrayBuffer?new e(n):n instanceof Ow?new e(n):C3(n)?kt(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 vF=e=>kt(Int8Array,e),SF=e=>kt(Int16Array,e),Za=e=>kt(Int32Array,e),cy=e=>kt(BigInt64Array,e),wt=e=>kt(Uint8Array,e),IF=e=>kt(Uint16Array,e),MF=e=>kt(Uint32Array,e),AF=e=>kt(BigUint64Array,e),TF=e=>kt(Float32Array,e),EF=e=>kt(Float64Array,e),DF=e=>kt(Uint8ClampedArray,e),Bw=e=>(e.next(),e);function*Ui(e,t){let n=function*(i){yield i},r=typeof t=="string"||ArrayBuffer.isView(t)||t instanceof ArrayBuffer||t instanceof Ow?n(t):ui(t)?t:n(t);return yield*Bw(function*(i){let o=null;do o=i.next(yield kt(e,o));while(!o.done)}(r[Symbol.iterator]())),new e}var NF=e=>Ui(Int8Array,e),BF=e=>Ui(Int16Array,e),OF=e=>Ui(Int32Array,e),Lw=e=>Ui(Uint8Array,e),LF=e=>Ui(Uint16Array,e),FF=e=>Ui(Uint32Array,e),CF=e=>Ui(Float32Array,e),kF=e=>Ui(Float64Array,e),RF=e=>Ui(Uint8ClampedArray,e);function fi(e,t){return br(this,arguments,function*(){if(xr(t))return yield Lt(yield Lt(yield*Sl(li(fi(e,yield Lt(t))))));let r=function(s){return br(this,arguments,function*(){yield yield Lt(yield Lt(s))})},i=function(s){return br(this,arguments,function*(){yield Lt(yield*Sl(li(Bw(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 Ow?r(t):ui(t)?i(t):$r(t)?t:r(t);return yield Lt(yield*Sl(li(Bw(function(s){return br(this,arguments,function*(){let a=null;do a=yield Lt(s.next(yield yield Lt(kt(e,a))));while(!a.done)})}(o[Symbol.asyncIterator]()))))),yield Lt(new e)})}var $F=e=>fi(Int8Array,e),UF=e=>fi(Int16Array,e),PF=e=>fi(Int32Array,e),Fw=e=>fi(Uint8Array,e),zF=e=>fi(Uint16Array,e),qF=e=>fi(Uint32Array,e),VF=e=>fi(Float32Array,e),jF=e=>fi(Float64Array,e),YF=e=>fi(Uint8ClampedArray,e);function ly(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 Cw(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 bn={fromIterable(e){return uy(WF(e))},fromAsyncIterable(e){return uy(GF(e))},fromDOMStream(e){return uy(XF(e))},fromNodeStream(e){return uy(HF(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')}},uy=e=>(e.next(),e);function*WF(e){let t,n=!1,r=[],i,o,s,a=0;function c(){return o==="peek"?wr(r,s)[0]:([i,r,a]=wr(r,s),i)}({cmd:o,size:s}=(yield null)||{cmd:"read",size:0});let l=Lw(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 GF(e){return br(this,arguments,function*(){let n,r=!1,i=[],o,s,a,c=0;function l(){return s==="peek"?wr(i,a)[0]:([o,i,c]=wr(i,a),o)}({cmd:s,size:a}=(yield yield Lt(null))||{cmd:"read",size:0});let u=Fw(e)[Symbol.asyncIterator]();try{do if({done:n,value:o}=Number.isNaN(a-c)?yield Lt(u.next()):yield Lt(u.next(a-c)),!n&&o.byteLength>0&&(i.push(o),c+=o.byteLength),n||a<=c)do({cmd:s,size:a}=yield yield Lt(l()));while(a<c);while(!n)}catch(f){(r=!0)&&typeof u.throw=="function"&&(yield Lt(u.throw(f)))}finally{r===!1&&typeof u.return=="function"&&(yield Lt(u.return(new Uint8Array(0))))}return yield Lt(null)})}function XF(e){return br(this,arguments,function*(){let n=!1,r=!1,i=[],o,s,a,c=0;function l(){return s==="peek"?wr(i,a)[0]:([o,i,c]=wr(i,a),o)}({cmd:s,size:a}=(yield yield Lt(null))||{cmd:"read",size:0});let u=new $w(e);try{do if({done:n,value:o}=Number.isNaN(a-c)?yield Lt(u.read()):yield Lt(u.read(a-c)),!n&&o.byteLength>0&&(i.push(wt(o)),c+=o.byteLength),n||a<=c)do({cmd:s,size:a}=yield yield Lt(l()));while(a<c);while(!n)}catch(f){(r=!0)&&(yield Lt(u.cancel(f)))}finally{r===!1?yield Lt(u.cancel()):e.locked&&u.releaseLock()}return yield Lt(null)})}var $w=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=wt(n)),n})}},Rw=(e,t)=>{let n=i=>r([t,i]),r;return[t,n,new Promise(i=>(r=i)&&e.once(t,n))]};function HF(e){return br(this,arguments,function*(){let n=[],r="error",i=!1,o=null,s,a,c=0,l=[],u;function f(){return s==="peek"?wr(l,a)[0]:([u,l,c]=wr(l,a),u)}if({cmd:s,size:a}=(yield yield Lt(null))||{cmd:"read",size:0},e.isTTY)return yield yield Lt(new Uint8Array(0)),yield Lt(null);try{n[0]=Rw(e,"end"),n[1]=Rw(e,"error");do{if(n[2]=Rw(e,"readable"),[r,o]=yield Lt(Promise.race(n.map(d=>d[2]))),r==="error")break;if((i=r==="end")||(Number.isFinite(a-c)?(u=wt(e.read(a-c)),u.byteLength<a-c&&(u=wt(e.read()))):u=wt(e.read()),u.byteLength>0&&(l.push(u),c+=u.byteLength)),i||a<=c)do({cmd:s,size:a}=yield yield Lt(f()));while(a<c)}while(!i)}finally{yield Lt(h(n,r==="error"?o:null))}return yield Lt(null);function h(d,p){return u=l=null,new Promise((m,y)=>{for(let[g,b]of d)e.off(g,b);try{let g=e.destroy;g&&g.call(e,p),p=void 0}catch(g){p=g||p}finally{p!=null?y(p):m()}})}})}var oe;(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"})(oe||(oe={}));var pe;(function(e){e[e.Sparse=0]="Sparse",e[e.Dense=1]="Dense"})(pe||(pe={}));var ue;(function(e){e[e.HALF=0]="HALF",e[e.SINGLE=1]="SINGLE",e[e.DOUBLE=2]="DOUBLE"})(ue||(ue={}));var ze;(function(e){e[e.DAY=0]="DAY",e[e.MILLISECOND=1]="MILLISECOND"})(ze||(ze={}));var at;(function(e){e[e.SECOND=0]="SECOND",e[e.MILLISECOND=1]="MILLISECOND",e[e.MICROSECOND=2]="MICROSECOND",e[e.NANOSECOND=3]="NANOSECOND"})(at||(at={}));var on;(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"})(on||(on={}));var Pi=new Int32Array(2),fy=new Float32Array(Pi.buffer),hy=new Float64Array(Pi.buffer),Il=new Uint16Array(new Uint8Array([1,0]).buffer)[0]===1;var Hf;(function(e){e[e.UTF8_BYTES=1]="UTF8_BYTES",e[e.UTF16_STRING=2]="UTF16_STRING"})(Hf||(Hf={}));var _r=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 Pi[0]=this.readInt32(t),fy[0]}readFloat64(t){return Pi[Il?0:1]=this.readInt32(t),Pi[Il?1:0]=this.readInt32(t+4),hy[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){fy[0]=n,this.writeInt32(t,Pi[0])}writeFloat64(t,n){hy[0]=n,this.writeInt32(t,Pi[Il?0:1]),this.writeInt32(t+4,Pi[Il?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===Hf.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 Ka=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=_r.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=_r.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 Zf;(function(e){e[e.BUFFER=0]="BUFFER"})(Zf||(Zf={}));var Kf;(function(e){e[e.LZ4_FRAME=0]="LZ4_FRAME",e[e.ZSTD=1]="ZSTD"})(Kf||(Kf={}));var py=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):Kf.LZ4_FRAME}method(){let t=this.bb.__offset(this.bb_pos,6);return t?this.bb.readInt8(this.bb_pos+t):Zf.BUFFER}static startBodyCompression(t){t.startObject(2)}static addCodec(t,n){t.addFieldInt8(0,n,Kf.LZ4_FRAME)}static addMethod(t,n){t.addFieldInt8(1,n,Zf.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 Ml=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 Al=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 vr=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 Al).__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 Ml).__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 py).__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 zo=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 vr).__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 Ys;(function(e){e[e.Little=0]="Little",e[e.Big=1]="Big"})(Ys||(Ys={}));var Qf;(function(e){e[e.DenseArray=0]="DenseArray"})(Qf||(Qf={}));var di=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 zi=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 di).__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):Qf.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,Qf.DenseArray)}static endDictionaryEncoding(t){return t.endObject()}};var Je=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 Jf=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 th=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 Ws=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):ze.MILLISECOND}static startDate(t){t.startObject(1)}static addUnit(t,n){t.addFieldInt16(0,n,ze.MILLISECOND)}static endDate(t){return t.endObject()}static createDate(t,n){return e.startDate(t),e.addUnit(t,n),e.endDate(t)}};var qi=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 Gs=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):at.MILLISECOND}static startDuration(t){t.startObject(1)}static addUnit(t,n){t.addFieldInt16(0,n,at.MILLISECOND)}static endDuration(t){return t.endObject()}static createDuration(t,n){return e.startDuration(t),e.addUnit(t,n),e.endDuration(t)}};var Xs=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 Hs=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 Zs=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):ue.HALF}static startFloatingPoint(t){t.startObject(1)}static addPrecision(t,n){t.addFieldInt16(0,n,ue.HALF)}static endFloatingPoint(t){return t.endObject()}static createFloatingPoint(t,n){return e.startFloatingPoint(t),e.addPrecision(t,n),e.endFloatingPoint(t)}};var Ks=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):on.YEAR_MONTH}static startInterval(t){t.startObject(1)}static addUnit(t,n){t.addFieldInt16(0,n,on.YEAR_MONTH)}static endInterval(t){return t.endObject()}static createInterval(t,n){return e.startInterval(t),e.addUnit(t,n),e.endInterval(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 getRootAsLargeBinary(t,n){return(n||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsLargeBinary(t,n){return t.setPosition(t.position()+4),(n||new e).__init(t.readInt32(t.position())+t.position(),t)}static startLargeBinary(t){t.startObject(0)}static endLargeBinary(t){return t.endObject()}static createLargeBinary(t){return e.startLargeBinary(t),e.endLargeBinary(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 getRootAsLargeUtf8(t,n){return(n||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsLargeUtf8(t,n){return t.setPosition(t.position()+4),(n||new e).__init(t.readInt32(t.position())+t.position(),t)}static startLargeUtf8(t){t.startObject(0)}static endLargeUtf8(t){return t.endObject()}static createLargeUtf8(t){return e.startLargeUtf8(t),e.endLargeUtf8(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 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 Qs=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 ih=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 oh=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 qo=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):at.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,at.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 Vo=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):at.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,at.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 pi=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):pe.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,pe.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 sh=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 fe;(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"})(fe||(fe={}));var Nn=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):fe.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 zi).__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 Je).__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,fe.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 ar=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):Ys.Little}fields(t,n){let r=this.bb.__offset(this.bb_pos,6);return r?(n||new Nn).__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 Je).__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,Ys.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 Ut;(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"})(Ut||(Ut={}));var O;(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.LargeBinary=19]="LargeBinary",e[e.LargeUtf8=20]="LargeUtf8",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"})(O||(O={}));var mi;(function(e){e[e.OFFSET=0]="OFFSET",e[e.DATA=1]="DATA",e[e.VALIDITY=2]="VALIDITY",e[e.TYPE=3]="TYPE"})(mi||(mi={}));var r_={};Vs(r_,{clampIndex:()=>kC,clampRange:()=>wh,createElementComparator:()=>ea});var Uw={};Vs(Uw,{valueToString:()=>yi});function yi(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=>yi(t))}]`:`[${e}]`:ArrayBuffer.isView(e)?`[${e}]`:JSON.stringify(e,(t,n)=>typeof n=="bigint"?`${n}`:n)}var zw={};Vs(zw,{BN:()=>ch,bigNumToBigInt:()=>$3,bigNumToString:()=>Dl,isArrowBigNumSymbol:()=>k3});var k3=Symbol.for("isArrowBigNum");function gi(e,...t){return t.length===0?Object.setPrototypeOf(kt(this.TypedArray,e),this.constructor.prototype):Object.setPrototypeOf(new this.TypedArray(e,...t),this.constructor.prototype)}gi.prototype[k3]=!0;gi.prototype.toJSON=function(){return`"${Dl(this)}"`};gi.prototype.valueOf=function(){return R3(this)};gi.prototype.toString=function(){return Dl(this)};gi.prototype[Symbol.toPrimitive]=function(e="default"){switch(e){case"number":return R3(this);case"string":return Dl(this);case"default":return $3(this)}return Dl(this)};function Tl(...e){return gi.apply(this,e)}function El(...e){return gi.apply(this,e)}function ah(...e){return gi.apply(this,e)}Object.setPrototypeOf(Tl.prototype,Object.create(Int32Array.prototype));Object.setPrototypeOf(El.prototype,Object.create(Uint32Array.prototype));Object.setPrototypeOf(ah.prototype,Object.create(Uint32Array.prototype));Object.assign(Tl.prototype,gi.prototype,{constructor:Tl,signed:!0,TypedArray:Int32Array,BigIntArray:BigInt64Array});Object.assign(El.prototype,gi.prototype,{constructor:El,signed:!1,TypedArray:Uint32Array,BigIntArray:BigUint64Array});Object.assign(ah.prototype,gi.prototype,{constructor:ah,signed:!0,TypedArray:Uint32Array,BigIntArray:BigUint64Array});function R3(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 Dl=e=>{if(e.byteLength===8)return`${new e.BigIntArray(e.buffer,e.byteOffset,1)[0]}`;if(!e.signed)return Pw(e);let t=new Uint16Array(e.buffer,e.byteOffset,e.byteLength/2);if(new Int16Array([t.at(-1)])[0]>=0)return Pw(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`-${Pw(t)}`},$3=e=>e.byteLength===8?new e.BigIntArray(e.buffer,e.byteOffset,1)[0]:Dl(e);function Pw(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 ch=class e{static new(t,n){switch(n){case!0:return new Tl(t);case!1:return new El(t)}switch(t.constructor){case Int8Array:case Int16Array:case Int32Array:case BigInt64Array:return new Tl(t)}return t.byteLength===16?new ah(t):new El(t)}static signed(t){return new Tl(t)}static unsigned(t){return new El(t)}static decimal(t){return new ah(t)}constructor(t,n){return e.new(t,n)}};function Ae(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 U3,P3,z3,q3,V3,j3,Y3,W3,G3,X3,H3,Z3,K3,Q3,J3,tA,eA,nA,rA,iA,oA,sA,X=class e{static isNull(t){return t?.typeId===O.Null}static isInt(t){return t?.typeId===O.Int}static isFloat(t){return t?.typeId===O.Float}static isBinary(t){return t?.typeId===O.Binary}static isLargeBinary(t){return t?.typeId===O.LargeBinary}static isUtf8(t){return t?.typeId===O.Utf8}static isLargeUtf8(t){return t?.typeId===O.LargeUtf8}static isBool(t){return t?.typeId===O.Bool}static isDecimal(t){return t?.typeId===O.Decimal}static isDate(t){return t?.typeId===O.Date}static isTime(t){return t?.typeId===O.Time}static isTimestamp(t){return t?.typeId===O.Timestamp}static isInterval(t){return t?.typeId===O.Interval}static isDuration(t){return t?.typeId===O.Duration}static isList(t){return t?.typeId===O.List}static isStruct(t){return t?.typeId===O.Struct}static isUnion(t){return t?.typeId===O.Union}static isFixedSizeBinary(t){return t?.typeId===O.FixedSizeBinary}static isFixedSizeList(t){return t?.typeId===O.FixedSizeList}static isMap(t){return t?.typeId===O.Map}static isDictionary(t){return t?.typeId===O.Dictionary}static isDenseUnion(t){return e.isUnion(t)&&t.mode===pe.Dense}static isSparseUnion(t){return e.isUnion(t)&&t.mode===pe.Sparse}constructor(t){this.typeId=t}};U3=Symbol.toStringTag;X[U3]=(e=>(e.children=null,e.ArrayType=Array,e.OffsetArrayType=Int32Array,e[Symbol.toStringTag]="DataType"))(X.prototype);var Bn=class extends X{constructor(){super(O.Null)}toString(){return"Null"}};P3=Symbol.toStringTag;Bn[P3]=(e=>e[Symbol.toStringTag]="Null")(Bn.prototype);var Be=class extends X{constructor(t,n){super(O.Int),this.isSigned=t,this.bitWidth=n}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}`}};z3=Symbol.toStringTag;Be[z3]=(e=>(e.isSigned=null,e.bitWidth=null,e[Symbol.toStringTag]="Int"))(Be.prototype);var lh=class extends Be{constructor(){super(!0,8)}get ArrayType(){return Int8Array}},uh=class extends Be{constructor(){super(!0,16)}get ArrayType(){return Int16Array}},bi=class extends Be{constructor(){super(!0,32)}get ArrayType(){return Int32Array}},fh=class extends Be{constructor(){super(!0,64)}get ArrayType(){return BigInt64Array}},hh=class extends Be{constructor(){super(!1,8)}get ArrayType(){return Uint8Array}},dh=class extends Be{constructor(){super(!1,16)}get ArrayType(){return Uint16Array}},ph=class extends Be{constructor(){super(!1,32)}get ArrayType(){return Uint32Array}},mh=class extends Be{constructor(){super(!1,64)}get ArrayType(){return BigUint64Array}};Object.defineProperty(lh.prototype,"ArrayType",{value:Int8Array});Object.defineProperty(uh.prototype,"ArrayType",{value:Int16Array});Object.defineProperty(bi.prototype,"ArrayType",{value:Int32Array});Object.defineProperty(fh.prototype,"ArrayType",{value:BigInt64Array});Object.defineProperty(hh.prototype,"ArrayType",{value:Uint8Array});Object.defineProperty(dh.prototype,"ArrayType",{value:Uint16Array});Object.defineProperty(ph.prototype,"ArrayType",{value:Uint32Array});Object.defineProperty(mh.prototype,"ArrayType",{value:BigUint64Array});var Vn=class extends X{constructor(t){super(O.Float),this.precision=t}get ArrayType(){switch(this.precision){case ue.HALF:return Uint16Array;case ue.SINGLE:return Float32Array;case ue.DOUBLE:return Float64Array}throw new Error(`Unrecognized ${this[Symbol.toStringTag]} type`)}toString(){return`Float${this.precision<<5||16}`}};q3=Symbol.toStringTag;Vn[q3]=(e=>(e.precision=null,e[Symbol.toStringTag]="Float"))(Vn.prototype);var yh=class extends Vn{constructor(){super(ue.HALF)}},gh=class extends Vn{constructor(){super(ue.SINGLE)}},bh=class extends Vn{constructor(){super(ue.DOUBLE)}};Object.defineProperty(yh.prototype,"ArrayType",{value:Uint16Array});Object.defineProperty(gh.prototype,"ArrayType",{value:Float32Array});Object.defineProperty(bh.prototype,"ArrayType",{value:Float64Array});var Vi=class extends X{constructor(){super(O.Binary)}toString(){return"Binary"}};V3=Symbol.toStringTag;Vi[V3]=(e=>(e.ArrayType=Uint8Array,e[Symbol.toStringTag]="Binary"))(Vi.prototype);var ji=class extends X{constructor(){super(O.LargeBinary)}toString(){return"LargeBinary"}};j3=Symbol.toStringTag;ji[j3]=(e=>(e.ArrayType=Uint8Array,e.OffsetArrayType=BigInt64Array,e[Symbol.toStringTag]="LargeBinary"))(ji.prototype);var Yi=class extends X{constructor(){super(O.Utf8)}toString(){return"Utf8"}};Y3=Symbol.toStringTag;Yi[Y3]=(e=>(e.ArrayType=Uint8Array,e[Symbol.toStringTag]="Utf8"))(Yi.prototype);var Wi=class extends X{constructor(){super(O.LargeUtf8)}toString(){return"LargeUtf8"}};W3=Symbol.toStringTag;Wi[W3]=(e=>(e.ArrayType=Uint8Array,e.OffsetArrayType=BigInt64Array,e[Symbol.toStringTag]="LargeUtf8"))(Wi.prototype);var Gi=class extends X{constructor(){super(O.Bool)}toString(){return"Bool"}};G3=Symbol.toStringTag;Gi[G3]=(e=>(e.ArrayType=Uint8Array,e[Symbol.toStringTag]="Bool"))(Gi.prototype);var Xi=class extends X{constructor(t,n,r=128){super(O.Decimal),this.scale=t,this.precision=n,this.bitWidth=r}toString(){return`Decimal[${this.precision}e${this.scale>0?"+":""}${this.scale}]`}};X3=Symbol.toStringTag;Xi[X3]=(e=>(e.scale=null,e.precision=null,e.ArrayType=Uint32Array,e[Symbol.toStringTag]="Decimal"))(Xi.prototype);var Hi=class extends X{constructor(t){super(O.Date),this.unit=t}toString(){return`Date${(this.unit+1)*32}<${ze[this.unit]}>`}};H3=Symbol.toStringTag;Hi[H3]=(e=>(e.unit=null,e.ArrayType=Int32Array,e[Symbol.toStringTag]="Date"))(Hi.prototype);var Pr=class extends X{constructor(t,n){super(O.Time),this.unit=t,this.bitWidth=n}toString(){return`Time${this.bitWidth}<${at[this.unit]}>`}get ArrayType(){switch(this.bitWidth){case 32:return Int32Array;case 64:return BigInt64Array}throw new Error(`Unrecognized ${this[Symbol.toStringTag]} type`)}};Z3=Symbol.toStringTag;Pr[Z3]=(e=>(e.unit=null,e.bitWidth=null,e[Symbol.toStringTag]="Time"))(Pr.prototype);var Zi=class extends X{constructor(t,n){super(O.Timestamp),this.unit=t,this.timezone=n}toString(){return`Timestamp<${at[this.unit]}${this.timezone?`, ${this.timezone}`:""}>`}};K3=Symbol.toStringTag;Zi[K3]=(e=>(e.unit=null,e.timezone=null,e.ArrayType=Int32Array,e[Symbol.toStringTag]="Timestamp"))(Zi.prototype);var Ki=class extends X{constructor(t){super(O.Interval),this.unit=t}toString(){return`Interval<${on[this.unit]}>`}};Q3=Symbol.toStringTag;Ki[Q3]=(e=>(e.unit=null,e.ArrayType=Int32Array,e[Symbol.toStringTag]="Interval"))(Ki.prototype);var Qi=class extends X{constructor(t){super(O.Duration),this.unit=t}toString(){return`Duration<${at[this.unit]}>`}};J3=Symbol.toStringTag;Qi[J3]=(e=>(e.unit=null,e.ArrayType=BigInt64Array,e[Symbol.toStringTag]="Duration"))(Qi.prototype);var zr=class extends X{constructor(t){super(O.List),this.children=[t]}toString(){return`List<${this.valueType}>`}get valueType(){return this.children[0].type}get valueField(){return this.children[0]}get ArrayType(){return this.valueType.ArrayType}};tA=Symbol.toStringTag;zr[tA]=(e=>(e.children=null,e[Symbol.toStringTag]="List"))(zr.prototype);var me=class extends X{constructor(t){super(O.Struct),this.children=t}toString(){return`Struct<{${this.children.map(t=>`${t.name}:${t.type}`).join(", ")}}>`}};eA=Symbol.toStringTag;me[eA]=(e=>(e.children=null,e[Symbol.toStringTag]="Struct"))(me.prototype);var qr=class extends X{constructor(t,n,r){super(O.Union),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))}toString(){return`${this[Symbol.toStringTag]}<${this.children.map(t=>`${t.type}`).join(" | ")}>`}};nA=Symbol.toStringTag;qr[nA]=(e=>(e.mode=null,e.typeIds=null,e.children=null,e.typeIdToChildIndex=null,e.ArrayType=Int8Array,e[Symbol.toStringTag]="Union"))(qr.prototype);var Ji=class extends X{constructor(t){super(O.FixedSizeBinary),this.byteWidth=t}toString(){return`FixedSizeBinary[${this.byteWidth}]`}};rA=Symbol.toStringTag;Ji[rA]=(e=>(e.byteWidth=null,e.ArrayType=Uint8Array,e[Symbol.toStringTag]="FixedSizeBinary"))(Ji.prototype);var Vr=class extends X{constructor(t,n){super(O.FixedSizeList),this.listSize=t,this.children=[n]}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}>`}};iA=Symbol.toStringTag;Vr[iA]=(e=>(e.children=null,e.listSize=null,e[Symbol.toStringTag]="FixedSizeList"))(Vr.prototype);var jr=class extends X{constructor(t,n=!1){var r,i,o;if(super(O.Map),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 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(", ")}}>`}};oA=Symbol.toStringTag;jr[oA]=(e=>(e.children=null,e.keysSorted=null,e[Symbol.toStringTag]="Map_"))(jr.prototype);var ZF=(e=>()=>++e)(-1),cr=class extends X{constructor(t,n,r,i){super(O.Dictionary),this.indices=n,this.dictionary=t,this.isOrdered=i||!1,this.id=r==null?ZF():Ae(r)}get children(){return this.dictionary.children}get valueType(){return this.dictionary}get ArrayType(){return this.dictionary.ArrayType}toString(){return`Dictionary<${this.indices}, ${this.dictionary}>`}};sA=Symbol.toStringTag;cr[sA]=(e=>(e.id=null,e.indices=null,e.isOrdered=null,e.dictionary=null,e[Symbol.toStringTag]="Dictionary"))(cr.prototype);function Sr(e){let t=e;switch(e.typeId){case O.Decimal:return e.bitWidth/32;case O.Timestamp:return 2;case O.Date:return 1+t.unit;case O.Interval:return 1+t.unit;case O.FixedSizeList:return t.listSize;case O.FixedSizeBinary:return t.byteWidth;default:return 1}}var dt=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 KF(this,t,n)}getVisitFnByTypeId(t,n=!0){return Nl(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}visitLargeUtf8(t,...n){return null}visitBinary(t,...n){return null}visitLargeBinary(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 KF(e,t,n=!0){return typeof t=="number"?Nl(e,t,n):typeof t=="string"&&t in O?Nl(e,O[t],n):t&&t instanceof X?Nl(e,aA(t),n):t?.type&&t.type instanceof X?Nl(e,aA(t.type),n):Nl(e,O.NONE,n)}function Nl(e,t,n=!0){let r=null;switch(t){case O.Null:r=e.visitNull;break;case O.Bool:r=e.visitBool;break;case O.Int:r=e.visitInt;break;case O.Int8:r=e.visitInt8||e.visitInt;break;case O.Int16:r=e.visitInt16||e.visitInt;break;case O.Int32:r=e.visitInt32||e.visitInt;break;case O.Int64:r=e.visitInt64||e.visitInt;break;case O.Uint8:r=e.visitUint8||e.visitInt;break;case O.Uint16:r=e.visitUint16||e.visitInt;break;case O.Uint32:r=e.visitUint32||e.visitInt;break;case O.Uint64:r=e.visitUint64||e.visitInt;break;case O.Float:r=e.visitFloat;break;case O.Float16:r=e.visitFloat16||e.visitFloat;break;case O.Float32:r=e.visitFloat32||e.visitFloat;break;case O.Float64:r=e.visitFloat64||e.visitFloat;break;case O.Utf8:r=e.visitUtf8;break;case O.LargeUtf8:r=e.visitLargeUtf8;break;case O.Binary:r=e.visitBinary;break;case O.LargeBinary:r=e.visitLargeBinary;break;case O.FixedSizeBinary:r=e.visitFixedSizeBinary;break;case O.Date:r=e.visitDate;break;case O.DateDay:r=e.visitDateDay||e.visitDate;break;case O.DateMillisecond:r=e.visitDateMillisecond||e.visitDate;break;case O.Timestamp:r=e.visitTimestamp;break;case O.TimestampSecond:r=e.visitTimestampSecond||e.visitTimestamp;break;case O.TimestampMillisecond:r=e.visitTimestampMillisecond||e.visitTimestamp;break;case O.TimestampMicrosecond:r=e.visitTimestampMicrosecond||e.visitTimestamp;break;case O.TimestampNanosecond:r=e.visitTimestampNanosecond||e.visitTimestamp;break;case O.Time:r=e.visitTime;break;case O.TimeSecond:r=e.visitTimeSecond||e.visitTime;break;case O.TimeMillisecond:r=e.visitTimeMillisecond||e.visitTime;break;case O.TimeMicrosecond:r=e.visitTimeMicrosecond||e.visitTime;break;case O.TimeNanosecond:r=e.visitTimeNanosecond||e.visitTime;break;case O.Decimal:r=e.visitDecimal;break;case O.List:r=e.visitList;break;case O.Struct:r=e.visitStruct;break;case O.Union:r=e.visitUnion;break;case O.DenseUnion:r=e.visitDenseUnion||e.visitUnion;break;case O.SparseUnion:r=e.visitSparseUnion||e.visitUnion;break;case O.Dictionary:r=e.visitDictionary;break;case O.Interval:r=e.visitInterval;break;case O.IntervalDayTime:r=e.visitIntervalDayTime||e.visitInterval;break;case O.IntervalYearMonth:r=e.visitIntervalYearMonth||e.visitInterval;break;case O.Duration:r=e.visitDuration;break;case O.DurationSecond:r=e.visitDurationSecond||e.visitDuration;break;case O.DurationMillisecond:r=e.visitDurationMillisecond||e.visitDuration;break;case O.DurationMicrosecond:r=e.visitDurationMicrosecond||e.visitDuration;break;case O.DurationNanosecond:r=e.visitDurationNanosecond||e.visitDuration;break;case O.FixedSizeList:r=e.visitFixedSizeList;break;case O.Map:r=e.visitMap;break}if(typeof r=="function")return r;if(!n)return()=>null;throw new Error(`Unrecognized type '${O[t]}'`)}function aA(e){switch(e.typeId){case O.Null:return O.Null;case O.Int:{let{bitWidth:t,isSigned:n}=e;switch(t){case 8:return n?O.Int8:O.Uint8;case 16:return n?O.Int16:O.Uint16;case 32:return n?O.Int32:O.Uint32;case 64:return n?O.Int64:O.Uint64}return O.Int}case O.Float:switch(e.precision){case ue.HALF:return O.Float16;case ue.SINGLE:return O.Float32;case ue.DOUBLE:return O.Float64}return O.Float;case O.Binary:return O.Binary;case O.LargeBinary:return O.LargeBinary;case O.Utf8:return O.Utf8;case O.LargeUtf8:return O.LargeUtf8;case O.Bool:return O.Bool;case O.Decimal:return O.Decimal;case O.Time:switch(e.unit){case at.SECOND:return O.TimeSecond;case at.MILLISECOND:return O.TimeMillisecond;case at.MICROSECOND:return O.TimeMicrosecond;case at.NANOSECOND:return O.TimeNanosecond}return O.Time;case O.Timestamp:switch(e.unit){case at.SECOND:return O.TimestampSecond;case at.MILLISECOND:return O.TimestampMillisecond;case at.MICROSECOND:return O.TimestampMicrosecond;case at.NANOSECOND:return O.TimestampNanosecond}return O.Timestamp;case O.Date:switch(e.unit){case ze.DAY:return O.DateDay;case ze.MILLISECOND:return O.DateMillisecond}return O.Date;case O.Interval:switch(e.unit){case on.DAY_TIME:return O.IntervalDayTime;case on.YEAR_MONTH:return O.IntervalYearMonth}return O.Interval;case O.Duration:switch(e.unit){case at.SECOND:return O.DurationSecond;case at.MILLISECOND:return O.DurationMillisecond;case at.MICROSECOND:return O.DurationMicrosecond;case at.NANOSECOND:return O.DurationNanosecond}return O.Duration;case O.Map:return O.Map;case O.List:return O.List;case O.Struct:return O.Struct;case O.Union:switch(e.mode){case pe.Dense:return O.DenseUnion;case pe.Sparse:return O.SparseUnion}return O.Union;case O.FixedSizeBinary:return O.FixedSizeBinary;case O.FixedSizeList:return O.FixedSizeList;case O.Dictionary:return O.Dictionary}throw new Error(`Unrecognized type '${O[e.typeId]}'`)}dt.prototype.visitInt8=null;dt.prototype.visitInt16=null;dt.prototype.visitInt32=null;dt.prototype.visitInt64=null;dt.prototype.visitUint8=null;dt.prototype.visitUint16=null;dt.prototype.visitUint32=null;dt.prototype.visitUint64=null;dt.prototype.visitFloat16=null;dt.prototype.visitFloat32=null;dt.prototype.visitFloat64=null;dt.prototype.visitDateDay=null;dt.prototype.visitDateMillisecond=null;dt.prototype.visitTimestampSecond=null;dt.prototype.visitTimestampMillisecond=null;dt.prototype.visitTimestampMicrosecond=null;dt.prototype.visitTimestampNanosecond=null;dt.prototype.visitTimeSecond=null;dt.prototype.visitTimeMillisecond=null;dt.prototype.visitTimeMicrosecond=null;dt.prototype.visitTimeNanosecond=null;dt.prototype.visitDenseUnion=null;dt.prototype.visitSparseUnion=null;dt.prototype.visitIntervalDayTime=null;dt.prototype.visitIntervalYearMonth=null;dt.prototype.visitDuration=null;dt.prototype.visitDurationSecond=null;dt.prototype.visitDurationMillisecond=null;dt.prototype.visitDurationMicrosecond=null;dt.prototype.visitDurationNanosecond=null;var qw={};Vs(qw,{float64ToUint16:()=>xh,uint16ToFloat64:()=>my});var cA=new Float64Array(1),Bl=new Uint32Array(cA.buffer);function my(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 xh(e){if(e!==e)return 32256;cA[0]=e;let t=(Bl[1]&2147483648)>>16&65535,n=Bl[1]&2146435072,r=0;return n>=1089470464?Bl[0]>0?n=31744:(n=(n&2080374784)>>16,r=(Bl[1]&1048575)>>10):n<=1056964608?(r=1048576+(Bl[1]&1048575),r=1048576+(r<<(n>>20)-998)>>21,n=0):(n=n-1056964608>>10,r=(Bl[1]&1048575)+512>>10),t|n|r&65535}var xt=class extends dt{};function It(e){return(t,n,r)=>{if(t.setValid(n,r!=null))return e(t,n,r)}}var QF=(e,t,n)=>{e[t]=Math.trunc(n/864e5)},Vw=(e,t,n)=>{e[t]=Math.trunc(n%4294967296),e[t+1]=Math.trunc(n/4294967296)},JF=(e,t,n)=>{e[t]=Math.trunc(n*1e3%4294967296),e[t+1]=Math.trunc(n*1e3/4294967296)},tC=(e,t,n)=>{e[t]=Math.trunc(n*1e6%4294967296),e[t+1]=Math.trunc(n*1e6/4294967296)},lA=(e,t,n,r)=>{if(n+1<t.length){let i=Ae(t[n]),o=Ae(t[n+1]);e.set(r.subarray(0,o-i),i)}},eC=({offset:e,values:t},n,r)=>{let i=e+n;r?t[i>>3]|=1<<i%8:t[i>>3]&=~(1<<i%8)},jo=({values:e},t,n)=>{e[t]=n},jw=({values:e},t,n)=>{e[t]=n},uA=({values:e},t,n)=>{e[t]=xh(n)},nC=(e,t,n)=>{switch(e.type.precision){case ue.HALF:return uA(e,t,n);case ue.SINGLE:case ue.DOUBLE:return jw(e,t,n)}},yy=({values:e},t,n)=>{QF(e,t,n.valueOf())},gy=({values:e},t,n)=>{Vw(e,t*2,n.valueOf())},Yw=({stride:e,values:t},n,r)=>{t.set(r.subarray(0,e),e*n)},fA=({values:e,valueOffsets:t},n,r)=>lA(e,t,n,r),hA=({values:e,valueOffsets:t},n,r)=>lA(e,t,n,$i(r)),Ww=(e,t,n)=>{e.type.unit===ze.DAY?yy(e,t,n):gy(e,t,n)},by=({values:e},t,n)=>Vw(e,t*2,n/1e3),xy=({values:e},t,n)=>Vw(e,t*2,n),wy=({values:e},t,n)=>JF(e,t*2,n),_y=({values:e},t,n)=>tC(e,t*2,n),Gw=(e,t,n)=>{switch(e.type.unit){case at.SECOND:return by(e,t,n);case at.MILLISECOND:return xy(e,t,n);case at.MICROSECOND:return wy(e,t,n);case at.NANOSECOND:return _y(e,t,n)}},vy=({values:e},t,n)=>{e[t]=n},Sy=({values:e},t,n)=>{e[t]=n},Iy=({values:e},t,n)=>{e[t]=n},My=({values:e},t,n)=>{e[t]=n},Xw=(e,t,n)=>{switch(e.type.unit){case at.SECOND:return vy(e,t,n);case at.MILLISECOND:return Sy(e,t,n);case at.MICROSECOND:return Iy(e,t,n);case at.NANOSECOND:return My(e,t,n)}},Hw=({values:e,stride:t},n,r)=>{e.set(r.subarray(0,t),t*n)},rC=(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))},iC=(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},oC=(e,t)=>(n,r,i,o)=>r&&n(r,e,t[o]),sC=(e,t)=>(n,r,i,o)=>r&&n(r,e,t.get(o)),aC=(e,t)=>(n,r,i,o)=>r&&n(r,e,t.get(i.name)),cC=(e,t)=>(n,r,i,o)=>r&&n(r,e,t[i.name]),lC=(e,t,n)=>{let r=e.type.children.map(o=>xn.getVisitFn(o.type)),i=n instanceof Map?aC(t,n):n instanceof qt?sC(t,n):Array.isArray(n)?oC(t,n):cC(t,n);e.type.children.forEach((o,s)=>i(r[s],e.children[s],o,s))},uC=(e,t,n)=>{e.type.mode===pe.Dense?dA(e,t,n):pA(e,t,n)},dA=(e,t,n)=>{let r=e.type.typeIdToChildIndex[e.typeIds[t]],i=e.children[r];xn.visit(i,e.valueOffsets[t],n)},pA=(e,t,n)=>{let r=e.type.typeIdToChildIndex[e.typeIds[t]],i=e.children[r];xn.visit(i,t,n)},fC=(e,t,n)=>{var r;(r=e.dictionary)===null||r===void 0||r.set(e.values[t],n)},Zw=(e,t,n)=>{e.type.unit===on.DAY_TIME?Ay(e,t,n):Ty(e,t,n)},Ay=({values:e},t,n)=>{e.set(n.subarray(0,2),2*t)},Ty=({values:e},t,n)=>{e[t]=n[0]*12+n[1]%12},Ey=({values:e},t,n)=>{e[t]=n},Dy=({values:e},t,n)=>{e[t]=n},Ny=({values:e},t,n)=>{e[t]=n},By=({values:e},t,n)=>{e[t]=n},Kw=(e,t,n)=>{switch(e.type.unit){case at.SECOND:return Ey(e,t,n);case at.MILLISECOND:return Dy(e,t,n);case at.MICROSECOND:return Ny(e,t,n);case at.NANOSECOND:return By(e,t,n)}},hC=(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))};xt.prototype.visitBool=It(eC);xt.prototype.visitInt=It(jo);xt.prototype.visitInt8=It(jo);xt.prototype.visitInt16=It(jo);xt.prototype.visitInt32=It(jo);xt.prototype.visitInt64=It(jo);xt.prototype.visitUint8=It(jo);xt.prototype.visitUint16=It(jo);xt.prototype.visitUint32=It(jo);xt.prototype.visitUint64=It(jo);xt.prototype.visitFloat=It(nC);xt.prototype.visitFloat16=It(uA);xt.prototype.visitFloat32=It(jw);xt.prototype.visitFloat64=It(jw);xt.prototype.visitUtf8=It(hA);xt.prototype.visitLargeUtf8=It(hA);xt.prototype.visitBinary=It(fA);xt.prototype.visitLargeBinary=It(fA);xt.prototype.visitFixedSizeBinary=It(Yw);xt.prototype.visitDate=It(Ww);xt.prototype.visitDateDay=It(yy);xt.prototype.visitDateMillisecond=It(gy);xt.prototype.visitTimestamp=It(Gw);xt.prototype.visitTimestampSecond=It(by);xt.prototype.visitTimestampMillisecond=It(xy);xt.prototype.visitTimestampMicrosecond=It(wy);xt.prototype.visitTimestampNanosecond=It(_y);xt.prototype.visitTime=It(Xw);xt.prototype.visitTimeSecond=It(vy);xt.prototype.visitTimeMillisecond=It(Sy);xt.prototype.visitTimeMicrosecond=It(Iy);xt.prototype.visitTimeNanosecond=It(My);xt.prototype.visitDecimal=It(Hw);xt.prototype.visitList=It(rC);xt.prototype.visitStruct=It(lC);xt.prototype.visitUnion=It(uC);xt.prototype.visitDenseUnion=It(dA);xt.prototype.visitSparseUnion=It(pA);xt.prototype.visitDictionary=It(fC);xt.prototype.visitInterval=It(Zw);xt.prototype.visitIntervalDayTime=It(Ay);xt.prototype.visitIntervalYearMonth=It(Ty);xt.prototype.visitDuration=It(Kw);xt.prototype.visitDurationSecond=It(Ey);xt.prototype.visitDurationMillisecond=It(Dy);xt.prototype.visitDurationMicrosecond=It(Ny);xt.prototype.visitDurationNanosecond=It(By);xt.prototype.visitFixedSizeList=It(hC);xt.prototype.visitMap=It(iC);var xn=new xt;var xi=Symbol.for("parent"),Ol=Symbol.for("rowIndex"),Js=class{constructor(t,n){return this[xi]=t,this[Ol]=n,new Proxy(this,new Jw)}toArray(){return Object.values(this.toJSON())}toJSON(){let t=this[Ol],n=this[xi],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])=>`${yi(t)}: ${yi(n)}`).join(", ")}}`}[Symbol.for("nodejs.util.inspect.custom")](){return this.toString()}[Symbol.iterator](){return new Qw(this[xi],this[Ol])}},Qw=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(Js.prototype,{[Symbol.toStringTag]:{enumerable:!1,configurable:!1,value:"Row"},[xi]:{writable:!0,enumerable:!1,configurable:!1,value:null},[Ol]:{writable:!0,enumerable:!1,configurable:!1,value:-1}});var Jw=class{isExtensible(){return!1}deleteProperty(){return!1}preventExtensions(){return!0}ownKeys(t){return t[xi].type.children.map(n=>n.name)}has(t,n){return t[xi].type.children.findIndex(r=>r.name===n)!==-1}getOwnPropertyDescriptor(t,n){if(t[xi].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[xi].type.children.findIndex(i=>i.name===n);if(r!==-1){let i=qe.visit(t[xi].children[r],t[Ol]);return Reflect.set(t,n,i),i}}set(t,n,r){let i=t[xi].type.children.findIndex(o=>o.name===n);return i!==-1?(xn.visit(t[xi].children[i],t[Ol],r),Reflect.set(t,n,r)):Reflect.has(t,n)||typeof n=="symbol"?Reflect.set(t,n,r):!1}};var pt=class extends dt{};function vt(e){return(t,n)=>t.getValid(n)?e(t,n):null}var dC=(e,t)=>864e5*e[t],t_=(e,t)=>4294967296*e[t+1]+(e[t]>>>0),pC=(e,t)=>4294967296*(e[t+1]/1e3)+(e[t]>>>0)/1e3,mC=(e,t)=>4294967296*(e[t+1]/1e6)+(e[t]>>>0)/1e6,mA=e=>new Date(e),yC=(e,t)=>mA(dC(e,t)),gC=(e,t)=>mA(t_(e,t)),bC=(e,t)=>null,yA=(e,t,n)=>{if(n+1>=t.length)return null;let r=Ae(t[n]),i=Ae(t[n+1]);return e.subarray(r,i)},xC=({offset:e,values:t},n)=>{let r=e+n;return(t[r>>3]&1<<r%8)!==0},gA=({values:e},t)=>yC(e,t),bA=({values:e},t)=>gC(e,t*2),ta=({stride:e,values:t},n)=>t[e*n],wC=({stride:e,values:t},n)=>my(t[e*n]),xA=({values:e},t)=>e[t],_C=({stride:e,values:t},n)=>t.subarray(e*n,e*(n+1)),wA=({values:e,valueOffsets:t},n)=>yA(e,t,n),_A=({values:e,valueOffsets:t},n)=>{let r=yA(e,t,n);return r!==null?Wf(r):null},vC=({values:e},t)=>e[t],SC=({type:e,values:t},n)=>e.precision!==ue.HALF?t[n]:my(t[n]),IC=(e,t)=>e.type.unit===ze.DAY?gA(e,t):bA(e,t),vA=({values:e},t)=>1e3*t_(e,t*2),SA=({values:e},t)=>t_(e,t*2),IA=({values:e},t)=>pC(e,t*2),MA=({values:e},t)=>mC(e,t*2),MC=(e,t)=>{switch(e.type.unit){case at.SECOND:return vA(e,t);case at.MILLISECOND:return SA(e,t);case at.MICROSECOND:return IA(e,t);case at.NANOSECOND:return MA(e,t)}},AA=({values:e},t)=>e[t],TA=({values:e},t)=>e[t],EA=({values:e},t)=>e[t],DA=({values:e},t)=>e[t],AC=(e,t)=>{switch(e.type.unit){case at.SECOND:return AA(e,t);case at.MILLISECOND:return TA(e,t);case at.MICROSECOND:return EA(e,t);case at.NANOSECOND:return DA(e,t)}},TC=({values:e,stride:t},n)=>ch.decimal(e.subarray(t*n,t*(n+1))),EC=(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 qt([c])},DC=(e,t)=>{let{valueOffsets:n,children:r}=e,{[t]:i,[t+1]:o}=n,s=r[0];return new to(s.slice(i,o-i))},NC=(e,t)=>new Js(e,t),BC=(e,t)=>e.type.mode===pe.Dense?NA(e,t):BA(e,t),NA=(e,t)=>{let n=e.type.typeIdToChildIndex[e.typeIds[t]],r=e.children[n];return qe.visit(r,e.valueOffsets[t])},BA=(e,t)=>{let n=e.type.typeIdToChildIndex[e.typeIds[t]],r=e.children[n];return qe.visit(r,t)},OC=(e,t)=>{var n;return(n=e.dictionary)===null||n===void 0?void 0:n.get(e.values[t])},LC=(e,t)=>e.type.unit===on.DAY_TIME?OA(e,t):LA(e,t),OA=({values:e},t)=>e.subarray(2*t,2*(t+1)),LA=({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},FA=({values:e},t)=>e[t],CA=({values:e},t)=>e[t],kA=({values:e},t)=>e[t],RA=({values:e},t)=>e[t],FC=(e,t)=>{switch(e.type.unit){case at.SECOND:return FA(e,t);case at.MILLISECOND:return CA(e,t);case at.MICROSECOND:return kA(e,t);case at.NANOSECOND:return RA(e,t)}},CC=(e,t)=>{let{stride:n,children:r}=e,o=r[0].slice(t*n,n);return new qt([o])};pt.prototype.visitNull=vt(bC);pt.prototype.visitBool=vt(xC);pt.prototype.visitInt=vt(vC);pt.prototype.visitInt8=vt(ta);pt.prototype.visitInt16=vt(ta);pt.prototype.visitInt32=vt(ta);pt.prototype.visitInt64=vt(xA);pt.prototype.visitUint8=vt(ta);pt.prototype.visitUint16=vt(ta);pt.prototype.visitUint32=vt(ta);pt.prototype.visitUint64=vt(xA);pt.prototype.visitFloat=vt(SC);pt.prototype.visitFloat16=vt(wC);pt.prototype.visitFloat32=vt(ta);pt.prototype.visitFloat64=vt(ta);pt.prototype.visitUtf8=vt(_A);pt.prototype.visitLargeUtf8=vt(_A);pt.prototype.visitBinary=vt(wA);pt.prototype.visitLargeBinary=vt(wA);pt.prototype.visitFixedSizeBinary=vt(_C);pt.prototype.visitDate=vt(IC);pt.prototype.visitDateDay=vt(gA);pt.prototype.visitDateMillisecond=vt(bA);pt.prototype.visitTimestamp=vt(MC);pt.prototype.visitTimestampSecond=vt(vA);pt.prototype.visitTimestampMillisecond=vt(SA);pt.prototype.visitTimestampMicrosecond=vt(IA);pt.prototype.visitTimestampNanosecond=vt(MA);pt.prototype.visitTime=vt(AC);pt.prototype.visitTimeSecond=vt(AA);pt.prototype.visitTimeMillisecond=vt(TA);pt.prototype.visitTimeMicrosecond=vt(EA);pt.prototype.visitTimeNanosecond=vt(DA);pt.prototype.visitDecimal=vt(TC);pt.prototype.visitList=vt(EC);pt.prototype.visitStruct=vt(NC);pt.prototype.visitUnion=vt(BC);pt.prototype.visitDenseUnion=vt(NA);pt.prototype.visitSparseUnion=vt(BA);pt.prototype.visitDictionary=vt(OC);pt.prototype.visitInterval=vt(LC);pt.prototype.visitIntervalDayTime=vt(OA);pt.prototype.visitIntervalYearMonth=vt(LA);pt.prototype.visitDuration=vt(FC);pt.prototype.visitDurationSecond=vt(FA);pt.prototype.visitDurationMillisecond=vt(CA);pt.prototype.visitDurationMicrosecond=vt(kA);pt.prototype.visitDurationNanosecond=vt(RA);pt.prototype.visitFixedSizeList=vt(CC);pt.prototype.visitMap=vt(DC);var qe=new pt;var Yr=Symbol.for("keys"),Ll=Symbol.for("vals"),to=class{constructor(t){return this[Yr]=new qt([t.children[0]]).memoize(),this[Ll]=t.children[1],new Proxy(this,new n_)}[Symbol.iterator](){return new e_(this[Yr],this[Ll])}get size(){return this[Yr].length}toArray(){return Object.values(this.toJSON())}toJSON(){let t=this[Yr],n=this[Ll],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])=>`${yi(t)}: ${yi(n)}`).join(", ")}}`}[Symbol.for("nodejs.util.inspect.custom")](){return this.toString()}},e_=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)]})}},n_=class{isExtensible(){return!1}deleteProperty(){return!1}preventExtensions(){return!0}ownKeys(t){return t[Yr].toArray().map(String)}has(t,n){return t[Yr].includes(n)}getOwnPropertyDescriptor(t,n){if(t[Yr].indexOf(n)!==-1)return{writable:!0,enumerable:!0,configurable:!0}}get(t,n){if(Reflect.has(t,n))return t[n];let r=t[Yr].indexOf(n);if(r!==-1){let i=qe.visit(Reflect.get(t,Ll),r);return Reflect.set(t,n,i),i}}set(t,n,r){let i=t[Yr].indexOf(n);return i!==-1?(xn.visit(Reflect.get(t,Ll),i,r),Reflect.set(t,n,r)):Reflect.has(t,n)?Reflect.set(t,n,r):!1}};Object.defineProperties(to.prototype,{[Symbol.toStringTag]:{enumerable:!1,configurable:!1,value:"Row"},[Yr]:{writable:!0,enumerable:!1,configurable:!1,value:null},[Ll]:{writable:!0,enumerable:!1,configurable:!1,value:null}});function kC(e,t,n){let r=e.length,i=t>-1?t:r+t%r;return n?n(e,i):i}var $A;function wh(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&&($A=o,o=s,s=$A),s>i&&(s=i),r?r(e,o,s):[o,s]}var UA=e=>e!==e;function ea(e){if(typeof e!=="object"||e===null)return UA(e)?UA: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?Cw(e,n):!1:e instanceof Map?$C(e):Array.isArray(e)?RC(e):e instanceof qt?UC(e):PC(e,!0)}function RC(e){let t=[];for(let n=-1,r=e.length;++n<r;)t[n]=ea(e[n]);return Oy(t)}function $C(e){let t=-1,n=[];for(let r of e.values())n[++t]=ea(r);return Oy(n)}function UC(e){let t=[];for(let n=-1,r=e.length;++n<r;)t[n]=ea(e.get(n));return Oy(t)}function PC(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]=ea(e[n[i]]);return Oy(r,n)}function Oy(e,t){return n=>{if(!n||typeof n!="object")return!1;switch(n.constructor){case Array:return zC(e,n);case Map:return PA(e,n,n.keys());case to:case Js:case Object:case void 0:return PA(e,n,t||Object.keys(n))}return n instanceof qt?qC(e,n):!1}}function zC(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 qC(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 PA(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 i_={};Vs(i_,{BitIterator:()=>Qa,getBit:()=>zA,getBool:()=>Fy,packBools:()=>tc,popcnt_array:()=>qA,popcnt_bit_range:()=>_h,popcnt_uint32:()=>Ly,setBool:()=>VC,truncateBitmap:()=>Ja});function Fy(e,t,n,r){return(n&1<<r)!==0}function zA(e,t,n,r){return(n&1<<r)>>r}function VC(e,t,n){return n?!!(e[t>>3]|=1<<t%8)||!0:!(e[t>>3]&=~(1<<t%8))&&!1}function Ja(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):tc(new Qa(n,e,t,null,Fy)).subarray(0,r)),i}return n}function tc(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 Qa=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 _h(e,t,n){if(n-t<=0)return 0;if(n-t<8){let o=0;for(let s of new Qa(e,t,n-t,e,zA))o+=s;return o}let r=n>>3<<3,i=t+(t%8===0?0:8-t%8);return _h(e,t,i)+_h(e,r,n)+qA(e,i>>3,r-i>>3)}function qA(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+=Ly(o.getUint32(i)),i+=4;for(;s-i>=2;)r+=Ly(o.getUint16(i)),i+=2;for(;s-i>=1;)r+=Ly(o.getUint8(i)),i+=1;return r}function Ly(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 jC=-1,Kt=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 X.isSparseUnion(t)?this.children.some(n=>n.nullable):X.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(X.isUnion(this.type))return this.children.reduce((r,i)=>r+i.nullCount,0);let t=this._nullCount,n;return t<=jC&&(n=this.nullBitmap)&&(this._nullCount=t=this.length-_h(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=Sr(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(X.isUnion(n)){let r=n,i=this.children[r.typeIdToChildIndex[this.typeIds[t]]],o=r.mode===pe.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(X.isUnion(i)){let o=i,s=this.children[o.typeIdToChildIndex[this.typeIds[t]]],a=o.mode===pe.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(Ja(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===O.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(Ja(this.offset,n,this.nullBitmap),0);let o=this.buffers;return o[mi.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[mi.TYPE])&&(s[mi.TYPE]=o.subarray(t,t+n)),(o=s[mi.OFFSET])&&(s[mi.OFFSET]=o.subarray(t,t+n+1))||(o=s[mi.DATA])&&(s[mi.DATA]=i===6?o:o.subarray(r*t,r*(t+n))),s}_sliceChildren(t,n,r){return t.map(i=>i.slice(n,r))}};Kt.prototype.children=Object.freeze([]);var o_=class e extends dt{visit(t){return this.getVisitFn(t.type).call(this,t)}visitNull(t){let{["type"]:n,["offset"]:r=0,["length"]:i=0}=t;return new Kt(n,r,i,i)}visitBool(t){let{["type"]:n,["offset"]:r=0}=t,i=wt(t.nullBitmap),o=kt(n.ArrayType,t.data),{["length"]:s=o.length>>3,["nullCount"]:a=t.nullBitmap?-1:0}=t;return new Kt(n,r,s,a,[void 0,o,i])}visitInt(t){let{["type"]:n,["offset"]:r=0}=t,i=wt(t.nullBitmap),o=kt(n.ArrayType,t.data),{["length"]:s=o.length,["nullCount"]:a=t.nullBitmap?-1:0}=t;return new Kt(n,r,s,a,[void 0,o,i])}visitFloat(t){let{["type"]:n,["offset"]:r=0}=t,i=wt(t.nullBitmap),o=kt(n.ArrayType,t.data),{["length"]:s=o.length,["nullCount"]:a=t.nullBitmap?-1:0}=t;return new Kt(n,r,s,a,[void 0,o,i])}visitUtf8(t){let{["type"]:n,["offset"]:r=0}=t,i=wt(t.data),o=wt(t.nullBitmap),s=Za(t.valueOffsets),{["length"]:a=s.length-1,["nullCount"]:c=t.nullBitmap?-1:0}=t;return new Kt(n,r,a,c,[s,i,o])}visitLargeUtf8(t){let{["type"]:n,["offset"]:r=0}=t,i=wt(t.data),o=wt(t.nullBitmap),s=cy(t.valueOffsets),{["length"]:a=s.length-1,["nullCount"]:c=t.nullBitmap?-1:0}=t;return new Kt(n,r,a,c,[s,i,o])}visitBinary(t){let{["type"]:n,["offset"]:r=0}=t,i=wt(t.data),o=wt(t.nullBitmap),s=Za(t.valueOffsets),{["length"]:a=s.length-1,["nullCount"]:c=t.nullBitmap?-1:0}=t;return new Kt(n,r,a,c,[s,i,o])}visitLargeBinary(t){let{["type"]:n,["offset"]:r=0}=t,i=wt(t.data),o=wt(t.nullBitmap),s=cy(t.valueOffsets),{["length"]:a=s.length-1,["nullCount"]:c=t.nullBitmap?-1:0}=t;return new Kt(n,r,a,c,[s,i,o])}visitFixedSizeBinary(t){let{["type"]:n,["offset"]:r=0}=t,i=wt(t.nullBitmap),o=kt(n.ArrayType,t.data),{["length"]:s=o.length/Sr(n),["nullCount"]:a=t.nullBitmap?-1:0}=t;return new Kt(n,r,s,a,[void 0,o,i])}visitDate(t){let{["type"]:n,["offset"]:r=0}=t,i=wt(t.nullBitmap),o=kt(n.ArrayType,t.data),{["length"]:s=o.length/Sr(n),["nullCount"]:a=t.nullBitmap?-1:0}=t;return new Kt(n,r,s,a,[void 0,o,i])}visitTimestamp(t){let{["type"]:n,["offset"]:r=0}=t,i=wt(t.nullBitmap),o=kt(n.ArrayType,t.data),{["length"]:s=o.length/Sr(n),["nullCount"]:a=t.nullBitmap?-1:0}=t;return new Kt(n,r,s,a,[void 0,o,i])}visitTime(t){let{["type"]:n,["offset"]:r=0}=t,i=wt(t.nullBitmap),o=kt(n.ArrayType,t.data),{["length"]:s=o.length/Sr(n),["nullCount"]:a=t.nullBitmap?-1:0}=t;return new Kt(n,r,s,a,[void 0,o,i])}visitDecimal(t){let{["type"]:n,["offset"]:r=0}=t,i=wt(t.nullBitmap),o=kt(n.ArrayType,t.data),{["length"]:s=o.length/Sr(n),["nullCount"]:a=t.nullBitmap?-1:0}=t;return new Kt(n,r,s,a,[void 0,o,i])}visitList(t){let{["type"]:n,["offset"]:r=0,["child"]:i}=t,o=wt(t.nullBitmap),s=Za(t.valueOffsets),{["length"]:a=s.length-1,["nullCount"]:c=t.nullBitmap?-1:0}=t;return new Kt(n,r,a,c,[s,void 0,o],[i])}visitStruct(t){let{["type"]:n,["offset"]:r=0,["children"]:i=[]}=t,o=wt(t.nullBitmap),{length:s=i.reduce((c,{length:l})=>Math.max(c,l),0),nullCount:a=t.nullBitmap?-1:0}=t;return new Kt(n,r,s,a,[void 0,void 0,o],i)}visitUnion(t){let{["type"]:n,["offset"]:r=0,["children"]:i=[]}=t,o=kt(n.ArrayType,t.typeIds),{["length"]:s=o.length,["nullCount"]:a=-1}=t;if(X.isSparseUnion(n))return new Kt(n,r,s,a,[void 0,void 0,void 0,o],i);let c=Za(t.valueOffsets);return new Kt(n,r,s,a,[c,void 0,void 0,o],i)}visitDictionary(t){let{["type"]:n,["offset"]:r=0}=t,i=wt(t.nullBitmap),o=kt(n.indices.ArrayType,t.data),{["dictionary"]:s=new qt([new e().visit({type:n.dictionary})])}=t,{["length"]:a=o.length,["nullCount"]:c=t.nullBitmap?-1:0}=t;return new Kt(n,r,a,c,[void 0,o,i],[],s)}visitInterval(t){let{["type"]:n,["offset"]:r=0}=t,i=wt(t.nullBitmap),o=kt(n.ArrayType,t.data),{["length"]:s=o.length/Sr(n),["nullCount"]:a=t.nullBitmap?-1:0}=t;return new Kt(n,r,s,a,[void 0,o,i])}visitDuration(t){let{["type"]:n,["offset"]:r=0}=t,i=wt(t.nullBitmap),o=kt(n.ArrayType,t.data),{["length"]:s=o.length,["nullCount"]:a=t.nullBitmap?-1:0}=t;return new Kt(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=wt(t.nullBitmap),{["length"]:s=i.length/Sr(n),["nullCount"]:a=t.nullBitmap?-1:0}=t;return new Kt(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=wt(t.nullBitmap),s=Za(t.valueOffsets),{["length"]:a=s.length-1,["nullCount"]:c=t.nullBitmap?-1:0}=t;return new Kt(n,r,a,c,[s,void 0,o],[i])}},YC=new o_;function At(e){return YC.visit(e)}var vh=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 VA(e){return e.some(t=>t.nullable)}function Cy(e){return e.reduce((t,n)=>t+n.nullCount,0)}function ky(e){return e.reduce((t,n,r)=>(t[r+1]=t[r]+n.length,t),new Uint32Array(e.length+1))}function Ry(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 s_(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 Sh(e,t){return e.getValid(t)}function Fl(e){function t(n,r,i){return e(n[r],i)}return function(n){let r=this.data;return s_(r,this._offsets,n,t)}}function $y(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=s_(o,this._offsets,r,n);return t=void 0,s}}function Uy(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):s_(o,this._offsets,i,n);return t=void 0,s}}var mt=class extends dt{};function WC(e,t){return t===null&&e.length>0?0:-1}function GC(e,t){let{nullBitmap:n}=e;if(!n||e.nullCount<=0)return-1;let r=0;for(let i of new Qa(n,e.offset+(t||0),e.length,n,Fy)){if(!i)return r;++r}return-1}function Tt(e,t,n){if(t===void 0)return-1;if(t===null)switch(e.typeId){case O.Union:break;case O.Dictionary:break;default:return GC(e,n)}let r=qe.getVisitFn(e),i=ea(t);for(let o=(n||0)-1,s=e.length;++o<s;)if(i(r(e,o)))return o;return-1}function jA(e,t,n){let r=qe.getVisitFn(e),i=ea(t);for(let o=(n||0)-1,s=e.length;++o<s;)if(i(r(e,o)))return o;return-1}mt.prototype.visitNull=WC;mt.prototype.visitBool=Tt;mt.prototype.visitInt=Tt;mt.prototype.visitInt8=Tt;mt.prototype.visitInt16=Tt;mt.prototype.visitInt32=Tt;mt.prototype.visitInt64=Tt;mt.prototype.visitUint8=Tt;mt.prototype.visitUint16=Tt;mt.prototype.visitUint32=Tt;mt.prototype.visitUint64=Tt;mt.prototype.visitFloat=Tt;mt.prototype.visitFloat16=Tt;mt.prototype.visitFloat32=Tt;mt.prototype.visitFloat64=Tt;mt.prototype.visitUtf8=Tt;mt.prototype.visitLargeUtf8=Tt;mt.prototype.visitBinary=Tt;mt.prototype.visitLargeBinary=Tt;mt.prototype.visitFixedSizeBinary=Tt;mt.prototype.visitDate=Tt;mt.prototype.visitDateDay=Tt;mt.prototype.visitDateMillisecond=Tt;mt.prototype.visitTimestamp=Tt;mt.prototype.visitTimestampSecond=Tt;mt.prototype.visitTimestampMillisecond=Tt;mt.prototype.visitTimestampMicrosecond=Tt;mt.prototype.visitTimestampNanosecond=Tt;mt.prototype.visitTime=Tt;mt.prototype.visitTimeSecond=Tt;mt.prototype.visitTimeMillisecond=Tt;mt.prototype.visitTimeMicrosecond=Tt;mt.prototype.visitTimeNanosecond=Tt;mt.prototype.visitDecimal=Tt;mt.prototype.visitList=Tt;mt.prototype.visitStruct=Tt;mt.prototype.visitUnion=Tt;mt.prototype.visitDenseUnion=jA;mt.prototype.visitSparseUnion=jA;mt.prototype.visitDictionary=Tt;mt.prototype.visitInterval=Tt;mt.prototype.visitIntervalDayTime=Tt;mt.prototype.visitIntervalYearMonth=Tt;mt.prototype.visitDuration=Tt;mt.prototype.visitDurationSecond=Tt;mt.prototype.visitDurationMillisecond=Tt;mt.prototype.visitDurationMicrosecond=Tt;mt.prototype.visitDurationNanosecond=Tt;mt.prototype.visitFixedSizeList=Tt;mt.prototype.visitMap=Tt;var ec=new mt;var yt=class extends dt{};function St(e){let{type:t}=e;if(e.nullCount===0&&e.stride===1&&(t.typeId===O.Timestamp||t instanceof Be&&t.bitWidth!==64||t instanceof Pr&&t.bitWidth!==64||t instanceof Vn&&t.precision!==ue.HALF))return new vh(e.data.length,r=>{let i=e.data[r];return i.values.subarray(0,i.length)[Symbol.iterator]()});let n=0;return new vh(e.data.length,r=>{let o=e.data[r].length,s=e.slice(n,n+o);return n+=o,new a_(s)})}var a_=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}};yt.prototype.visitNull=St;yt.prototype.visitBool=St;yt.prototype.visitInt=St;yt.prototype.visitInt8=St;yt.prototype.visitInt16=St;yt.prototype.visitInt32=St;yt.prototype.visitInt64=St;yt.prototype.visitUint8=St;yt.prototype.visitUint16=St;yt.prototype.visitUint32=St;yt.prototype.visitUint64=St;yt.prototype.visitFloat=St;yt.prototype.visitFloat16=St;yt.prototype.visitFloat32=St;yt.prototype.visitFloat64=St;yt.prototype.visitUtf8=St;yt.prototype.visitLargeUtf8=St;yt.prototype.visitBinary=St;yt.prototype.visitLargeBinary=St;yt.prototype.visitFixedSizeBinary=St;yt.prototype.visitDate=St;yt.prototype.visitDateDay=St;yt.prototype.visitDateMillisecond=St;yt.prototype.visitTimestamp=St;yt.prototype.visitTimestampSecond=St;yt.prototype.visitTimestampMillisecond=St;yt.prototype.visitTimestampMicrosecond=St;yt.prototype.visitTimestampNanosecond=St;yt.prototype.visitTime=St;yt.prototype.visitTimeSecond=St;yt.prototype.visitTimeMillisecond=St;yt.prototype.visitTimeMicrosecond=St;yt.prototype.visitTimeNanosecond=St;yt.prototype.visitDecimal=St;yt.prototype.visitList=St;yt.prototype.visitStruct=St;yt.prototype.visitUnion=St;yt.prototype.visitDenseUnion=St;yt.prototype.visitSparseUnion=St;yt.prototype.visitDictionary=St;yt.prototype.visitInterval=St;yt.prototype.visitIntervalDayTime=St;yt.prototype.visitIntervalYearMonth=St;yt.prototype.visitDuration=St;yt.prototype.visitDurationSecond=St;yt.prototype.visitDurationMillisecond=St;yt.prototype.visitDurationMicrosecond=St;yt.prototype.visitDurationNanosecond=St;yt.prototype.visitFixedSizeList=St;yt.prototype.visitMap=St;var Cl=new yt;var YA,WA={},GA={},qt=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 Kt)))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}=WA[s.typeId],u=o[0];this.isValid=f=>Sh(u,f),this.get=f=>a(u,f),this.set=(f,h)=>c(u,f,h),this.indexOf=f=>l(u,f),this._offsets=[0,u.length];break}default:Object.setPrototypeOf(this,GA[s.typeId]),this._offsets=ky(o);break}this.data=o,this.type=s,this.stride=Sr(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 nullable(){return VA(this.data)}get nullCount(){return Cy(this.data)}get ArrayType(){return this.type.ArrayType}get[Symbol.toStringTag](){return`${this.VectorName}<${this.type[Symbol.toStringTag]}>`}get VectorName(){return`${O[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}[Symbol.iterator](){return Cl.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(wh(this,t,n,({data:r,_offsets:i},o,s)=>Ry(r,i,o,s)))}toJSON(){return[...this]}toArray(){let{type:t,data:n,length:r,stride:i,ArrayType:o}=this;switch(t.typeId){case O.Int:case O.Float:case O.Decimal:case O.Time:case O.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 X.isDictionary(this.type)?this.data[0].dictionary.isMemoized:!1}memoize(){if(X.isDictionary(this.type)){let t=new Py(this.data[0].dictionary),n=this.data.map(r=>{let i=r.clone();return i.dictionary=t,i});return new e(n)}return new Py(this)}unmemoize(){if(X.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}};YA=Symbol.toStringTag;qt[YA]=(e=>{e.type=X.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(O).map(n=>O[n]).filter(n=>typeof n=="number"&&n!==O.NONE);for(let n of t){let r=qe.getVisitFnByTypeId(n),i=xn.getVisitFnByTypeId(n),o=ec.getVisitFnByTypeId(n);WA[n]={get:r,set:i,indexOf:o},GA[n]=Object.create(e,{isValid:{value:Fl(Sh)},get:{value:Fl(qe.getVisitFnByTypeId(n))},set:{value:$y(xn.getVisitFnByTypeId(n))},indexOf:{value:Uy(ec.getVisitFnByTypeId(n))}})}return"Vector"})(qt.prototype);var Py=class e extends qt{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 qt(this.data)}),Object.defineProperty(this,"memoize",{value:()=>this})}};function XA(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 UL=Object.create;var Yw=Object.defineProperty;var PL=Object.getOwnPropertyDescriptor;var zL=Object.getOwnPropertyNames;var qL=Object.getPrototypeOf,VL=Object.prototype.hasOwnProperty;var ZI=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),Gs=(e,t)=>{for(var n in t)Yw(e,n,{get:t[n],enumerable:!0})},jL=(e,t,n,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of zL(t))!VL.call(e,i)&&i!==n&&Yw(e,i,{get:()=>t[i],enumerable:!(r=PL(t,i))||r.enumerable});return e};var YL=(e,t,n)=>(n=e!=null?UL(qL(e)):{},jL(t||!e||!e.__esModule?Yw(n,"default",{value:e,enumerable:!0}):n,e));var R7=ZI((p7t,C7)=>{"use strict";function MG(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 IG(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 AG(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 TG(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 EG(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 Qm(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)}C7.exports={ge:function(e,t,n,r,i){return Qm(e,t,n,r,i,MG)},gt:function(e,t,n,r,i){return Qm(e,t,n,r,i,IG)},lt:function(e,t,n,r,i){return Qm(e,t,n,r,i,AG)},le:function(e,t,n,r,i){return Qm(e,t,n,r,i,TG)},eq:function(e,t,n,r,i){return Qm(e,t,n,r,i,EG)}}});var j7=ZI((m7t,V7)=>{"use strict";var Dw=R7(),Uf=0,Sl=1,Ew=2;V7.exports=NG;function hI(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 Km=hI.prototype;function uI(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 U7(e,t){var n=Pf(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 k7(e,t){var n=e.intervals([]);n.push(t),U7(e,n)}function $7(e,t){var n=e.intervals([]),r=n.indexOf(t);return r<0?Uf:(n.splice(r,1),U7(e,n),Sl)}Km.intervals=function(e){return e.push.apply(e,this.leftPoints),this.left&&this.left.intervals(e),this.right&&this.right.intervals(e),e};Km.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)?k7(this,e):this.left.insert(e):this.left=Pf([e]);else if(e[0]>this.mid)this.right?4*(this.right.count+1)>3*(t+1)?k7(this,e):this.right.insert(e):this.right=Pf([e]);else{var n=Dw.ge(this.leftPoints,e,dI),r=Dw.ge(this.rightPoints,e,pI);this.leftPoints.splice(n,0,e),this.rightPoints.splice(r,0,e)}};Km.remove=function(e){var t=this.count-this.leftPoints;if(e[1]<this.mid){if(!this.left)return Uf;var n=this.right?this.right.count:0;if(4*n>3*(t-1))return $7(this,e);var r=this.left.remove(e);return r===Ew?(this.left=null,this.count-=1,Sl):(r===Sl&&(this.count-=1),r)}else if(e[0]>this.mid){if(!this.right)return Uf;var i=this.left?this.left.count:0;if(4*i>3*(t-1))return $7(this,e);var r=this.right.remove(e);return r===Ew?(this.right=null,this.count-=1,Sl):(r===Sl&&(this.count-=1),r)}else{if(this.count===1)return this.leftPoints[0]===e?Ew:Uf;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}uI(this,s),this.count=(this.left?this.left.count:0)+(this.right?this.right.count:0)+this.leftPoints.length}else this.left?uI(this,this.left):uI(this,this.right);return Sl}for(var a=Dw.ge(this.leftPoints,e,dI);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=Dw.ge(this.rightPoints,e,pI);r<this.rightPoints.length&&this.rightPoints[r][1]===e[1];++r)if(this.rightPoints[r]===e)return this.rightPoints.splice(r,1),Sl}return Uf}};function P7(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 z7(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 q7(e,t){for(var n=0;n<e.length;++n){var r=t(e[n]);if(r)return r}}Km.queryPoint=function(e,t){if(e<this.mid){if(this.left){var n=this.left.queryPoint(e,t);if(n)return n}return P7(this.leftPoints,e,t)}else if(e>this.mid){if(this.right){var n=this.right.queryPoint(e,t);if(n)return n}return z7(this.rightPoints,e,t)}else return q7(this.leftPoints,t)};Km.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?P7(this.leftPoints,t,n):e>this.mid?z7(this.rightPoints,e,n):q7(this.leftPoints,n)};function DG(e,t){return e-t}function dI(e,t){var n=e[0]-t[0];return n||e[1]-t[1]}function pI(e,t){var n=e[1]-t[1];return n||e[0]-t[0]}function Pf(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(DG);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(dI),l.sort(pI),new hI(r,Pf(i),Pf(o),c,l)}function fI(e){this.root=e}var zf=fI.prototype;zf.insert=function(e){this.root?this.root.insert(e):this.root=new hI(e[0],null,null,[e],[e])};zf.remove=function(e){if(this.root){var t=this.root.remove(e);return t===Ew&&(this.root=null),t!==Uf}return!1};zf.queryPoint=function(e,t){if(this.root)return this.root.queryPoint(e,t)};zf.queryInterval=function(e,t,n){if(e<=t&&this.root)return this.root.queryInterval(e,t,n)};Object.defineProperty(zf,"count",{get:function(){return this.root?this.root.count:0}});Object.defineProperty(zf,"intervals",{get:function(){return this.root?this.root.intervals([]):[]}});function NG(e){return!e||e.length===0?new fI(null):new fI(Pf(e))}});var Xs=Symbol("Fixed"),bn=Symbol("Transient"),Wf=Symbol("Transform");var QI={};function Gf(e,t=!1){let n,r,i=QI;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=QI,a(u)}),i=l}return t?c:a}var Xf=class{constructor(t){this._filterBy=t,this._requestUpdate=Gf(()=>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(t){return this}query(t){return null}queryPending(){return this}queryResult(t){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 JI(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 KI(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 xr(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(h){r[h]&&(i[h]=function(d){return new Promise(function(p,m){o.push([h,d,p,m])>1||a(h,d)})})}function a(h,d){try{c(r[h](d))}catch(p){f(o[0][3],p)}}function c(h){h.value instanceof Ft?Promise.resolve(h.value.v).then(l,u):f(o[0][2],h)}function l(h){a("next",h)}function u(h){a("throw",h)}function f(h,d){h(d),o.shift(),o.length&&a(o[0][0],o[0][1])}}function Tl(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 fi(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 KI=="function"?KI(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 Qw={};Gs(Qw,{compareArrayLike:()=>Zw,joinUint8Arrays:()=>_r,memcpy:()=>Qf,rebaseValueOffsets:()=>gy,toArrayBufferView:()=>kt,toArrayBufferViewAsyncIterator:()=>di,toArrayBufferViewIterator:()=>qi,toBigInt64Array:()=>yy,toBigUint64Array:()=>tF,toFloat32Array:()=>eF,toFloat32ArrayAsyncIterator:()=>gF,toFloat32ArrayIterator:()=>lF,toFloat64Array:()=>nF,toFloat64ArrayAsyncIterator:()=>bF,toFloat64ArrayIterator:()=>uF,toInt16Array:()=>QL,toInt16ArrayAsyncIterator:()=>dF,toInt16ArrayIterator:()=>oF,toInt32Array:()=>ec,toInt32ArrayAsyncIterator:()=>pF,toInt32ArrayIterator:()=>sF,toInt8Array:()=>ZL,toInt8ArrayAsyncIterator:()=>hF,toInt8ArrayIterator:()=>iF,toUint16Array:()=>KL,toUint16ArrayAsyncIterator:()=>mF,toUint16ArrayIterator:()=>aF,toUint32Array:()=>JL,toUint32ArrayAsyncIterator:()=>yF,toUint32ArrayIterator:()=>cF,toUint8Array:()=>wt,toUint8ArrayAsyncIterator:()=>Hw,toUint8ArrayIterator:()=>Xw,toUint8ClampedArray:()=>rF,toUint8ClampedArrayAsyncIterator:()=>xF,toUint8ClampedArrayIterator:()=>fF});var WL=new TextDecoder("utf-8"),Hf=e=>WL.decode(e),GL=new TextEncoder,zi=e=>GL.encode(e);var XL=e=>typeof e=="number",t6=e=>typeof e=="boolean",Je=e=>typeof e=="function",jn=e=>e!=null&&Object(e)===e,wr=e=>jn(e)&&Je(e.then);var hi=e=>jn(e)&&Je(e[Symbol.iterator]),Ur=e=>jn(e)&&Je(e[Symbol.asyncIterator]),uy=e=>jn(e)&&jn(e.schema);var fy=e=>jn(e)&&"done"in e&&"value"in e;var hy=e=>jn(e)&&Je(e.stat)&&XL(e.fd);var dy=e=>jn(e)&&Zf(e.body),py=e=>"_getDOMStream"in e&&"_getNodeStream"in e,e6=e=>jn(e)&&Je(e.abort)&&Je(e.getWriter)&&!py(e),Zf=e=>jn(e)&&Je(e.cancel)&&Je(e.getReader)&&!py(e),n6=e=>jn(e)&&Je(e.end)&&Je(e.write)&&t6(e.writable)&&!py(e),my=e=>jn(e)&&Je(e.read)&&Je(e.pipe)&&t6(e.readable)&&!py(e),r6=e=>jn(e)&&Je(e.clear)&&Je(e.bytes)&&Je(e.position)&&Je(e.setPosition)&&Je(e.capacity)&&Je(e.getBufferIdentifier)&&Je(e.createLong);var Gw=typeof SharedArrayBuffer<"u"?SharedArrayBuffer:ArrayBuffer;function HL(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 Qf(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 _r(e,t){let n=HL(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?Qf(s,o,a):s=o;break}Qf(s||(s=new Uint8Array(l)),o,a),a+=o.length}return[s||new Uint8Array(0),n.slice(c),r-(s?s.byteLength:0)]}function kt(e,t){let n=fy(t)?t.value:t;return n instanceof e?e===Uint8Array?new e(n.buffer,n.byteOffset,n.byteLength):n:n?(typeof n=="string"&&(n=zi(n)),n instanceof ArrayBuffer?new e(n):n instanceof Gw?new e(n):r6(n)?kt(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 ZL=e=>kt(Int8Array,e),QL=e=>kt(Int16Array,e),ec=e=>kt(Int32Array,e),yy=e=>kt(BigInt64Array,e),wt=e=>kt(Uint8Array,e),KL=e=>kt(Uint16Array,e),JL=e=>kt(Uint32Array,e),tF=e=>kt(BigUint64Array,e),eF=e=>kt(Float32Array,e),nF=e=>kt(Float64Array,e),rF=e=>kt(Uint8ClampedArray,e),Ww=e=>(e.next(),e);function*qi(e,t){let n=function*(i){yield i},r=typeof t=="string"||ArrayBuffer.isView(t)||t instanceof ArrayBuffer||t instanceof Gw?n(t):hi(t)?t:n(t);return yield*Ww(function*(i){let o=null;do o=i.next(yield kt(e,o));while(!o.done)}(r[Symbol.iterator]())),new e}var iF=e=>qi(Int8Array,e),oF=e=>qi(Int16Array,e),sF=e=>qi(Int32Array,e),Xw=e=>qi(Uint8Array,e),aF=e=>qi(Uint16Array,e),cF=e=>qi(Uint32Array,e),lF=e=>qi(Float32Array,e),uF=e=>qi(Float64Array,e),fF=e=>qi(Uint8ClampedArray,e);function di(e,t){return xr(this,arguments,function*(){if(wr(t))return yield Ft(yield Ft(yield*Tl(fi(di(e,yield Ft(t))))));let r=function(s){return xr(this,arguments,function*(){yield yield Ft(yield Ft(s))})},i=function(s){return xr(this,arguments,function*(){yield Ft(yield*Tl(fi(Ww(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 Gw?r(t):hi(t)?i(t):Ur(t)?t:r(t);return yield Ft(yield*Tl(fi(Ww(function(s){return xr(this,arguments,function*(){let a=null;do a=yield Ft(s.next(yield yield Ft(kt(e,a))));while(!a.done)})}(o[Symbol.asyncIterator]()))))),yield Ft(new e)})}var hF=e=>di(Int8Array,e),dF=e=>di(Int16Array,e),pF=e=>di(Int32Array,e),Hw=e=>di(Uint8Array,e),mF=e=>di(Uint16Array,e),yF=e=>di(Uint32Array,e),gF=e=>di(Float32Array,e),bF=e=>di(Float64Array,e),xF=e=>di(Uint8ClampedArray,e);function gy(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 Zw(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 xn={fromIterable(e){return by(wF(e))},fromAsyncIterable(e){return by(_F(e))},fromDOMStream(e){return by(vF(e))},fromNodeStream(e){return by(SF(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')}},by=e=>(e.next(),e);function*wF(e){let t,n=!1,r=[],i,o,s,a=0;function c(){return o==="peek"?_r(r,s)[0]:([i,r,a]=_r(r,s),i)}({cmd:o,size:s}=(yield null)||{cmd:"read",size:0});let l=Xw(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 _F(e){return xr(this,arguments,function*(){let n,r=!1,i=[],o,s,a,c=0;function l(){return s==="peek"?_r(i,a)[0]:([o,i,c]=_r(i,a),o)}({cmd:s,size:a}=(yield yield Ft(null))||{cmd:"read",size:0});let u=Hw(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 vF(e){return xr(this,arguments,function*(){let n=!1,r=!1,i=[],o,s,a,c=0;function l(){return s==="peek"?_r(i,a)[0]:([o,i,c]=_r(i,a),o)}({cmd:s,size:a}=(yield yield Ft(null))||{cmd:"read",size:0});let u=new Jw(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(wt(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 Jw=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=wt(n)),n})}},Kw=(e,t)=>{let n=i=>r([t,i]),r;return[t,n,new Promise(i=>(r=i)&&e.once(t,n))]};function SF(e){return xr(this,arguments,function*(){let n=[],r="error",i=!1,o=null,s,a,c=0,l=[],u;function f(){return s==="peek"?_r(l,a)[0]:([u,l,c]=_r(l,a),u)}if({cmd:s,size:a}=(yield yield Ft(null))||{cmd:"read",size:0},e.isTTY)return yield yield Ft(new Uint8Array(0)),yield Ft(null);try{n[0]=Kw(e,"end"),n[1]=Kw(e,"error");do{if(n[2]=Kw(e,"readable"),[r,o]=yield Ft(Promise.race(n.map(d=>d[2]))),r==="error")break;if((i=r==="end")||(Number.isFinite(a-c)?(u=wt(e.read(a-c)),u.byteLength<a-c&&(u=wt(e.read()))):u=wt(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(h(n,r==="error"?o:null))}return yield Ft(null);function h(d,p){return u=l=null,new Promise((m,y)=>{for(let[g,b]of d)e.off(g,b);try{let g=e.destroy;g&&g.call(e,p),p=void 0}catch(g){p=g||p}finally{p!=null?y(p):m()}})}})}var se;(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"})(se||(se={}));var me;(function(e){e[e.Sparse=0]="Sparse",e[e.Dense=1]="Dense"})(me||(me={}));var fe;(function(e){e[e.HALF=0]="HALF",e[e.SINGLE=1]="SINGLE",e[e.DOUBLE=2]="DOUBLE"})(fe||(fe={}));var qe;(function(e){e[e.DAY=0]="DAY",e[e.MILLISECOND=1]="MILLISECOND"})(qe||(qe={}));var at;(function(e){e[e.SECOND=0]="SECOND",e[e.MILLISECOND=1]="MILLISECOND",e[e.MICROSECOND=2]="MICROSECOND",e[e.NANOSECOND=3]="NANOSECOND"})(at||(at={}));var on;(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"})(on||(on={}));var Vi=new Int32Array(2),xy=new Float32Array(Vi.buffer),wy=new Float64Array(Vi.buffer),El=new Uint16Array(new Uint8Array([1,0]).buffer)[0]===1;var Kf;(function(e){e[e.UTF8_BYTES=1]="UTF8_BYTES",e[e.UTF16_STRING=2]="UTF16_STRING"})(Kf||(Kf={}));var vr=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 Vi[0]=this.readInt32(t),xy[0]}readFloat64(t){return Vi[El?0:1]=this.readInt32(t),Vi[El?1:0]=this.readInt32(t+4),wy[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){xy[0]=n,this.writeInt32(t,Vi[0])}writeFloat64(t,n){wy[0]=n,this.writeInt32(t,Vi[El?0:1]),this.writeInt32(t+4,Vi[El?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===Kf.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 nc=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=vr.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=vr.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 Jf;(function(e){e[e.BUFFER=0]="BUFFER"})(Jf||(Jf={}));var th;(function(e){e[e.LZ4_FRAME=0]="LZ4_FRAME",e[e.ZSTD=1]="ZSTD"})(th||(th={}));var vy=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):th.LZ4_FRAME}method(){let t=this.bb.__offset(this.bb_pos,6);return t?this.bb.readInt8(this.bb_pos+t):Jf.BUFFER}static startBodyCompression(t){t.startObject(2)}static addCodec(t,n){t.addFieldInt8(0,n,th.LZ4_FRAME)}static addMethod(t,n){t.addFieldInt8(1,n,Jf.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 Dl=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 Nl=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 Sr=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 Nl).__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 Dl).__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 vy).__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 jo=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 Sr).__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 Hs;(function(e){e[e.Little=0]="Little",e[e.Big=1]="Big"})(Hs||(Hs={}));var eh;(function(e){e[e.DenseArray=0]="DenseArray"})(eh||(eh={}));var mi=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 ji=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 mi).__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):eh.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,eh.DenseArray)}static endDictionaryEncoding(t){return t.endObject()}};var tn=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 nh=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 rh=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 Zs=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):qe.MILLISECOND}static startDate(t){t.startObject(1)}static addUnit(t,n){t.addFieldInt16(0,n,qe.MILLISECOND)}static endDate(t){return t.endObject()}static createDate(t,n){return e.startDate(t),e.addUnit(t,n),e.endDate(t)}};var Yi=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 Qs=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):at.MILLISECOND}static startDuration(t){t.startObject(1)}static addUnit(t,n){t.addFieldInt16(0,n,at.MILLISECOND)}static endDuration(t){return t.endObject()}static createDuration(t,n){return e.startDuration(t),e.addUnit(t,n),e.endDuration(t)}};var Ks=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 Js=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 ta=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):fe.HALF}static startFloatingPoint(t){t.startObject(1)}static addPrecision(t,n){t.addFieldInt16(0,n,fe.HALF)}static endFloatingPoint(t){return t.endObject()}static createFloatingPoint(t,n){return e.startFloatingPoint(t),e.addPrecision(t,n),e.endFloatingPoint(t)}};var ea=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):on.YEAR_MONTH}static startInterval(t){t.startObject(1)}static addUnit(t,n){t.addFieldInt16(0,n,on.YEAR_MONTH)}static endInterval(t){return t.endObject()}static createInterval(t,n){return e.startInterval(t),e.addUnit(t,n),e.endInterval(t)}};var ih=class e{constructor(){this.bb=null,this.bb_pos=0}__init(t,n){return this.bb_pos=t,this.bb=n,this}static getRootAsLargeBinary(t,n){return(n||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsLargeBinary(t,n){return t.setPosition(t.position()+4),(n||new e).__init(t.readInt32(t.position())+t.position(),t)}static startLargeBinary(t){t.startObject(0)}static endLargeBinary(t){return t.endObject()}static createLargeBinary(t){return e.startLargeBinary(t),e.endLargeBinary(t)}};var oh=class e{constructor(){this.bb=null,this.bb_pos=0}__init(t,n){return this.bb_pos=t,this.bb=n,this}static getRootAsLargeUtf8(t,n){return(n||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsLargeUtf8(t,n){return t.setPosition(t.position()+4),(n||new e).__init(t.readInt32(t.position())+t.position(),t)}static startLargeUtf8(t){t.startObject(0)}static endLargeUtf8(t){return t.endObject()}static createLargeUtf8(t){return e.startLargeUtf8(t),e.endLargeUtf8(t)}};var sh=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 na=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 ah=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 ch=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 Yo=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):at.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,at.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 Wo=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):at.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,at.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 yi=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):me.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,me.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 lh=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 he;(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"})(he||(he={}));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):he.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 ji).__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 tn).__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,he.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 cr=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):Hs.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 tn).__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,Hs.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 Ut;(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"})(Ut||(Ut={}));var B;(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.LargeBinary=19]="LargeBinary",e[e.LargeUtf8=20]="LargeUtf8",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"})(B||(B={}));var gi;(function(e){e[e.OFFSET=0]="OFFSET",e[e.DATA=1]="DATA",e[e.VALIDITY=2]="VALIDITY",e[e.TYPE=3]="TYPE"})(gi||(gi={}));var b_={};Gs(b_,{clampIndex:()=>uC,clampRange:()=>Sh,createElementComparator:()=>oa});var t_={};Gs(t_,{valueToString:()=>bi});function bi(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=>bi(t))}]`:`[${e}]`:ArrayBuffer.isView(e)?`[${e}]`:JSON.stringify(e,(t,n)=>typeof n=="bigint"?`${n}`:n)}var n_={};Gs(n_,{BN:()=>fh,bigNumToBigInt:()=>s6,bigNumToString:()=>Ll,isArrowBigNumSymbol:()=>i6});var i6=Symbol.for("isArrowBigNum");function xi(e,...t){return t.length===0?Object.setPrototypeOf(kt(this.TypedArray,e),this.constructor.prototype):Object.setPrototypeOf(new this.TypedArray(e,...t),this.constructor.prototype)}xi.prototype[i6]=!0;xi.prototype.toJSON=function(){return`"${Ll(this)}"`};xi.prototype.valueOf=function(){return o6(this)};xi.prototype.toString=function(){return Ll(this)};xi.prototype[Symbol.toPrimitive]=function(e="default"){switch(e){case"number":return o6(this);case"string":return Ll(this);case"default":return s6(this)}return Ll(this)};function Ol(...e){return xi.apply(this,e)}function Bl(...e){return xi.apply(this,e)}function uh(...e){return xi.apply(this,e)}Object.setPrototypeOf(Ol.prototype,Object.create(Int32Array.prototype));Object.setPrototypeOf(Bl.prototype,Object.create(Uint32Array.prototype));Object.setPrototypeOf(uh.prototype,Object.create(Uint32Array.prototype));Object.assign(Ol.prototype,xi.prototype,{constructor:Ol,signed:!0,TypedArray:Int32Array,BigIntArray:BigInt64Array});Object.assign(Bl.prototype,xi.prototype,{constructor:Bl,signed:!1,TypedArray:Uint32Array,BigIntArray:BigUint64Array});Object.assign(uh.prototype,xi.prototype,{constructor:uh,signed:!0,TypedArray:Uint32Array,BigIntArray:BigUint64Array});function o6(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 Ll=e=>{if(e.byteLength===8)return`${new e.BigIntArray(e.buffer,e.byteOffset,1)[0]}`;if(!e.signed)return e_(e);let t=new Uint16Array(e.buffer,e.byteOffset,e.byteLength/2);if(new Int16Array([t.at(-1)])[0]>=0)return e_(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`-${e_(t)}`},s6=e=>e.byteLength===8?new e.BigIntArray(e.buffer,e.byteOffset,1)[0]:Ll(e);function e_(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 fh=class e{static new(t,n){switch(n){case!0:return new Ol(t);case!1:return new Bl(t)}switch(t.constructor){case Int8Array:case Int16Array:case Int32Array:case BigInt64Array:return new Ol(t)}return t.byteLength===16?new uh(t):new Bl(t)}static signed(t){return new Ol(t)}static unsigned(t){return new Bl(t)}static decimal(t){return new uh(t)}constructor(t,n){return e.new(t,n)}};function Te(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 a6,c6,l6,u6,f6,h6,d6,p6,m6,y6,g6,b6,x6,w6,_6,v6,S6,M6,I6,A6,T6,E6,X=class e{static isNull(t){return t?.typeId===B.Null}static isInt(t){return t?.typeId===B.Int}static isFloat(t){return t?.typeId===B.Float}static isBinary(t){return t?.typeId===B.Binary}static isLargeBinary(t){return t?.typeId===B.LargeBinary}static isUtf8(t){return t?.typeId===B.Utf8}static isLargeUtf8(t){return t?.typeId===B.LargeUtf8}static isBool(t){return t?.typeId===B.Bool}static isDecimal(t){return t?.typeId===B.Decimal}static isDate(t){return t?.typeId===B.Date}static isTime(t){return t?.typeId===B.Time}static isTimestamp(t){return t?.typeId===B.Timestamp}static isInterval(t){return t?.typeId===B.Interval}static isDuration(t){return t?.typeId===B.Duration}static isList(t){return t?.typeId===B.List}static isStruct(t){return t?.typeId===B.Struct}static isUnion(t){return t?.typeId===B.Union}static isFixedSizeBinary(t){return t?.typeId===B.FixedSizeBinary}static isFixedSizeList(t){return t?.typeId===B.FixedSizeList}static isMap(t){return t?.typeId===B.Map}static isDictionary(t){return t?.typeId===B.Dictionary}static isDenseUnion(t){return e.isUnion(t)&&t.mode===me.Dense}static isSparseUnion(t){return e.isUnion(t)&&t.mode===me.Sparse}constructor(t){this.typeId=t}};a6=Symbol.toStringTag;X[a6]=(e=>(e.children=null,e.ArrayType=Array,e.OffsetArrayType=Int32Array,e[Symbol.toStringTag]="DataType"))(X.prototype);var Ln=class extends X{constructor(){super(B.Null)}toString(){return"Null"}};c6=Symbol.toStringTag;Ln[c6]=(e=>e[Symbol.toStringTag]="Null")(Ln.prototype);var Be=class extends X{constructor(t,n){super(B.Int),this.isSigned=t,this.bitWidth=n}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}`}};l6=Symbol.toStringTag;Be[l6]=(e=>(e.isSigned=null,e.bitWidth=null,e[Symbol.toStringTag]="Int"))(Be.prototype);var hh=class extends Be{constructor(){super(!0,8)}get ArrayType(){return Int8Array}},dh=class extends Be{constructor(){super(!0,16)}get ArrayType(){return Int16Array}},wi=class extends Be{constructor(){super(!0,32)}get ArrayType(){return Int32Array}},ph=class extends Be{constructor(){super(!0,64)}get ArrayType(){return BigInt64Array}},mh=class extends Be{constructor(){super(!1,8)}get ArrayType(){return Uint8Array}},yh=class extends Be{constructor(){super(!1,16)}get ArrayType(){return Uint16Array}},gh=class extends Be{constructor(){super(!1,32)}get ArrayType(){return Uint32Array}},bh=class extends Be{constructor(){super(!1,64)}get ArrayType(){return BigUint64Array}};Object.defineProperty(hh.prototype,"ArrayType",{value:Int8Array});Object.defineProperty(dh.prototype,"ArrayType",{value:Int16Array});Object.defineProperty(wi.prototype,"ArrayType",{value:Int32Array});Object.defineProperty(ph.prototype,"ArrayType",{value:BigInt64Array});Object.defineProperty(mh.prototype,"ArrayType",{value:Uint8Array});Object.defineProperty(yh.prototype,"ArrayType",{value:Uint16Array});Object.defineProperty(gh.prototype,"ArrayType",{value:Uint32Array});Object.defineProperty(bh.prototype,"ArrayType",{value:BigUint64Array});var Yn=class extends X{constructor(t){super(B.Float),this.precision=t}get ArrayType(){switch(this.precision){case fe.HALF:return Uint16Array;case fe.SINGLE:return Float32Array;case fe.DOUBLE:return Float64Array}throw new Error(`Unrecognized ${this[Symbol.toStringTag]} type`)}toString(){return`Float${this.precision<<5||16}`}};u6=Symbol.toStringTag;Yn[u6]=(e=>(e.precision=null,e[Symbol.toStringTag]="Float"))(Yn.prototype);var xh=class extends Yn{constructor(){super(fe.HALF)}},wh=class extends Yn{constructor(){super(fe.SINGLE)}},_h=class extends Yn{constructor(){super(fe.DOUBLE)}};Object.defineProperty(xh.prototype,"ArrayType",{value:Uint16Array});Object.defineProperty(wh.prototype,"ArrayType",{value:Float32Array});Object.defineProperty(_h.prototype,"ArrayType",{value:Float64Array});var Wi=class extends X{constructor(){super(B.Binary)}toString(){return"Binary"}};f6=Symbol.toStringTag;Wi[f6]=(e=>(e.ArrayType=Uint8Array,e[Symbol.toStringTag]="Binary"))(Wi.prototype);var Gi=class extends X{constructor(){super(B.LargeBinary)}toString(){return"LargeBinary"}};h6=Symbol.toStringTag;Gi[h6]=(e=>(e.ArrayType=Uint8Array,e.OffsetArrayType=BigInt64Array,e[Symbol.toStringTag]="LargeBinary"))(Gi.prototype);var Xi=class extends X{constructor(){super(B.Utf8)}toString(){return"Utf8"}};d6=Symbol.toStringTag;Xi[d6]=(e=>(e.ArrayType=Uint8Array,e[Symbol.toStringTag]="Utf8"))(Xi.prototype);var Hi=class extends X{constructor(){super(B.LargeUtf8)}toString(){return"LargeUtf8"}};p6=Symbol.toStringTag;Hi[p6]=(e=>(e.ArrayType=Uint8Array,e.OffsetArrayType=BigInt64Array,e[Symbol.toStringTag]="LargeUtf8"))(Hi.prototype);var Zi=class extends X{constructor(){super(B.Bool)}toString(){return"Bool"}};m6=Symbol.toStringTag;Zi[m6]=(e=>(e.ArrayType=Uint8Array,e[Symbol.toStringTag]="Bool"))(Zi.prototype);var Qi=class extends X{constructor(t,n,r=128){super(B.Decimal),this.scale=t,this.precision=n,this.bitWidth=r}toString(){return`Decimal[${this.precision}e${this.scale>0?"+":""}${this.scale}]`}};y6=Symbol.toStringTag;Qi[y6]=(e=>(e.scale=null,e.precision=null,e.ArrayType=Uint32Array,e[Symbol.toStringTag]="Decimal"))(Qi.prototype);var Ki=class extends X{constructor(t){super(B.Date),this.unit=t}toString(){return`Date${(this.unit+1)*32}<${qe[this.unit]}>`}};g6=Symbol.toStringTag;Ki[g6]=(e=>(e.unit=null,e.ArrayType=Int32Array,e[Symbol.toStringTag]="Date"))(Ki.prototype);var zr=class extends X{constructor(t,n){super(B.Time),this.unit=t,this.bitWidth=n}toString(){return`Time${this.bitWidth}<${at[this.unit]}>`}get ArrayType(){switch(this.bitWidth){case 32:return Int32Array;case 64:return BigInt64Array}throw new Error(`Unrecognized ${this[Symbol.toStringTag]} type`)}};b6=Symbol.toStringTag;zr[b6]=(e=>(e.unit=null,e.bitWidth=null,e[Symbol.toStringTag]="Time"))(zr.prototype);var Ji=class extends X{constructor(t,n){super(B.Timestamp),this.unit=t,this.timezone=n}toString(){return`Timestamp<${at[this.unit]}${this.timezone?`, ${this.timezone}`:""}>`}};x6=Symbol.toStringTag;Ji[x6]=(e=>(e.unit=null,e.timezone=null,e.ArrayType=Int32Array,e[Symbol.toStringTag]="Timestamp"))(Ji.prototype);var to=class extends X{constructor(t){super(B.Interval),this.unit=t}toString(){return`Interval<${on[this.unit]}>`}};w6=Symbol.toStringTag;to[w6]=(e=>(e.unit=null,e.ArrayType=Int32Array,e[Symbol.toStringTag]="Interval"))(to.prototype);var eo=class extends X{constructor(t){super(B.Duration),this.unit=t}toString(){return`Duration<${at[this.unit]}>`}};_6=Symbol.toStringTag;eo[_6]=(e=>(e.unit=null,e.ArrayType=BigInt64Array,e[Symbol.toStringTag]="Duration"))(eo.prototype);var qr=class extends X{constructor(t){super(B.List),this.children=[t]}toString(){return`List<${this.valueType}>`}get valueType(){return this.children[0].type}get valueField(){return this.children[0]}get ArrayType(){return this.valueType.ArrayType}};v6=Symbol.toStringTag;qr[v6]=(e=>(e.children=null,e[Symbol.toStringTag]="List"))(qr.prototype);var ye=class extends X{constructor(t){super(B.Struct),this.children=t}toString(){return`Struct<{${this.children.map(t=>`${t.name}:${t.type}`).join(", ")}}>`}};S6=Symbol.toStringTag;ye[S6]=(e=>(e.children=null,e[Symbol.toStringTag]="Struct"))(ye.prototype);var Vr=class extends X{constructor(t,n,r){super(B.Union),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))}toString(){return`${this[Symbol.toStringTag]}<${this.children.map(t=>`${t.type}`).join(" | ")}>`}};M6=Symbol.toStringTag;Vr[M6]=(e=>(e.mode=null,e.typeIds=null,e.children=null,e.typeIdToChildIndex=null,e.ArrayType=Int8Array,e[Symbol.toStringTag]="Union"))(Vr.prototype);var no=class extends X{constructor(t){super(B.FixedSizeBinary),this.byteWidth=t}toString(){return`FixedSizeBinary[${this.byteWidth}]`}};I6=Symbol.toStringTag;no[I6]=(e=>(e.byteWidth=null,e.ArrayType=Uint8Array,e[Symbol.toStringTag]="FixedSizeBinary"))(no.prototype);var jr=class extends X{constructor(t,n){super(B.FixedSizeList),this.listSize=t,this.children=[n]}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}>`}};A6=Symbol.toStringTag;jr[A6]=(e=>(e.children=null,e.listSize=null,e[Symbol.toStringTag]="FixedSizeList"))(jr.prototype);var Yr=class extends X{constructor(t,n=!1){var r,i,o;if(super(B.Map),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 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(", ")}}>`}};T6=Symbol.toStringTag;Yr[T6]=(e=>(e.children=null,e.keysSorted=null,e[Symbol.toStringTag]="Map_"))(Yr.prototype);var MF=(e=>()=>++e)(-1),lr=class extends X{constructor(t,n,r,i){super(B.Dictionary),this.indices=n,this.dictionary=t,this.isOrdered=i||!1,this.id=r==null?MF():Te(r)}get children(){return this.dictionary.children}get valueType(){return this.dictionary}get ArrayType(){return this.dictionary.ArrayType}toString(){return`Dictionary<${this.indices}, ${this.dictionary}>`}};E6=Symbol.toStringTag;lr[E6]=(e=>(e.id=null,e.indices=null,e.isOrdered=null,e.dictionary=null,e[Symbol.toStringTag]="Dictionary"))(lr.prototype);function Mr(e){let t=e;switch(e.typeId){case B.Decimal:return e.bitWidth/32;case B.Timestamp:return 2;case B.Date:return 1+t.unit;case B.Interval:return 1+t.unit;case B.FixedSizeList:return t.listSize;case B.FixedSizeBinary:return t.byteWidth;default:return 1}}var dt=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 IF(this,t,n)}getVisitFnByTypeId(t,n=!0){return Fl(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}visitLargeUtf8(t,...n){return null}visitBinary(t,...n){return null}visitLargeBinary(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 IF(e,t,n=!0){return typeof t=="number"?Fl(e,t,n):typeof t=="string"&&t in B?Fl(e,B[t],n):t&&t instanceof X?Fl(e,D6(t),n):t?.type&&t.type instanceof X?Fl(e,D6(t.type),n):Fl(e,B.NONE,n)}function Fl(e,t,n=!0){let r=null;switch(t){case B.Null:r=e.visitNull;break;case B.Bool:r=e.visitBool;break;case B.Int:r=e.visitInt;break;case B.Int8:r=e.visitInt8||e.visitInt;break;case B.Int16:r=e.visitInt16||e.visitInt;break;case B.Int32:r=e.visitInt32||e.visitInt;break;case B.Int64:r=e.visitInt64||e.visitInt;break;case B.Uint8:r=e.visitUint8||e.visitInt;break;case B.Uint16:r=e.visitUint16||e.visitInt;break;case B.Uint32:r=e.visitUint32||e.visitInt;break;case B.Uint64:r=e.visitUint64||e.visitInt;break;case B.Float:r=e.visitFloat;break;case B.Float16:r=e.visitFloat16||e.visitFloat;break;case B.Float32:r=e.visitFloat32||e.visitFloat;break;case B.Float64:r=e.visitFloat64||e.visitFloat;break;case B.Utf8:r=e.visitUtf8;break;case B.LargeUtf8:r=e.visitLargeUtf8;break;case B.Binary:r=e.visitBinary;break;case B.LargeBinary:r=e.visitLargeBinary;break;case B.FixedSizeBinary:r=e.visitFixedSizeBinary;break;case B.Date:r=e.visitDate;break;case B.DateDay:r=e.visitDateDay||e.visitDate;break;case B.DateMillisecond:r=e.visitDateMillisecond||e.visitDate;break;case B.Timestamp:r=e.visitTimestamp;break;case B.TimestampSecond:r=e.visitTimestampSecond||e.visitTimestamp;break;case B.TimestampMillisecond:r=e.visitTimestampMillisecond||e.visitTimestamp;break;case B.TimestampMicrosecond:r=e.visitTimestampMicrosecond||e.visitTimestamp;break;case B.TimestampNanosecond:r=e.visitTimestampNanosecond||e.visitTimestamp;break;case B.Time:r=e.visitTime;break;case B.TimeSecond:r=e.visitTimeSecond||e.visitTime;break;case B.TimeMillisecond:r=e.visitTimeMillisecond||e.visitTime;break;case B.TimeMicrosecond:r=e.visitTimeMicrosecond||e.visitTime;break;case B.TimeNanosecond:r=e.visitTimeNanosecond||e.visitTime;break;case B.Decimal:r=e.visitDecimal;break;case B.List:r=e.visitList;break;case B.Struct:r=e.visitStruct;break;case B.Union:r=e.visitUnion;break;case B.DenseUnion:r=e.visitDenseUnion||e.visitUnion;break;case B.SparseUnion:r=e.visitSparseUnion||e.visitUnion;break;case B.Dictionary:r=e.visitDictionary;break;case B.Interval:r=e.visitInterval;break;case B.IntervalDayTime:r=e.visitIntervalDayTime||e.visitInterval;break;case B.IntervalYearMonth:r=e.visitIntervalYearMonth||e.visitInterval;break;case B.Duration:r=e.visitDuration;break;case B.DurationSecond:r=e.visitDurationSecond||e.visitDuration;break;case B.DurationMillisecond:r=e.visitDurationMillisecond||e.visitDuration;break;case B.DurationMicrosecond:r=e.visitDurationMicrosecond||e.visitDuration;break;case B.DurationNanosecond:r=e.visitDurationNanosecond||e.visitDuration;break;case B.FixedSizeList:r=e.visitFixedSizeList;break;case B.Map:r=e.visitMap;break}if(typeof r=="function")return r;if(!n)return()=>null;throw new Error(`Unrecognized type '${B[t]}'`)}function D6(e){switch(e.typeId){case B.Null:return B.Null;case B.Int:{let{bitWidth:t,isSigned:n}=e;switch(t){case 8:return n?B.Int8:B.Uint8;case 16:return n?B.Int16:B.Uint16;case 32:return n?B.Int32:B.Uint32;case 64:return n?B.Int64:B.Uint64}return B.Int}case B.Float:switch(e.precision){case fe.HALF:return B.Float16;case fe.SINGLE:return B.Float32;case fe.DOUBLE:return B.Float64}return B.Float;case B.Binary:return B.Binary;case B.LargeBinary:return B.LargeBinary;case B.Utf8:return B.Utf8;case B.LargeUtf8:return B.LargeUtf8;case B.Bool:return B.Bool;case B.Decimal:return B.Decimal;case B.Time:switch(e.unit){case at.SECOND:return B.TimeSecond;case at.MILLISECOND:return B.TimeMillisecond;case at.MICROSECOND:return B.TimeMicrosecond;case at.NANOSECOND:return B.TimeNanosecond}return B.Time;case B.Timestamp:switch(e.unit){case at.SECOND:return B.TimestampSecond;case at.MILLISECOND:return B.TimestampMillisecond;case at.MICROSECOND:return B.TimestampMicrosecond;case at.NANOSECOND:return B.TimestampNanosecond}return B.Timestamp;case B.Date:switch(e.unit){case qe.DAY:return B.DateDay;case qe.MILLISECOND:return B.DateMillisecond}return B.Date;case B.Interval:switch(e.unit){case on.DAY_TIME:return B.IntervalDayTime;case on.YEAR_MONTH:return B.IntervalYearMonth}return B.Interval;case B.Duration:switch(e.unit){case at.SECOND:return B.DurationSecond;case at.MILLISECOND:return B.DurationMillisecond;case at.MICROSECOND:return B.DurationMicrosecond;case at.NANOSECOND:return B.DurationNanosecond}return B.Duration;case B.Map:return B.Map;case B.List:return B.List;case B.Struct:return B.Struct;case B.Union:switch(e.mode){case me.Dense:return B.DenseUnion;case me.Sparse:return B.SparseUnion}return B.Union;case B.FixedSizeBinary:return B.FixedSizeBinary;case B.FixedSizeList:return B.FixedSizeList;case B.Dictionary:return B.Dictionary}throw new Error(`Unrecognized type '${B[e.typeId]}'`)}dt.prototype.visitInt8=null;dt.prototype.visitInt16=null;dt.prototype.visitInt32=null;dt.prototype.visitInt64=null;dt.prototype.visitUint8=null;dt.prototype.visitUint16=null;dt.prototype.visitUint32=null;dt.prototype.visitUint64=null;dt.prototype.visitFloat16=null;dt.prototype.visitFloat32=null;dt.prototype.visitFloat64=null;dt.prototype.visitDateDay=null;dt.prototype.visitDateMillisecond=null;dt.prototype.visitTimestampSecond=null;dt.prototype.visitTimestampMillisecond=null;dt.prototype.visitTimestampMicrosecond=null;dt.prototype.visitTimestampNanosecond=null;dt.prototype.visitTimeSecond=null;dt.prototype.visitTimeMillisecond=null;dt.prototype.visitTimeMicrosecond=null;dt.prototype.visitTimeNanosecond=null;dt.prototype.visitDenseUnion=null;dt.prototype.visitSparseUnion=null;dt.prototype.visitIntervalDayTime=null;dt.prototype.visitIntervalYearMonth=null;dt.prototype.visitDuration=null;dt.prototype.visitDurationSecond=null;dt.prototype.visitDurationMillisecond=null;dt.prototype.visitDurationMicrosecond=null;dt.prototype.visitDurationNanosecond=null;var r_={};Gs(r_,{float64ToUint16:()=>vh,uint16ToFloat64:()=>Sy});var N6=new Float64Array(1),Cl=new Uint32Array(N6.buffer);function Sy(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 vh(e){if(e!==e)return 32256;N6[0]=e;let t=(Cl[1]&2147483648)>>16&65535,n=Cl[1]&2146435072,r=0;return n>=1089470464?Cl[0]>0?n=31744:(n=(n&2080374784)>>16,r=(Cl[1]&1048575)>>10):n<=1056964608?(r=1048576+(Cl[1]&1048575),r=1048576+(r<<(n>>20)-998)>>21,n=0):(n=n-1056964608>>10,r=(Cl[1]&1048575)+512>>10),t|n|r&65535}var xt=class extends dt{};function Mt(e){return(t,n,r)=>{if(t.setValid(n,r!=null))return e(t,n,r)}}var AF=(e,t,n)=>{e[t]=Math.trunc(n/864e5)},i_=(e,t,n)=>{e[t]=Math.trunc(n%4294967296),e[t+1]=Math.trunc(n/4294967296)},TF=(e,t,n)=>{e[t]=Math.trunc(n*1e3%4294967296),e[t+1]=Math.trunc(n*1e3/4294967296)},EF=(e,t,n)=>{e[t]=Math.trunc(n*1e6%4294967296),e[t+1]=Math.trunc(n*1e6/4294967296)},O6=(e,t,n,r)=>{if(n+1<t.length){let i=Te(t[n]),o=Te(t[n+1]);e.set(r.subarray(0,o-i),i)}},DF=({offset:e,values:t},n,r)=>{let i=e+n;r?t[i>>3]|=1<<i%8:t[i>>3]&=~(1<<i%8)},Go=({values:e},t,n)=>{e[t]=n},o_=({values:e},t,n)=>{e[t]=n},B6=({values:e},t,n)=>{e[t]=vh(n)},NF=(e,t,n)=>{switch(e.type.precision){case fe.HALF:return B6(e,t,n);case fe.SINGLE:case fe.DOUBLE:return o_(e,t,n)}},My=({values:e},t,n)=>{AF(e,t,n.valueOf())},Iy=({values:e},t,n)=>{i_(e,t*2,n.valueOf())},s_=({stride:e,values:t},n,r)=>{t.set(r.subarray(0,e),e*n)},L6=({values:e,valueOffsets:t},n,r)=>O6(e,t,n,r),F6=({values:e,valueOffsets:t},n,r)=>O6(e,t,n,zi(r)),a_=(e,t,n)=>{e.type.unit===qe.DAY?My(e,t,n):Iy(e,t,n)},Ay=({values:e},t,n)=>i_(e,t*2,n/1e3),Ty=({values:e},t,n)=>i_(e,t*2,n),Ey=({values:e},t,n)=>TF(e,t*2,n),Dy=({values:e},t,n)=>EF(e,t*2,n),c_=(e,t,n)=>{switch(e.type.unit){case at.SECOND:return Ay(e,t,n);case at.MILLISECOND:return Ty(e,t,n);case at.MICROSECOND:return Ey(e,t,n);case at.NANOSECOND:return Dy(e,t,n)}},Ny=({values:e},t,n)=>{e[t]=n},Oy=({values:e},t,n)=>{e[t]=n},By=({values:e},t,n)=>{e[t]=n},Ly=({values:e},t,n)=>{e[t]=n},l_=(e,t,n)=>{switch(e.type.unit){case at.SECOND:return Ny(e,t,n);case at.MILLISECOND:return Oy(e,t,n);case at.MICROSECOND:return By(e,t,n);case at.NANOSECOND:return Ly(e,t,n)}},u_=({values:e,stride:t},n,r)=>{e.set(r.subarray(0,t),t*n)},OF=(e,t,n)=>{let r=e.children[0],i=e.valueOffsets,o=wn.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))},BF=(e,t,n)=>{let r=e.children[0],{valueOffsets:i}=e,o=wn.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},LF=(e,t)=>(n,r,i,o)=>r&&n(r,e,t[o]),FF=(e,t)=>(n,r,i,o)=>r&&n(r,e,t.get(o)),CF=(e,t)=>(n,r,i,o)=>r&&n(r,e,t.get(i.name)),RF=(e,t)=>(n,r,i,o)=>r&&n(r,e,t[i.name]),kF=(e,t,n)=>{let r=e.type.children.map(o=>wn.getVisitFn(o.type)),i=n instanceof Map?CF(t,n):n instanceof qt?FF(t,n):Array.isArray(n)?LF(t,n):RF(t,n);e.type.children.forEach((o,s)=>i(r[s],e.children[s],o,s))},$F=(e,t,n)=>{e.type.mode===me.Dense?C6(e,t,n):R6(e,t,n)},C6=(e,t,n)=>{let r=e.type.typeIdToChildIndex[e.typeIds[t]],i=e.children[r];wn.visit(i,e.valueOffsets[t],n)},R6=(e,t,n)=>{let r=e.type.typeIdToChildIndex[e.typeIds[t]],i=e.children[r];wn.visit(i,t,n)},UF=(e,t,n)=>{var r;(r=e.dictionary)===null||r===void 0||r.set(e.values[t],n)},f_=(e,t,n)=>{e.type.unit===on.DAY_TIME?Fy(e,t,n):Cy(e,t,n)},Fy=({values:e},t,n)=>{e.set(n.subarray(0,2),2*t)},Cy=({values:e},t,n)=>{e[t]=n[0]*12+n[1]%12},Ry=({values:e},t,n)=>{e[t]=n},ky=({values:e},t,n)=>{e[t]=n},$y=({values:e},t,n)=>{e[t]=n},Uy=({values:e},t,n)=>{e[t]=n},h_=(e,t,n)=>{switch(e.type.unit){case at.SECOND:return Ry(e,t,n);case at.MILLISECOND:return ky(e,t,n);case at.MICROSECOND:return $y(e,t,n);case at.NANOSECOND:return Uy(e,t,n)}},PF=(e,t,n)=>{let{stride:r}=e,i=e.children[0],o=wn.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))};xt.prototype.visitBool=Mt(DF);xt.prototype.visitInt=Mt(Go);xt.prototype.visitInt8=Mt(Go);xt.prototype.visitInt16=Mt(Go);xt.prototype.visitInt32=Mt(Go);xt.prototype.visitInt64=Mt(Go);xt.prototype.visitUint8=Mt(Go);xt.prototype.visitUint16=Mt(Go);xt.prototype.visitUint32=Mt(Go);xt.prototype.visitUint64=Mt(Go);xt.prototype.visitFloat=Mt(NF);xt.prototype.visitFloat16=Mt(B6);xt.prototype.visitFloat32=Mt(o_);xt.prototype.visitFloat64=Mt(o_);xt.prototype.visitUtf8=Mt(F6);xt.prototype.visitLargeUtf8=Mt(F6);xt.prototype.visitBinary=Mt(L6);xt.prototype.visitLargeBinary=Mt(L6);xt.prototype.visitFixedSizeBinary=Mt(s_);xt.prototype.visitDate=Mt(a_);xt.prototype.visitDateDay=Mt(My);xt.prototype.visitDateMillisecond=Mt(Iy);xt.prototype.visitTimestamp=Mt(c_);xt.prototype.visitTimestampSecond=Mt(Ay);xt.prototype.visitTimestampMillisecond=Mt(Ty);xt.prototype.visitTimestampMicrosecond=Mt(Ey);xt.prototype.visitTimestampNanosecond=Mt(Dy);xt.prototype.visitTime=Mt(l_);xt.prototype.visitTimeSecond=Mt(Ny);xt.prototype.visitTimeMillisecond=Mt(Oy);xt.prototype.visitTimeMicrosecond=Mt(By);xt.prototype.visitTimeNanosecond=Mt(Ly);xt.prototype.visitDecimal=Mt(u_);xt.prototype.visitList=Mt(OF);xt.prototype.visitStruct=Mt(kF);xt.prototype.visitUnion=Mt($F);xt.prototype.visitDenseUnion=Mt(C6);xt.prototype.visitSparseUnion=Mt(R6);xt.prototype.visitDictionary=Mt(UF);xt.prototype.visitInterval=Mt(f_);xt.prototype.visitIntervalDayTime=Mt(Fy);xt.prototype.visitIntervalYearMonth=Mt(Cy);xt.prototype.visitDuration=Mt(h_);xt.prototype.visitDurationSecond=Mt(Ry);xt.prototype.visitDurationMillisecond=Mt(ky);xt.prototype.visitDurationMicrosecond=Mt($y);xt.prototype.visitDurationNanosecond=Mt(Uy);xt.prototype.visitFixedSizeList=Mt(PF);xt.prototype.visitMap=Mt(BF);var wn=new xt;var _i=Symbol.for("parent"),Rl=Symbol.for("rowIndex"),ra=class{constructor(t,n){return this[_i]=t,this[Rl]=n,new Proxy(this,new p_)}toArray(){return Object.values(this.toJSON())}toJSON(){let t=this[Rl],n=this[_i],r=n.type.children,i={};for(let o=-1,s=r.length;++o<s;)i[r[o].name]=Ve.visit(n.children[o],t);return i}toString(){return`{${[...this].map(([t,n])=>`${bi(t)}: ${bi(n)}`).join(", ")}}`}[Symbol.for("nodejs.util.inspect.custom")](){return this.toString()}[Symbol.iterator](){return new d_(this[_i],this[Rl])}},d_=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,Ve.visit(this.children[t],this.rowIndex)]}):{done:!0,value:null}}};Object.defineProperties(ra.prototype,{[Symbol.toStringTag]:{enumerable:!1,configurable:!1,value:"Row"},[_i]:{writable:!0,enumerable:!1,configurable:!1,value:null},[Rl]:{writable:!0,enumerable:!1,configurable:!1,value:-1}});var p_=class{isExtensible(){return!1}deleteProperty(){return!1}preventExtensions(){return!0}ownKeys(t){return t[_i].type.children.map(n=>n.name)}has(t,n){return t[_i].type.children.findIndex(r=>r.name===n)!==-1}getOwnPropertyDescriptor(t,n){if(t[_i].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[_i].type.children.findIndex(i=>i.name===n);if(r!==-1){let i=Ve.visit(t[_i].children[r],t[Rl]);return Reflect.set(t,n,i),i}}set(t,n,r){let i=t[_i].type.children.findIndex(o=>o.name===n);return i!==-1?(wn.visit(t[_i].children[i],t[Rl],r),Reflect.set(t,n,r)):Reflect.has(t,n)||typeof n=="symbol"?Reflect.set(t,n,r):!1}};var pt=class extends dt{};function vt(e){return(t,n)=>t.getValid(n)?e(t,n):null}var zF=(e,t)=>864e5*e[t],m_=(e,t)=>4294967296*e[t+1]+(e[t]>>>0),qF=(e,t)=>4294967296*(e[t+1]/1e3)+(e[t]>>>0)/1e3,VF=(e,t)=>4294967296*(e[t+1]/1e6)+(e[t]>>>0)/1e6,k6=e=>new Date(e),jF=(e,t)=>k6(zF(e,t)),YF=(e,t)=>k6(m_(e,t)),WF=(e,t)=>null,$6=(e,t,n)=>{if(n+1>=t.length)return null;let r=Te(t[n]),i=Te(t[n+1]);return e.subarray(r,i)},GF=({offset:e,values:t},n)=>{let r=e+n;return(t[r>>3]&1<<r%8)!==0},U6=({values:e},t)=>jF(e,t),P6=({values:e},t)=>YF(e,t*2),ia=({stride:e,values:t},n)=>t[e*n],XF=({stride:e,values:t},n)=>Sy(t[e*n]),z6=({values:e},t)=>e[t],HF=({stride:e,values:t},n)=>t.subarray(e*n,e*(n+1)),q6=({values:e,valueOffsets:t},n)=>$6(e,t,n),V6=({values:e,valueOffsets:t},n)=>{let r=$6(e,t,n);return r!==null?Hf(r):null},ZF=({values:e},t)=>e[t],QF=({type:e,values:t},n)=>e.precision!==fe.HALF?t[n]:Sy(t[n]),KF=(e,t)=>e.type.unit===qe.DAY?U6(e,t):P6(e,t),j6=({values:e},t)=>1e3*m_(e,t*2),Y6=({values:e},t)=>m_(e,t*2),W6=({values:e},t)=>qF(e,t*2),G6=({values:e},t)=>VF(e,t*2),JF=(e,t)=>{switch(e.type.unit){case at.SECOND:return j6(e,t);case at.MILLISECOND:return Y6(e,t);case at.MICROSECOND:return W6(e,t);case at.NANOSECOND:return G6(e,t)}},X6=({values:e},t)=>e[t],H6=({values:e},t)=>e[t],Z6=({values:e},t)=>e[t],Q6=({values:e},t)=>e[t],tC=(e,t)=>{switch(e.type.unit){case at.SECOND:return X6(e,t);case at.MILLISECOND:return H6(e,t);case at.MICROSECOND:return Z6(e,t);case at.NANOSECOND:return Q6(e,t)}},eC=({values:e,stride:t},n)=>fh.decimal(e.subarray(t*n,t*(n+1))),nC=(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 qt([c])},rC=(e,t)=>{let{valueOffsets:n,children:r}=e,{[t]:i,[t+1]:o}=n,s=r[0];return new ro(s.slice(i,o-i))},iC=(e,t)=>new ra(e,t),oC=(e,t)=>e.type.mode===me.Dense?K6(e,t):J6(e,t),K6=(e,t)=>{let n=e.type.typeIdToChildIndex[e.typeIds[t]],r=e.children[n];return Ve.visit(r,e.valueOffsets[t])},J6=(e,t)=>{let n=e.type.typeIdToChildIndex[e.typeIds[t]],r=e.children[n];return Ve.visit(r,t)},sC=(e,t)=>{var n;return(n=e.dictionary)===null||n===void 0?void 0:n.get(e.values[t])},aC=(e,t)=>e.type.unit===on.DAY_TIME?tA(e,t):eA(e,t),tA=({values:e},t)=>e.subarray(2*t,2*(t+1)),eA=({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},nA=({values:e},t)=>e[t],rA=({values:e},t)=>e[t],iA=({values:e},t)=>e[t],oA=({values:e},t)=>e[t],cC=(e,t)=>{switch(e.type.unit){case at.SECOND:return nA(e,t);case at.MILLISECOND:return rA(e,t);case at.MICROSECOND:return iA(e,t);case at.NANOSECOND:return oA(e,t)}},lC=(e,t)=>{let{stride:n,children:r}=e,o=r[0].slice(t*n,n);return new qt([o])};pt.prototype.visitNull=vt(WF);pt.prototype.visitBool=vt(GF);pt.prototype.visitInt=vt(ZF);pt.prototype.visitInt8=vt(ia);pt.prototype.visitInt16=vt(ia);pt.prototype.visitInt32=vt(ia);pt.prototype.visitInt64=vt(z6);pt.prototype.visitUint8=vt(ia);pt.prototype.visitUint16=vt(ia);pt.prototype.visitUint32=vt(ia);pt.prototype.visitUint64=vt(z6);pt.prototype.visitFloat=vt(QF);pt.prototype.visitFloat16=vt(XF);pt.prototype.visitFloat32=vt(ia);pt.prototype.visitFloat64=vt(ia);pt.prototype.visitUtf8=vt(V6);pt.prototype.visitLargeUtf8=vt(V6);pt.prototype.visitBinary=vt(q6);pt.prototype.visitLargeBinary=vt(q6);pt.prototype.visitFixedSizeBinary=vt(HF);pt.prototype.visitDate=vt(KF);pt.prototype.visitDateDay=vt(U6);pt.prototype.visitDateMillisecond=vt(P6);pt.prototype.visitTimestamp=vt(JF);pt.prototype.visitTimestampSecond=vt(j6);pt.prototype.visitTimestampMillisecond=vt(Y6);pt.prototype.visitTimestampMicrosecond=vt(W6);pt.prototype.visitTimestampNanosecond=vt(G6);pt.prototype.visitTime=vt(tC);pt.prototype.visitTimeSecond=vt(X6);pt.prototype.visitTimeMillisecond=vt(H6);pt.prototype.visitTimeMicrosecond=vt(Z6);pt.prototype.visitTimeNanosecond=vt(Q6);pt.prototype.visitDecimal=vt(eC);pt.prototype.visitList=vt(nC);pt.prototype.visitStruct=vt(iC);pt.prototype.visitUnion=vt(oC);pt.prototype.visitDenseUnion=vt(K6);pt.prototype.visitSparseUnion=vt(J6);pt.prototype.visitDictionary=vt(sC);pt.prototype.visitInterval=vt(aC);pt.prototype.visitIntervalDayTime=vt(tA);pt.prototype.visitIntervalYearMonth=vt(eA);pt.prototype.visitDuration=vt(cC);pt.prototype.visitDurationSecond=vt(nA);pt.prototype.visitDurationMillisecond=vt(rA);pt.prototype.visitDurationMicrosecond=vt(iA);pt.prototype.visitDurationNanosecond=vt(oA);pt.prototype.visitFixedSizeList=vt(lC);pt.prototype.visitMap=vt(rC);var Ve=new pt;var Wr=Symbol.for("keys"),kl=Symbol.for("vals"),ro=class{constructor(t){return this[Wr]=new qt([t.children[0]]).memoize(),this[kl]=t.children[1],new Proxy(this,new g_)}[Symbol.iterator](){return new y_(this[Wr],this[kl])}get size(){return this[Wr].length}toArray(){return Object.values(this.toJSON())}toJSON(){let t=this[Wr],n=this[kl],r={};for(let i=-1,o=t.length;++i<o;)r[t.get(i)]=Ve.visit(n,i);return r}toString(){return`{${[...this].map(([t,n])=>`${bi(t)}: ${bi(n)}`).join(", ")}}`}[Symbol.for("nodejs.util.inspect.custom")](){return this.toString()}},y_=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),Ve.visit(this.vals,t)]})}},g_=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=Ve.visit(Reflect.get(t,kl),r);return Reflect.set(t,n,i),i}}set(t,n,r){let i=t[Wr].indexOf(n);return i!==-1?(wn.visit(Reflect.get(t,kl),i,r),Reflect.set(t,n,r)):Reflect.has(t,n)?Reflect.set(t,n,r):!1}};Object.defineProperties(ro.prototype,{[Symbol.toStringTag]:{enumerable:!1,configurable:!1,value:"Row"},[Wr]:{writable:!0,enumerable:!1,configurable:!1,value:null},[kl]:{writable:!0,enumerable:!1,configurable:!1,value:null}});function uC(e,t,n){let r=e.length,i=t>-1?t:r+t%r;return n?n(e,i):i}var sA;function Sh(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&&(sA=o,o=s,s=sA),s>i&&(s=i),r?r(e,o,s):[o,s]}var aA=e=>e!==e;function oa(e){if(typeof e!=="object"||e===null)return aA(e)?aA: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?Zw(e,n):!1:e instanceof Map?hC(e):Array.isArray(e)?fC(e):e instanceof qt?dC(e):pC(e,!0)}function fC(e){let t=[];for(let n=-1,r=e.length;++n<r;)t[n]=oa(e[n]);return Py(t)}function hC(e){let t=-1,n=[];for(let r of e.values())n[++t]=oa(r);return Py(n)}function dC(e){let t=[];for(let n=-1,r=e.length;++n<r;)t[n]=oa(e.get(n));return Py(t)}function pC(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]=oa(e[n[i]]);return Py(r,n)}function Py(e,t){return n=>{if(!n||typeof n!="object")return!1;switch(n.constructor){case Array:return mC(e,n);case Map:return cA(e,n,n.keys());case ro:case ra:case Object:case void 0:return cA(e,n,t||Object.keys(n))}return n instanceof qt?yC(e,n):!1}}function mC(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 yC(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 cA(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 x_={};Gs(x_,{BitIterator:()=>rc,getBit:()=>lA,getBool:()=>qy,packBools:()=>oc,popcnt_array:()=>uA,popcnt_bit_range:()=>Mh,popcnt_uint32:()=>zy,setBool:()=>gC,truncateBitmap:()=>ic});function qy(e,t,n,r){return(n&1<<r)!==0}function lA(e,t,n,r){return(n&1<<r)>>r}function gC(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):oc(new rc(n,e,t,null,qy)).subarray(0,r)),i}return n}function oc(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 rc=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 Mh(e,t,n){if(n-t<=0)return 0;if(n-t<8){let o=0;for(let s of new rc(e,t,n-t,e,lA))o+=s;return o}let r=n>>3<<3,i=t+(t%8===0?0:8-t%8);return Mh(e,t,i)+Mh(e,r,n)+uA(e,i>>3,r-i>>3)}function uA(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+=zy(o.getUint32(i)),i+=4;for(;s-i>=2;)r+=zy(o.getUint16(i)),i+=2;for(;s-i>=1;)r+=zy(o.getUint8(i)),i+=1;return r}function zy(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 bC=-1,Kt=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 X.isSparseUnion(t)?this.children.some(n=>n.nullable):X.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(X.isUnion(this.type))return this.children.reduce((r,i)=>r+i.nullCount,0);let t=this._nullCount,n;return t<=bC&&(n=this.nullBitmap)&&(this._nullCount=t=this.length-Mh(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(X.isUnion(n)){let r=n,i=this.children[r.typeIdToChildIndex[this.typeIds[t]]],o=r.mode===me.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(X.isUnion(i)){let o=i,s=this.children[o.typeIdToChildIndex[this.typeIds[t]]],a=o.mode===me.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===B.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[gi.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[gi.TYPE])&&(s[gi.TYPE]=o.subarray(t,t+n)),(o=s[gi.OFFSET])&&(s[gi.OFFSET]=o.subarray(t,t+n+1))||(o=s[gi.DATA])&&(s[gi.DATA]=i===6?o:o.subarray(r*t,r*(t+n))),s}_sliceChildren(t,n,r){return t.map(i=>i.slice(n,r))}};Kt.prototype.children=Object.freeze([]);var w_=class e extends dt{visit(t){return this.getVisitFn(t.type).call(this,t)}visitNull(t){let{["type"]:n,["offset"]:r=0,["length"]:i=0}=t;return new Kt(n,r,i,i)}visitBool(t){let{["type"]:n,["offset"]:r=0}=t,i=wt(t.nullBitmap),o=kt(n.ArrayType,t.data),{["length"]:s=o.length>>3,["nullCount"]:a=t.nullBitmap?-1:0}=t;return new Kt(n,r,s,a,[void 0,o,i])}visitInt(t){let{["type"]:n,["offset"]:r=0}=t,i=wt(t.nullBitmap),o=kt(n.ArrayType,t.data),{["length"]:s=o.length,["nullCount"]:a=t.nullBitmap?-1:0}=t;return new Kt(n,r,s,a,[void 0,o,i])}visitFloat(t){let{["type"]:n,["offset"]:r=0}=t,i=wt(t.nullBitmap),o=kt(n.ArrayType,t.data),{["length"]:s=o.length,["nullCount"]:a=t.nullBitmap?-1:0}=t;return new Kt(n,r,s,a,[void 0,o,i])}visitUtf8(t){let{["type"]:n,["offset"]:r=0}=t,i=wt(t.data),o=wt(t.nullBitmap),s=ec(t.valueOffsets),{["length"]:a=s.length-1,["nullCount"]:c=t.nullBitmap?-1:0}=t;return new Kt(n,r,a,c,[s,i,o])}visitLargeUtf8(t){let{["type"]:n,["offset"]:r=0}=t,i=wt(t.data),o=wt(t.nullBitmap),s=yy(t.valueOffsets),{["length"]:a=s.length-1,["nullCount"]:c=t.nullBitmap?-1:0}=t;return new Kt(n,r,a,c,[s,i,o])}visitBinary(t){let{["type"]:n,["offset"]:r=0}=t,i=wt(t.data),o=wt(t.nullBitmap),s=ec(t.valueOffsets),{["length"]:a=s.length-1,["nullCount"]:c=t.nullBitmap?-1:0}=t;return new Kt(n,r,a,c,[s,i,o])}visitLargeBinary(t){let{["type"]:n,["offset"]:r=0}=t,i=wt(t.data),o=wt(t.nullBitmap),s=yy(t.valueOffsets),{["length"]:a=s.length-1,["nullCount"]:c=t.nullBitmap?-1:0}=t;return new Kt(n,r,a,c,[s,i,o])}visitFixedSizeBinary(t){let{["type"]:n,["offset"]:r=0}=t,i=wt(t.nullBitmap),o=kt(n.ArrayType,t.data),{["length"]:s=o.length/Mr(n),["nullCount"]:a=t.nullBitmap?-1:0}=t;return new Kt(n,r,s,a,[void 0,o,i])}visitDate(t){let{["type"]:n,["offset"]:r=0}=t,i=wt(t.nullBitmap),o=kt(n.ArrayType,t.data),{["length"]:s=o.length/Mr(n),["nullCount"]:a=t.nullBitmap?-1:0}=t;return new Kt(n,r,s,a,[void 0,o,i])}visitTimestamp(t){let{["type"]:n,["offset"]:r=0}=t,i=wt(t.nullBitmap),o=kt(n.ArrayType,t.data),{["length"]:s=o.length/Mr(n),["nullCount"]:a=t.nullBitmap?-1:0}=t;return new Kt(n,r,s,a,[void 0,o,i])}visitTime(t){let{["type"]:n,["offset"]:r=0}=t,i=wt(t.nullBitmap),o=kt(n.ArrayType,t.data),{["length"]:s=o.length/Mr(n),["nullCount"]:a=t.nullBitmap?-1:0}=t;return new Kt(n,r,s,a,[void 0,o,i])}visitDecimal(t){let{["type"]:n,["offset"]:r=0}=t,i=wt(t.nullBitmap),o=kt(n.ArrayType,t.data),{["length"]:s=o.length/Mr(n),["nullCount"]:a=t.nullBitmap?-1:0}=t;return new Kt(n,r,s,a,[void 0,o,i])}visitList(t){let{["type"]:n,["offset"]:r=0,["child"]:i}=t,o=wt(t.nullBitmap),s=ec(t.valueOffsets),{["length"]:a=s.length-1,["nullCount"]:c=t.nullBitmap?-1:0}=t;return new Kt(n,r,a,c,[s,void 0,o],[i])}visitStruct(t){let{["type"]:n,["offset"]:r=0,["children"]:i=[]}=t,o=wt(t.nullBitmap),{length:s=i.reduce((c,{length:l})=>Math.max(c,l),0),nullCount:a=t.nullBitmap?-1:0}=t;return new Kt(n,r,s,a,[void 0,void 0,o],i)}visitUnion(t){let{["type"]:n,["offset"]:r=0,["children"]:i=[]}=t,o=kt(n.ArrayType,t.typeIds),{["length"]:s=o.length,["nullCount"]:a=-1}=t;if(X.isSparseUnion(n))return new Kt(n,r,s,a,[void 0,void 0,void 0,o],i);let c=ec(t.valueOffsets);return new Kt(n,r,s,a,[c,void 0,void 0,o],i)}visitDictionary(t){let{["type"]:n,["offset"]:r=0}=t,i=wt(t.nullBitmap),o=kt(n.indices.ArrayType,t.data),{["dictionary"]:s=new qt([new e().visit({type:n.dictionary})])}=t,{["length"]:a=o.length,["nullCount"]:c=t.nullBitmap?-1:0}=t;return new Kt(n,r,a,c,[void 0,o,i],[],s)}visitInterval(t){let{["type"]:n,["offset"]:r=0}=t,i=wt(t.nullBitmap),o=kt(n.ArrayType,t.data),{["length"]:s=o.length/Mr(n),["nullCount"]:a=t.nullBitmap?-1:0}=t;return new Kt(n,r,s,a,[void 0,o,i])}visitDuration(t){let{["type"]:n,["offset"]:r=0}=t,i=wt(t.nullBitmap),o=kt(n.ArrayType,t.data),{["length"]:s=o.length,["nullCount"]:a=t.nullBitmap?-1:0}=t;return new Kt(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=wt(t.nullBitmap),{["length"]:s=i.length/Mr(n),["nullCount"]:a=t.nullBitmap?-1:0}=t;return new Kt(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=wt(t.nullBitmap),s=ec(t.valueOffsets),{["length"]:a=s.length-1,["nullCount"]:c=t.nullBitmap?-1:0}=t;return new Kt(n,r,a,c,[s,void 0,o],[i])}},xC=new w_;function At(e){return xC.visit(e)}var Ih=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 fA(e){return e.some(t=>t.nullable)}function Vy(e){return e.reduce((t,n)=>t+n.nullCount,0)}function jy(e){return e.reduce((t,n,r)=>(t[r+1]=t[r]+n.length,t),new Uint32Array(e.length+1))}function Yy(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 __(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 Ah(e,t){return e.getValid(t)}function $l(e){function t(n,r,i){return e(n[r],i)}return function(n){let r=this.data;return __(r,this._offsets,n,t)}}function Wy(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=__(o,this._offsets,r,n);return t=void 0,s}}function Gy(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):__(o,this._offsets,i,n);return t=void 0,s}}var mt=class extends dt{};function wC(e,t){return t===null&&e.length>0?0:-1}function _C(e,t){let{nullBitmap:n}=e;if(!n||e.nullCount<=0)return-1;let r=0;for(let i of new rc(n,e.offset+(t||0),e.length,n,qy)){if(!i)return r;++r}return-1}function Tt(e,t,n){if(t===void 0)return-1;if(t===null)switch(e.typeId){case B.Union:break;case B.Dictionary:break;default:return _C(e,n)}let r=Ve.getVisitFn(e),i=oa(t);for(let o=(n||0)-1,s=e.length;++o<s;)if(i(r(e,o)))return o;return-1}function hA(e,t,n){let r=Ve.getVisitFn(e),i=oa(t);for(let o=(n||0)-1,s=e.length;++o<s;)if(i(r(e,o)))return o;return-1}mt.prototype.visitNull=wC;mt.prototype.visitBool=Tt;mt.prototype.visitInt=Tt;mt.prototype.visitInt8=Tt;mt.prototype.visitInt16=Tt;mt.prototype.visitInt32=Tt;mt.prototype.visitInt64=Tt;mt.prototype.visitUint8=Tt;mt.prototype.visitUint16=Tt;mt.prototype.visitUint32=Tt;mt.prototype.visitUint64=Tt;mt.prototype.visitFloat=Tt;mt.prototype.visitFloat16=Tt;mt.prototype.visitFloat32=Tt;mt.prototype.visitFloat64=Tt;mt.prototype.visitUtf8=Tt;mt.prototype.visitLargeUtf8=Tt;mt.prototype.visitBinary=Tt;mt.prototype.visitLargeBinary=Tt;mt.prototype.visitFixedSizeBinary=Tt;mt.prototype.visitDate=Tt;mt.prototype.visitDateDay=Tt;mt.prototype.visitDateMillisecond=Tt;mt.prototype.visitTimestamp=Tt;mt.prototype.visitTimestampSecond=Tt;mt.prototype.visitTimestampMillisecond=Tt;mt.prototype.visitTimestampMicrosecond=Tt;mt.prototype.visitTimestampNanosecond=Tt;mt.prototype.visitTime=Tt;mt.prototype.visitTimeSecond=Tt;mt.prototype.visitTimeMillisecond=Tt;mt.prototype.visitTimeMicrosecond=Tt;mt.prototype.visitTimeNanosecond=Tt;mt.prototype.visitDecimal=Tt;mt.prototype.visitList=Tt;mt.prototype.visitStruct=Tt;mt.prototype.visitUnion=Tt;mt.prototype.visitDenseUnion=hA;mt.prototype.visitSparseUnion=hA;mt.prototype.visitDictionary=Tt;mt.prototype.visitInterval=Tt;mt.prototype.visitIntervalDayTime=Tt;mt.prototype.visitIntervalYearMonth=Tt;mt.prototype.visitDuration=Tt;mt.prototype.visitDurationSecond=Tt;mt.prototype.visitDurationMillisecond=Tt;mt.prototype.visitDurationMicrosecond=Tt;mt.prototype.visitDurationNanosecond=Tt;mt.prototype.visitFixedSizeList=Tt;mt.prototype.visitMap=Tt;var sc=new mt;var yt=class extends dt{};function St(e){let{type:t}=e;if(e.nullCount===0&&e.stride===1&&(t.typeId===B.Timestamp||t instanceof Be&&t.bitWidth!==64||t instanceof zr&&t.bitWidth!==64||t instanceof Yn&&t.precision!==fe.HALF))return new Ih(e.data.length,r=>{let i=e.data[r];return i.values.subarray(0,i.length)[Symbol.iterator]()});let n=0;return new Ih(e.data.length,r=>{let o=e.data[r].length,s=e.slice(n,n+o);return n+=o,new v_(s)})}var v_=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}};yt.prototype.visitNull=St;yt.prototype.visitBool=St;yt.prototype.visitInt=St;yt.prototype.visitInt8=St;yt.prototype.visitInt16=St;yt.prototype.visitInt32=St;yt.prototype.visitInt64=St;yt.prototype.visitUint8=St;yt.prototype.visitUint16=St;yt.prototype.visitUint32=St;yt.prototype.visitUint64=St;yt.prototype.visitFloat=St;yt.prototype.visitFloat16=St;yt.prototype.visitFloat32=St;yt.prototype.visitFloat64=St;yt.prototype.visitUtf8=St;yt.prototype.visitLargeUtf8=St;yt.prototype.visitBinary=St;yt.prototype.visitLargeBinary=St;yt.prototype.visitFixedSizeBinary=St;yt.prototype.visitDate=St;yt.prototype.visitDateDay=St;yt.prototype.visitDateMillisecond=St;yt.prototype.visitTimestamp=St;yt.prototype.visitTimestampSecond=St;yt.prototype.visitTimestampMillisecond=St;yt.prototype.visitTimestampMicrosecond=St;yt.prototype.visitTimestampNanosecond=St;yt.prototype.visitTime=St;yt.prototype.visitTimeSecond=St;yt.prototype.visitTimeMillisecond=St;yt.prototype.visitTimeMicrosecond=St;yt.prototype.visitTimeNanosecond=St;yt.prototype.visitDecimal=St;yt.prototype.visitList=St;yt.prototype.visitStruct=St;yt.prototype.visitUnion=St;yt.prototype.visitDenseUnion=St;yt.prototype.visitSparseUnion=St;yt.prototype.visitDictionary=St;yt.prototype.visitInterval=St;yt.prototype.visitIntervalDayTime=St;yt.prototype.visitIntervalYearMonth=St;yt.prototype.visitDuration=St;yt.prototype.visitDurationSecond=St;yt.prototype.visitDurationMillisecond=St;yt.prototype.visitDurationMicrosecond=St;yt.prototype.visitDurationNanosecond=St;yt.prototype.visitFixedSizeList=St;yt.prototype.visitMap=St;var Ul=new yt;var dA,pA={},mA={},qt=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 Kt)))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}=pA[s.typeId],u=o[0];this.isValid=f=>Ah(u,f),this.get=f=>a(u,f),this.set=(f,h)=>c(u,f,h),this.indexOf=f=>l(u,f),this._offsets=[0,u.length];break}default:Object.setPrototypeOf(this,mA[s.typeId]),this._offsets=jy(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 nullable(){return fA(this.data)}get nullCount(){return Vy(this.data)}get ArrayType(){return this.type.ArrayType}get[Symbol.toStringTag](){return`${this.VectorName}<${this.type[Symbol.toStringTag]}>`}get VectorName(){return`${B[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}[Symbol.iterator](){return Ul.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(Sh(this,t,n,({data:r,_offsets:i},o,s)=>Yy(r,i,o,s)))}toJSON(){return[...this]}toArray(){let{type:t,data:n,length:r,stride:i,ArrayType:o}=this;switch(t.typeId){case B.Int:case B.Float:case B.Decimal:case B.Time:case B.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 X.isDictionary(this.type)?this.data[0].dictionary.isMemoized:!1}memoize(){if(X.isDictionary(this.type)){let t=new Xy(this.data[0].dictionary),n=this.data.map(r=>{let i=r.clone();return i.dictionary=t,i});return new e(n)}return new Xy(this)}unmemoize(){if(X.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}};dA=Symbol.toStringTag;qt[dA]=(e=>{e.type=X.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(B).map(n=>B[n]).filter(n=>typeof n=="number"&&n!==B.NONE);for(let n of t){let r=Ve.getVisitFnByTypeId(n),i=wn.getVisitFnByTypeId(n),o=sc.getVisitFnByTypeId(n);pA[n]={get:r,set:i,indexOf:o},mA[n]=Object.create(e,{isValid:{value:$l(Ah)},get:{value:$l(Ve.getVisitFnByTypeId(n))},set:{value:Wy(wn.getVisitFnByTypeId(n))},indexOf:{value:Gy(sc.getVisitFnByTypeId(n))}})}return"Vector"})(qt.prototype);var Xy=class e extends qt{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 qt(this.data)}),Object.defineProperty(this,"memoize",{value:()=>this})}};function yA(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 ${XC(r)}:`).join("")}
3
+ case ${vC(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 XC(e){return typeof e!="bigint"?yi(e):`${yi(e)}n`}function c_(e,t){let n=Math.ceil(e)*t-1;return(n-n%64+64||64)/t}function HA(e,t=0){return e.length>=t?e.subarray(0,t):Xf(new e.constructor(t),e,0)}var wi=class{constructor(t,n=0,r=1){this.length=Math.ceil(n/r),this.buffer=new t(this.length),this.stride=r,this.BYTES_PER_ELEMENT=t.BYTES_PER_ELEMENT,this.ArrayType=t}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?c_(r*1,this.BYTES_PER_ELEMENT):c_(r*2,this.BYTES_PER_ELEMENT))}return this}flush(t=this.length){t=c_(t*this.stride,this.BYTES_PER_ELEMENT);let n=HA(this.buffer,t);return this.clear(),n}clear(){return this.length=0,this.buffer=new this.ArrayType,this}_resize(t){return this.buffer=HA(this.buffer,t)}},Yo=class extends wi{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}},kl=class extends Yo{constructor(){super(Uint8Array,0,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()}},Rl=class extends Yo{constructor(t){super(t.OffsetArrayType,1,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++&&r>=0&&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,this.BYTES_PER_ELEMENT>4?BigInt(0):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=Sr(t),this._nulls=new kl,n&&n.length>0&&(this._isValid=XA(n))}toVector(){return new qt([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 h=this.children.map(d=>d.flush());return this.clear(),At({type:o,length:s,nullCount:a,children:h,child:h[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 Yo(this.ArrayType,0,this.stride)}setValue(t,n){let r=this._values;return r.reserve(t-r.length+1),super.setValue(t,n)}},lr=class extends be{constructor(t){super(t),this._pendingLength=0,this._offsets=new Rl(t.type)}setValue(t,n){let r=this._pending||(this._pending=new Map),i=r.get(t);i&&(this._pendingLength-=i.length),this._pendingLength+=n instanceof to?n[Yr].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 nc=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 Ir=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):oe.V1}schema(t){let n=this.bb.__offset(this.bb_pos,6);return n?(t||new ar).__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 nc).__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 nc).__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 Je).__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,oe.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 ne=class e{constructor(t=[],n,r,i=oe.V5){this.fields=t||[],this.metadata=n||new Map,r||(r=l_(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=zy(zy(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:zy(zy(new Map,r[c].metadata),a.metadata)}))&&!1:!0}),s=l_(o,new Map);return new e([...r,...o],i,new Map([...this.dictionaries,...s]))}};ne.prototype.fields=null;ne.prototype.metadata=null;ne.prototype.dictionaries=null;var Rt=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)}};Rt.prototype.type=null;Rt.prototype.name=null;Rt.prototype.nullable=null;Rt.prototype.metadata=null;function zy(e,t){return new Map([...e||new Map,...t||new Map])}function l_(e,t=new Map){for(let n=-1,r=e.length;++n<r;){let o=e[n].type;if(X.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&&l_(o.children,t)}return t}var HC=Ka,ZC=_r,Wo=class{static decode(t){t=new ZC(wt(t));let n=Ir.getRootAsFooter(t),r=ne.decode(n.schema(),new Map,n.version());return new u_(r,n)}static encode(t){let n=new HC,r=ne.encode(n,t.schema);Ir.startRecordBatchesVector(n,t.numRecordBatches);for(let s of[...t.recordBatches()].slice().reverse())Go.encode(n,s);let i=n.endVector();Ir.startDictionariesVector(n,t.numDictionaries);for(let s of[...t.dictionaryBatches()].slice().reverse())Go.encode(n,s);let o=n.endVector();return Ir.startFooter(n),Ir.addSchema(n,r),Ir.addVersion(n,oe.V5),Ir.addRecordBatches(n,i),Ir.addDictionaries(n,o),Ir.finishFooterBuffer(n,Ir.endFooter(n)),n.asUint8Array()}get numRecordBatches(){return this._recordBatches.length}get numDictionaries(){return this._dictionaryBatches.length}constructor(t,n=oe.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 u_=class extends Wo{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 Go.decode(n)}return null}getDictionaryBatch(t){if(t>=0&&t<this.numDictionaries){let n=this._footer.dictionaries(t);if(n)return Go.decode(n)}return null}},Go=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 nc.createBlock(t,i,r,o)}constructor(t,n,r){this.metaDataLength=t,this.offset=Ae(r),this.bodyLength=Ae(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||[]}},rc=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())}},qy=class extends rc{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 bn.toDOMStream(this._closedPromiseResolve||this._error?this:this._values,t)}toNodeStream(t){return bn.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 eo=class extends qy{write(t){if((t=wt(t)).byteLength>0)return super.write(t)}toString(t=!1){return t?Wf(this.toUint8Array(!0)):this.toUint8Array(!1).then(Wf)}toUint8Array(t=!1){return t?wr(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=li(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 wr(s,a)[0]})}},no=class{constructor(t){t&&(this.source=new f_(bn.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)}},Wr=class e{constructor(t){t instanceof e?this.source=t.source:t instanceof eo?this.source=new Xo(bn.fromAsyncIterable(t)):ay(t)?this.source=new Xo(bn.fromNodeStream(t)):Gf(t)?this.source=new Xo(bn.fromDOMStream(t)):oy(t)?this.source=new Xo(bn.fromDOMStream(t.body)):ui(t)?this.source=new Xo(bn.fromIterable(t)):xr(t)?this.source=new Xo(bn.fromAsyncIterable(t)):$r(t)&&(this.source=new Xo(bn.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)}},f_=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)}},Xo=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 Mh=class extends no{constructor(t,n){super(),this.position=0,this.buffer=wt(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}}},na=class extends Wr{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 d_={};Vs(d_,{BaseInt64:()=>Ah,Int128:()=>Th,Int64:()=>Ho,Uint64:()=>Te});function $l(e){return e<0&&(e=4294967295+e+1),`0x${e.toString(16)}`}var Ul=8,h_=[1,10,100,1e3,1e4,1e5,1e6,1e7,1e8],Ah=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`${$l(this.buffer[1])} ${$l(this.buffer[0])}`}},Te=class e extends Ah{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=Ul<r-o?Ul:r-o,a=new e(new Uint32Array([Number.parseInt(t.slice(o,o+s),10),0])),c=new e(new Uint32Array([h_[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)}},Ho=class e extends Ah{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=Ul<i-s?Ul:i-s,c=new e(new Uint32Array([Number.parseInt(t.slice(s,s+a),10),0])),l=new e(new Uint32Array([h_[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)}},Th=class e{constructor(t){this.buffer=t}high(){return new Ho(new Uint32Array(this.buffer.buffer,this.buffer.byteOffset+8,2))}low(){return new Ho(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 Te(new Uint32Array([this.buffer[3],0])),r=new Te(new Uint32Array([this.buffer[2],0])),i=new Te(new Uint32Array([this.buffer[1],0])),o=new Te(new Uint32Array([this.buffer[0],0])),s=new Te(new Uint32Array([t.buffer[3],0])),a=new Te(new Uint32Array([t.buffer[2],0])),c=new Te(new Uint32Array([t.buffer[1],0])),l=new Te(new Uint32Array([t.buffer[0],0])),u=Te.multiply(o,l);this.buffer[0]=u.low();let f=new Te(new Uint32Array([u.high(),0]));return u=Te.multiply(i,l),f.plus(u),u=Te.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 Te(new Uint32Array(this.buffer.buffer,this.buffer.byteOffset+8,2)).plus(Te.multiply(r,l)).plus(Te.multiply(i,c)).plus(Te.multiply(o,a)),this.buffer[3]+=Te.multiply(n,l).plus(Te.multiply(r,c)).plus(Te.multiply(i,a)).plus(Te.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`${$l(this.buffer[3])} ${$l(this.buffer[2])} ${$l(this.buffer[1])} ${$l(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=Ul<i-s?Ul:i-s,c=new e(new Uint32Array([Number.parseInt(t.slice(s,s+a),10),0,0,0])),l=new e(new Uint32Array([h_[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 Eh=class extends dt{constructor(t,n,r,i,o=oe.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 Rt?t.type:t)}visitNull(t,{length:n}=this.nextFieldNode()){return At({type:t,length:n})}visitBool(t,{length:n,nullCount:r}=this.nextFieldNode()){return At({type:t,length:n,nullCount:r,nullBitmap:this.readNullBitmap(t,r),data:this.readData(t)})}visitInt(t,{length:n,nullCount:r}=this.nextFieldNode()){return At({type:t,length:n,nullCount:r,nullBitmap:this.readNullBitmap(t,r),data:this.readData(t)})}visitFloat(t,{length:n,nullCount:r}=this.nextFieldNode()){return At({type:t,length:n,nullCount:r,nullBitmap:this.readNullBitmap(t,r),data:this.readData(t)})}visitUtf8(t,{length:n,nullCount:r}=this.nextFieldNode()){return At({type:t,length:n,nullCount:r,nullBitmap:this.readNullBitmap(t,r),valueOffsets:this.readOffsets(t),data:this.readData(t)})}visitLargeUtf8(t,{length:n,nullCount:r}=this.nextFieldNode()){return At({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 At({type:t,length:n,nullCount:r,nullBitmap:this.readNullBitmap(t,r),valueOffsets:this.readOffsets(t),data:this.readData(t)})}visitLargeBinary(t,{length:n,nullCount:r}=this.nextFieldNode()){return At({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 At({type:t,length:n,nullCount:r,nullBitmap:this.readNullBitmap(t,r),data:this.readData(t)})}visitDate(t,{length:n,nullCount:r}=this.nextFieldNode()){return At({type:t,length:n,nullCount:r,nullBitmap:this.readNullBitmap(t,r),data:this.readData(t)})}visitTimestamp(t,{length:n,nullCount:r}=this.nextFieldNode()){return At({type:t,length:n,nullCount:r,nullBitmap:this.readNullBitmap(t,r),data:this.readData(t)})}visitTime(t,{length:n,nullCount:r}=this.nextFieldNode()){return At({type:t,length:n,nullCount:r,nullBitmap:this.readNullBitmap(t,r),data:this.readData(t)})}visitDecimal(t,{length:n,nullCount:r}=this.nextFieldNode()){return At({type:t,length:n,nullCount:r,nullBitmap:this.readNullBitmap(t,r),data:this.readData(t)})}visitList(t,{length:n,nullCount:r}=this.nextFieldNode()){return At({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 At({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<oe.V5&&this.readNullBitmap(t,r),t.mode===pe.Sparse?this.visitSparseUnion(t,{length:n,nullCount:r}):this.visitDenseUnion(t,{length:n,nullCount:r})}visitDenseUnion(t,{length:n,nullCount:r}=this.nextFieldNode()){return At({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 At({type:t,length:n,nullCount:r,typeIds:this.readTypeIds(t),children:this.visitMany(t.children)})}visitDictionary(t,{length:n,nullCount:r}=this.nextFieldNode()){return At({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 At({type:t,length:n,nullCount:r,nullBitmap:this.readNullBitmap(t,r),data:this.readData(t)})}visitDuration(t,{length:n,nullCount:r}=this.nextFieldNode()){return At({type:t,length:n,nullCount:r,nullBitmap:this.readNullBitmap(t,r),data:this.readData(t)})}visitFixedSizeList(t,{length:n,nullCount:r}=this.nextFieldNode()){return At({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 At({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)}},Vy=class extends Eh{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):tc(this.sources[r])}readOffsets(t,{offset:n}=this.nextBufferRange()){return kt(Uint8Array,kt(t.OffsetArrayType,this.sources[n]))}readTypeIds(t,{offset:n}=this.nextBufferRange()){return kt(Uint8Array,kt(t.ArrayType,this.sources[n]))}readData(t,{offset:n}=this.nextBufferRange()){let{sources:r}=this;return X.isTimestamp(t)?kt(Uint8Array,Ho.convertArray(r[n])):(X.isInt(t)||X.isTime(t))&&t.bitWidth===64||X.isDuration(t)?kt(Uint8Array,Ho.convertArray(r[n])):X.isDate(t)&&t.unit===ze.MILLISECOND?kt(Uint8Array,Ho.convertArray(r[n])):X.isDecimal(t)?kt(Uint8Array,Th.convertArray(r[n])):X.isBinary(t)||X.isLargeBinary(t)||X.isFixedSizeBinary(t)?KC(r[n]):X.isBool(t)?tc(r[n]):X.isUtf8(t)||X.isLargeUtf8(t)?$i(r[n].join("")):kt(Uint8Array,kt(t.ArrayType,r[n].map(i=>+i)))}};function KC(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 Pl=class extends lr{constructor(t){super(t),this._values=new wi(Uint8Array)}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,wt(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 zl=class extends lr{constructor(t){super(t),this._values=new wi(Uint8Array)}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,wt(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,BigInt(0));else{let c=a.length;i.set(a,o),r.set(s,BigInt(c)),o+=c}}};var jy=class extends be{constructor(t){super(t),this._values=new kl}setValue(t,n){this._values.set(t,+n)}};var ic=class extends Ve{};ic.prototype._setValue=Ww;var Dh=class extends ic{};Dh.prototype._setValue=yy;var Nh=class extends ic{};Nh.prototype._setValue=gy;var Bh=class extends Ve{};Bh.prototype._setValue=Hw;var Yy=class extends be{constructor({type:t,nullValues:n,dictionaryHashFunction:r}){super({type:new cr(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 Oh=class extends Ve{};Oh.prototype._setValue=Yw;var Wy=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 Vr(this.type.listSize,new Rt(n,t.type,!0)),r}};var sc=class extends Ve{setValue(t,n){this._values.set(t,n)}},Gy=class extends sc{setValue(t,n){super.setValue(t,xh(n))}},Xy=class extends sc{},Hy=class extends sc{};var ac=class extends Ve{};ac.prototype._setValue=Zw;var Lh=class extends ac{};Lh.prototype._setValue=Ay;var Fh=class extends ac{};Fh.prototype._setValue=Ty;var Zo=class extends Ve{};Zo.prototype._setValue=Kw;var Ch=class extends Zo{};Ch.prototype._setValue=Ey;var kh=class extends Zo{};kh.prototype._setValue=Dy;var Rh=class extends Zo{};Rh.prototype._setValue=Ny;var $h=class extends Zo{};$h.prototype._setValue=By;var Gr=class extends Ve{setValue(t,n){this._values.set(t,n)}},Zy=class extends Gr{},Ky=class extends Gr{},Qy=class extends Gr{},Jy=class extends Gr{},t0=class extends Gr{},e0=class extends Gr{},n0=class extends Gr{},r0=class extends Gr{};var i0=class extends lr{constructor(t){super(t),this._offsets=new Rl(t.type)}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 zr(new Rt(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 o0=class extends lr{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 jr(new Rt(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 s0=class extends be{setValue(t,n){}setValid(t,n){return this.length=Math.max(t+1,this.length),n}};var a0=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 Rt(n,t.type,!0)]),r}};var Ko=class extends Ve{};Ko.prototype._setValue=Gw;var Uh=class extends Ko{};Uh.prototype._setValue=by;var Ph=class extends Ko{};Ph.prototype._setValue=xy;var zh=class extends Ko{};zh.prototype._setValue=wy;var qh=class extends Ko{};qh.prototype._setValue=_y;var Qo=class extends Ve{};Qo.prototype._setValue=Xw;var Vh=class extends Qo{};Vh.prototype._setValue=vy;var jh=class extends Qo{};jh.prototype._setValue=Sy;var Yh=class extends Qo{};Yh.prototype._setValue=Iy;var Wh=class extends Qo{};Wh.prototype._setValue=My;var ql=class extends be{constructor(t){super(t),this._typeIds=new Yo(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 Rt(n,t.type)];return this.type=new qr(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.")}},c0=class extends ql{},l0=class extends ql{constructor(t){super(t),this._offsets=new Yo(Int32Array)}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 Gh=class extends lr{constructor(t){super(t),this._values=new wi(Uint8Array)}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,$i(n))}_flushPending(t,n){}};Gh.prototype._flushPending=Pl.prototype._flushPending;var Xh=class extends lr{constructor(t){super(t),this._values=new wi(Uint8Array)}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,$i(n))}_flushPending(t,n){}};Xh.prototype._flushPending=zl.prototype._flushPending;var p_=class extends dt{visitNull(){return s0}visitBool(){return jy}visitInt(){return Gr}visitInt8(){return Zy}visitInt16(){return Ky}visitInt32(){return Qy}visitInt64(){return Jy}visitUint8(){return t0}visitUint16(){return e0}visitUint32(){return n0}visitUint64(){return r0}visitFloat(){return sc}visitFloat16(){return Gy}visitFloat32(){return Xy}visitFloat64(){return Hy}visitUtf8(){return Gh}visitLargeUtf8(){return Xh}visitBinary(){return Pl}visitLargeBinary(){return zl}visitFixedSizeBinary(){return Oh}visitDate(){return ic}visitDateDay(){return Dh}visitDateMillisecond(){return Nh}visitTimestamp(){return Ko}visitTimestampSecond(){return Uh}visitTimestampMillisecond(){return Ph}visitTimestampMicrosecond(){return zh}visitTimestampNanosecond(){return qh}visitTime(){return Qo}visitTimeSecond(){return Vh}visitTimeMillisecond(){return jh}visitTimeMicrosecond(){return Yh}visitTimeNanosecond(){return Wh}visitDecimal(){return Bh}visitList(){return i0}visitStruct(){return a0}visitUnion(){return ql}visitDenseUnion(){return l0}visitSparseUnion(){return c0}visitDictionary(){return Yy}visitInterval(){return ac}visitIntervalDayTime(){return Lh}visitIntervalYearMonth(){return Fh}visitDuration(){return Zo}visitDurationSecond(){return Ch}visitDurationMillisecond(){return kh}visitDurationMicrosecond(){return Rh}visitDurationNanosecond(){return $h}visitFixedSizeList(){return Wy}visitMap(){return o0}},ZA=new p_;var gt=class extends dt{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 jn(e,t){return t instanceof e.constructor}function cc(e,t){return e===t||jn(e,t)}function Jo(e,t){return e===t||jn(e,t)&&e.bitWidth===t.bitWidth&&e.isSigned===t.isSigned}function u0(e,t){return e===t||jn(e,t)&&e.precision===t.precision}function QC(e,t){return e===t||jn(e,t)&&e.byteWidth===t.byteWidth}function m_(e,t){return e===t||jn(e,t)&&e.unit===t.unit}function Hh(e,t){return e===t||jn(e,t)&&e.unit===t.unit&&e.timezone===t.timezone}function Zh(e,t){return e===t||jn(e,t)&&e.unit===t.unit&&e.bitWidth===t.bitWidth}function JC(e,t){return e===t||jn(e,t)&&e.children.length===t.children.length&&ro.compareManyFields(e.children,t.children)}function tk(e,t){return e===t||jn(e,t)&&e.children.length===t.children.length&&ro.compareManyFields(e.children,t.children)}function y_(e,t){return e===t||jn(e,t)&&e.mode===t.mode&&e.typeIds.every((n,r)=>n===t.typeIds[r])&&ro.compareManyFields(e.children,t.children)}function ek(e,t){return e===t||jn(e,t)&&e.id===t.id&&e.isOrdered===t.isOrdered&&ro.visit(e.indices,t.indices)&&ro.visit(e.dictionary,t.dictionary)}function g_(e,t){return e===t||jn(e,t)&&e.unit===t.unit}function Kh(e,t){return e===t||jn(e,t)&&e.unit===t.unit}function nk(e,t){return e===t||jn(e,t)&&e.listSize===t.listSize&&e.children.length===t.children.length&&ro.compareManyFields(e.children,t.children)}function rk(e,t){return e===t||jn(e,t)&&e.keysSorted===t.keysSorted&&e.children.length===t.children.length&&ro.compareManyFields(e.children,t.children)}gt.prototype.visitNull=cc;gt.prototype.visitBool=cc;gt.prototype.visitInt=Jo;gt.prototype.visitInt8=Jo;gt.prototype.visitInt16=Jo;gt.prototype.visitInt32=Jo;gt.prototype.visitInt64=Jo;gt.prototype.visitUint8=Jo;gt.prototype.visitUint16=Jo;gt.prototype.visitUint32=Jo;gt.prototype.visitUint64=Jo;gt.prototype.visitFloat=u0;gt.prototype.visitFloat16=u0;gt.prototype.visitFloat32=u0;gt.prototype.visitFloat64=u0;gt.prototype.visitUtf8=cc;gt.prototype.visitLargeUtf8=cc;gt.prototype.visitBinary=cc;gt.prototype.visitLargeBinary=cc;gt.prototype.visitFixedSizeBinary=QC;gt.prototype.visitDate=m_;gt.prototype.visitDateDay=m_;gt.prototype.visitDateMillisecond=m_;gt.prototype.visitTimestamp=Hh;gt.prototype.visitTimestampSecond=Hh;gt.prototype.visitTimestampMillisecond=Hh;gt.prototype.visitTimestampMicrosecond=Hh;gt.prototype.visitTimestampNanosecond=Hh;gt.prototype.visitTime=Zh;gt.prototype.visitTimeSecond=Zh;gt.prototype.visitTimeMillisecond=Zh;gt.prototype.visitTimeMicrosecond=Zh;gt.prototype.visitTimeNanosecond=Zh;gt.prototype.visitDecimal=cc;gt.prototype.visitList=JC;gt.prototype.visitStruct=tk;gt.prototype.visitUnion=y_;gt.prototype.visitDenseUnion=y_;gt.prototype.visitSparseUnion=y_;gt.prototype.visitDictionary=ek;gt.prototype.visitInterval=g_;gt.prototype.visitIntervalDayTime=g_;gt.prototype.visitIntervalYearMonth=g_;gt.prototype.visitDuration=Kh;gt.prototype.visitDurationSecond=Kh;gt.prototype.visitDurationMillisecond=Kh;gt.prototype.visitDurationMicrosecond=Kh;gt.prototype.visitDurationNanosecond=Kh;gt.prototype.visitFixedSizeList=nk;gt.prototype.visitMap=rk;var ro=new gt;function lc(e,t){return ro.compareSchemas(e,t)}function KA(e,t){return ro.compareFields(e,t)}function QA(e,t){return ro.visit(e,t)}function oc(e){let t=e.type,n=new(ZA.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 f0(e,t){return ik(e,t.map(n=>n.data.concat()))}function ik(e,t){let n=[...e.fields],r=[],i={numBatches:t.reduce((f,h)=>Math.max(f,h.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=ok(n,s,u,t,i),s>0&&(r[o++]=At({type:new me(n),length:s,nullCount:0,children:u.slice()})))}return[e=e.assign(n),r.map(f=>new Oe(e,f))]}function ok(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:At({type:f.type,length:t,nullCount:t,nullBitmap:new Uint8Array(s)})}}return n}var JA,ur=class e{constructor(...t){var n,r;if(t.length===0)return this.batches=[],this.schema=new ne([]),this._offsets=[0],this;let i,o;t[0]instanceof ne&&(i=t.shift()),t.at(-1)instanceof Uint32Array&&(o=t.pop());let s=c=>{if(c){if(c instanceof Oe)return[c];if(c instanceof e)return c.batches;if(c instanceof Kt){if(c.type instanceof me)return[new Oe(new ne(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(d=>new qt([c[d]])),f=i??new ne(l.map((d,p)=>new Rt(String(d),u[p].type,u[p].nullable))),[,h]=f0(f,u);return h.length===0?[new Oe(c)]:h}}}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 ne([]),!(i instanceof ne))throw new TypeError("Table constructor expects a [Schema, RecordBatch[]] pair.");for(let c of a){if(!(c instanceof Oe))throw new TypeError("Table constructor expects a [Schema, RecordBatch[]] pair.");if(!lc(i,c.schema))throw new TypeError("Table and inner RecordBatch schemas must be equivalent.")}this.schema=i,this.batches=a,this._offsets=o??ky(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=Cy(this.data)),this._nullCount}isValid(t){return!1}get(t){return null}set(t,n){}indexOf(t,n){return-1}[Symbol.iterator](){return this.batches.length>0?Cl.visit(new qt(this.data)):new Array(0)[Symbol.iterator]()}toArray(){return[...this]}toString(){return`[
7
+ return true;`)}function vC(e){return typeof e!="bigint"?bi(e):`${bi(e)}n`}function S_(e,t){let n=Math.ceil(e)*t-1;return(n-n%64+64||64)/t}function gA(e,t=0){return e.length>=t?e.subarray(0,t):Qf(new e.constructor(t),e,0)}var vi=class{constructor(t,n=0,r=1){this.length=Math.ceil(n/r),this.buffer=new t(this.length),this.stride=r,this.BYTES_PER_ELEMENT=t.BYTES_PER_ELEMENT,this.ArrayType=t}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?S_(r*1,this.BYTES_PER_ELEMENT):S_(r*2,this.BYTES_PER_ELEMENT))}return this}flush(t=this.length){t=S_(t*this.stride,this.BYTES_PER_ELEMENT);let n=gA(this.buffer,t);return this.clear(),n}clear(){return this.length=0,this.buffer=new this.ArrayType,this}_resize(t){return this.buffer=gA(this.buffer,t)}},Xo=class extends vi{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}},Pl=class extends Xo{constructor(){super(Uint8Array,0,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()}},zl=class extends Xo{constructor(t){super(t.OffsetArrayType,1,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++&&r>=0&&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,this.BYTES_PER_ELEMENT>4?BigInt(0):0),super.flush(t+1)}};var xe=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 Pl,n&&n.length>0&&(this._isValid=yA(n))}toVector(){return new qt([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 h=this.children.map(d=>d.flush());return this.clear(),At({type:o,length:s,nullCount:a,children:h,child:h[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}};xe.prototype.length=1;xe.prototype.stride=1;xe.prototype.children=null;xe.prototype.finished=!1;xe.prototype.nullValues=null;xe.prototype._isValid=()=>!0;var je=class extends xe{constructor(t){super(t),this._values=new Xo(this.ArrayType,0,this.stride)}setValue(t,n){let r=this._values;return r.reserve(t-r.length+1),super.setValue(t,n)}},ur=class extends xe{constructor(t){super(t),this._pendingLength=0,this._offsets=new zl(t.type)}setValue(t,n){let r=this._pending||(this._pending=new Map),i=r.get(t);i&&(this._pendingLength-=i.length),this._pendingLength+=n instanceof ro?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 ac=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 Ir=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):se.V1}schema(t){let n=this.bb.__offset(this.bb_pos,6);return n?(t||new cr).__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 ac).__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 ac).__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 tn).__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,se.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=se.V5){this.fields=t||[],this.metadata=n||new Map,r||(r=M_(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=Hy(Hy(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:Hy(Hy(new Map,r[c].metadata),a.metadata)}))&&!1:!0}),s=M_(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 $t=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)}};$t.prototype.type=null;$t.prototype.name=null;$t.prototype.nullable=null;$t.prototype.metadata=null;function Hy(e,t){return new Map([...e||new Map,...t||new Map])}function M_(e,t=new Map){for(let n=-1,r=e.length;++n<r;){let o=e[n].type;if(X.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&&M_(o.children,t)}return t}var SC=nc,MC=vr,Ho=class{static decode(t){t=new MC(wt(t));let n=Ir.getRootAsFooter(t),r=re.decode(n.schema(),new Map,n.version());return new I_(r,n)}static encode(t){let n=new SC,r=re.encode(n,t.schema);Ir.startRecordBatchesVector(n,t.numRecordBatches);for(let s of[...t.recordBatches()].slice().reverse())Zo.encode(n,s);let i=n.endVector();Ir.startDictionariesVector(n,t.numDictionaries);for(let s of[...t.dictionaryBatches()].slice().reverse())Zo.encode(n,s);let o=n.endVector();return Ir.startFooter(n),Ir.addSchema(n,r),Ir.addVersion(n,se.V5),Ir.addRecordBatches(n,i),Ir.addDictionaries(n,o),Ir.finishFooterBuffer(n,Ir.endFooter(n)),n.asUint8Array()}get numRecordBatches(){return this._recordBatches.length}get numDictionaries(){return this._dictionaryBatches.length}constructor(t,n=se.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 I_=class extends Ho{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 Zo.decode(n)}return null}getDictionaryBatch(t){if(t>=0&&t<this.numDictionaries){let n=this._footer.dictionaries(t);if(n)return Zo.decode(n)}return null}},Zo=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 ac.createBlock(t,i,r,o)}constructor(t,n,r){this.metaDataLength=t,this.offset=Te(r),this.bodyLength=Te(n)}};var be=Object.freeze({done:!0,value:void 0}),Th=class{constructor(t){this._json=t}get schema(){return this._json.schema}get batches(){return this._json.batches||[]}get dictionaries(){return this._json.dictionaries||[]}},cc=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())}},Zy=class extends cc{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(be);this._closedPromiseResolve(),this._closedPromiseResolve=void 0}}[Symbol.asyncIterator](){return this}toDOMStream(t){return xn.toDOMStream(this._closedPromiseResolve||this._error?this:this._values,t)}toNodeStream(t){return xn.toNodeStream(this._closedPromiseResolve||this._error?this:this._values,t)}throw(t){return Z(this,void 0,void 0,function*(){return yield this.abort(t),be})}return(t){return Z(this,void 0,void 0,function*(){return yield this.close(),be})}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(be)}_ensureOpen(){if(this._closedPromiseResolve)return!0;throw new Error("AsyncQueue is closed")}};var io=class extends Zy{write(t){if((t=wt(t)).byteLength>0)return super.write(t)}toString(t=!1){return t?Hf(this.toUint8Array(!0)):this.toUint8Array(!1).then(Hf)}toUint8Array(t=!1){return t?_r(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=fi(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 _r(s,a)[0]})}},oo=class{constructor(t){t&&(this.source=new A_(xn.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)}},Gr=class e{constructor(t){t instanceof e?this.source=t.source:t instanceof io?this.source=new Qo(xn.fromAsyncIterable(t)):my(t)?this.source=new Qo(xn.fromNodeStream(t)):Zf(t)?this.source=new Qo(xn.fromDOMStream(t)):dy(t)?this.source=new Qo(xn.fromDOMStream(t.body)):hi(t)?this.source=new Qo(xn.fromIterable(t)):wr(t)?this.source=new Qo(xn.fromAsyncIterable(t)):Ur(t)&&(this.source=new Qo(xn.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)}},A_=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)||be)}return(t){return Object.create(this.source.return&&this.source.return(t)||be)}},Qo=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))||be;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))||be;return this._closedPromiseResolve&&this._closedPromiseResolve(),this._closedPromiseResolve=void 0,Object.create(n)})}};var Eh=class extends oo{constructor(t,n){super(),this.position=0,this.buffer=wt(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 Gr{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 E_={};Gs(E_,{BaseInt64:()=>Dh,Int128:()=>Nh,Int64:()=>Ko,Uint64:()=>Ee});function ql(e){return e<0&&(e=4294967295+e+1),`0x${e.toString(16)}`}var Vl=8,T_=[1,10,100,1e3,1e4,1e5,1e6,1e7,1e8],Dh=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`${ql(this.buffer[1])} ${ql(this.buffer[0])}`}},Ee=class e extends Dh{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=Vl<r-o?Vl:r-o,a=new e(new Uint32Array([Number.parseInt(t.slice(o,o+s),10),0])),c=new e(new Uint32Array([T_[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)}},Ko=class e extends Dh{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=Vl<i-s?Vl:i-s,c=new e(new Uint32Array([Number.parseInt(t.slice(s,s+a),10),0])),l=new e(new Uint32Array([T_[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)}},Nh=class e{constructor(t){this.buffer=t}high(){return new Ko(new Uint32Array(this.buffer.buffer,this.buffer.byteOffset+8,2))}low(){return new Ko(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 Ee(new Uint32Array([this.buffer[3],0])),r=new Ee(new Uint32Array([this.buffer[2],0])),i=new Ee(new Uint32Array([this.buffer[1],0])),o=new Ee(new Uint32Array([this.buffer[0],0])),s=new Ee(new Uint32Array([t.buffer[3],0])),a=new Ee(new Uint32Array([t.buffer[2],0])),c=new Ee(new Uint32Array([t.buffer[1],0])),l=new Ee(new Uint32Array([t.buffer[0],0])),u=Ee.multiply(o,l);this.buffer[0]=u.low();let f=new Ee(new Uint32Array([u.high(),0]));return u=Ee.multiply(i,l),f.plus(u),u=Ee.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 Ee(new Uint32Array(this.buffer.buffer,this.buffer.byteOffset+8,2)).plus(Ee.multiply(r,l)).plus(Ee.multiply(i,c)).plus(Ee.multiply(o,a)),this.buffer[3]+=Ee.multiply(n,l).plus(Ee.multiply(r,c)).plus(Ee.multiply(i,a)).plus(Ee.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`${ql(this.buffer[3])} ${ql(this.buffer[2])} ${ql(this.buffer[1])} ${ql(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=Vl<i-s?Vl:i-s,c=new e(new Uint32Array([Number.parseInt(t.slice(s,s+a),10),0,0,0])),l=new e(new Uint32Array([T_[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 Oh=class extends dt{constructor(t,n,r,i,o=se.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 $t?t.type:t)}visitNull(t,{length:n}=this.nextFieldNode()){return At({type:t,length:n})}visitBool(t,{length:n,nullCount:r}=this.nextFieldNode()){return At({type:t,length:n,nullCount:r,nullBitmap:this.readNullBitmap(t,r),data:this.readData(t)})}visitInt(t,{length:n,nullCount:r}=this.nextFieldNode()){return At({type:t,length:n,nullCount:r,nullBitmap:this.readNullBitmap(t,r),data:this.readData(t)})}visitFloat(t,{length:n,nullCount:r}=this.nextFieldNode()){return At({type:t,length:n,nullCount:r,nullBitmap:this.readNullBitmap(t,r),data:this.readData(t)})}visitUtf8(t,{length:n,nullCount:r}=this.nextFieldNode()){return At({type:t,length:n,nullCount:r,nullBitmap:this.readNullBitmap(t,r),valueOffsets:this.readOffsets(t),data:this.readData(t)})}visitLargeUtf8(t,{length:n,nullCount:r}=this.nextFieldNode()){return At({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 At({type:t,length:n,nullCount:r,nullBitmap:this.readNullBitmap(t,r),valueOffsets:this.readOffsets(t),data:this.readData(t)})}visitLargeBinary(t,{length:n,nullCount:r}=this.nextFieldNode()){return At({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 At({type:t,length:n,nullCount:r,nullBitmap:this.readNullBitmap(t,r),data:this.readData(t)})}visitDate(t,{length:n,nullCount:r}=this.nextFieldNode()){return At({type:t,length:n,nullCount:r,nullBitmap:this.readNullBitmap(t,r),data:this.readData(t)})}visitTimestamp(t,{length:n,nullCount:r}=this.nextFieldNode()){return At({type:t,length:n,nullCount:r,nullBitmap:this.readNullBitmap(t,r),data:this.readData(t)})}visitTime(t,{length:n,nullCount:r}=this.nextFieldNode()){return At({type:t,length:n,nullCount:r,nullBitmap:this.readNullBitmap(t,r),data:this.readData(t)})}visitDecimal(t,{length:n,nullCount:r}=this.nextFieldNode()){return At({type:t,length:n,nullCount:r,nullBitmap:this.readNullBitmap(t,r),data:this.readData(t)})}visitList(t,{length:n,nullCount:r}=this.nextFieldNode()){return At({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 At({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<se.V5&&this.readNullBitmap(t,r),t.mode===me.Sparse?this.visitSparseUnion(t,{length:n,nullCount:r}):this.visitDenseUnion(t,{length:n,nullCount:r})}visitDenseUnion(t,{length:n,nullCount:r}=this.nextFieldNode()){return At({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 At({type:t,length:n,nullCount:r,typeIds:this.readTypeIds(t),children:this.visitMany(t.children)})}visitDictionary(t,{length:n,nullCount:r}=this.nextFieldNode()){return At({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 At({type:t,length:n,nullCount:r,nullBitmap:this.readNullBitmap(t,r),data:this.readData(t)})}visitDuration(t,{length:n,nullCount:r}=this.nextFieldNode()){return At({type:t,length:n,nullCount:r,nullBitmap:this.readNullBitmap(t,r),data:this.readData(t)})}visitFixedSizeList(t,{length:n,nullCount:r}=this.nextFieldNode()){return At({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 At({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)}},Qy=class extends Oh{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):oc(this.sources[r])}readOffsets(t,{offset:n}=this.nextBufferRange()){return kt(Uint8Array,kt(t.OffsetArrayType,this.sources[n]))}readTypeIds(t,{offset:n}=this.nextBufferRange()){return kt(Uint8Array,kt(t.ArrayType,this.sources[n]))}readData(t,{offset:n}=this.nextBufferRange()){let{sources:r}=this;return X.isTimestamp(t)?kt(Uint8Array,Ko.convertArray(r[n])):(X.isInt(t)||X.isTime(t))&&t.bitWidth===64||X.isDuration(t)?kt(Uint8Array,Ko.convertArray(r[n])):X.isDate(t)&&t.unit===qe.MILLISECOND?kt(Uint8Array,Ko.convertArray(r[n])):X.isDecimal(t)?kt(Uint8Array,Nh.convertArray(r[n])):X.isBinary(t)||X.isLargeBinary(t)||X.isFixedSizeBinary(t)?IC(r[n]):X.isBool(t)?oc(r[n]):X.isUtf8(t)||X.isLargeUtf8(t)?zi(r[n].join("")):kt(Uint8Array,kt(t.ArrayType,r[n].map(i=>+i)))}};function IC(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 jl=class extends ur{constructor(t){super(t),this._values=new vi(Uint8Array)}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,wt(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 Yl=class extends ur{constructor(t){super(t),this._values=new vi(Uint8Array)}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,wt(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,BigInt(0));else{let c=a.length;i.set(a,o),r.set(s,BigInt(c)),o+=c}}};var Ky=class extends xe{constructor(t){super(t),this._values=new Pl}setValue(t,n){this._values.set(t,+n)}};var lc=class extends je{};lc.prototype._setValue=a_;var Bh=class extends lc{};Bh.prototype._setValue=My;var Lh=class extends lc{};Lh.prototype._setValue=Iy;var Fh=class extends je{};Fh.prototype._setValue=u_;var Jy=class extends xe{constructor({type:t,nullValues:n,dictionaryHashFunction:r}){super({type:new lr(t.dictionary,t.indices,t.id,t.isOrdered)}),this._nulls=null,this._dictionaryOffset=0,this._keysToIndices=Object.create(null),this.indices=uc({type:this.type.indices,nullValues:n}),this.dictionary=uc({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 Ch=class extends je{};Ch.prototype._setValue=s_;var t0=class extends xe{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 jr(this.type.listSize,new $t(n,t.type,!0)),r}};var fc=class extends je{setValue(t,n){this._values.set(t,n)}},e0=class extends fc{setValue(t,n){super.setValue(t,vh(n))}},n0=class extends fc{},r0=class extends fc{};var hc=class extends je{};hc.prototype._setValue=f_;var Rh=class extends hc{};Rh.prototype._setValue=Fy;var kh=class extends hc{};kh.prototype._setValue=Cy;var Jo=class extends je{};Jo.prototype._setValue=h_;var $h=class extends Jo{};$h.prototype._setValue=Ry;var Uh=class extends Jo{};Uh.prototype._setValue=ky;var Ph=class extends Jo{};Ph.prototype._setValue=$y;var zh=class extends Jo{};zh.prototype._setValue=Uy;var Xr=class extends je{setValue(t,n){this._values.set(t,n)}},i0=class extends Xr{},o0=class extends Xr{},s0=class extends Xr{},a0=class extends Xr{},c0=class extends Xr{},l0=class extends Xr{},u0=class extends Xr{},f0=class extends Xr{};var h0=class extends ur{constructor(t){super(t),this._offsets=new zl(t.type)}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 qr(new $t(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 d0=class extends ur{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 Yr(new $t(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 p0=class extends xe{setValue(t,n){}setValid(t,n){return this.length=Math.max(t+1,this.length),n}};var m0=class extends xe{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 ye([...this.type.children,new $t(n,t.type,!0)]),r}};var ts=class extends je{};ts.prototype._setValue=c_;var qh=class extends ts{};qh.prototype._setValue=Ay;var Vh=class extends ts{};Vh.prototype._setValue=Ty;var jh=class extends ts{};jh.prototype._setValue=Ey;var Yh=class extends ts{};Yh.prototype._setValue=Dy;var es=class extends je{};es.prototype._setValue=l_;var Wh=class extends es{};Wh.prototype._setValue=Ny;var Gh=class extends es{};Gh.prototype._setValue=Oy;var Xh=class extends es{};Xh.prototype._setValue=By;var Hh=class extends es{};Hh.prototype._setValue=Ly;var Wl=class extends xe{constructor(t){super(t),this._typeIds=new Xo(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 $t(n,t.type)];return this.type=new Vr(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.")}},y0=class extends Wl{},g0=class extends Wl{constructor(t){super(t),this._offsets=new Xo(Int32Array)}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 Zh=class extends ur{constructor(t){super(t),this._values=new vi(Uint8Array)}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,zi(n))}_flushPending(t,n){}};Zh.prototype._flushPending=jl.prototype._flushPending;var Qh=class extends ur{constructor(t){super(t),this._values=new vi(Uint8Array)}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,zi(n))}_flushPending(t,n){}};Qh.prototype._flushPending=Yl.prototype._flushPending;var D_=class extends dt{visitNull(){return p0}visitBool(){return Ky}visitInt(){return Xr}visitInt8(){return i0}visitInt16(){return o0}visitInt32(){return s0}visitInt64(){return a0}visitUint8(){return c0}visitUint16(){return l0}visitUint32(){return u0}visitUint64(){return f0}visitFloat(){return fc}visitFloat16(){return e0}visitFloat32(){return n0}visitFloat64(){return r0}visitUtf8(){return Zh}visitLargeUtf8(){return Qh}visitBinary(){return jl}visitLargeBinary(){return Yl}visitFixedSizeBinary(){return Ch}visitDate(){return lc}visitDateDay(){return Bh}visitDateMillisecond(){return Lh}visitTimestamp(){return ts}visitTimestampSecond(){return qh}visitTimestampMillisecond(){return Vh}visitTimestampMicrosecond(){return jh}visitTimestampNanosecond(){return Yh}visitTime(){return es}visitTimeSecond(){return Wh}visitTimeMillisecond(){return Gh}visitTimeMicrosecond(){return Xh}visitTimeNanosecond(){return Hh}visitDecimal(){return Fh}visitList(){return h0}visitStruct(){return m0}visitUnion(){return Wl}visitDenseUnion(){return g0}visitSparseUnion(){return y0}visitDictionary(){return Jy}visitInterval(){return hc}visitIntervalDayTime(){return Rh}visitIntervalYearMonth(){return kh}visitDuration(){return Jo}visitDurationSecond(){return $h}visitDurationMillisecond(){return Uh}visitDurationMicrosecond(){return Ph}visitDurationNanosecond(){return zh}visitFixedSizeList(){return t0}visitMap(){return d0}},bA=new D_;var gt=class extends dt{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 Wn(e,t){return t instanceof e.constructor}function dc(e,t){return e===t||Wn(e,t)}function ns(e,t){return e===t||Wn(e,t)&&e.bitWidth===t.bitWidth&&e.isSigned===t.isSigned}function b0(e,t){return e===t||Wn(e,t)&&e.precision===t.precision}function AC(e,t){return e===t||Wn(e,t)&&e.byteWidth===t.byteWidth}function N_(e,t){return e===t||Wn(e,t)&&e.unit===t.unit}function Kh(e,t){return e===t||Wn(e,t)&&e.unit===t.unit&&e.timezone===t.timezone}function Jh(e,t){return e===t||Wn(e,t)&&e.unit===t.unit&&e.bitWidth===t.bitWidth}function TC(e,t){return e===t||Wn(e,t)&&e.children.length===t.children.length&&so.compareManyFields(e.children,t.children)}function EC(e,t){return e===t||Wn(e,t)&&e.children.length===t.children.length&&so.compareManyFields(e.children,t.children)}function O_(e,t){return e===t||Wn(e,t)&&e.mode===t.mode&&e.typeIds.every((n,r)=>n===t.typeIds[r])&&so.compareManyFields(e.children,t.children)}function DC(e,t){return e===t||Wn(e,t)&&e.id===t.id&&e.isOrdered===t.isOrdered&&so.visit(e.indices,t.indices)&&so.visit(e.dictionary,t.dictionary)}function B_(e,t){return e===t||Wn(e,t)&&e.unit===t.unit}function td(e,t){return e===t||Wn(e,t)&&e.unit===t.unit}function NC(e,t){return e===t||Wn(e,t)&&e.listSize===t.listSize&&e.children.length===t.children.length&&so.compareManyFields(e.children,t.children)}function OC(e,t){return e===t||Wn(e,t)&&e.keysSorted===t.keysSorted&&e.children.length===t.children.length&&so.compareManyFields(e.children,t.children)}gt.prototype.visitNull=dc;gt.prototype.visitBool=dc;gt.prototype.visitInt=ns;gt.prototype.visitInt8=ns;gt.prototype.visitInt16=ns;gt.prototype.visitInt32=ns;gt.prototype.visitInt64=ns;gt.prototype.visitUint8=ns;gt.prototype.visitUint16=ns;gt.prototype.visitUint32=ns;gt.prototype.visitUint64=ns;gt.prototype.visitFloat=b0;gt.prototype.visitFloat16=b0;gt.prototype.visitFloat32=b0;gt.prototype.visitFloat64=b0;gt.prototype.visitUtf8=dc;gt.prototype.visitLargeUtf8=dc;gt.prototype.visitBinary=dc;gt.prototype.visitLargeBinary=dc;gt.prototype.visitFixedSizeBinary=AC;gt.prototype.visitDate=N_;gt.prototype.visitDateDay=N_;gt.prototype.visitDateMillisecond=N_;gt.prototype.visitTimestamp=Kh;gt.prototype.visitTimestampSecond=Kh;gt.prototype.visitTimestampMillisecond=Kh;gt.prototype.visitTimestampMicrosecond=Kh;gt.prototype.visitTimestampNanosecond=Kh;gt.prototype.visitTime=Jh;gt.prototype.visitTimeSecond=Jh;gt.prototype.visitTimeMillisecond=Jh;gt.prototype.visitTimeMicrosecond=Jh;gt.prototype.visitTimeNanosecond=Jh;gt.prototype.visitDecimal=dc;gt.prototype.visitList=TC;gt.prototype.visitStruct=EC;gt.prototype.visitUnion=O_;gt.prototype.visitDenseUnion=O_;gt.prototype.visitSparseUnion=O_;gt.prototype.visitDictionary=DC;gt.prototype.visitInterval=B_;gt.prototype.visitIntervalDayTime=B_;gt.prototype.visitIntervalYearMonth=B_;gt.prototype.visitDuration=td;gt.prototype.visitDurationSecond=td;gt.prototype.visitDurationMillisecond=td;gt.prototype.visitDurationMicrosecond=td;gt.prototype.visitDurationNanosecond=td;gt.prototype.visitFixedSizeList=NC;gt.prototype.visitMap=OC;var so=new gt;function pc(e,t){return so.compareSchemas(e,t)}function xA(e,t){return so.compareFields(e,t)}function wA(e,t){return so.visit(e,t)}function uc(e){let t=e.type,n=new(bA.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(uc(Object.assign(Object.assign({},l),{type:c})))}}return n}function x0(e,t){return BC(e,t.map(n=>n.data.concat()))}function BC(e,t){let n=[...e.fields],r=[],i={numBatches:t.reduce((f,h)=>Math.max(f,h.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=LC(n,s,u,t,i),s>0&&(r[o++]=At({type:new ye(n),length:s,nullCount:0,children:u.slice()})))}return[e=e.assign(n),r.map(f=>new Le(e,f))]}function LC(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:At({type:f.type,length:t,nullCount:t,nullBitmap:new Uint8Array(s)})}}return n}var _A,fr=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 Kt){if(c.type instanceof ye)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(d=>new qt([c[d]])),f=i??new re(l.map((d,p)=>new $t(String(d),u[p].type,u[p].nullable))),[,h]=x0(f,u);return h.length===0?[new Le(c)]:h}}}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(!pc(i,c.schema))throw new TypeError("Table and inner RecordBatch schemas must be equivalent.")}this.schema=i,this.batches=a,this._offsets=o??jy(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=Vy(this.data)),this._nullCount}isValid(t){return!1}get(t){return null}set(t,n){}indexOf(t,n){return-1}[Symbol.iterator](){return this.batches.length>0?Ul.visit(new qt(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 Oe(n,i)))}slice(t,n){let r=this.schema;[t,n]=wh({length:this.numRows},t,n);let i=Ry(this.data,this._offsets,t,n);return new e(r,i.map(o=>new Oe(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=At({type:r,length:0,nullCount:0});n.push(i._changeLengthAndBackfillNullBitmap(this.numRows))}return new qt(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 qt([At({type:new Bn,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]=f0(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,h=n.findIndex(d=>d.name===c.name);return~h?f[h]=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(...f0(o,s))}};JA=Symbol.toStringTag;ur[JA]=(e=>(e.schema=null,e.batches=[],e._offsets=new Uint32Array([0]),e._nullCount=-1,e[Symbol.isConcatSpreadable]=!0,e.isValid=Fl(Sh),e.get=Fl(qe.getVisitFn(O.Struct)),e.set=$y(xn.getVisitFn(O.Struct)),e.indexOf=Uy(ec.getVisitFn(O.Struct)),"Table"))(ur.prototype);var e6,Oe=class e{constructor(...t){switch(t.length){case 2:{if([this.schema]=t,!(this.schema instanceof ne))throw new TypeError("RecordBatch constructor expects a [Schema, Data] pair.");if([,this.data=At({nullCount:0,type:new me(this.schema.fields),children:this.schema.fields.map(n=>At({type:n.type,nullCount:0}))})]=t,!(this.data instanceof Kt))throw new TypeError("RecordBatch constructor expects a [Schema, Data] pair.");[this.schema,this.data]=t6(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]=Rt.new({name:l,type:n[l].type,nullable:!0}),c),{length:0,fields:new Array,children:new Array}),s=new ne(r),a=At({type:new me(r),length:o,children:i,nullCount:0});[this.schema,this.data]=t6(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=n6(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 ec.visit(this.data,t,n)}[Symbol.iterator](){return Cl.visit(new qt([this.data]))}toArray(){return[...this]}concat(...t){return new ur(this.schema,[this,...t])}slice(t,n){let[r]=new qt([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 qt([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 qt([At({type:new Bn,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 ne(o,new Map(this.schema.metadata)),i=At({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,At({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=At({type:new me(n.fields),length:this.numRows,children:r});return new e(n,i)}};e6=Symbol.toStringTag;Oe[e6]=(e=>(e._nullCount=-1,e[Symbol.isConcatSpreadable]=!0,"RecordBatch"))(Oe.prototype);function t6(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:At({type:c.type,length:n,nullCount:n,nullBitmap:new Uint8Array(s)}))}return[e.assign(i),At({type:new me(i),length:n,children:o})]}function n6(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)||[]])n6(a.children,l?.children,n);if(X.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 uc=class extends Oe{constructor(t){let n=t.fields.map(i=>At({type:i.type})),r=At({type:new me(t.fields),nullCount:0,children:n});super(t,r)}};var _i=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):oe.V1}headerType(){let t=this.bb.__offset(this.bb_pos,6);return t?this.bb.readUint8(this.bb_pos+t):Ut.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 Je).__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,oe.V1)}static addHeaderType(t,n){t.addFieldInt8(1,n,Ut.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 b_=class extends dt{visit(t,n){return t==null||n==null?void 0:super.visit(t,n)}visitNull(t,n){return ih.startNull(n),ih.endNull(n)}visitInt(t,n){return di.startInt(n),di.addBitWidth(n,t.bitWidth),di.addIsSigned(n,t.isSigned),di.endInt(n)}visitFloat(t,n){return Zs.startFloatingPoint(n),Zs.addPrecision(n,t.precision),Zs.endFloatingPoint(n)}visitBinary(t,n){return Jf.startBinary(n),Jf.endBinary(n)}visitLargeBinary(t,n){return eh.startLargeBinary(n),eh.endLargeBinary(n)}visitBool(t,n){return th.startBool(n),th.endBool(n)}visitUtf8(t,n){return sh.startUtf8(n),sh.endUtf8(n)}visitLargeUtf8(t,n){return nh.startLargeUtf8(n),nh.endLargeUtf8(n)}visitDecimal(t,n){return qi.startDecimal(n),qi.addScale(n,t.scale),qi.addPrecision(n,t.precision),qi.addBitWidth(n,t.bitWidth),qi.endDecimal(n)}visitDate(t,n){return Ws.startDate(n),Ws.addUnit(n,t.unit),Ws.endDate(n)}visitTime(t,n){return qo.startTime(n),qo.addUnit(n,t.unit),qo.addBitWidth(n,t.bitWidth),qo.endTime(n)}visitTimestamp(t,n){let r=t.timezone&&n.createString(t.timezone)||void 0;return Vo.startTimestamp(n),Vo.addUnit(n,t.unit),r!==void 0&&Vo.addTimezone(n,r),Vo.endTimestamp(n)}visitInterval(t,n){return Ks.startInterval(n),Ks.addUnit(n,t.unit),Ks.endInterval(n)}visitDuration(t,n){return Gs.startDuration(n),Gs.addUnit(n,t.unit),Gs.endDuration(n)}visitList(t,n){return rh.startList(n),rh.endList(n)}visitStruct(t,n){return oh.startStruct_(n),oh.endStruct_(n)}visitUnion(t,n){pi.startTypeIdsVector(n,t.typeIds.length);let r=pi.createTypeIdsVector(n,t.typeIds);return pi.startUnion(n),pi.addMode(n,t.mode),pi.addTypeIds(n,r),pi.endUnion(n)}visitDictionary(t,n){let r=this.visit(t.indices,n);return zi.startDictionaryEncoding(n),zi.addId(n,BigInt(t.id)),zi.addIsOrdered(n,t.isOrdered),r!==void 0&&zi.addIndexType(n,r),zi.endDictionaryEncoding(n)}visitFixedSizeBinary(t,n){return Xs.startFixedSizeBinary(n),Xs.addByteWidth(n,t.byteWidth),Xs.endFixedSizeBinary(n)}visitFixedSizeList(t,n){return Hs.startFixedSizeList(n),Hs.addListSize(n,t.listSize),Hs.endFixedSizeList(n)}visitMap(t,n){return Qs.startMap(n),Qs.addKeysSorted(n,t.keysSorted),Qs.endMap(n)}},h0=new b_;function s6(e,t=new Map){return new ne(ak(e,t),d0(e.metadata),t)}function x_(e){return new wn(e.count,c6(e.columns),l6(e.columns))}function a6(e){return new hr(x_(e.data),e.id,e.isDelta)}function ak(e,t){return(e.fields||[]).filter(Boolean).map(n=>Rt.fromJSON(n,t))}function r6(e,t){return(e.children||[]).filter(Boolean).map(n=>Rt.fromJSON(n,t))}function c6(e){return(e||[]).reduce((t,n)=>[...t,new Xr(n.count,ck(n.VALIDITY)),...c6(n.children)],[])}function l6(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=l6(i.children,t)}return t}function ck(e){return(e||[]).reduce((t,n)=>t+ +(n===0),0)}function u6(e,t){let n,r,i,o,s,a;return!t||!(o=e.dictionary)?(s=o6(e,r6(e,t)),i=new Rt(e.name,s,e.nullable,d0(e.metadata))):t.has(n=o.id)?(r=(r=o.indexType)?i6(r):new bi,a=new cr(t.get(n),r,n,o.isOrdered),i=new Rt(e.name,a,e.nullable,d0(e.metadata))):(r=(r=o.indexType)?i6(r):new bi,t.set(n,s=o6(e,r6(e,t))),a=new cr(s,r,n,o.isOrdered),i=new Rt(e.name,a,e.nullable,d0(e.metadata))),i||null}function d0(e=[]){return new Map(e.map(({key:t,value:n})=>[t,n]))}function i6(e){return new Be(e.isSigned,e.bitWidth)}function o6(e,t){let n=e.type.name;switch(n){case"NONE":return new Bn;case"null":return new Bn;case"binary":return new Vi;case"largebinary":return new ji;case"utf8":return new Yi;case"largeutf8":return new Wi;case"bool":return new Gi;case"list":return new zr((t||[])[0]);case"struct":return new me(t||[]);case"struct_":return new me(t||[])}switch(n){case"int":{let r=e.type;return new Be(r.isSigned,r.bitWidth)}case"floatingpoint":{let r=e.type;return new Vn(ue[r.precision])}case"decimal":{let r=e.type;return new Xi(r.scale,r.precision,r.bitWidth)}case"date":{let r=e.type;return new Hi(ze[r.unit])}case"time":{let r=e.type;return new Pr(at[r.unit],r.bitWidth)}case"timestamp":{let r=e.type;return new Zi(at[r.unit],r.timezone)}case"interval":{let r=e.type;return new Ki(on[r.unit])}case"duration":{let r=e.type;return new Qi(at[r.unit])}case"union":{let r=e.type,[i,...o]=(r.mode+"").toLowerCase(),s=i.toUpperCase()+o.join("");return new qr(pe[s],r.typeIds||[],t||[])}case"fixedsizebinary":{let r=e.type;return new Ji(r.byteWidth)}case"fixedsizelist":{let r=e.type;return new Vr(r.listSize,(t||[])[0])}case"map":{let r=e.type;return new jr((t||[])[0],r.keysSorted)}}throw new Error(`Unrecognized type: "${n}"`)}var lk=Ka,uk=_r,dr=class e{static fromJSON(t,n){let r=new e(0,oe.V5,n);return r._createHeader=fk(t,n),r}static decode(t){t=new uk(wt(t));let n=_i.getRootAsMessage(t),r=n.bodyLength(),i=n.version(),o=n.headerType(),s=new e(r,i,o);return s._createHeader=hk(n,o),s}static encode(t){let n=new lk,r=-1;return t.isSchema()?r=ne.encode(n,t.header()):t.isRecordBatch()?r=wn.encode(n,t.header()):t.isDictionaryBatch()&&(r=hr.encode(n,t.header())),_i.startMessage(n),_i.addVersion(n,oe.V5),_i.addHeader(n,r),_i.addHeaderType(n,t.headerType),_i.addBodyLength(n,BigInt(t.bodyLength)),_i.finishMessageBuffer(n,_i.endMessage(n)),n.asUint8Array()}static from(t,n=0){if(t instanceof ne)return new e(0,oe.V5,Ut.Schema,t);if(t instanceof wn)return new e(n,oe.V5,Ut.RecordBatch,t);if(t instanceof hr)return new e(n,oe.V5,Ut.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===Ut.Schema}isRecordBatch(){return this.headerType===Ut.RecordBatch}isDictionaryBatch(){return this.headerType===Ut.DictionaryBatch}constructor(t,n,r,i){this._version=n,this._headerType=r,this.body=new Uint8Array(0),i&&(this._createHeader=()=>i),this._bodyLength=Ae(t)}},wn=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=Ae(t)}},hr=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=Ae(n)}},fr=class{constructor(t,n){this.offset=Ae(t),this.length=Ae(n)}},Xr=class{constructor(t,n){this.length=Ae(t),this.nullCount=Ae(n)}};function fk(e,t){return()=>{switch(t){case Ut.Schema:return ne.fromJSON(e);case Ut.RecordBatch:return wn.fromJSON(e);case Ut.DictionaryBatch:return hr.fromJSON(e)}throw new Error(`Unrecognized Message type: { name: ${Ut[t]}, type: ${t} }`)}}function hk(e,t){return()=>{switch(t){case Ut.Schema:return ne.decode(e.header(new ar),new Map,e.version());case Ut.RecordBatch:return wn.decode(e.header(new vr),e.version());case Ut.DictionaryBatch:return hr.decode(e.header(new zo),e.version())}throw new Error(`Unrecognized Message type: { name: ${Ut[t]}, type: ${t} }`)}}Rt.encode=Sk;Rt.decode=_k;Rt.fromJSON=u6;ne.encode=vk;ne.decode=dk;ne.fromJSON=s6;wn.encode=Ik;wn.decode=pk;wn.fromJSON=x_;hr.encode=Mk;hr.decode=mk;hr.fromJSON=a6;Xr.encode=Ak;Xr.decode=gk;fr.encode=Tk;fr.decode=yk;function dk(e,t=new Map,n=oe.V5){let r=wk(e,t);return new ne(r,p0(e),t,n)}function pk(e,t=oe.V5){if(e.compression()!==null)throw new Error("Record batch compression not implemented");return new wn(e.length(),bk(e),xk(e,t))}function mk(e,t=oe.V5){return new hr(wn.decode(e.data(),t),e.id(),e.isDelta())}function yk(e){return new fr(e.offset(),e.length())}function gk(e){return new Xr(e.length(),e.nullCount())}function bk(e){let t=[];for(let n,r=-1,i=-1,o=e.nodesLength();++r<o;)(n=e.nodes(r))&&(t[++i]=Xr.decode(n));return t}function xk(e,t){let n=[];for(let r,i=-1,o=-1,s=e.buffersLength();++i<s;)(r=e.buffers(i))&&(t<oe.V4&&(r.bb_pos+=8*(i+1)),n[++o]=fr.decode(r));return n}function wk(e,t){let n=[];for(let r,i=-1,o=-1,s=e.fieldsLength();++i<s;)(r=e.fields(i))&&(n[++o]=Rt.decode(r,t));return n}function f6(e,t){let n=[];for(let r,i=-1,o=-1,s=e.childrenLength();++i<s;)(r=e.children(i))&&(n[++o]=Rt.decode(r,t));return n}function _k(e,t){let n,r,i,o,s,a;return!t||!(a=e.dictionary())?(i=d6(e,f6(e,t)),r=new Rt(e.name(),i,e.nullable(),p0(e))):t.has(n=Ae(a.id()))?(o=(o=a.indexType())?h6(o):new bi,s=new cr(t.get(n),o,n,a.isOrdered()),r=new Rt(e.name(),s,e.nullable(),p0(e))):(o=(o=a.indexType())?h6(o):new bi,t.set(n,i=d6(e,f6(e,t))),s=new cr(i,o,n,a.isOrdered()),r=new Rt(e.name(),s,e.nullable(),p0(e))),r||null}function p0(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 h6(e){return new Be(e.isSigned(),e.bitWidth())}function d6(e,t){let n=e.typeType();switch(n){case fe.NONE:return new Bn;case fe.Null:return new Bn;case fe.Binary:return new Vi;case fe.LargeBinary:return new ji;case fe.Utf8:return new Yi;case fe.LargeUtf8:return new Wi;case fe.Bool:return new Gi;case fe.List:return new zr((t||[])[0]);case fe.Struct_:return new me(t||[])}switch(n){case fe.Int:{let r=e.type(new di);return new Be(r.isSigned(),r.bitWidth())}case fe.FloatingPoint:{let r=e.type(new Zs);return new Vn(r.precision())}case fe.Decimal:{let r=e.type(new qi);return new Xi(r.scale(),r.precision(),r.bitWidth())}case fe.Date:{let r=e.type(new Ws);return new Hi(r.unit())}case fe.Time:{let r=e.type(new qo);return new Pr(r.unit(),r.bitWidth())}case fe.Timestamp:{let r=e.type(new Vo);return new Zi(r.unit(),r.timezone())}case fe.Interval:{let r=e.type(new Ks);return new Ki(r.unit())}case fe.Duration:{let r=e.type(new Gs);return new Qi(r.unit())}case fe.Union:{let r=e.type(new pi);return new qr(r.mode(),r.typeIdsArray()||[],t||[])}case fe.FixedSizeBinary:{let r=e.type(new Xs);return new Ji(r.byteWidth())}case fe.FixedSizeList:{let r=e.type(new Hs);return new Vr(r.listSize(),(t||[])[0])}case fe.Map:{let r=e.type(new Qs);return new jr((t||[])[0],r.keysSorted())}}throw new Error(`Unrecognized type: "${fe[n]}" (${n})`)}function vk(e,t){let n=t.fields.map(o=>Rt.encode(e,o));ar.startFieldsVector(e,n.length);let r=ar.createFieldsVector(e,n),i=t.metadata&&t.metadata.size>0?ar.createCustomMetadataVector(e,[...t.metadata].map(([o,s])=>{let a=e.createString(`${o}`),c=e.createString(`${s}`);return Je.startKeyValue(e),Je.addKey(e,a),Je.addValue(e,c),Je.endKeyValue(e)})):-1;return ar.startSchema(e),ar.addFields(e,r),ar.addEndianness(e,Ek?Ys.Little:Ys.Big),i!==-1&&ar.addCustomMetadata(e,i),ar.endSchema(e)}function Sk(e,t){let n=-1,r=-1,i=-1,o=t.type,s=t.typeId;X.isDictionary(o)?(s=o.dictionary.typeId,i=h0.visit(o,e),r=h0.visit(o.dictionary,e)):r=h0.visit(o,e);let a=(o.children||[]).map(u=>Rt.encode(e,u)),c=Nn.createChildrenVector(e,a),l=t.metadata&&t.metadata.size>0?Nn.createCustomMetadataVector(e,[...t.metadata].map(([u,f])=>{let h=e.createString(`${u}`),d=e.createString(`${f}`);return Je.startKeyValue(e),Je.addKey(e,h),Je.addValue(e,d),Je.endKeyValue(e)})):-1;return t.name&&(n=e.createString(t.name)),Nn.startField(e),Nn.addType(e,r),Nn.addTypeType(e,s),Nn.addChildren(e,c),Nn.addNullable(e,!!t.nullable),n!==-1&&Nn.addName(e,n),i!==-1&&Nn.addDictionary(e,i),l!==-1&&Nn.addCustomMetadata(e,l),Nn.endField(e)}function Ik(e,t){let n=t.nodes||[],r=t.buffers||[];vr.startNodesVector(e,n.length);for(let s of n.slice().reverse())Xr.encode(e,s);let i=e.endVector();vr.startBuffersVector(e,r.length);for(let s of r.slice().reverse())fr.encode(e,s);let o=e.endVector();return vr.startRecordBatch(e),vr.addLength(e,BigInt(t.length)),vr.addNodes(e,i),vr.addBuffers(e,o),vr.endRecordBatch(e)}function Mk(e,t){let n=wn.encode(e,t.data);return zo.startDictionaryBatch(e),zo.addId(e,BigInt(t.id)),zo.addIsDelta(e,t.isDelta),zo.addData(e,n),zo.endDictionaryBatch(e)}function Ak(e,t){return Al.createFieldNode(e,BigInt(t.length),BigInt(t.nullCount))}function Tk(e,t){return Ml.createBuffer(e,BigInt(t.offset),BigInt(t.length))}var Ek=(()=>{let e=new ArrayBuffer(2);return new DataView(e).setInt16(0,256,!0),new Int16Array(e)[0]===256})();var __=e=>`Expected ${Ut[e]} Message in stream, but was null or length 0.`,v_=e=>`Header pointer of flatbuffer-encoded ${Ut[e]} Message is null or length 0.`,p6=(e,t)=>`Expected to read ${e} metadata bytes, but only read ${t}.`,m6=(e,t)=>`Expected to read ${e} bytes for message body, but only read ${t}.`,Vl=class{constructor(t){this.source=t instanceof no?t:new no(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(__(t));return n.value}readMessageBody(t){if(t<=0)return new Uint8Array(0);let n=wt(this.source.read(t));if(n.byteLength<t)throw new Error(m6(t,n.byteLength));return n.byteOffset%8===0&&n.byteOffset+n.byteLength<=n.buffer.byteLength?n:n.slice()}readSchema(t=!1){let n=Ut.Schema,r=this.readMessage(n),i=r?.header();if(t&&!i)throw new Error(v_(n));return i}readMetadataLength(){let t=this.source.read(m0),n=t&&new _r(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(p6(t,n.byteLength));return{done:!1,value:dr.decode(n)}}},Qh=class{constructor(t,n){this.source=t instanceof Wr?t:iy(t)?new na(t,n):new Wr(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(__(t));return n.value})}readMessageBody(t){return Z(this,void 0,void 0,function*(){if(t<=0)return new Uint8Array(0);let n=wt(yield this.source.read(t));if(n.byteLength<t)throw new Error(m6(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=Ut.Schema,r=yield this.readMessage(n),i=r?.header();if(t&&!i)throw new Error(v_(n));return i})}readMetadataLength(){return Z(this,void 0,void 0,function*(){let t=yield this.source.read(m0),n=t&&new _r(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(p6(t,n.byteLength));return{done:!1,value:dr.decode(n)}})}},Jh=class extends Vl{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:dr.fromJSON(t.schema,Ut.Schema)};if(this._dictionaryIndex<t.dictionaries.length){let n=t.dictionaries[this._dictionaryIndex++];return this._body=n.data.columns,{done:!1,value:dr.fromJSON(n,Ut.DictionaryBatch)}}if(this._batchIndex<t.batches.length){let n=t.batches[this._batchIndex++];return this._body=n.columns,{done:!1,value:dr.fromJSON(n,Ut.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(__(t));return n.value}readSchema(){let t=Ut.Schema,n=this.readMessage(t),r=n?.header();if(!n||!r)throw new Error(v_(t));return r}},m0=4,w_="ARROW1",jl=new Uint8Array(w_.length);for(let e=0;e<w_.length;e+=1)jl[e]=w_.codePointAt(e);function y0(e,t=0){for(let n=-1,r=jl.length;++n<r;)if(jl[n]!==e[t+n])return!1;return!0}var Yl=jl.length,S_=Yl+m0,y6=Yl*2+m0;var Mr=class e extends rc{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 xr(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 bn.toDOMStream(this.isSync()?{[Symbol.iterator]:()=>this}:{[Symbol.asyncIterator]:()=>this})}toNodeStream(){return bn.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:ny(t)?Nk(t):iy(t)?Lk(t):xr(t)?Z(this,void 0,void 0,function*(){return yield e.from(yield t)}):oy(t)||Gf(t)||ay(t)||$r(t)?Ok(new Wr(t)):Bk(new no(t))}static readAll(t){return t instanceof e?t.isSync()?g6(t):b6(t):ny(t)||ArrayBuffer.isView(t)||ui(t)||ry(t)?g6(t):b6(t)}},ts=class extends Mr{constructor(t){super(t),this._impl=t}readAll(){return[...this]}[Symbol.iterator](){return this._impl[Symbol.iterator]()}[Symbol.asyncIterator](){return br(this,arguments,function*(){yield Lt(yield*Sl(li(this[Symbol.iterator]())))})}},fc=class extends Mr{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=li(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]()}},hc=class extends ts{constructor(t){super(t),this._impl=t}},g0=class extends fc{constructor(t){super(t),this._impl=t}},b0=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=At({type:new me(this.schema.fields),length:t.length,children:r});return new Oe(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 qt(l)):new qt(l)).memoize()}return a.memoize()}_loadVectors(t,n,r){return new Eh(n,t.nodes,t.buffers,this.dictionaries,this.schema.metadataVersion).visitMany(r)}},Wl=class extends b0{constructor(t,n){super(n),this._reader=ny(t)?new Jh(this._handle=t):new Vl(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=x6(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 uc(this.schema)}):this.return()}_readNextMessageAndValidate(t){return this._reader.readMessage(t)}},Gl=class extends b0{constructor(t,n){super(n),this._reader=new Qh(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=x6(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 uc(this.schema)}):yield this.return()})}_readNextMessageAndValidate(t){return Z(this,void 0,void 0,function*(){return yield this._reader.readMessage(t)})}},x0=class extends Wl{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 Mh?t:new Mh(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(Ut.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(Ut.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-S_,r=t.readInt32(n),i=t.readAt(n-r,r);return Wo.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}},I_=class extends Gl{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 na?t:new na(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(Ut.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(Ut.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-S_,r=yield t.readInt32(n),i=yield t.readAt(n-r,r);return Wo.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})}},M_=class extends Wl{constructor(t,n){super(t,n)}_loadVectors(t,n,r){return new Vy(n,t.nodes,t.buffers,this.dictionaries,this.schema.metadataVersion).visitMany(r)}};function x6(e,t){return t&&typeof t.autoDestroy=="boolean"?t.autoDestroy:e.autoDestroy}function*g6(e){let t=Mr.from(e);try{if(!t.open({autoDestroy:!1}).closed)do yield t;while(!t.reset().open().closed)}finally{t.cancel()}}function b6(e){return br(this,arguments,function*(){let n=yield Lt(Mr.from(e));try{if(!(yield Lt(n.open({autoDestroy:!1}))).closed)do yield yield Lt(n);while(!(yield Lt(n.reset().open())).closed)}finally{yield Lt(n.cancel())}})}function Nk(e){return new ts(new M_(e))}function Bk(e){let t=e.peek(Yl+7&-8);return t&&t.byteLength>=4?y0(t)?new hc(new x0(e.read())):new ts(new Wl(e)):new ts(new Wl(function*(){}()))}function Ok(e){return Z(this,void 0,void 0,function*(){let t=yield e.peek(Yl+7&-8);return t&&t.byteLength>=4?y0(t)?new hc(new x0(yield e.read())):new fc(new Gl(e)):new fc(new Gl(function(){return br(this,arguments,function*(){})}()))})}function Lk(e){return Z(this,void 0,void 0,function*(){let{size:t}=yield e.stat(),n=new na(e,t);return t>=y6&&y0(yield n.readAt(0,Yl+7&-8))?new g0(new I_(n)):new fc(new Gl(n))})}var ve=class e extends dt{static assemble(...t){let n=i=>i.flatMap(o=>Array.isArray(o)?n(o):o instanceof Oe?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 qt)return this.visitMany(t.data),this;let{type:n}=t;if(!X.isDictionary(n)){let{length:r}=t;if(r>2147483647)throw new RangeError("Cannot write arrays larger than 2^31 - 1 in length");if(X.isUnion(n))this.nodes.push(new Xr(r,0));else{let{nullCount:i}=t;X.isNull(n)||vi.call(this,i<=0?new Uint8Array(0):Ja(t.offset,r,t.nullBitmap)),this.nodes.push(new Xr(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 vi(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 Fk(e){var t;let{type:n,length:r,typeIds:i,valueOffsets:o}=e;if(vi.call(this,i),n.mode===pe.Sparse)return A_.call(this,e);if(n.mode===pe.Dense){if(e.offset<=0)return vi.call(this,o),A_.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);vi.call(this,s),this.visitMany(e.children.map((l,u)=>{let f=n.typeIds[u],h=a[f],d=c[f];return l.slice(h,Math.min(r,d))}))}}return this}function Ck(e){let t;return e.nullCount>=e.length?vi.call(this,new Uint8Array(0)):(t=e.values)instanceof Uint8Array?vi.call(this,Ja(e.offset,e.length,t)):vi.call(this,tc(e.values))}function es(e){return vi.call(this,e.values.subarray(0,e.length*e.stride))}function w0(e){let{length:t,values:n,valueOffsets:r}=e,i=Ae(r[0]),o=Ae(r[t]),s=Math.min(o-i,n.byteLength-i);return vi.call(this,ly(-i,t+1,r)),vi.call(this,n.subarray(i,i+s)),this}function T_(e){let{length:t,valueOffsets:n}=e;if(n){let{[0]:r,[t]:i}=n;return vi.call(this,ly(-r,t+1,n)),this.visit(e.children[0].slice(r,i-r))}return this.visit(e.children[0])}function A_(e){return this.visitMany(e.type.children.map((t,n)=>e.children[n]).filter(Boolean))[0]}ve.prototype.visitBool=Ck;ve.prototype.visitInt=es;ve.prototype.visitFloat=es;ve.prototype.visitUtf8=w0;ve.prototype.visitLargeUtf8=w0;ve.prototype.visitBinary=w0;ve.prototype.visitLargeBinary=w0;ve.prototype.visitFixedSizeBinary=es;ve.prototype.visitDate=es;ve.prototype.visitTimestamp=es;ve.prototype.visitTime=es;ve.prototype.visitDecimal=es;ve.prototype.visitList=T_;ve.prototype.visitStruct=A_;ve.prototype.visitUnion=Fk;ve.prototype.visitInterval=es;ve.prototype.visitDuration=es;ve.prototype.visitFixedSizeList=T_;ve.prototype.visitMap=T_;var dc=class extends rc{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 eo,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 xr(t)?t.then(n=>this.writeAll(n)):$r(t)?D_(this,t):E_(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 eo?this._sink=t:(this._sink=new eo,t&&L3(t)?this.toDOMStream({type:"bytes"}).pipeTo(t):t&&F3(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||!lc(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 Oe&&!(n=t.schema))return this.finish()&&void 0}else throw new Error("RecordBatchWriter is closed");if(n&&!lc(n,this._schema)){if(this._started&&this._autoDestroy)return this.close();this.reset(this._sink,n)}t instanceof Oe?t instanceof uc||this._writeRecordBatch(t):t instanceof ur?this.writeAll(t.batches):ui(t)&&this.writeAll(t)}_writeMessage(t,n=8){let r=n-1,i=dr.encode(t),o=i.byteLength,s=this._writeLegacyIpcFormat?4:8,a=o+s+r&~r,c=a-o-s;return t.headerType===Ut.RecordBatch?this._recordBatchBlocks.push(new Go(a,t.bodyLength,this._position)):t.headerType===Ut.DictionaryBatch&&this._dictionaryBlocks.push(new Go(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=wt(t);n&&n.byteLength>0&&(this._sink.write(n),this._position+=n.byteLength)}return this}_writeSchema(t){return this._writeMessage(dr.from(t))}_writeFooter(t){return this._writeLegacyIpcFormat?this._write(Int32Array.of(0)):this._write(Int32Array.of(-1,0))}_writeMagic(){return this._write(jl)}_writePadding(t){return t>0?this._write(new Uint8Array(t)):this}_writeRecordBatch(t){let{byteLength:n,nodes:r,bufferRegions:i,buffers:o}=ve.assemble(t),s=new wn(t.numRows,r,i),a=dr.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}=ve.assemble(new qt([t])),c=new wn(t.length,o,s),l=new hr(c,n,r),u=dr.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}},td=class e extends dc{static writeAll(t,n){let r=new e(n);return xr(t)?t.then(i=>r.writeAll(i)):$r(t)?D_(r,t):E_(r,t)}},ed=class e extends dc{static writeAll(t){let n=new e;return xr(t)?t.then(r=>n.writeAll(r)):$r(t)?D_(n,t):E_(n,t)}constructor(){super(),this._autoDestroy=!0}_writeSchema(t){return this._writeMagic()._writePadding(2)}_writeFooter(t){let n=Wo.encode(new Wo(t,oe.V5,this._recordBatchBlocks,this._dictionaryBlocks));return super._writeFooter(t)._write(n)._write(Int32Array.of(n.byteLength))._writeMagic()}};function E_(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 D_(e,t){var n,r,i,o,s,a,c;return Z(this,void 0,void 0,function*(){try{for(n=!0,r=li(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 w6(e,t){if($r(e))return Rk(e,t);if(ui(e))return kk(e,t);throw new Error("toDOMStream() must be called with an Iterable or AsyncIterable")}function kk(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=wt(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 Rk(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=wt(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 S6(e){return new N_(e)}var N_=class{constructor(t){this._numChunks=0,this._finished=!1,this._bufferedSize=0;let{["readableStrategy"]:n,["writableStrategy"]:r,["queueingStrategy"]:i="count"}=t,o=B3(t,["readableStrategy","writableStrategy","queueingStrategy"]);this._controller=null,this._builder=oc(o),this._getSize=i!=="bytes"?_6:v6;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"?_6:v6}),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)}},_6=e=>{var t;return(t=e?.length)!==null&&t!==void 0?t:0},v6=e=>{var t;return(t=e?.byteLength)!==null&&t!==void 0?t:0};function _0(e,t){let n=new eo,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 Mr.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 v0(e,t){let n=new this(e),r=new Wr(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 nd(e){let t=Mr.from(e);return xr(t)?t.then(n=>nd(n)):t.isAsync()?t.readAll().then(n=>new ur(n)):new ur(t.readAll())}var r7=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},zw),d_),i_),qw),kw),r_),Uw),{compareSchemas:lc,compareFields:KA,compareTypes:QA});bn.toDOMStream=w6;be.throughDOM=S6;Mr.throughDOM=_0;hc.throughDOM=_0;ts.throughDOM=_0;dc.throughDOM=v0;ed.throughDOM=v0;td.throughDOM=v0;function B_(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:h}=r;if(r=null,c(),typeof l=="string"){let d=JSON.parse(l);d.error?h(d.error):f(d)}else if(u.type==="exec")f();else if(u.type==="arrow")f(nd(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?`${I6(t)}.`:""}${r}`}else return t?I6(t):"NULL"}};function I6(e){return e.split(".").map(n=>`"${n}"`).join(".")}function M6(e,t){return e instanceof pr&&e.column===t}function Gt(e){return typeof e=="string"?S0(e):e}function pc(e){return typeof e=="string"?A6(e):e}function A6(e){return new pr(e)}function S0(e,t=null){return arguments.length===1&&(t=e,e=null),new pr(e,t)}function ns(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 rs=e=>typeof e?.addEventListener=="function";function I0(e){return e instanceof ra}var ra=class{constructor(t,n,r){this._expr=Array.isArray(t)?t:[t],this._deps=n||[],this.annotate(r);let i=this._expr.filter(o=>rs(o));i.length>0?(this._params=Array.from(new Set(i)),this._params.forEach(o=>{o.addEventListener("value",()=>i7(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=>rs(t)&&!I0(t)?ns(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 i7(e,t){if(t?.size)return Promise.allSettled(Array.from(t,n=>n(e)))}function O_(e,t){let n=[e[0]],r=new Set,i=t.length;for(let o=0,s=0;o<i;){let a=t[o];rs(a)?n[++s]=a:(Array.isArray(a?.columns)&&a.columns.forEach(l=>r.add(l)),n[s]+=typeof a=="string"?a:ns(a));let c=e[++o];rs(n[s])?n[++s]=c:n[s]+=c}return{spans:n,cols:Array.from(r)}}function q(e,...t){let{spans:n,cols:r}=O_(e,t);return new ra(n,r)}var rd=e=>({value:e,toString:()=>ns(e)});function id(e){e(this.op,this),this.children?.forEach(t=>t.visit(e))}function T6(e,t){let n=t.filter(i=>i!=null).map(Gt),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:id})}var Ar=(...e)=>T6("AND",e.flat()),od=(...e)=>T6("OR",e.flat()),o7=e=>t=>q`(${e} ${Gt(t)})`.annotate({op:e,a:t,visit:id}),s7=o7("NOT"),E6=e=>t=>q`(${Gt(t)} ${e})`.annotate({op:e,a:t,visit:id}),sd=E6("IS NULL"),mc=E6("IS NOT NULL"),ia=e=>(t,n)=>q`(${Gt(t)} ${e} ${Gt(n)})`.annotate({op:e,a:t,b:n,visit:id}),L_=ia("="),ad=ia("<>"),yc=ia("<"),F_=ia(">"),gc=ia("<="),a7=ia(">="),c7=ia("IS DISTINCT FROM"),C_=ia("IS NOT DISTINCT FROM");function l7(e,t,n,r){t=Gt(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:id,field:t,range:n})}var Le=(e,t,n)=>l7("BETWEEN",e,t,n);function bc(e,t){return Array.from({length:e},()=>t)}function _n(e,t){return(...n)=>{let r=n.map(Gt),i=t?`::${t}`:"";return(r.length?q([`${e}(`,...bc(r.length-1,", "),`)${i}`],...r):q`${e}()${i}`).annotate({func:e,args:r})}}var u7=_n("REGEXP_MATCHES"),f7=_n("CONTAINS"),h7=_n("PREFIX"),d7=_n("SUFFIX"),p7=_n("LOWER"),m7=_n("UPPER"),y7=_n("LENGTH"),g7=_n("ISNAN"),b7=_n("ISFINITE"),x7=_n("ISINF");var cd=class e extends ra{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 h=o&&s?" ":"",d=(o||s)&&a?" ":"";c=q`${n} OVER (${i?`"${i}" `:""}${o}${h}${s}${d}${a})`}r&&(c=q`(${c})::${r}`);let{_expr:u,_deps:f}=c;super(u,f),this.window=t,this.func=n,this.type=r,this.name=i,this.group=o,this.order=s,this.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(Gt),r=q(["PARTITION BY ",bc(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(Gt),r=q(["ORDER BY ",bc(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=D6("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=D6("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 D6(e,t){if(rs(t)){let n=q`${t}`;return n.toString=()=>`${e} ${N6(t.value)}`,n}return`${e} ${N6(t)}`}function N6(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 Si(e,t){return(...n)=>{let r=_n(e)(...n);return new cd(e,r,t)}}var w7=Si("ROW_NUMBER","INTEGER"),_7=Si("RANK","INTEGER"),v7=Si("DENSE_RANK","INTEGER"),S7=Si("PERCENT_RANK"),I7=Si("CUME_DIST"),M7=Si("NTILE"),A7=Si("LAG"),T7=Si("LEAD"),E7=Si("FIRST_VALUE"),D7=Si("LAST_VALUE"),N7=Si("NTH_VALUE");var k_=class e extends ra{constructor(t,n,r,i,o){n=(n||[]).map(Gt);let{strings:s,exprs:a}=B7(t,n,r,i,o),{spans:c,cols:l}=O_(s,a);super(c,l),this.aggregate=t,this.args=n,this.type=r,this.isDistinct=i,this.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(O7).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 cd(t,o,r)}partitionby(...t){return this.window().partitionby(...t)}orderby(...t){return this.window().orderby(...t)}rows(t){return this.window().rows(t)}range(t){return this.window().range(t)}};function B7(e,t,n,r,i){let o=`)${n?`::${n}`:""}`,s=[`${e}(${r?"DISTINCT ":""}`],a=[];return t.length?(s=s.concat([...bc(t.length-1,", "),`${o}${i?" FILTER (WHERE ":""}`,...i?[")"]:[]]),a=[...t,...i?[i]:[]]):s[0]+="*"+o,{exprs:a,strings:s}}function O7(e){let t=ns(e);return t&&t.startsWith('"')&&t.endsWith('"')?t.slice(1,-1):t}function Xt(e,t){return(...n)=>new k_(e,n,t)}var Ii=Xt("COUNT","INTEGER"),L7=Xt("AVG"),F7=Xt("AVG"),C7=Xt("MAD"),oa=Xt("MAX"),sa=Xt("MIN"),Mi=Xt("SUM","DOUBLE"),k7=Xt("PRODUCT"),R7=Xt("MEDIAN"),$7=Xt("QUANTILE"),U7=Xt("MODE"),P7=Xt("VARIANCE"),z7=Xt("STDDEV"),q7=Xt("SKEWNESS"),V7=Xt("KURTOSIS"),j7=Xt("ENTROPY"),Y7=Xt("VAR_POP"),W7=Xt("STDDEV_POP"),G7=Xt("CORR"),X7=Xt("COVAR_POP"),R_=Xt("REGR_INTERCEPT"),$_=Xt("REGR_SLOPE"),U_=Xt("REGR_COUNT"),H7=Xt("REGR_R2"),P_=Xt("REGR_SYY"),z_=Xt("REGR_SXX"),Z7=Xt("REGR_SXY"),q_=Xt("REGR_AVGX"),K7=Xt("REGR_AVGY"),Q7=Xt("FIRST"),J7=Xt("LAST"),M0=Xt("ARG_MIN"),A0=Xt("ARG_MAX"),tR=Xt("STRING_AGG"),eR=Xt("ARRAY_AGG");function B6(e,t){let n=Gt(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 T0=e=>B6(e,"DOUBLE");var V_=e=>q`epoch_ms(${Gt(e)})`;var j_=_n("ST_AsGeoJSON"),nR=_n("ST_X"),rR=_n("ST_Y"),iR=_n("ST_CENTROID");var Ft=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 xc("UNION",t.flat())}static unionAll(...t){return new xc("UNION ALL",t.flat())}static intersect(...t){return new xc("INTERSECT",t.flat())}static except(...t){return new xc("EXCEPT",t.flat())}static describe(t){let n=t.clone(),{clone:r,toString:i}=n;return Object.assign(n,{describe:!0,clone:()=>e.describe(r.call(n)),toString:()=>`DESCRIBE ${i.call(n)}`})}constructor(){this.query={with:[],select:[],from:[],where:[],groupby:[],having:[],window:[],qualify:[],orderby:[]},this.cteFor=null}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:Gt(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:E0(o),expr:Gt(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 pr)r.push({as:i.table,from:i});else if(ld(i)||I0(i))r.push({from:i});else if(Array.isArray(i))r.push({as:E0(i[0]),from:pc(i[1])});else for(let o in i)r.push({as:E0(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(Gt)),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:E0(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(Gt)),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(ld(s))o.push(s);else if(i[s.table]){let a=i[s.table];o.push(a)}}),o}toString(){let{with:t,select:n,distinct:r,from:i,sample:o,where:s,groupby:a,having:c,window:l,qualify:u,orderby:f,limit:h,offset:d}=this.query,p=[];if(t.length){let y=t.map(({as:g,query:b})=>`"${g}" AS (${b})`);p.push(`WITH ${y.join(", ")}`)}let m=n.map(({as:y,expr:g})=>M6(g,y)&&!g.table?`${g}`:`${g} AS "${y}"`);if(p.push(`SELECT${r?" DISTINCT":""} ${m.join(", ")}`),i.length){let y=i.map(({as:g,from:b})=>{let x=ld(b)?`(${b})`:`${b}`;return!g||g===b.table?x:`${x} AS "${g}"`});p.push(`FROM ${y.join(", ")}`)}if(s.length){let y=s.map(String).filter(g=>g).join(" AND ");y&&p.push(`WHERE ${y}`)}if(o){let{rows:y,perc:g,method:b,seed:x}=o,w=y?`${y} ROWS`:`${g} PERCENT`,v=b?` (${b}${x!=null?`, ${x}`:""})`:"";p.push(`USING SAMPLE ${w}${v}`)}if(a.length&&p.push(`GROUP BY ${a.join(", ")}`),c.length){let y=c.map(String).filter(g=>g).join(" AND ");y&&p.push(`HAVING ${y}`)}if(l.length){let y=l.map(({as:g,expr:b})=>`"${g}" AS (${b})`);p.push(`WINDOW ${y.join(", ")}`)}if(u.length){let y=u.map(String).filter(g=>g).join(" AND ");y&&p.push(`QUALIFY ${y}`)}return f.length&&p.push(`ORDER BY ${f.join(", ")}`),Number.isFinite(h)&&p.push(`LIMIT ${h}`),Number.isFinite(d)&&p.push(`OFFSET ${d}`),p.join(" ")}},xc=class e{constructor(t,n){this.op=t,this.queries=n.map(r=>r.clone()),this.query={orderby:[]},this.cteFor=null}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(Gt)),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 ld(e){return e instanceof Ft||e instanceof xc}function Y_(e){return ld(e)&&e.describe}function E0(e){return oR(e)?e.slice(1,-1):e}function oR(e){return e[0]==='"'&&e[e.length-1]==='"'}var D0=e=>e;function sR(){return{apply:D0,invert:D0,sqlApply:Gt,sqlInvert:D0}}function aR({base:e=null}={}){if(e==null||e===Math.E)return{apply:Math.log,invert:Math.exp,sqlApply:t=>q`LN(${Gt(t)})`,sqlInvert:t=>q`EXP(${t})`};if(e===10)return{apply:Math.log10,invert:t=>Math.pow(10,t),sqlApply:t=>q`LOG(${Gt(t)})`,sqlInvert:t=>q`POW(10, ${t})`};{let t=+e;return{apply:n=>Math.log(n)/Math.log(t),invert:n=>Math.pow(t,n),sqlApply:n=>q`LN(${Gt(n)}) / LN(${t})`,sqlInvert:n=>q`POW(${t}, ${n})`}}}function cR({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=Gt(n),q`SIGN(${n}) * LN(${t} + ABS(${n}))`),sqlInvert:n=>q`SIGN(${n}) * (EXP(ABS(${n})) - ${t})`}}function lR(){return{apply:e=>Math.sign(e)*Math.sqrt(Math.abs(e)),invert:e=>Math.sign(e)*e*e,sqlApply:e=>(e=Gt(e),q`SIGN(${e}) * SQRT(ABS(${e}))`),sqlInvert:e=>q`SIGN(${e}) * (${e}) ** 2`}}function uR({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=Gt(n),q`SIGN(${n}) * POW(ABS(${n}), ${t})`),sqlInvert:n=>q`SIGN(${n}) * POW(ABS(${n}), 1/${t})`}}function O6(){return{apply:e=>+e,invert:e=>new Date(e),sqlApply:e=>e instanceof Date?+e:V_(Gt(e)),sqlInvert:D0}}var fR={linear:sR,log:aR,symlog:cR,sqrt:lR,pow:uR,time:O6,utc:O6};function ud(e){let t=fR[e.type];return t?{...e,...t(e)}:null}function N0(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 F6(e){let t=2166136261;for(let n=0,r=e.length;n<r;++n){let i=e.charCodeAt(n),o=i&65280;o&&(t=L6(t^o>>8)),t=L6(t^i&255)}return hR(t)}function L6(e){return e+(e<<1)+(e<<4)+(e<<7)+(e<<8)+(e<<24)}function hR(e){return e+=e<<13,e^=e>>>7,e+=e<<3,e^=e>>>17,e+=e<<5,e&4294967295}var B0=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,k6),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=dR(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=k6(l),f=l.query(o.predicate(l)).select({...i.columns,...u.aux}).groupby(Object.keys(i.columns)),[h]=f.subqueries;if(h){let b=Object.values(i.columns).map(x=>x.columns[0]);mR(h,b)}let d=f.orderby();f.query.orderby=[];let p=f.toString(),y=`cube_index_${(F6(p)>>>0).toString(16)}`,g=a.exec(N0(y,p,{temp:c}));s.set(l,{table:y,result:g,order:d,...u})}return!0}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=Ft.select(o,s).from(i).groupby(o).where(n).orderby(a);return this.mc.updateClient(t,c)}};function dR(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=>pR(l,s));if(c.some(l=>l==null))return null;c.length===1?(a=l=>l?Le("active0",l.range.map(c[0])):[],r={active0:c[0](e.predicate.field)}):(a=l=>l?Ar(l.children.map(({range:u},f)=>Le(`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 pR(e,t){let{apply:n,sqlApply:r}=ud(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=>q`${l}FLOOR(${c}::DOUBLE * (${r(u)} - ${s}::DOUBLE))::INTEGER`}}var C6={from:NaN};function k6(e){if(!e.filterIndexable)return C6;let t=e.query(),n=W_(t);if(!n||!t.groupby)return C6;let r=new Set(t.groupby().map(c=>c.column)),i=[],o=[],s={},a;for(let c of t.select()){let{as:l,expr:{aggregate:u,args:f}}=c,h=u?.toUpperCase?.();switch(h){case"COUNT":case"SUM":i.push({[l]:q`SUM("${l}")::DOUBLE`});break;case"AVG":s[a="__count__"]=q`COUNT(*)`,i.push({[l]:q`(SUM("${l}" * ${a}) / SUM(${a}))::DOUBLE`});break;case"ARG_MAX":s[a=`__max_${l}__`]=q`MAX(${f[1]})`,i.push({[l]:q`ARG_MAX("${l}", ${a})`});break;case"ARG_MIN":s[a=`__min_${l}__`]=q`MIN(${f[1]})`,i.push({[l]:q`ARG_MIN("${l}", ${a})`});break;case"MAX":case"MIN":case"BIT_AND":case"BIT_OR":case"BIT_XOR":case"BOOL_AND":case"BOOL_OR":case"PRODUCT":i.push({[l]:q`${h}("${l}")`});break;default:if(r.has(l))o.push(l);else return null}}return{aggr:i,dims:o,aux:s,from:n}}function W_(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=W_(t[0]);for(let r=1;r<t.length;++r){let i=W_(t[r]);if(i!==void 0&&i!==n)return NaN}return n}function mR(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 O0=class{constructor(t,n,r=!0){this.mc=t,this.selection=n,this.clients=new Set,this.indexer=r?new B0(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():yR(t,r,i)}};function yR(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 L0(){let e,t,n=new Promise((r,i)=>{e=r,t=i});return Object.assign(n,{fulfill:r=>(e(r),n),reject:r=>(t(r),n)})}function gR(e){return(typeof requestAnimationFrame<"u"?requestAnimationFrame:typeof setImmediate<"u"?setImmediate:setTimeout)(e)}function R6(e,t,n){let r=[],i=0;function o(){let s=bR(r,t);r=[],i=0;for(let a of s)wR(a,e,n),SR(a,t)}return{add(s,a){s.request.type==="arrow"?(i=i||gR(()=>o()),r.push({entry:s,priority:a,index:r.length})):e(s,a)}}}function bR(e,t){let n=[],r=new Map;for(let i of e){let{entry:{request:o}}=i,s=xR(o.query,t);if(!r.has(s)){let a=[];n.push(a),r.set(s,a)}r.get(s).push(i)}return n}function xR(e,t){let n=`${e}`;if(e instanceof Ft&&!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 wR(e,t,n){if(_R(e))t({request:{type:"arrow",cache:!1,record:!1,query:e.query=vR(e,n)},result:e.result=L0()});else for(let{entry:r,priority:i}of e)t(r,i)}function _R(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 vR(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[h]=r.get(f);c.push([h,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 SR(e,t){let{maps:n,query:r,result:i}=e;if(!n)return;let o;try{o=await i}catch(a){for(let{entry:c}of e)c.result.reject(a);return}let s=Y_(r);e.forEach(({entry:a},c)=>{let{request:l,result:u}=a,f=n[c],h=s&&f?MR(o,f):f?IR(o,f):o;l.cache&&t.set(String(l.query),h),u.fulfill(h)})}function IR(e,t){let n={};for(let[r,i]of t)n[i]=e.getChild(r);return new e.constructor(n)}function MR(e,t){let n=new Map(t),r=[];for(let i of e)n.has(i.column_name)&&r.push({...i,column_name:n.get(i.column_name)});return r}var AR=typeof requestIdleCallback<"u"?requestIdleCallback:setTimeout,$6=()=>({get:()=>{},set:(e,t)=>t,clear:()=>{}});function U6({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&&AR(r),o},clear(){n=new Map}}}function P6(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 io={High:0,Normal:1,Low:2};function z6(){let e=P6(3),t,n,r,i=[],o=null,s;function a(){if(o||e.isEmpty())return;let{request:f,result:h}=e.next();o=u(f,h),o.finally(()=>{o=null,a()})}function c(f,h=io.Normal){e.insert(f,h),a()}function l(f){i.length&&f&&i.forEach(h=>h.add(f))}async function u(f,h){try{let{query:d,type:p,cache:m=!1,record:y=!0,options:g}=f,b=d?`${d}`:null;if(y&&l(b),m){let v=n.get(b);if(v){r.debug("Cache"),h.fulfill(v);return}}let x=performance.now(),w=await t.query({type:p,sql:b,...g});m&&n.set(b,w),r.debug(`Request: ${(performance.now()-x).toFixed(1)}`),h.fulfill(w)}catch(d){h.reject(d)}}return{cache(f){return f!==void 0?n=f===!0?U6():f||$6():n},logger(f){return f?r=f:r},connector(f){return f?t=f:t},consolidate(f){f&&!s?s=R6(c,n,l):!f&&s&&(s=null)},request(f,h=io.Normal){let d=L0(),p={request:f,result:d};return s?s.add(p,h):c(p,h),d},cancel(f){let h=new Set(f);e.remove(({result:d})=>h.has(d))},clear(){e.remove(({result:f})=>(f.reject("Cleared"),!0))},record(){let f=[],h={add(d){f.push(d)},reset(){f=[]},snapshot(){return f.slice()},stop(){return i=i.filter(d=>d!==h),f}};return i.push(h),h}}}function G_(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":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":case"JSON":return"string";case"ARRAY":case"LIST":return"array";case"BLOB":case"STRUCT":case"MAP":case"GEOMETRY":return"object";default:if(e.startsWith("DECIMAL"))return"number";if(e.startsWith("STRUCT")||e.startsWith("MAP"))return"object";if(e.endsWith("]"))return"array";throw new Error(`Unsupported type: ${e}`)}}function fd(e){return typeof e?.getChild=="function"}function X_(e){if(X.isTimestamp(e))return t=>t==null?t:new Date(t);if(X.isInt(e)&&e.bitWidth>=64)return t=>t==null?t:Number(t);if(X.isDecimal(e)){let t=1/Math.pow(10,e.scale);return n=>n==null?n:V6(n,t)}return t=>t}function H_(e){let{type:t}=e;if(X.isTimestamp(t)){let n=e.length,r=new Array(n);for(let i=0;i<n;++i){let o=e.get(i);r[i]=o==null?null:new Date(o)}return r}if(X.isInt(t)&&t.bitWidth>=64){let n=e.length,r=new Float64Array(n);for(let i=0;i<n;++i){let o=e.get(i);r[i]=o==null?NaN:Number(o)}return r}if(X.isDecimal(t)){let n=1/Math.pow(10,t.scale),r=e.length,i=new Float64Array(r);for(let o=0;o<r;++o){let s=e.get(o);i[o]=s==null?NaN:V6(s,n)}return i}return e.toArray()}var q6=Array.from({length:8},(e,t)=>Math.pow(2,t*32));function V6(e,t){let n=e.length,r=0;if(e.signed&&(e[n-1]|0)<0){for(let i=0;i<n;++i)r+=~e[i]*q6[i];r=-(r+1)}else for(let i=0;i<n;++i)r+=e[i]*q6[i];return r*t}var TR="count",ER="nulls",DR="max",NR="min",BR="distinct";var OR={[TR]:Ii,[BR]:e=>Ii(e).distinct(),[DR]:oa,[NR]:sa,[ER]:e=>Ii().where(sd(e))};function LR(e,t,n){return Ft.from(e).select(Array.from(n,r=>[r,OR[r](t)]))}async function j6(e,t){return t.length===1&&`${t[0].column}`=="*"?CR(e,t[0].table):(await Promise.all(t.map(n=>FR(e,n)))).filter(n=>n)}async function FR(e,{table:t,column:n,stats:r}){let i=Ft.from({source:t}).select({column:n}).groupby(n.aggregate?q`ALL`:[]),[o]=Array.from(await e.query(Ft.describe(i))),s={table:t,column:`${n}`,sqlType:o.column_type,type:G_(o.column_type),nullable:o.null==="YES"};if(!(r?.length||r?.size))return s;let a=await e.query(LR(t,n,r),{persist:!0});for(let c=0;c<a.numCols;++c){let{name:l}=a.schema.fields[c],u=a.getChildAt(c),f=X_(u.type);s[l]=f(u.get(0))}return s}async function CR(e,t){let n=await e.query(`DESCRIBE ${pc(t)}`);return Array.from(n).map(r=>({table:t,column:r.column_name,sqlType:r.column_type,type:G_(r.column_type),nullable:r.null==="YES"}))}function Y6(){return{debug(){},info(){},log(){},warn(){},error(){}}}var F0;function Z_(e){return e?F0=e:F0==null&&(F0=new C0),F0}var C0=class{constructor(t=B_(),n={}){let{logger:r=console,manager:i=z6()}=n;this.manager=i,this.logger(r),this.configure(n),this.databaseConnector(t),this.clear()}logger(t){return arguments.length&&(this._logger=t||Y6(),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}={}){this.manager.clear(),t&&(this.clients?.forEach(r=>this.disconnect(r)),this.filterGroups?.forEach(r=>r.finalize()),this.clients=new Set,this.filterGroups=new Map),n&&this.manager.cache().clear()}databaseConnector(t){return this.manager.connector(t)}cancel(t){this.manager.cancel(t)}exec(t,{priority:n=io.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=io.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:io.Low})}createBundle(t,n,r=io.Low){let i={name:t,queries:n};return this.manager.request({type:"create-bundle",options:i},r)}loadBundle(t,n=io.High){let r={name:t};return this.manager.request({type:"load-bundle",options:r},n)}updateClient(t,n,r=io.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{clients:n,filterGroups:r,indexes:i}=this;if(n.has(t))throw new Error("Client already connected.");n.add(t),t.coordinator=this;let o=t.fields();o?.length&&t.fieldInfo(await j6(this,o));let s=t.filterBy;if(s)if(r.has(s))r.get(s).add(t);else{let a=new O0(this,s,i);r.set(s,a.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 k0=class{constructor(){this._callbacks=new Map}addEventListener(t,n){this._callbacks.has(t)||this._callbacks.set(t,{callbacks:new Set,pending:null,queue:new K_}),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(t,n){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=Array.from(o,c=>c(i));r.pending=Promise.allSettled(a).then(()=>{r.pending=null,s.isEmpty()||this.emit(t,s.dequeue())})}}}},K_=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 hd(e,t){return e===t?!1:e instanceof Date&&t instanceof Date?+e!=+t:Array.isArray(e)&&Array.isArray(t)?kR(e,t):!0}function kR(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 Xl(e){return e instanceof Hl}var Hl=class e extends k0{constructor(t){super(),this._value=t}static value(t){return new e(t)}static array(t){if(t.some(n=>Xl(n))){let n=new e,r=()=>{n.update(t.map(i=>Xl(i)?i.value:i))};return r(),t.forEach(i=>Xl(i)?i.addEventListener("value",r):0),n}return new e(t)}get value(){return this._value}update(t,{force:n}={}){return hd(this._value,t)||n?this.emit("value",t):this.cancel("value"),this}willEmit(t,n){return t==="value"&&(this._value=n),n}};function Q_(e){return e instanceof _c}var _c=class e extends Hl{static intersect({cross:t=!1}={}){return new e(new wc({cross:t}))}static union({cross:t=!1}={}){return new e(new wc({cross:t,union:!0}))}static single({cross:t=!1}={}){return new e(new wc({cross:t,single:!0}))}static crossfilter(){return new e(new wc({cross:!0}))}constructor(t=new wc){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)}},wc=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?od(o):o}queueFilter(t){if(this.cross){let n=t.active?.source;return r=>r.active?.source!==n}return null}};function J_(){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 Xm={};Vs(Xm,{Area:()=>dl,Arrow:()=>Im,BarX:()=>Mm,BarY:()=>Am,Cell:()=>pl,Contour:()=>$m,Density:()=>zm,Dot:()=>ml,Frame:()=>ym,Geo:()=>qm,Hexgrid:()=>Vm,Image:()=>jm,Line:()=>yl,Link:()=>vm,Mark:()=>_t,Raster:()=>Fm,Rect:()=>bl,RuleX:()=>fm,RuleY:()=>hm,Text:()=>ul,TickX:()=>Nm,TickY:()=>Bm,Tip:()=>gm,Vector:()=>hl,area:()=>_m,areaX:()=>qa,areaY:()=>Us,arrow:()=>PB,auto:()=>KB,autoSpec:()=>_M,axisFx:()=>P1,axisFy:()=>U1,axisX:()=>pm,axisY:()=>dm,barX:()=>Co,barY:()=>ko,bin:()=>$s,binX:()=>Lo,binY:()=>Fo,bollinger:()=>Wa,bollingerX:()=>rO,bollingerY:()=>iO,boxX:()=>oO,boxY:()=>sO,cell:()=>Va,cellX:()=>qB,cellY:()=>VB,centroid:()=>nL,circle:()=>WB,cluster:()=>eL,column:()=>dn,contour:()=>mO,crosshair:()=>bO,crosshairX:()=>xO,crosshairY:()=>wO,delaunayLink:()=>SO,delaunayMesh:()=>IO,density:()=>DO,differenceY:()=>OO,dodgeX:()=>yL,dodgeY:()=>gL,dot:()=>ci,dotX:()=>jB,dotY:()=>YB,filter:()=>JD,find:()=>c5,formatIsoDate:()=>VI,formatMonth:()=>lN,formatWeekday:()=>uN,frame:()=>yf,geo:()=>uw,geoCentroid:()=>rL,graticule:()=>FO,gridFx:()=>j1,gridFy:()=>q1,gridX:()=>V1,gridY:()=>z1,group:()=>rm,groupX:()=>La,groupY:()=>Fa,groupZ:()=>nm,hexagon:()=>GB,hexbin:()=>CO,hexgrid:()=>kO,hull:()=>MO,identity:()=>W,image:()=>$O,indexOf:()=>Ie,initializer:()=>_e,interpolateNearest:()=>km,interpolateNone:()=>lw,interpolatorBarycentric:()=>Cm,interpolatorRandomWalk:()=>Rm,legend:()=>cB,line:()=>gl,lineX:()=>ja,lineY:()=>Ya,linearRegressionX:()=>zO,linearRegressionY:()=>qO,link:()=>tw,map:()=>yr,mapX:()=>Df,mapY:()=>Nf,marks:()=>Ke,normalize:()=>xw,normalizeX:()=>_L,normalizeY:()=>vL,plot:()=>xm,pointer:()=>ff,pointerX:()=>hf,pointerY:()=>sl,raster:()=>fO,rect:()=>Em,rectX:()=>Af,rectY:()=>Tf,reverse:()=>t5,ruleX:()=>Cr,ruleY:()=>kr,scale:()=>Ra,select:()=>IL,selectFirst:()=>GM,selectLast:()=>XM,selectMaxX:()=>TL,selectMaxY:()=>EL,selectMinX:()=>ML,selectMinY:()=>AL,shiftX:()=>SL,shuffle:()=>e5,sort:()=>i1,sphere:()=>LO,spike:()=>qN,stackX:()=>bM,stackX1:()=>BB,stackX2:()=>OB,stackY:()=>xM,stackY1:()=>LB,stackY2:()=>FB,text:()=>Oo,textX:()=>O1,textY:()=>L1,tickX:()=>sw,tickY:()=>aw,tip:()=>G1,transform:()=>pn,tree:()=>zM,treeLink:()=>mw,treeNode:()=>Ym,valueof:()=>bt,vector:()=>aM,vectorX:()=>k1,vectorY:()=>R1,voronoi:()=>AO,voronoiMesh:()=>TO,window:()=>Bf,windowX:()=>QB,windowY:()=>JB});function $t(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=$t,n=(a,c)=>$t(e(a),c),r=(a,c)=>e(a)-c):(t=e===$t||e===Yn?e:RR,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 RR(){return 0}function dd(e){return e===null?NaN:+e}function*W6(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 G6=is($t),X6=G6.right,$R=G6.left,UR=is(dd).center,os=X6;var pd=H6(Z6),tv=H6(PR);function H6(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?(Zl(a,l,i,o,s),Zl(a,i,l,o,s),Zl(a,l,i,o,s),Kl(c,i,l,o,s),Kl(c,l,i,o,s),Kl(c,i,l,o,s)):a?(Zl(a,i,l,o,s),Zl(a,l,i,o,s),Zl(a,i,l,o,s)):c&&(Kl(c,i,l,o,s),Kl(c,l,i,o,s),Kl(c,i,l,o,s)),t}}function Zl(e,t,n,r,i){for(let o=0,s=r*i;o<s;)e(t,n,o,o+=r,1)}function Kl(e,t,n,r,i){for(let o=0,s=r*i;o<r;++o)e(t,n,o,o+s,r)}function PR(e){let t=Z6(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 Z6(e){let t=Math.floor(e);if(t===e)return zR(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 h=s,d=s+u;h<d;h+=c)l+=o[Math.min(a,h)];for(let h=s,d=a;h<=d;h+=c)l+=o[Math.min(a,h+u)],i[h]=(l+n*(o[Math.max(s,h-f)]+o[Math.min(a,h+f)]))/r,l-=o[Math.max(s,h-u)]}}function zR(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 oo(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 qR(e){return e.length|0}function VR(e){return!(e>0)}function jR(e){return typeof e!="object"||"length"in e?e:Array.from(e)}function YR(e){return t=>e(...t)}function R0(...e){let t=typeof e[e.length-1]=="function"&&YR(e.pop());e=e.map(jR);let n=e.map(qR),r=e.length-1,i=new Array(r+1).fill(0),o=[];if(r<0||n.some(VR))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 $0(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 aa(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 Hr(e,t){let n=aa(e,t);return n&&Math.sqrt(n)}function se(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 Wn=class extends Map{constructor(t,n=J6){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(ev(this,t))}has(t){return super.has(ev(this,t))}set(t,n){return super.set(K6(this,t),n)}delete(t){return super.delete(Q6(this,t))}},Gn=class extends Set{constructor(t,n=J6){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(ev(this,t))}add(t){return super.add(K6(this,t))}delete(t){return super.delete(Q6(this,t))}};function ev({_intern:e,_key:t},n){let r=t(n);return e.has(r)?e.get(r):n}function K6({_intern:e,_key:t},n){let r=t(n);return e.has(r)?e.get(r):(e.set(r,n),n)}function Q6({_intern:e,_key:t},n){let r=t(n);return e.has(r)&&(n=e.get(r),e.delete(r)),n}function J6(e){return e!==null&&typeof e=="object"?e.valueOf():e}function md(e){return e}function sn(e,...t){return rv(e,md,md,t)}function Ai(e,t,...n){return rv(e,md,t,n)}function nv(e,t,...n){return rv(e,Array.from,t,n)}function rv(e,t,n,r){return function i(o,s){if(s>=r.length)return n(o);let a=new Wn,c=r[s++],l=-1;for(let u of o){let f=c(u,++l,o),h=a.get(f);h?h.push(u):a.set(f,[u])}for(let[u,f]of a)a.set(u,i(f,s));return t(a)}(e,0)}function iv(e,t){return Array.from(t,n=>e[n])}function ss(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=vc(s[i],s[o]);if(a)return a}})):(n=e.map(n),r.sort((i,o)=>vc(n[i],n[o]))),iv(e,r)}return e.sort(yd(n))}function yd(e=$t){if(e===$t)return vc;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 vc(e,t){return(e==null||!(e>=e))-(t==null||!(t>=t))||(e<t?-1:e>t?1:0)}function Ql(e,t,n){return(t.length!==2?ss(Ai(e,t,n),([r,i],[o,s])=>$t(i,s)||$t(r,o)):ss(sn(e,n),([r,i],[o,s])=>t(i,s)||$t(r,o))).map(([r])=>r)}var WR=Math.sqrt(50),GR=Math.sqrt(10),XR=Math.sqrt(2);function U0(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>=WR?10:o>=GR?5:o>=XR?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?U0(e,t,n*2):[a,c,l]}function Sn(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?U0(t,e,n):U0(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,U0(e,t,n)[2]}function Jl(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 tu(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 ca(e){return Math.max(1,Math.ceil(Math.log(oo(e))/Math.LN2)+1)}function Yt(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 P0(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 ae(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 q0(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?vc:yd(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),h=.5*Math.sqrt(u*f*(c-f)/c)*(l-c/2<0?-1:1),d=Math.max(n,Math.floor(t-l*f/c+h)),p=Math.min(r,Math.floor(t+(c-l)*f/c+h));q0(e,t,d,p,i)}let o=e[t],s=n,a=r;for(gd(e,n,t),i(e[r],o)>0&&gd(e,n,r);s<a;){for(gd(e,s,a),++s,--a;i(e[s],o)<0;)++s;for(;i(e[a],o)>0;)--a}i(e[n],o)===0?gd(e,n,a):(++a,gd(e,a,r)),a<=t&&(n=a+1),t<=a&&(r=a-1)}return e}function gd(e,t,n){let r=e[t];e[t]=e[n],e[n]=r}function Sc(e,t=$t){let n,r=!1;if(t.length===1){let i;for(let o of e){let s=t(o);(r?$t(s,i)>0:$t(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 Xn(e,t,n){if(e=Float64Array.from(W6(e,n)),!(!(r=e.length)||isNaN(t=+t))){if(t<=0||r<2)return ae(e);if(t>=1)return Yt(e);var r,i=(r-1)*t,o=Math.floor(i),s=Yt(q0(e,o).subarray(0,o+1)),a=ae(e.subarray(o+1));return s+(a-s)*(i-o)}}function ov(e,t,n=dd){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 V0(e,t,n){let r=oo(e),i=Xn(e,.75)-Xn(e,.25);return r&&i?Math.ceil((n-t)/(2*i*Math.pow(r,-1/3))):1}function bd(e,t,n){let r=oo(e),i=Hr(e);return r&&i?Math.ceil((n-t)*Math.cbrt(r)/(3.49*i)):1}function cs(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 Ti(e,t){return Xn(e,.5,t)}function*ZR(e){for(let t of e)yield*t}function eu(e){return Array.from(ZR(e))}function nu(e,t){let n=new Wn;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=KR){let n=[],r,i=!1;for(let o of e)i&&n.push(t(r,o)),r=o,i=!0;return n}function KR(e,t){return[e,t]}function Re(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 xd(e,t=$t){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=$t);let i=(a,c)=>t(n[a],n[c]),o,s;return e=Uint32Array.from(n,(a,c)=>c),e.sort(t===$t?(a,c)=>vc(n[a],n[c]):yd(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 Y0(e,t=$t){let n,r=!1;if(t.length===1){let i;for(let o of e){let s=t(o);(r?$t(s,i)<0:$t(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 In(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 la(e){if(typeof e[Symbol.iterator]!="function")throw new TypeError("values is not iterable");return Array.from(e).reverse()}function tT(e){return e}var sv=1,av=2,cv=3,W0=4,eT=1e-6;function QR(e){return"translate("+e+",0)"}function JR(e){return"translate(0,"+e+")"}function t9(e){return t=>+e(t)}function e9(e,t){return t=Math.max(0,e.bandwidth()-t*2)/2,e.round()&&(t=Math.round(t)),n=>+e(n)+t}function n9(){return!this.__axis}function r9(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===sv||e===W0?-1:1,u=e===W0||e===av?"x":"y",f=e===sv||e===cv?QR:JR;function h(d){var p=r??(t.ticks?t.ticks.apply(t,n):t.domain()),m=i??(t.tickFormat?t.tickFormat.apply(t,n):tT),y=Math.max(o,0)+a,g=t.range(),b=+g[0]+c,x=+g[g.length-1]+c,w=(t.bandwidth?e9:t9)(t.copy(),c),v=d.selection?d.selection():d,_=v.selectAll(".domain").data([null]),M=v.selectAll(".tick").data(p,t).order(),E=M.exit(),I=M.enter().append("g").attr("class","tick"),N=M.select("line"),A=M.select("text");_=_.merge(_.enter().insert("path",".tick").attr("class","domain").attr("stroke","currentColor")),M=M.merge(I),N=N.merge(I.append("line").attr("stroke","currentColor").attr(u+"2",l*o)),A=A.merge(I.append("text").attr("fill","currentColor").attr(u,l*y).attr("dy",e===sv?"0em":e===cv?"0.71em":"0.32em")),d!==v&&(_=_.transition(d),M=M.transition(d),N=N.transition(d),A=A.transition(d),E=E.transition(d).attr("opacity",eT).attr("transform",function(B){return isFinite(B=w(B))?f(B+c):this.getAttribute("transform")}),I.attr("opacity",eT).attr("transform",function(B){var L=this.parentNode.__axis;return f((L&&isFinite(L=L(B))?L:w(B))+c)})),E.remove(),_.attr("d",e===W0||e===av?s?"M"+l*s+","+b+"H"+c+"V"+x+"H"+l*s:"M"+c+","+b+"V"+x:s?"M"+b+","+l*s+"V"+c+"H"+x+"V"+l*s:"M"+b+","+c+"H"+x),M.attr("opacity",1).attr("transform",function(B){return f(w(B)+c)}),N.attr(u+"2",l*o),A.attr(u,l*y).text(m),v.filter(n9).attr("fill","none").attr("font-size",10).attr("font-family","sans-serif").attr("text-anchor",e===av?"start":e===W0?"end":"middle"),v.each(function(){this.__axis=w})}return h.scale=function(d){return arguments.length?(t=d,h):t},h.ticks=function(){return n=Array.from(arguments),h},h.tickArguments=function(d){return arguments.length?(n=d==null?[]:Array.from(d),h):n.slice()},h.tickValues=function(d){return arguments.length?(r=d==null?null:Array.from(d),h):r&&r.slice()},h.tickFormat=function(d){return arguments.length?(i=d,h):i},h.tickSize=function(d){return arguments.length?(o=s=+d,h):o},h.tickSizeInner=function(d){return arguments.length?(o=+d,h):o},h.tickSizeOuter=function(d){return arguments.length?(s=+d,h):s},h.tickPadding=function(d){return arguments.length?(a=+d,h):a},h.offset=function(d){return arguments.length?(c=+d,h):c},h}function lv(e){return r9(cv,e)}var i9={value:()=>{}};function rT(){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 G0(n)}function G0(e){this._=e}function o9(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}})}G0.prototype=rT.prototype={constructor:G0,on:function(e,t){var n=this._,r=o9(e+"",n),i,o=-1,s=r.length;if(arguments.length<2){for(;++o<s;)if((i=(e=r[o]).type)&&(i=s9(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]=nT(n[i],e.name,t);else if(t==null)for(i in n)n[i]=nT(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 G0(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 s9(e,t){for(var n=0,r=e.length,i;n<r;++n)if((i=e[n]).name===t)return i.value}function nT(e,t,n){for(var r=0,i=e.length;r<i;++r)if(e[r].name===t){e[r]=i9,e=e.slice(0,r).concat(e.slice(r+1));break}return n!=null&&e.push({name:t,value:n}),e}var Ic=rT;var X0="http://www.w3.org/1999/xhtml",Zr={svg:"http://www.w3.org/2000/svg",xhtml:X0,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};function ls(e){var t=e+="",n=t.indexOf(":");return n>=0&&(t=e.slice(0,n))!=="xmlns"&&(e=e.slice(n+1)),Zr.hasOwnProperty(t)?{space:Zr[t],local:e}:e}function a9(e){return function(){var t=this.ownerDocument,n=this.namespaceURI;return n===X0&&t.documentElement.namespaceURI===X0?t.createElement(e):t.createElementNS(n,e)}}function c9(e){return function(){return this.ownerDocument.createElementNS(e.space,e.local)}}function us(e){var t=ls(e);return(t.local?c9:a9)(t)}function l9(){}function Mc(e){return e==null?l9:function(){return this.querySelector(e)}}function iT(e){typeof e!="function"&&(e=Mc(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 Fe(r,this._parents)}function uv(e){return e==null?[]:Array.isArray(e)?e:Array.from(e)}function u9(){return[]}function wd(e){return e==null?u9:function(){return this.querySelectorAll(e)}}function f9(e){return function(){return uv(e.apply(this,arguments))}}function oT(e){typeof e=="function"?e=f9(e):e=wd(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 Fe(r,i)}function _d(e){return function(){return this.matches(e)}}function H0(e){return function(t){return t.matches(e)}}var h9=Array.prototype.find;function d9(e){return function(){return h9.call(this.children,e)}}function p9(){return this.firstElementChild}function sT(e){return this.select(e==null?p9:d9(typeof e=="function"?e:H0(e)))}var m9=Array.prototype.filter;function y9(){return Array.from(this.children)}function g9(e){return function(){return m9.call(this.children,e)}}function aT(e){return this.selectAll(e==null?y9:g9(typeof e=="function"?e:H0(e)))}function cT(e){typeof e!="function"&&(e=_d(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 Fe(r,this._parents)}function Z0(e){return new Array(e.length)}function lT(){return new Fe(this._enter||this._groups.map(Z0),this._parents)}function vd(e,t){this.ownerDocument=e.ownerDocument,this.namespaceURI=e.namespaceURI,this._next=null,this._parent=e,this.__data__=t}vd.prototype={constructor:vd,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 uT(e){return function(){return e}}function b9(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 vd(e,o[s]);for(;s<c;++s)(a=t[s])&&(i[s]=a)}function x9(e,t,n,r,i,o,s){var a,c,l=new Map,u=t.length,f=o.length,h=new Array(u),d;for(a=0;a<u;++a)(c=t[a])&&(h[a]=d=s.call(c,c.__data__,a,t)+"",l.has(d)?i[a]=c:l.set(d,c));for(a=0;a<f;++a)d=s.call(e,o[a],a,o)+"",(c=l.get(d))?(r[a]=c,c.__data__=o[a],l.delete(d)):n[a]=new vd(e,o[a]);for(a=0;a<u;++a)(c=t[a])&&l.get(h[a])===c&&(i[a]=c)}function w9(e){return e.__data__}function fT(e,t){if(!arguments.length)return Array.from(this,w9);var n=t?x9:b9,r=this._parents,i=this._groups;typeof e!="function"&&(e=uT(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],h=f.length,d=_9(e.call(u,u&&u.__data__,l,r)),p=d.length,m=a[l]=new Array(p),y=s[l]=new Array(p),g=c[l]=new Array(h);n(u,f,m,y,g,d,t);for(var b=0,x=0,w,v;b<p;++b)if(w=m[b]){for(b>=x&&(x=b+1);!(v=y[x])&&++x<p;);w._next=v||null}}return s=new Fe(s,r),s._enter=a,s._exit=c,s}function _9(e){return typeof e=="object"&&"length"in e?e:Array.from(e)}function hT(){return new Fe(this._exit||this._groups.map(Z0),this._parents)}function dT(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 pT(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,h=a[c]=new Array(f),d,p=0;p<f;++p)(d=l[p]||u[p])&&(h[p]=d);for(;c<i;++c)a[c]=n[c];return new Fe(a,this._parents)}function mT(){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 yT(e){e||(e=v9);function t(f,h){return f&&h?e(f.__data__,h.__data__):!f-!h}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 Fe(i,this._parents).order()}function v9(e,t){return e<t?-1:e>t?1:e>=t?0:NaN}function gT(){var e=arguments[0];return arguments[0]=this,e.apply(null,arguments),this}function bT(){return Array.from(this)}function xT(){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 wT(){let e=0;for(let t of this)++e;return e}function _T(){return!this.node()}function vT(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 S9(e){return function(){this.removeAttribute(e)}}function I9(e){return function(){this.removeAttributeNS(e.space,e.local)}}function M9(e,t){return function(){this.setAttribute(e,t)}}function A9(e,t){return function(){this.setAttributeNS(e.space,e.local,t)}}function T9(e,t){return function(){var n=t.apply(this,arguments);n==null?this.removeAttribute(e):this.setAttribute(e,n)}}function E9(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 ST(e,t){var n=ls(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?I9:S9:typeof t=="function"?n.local?E9:T9:n.local?A9:M9)(n,t))}function K0(e){return e.ownerDocument&&e.ownerDocument.defaultView||e.document&&e||e.defaultView}function D9(e){return function(){this.style.removeProperty(e)}}function N9(e,t,n){return function(){this.style.setProperty(e,t,n)}}function B9(e,t,n){return function(){var r=t.apply(this,arguments);r==null?this.style.removeProperty(e):this.style.setProperty(e,r,n)}}function IT(e,t,n){return arguments.length>1?this.each((t==null?D9:typeof t=="function"?B9:N9)(e,t,n??"")):ua(this.node(),e)}function ua(e,t){return e.style.getPropertyValue(t)||K0(e).getComputedStyle(e,null).getPropertyValue(t)}function O9(e){return function(){delete this[e]}}function L9(e,t){return function(){this[e]=t}}function F9(e,t){return function(){var n=t.apply(this,arguments);n==null?delete this[e]:this[e]=n}}function MT(e,t){return arguments.length>1?this.each((t==null?O9:typeof t=="function"?F9:L9)(e,t)):this.node()[e]}function AT(e){return e.trim().split(/^|\s+/)}function fv(e){return e.classList||new TT(e)}function TT(e){this._node=e,this._names=AT(e.getAttribute("class")||"")}TT.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 ET(e,t){for(var n=fv(e),r=-1,i=t.length;++r<i;)n.add(t[r])}function DT(e,t){for(var n=fv(e),r=-1,i=t.length;++r<i;)n.remove(t[r])}function C9(e){return function(){ET(this,e)}}function k9(e){return function(){DT(this,e)}}function R9(e,t){return function(){(t.apply(this,arguments)?ET:DT)(this,e)}}function NT(e,t){var n=AT(e+"");if(arguments.length<2){for(var r=fv(this.node()),i=-1,o=n.length;++i<o;)if(!r.contains(n[i]))return!1;return!0}return this.each((typeof t=="function"?R9:t?C9:k9)(n,t))}function $9(){this.textContent=""}function U9(e){return function(){this.textContent=e}}function P9(e){return function(){var t=e.apply(this,arguments);this.textContent=t??""}}function BT(e){return arguments.length?this.each(e==null?$9:(typeof e=="function"?P9:U9)(e)):this.node().textContent}function z9(){this.innerHTML=""}function q9(e){return function(){this.innerHTML=e}}function V9(e){return function(){var t=e.apply(this,arguments);this.innerHTML=t??""}}function OT(e){return arguments.length?this.each(e==null?z9:(typeof e=="function"?V9:q9)(e)):this.node().innerHTML}function j9(){this.nextSibling&&this.parentNode.appendChild(this)}function LT(){return this.each(j9)}function Y9(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function FT(){return this.each(Y9)}function CT(e){var t=typeof e=="function"?e:us(e);return this.select(function(){return this.appendChild(t.apply(this,arguments))})}function W9(){return null}function kT(e,t){var n=typeof e=="function"?e:us(e),r=t==null?W9:typeof t=="function"?t:Mc(t);return this.select(function(){return this.insertBefore(n.apply(this,arguments),r.apply(this,arguments)||null)})}function G9(){var e=this.parentNode;e&&e.removeChild(this)}function RT(){return this.each(G9)}function X9(){var e=this.cloneNode(!1),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function H9(){var e=this.cloneNode(!0),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function $T(e){return this.select(e?H9:X9)}function UT(e){return arguments.length?this.property("__data__",e):this.node().__data__}function Z9(e){return function(t){e.call(this,t,this.__data__)}}function K9(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 Q9(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 J9(e,t,n){return function(){var r=this.__on,i,o=Z9(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 PT(e,t,n){var r=K9(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?J9:Q9,i=0;i<o;++i)this.each(a(r[i],t,n));return this}function zT(e,t,n){var r=K0(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 t$(e,t){return function(){return zT(this,e,t)}}function e$(e,t){return function(){return zT(this,e,t.apply(this,arguments))}}function qT(e,t){return this.each((typeof t=="function"?e$:t$)(e,t))}function*VT(){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 hv=[null];function Fe(e,t){this._groups=e,this._parents=t}function jT(){return new Fe([[document.documentElement]],hv)}function n$(){return this}Fe.prototype=jT.prototype={constructor:Fe,select:iT,selectAll:oT,selectChild:sT,selectChildren:aT,filter:cT,data:fT,enter:lT,exit:hT,join:dT,merge:pT,selection:n$,order:mT,sort:yT,call:gT,nodes:bT,node:xT,size:wT,empty:_T,each:vT,attr:ST,style:IT,property:MT,classed:NT,text:BT,html:OT,raise:LT,lower:FT,append:CT,insert:kT,remove:RT,clone:$T,datum:UT,on:PT,dispatch:qT,[Symbol.iterator]:VT};var fs=jT;function Pt(e){return typeof e=="string"?new Fe([[document.querySelector(e)]],[document.documentElement]):new Fe([[e]],hv)}function YT(e){let t;for(;t=e.sourceEvent;)e=t;return e}function On(e,t){if(e=YT(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 Q0={capture:!0,passive:!1};function J0(e){e.preventDefault(),e.stopImmediatePropagation()}function Sd(e){var t=e.document.documentElement,n=Pt(e).on("dragstart.drag",J0,Q0);"onselectstart"in t?n.on("selectstart.drag",J0,Q0):(t.__noselect=t.style.MozUserSelect,t.style.MozUserSelect="none")}function Id(e,t){var n=e.document.documentElement,r=Pt(e).on("dragstart.drag",null);t&&(r.on("click.drag",J0,Q0),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 hs(e,t,n){e.prototype=t.prototype=n,n.constructor=e}function fa(e,t){var n=Object.create(e.prototype);for(var r in t)n[r]=t[r];return n}function ao(){}var ha=.7,Ec=1/ha,ru="\\s*([+-]?\\d+)\\s*",Md="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",so="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",r$=/^#([0-9a-f]{3,8})$/,i$=new RegExp(`^rgb\\(${ru},${ru},${ru}\\)$`),o$=new RegExp(`^rgb\\(${so},${so},${so}\\)$`),s$=new RegExp(`^rgba\\(${ru},${ru},${ru},${Md}\\)$`),a$=new RegExp(`^rgba\\(${so},${so},${so},${Md}\\)$`),c$=new RegExp(`^hsl\\(${Md},${so},${so}\\)$`),l$=new RegExp(`^hsla\\(${Md},${so},${so},${Md}\\)$`),WT={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};hs(ao,Tr,{copy(e){return Object.assign(new this.constructor,this,e)},displayable(){return this.rgb().displayable()},hex:GT,formatHex:GT,formatHex8:u$,formatHsl:f$,formatRgb:XT,toString:XT});function GT(){return this.rgb().formatHex()}function u$(){return this.rgb().formatHex8()}function f$(){return t4(this).formatHsl()}function XT(){return this.rgb().formatRgb()}function Tr(e){var t,n;return e=(e+"").trim().toLowerCase(),(t=r$.exec(e))?(n=t[1].length,t=parseInt(t[1],16),n===6?HT(t):n===3?new je(t>>8&15|t>>4&240,t>>4&15|t&240,(t&15)<<4|t&15,1):n===8?tg(t>>24&255,t>>16&255,t>>8&255,(t&255)/255):n===4?tg(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=i$.exec(e))?new je(t[1],t[2],t[3],1):(t=o$.exec(e))?new je(t[1]*255/100,t[2]*255/100,t[3]*255/100,1):(t=s$.exec(e))?tg(t[1],t[2],t[3],t[4]):(t=a$.exec(e))?tg(t[1]*255/100,t[2]*255/100,t[3]*255/100,t[4]):(t=c$.exec(e))?QT(t[1],t[2]/100,t[3]/100,1):(t=l$.exec(e))?QT(t[1],t[2]/100,t[3]/100,t[4]):WT.hasOwnProperty(e)?HT(WT[e]):e==="transparent"?new je(NaN,NaN,NaN,0):null}function HT(e){return new je(e>>16&255,e>>8&255,e&255,1)}function tg(e,t,n,r){return r<=0&&(e=t=n=NaN),new je(e,t,n,r)}function Ad(e){return e instanceof ao||(e=Tr(e)),e?(e=e.rgb(),new je(e.r,e.g,e.b,e.opacity)):new je}function tn(e,t,n,r){return arguments.length===1?Ad(e):new je(e,t,n,r??1)}function je(e,t,n,r){this.r=+e,this.g=+t,this.b=+n,this.opacity=+r}hs(je,tn,fa(ao,{brighter(e){return e=e==null?Ec:Math.pow(Ec,e),new je(this.r*e,this.g*e,this.b*e,this.opacity)},darker(e){return e=e==null?ha:Math.pow(ha,e),new je(this.r*e,this.g*e,this.b*e,this.opacity)},rgb(){return this},clamp(){return new je(Tc(this.r),Tc(this.g),Tc(this.b),ng(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:ZT,formatHex:ZT,formatHex8:h$,formatRgb:KT,toString:KT}));function ZT(){return`#${Ac(this.r)}${Ac(this.g)}${Ac(this.b)}`}function h$(){return`#${Ac(this.r)}${Ac(this.g)}${Ac(this.b)}${Ac((isNaN(this.opacity)?1:this.opacity)*255)}`}function KT(){let e=ng(this.opacity);return`${e===1?"rgb(":"rgba("}${Tc(this.r)}, ${Tc(this.g)}, ${Tc(this.b)}${e===1?")":`, ${e})`}`}function ng(e){return isNaN(e)?1:Math.max(0,Math.min(1,e))}function Tc(e){return Math.max(0,Math.min(255,Math.round(e)||0))}function Ac(e){return e=Tc(e),(e<16?"0":"")+e.toString(16)}function QT(e,t,n,r){return r<=0?e=t=n=NaN:n<=0||n>=1?e=t=NaN:t<=0&&(e=NaN),new Ei(e,t,n,r)}function t4(e){if(e instanceof Ei)return new Ei(e.h,e.s,e.l,e.opacity);if(e instanceof ao||(e=Tr(e)),!e)return new Ei;if(e instanceof Ei)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 Ei(s,a,c,e.opacity)}function Td(e,t,n,r){return arguments.length===1?t4(e):new Ei(e,t,n,r??1)}function Ei(e,t,n,r){this.h=+e,this.s=+t,this.l=+n,this.opacity=+r}hs(Ei,Td,fa(ao,{brighter(e){return e=e==null?Ec:Math.pow(Ec,e),new Ei(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=e==null?ha:Math.pow(ha,e),new Ei(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 je(dv(e>=240?e-240:e+120,i,r),dv(e,i,r),dv(e<120?e+240:e-120,i,r),this.opacity)},clamp(){return new Ei(JT(this.h),eg(this.s),eg(this.l),ng(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=ng(this.opacity);return`${e===1?"hsl(":"hsla("}${JT(this.h)}, ${eg(this.s)*100}%, ${eg(this.l)*100}%${e===1?")":`, ${e})`}`}}));function JT(e){return e=(e||0)%360,e<0?e+360:e}function eg(e){return Math.max(0,Math.min(1,e||0))}function dv(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 rg=Math.PI/180,ig=180/Math.PI;var og=18,e4=.96422,n4=1,r4=.82521,i4=4/29,iu=6/29,o4=3*iu*iu,d$=iu*iu*iu;function s4(e){if(e instanceof co)return new co(e.l,e.a,e.b,e.opacity);if(e instanceof ds)return a4(e);e instanceof je||(e=Ad(e));var t=gv(e.r),n=gv(e.g),r=gv(e.b),i=pv((.2225045*t+.7168786*n+.0606169*r)/n4),o,s;return t===n&&n===r?o=s=i:(o=pv((.4360747*t+.3850649*n+.1430804*r)/e4),s=pv((.0139322*t+.0971045*n+.7141733*r)/r4)),new co(116*i-16,500*(o-i),200*(i-s),e.opacity)}function ou(e,t,n,r){return arguments.length===1?s4(e):new co(e,t,n,r??1)}function co(e,t,n,r){this.l=+e,this.a=+t,this.b=+n,this.opacity=+r}hs(co,ou,fa(ao,{brighter(e){return new co(this.l+og*(e??1),this.a,this.b,this.opacity)},darker(e){return new co(this.l-og*(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=e4*mv(t),e=n4*mv(e),n=r4*mv(n),new je(yv(3.1338561*t-1.6168667*e-.4906146*n),yv(-.9787684*t+1.9161415*e+.033454*n),yv(.0719453*t-.2289914*e+1.4052427*n),this.opacity)}}));function pv(e){return e>d$?Math.pow(e,1/3):e/o4+i4}function mv(e){return e>iu?e*e*e:o4*(e-i4)}function yv(e){return 255*(e<=.0031308?12.92*e:1.055*Math.pow(e,1/2.4)-.055)}function gv(e){return(e/=255)<=.04045?e/12.92:Math.pow((e+.055)/1.055,2.4)}function p$(e){if(e instanceof ds)return new ds(e.h,e.c,e.l,e.opacity);if(e instanceof co||(e=s4(e)),e.a===0&&e.b===0)return new ds(NaN,0<e.l&&e.l<100?0:NaN,e.l,e.opacity);var t=Math.atan2(e.b,e.a)*ig;return new ds(t<0?t+360:t,Math.sqrt(e.a*e.a+e.b*e.b),e.l,e.opacity)}function Ed(e,t,n,r){return arguments.length===1?p$(e):new ds(e,t,n,r??1)}function ds(e,t,n,r){this.h=+e,this.c=+t,this.l=+n,this.opacity=+r}function a4(e){if(isNaN(e.h))return new co(e.l,0,0,e.opacity);var t=e.h*rg;return new co(e.l,Math.cos(t)*e.c,Math.sin(t)*e.c,e.opacity)}hs(ds,Ed,fa(ao,{brighter(e){return new ds(this.h,this.c,this.l+og*(e??1),this.opacity)},darker(e){return new ds(this.h,this.c,this.l-og*(e??1),this.opacity)},rgb(){return a4(this).rgb()}}));var f4=-.14861,bv=1.78277,xv=-.29227,sg=-.90649,Dd=1.97294,c4=Dd*sg,l4=Dd*bv,u4=bv*xv-sg*f4;function m$(e){if(e instanceof Dc)return new Dc(e.h,e.s,e.l,e.opacity);e instanceof je||(e=Ad(e));var t=e.r/255,n=e.g/255,r=e.b/255,i=(u4*r+c4*t-l4*n)/(u4+c4-l4),o=r-i,s=(Dd*(n-i)-xv*o)/sg,a=Math.sqrt(s*s+o*o)/(Dd*i*(1-i)),c=a?Math.atan2(s,o)*ig-120:NaN;return new Dc(c<0?c+360:c,a,i,e.opacity)}function Hn(e,t,n,r){return arguments.length===1?m$(e):new Dc(e,t,n,r??1)}function Dc(e,t,n,r){this.h=+e,this.s=+t,this.l=+n,this.opacity=+r}hs(Dc,Hn,fa(ao,{brighter(e){return e=e==null?Ec:Math.pow(Ec,e),new Dc(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=e==null?ha:Math.pow(ha,e),new Dc(this.h,this.s,this.l*e,this.opacity)},rgb(){var e=isNaN(this.h)?0:(this.h+120)*rg,t=+this.l,n=isNaN(this.s)?0:this.s*t*(1-t),r=Math.cos(e),i=Math.sin(e);return new je(255*(t+n*(f4*r+bv*i)),255*(t+n*(xv*r+sg*i)),255*(t+n*(Dd*r)),this.opacity)}}));function wv(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 h4(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 wv((n-r/t)*t,s,i,o,a)}}function d4(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 wv((n-r/t)*t,i,o,s,a)}}var su=e=>()=>e;function p4(e,t){return function(n){return e+n*t}}function y$(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 au(e,t){var n=t-e;return n?p4(e,n>180||n<-180?n-360*Math.round(n/360):n):su(isNaN(e)?t:e)}function m4(e){return(e=+e)==1?Se:function(t,n){return n-t?y$(t,n,e):su(isNaN(t)?n:t)}}function Se(e,t){var n=t-e;return n?p4(e,n):su(isNaN(e)?t:e)}var Kr=function e(t){var n=m4(t);function r(i,o){var s=n((i=tn(i)).r,(o=tn(o)).r),a=n(i.g,o.g),c=n(i.b,o.b),l=Se(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 y4(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=tn(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 _v=y4(h4),g$=y4(d4);function g4(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 b4(e){return ArrayBuffer.isView(e)&&!(e instanceof DataView)}function x4(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]=Er(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 w4(e,t){var n=new Date;return e=+e,t=+t,function(r){return n.setTime(e*(1-r)+t*r),n}}function xe(e,t){return e=+e,t=+t,function(n){return e*(1-n)+t*n}}function _4(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]=Er(e[i],t[i]):r[i]=t[i];return function(o){for(i in n)r[i]=n[i](o);return r}}var Sv=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,vv=new RegExp(Sv.source,"g");function b$(e){return function(){return e}}function x$(e){return function(t){return e(t)+""}}function Nd(e,t){var n=Sv.lastIndex=vv.lastIndex=0,r,i,o,s=-1,a=[],c=[];for(e=e+"",t=t+"";(r=Sv.exec(e))&&(i=vv.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:xe(r,i)})),n=vv.lastIndex;return n<t.length&&(o=t.slice(n),a[s]?a[s]+=o:a[++s]=o),a.length<2?c[0]?x$(c[0].x):b$(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 Er(e,t){var n=typeof t,r;return t==null||n==="boolean"?su(t):(n==="number"?xe:n==="string"?(r=Tr(t))?(t=r,Kr):Nd:t instanceof Tr?Kr:t instanceof Date?w4:b4(t)?g4:Array.isArray(t)?x4:typeof t.valueOf!="function"&&typeof t.toString!="function"||isNaN(t)?_4:xe)(e,t)}function Nc(e,t){return e=+e,t=+t,function(n){return Math.round(e*(1-n)+t*n)}}var v4=180/Math.PI,ag={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1};function Iv(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)*v4,skewX:Math.atan(c)*v4,scaleX:s,scaleY:a}}var cg;function S4(e){let t=new(typeof DOMMatrix=="function"?DOMMatrix:WebKitCSSMatrix)(e+"");return t.isIdentity?ag:Iv(t.a,t.b,t.c,t.d,t.e,t.f)}function I4(e){return e==null?ag:(cg||(cg=document.createElementNS("http://www.w3.org/2000/svg","g")),cg.setAttribute("transform",e),(e=cg.transform.baseVal.consolidate())?(e=e.matrix,Iv(e.a,e.b,e.c,e.d,e.e,e.f)):ag)}function M4(e,t,n,r){function i(l){return l.length?l.pop()+" ":""}function o(l,u,f,h,d,p){if(l!==f||u!==h){var m=d.push("translate(",null,t,null,n);p.push({i:m-4,x:xe(l,f)},{i:m-2,x:xe(u,h)})}else(f||h)&&d.push("translate("+f+t+h+n)}function s(l,u,f,h){l!==u?(l-u>180?u+=360:u-l>180&&(l+=360),h.push({i:f.push(i(f)+"rotate(",null,r)-2,x:xe(l,u)})):u&&f.push(i(f)+"rotate("+u+r)}function a(l,u,f,h){l!==u?h.push({i:f.push(i(f)+"skewX(",null,r)-2,x:xe(l,u)}):u&&f.push(i(f)+"skewX("+u+r)}function c(l,u,f,h,d,p){if(l!==f||u!==h){var m=d.push(i(d)+"scale(",null,",",null,")");p.push({i:m-4,x:xe(l,f)},{i:m-2,x:xe(u,h)})}else(f!==1||h!==1)&&d.push(i(d)+"scale("+f+","+h+")")}return function(l,u){var f=[],h=[];return l=e(l),u=e(u),o(l.translateX,l.translateY,u.translateX,u.translateY,f,h),s(l.rotate,u.rotate,f,h),a(l.skewX,u.skewX,f,h),c(l.scaleX,l.scaleY,u.scaleX,u.scaleY,f,h),l=u=null,function(d){for(var p=-1,m=h.length,y;++p<m;)f[(y=h[p]).i]=y.x(d);return f.join("")}}}var Mv=M4(S4,"px, ","px)","deg)"),Av=M4(I4,", ",")",")");var w$=1e-12;function A4(e){return((e=Math.exp(e))+1/e)/2}function _$(e){return((e=Math.exp(e))-1/e)/2}function v$(e){return((e=Math.exp(2*e))-1)/(e+1)}var Tv=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],h=s[2],d=u-a,p=f-c,m=d*d+p*p,y,g;if(m<w$)g=Math.log(h/l)/t,y=function(M){return[a+M*d,c+M*p,l*Math.exp(t*M*g)]};else{var b=Math.sqrt(m),x=(h*h-l*l+r*m)/(2*l*n*b),w=(h*h-l*l-r*m)/(2*h*n*b),v=Math.log(Math.sqrt(x*x+1)-x),_=Math.log(Math.sqrt(w*w+1)-w);g=(_-v)/t,y=function(M){var E=M*g,I=A4(v),N=l/(n*b)*(I*v$(t*E+v)-_$(v));return[a+N*d,c+N*p,l*I/A4(t*E+v)]}}return y.duration=g*1e3*t/Math.SQRT2,y}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 T4(e){return function(t,n){var r=e((t=Td(t)).h,(n=Td(n)).h),i=Se(t.s,n.s),o=Se(t.l,n.l),s=Se(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 Ev=T4(au),S$=T4(Se);function lg(e,t){var n=Se((e=ou(e)).l,(t=ou(t)).l),r=Se(e.a,t.a),i=Se(e.b,t.b),o=Se(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 E4(e){return function(t,n){var r=e((t=Ed(t)).h,(n=Ed(n)).h),i=Se(t.c,n.c),o=Se(t.l,n.l),s=Se(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 Dv=E4(au),I$=E4(Se);function D4(e){return function t(n){n=+n;function r(i,o){var s=e((i=Hn(i)).h,(o=Hn(o)).h),a=Se(i.s,o.s),c=Se(i.l,o.l),l=Se(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 M$=D4(au),cu=D4(Se);function lo(e,t){t===void 0&&(t=e,e=Er);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 lu=0,Od=0,Bd=0,B4=1e3,ug,Ld,fg=0,Bc=0,hg=0,Fd=typeof performance=="object"&&performance.now?performance:Date,O4=typeof window=="object"&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(e){setTimeout(e,17)};function kd(){return Bc||(O4(A$),Bc=Fd.now()+hg)}function A$(){Bc=0}function Cd(){this._call=this._time=this._next=null}Cd.prototype=dg.prototype={constructor:Cd,restart:function(e,t,n){if(typeof e!="function")throw new TypeError("callback is not a function");n=(n==null?kd():+n)+(t==null?0:+t),!this._next&&Ld!==this&&(Ld?Ld._next=this:ug=this,Ld=this),this._call=e,this._time=n,Nv()},stop:function(){this._call&&(this._call=null,this._time=1/0,Nv())}};function dg(e,t,n){var r=new Cd;return r.restart(e,t,n),r}function L4(){kd(),++lu;for(var e=ug,t;e;)(t=Bc-e._time)>=0&&e._call.call(void 0,t),e=e._next;--lu}function N4(){Bc=(fg=Fd.now())+hg,lu=Od=0;try{L4()}finally{lu=0,E$(),Bc=0}}function T$(){var e=Fd.now(),t=e-fg;t>B4&&(hg-=t,fg=e)}function E$(){for(var e,t=ug,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:ug=n);Ld=e,Nv(r)}function Nv(e){if(!lu){Od&&(Od=clearTimeout(Od));var t=e-Bc;t>24?(e<1/0&&(Od=setTimeout(N4,e-Fd.now()-hg)),Bd&&(Bd=clearInterval(Bd))):(Bd||(fg=Fd.now(),Bd=setInterval(T$,B4)),lu=1,O4(N4))}}function pg(e,t,n){var r=new Cd;return t=t==null?0:+t,r.restart(i=>{r.stop(),e(i+t)},t,n),r}var D$=Ic("start","end","cancel","interrupt"),N$=[],k4=0,F4=1,yg=2,mg=3,C4=4,gg=5,Rd=6;function da(e,t,n,r,i,o){var s=e.__transition;if(!s)e.__transition={};else if(n in s)return;B$(e,n,{name:t,index:r,group:i,on:D$,tween:N$,time:o.time,delay:o.delay,duration:o.duration,ease:o.ease,timer:null,state:k4})}function $d(e,t){var n=en(e,t);if(n.state>k4)throw new Error("too late; already scheduled");return n}function Mn(e,t){var n=en(e,t);if(n.state>mg)throw new Error("too late; already running");return n}function en(e,t){var n=e.__transition;if(!n||!(n=n[t]))throw new Error("transition not found");return n}function B$(e,t,n){var r=e.__transition,i;r[t]=n,n.timer=dg(o,0,n.time);function o(l){n.state=F4,n.timer.restart(s,n.delay,n.time),n.delay<=l&&s(l-n.delay)}function s(l){var u,f,h,d;if(n.state!==F4)return c();for(u in r)if(d=r[u],d.name===n.name){if(d.state===mg)return pg(s);d.state===C4?(d.state=Rd,d.timer.stop(),d.on.call("interrupt",e,e.__data__,d.index,d.group),delete r[u]):+u<t&&(d.state=Rd,d.timer.stop(),d.on.call("cancel",e,e.__data__,d.index,d.group),delete r[u])}if(pg(function(){n.state===mg&&(n.state=C4,n.timer.restart(a,n.delay,n.time),a(l))}),n.state=yg,n.on.call("start",e,e.__data__,n.index,n.group),n.state===yg){for(n.state=mg,i=new Array(h=n.tween.length),u=0,f=-1;u<h;++u)(d=n.tween[u].value.call(e,e.__data__,n.index,n.group))&&(i[++f]=d);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=gg,1),f=-1,h=i.length;++f<h;)i[f].call(e,u);n.state===gg&&(n.on.call("end",e,e.__data__,n.index,n.group),c())}function c(){n.state=Rd,n.timer.stop(),delete r[t];for(var l in r)return;delete e.__transition}}function uo(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>yg&&r.state<gg,r.state=Rd,r.timer.stop(),r.on.call(i?"interrupt":"cancel",e,e.__data__,r.index,r.group),delete n[s]}o&&delete e.__transition}}function R4(e){return this.each(function(){uo(this,e)})}function O$(e,t){var n,r;return function(){var i=Mn(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 L$(e,t,n){var r,i;if(typeof n!="function")throw new Error;return function(){var o=Mn(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 $4(e,t){var n=this._id;if(e+="",arguments.length<2){for(var r=en(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?O$:L$)(n,e,t))}function uu(e,t,n){var r=e._id;return e.each(function(){var i=Mn(this,r);(i.value||(i.value={}))[t]=n.apply(this,arguments)}),function(i){return en(i,r).value[t]}}function bg(e,t){var n;return(typeof t=="number"?xe:t instanceof Tr?Kr:(n=Tr(t))?(t=n,Kr):Nd)(e,t)}function F$(e){return function(){this.removeAttribute(e)}}function C$(e){return function(){this.removeAttributeNS(e.space,e.local)}}function k$(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 R$(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 $$(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 U$(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 U4(e,t){var n=ls(e),r=n==="transform"?Av:bg;return this.attrTween(e,typeof t=="function"?(n.local?U$:$$)(n,r,uu(this,"attr."+e,t)):t==null?(n.local?C$:F$)(n):(n.local?R$:k$)(n,r,t))}function P$(e,t){return function(n){this.setAttribute(e,t.call(this,n))}}function z$(e,t){return function(n){this.setAttributeNS(e.space,e.local,t.call(this,n))}}function q$(e,t){var n,r;function i(){var o=t.apply(this,arguments);return o!==r&&(n=(r=o)&&z$(e,o)),n}return i._value=t,i}function V$(e,t){var n,r;function i(){var o=t.apply(this,arguments);return o!==r&&(n=(r=o)&&P$(e,o)),n}return i._value=t,i}function P4(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=ls(e);return this.tween(n,(r.local?q$:V$)(r,t))}function j$(e,t){return function(){$d(this,e).delay=+t.apply(this,arguments)}}function Y$(e,t){return t=+t,function(){$d(this,e).delay=t}}function z4(e){var t=this._id;return arguments.length?this.each((typeof e=="function"?j$:Y$)(t,e)):en(this.node(),t).delay}function W$(e,t){return function(){Mn(this,e).duration=+t.apply(this,arguments)}}function G$(e,t){return t=+t,function(){Mn(this,e).duration=t}}function q4(e){var t=this._id;return arguments.length?this.each((typeof e=="function"?W$:G$)(t,e)):en(this.node(),t).duration}function X$(e,t){if(typeof t!="function")throw new Error;return function(){Mn(this,e).ease=t}}function V4(e){var t=this._id;return arguments.length?this.each(X$(t,e)):en(this.node(),t).ease}function H$(e,t){return function(){var n=t.apply(this,arguments);if(typeof n!="function")throw new Error;Mn(this,e).ease=n}}function j4(e){if(typeof e!="function")throw new Error;return this.each(H$(this._id,e))}function Y4(e){typeof e!="function"&&(e=_d(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 Zn(r,this._parents,this._name,this._id)}function W4(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),h,d=0;d<u;++d)(h=c[d]||l[d])&&(f[d]=h);for(;a<r;++a)s[a]=t[a];return new Zn(s,this._parents,this._name,this._id)}function Z$(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 K$(e,t,n){var r,i,o=Z$(t)?$d:Mn;return function(){var s=o(this,e),a=s.on;a!==r&&(i=(r=a).copy()).on(t,n),s.on=i}}function G4(e,t){var n=this._id;return arguments.length<2?en(this.node(),n).on.on(e):this.each(K$(n,e,t))}function Q$(e){return function(){var t=this.parentNode;for(var n in this.__transition)if(+n!==e)return;t&&t.removeChild(this)}}function X4(){return this.on("end.remove",Q$(this._id))}function H4(e){var t=this._name,n=this._id;typeof e!="function"&&(e=Mc(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,h=0;h<c;++h)(u=a[h])&&(f=e.call(u,u.__data__,h,a))&&("__data__"in u&&(f.__data__=u.__data__),l[h]=f,da(l[h],t,n,h,l,en(u,n)));return new Zn(o,this._parents,t,n)}function Z4(e){var t=this._name,n=this._id;typeof e!="function"&&(e=wd(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 h=e.call(u,u.__data__,f,c),d,p=en(u,n),m=0,y=h.length;m<y;++m)(d=h[m])&&da(d,t,n,m,h,p);o.push(h),s.push(u)}return new Zn(o,s,t,n)}var J$=fs.prototype.constructor;function K4(){return new J$(this._groups,this._parents)}function tU(e,t){var n,r,i;return function(){var o=ua(this,e),s=(this.style.removeProperty(e),ua(this,e));return o===s?null:o===n&&s===r?i:i=t(n=o,r=s)}}function Q4(e){return function(){this.style.removeProperty(e)}}function eU(e,t,n){var r,i=n+"",o;return function(){var s=ua(this,e);return s===i?null:s===r?o:o=t(r=s,n)}}function nU(e,t,n){var r,i,o;return function(){var s=ua(this,e),a=n(this),c=a+"";return a==null&&(c=a=(this.style.removeProperty(e),ua(this,e))),s===c?null:s===r&&c===i?o:(i=c,o=t(r=s,a))}}function rU(e,t){var n,r,i,o="style."+t,s="end."+o,a;return function(){var c=Mn(this,e),l=c.on,u=c.value[o]==null?a||(a=Q4(t)):void 0;(l!==n||i!==u)&&(r=(n=l).copy()).on(s,i=u),c.on=r}}function J4(e,t,n){var r=(e+="")=="transform"?Mv:bg;return t==null?this.styleTween(e,tU(e,r)).on("end.style."+e,Q4(e)):typeof t=="function"?this.styleTween(e,nU(e,r,uu(this,"style."+e,t))).each(rU(this._id,e)):this.styleTween(e,eU(e,r,t),n).on("end.style."+e,null)}function iU(e,t,n){return function(r){this.style.setProperty(e,t.call(this,r),n)}}function oU(e,t,n){var r,i;function o(){var s=t.apply(this,arguments);return s!==i&&(r=(i=s)&&iU(e,s,n)),r}return o._value=t,o}function t8(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,oU(e,t,n??""))}function sU(e){return function(){this.textContent=e}}function aU(e){return function(){var t=e(this);this.textContent=t??""}}function e8(e){return this.tween("text",typeof e=="function"?aU(uu(this,"text",e)):sU(e==null?"":e+""))}function cU(e){return function(t){this.textContent=e.call(this,t)}}function lU(e){var t,n;function r(){var i=e.apply(this,arguments);return i!==n&&(t=(n=i)&&cU(i)),t}return r._value=e,r}function n8(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,lU(e))}function r8(){for(var e=this._name,t=this._id,n=xg(),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=en(c,t);da(c,e,n,l,s,{time:u.time+u.delay+u.duration,delay:0,duration:u.duration,ease:u.ease})}return new Zn(r,this._parents,e,n)}function i8(){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=Mn(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 uU=0;function Zn(e,t,n,r){this._groups=e,this._parents=t,this._name=n,this._id=r}function o8(e){return fs().transition(e)}function xg(){return++uU}var ps=fs.prototype;Zn.prototype=o8.prototype={constructor:Zn,select:H4,selectAll:Z4,selectChild:ps.selectChild,selectChildren:ps.selectChildren,filter:Y4,merge:W4,selection:K4,transition:r8,call:ps.call,nodes:ps.nodes,node:ps.node,size:ps.size,empty:ps.empty,each:ps.each,on:G4,attr:U4,attrTween:P4,style:J4,styleTween:t8,text:e8,textTween:n8,remove:X4,tween:$4,delay:z4,duration:q4,ease:V4,easeVarying:j4,end:i8,[Symbol.iterator]:ps[Symbol.iterator]};function wg(e){return((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2}var fU={time:null,delay:0,duration:250,ease:wg};function hU(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 s8(e){var t,n;e instanceof Zn?(t=e._id,e=e._name):(t=xg(),(n=fU).time=kd(),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])&&da(c,e,t,l,s,n||hU(c,t));return new Zn(r,this._parents,e,t)}fs.prototype.interrupt=R4;fs.prototype.transition=s8;var _g=e=>()=>e;function Bv(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 a8(e){e.stopImmediatePropagation()}function vg(e){e.preventDefault(),e.stopImmediatePropagation()}var c8={name:"drag"},Ov={name:"space"},fu={name:"handle"},hu={name:"center"},{abs:l8,max:Fn,min:Cn}=Math;function u8(e){return[+e[0],+e[1]]}function Fv(e){return[u8(e[0]),u8(e[1])]}var Sg={name:"x",handles:["w","e"].map(Ud),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]]}},Ig={name:"y",handles:["n","s"].map(Ud),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]]}},dU={name:"xy",handles:["n","w","e","s","nw","ne","sw","se"].map(Ud),input:function(e){return e==null?null:Fv(e)},output:function(e){return e}},ms={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"},f8={e:"w",w:"e",nw:"ne",ne:"nw",se:"sw",sw:"se"},h8={n:"s",s:"n",nw:"sw",ne:"se",se:"ne",sw:"nw"},pU={overlay:1,selection:1,n:null,e:1,s:null,w:-1,nw:-1,ne:1,se:1,sw:-1},mU={overlay:1,selection:1,n:-1,e:null,s:1,w:null,nw:-1,ne:-1,se:1,sw:1};function Ud(e){return{type:e}}function yU(e){return!e.ctrlKey&&!e.button}function gU(){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 bU(){return navigator.maxTouchPoints||"ontouchstart"in this}function Lv(e){for(;!e.__brush;)if(!(e=e.parentNode))return;return e.__brush}function xU(e){return e[0][0]===e[1][0]||e[0][1]===e[1][1]}function Cv(){return $v(Sg)}function kv(){return $v(Ig)}function Rv(){return $v(dU)}function $v(e){var t=gU,n=yU,r=bU,i=!0,o=Ic("start","brush","end"),s=6,a;function c(y){var g=y.property("__brush",m).selectAll(".overlay").data([Ud("overlay")]);g.enter().append("rect").attr("class","overlay").attr("pointer-events","all").attr("cursor",ms.overlay).merge(g).each(function(){var x=Lv(this).extent;Pt(this).attr("x",x[0][0]).attr("y",x[0][1]).attr("width",x[1][0]-x[0][0]).attr("height",x[1][1]-x[0][1])}),y.selectAll(".selection").data([Ud("selection")]).enter().append("rect").attr("class","selection").attr("cursor",ms.selection).attr("fill","#777").attr("fill-opacity",.3).attr("stroke","#fff").attr("shape-rendering","crispEdges");var b=y.selectAll(".handle").data(e.handles,function(x){return x.type});b.exit().remove(),b.enter().append("rect").attr("class",function(x){return"handle handle--"+x.type}).attr("cursor",function(x){return ms[x.type]}),y.each(l).attr("fill","none").attr("pointer-events","all").on("mousedown.brush",h).filter(r).on("touchstart.brush",h).on("touchmove.brush",d).on("touchend.brush touchcancel.brush",p).style("touch-action","none").style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}c.move=function(y,g,b){y.tween?y.on("start.brush",function(x){u(this,arguments).beforestart().start(x)}).on("interrupt.brush end.brush",function(x){u(this,arguments).end(x)}).tween("brush",function(){var x=this,w=x.__brush,v=u(x,arguments),_=w.selection,M=e.input(typeof g=="function"?g.apply(this,arguments):g,w.extent),E=Er(_,M);function I(N){w.selection=N===1&&M===null?null:E(N),l.call(x),v.brush()}return _!==null&&M!==null?I:I(1)}):y.each(function(){var x=this,w=arguments,v=x.__brush,_=e.input(typeof g=="function"?g.apply(x,w):g,v.extent),M=u(x,w).beforestart();uo(x),v.selection=_===null?null:_,l.call(x),M.start(b).brush(b).end(b)})},c.clear=function(y,g){c.move(y,null,g)};function l(){var y=Pt(this),g=Lv(this).selection;g?(y.selectAll(".selection").style("display",null).attr("x",g[0][0]).attr("y",g[0][1]).attr("width",g[1][0]-g[0][0]).attr("height",g[1][1]-g[0][1]),y.selectAll(".handle").style("display",null).attr("x",function(b){return b.type[b.type.length-1]==="e"?g[1][0]-s/2:g[0][0]-s/2}).attr("y",function(b){return b.type[0]==="s"?g[1][1]-s/2:g[0][1]-s/2}).attr("width",function(b){return b.type==="n"||b.type==="s"?g[1][0]-g[0][0]+s:s}).attr("height",function(b){return b.type==="e"||b.type==="w"?g[1][1]-g[0][1]+s:s})):y.selectAll(".selection,.handle").style("display","none").attr("x",null).attr("y",null).attr("width",null).attr("height",null)}function u(y,g,b){var x=y.__brush.emitter;return x&&(!b||!x.clean)?x:new f(y,g,b)}function f(y,g,b){this.that=y,this.args=g,this.state=y.__brush,this.active=0,this.clean=b}f.prototype={beforestart:function(){return++this.active===1&&(this.state.emitter=this,this.starting=!0),this},start:function(y,g){return this.starting?(this.starting=!1,this.emit("start",y,g)):this.emit("brush",y),this},brush:function(y,g){return this.emit("brush",y,g),this},end:function(y,g){return--this.active===0&&(delete this.state.emitter,this.emit("end",y,g)),this},emit:function(y,g,b){var x=Pt(this.that).datum();o.call(y,this.that,new Bv(y,{sourceEvent:g,target:c,selection:e.output(this.state.selection),mode:b,dispatch:o}),x)}};function h(y){if(a&&!y.touches||!n.apply(this,arguments))return;var g=this,b=y.target.__data__.type,x=(i&&y.metaKey?b="overlay":b)==="selection"?c8:i&&y.altKey?hu:fu,w=e===Ig?null:pU[b],v=e===Sg?null:mU[b],_=Lv(g),M=_.extent,E=_.selection,I=M[0][0],N,A,B=M[0][1],L,S,T=M[1][0],D,C,k=M[1][1],F,R,$=0,U=0,G,et=w&&v&&i&&y.shiftKey,rt,st,j=Array.from(y.touches||[y],J=>{let ie=J.identifier;return J=On(J,g),J.point0=J.slice(),J.identifier=ie,J});uo(g);var ot=u(g,arguments,!0).beforestart();if(b==="overlay"){E&&(G=!0);let J=[j[0],j[1]||j[0]];_.selection=E=[[N=e===Ig?I:Cn(J[0][0],J[1][0]),L=e===Sg?B:Cn(J[0][1],J[1][1])],[D=e===Ig?T:Fn(J[0][0],J[1][0]),F=e===Sg?k:Fn(J[0][1],J[1][1])]],j.length>1&&Ot(y)}else N=E[0][0],L=E[0][1],D=E[1][0],F=E[1][1];A=N,S=L,C=D,R=F;var z=Pt(g).attr("pointer-events","none"),H=z.selectAll(".overlay").attr("cursor",ms[b]);if(y.touches)ot.moved=P,ot.ended=ft;else{var nt=Pt(y.view).on("mousemove.brush",P,!0).on("mouseup.brush",ft,!0);i&&nt.on("keydown.brush",jt,!0).on("keyup.brush",Wt,!0),Sd(y.view)}l.call(g),ot.start(y,x.name);function P(J){for(let ie of J.changedTouches||[J])for(let gr of j)gr.identifier===ie.identifier&&(gr.cur=On(ie,g));if(et&&!rt&&!st&&j.length===1){let ie=j[0];l8(ie.cur[0]-ie[0])>l8(ie.cur[1]-ie[1])?st=!0:rt=!0}for(let ie of j)ie.cur&&(ie[0]=ie.cur[0],ie[1]=ie.cur[1]);G=!0,vg(J),Ot(J)}function Ot(J){let ie=j[0],gr=ie.point0;var ki;switch($=ie[0]-gr[0],U=ie[1]-gr[1],x){case Ov:case c8:{w&&($=Fn(I-N,Cn(T-D,$)),A=N+$,C=D+$),v&&(U=Fn(B-L,Cn(k-F,U)),S=L+U,R=F+U);break}case fu:{j[1]?(w&&(A=Fn(I,Cn(T,j[0][0])),C=Fn(I,Cn(T,j[1][0])),w=1),v&&(S=Fn(B,Cn(k,j[0][1])),R=Fn(B,Cn(k,j[1][1])),v=1)):(w<0?($=Fn(I-N,Cn(T-N,$)),A=N+$,C=D):w>0&&($=Fn(I-D,Cn(T-D,$)),A=N,C=D+$),v<0?(U=Fn(B-L,Cn(k-L,U)),S=L+U,R=F):v>0&&(U=Fn(B-F,Cn(k-F,U)),S=L,R=F+U));break}case hu:{w&&(A=Fn(I,Cn(T,N-$*w)),C=Fn(I,Cn(T,D+$*w))),v&&(S=Fn(B,Cn(k,L-U*v)),R=Fn(B,Cn(k,F+U*v)));break}}C<A&&(w*=-1,ki=N,N=D,D=ki,ki=A,A=C,C=ki,b in f8&&H.attr("cursor",ms[b=f8[b]])),R<S&&(v*=-1,ki=L,L=F,F=ki,ki=S,S=R,R=ki,b in h8&&H.attr("cursor",ms[b=h8[b]])),_.selection&&(E=_.selection),rt&&(A=E[0][0],C=E[1][0]),st&&(S=E[0][1],R=E[1][1]),(E[0][0]!==A||E[0][1]!==S||E[1][0]!==C||E[1][1]!==R)&&(_.selection=[[A,S],[C,R]],l.call(g),ot.brush(J,x.name))}function ft(J){if(a8(J),J.touches){if(J.touches.length)return;a&&clearTimeout(a),a=setTimeout(function(){a=null},500)}else Id(J.view,G),nt.on("keydown.brush keyup.brush mousemove.brush mouseup.brush",null);z.attr("pointer-events","all"),H.attr("cursor",ms.overlay),_.selection&&(E=_.selection),xU(E)&&(_.selection=null,l.call(g)),ot.end(J,x.name)}function jt(J){switch(J.keyCode){case 16:{et=w&&v;break}case 18:{x===fu&&(w&&(D=C-$*w,N=A+$*w),v&&(F=R-U*v,L=S+U*v),x=hu,Ot(J));break}case 32:{(x===fu||x===hu)&&(w<0?D=C-$:w>0&&(N=A-$),v<0?F=R-U:v>0&&(L=S-U),x=Ov,H.attr("cursor",ms.selection),Ot(J));break}default:return}vg(J)}function Wt(J){switch(J.keyCode){case 16:{et&&(rt=st=et=!1,Ot(J));break}case 18:{x===hu&&(w<0?D=C:w>0&&(N=A),v<0?F=R:v>0&&(L=S),x=fu,Ot(J));break}case 32:{x===Ov&&(J.altKey?(w&&(D=C-$*w,N=A+$*w),v&&(F=R-U*v,L=S+U*v),x=hu):(w<0?D=C:w>0&&(N=A),v<0?F=R:v>0&&(L=S),x=fu),H.attr("cursor",ms[b]),Ot(J));break}default:return}vg(J)}}function d(y){u(this,arguments).moved(y)}function p(y){u(this,arguments).ended(y)}function m(){var y=this.__brush||{selection:null};return y.extent=Fv(t.apply(this,arguments)),y.dim=e,y}return c.extent=function(y){return arguments.length?(t=typeof y=="function"?y:_g(Fv(y)),c):t},c.filter=function(y){return arguments.length?(n=typeof y=="function"?y:_g(!!y),c):n},c.touchable=function(y){return arguments.length?(r=typeof y=="function"?y:_g(!!y),c):r},c.handleSize=function(y){return arguments.length?(s=+y,c):s},c.keyModifiers=function(y){return arguments.length?(i=!!y,c):i},c.on=function(){var y=o.on.apply(o,arguments);return y===o?c:y},c}var Uv=Math.PI,Pv=2*Uv,Oc=1e-6,wU=Pv-Oc;function d8(e){this._+=e[0];for(let t=1,n=e.length;t<n;++t)this._+=arguments[t]+e[t]}function _U(e){let t=Math.floor(e);if(!(t>=0))throw new Error(`invalid digits: ${e}`);if(t>15)return d8;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 pa=class{constructor(t){this._x0=this._y0=this._x1=this._y1=null,this._="",this._append=t==null?d8:_U(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,h=u*u+f*f;if(this._x1===null)this._append`M${this._x1=t},${this._y1=n}`;else if(h>Oc)if(!(Math.abs(f*c-l*u)>Oc)||!o)this._append`L${this._x1=t},${this._y1=n}`;else{let d=r-s,p=i-a,m=c*c+l*l,y=d*d+p*p,g=Math.sqrt(m),b=Math.sqrt(h),x=o*Math.tan((Uv-Math.acos((m+h-y)/(2*g*b)))/2),w=x/b,v=x/g;Math.abs(w-1)>Oc&&this._append`L${t+w*u},${n+w*f}`,this._append`A${o},${o},0,0,${+(f*d>u*p)},${this._x1=t+v*c},${this._y1=n+v*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,h=s?i-o:o-i;this._x1===null?this._append`M${l},${u}`:(Math.abs(this._x1-l)>Oc||Math.abs(this._y1-u)>Oc)&&this._append`L${l},${u}`,r&&(h<0&&(h=h%Pv+Pv),h>wU?this._append`A${r},${r},0,1,${f},${t-a},${n-c}A${r},${r},0,1,${f},${this._x1=l},${this._y1=u}`:h>Oc&&this._append`A${r},${r},0,${+(h>=Uv)},${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 p8(){return new pa}p8.prototype=pa.prototype;function Kn(e=3){return new pa(+e)}var vU=Array.prototype,Mg=vU.slice;function m8(e,t){return e-t}function y8(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 fo=e=>()=>e;function g8(e,t){for(var n=-1,r=t.length,i;++n<r;)if(i=SU(e,t[n]))return i;return 0}function SU(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],h=f[0],d=f[1];if(IU(c,f,t))return 0;u>r!=d>r&&n<(h-l)*(r-u)/(d-u)+l&&(i=-i)}return i}function IU(e,t,n){var r;return MU(e,t,n)&&AU(e[r=+(e[0]===t[0])],n[r],t[r])}function MU(e,t,n){return(t[0]-e[0])*(n[1]-e[1])===(n[0]-e[0])*(t[1]-e[1])}function AU(e,t,n){return e<=t&&t<=n||n<=t&&t<=e}function b8(){}var ys=[[],[[[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 ma(){var e=1,t=1,n=ca,r=c;function i(l){var u=n(l);if(Array.isArray(u))u=u.slice().sort(m8);else{let f=se(l,TU);for(u=Sn(...tu(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 h=[],d=[];return s(l,f,function(p){r(p,l,f),y8(p)>0?h.push([p]):d.push(p)}),d.forEach(function(p){for(var m=0,y=h.length,g;m<y;++m)if(g8((g=h[m])[0],p)!==-1){g.push(p);return}}),{type:"MultiPolygon",value:u,coordinates:h}}function s(l,u,f){var h=new Array,d=new Array,p,m,y,g,b,x;for(p=m=-1,g=Lc(l[0],u),ys[g<<1].forEach(w);++p<e-1;)y=g,g=Lc(l[p+1],u),ys[y|g<<1].forEach(w);for(ys[g<<0].forEach(w);++m<t-1;){for(p=-1,g=Lc(l[m*e+e],u),b=Lc(l[m*e],u),ys[g<<1|b<<2].forEach(w);++p<e-1;)y=g,g=Lc(l[m*e+e+p+1],u),x=b,b=Lc(l[m*e+p+1],u),ys[y|g<<1|b<<2|x<<3].forEach(w);ys[g|b<<3].forEach(w)}for(p=-1,b=l[m*e]>=u,ys[b<<2].forEach(w);++p<e-1;)x=b,b=Lc(l[m*e+p+1],u),ys[b<<2|x<<3].forEach(w);ys[b<<3].forEach(w);function w(v){var _=[v[0][0]+p,v[0][1]+m],M=[v[1][0]+p,v[1][1]+m],E=a(_),I=a(M),N,A;(N=d[E])?(A=h[I])?(delete d[N.end],delete h[A.start],N===A?(N.ring.push(M),f(N.ring)):h[N.start]=d[A.end]={start:N.start,end:A.end,ring:N.ring.concat(A.ring)}):(delete d[N.end],N.ring.push(M),d[N.end=I]=N):(N=h[I])?(A=d[E])?(delete h[N.start],delete d[A.end],N===A?(N.ring.push(M),f(N.ring)):h[A.start]=d[N.end]={start:A.start,end:N.end,ring:A.ring.concat(N.ring)}):(delete h[N.start],N.ring.unshift(_),h[N.start=E]=N):h[E]=d[I]={start:E,end:I,ring:[_,M]}}}function a(l){return l[0]*2+l[1]*(e+1)*4}function c(l,u,f){l.forEach(function(h){var d=h[0],p=h[1],m=d|0,y=p|0,g=zv(u[y*e+m]);d>0&&d<e&&m===d&&(h[0]=x8(d,zv(u[y*e+m-1]),g,f)),p>0&&p<t&&y===p&&(h[1]=x8(p,zv(u[(y-1)*e+m]),g,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)?fo(Mg.call(l)):fo(l),i):n},i.smooth=function(l){return arguments.length?(r=l?c:b8,i):r===c},i}function TU(e){return isFinite(e)?e:NaN}function Lc(e,t){return e==null?!1:+e>=t}function zv(e){return e==null||isNaN(e=+e)?-1/0:e}function x8(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 EU(e){return e[0]}function DU(e){return e[1]}function NU(){return 1}function qv(){var e=EU,t=DU,n=NU,r=960,i=500,o=20,s=2,a=o*3,c=r+a*2>>s,l=i+a*2>>s,u=fo(20);function f(b){var x=new Float32Array(c*l),w=Math.pow(2,-s),v=-1;for(let L of b){var _=(e(L,++v,b)+a)*w,M=(t(L,v,b)+a)*w,E=+n(L,v,b);if(E&&_>=0&&_<c&&M>=0&&M<l){var I=Math.floor(_),N=Math.floor(M),A=_-I-.5,B=M-N-.5;x[I+N*c]+=(1-A)*(1-B)*E,x[I+1+N*c]+=A*(1-B)*E,x[I+1+(N+1)*c]+=A*B*E,x[I+(N+1)*c]+=(1-A)*B*E}}return pd({data:x,width:c,height:l},o*w),x}function h(b){var x=f(b),w=u(x),v=Math.pow(2,2*s);return Array.isArray(w)||(w=Sn(Number.MIN_VALUE,Yt(x)/v,w)),ma().size([c,l]).thresholds(w.map(_=>_*v))(x).map((_,M)=>(_.value=+w[M],d(_)))}h.contours=function(b){var x=f(b),w=ma().size([c,l]),v=Math.pow(2,2*s),_=M=>{M=+M;var E=d(w.contour(x,M*v));return E.value=M,E};return Object.defineProperty(_,"max",{get:()=>Yt(x)/v}),_};function d(b){return b.coordinates.forEach(p),b}function p(b){b.forEach(m)}function m(b){b.forEach(y)}function y(b){b[0]=b[0]*Math.pow(2,s)-a,b[1]=b[1]*Math.pow(2,s)-a}function g(){return a=o*3,c=r+a*2>>s,l=i+a*2>>s,h}return h.x=function(b){return arguments.length?(e=typeof b=="function"?b:fo(+b),h):e},h.y=function(b){return arguments.length?(t=typeof b=="function"?b:fo(+b),h):t},h.weight=function(b){return arguments.length?(n=typeof b=="function"?b:fo(+b),h):n},h.size=function(b){if(!arguments.length)return[r,i];var x=+b[0],w=+b[1];if(!(x>=0&&w>=0))throw new Error("invalid size");return r=x,i=w,g()},h.cellSize=function(b){if(!arguments.length)return 1<<s;if(!((b=+b)>=1))throw new Error("invalid cell size");return s=Math.floor(Math.log(b)/Math.LN2),g()},h.thresholds=function(b){return arguments.length?(u=typeof b=="function"?b:Array.isArray(b)?fo(Mg.call(b)):fo(b),h):u},h.bandwidth=function(b){if(!arguments.length)return Math.sqrt(o*(o+1));if(!((b=+b)>=0))throw new Error("invalid bandwidth");return o=(Math.sqrt(4*b*b+1)-1)/2,g()},h}var Zt=11102230246251565e-32,Ye=134217729,Pd=(3+8*Zt)*Zt;function Fc(e,t,n,r,i){let o,s,a,c,l=t[0],u=r[0],f=0,h=0;u>l==u>-l?(o=l,l=t[++f]):(o=u,u=r[++h]);let d=0;if(f<e&&h<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[++h]),o=s,a!==0&&(i[d++]=a);f<e&&h<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[++h]),o=s,a!==0&&(i[d++]=a);for(;f<e;)s=o+l,c=s-o,a=o-(s-c)+(l-c),l=t[++f],o=s,a!==0&&(i[d++]=a);for(;h<n;)s=o+u,c=s-o,a=o-(s-c)+(u-c),u=r[++h],o=s,a!==0&&(i[d++]=a);return(o!==0||d===0)&&(i[d++]=o),d}function zd(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 BU=(3+16*Zt)*Zt,OU=(2+12*Zt)*Zt,LU=(9+64*Zt)*Zt*Zt,du=V(4),w8=V(8),_8=V(12),v8=V(16),Qn=V(4);function FU(e,t,n,r,i,o,s){let a,c,l,u,f,h,d,p,m,y,g,b,x,w,v,_,M,E,I=e-i,N=n-i,A=t-o,B=r-o;w=I*B,h=Ye*I,d=h-(h-I),p=I-d,h=Ye*B,m=h-(h-B),y=B-m,v=p*y-(w-d*m-p*m-d*y),_=A*N,h=Ye*A,d=h-(h-A),p=A-d,h=Ye*N,m=h-(h-N),y=N-m,M=p*y-(_-d*m-p*m-d*y),g=v-M,f=v-g,du[0]=v-(g+f)+(f-M),b=w+g,f=b-w,x=w-(b-f)+(g-f),g=x-_,f=x-g,du[1]=x-(g+f)+(f-_),E=b+g,f=E-b,du[2]=b-(E-f)+(g-f),du[3]=E;let L=zd(4,du),S=OU*s;if(L>=S||-L>=S||(f=e-I,a=e-(I+f)+(f-i),f=n-N,l=n-(N+f)+(f-i),f=t-A,c=t-(A+f)+(f-o),f=r-B,u=r-(B+f)+(f-o),a===0&&c===0&&l===0&&u===0)||(S=LU*s+Pd*Math.abs(L),L+=I*u+B*a-(A*l+N*c),L>=S||-L>=S))return L;w=a*B,h=Ye*a,d=h-(h-a),p=a-d,h=Ye*B,m=h-(h-B),y=B-m,v=p*y-(w-d*m-p*m-d*y),_=c*N,h=Ye*c,d=h-(h-c),p=c-d,h=Ye*N,m=h-(h-N),y=N-m,M=p*y-(_-d*m-p*m-d*y),g=v-M,f=v-g,Qn[0]=v-(g+f)+(f-M),b=w+g,f=b-w,x=w-(b-f)+(g-f),g=x-_,f=x-g,Qn[1]=x-(g+f)+(f-_),E=b+g,f=E-b,Qn[2]=b-(E-f)+(g-f),Qn[3]=E;let T=Fc(4,du,4,Qn,w8);w=I*u,h=Ye*I,d=h-(h-I),p=I-d,h=Ye*u,m=h-(h-u),y=u-m,v=p*y-(w-d*m-p*m-d*y),_=A*l,h=Ye*A,d=h-(h-A),p=A-d,h=Ye*l,m=h-(h-l),y=l-m,M=p*y-(_-d*m-p*m-d*y),g=v-M,f=v-g,Qn[0]=v-(g+f)+(f-M),b=w+g,f=b-w,x=w-(b-f)+(g-f),g=x-_,f=x-g,Qn[1]=x-(g+f)+(f-_),E=b+g,f=E-b,Qn[2]=b-(E-f)+(g-f),Qn[3]=E;let D=Fc(T,w8,4,Qn,_8);w=a*u,h=Ye*a,d=h-(h-a),p=a-d,h=Ye*u,m=h-(h-u),y=u-m,v=p*y-(w-d*m-p*m-d*y),_=c*l,h=Ye*c,d=h-(h-c),p=c-d,h=Ye*l,m=h-(h-l),y=l-m,M=p*y-(_-d*m-p*m-d*y),g=v-M,f=v-g,Qn[0]=v-(g+f)+(f-M),b=w+g,f=b-w,x=w-(b-f)+(g-f),g=x-_,f=x-g,Qn[1]=x-(g+f)+(f-_),E=b+g,f=E-b,Qn[2]=b-(E-f)+(g-f),Qn[3]=E;let C=Fc(D,_8,4,Qn,v8);return v8[C-1]}function pu(e,t,n,r,i,o){let s=(t-o)*(n-i),a=(e-i)*(r-o),c=s-a,l=Math.abs(s+a);return Math.abs(c)>=BU*l?c:-FU(e,t,n,r,i,o,l)}var Emt=(7+56*Zt)*Zt,Dmt=(3+28*Zt)*Zt,Nmt=(26+288*Zt)*Zt*Zt,Bmt=V(4),Omt=V(4),Lmt=V(4),Fmt=V(4),Cmt=V(4),kmt=V(4),Rmt=V(4),$mt=V(4),Umt=V(4),Pmt=V(8),zmt=V(8),qmt=V(8),Vmt=V(4),jmt=V(8),Ymt=V(8),Wmt=V(8),Gmt=V(12),Xmt=V(192),Hmt=V(192);var Qmt=(10+96*Zt)*Zt,Jmt=(4+48*Zt)*Zt,tyt=(44+576*Zt)*Zt*Zt,eyt=V(4),nyt=V(4),ryt=V(4),iyt=V(4),oyt=V(4),syt=V(4),ayt=V(4),cyt=V(4),lyt=V(8),uyt=V(8),fyt=V(8),hyt=V(8),dyt=V(8),pyt=V(8),myt=V(8),yyt=V(8),gyt=V(8),byt=V(4),xyt=V(4),wyt=V(4),_yt=V(8),vyt=V(16),Syt=V(16),Iyt=V(16),Myt=V(32),Ayt=V(32),Tyt=V(48),Eyt=V(64),Dyt=V(1152),Nyt=V(1152);var Fyt=(16+224*Zt)*Zt,Cyt=(5+72*Zt)*Zt,kyt=(71+1408*Zt)*Zt*Zt,Ryt=V(4),$yt=V(4),Uyt=V(4),Pyt=V(4),zyt=V(4),qyt=V(4),Vyt=V(4),jyt=V(4),Yyt=V(4),Wyt=V(4),Gyt=V(24),Xyt=V(24),Hyt=V(24),Zyt=V(24),Kyt=V(24),Qyt=V(24),Jyt=V(24),t0t=V(24),e0t=V(24),n0t=V(24),r0t=V(1152),i0t=V(1152),o0t=V(1152),s0t=V(1152),a0t=V(1152),c0t=V(2304),l0t=V(2304),u0t=V(3456),f0t=V(5760),h0t=V(8),d0t=V(8),p0t=V(8),m0t=V(16),y0t=V(24),g0t=V(48),b0t=V(48),x0t=V(96),w0t=V(192),_0t=V(384),v0t=V(384),S0t=V(384),I0t=V(768);var M0t=V(96),A0t=V(96),T0t=V(96),E0t=V(1152);var I8=Math.pow(2,-52),Ag=new Uint32Array(512),yu=class e{static from(t,n=PU,r=zU){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),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 N=t[2*I],A=t[2*I+1];N<a&&(a=N),A<c&&(c=A),N>l&&(l=N),A>u&&(u=A),this._ids[I]=I}let f=(a+l)/2,h=(c+u)/2,d,p,m;for(let I=0,N=1/0;I<s;I++){let A=Vv(f,h,t[2*I],t[2*I+1]);A<N&&(d=I,N=A)}let y=t[2*d],g=t[2*d+1];for(let I=0,N=1/0;I<s;I++){if(I===d)continue;let A=Vv(y,g,t[2*I],t[2*I+1]);A<N&&A>0&&(p=I,N=A)}let b=t[2*p],x=t[2*p+1],w=1/0;for(let I=0;I<s;I++){if(I===d||I===p)continue;let N=$U(y,g,b,x,t[2*I],t[2*I+1]);N<w&&(m=I,w=N)}let v=t[2*m],_=t[2*m+1];if(w===1/0){for(let A=0;A<s;A++)this._dists[A]=t[2*A]-t[0]||t[2*A+1]-t[1];mu(this._ids,this._dists,0,s-1);let I=new Uint32Array(s),N=0;for(let A=0,B=-1/0;A<s;A++){let L=this._ids[A],S=this._dists[L];S>B&&(I[N++]=L,B=S)}this.hull=I.subarray(0,N),this.triangles=new Uint32Array(0),this.halfedges=new Uint32Array(0);return}if(pu(y,g,b,x,v,_)<0){let I=p,N=b,A=x;p=m,b=v,x=_,m=I,v=N,_=A}let M=UU(y,g,b,x,v,_);this._cx=M.x,this._cy=M.y;for(let I=0;I<s;I++)this._dists[I]=Vv(t[2*I],t[2*I+1],M.x,M.y);mu(this._ids,this._dists,0,s-1),this._hullStart=d;let E=3;r[d]=n[m]=p,r[p]=n[d]=m,r[m]=n[p]=d,i[d]=0,i[p]=1,i[m]=2,o.fill(-1),o[this._hashKey(y,g)]=d,o[this._hashKey(b,x)]=p,o[this._hashKey(v,_)]=m,this.trianglesLen=0,this._addTriangle(d,p,m,-1,-1,-1);for(let I=0,N,A;I<this._ids.length;I++){let B=this._ids[I],L=t[2*B],S=t[2*B+1];if(I>0&&Math.abs(L-N)<=I8&&Math.abs(S-A)<=I8||(N=L,A=S,B===d||B===p||B===m))continue;let T=0;for(let R=0,$=this._hashKey(L,S);R<this._hashSize&&(T=o[($+R)%this._hashSize],!(T!==-1&&T!==r[T]));R++);T=n[T];let D=T,C;for(;C=r[D],pu(L,S,t[2*D],t[2*D+1],t[2*C],t[2*C+1])>=0;)if(D=C,D===T){D=-1;break}if(D===-1)continue;let k=this._addTriangle(D,B,r[D],-1,-1,i[D]);i[B]=this._legalize(k+2),i[D]=k,E++;let F=r[D];for(;C=r[F],pu(L,S,t[2*F],t[2*F+1],t[2*C],t[2*C+1])<0;)k=this._addTriangle(F,B,C,i[B],-1,i[F]),i[B]=this._legalize(k+2),r[F]=F,E--,F=C;if(D===T)for(;C=n[D],pu(L,S,t[2*C],t[2*C+1],t[2*D],t[2*D+1])<0;)k=this._addTriangle(C,B,D,-1,i[D],i[C]),this._legalize(k+2),i[C]=k,r[D]=D,E--,D=C;this._hullStart=n[B]=D,r[D]=n[F]=B,r[B]=F,o[this._hashKey(L,S)]=B,o[this._hashKey(t[2*D],t[2*D+1])]=D}this.hull=new Uint32Array(E);for(let I=0,N=this._hullStart;I<E;I++)this.hull[I]=N,N=r[N];this.triangles=this._triangles.subarray(0,this.trianglesLen),this.halfedges=this._halfedges.subarray(0,this.trianglesLen)}_hashKey(t,n){return Math.floor(kU(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=Ag[--o];continue}let l=a-a%3,u=c+(t+1)%3,f=l+(a+2)%3,h=n[s],d=n[t],p=n[u],m=n[f];if(RU(i[2*h],i[2*h+1],i[2*d],i[2*d+1],i[2*p],i[2*p+1],i[2*m],i[2*m+1])){n[t]=m,n[a]=h;let g=r[f];if(g===-1){let x=this._hullStart;do{if(this._hullTri[x]===f){this._hullTri[x]=t;break}x=this._hullPrev[x]}while(x!==this._hullStart)}this._link(t,g),this._link(a,r[s]),this._link(s,f);let b=l+(a+1)%3;o<Ag.length&&(Ag[o++]=b)}else{if(o===0)break;t=Ag[--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 kU(e,t){let n=e/(Math.abs(e)+Math.abs(t));return(t>0?3-n:1+n)/4}function Vv(e,t,n,r){let i=e-n,o=t-r;return i*i+o*o}function RU(e,t,n,r,i,o,s,a){let c=e-s,l=t-a,u=n-s,f=r-a,h=i-s,d=o-a,p=c*c+l*l,m=u*u+f*f,y=h*h+d*d;return c*(f*y-m*d)-l*(u*y-m*h)+p*(u*d-f*h)<0}function $U(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,h=.5/(s*l-a*c),d=(l*u-a*f)*h,p=(s*f-c*u)*h;return d*d+p*p}function UU(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,h=.5/(s*l-a*c),d=e+(l*u-a*f)*h,p=t+(s*f-c*u)*h;return{x:d,y:p}}function mu(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;qd(e,i,o),t[e[n]]>t[e[r]]&&qd(e,n,r),t[e[o]]>t[e[r]]&&qd(e,o,r),t[e[n]]>t[e[o]]&&qd(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;qd(e,o,s)}e[n+1]=e[s],e[s]=a,r-o+1>=s-n?(mu(e,t,o,r),mu(e,t,n,s-1)):(mu(e,t,n,s-1),mu(e,t,o,r))}}function qd(e,t,n){let r=e[t];e[t]=e[n],e[n]=r}function PU(e){return e[0]}function zU(e){return e[1]}var Qr=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 ya=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 Vd=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,y=0,g=r.length,b,x;m<g;m+=3,y+=2){let w=r[m]*2,v=r[m+1]*2,_=r[m+2]*2,M=t[w],E=t[w+1],I=t[v],N=t[v+1],A=t[_],B=t[_+1],L=I-M,S=N-E,T=A-M,D=B-E,C=(L*D-S*T)*2;if(Math.abs(C)<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 k=1e9*Math.sign((o-M)*D-(s-E)*T);b=(M+A)/2-k*D,x=(E+B)/2+k*T}else{let k=1/C,F=L*L+S*S,R=T*T+D*D;b=M+(D*F-S*R)*k,x=E+(L*R-T*F)*k}a[y]=b,a[y+1]=x}let c=n[n.length-1],l,u=c*4,f,h=t[2*c],d,p=t[2*c+1];i.fill(0);for(let m=0;m<n.length;++m)c=n[m],l=u,f=h,d=p,u=c*4,h=t[2*c],p=t[2*c+1],i[l+2]=i[u]=d-p,i[l+3]=i[u+1]=h-f}render(t){let n=t==null?t=new Qr: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 h=r[u];if(h<u)continue;let d=Math.floor(u/3)*2,p=Math.floor(h/3)*2,m=s[d],y=s[d+1],g=s[p],b=s[p+1];this._renderSegment(m,y,g,b,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,h=s[f],d=s[f+1],p=c*4,m=this._project(h,d,a[p+2],a[p+3]);m&&this._renderSegment(h,d,m[0],m[1],t)}return n&&n.value()}renderBounds(t){let n=t==null?t=new Qr: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 Qr: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 ya;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,h=0;for(let d=0;d<r;d+=2)if(o=a,s=c,a=n[d],c=n[d+1],l=u,u=this._regioncode(a,c),l===0&&u===0)f=h,h=0,i?i.push(a,c):i=[a,c];else{let p,m,y,g,b;if(l===0){if((p=this._clipSegment(o,s,a,c,l,u))===null)continue;[m,y,g,b]=p}else{if((p=this._clipSegment(a,c,o,s,u,l))===null)continue;[g,b,m,y]=p,f=h,h=this._edgecode(m,y),f&&h&&this._edge(t,f,h,i,i.length),i?i.push(m,y):i=[m,y]}f=h,h=this._edgecode(g,b),f&&h&&this._edge(t,f,h,i,i.length),i?i.push(g,b):i=[g,b]}if(i)f=h,h=this._edgecode(i[0],i[1]),f&&h&&this._edge(t,f,h,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,h=this._edgecode(a[u-2],a[u-1]);l<u;l+=2)f=h,h=this._edgecode(a[l],a[l+1]),f&&h&&(l=this._edge(t,f,h,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 qU=2*Math.PI,gu=Math.pow;function VU(e){return e[0]}function jU(e){return e[1]}function YU(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 WU(e,t,n){return[e+Math.sin(e+t)*n,t+Math.cos(e-t)*n]}var Jr=class e{static from(t,n=VU,r=jU,i){return new e("length"in t?GU(t,n,r,i):Float64Array.from(XU(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&&YU(t)){this.collinear=Int32Array.from({length:n.length/2},(h,d)=>d).sort((h,d)=>n[2*h]-n[2*d]||n[2*h+1]-n[2*d+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 h=0,d=n.length/2;h<d;++h){let p=WU(n[2*h],n[2*h+1],f);n[2*h]=p[0],n[2*h+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 Vd(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=gu(n-l[t*2],2)+gu(r-l[t*2+1],2),h=i[t],d=h;do{let p=c[d],m=gu(n-l[p*2],2)+gu(r-l[p*2+1],2);if(m<f&&(f=m,u=p),d=d%3===2?d-2:d+1,c[d]!==t)break;if(d=a[d],d===-1){if(d=o[(s[t]+1)%o.length],d!==p&&gu(n-l[d*2],2)+gu(r-l[d*2+1],2)<f)return d;break}}while(d!==h);return u}render(t){let n=t==null?t=new Qr: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 Qr: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,qU)}return r&&r.value()}renderHull(t){let n=t==null?t=new Qr: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 ya;return this.renderHull(t),t.value()}renderTriangle(t,n){let r=n==null?n=new Qr: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 ya;return this.renderTriangle(t,n),n.value()}};function GU(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*XU(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 M8(e){return Math.abs(e=Math.round(e))>=1e21?e.toLocaleString("en").replace(/,/g,""):e.toString(10)}function Cc(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 ho(e){return e=Cc(Math.abs(e)),e?e[1]:NaN}function A8(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 T8(e){return function(t){return t.replace(/[0-9]/g,function(n){return e[+n]})}}var HU=/^(?:(.)?([<>=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i;function po(e){if(!(t=HU.exec(e)))throw new Error("invalid format: "+e);var t;return new Tg({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]})}po.prototype=Tg.prototype;function Tg(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+""}Tg.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 E8(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 jv;function D8(e,t){var n=Cc(e,t);if(!n)return e+"";var r=n[0],i=n[1],o=i-(jv=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")+Cc(e,Math.max(0,t+o-1))[0]}function Yv(e,t){var n=Cc(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 Wv={"%":(e,t)=>(e*100).toFixed(t),b:e=>Math.round(e).toString(2),c:e=>e+"",d:M8,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)=>Yv(e*100,t),r:Yv,s:D8,X:e=>Math.round(e).toString(16).toUpperCase(),x:e=>Math.round(e).toString(16)};function Gv(e){return e}var N8=Array.prototype.map,B8=["y","z","a","f","p","n","\xB5","m","","k","M","G","T","P","E","Z","Y"];function O8(e){var t=e.grouping===void 0||e.thousands===void 0?Gv:A8(N8.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?Gv:T8(N8.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=po(f);var h=f.fill,d=f.align,p=f.sign,m=f.symbol,y=f.zero,g=f.width,b=f.comma,x=f.precision,w=f.trim,v=f.type;v==="n"?(b=!0,v="g"):Wv[v]||(x===void 0&&(x=12),w=!0,v="g"),(y||h==="0"&&d==="=")&&(y=!0,h="0",d="=");var _=m==="$"?n:m==="#"&&/[boxX]/.test(v)?"0"+v.toLowerCase():"",M=m==="$"?r:/[%p]/.test(v)?s:"",E=Wv[v],I=/[defgprs%]/.test(v);x=x===void 0?6:/[gprs]/.test(v)?Math.max(1,Math.min(21,x)):Math.max(0,Math.min(20,x));function N(A){var B=_,L=M,S,T,D;if(v==="c")L=E(A)+L,A="";else{A=+A;var C=A<0||1/A<0;if(A=isNaN(A)?c:E(Math.abs(A),x),w&&(A=E8(A)),C&&+A==0&&p!=="+"&&(C=!1),B=(C?p==="("?p:a:p==="-"||p==="("?"":p)+B,L=(v==="s"?B8[8+jv/3]:"")+L+(C&&p==="("?")":""),I){for(S=-1,T=A.length;++S<T;)if(D=A.charCodeAt(S),48>D||D>57){L=(D===46?i+A.slice(S+1):A.slice(S))+L,A=A.slice(0,S);break}}}b&&!y&&(A=t(A,1/0));var k=B.length+A.length+L.length,F=k<g?new Array(g-k+1).join(h):"";switch(b&&y&&(A=t(F+A,F.length?g-L.length:1/0),F=""),d){case"<":A=B+A+L+F;break;case"=":A=B+F+A+L;break;case"^":A=F.slice(0,k=F.length>>1)+B+A+L+F.slice(k);break;default:A=F+B+A+L;break}return o(A)}return N.toString=function(){return f+""},N}function u(f,h){var d=l((f=po(f),f.type="f",f)),p=Math.max(-8,Math.min(8,Math.floor(ho(h)/3)))*3,m=Math.pow(10,-p),y=B8[8+p/3];return function(g){return d(m*g)+y}}return{format:l,formatPrefix:u}}var Eg,ti,Dg;Xv({thousands:",",grouping:[3],currency:["$",""]});function Xv(e){return Eg=O8(e),ti=Eg.format,Dg=Eg.formatPrefix,Eg}function Hv(e){return Math.max(0,-ho(Math.abs(e)))}function Zv(e,t){return Math.max(0,Math.max(-8,Math.min(8,Math.floor(ho(t)/3)))*3-ho(Math.abs(e)))}function Kv(e,t){return e=Math.abs(e),t=Math.abs(t)-e,Math.max(0,ho(t)-ho(e))+1}var tt=1e-6,kc=1e-12,Et=Math.PI,he=Et/2,Qv=Et/4,an=Et*2,Ce=180/Et,zt=Et/180,Ct=Math.abs,ei=Math.atan,We=Math.atan2,Q=Math.cos,jd=Math.ceil,Ng=Math.exp;var Bg=Math.hypot,Rc=Math.log,Og=Math.pow,K=Math.sin,kn=Math.sign||function(e){return e>0?1:e<0?-1:0},de=Math.sqrt,bu=Math.tan;function Lg(e){return e>1?0:e<-1?Et:Math.acos(e)}function we(e){return e>1?he:e<-1?-he:Math.asin(e)}function Ge(){}function Fg(e,t){e&&F8.hasOwnProperty(e.type)&&F8[e.type](e,t)}var L8={Feature:function(e,t){Fg(e.geometry,t)},FeatureCollection:function(e,t){for(var n=e.features,r=-1,i=n.length;++r<i;)Fg(n[r].geometry,t)}},F8={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){Jv(e.coordinates,t,0)},MultiLineString:function(e,t){for(var n=e.coordinates,r=-1,i=n.length;++r<i;)Jv(n[r],t,0)},Polygon:function(e,t){C8(e.coordinates,t)},MultiPolygon:function(e,t){for(var n=e.coordinates,r=-1,i=n.length;++r<i;)C8(n[r],t)},GeometryCollection:function(e,t){for(var n=e.geometries,r=-1,i=n.length;++r<i;)Fg(n[r],t)}};function Jv(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 C8(e,t){var n=-1,r=e.length;for(t.polygonStart();++n<r;)Jv(e[n],t,1);t.polygonEnd()}function Dr(e,t){e&&L8.hasOwnProperty(e.type)?L8[e.type](e,t):Fg(e,t)}function Yd(e){return[We(e[1],e[0]),we(e[2])]}function mo(e){var t=e[0],n=e[1],r=Q(n);return[r*Q(t),r*K(t),K(n)]}function Wd(e,t){return e[0]*t[0]+e[1]*t[1]+e[2]*t[2]}function xu(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 Cg(e,t){e[0]+=t[0],e[1]+=t[1],e[2]+=t[2]}function Gd(e,t){return[e[0]*t,e[1]*t,e[2]*t]}function Xd(e){var t=de(e[0]*e[0]+e[1]*e[1]+e[2]*e[2]);e[0]/=t,e[1]/=t,e[2]/=t}var Hd,kg,Rg,$g,Ug,Pg,zg,qg,t2,e2,n2,$8,U8,Jn,tr,er,Di={sphere:Ge,point:r2,lineStart:k8,lineEnd:R8,polygonStart:function(){Di.lineStart=QU,Di.lineEnd=JU},polygonEnd:function(){Di.lineStart=k8,Di.lineEnd=R8}};function r2(e,t){e*=zt,t*=zt;var n=Q(t);Zd(n*Q(e),n*K(e),K(t))}function Zd(e,t,n){++Hd,Rg+=(e-Rg)/Hd,$g+=(t-$g)/Hd,Ug+=(n-Ug)/Hd}function k8(){Di.point=ZU}function ZU(e,t){e*=zt,t*=zt;var n=Q(t);Jn=n*Q(e),tr=n*K(e),er=K(t),Di.point=KU,Zd(Jn,tr,er)}function KU(e,t){e*=zt,t*=zt;var n=Q(t),r=n*Q(e),i=n*K(e),o=K(t),s=We(de((s=tr*o-er*i)*s+(s=er*r-Jn*o)*s+(s=Jn*i-tr*r)*s),Jn*r+tr*i+er*o);kg+=s,Pg+=s*(Jn+(Jn=r)),zg+=s*(tr+(tr=i)),qg+=s*(er+(er=o)),Zd(Jn,tr,er)}function R8(){Di.point=r2}function QU(){Di.point=tP}function JU(){P8($8,U8),Di.point=r2}function tP(e,t){$8=e,U8=t,e*=zt,t*=zt,Di.point=P8;var n=Q(t);Jn=n*Q(e),tr=n*K(e),er=K(t),Zd(Jn,tr,er)}function P8(e,t){e*=zt,t*=zt;var n=Q(t),r=n*Q(e),i=n*K(e),o=K(t),s=tr*o-er*i,a=er*r-Jn*o,c=Jn*i-tr*r,l=Bg(s,a,c),u=we(l),f=l&&-u/l;t2.add(f*s),e2.add(f*a),n2.add(f*c),kg+=u,Pg+=u*(Jn+(Jn=r)),zg+=u*(tr+(tr=i)),qg+=u*(er+(er=o)),Zd(Jn,tr,er)}function i2(e){Hd=kg=Rg=$g=Ug=Pg=zg=qg=0,t2=new vn,e2=new vn,n2=new vn,Dr(e,Di);var t=+t2,n=+e2,r=+n2,i=Bg(t,n,r);return i<kc&&(t=Pg,n=zg,r=qg,kg<tt&&(t=Rg,n=$g,r=Ug),i=Bg(t,n,r),i<kc)?[NaN,NaN]:[We(n,t)*Ce,we(r/i)*Ce]}function Kd(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 o2(e,t){return Ct(e)>Et&&(e-=Math.round(e/an)*an),[e,t]}o2.invert=o2;function s2(e,t,n){return(e%=an)?t||n?Kd(q8(e),V8(t,n)):q8(e):t||n?V8(t,n):o2}function z8(e){return function(t,n){return t+=e,Ct(t)>Et&&(t-=Math.round(t/an)*an),[t,n]}}function q8(e){var t=z8(e);return t.invert=z8(-e),t}function V8(e,t){var n=Q(e),r=K(e),i=Q(t),o=K(t);function s(a,c){var l=Q(c),u=Q(a)*l,f=K(a)*l,h=K(c),d=h*n+u*r;return[We(f*i-d*o,u*n-h*r),we(d*i+f*o)]}return s.invert=function(a,c){var l=Q(c),u=Q(a)*l,f=K(a)*l,h=K(c),d=h*i-f*o;return[We(f*i+h*o,u*n+d*r),we(d*n-u*r)]},s}function j8(e){e=s2(e[0]*zt,e[1]*zt,e.length>2?e[2]*zt:0);function t(n){return n=e(n[0]*zt,n[1]*zt),n[0]*=Ce,n[1]*=Ce,n}return t.invert=function(n){return n=e.invert(n[0]*zt,n[1]*zt),n[0]*=Ce,n[1]*=Ce,n},t}function W8(e,t,n,r,i,o){if(n){var s=Q(t),a=K(t),c=r*n;i==null?(i=t+r*an,o=t-c/2):(i=Y8(s,i),o=Y8(s,o),(r>0?i<o:i>o)&&(i+=r*an));for(var l,u=i;r>0?u>o:u<o;u-=c)l=Yd([s,-a*Q(u),-a*K(u)]),e.point(l[0],l[1])}}function Y8(e,t){t=mo(t),t[0]-=e,Xd(t);var n=Lg(-t[1]);return((-t[2]<0?-n:n)+an-tt)%an}function Vg(){var e=[],t;return{point:function(n,r,i){t.push([n,r,i])},lineStart:function(){e.push(t=[])},lineEnd:Ge,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 Ct(e[0]-t[0])<tt&&Ct(e[1]-t[1])<tt}function jg(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 Yg(e,t,n,r,i){var o=[],s=[],a,c;if(e.forEach(function(p){if(!((m=p.length-1)<=0)){var m,y=p[0],g=p[m],b;if(wu(y,g)){if(!y[2]&&!g[2]){for(i.lineStart(),a=0;a<m;++a)i.point((y=p[a])[0],y[1]);i.lineEnd();return}g[0]+=2*tt}o.push(b=new jg(y,p,null,!0)),s.push(b.o=new jg(y,null,b,!1)),o.push(b=new jg(g,p,null,!1)),s.push(b.o=new jg(g,null,b,!0))}}),!!o.length){for(s.sort(t),G8(o),G8(s),a=0,c=s.length;a<c;++a)s[a].e=n=!n;for(var l=o[0],u,f;;){for(var h=l,d=!0;h.v;)if((h=h.n)===l)return;u=h.z,i.lineStart();do{if(h.v=h.o.v=!0,h.e){if(d)for(a=0,c=u.length;a<c;++a)i.point((f=u[a])[0],f[1]);else r(h.x,h.n.x,1,i);h=h.n}else{if(d)for(u=h.p.z,a=u.length-1;a>=0;--a)i.point((f=u[a])[0],f[1]);else r(h.x,h.p.x,-1,i);h=h.p}h=h.o,u=h.z,d=!d}while(!h.v);i.lineEnd()}}}function G8(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 a2(e){return Ct(e[0])<=Et?e[0]:kn(e[0])*((Ct(e[0])+Et)%an-Et)}function X8(e,t){var n=a2(t),r=t[1],i=K(r),o=[K(n),-Q(n),0],s=0,a=0,c=new vn;i===1?r=he+tt:i===-1&&(r=-he-tt);for(var l=0,u=e.length;l<u;++l)if(h=(f=e[l]).length)for(var f,h,d=f[h-1],p=a2(d),m=d[1]/2+Qv,y=K(m),g=Q(m),b=0;b<h;++b,p=w,y=_,g=M,d=x){var x=f[b],w=a2(x),v=x[1]/2+Qv,_=K(v),M=Q(v),E=w-p,I=E>=0?1:-1,N=I*E,A=N>Et,B=y*_;if(c.add(We(B*I*K(N),g*M+B*Q(N))),s+=A?E+I*an:E,A^p>=n^w>=n){var L=xu(mo(d),mo(x));Xd(L);var S=xu(o,L);Xd(S);var T=(A^E>=0?-1:1)*we(S[2]);(r>T||r===T&&(L[0]||L[1]))&&(a+=A^E>=0?1:-1)}}return(s<-tt||s<tt&&c<-kc)^a&1}function Wg(e,t,n,r){return function(i){var o=t(i),s=Vg(),a=t(s),c=!1,l,u,f,h={point:d,lineStart:m,lineEnd:y,polygonStart:function(){h.point=g,h.lineStart=b,h.lineEnd=x,u=[],l=[]},polygonEnd:function(){h.point=d,h.lineStart=m,h.lineEnd=y,u=eu(u);var w=X8(l,r);u.length?(c||(i.polygonStart(),c=!0),Yg(u,nP,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 d(w,v){e(w,v)&&i.point(w,v)}function p(w,v){o.point(w,v)}function m(){h.point=p,o.lineStart()}function y(){h.point=d,o.lineEnd()}function g(w,v){f.push([w,v]),a.point(w,v)}function b(){a.lineStart(),f=[]}function x(){g(f[0][0],f[0][1]),a.lineEnd();var w=a.clean(),v=s.result(),_,M=v.length,E,I,N;if(f.pop(),l.push(f),f=null,!!M){if(w&1){if(I=v[0],(E=I.length-1)>0){for(c||(i.polygonStart(),c=!0),i.lineStart(),_=0;_<E;++_)i.point((N=I[_])[0],N[1]);i.lineEnd()}return}M>1&&w&2&&v.push(v.pop().concat(v.shift())),u.push(v.filter(eP))}}return h}}function eP(e){return e.length>1}function nP(e,t){return((e=e.x)[0]<0?e[1]-he-tt:he-e[1])-((t=t.x)[0]<0?t[1]-he-tt:he-t[1])}var c2=Wg(function(){return!0},rP,oP,[-Et,-he]);function rP(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=Ct(o-t);Ct(c-Et)<tt?(e.point(t,n=(n+s)/2>0?he:-he),e.point(r,n),e.lineEnd(),e.lineStart(),e.point(a,n),e.point(o,n),i=0):r!==a&&c>=Et&&(Ct(t-r)<tt&&(t-=r*tt),Ct(o-a)<tt&&(o-=a*tt),n=iP(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 iP(e,t,n,r){var i,o,s=K(e-n);return Ct(s)>tt?ei((K(t)*(o=Q(r))*K(n)-K(r)*(i=Q(t))*K(e))/(i*o*s)):(t+r)/2}function oP(e,t,n,r){var i;if(e==null)i=n*he,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(Ct(e[0]-t[0])>tt){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 H8(e){var t=Q(e),n=6*zt,r=t>0,i=Ct(t)>tt;function o(u,f,h,d){W8(d,e,n,h,u,f)}function s(u,f){return Q(u)*Q(f)>t}function a(u){var f,h,d,p,m;return{lineStart:function(){p=d=!1,m=1},point:function(y,g){var b=[y,g],x,w=s(y,g),v=r?w?0:l(y,g):w?l(y+(y<0?Et:-Et),g):0;if(!f&&(p=d=w)&&u.lineStart(),w!==d&&(x=c(f,b),(!x||wu(f,x)||wu(b,x))&&(b[2]=1)),w!==d)m=0,w?(u.lineStart(),x=c(b,f),u.point(x[0],x[1])):(x=c(f,b),u.point(x[0],x[1],2),u.lineEnd()),f=x;else if(i&&f&&r^w){var _;!(v&h)&&(_=c(b,f,!0))&&(m=0,r?(u.lineStart(),u.point(_[0][0],_[0][1]),u.point(_[1][0],_[1][1]),u.lineEnd()):(u.point(_[1][0],_[1][1]),u.lineEnd(),u.lineStart(),u.point(_[0][0],_[0][1],3)))}w&&(!f||!wu(f,b))&&u.point(b[0],b[1]),f=b,d=w,h=v},lineEnd:function(){d&&u.lineEnd(),f=null},clean:function(){return m|(p&&d)<<1}}}function c(u,f,h){var d=mo(u),p=mo(f),m=[1,0,0],y=xu(d,p),g=Wd(y,y),b=y[0],x=g-b*b;if(!x)return!h&&u;var w=t*g/x,v=-t*b/x,_=xu(m,y),M=Gd(m,w),E=Gd(y,v);Cg(M,E);var I=_,N=Wd(M,I),A=Wd(I,I),B=N*N-A*(Wd(M,M)-1);if(!(B<0)){var L=de(B),S=Gd(I,(-N-L)/A);if(Cg(S,M),S=Yd(S),!h)return S;var T=u[0],D=f[0],C=u[1],k=f[1],F;D<T&&(F=T,T=D,D=F);var R=D-T,$=Ct(R-Et)<tt,U=$||R<tt;if(!$&&k<C&&(F=C,C=k,k=F),U?$?C+k>0^S[1]<(Ct(S[0]-T)<tt?C:k):C<=S[1]&&S[1]<=k:R>Et^(T<=S[0]&&S[0]<=D)){var G=Gd(I,(-N+L)/A);return Cg(G,M),[S,Yd(G)]}}}function l(u,f){var h=r?e:Et-e,d=0;return u<-h?d|=1:u>h&&(d|=2),f<-h?d|=4:f>h&&(d|=8),d}return Wg(s,a,o,r?[0,-e]:[-Et,e-Et])}function Z8(e,t,n,r,i,o){var s=e[0],a=e[1],c=t[0],l=t[1],u=0,f=1,h=c-s,d=l-a,p;if(p=n-s,!(!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=i-s,!(!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)}if(p=r-a,!(!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=o-a,!(!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)}return u>0&&(e[0]=s+u*h,e[1]=a+u*d),f<1&&(t[0]=s+f*h,t[1]=a+f*d),!0}}}}}var Qd=1e9,Gg=-Qd;function _u(e,t,n,r){function i(l,u){return e<=l&&l<=n&&t<=u&&u<=r}function o(l,u,f,h){var d=0,p=0;if(l==null||(d=s(l,f))!==(p=s(u,f))||c(l,u)<0^f>0)do h.point(d===0||d===3?e:n,d>1?r:t);while((d=(d+f+4)%4)!==p);else h.point(u[0],u[1])}function s(l,u){return Ct(l[0]-e)<tt?u>0?0:3:Ct(l[0]-n)<tt?u>0?2:1:Ct(l[1]-t)<tt?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),h=s(u,1);return f!==h?f-h: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=Vg(),h,d,p,m,y,g,b,x,w,v,_,M={point:E,lineStart:B,lineEnd:L,polygonStart:N,polygonEnd:A};function E(T,D){i(T,D)&&u.point(T,D)}function I(){for(var T=0,D=0,C=d.length;D<C;++D)for(var k=d[D],F=1,R=k.length,$=k[0],U,G,et=$[0],rt=$[1];F<R;++F)U=et,G=rt,$=k[F],et=$[0],rt=$[1],G<=r?rt>r&&(et-U)*(r-G)>(rt-G)*(e-U)&&++T:rt<=r&&(et-U)*(r-G)<(rt-G)*(e-U)&&--T;return T}function N(){u=f,h=[],d=[],_=!0}function A(){var T=I(),D=_&&T,C=(h=eu(h)).length;(D||C)&&(l.polygonStart(),D&&(l.lineStart(),o(null,null,1,l),l.lineEnd()),C&&Yg(h,a,T,o,l),l.polygonEnd()),u=l,h=d=p=null}function B(){M.point=S,d&&d.push(p=[]),v=!0,w=!1,b=x=NaN}function L(){h&&(S(m,y),g&&w&&f.rejoin(),h.push(f.result())),M.point=E,w&&u.lineEnd()}function S(T,D){var C=i(T,D);if(d&&p.push([T,D]),v)m=T,y=D,g=C,v=!1,C&&(u.lineStart(),u.point(T,D));else if(C&&w)u.point(T,D);else{var k=[b=Math.max(Gg,Math.min(Qd,b)),x=Math.max(Gg,Math.min(Qd,x))],F=[T=Math.max(Gg,Math.min(Qd,T)),D=Math.max(Gg,Math.min(Qd,D))];Z8(k,F,e,t,n,r)?(w||(u.lineStart(),u.point(k[0],k[1])),u.point(F[0],F[1]),C||u.lineEnd(),_=!1):C&&(u.lineStart(),u.point(T,D),_=!1)}b=T,x=D,w=C}return M}}function K8(e,t,n){var r=Re(e,t-tt,n).concat(t);return function(i){return r.map(function(o){return[i,o]})}}function Q8(e,t,n){var r=Re(e,t-tt,n).concat(t);return function(i){return r.map(function(o){return[o,i]})}}function l2(){var e,t,n,r,i,o,s,a,c=10,l=c,u=90,f=360,h,d,p,m,y=2.5;function g(){return{type:"MultiLineString",coordinates:b()}}function b(){return Re(jd(r/u)*u,n,u).map(p).concat(Re(jd(a/f)*f,s,f).map(m)).concat(Re(jd(t/c)*c,e,c).filter(function(x){return Ct(x%u)>tt}).map(h)).concat(Re(jd(o/l)*l,i,l).filter(function(x){return Ct(x%f)>tt}).map(d))}return g.lines=function(){return b().map(function(x){return{type:"LineString",coordinates:x}})},g.outline=function(){return{type:"Polygon",coordinates:[p(r).concat(m(s).slice(1),p(n).reverse().slice(1),m(a).reverse().slice(1))]}},g.extent=function(x){return arguments.length?g.extentMajor(x).extentMinor(x):g.extentMinor()},g.extentMajor=function(x){return arguments.length?(r=+x[0][0],n=+x[1][0],a=+x[0][1],s=+x[1][1],r>n&&(x=r,r=n,n=x),a>s&&(x=a,a=s,s=x),g.precision(y)):[[r,a],[n,s]]},g.extentMinor=function(x){return arguments.length?(t=+x[0][0],e=+x[1][0],o=+x[0][1],i=+x[1][1],t>e&&(x=t,t=e,e=x),o>i&&(x=o,o=i,i=x),g.precision(y)):[[t,o],[e,i]]},g.step=function(x){return arguments.length?g.stepMajor(x).stepMinor(x):g.stepMinor()},g.stepMajor=function(x){return arguments.length?(u=+x[0],f=+x[1],g):[u,f]},g.stepMinor=function(x){return arguments.length?(c=+x[0],l=+x[1],g):[c,l]},g.precision=function(x){return arguments.length?(y=+x,h=K8(o,i,90),d=Q8(t,e,y),p=K8(a,s,90),m=Q8(r,n,y),g):y},g.extentMajor([[-180,-90+tt],[180,90-tt]]).extentMinor([[-180,-80-tt],[180,80+tt]])}function u2(){return l2()()}var Jd=e=>e;var f2=new vn,h2=new vn,J8,tE,d2,p2,ga={point:Ge,lineStart:Ge,lineEnd:Ge,polygonStart:function(){ga.lineStart=sP,ga.lineEnd=cP},polygonEnd:function(){ga.lineStart=ga.lineEnd=ga.point=Ge,f2.add(Ct(h2)),h2=new vn},result:function(){var e=f2/2;return f2=new vn,e}};function sP(){ga.point=aP}function aP(e,t){ga.point=eE,J8=d2=e,tE=p2=t}function eE(e,t){h2.add(p2*e-d2*t),d2=e,p2=t}function cP(){eE(J8,tE)}var m2=ga;var vu=1/0,Xg=vu,tp=-vu,Hg=tp,lP={point:uP,lineStart:Ge,lineEnd:Ge,polygonStart:Ge,polygonEnd:Ge,result:function(){var e=[[vu,Xg],[tp,Hg]];return tp=Hg=-(Xg=vu=1/0),e}};function uP(e,t){e<vu&&(vu=e),e>tp&&(tp=e),t<Xg&&(Xg=t),t>Hg&&(Hg=t)}var Su=lP;var y2=0,g2=0,ep=0,Zg=0,Kg=0,Iu=0,b2=0,x2=0,np=0,iE,oE,yo,go,Ni={point:$c,lineStart:nE,lineEnd:rE,polygonStart:function(){Ni.lineStart=dP,Ni.lineEnd=pP},polygonEnd:function(){Ni.point=$c,Ni.lineStart=nE,Ni.lineEnd=rE},result:function(){var e=np?[b2/np,x2/np]:Iu?[Zg/Iu,Kg/Iu]:ep?[y2/ep,g2/ep]:[NaN,NaN];return y2=g2=ep=Zg=Kg=Iu=b2=x2=np=0,e}};function $c(e,t){y2+=e,g2+=t,++ep}function nE(){Ni.point=fP}function fP(e,t){Ni.point=hP,$c(yo=e,go=t)}function hP(e,t){var n=e-yo,r=t-go,i=de(n*n+r*r);Zg+=i*(yo+e)/2,Kg+=i*(go+t)/2,Iu+=i,$c(yo=e,go=t)}function rE(){Ni.point=$c}function dP(){Ni.point=mP}function pP(){sE(iE,oE)}function mP(e,t){Ni.point=sE,$c(iE=yo=e,oE=go=t)}function sE(e,t){var n=e-yo,r=t-go,i=de(n*n+r*r);Zg+=i*(yo+e)/2,Kg+=i*(go+t)/2,Iu+=i,i=go*e-yo*t,b2+=i*(yo+e),x2+=i*(go+t),np+=i*3,$c(yo=e,go=t)}var w2=Ni;function Qg(e){this._context=e}Qg.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,an);break}}},result:Ge};var v2=new vn,_2,aE,cE,rp,ip,Jg={point:Ge,lineStart:function(){Jg.point=yP},lineEnd:function(){_2&&lE(aE,cE),Jg.point=Ge},polygonStart:function(){_2=!0},polygonEnd:function(){_2=null},result:function(){var e=+v2;return v2=new vn,e}};function yP(e,t){Jg.point=lE,aE=rp=e,cE=ip=t}function lE(e,t){rp-=e,ip-=t,v2.add(de(rp*rp+ip*ip)),rp=e,ip=t}var S2=Jg;var uE,tb,fE,hE,Mu=class{constructor(t){this._append=t==null?dE:gP(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!==fE||this._append!==tb){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`,fE=r,tb=this._append,hE=this._,this._=i}this._+=hE;break}}}result(){let t=this._;return this._="",t.length?t:null}};function dE(e){let t=1;this._+=e[0];for(let n=e.length;t<n;++t)this._+=arguments[t]+e[t]}function gP(e){let t=Math.floor(e);if(!(t>=0))throw new RangeError(`invalid digits: ${e}`);if(t>15)return dE;if(t!==uE){let n=10**t;uE=t,tb=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 tb}function An(e,t){let n=3,r=4.5,i,o;function s(a){return a&&(typeof r=="function"&&o.pointRadius(+r.apply(this,arguments)),Dr(a,i(o))),o.result()}return s.area=function(a){return Dr(a,i(m2)),m2.result()},s.measure=function(a){return Dr(a,i(S2)),S2.result()},s.bounds=function(a){return Dr(a,i(Su)),Su.result()},s.centroid=function(a){return Dr(a,i(w2)),w2.result()},s.projection=function(a){return arguments.length?(i=a==null?(e=null,Jd):(e=a).stream,s):e},s.context=function(a){return arguments.length?(o=a==null?(t=null,new Mu(n)):new Qg(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 Mu(n)),s},s.projection(e).digits(n).context(t)}function Uc(e){return{stream:Au(e)}}function Au(e){return function(t){var n=new I2;for(var r in e)n[r]=e[r];return n.stream=t,n}}function I2(){}I2.prototype={constructor:I2,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 M2(e,t,n){var r=e.clipExtent&&e.clipExtent();return e.scale(150).translate([0,0]),r!=null&&e.clipExtent(null),Dr(n,e.stream(Su)),t(Su.result()),r!=null&&e.clipExtent(r),e}function op(e,t,n){return M2(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 eb(e,t,n){return op(e,[[0,0],t],n)}function nb(e,t,n){return M2(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 rb(e,t,n){return M2(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 pE=16,bP=Q(30*zt);function A2(e,t){return+t?wP(e,t):xP(e)}function xP(e){return Au({point:function(t,n){t=e(t,n),this.stream.point(t[0],t[1])}})}function wP(e,t){function n(r,i,o,s,a,c,l,u,f,h,d,p,m,y){var g=l-r,b=u-i,x=g*g+b*b;if(x>4*t&&m--){var w=s+h,v=a+d,_=c+p,M=de(w*w+v*v+_*_),E=we(_/=M),I=Ct(Ct(_)-1)<tt||Ct(o-f)<tt?(o+f)/2:We(v,w),N=e(I,E),A=N[0],B=N[1],L=A-r,S=B-i,T=b*L-g*S;(T*T/x>t||Ct((g*L+b*S)/x-.5)>.3||s*h+a*d+c*p<bP)&&(n(r,i,o,s,a,c,A,B,I,w/=M,v/=M,_,m,y),y.point(A,B),n(A,B,I,w,v,_,l,u,f,h,d,p,m,y))}}return function(r){var i,o,s,a,c,l,u,f,h,d,p,m,y={point:g,lineStart:b,lineEnd:w,polygonStart:function(){r.polygonStart(),y.lineStart=v},polygonEnd:function(){r.polygonEnd(),y.lineStart=b}};function g(E,I){E=e(E,I),r.point(E[0],E[1])}function b(){f=NaN,y.point=x,r.lineStart()}function x(E,I){var N=mo([E,I]),A=e(E,I);n(f,h,u,d,p,m,f=A[0],h=A[1],u=E,d=N[0],p=N[1],m=N[2],pE,r),r.point(f,h)}function w(){y.point=g,r.lineEnd()}function v(){b(),y.point=_,y.lineEnd=M}function _(E,I){x(i=E,I),o=f,s=h,a=d,c=p,l=m,y.point=x}function M(){n(f,h,u,d,p,m,o,s,i,a,c,l,pE,r),y.lineEnd=w,w()}return y}}var _P=Au({point:function(e,t){this.stream.point(e*zt,t*zt)}});function vP(e){return Au({point:function(t,n){var r=e(t,n);return this.stream.point(r[0],r[1])}})}function SP(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 mE(e,t,n,r,i,o){if(!o)return SP(e,t,n,r,i);var s=Q(o),a=K(o),c=s*e,l=a*e,u=s/e,f=a/e,h=(a*n-s*t)/e,d=(a*t+s*n)/e;function p(m,y){return m*=r,y*=i,[c*m-l*y+t,n-l*m-c*y]}return p.invert=function(m,y){return[r*(u*m-f*y+h),i*(d-f*m-u*y)]},p}function Tn(e){return T2(function(){return e})()}function T2(e){var t,n=150,r=480,i=250,o=0,s=0,a=0,c=0,l=0,u,f=0,h=1,d=1,p=null,m=c2,y=null,g,b,x,w=Jd,v=.5,_,M,E,I,N;function A(T){return E(T[0]*zt,T[1]*zt)}function B(T){return T=E.invert(T[0],T[1]),T&&[T[0]*Ce,T[1]*Ce]}A.stream=function(T){return I&&N===T?I:I=_P(vP(u)(m(_(w(N=T)))))},A.preclip=function(T){return arguments.length?(m=T,p=void 0,S()):m},A.postclip=function(T){return arguments.length?(w=T,y=g=b=x=null,S()):w},A.clipAngle=function(T){return arguments.length?(m=+T?H8(p=T*zt):(p=null,c2),S()):p*Ce},A.clipExtent=function(T){return arguments.length?(w=T==null?(y=g=b=x=null,Jd):_u(y=+T[0][0],g=+T[0][1],b=+T[1][0],x=+T[1][1]),S()):y==null?null:[[y,g],[b,x]]},A.scale=function(T){return arguments.length?(n=+T,L()):n},A.translate=function(T){return arguments.length?(r=+T[0],i=+T[1],L()):[r,i]},A.center=function(T){return arguments.length?(o=T[0]%360*zt,s=T[1]%360*zt,L()):[o*Ce,s*Ce]},A.rotate=function(T){return arguments.length?(a=T[0]%360*zt,c=T[1]%360*zt,l=T.length>2?T[2]%360*zt:0,L()):[a*Ce,c*Ce,l*Ce]},A.angle=function(T){return arguments.length?(f=T%360*zt,L()):f*Ce},A.reflectX=function(T){return arguments.length?(h=T?-1:1,L()):h<0},A.reflectY=function(T){return arguments.length?(d=T?-1:1,L()):d<0},A.precision=function(T){return arguments.length?(_=A2(M,v=T*T),S()):de(v)},A.fitExtent=function(T,D){return op(A,T,D)},A.fitSize=function(T,D){return eb(A,T,D)},A.fitWidth=function(T,D){return nb(A,T,D)},A.fitHeight=function(T,D){return rb(A,T,D)};function L(){var T=mE(n,0,0,h,d,f).apply(null,t(o,s)),D=mE(n,r-T[0],i-T[1],h,d,f);return u=s2(a,c,l),M=Kd(t,D),E=Kd(u,M),_=A2(M,v),S()}function S(){return I=N=null,A}return function(){return t=e.apply(this,arguments),A.invert=t.invert&&B,L()}}function Tu(e){var t=0,n=Et/3,r=T2(e),i=r(t,n);return i.parallels=function(o){return arguments.length?r(t=o[0]*zt,n=o[1]*zt):[t*Ce,n*Ce]},i}function yE(e){var t=Q(e);function n(r,i){return[r*t,K(i)/t]}return n.invert=function(r,i){return[r/t,we(i*t)]},n}function gE(e,t){var n=K(e),r=(n+K(t))/2;if(Ct(r)<tt)return yE(e);var i=1+n*(2*r-n),o=de(i)/r;function s(a,c){var l=de(i-2*r*K(c))/r;return[l*K(a*=r),o-l*Q(a)]}return s.invert=function(a,c){var l=o-c,u=We(a,Ct(l))*kn(l);return l*r<0&&(u-=Et*kn(a)*kn(l)),[u/r,we((i-(a*a+l*l)*r*r)/(2*r))]},s}function ba(){return Tu(gE).scale(155.424).center([0,33.6442])}function sp(){return ba().parallels([29.5,45.5]).scale(1070).translate([480,250]).rotate([96,0]).center([-.6,38.7])}function IP(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 E2(){var e,t,n=sp(),r,i=ba().rotate([154,0]).center([-2,58.5]).parallels([55,65]),o,s=ba().rotate([157,0]).center([-3,19.9]).parallels([8,18]),a,c,l={point:function(h,d){c=[h,d]}};function u(h){var d=h[0],p=h[1];return c=null,r.point(d,p),c||(o.point(d,p),c)||(a.point(d,p),c)}u.invert=function(h){var d=n.scale(),p=n.translate(),m=(h[0]-p[0])/d,y=(h[1]-p[1])/d;return(y>=.12&&y<.234&&m>=-.425&&m<-.214?i:y>=.166&&y<.234&&m>=-.214&&m<-.115?s:n).invert(h)},u.stream=function(h){return e&&t===h?e:e=IP([n.stream(t=h),i.stream(h),s.stream(h)])},u.precision=function(h){return arguments.length?(n.precision(h),i.precision(h),s.precision(h),f()):n.precision()},u.scale=function(h){return arguments.length?(n.scale(h),i.scale(h*.35),s.scale(h),u.translate(n.translate())):n.scale()},u.translate=function(h){if(!arguments.length)return n.translate();var d=n.scale(),p=+h[0],m=+h[1];return r=n.translate(h).clipExtent([[p-.455*d,m-.238*d],[p+.455*d,m+.238*d]]).stream(l),o=i.translate([p-.307*d,m+.201*d]).clipExtent([[p-.425*d+tt,m+.12*d+tt],[p-.214*d-tt,m+.234*d-tt]]).stream(l),a=s.translate([p-.205*d,m+.212*d]).clipExtent([[p-.214*d+tt,m+.166*d+tt],[p-.115*d-tt,m+.234*d-tt]]).stream(l),f()},u.fitExtent=function(h,d){return op(u,h,d)},u.fitSize=function(h,d){return eb(u,h,d)},u.fitWidth=function(h,d){return nb(u,h,d)},u.fitHeight=function(h,d){return rb(u,h,d)};function f(){return e=t=null,u}return u.scale(1070)}function ib(e){return function(t,n){var r=Q(t),i=Q(n),o=e(r*i);return o===1/0?[2,0]:[o*i*K(t),o*K(n)]}}function bo(e){return function(t,n){var r=de(t*t+n*n),i=e(r),o=K(i),s=Q(i);return[We(t*o,r*s),we(r&&n*o/r)]}}var D2=ib(function(e){return de(2/(1+e))});D2.invert=bo(function(e){return 2*we(e/2)});function N2(){return Tn(D2).scale(124.75).clipAngle(180-.001)}var B2=ib(function(e){return(e=Lg(e))&&e/K(e)});B2.invert=bo(function(e){return e});function O2(){return Tn(B2).scale(79.4188).clipAngle(180-.001)}function Eu(e,t){return[e,Rc(bu((he+t)/2))]}Eu.invert=function(e,t){return[e,2*ei(Ng(t))-he]};function L2(){return F2(Eu).scale(961/an)}function F2(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(),h=t(j8(t.rotate()).invert([0,0]));return o(s==null?[[h[0]-f,h[1]-f],[h[0]+f,h[1]+f]]:e===Eu?[[Math.max(h[0]-f,s),a],[Math.min(h[0]+f,c),l]]:[[s,Math.max(h[1]-f,a)],[c,Math.min(h[1]+f,l)]])}return u()}function ob(e){return bu((he+e)/2)}function bE(e,t){var n=Q(e),r=e===t?K(e):Rc(n/Q(t))/Rc(ob(t)/ob(e)),i=n*Og(ob(e),r)/r;if(!r)return Eu;function o(s,a){i>0?a<-he+tt&&(a=-he+tt):a>he-tt&&(a=he-tt);var c=i/Og(ob(a),r);return[c*K(r*s),i-c*Q(r*s)]}return o.invert=function(s,a){var c=i-a,l=kn(r)*de(s*s+c*c),u=We(s,Ct(c))*kn(c);return c*r<0&&(u-=Et*kn(s)*kn(c)),[u/r,2*ei(Og(i/l,1/r))-he]},o}function C2(){return Tu(bE).scale(109.5).parallels([30,30])}function Du(e,t){return[e,t]}Du.invert=Du;function k2(){return Tn(Du).scale(152.63)}function xE(e,t){var n=Q(e),r=e===t?K(e):(n-Q(t))/(t-e),i=n/r+e;if(Ct(r)<tt)return Du;function o(s,a){var c=i-a,l=r*s;return[c*K(l),i-c*Q(l)]}return o.invert=function(s,a){var c=i-a,l=We(s,Ct(c))*kn(c);return c*r<0&&(l-=Et*kn(s)*kn(c)),[l/r,i-kn(r)*de(s*s+c*c)]},o}function R2(){return Tu(xE).scale(131.154).center([0,13.9389])}var ap=1.340264,cp=-.081106,lp=893e-6,up=.003796,sb=de(3)/2,MP=12;function $2(e,t){var n=we(sb*K(t)),r=n*n,i=r*r*r;return[e*Q(n)/(sb*(ap+3*cp*r+i*(7*lp+9*up*r))),n*(ap+cp*r+i*(lp+up*r))]}$2.invert=function(e,t){for(var n=t,r=n*n,i=r*r*r,o=0,s,a,c;o<MP&&(a=n*(ap+cp*r+i*(lp+up*r))-t,c=ap+3*cp*r+i*(7*lp+9*up*r),n-=s=a/c,r=n*n,i=r*r*r,!(Ct(s)<kc));++o);return[sb*e*(ap+3*cp*r+i*(7*lp+9*up*r))/Q(n),we(K(n)/sb)]};function U2(){return Tn($2).scale(177.158)}function P2(e,t){var n=Q(t),r=Q(e)*n;return[n*K(e)/r,K(t)/r]}P2.invert=bo(ei);function z2(){return Tn(P2).scale(144.049).clipAngle(60)}function q2(e,t){return[Q(t)*K(e),K(t)]}q2.invert=bo(we);function V2(){return Tn(q2).scale(249.5).clipAngle(90+tt)}function j2(e,t){var n=Q(t),r=1+Q(e)*n;return[n*K(e)/r,K(t)/r]}j2.invert=bo(function(e){return 2*ei(e)});function Y2(){return Tn(j2).scale(250).clipAngle(142)}function W2(e,t){return[Rc(bu((he+t)/2)),-e]}W2.invert=function(e,t){return[-t,2*ei(Ng(e))-he]};function G2(){var e=F2(W2),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 AP(e,t){return e.parent===t.parent?1:2}function TP(e){return e.reduce(EP,0)/e.length}function EP(e,t){return e+t.x}function DP(e){return 1+e.reduce(NP,0)}function NP(e,t){return Math.max(e,t.y)}function BP(e){for(var t;t=e.children;)e=t[0];return e}function OP(e){for(var t;t=e.children;)e=t[t.length-1];return e}function ab(){var e=AP,t=1,n=1,r=!1;function i(o){var s,a=0;o.eachAfter(function(h){var d=h.children;d?(h.x=TP(d),h.y=DP(d)):(h.x=s?a+=e(h,s):0,h.y=0,s=h)});var c=BP(o),l=OP(o),u=c.x-e(c,l)/2,f=l.x+e(l,c)/2;return o.eachAfter(r?function(h){h.x=(h.x-o.x)*t,h.y=(o.y-h.y)*n}:function(h){h.x=(h.x-u)/(f-u)*t,h.y=(1-(o.y?h.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 LP(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 wE(){return this.eachAfter(LP)}function _E(e,t){let n=-1;for(let r of this)e.call(t,r,++n,this);return this}function vE(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 SE(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 IE(e,t){let n=-1;for(let r of this)if(e.call(t,r,++n,this))return r}function ME(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 AE(e){return this.eachBefore(function(t){t.children&&t.children.sort(e)})}function TE(e){for(var t=this,n=FP(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 FP(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 EE(){for(var e=this,t=[e];e=e.parent;)t.push(e);return t}function DE(){return Array.from(this)}function NE(){var e=[];return this.eachBefore(function(t){t.children||e.push(t)}),e}function BE(){var e=this,t=[];return e.each(function(n){n!==e&&t.push({source:n.parent,target:n})}),t}function*OE(){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 X2(e,t){e instanceof Map?(e=[void 0,e],t===void 0&&(t=RP)):t===void 0&&(t=kP);for(var n=new xa(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 xa(s[a])),o.parent=r,o.depth=r.depth+1;return n.eachBefore(H2)}function CP(){return X2(this).eachBefore($P)}function kP(e){return e.children}function RP(e){return Array.isArray(e)?e[1]:null}function $P(e){e.data.value!==void 0&&(e.value=e.data.value),e.data=e.data.data}function H2(e){var t=0;do e.height=t;while((e=e.parent)&&e.height<++t)}function xa(e){this.data=e,this.depth=this.height=0,this.parent=null}xa.prototype=X2.prototype={constructor:xa,count:wE,each:_E,eachAfter:SE,eachBefore:vE,find:IE,sum:ME,sort:AE,path:TE,ancestors:EE,descendants:DE,leaves:NE,links:BE,copy:CP,[Symbol.iterator]:OE};function cb(e){return e==null?null:UP(e)}function UP(e){if(typeof e!="function")throw new Error;return e}var PP={depth:-1},LE={},Z2={};function zP(e){return e.id}function qP(e){return e.parentId}function lb(){var e=zP,t=qP,n;function r(i){var o=Array.from(i),s=e,a=t,c,l,u,f,h,d,p,m,y=new Map;if(n!=null){let g=o.map((w,v)=>VP(n(w,v,i))),b=g.map(FE),x=new Set(g).add("");for(let w of b)x.has(w)||(x.add(w),g.push(w),b.push(FE(w)),o.push(Z2));s=(w,v)=>g[v],a=(w,v)=>b[v]}for(u=0,c=o.length;u<c;++u)l=o[u],d=o[u]=new xa(l),(p=s(l,u,i))!=null&&(p+="")&&(m=d.id=p,y.set(m,y.has(m)?LE:d)),(p=a(l,u,i))!=null&&(p+="")&&(d.parent=p);for(u=0;u<c;++u)if(d=o[u],p=d.parent){if(h=y.get(p),!h)throw new Error("missing: "+p);if(h===LE)throw new Error("ambiguous: "+p);h.children?h.children.push(d):h.children=[d],d.parent=h}else{if(f)throw new Error("multiple roots");f=d}if(!f)throw new Error("no root");if(n!=null){for(;f.data===Z2&&f.children.length===1;)f=f.children[0],--c;for(let g=o.length-1;g>=0&&(d=o[g],d.data===Z2);--g)d.data=null}if(f.parent=PP,f.eachBefore(function(g){g.depth=g.parent.depth+1,--c}).eachBefore(H2),f.parent=null,c>0)throw new Error("cycle");return f}return r.id=function(i){return arguments.length?(e=cb(i),r):e},r.parentId=function(i){return arguments.length?(t=cb(i),r):t},r.path=function(i){return arguments.length?(n=cb(i),r):n},r}function VP(e){e=`${e}`;let t=e.length;return K2(e,t-1)&&!K2(e,t-2)&&(e=e.slice(0,-1)),e[0]==="/"?e:`/${e}`}function FE(e){let t=e.length;if(t<2)return"";for(;--t>1&&!K2(e,t););return e.slice(0,t)}function K2(e,t){if(e[t]==="/"){let n=0;for(;t>0&&e[--t]==="\\";)++n;if(!(n&1))return!0}return!1}function jP(e,t){return e.parent===t.parent?1:2}function Q2(e){var t=e.children;return t?t[0]:e.t}function J2(e){var t=e.children;return t?t[t.length-1]:e.t}function YP(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 WP(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 GP(e,t,n){return e.a.parent===t.parent?e.a:n}function ub(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}ub.prototype=Object.create(xa.prototype);function XP(e){for(var t=new ub(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 ub(o[s],s)),i.parent=n;return(t.parent=new ub(null,0)).children=[t],t}function Pc(){var e=jP,t=1,n=1,r=null;function i(l){var u=XP(l);if(u.eachAfter(o),u.parent.m=-u.z,u.eachBefore(s),r)l.eachBefore(c);else{var f=l,h=l,d=l;l.eachBefore(function(b){b.x<f.x&&(f=b),b.x>h.x&&(h=b),b.depth>d.depth&&(d=b)});var p=f===h?1:e(f,h)/2,m=p-f.x,y=t/(h.x+p+m),g=n/(d.depth||1);l.eachBefore(function(b){b.x=(b.x+m)*y,b.y=b.depth*g})}return l}function o(l){var u=l.children,f=l.parent.children,h=l.i?f[l.i-1]:null;if(u){WP(l);var d=(u[0].z+u[u.length-1].z)/2;h?(l.z=h.z+e(l._,h._),l.m=l.z-d):l.z=d}else h&&(l.z=h.z+e(l._,h._));l.parent.A=a(l,h,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 h=l,d=l,p=u,m=h.parent.children[0],y=h.m,g=d.m,b=p.m,x=m.m,w;p=J2(p),h=Q2(h),p&&h;)m=Q2(m),d=J2(d),d.a=l,w=p.z+b-h.z-y+e(p._,h._),w>0&&(YP(GP(p,l,f),l,w),y+=w,g+=w),b+=p.m,y+=h.m,x+=m.m,g+=d.m;p&&!J2(d)&&(d.t=p,d.m+=b-g),h&&!Q2(m)&&(m.t=h,m.m+=y-x,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 CE=23283064365386963e-26;function zc(e=Math.random()){let t=(0<=e&&e<1?e/CE:Math.abs(e))|0;return()=>(t=1664525*t+1013904223|0,CE*(t>>>0))}function Xe(e,t){switch(arguments.length){case 0:break;case 1:this.range(e);break;default:this.range(t).domain(e);break}return this}function fp(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 qc(){var e=new Wn,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 Wn;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 qc(t,n).unknown(r)},Xe.apply(i,arguments),i}function wa(){var e=qc().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 h=t().length,d=i<r,p=d?i:r,m=d?r:i;o=(m-p)/Math.max(1,h-c+l*2),a&&(o=Math.floor(o)),p+=(m-p-o*(h-c))*u,s=o*(1-c),a&&(p=Math.round(p),s=Math.round(s));var y=Re(h).map(function(g){return p+o*g});return n(d?y.reverse():y)}return e.domain=function(h){return arguments.length?(t(h),f()):t()},e.range=function(h){return arguments.length?([r,i]=h,r=+r,i=+i,f()):[r,i]},e.rangeRound=function(h){return[r,i]=h,r=+r,i=+i,a=!0,f()},e.bandwidth=function(){return s},e.step=function(){return o},e.round=function(h){return arguments.length?(a=!!h,f()):a},e.padding=function(h){return arguments.length?(c=Math.min(1,l=+h),f()):c},e.paddingInner=function(h){return arguments.length?(c=Math.min(1,h),f()):c},e.paddingOuter=function(h){return arguments.length?(l=+h,f()):l},e.align=function(h){return arguments.length?(u=Math.max(0,Math.min(1,h)),f()):u},e.copy=function(){return wa(t(),[r,i]).round(a).paddingInner(c).paddingOuter(l).align(u)},Xe.apply(f(),arguments)}function kE(e){var t=e.copy;return e.padding=e.paddingOuter,delete e.paddingInner,delete e.paddingOuter,e.copy=function(){return kE(t())},e}function tS(){return kE(wa.apply(null,arguments).paddingInner(1))}function eS(e){return function(){return e}}function Nu(e){return+e}var RE=[0,1];function mr(e){return e}function nS(e,t){return(t-=e=+e)?function(n){return(n-e)/t}:eS(isNaN(t)?NaN:.5)}function HP(e,t){var n;return e>t&&(n=e,e=t,t=n),function(r){return Math.max(e,Math.min(t,r))}}function ZP(e,t,n){var r=e[0],i=e[1],o=t[0],s=t[1];return i<r?(r=nS(i,r),o=n(s,o)):(r=nS(r,i),o=n(o,s)),function(a){return o(r(a))}}function KP(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]=nS(e[s],e[s+1]),o[s]=n(t[s],t[s+1]);return function(a){var c=os(e,a,1,r)-1;return o[c](i[c](a))}}function xo(e,t){return t.domain(e.domain()).range(e.range()).interpolate(e.interpolate()).clamp(e.clamp()).unknown(e.unknown())}function Vc(){var e=RE,t=RE,n=Er,r,i,o,s=mr,a,c,l;function u(){var h=Math.min(e.length,t.length);return s!==mr&&(s=HP(e[0],e[h-1])),a=h>2?KP:ZP,c=l=null,f}function f(h){return h==null||isNaN(h=+h)?o:(c||(c=a(e.map(r),t,n)))(r(s(h)))}return f.invert=function(h){return s(i((l||(l=a(t,e.map(r),xe)))(h)))},f.domain=function(h){return arguments.length?(e=Array.from(h,Nu),u()):e.slice()},f.range=function(h){return arguments.length?(t=Array.from(h),u()):t.slice()},f.rangeRound=function(h){return t=Array.from(h),n=Nc,u()},f.clamp=function(h){return arguments.length?(s=h?!0:mr,u()):s!==mr},f.interpolate=function(h){return arguments.length?(n=h,u()):n},f.unknown=function(h){return arguments.length?(o=h,f):o},function(h,d){return r=h,i=d,u()}}function dp(){return Vc()(mr,mr)}function rS(e,t,n,r){var i=Jl(e,t,n),o;switch(r=po(r??",f"),r.type){case"s":{var s=Math.max(Math.abs(e),Math.abs(t));return r.precision==null&&!isNaN(o=Zv(i,s))&&(r.precision=o),Dg(r,s)}case"":case"e":case"g":case"p":case"r":{r.precision==null&&!isNaN(o=Kv(i,Math.max(Math.abs(e),Math.abs(t))))&&(r.precision=o-(r.type==="e"));break}case"f":case"%":{r.precision==null&&!isNaN(o=Hv(i))&&(r.precision=o-(r.type==="%")*2);break}}return ti(r)}function gs(e){var t=e.domain;return e.ticks=function(n){var r=t();return Sn(r[0],r[r.length-1],n??10)},e.tickFormat=function(n,r){var i=t();return rS(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 bs(){var e=dp();return e.copy=function(){return xo(e,bs())},Xe.apply(e,arguments),gs(e)}function pp(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,Nu),n):e.slice()},n.unknown=function(r){return arguments.length?(t=r,n):t},n.copy=function(){return pp(e).unknown(t)},e=arguments.length?Array.from(e,Nu):[0,1],gs(n)}function mp(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 $E(e){return Math.log(e)}function UE(e){return Math.exp(e)}function QP(e){return-Math.log(-e)}function JP(e){return-Math.exp(-e)}function tz(e){return isFinite(e)?+("1e"+e):e<0?0:e}function ez(e){return e===10?tz:e===Math.E?Math.exp:t=>Math.pow(e,t)}function nz(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 PE(e){return(t,n)=>-e(-t,n)}function iS(e){let t=e($E,UE),n=t.domain,r=10,i,o;function s(){return i=nz(r),o=ez(r),n()[0]<0?(i=PE(i),o=PE(o),e(QP,JP)):e($E,UE),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 h=i(l),d=i(u),p,m,y=a==null?10:+a,g=[];if(!(r%1)&&d-h<y){if(h=Math.floor(h),d=Math.ceil(d),l>0){for(;h<=d;++h)for(p=1;p<r;++p)if(m=h<0?p/o(-h):p*o(h),!(m<l)){if(m>u)break;g.push(m)}}else for(;h<=d;++h)for(p=r-1;p>=1;--p)if(m=h>0?p/o(-h):p*o(h),!(m<l)){if(m>u)break;g.push(m)}g.length*2<y&&(g=Sn(l,u,y))}else g=Sn(h,d,Math.min(d-h,y)).map(o);return f?g.reverse():g},t.tickFormat=(a,c)=>{if(a==null&&(a=10),c==null&&(c=r===10?"s":","),typeof c!="function"&&(!(r%1)&&(c=po(c)).precision==null&&(c.trim=!0),c=ti(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(mp(n(),{floor:a=>o(Math.floor(i(a))),ceil:a=>o(Math.ceil(i(a)))})),t}function yp(){let e=iS(Vc()).domain([1,10]);return e.copy=()=>xo(e,yp()).base(e.base()),Xe.apply(e,arguments),e}function zE(e){return function(t){return Math.sign(t)*Math.log1p(Math.abs(t/e))}}function qE(e){return function(t){return Math.sign(t)*Math.expm1(Math.abs(t))*e}}function oS(e){var t=1,n=e(zE(t),qE(t));return n.constant=function(r){return arguments.length?e(zE(t=+r),qE(t)):t},gs(n)}function gp(){var e=oS(Vc());return e.copy=function(){return xo(e,gp()).constant(e.constant())},Xe.apply(e,arguments)}function VE(e){return function(t){return t<0?-Math.pow(-t,e):Math.pow(t,e)}}function rz(e){return e<0?-Math.sqrt(-e):Math.sqrt(e)}function iz(e){return e<0?-e*e:e*e}function sS(e){var t=e(mr,mr),n=1;function r(){return n===1?e(mr,mr):n===.5?e(rz,iz):e(VE(n),VE(1/n))}return t.exponent=function(i){return arguments.length?(n=+i,r()):n},gs(t)}function bp(){var e=sS(Vc());return e.copy=function(){return xo(e,bp()).exponent(e.exponent())},Xe.apply(e,arguments),e}function xp(){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]=ov(e,s/a);return o}function o(s){return s==null||isNaN(s=+s)?r:t[os(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($t),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 xp().domain(e).range(t).unknown(r)},Xe.apply(o,arguments)}function wp(){var e=[.5],t=[0,1],n,r=1;function i(o){return o!=null&&o<=o?t[os(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 wp().domain(e).range(t).unknown(n)},Xe.apply(i,arguments)}var aS=new Date,cS=new Date;function ye(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=>ye(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)=>(aS.setTime(+o),cS.setTime(+s),e(aS),e(cS),Math.floor(n(aS,cS))),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 _p=ye(()=>{},(e,t)=>{e.setTime(+e+t)},(e,t)=>t-e);_p.every=e=>(e=Math.floor(e),!isFinite(e)||!(e>0)?null:e>1?ye(t=>{t.setTime(Math.floor(t/e)*e)},(t,n)=>{t.setTime(+t+n*e)},(t,n)=>(n-t)/e):_p);var $_t=_p.range;var cn=ye(e=>{e.setTime(e-e.getMilliseconds())},(e,t)=>{e.setTime(+e+t*1e3)},(e,t)=>(t-e)/1e3,e=>e.getUTCSeconds()),jE=cn.range;var xs=ye(e=>{e.setTime(e-e.getMilliseconds()-e.getSeconds()*1e3)},(e,t)=>{e.setTime(+e+t*6e4)},(e,t)=>(t-e)/6e4,e=>e.getMinutes()),oz=xs.range,ws=ye(e=>{e.setUTCSeconds(0,0)},(e,t)=>{e.setTime(+e+t*6e4)},(e,t)=>(t-e)/6e4,e=>e.getUTCMinutes()),sz=ws.range;var _s=ye(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()),az=_s.range,vs=ye(e=>{e.setUTCMinutes(0,0,0)},(e,t)=>{e.setTime(+e+t*36e5)},(e,t)=>(t-e)/36e5,e=>e.getUTCHours()),cz=vs.range;var ni=ye(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),lz=ni.range,Wc=ye(e=>{e.setUTCHours(0,0,0,0)},(e,t)=>{e.setUTCDate(e.getUTCDate()+t)},(e,t)=>(t-e)/864e5,e=>e.getUTCDate()-1),uz=Wc.range,Gc=ye(e=>{e.setUTCHours(0,0,0,0)},(e,t)=>{e.setUTCDate(e.getUTCDate()+t)},(e,t)=>(t-e)/864e5,e=>Math.floor(e/864e5)),fz=Gc.range;function Xc(e){return ye(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 Nr=Xc(0),_a=Xc(1),fb=Xc(2),hb=Xc(3),_o=Xc(4),db=Xc(5),pb=Xc(6),WE=Nr.range,hz=_a.range,dz=fb.range,pz=hb.range,mz=_o.range,yz=db.range,gz=pb.range;function Hc(e){return ye(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 Br=Hc(0),va=Hc(1),mb=Hc(2),yb=Hc(3),vo=Hc(4),gb=Hc(5),bb=Hc(6),GE=Br.range,bz=va.range,xz=mb.range,wz=yb.range,_z=vo.range,vz=gb.range,Sz=bb.range;var Ss=ye(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()),Iz=Ss.range,Is=ye(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()),Mz=Is.range;var Rn=ye(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:ye(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 Az=Rn.range,$n=ye(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:ye(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 Tz=$n.range;function HE(e,t,n,r,i,o){let s=[[cn,1,1e3],[cn,5,5*1e3],[cn,15,15*1e3],[cn,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 h=u<l;h&&([l,u]=[u,l]);let d=f&&typeof f.range=="function"?f:c(l,u,f),p=d?d.range(l,+u+1):[];return h?p.reverse():p}function c(l,u,f){let h=Math.abs(u-l)/f,d=is(([,,y])=>y).right(s,h);if(d===s.length)return e.every(Jl(l/31536e6,u/31536e6,f));if(d===0)return _p.every(Math.max(Jl(l,u,f),1));let[p,m]=s[h/s[d-1][2]<s[d][2]/h?d-1:d];return p.every(m)}return[a,c]}var[lS,Sp]=HE($n,Is,Br,Gc,vs,ws),[uS,fS]=HE(Rn,Ss,Nr,ni,_s,xs);function hS(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 dS(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 Ip(e,t,n){return{y:e,m:t,d:n,H:0,M:0,S:0,L:0}}function pS(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=Mp(i),u=Ap(i),f=Mp(o),h=Ap(o),d=Mp(s),p=Ap(s),m=Mp(a),y=Ap(a),g=Mp(c),b=Ap(c),x={a:C,A:k,b:F,B:R,c:null,d:eD,e:eD,f:Kz,g:aq,G:lq,H:Xz,I:Hz,j:Zz,L:sD,m:Qz,M:Jz,p:$,q:U,Q:iD,s:oD,S:tq,u:eq,U:nq,V:rq,w:iq,W:oq,x:null,X:null,y:sq,Y:cq,Z:uq,"%":rD},w={a:G,A:et,b:rt,B:st,c:null,d:nD,e:nD,f:pq,g:Iq,G:Aq,H:fq,I:hq,j:dq,L:cD,m:mq,M:yq,p:j,q:ot,Q:iD,s:oD,S:gq,u:bq,U:xq,V:wq,w:_q,W:vq,x:null,X:null,y:Sq,Y:Mq,Z:Tq,"%":rD},v={a:N,A,b:B,B:L,c:S,d:JE,e:JE,f:jz,g:QE,G:KE,H:tD,I:tD,j:Pz,L:Vz,m:Uz,M:zz,p:I,q:$z,Q:Wz,s:Gz,S:qz,u:Lz,U:Fz,V:Cz,w:Oz,W:kz,x:T,X:D,y:QE,Y:KE,Z:Rz,"%":Yz};x.x=_(n,x),x.X=_(r,x),x.c=_(t,x),w.x=_(n,w),w.X=_(r,w),w.c=_(t,w);function _(z,H){return function(nt){var P=[],Ot=-1,ft=0,jt=z.length,Wt,J,ie;for(nt instanceof Date||(nt=new Date(+nt));++Ot<jt;)z.charCodeAt(Ot)===37&&(P.push(z.slice(ft,Ot)),(J=ZE[Wt=z.charAt(++Ot)])!=null?Wt=z.charAt(++Ot):J=Wt==="e"?" ":"0",(ie=H[Wt])&&(Wt=ie(nt,J)),P.push(Wt),ft=Ot+1);return P.push(z.slice(ft,Ot)),P.join("")}}function M(z,H){return function(nt){var P=Ip(1900,void 0,1),Ot=E(P,z,nt+="",0),ft,jt;if(Ot!=nt.length)return null;if("Q"in P)return new Date(P.Q);if("s"in P)return new Date(P.s*1e3+("L"in P?P.L:0));if(H&&!("Z"in P)&&(P.Z=0),"p"in P&&(P.H=P.H%12+P.p*12),P.m===void 0&&(P.m="q"in P?P.q:0),"V"in P){if(P.V<1||P.V>53)return null;"w"in P||(P.w=1),"Z"in P?(ft=dS(Ip(P.y,0,1)),jt=ft.getUTCDay(),ft=jt>4||jt===0?va.ceil(ft):va(ft),ft=Wc.offset(ft,(P.V-1)*7),P.y=ft.getUTCFullYear(),P.m=ft.getUTCMonth(),P.d=ft.getUTCDate()+(P.w+6)%7):(ft=hS(Ip(P.y,0,1)),jt=ft.getDay(),ft=jt>4||jt===0?_a.ceil(ft):_a(ft),ft=ni.offset(ft,(P.V-1)*7),P.y=ft.getFullYear(),P.m=ft.getMonth(),P.d=ft.getDate()+(P.w+6)%7)}else("W"in P||"U"in P)&&("w"in P||(P.w="u"in P?P.u%7:"W"in P?1:0),jt="Z"in P?dS(Ip(P.y,0,1)).getUTCDay():hS(Ip(P.y,0,1)).getDay(),P.m=0,P.d="W"in P?(P.w+6)%7+P.W*7-(jt+5)%7:P.w+P.U*7-(jt+6)%7);return"Z"in P?(P.H+=P.Z/100|0,P.M+=P.Z%100,dS(P)):hS(P)}}function E(z,H,nt,P){for(var Ot=0,ft=H.length,jt=nt.length,Wt,J;Ot<ft;){if(P>=jt)return-1;if(Wt=H.charCodeAt(Ot++),Wt===37){if(Wt=H.charAt(Ot++),J=v[Wt in ZE?H.charAt(Ot++):Wt],!J||(P=J(z,nt,P))<0)return-1}else if(Wt!=nt.charCodeAt(P++))return-1}return P}function I(z,H,nt){var P=l.exec(H.slice(nt));return P?(z.p=u.get(P[0].toLowerCase()),nt+P[0].length):-1}function N(z,H,nt){var P=d.exec(H.slice(nt));return P?(z.w=p.get(P[0].toLowerCase()),nt+P[0].length):-1}function A(z,H,nt){var P=f.exec(H.slice(nt));return P?(z.w=h.get(P[0].toLowerCase()),nt+P[0].length):-1}function B(z,H,nt){var P=g.exec(H.slice(nt));return P?(z.m=b.get(P[0].toLowerCase()),nt+P[0].length):-1}function L(z,H,nt){var P=m.exec(H.slice(nt));return P?(z.m=y.get(P[0].toLowerCase()),nt+P[0].length):-1}function S(z,H,nt){return E(z,t,H,nt)}function T(z,H,nt){return E(z,n,H,nt)}function D(z,H,nt){return E(z,r,H,nt)}function C(z){return s[z.getDay()]}function k(z){return o[z.getDay()]}function F(z){return c[z.getMonth()]}function R(z){return a[z.getMonth()]}function $(z){return i[+(z.getHours()>=12)]}function U(z){return 1+~~(z.getMonth()/3)}function G(z){return s[z.getUTCDay()]}function et(z){return o[z.getUTCDay()]}function rt(z){return c[z.getUTCMonth()]}function st(z){return a[z.getUTCMonth()]}function j(z){return i[+(z.getUTCHours()>=12)]}function ot(z){return 1+~~(z.getUTCMonth()/3)}return{format:function(z){var H=_(z+="",x);return H.toString=function(){return z},H},parse:function(z){var H=M(z+="",!1);return H.toString=function(){return z},H},utcFormat:function(z){var H=_(z+="",w);return H.toString=function(){return z},H},utcParse:function(z){var H=M(z+="",!0);return H.toString=function(){return z},H}}}var ZE={"-":"",_:" ",0:"0"},ln=/^\s*\d+/,Dz=/^%/,Nz=/[\\^$*+?|[\]().{}]/g;function Qt(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 Bz(e){return e.replace(Nz,"\\$&")}function Mp(e){return new RegExp("^(?:"+e.map(Bz).join("|")+")","i")}function Ap(e){return new Map(e.map((t,n)=>[t.toLowerCase(),n]))}function Oz(e,t,n){var r=ln.exec(t.slice(n,n+1));return r?(e.w=+r[0],n+r[0].length):-1}function Lz(e,t,n){var r=ln.exec(t.slice(n,n+1));return r?(e.u=+r[0],n+r[0].length):-1}function Fz(e,t,n){var r=ln.exec(t.slice(n,n+2));return r?(e.U=+r[0],n+r[0].length):-1}function Cz(e,t,n){var r=ln.exec(t.slice(n,n+2));return r?(e.V=+r[0],n+r[0].length):-1}function kz(e,t,n){var r=ln.exec(t.slice(n,n+2));return r?(e.W=+r[0],n+r[0].length):-1}function KE(e,t,n){var r=ln.exec(t.slice(n,n+4));return r?(e.y=+r[0],n+r[0].length):-1}function QE(e,t,n){var r=ln.exec(t.slice(n,n+2));return r?(e.y=+r[0]+(+r[0]>68?1900:2e3),n+r[0].length):-1}function Rz(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 $z(e,t,n){var r=ln.exec(t.slice(n,n+1));return r?(e.q=r[0]*3-3,n+r[0].length):-1}function Uz(e,t,n){var r=ln.exec(t.slice(n,n+2));return r?(e.m=r[0]-1,n+r[0].length):-1}function JE(e,t,n){var r=ln.exec(t.slice(n,n+2));return r?(e.d=+r[0],n+r[0].length):-1}function Pz(e,t,n){var r=ln.exec(t.slice(n,n+3));return r?(e.m=0,e.d=+r[0],n+r[0].length):-1}function tD(e,t,n){var r=ln.exec(t.slice(n,n+2));return r?(e.H=+r[0],n+r[0].length):-1}function zz(e,t,n){var r=ln.exec(t.slice(n,n+2));return r?(e.M=+r[0],n+r[0].length):-1}function qz(e,t,n){var r=ln.exec(t.slice(n,n+2));return r?(e.S=+r[0],n+r[0].length):-1}function Vz(e,t,n){var r=ln.exec(t.slice(n,n+3));return r?(e.L=+r[0],n+r[0].length):-1}function jz(e,t,n){var r=ln.exec(t.slice(n,n+6));return r?(e.L=Math.floor(r[0]/1e3),n+r[0].length):-1}function Yz(e,t,n){var r=Dz.exec(t.slice(n,n+1));return r?n+r[0].length:-1}function Wz(e,t,n){var r=ln.exec(t.slice(n));return r?(e.Q=+r[0],n+r[0].length):-1}function Gz(e,t,n){var r=ln.exec(t.slice(n));return r?(e.s=+r[0],n+r[0].length):-1}function eD(e,t){return Qt(e.getDate(),t,2)}function Xz(e,t){return Qt(e.getHours(),t,2)}function Hz(e,t){return Qt(e.getHours()%12||12,t,2)}function Zz(e,t){return Qt(1+ni.count(Rn(e),e),t,3)}function sD(e,t){return Qt(e.getMilliseconds(),t,3)}function Kz(e,t){return sD(e,t)+"000"}function Qz(e,t){return Qt(e.getMonth()+1,t,2)}function Jz(e,t){return Qt(e.getMinutes(),t,2)}function tq(e,t){return Qt(e.getSeconds(),t,2)}function eq(e){var t=e.getDay();return t===0?7:t}function nq(e,t){return Qt(Nr.count(Rn(e)-1,e),t,2)}function aD(e){var t=e.getDay();return t>=4||t===0?_o(e):_o.ceil(e)}function rq(e,t){return e=aD(e),Qt(_o.count(Rn(e),e)+(Rn(e).getDay()===4),t,2)}function iq(e){return e.getDay()}function oq(e,t){return Qt(_a.count(Rn(e)-1,e),t,2)}function sq(e,t){return Qt(e.getFullYear()%100,t,2)}function aq(e,t){return e=aD(e),Qt(e.getFullYear()%100,t,2)}function cq(e,t){return Qt(e.getFullYear()%1e4,t,4)}function lq(e,t){var n=e.getDay();return e=n>=4||n===0?_o(e):_o.ceil(e),Qt(e.getFullYear()%1e4,t,4)}function uq(e){var t=e.getTimezoneOffset();return(t>0?"-":(t*=-1,"+"))+Qt(t/60|0,"0",2)+Qt(t%60,"0",2)}function nD(e,t){return Qt(e.getUTCDate(),t,2)}function fq(e,t){return Qt(e.getUTCHours(),t,2)}function hq(e,t){return Qt(e.getUTCHours()%12||12,t,2)}function dq(e,t){return Qt(1+Wc.count($n(e),e),t,3)}function cD(e,t){return Qt(e.getUTCMilliseconds(),t,3)}function pq(e,t){return cD(e,t)+"000"}function mq(e,t){return Qt(e.getUTCMonth()+1,t,2)}function yq(e,t){return Qt(e.getUTCMinutes(),t,2)}function gq(e,t){return Qt(e.getUTCSeconds(),t,2)}function bq(e){var t=e.getUTCDay();return t===0?7:t}function xq(e,t){return Qt(Br.count($n(e)-1,e),t,2)}function lD(e){var t=e.getUTCDay();return t>=4||t===0?vo(e):vo.ceil(e)}function wq(e,t){return e=lD(e),Qt(vo.count($n(e),e)+($n(e).getUTCDay()===4),t,2)}function _q(e){return e.getUTCDay()}function vq(e,t){return Qt(va.count($n(e)-1,e),t,2)}function Sq(e,t){return Qt(e.getUTCFullYear()%100,t,2)}function Iq(e,t){return e=lD(e),Qt(e.getUTCFullYear()%100,t,2)}function Mq(e,t){return Qt(e.getUTCFullYear()%1e4,t,4)}function Aq(e,t){var n=e.getUTCDay();return e=n>=4||n===0?vo(e):vo.ceil(e),Qt(e.getUTCFullYear()%1e4,t,4)}function Tq(){return"+0000"}function rD(){return"%"}function iD(e){return+e}function oD(e){return Math.floor(+e/1e3)}var Bu,Ou,uD,So,fD;mS({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 mS(e){return Bu=pS(e),Ou=Bu.format,uD=Bu.parse,So=Bu.utcFormat,fD=Bu.utcParse,Bu}function Eq(e){return new Date(e)}function Dq(e){return e instanceof Date?+e:+new Date(+e)}function xb(e,t,n,r,i,o,s,a,c,l){var u=dp(),f=u.invert,h=u.domain,d=l(".%L"),p=l(":%S"),m=l("%I:%M"),y=l("%I %p"),g=l("%a %d"),b=l("%b %d"),x=l("%B"),w=l("%Y");function v(_){return(c(_)<_?d:a(_)<_?p:s(_)<_?m:o(_)<_?y:r(_)<_?i(_)<_?g:b:n(_)<_?x:w)(_)}return u.invert=function(_){return new Date(f(_))},u.domain=function(_){return arguments.length?h(Array.from(_,Dq)):h().map(Eq)},u.ticks=function(_){var M=h();return e(M[0],M[M.length-1],_??10)},u.tickFormat=function(_,M){return M==null?v:l(M)},u.nice=function(_){var M=h();return(!_||typeof _.range!="function")&&(_=t(M[0],M[M.length-1],_??10)),_?h(mp(M,_)):u},u.copy=function(){return xo(u,xb(e,t,n,r,i,o,s,a,c,l))},u}function wb(){return Xe.apply(xb(uS,fS,Rn,Ss,Nr,ni,_s,xs,cn,Ou).domain([new Date(2e3,0,1),new Date(2e3,0,2)]),arguments)}function _b(){return Xe.apply(xb(lS,Sp,$n,Is,Br,Wc,vs,ws,cn,So).domain([Date.UTC(2e3,0,1),Date.UTC(2e3,0,2)]),arguments)}function Tp(e,t){return t.domain(e.domain()).interpolator(e.interpolator()).clamp(e.clamp()).unknown(e.unknown())}function vb(){var e=0,t=.5,n=1,r=1,i,o,s,a,c,l=mr,u,f=!1,h;function d(m){return isNaN(m=+m)?h:(m=.5+((m=+u(m))-o)*(r*m<r*o?a:c),l(f?Math.max(0,Math.min(1,m)):m))}d.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,d):[e,t,n]},d.clamp=function(m){return arguments.length?(f=!!m,d):f},d.interpolator=function(m){return arguments.length?(l=m,d):l};function p(m){return function(y){var g,b,x;return arguments.length?([g,b,x]=y,l=lo(m,[g,b,x]),d):[l(0),l(.5),l(1)]}}return d.range=p(Er),d.rangeRound=p(Nc),d.unknown=function(m){return arguments.length?(h=m,d):h},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,d}}function Ep(){var e=gs(vb()(mr));return e.copy=function(){return Tp(e,Ep())},fp.apply(e,arguments)}function Sb(){var e=iS(vb()).domain([.1,1,10]);return e.copy=function(){return Tp(e,Sb()).base(e.base())},fp.apply(e,arguments)}function Ib(){var e=oS(vb());return e.copy=function(){return Tp(e,Ib()).constant(e.constant())},fp.apply(e,arguments)}function Mb(){var e=sS(vb());return e.copy=function(){return Tp(e,Mb()).exponent(e.exponent())},fp.apply(e,arguments)}function Y(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 yS=Y("1f77b4ff7f0e2ca02cd627289467bd8c564be377c27f7f7fbcbd2217becf");var gS=Y("7fc97fbeaed4fdc086ffff99386cb0f0027fbf5b17666666");var bS=Y("1b9e77d95f027570b3e7298a66a61ee6ab02a6761d666666");var xS=Y("4269d0efb118ff725c6cc5b03ca951ff8ab7a463f297bbf59c6b4e9498a0");var wS=Y("a6cee31f78b4b2df8a33a02cfb9a99e31a1cfdbf6fff7f00cab2d66a3d9affff99b15928");var _S=Y("fbb4aeb3cde3ccebc5decbe4fed9a6ffffcce5d8bdfddaecf2f2f2");var vS=Y("b3e2cdfdcdaccbd5e8f4cae4e6f5c9fff2aef1e2cccccccc");var SS=Y("e41a1c377eb84daf4a984ea3ff7f00ffff33a65628f781bf999999");var IS=Y("66c2a5fc8d628da0cbe78ac3a6d854ffd92fe5c494b3b3b3");var MS=Y("8dd3c7ffffb3bebadafb807280b1d3fdb462b3de69fccde5d9d9d9bc80bdccebc5ffed6f");var AS=Y("4e79a7f28e2ce1575976b7b259a14fedc949af7aa1ff9da79c755fbab0ab");var ht=e=>_v(e[e.length-1]);var Ab=new Array(3).concat("d8b365f5f5f55ab4ac","a6611adfc27d80cdc1018571","a6611adfc27df5f5f580cdc1018571","8c510ad8b365f6e8c3c7eae55ab4ac01665e","8c510ad8b365f6e8c3f5f5f5c7eae55ab4ac01665e","8c510abf812ddfc27df6e8c3c7eae580cdc135978f01665e","8c510abf812ddfc27df6e8c3f5f5f5c7eae580cdc135978f01665e","5430058c510abf812ddfc27df6e8c3c7eae580cdc135978f01665e003c30","5430058c510abf812ddfc27df6e8c3f5f5f5c7eae580cdc135978f01665e003c30").map(Y),Tb=ht(Ab);var Eb=new Array(3).concat("af8dc3f7f7f77fbf7b","7b3294c2a5cfa6dba0008837","7b3294c2a5cff7f7f7a6dba0008837","762a83af8dc3e7d4e8d9f0d37fbf7b1b7837","762a83af8dc3e7d4e8f7f7f7d9f0d37fbf7b1b7837","762a839970abc2a5cfe7d4e8d9f0d3a6dba05aae611b7837","762a839970abc2a5cfe7d4e8f7f7f7d9f0d3a6dba05aae611b7837","40004b762a839970abc2a5cfe7d4e8d9f0d3a6dba05aae611b783700441b","40004b762a839970abc2a5cfe7d4e8f7f7f7d9f0d3a6dba05aae611b783700441b").map(Y),Db=ht(Eb);var Nb=new Array(3).concat("e9a3c9f7f7f7a1d76a","d01c8bf1b6dab8e1864dac26","d01c8bf1b6daf7f7f7b8e1864dac26","c51b7de9a3c9fde0efe6f5d0a1d76a4d9221","c51b7de9a3c9fde0eff7f7f7e6f5d0a1d76a4d9221","c51b7dde77aef1b6dafde0efe6f5d0b8e1867fbc414d9221","c51b7dde77aef1b6dafde0eff7f7f7e6f5d0b8e1867fbc414d9221","8e0152c51b7dde77aef1b6dafde0efe6f5d0b8e1867fbc414d9221276419","8e0152c51b7dde77aef1b6dafde0eff7f7f7e6f5d0b8e1867fbc414d9221276419").map(Y),Bb=ht(Nb);var Ob=new Array(3).concat("998ec3f7f7f7f1a340","5e3c99b2abd2fdb863e66101","5e3c99b2abd2f7f7f7fdb863e66101","542788998ec3d8daebfee0b6f1a340b35806","542788998ec3d8daebf7f7f7fee0b6f1a340b35806","5427888073acb2abd2d8daebfee0b6fdb863e08214b35806","5427888073acb2abd2d8daebf7f7f7fee0b6fdb863e08214b35806","2d004b5427888073acb2abd2d8daebfee0b6fdb863e08214b358067f3b08","2d004b5427888073acb2abd2d8daebf7f7f7fee0b6fdb863e08214b358067f3b08").map(Y),Lb=ht(Ob);var Dp=new Array(3).concat("ef8a62f7f7f767a9cf","ca0020f4a58292c5de0571b0","ca0020f4a582f7f7f792c5de0571b0","b2182bef8a62fddbc7d1e5f067a9cf2166ac","b2182bef8a62fddbc7f7f7f7d1e5f067a9cf2166ac","b2182bd6604df4a582fddbc7d1e5f092c5de4393c32166ac","b2182bd6604df4a582fddbc7f7f7f7d1e5f092c5de4393c32166ac","67001fb2182bd6604df4a582fddbc7d1e5f092c5de4393c32166ac053061","67001fb2182bd6604df4a582fddbc7f7f7f7d1e5f092c5de4393c32166ac053061").map(Y),Lu=ht(Dp);var Fb=new Array(3).concat("ef8a62ffffff999999","ca0020f4a582bababa404040","ca0020f4a582ffffffbababa404040","b2182bef8a62fddbc7e0e0e09999994d4d4d","b2182bef8a62fddbc7ffffffe0e0e09999994d4d4d","b2182bd6604df4a582fddbc7e0e0e0bababa8787874d4d4d","b2182bd6604df4a582fddbc7ffffffe0e0e0bababa8787874d4d4d","67001fb2182bd6604df4a582fddbc7e0e0e0bababa8787874d4d4d1a1a1a","67001fb2182bd6604df4a582fddbc7ffffffe0e0e0bababa8787874d4d4d1a1a1a").map(Y),Cb=ht(Fb);var Np=new Array(3).concat("fc8d59ffffbf91bfdb","d7191cfdae61abd9e92c7bb6","d7191cfdae61ffffbfabd9e92c7bb6","d73027fc8d59fee090e0f3f891bfdb4575b4","d73027fc8d59fee090ffffbfe0f3f891bfdb4575b4","d73027f46d43fdae61fee090e0f3f8abd9e974add14575b4","d73027f46d43fdae61fee090ffffbfe0f3f8abd9e974add14575b4","a50026d73027f46d43fdae61fee090e0f3f8abd9e974add14575b4313695","a50026d73027f46d43fdae61fee090ffffbfe0f3f8abd9e974add14575b4313695").map(Y),Fu=ht(Np);var kb=new Array(3).concat("fc8d59ffffbf91cf60","d7191cfdae61a6d96a1a9641","d7191cfdae61ffffbfa6d96a1a9641","d73027fc8d59fee08bd9ef8b91cf601a9850","d73027fc8d59fee08bffffbfd9ef8b91cf601a9850","d73027f46d43fdae61fee08bd9ef8ba6d96a66bd631a9850","d73027f46d43fdae61fee08bffffbfd9ef8ba6d96a66bd631a9850","a50026d73027f46d43fdae61fee08bd9ef8ba6d96a66bd631a9850006837","a50026d73027f46d43fdae61fee08bffffbfd9ef8ba6d96a66bd631a9850006837").map(Y),Rb=ht(kb);var $b=new Array(3).concat("fc8d59ffffbf99d594","d7191cfdae61abdda42b83ba","d7191cfdae61ffffbfabdda42b83ba","d53e4ffc8d59fee08be6f59899d5943288bd","d53e4ffc8d59fee08bffffbfe6f59899d5943288bd","d53e4ff46d43fdae61fee08be6f598abdda466c2a53288bd","d53e4ff46d43fdae61fee08bffffbfe6f598abdda466c2a53288bd","9e0142d53e4ff46d43fdae61fee08be6f598abdda466c2a53288bd5e4fa2","9e0142d53e4ff46d43fdae61fee08bffffbfe6f598abdda466c2a53288bd5e4fa2").map(Y),Ub=ht($b);var Pb=new Array(3).concat("e5f5f999d8c92ca25f","edf8fbb2e2e266c2a4238b45","edf8fbb2e2e266c2a42ca25f006d2c","edf8fbccece699d8c966c2a42ca25f006d2c","edf8fbccece699d8c966c2a441ae76238b45005824","f7fcfde5f5f9ccece699d8c966c2a441ae76238b45005824","f7fcfde5f5f9ccece699d8c966c2a441ae76238b45006d2c00441b").map(Y),zb=ht(Pb);var qb=new Array(3).concat("e0ecf49ebcda8856a7","edf8fbb3cde38c96c688419d","edf8fbb3cde38c96c68856a7810f7c","edf8fbbfd3e69ebcda8c96c68856a7810f7c","edf8fbbfd3e69ebcda8c96c68c6bb188419d6e016b","f7fcfde0ecf4bfd3e69ebcda8c96c68c6bb188419d6e016b","f7fcfde0ecf4bfd3e69ebcda8c96c68c6bb188419d810f7c4d004b").map(Y),Vb=ht(qb);var jb=new Array(3).concat("e0f3dba8ddb543a2ca","f0f9e8bae4bc7bccc42b8cbe","f0f9e8bae4bc7bccc443a2ca0868ac","f0f9e8ccebc5a8ddb57bccc443a2ca0868ac","f0f9e8ccebc5a8ddb57bccc44eb3d32b8cbe08589e","f7fcf0e0f3dbccebc5a8ddb57bccc44eb3d32b8cbe08589e","f7fcf0e0f3dbccebc5a8ddb57bccc44eb3d32b8cbe0868ac084081").map(Y),Yb=ht(jb);var Wb=new Array(3).concat("fee8c8fdbb84e34a33","fef0d9fdcc8afc8d59d7301f","fef0d9fdcc8afc8d59e34a33b30000","fef0d9fdd49efdbb84fc8d59e34a33b30000","fef0d9fdd49efdbb84fc8d59ef6548d7301f990000","fff7ecfee8c8fdd49efdbb84fc8d59ef6548d7301f990000","fff7ecfee8c8fdd49efdbb84fc8d59ef6548d7301fb300007f0000").map(Y),Gb=ht(Wb);var Xb=new Array(3).concat("ece2f0a6bddb1c9099","f6eff7bdc9e167a9cf02818a","f6eff7bdc9e167a9cf1c9099016c59","f6eff7d0d1e6a6bddb67a9cf1c9099016c59","f6eff7d0d1e6a6bddb67a9cf3690c002818a016450","fff7fbece2f0d0d1e6a6bddb67a9cf3690c002818a016450","fff7fbece2f0d0d1e6a6bddb67a9cf3690c002818a016c59014636").map(Y),Hb=ht(Xb);var Zb=new Array(3).concat("ece7f2a6bddb2b8cbe","f1eef6bdc9e174a9cf0570b0","f1eef6bdc9e174a9cf2b8cbe045a8d","f1eef6d0d1e6a6bddb74a9cf2b8cbe045a8d","f1eef6d0d1e6a6bddb74a9cf3690c00570b0034e7b","fff7fbece7f2d0d1e6a6bddb74a9cf3690c00570b0034e7b","fff7fbece7f2d0d1e6a6bddb74a9cf3690c00570b0045a8d023858").map(Y),Kb=ht(Zb);var Qb=new Array(3).concat("e7e1efc994c7dd1c77","f1eef6d7b5d8df65b0ce1256","f1eef6d7b5d8df65b0dd1c77980043","f1eef6d4b9dac994c7df65b0dd1c77980043","f1eef6d4b9dac994c7df65b0e7298ace125691003f","f7f4f9e7e1efd4b9dac994c7df65b0e7298ace125691003f","f7f4f9e7e1efd4b9dac994c7df65b0e7298ace125698004367001f").map(Y),Jb=ht(Qb);var tx=new Array(3).concat("fde0ddfa9fb5c51b8a","feebe2fbb4b9f768a1ae017e","feebe2fbb4b9f768a1c51b8a7a0177","feebe2fcc5c0fa9fb5f768a1c51b8a7a0177","feebe2fcc5c0fa9fb5f768a1dd3497ae017e7a0177","fff7f3fde0ddfcc5c0fa9fb5f768a1dd3497ae017e7a0177","fff7f3fde0ddfcc5c0fa9fb5f768a1dd3497ae017e7a017749006a").map(Y),ex=ht(tx);var nx=new Array(3).concat("edf8b17fcdbb2c7fb8","ffffcca1dab441b6c4225ea8","ffffcca1dab441b6c42c7fb8253494","ffffccc7e9b47fcdbb41b6c42c7fb8253494","ffffccc7e9b47fcdbb41b6c41d91c0225ea80c2c84","ffffd9edf8b1c7e9b47fcdbb41b6c41d91c0225ea80c2c84","ffffd9edf8b1c7e9b47fcdbb41b6c41d91c0225ea8253494081d58").map(Y),rx=ht(nx);var ix=new Array(3).concat("f7fcb9addd8e31a354","ffffccc2e69978c679238443","ffffccc2e69978c67931a354006837","ffffccd9f0a3addd8e78c67931a354006837","ffffccd9f0a3addd8e78c67941ab5d238443005a32","ffffe5f7fcb9d9f0a3addd8e78c67941ab5d238443005a32","ffffe5f7fcb9d9f0a3addd8e78c67941ab5d238443006837004529").map(Y),ox=ht(ix);var sx=new Array(3).concat("fff7bcfec44fd95f0e","ffffd4fed98efe9929cc4c02","ffffd4fed98efe9929d95f0e993404","ffffd4fee391fec44ffe9929d95f0e993404","ffffd4fee391fec44ffe9929ec7014cc4c028c2d04","ffffe5fff7bcfee391fec44ffe9929ec7014cc4c028c2d04","ffffe5fff7bcfee391fec44ffe9929ec7014cc4c02993404662506").map(Y),ax=ht(sx);var cx=new Array(3).concat("ffeda0feb24cf03b20","ffffb2fecc5cfd8d3ce31a1c","ffffb2fecc5cfd8d3cf03b20bd0026","ffffb2fed976feb24cfd8d3cf03b20bd0026","ffffb2fed976feb24cfd8d3cfc4e2ae31a1cb10026","ffffccffeda0fed976feb24cfd8d3cfc4e2ae31a1cb10026","ffffccffeda0fed976feb24cfd8d3cfc4e2ae31a1cbd0026800026").map(Y),lx=ht(cx);var ux=new Array(3).concat("deebf79ecae13182bd","eff3ffbdd7e76baed62171b5","eff3ffbdd7e76baed63182bd08519c","eff3ffc6dbef9ecae16baed63182bd08519c","eff3ffc6dbef9ecae16baed64292c62171b5084594","f7fbffdeebf7c6dbef9ecae16baed64292c62171b5084594","f7fbffdeebf7c6dbef9ecae16baed64292c62171b508519c08306b").map(Y),fx=ht(ux);var hx=new Array(3).concat("e5f5e0a1d99b31a354","edf8e9bae4b374c476238b45","edf8e9bae4b374c47631a354006d2c","edf8e9c7e9c0a1d99b74c47631a354006d2c","edf8e9c7e9c0a1d99b74c47641ab5d238b45005a32","f7fcf5e5f5e0c7e9c0a1d99b74c47641ab5d238b45005a32","f7fcf5e5f5e0c7e9c0a1d99b74c47641ab5d238b45006d2c00441b").map(Y),dx=ht(hx);var px=new Array(3).concat("f0f0f0bdbdbd636363","f7f7f7cccccc969696525252","f7f7f7cccccc969696636363252525","f7f7f7d9d9d9bdbdbd969696636363252525","f7f7f7d9d9d9bdbdbd969696737373525252252525","fffffff0f0f0d9d9d9bdbdbd969696737373525252252525","fffffff0f0f0d9d9d9bdbdbd969696737373525252252525000000").map(Y),mx=ht(px);var yx=new Array(3).concat("efedf5bcbddc756bb1","f2f0f7cbc9e29e9ac86a51a3","f2f0f7cbc9e29e9ac8756bb154278f","f2f0f7dadaebbcbddc9e9ac8756bb154278f","f2f0f7dadaebbcbddc9e9ac8807dba6a51a34a1486","fcfbfdefedf5dadaebbcbddc9e9ac8807dba6a51a34a1486","fcfbfdefedf5dadaebbcbddc9e9ac8807dba6a51a354278f3f007d").map(Y),gx=ht(yx);var bx=new Array(3).concat("fee0d2fc9272de2d26","fee5d9fcae91fb6a4acb181d","fee5d9fcae91fb6a4ade2d26a50f15","fee5d9fcbba1fc9272fb6a4ade2d26a50f15","fee5d9fcbba1fc9272fb6a4aef3b2ccb181d99000d","fff5f0fee0d2fcbba1fc9272fb6a4aef3b2ccb181d99000d","fff5f0fee0d2fcbba1fc9272fb6a4aef3b2ccb181da50f1567000d").map(Y),xx=ht(bx);var wx=new Array(3).concat("fee6cefdae6be6550d","feeddefdbe85fd8d3cd94701","feeddefdbe85fd8d3ce6550da63603","feeddefdd0a2fdae6bfd8d3ce6550da63603","feeddefdd0a2fdae6bfd8d3cf16913d948018c2d04","fff5ebfee6cefdd0a2fdae6bfd8d3cf16913d948018c2d04","fff5ebfee6cefdd0a2fdae6bfd8d3cf16913d94801a636037f2704").map(Y),_x=ht(wx);function vx(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 Sx=cu(Hn(300,.5,0),Hn(-240,.5,1));var Mx=cu(Hn(-100,.75,.35),Hn(80,1.5,.8)),Ax=cu(Hn(260,.75,.35),Hn(80,1.5,.8)),Ix=Hn();function Tx(e){(e<0||e>1)&&(e-=Math.floor(e));var t=Math.abs(e-.5);return Ix.h=360*e-100,Ix.s=1.5-1.5*t,Ix.l=.8-.9*t,Ix+""}var Ex=tn(),Nq=Math.PI/3,Bq=Math.PI*2/3;function Dx(e){var t;return e=(.5-e)*Math.PI,Ex.r=255*(t=Math.sin(e))*t,Ex.g=255*(t=Math.sin(e+Nq))*t,Ex.b=255*(t=Math.sin(e+Bq))*t,Ex+""}function Nx(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 Bx(e){var t=e.length;return function(n){return e[Math.max(0,Math.min(t-1,Math.floor(n*t)))]}}var Ox=Bx(Y("44015444025645045745055946075a46085c460a5d460b5e470d60470e6147106347116447136548146748166848176948186a481a6c481b6d481c6e481d6f481f70482071482173482374482475482576482677482878482979472a7a472c7a472d7b472e7c472f7d46307e46327e46337f463480453581453781453882443983443a83443b84433d84433e85423f854240864241864142874144874045884046883f47883f48893e49893e4a893e4c8a3d4d8a3d4e8a3c4f8a3c508b3b518b3b528b3a538b3a548c39558c39568c38588c38598c375a8c375b8d365c8d365d8d355e8d355f8d34608d34618d33628d33638d32648e32658e31668e31678e31688e30698e306a8e2f6b8e2f6c8e2e6d8e2e6e8e2e6f8e2d708e2d718e2c718e2c728e2c738e2b748e2b758e2a768e2a778e2a788e29798e297a8e297b8e287c8e287d8e277e8e277f8e27808e26818e26828e26828e25838e25848e25858e24868e24878e23888e23898e238a8d228b8d228c8d228d8d218e8d218f8d21908d21918c20928c20928c20938c1f948c1f958b1f968b1f978b1f988b1f998a1f9a8a1e9b8a1e9c891e9d891f9e891f9f881fa0881fa1881fa1871fa28720a38620a48621a58521a68522a78522a88423a98324aa8325ab8225ac8226ad8127ad8128ae8029af7f2ab07f2cb17e2db27d2eb37c2fb47c31b57b32b67a34b67935b77937b87838b9773aba763bbb753dbc743fbc7340bd7242be7144bf7046c06f48c16e4ac16d4cc26c4ec36b50c46a52c56954c56856c66758c7655ac8645cc8635ec96260ca6063cb5f65cb5e67cc5c69cd5b6ccd5a6ece5870cf5773d05675d05477d1537ad1517cd2507fd34e81d34d84d44b86d54989d5488bd6468ed64590d74393d74195d84098d83e9bd93c9dd93ba0da39a2da37a5db36a8db34aadc32addc30b0dd2fb2dd2db5de2bb8de29bade28bddf26c0df25c2df23c5e021c8e020cae11fcde11dd0e11cd2e21bd5e21ad8e219dae319dde318dfe318e2e418e5e419e7e419eae51aece51befe51cf1e51df4e61ef6e620f8e621fbe723fde725")),Lx=Bx(Y("00000401000501010601010802010902020b02020d03030f03031204041405041606051806051a07061c08071e0907200a08220b09240c09260d0a290e0b2b100b2d110c2f120d31130d34140e36150e38160f3b180f3d19103f1a10421c10441d11471e114920114b21114e22115024125325125527125829115a2a115c2c115f2d11612f116331116533106734106936106b38106c390f6e3b0f703d0f713f0f72400f74420f75440f764510774710784910784a10794c117a4e117b4f127b51127c52137c54137d56147d57157e59157e5a167e5c167f5d177f5f187f601880621980641a80651a80671b80681c816a1c816b1d816d1d816e1e81701f81721f817320817521817621817822817922827b23827c23827e24828025828125818326818426818627818827818928818b29818c29818e2a81902a81912b81932b80942c80962c80982d80992d809b2e7f9c2e7f9e2f7fa02f7fa1307ea3307ea5317ea6317da8327daa337dab337cad347cae347bb0357bb2357bb3367ab5367ab73779b83779ba3878bc3978bd3977bf3a77c03a76c23b75c43c75c53c74c73d73c83e73ca3e72cc3f71cd4071cf4070d0416fd2426fd3436ed5446dd6456cd8456cd9466bdb476adc4869de4968df4a68e04c67e24d66e34e65e44f64e55064e75263e85362e95462ea5661eb5760ec5860ed5a5fee5b5eef5d5ef05f5ef1605df2625df2645cf3655cf4675cf4695cf56b5cf66c5cf66e5cf7705cf7725cf8745cf8765cf9785df9795df97b5dfa7d5efa7f5efa815ffb835ffb8560fb8761fc8961fc8a62fc8c63fc8e64fc9065fd9266fd9467fd9668fd9869fd9a6afd9b6bfe9d6cfe9f6dfea16efea36ffea571fea772fea973feaa74feac76feae77feb078feb27afeb47bfeb67cfeb77efeb97ffebb81febd82febf84fec185fec287fec488fec68afec88cfeca8dfecc8ffecd90fecf92fed194fed395fed597fed799fed89afdda9cfddc9efddea0fde0a1fde2a3fde3a5fde5a7fde7a9fde9aafdebacfcecaefceeb0fcf0b2fcf2b4fcf4b6fcf6b8fcf7b9fcf9bbfcfbbdfcfdbf")),Fx=Bx(Y("00000401000501010601010802010a02020c02020e03021004031204031405041706041907051b08051d09061f0a07220b07240c08260d08290e092b10092d110a30120a32140b34150b37160b39180c3c190c3e1b0c411c0c431e0c451f0c48210c4a230c4c240c4f260c51280b53290b552b0b572d0b592f0a5b310a5c320a5e340a5f3609613809623909633b09643d09653e0966400a67420a68440a68450a69470b6a490b6a4a0c6b4c0c6b4d0d6c4f0d6c510e6c520e6d540f6d550f6d57106e59106e5a116e5c126e5d126e5f136e61136e62146e64156e65156e67166e69166e6a176e6c186e6d186e6f196e71196e721a6e741a6e751b6e771c6d781c6d7a1d6d7c1d6d7d1e6d7f1e6c801f6c82206c84206b85216b87216b88226a8a226a8c23698d23698f24699025689225689326679526679727669827669a28659b29649d29649f2a63a02a63a22b62a32c61a52c60a62d60a82e5fa92e5eab2f5ead305dae305cb0315bb1325ab3325ab43359b63458b73557b93556ba3655bc3754bd3853bf3952c03a51c13a50c33b4fc43c4ec63d4dc73e4cc83f4bca404acb4149cc4248ce4347cf4446d04545d24644d34743d44842d54a41d74b3fd84c3ed94d3dda4e3cdb503bdd513ade5238df5337e05536e15635e25734e35933e45a31e55c30e65d2fe75e2ee8602de9612bea632aeb6429eb6628ec6726ed6925ee6a24ef6c23ef6e21f06f20f1711ff1731df2741cf3761bf37819f47918f57b17f57d15f67e14f68013f78212f78410f8850ff8870ef8890cf98b0bf98c0af98e09fa9008fa9207fa9407fb9606fb9706fb9906fb9b06fb9d07fc9f07fca108fca309fca50afca60cfca80dfcaa0ffcac11fcae12fcb014fcb216fcb418fbb61afbb81dfbba1ffbbc21fbbe23fac026fac228fac42afac62df9c72ff9c932f9cb35f8cd37f8cf3af7d13df7d340f6d543f6d746f5d949f5db4cf4dd4ff4df53f4e156f3e35af3e55df2e661f2e865f2ea69f1ec6df1ed71f1ef75f1f179f2f27df2f482f3f586f3f68af4f88ef5f992f6fa96f8fb9af9fc9dfafda1fcffa4")),Cx=Bx(Y("0d088710078813078916078a19068c1b068d1d068e20068f2206902406912605912805922a05932c05942e05952f059631059733059735049837049938049a3a049a3c049b3e049c3f049c41049d43039e44039e46039f48039f4903a04b03a14c02a14e02a25002a25102a35302a35502a45601a45801a45901a55b01a55c01a65e01a66001a66100a76300a76400a76600a76700a86900a86a00a86c00a86e00a86f00a87100a87201a87401a87501a87701a87801a87a02a87b02a87d03a87e03a88004a88104a78305a78405a78606a68707a68808a68a09a58b0aa58d0ba58e0ca48f0da4910ea3920fa39410a29511a19613a19814a099159f9a169f9c179e9d189d9e199da01a9ca11b9ba21d9aa31e9aa51f99a62098a72197a82296aa2395ab2494ac2694ad2793ae2892b02991b12a90b22b8fb32c8eb42e8db52f8cb6308bb7318ab83289ba3388bb3488bc3587bd3786be3885bf3984c03a83c13b82c23c81c33d80c43e7fc5407ec6417dc7427cc8437bc9447aca457acb4679cc4778cc4977cd4a76ce4b75cf4c74d04d73d14e72d24f71d35171d45270d5536fd5546ed6556dd7566cd8576bd9586ada5a6ada5b69db5c68dc5d67dd5e66de5f65de6164df6263e06363e16462e26561e26660e3685fe4695ee56a5de56b5de66c5ce76e5be76f5ae87059e97158e97257ea7457eb7556eb7655ec7754ed7953ed7a52ee7b51ef7c51ef7e50f07f4ff0804ef1814df1834cf2844bf3854bf3874af48849f48948f58b47f58c46f68d45f68f44f79044f79143f79342f89441f89540f9973ff9983ef99a3efa9b3dfa9c3cfa9e3bfb9f3afba139fba238fca338fca537fca636fca835fca934fdab33fdac33fdae32fdaf31fdb130fdb22ffdb42ffdb52efeb72dfeb82cfeba2cfebb2bfebd2afebe2afec029fdc229fdc328fdc527fdc627fdc827fdca26fdcb26fccd25fcce25fcd025fcd225fbd324fbd524fbd724fad824fada24f9dc24f9dd25f8df25f8e125f7e225f7e425f6e626f6e826f5e926f5eb27f4ed27f3ee27f3f027f2f227f1f426f1f525f0f724f0f921"));function He(e){return function(){return e}}var TS=Math.cos;var Cu=Math.min,Bp=Math.sin,Jt=Math.sqrt,ES=1e-12,Zc=Math.PI,lMt=Zc/2,ku=2*Zc;function kx(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 pa(t)}var dMt=Array.prototype.slice;function Rx(e){return typeof e=="object"&&"length"in e?e:Array.from(e)}function hD(e){this._context=e}hD.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 Ms(e){return new hD(e)}function $x(e){return e[0]}function Ux(e){return e[1]}function Op(e,t){var n=He(!0),r=null,i=Ms,o=null,s=kx(a);e=typeof e=="function"?e:e===void 0?$x:He(e),t=typeof t=="function"?t:t===void 0?Ux:He(t);function a(c){var l,u=(c=Rx(c)).length,f,h=!1,d;for(r==null&&(o=i(d=s())),l=0;l<=u;++l)!(l<u&&n(f=c[l],l,c))===h&&((h=!h)?o.lineStart():o.lineEnd()),h&&o.point(+e(f,l,c),+t(f,l,c));if(d)return o=null,d+""||null}return a.x=function(c){return arguments.length?(e=typeof c=="function"?c:He(+c),a):e},a.y=function(c){return arguments.length?(t=typeof c=="function"?c:He(+c),a):t},a.defined=function(c){return arguments.length?(n=typeof c=="function"?c:He(!!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 Ru(e,t,n){var r=null,i=He(!0),o=null,s=Ms,a=null,c=kx(l);e=typeof e=="function"?e:e===void 0?$x:He(+e),t=typeof t=="function"?t:t===void 0?He(0):He(+t),n=typeof n=="function"?n:n===void 0?Ux:He(+n);function l(f){var h,d,p,m=(f=Rx(f)).length,y,g=!1,b,x=new Array(m),w=new Array(m);for(o==null&&(a=s(b=c())),h=0;h<=m;++h){if(!(h<m&&i(y=f[h],h,f))===g)if(g=!g)d=h,a.areaStart(),a.lineStart();else{for(a.lineEnd(),a.lineStart(),p=h-1;p>=d;--p)a.point(x[p],w[p]);a.lineEnd(),a.areaEnd()}g&&(x[h]=+e(y,h,f),w[h]=+t(y,h,f),a.point(r?+r(y,h,f):x[h],n?+n(y,h,f):w[h]))}if(b)return a=null,b+""||null}function u(){return Op().defined(i).curve(s).context(o)}return l.x=function(f){return arguments.length?(e=typeof f=="function"?f:He(+f),r=null,l):e},l.x0=function(f){return arguments.length?(e=typeof f=="function"?f:He(+f),l):e},l.x1=function(f){return arguments.length?(r=f==null?null:typeof f=="function"?f:He(+f),l):r},l.y=function(f){return arguments.length?(t=typeof f=="function"?f:He(+f),n=null,l):t},l.y0=function(f){return arguments.length?(t=typeof f=="function"?f:He(+f),l):t},l.y1=function(f){return arguments.length?(n=f==null?null:typeof f=="function"?f:He(+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:He(!!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 Px=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 DS(e){return new Px(e,!0)}function NS(e){return new Px(e,!1)}var Oq=Jt(3),Lp={draw(e,t){let n=Jt(t+Cu(t/28,.75))*.59436,r=n/2,i=r*Oq;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 As={draw(e,t){let n=Jt(t/Zc);e.moveTo(n,0),e.arc(0,0,n,0,ku)}};var Fp={draw(e,t){let n=Jt(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 dD=Jt(1/3),Lq=dD*2,Cp={draw(e,t){let n=Jt(t/Lq),r=n*dD;e.moveTo(0,-n),e.lineTo(r,0),e.lineTo(0,n),e.lineTo(-r,0),e.closePath()}};var kp={draw(e,t){let n=Jt(t)*.62625;e.moveTo(0,-n),e.lineTo(n,0),e.lineTo(0,n),e.lineTo(-n,0),e.closePath()}};var Rp={draw(e,t){let n=Jt(t-Cu(t/7,2))*.87559;e.moveTo(-n,0),e.lineTo(n,0),e.moveTo(0,n),e.lineTo(0,-n)}};var $p={draw(e,t){let n=Jt(t),r=-n/2;e.rect(r,r,n,n)}};var Up={draw(e,t){let n=Jt(t)*.4431;e.moveTo(n,n),e.lineTo(n,-n),e.lineTo(-n,-n),e.lineTo(-n,n),e.closePath()}};var Fq=.8908130915292852,pD=Bp(Zc/10)/Bp(7*Zc/10),Cq=Bp(ku/10)*pD,kq=-TS(ku/10)*pD,Pp={draw(e,t){let n=Jt(t*Fq),r=Cq*n,i=kq*n;e.moveTo(0,-n),e.lineTo(r,i);for(let o=1;o<5;++o){let s=ku*o/5,a=TS(s),c=Bp(s);e.lineTo(c*n,-a*n),e.lineTo(a*r-c*i,c*r+a*i)}e.closePath()}};var BS=Jt(3),zp={draw(e,t){let n=-Jt(t/(BS*3));e.moveTo(0,n*2),e.lineTo(-BS*n,-n),e.lineTo(BS*n,-n),e.closePath()}};var Rq=Jt(3),qp={draw(e,t){let n=Jt(t)*.6824,r=n/2,i=n*Rq/2;e.moveTo(0,-n),e.lineTo(i,r),e.lineTo(-i,r),e.closePath()}};var ri=-.5,ii=Jt(3)/2,OS=1/Jt(12),$q=(OS/2+1)*3,Vp={draw(e,t){let n=Jt(t/$q),r=n/2,i=n*OS,o=r,s=n*OS+n,a=-o,c=s;e.moveTo(r,i),e.lineTo(o,s),e.lineTo(a,c),e.lineTo(ri*r-ii*i,ii*r+ri*i),e.lineTo(ri*o-ii*s,ii*o+ri*s),e.lineTo(ri*a-ii*c,ii*a+ri*c),e.lineTo(ri*r+ii*i,ri*i-ii*r),e.lineTo(ri*o+ii*s,ri*s-ii*o),e.lineTo(ri*a+ii*c,ri*c-ii*a),e.closePath()}};var $u={draw(e,t){let n=Jt(t-Cu(t/6,1.7))*.6189;e.moveTo(-n,-n),e.lineTo(n,n),e.moveTo(-n,n),e.lineTo(n,-n)}};var zx=[As,Fp,Cp,$p,Pp,zp,Vp],LS=[As,Rp,$u,qp,Lp,Up,kp];function oi(){}function Uu(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 jp(e){this._context=e}jp.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:Uu(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:Uu(this,e,t);break}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t}};function FS(e){return new jp(e)}function mD(e){this._context=e}mD.prototype={areaStart:oi,areaEnd:oi,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:Uu(this,e,t);break}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t}};function CS(e){return new mD(e)}function yD(e){this._context=e}yD.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:Uu(this,e,t);break}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t}};function kS(e){return new yD(e)}function gD(e,t){this._basis=new jp(e),this._beta=t}gD.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 RS=function e(t){function n(r){return t===1?new jp(r):new gD(r,t)}return n.beta=function(r){return e(+r)},n}(.85);function Pu(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 qx(e,t){this._context=e,this._k=(1-t)/6}qx.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._x2=this._y0=this._y1=this._y2=NaN,this._point=0},lineEnd:function(){switch(this._point){case 2:this._context.lineTo(this._x2,this._y2);break;case 3:Pu(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:Pu(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 $S=function e(t){function n(r){return new qx(r,t)}return n.tension=function(r){return e(+r)},n}(0);function Vx(e,t){this._context=e,this._k=(1-t)/6}Vx.prototype={areaStart:oi,areaEnd:oi,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:Pu(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 US=function e(t){function n(r){return new Vx(r,t)}return n.tension=function(r){return e(+r)},n}(0);function jx(e,t){this._context=e,this._k=(1-t)/6}jx.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:Pu(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 PS=function e(t){function n(r){return new jx(r,t)}return n.tension=function(r){return e(+r)},n}(0);function Yp(e,t,n){var r=e._x1,i=e._y1,o=e._x2,s=e._y2;if(e._l01_a>ES){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>ES){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 bD(e,t){this._context=e,this._alpha=t}bD.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:Yp(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 zS=function e(t){function n(r){return t?new bD(r,t):new qx(r,0)}return n.alpha=function(r){return e(+r)},n}(.5);function xD(e,t){this._context=e,this._alpha=t}xD.prototype={areaStart:oi,areaEnd:oi,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:Yp(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 qS=function e(t){function n(r){return t?new xD(r,t):new Vx(r,0)}return n.alpha=function(r){return e(+r)},n}(.5);function wD(e,t){this._context=e,this._alpha=t}wD.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:Yp(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 VS=function e(t){function n(r){return t?new wD(r,t):new jx(r,0)}return n.alpha=function(r){return e(+r)},n}(.5);function _D(e){this._context=e}_D.prototype={areaStart:oi,areaEnd:oi,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 jS(e){return new _D(e)}function vD(e){return e<0?-1:1}function SD(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(vD(o)+vD(s))*Math.min(Math.abs(o),Math.abs(s),.5*Math.abs(a))||0}function ID(e,t){var n=e._x1-e._x0;return n?(3*(e._y1-e._y0)/n-t)/2:t}function YS(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 Yx(e){this._context=e}Yx.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:YS(this,this._t0,ID(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,YS(this,ID(this,n=SD(this,e,t)),n);break;default:YS(this,this._t0,n=SD(this,e,t));break}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t,this._t0=n}}};function MD(e){this._context=new AD(e)}(MD.prototype=Object.create(Yx.prototype)).point=function(e,t){Yx.prototype.point.call(this,t,e)};function AD(e){this._context=e}AD.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 WS(e){return new Yx(e)}function GS(e){return new MD(e)}function ED(e){this._context=e}ED.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=TD(e),i=TD(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 TD(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 XS(e){return new ED(e)}function Wx(e,t){this._context=e,this._t=t}Wx.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 HS(e){return new Wx(e,.5)}function ZS(e){return new Wx(e,0)}function KS(e){return new Wx(e,1)}var Wp=e=>()=>e;function QS(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 Or(e,t,n){this.k=e,this.x=t,this.y=n}Or.prototype={constructor:Or,scale:function(e){return e===1?this:new Or(this.k*e,this.x,this.y)},translate:function(e,t){return e===0&t===0?this:new Or(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 Gp=new Or(1,0,0);JS.prototype=Or.prototype;function JS(e){for(;!e.__zoom;)if(!(e=e.parentNode))return Gp;return e.__zoom}function Gx(e){e.stopImmediatePropagation()}function zu(e){e.preventDefault(),e.stopImmediatePropagation()}function Uq(e){return(!e.ctrlKey||e.type==="wheel")&&!e.button}function Pq(){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 DD(){return this.__zoom||Gp}function zq(e){return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*(e.ctrlKey?10:1)}function qq(){return navigator.maxTouchPoints||"ontouchstart"in this}function Vq(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 tI(){var e=Uq,t=Pq,n=Vq,r=zq,i=qq,o=[0,1/0],s=[[-1/0,-1/0],[1/0,1/0]],a=250,c=Tv,l=Ic("start","zoom","end"),u,f,h,d=500,p=150,m=0,y=10;function g(S){S.property("__zoom",DD).on("wheel.zoom",E,{passive:!1}).on("mousedown.zoom",I).on("dblclick.zoom",N).filter(i).on("touchstart.zoom",A).on("touchmove.zoom",B).on("touchend.zoom touchcancel.zoom",L).style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}g.transform=function(S,T,D,C){var k=S.selection?S.selection():S;k.property("__zoom",DD),S!==k?v(S,T,D,C):k.interrupt().each(function(){_(this,arguments).event(C).start().zoom(null,typeof T=="function"?T.apply(this,arguments):T).end()})},g.scaleBy=function(S,T,D,C){g.scaleTo(S,function(){var k=this.__zoom.k,F=typeof T=="function"?T.apply(this,arguments):T;return k*F},D,C)},g.scaleTo=function(S,T,D,C){g.transform(S,function(){var k=t.apply(this,arguments),F=this.__zoom,R=D==null?w(k):typeof D=="function"?D.apply(this,arguments):D,$=F.invert(R),U=typeof T=="function"?T.apply(this,arguments):T;return n(x(b(F,U),R,$),k,s)},D,C)},g.translateBy=function(S,T,D,C){g.transform(S,function(){return n(this.__zoom.translate(typeof T=="function"?T.apply(this,arguments):T,typeof D=="function"?D.apply(this,arguments):D),t.apply(this,arguments),s)},null,C)},g.translateTo=function(S,T,D,C,k){g.transform(S,function(){var F=t.apply(this,arguments),R=this.__zoom,$=C==null?w(F):typeof C=="function"?C.apply(this,arguments):C;return n(Gp.translate($[0],$[1]).scale(R.k).translate(typeof T=="function"?-T.apply(this,arguments):-T,typeof D=="function"?-D.apply(this,arguments):-D),F,s)},C,k)};function b(S,T){return T=Math.max(o[0],Math.min(o[1],T)),T===S.k?S:new Or(T,S.x,S.y)}function x(S,T,D){var C=T[0]-D[0]*S.k,k=T[1]-D[1]*S.k;return C===S.x&&k===S.y?S:new Or(S.k,C,k)}function w(S){return[(+S[0][0]+ +S[1][0])/2,(+S[0][1]+ +S[1][1])/2]}function v(S,T,D,C){S.on("start.zoom",function(){_(this,arguments).event(C).start()}).on("interrupt.zoom end.zoom",function(){_(this,arguments).event(C).end()}).tween("zoom",function(){var k=this,F=arguments,R=_(k,F).event(C),$=t.apply(k,F),U=D==null?w($):typeof D=="function"?D.apply(k,F):D,G=Math.max($[1][0]-$[0][0],$[1][1]-$[0][1]),et=k.__zoom,rt=typeof T=="function"?T.apply(k,F):T,st=c(et.invert(U).concat(G/et.k),rt.invert(U).concat(G/rt.k));return function(j){if(j===1)j=rt;else{var ot=st(j),z=G/ot[2];j=new Or(z,U[0]-ot[0]*z,U[1]-ot[1]*z)}R.zoom(null,j)}})}function _(S,T,D){return!D&&S.__zooming||new M(S,T)}function M(S,T){this.that=S,this.args=T,this.active=0,this.sourceEvent=null,this.extent=t.apply(S,T),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,T){return this.mouse&&S!=="mouse"&&(this.mouse[1]=T.invert(this.mouse[0])),this.touch0&&S!=="touch"&&(this.touch0[1]=T.invert(this.touch0[0])),this.touch1&&S!=="touch"&&(this.touch1[1]=T.invert(this.touch1[0])),this.that.__zoom=T,this.emit("zoom"),this},end:function(){return--this.active===0&&(delete this.that.__zooming,this.emit("end")),this},emit:function(S){var T=Pt(this.that).datum();l.call(S,this.that,new QS(S,{sourceEvent:this.sourceEvent,target:g,type:S,transform:this.that.__zoom,dispatch:l}),T)}};function E(S,...T){if(!e.apply(this,arguments))return;var D=_(this,T).event(S),C=this.__zoom,k=Math.max(o[0],Math.min(o[1],C.k*Math.pow(2,r.apply(this,arguments)))),F=On(S);if(D.wheel)(D.mouse[0][0]!==F[0]||D.mouse[0][1]!==F[1])&&(D.mouse[1]=C.invert(D.mouse[0]=F)),clearTimeout(D.wheel);else{if(C.k===k)return;D.mouse=[F,C.invert(F)],uo(this),D.start()}zu(S),D.wheel=setTimeout(R,p),D.zoom("mouse",n(x(b(C,k),D.mouse[0],D.mouse[1]),D.extent,s));function R(){D.wheel=null,D.end()}}function I(S,...T){if(h||!e.apply(this,arguments))return;var D=S.currentTarget,C=_(this,T,!0).event(S),k=Pt(S.view).on("mousemove.zoom",U,!0).on("mouseup.zoom",G,!0),F=On(S,D),R=S.clientX,$=S.clientY;Sd(S.view),Gx(S),C.mouse=[F,this.__zoom.invert(F)],uo(this),C.start();function U(et){if(zu(et),!C.moved){var rt=et.clientX-R,st=et.clientY-$;C.moved=rt*rt+st*st>m}C.event(et).zoom("mouse",n(x(C.that.__zoom,C.mouse[0]=On(et,D),C.mouse[1]),C.extent,s))}function G(et){k.on("mousemove.zoom mouseup.zoom",null),Id(et.view,C.moved),zu(et),C.event(et).end()}}function N(S,...T){if(e.apply(this,arguments)){var D=this.__zoom,C=On(S.changedTouches?S.changedTouches[0]:S,this),k=D.invert(C),F=D.k*(S.shiftKey?.5:2),R=n(x(b(D,F),C,k),t.apply(this,T),s);zu(S),a>0?Pt(this).transition().duration(a).call(v,R,C,S):Pt(this).call(g.transform,R,C,S)}}function A(S,...T){if(e.apply(this,arguments)){var D=S.touches,C=D.length,k=_(this,T,S.changedTouches.length===C).event(S),F,R,$,U;for(Gx(S),R=0;R<C;++R)$=D[R],U=On($,this),U=[U,this.__zoom.invert(U),$.identifier],k.touch0?!k.touch1&&k.touch0[2]!==U[2]&&(k.touch1=U,k.taps=0):(k.touch0=U,F=!0,k.taps=1+!!u);u&&(u=clearTimeout(u)),F&&(k.taps<2&&(f=U[0],u=setTimeout(function(){u=null},d)),uo(this),k.start())}}function B(S,...T){if(this.__zooming){var D=_(this,T).event(S),C=S.changedTouches,k=C.length,F,R,$,U;for(zu(S),F=0;F<k;++F)R=C[F],$=On(R,this),D.touch0&&D.touch0[2]===R.identifier?D.touch0[0]=$:D.touch1&&D.touch1[2]===R.identifier&&(D.touch1[0]=$);if(R=D.that.__zoom,D.touch1){var G=D.touch0[0],et=D.touch0[1],rt=D.touch1[0],st=D.touch1[1],j=(j=rt[0]-G[0])*j+(j=rt[1]-G[1])*j,ot=(ot=st[0]-et[0])*ot+(ot=st[1]-et[1])*ot;R=b(R,Math.sqrt(j/ot)),$=[(G[0]+rt[0])/2,(G[1]+rt[1])/2],U=[(et[0]+st[0])/2,(et[1]+st[1])/2]}else if(D.touch0)$=D.touch0[0],U=D.touch0[1];else return;D.zoom("touch",n(x(R,$,U),D.extent,s))}}function L(S,...T){if(this.__zooming){var D=_(this,T).event(S),C=S.changedTouches,k=C.length,F,R;for(Gx(S),h&&clearTimeout(h),h=setTimeout(function(){h=null},d),F=0;F<k;++F)R=C[F],D.touch0&&D.touch0[2]===R.identifier?delete D.touch0:D.touch1&&D.touch1[2]===R.identifier&&delete D.touch1;if(D.touch1&&!D.touch0&&(D.touch0=D.touch1,delete D.touch1),D.touch0)D.touch0[1]=this.__zoom.invert(D.touch0[0]);else if(D.end(),D.taps===2&&(R=On(R,this),Math.hypot(f[0]-R[0],f[1]-R[1])<y)){var $=Pt(this).on("dblclick.zoom");$&&$.apply(this,arguments)}}}return g.wheelDelta=function(S){return arguments.length?(r=typeof S=="function"?S:Wp(+S),g):r},g.filter=function(S){return arguments.length?(e=typeof S=="function"?S:Wp(!!S),g):e},g.touchable=function(S){return arguments.length?(i=typeof S=="function"?S:Wp(!!S),g):i},g.extent=function(S){return arguments.length?(t=typeof S=="function"?S:Wp([[+S[0][0],+S[0][1]],[+S[1][0],+S[1][1]]]),g):t},g.scaleExtent=function(S){return arguments.length?(o[0]=+S[0],o[1]=+S[1],g):[o[0],o[1]]},g.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],g):[[s[0][0],s[0][1]],[s[1][0],s[1][1]]]},g.constrain=function(S){return arguments.length?(n=S,g):n},g.duration=function(S){return arguments.length?(a=+S,g):a},g.interpolate=function(S){return arguments.length?(c=S,g):c},g.on=function(){var S=l.on.apply(l,arguments);return S===l?g:S},g.clickDistance=function(S){return arguments.length?(m=(S=+S)*S,g):Math.sqrt(m)},g.tapDistance=function(S){return arguments.length?(y=+S,g):y},g}function $e(e){return e!=null&&!Number.isNaN(e)}function un(e,t){return+$e(t)-+$e(e)||$t(e,t)}function Kc(e,t){return+$e(t)-+$e(e)||Yn(e,t)}function Xp(e){return e!=null&&`${e}`!=""}function qu(e){return isFinite(e)?e:NaN}function nr(e){return e>0&&isFinite(e)?e:NaN}function Sa(e){return e<0&&isFinite(e)?e:NaN}function Xx(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`${jq(e.getUTCFullYear(),4)}-${Ts(e.getUTCMonth()+1,2)}-${Ts(e.getUTCDate(),2)}${n||r||i||o?`T${Ts(n,2)}:${Ts(r,2)}${i||o?`:${Ts(i,2)}${o?`.${Ts(o,3)}`:""}`:""}Z`:""}`}function jq(e){return e<0?`-${Ts(-e,6)}`:e>9999?`+${Ts(e,6)}`:Ts(e,4)}function Ts(e,t){return`${e}`.padStart(t,"0")}var Yq=/^(?:[-+]\d{2})?\d{4}(?:-\d{2}(?:-\d{2})?)?(?:T\d{2}:\d{2}(?::\d{2}(?:\.\d{3})?)?(?:Z|[-+]\d{2}:?\d{2})?)?$/;function Hp(e,t){return Yq.test(e+="")?new Date(e):typeof t=="function"?t(e):t}function Es(e){if(e==null)return;let t=e[0],n=e[e.length-1];return Yn(t,n)}var ju=1e3,Ma=ju*60,Aa=Ma*60,Mo=Aa*24,Io=Mo*7,Qc=Mo*30,Ia=Mo*365,eI=[["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",ju],["5 seconds",5*ju],["15 seconds",15*ju],["30 seconds",30*ju],["minute",Ma],["5 minutes",5*Ma],["15 minutes",15*Ma],["30 minutes",30*Ma],["hour",Aa],["3 hours",3*Aa],["6 hours",6*Aa],["12 hours",12*Aa],["day",Mo],["2 days",2*Mo],["week",Io],["2 weeks",2*Io],["month",Qc],["3 months",3*Qc],["6 months",6*Qc],["year",Ia],["2 years",2*Ia],["5 years",5*Ia],["10 years",10*Ia],["20 years",20*Ia],["50 years",50*Ia],["100 years",100*Ia]],nI=new Map([["second",ju],["minute",Ma],["hour",Aa],["day",Mo],["monday",Io],["tuesday",Io],["wednesday",Io],["thursday",Io],["friday",Io],["saturday",Io],["sunday",Io],["week",Io],["month",Qc],["year",Ia]]),BD=new Map([["second",cn],["minute",xs],["hour",_s],["day",ni],["monday",_a],["tuesday",fb],["wednesday",hb],["thursday",_o],["friday",db],["saturday",pb],["sunday",Nr],["week",Nr],["month",Ss],["year",Rn]]),rI=new Map([["second",cn],["minute",ws],["hour",vs],["day",Gc],["monday",va],["tuesday",mb],["wednesday",yb],["thursday",vo],["friday",gb],["saturday",bb],["sunday",Br],["week",Br],["month",Is],["year",$n]]),Yu=Symbol("intervalDuration"),Zx=Symbol("intervalType");for(let[e,t]of BD)t[Yu]=nI.get(e),t[Zx]="time";for(let[e,t]of rI)t[Yu]=nI.get(e),t[Zx]="utc";var Zp=[["year",$n,"utc"],["month",Is,"utc"],["day",Gc,"utc",6*Qc],["hour",vs,"utc",3*Mo],["minute",ws,"utc",6*Aa],["second",cn,"utc",30*Ma]],Hx=[["year",Rn,"time"],["month",Ss,"time"],["day",ni,"time",6*Qc],["hour",_s,"time",3*Mo],["minute",xs,"time",6*Aa],["second",cn,"time",30*Ma]],Wq=[Zp[0],Hx[0],Zp[1],Hx[1],Zp[2],Hx[2],...Zp.slice(3)];function Kx(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=rI.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 iI(e){return OD(Kx(e),"time")}function Kp(e){return OD(Kx(e),"utc")}function OD([e,t],n){let r=(n==="time"?BD:rI).get(e);return t>1&&(r=r.every(t),r[Yu]=nI.get(e)*t,r[Zx]=n),r}function oI(e,t){if(!(t>1))return;let n=e[Yu];if(!eI.some(([,i])=>i===n)||n%Mo===0&&Mo<n&&n<Qc)return;let[r]=eI[is(([,i])=>Math.log(i)).center(eI,Math.log(n*t))];return(e[Zx]==="time"?iI:Kp)(r)}function ND(e,t,n){let r=t==="time"?Ou:So;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=Gq(n);switch(e){case"millisecond":return Vu(r(".%L"),r(":%M:%S"),i);case"second":return Vu(r(":%S"),r("%-I:%M"),i);case"minute":return Vu(r("%-I:%M"),r("%p"),i);case"hour":return Vu(r("%-I %p"),r("%b %-d"),i);case"day":return Vu(r("%-d"),r("%b"),i);case"month":return Vu(r("%b"),r("%Y"),i);case"year":return r("%Y")}throw new Error("unable to format time ticks")}function Gq(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]=Sh({length:this.numRows},t,n);let i=Yy(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=At({type:r,length:0,nullCount:0});n.push(i._changeLengthAndBackfillNullBitmap(this.numRows))}return new qt(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 qt([At({type:new Ln,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]=x0(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,h=n.findIndex(d=>d.name===c.name);return~h?f[h]=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(...x0(o,s))}};_A=Symbol.toStringTag;fr[_A]=(e=>(e.schema=null,e.batches=[],e._offsets=new Uint32Array([0]),e._nullCount=-1,e[Symbol.isConcatSpreadable]=!0,e.isValid=$l(Ah),e.get=$l(Ve.getVisitFn(B.Struct)),e.set=Wy(wn.getVisitFn(B.Struct)),e.indexOf=Gy(sc.getVisitFn(B.Struct)),"Table"))(fr.prototype);var SA,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=At({nullCount:0,type:new ye(this.schema.fields),children:this.schema.fields.map(n=>At({type:n.type,nullCount:0}))})]=t,!(this.data instanceof Kt))throw new TypeError("RecordBatch constructor expects a [Schema, Data] pair.");[this.schema,this.data]=vA(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]=$t.new({name:l,type:n[l].type,nullable:!0}),c),{length:0,fields:new Array,children:new Array}),s=new re(r),a=At({type:new ye(r),length:o,children:i,nullCount:0});[this.schema,this.data]=vA(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=MA(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 Ve.visit(this.data,t)}set(t,n){return wn.visit(this.data,t,n)}indexOf(t,n){return sc.visit(this.data,t,n)}[Symbol.iterator](){return Ul.visit(new qt([this.data]))}toArray(){return[...this]}concat(...t){return new fr(this.schema,[this,...t])}slice(t,n){let[r]=new qt([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 qt([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 qt([At({type:new Ln,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=At({type:new ye(o),children:s})}return new e(r,i)}select(t){let n=this.schema.select(t),r=new ye(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,At({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=At({type:new ye(n.fields),length:this.numRows,children:r});return new e(n,i)}};SA=Symbol.toStringTag;Le[SA]=(e=>(e._nullCount=-1,e[Symbol.isConcatSpreadable]=!0,"RecordBatch"))(Le.prototype);function vA(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:At({type:c.type,length:n,nullCount:n,nullBitmap:new Uint8Array(s)}))}return[e.assign(i),At({type:new ye(i),length:n,children:o})]}function MA(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)||[]])MA(a.children,l?.children,n);if(X.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 mc=class extends Le{constructor(t){let n=t.fields.map(i=>At({type:i.type})),r=At({type:new ye(t.fields),nullCount:0,children:n});super(t,r)}};var Si=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):se.V1}headerType(){let t=this.bb.__offset(this.bb_pos,6);return t?this.bb.readUint8(this.bb_pos+t):Ut.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 tn).__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,se.V1)}static addHeaderType(t,n){t.addFieldInt8(1,n,Ut.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 L_=class extends dt{visit(t,n){return t==null||n==null?void 0:super.visit(t,n)}visitNull(t,n){return ah.startNull(n),ah.endNull(n)}visitInt(t,n){return mi.startInt(n),mi.addBitWidth(n,t.bitWidth),mi.addIsSigned(n,t.isSigned),mi.endInt(n)}visitFloat(t,n){return ta.startFloatingPoint(n),ta.addPrecision(n,t.precision),ta.endFloatingPoint(n)}visitBinary(t,n){return nh.startBinary(n),nh.endBinary(n)}visitLargeBinary(t,n){return ih.startLargeBinary(n),ih.endLargeBinary(n)}visitBool(t,n){return rh.startBool(n),rh.endBool(n)}visitUtf8(t,n){return lh.startUtf8(n),lh.endUtf8(n)}visitLargeUtf8(t,n){return oh.startLargeUtf8(n),oh.endLargeUtf8(n)}visitDecimal(t,n){return Yi.startDecimal(n),Yi.addScale(n,t.scale),Yi.addPrecision(n,t.precision),Yi.addBitWidth(n,t.bitWidth),Yi.endDecimal(n)}visitDate(t,n){return Zs.startDate(n),Zs.addUnit(n,t.unit),Zs.endDate(n)}visitTime(t,n){return Yo.startTime(n),Yo.addUnit(n,t.unit),Yo.addBitWidth(n,t.bitWidth),Yo.endTime(n)}visitTimestamp(t,n){let r=t.timezone&&n.createString(t.timezone)||void 0;return Wo.startTimestamp(n),Wo.addUnit(n,t.unit),r!==void 0&&Wo.addTimezone(n,r),Wo.endTimestamp(n)}visitInterval(t,n){return ea.startInterval(n),ea.addUnit(n,t.unit),ea.endInterval(n)}visitDuration(t,n){return Qs.startDuration(n),Qs.addUnit(n,t.unit),Qs.endDuration(n)}visitList(t,n){return sh.startList(n),sh.endList(n)}visitStruct(t,n){return ch.startStruct_(n),ch.endStruct_(n)}visitUnion(t,n){yi.startTypeIdsVector(n,t.typeIds.length);let r=yi.createTypeIdsVector(n,t.typeIds);return yi.startUnion(n),yi.addMode(n,t.mode),yi.addTypeIds(n,r),yi.endUnion(n)}visitDictionary(t,n){let r=this.visit(t.indices,n);return ji.startDictionaryEncoding(n),ji.addId(n,BigInt(t.id)),ji.addIsOrdered(n,t.isOrdered),r!==void 0&&ji.addIndexType(n,r),ji.endDictionaryEncoding(n)}visitFixedSizeBinary(t,n){return Ks.startFixedSizeBinary(n),Ks.addByteWidth(n,t.byteWidth),Ks.endFixedSizeBinary(n)}visitFixedSizeList(t,n){return Js.startFixedSizeList(n),Js.addListSize(n,t.listSize),Js.endFixedSizeList(n)}visitMap(t,n){return na.startMap(n),na.addKeysSorted(n,t.keysSorted),na.endMap(n)}},w0=new L_;function EA(e,t=new Map){return new re(CC(e,t),_0(e.metadata),t)}function F_(e){return new _n(e.count,NA(e.columns),OA(e.columns))}function DA(e){return new dr(F_(e.data),e.id,e.isDelta)}function CC(e,t){return(e.fields||[]).filter(Boolean).map(n=>$t.fromJSON(n,t))}function IA(e,t){return(e.children||[]).filter(Boolean).map(n=>$t.fromJSON(n,t))}function NA(e){return(e||[]).reduce((t,n)=>[...t,new Hr(n.count,RC(n.VALIDITY)),...NA(n.children)],[])}function OA(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=OA(i.children,t)}return t}function RC(e){return(e||[]).reduce((t,n)=>t+ +(n===0),0)}function BA(e,t){let n,r,i,o,s,a;return!t||!(o=e.dictionary)?(s=TA(e,IA(e,t)),i=new $t(e.name,s,e.nullable,_0(e.metadata))):t.has(n=o.id)?(r=(r=o.indexType)?AA(r):new wi,a=new lr(t.get(n),r,n,o.isOrdered),i=new $t(e.name,a,e.nullable,_0(e.metadata))):(r=(r=o.indexType)?AA(r):new wi,t.set(n,s=TA(e,IA(e,t))),a=new lr(s,r,n,o.isOrdered),i=new $t(e.name,a,e.nullable,_0(e.metadata))),i||null}function _0(e=[]){return new Map(e.map(({key:t,value:n})=>[t,n]))}function AA(e){return new Be(e.isSigned,e.bitWidth)}function TA(e,t){let n=e.type.name;switch(n){case"NONE":return new Ln;case"null":return new Ln;case"binary":return new Wi;case"largebinary":return new Gi;case"utf8":return new Xi;case"largeutf8":return new Hi;case"bool":return new Zi;case"list":return new qr((t||[])[0]);case"struct":return new ye(t||[]);case"struct_":return new ye(t||[])}switch(n){case"int":{let r=e.type;return new Be(r.isSigned,r.bitWidth)}case"floatingpoint":{let r=e.type;return new Yn(fe[r.precision])}case"decimal":{let r=e.type;return new Qi(r.scale,r.precision,r.bitWidth)}case"date":{let r=e.type;return new Ki(qe[r.unit])}case"time":{let r=e.type;return new zr(at[r.unit],r.bitWidth)}case"timestamp":{let r=e.type;return new Ji(at[r.unit],r.timezone)}case"interval":{let r=e.type;return new to(on[r.unit])}case"duration":{let r=e.type;return new eo(at[r.unit])}case"union":{let r=e.type,[i,...o]=(r.mode+"").toLowerCase(),s=i.toUpperCase()+o.join("");return new Vr(me[s],r.typeIds||[],t||[])}case"fixedsizebinary":{let r=e.type;return new no(r.byteWidth)}case"fixedsizelist":{let r=e.type;return new jr(r.listSize,(t||[])[0])}case"map":{let r=e.type;return new Yr((t||[])[0],r.keysSorted)}}throw new Error(`Unrecognized type: "${n}"`)}var kC=nc,$C=vr,pr=class e{static fromJSON(t,n){let r=new e(0,se.V5,n);return r._createHeader=UC(t,n),r}static decode(t){t=new $C(wt(t));let n=Si.getRootAsMessage(t),r=n.bodyLength(),i=n.version(),o=n.headerType(),s=new e(r,i,o);return s._createHeader=PC(n,o),s}static encode(t){let n=new kC,r=-1;return t.isSchema()?r=re.encode(n,t.header()):t.isRecordBatch()?r=_n.encode(n,t.header()):t.isDictionaryBatch()&&(r=dr.encode(n,t.header())),Si.startMessage(n),Si.addVersion(n,se.V5),Si.addHeader(n,r),Si.addHeaderType(n,t.headerType),Si.addBodyLength(n,BigInt(t.bodyLength)),Si.finishMessageBuffer(n,Si.endMessage(n)),n.asUint8Array()}static from(t,n=0){if(t instanceof re)return new e(0,se.V5,Ut.Schema,t);if(t instanceof _n)return new e(n,se.V5,Ut.RecordBatch,t);if(t instanceof dr)return new e(n,se.V5,Ut.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===Ut.Schema}isRecordBatch(){return this.headerType===Ut.RecordBatch}isDictionaryBatch(){return this.headerType===Ut.DictionaryBatch}constructor(t,n,r,i){this._version=n,this._headerType=r,this.body=new Uint8Array(0),i&&(this._createHeader=()=>i),this._bodyLength=Te(t)}},_n=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=Te(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=Te(n)}},hr=class{constructor(t,n){this.offset=Te(t),this.length=Te(n)}},Hr=class{constructor(t,n){this.length=Te(t),this.nullCount=Te(n)}};function UC(e,t){return()=>{switch(t){case Ut.Schema:return re.fromJSON(e);case Ut.RecordBatch:return _n.fromJSON(e);case Ut.DictionaryBatch:return dr.fromJSON(e)}throw new Error(`Unrecognized Message type: { name: ${Ut[t]}, type: ${t} }`)}}function PC(e,t){return()=>{switch(t){case Ut.Schema:return re.decode(e.header(new cr),new Map,e.version());case Ut.RecordBatch:return _n.decode(e.header(new Sr),e.version());case Ut.DictionaryBatch:return dr.decode(e.header(new jo),e.version())}throw new Error(`Unrecognized Message type: { name: ${Ut[t]}, type: ${t} }`)}}$t.encode=QC;$t.decode=HC;$t.fromJSON=BA;re.encode=ZC;re.decode=zC;re.fromJSON=EA;_n.encode=KC;_n.decode=qC;_n.fromJSON=F_;dr.encode=JC;dr.decode=VC;dr.fromJSON=DA;Hr.encode=tR;Hr.decode=YC;hr.encode=eR;hr.decode=jC;function zC(e,t=new Map,n=se.V5){let r=XC(e,t);return new re(r,v0(e),t,n)}function qC(e,t=se.V5){if(e.compression()!==null)throw new Error("Record batch compression not implemented");return new _n(e.length(),WC(e),GC(e,t))}function VC(e,t=se.V5){return new dr(_n.decode(e.data(),t),e.id(),e.isDelta())}function jC(e){return new hr(e.offset(),e.length())}function YC(e){return new Hr(e.length(),e.nullCount())}function WC(e){let t=[];for(let n,r=-1,i=-1,o=e.nodesLength();++r<o;)(n=e.nodes(r))&&(t[++i]=Hr.decode(n));return t}function GC(e,t){let n=[];for(let r,i=-1,o=-1,s=e.buffersLength();++i<s;)(r=e.buffers(i))&&(t<se.V4&&(r.bb_pos+=8*(i+1)),n[++o]=hr.decode(r));return n}function XC(e,t){let n=[];for(let r,i=-1,o=-1,s=e.fieldsLength();++i<s;)(r=e.fields(i))&&(n[++o]=$t.decode(r,t));return n}function LA(e,t){let n=[];for(let r,i=-1,o=-1,s=e.childrenLength();++i<s;)(r=e.children(i))&&(n[++o]=$t.decode(r,t));return n}function HC(e,t){let n,r,i,o,s,a;return!t||!(a=e.dictionary())?(i=CA(e,LA(e,t)),r=new $t(e.name(),i,e.nullable(),v0(e))):t.has(n=Te(a.id()))?(o=(o=a.indexType())?FA(o):new wi,s=new lr(t.get(n),o,n,a.isOrdered()),r=new $t(e.name(),s,e.nullable(),v0(e))):(o=(o=a.indexType())?FA(o):new wi,t.set(n,i=CA(e,LA(e,t))),s=new lr(i,o,n,a.isOrdered()),r=new $t(e.name(),s,e.nullable(),v0(e))),r||null}function v0(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 FA(e){return new Be(e.isSigned(),e.bitWidth())}function CA(e,t){let n=e.typeType();switch(n){case he.NONE:return new Ln;case he.Null:return new Ln;case he.Binary:return new Wi;case he.LargeBinary:return new Gi;case he.Utf8:return new Xi;case he.LargeUtf8:return new Hi;case he.Bool:return new Zi;case he.List:return new qr((t||[])[0]);case he.Struct_:return new ye(t||[])}switch(n){case he.Int:{let r=e.type(new mi);return new Be(r.isSigned(),r.bitWidth())}case he.FloatingPoint:{let r=e.type(new ta);return new Yn(r.precision())}case he.Decimal:{let r=e.type(new Yi);return new Qi(r.scale(),r.precision(),r.bitWidth())}case he.Date:{let r=e.type(new Zs);return new Ki(r.unit())}case he.Time:{let r=e.type(new Yo);return new zr(r.unit(),r.bitWidth())}case he.Timestamp:{let r=e.type(new Wo);return new Ji(r.unit(),r.timezone())}case he.Interval:{let r=e.type(new ea);return new to(r.unit())}case he.Duration:{let r=e.type(new Qs);return new eo(r.unit())}case he.Union:{let r=e.type(new yi);return new Vr(r.mode(),r.typeIdsArray()||[],t||[])}case he.FixedSizeBinary:{let r=e.type(new Ks);return new no(r.byteWidth())}case he.FixedSizeList:{let r=e.type(new Js);return new jr(r.listSize(),(t||[])[0])}case he.Map:{let r=e.type(new na);return new Yr((t||[])[0],r.keysSorted())}}throw new Error(`Unrecognized type: "${he[n]}" (${n})`)}function ZC(e,t){let n=t.fields.map(o=>$t.encode(e,o));cr.startFieldsVector(e,n.length);let r=cr.createFieldsVector(e,n),i=t.metadata&&t.metadata.size>0?cr.createCustomMetadataVector(e,[...t.metadata].map(([o,s])=>{let a=e.createString(`${o}`),c=e.createString(`${s}`);return tn.startKeyValue(e),tn.addKey(e,a),tn.addValue(e,c),tn.endKeyValue(e)})):-1;return cr.startSchema(e),cr.addFields(e,r),cr.addEndianness(e,nR?Hs.Little:Hs.Big),i!==-1&&cr.addCustomMetadata(e,i),cr.endSchema(e)}function QC(e,t){let n=-1,r=-1,i=-1,o=t.type,s=t.typeId;X.isDictionary(o)?(s=o.dictionary.typeId,i=w0.visit(o,e),r=w0.visit(o.dictionary,e)):r=w0.visit(o,e);let a=(o.children||[]).map(u=>$t.encode(e,u)),c=Bn.createChildrenVector(e,a),l=t.metadata&&t.metadata.size>0?Bn.createCustomMetadataVector(e,[...t.metadata].map(([u,f])=>{let h=e.createString(`${u}`),d=e.createString(`${f}`);return tn.startKeyValue(e),tn.addKey(e,h),tn.addValue(e,d),tn.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 KC(e,t){let n=t.nodes||[],r=t.buffers||[];Sr.startNodesVector(e,n.length);for(let s of n.slice().reverse())Hr.encode(e,s);let i=e.endVector();Sr.startBuffersVector(e,r.length);for(let s of r.slice().reverse())hr.encode(e,s);let o=e.endVector();return Sr.startRecordBatch(e),Sr.addLength(e,BigInt(t.length)),Sr.addNodes(e,i),Sr.addBuffers(e,o),Sr.endRecordBatch(e)}function JC(e,t){let n=_n.encode(e,t.data);return jo.startDictionaryBatch(e),jo.addId(e,BigInt(t.id)),jo.addIsDelta(e,t.isDelta),jo.addData(e,n),jo.endDictionaryBatch(e)}function tR(e,t){return Nl.createFieldNode(e,BigInt(t.length),BigInt(t.nullCount))}function eR(e,t){return Dl.createBuffer(e,BigInt(t.offset),BigInt(t.length))}var nR=(()=>{let e=new ArrayBuffer(2);return new DataView(e).setInt16(0,256,!0),new Int16Array(e)[0]===256})();var R_=e=>`Expected ${Ut[e]} Message in stream, but was null or length 0.`,k_=e=>`Header pointer of flatbuffer-encoded ${Ut[e]} Message is null or length 0.`,RA=(e,t)=>`Expected to read ${e} metadata bytes, but only read ${t}.`,kA=(e,t)=>`Expected to read ${e} bytes for message body, but only read ${t}.`,Gl=class{constructor(t){this.source=t instanceof oo?t:new oo(t)}[Symbol.iterator](){return this}next(){let t;return(t=this.readMetadataLength()).done?be:t.value===-1&&(t=this.readMetadataLength()).done?be:(t=this.readMetadata(t.value)).done?be: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(R_(t));return n.value}readMessageBody(t){if(t<=0)return new Uint8Array(0);let n=wt(this.source.read(t));if(n.byteLength<t)throw new Error(kA(t,n.byteLength));return n.byteOffset%8===0&&n.byteOffset+n.byteLength<=n.buffer.byteLength?n:n.slice()}readSchema(t=!1){let n=Ut.Schema,r=this.readMessage(n),i=r?.header();if(t&&!i)throw new Error(k_(n));return i}readMetadataLength(){let t=this.source.read(S0),n=t&&new vr(t),r=n?.readInt32(0)||0;return{done:r===0,value:r}}readMetadata(t){let n=this.source.read(t);if(!n)return be;if(n.byteLength<t)throw new Error(RA(t,n.byteLength));return{done:!1,value:pr.decode(n)}}},ed=class{constructor(t,n){this.source=t instanceof Gr?t:hy(t)?new sa(t,n):new Gr(t)}[Symbol.asyncIterator](){return this}next(){return Z(this,void 0,void 0,function*(){let t;return(t=yield this.readMetadataLength()).done?be:t.value===-1&&(t=yield this.readMetadataLength()).done?be:(t=yield this.readMetadata(t.value)).done?be: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(R_(t));return n.value})}readMessageBody(t){return Z(this,void 0,void 0,function*(){if(t<=0)return new Uint8Array(0);let n=wt(yield this.source.read(t));if(n.byteLength<t)throw new Error(kA(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=Ut.Schema,r=yield this.readMessage(n),i=r?.header();if(t&&!i)throw new Error(k_(n));return i})}readMetadataLength(){return Z(this,void 0,void 0,function*(){let t=yield this.source.read(S0),n=t&&new vr(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 be;if(n.byteLength<t)throw new Error(RA(t,n.byteLength));return{done:!1,value:pr.decode(n)}})}},nd=class extends Gl{constructor(t){super(new Uint8Array(0)),this._schema=!1,this._body=[],this._batchIndex=0,this._dictionaryIndex=0,this._json=t instanceof Th?t:new Th(t)}next(){let{_json:t}=this;if(!this._schema)return this._schema=!0,{done:!1,value:pr.fromJSON(t.schema,Ut.Schema)};if(this._dictionaryIndex<t.dictionaries.length){let n=t.dictionaries[this._dictionaryIndex++];return this._body=n.data.columns,{done:!1,value:pr.fromJSON(n,Ut.DictionaryBatch)}}if(this._batchIndex<t.batches.length){let n=t.batches[this._batchIndex++];return this._body=n.columns,{done:!1,value:pr.fromJSON(n,Ut.RecordBatch)}}return this._body=[],be}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(R_(t));return n.value}readSchema(){let t=Ut.Schema,n=this.readMessage(t),r=n?.header();if(!n||!r)throw new Error(k_(t));return r}},S0=4,C_="ARROW1",Xl=new Uint8Array(C_.length);for(let e=0;e<C_.length;e+=1)Xl[e]=C_.codePointAt(e);function M0(e,t=0){for(let n=-1,r=Xl.length;++n<r;)if(Xl[n]!==e[t+n])return!1;return!0}var Hl=Xl.length,$_=Hl+S0,$A=Hl*2+S0;var Ar=class e extends cc{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 wr(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 xn.toDOMStream(this.isSync()?{[Symbol.iterator]:()=>this}:{[Symbol.asyncIterator]:()=>this})}toNodeStream(){return xn.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:uy(t)?iR(t):hy(t)?aR(t):wr(t)?Z(this,void 0,void 0,function*(){return yield e.from(yield t)}):dy(t)||Zf(t)||my(t)||Ur(t)?sR(new Gr(t)):oR(new oo(t))}static readAll(t){return t instanceof e?t.isSync()?UA(t):PA(t):uy(t)||ArrayBuffer.isView(t)||hi(t)||fy(t)?UA(t):PA(t)}},rs=class extends Ar{constructor(t){super(t),this._impl=t}readAll(){return[...this]}[Symbol.iterator](){return this._impl[Symbol.iterator]()}[Symbol.asyncIterator](){return xr(this,arguments,function*(){yield Ft(yield*Tl(fi(this[Symbol.iterator]())))})}},yc=class extends Ar{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=fi(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]()}},gc=class extends rs{constructor(t){super(t),this._impl=t}},I0=class extends yc{constructor(t){super(t),this._impl=t}},A0=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=At({type:new ye(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 qt(l)):new qt(l)).memoize()}return a.memoize()}_loadVectors(t,n,r){return new Oh(n,t.nodes,t.buffers,this.dictionaries,this.schema.metadataVersion).visitMany(r)}},Zl=class extends A0{constructor(t,n){super(n),this._reader=uy(t)?new nd(this._handle=t):new Gl(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=zA(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):be}return(t){return!this.closed&&this.autoDestroy&&(this.closed=!0)?this.reset()._reader.return(t):be}next(){if(this.closed)return be;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 mc(this.schema)}):this.return()}_readNextMessageAndValidate(t){return this._reader.readMessage(t)}},Ql=class extends A0{constructor(t,n){super(n),this._reader=new ed(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=zA(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):be})}return(t){return Z(this,void 0,void 0,function*(){return!this.closed&&this.autoDestroy&&(this.closed=!0)?yield this.reset()._reader.return(t):be})}next(){return Z(this,void 0,void 0,function*(){if(this.closed)return be;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 mc(this.schema)}):yield this.return()})}_readNextMessageAndValidate(t){return Z(this,void 0,void 0,function*(){return yield this._reader.readMessage(t)})}},T0=class extends Zl{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 Eh?t:new Eh(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(Ut.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(Ut.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-$_,r=t.readInt32(n),i=t.readAt(n-r,r);return Ho.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}},U_=class extends Ql{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(Ut.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(Ut.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-$_,r=yield t.readInt32(n),i=yield t.readAt(n-r,r);return Ho.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})}},P_=class extends Zl{constructor(t,n){super(t,n)}_loadVectors(t,n,r){return new Qy(n,t.nodes,t.buffers,this.dictionaries,this.schema.metadataVersion).visitMany(r)}};function zA(e,t){return t&&typeof t.autoDestroy=="boolean"?t.autoDestroy:e.autoDestroy}function*UA(e){let t=Ar.from(e);try{if(!t.open({autoDestroy:!1}).closed)do yield t;while(!t.reset().open().closed)}finally{t.cancel()}}function PA(e){return xr(this,arguments,function*(){let n=yield Ft(Ar.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 iR(e){return new rs(new P_(e))}function oR(e){let t=e.peek(Hl+7&-8);return t&&t.byteLength>=4?M0(t)?new gc(new T0(e.read())):new rs(new Zl(e)):new rs(new Zl(function*(){}()))}function sR(e){return Z(this,void 0,void 0,function*(){let t=yield e.peek(Hl+7&-8);return t&&t.byteLength>=4?M0(t)?new gc(new T0(yield e.read())):new yc(new Ql(e)):new yc(new Ql(function(){return xr(this,arguments,function*(){})}()))})}function aR(e){return Z(this,void 0,void 0,function*(){let{size:t}=yield e.stat(),n=new sa(e,t);return t>=$A&&M0(yield n.readAt(0,Hl+7&-8))?new I0(new U_(n)):new yc(new Ql(n))})}var Se=class e extends dt{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 qt)return this.visitMany(t.data),this;let{type:n}=t;if(!X.isDictionary(n)){let{length:r}=t;if(r>2147483647)throw new RangeError("Cannot write arrays larger than 2^31 - 1 in length");if(X.isUnion(n))this.nodes.push(new Hr(r,0));else{let{nullCount:i}=t;X.isNull(n)||Mi.call(this,i<=0?new Uint8Array(0):ic(t.offset,r,t.nullBitmap)),this.nodes.push(new Hr(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 Mi(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 cR(e){var t;let{type:n,length:r,typeIds:i,valueOffsets:o}=e;if(Mi.call(this,i),n.mode===me.Sparse)return z_.call(this,e);if(n.mode===me.Dense){if(e.offset<=0)return Mi.call(this,o),z_.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);Mi.call(this,s),this.visitMany(e.children.map((l,u)=>{let f=n.typeIds[u],h=a[f],d=c[f];return l.slice(h,Math.min(r,d))}))}}return this}function lR(e){let t;return e.nullCount>=e.length?Mi.call(this,new Uint8Array(0)):(t=e.values)instanceof Uint8Array?Mi.call(this,ic(e.offset,e.length,t)):Mi.call(this,oc(e.values))}function is(e){return Mi.call(this,e.values.subarray(0,e.length*e.stride))}function E0(e){let{length:t,values:n,valueOffsets:r}=e,i=Te(r[0]),o=Te(r[t]),s=Math.min(o-i,n.byteLength-i);return Mi.call(this,gy(-i,t+1,r)),Mi.call(this,n.subarray(i,i+s)),this}function q_(e){let{length:t,valueOffsets:n}=e;if(n){let{[0]:r,[t]:i}=n;return Mi.call(this,gy(-r,t+1,n)),this.visit(e.children[0].slice(r,i-r))}return this.visit(e.children[0])}function z_(e){return this.visitMany(e.type.children.map((t,n)=>e.children[n]).filter(Boolean))[0]}Se.prototype.visitBool=lR;Se.prototype.visitInt=is;Se.prototype.visitFloat=is;Se.prototype.visitUtf8=E0;Se.prototype.visitLargeUtf8=E0;Se.prototype.visitBinary=E0;Se.prototype.visitLargeBinary=E0;Se.prototype.visitFixedSizeBinary=is;Se.prototype.visitDate=is;Se.prototype.visitTimestamp=is;Se.prototype.visitTime=is;Se.prototype.visitDecimal=is;Se.prototype.visitList=q_;Se.prototype.visitStruct=z_;Se.prototype.visitUnion=cR;Se.prototype.visitInterval=is;Se.prototype.visitDuration=is;Se.prototype.visitFixedSizeList=q_;Se.prototype.visitMap=q_;var bc=class extends cc{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,jn(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 wr(t)?t.then(n=>this.writeAll(n)):Ur(t)?j_(this,t):V_(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&&e6(t)?this.toDOMStream({type:"bytes"}).pipeTo(t):t&&n6(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||!pc(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 fr&&!(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&&!pc(n,this._schema)){if(this._started&&this._autoDestroy)return this.close();this.reset(this._sink,n)}t instanceof Le?t instanceof mc||this._writeRecordBatch(t):t instanceof fr?this.writeAll(t.batches):hi(t)&&this.writeAll(t)}_writeMessage(t,n=8){let r=n-1,i=pr.encode(t),o=i.byteLength,s=this._writeLegacyIpcFormat?4:8,a=o+s+r&~r,c=a-o-s;return t.headerType===Ut.RecordBatch?this._recordBatchBlocks.push(new Zo(a,t.bodyLength,this._position)):t.headerType===Ut.DictionaryBatch&&this._dictionaryBlocks.push(new Zo(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=wt(t);n&&n.byteLength>0&&(this._sink.write(n),this._position+=n.byteLength)}return this}_writeSchema(t){return this._writeMessage(pr.from(t))}_writeFooter(t){return this._writeLegacyIpcFormat?this._write(Int32Array.of(0)):this._write(Int32Array.of(-1,0))}_writeMagic(){return this._write(Xl)}_writePadding(t){return t>0?this._write(new Uint8Array(t)):this}_writeRecordBatch(t){let{byteLength:n,nodes:r,bufferRegions:i,buffers:o}=Se.assemble(t),s=new _n(t.numRows,r,i),a=pr.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}=Se.assemble(new qt([t])),c=new _n(t.length,o,s),l=new dr(c,n,r),u=pr.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}},rd=class e extends bc{static writeAll(t,n){let r=new e(n);return wr(t)?t.then(i=>r.writeAll(i)):Ur(t)?j_(r,t):V_(r,t)}},id=class e extends bc{static writeAll(t){let n=new e;return wr(t)?t.then(r=>n.writeAll(r)):Ur(t)?j_(n,t):V_(n,t)}constructor(){super(),this._autoDestroy=!0}_writeSchema(t){return this._writeMagic()._writePadding(2)}_writeFooter(t){let n=Ho.encode(new Ho(t,se.V5,this._recordBatchBlocks,this._dictionaryBlocks));return super._writeFooter(t)._write(n)._write(Int32Array.of(n.byteLength))._writeMagic()}};function V_(e,t){let n=t;t instanceof fr&&(n=t.batches,e.reset(void 0,t.schema));for(let r of n)e.write(r);return e.finish()}function j_(e,t){var n,r,i,o,s,a,c;return Z(this,void 0,void 0,function*(){try{for(n=!0,r=fi(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 qA(e,t){if(Ur(e))return fR(e,t);if(hi(e))return uR(e,t);throw new Error("toDOMStream() must be called with an Iterable or AsyncIterable")}function uR(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=wt(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 fR(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=wt(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 YA(e){return new Y_(e)}var Y_=class{constructor(t){this._numChunks=0,this._finished=!1,this._bufferedSize=0;let{["readableStrategy"]:n,["writableStrategy"]:r,["queueingStrategy"]:i="count"}=t,o=JI(t,["readableStrategy","writableStrategy","queueingStrategy"]);this._controller=null,this._builder=uc(o),this._getSize=i!=="bytes"?VA:jA;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"?VA:jA}),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)}},VA=e=>{var t;return(t=e?.length)!==null&&t!==void 0?t:0},jA=e=>{var t;return(t=e?.byteLength)!==null&&t!==void 0?t:0};function D0(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 Ar.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 N0(e,t){let n=new this(e),r=new Gr(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 od(e){let t=Ar.from(e);return wr(t)?t.then(n=>od(n)):t.isAsync()?t.readAll().then(n=>new fr(n)):new fr(t.readAll())}var OR=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},n_),E_),x_),r_),Qw),b_),t_),{compareSchemas:pc,compareFields:xA,compareTypes:wA});xn.toDOMStream=qA;xe.throughDOM=YA;Ar.throughDOM=D0;gc.throughDOM=D0;rs.throughDOM=D0;bc.throughDOM=N0;id.throughDOM=N0;rd.throughDOM=N0;function W_(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:h}=r;if(r=null,c(),typeof l=="string"){let d=JSON.parse(l);d.error?h(d.error):f(d)}else if(u.type==="exec")f();else if(u.type==="arrow")f(od(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 mr=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?`${WA(t)}.`:""}${r}`}else return t?WA(t):"NULL"}};function WA(e){return e.split(".").map(n=>`"${n}"`).join(".")}function GA(e,t){return e instanceof mr&&e.column===t}function Vt(e){return typeof e=="string"?O0(e):e}function xc(e){return typeof e=="string"?XA(e):e}function XA(e){return new mr(e)}function O0(e,t=null){return arguments.length===1&&(t=e,e=null),new mr(e,t)}function os(e){switch(typeof e){case"boolean":return e?"TRUE":"FALSE";case"string":return`'${e.replace("'","''")}'`;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 ss=e=>typeof e?.addEventListener=="function";function B0(e){return e instanceof as}var as=class{constructor(t,n,r){this._expr=Array.isArray(t)?t:[t],this._deps=n||[],this.annotate(r);let i=this._expr.filter(o=>ss(o));i.length>0?(this._params=Array.from(new Set(i)),this._params.forEach(o=>{o.addEventListener("value",()=>BR(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=>ss(t)&&!B0(t)?os(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 BR(e,t){if(t?.size)return Promise.allSettled(Array.from(t,n=>n(e)))}function G_(e,t){let n=[e[0]],r=new Set,i=t.length;for(let o=0,s=0;o<i;){let a=t[o];ss(a)?n[++s]=a:(Array.isArray(a?.columns)&&a.columns.forEach(l=>r.add(l)),n[s]+=typeof a=="string"?a:os(a));let c=e[++o];ss(n[s])?n[++s]=c:n[s]+=c}return{spans:n,cols:Array.from(r)}}function q(e,...t){let{spans:n,cols:r}=G_(e,t);return new as(n,r)}var X_=e=>({value:e,toString:()=>os(e)});function sd(e){e(this.op,this),this.children?.forEach(t=>t.visit(e))}function HA(e,t){let n=t.filter(i=>i!=null).map(Vt),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:sd})}var Zr=(...e)=>HA("AND",e.flat()),ad=(...e)=>HA("OR",e.flat()),LR=e=>t=>q`(${e} ${Vt(t)})`.annotate({op:e,a:t,visit:sd}),FR=LR("NOT"),ZA=e=>t=>q`(${Vt(t)} ${e})`.annotate({op:e,a:t,visit:sd}),cd=ZA("IS NULL"),wc=ZA("IS NOT NULL"),aa=e=>(t,n)=>q`(${Vt(t)} ${e} ${Vt(n)})`.annotate({op:e,a:t,b:n,visit:sd}),CR=aa("="),ld=aa("<>"),_c=aa("<"),H_=aa(">"),vc=aa("<="),RR=aa(">="),kR=aa("IS DISTINCT FROM"),Z_=aa("IS NOT DISTINCT FROM");function $R(e,t,n,r){t=Vt(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:sd,field:t,range:n})}var sn=(e,t,n)=>$R("BETWEEN",e,t,n);function Sc(e,t){return Array.from({length:e},()=>t)}function vn(e,t){return(...n)=>{let r=n.map(Vt),i=t?`::${t}`:"";return(r.length?q([`${e}(`,...Sc(r.length-1,", "),`)${i}`],...r):q`${e}()${i}`).annotate({func:e,args:r})}}var QA=vn("REGEXP_MATCHES"),KA=vn("CONTAINS"),JA=vn("PREFIX"),t4=vn("SUFFIX"),UR=vn("LOWER"),PR=vn("UPPER"),zR=vn("LENGTH"),qR=vn("ISNAN"),VR=vn("ISFINITE"),jR=vn("ISINF");var ud=class e extends as{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 h=o&&s?" ":"",d=(o||s)&&a?" ":"";c=q`${n} OVER (${i?`"${i}" `:""}${o}${h}${s}${d}${a})`}r&&(c=q`(${c})::${r}`);let{_expr:u,_deps:f}=c;super(u,f),this.window=t,this.func=n,this.type=r,this.name=i,this.group=o,this.order=s,this.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(Vt),r=q(["PARTITION BY ",Sc(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(Vt),r=q(["ORDER BY ",Sc(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=e4("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=e4("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 e4(e,t){if(ss(t)){let n=q`${t}`;return n.toString=()=>`${e} ${n4(t.value)}`,n}return`${e} ${n4(t)}`}function n4(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 Ii(e,t){return(...n)=>{let r=vn(e)(...n);return new ud(e,r,t)}}var YR=Ii("ROW_NUMBER","INTEGER"),WR=Ii("RANK","INTEGER"),GR=Ii("DENSE_RANK","INTEGER"),XR=Ii("PERCENT_RANK"),HR=Ii("CUME_DIST"),ZR=Ii("NTILE"),QR=Ii("LAG"),KR=Ii("LEAD"),JR=Ii("FIRST_VALUE"),tk=Ii("LAST_VALUE"),ek=Ii("NTH_VALUE");function jt(e,...t){return q(e,...t).annotate({aggregate:!0})}var Q_=class e extends as{constructor(t,n,r,i,o){n=(n||[]).map(Vt);let{strings:s,exprs:a}=nk(t,n,r,i,o),{spans:c,cols:l}=G_(s,a);super(c,l),this.aggregate=t,this.args=n,this.type=r,this.isDistinct=i,this.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(rk).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 ud(t,o,r)}partitionby(...t){return this.window().partitionby(...t)}orderby(...t){return this.window().orderby(...t)}rows(t){return this.window().rows(t)}range(t){return this.window().range(t)}};function nk(e,t,n,r,i){let o=`)${n?`::${n}`:""}`,s=[`${e}(${r?"DISTINCT ":""}`],a=[];return t.length?(s=s.concat([...Sc(t.length-1,", "),`${o}${i?" FILTER (WHERE ":""}`,...i?[")"]:[]]),a=[...t,...i?[i]:[]]):s[0]+="*"+o,{exprs:a,strings:s}}function rk(e){let t=os(e);return t&&t.startsWith('"')&&t.endsWith('"')?t.slice(1,-1):t}function Gt(e,t){return(...n)=>new Q_(e,n,t)}var Tr=Gt("COUNT","INTEGER"),K_=Gt("AVG"),ik=Gt("AVG"),ok=Gt("MAD"),ca=Gt("MAX"),la=Gt("MIN"),Ai=Gt("SUM","DOUBLE"),sk=Gt("PRODUCT"),ak=Gt("MEDIAN"),ck=Gt("QUANTILE"),lk=Gt("MODE"),uk=Gt("VARIANCE"),J_=Gt("STDDEV"),fk=Gt("SKEWNESS"),hk=Gt("KURTOSIS"),dk=Gt("ENTROPY"),pk=Gt("VAR_POP"),mk=Gt("STDDEV_POP"),yk=Gt("CORR"),gk=Gt("COVAR_SAMP"),bk=Gt("COVAR_POP"),tv=Gt("REGR_INTERCEPT"),ev=Gt("REGR_SLOPE"),nv=Gt("REGR_COUNT"),xk=Gt("REGR_R2"),rv=Gt("REGR_SYY"),iv=Gt("REGR_SXX"),wk=Gt("REGR_SXY"),ov=Gt("REGR_AVGX"),_k=Gt("REGR_AVGY"),vk=Gt("FIRST"),Sk=Gt("LAST"),L0=Gt("ARG_MIN"),F0=Gt("ARG_MAX"),Mk=Gt("STRING_AGG"),Ik=Gt("ARRAY_AGG");function r4(e,t){let n=Vt(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 C0=e=>r4(e,"DOUBLE");var sv=e=>q`epoch_ms(${Vt(e)})`;var av=vn("ST_AsGeoJSON"),Ak=vn("ST_X"),Tk=vn("ST_Y"),Ek=vn("ST_CENTROID");var Ct=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 Mc("UNION",t.flat())}static unionAll(...t){return new Mc("UNION ALL",t.flat())}static intersect(...t){return new Mc("INTERSECT",t.flat())}static except(...t){return new Mc("EXCEPT",t.flat())}static describe(t){let n=t.clone(),{clone:r,toString:i}=n;return Object.assign(n,{describe:!0,clone:()=>e.describe(r.call(n)),toString:()=>`DESCRIBE ${i.call(n)}`})}constructor(){this.query={with:[],select:[],from:[],where:[],groupby:[],having:[],window:[],qualify:[],orderby:[]},this.cteFor=null}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 o of t.flat())if(o!=null)if(typeof o=="string")r.push({as:o,expr:Vt(o)});else if(o instanceof mr)r.push({as:o.column,expr:o});else if(Array.isArray(o))r.push({as:o[0],expr:o[1]});else for(let s in o)r.push({as:R0(s),expr:Vt(o[s])});let i=new Set(r.map(o=>o.as));return n.select=n.select.filter(o=>!i.has(o.as)).concat(r.filter(o=>o.expr)),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:xc(i)});else if(i instanceof mr)r.push({as:i.table,from:i});else if(fd(i)||B0(i))r.push({from:i});else if(Array.isArray(i))r.push({as:R0(i[0]),from:xc(i[1])});else for(let o in i)r.push({as:R0(o),from:xc(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(Vt)),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:R0(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(Vt)),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(fd(s))o.push(s);else if(i[s.table]){let a=i[s.table];o.push(a)}}),o}toString(){let{with:t,select:n,distinct:r,from:i,sample:o,where:s,groupby:a,having:c,window:l,qualify:u,orderby:f,limit:h,offset:d}=this.query,p=[];if(t.length){let y=t.map(({as:g,query:b})=>`"${g}" AS (${b})`);p.push(`WITH ${y.join(", ")}`)}let m=n.map(({as:y,expr:g})=>GA(g,y)&&!g.table?`${g}`:`${g} AS "${y}"`);if(p.push(`SELECT${r?" DISTINCT":""} ${m.join(", ")}`),i.length){let y=i.map(({as:g,from:b})=>{let x=fd(b)?`(${b})`:`${b}`;return!g||g===b.table?x:`${x} AS "${g}"`});p.push(`FROM ${y.join(", ")}`)}if(s.length){let y=s.map(String).filter(g=>g).join(" AND ");y&&p.push(`WHERE ${y}`)}if(o){let{rows:y,perc:g,method:b,seed:x}=o,w=y?`${y} ROWS`:`${g} PERCENT`,v=b?` (${b}${x!=null?`, ${x}`:""})`:"";p.push(`USING SAMPLE ${w}${v}`)}if(a.length&&p.push(`GROUP BY ${a.join(", ")}`),c.length){let y=c.map(String).filter(g=>g).join(" AND ");y&&p.push(`HAVING ${y}`)}if(l.length){let y=l.map(({as:g,expr:b})=>`"${g}" AS (${b})`);p.push(`WINDOW ${y.join(", ")}`)}if(u.length){let y=u.map(String).filter(g=>g).join(" AND ");y&&p.push(`QUALIFY ${y}`)}return f.length&&p.push(`ORDER BY ${f.join(", ")}`),Number.isFinite(h)&&p.push(`LIMIT ${h}`),Number.isFinite(d)&&p.push(`OFFSET ${d}`),p.join(" ")}},Mc=class e{constructor(t,n){this.op=t,this.queries=n.map(r=>r.clone()),this.query={orderby:[]},this.cteFor=null}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(Vt)),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 fd(e){return e instanceof Ct||e instanceof Mc}function cv(e){return fd(e)&&e.describe}function R0(e){return Dk(e)?e.slice(1,-1):e}function Dk(e){return e[0]==='"'&&e[e.length-1]==='"'}var k0=e=>e;function i4(){return{apply:k0,invert:k0,sqlApply:Vt,sqlInvert:k0}}function Nk({base:e=null}={}){if(e==null||e===Math.E)return{apply:Math.log,invert:Math.exp,sqlApply:t=>q`LN(${Vt(t)})`,sqlInvert:t=>q`EXP(${t})`};if(e===10)return{apply:Math.log10,invert:t=>Math.pow(10,t),sqlApply:t=>q`LOG(${Vt(t)})`,sqlInvert:t=>q`POW(10, ${t})`};{let t=+e;return{apply:n=>Math.log(n)/Math.log(t),invert:n=>Math.pow(t,n),sqlApply:n=>q`LN(${Vt(n)}) / LN(${t})`,sqlInvert:n=>q`POW(${t}, ${n})`}}}function Ok({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=Vt(n),q`SIGN(${n}) * LN(${t} + ABS(${n}))`),sqlInvert:n=>q`SIGN(${n}) * (EXP(ABS(${n})) - ${t})`}}function Bk(){return{apply:e=>Math.sign(e)*Math.sqrt(Math.abs(e)),invert:e=>Math.sign(e)*e*e,sqlApply:e=>(e=Vt(e),q`SIGN(${e}) * SQRT(ABS(${e}))`),sqlInvert:e=>q`SIGN(${e}) * (${e}) ** 2`}}function Lk({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=Vt(n),q`SIGN(${n}) * POW(ABS(${n}), ${t})`),sqlInvert:n=>q`SIGN(${n}) * POW(ABS(${n}), 1/${t})`}}function o4(){return{apply:e=>+e,invert:e=>new Date(e),sqlApply:e=>e instanceof Date?+e:sv(Vt(e)),sqlInvert:k0}}var Fk={identity:i4,linear:i4,log:Nk,symlog:Ok,sqrt:Bk,pow:Lk,time:o4,utc:o4};function hd(e){let t=Fk[e.type];return t?{...e,...t(e)}:null}function $0(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 a4(e){let t=2166136261;for(let n=0,r=e.length;n<r;++n){let i=e.charCodeAt(n),o=i&65280;o&&(t=s4(t^o>>8)),t=s4(t^i&255)}return Ck(t)}function s4(e){return e+(e<<1)+(e<<4)+(e<<7)+(e<<8)+(e<<24)}function Ck(e){return e+=e<<13,e^=e>>>7,e+=e<<3,e^=e>>>17,e+=e<<5,e&4294967295}var c4={from:NaN};function hv(e){if(!e.filterIndexable)return c4;let t=e.query(),n=lv(t);if(typeof n!="string"||!t.groupby)return c4;let r=new Set(t.groupby().map(a=>a.column)),i=[],o=[],s={};for(let a of t.select()){let{as:c,expr:{aggregate:l,args:u}}=a,f=l?.toUpperCase?.();switch(f){case"COUNT":case"SUM":i.push({[c]:jt`SUM("${c}")::DOUBLE`});break;case"AVG":i.push({[c]:kk(s,c,u[0])});break;case"ARG_MAX":i.push({[c]:$k(s,c,u)});break;case"ARG_MIN":i.push({[c]:Uk(s,c,u)});break;case"VARIANCE":case"VAR_SAMP":s[c]=null,i.push({[c]:U0(s,u[0],n)});break;case"VAR_POP":s[c]=null,i.push({[c]:U0(s,u[0],n,!1)});break;case"STDDEV":case"STDDEV_SAMP":s[c]=null,i.push({[c]:jt`SQRT(${U0(s,u[0],n)})`});break;case"STDDEV_POP":s[c]=null,i.push({[c]:jt`SQRT(${U0(s,u[0],n,!1)})`});break;case"COVAR_SAMP":s[c]=null,i.push({[c]:P0(s,u,n)});break;case"COVAR_POP":s[c]=null,i.push({[c]:P0(s,u,n,!1)});break;case"CORR":s[c]=null,i.push({[c]:l4(s,u,n)});break;case"REGR_COUNT":s[c]=null,i.push({[c]:jt`${Kl(s,u)}::DOUBLE`});break;case"REGR_AVGX":s[c]=null,i.push({[c]:h4(s,u)});break;case"REGR_AVGY":s[c]=null,i.push({[c]:d4(s,u)});break;case"REGR_SYY":s[c]=null,i.push({[c]:fv(s,0,u,n)});break;case"REGR_SXX":s[c]=null,i.push({[c]:fv(s,1,u,n)});break;case"REGR_SXY":s[c]=null,i.push({[c]:P0(s,u,n,null)});break;case"REGR_SLOPE":s[c]=null,i.push({[c]:p4(s,u,n)});break;case"REGR_INTERCEPT":s[c]=null,i.push({[c]:Pk(s,u,n)});break;case"REGR_R2":s[c]=null,i.push({[c]:jt`(${l4(s,u,n)}) ** 2`});break;case"MAX":case"MIN":case"BIT_AND":case"BIT_OR":case"BIT_XOR":case"BOOL_AND":case"BOOL_OR":case"PRODUCT":i.push({[c]:jt`${f}("${c}")`});break;default:if(r.has(c))o.push(c);else return null}}return{from:n,dims:o,aggr:i,aux:s}}function Ti(e,...t){let n=t.length?"_"+t.map(Rk).join("_"):"";return`__${e}${n}__`}function Rk(e){return`${e}`.replaceAll('"',"").replaceAll(" ","_")}function lv(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=lv(t[0]);for(let r=1;r<t.length;++r){let i=lv(t[r]);if(i!==void 0&&i!==n)return NaN}return n}function u4(e,t){let n=Ti("count",t);return e[n]=jt`COUNT(${t})`,jt`SUM(${n})`.annotate({name:n})}function kk(e,t,n){let r=u4(e,n);return jt`(SUM("${t}" * ${r.name}) / ${r})`}function dd(e,t){return q`(SELECT AVG(${e}) FROM "${t}")`}function $k(e,t,[,n]){let r=Ti("max",n);return e[r]=jt`MAX(${n})`,jt`ARG_MAX("${t}", ${r})`}function Uk(e,t,[,n]){let r=Ti("min",n);return e[r]=jt`MIN(${n})`,jt`ARG_MIN("${t}", ${r})`}function U0(e,t,n,r=!0){let i=u4(e,t),o=Ti("rssq",t),s=Ti("rsum",t),a=q`${t} - ${dd(t,n)}`;return e[o]=jt`SUM((${a}) ** 2)`,e[s]=jt`SUM(${a})`,jt`(SUM(${o}) - (SUM(${s}) ** 2 / ${i})) / (${i}${r?" - 1":""})`}function P0(e,t,n,r=!0){let i=Kl(e,t),o=f4(e,t,n),s=pd(e,1,t,n),a=pd(e,0,t,n),c=r===null?"":r?` / (${i} - 1)`:` / ${i}`;return jt`(${o} - ${s} * ${a} / ${i})${c}`}function l4(e,t,n){let r=Kl(e,t),i=f4(e,t,n),o=uv(e,1,t,n),s=uv(e,0,t,n),a=pd(e,1,t,n),c=pd(e,0,t,n),l=jt`(${o} - (${a} ** 2) / ${r})`,u=jt`(${s} - (${c} ** 2) / ${r})`;return jt`(${i} - ${a} * ${c} / ${r}) / SQRT(${l} * ${u})`}function Kl(e,[t,n]){let r=Ti("count",t,n);return e[r]=jt`REGR_COUNT(${t}, ${n})`,jt`SUM(${r})`.annotate({name:r})}function pd(e,t,n,r){let i=n[t],o=n[1-t],s=Ti("rs",i);return e[s]=jt`SUM(${i} - ${dd(i,r)}) FILTER (${o} IS NOT NULL)`,jt`SUM(${s})`}function uv(e,t,n,r){let i=n[t],o=n[1-t],s=Ti("rss",i);return e[s]=jt`SUM((${i} - ${dd(i,r)}) ** 2) FILTER (${o} IS NOT NULL)`,jt`SUM(${s})`}function f4(e,t,n){let[r,i]=t,o=Ti("sxy",r,i);return e[o]=jt`SUM((${i} - ${dd(i,n)}) * (${r} - ${dd(r,n)}))`,jt`SUM(${o})`}function h4(e,t){let[n,r]=t,i=Kl(e,t),o=Ti("avg",r,n);return e[o]=jt`REGR_AVGX(${n}, ${r})`,jt`(SUM(${o} * ${i.name}) / ${i})`}function d4(e,t){let[n,r]=t,i=Kl(e,t),o=Ti("avg",n,r);return e[o]=jt`REGR_AVGY(${n}, ${r})`,jt`(SUM(${o} * ${i.name}) / ${i})`}function fv(e,t,n,r){let i=Kl(e,n),o=pd(e,t,n,r),s=uv(e,t,n,r);return jt`(${s} - (${o} ** 2 / ${i}))`}function p4(e,t,n){let r=P0(e,t,n,null),i=fv(e,1,t,n);return jt`(${r}) / ${i}`}function Pk(e,t,n){let r=h4(e,t),i=d4(e,t),o=p4(e,t,n);return jt`${i} - (${o}) * ${r}`}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.active=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 u=Array.from(t,hv).filter(h=>h),f=u[0]?.from;this.enabled=u.length&&u.every(h=>h.from===f),this.clients=t,this.active=null,this.clear()}if(!this.enabled)return!1;n=n||this.selection.active;let{source:r}=n;if(r&&r===this.active?.source)return!0;if(this.clear(),!r)return!1;let i=this.active=zk(n);if(!i)return!1;let o=this.mc.logger();o.warn("DATA CUBE INDEX CONSTRUCTION");let s=this.selection.remove(r),a=this.indices=new Map,{mc:c,temp:l}=this;for(let u of t){if(s.skip(u,n)){a.set(u,null);continue}let f=hv(u);if(!f)continue;let h=u.query(s.predicate(u)).select({...i.columns,...f.aux}).groupby(Object.keys(i.columns)),[d]=h.subqueries;if(d){let x=Object.values(i.columns).flatMap(w=>w.columns);jk(d,x)}let p=h.orderby();h.query.orderby=[];let m=h.toString(),g=`cube_index_${(a4(m)>>>0).toString(16)}`,b=c.exec($0(g,m,{temp:l}));b.catch(x=>o.error(x)),a.set(u,{table:g,result:b,order:p,...f})}return!0}async update(){let{clients:t,selection:n,active: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{mc:r,indices:i,selection:o}=this;if(!i.has(t))return n=o.predicate(t),r.updateClient(t,t.query(n));let s=this.indices.get(t);if(!s)return;let{table:a,dims:c,aggr:l,order:u=[]}=s,f=Ct.select(c,l).from(a).groupby(c).where(n).orderby(u);return r.updateClient(t,f)}};function zk(e){let{source:t,meta:n}=e,r=e.predicate?.columns;if(!n||!r)return null;let{type:i,scales:o,bin:s,pixelSize:a=1}=n,c;if(i==="interval"&&o){let l=o.map(u=>Vk(u,a,s));if(l.some(u=>u==null))return null;l.length===1?(c=u=>u?sn("active0",u.range.map(l[0])):[],r={active0:l[0](e.predicate.field)}):(c=u=>u?Zr(u.children.map(({range:f},h)=>sn(`active${h}`,f.map(l[h])))):[],r=Object.fromEntries(e.predicate.children.map((u,f)=>[`active${f}`,l[f](u.field)])))}else if(i==="point")c=l=>l,r=Object.fromEntries(r.map(l=>[`${l}`,Vt(l)]));else return null;return{source:t,columns:r,predicate:c}}var qk={ceil:"CEIL",round:"ROUND"};function Vk(e,t,n){let{type:r,domain:i,range:o,apply:s,sqlApply:a}=hd(e);if(!s)return;let c=qk[`${n}`.toLowerCase()]||"FLOOR",l=s(Math.min(...i)),u=s(Math.max(...i)),f=r==="identity"?1:Math.abs(o[1]-o[0])/(u-l),h=f/t===1?"":`${f/t}::DOUBLE * `,d=l===0?"":` - ${l}::DOUBLE`;return p=>q`${c}(${h}(${a(p)}${d}))::INTEGER`}function jk(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(){this._callbacks=new Map}addEventListener(t,n){this._callbacks.has(t)||this._callbacks.set(t,{callbacks:new Set,pending:null,queue:new dv}),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(t,n){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=Array.from(o,c=>c(i));r.pending=Promise.allSettled(a).then(()=>{r.pending=null,s.isEmpty()||this.emit(t,s.dequeue())})}}}},dv=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 md(e,t){return e===t?!1:e instanceof Date&&t instanceof Date?+e!=+t:Array.isArray(e)&&Array.isArray(t)?Yk(e,t):!0}function Yk(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 Jl(e){return e instanceof tu}var tu=class e extends q0{constructor(t){super(),this._value=t}static value(t){return new e(t)}static array(t){if(t.some(n=>Jl(n))){let n=new e,r=()=>{n.update(t.map(i=>Jl(i)?i.value:i))};return r(),t.forEach(i=>Jl(i)?i.addEventListener("value",r):0),n}return new e(t)}get value(){return this._value}update(t,{force:n}={}){return md(this._value,t)||n?this.emit("value",t):this.cancel("value"),this}willEmit(t,n){return t==="value"&&(this._value=n),n}};function pv(e){return e instanceof Ac}var Ac=class e extends tu{static intersect({cross:t=!1}={}){return new e(new Ic({cross:t}))}static union({cross:t=!1}={}){return new e(new Ic({cross:t,union:!0}))}static single({cross:t=!1}={}){return new e(new Ic({cross:t,single:!0}))}static crossfilter(){return new e(new Ic({cross:!0}))}constructor(t=new Ic){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 resolver(){return this._resolver}get single(){return this._resolver.single}get clauses(){return super.value}get active(){return this.clauses.active}get value(){return this.active?.value}valueFor(t){return this.clauses.find(n=>n.source===t)?.value}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)}},Ic=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?ad(o):o}queueFilter(t){if(this.cross){let n=t.active?.source;return r=>r.active?.source!==n}return null}};var V0=class{constructor(t,n,r=!0){this.mc=t,this.selection=n,this.clients=new Set,this.indexer=null,this.index(r);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)}index(t){let{selection:n}=this,{resolver:r}=n;this.indexer=t&&(r.single||!r.union)?new z0(this.mc,{...t,selection:n}):null}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():Wk(t,r,i)}};function Wk(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 Object.assign(n,{fulfill:r=>(e(r),n),reject:r=>(t(r),n)})}function Gk(e){return(typeof requestAnimationFrame<"u"?requestAnimationFrame:typeof setImmediate<"u"?setImmediate:setTimeout)(e)}function m4(e,t,n){let r=[],i=0;function o(){let s=Xk(r,t);r=[],i=0;for(let a of s)Zk(a,e,n),Jk(a,t)}return{add(s,a){s.request.type==="arrow"?(i=i||Gk(()=>o()),r.push({entry:s,priority:a,index:r.length})):e(s,a)}}}function Xk(e,t){let n=[],r=new Map;for(let i of e){let{entry:{request:o}}=i,s=Hk(o.query,t);if(!r.has(s)){let a=[];n.push(a),r.set(s,a)}r.get(s).push(i)}return n}function Hk(e,t){let n=`${e}`;if(e instanceof Ct&&!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 mr&&o[s.column]||s))}return`${r}`}else return n}function Zk(e,t,n){if(Qk(e))t({request:{type:"arrow",cache:!1,record:!1,query:e.query=Kk(e,n)},result:e.result=j0()});else for(let{entry:r,priority:i}of e)t(r,i)}function Qk(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 Kk(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[h]=r.get(f);c.push([h,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 mr&&s[a.column]||a))}return i.$select(Array.from(r.values()))}async function Jk(e,t){let{maps:n,query:r,result:i}=e;if(!n)return;let o;try{o=await i}catch(a){for(let{entry:c}of e)c.result.reject(a);return}let s=cv(r);e.forEach(({entry:a},c)=>{let{request:l,result:u}=a,f=n[c],h=s&&f?e9(o,f):f?t9(o,f):o;l.cache&&t.set(String(l.query),h),u.fulfill(h)})}function t9(e,t){let n={};for(let[r,i]of t)n[i]=e.getChild(r);return new e.constructor(n)}function e9(e,t){let n=new Map(t),r=[];for(let i of e)n.has(i.column_name)&&r.push({...i,column_name:n.get(i.column_name)});return r}var n9=typeof requestIdleCallback<"u"?requestIdleCallback:setTimeout,y4=()=>({get:()=>{},set:(e,t)=>t,clear:()=>{}});function g4({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&&n9(r),o},clear(){n=new Map}}}function b4(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 ao={High:0,Normal:1,Low:2},Y0=class{constructor(){this.queue=b4(3),this.db=null,this.clientCache=null,this._logger=null,this._logQueries=!1,this.recorders=[],this.pending=null,this._consolidate=null}next(){if(this.pending||this.queue.isEmpty())return;let{request:t,result:n}=this.queue.next();this.pending=this.submit(t,n),this.pending.finally(()=>{this.pending=null,this.next()})}enqueue(t,n=ao.Normal){this.queue.insert(t,n),this.next()}recordQuery(t){this.recorders.length&&t&&this.recorders.forEach(n=>n.add(t))}async submit(t,n){try{let{query:r,type:i,cache:o=!1,record:s=!0,options:a}=t,c=r?`${r}`:null;if(s&&this.recordQuery(c),o){let f=this.clientCache.get(c);if(f){this._logger.debug("Cache"),n.fulfill(f);return}}let l=performance.now();this._logQueries&&this._logger.debug("Query",{type:i,sql:c,...a});let u=await this.db.query({type:i,sql:c,...a});o&&this.clientCache.set(c,u),this._logger.debug(`Request: ${(performance.now()-l).toFixed(1)}`),n.fulfill(u)}catch(r){n.reject(r)}}cache(t){return t!==void 0?this.clientCache=t===!0?g4():t||y4():this.clientCache}logger(t){return t?this._logger=t:this._logger}logQueries(t){return t!==void 0?this._logQueries=!!t:this._logQueries}connector(t){return t?this.db=t:this.db}consolidate(t){t&&!this._consolidate?this._consolidate=m4(this.enqueue.bind(this),this.clientCache,this.recordQuery.bind(this)):!t&&this._consolidate&&(this._consolidate=null)}request(t,n=ao.Normal){let r=j0(),i={request:t,result:r};return this._consolidate?this._consolidate.add(i,n):this.enqueue(i,n),r}cancel(t){let n=new Set(t);this.queue.remove(({result:r})=>n.has(r))}clear(){this.queue.remove(({result:t})=>(t.reject("Cleared"),!0))}record(){let t=[],n={add(r){t.push(r)},reset(){t=[]},snapshot(){return t.slice()},stop(){return this.recorders=this.recorders.filter(r=>r!==n),t}};return this.recorders.push(n),n}};function mv(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":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":case"JSON":return"string";case"ARRAY":case"LIST":return"array";case"BLOB":case"STRUCT":case"MAP":case"GEOMETRY":return"object";default:if(e.startsWith("DECIMAL"))return"number";if(e.startsWith("STRUCT")||e.startsWith("MAP"))return"object";if(e.endsWith("]"))return"array";throw new Error(`Unsupported type: ${e}`)}}function yv(e){return typeof e?.getChild=="function"}function gv(e){if(X.isTimestamp(e))return t=>t==null?t:new Date(t);if(X.isInt(e)&&e.bitWidth>=64)return t=>t==null?t:Number(t);if(X.isDecimal(e)){let t=1/Math.pow(10,e.scale);return n=>n==null?n:w4(n,t)}return t=>t}function bv(e){let{type:t}=e;if(X.isTimestamp(t)){let n=e.length,r=new Array(n);for(let i=0;i<n;++i){let o=e.get(i);r[i]=o==null?null:new Date(o)}return r}if(X.isInt(t)&&t.bitWidth>=64){let n=e.length,r=e.nullCount?new Array(n):new Float64Array(n);for(let i=0;i<n;++i){let o=e.get(i);r[i]=o==null?null:Number(o)}return r}if(X.isDecimal(t)){let n=1/Math.pow(10,t.scale),r=e.length,i=e.nullCount?new Array(r):new Float64Array(r);for(let o=0;o<r;++o){let s=e.get(o);i[o]=s==null?null:w4(s,n)}return i}return e.nullCount?Array.from(e):e.toArray()}var x4=Array.from({length:8},(e,t)=>Math.pow(2,t*32));function w4(e,t){let n=e.length,r=0;if(e.signed&&(e[n-1]|0)<0){for(let i=0;i<n;++i)r+=~e[i]*x4[i];r=-(r+1)}else for(let i=0;i<n;++i)r+=e[i]*x4[i];return r*t}var r9="count",i9="nulls",o9="max",s9="min",a9="distinct";var c9={[r9]:Tr,[a9]:e=>Tr(e).distinct(),[o9]:ca,[s9]:la,[i9]:e=>Tr().where(cd(e))};function l9(e,t,n){return Ct.from(e).select(Array.from(n,r=>[r,c9[r](t)]))}async function _4(e,t){return t.length===1&&`${t[0].column}`=="*"?f9(e,t[0].table):(await Promise.all(t.map(n=>u9(e,n)))).filter(n=>n)}async function u9(e,{table:t,column:n,stats:r}){let i=Ct.from({source:t}).select({column:n}).groupby(n.aggregate?q`ALL`:[]),[o]=Array.from(await e.query(Ct.describe(i))),s={table:t,column:`${n}`,sqlType:o.column_type,type:mv(o.column_type),nullable:o.null==="YES"};if(!(r?.length||r?.size))return s;let a=await e.query(l9(t,n,r),{persist:!0});for(let c=0;c<a.numCols;++c){let{name:l}=a.schema.fields[c],u=a.getChildAt(c),f=gv(u.type);s[l]=f(u.get(0))}return s}async function f9(e,t){let n=await e.query(`DESCRIBE ${xc(t)}`);return Array.from(n).map(r=>({table:t,column:r.column_name,sqlType:r.column_type,type:mv(r.column_type),nullable:r.null==="YES"}))}function v4(){return{debug(){},info(){},log(){},warn(){},error(){}}}var W0;function xv(e){return e?W0=e:W0==null&&(W0=new G0),W0}var G0=class{constructor(t=W_(),n={}){let{logger:r=console,manager:i=new Y0}=n;this.manager=i,this.logger(r),this.configure(n),this.databaseConnector(t),this.clear()}logger(t){return arguments.length&&(this._logger=t||v4(),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}={}){this.manager.clear(),t&&(this.clients?.forEach(r=>this.disconnect(r)),this.filterGroups?.forEach(r=>r.finalize()),this.clients=new Set,this.filterGroups=new Map),n&&this.manager.cache().clear()}databaseConnector(t){return this.manager.connector(t)}cancel(t){this.manager.cancel(t)}exec(t,{priority:n=ao.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=ao.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:ao.Low})}createBundle(t,n,r=ao.Low){let i={name:t,queries:n};return this.manager.request({type:"create-bundle",options:i},r)}loadBundle(t,n=ao.High){let r={name:t};return this.manager.request({type:"load-bundle",options:r},n)}updateClient(t,n,r=ao.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{clients:n,filterGroups:r,indexes:i}=this;if(n.has(t))throw new Error("Client already connected.");n.add(t),t.coordinator=this;let o=t.fields();o?.length&&t.fieldInfo(await _4(this,o));let s=t.filterBy;if(s)if(r.has(s))r.get(s).add(t);else{let a=new V0(this,s,i);r.set(s,a.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)}};function yd(e,t,{source:n,clients:r=void 0}){let i=null;if(t){let o=t.map(s=>{let a=s.map((c,l)=>Z_(e[l],X_(c)));return a.length>1?Zr(a):a[0]});i=o.length>1?ad(o):o[0]}return{meta:{type:"point"},source:n,clients:r,value:t,predicate:i}}function gd(e,t,{source:n,clients:r,bin:i,scale:o,pixelSize:s=1}){let a=t!=null?sn(e,t):null;return{meta:{type:"interval",scales:[o],bin:i,pixelSize:s},source:n,clients:r,value:t,predicate:a}}function wv(e,t,{source:n,clients:r,bin:i,scales:o=[],pixelSize:s=1}){let a=t!=null?Zr(e.map((l,u)=>sn(l,t[u]))):null;return{meta:{type:"interval",scales:o,bin:i,pixelSize:s},source:n,clients:r,value:t,predicate:a}}function _v(){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 gI={};Gs(gI,{Area:()=>gl,Arrow:()=>Dm,BarX:()=>Nm,BarY:()=>Om,Cell:()=>bl,Contour:()=>Vm,Density:()=>Wm,Dot:()=>xl,Frame:()=>_m,Geo:()=>Gm,Hexgrid:()=>Xm,Image:()=>Hm,Line:()=>wl,Link:()=>Tm,Mark:()=>_t,Raster:()=>Um,Rect:()=>vl,RuleX:()=>ym,RuleY:()=>gm,Text:()=>pl,TickX:()=>Cm,TickY:()=>Rm,Tip:()=>vm,Vector:()=>yl,area:()=>Am,areaX:()=>Ga,areaY:()=>js,arrow:()=>gB,auto:()=>EB,autoSpec:()=>VM,axisFx:()=>Q1,axisFy:()=>Z1,axisX:()=>xm,axisY:()=>bm,barX:()=>$o,barY:()=>Uo,bin:()=>Vs,binX:()=>Ro,binY:()=>ko,bollinger:()=>Qa,bollingerX:()=>FB,bollingerY:()=>CB,boxX:()=>RB,boxY:()=>kB,cell:()=>Xa,cellX:()=>xB,cellY:()=>wB,centroid:()=>L7,circle:()=>SB,cluster:()=>B7,column:()=>pn,contour:()=>WB,crosshair:()=>HB,crosshairX:()=>ZB,crosshairY:()=>QB,delaunayLink:()=>t7,delaunayMesh:()=>e7,density:()=>s7,differenceY:()=>l7,dodgeX:()=>G7,dodgeY:()=>X7,dot:()=>ui,dotX:()=>_B,dotY:()=>vB,filter:()=>ND,find:()=>UD,formatIsoDate:()=>fM,formatMonth:()=>PN,formatWeekday:()=>zN,frame:()=>xf,geo:()=>_w,geoCentroid:()=>F7,graticule:()=>f7,gridFx:()=>ew,gridFy:()=>J1,gridX:()=>tw,gridY:()=>K1,group:()=>cm,groupX:()=>Ra,groupY:()=>ka,groupZ:()=>am,hexagon:()=>MB,hexbin:()=>h7,hexgrid:()=>d7,hull:()=>n7,identity:()=>W,image:()=>m7,indexOf:()=>Ie,initializer:()=>ve,interpolateNearest:()=>zm,interpolateNone:()=>ww,interpolatorBarycentric:()=>Pm,interpolatorRandomWalk:()=>qm,legend:()=>UO,line:()=>_l,lineX:()=>Ha,lineY:()=>Za,linearRegressionX:()=>b7,linearRegressionY:()=>x7,link:()=>fw,map:()=>gr,mapX:()=>Bf,mapY:()=>Lf,marks:()=>Ke,normalize:()=>Nw,normalizeX:()=>K7,normalizeY:()=>J7,plot:()=>Mm,pointer:()=>qa,pointerX:()=>Va,pointerY:()=>zs,raster:()=>qB,rect:()=>Lm,rectX:()=>Df,rectY:()=>Nf,reverse:()=>OD,ruleX:()=>Rr,ruleY:()=>kr,scale:()=>Pa,select:()=>eL,selectFirst:()=>Jm,selectLast:()=>ty,selectMaxX:()=>Fw,selectMaxY:()=>Cw,selectMinX:()=>Bw,selectMinY:()=>Lw,shiftX:()=>tL,shuffle:()=>BD,sort:()=>m1,sphere:()=>u7,spike:()=>xO,stackX:()=>PM,stackX1:()=>cB,stackX2:()=>lB,stackY:()=>zM,stackY1:()=>uB,stackY2:()=>fB,text:()=>Co,textX:()=>V1,textY:()=>j1,tickX:()=>gw,tickY:()=>bw,tip:()=>iw,transform:()=>mn,tree:()=>lI,treeLink:()=>Aw,treeNode:()=>Zm,valueof:()=>bt,vector:()=>DM,vectorX:()=>G1,vectorY:()=>X1,voronoi:()=>r7,voronoiMesh:()=>i7,window:()=>Ff,windowX:()=>DB,windowY:()=>NB});function Et(e,t){return e==null||t==null?NaN:e<t?-1:e>t?1:e>=t?0:NaN}function Gn(e,t){return e==null||t==null?NaN:t<e?-1:t>e?1:t>=e?0:NaN}function cs(e){let t,n,r;e.length!==2?(t=Et,n=(a,c)=>Et(e(a),c),r=(a,c)=>e(a)-c):(t=e===Et||e===Gn?e:h9,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 h9(){return 0}function bd(e){return e===null?NaN:+e}function*S4(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 M4=cs(Et),I4=M4.right,d9=M4.left,p9=cs(bd).center,ls=I4;var xd=A4(T4),vv=A4(m9);function A4(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?(eu(a,l,i,o,s),eu(a,i,l,o,s),eu(a,l,i,o,s),nu(c,i,l,o,s),nu(c,l,i,o,s),nu(c,i,l,o,s)):a?(eu(a,i,l,o,s),eu(a,l,i,o,s),eu(a,i,l,o,s)):c&&(nu(c,i,l,o,s),nu(c,l,i,o,s),nu(c,i,l,o,s)),t}}function eu(e,t,n,r,i){for(let o=0,s=r*i;o<s;)e(t,n,o,o+=r,1)}function nu(e,t,n,r,i){for(let o=0,s=r*i;o<r;++o)e(t,n,o,o+s,r)}function m9(e){let t=T4(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 T4(e){let t=Math.floor(e);if(t===e)return y9(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 h=s,d=s+u;h<d;h+=c)l+=o[Math.min(a,h)];for(let h=s,d=a;h<=d;h+=c)l+=o[Math.min(a,h+u)],i[h]=(l+n*(o[Math.max(s,h-f)]+o[Math.min(a,h+f)]))/r,l-=o[Math.max(s,h-u)]}}function y9(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 co(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 g9(e){return e.length|0}function b9(e){return!(e>0)}function x9(e){return typeof e!="object"||"length"in e?e:Array.from(e)}function w9(e){return t=>e(...t)}function X0(...e){let t=typeof e[e.length-1]=="function"&&w9(e.pop());e=e.map(x9);let n=e.map(g9),r=e.length-1,i=new Array(r+1).fill(0),o=[];if(r<0||n.some(b9))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 H0(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 ua(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 Qr(e,t){let n=ua(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 Sn=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=N4){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(Sv(this,t))}has(t){return super.has(Sv(this,t))}set(t,n){return super.set(E4(this,t),n)}delete(t){return super.delete(D4(this,t))}},Hn=class extends Set{constructor(t,n=N4){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(Sv(this,t))}add(t){return super.add(E4(this,t))}delete(t){return super.delete(D4(this,t))}};function Sv({_intern:e,_key:t},n){let r=t(n);return e.has(r)?e.get(r):n}function E4({_intern:e,_key:t},n){let r=t(n);return e.has(r)?e.get(r):(e.set(r,n),n)}function D4({_intern:e,_key:t},n){let r=t(n);return e.has(r)&&(n=e.get(r),e.delete(r)),n}function N4(e){return e!==null&&typeof e=="object"?e.valueOf():e}function wd(e){return e}function an(e,...t){return Iv(e,wd,wd,t)}function Ei(e,t,...n){return Iv(e,wd,t,n)}function Mv(e,t,...n){return Iv(e,Array.from,t,n)}function Iv(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),h=a.get(f);h?h.push(u):a.set(f,[u])}for(let[u,f]of a)a.set(u,i(f,s));return t(a)}(e,0)}function Av(e,t){return Array.from(t,n=>e[n])}function us(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=Tc(s[i],s[o]);if(a)return a}})):(n=e.map(n),r.sort((i,o)=>Tc(n[i],n[o]))),Av(e,r)}return e.sort(_d(n))}function _d(e=Et){if(e===Et)return Tc;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 Tc(e,t){return(e==null||!(e>=e))-(t==null||!(t>=t))||(e<t?-1:e>t?1:0)}function ru(e,t,n){return(t.length!==2?us(Ei(e,t,n),([r,i],[o,s])=>Et(i,s)||Et(r,o)):us(an(e,n),([r,i],[o,s])=>t(i,s)||Et(r,o))).map(([r])=>r)}var _9=Math.sqrt(50),v9=Math.sqrt(10),S9=Math.sqrt(2);function Z0(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>=_9?10:o>=v9?5:o>=S9?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?Z0(e,t,n*2):[a,c,l]}function Mn(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?Z0(t,e,n):Z0(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 fs(e,t,n){return t=+t,e=+e,n=+n,Z0(e,t,n)[2]}function iu(e,t,n){t=+t,e=+e,n=+n;let r=t<e,i=r?fs(t,e,n):fs(e,t,n);return(r?-1:1)*(i<0?1/-i:i)}function ou(e,t,n){let r;for(;;){let i=fs(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 fa(e){return Math.max(1,Math.ceil(Math.log(co(e))/Math.LN2)+1)}function Xt(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 Q0(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 K0(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?Tc:_d(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),h=.5*Math.sqrt(u*f*(c-f)/c)*(l-c/2<0?-1:1),d=Math.max(n,Math.floor(t-l*f/c+h)),p=Math.min(r,Math.floor(t+(c-l)*f/c+h));J0(e,t,d,p,i)}let o=e[t],s=n,a=r;for(vd(e,n,t),i(e[r],o)>0&&vd(e,n,r);s<a;){for(vd(e,s,a),++s,--a;i(e[s],o)<0;)++s;for(;i(e[a],o)>0;)--a}i(e[n],o)===0?vd(e,n,a):(++a,vd(e,a,r)),a<=t&&(n=a+1),t<=a&&(r=a-1)}return e}function vd(e,t,n){let r=e[t];e[t]=e[n],e[n]=r}function Ec(e,t=Et){let n,r=!1;if(t.length===1){let i;for(let o of e){let s=t(o);(r?Et(s,i)>0:Et(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 Zn(e,t,n){if(e=Float64Array.from(S4(e,n)),!(!(r=e.length)||isNaN(t=+t))){if(t<=0||r<2)return ce(e);if(t>=1)return Xt(e);var r,i=(r-1)*t,o=Math.floor(i),s=Xt(J0(e,o).subarray(0,o+1)),a=ce(e.subarray(o+1));return s+(a-s)*(i-o)}}function Tv(e,t,n=bd){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 tg(e,t,n){let r=co(e),i=Zn(e,.75)-Zn(e,.25);return r&&i?Math.ceil((n-t)/(2*i*Math.pow(r,-1/3))):1}function Sd(e,t,n){let r=co(e),i=Qr(e);return r&&i?Math.ceil((n-t)*Math.cbrt(r)/(3.49*i)):1}function hs(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 Di(e,t){return Zn(e,.5,t)}function*I9(e){for(let t of e)yield*t}function su(e){return Array.from(I9(e))}function au(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 eg(e,t=A9){let n=[],r,i=!1;for(let o of e)i&&n.push(t(r,o)),r=o,i=!0;return n}function A9(e,t){return[e,t]}function ke(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 Md(e,t=Et){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=Et);let i=(a,c)=>t(n[a],n[c]),o,s;return e=Uint32Array.from(n,(a,c)=>c),e.sort(t===Et?(a,c)=>Tc(n[a],n[c]):_d(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 ng(e,t=Et){let n,r=!1;if(t.length===1){let i;for(let o of e){let s=t(o);(r?Et(s,i)<0:Et(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 In(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 ha(e){if(typeof e[Symbol.iterator]!="function")throw new TypeError("values is not iterable");return Array.from(e).reverse()}function O4(e){return e}var Ev=1,Dv=2,Nv=3,rg=4,B4=1e-6;function T9(e){return"translate("+e+",0)"}function E9(e){return"translate(0,"+e+")"}function D9(e){return t=>+e(t)}function N9(e,t){return t=Math.max(0,e.bandwidth()-t*2)/2,e.round()&&(t=Math.round(t)),n=>+e(n)+t}function O9(){return!this.__axis}function B9(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===Ev||e===rg?-1:1,u=e===rg||e===Dv?"x":"y",f=e===Ev||e===Nv?T9:E9;function h(d){var p=r??(t.ticks?t.ticks.apply(t,n):t.domain()),m=i??(t.tickFormat?t.tickFormat.apply(t,n):O4),y=Math.max(o,0)+a,g=t.range(),b=+g[0]+c,x=+g[g.length-1]+c,w=(t.bandwidth?N9:D9)(t.copy(),c),v=d.selection?d.selection():d,_=v.selectAll(".domain").data([null]),M=v.selectAll(".tick").data(p,t).order(),E=M.exit(),I=M.enter().append("g").attr("class","tick"),N=M.select("line"),A=M.select("text");_=_.merge(_.enter().insert("path",".tick").attr("class","domain").attr("stroke","currentColor")),M=M.merge(I),N=N.merge(I.append("line").attr("stroke","currentColor").attr(u+"2",l*o)),A=A.merge(I.append("text").attr("fill","currentColor").attr(u,l*y).attr("dy",e===Ev?"0em":e===Nv?"0.71em":"0.32em")),d!==v&&(_=_.transition(d),M=M.transition(d),N=N.transition(d),A=A.transition(d),E=E.transition(d).attr("opacity",B4).attr("transform",function(O){return isFinite(O=w(O))?f(O+c):this.getAttribute("transform")}),I.attr("opacity",B4).attr("transform",function(O){var L=this.parentNode.__axis;return f((L&&isFinite(L=L(O))?L:w(O))+c)})),E.remove(),_.attr("d",e===rg||e===Dv?s?"M"+l*s+","+b+"H"+c+"V"+x+"H"+l*s:"M"+c+","+b+"V"+x:s?"M"+b+","+l*s+"V"+c+"H"+x+"V"+l*s:"M"+b+","+c+"H"+x),M.attr("opacity",1).attr("transform",function(O){return f(w(O)+c)}),N.attr(u+"2",l*o),A.attr(u,l*y).text(m),v.filter(O9).attr("fill","none").attr("font-size",10).attr("font-family","sans-serif").attr("text-anchor",e===Dv?"start":e===rg?"end":"middle"),v.each(function(){this.__axis=w})}return h.scale=function(d){return arguments.length?(t=d,h):t},h.ticks=function(){return n=Array.from(arguments),h},h.tickArguments=function(d){return arguments.length?(n=d==null?[]:Array.from(d),h):n.slice()},h.tickValues=function(d){return arguments.length?(r=d==null?null:Array.from(d),h):r&&r.slice()},h.tickFormat=function(d){return arguments.length?(i=d,h):i},h.tickSize=function(d){return arguments.length?(o=s=+d,h):o},h.tickSizeInner=function(d){return arguments.length?(o=+d,h):o},h.tickSizeOuter=function(d){return arguments.length?(s=+d,h):s},h.tickPadding=function(d){return arguments.length?(a=+d,h):a},h.offset=function(d){return arguments.length?(c=+d,h):c},h}function Ov(e){return B9(Nv,e)}var L9={value:()=>{}};function F4(){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 ig(n)}function ig(e){this._=e}function F9(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}})}ig.prototype=F4.prototype={constructor:ig,on:function(e,t){var n=this._,r=F9(e+"",n),i,o=-1,s=r.length;if(arguments.length<2){for(;++o<s;)if((i=(e=r[o]).type)&&(i=C9(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]=L4(n[i],e.name,t);else if(t==null)for(i in n)n[i]=L4(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 ig(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 C9(e,t){for(var n=0,r=e.length,i;n<r;++n)if((i=e[n]).name===t)return i.value}function L4(e,t,n){for(var r=0,i=e.length;r<i;++r)if(e[r].name===t){e[r]=L9,e=e.slice(0,r).concat(e.slice(r+1));break}return n!=null&&e.push({name:t,value:n}),e}var Dc=F4;var og="http://www.w3.org/1999/xhtml",Kr={svg:"http://www.w3.org/2000/svg",xhtml:og,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};function ds(e){var t=e+="",n=t.indexOf(":");return n>=0&&(t=e.slice(0,n))!=="xmlns"&&(e=e.slice(n+1)),Kr.hasOwnProperty(t)?{space:Kr[t],local:e}:e}function R9(e){return function(){var t=this.ownerDocument,n=this.namespaceURI;return n===og&&t.documentElement.namespaceURI===og?t.createElement(e):t.createElementNS(n,e)}}function k9(e){return function(){return this.ownerDocument.createElementNS(e.space,e.local)}}function ps(e){var t=ds(e);return(t.local?k9:R9)(t)}function $9(){}function Nc(e){return e==null?$9:function(){return this.querySelector(e)}}function C4(e){typeof e!="function"&&(e=Nc(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 Fe(r,this._parents)}function Bv(e){return e==null?[]:Array.isArray(e)?e:Array.from(e)}function U9(){return[]}function Id(e){return e==null?U9:function(){return this.querySelectorAll(e)}}function P9(e){return function(){return Bv(e.apply(this,arguments))}}function R4(e){typeof e=="function"?e=P9(e):e=Id(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 Fe(r,i)}function Ad(e){return function(){return this.matches(e)}}function sg(e){return function(t){return t.matches(e)}}var z9=Array.prototype.find;function q9(e){return function(){return z9.call(this.children,e)}}function V9(){return this.firstElementChild}function k4(e){return this.select(e==null?V9:q9(typeof e=="function"?e:sg(e)))}var j9=Array.prototype.filter;function Y9(){return Array.from(this.children)}function W9(e){return function(){return j9.call(this.children,e)}}function $4(e){return this.selectAll(e==null?Y9:W9(typeof e=="function"?e:sg(e)))}function U4(e){typeof e!="function"&&(e=Ad(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 Fe(r,this._parents)}function ag(e){return new Array(e.length)}function P4(){return new Fe(this._enter||this._groups.map(ag),this._parents)}function Td(e,t){this.ownerDocument=e.ownerDocument,this.namespaceURI=e.namespaceURI,this._next=null,this._parent=e,this.__data__=t}Td.prototype={constructor:Td,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 z4(e){return function(){return e}}function G9(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 Td(e,o[s]);for(;s<c;++s)(a=t[s])&&(i[s]=a)}function X9(e,t,n,r,i,o,s){var a,c,l=new Map,u=t.length,f=o.length,h=new Array(u),d;for(a=0;a<u;++a)(c=t[a])&&(h[a]=d=s.call(c,c.__data__,a,t)+"",l.has(d)?i[a]=c:l.set(d,c));for(a=0;a<f;++a)d=s.call(e,o[a],a,o)+"",(c=l.get(d))?(r[a]=c,c.__data__=o[a],l.delete(d)):n[a]=new Td(e,o[a]);for(a=0;a<u;++a)(c=t[a])&&l.get(h[a])===c&&(i[a]=c)}function H9(e){return e.__data__}function q4(e,t){if(!arguments.length)return Array.from(this,H9);var n=t?X9:G9,r=this._parents,i=this._groups;typeof e!="function"&&(e=z4(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],h=f.length,d=Z9(e.call(u,u&&u.__data__,l,r)),p=d.length,m=a[l]=new Array(p),y=s[l]=new Array(p),g=c[l]=new Array(h);n(u,f,m,y,g,d,t);for(var b=0,x=0,w,v;b<p;++b)if(w=m[b]){for(b>=x&&(x=b+1);!(v=y[x])&&++x<p;);w._next=v||null}}return s=new Fe(s,r),s._enter=a,s._exit=c,s}function Z9(e){return typeof e=="object"&&"length"in e?e:Array.from(e)}function V4(){return new Fe(this._exit||this._groups.map(ag),this._parents)}function j4(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 Y4(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,h=a[c]=new Array(f),d,p=0;p<f;++p)(d=l[p]||u[p])&&(h[p]=d);for(;c<i;++c)a[c]=n[c];return new Fe(a,this._parents)}function W4(){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 G4(e){e||(e=Q9);function t(f,h){return f&&h?e(f.__data__,h.__data__):!f-!h}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 Fe(i,this._parents).order()}function Q9(e,t){return e<t?-1:e>t?1:e>=t?0:NaN}function X4(){var e=arguments[0];return arguments[0]=this,e.apply(null,arguments),this}function H4(){return Array.from(this)}function Z4(){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 Q4(){let e=0;for(let t of this)++e;return e}function K4(){return!this.node()}function J4(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 K9(e){return function(){this.removeAttribute(e)}}function J9(e){return function(){this.removeAttributeNS(e.space,e.local)}}function t$(e,t){return function(){this.setAttribute(e,t)}}function e$(e,t){return function(){this.setAttributeNS(e.space,e.local,t)}}function n$(e,t){return function(){var n=t.apply(this,arguments);n==null?this.removeAttribute(e):this.setAttribute(e,n)}}function r$(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 tT(e,t){var n=ds(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?J9:K9:typeof t=="function"?n.local?r$:n$:n.local?e$:t$)(n,t))}function cg(e){return e.ownerDocument&&e.ownerDocument.defaultView||e.document&&e||e.defaultView}function i$(e){return function(){this.style.removeProperty(e)}}function o$(e,t,n){return function(){this.style.setProperty(e,t,n)}}function s$(e,t,n){return function(){var r=t.apply(this,arguments);r==null?this.style.removeProperty(e):this.style.setProperty(e,r,n)}}function eT(e,t,n){return arguments.length>1?this.each((t==null?i$:typeof t=="function"?s$:o$)(e,t,n??"")):da(this.node(),e)}function da(e,t){return e.style.getPropertyValue(t)||cg(e).getComputedStyle(e,null).getPropertyValue(t)}function a$(e){return function(){delete this[e]}}function c$(e,t){return function(){this[e]=t}}function l$(e,t){return function(){var n=t.apply(this,arguments);n==null?delete this[e]:this[e]=n}}function nT(e,t){return arguments.length>1?this.each((t==null?a$:typeof t=="function"?l$:c$)(e,t)):this.node()[e]}function rT(e){return e.trim().split(/^|\s+/)}function Lv(e){return e.classList||new iT(e)}function iT(e){this._node=e,this._names=rT(e.getAttribute("class")||"")}iT.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 oT(e,t){for(var n=Lv(e),r=-1,i=t.length;++r<i;)n.add(t[r])}function sT(e,t){for(var n=Lv(e),r=-1,i=t.length;++r<i;)n.remove(t[r])}function u$(e){return function(){oT(this,e)}}function f$(e){return function(){sT(this,e)}}function h$(e,t){return function(){(t.apply(this,arguments)?oT:sT)(this,e)}}function aT(e,t){var n=rT(e+"");if(arguments.length<2){for(var r=Lv(this.node()),i=-1,o=n.length;++i<o;)if(!r.contains(n[i]))return!1;return!0}return this.each((typeof t=="function"?h$:t?u$:f$)(n,t))}function d$(){this.textContent=""}function p$(e){return function(){this.textContent=e}}function m$(e){return function(){var t=e.apply(this,arguments);this.textContent=t??""}}function cT(e){return arguments.length?this.each(e==null?d$:(typeof e=="function"?m$:p$)(e)):this.node().textContent}function y$(){this.innerHTML=""}function g$(e){return function(){this.innerHTML=e}}function b$(e){return function(){var t=e.apply(this,arguments);this.innerHTML=t??""}}function lT(e){return arguments.length?this.each(e==null?y$:(typeof e=="function"?b$:g$)(e)):this.node().innerHTML}function x$(){this.nextSibling&&this.parentNode.appendChild(this)}function uT(){return this.each(x$)}function w$(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function fT(){return this.each(w$)}function hT(e){var t=typeof e=="function"?e:ps(e);return this.select(function(){return this.appendChild(t.apply(this,arguments))})}function _$(){return null}function dT(e,t){var n=typeof e=="function"?e:ps(e),r=t==null?_$:typeof t=="function"?t:Nc(t);return this.select(function(){return this.insertBefore(n.apply(this,arguments),r.apply(this,arguments)||null)})}function v$(){var e=this.parentNode;e&&e.removeChild(this)}function pT(){return this.each(v$)}function S$(){var e=this.cloneNode(!1),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function M$(){var e=this.cloneNode(!0),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function mT(e){return this.select(e?M$:S$)}function yT(e){return arguments.length?this.property("__data__",e):this.node().__data__}function I$(e){return function(t){e.call(this,t,this.__data__)}}function A$(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 T$(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 E$(e,t,n){return function(){var r=this.__on,i,o=I$(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 gT(e,t,n){var r=A$(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?E$:T$,i=0;i<o;++i)this.each(a(r[i],t,n));return this}function bT(e,t,n){var r=cg(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 D$(e,t){return function(){return bT(this,e,t)}}function N$(e,t){return function(){return bT(this,e,t.apply(this,arguments))}}function xT(e,t){return this.each((typeof t=="function"?N$:D$)(e,t))}function*wT(){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 Fv=[null];function Fe(e,t){this._groups=e,this._parents=t}function _T(){return new Fe([[document.documentElement]],Fv)}function O$(){return this}Fe.prototype=_T.prototype={constructor:Fe,select:C4,selectAll:R4,selectChild:k4,selectChildren:$4,filter:U4,data:q4,enter:P4,exit:V4,join:j4,merge:Y4,selection:O$,order:W4,sort:G4,call:X4,nodes:H4,node:Z4,size:Q4,empty:K4,each:J4,attr:tT,style:eT,property:nT,classed:aT,text:cT,html:lT,raise:uT,lower:fT,append:hT,insert:dT,remove:pT,clone:mT,datum:yT,on:gT,dispatch:xT,[Symbol.iterator]:wT};var ms=_T;function Pt(e){return typeof e=="string"?new Fe([[document.querySelector(e)]],[document.documentElement]):new Fe([[e]],Fv)}function vT(e){let t;for(;t=e.sourceEvent;)e=t;return e}function Fn(e,t){if(e=vT(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 lg={capture:!0,passive:!1};function ug(e){e.preventDefault(),e.stopImmediatePropagation()}function Ed(e){var t=e.document.documentElement,n=Pt(e).on("dragstart.drag",ug,lg);"onselectstart"in t?n.on("selectstart.drag",ug,lg):(t.__noselect=t.style.MozUserSelect,t.style.MozUserSelect="none")}function Dd(e,t){var n=e.document.documentElement,r=Pt(e).on("dragstart.drag",null);t&&(r.on("click.drag",ug,lg),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 ys(e,t,n){e.prototype=t.prototype=n,n.constructor=e}function pa(e,t){var n=Object.create(e.prototype);for(var r in t)n[r]=t[r];return n}function uo(){}var ma=.7,Lc=1/ma,cu="\\s*([+-]?\\d+)\\s*",Nd="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",lo="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",B$=/^#([0-9a-f]{3,8})$/,L$=new RegExp(`^rgb\\(${cu},${cu},${cu}\\)$`),F$=new RegExp(`^rgb\\(${lo},${lo},${lo}\\)$`),C$=new RegExp(`^rgba\\(${cu},${cu},${cu},${Nd}\\)$`),R$=new RegExp(`^rgba\\(${lo},${lo},${lo},${Nd}\\)$`),k$=new RegExp(`^hsl\\(${Nd},${lo},${lo}\\)$`),$$=new RegExp(`^hsla\\(${Nd},${lo},${lo},${Nd}\\)$`),ST={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};ys(uo,Er,{copy(e){return Object.assign(new this.constructor,this,e)},displayable(){return this.rgb().displayable()},hex:MT,formatHex:MT,formatHex8:U$,formatHsl:P$,formatRgb:IT,toString:IT});function MT(){return this.rgb().formatHex()}function U$(){return this.rgb().formatHex8()}function P$(){return OT(this).formatHsl()}function IT(){return this.rgb().formatRgb()}function Er(e){var t,n;return e=(e+"").trim().toLowerCase(),(t=B$.exec(e))?(n=t[1].length,t=parseInt(t[1],16),n===6?AT(t):n===3?new Ye(t>>8&15|t>>4&240,t>>4&15|t&240,(t&15)<<4|t&15,1):n===8?fg(t>>24&255,t>>16&255,t>>8&255,(t&255)/255):n===4?fg(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=L$.exec(e))?new Ye(t[1],t[2],t[3],1):(t=F$.exec(e))?new Ye(t[1]*255/100,t[2]*255/100,t[3]*255/100,1):(t=C$.exec(e))?fg(t[1],t[2],t[3],t[4]):(t=R$.exec(e))?fg(t[1]*255/100,t[2]*255/100,t[3]*255/100,t[4]):(t=k$.exec(e))?DT(t[1],t[2]/100,t[3]/100,1):(t=$$.exec(e))?DT(t[1],t[2]/100,t[3]/100,t[4]):ST.hasOwnProperty(e)?AT(ST[e]):e==="transparent"?new Ye(NaN,NaN,NaN,0):null}function AT(e){return new Ye(e>>16&255,e>>8&255,e&255,1)}function fg(e,t,n,r){return r<=0&&(e=t=n=NaN),new Ye(e,t,n,r)}function Od(e){return e instanceof uo||(e=Er(e)),e?(e=e.rgb(),new Ye(e.r,e.g,e.b,e.opacity)):new Ye}function en(e,t,n,r){return arguments.length===1?Od(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}ys(Ye,en,pa(uo,{brighter(e){return e=e==null?Lc:Math.pow(Lc,e),new Ye(this.r*e,this.g*e,this.b*e,this.opacity)},darker(e){return e=e==null?ma:Math.pow(ma,e),new Ye(this.r*e,this.g*e,this.b*e,this.opacity)},rgb(){return this},clamp(){return new Ye(Bc(this.r),Bc(this.g),Bc(this.b),dg(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:TT,formatHex:TT,formatHex8:z$,formatRgb:ET,toString:ET}));function TT(){return`#${Oc(this.r)}${Oc(this.g)}${Oc(this.b)}`}function z$(){return`#${Oc(this.r)}${Oc(this.g)}${Oc(this.b)}${Oc((isNaN(this.opacity)?1:this.opacity)*255)}`}function ET(){let e=dg(this.opacity);return`${e===1?"rgb(":"rgba("}${Bc(this.r)}, ${Bc(this.g)}, ${Bc(this.b)}${e===1?")":`, ${e})`}`}function dg(e){return isNaN(e)?1:Math.max(0,Math.min(1,e))}function Bc(e){return Math.max(0,Math.min(255,Math.round(e)||0))}function Oc(e){return e=Bc(e),(e<16?"0":"")+e.toString(16)}function DT(e,t,n,r){return r<=0?e=t=n=NaN:n<=0||n>=1?e=t=NaN:t<=0&&(e=NaN),new Ni(e,t,n,r)}function OT(e){if(e instanceof Ni)return new Ni(e.h,e.s,e.l,e.opacity);if(e instanceof uo||(e=Er(e)),!e)return new Ni;if(e instanceof Ni)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 Ni(s,a,c,e.opacity)}function Bd(e,t,n,r){return arguments.length===1?OT(e):new Ni(e,t,n,r??1)}function Ni(e,t,n,r){this.h=+e,this.s=+t,this.l=+n,this.opacity=+r}ys(Ni,Bd,pa(uo,{brighter(e){return e=e==null?Lc:Math.pow(Lc,e),new Ni(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=e==null?ma:Math.pow(ma,e),new Ni(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(Cv(e>=240?e-240:e+120,i,r),Cv(e,i,r),Cv(e<120?e+240:e-120,i,r),this.opacity)},clamp(){return new Ni(NT(this.h),hg(this.s),hg(this.l),dg(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=dg(this.opacity);return`${e===1?"hsl(":"hsla("}${NT(this.h)}, ${hg(this.s)*100}%, ${hg(this.l)*100}%${e===1?")":`, ${e})`}`}}));function NT(e){return e=(e||0)%360,e<0?e+360:e}function hg(e){return Math.max(0,Math.min(1,e||0))}function Cv(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 pg=Math.PI/180,mg=180/Math.PI;var yg=18,BT=.96422,LT=1,FT=.82521,CT=4/29,lu=6/29,RT=3*lu*lu,q$=lu*lu*lu;function kT(e){if(e instanceof fo)return new fo(e.l,e.a,e.b,e.opacity);if(e instanceof gs)return $T(e);e instanceof Ye||(e=Od(e));var t=Uv(e.r),n=Uv(e.g),r=Uv(e.b),i=Rv((.2225045*t+.7168786*n+.0606169*r)/LT),o,s;return t===n&&n===r?o=s=i:(o=Rv((.4360747*t+.3850649*n+.1430804*r)/BT),s=Rv((.0139322*t+.0971045*n+.7141733*r)/FT)),new fo(116*i-16,500*(o-i),200*(i-s),e.opacity)}function uu(e,t,n,r){return arguments.length===1?kT(e):new fo(e,t,n,r??1)}function fo(e,t,n,r){this.l=+e,this.a=+t,this.b=+n,this.opacity=+r}ys(fo,uu,pa(uo,{brighter(e){return new fo(this.l+yg*(e??1),this.a,this.b,this.opacity)},darker(e){return new fo(this.l-yg*(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=BT*kv(t),e=LT*kv(e),n=FT*kv(n),new Ye($v(3.1338561*t-1.6168667*e-.4906146*n),$v(-.9787684*t+1.9161415*e+.033454*n),$v(.0719453*t-.2289914*e+1.4052427*n),this.opacity)}}));function Rv(e){return e>q$?Math.pow(e,1/3):e/RT+CT}function kv(e){return e>lu?e*e*e:RT*(e-CT)}function $v(e){return 255*(e<=.0031308?12.92*e:1.055*Math.pow(e,1/2.4)-.055)}function Uv(e){return(e/=255)<=.04045?e/12.92:Math.pow((e+.055)/1.055,2.4)}function V$(e){if(e instanceof gs)return new gs(e.h,e.c,e.l,e.opacity);if(e instanceof fo||(e=kT(e)),e.a===0&&e.b===0)return new gs(NaN,0<e.l&&e.l<100?0:NaN,e.l,e.opacity);var t=Math.atan2(e.b,e.a)*mg;return new gs(t<0?t+360:t,Math.sqrt(e.a*e.a+e.b*e.b),e.l,e.opacity)}function Ld(e,t,n,r){return arguments.length===1?V$(e):new gs(e,t,n,r??1)}function gs(e,t,n,r){this.h=+e,this.c=+t,this.l=+n,this.opacity=+r}function $T(e){if(isNaN(e.h))return new fo(e.l,0,0,e.opacity);var t=e.h*pg;return new fo(e.l,Math.cos(t)*e.c,Math.sin(t)*e.c,e.opacity)}ys(gs,Ld,pa(uo,{brighter(e){return new gs(this.h,this.c,this.l+yg*(e??1),this.opacity)},darker(e){return new gs(this.h,this.c,this.l-yg*(e??1),this.opacity)},rgb(){return $T(this).rgb()}}));var qT=-.14861,Pv=1.78277,zv=-.29227,gg=-.90649,Fd=1.97294,UT=Fd*gg,PT=Fd*Pv,zT=Pv*zv-gg*qT;function j$(e){if(e instanceof Fc)return new Fc(e.h,e.s,e.l,e.opacity);e instanceof Ye||(e=Od(e));var t=e.r/255,n=e.g/255,r=e.b/255,i=(zT*r+UT*t-PT*n)/(zT+UT-PT),o=r-i,s=(Fd*(n-i)-zv*o)/gg,a=Math.sqrt(s*s+o*o)/(Fd*i*(1-i)),c=a?Math.atan2(s,o)*mg-120:NaN;return new Fc(c<0?c+360:c,a,i,e.opacity)}function Qn(e,t,n,r){return arguments.length===1?j$(e):new Fc(e,t,n,r??1)}function Fc(e,t,n,r){this.h=+e,this.s=+t,this.l=+n,this.opacity=+r}ys(Fc,Qn,pa(uo,{brighter(e){return e=e==null?Lc:Math.pow(Lc,e),new Fc(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=e==null?ma:Math.pow(ma,e),new Fc(this.h,this.s,this.l*e,this.opacity)},rgb(){var e=isNaN(this.h)?0:(this.h+120)*pg,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*(qT*r+Pv*i)),255*(t+n*(zv*r+gg*i)),255*(t+n*(Fd*r)),this.opacity)}}));function qv(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 VT(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 qv((n-r/t)*t,s,i,o,a)}}function jT(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 qv((n-r/t)*t,i,o,s,a)}}var fu=e=>()=>e;function YT(e,t){return function(n){return e+n*t}}function Y$(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 hu(e,t){var n=t-e;return n?YT(e,n>180||n<-180?n-360*Math.round(n/360):n):fu(isNaN(e)?t:e)}function WT(e){return(e=+e)==1?Me:function(t,n){return n-t?Y$(t,n,e):fu(isNaN(t)?n:t)}}function Me(e,t){var n=t-e;return n?YT(e,n):fu(isNaN(e)?t:e)}var Jr=function e(t){var n=WT(t);function r(i,o){var s=n((i=en(i)).r,(o=en(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 GT(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=en(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 Vv=GT(VT),W$=GT(jT);function XT(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 HT(e){return ArrayBuffer.isView(e)&&!(e instanceof DataView)}function ZT(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]=Dr(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 QT(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 KT(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]=Dr(e[i],t[i]):r[i]=t[i];return function(o){for(i in n)r[i]=n[i](o);return r}}var Yv=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,jv=new RegExp(Yv.source,"g");function G$(e){return function(){return e}}function X$(e){return function(t){return e(t)+""}}function Cd(e,t){var n=Yv.lastIndex=jv.lastIndex=0,r,i,o,s=-1,a=[],c=[];for(e=e+"",t=t+"";(r=Yv.exec(e))&&(i=jv.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=jv.lastIndex;return n<t.length&&(o=t.slice(n),a[s]?a[s]+=o:a[++s]=o),a.length<2?c[0]?X$(c[0].x):G$(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 Dr(e,t){var n=typeof t,r;return t==null||n==="boolean"?fu(t):(n==="number"?we:n==="string"?(r=Er(t))?(t=r,Jr):Cd:t instanceof Er?Jr:t instanceof Date?QT:HT(t)?XT:Array.isArray(t)?ZT:typeof t.valueOf!="function"&&typeof t.toString!="function"||isNaN(t)?KT:we)(e,t)}function Cc(e,t){return e=+e,t=+t,function(n){return Math.round(e*(1-n)+t*n)}}var JT=180/Math.PI,bg={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1};function Wv(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)*JT,skewX:Math.atan(c)*JT,scaleX:s,scaleY:a}}var xg;function t8(e){let t=new(typeof DOMMatrix=="function"?DOMMatrix:WebKitCSSMatrix)(e+"");return t.isIdentity?bg:Wv(t.a,t.b,t.c,t.d,t.e,t.f)}function e8(e){return e==null?bg:(xg||(xg=document.createElementNS("http://www.w3.org/2000/svg","g")),xg.setAttribute("transform",e),(e=xg.transform.baseVal.consolidate())?(e=e.matrix,Wv(e.a,e.b,e.c,e.d,e.e,e.f)):bg)}function n8(e,t,n,r){function i(l){return l.length?l.pop()+" ":""}function o(l,u,f,h,d,p){if(l!==f||u!==h){var m=d.push("translate(",null,t,null,n);p.push({i:m-4,x:we(l,f)},{i:m-2,x:we(u,h)})}else(f||h)&&d.push("translate("+f+t+h+n)}function s(l,u,f,h){l!==u?(l-u>180?u+=360:u-l>180&&(l+=360),h.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,h){l!==u?h.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,h,d,p){if(l!==f||u!==h){var m=d.push(i(d)+"scale(",null,",",null,")");p.push({i:m-4,x:we(l,f)},{i:m-2,x:we(u,h)})}else(f!==1||h!==1)&&d.push(i(d)+"scale("+f+","+h+")")}return function(l,u){var f=[],h=[];return l=e(l),u=e(u),o(l.translateX,l.translateY,u.translateX,u.translateY,f,h),s(l.rotate,u.rotate,f,h),a(l.skewX,u.skewX,f,h),c(l.scaleX,l.scaleY,u.scaleX,u.scaleY,f,h),l=u=null,function(d){for(var p=-1,m=h.length,y;++p<m;)f[(y=h[p]).i]=y.x(d);return f.join("")}}}var Gv=n8(t8,"px, ","px)","deg)"),Xv=n8(e8,", ",")",")");var H$=1e-12;function r8(e){return((e=Math.exp(e))+1/e)/2}function Z$(e){return((e=Math.exp(e))-1/e)/2}function Q$(e){return((e=Math.exp(2*e))-1)/(e+1)}var Hv=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],h=s[2],d=u-a,p=f-c,m=d*d+p*p,y,g;if(m<H$)g=Math.log(h/l)/t,y=function(M){return[a+M*d,c+M*p,l*Math.exp(t*M*g)]};else{var b=Math.sqrt(m),x=(h*h-l*l+r*m)/(2*l*n*b),w=(h*h-l*l-r*m)/(2*h*n*b),v=Math.log(Math.sqrt(x*x+1)-x),_=Math.log(Math.sqrt(w*w+1)-w);g=(_-v)/t,y=function(M){var E=M*g,I=r8(v),N=l/(n*b)*(I*Q$(t*E+v)-Z$(v));return[a+N*d,c+N*p,l*I/r8(t*E+v)]}}return y.duration=g*1e3*t/Math.SQRT2,y}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 i8(e){return function(t,n){var r=e((t=Bd(t)).h,(n=Bd(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 Zv=i8(hu),K$=i8(Me);function wg(e,t){var n=Me((e=uu(e)).l,(t=uu(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 o8(e){return function(t,n){var r=e((t=Ld(t)).h,(n=Ld(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 Qv=o8(hu),J$=o8(Me);function s8(e){return function t(n){n=+n;function r(i,o){var s=e((i=Qn(i)).h,(o=Qn(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 tU=s8(hu),du=s8(Me);function ho(e,t){t===void 0&&(t=e,e=Dr);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 pu=0,kd=0,Rd=0,c8=1e3,_g,$d,vg=0,Rc=0,Sg=0,Ud=typeof performance=="object"&&performance.now?performance:Date,l8=typeof window=="object"&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(e){setTimeout(e,17)};function zd(){return Rc||(l8(eU),Rc=Ud.now()+Sg)}function eU(){Rc=0}function Pd(){this._call=this._time=this._next=null}Pd.prototype=Mg.prototype={constructor:Pd,restart:function(e,t,n){if(typeof e!="function")throw new TypeError("callback is not a function");n=(n==null?zd():+n)+(t==null?0:+t),!this._next&&$d!==this&&($d?$d._next=this:_g=this,$d=this),this._call=e,this._time=n,Kv()},stop:function(){this._call&&(this._call=null,this._time=1/0,Kv())}};function Mg(e,t,n){var r=new Pd;return r.restart(e,t,n),r}function u8(){zd(),++pu;for(var e=_g,t;e;)(t=Rc-e._time)>=0&&e._call.call(void 0,t),e=e._next;--pu}function a8(){Rc=(vg=Ud.now())+Sg,pu=kd=0;try{u8()}finally{pu=0,rU(),Rc=0}}function nU(){var e=Ud.now(),t=e-vg;t>c8&&(Sg-=t,vg=e)}function rU(){for(var e,t=_g,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:_g=n);$d=e,Kv(r)}function Kv(e){if(!pu){kd&&(kd=clearTimeout(kd));var t=e-Rc;t>24?(e<1/0&&(kd=setTimeout(a8,e-Ud.now()-Sg)),Rd&&(Rd=clearInterval(Rd))):(Rd||(vg=Ud.now(),Rd=setInterval(nU,c8)),pu=1,l8(a8))}}function Ig(e,t,n){var r=new Pd;return t=t==null?0:+t,r.restart(i=>{r.stop(),e(i+t)},t,n),r}var iU=Dc("start","end","cancel","interrupt"),oU=[],d8=0,f8=1,Tg=2,Ag=3,h8=4,Eg=5,qd=6;function ya(e,t,n,r,i,o){var s=e.__transition;if(!s)e.__transition={};else if(n in s)return;sU(e,n,{name:t,index:r,group:i,on:iU,tween:oU,time:o.time,delay:o.delay,duration:o.duration,ease:o.ease,timer:null,state:d8})}function Vd(e,t){var n=nn(e,t);if(n.state>d8)throw new Error("too late; already scheduled");return n}function An(e,t){var n=nn(e,t);if(n.state>Ag)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 sU(e,t,n){var r=e.__transition,i;r[t]=n,n.timer=Mg(o,0,n.time);function o(l){n.state=f8,n.timer.restart(s,n.delay,n.time),n.delay<=l&&s(l-n.delay)}function s(l){var u,f,h,d;if(n.state!==f8)return c();for(u in r)if(d=r[u],d.name===n.name){if(d.state===Ag)return Ig(s);d.state===h8?(d.state=qd,d.timer.stop(),d.on.call("interrupt",e,e.__data__,d.index,d.group),delete r[u]):+u<t&&(d.state=qd,d.timer.stop(),d.on.call("cancel",e,e.__data__,d.index,d.group),delete r[u])}if(Ig(function(){n.state===Ag&&(n.state=h8,n.timer.restart(a,n.delay,n.time),a(l))}),n.state=Tg,n.on.call("start",e,e.__data__,n.index,n.group),n.state===Tg){for(n.state=Ag,i=new Array(h=n.tween.length),u=0,f=-1;u<h;++u)(d=n.tween[u].value.call(e,e.__data__,n.index,n.group))&&(i[++f]=d);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=Eg,1),f=-1,h=i.length;++f<h;)i[f].call(e,u);n.state===Eg&&(n.on.call("end",e,e.__data__,n.index,n.group),c())}function c(){n.state=qd,n.timer.stop(),delete r[t];for(var l in r)return;delete e.__transition}}function po(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>Tg&&r.state<Eg,r.state=qd,r.timer.stop(),r.on.call(i?"interrupt":"cancel",e,e.__data__,r.index,r.group),delete n[s]}o&&delete e.__transition}}function p8(e){return this.each(function(){po(this,e)})}function aU(e,t){var n,r;return function(){var i=An(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 cU(e,t,n){var r,i;if(typeof n!="function")throw new Error;return function(){var o=An(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 m8(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?aU:cU)(n,e,t))}function mu(e,t,n){var r=e._id;return e.each(function(){var i=An(this,r);(i.value||(i.value={}))[t]=n.apply(this,arguments)}),function(i){return nn(i,r).value[t]}}function Dg(e,t){var n;return(typeof t=="number"?we:t instanceof Er?Jr:(n=Er(t))?(t=n,Jr):Cd)(e,t)}function lU(e){return function(){this.removeAttribute(e)}}function uU(e){return function(){this.removeAttributeNS(e.space,e.local)}}function fU(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 hU(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 dU(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 pU(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 y8(e,t){var n=ds(e),r=n==="transform"?Xv:Dg;return this.attrTween(e,typeof t=="function"?(n.local?pU:dU)(n,r,mu(this,"attr."+e,t)):t==null?(n.local?uU:lU)(n):(n.local?hU:fU)(n,r,t))}function mU(e,t){return function(n){this.setAttribute(e,t.call(this,n))}}function yU(e,t){return function(n){this.setAttributeNS(e.space,e.local,t.call(this,n))}}function gU(e,t){var n,r;function i(){var o=t.apply(this,arguments);return o!==r&&(n=(r=o)&&yU(e,o)),n}return i._value=t,i}function bU(e,t){var n,r;function i(){var o=t.apply(this,arguments);return o!==r&&(n=(r=o)&&mU(e,o)),n}return i._value=t,i}function g8(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=ds(e);return this.tween(n,(r.local?gU:bU)(r,t))}function xU(e,t){return function(){Vd(this,e).delay=+t.apply(this,arguments)}}function wU(e,t){return t=+t,function(){Vd(this,e).delay=t}}function b8(e){var t=this._id;return arguments.length?this.each((typeof e=="function"?xU:wU)(t,e)):nn(this.node(),t).delay}function _U(e,t){return function(){An(this,e).duration=+t.apply(this,arguments)}}function vU(e,t){return t=+t,function(){An(this,e).duration=t}}function x8(e){var t=this._id;return arguments.length?this.each((typeof e=="function"?_U:vU)(t,e)):nn(this.node(),t).duration}function SU(e,t){if(typeof t!="function")throw new Error;return function(){An(this,e).ease=t}}function w8(e){var t=this._id;return arguments.length?this.each(SU(t,e)):nn(this.node(),t).ease}function MU(e,t){return function(){var n=t.apply(this,arguments);if(typeof n!="function")throw new Error;An(this,e).ease=n}}function _8(e){if(typeof e!="function")throw new Error;return this.each(MU(this._id,e))}function v8(e){typeof e!="function"&&(e=Ad(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 Kn(r,this._parents,this._name,this._id)}function S8(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),h,d=0;d<u;++d)(h=c[d]||l[d])&&(f[d]=h);for(;a<r;++a)s[a]=t[a];return new Kn(s,this._parents,this._name,this._id)}function IU(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 AU(e,t,n){var r,i,o=IU(t)?Vd:An;return function(){var s=o(this,e),a=s.on;a!==r&&(i=(r=a).copy()).on(t,n),s.on=i}}function M8(e,t){var n=this._id;return arguments.length<2?nn(this.node(),n).on.on(e):this.each(AU(n,e,t))}function TU(e){return function(){var t=this.parentNode;for(var n in this.__transition)if(+n!==e)return;t&&t.removeChild(this)}}function I8(){return this.on("end.remove",TU(this._id))}function A8(e){var t=this._name,n=this._id;typeof e!="function"&&(e=Nc(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,h=0;h<c;++h)(u=a[h])&&(f=e.call(u,u.__data__,h,a))&&("__data__"in u&&(f.__data__=u.__data__),l[h]=f,ya(l[h],t,n,h,l,nn(u,n)));return new Kn(o,this._parents,t,n)}function T8(e){var t=this._name,n=this._id;typeof e!="function"&&(e=Id(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 h=e.call(u,u.__data__,f,c),d,p=nn(u,n),m=0,y=h.length;m<y;++m)(d=h[m])&&ya(d,t,n,m,h,p);o.push(h),s.push(u)}return new Kn(o,s,t,n)}var EU=ms.prototype.constructor;function E8(){return new EU(this._groups,this._parents)}function DU(e,t){var n,r,i;return function(){var o=da(this,e),s=(this.style.removeProperty(e),da(this,e));return o===s?null:o===n&&s===r?i:i=t(n=o,r=s)}}function D8(e){return function(){this.style.removeProperty(e)}}function NU(e,t,n){var r,i=n+"",o;return function(){var s=da(this,e);return s===i?null:s===r?o:o=t(r=s,n)}}function OU(e,t,n){var r,i,o;return function(){var s=da(this,e),a=n(this),c=a+"";return a==null&&(c=a=(this.style.removeProperty(e),da(this,e))),s===c?null:s===r&&c===i?o:(i=c,o=t(r=s,a))}}function BU(e,t){var n,r,i,o="style."+t,s="end."+o,a;return function(){var c=An(this,e),l=c.on,u=c.value[o]==null?a||(a=D8(t)):void 0;(l!==n||i!==u)&&(r=(n=l).copy()).on(s,i=u),c.on=r}}function N8(e,t,n){var r=(e+="")=="transform"?Gv:Dg;return t==null?this.styleTween(e,DU(e,r)).on("end.style."+e,D8(e)):typeof t=="function"?this.styleTween(e,OU(e,r,mu(this,"style."+e,t))).each(BU(this._id,e)):this.styleTween(e,NU(e,r,t),n).on("end.style."+e,null)}function LU(e,t,n){return function(r){this.style.setProperty(e,t.call(this,r),n)}}function FU(e,t,n){var r,i;function o(){var s=t.apply(this,arguments);return s!==i&&(r=(i=s)&&LU(e,s,n)),r}return o._value=t,o}function O8(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,FU(e,t,n??""))}function CU(e){return function(){this.textContent=e}}function RU(e){return function(){var t=e(this);this.textContent=t??""}}function B8(e){return this.tween("text",typeof e=="function"?RU(mu(this,"text",e)):CU(e==null?"":e+""))}function kU(e){return function(t){this.textContent=e.call(this,t)}}function $U(e){var t,n;function r(){var i=e.apply(this,arguments);return i!==n&&(t=(n=i)&&kU(i)),t}return r._value=e,r}function L8(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,$U(e))}function F8(){for(var e=this._name,t=this._id,n=Ng(),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);ya(c,e,n,l,s,{time:u.time+u.delay+u.duration,delay:0,duration:u.duration,ease:u.ease})}return new Kn(r,this._parents,e,n)}function C8(){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=An(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 UU=0;function Kn(e,t,n,r){this._groups=e,this._parents=t,this._name=n,this._id=r}function R8(e){return ms().transition(e)}function Ng(){return++UU}var bs=ms.prototype;Kn.prototype=R8.prototype={constructor:Kn,select:A8,selectAll:T8,selectChild:bs.selectChild,selectChildren:bs.selectChildren,filter:v8,merge:S8,selection:E8,transition:F8,call:bs.call,nodes:bs.nodes,node:bs.node,size:bs.size,empty:bs.empty,each:bs.each,on:M8,attr:y8,attrTween:g8,style:N8,styleTween:O8,text:B8,textTween:L8,remove:I8,tween:m8,delay:b8,duration:x8,ease:w8,easeVarying:_8,end:C8,[Symbol.iterator]:bs[Symbol.iterator]};function Og(e){return((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2}var PU={time:null,delay:0,duration:250,ease:Og};function zU(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 k8(e){var t,n;e instanceof Kn?(t=e._id,e=e._name):(t=Ng(),(n=PU).time=zd(),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])&&ya(c,e,t,l,s,n||zU(c,t));return new Kn(r,this._parents,e,t)}ms.prototype.interrupt=p8;ms.prototype.transition=k8;var Bg=e=>()=>e;function Jv(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 $8(e){e.stopImmediatePropagation()}function Lg(e){e.preventDefault(),e.stopImmediatePropagation()}var U8={name:"drag"},t2={name:"space"},yu={name:"handle"},gu={name:"center"},{abs:P8,max:Rn,min:kn}=Math;function z8(e){return[+e[0],+e[1]]}function n2(e){return[z8(e[0]),z8(e[1])]}var Fg={name:"x",handles:["w","e"].map(jd),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]]}},Cg={name:"y",handles:["n","s"].map(jd),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]]}},qU={name:"xy",handles:["n","w","e","s","nw","ne","sw","se"].map(jd),input:function(e){return e==null?null:n2(e)},output:function(e){return e}},xs={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"},q8={e:"w",w:"e",nw:"ne",ne:"nw",se:"sw",sw:"se"},V8={n:"s",s:"n",nw:"sw",ne:"se",se:"ne",sw:"nw"},VU={overlay:1,selection:1,n:null,e:1,s:null,w:-1,nw:-1,ne:1,se:1,sw:-1},jU={overlay:1,selection:1,n:-1,e:null,s:1,w:null,nw:-1,ne:-1,se:1,sw:1};function jd(e){return{type:e}}function YU(e){return!e.ctrlKey&&!e.button}function WU(){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 GU(){return navigator.maxTouchPoints||"ontouchstart"in this}function e2(e){for(;!e.__brush;)if(!(e=e.parentNode))return;return e.__brush}function XU(e){return e[0][0]===e[1][0]||e[0][1]===e[1][1]}function r2(){return s2(Fg)}function i2(){return s2(Cg)}function o2(){return s2(qU)}function s2(e){var t=WU,n=YU,r=GU,i=!0,o=Dc("start","brush","end"),s=6,a;function c(y){var g=y.property("__brush",m).selectAll(".overlay").data([jd("overlay")]);g.enter().append("rect").attr("class","overlay").attr("pointer-events","all").attr("cursor",xs.overlay).merge(g).each(function(){var x=e2(this).extent;Pt(this).attr("x",x[0][0]).attr("y",x[0][1]).attr("width",x[1][0]-x[0][0]).attr("height",x[1][1]-x[0][1])}),y.selectAll(".selection").data([jd("selection")]).enter().append("rect").attr("class","selection").attr("cursor",xs.selection).attr("fill","#777").attr("fill-opacity",.3).attr("stroke","#fff").attr("shape-rendering","crispEdges");var b=y.selectAll(".handle").data(e.handles,function(x){return x.type});b.exit().remove(),b.enter().append("rect").attr("class",function(x){return"handle handle--"+x.type}).attr("cursor",function(x){return xs[x.type]}),y.each(l).attr("fill","none").attr("pointer-events","all").on("mousedown.brush",h).filter(r).on("touchstart.brush",h).on("touchmove.brush",d).on("touchend.brush touchcancel.brush",p).style("touch-action","none").style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}c.move=function(y,g,b){y.tween?y.on("start.brush",function(x){u(this,arguments).beforestart().start(x)}).on("interrupt.brush end.brush",function(x){u(this,arguments).end(x)}).tween("brush",function(){var x=this,w=x.__brush,v=u(x,arguments),_=w.selection,M=e.input(typeof g=="function"?g.apply(this,arguments):g,w.extent),E=Dr(_,M);function I(N){w.selection=N===1&&M===null?null:E(N),l.call(x),v.brush()}return _!==null&&M!==null?I:I(1)}):y.each(function(){var x=this,w=arguments,v=x.__brush,_=e.input(typeof g=="function"?g.apply(x,w):g,v.extent),M=u(x,w).beforestart();po(x),v.selection=_===null?null:_,l.call(x),M.start(b).brush(b).end(b)})},c.clear=function(y,g){c.move(y,null,g)};function l(){var y=Pt(this),g=e2(this).selection;g?(y.selectAll(".selection").style("display",null).attr("x",g[0][0]).attr("y",g[0][1]).attr("width",g[1][0]-g[0][0]).attr("height",g[1][1]-g[0][1]),y.selectAll(".handle").style("display",null).attr("x",function(b){return b.type[b.type.length-1]==="e"?g[1][0]-s/2:g[0][0]-s/2}).attr("y",function(b){return b.type[0]==="s"?g[1][1]-s/2:g[0][1]-s/2}).attr("width",function(b){return b.type==="n"||b.type==="s"?g[1][0]-g[0][0]+s:s}).attr("height",function(b){return b.type==="e"||b.type==="w"?g[1][1]-g[0][1]+s:s})):y.selectAll(".selection,.handle").style("display","none").attr("x",null).attr("y",null).attr("width",null).attr("height",null)}function u(y,g,b){var x=y.__brush.emitter;return x&&(!b||!x.clean)?x:new f(y,g,b)}function f(y,g,b){this.that=y,this.args=g,this.state=y.__brush,this.active=0,this.clean=b}f.prototype={beforestart:function(){return++this.active===1&&(this.state.emitter=this,this.starting=!0),this},start:function(y,g){return this.starting?(this.starting=!1,this.emit("start",y,g)):this.emit("brush",y),this},brush:function(y,g){return this.emit("brush",y,g),this},end:function(y,g){return--this.active===0&&(delete this.state.emitter,this.emit("end",y,g)),this},emit:function(y,g,b){var x=Pt(this.that).datum();o.call(y,this.that,new Jv(y,{sourceEvent:g,target:c,selection:e.output(this.state.selection),mode:b,dispatch:o}),x)}};function h(y){if(a&&!y.touches||!n.apply(this,arguments))return;var g=this,b=y.target.__data__.type,x=(i&&y.metaKey?b="overlay":b)==="selection"?U8:i&&y.altKey?gu:yu,w=e===Cg?null:VU[b],v=e===Fg?null:jU[b],_=e2(g),M=_.extent,E=_.selection,I=M[0][0],N,A,O=M[0][1],L,S,T=M[1][0],D,C,R=M[1][1],F,k,$=0,U=0,G,et=w&&v&&i&&y.shiftKey,rt,st,j=Array.from(y.touches||[y],J=>{let oe=J.identifier;return J=Fn(J,g),J.point0=J.slice(),J.identifier=oe,J});po(g);var ot=u(g,arguments,!0).beforestart();if(b==="overlay"){E&&(G=!0);let J=[j[0],j[1]||j[0]];_.selection=E=[[N=e===Cg?I:kn(J[0][0],J[1][0]),L=e===Fg?O:kn(J[0][1],J[1][1])],[D=e===Cg?T:Rn(J[0][0],J[1][0]),F=e===Fg?R:Rn(J[0][1],J[1][1])]],j.length>1&&Lt(y)}else N=E[0][0],L=E[0][1],D=E[1][0],F=E[1][1];A=N,S=L,C=D,k=F;var z=Pt(g).attr("pointer-events","none"),H=z.selectAll(".overlay").attr("cursor",xs[b]);if(y.touches)ot.moved=P,ot.ended=ft;else{var nt=Pt(y.view).on("mousemove.brush",P,!0).on("mouseup.brush",ft,!0);i&&nt.on("keydown.brush",Wt,!0).on("keyup.brush",Ht,!0),Ed(y.view)}l.call(g),ot.start(y,x.name);function P(J){for(let oe of J.changedTouches||[J])for(let br of j)br.identifier===oe.identifier&&(br.cur=Fn(oe,g));if(et&&!rt&&!st&&j.length===1){let oe=j[0];P8(oe.cur[0]-oe[0])>P8(oe.cur[1]-oe[1])?st=!0:rt=!0}for(let oe of j)oe.cur&&(oe[0]=oe.cur[0],oe[1]=oe.cur[1]);G=!0,Lg(J),Lt(J)}function Lt(J){let oe=j[0],br=oe.point0;var Ui;switch($=oe[0]-br[0],U=oe[1]-br[1],x){case t2:case U8:{w&&($=Rn(I-N,kn(T-D,$)),A=N+$,C=D+$),v&&(U=Rn(O-L,kn(R-F,U)),S=L+U,k=F+U);break}case yu:{j[1]?(w&&(A=Rn(I,kn(T,j[0][0])),C=Rn(I,kn(T,j[1][0])),w=1),v&&(S=Rn(O,kn(R,j[0][1])),k=Rn(O,kn(R,j[1][1])),v=1)):(w<0?($=Rn(I-N,kn(T-N,$)),A=N+$,C=D):w>0&&($=Rn(I-D,kn(T-D,$)),A=N,C=D+$),v<0?(U=Rn(O-L,kn(R-L,U)),S=L+U,k=F):v>0&&(U=Rn(O-F,kn(R-F,U)),S=L,k=F+U));break}case gu:{w&&(A=Rn(I,kn(T,N-$*w)),C=Rn(I,kn(T,D+$*w))),v&&(S=Rn(O,kn(R,L-U*v)),k=Rn(O,kn(R,F+U*v)));break}}C<A&&(w*=-1,Ui=N,N=D,D=Ui,Ui=A,A=C,C=Ui,b in q8&&H.attr("cursor",xs[b=q8[b]])),k<S&&(v*=-1,Ui=L,L=F,F=Ui,Ui=S,S=k,k=Ui,b in V8&&H.attr("cursor",xs[b=V8[b]])),_.selection&&(E=_.selection),rt&&(A=E[0][0],C=E[1][0]),st&&(S=E[0][1],k=E[1][1]),(E[0][0]!==A||E[0][1]!==S||E[1][0]!==C||E[1][1]!==k)&&(_.selection=[[A,S],[C,k]],l.call(g),ot.brush(J,x.name))}function ft(J){if($8(J),J.touches){if(J.touches.length)return;a&&clearTimeout(a),a=setTimeout(function(){a=null},500)}else Dd(J.view,G),nt.on("keydown.brush keyup.brush mousemove.brush mouseup.brush",null);z.attr("pointer-events","all"),H.attr("cursor",xs.overlay),_.selection&&(E=_.selection),XU(E)&&(_.selection=null,l.call(g)),ot.end(J,x.name)}function Wt(J){switch(J.keyCode){case 16:{et=w&&v;break}case 18:{x===yu&&(w&&(D=C-$*w,N=A+$*w),v&&(F=k-U*v,L=S+U*v),x=gu,Lt(J));break}case 32:{(x===yu||x===gu)&&(w<0?D=C-$:w>0&&(N=A-$),v<0?F=k-U:v>0&&(L=S-U),x=t2,H.attr("cursor",xs.selection),Lt(J));break}default:return}Lg(J)}function Ht(J){switch(J.keyCode){case 16:{et&&(rt=st=et=!1,Lt(J));break}case 18:{x===gu&&(w<0?D=C:w>0&&(N=A),v<0?F=k:v>0&&(L=S),x=yu,Lt(J));break}case 32:{x===t2&&(J.altKey?(w&&(D=C-$*w,N=A+$*w),v&&(F=k-U*v,L=S+U*v),x=gu):(w<0?D=C:w>0&&(N=A),v<0?F=k:v>0&&(L=S),x=yu),H.attr("cursor",xs[b]),Lt(J));break}default:return}Lg(J)}}function d(y){u(this,arguments).moved(y)}function p(y){u(this,arguments).ended(y)}function m(){var y=this.__brush||{selection:null};return y.extent=n2(t.apply(this,arguments)),y.dim=e,y}return c.extent=function(y){return arguments.length?(t=typeof y=="function"?y:Bg(n2(y)),c):t},c.filter=function(y){return arguments.length?(n=typeof y=="function"?y:Bg(!!y),c):n},c.touchable=function(y){return arguments.length?(r=typeof y=="function"?y:Bg(!!y),c):r},c.handleSize=function(y){return arguments.length?(s=+y,c):s},c.keyModifiers=function(y){return arguments.length?(i=!!y,c):i},c.on=function(){var y=o.on.apply(o,arguments);return y===o?c:y},c}var a2=Math.PI,c2=2*a2,kc=1e-6,HU=c2-kc;function j8(e){this._+=e[0];for(let t=1,n=e.length;t<n;++t)this._+=arguments[t]+e[t]}function ZU(e){let t=Math.floor(e);if(!(t>=0))throw new Error(`invalid digits: ${e}`);if(t>15)return j8;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 ga=class{constructor(t){this._x0=this._y0=this._x1=this._y1=null,this._="",this._append=t==null?j8:ZU(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,h=u*u+f*f;if(this._x1===null)this._append`M${this._x1=t},${this._y1=n}`;else if(h>kc)if(!(Math.abs(f*c-l*u)>kc)||!o)this._append`L${this._x1=t},${this._y1=n}`;else{let d=r-s,p=i-a,m=c*c+l*l,y=d*d+p*p,g=Math.sqrt(m),b=Math.sqrt(h),x=o*Math.tan((a2-Math.acos((m+h-y)/(2*g*b)))/2),w=x/b,v=x/g;Math.abs(w-1)>kc&&this._append`L${t+w*u},${n+w*f}`,this._append`A${o},${o},0,0,${+(f*d>u*p)},${this._x1=t+v*c},${this._y1=n+v*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,h=s?i-o:o-i;this._x1===null?this._append`M${l},${u}`:(Math.abs(this._x1-l)>kc||Math.abs(this._y1-u)>kc)&&this._append`L${l},${u}`,r&&(h<0&&(h=h%c2+c2),h>HU?this._append`A${r},${r},0,1,${f},${t-a},${n-c}A${r},${r},0,1,${f},${this._x1=l},${this._y1=u}`:h>kc&&this._append`A${r},${r},0,${+(h>=a2)},${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 Y8(){return new ga}Y8.prototype=ga.prototype;function Jn(e=3){return new ga(+e)}var QU=Array.prototype,Rg=QU.slice;function W8(e,t){return e-t}function G8(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 mo=e=>()=>e;function X8(e,t){for(var n=-1,r=t.length,i;++n<r;)if(i=KU(e,t[n]))return i;return 0}function KU(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],h=f[0],d=f[1];if(JU(c,f,t))return 0;u>r!=d>r&&n<(h-l)*(r-u)/(d-u)+l&&(i=-i)}return i}function JU(e,t,n){var r;return tP(e,t,n)&&eP(e[r=+(e[0]===t[0])],n[r],t[r])}function tP(e,t,n){return(t[0]-e[0])*(n[1]-e[1])===(n[0]-e[0])*(t[1]-e[1])}function eP(e,t,n){return e<=t&&t<=n||n<=t&&t<=e}function H8(){}var ws=[[],[[[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 ba(){var e=1,t=1,n=fa,r=c;function i(l){var u=n(l);if(Array.isArray(u))u=u.slice().sort(W8);else{let f=ae(l,nP);for(u=Mn(...ou(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 h=[],d=[];return s(l,f,function(p){r(p,l,f),G8(p)>0?h.push([p]):d.push(p)}),d.forEach(function(p){for(var m=0,y=h.length,g;m<y;++m)if(X8((g=h[m])[0],p)!==-1){g.push(p);return}}),{type:"MultiPolygon",value:u,coordinates:h}}function s(l,u,f){var h=new Array,d=new Array,p,m,y,g,b,x;for(p=m=-1,g=$c(l[0],u),ws[g<<1].forEach(w);++p<e-1;)y=g,g=$c(l[p+1],u),ws[y|g<<1].forEach(w);for(ws[g<<0].forEach(w);++m<t-1;){for(p=-1,g=$c(l[m*e+e],u),b=$c(l[m*e],u),ws[g<<1|b<<2].forEach(w);++p<e-1;)y=g,g=$c(l[m*e+e+p+1],u),x=b,b=$c(l[m*e+p+1],u),ws[y|g<<1|b<<2|x<<3].forEach(w);ws[g|b<<3].forEach(w)}for(p=-1,b=l[m*e]>=u,ws[b<<2].forEach(w);++p<e-1;)x=b,b=$c(l[m*e+p+1],u),ws[b<<2|x<<3].forEach(w);ws[b<<3].forEach(w);function w(v){var _=[v[0][0]+p,v[0][1]+m],M=[v[1][0]+p,v[1][1]+m],E=a(_),I=a(M),N,A;(N=d[E])?(A=h[I])?(delete d[N.end],delete h[A.start],N===A?(N.ring.push(M),f(N.ring)):h[N.start]=d[A.end]={start:N.start,end:A.end,ring:N.ring.concat(A.ring)}):(delete d[N.end],N.ring.push(M),d[N.end=I]=N):(N=h[I])?(A=d[E])?(delete h[N.start],delete d[A.end],N===A?(N.ring.push(M),f(N.ring)):h[A.start]=d[N.end]={start:A.start,end:N.end,ring:A.ring.concat(N.ring)}):(delete h[N.start],N.ring.unshift(_),h[N.start=E]=N):h[E]=d[I]={start:E,end:I,ring:[_,M]}}}function a(l){return l[0]*2+l[1]*(e+1)*4}function c(l,u,f){l.forEach(function(h){var d=h[0],p=h[1],m=d|0,y=p|0,g=l2(u[y*e+m]);d>0&&d<e&&m===d&&(h[0]=Z8(d,l2(u[y*e+m-1]),g,f)),p>0&&p<t&&y===p&&(h[1]=Z8(p,l2(u[(y-1)*e+m]),g,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)?mo(Rg.call(l)):mo(l),i):n},i.smooth=function(l){return arguments.length?(r=l?c:H8,i):r===c},i}function nP(e){return isFinite(e)?e:NaN}function $c(e,t){return e==null?!1:+e>=t}function l2(e){return e==null||isNaN(e=+e)?-1/0:e}function Z8(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 rP(e){return e[0]}function iP(e){return e[1]}function oP(){return 1}function u2(){var e=rP,t=iP,n=oP,r=960,i=500,o=20,s=2,a=o*3,c=r+a*2>>s,l=i+a*2>>s,u=mo(20);function f(b){var x=new Float32Array(c*l),w=Math.pow(2,-s),v=-1;for(let L of b){var _=(e(L,++v,b)+a)*w,M=(t(L,v,b)+a)*w,E=+n(L,v,b);if(E&&_>=0&&_<c&&M>=0&&M<l){var I=Math.floor(_),N=Math.floor(M),A=_-I-.5,O=M-N-.5;x[I+N*c]+=(1-A)*(1-O)*E,x[I+1+N*c]+=A*(1-O)*E,x[I+1+(N+1)*c]+=A*O*E,x[I+(N+1)*c]+=(1-A)*O*E}}return xd({data:x,width:c,height:l},o*w),x}function h(b){var x=f(b),w=u(x),v=Math.pow(2,2*s);return Array.isArray(w)||(w=Mn(Number.MIN_VALUE,Xt(x)/v,w)),ba().size([c,l]).thresholds(w.map(_=>_*v))(x).map((_,M)=>(_.value=+w[M],d(_)))}h.contours=function(b){var x=f(b),w=ba().size([c,l]),v=Math.pow(2,2*s),_=M=>{M=+M;var E=d(w.contour(x,M*v));return E.value=M,E};return Object.defineProperty(_,"max",{get:()=>Xt(x)/v}),_};function d(b){return b.coordinates.forEach(p),b}function p(b){b.forEach(m)}function m(b){b.forEach(y)}function y(b){b[0]=b[0]*Math.pow(2,s)-a,b[1]=b[1]*Math.pow(2,s)-a}function g(){return a=o*3,c=r+a*2>>s,l=i+a*2>>s,h}return h.x=function(b){return arguments.length?(e=typeof b=="function"?b:mo(+b),h):e},h.y=function(b){return arguments.length?(t=typeof b=="function"?b:mo(+b),h):t},h.weight=function(b){return arguments.length?(n=typeof b=="function"?b:mo(+b),h):n},h.size=function(b){if(!arguments.length)return[r,i];var x=+b[0],w=+b[1];if(!(x>=0&&w>=0))throw new Error("invalid size");return r=x,i=w,g()},h.cellSize=function(b){if(!arguments.length)return 1<<s;if(!((b=+b)>=1))throw new Error("invalid cell size");return s=Math.floor(Math.log(b)/Math.LN2),g()},h.thresholds=function(b){return arguments.length?(u=typeof b=="function"?b:Array.isArray(b)?mo(Rg.call(b)):mo(b),h):u},h.bandwidth=function(b){if(!arguments.length)return Math.sqrt(o*(o+1));if(!((b=+b)>=0))throw new Error("invalid bandwidth");return o=(Math.sqrt(4*b*b+1)-1)/2,g()},h}var Qt=11102230246251565e-32,We=134217729,Yd=(3+8*Qt)*Qt;function Uc(e,t,n,r,i){let o,s,a,c,l=t[0],u=r[0],f=0,h=0;u>l==u>-l?(o=l,l=t[++f]):(o=u,u=r[++h]);let d=0;if(f<e&&h<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[++h]),o=s,a!==0&&(i[d++]=a);f<e&&h<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[++h]),o=s,a!==0&&(i[d++]=a);for(;f<e;)s=o+l,c=s-o,a=o-(s-c)+(l-c),l=t[++f],o=s,a!==0&&(i[d++]=a);for(;h<n;)s=o+u,c=s-o,a=o-(s-c)+(u-c),u=r[++h],o=s,a!==0&&(i[d++]=a);return(o!==0||d===0)&&(i[d++]=o),d}function Wd(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 sP=(3+16*Qt)*Qt,aP=(2+12*Qt)*Qt,cP=(9+64*Qt)*Qt*Qt,bu=V(4),Q8=V(8),K8=V(12),J8=V(16),tr=V(4);function lP(e,t,n,r,i,o,s){let a,c,l,u,f,h,d,p,m,y,g,b,x,w,v,_,M,E,I=e-i,N=n-i,A=t-o,O=r-o;w=I*O,h=We*I,d=h-(h-I),p=I-d,h=We*O,m=h-(h-O),y=O-m,v=p*y-(w-d*m-p*m-d*y),_=A*N,h=We*A,d=h-(h-A),p=A-d,h=We*N,m=h-(h-N),y=N-m,M=p*y-(_-d*m-p*m-d*y),g=v-M,f=v-g,bu[0]=v-(g+f)+(f-M),b=w+g,f=b-w,x=w-(b-f)+(g-f),g=x-_,f=x-g,bu[1]=x-(g+f)+(f-_),E=b+g,f=E-b,bu[2]=b-(E-f)+(g-f),bu[3]=E;let L=Wd(4,bu),S=aP*s;if(L>=S||-L>=S||(f=e-I,a=e-(I+f)+(f-i),f=n-N,l=n-(N+f)+(f-i),f=t-A,c=t-(A+f)+(f-o),f=r-O,u=r-(O+f)+(f-o),a===0&&c===0&&l===0&&u===0)||(S=cP*s+Yd*Math.abs(L),L+=I*u+O*a-(A*l+N*c),L>=S||-L>=S))return L;w=a*O,h=We*a,d=h-(h-a),p=a-d,h=We*O,m=h-(h-O),y=O-m,v=p*y-(w-d*m-p*m-d*y),_=c*N,h=We*c,d=h-(h-c),p=c-d,h=We*N,m=h-(h-N),y=N-m,M=p*y-(_-d*m-p*m-d*y),g=v-M,f=v-g,tr[0]=v-(g+f)+(f-M),b=w+g,f=b-w,x=w-(b-f)+(g-f),g=x-_,f=x-g,tr[1]=x-(g+f)+(f-_),E=b+g,f=E-b,tr[2]=b-(E-f)+(g-f),tr[3]=E;let T=Uc(4,bu,4,tr,Q8);w=I*u,h=We*I,d=h-(h-I),p=I-d,h=We*u,m=h-(h-u),y=u-m,v=p*y-(w-d*m-p*m-d*y),_=A*l,h=We*A,d=h-(h-A),p=A-d,h=We*l,m=h-(h-l),y=l-m,M=p*y-(_-d*m-p*m-d*y),g=v-M,f=v-g,tr[0]=v-(g+f)+(f-M),b=w+g,f=b-w,x=w-(b-f)+(g-f),g=x-_,f=x-g,tr[1]=x-(g+f)+(f-_),E=b+g,f=E-b,tr[2]=b-(E-f)+(g-f),tr[3]=E;let D=Uc(T,Q8,4,tr,K8);w=a*u,h=We*a,d=h-(h-a),p=a-d,h=We*u,m=h-(h-u),y=u-m,v=p*y-(w-d*m-p*m-d*y),_=c*l,h=We*c,d=h-(h-c),p=c-d,h=We*l,m=h-(h-l),y=l-m,M=p*y-(_-d*m-p*m-d*y),g=v-M,f=v-g,tr[0]=v-(g+f)+(f-M),b=w+g,f=b-w,x=w-(b-f)+(g-f),g=x-_,f=x-g,tr[1]=x-(g+f)+(f-_),E=b+g,f=E-b,tr[2]=b-(E-f)+(g-f),tr[3]=E;let C=Uc(D,K8,4,tr,J8);return J8[C-1]}function xu(e,t,n,r,i,o){let s=(t-o)*(n-i),a=(e-i)*(r-o),c=s-a,l=Math.abs(s+a);return Math.abs(c)>=sP*l?c:-lP(e,t,n,r,i,o,l)}var Syt=(7+56*Qt)*Qt,Myt=(3+28*Qt)*Qt,Iyt=(26+288*Qt)*Qt*Qt,Ayt=V(4),Tyt=V(4),Eyt=V(4),Dyt=V(4),Nyt=V(4),Oyt=V(4),Byt=V(4),Lyt=V(4),Fyt=V(4),Cyt=V(8),Ryt=V(8),kyt=V(8),$yt=V(4),Uyt=V(8),Pyt=V(8),zyt=V(8),qyt=V(12),Vyt=V(192),jyt=V(192);var Gyt=(10+96*Qt)*Qt,Xyt=(4+48*Qt)*Qt,Hyt=(44+576*Qt)*Qt*Qt,Zyt=V(4),Qyt=V(4),Kyt=V(4),Jyt=V(4),t0t=V(4),e0t=V(4),n0t=V(4),r0t=V(4),i0t=V(8),o0t=V(8),s0t=V(8),a0t=V(8),c0t=V(8),l0t=V(8),u0t=V(8),f0t=V(8),h0t=V(8),d0t=V(4),p0t=V(4),m0t=V(4),y0t=V(8),g0t=V(16),b0t=V(16),x0t=V(16),w0t=V(32),_0t=V(32),v0t=V(48),S0t=V(64),M0t=V(1152),I0t=V(1152);var D0t=(16+224*Qt)*Qt,N0t=(5+72*Qt)*Qt,O0t=(71+1408*Qt)*Qt*Qt,B0t=V(4),L0t=V(4),F0t=V(4),C0t=V(4),R0t=V(4),k0t=V(4),$0t=V(4),U0t=V(4),P0t=V(4),z0t=V(4),q0t=V(24),V0t=V(24),j0t=V(24),Y0t=V(24),W0t=V(24),G0t=V(24),X0t=V(24),H0t=V(24),Z0t=V(24),Q0t=V(24),K0t=V(1152),J0t=V(1152),tgt=V(1152),egt=V(1152),ngt=V(1152),rgt=V(2304),igt=V(2304),ogt=V(3456),sgt=V(5760),agt=V(8),cgt=V(8),lgt=V(8),ugt=V(16),fgt=V(24),hgt=V(48),dgt=V(48),pgt=V(96),mgt=V(192),ygt=V(384),ggt=V(384),bgt=V(384),xgt=V(768);var wgt=V(96),_gt=V(96),vgt=V(96),Sgt=V(1152);var eE=Math.pow(2,-52),kg=new Uint32Array(512),_u=class e{static from(t,n=mP,r=yP){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),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 N=t[2*I],A=t[2*I+1];N<a&&(a=N),A<c&&(c=A),N>l&&(l=N),A>u&&(u=A),this._ids[I]=I}let f=(a+l)/2,h=(c+u)/2,d,p,m;for(let I=0,N=1/0;I<s;I++){let A=f2(f,h,t[2*I],t[2*I+1]);A<N&&(d=I,N=A)}let y=t[2*d],g=t[2*d+1];for(let I=0,N=1/0;I<s;I++){if(I===d)continue;let A=f2(y,g,t[2*I],t[2*I+1]);A<N&&A>0&&(p=I,N=A)}let b=t[2*p],x=t[2*p+1],w=1/0;for(let I=0;I<s;I++){if(I===d||I===p)continue;let N=dP(y,g,b,x,t[2*I],t[2*I+1]);N<w&&(m=I,w=N)}let v=t[2*m],_=t[2*m+1];if(w===1/0){for(let A=0;A<s;A++)this._dists[A]=t[2*A]-t[0]||t[2*A+1]-t[1];wu(this._ids,this._dists,0,s-1);let I=new Uint32Array(s),N=0;for(let A=0,O=-1/0;A<s;A++){let L=this._ids[A],S=this._dists[L];S>O&&(I[N++]=L,O=S)}this.hull=I.subarray(0,N),this.triangles=new Uint32Array(0),this.halfedges=new Uint32Array(0);return}if(xu(y,g,b,x,v,_)<0){let I=p,N=b,A=x;p=m,b=v,x=_,m=I,v=N,_=A}let M=pP(y,g,b,x,v,_);this._cx=M.x,this._cy=M.y;for(let I=0;I<s;I++)this._dists[I]=f2(t[2*I],t[2*I+1],M.x,M.y);wu(this._ids,this._dists,0,s-1),this._hullStart=d;let E=3;r[d]=n[m]=p,r[p]=n[d]=m,r[m]=n[p]=d,i[d]=0,i[p]=1,i[m]=2,o.fill(-1),o[this._hashKey(y,g)]=d,o[this._hashKey(b,x)]=p,o[this._hashKey(v,_)]=m,this.trianglesLen=0,this._addTriangle(d,p,m,-1,-1,-1);for(let I=0,N,A;I<this._ids.length;I++){let O=this._ids[I],L=t[2*O],S=t[2*O+1];if(I>0&&Math.abs(L-N)<=eE&&Math.abs(S-A)<=eE||(N=L,A=S,O===d||O===p||O===m))continue;let T=0;for(let k=0,$=this._hashKey(L,S);k<this._hashSize&&(T=o[($+k)%this._hashSize],!(T!==-1&&T!==r[T]));k++);T=n[T];let D=T,C;for(;C=r[D],xu(L,S,t[2*D],t[2*D+1],t[2*C],t[2*C+1])>=0;)if(D=C,D===T){D=-1;break}if(D===-1)continue;let R=this._addTriangle(D,O,r[D],-1,-1,i[D]);i[O]=this._legalize(R+2),i[D]=R,E++;let F=r[D];for(;C=r[F],xu(L,S,t[2*F],t[2*F+1],t[2*C],t[2*C+1])<0;)R=this._addTriangle(F,O,C,i[O],-1,i[F]),i[O]=this._legalize(R+2),r[F]=F,E--,F=C;if(D===T)for(;C=n[D],xu(L,S,t[2*C],t[2*C+1],t[2*D],t[2*D+1])<0;)R=this._addTriangle(C,O,D,-1,i[D],i[C]),this._legalize(R+2),i[C]=R,r[D]=D,E--,D=C;this._hullStart=n[O]=D,r[D]=n[F]=O,r[O]=F,o[this._hashKey(L,S)]=O,o[this._hashKey(t[2*D],t[2*D+1])]=D}this.hull=new Uint32Array(E);for(let I=0,N=this._hullStart;I<E;I++)this.hull[I]=N,N=r[N];this.triangles=this._triangles.subarray(0,this.trianglesLen),this.halfedges=this._halfedges.subarray(0,this.trianglesLen)}_hashKey(t,n){return Math.floor(fP(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=kg[--o];continue}let l=a-a%3,u=c+(t+1)%3,f=l+(a+2)%3,h=n[s],d=n[t],p=n[u],m=n[f];if(hP(i[2*h],i[2*h+1],i[2*d],i[2*d+1],i[2*p],i[2*p+1],i[2*m],i[2*m+1])){n[t]=m,n[a]=h;let g=r[f];if(g===-1){let x=this._hullStart;do{if(this._hullTri[x]===f){this._hullTri[x]=t;break}x=this._hullPrev[x]}while(x!==this._hullStart)}this._link(t,g),this._link(a,r[s]),this._link(s,f);let b=l+(a+1)%3;o<kg.length&&(kg[o++]=b)}else{if(o===0)break;t=kg[--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 fP(e,t){let n=e/(Math.abs(e)+Math.abs(t));return(t>0?3-n:1+n)/4}function f2(e,t,n,r){let i=e-n,o=t-r;return i*i+o*o}function hP(e,t,n,r,i,o,s,a){let c=e-s,l=t-a,u=n-s,f=r-a,h=i-s,d=o-a,p=c*c+l*l,m=u*u+f*f,y=h*h+d*d;return c*(f*y-m*d)-l*(u*y-m*h)+p*(u*d-f*h)<0}function dP(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,h=.5/(s*l-a*c),d=(l*u-a*f)*h,p=(s*f-c*u)*h;return d*d+p*p}function pP(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,h=.5/(s*l-a*c),d=e+(l*u-a*f)*h,p=t+(s*f-c*u)*h;return{x:d,y:p}}function wu(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;Gd(e,i,o),t[e[n]]>t[e[r]]&&Gd(e,n,r),t[e[o]]>t[e[r]]&&Gd(e,o,r),t[e[n]]>t[e[o]]&&Gd(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;Gd(e,o,s)}e[n+1]=e[s],e[s]=a,r-o+1>=s-n?(wu(e,t,o,r),wu(e,t,n,s-1)):(wu(e,t,n,s-1),wu(e,t,o,r))}}function Gd(e,t,n){let r=e[t];e[t]=e[n],e[n]=r}function mP(e){return e[0]}function yP(e){return e[1]}var ti=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 xa=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 Xd=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,y=0,g=r.length,b,x;m<g;m+=3,y+=2){let w=r[m]*2,v=r[m+1]*2,_=r[m+2]*2,M=t[w],E=t[w+1],I=t[v],N=t[v+1],A=t[_],O=t[_+1],L=I-M,S=N-E,T=A-M,D=O-E,C=(L*D-S*T)*2;if(Math.abs(C)<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)*D-(s-E)*T);b=(M+A)/2-R*D,x=(E+O)/2+R*T}else{let R=1/C,F=L*L+S*S,k=T*T+D*D;b=M+(D*F-S*k)*R,x=E+(L*k-T*F)*R}a[y]=b,a[y+1]=x}let c=n[n.length-1],l,u=c*4,f,h=t[2*c],d,p=t[2*c+1];i.fill(0);for(let m=0;m<n.length;++m)c=n[m],l=u,f=h,d=p,u=c*4,h=t[2*c],p=t[2*c+1],i[l+2]=i[u]=d-p,i[l+3]=i[u+1]=h-f}render(t){let n=t==null?t=new ti: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 h=r[u];if(h<u)continue;let d=Math.floor(u/3)*2,p=Math.floor(h/3)*2,m=s[d],y=s[d+1],g=s[p],b=s[p+1];this._renderSegment(m,y,g,b,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,h=s[f],d=s[f+1],p=c*4,m=this._project(h,d,a[p+2],a[p+3]);m&&this._renderSegment(h,d,m[0],m[1],t)}return n&&n.value()}renderBounds(t){let n=t==null?t=new ti: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 ti: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 xa;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,h=0;for(let d=0;d<r;d+=2)if(o=a,s=c,a=n[d],c=n[d+1],l=u,u=this._regioncode(a,c),l===0&&u===0)f=h,h=0,i?i.push(a,c):i=[a,c];else{let p,m,y,g,b;if(l===0){if((p=this._clipSegment(o,s,a,c,l,u))===null)continue;[m,y,g,b]=p}else{if((p=this._clipSegment(a,c,o,s,u,l))===null)continue;[g,b,m,y]=p,f=h,h=this._edgecode(m,y),f&&h&&this._edge(t,f,h,i,i.length),i?i.push(m,y):i=[m,y]}f=h,h=this._edgecode(g,b),f&&h&&this._edge(t,f,h,i,i.length),i?i.push(g,b):i=[g,b]}if(i)f=h,h=this._edgecode(i[0],i[1]),f&&h&&this._edge(t,f,h,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,h=this._edgecode(a[u-2],a[u-1]);l<u;l+=2)f=h,h=this._edgecode(a[l],a[l+1]),f&&h&&(l=this._edge(t,f,h,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 gP=2*Math.PI,vu=Math.pow;function bP(e){return e[0]}function xP(e){return e[1]}function wP(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 _P(e,t,n){return[e+Math.sin(e+t)*n,t+Math.cos(e-t)*n]}var ei=class e{static from(t,n=bP,r=xP,i){return new e("length"in t?vP(t,n,r,i):Float64Array.from(SP(t,n,r,i)))}constructor(t){this._delaunator=new _u(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&&wP(t)){this.collinear=Int32Array.from({length:n.length/2},(h,d)=>d).sort((h,d)=>n[2*h]-n[2*d]||n[2*h+1]-n[2*d+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 h=0,d=n.length/2;h<d;++h){let p=_P(n[2*h],n[2*h+1],f);n[2*h]=p[0],n[2*h+1]=p[1]}this._delaunator=new _u(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 Xd(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=vu(n-l[t*2],2)+vu(r-l[t*2+1],2),h=i[t],d=h;do{let p=c[d],m=vu(n-l[p*2],2)+vu(r-l[p*2+1],2);if(m<f&&(f=m,u=p),d=d%3===2?d-2:d+1,c[d]!==t)break;if(d=a[d],d===-1){if(d=o[(s[t]+1)%o.length],d!==p&&vu(n-l[d*2],2)+vu(r-l[d*2+1],2)<f)return d;break}}while(d!==h);return u}render(t){let n=t==null?t=new ti: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 ti: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,gP)}return r&&r.value()}renderHull(t){let n=t==null?t=new ti: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 xa;return this.renderHull(t),t.value()}renderTriangle(t,n){let r=n==null?n=new ti: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 xa;return this.renderTriangle(t,n),n.value()}};function vP(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*SP(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 nE(e){return Math.abs(e=Math.round(e))>=1e21?e.toLocaleString("en").replace(/,/g,""):e.toString(10)}function Pc(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 yo(e){return e=Pc(Math.abs(e)),e?e[1]:NaN}function rE(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 iE(e){return function(t){return t.replace(/[0-9]/g,function(n){return e[+n]})}}var MP=/^(?:(.)?([<>=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i;function go(e){if(!(t=MP.exec(e)))throw new Error("invalid format: "+e);var t;return new $g({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]})}go.prototype=$g.prototype;function $g(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+""}$g.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 oE(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 h2;function sE(e,t){var n=Pc(e,t);if(!n)return e+"";var r=n[0],i=n[1],o=i-(h2=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")+Pc(e,Math.max(0,t+o-1))[0]}function d2(e,t){var n=Pc(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 p2={"%":(e,t)=>(e*100).toFixed(t),b:e=>Math.round(e).toString(2),c:e=>e+"",d:nE,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)=>d2(e*100,t),r:d2,s:sE,X:e=>Math.round(e).toString(16).toUpperCase(),x:e=>Math.round(e).toString(16)};function m2(e){return e}var aE=Array.prototype.map,cE=["y","z","a","f","p","n","\xB5","m","","k","M","G","T","P","E","Z","Y"];function lE(e){var t=e.grouping===void 0||e.thousands===void 0?m2:rE(aE.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?m2:iE(aE.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=go(f);var h=f.fill,d=f.align,p=f.sign,m=f.symbol,y=f.zero,g=f.width,b=f.comma,x=f.precision,w=f.trim,v=f.type;v==="n"?(b=!0,v="g"):p2[v]||(x===void 0&&(x=12),w=!0,v="g"),(y||h==="0"&&d==="=")&&(y=!0,h="0",d="=");var _=m==="$"?n:m==="#"&&/[boxX]/.test(v)?"0"+v.toLowerCase():"",M=m==="$"?r:/[%p]/.test(v)?s:"",E=p2[v],I=/[defgprs%]/.test(v);x=x===void 0?6:/[gprs]/.test(v)?Math.max(1,Math.min(21,x)):Math.max(0,Math.min(20,x));function N(A){var O=_,L=M,S,T,D;if(v==="c")L=E(A)+L,A="";else{A=+A;var C=A<0||1/A<0;if(A=isNaN(A)?c:E(Math.abs(A),x),w&&(A=oE(A)),C&&+A==0&&p!=="+"&&(C=!1),O=(C?p==="("?p:a:p==="-"||p==="("?"":p)+O,L=(v==="s"?cE[8+h2/3]:"")+L+(C&&p==="("?")":""),I){for(S=-1,T=A.length;++S<T;)if(D=A.charCodeAt(S),48>D||D>57){L=(D===46?i+A.slice(S+1):A.slice(S))+L,A=A.slice(0,S);break}}}b&&!y&&(A=t(A,1/0));var R=O.length+A.length+L.length,F=R<g?new Array(g-R+1).join(h):"";switch(b&&y&&(A=t(F+A,F.length?g-L.length:1/0),F=""),d){case"<":A=O+A+L+F;break;case"=":A=O+F+A+L;break;case"^":A=F.slice(0,R=F.length>>1)+O+A+L+F.slice(R);break;default:A=F+O+A+L;break}return o(A)}return N.toString=function(){return f+""},N}function u(f,h){var d=l((f=go(f),f.type="f",f)),p=Math.max(-8,Math.min(8,Math.floor(yo(h)/3)))*3,m=Math.pow(10,-p),y=cE[8+p/3];return function(g){return d(m*g)+y}}return{format:l,formatPrefix:u}}var Ug,ni,Pg;y2({thousands:",",grouping:[3],currency:["$",""]});function y2(e){return Ug=lE(e),ni=Ug.format,Pg=Ug.formatPrefix,Ug}function g2(e){return Math.max(0,-yo(Math.abs(e)))}function b2(e,t){return Math.max(0,Math.max(-8,Math.min(8,Math.floor(yo(t)/3)))*3-yo(Math.abs(e)))}function x2(e,t){return e=Math.abs(e),t=Math.abs(t)-e,Math.max(0,yo(t)-yo(e))+1}var tt=1e-6,zc=1e-12,Dt=Math.PI,de=Dt/2,w2=Dt/4,cn=Dt*2,Ce=180/Dt,zt=Dt/180,Rt=Math.abs,ri=Math.atan,Ge=Math.atan2,K=Math.cos,Hd=Math.ceil,zg=Math.exp;var qg=Math.hypot,qc=Math.log,Vg=Math.pow,Q=Math.sin,$n=Math.sign||function(e){return e>0?1:e<0?-1:0},pe=Math.sqrt,Su=Math.tan;function jg(e){return e>1?0:e<-1?Dt:Math.acos(e)}function _e(e){return e>1?de:e<-1?-de:Math.asin(e)}function Xe(){}function Yg(e,t){e&&fE.hasOwnProperty(e.type)&&fE[e.type](e,t)}var uE={Feature:function(e,t){Yg(e.geometry,t)},FeatureCollection:function(e,t){for(var n=e.features,r=-1,i=n.length;++r<i;)Yg(n[r].geometry,t)}},fE={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){_2(e.coordinates,t,0)},MultiLineString:function(e,t){for(var n=e.coordinates,r=-1,i=n.length;++r<i;)_2(n[r],t,0)},Polygon:function(e,t){hE(e.coordinates,t)},MultiPolygon:function(e,t){for(var n=e.coordinates,r=-1,i=n.length;++r<i;)hE(n[r],t)},GeometryCollection:function(e,t){for(var n=e.geometries,r=-1,i=n.length;++r<i;)Yg(n[r],t)}};function _2(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 hE(e,t){var n=-1,r=e.length;for(t.polygonStart();++n<r;)_2(e[n],t,1);t.polygonEnd()}function Nr(e,t){e&&uE.hasOwnProperty(e.type)?uE[e.type](e,t):Yg(e,t)}function Zd(e){return[Ge(e[1],e[0]),_e(e[2])]}function bo(e){var t=e[0],n=e[1],r=K(n);return[r*K(t),r*Q(t),Q(n)]}function Qd(e,t){return e[0]*t[0]+e[1]*t[1]+e[2]*t[2]}function Mu(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 Wg(e,t){e[0]+=t[0],e[1]+=t[1],e[2]+=t[2]}function Kd(e,t){return[e[0]*t,e[1]*t,e[2]*t]}function Jd(e){var t=pe(e[0]*e[0]+e[1]*e[1]+e[2]*e[2]);e[0]/=t,e[1]/=t,e[2]/=t}var tp,Gg,Xg,Hg,Zg,Qg,Kg,Jg,v2,S2,M2,mE,yE,er,nr,rr,Oi={sphere:Xe,point:I2,lineStart:dE,lineEnd:pE,polygonStart:function(){Oi.lineStart=TP,Oi.lineEnd=EP},polygonEnd:function(){Oi.lineStart=dE,Oi.lineEnd=pE}};function I2(e,t){e*=zt,t*=zt;var n=K(t);ep(n*K(e),n*Q(e),Q(t))}function ep(e,t,n){++tp,Xg+=(e-Xg)/tp,Hg+=(t-Hg)/tp,Zg+=(n-Zg)/tp}function dE(){Oi.point=IP}function IP(e,t){e*=zt,t*=zt;var n=K(t);er=n*K(e),nr=n*Q(e),rr=Q(t),Oi.point=AP,ep(er,nr,rr)}function AP(e,t){e*=zt,t*=zt;var n=K(t),r=n*K(e),i=n*Q(e),o=Q(t),s=Ge(pe((s=nr*o-rr*i)*s+(s=rr*r-er*o)*s+(s=er*i-nr*r)*s),er*r+nr*i+rr*o);Gg+=s,Qg+=s*(er+(er=r)),Kg+=s*(nr+(nr=i)),Jg+=s*(rr+(rr=o)),ep(er,nr,rr)}function pE(){Oi.point=I2}function TP(){Oi.point=DP}function EP(){gE(mE,yE),Oi.point=I2}function DP(e,t){mE=e,yE=t,e*=zt,t*=zt,Oi.point=gE;var n=K(t);er=n*K(e),nr=n*Q(e),rr=Q(t),ep(er,nr,rr)}function gE(e,t){e*=zt,t*=zt;var n=K(t),r=n*K(e),i=n*Q(e),o=Q(t),s=nr*o-rr*i,a=rr*r-er*o,c=er*i-nr*r,l=qg(s,a,c),u=_e(l),f=l&&-u/l;v2.add(f*s),S2.add(f*a),M2.add(f*c),Gg+=u,Qg+=u*(er+(er=r)),Kg+=u*(nr+(nr=i)),Jg+=u*(rr+(rr=o)),ep(er,nr,rr)}function A2(e){tp=Gg=Xg=Hg=Zg=Qg=Kg=Jg=0,v2=new Sn,S2=new Sn,M2=new Sn,Nr(e,Oi);var t=+v2,n=+S2,r=+M2,i=qg(t,n,r);return i<zc&&(t=Qg,n=Kg,r=Jg,Gg<tt&&(t=Xg,n=Hg,r=Zg),i=qg(t,n,r),i<zc)?[NaN,NaN]:[Ge(n,t)*Ce,_e(r/i)*Ce]}function np(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 T2(e,t){return Rt(e)>Dt&&(e-=Math.round(e/cn)*cn),[e,t]}T2.invert=T2;function E2(e,t,n){return(e%=cn)?t||n?np(xE(e),wE(t,n)):xE(e):t||n?wE(t,n):T2}function bE(e){return function(t,n){return t+=e,Rt(t)>Dt&&(t-=Math.round(t/cn)*cn),[t,n]}}function xE(e){var t=bE(e);return t.invert=bE(-e),t}function wE(e,t){var n=K(e),r=Q(e),i=K(t),o=Q(t);function s(a,c){var l=K(c),u=K(a)*l,f=Q(a)*l,h=Q(c),d=h*n+u*r;return[Ge(f*i-d*o,u*n-h*r),_e(d*i+f*o)]}return s.invert=function(a,c){var l=K(c),u=K(a)*l,f=Q(a)*l,h=Q(c),d=h*i-f*o;return[Ge(f*i+h*o,u*n+d*r),_e(d*n-u*r)]},s}function _E(e){e=E2(e[0]*zt,e[1]*zt,e.length>2?e[2]*zt:0);function t(n){return n=e(n[0]*zt,n[1]*zt),n[0]*=Ce,n[1]*=Ce,n}return t.invert=function(n){return n=e.invert(n[0]*zt,n[1]*zt),n[0]*=Ce,n[1]*=Ce,n},t}function SE(e,t,n,r,i,o){if(n){var s=K(t),a=Q(t),c=r*n;i==null?(i=t+r*cn,o=t-c/2):(i=vE(s,i),o=vE(s,o),(r>0?i<o:i>o)&&(i+=r*cn));for(var l,u=i;r>0?u>o:u<o;u-=c)l=Zd([s,-a*K(u),-a*Q(u)]),e.point(l[0],l[1])}}function vE(e,t){t=bo(t),t[0]-=e,Jd(t);var n=jg(-t[1]);return((-t[2]<0?-n:n)+cn-tt)%cn}function tb(){var e=[],t;return{point:function(n,r,i){t.push([n,r,i])},lineStart:function(){e.push(t=[])},lineEnd:Xe,rejoin:function(){e.length>1&&e.push(e.pop().concat(e.shift()))},result:function(){var n=e;return e=[],t=null,n}}}function Iu(e,t){return Rt(e[0]-t[0])<tt&&Rt(e[1]-t[1])<tt}function eb(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 nb(e,t,n,r,i){var o=[],s=[],a,c;if(e.forEach(function(p){if(!((m=p.length-1)<=0)){var m,y=p[0],g=p[m],b;if(Iu(y,g)){if(!y[2]&&!g[2]){for(i.lineStart(),a=0;a<m;++a)i.point((y=p[a])[0],y[1]);i.lineEnd();return}g[0]+=2*tt}o.push(b=new eb(y,p,null,!0)),s.push(b.o=new eb(y,null,b,!1)),o.push(b=new eb(g,p,null,!1)),s.push(b.o=new eb(g,null,b,!0))}}),!!o.length){for(s.sort(t),ME(o),ME(s),a=0,c=s.length;a<c;++a)s[a].e=n=!n;for(var l=o[0],u,f;;){for(var h=l,d=!0;h.v;)if((h=h.n)===l)return;u=h.z,i.lineStart();do{if(h.v=h.o.v=!0,h.e){if(d)for(a=0,c=u.length;a<c;++a)i.point((f=u[a])[0],f[1]);else r(h.x,h.n.x,1,i);h=h.n}else{if(d)for(u=h.p.z,a=u.length-1;a>=0;--a)i.point((f=u[a])[0],f[1]);else r(h.x,h.p.x,-1,i);h=h.p}h=h.o,u=h.z,d=!d}while(!h.v);i.lineEnd()}}}function ME(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 D2(e){return Rt(e[0])<=Dt?e[0]:$n(e[0])*((Rt(e[0])+Dt)%cn-Dt)}function IE(e,t){var n=D2(t),r=t[1],i=Q(r),o=[Q(n),-K(n),0],s=0,a=0,c=new Sn;i===1?r=de+tt:i===-1&&(r=-de-tt);for(var l=0,u=e.length;l<u;++l)if(h=(f=e[l]).length)for(var f,h,d=f[h-1],p=D2(d),m=d[1]/2+w2,y=Q(m),g=K(m),b=0;b<h;++b,p=w,y=_,g=M,d=x){var x=f[b],w=D2(x),v=x[1]/2+w2,_=Q(v),M=K(v),E=w-p,I=E>=0?1:-1,N=I*E,A=N>Dt,O=y*_;if(c.add(Ge(O*I*Q(N),g*M+O*K(N))),s+=A?E+I*cn:E,A^p>=n^w>=n){var L=Mu(bo(d),bo(x));Jd(L);var S=Mu(o,L);Jd(S);var T=(A^E>=0?-1:1)*_e(S[2]);(r>T||r===T&&(L[0]||L[1]))&&(a+=A^E>=0?1:-1)}}return(s<-tt||s<tt&&c<-zc)^a&1}function rb(e,t,n,r){return function(i){var o=t(i),s=tb(),a=t(s),c=!1,l,u,f,h={point:d,lineStart:m,lineEnd:y,polygonStart:function(){h.point=g,h.lineStart=b,h.lineEnd=x,u=[],l=[]},polygonEnd:function(){h.point=d,h.lineStart=m,h.lineEnd=y,u=su(u);var w=IE(l,r);u.length?(c||(i.polygonStart(),c=!0),nb(u,OP,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 d(w,v){e(w,v)&&i.point(w,v)}function p(w,v){o.point(w,v)}function m(){h.point=p,o.lineStart()}function y(){h.point=d,o.lineEnd()}function g(w,v){f.push([w,v]),a.point(w,v)}function b(){a.lineStart(),f=[]}function x(){g(f[0][0],f[0][1]),a.lineEnd();var w=a.clean(),v=s.result(),_,M=v.length,E,I,N;if(f.pop(),l.push(f),f=null,!!M){if(w&1){if(I=v[0],(E=I.length-1)>0){for(c||(i.polygonStart(),c=!0),i.lineStart(),_=0;_<E;++_)i.point((N=I[_])[0],N[1]);i.lineEnd()}return}M>1&&w&2&&v.push(v.pop().concat(v.shift())),u.push(v.filter(NP))}}return h}}function NP(e){return e.length>1}function OP(e,t){return((e=e.x)[0]<0?e[1]-de-tt:de-e[1])-((t=t.x)[0]<0?t[1]-de-tt:de-t[1])}var N2=rb(function(){return!0},BP,FP,[-Dt,-de]);function BP(e){var t=NaN,n=NaN,r=NaN,i;return{lineStart:function(){e.lineStart(),i=1},point:function(o,s){var a=o>0?Dt:-Dt,c=Rt(o-t);Rt(c-Dt)<tt?(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>=Dt&&(Rt(t-r)<tt&&(t-=r*tt),Rt(o-a)<tt&&(o-=a*tt),n=LP(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 LP(e,t,n,r){var i,o,s=Q(e-n);return Rt(s)>tt?ri((Q(t)*(o=K(r))*Q(n)-Q(r)*(i=K(t))*Q(e))/(i*o*s)):(t+r)/2}function FP(e,t,n,r){var i;if(e==null)i=n*de,r.point(-Dt,i),r.point(0,i),r.point(Dt,i),r.point(Dt,0),r.point(Dt,-i),r.point(0,-i),r.point(-Dt,-i),r.point(-Dt,0),r.point(-Dt,i);else if(Rt(e[0]-t[0])>tt){var o=e[0]<t[0]?Dt:-Dt;i=n*o/2,r.point(-o,i),r.point(0,i),r.point(o,i)}else r.point(t[0],t[1])}function AE(e){var t=K(e),n=6*zt,r=t>0,i=Rt(t)>tt;function o(u,f,h,d){SE(d,e,n,h,u,f)}function s(u,f){return K(u)*K(f)>t}function a(u){var f,h,d,p,m;return{lineStart:function(){p=d=!1,m=1},point:function(y,g){var b=[y,g],x,w=s(y,g),v=r?w?0:l(y,g):w?l(y+(y<0?Dt:-Dt),g):0;if(!f&&(p=d=w)&&u.lineStart(),w!==d&&(x=c(f,b),(!x||Iu(f,x)||Iu(b,x))&&(b[2]=1)),w!==d)m=0,w?(u.lineStart(),x=c(b,f),u.point(x[0],x[1])):(x=c(f,b),u.point(x[0],x[1],2),u.lineEnd()),f=x;else if(i&&f&&r^w){var _;!(v&h)&&(_=c(b,f,!0))&&(m=0,r?(u.lineStart(),u.point(_[0][0],_[0][1]),u.point(_[1][0],_[1][1]),u.lineEnd()):(u.point(_[1][0],_[1][1]),u.lineEnd(),u.lineStart(),u.point(_[0][0],_[0][1],3)))}w&&(!f||!Iu(f,b))&&u.point(b[0],b[1]),f=b,d=w,h=v},lineEnd:function(){d&&u.lineEnd(),f=null},clean:function(){return m|(p&&d)<<1}}}function c(u,f,h){var d=bo(u),p=bo(f),m=[1,0,0],y=Mu(d,p),g=Qd(y,y),b=y[0],x=g-b*b;if(!x)return!h&&u;var w=t*g/x,v=-t*b/x,_=Mu(m,y),M=Kd(m,w),E=Kd(y,v);Wg(M,E);var I=_,N=Qd(M,I),A=Qd(I,I),O=N*N-A*(Qd(M,M)-1);if(!(O<0)){var L=pe(O),S=Kd(I,(-N-L)/A);if(Wg(S,M),S=Zd(S),!h)return S;var T=u[0],D=f[0],C=u[1],R=f[1],F;D<T&&(F=T,T=D,D=F);var k=D-T,$=Rt(k-Dt)<tt,U=$||k<tt;if(!$&&R<C&&(F=C,C=R,R=F),U?$?C+R>0^S[1]<(Rt(S[0]-T)<tt?C:R):C<=S[1]&&S[1]<=R:k>Dt^(T<=S[0]&&S[0]<=D)){var G=Kd(I,(-N+L)/A);return Wg(G,M),[S,Zd(G)]}}}function l(u,f){var h=r?e:Dt-e,d=0;return u<-h?d|=1:u>h&&(d|=2),f<-h?d|=4:f>h&&(d|=8),d}return rb(s,a,o,r?[0,-e]:[-Dt,e-Dt])}function TE(e,t,n,r,i,o){var s=e[0],a=e[1],c=t[0],l=t[1],u=0,f=1,h=c-s,d=l-a,p;if(p=n-s,!(!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=i-s,!(!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)}if(p=r-a,!(!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=o-a,!(!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)}return u>0&&(e[0]=s+u*h,e[1]=a+u*d),f<1&&(t[0]=s+f*h,t[1]=a+f*d),!0}}}}}var rp=1e9,ib=-rp;function Au(e,t,n,r){function i(l,u){return e<=l&&l<=n&&t<=u&&u<=r}function o(l,u,f,h){var d=0,p=0;if(l==null||(d=s(l,f))!==(p=s(u,f))||c(l,u)<0^f>0)do h.point(d===0||d===3?e:n,d>1?r:t);while((d=(d+f+4)%4)!==p);else h.point(u[0],u[1])}function s(l,u){return Rt(l[0]-e)<tt?u>0?0:3:Rt(l[0]-n)<tt?u>0?2:1:Rt(l[1]-t)<tt?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),h=s(u,1);return f!==h?f-h: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=tb(),h,d,p,m,y,g,b,x,w,v,_,M={point:E,lineStart:O,lineEnd:L,polygonStart:N,polygonEnd:A};function E(T,D){i(T,D)&&u.point(T,D)}function I(){for(var T=0,D=0,C=d.length;D<C;++D)for(var R=d[D],F=1,k=R.length,$=R[0],U,G,et=$[0],rt=$[1];F<k;++F)U=et,G=rt,$=R[F],et=$[0],rt=$[1],G<=r?rt>r&&(et-U)*(r-G)>(rt-G)*(e-U)&&++T:rt<=r&&(et-U)*(r-G)<(rt-G)*(e-U)&&--T;return T}function N(){u=f,h=[],d=[],_=!0}function A(){var T=I(),D=_&&T,C=(h=su(h)).length;(D||C)&&(l.polygonStart(),D&&(l.lineStart(),o(null,null,1,l),l.lineEnd()),C&&nb(h,a,T,o,l),l.polygonEnd()),u=l,h=d=p=null}function O(){M.point=S,d&&d.push(p=[]),v=!0,w=!1,b=x=NaN}function L(){h&&(S(m,y),g&&w&&f.rejoin(),h.push(f.result())),M.point=E,w&&u.lineEnd()}function S(T,D){var C=i(T,D);if(d&&p.push([T,D]),v)m=T,y=D,g=C,v=!1,C&&(u.lineStart(),u.point(T,D));else if(C&&w)u.point(T,D);else{var R=[b=Math.max(ib,Math.min(rp,b)),x=Math.max(ib,Math.min(rp,x))],F=[T=Math.max(ib,Math.min(rp,T)),D=Math.max(ib,Math.min(rp,D))];TE(R,F,e,t,n,r)?(w||(u.lineStart(),u.point(R[0],R[1])),u.point(F[0],F[1]),C||u.lineEnd(),_=!1):C&&(u.lineStart(),u.point(T,D),_=!1)}b=T,x=D,w=C}return M}}function EE(e,t,n){var r=ke(e,t-tt,n).concat(t);return function(i){return r.map(function(o){return[i,o]})}}function DE(e,t,n){var r=ke(e,t-tt,n).concat(t);return function(i){return r.map(function(o){return[o,i]})}}function O2(){var e,t,n,r,i,o,s,a,c=10,l=c,u=90,f=360,h,d,p,m,y=2.5;function g(){return{type:"MultiLineString",coordinates:b()}}function b(){return ke(Hd(r/u)*u,n,u).map(p).concat(ke(Hd(a/f)*f,s,f).map(m)).concat(ke(Hd(t/c)*c,e,c).filter(function(x){return Rt(x%u)>tt}).map(h)).concat(ke(Hd(o/l)*l,i,l).filter(function(x){return Rt(x%f)>tt}).map(d))}return g.lines=function(){return b().map(function(x){return{type:"LineString",coordinates:x}})},g.outline=function(){return{type:"Polygon",coordinates:[p(r).concat(m(s).slice(1),p(n).reverse().slice(1),m(a).reverse().slice(1))]}},g.extent=function(x){return arguments.length?g.extentMajor(x).extentMinor(x):g.extentMinor()},g.extentMajor=function(x){return arguments.length?(r=+x[0][0],n=+x[1][0],a=+x[0][1],s=+x[1][1],r>n&&(x=r,r=n,n=x),a>s&&(x=a,a=s,s=x),g.precision(y)):[[r,a],[n,s]]},g.extentMinor=function(x){return arguments.length?(t=+x[0][0],e=+x[1][0],o=+x[0][1],i=+x[1][1],t>e&&(x=t,t=e,e=x),o>i&&(x=o,o=i,i=x),g.precision(y)):[[t,o],[e,i]]},g.step=function(x){return arguments.length?g.stepMajor(x).stepMinor(x):g.stepMinor()},g.stepMajor=function(x){return arguments.length?(u=+x[0],f=+x[1],g):[u,f]},g.stepMinor=function(x){return arguments.length?(c=+x[0],l=+x[1],g):[c,l]},g.precision=function(x){return arguments.length?(y=+x,h=EE(o,i,90),d=DE(t,e,y),p=EE(a,s,90),m=DE(r,n,y),g):y},g.extentMajor([[-180,-90+tt],[180,90-tt]]).extentMinor([[-180,-80-tt],[180,80+tt]])}function B2(){return O2()()}var ip=e=>e;var L2=new Sn,F2=new Sn,NE,OE,C2,R2,wa={point:Xe,lineStart:Xe,lineEnd:Xe,polygonStart:function(){wa.lineStart=CP,wa.lineEnd=kP},polygonEnd:function(){wa.lineStart=wa.lineEnd=wa.point=Xe,L2.add(Rt(F2)),F2=new Sn},result:function(){var e=L2/2;return L2=new Sn,e}};function CP(){wa.point=RP}function RP(e,t){wa.point=BE,NE=C2=e,OE=R2=t}function BE(e,t){F2.add(R2*e-C2*t),C2=e,R2=t}function kP(){BE(NE,OE)}var k2=wa;var Tu=1/0,ob=Tu,op=-Tu,sb=op,$P={point:UP,lineStart:Xe,lineEnd:Xe,polygonStart:Xe,polygonEnd:Xe,result:function(){var e=[[Tu,ob],[op,sb]];return op=sb=-(ob=Tu=1/0),e}};function UP(e,t){e<Tu&&(Tu=e),e>op&&(op=e),t<ob&&(ob=t),t>sb&&(sb=t)}var Eu=$P;var $2=0,U2=0,sp=0,ab=0,cb=0,Du=0,P2=0,z2=0,ap=0,CE,RE,xo,wo,Bi={point:Vc,lineStart:LE,lineEnd:FE,polygonStart:function(){Bi.lineStart=qP,Bi.lineEnd=VP},polygonEnd:function(){Bi.point=Vc,Bi.lineStart=LE,Bi.lineEnd=FE},result:function(){var e=ap?[P2/ap,z2/ap]:Du?[ab/Du,cb/Du]:sp?[$2/sp,U2/sp]:[NaN,NaN];return $2=U2=sp=ab=cb=Du=P2=z2=ap=0,e}};function Vc(e,t){$2+=e,U2+=t,++sp}function LE(){Bi.point=PP}function PP(e,t){Bi.point=zP,Vc(xo=e,wo=t)}function zP(e,t){var n=e-xo,r=t-wo,i=pe(n*n+r*r);ab+=i*(xo+e)/2,cb+=i*(wo+t)/2,Du+=i,Vc(xo=e,wo=t)}function FE(){Bi.point=Vc}function qP(){Bi.point=jP}function VP(){kE(CE,RE)}function jP(e,t){Bi.point=kE,Vc(CE=xo=e,RE=wo=t)}function kE(e,t){var n=e-xo,r=t-wo,i=pe(n*n+r*r);ab+=i*(xo+e)/2,cb+=i*(wo+t)/2,Du+=i,i=wo*e-xo*t,P2+=i*(xo+e),z2+=i*(wo+t),ap+=i*3,Vc(xo=e,wo=t)}var q2=Bi;function lb(e){this._context=e}lb.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,cn);break}}},result:Xe};var j2=new Sn,V2,$E,UE,cp,lp,ub={point:Xe,lineStart:function(){ub.point=YP},lineEnd:function(){V2&&PE($E,UE),ub.point=Xe},polygonStart:function(){V2=!0},polygonEnd:function(){V2=null},result:function(){var e=+j2;return j2=new Sn,e}};function YP(e,t){ub.point=PE,$E=cp=e,UE=lp=t}function PE(e,t){cp-=e,lp-=t,j2.add(pe(cp*cp+lp*lp)),cp=e,lp=t}var Y2=ub;var zE,fb,qE,VE,Nu=class{constructor(t){this._append=t==null?jE:WP(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!==qE||this._append!==fb){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`,qE=r,fb=this._append,VE=this._,this._=i}this._+=VE;break}}}result(){let t=this._;return this._="",t.length?t:null}};function jE(e){let t=1;this._+=e[0];for(let n=e.length;t<n;++t)this._+=arguments[t]+e[t]}function WP(e){let t=Math.floor(e);if(!(t>=0))throw new RangeError(`invalid digits: ${e}`);if(t>15)return jE;if(t!==zE){let n=10**t;zE=t,fb=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 fb}function Tn(e,t){let n=3,r=4.5,i,o;function s(a){return a&&(typeof r=="function"&&o.pointRadius(+r.apply(this,arguments)),Nr(a,i(o))),o.result()}return s.area=function(a){return Nr(a,i(k2)),k2.result()},s.measure=function(a){return Nr(a,i(Y2)),Y2.result()},s.bounds=function(a){return Nr(a,i(Eu)),Eu.result()},s.centroid=function(a){return Nr(a,i(q2)),q2.result()},s.projection=function(a){return arguments.length?(i=a==null?(e=null,ip):(e=a).stream,s):e},s.context=function(a){return arguments.length?(o=a==null?(t=null,new Nu(n)):new lb(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 Nu(n)),s},s.projection(e).digits(n).context(t)}function jc(e){return{stream:Ou(e)}}function Ou(e){return function(t){var n=new W2;for(var r in e)n[r]=e[r];return n.stream=t,n}}function W2(){}W2.prototype={constructor:W2,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 G2(e,t,n){var r=e.clipExtent&&e.clipExtent();return e.scale(150).translate([0,0]),r!=null&&e.clipExtent(null),Nr(n,e.stream(Eu)),t(Eu.result()),r!=null&&e.clipExtent(r),e}function up(e,t,n){return G2(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 hb(e,t,n){return up(e,[[0,0],t],n)}function db(e,t,n){return G2(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 pb(e,t,n){return G2(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 YE=16,GP=K(30*zt);function X2(e,t){return+t?HP(e,t):XP(e)}function XP(e){return Ou({point:function(t,n){t=e(t,n),this.stream.point(t[0],t[1])}})}function HP(e,t){function n(r,i,o,s,a,c,l,u,f,h,d,p,m,y){var g=l-r,b=u-i,x=g*g+b*b;if(x>4*t&&m--){var w=s+h,v=a+d,_=c+p,M=pe(w*w+v*v+_*_),E=_e(_/=M),I=Rt(Rt(_)-1)<tt||Rt(o-f)<tt?(o+f)/2:Ge(v,w),N=e(I,E),A=N[0],O=N[1],L=A-r,S=O-i,T=b*L-g*S;(T*T/x>t||Rt((g*L+b*S)/x-.5)>.3||s*h+a*d+c*p<GP)&&(n(r,i,o,s,a,c,A,O,I,w/=M,v/=M,_,m,y),y.point(A,O),n(A,O,I,w,v,_,l,u,f,h,d,p,m,y))}}return function(r){var i,o,s,a,c,l,u,f,h,d,p,m,y={point:g,lineStart:b,lineEnd:w,polygonStart:function(){r.polygonStart(),y.lineStart=v},polygonEnd:function(){r.polygonEnd(),y.lineStart=b}};function g(E,I){E=e(E,I),r.point(E[0],E[1])}function b(){f=NaN,y.point=x,r.lineStart()}function x(E,I){var N=bo([E,I]),A=e(E,I);n(f,h,u,d,p,m,f=A[0],h=A[1],u=E,d=N[0],p=N[1],m=N[2],YE,r),r.point(f,h)}function w(){y.point=g,r.lineEnd()}function v(){b(),y.point=_,y.lineEnd=M}function _(E,I){x(i=E,I),o=f,s=h,a=d,c=p,l=m,y.point=x}function M(){n(f,h,u,d,p,m,o,s,i,a,c,l,YE,r),y.lineEnd=w,w()}return y}}var ZP=Ou({point:function(e,t){this.stream.point(e*zt,t*zt)}});function QP(e){return Ou({point:function(t,n){var r=e(t,n);return this.stream.point(r[0],r[1])}})}function KP(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 WE(e,t,n,r,i,o){if(!o)return KP(e,t,n,r,i);var s=K(o),a=Q(o),c=s*e,l=a*e,u=s/e,f=a/e,h=(a*n-s*t)/e,d=(a*t+s*n)/e;function p(m,y){return m*=r,y*=i,[c*m-l*y+t,n-l*m-c*y]}return p.invert=function(m,y){return[r*(u*m-f*y+h),i*(d-f*m-u*y)]},p}function En(e){return H2(function(){return e})()}function H2(e){var t,n=150,r=480,i=250,o=0,s=0,a=0,c=0,l=0,u,f=0,h=1,d=1,p=null,m=N2,y=null,g,b,x,w=ip,v=.5,_,M,E,I,N;function A(T){return E(T[0]*zt,T[1]*zt)}function O(T){return T=E.invert(T[0],T[1]),T&&[T[0]*Ce,T[1]*Ce]}A.stream=function(T){return I&&N===T?I:I=ZP(QP(u)(m(_(w(N=T)))))},A.preclip=function(T){return arguments.length?(m=T,p=void 0,S()):m},A.postclip=function(T){return arguments.length?(w=T,y=g=b=x=null,S()):w},A.clipAngle=function(T){return arguments.length?(m=+T?AE(p=T*zt):(p=null,N2),S()):p*Ce},A.clipExtent=function(T){return arguments.length?(w=T==null?(y=g=b=x=null,ip):Au(y=+T[0][0],g=+T[0][1],b=+T[1][0],x=+T[1][1]),S()):y==null?null:[[y,g],[b,x]]},A.scale=function(T){return arguments.length?(n=+T,L()):n},A.translate=function(T){return arguments.length?(r=+T[0],i=+T[1],L()):[r,i]},A.center=function(T){return arguments.length?(o=T[0]%360*zt,s=T[1]%360*zt,L()):[o*Ce,s*Ce]},A.rotate=function(T){return arguments.length?(a=T[0]%360*zt,c=T[1]%360*zt,l=T.length>2?T[2]%360*zt:0,L()):[a*Ce,c*Ce,l*Ce]},A.angle=function(T){return arguments.length?(f=T%360*zt,L()):f*Ce},A.reflectX=function(T){return arguments.length?(h=T?-1:1,L()):h<0},A.reflectY=function(T){return arguments.length?(d=T?-1:1,L()):d<0},A.precision=function(T){return arguments.length?(_=X2(M,v=T*T),S()):pe(v)},A.fitExtent=function(T,D){return up(A,T,D)},A.fitSize=function(T,D){return hb(A,T,D)},A.fitWidth=function(T,D){return db(A,T,D)},A.fitHeight=function(T,D){return pb(A,T,D)};function L(){var T=WE(n,0,0,h,d,f).apply(null,t(o,s)),D=WE(n,r-T[0],i-T[1],h,d,f);return u=E2(a,c,l),M=np(t,D),E=np(u,M),_=X2(M,v),S()}function S(){return I=N=null,A}return function(){return t=e.apply(this,arguments),A.invert=t.invert&&O,L()}}function Bu(e){var t=0,n=Dt/3,r=H2(e),i=r(t,n);return i.parallels=function(o){return arguments.length?r(t=o[0]*zt,n=o[1]*zt):[t*Ce,n*Ce]},i}function GE(e){var t=K(e);function n(r,i){return[r*t,Q(i)/t]}return n.invert=function(r,i){return[r/t,_e(i*t)]},n}function XE(e,t){var n=Q(e),r=(n+Q(t))/2;if(Rt(r)<tt)return GE(e);var i=1+n*(2*r-n),o=pe(i)/r;function s(a,c){var l=pe(i-2*r*Q(c))/r;return[l*Q(a*=r),o-l*K(a)]}return s.invert=function(a,c){var l=o-c,u=Ge(a,Rt(l))*$n(l);return l*r<0&&(u-=Dt*$n(a)*$n(l)),[u/r,_e((i-(a*a+l*l)*r*r)/(2*r))]},s}function _a(){return Bu(XE).scale(155.424).center([0,33.6442])}function fp(){return _a().parallels([29.5,45.5]).scale(1070).translate([480,250]).rotate([96,0]).center([-.6,38.7])}function JP(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 Z2(){var e,t,n=fp(),r,i=_a().rotate([154,0]).center([-2,58.5]).parallels([55,65]),o,s=_a().rotate([157,0]).center([-3,19.9]).parallels([8,18]),a,c,l={point:function(h,d){c=[h,d]}};function u(h){var d=h[0],p=h[1];return c=null,r.point(d,p),c||(o.point(d,p),c)||(a.point(d,p),c)}u.invert=function(h){var d=n.scale(),p=n.translate(),m=(h[0]-p[0])/d,y=(h[1]-p[1])/d;return(y>=.12&&y<.234&&m>=-.425&&m<-.214?i:y>=.166&&y<.234&&m>=-.214&&m<-.115?s:n).invert(h)},u.stream=function(h){return e&&t===h?e:e=JP([n.stream(t=h),i.stream(h),s.stream(h)])},u.precision=function(h){return arguments.length?(n.precision(h),i.precision(h),s.precision(h),f()):n.precision()},u.scale=function(h){return arguments.length?(n.scale(h),i.scale(h*.35),s.scale(h),u.translate(n.translate())):n.scale()},u.translate=function(h){if(!arguments.length)return n.translate();var d=n.scale(),p=+h[0],m=+h[1];return r=n.translate(h).clipExtent([[p-.455*d,m-.238*d],[p+.455*d,m+.238*d]]).stream(l),o=i.translate([p-.307*d,m+.201*d]).clipExtent([[p-.425*d+tt,m+.12*d+tt],[p-.214*d-tt,m+.234*d-tt]]).stream(l),a=s.translate([p-.205*d,m+.212*d]).clipExtent([[p-.214*d+tt,m+.166*d+tt],[p-.115*d-tt,m+.234*d-tt]]).stream(l),f()},u.fitExtent=function(h,d){return up(u,h,d)},u.fitSize=function(h,d){return hb(u,h,d)},u.fitWidth=function(h,d){return db(u,h,d)},u.fitHeight=function(h,d){return pb(u,h,d)};function f(){return e=t=null,u}return u.scale(1070)}function mb(e){return function(t,n){var r=K(t),i=K(n),o=e(r*i);return o===1/0?[2,0]:[o*i*Q(t),o*Q(n)]}}function _o(e){return function(t,n){var r=pe(t*t+n*n),i=e(r),o=Q(i),s=K(i);return[Ge(t*o,r*s),_e(r&&n*o/r)]}}var Q2=mb(function(e){return pe(2/(1+e))});Q2.invert=_o(function(e){return 2*_e(e/2)});function K2(){return En(Q2).scale(124.75).clipAngle(180-.001)}var J2=mb(function(e){return(e=jg(e))&&e/Q(e)});J2.invert=_o(function(e){return e});function tS(){return En(J2).scale(79.4188).clipAngle(180-.001)}function Lu(e,t){return[e,qc(Su((de+t)/2))]}Lu.invert=function(e,t){return[e,2*ri(zg(t))-de]};function eS(){return nS(Lu).scale(961/cn)}function nS(e){var t=En(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=Dt*r(),h=t(_E(t.rotate()).invert([0,0]));return o(s==null?[[h[0]-f,h[1]-f],[h[0]+f,h[1]+f]]:e===Lu?[[Math.max(h[0]-f,s),a],[Math.min(h[0]+f,c),l]]:[[s,Math.max(h[1]-f,a)],[c,Math.min(h[1]+f,l)]])}return u()}function yb(e){return Su((de+e)/2)}function HE(e,t){var n=K(e),r=e===t?Q(e):qc(n/K(t))/qc(yb(t)/yb(e)),i=n*Vg(yb(e),r)/r;if(!r)return Lu;function o(s,a){i>0?a<-de+tt&&(a=-de+tt):a>de-tt&&(a=de-tt);var c=i/Vg(yb(a),r);return[c*Q(r*s),i-c*K(r*s)]}return o.invert=function(s,a){var c=i-a,l=$n(r)*pe(s*s+c*c),u=Ge(s,Rt(c))*$n(c);return c*r<0&&(u-=Dt*$n(s)*$n(c)),[u/r,2*ri(Vg(i/l,1/r))-de]},o}function rS(){return Bu(HE).scale(109.5).parallels([30,30])}function Fu(e,t){return[e,t]}Fu.invert=Fu;function iS(){return En(Fu).scale(152.63)}function ZE(e,t){var n=K(e),r=e===t?Q(e):(n-K(t))/(t-e),i=n/r+e;if(Rt(r)<tt)return Fu;function o(s,a){var c=i-a,l=r*s;return[c*Q(l),i-c*K(l)]}return o.invert=function(s,a){var c=i-a,l=Ge(s,Rt(c))*$n(c);return c*r<0&&(l-=Dt*$n(s)*$n(c)),[l/r,i-$n(r)*pe(s*s+c*c)]},o}function oS(){return Bu(ZE).scale(131.154).center([0,13.9389])}var hp=1.340264,dp=-.081106,pp=893e-6,mp=.003796,gb=pe(3)/2,tz=12;function sS(e,t){var n=_e(gb*Q(t)),r=n*n,i=r*r*r;return[e*K(n)/(gb*(hp+3*dp*r+i*(7*pp+9*mp*r))),n*(hp+dp*r+i*(pp+mp*r))]}sS.invert=function(e,t){for(var n=t,r=n*n,i=r*r*r,o=0,s,a,c;o<tz&&(a=n*(hp+dp*r+i*(pp+mp*r))-t,c=hp+3*dp*r+i*(7*pp+9*mp*r),n-=s=a/c,r=n*n,i=r*r*r,!(Rt(s)<zc));++o);return[gb*e*(hp+3*dp*r+i*(7*pp+9*mp*r))/K(n),_e(Q(n)/gb)]};function aS(){return En(sS).scale(177.158)}function cS(e,t){var n=K(t),r=K(e)*n;return[n*Q(e)/r,Q(t)/r]}cS.invert=_o(ri);function lS(){return En(cS).scale(144.049).clipAngle(60)}function uS(e,t){return[K(t)*Q(e),Q(t)]}uS.invert=_o(_e);function fS(){return En(uS).scale(249.5).clipAngle(90+tt)}function hS(e,t){var n=K(t),r=1+K(e)*n;return[n*Q(e)/r,Q(t)/r]}hS.invert=_o(function(e){return 2*ri(e)});function dS(){return En(hS).scale(250).clipAngle(142)}function pS(e,t){return[qc(Su((de+t)/2)),-e]}pS.invert=function(e,t){return[-t,2*ri(zg(e))-de]};function mS(){var e=nS(pS),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 ez(e,t){return e.parent===t.parent?1:2}function nz(e){return e.reduce(rz,0)/e.length}function rz(e,t){return e+t.x}function iz(e){return 1+e.reduce(oz,0)}function oz(e,t){return Math.max(e,t.y)}function sz(e){for(var t;t=e.children;)e=t[0];return e}function az(e){for(var t;t=e.children;)e=t[t.length-1];return e}function bb(){var e=ez,t=1,n=1,r=!1;function i(o){var s,a=0;o.eachAfter(function(h){var d=h.children;d?(h.x=nz(d),h.y=iz(d)):(h.x=s?a+=e(h,s):0,h.y=0,s=h)});var c=sz(o),l=az(o),u=c.x-e(c,l)/2,f=l.x+e(l,c)/2;return o.eachAfter(r?function(h){h.x=(h.x-o.x)*t,h.y=(o.y-h.y)*n}:function(h){h.x=(h.x-u)/(f-u)*t,h.y=(1-(o.y?h.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 cz(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 QE(){return this.eachAfter(cz)}function KE(e,t){let n=-1;for(let r of this)e.call(t,r,++n,this);return this}function JE(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 t5(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 e5(e,t){let n=-1;for(let r of this)if(e.call(t,r,++n,this))return r}function n5(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 r5(e){return this.eachBefore(function(t){t.children&&t.children.sort(e)})}function i5(e){for(var t=this,n=lz(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 lz(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 o5(){for(var e=this,t=[e];e=e.parent;)t.push(e);return t}function s5(){return Array.from(this)}function a5(){var e=[];return this.eachBefore(function(t){t.children||e.push(t)}),e}function c5(){var e=this,t=[];return e.each(function(n){n!==e&&t.push({source:n.parent,target:n})}),t}function*l5(){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 yS(e,t){e instanceof Map?(e=[void 0,e],t===void 0&&(t=hz)):t===void 0&&(t=fz);for(var n=new va(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 va(s[a])),o.parent=r,o.depth=r.depth+1;return n.eachBefore(gS)}function uz(){return yS(this).eachBefore(dz)}function fz(e){return e.children}function hz(e){return Array.isArray(e)?e[1]:null}function dz(e){e.data.value!==void 0&&(e.value=e.data.value),e.data=e.data.data}function gS(e){var t=0;do e.height=t;while((e=e.parent)&&e.height<++t)}function va(e){this.data=e,this.depth=this.height=0,this.parent=null}va.prototype=yS.prototype={constructor:va,count:QE,each:KE,eachAfter:t5,eachBefore:JE,find:e5,sum:n5,sort:r5,path:i5,ancestors:o5,descendants:s5,leaves:a5,links:c5,copy:uz,[Symbol.iterator]:l5};function xb(e){return e==null?null:pz(e)}function pz(e){if(typeof e!="function")throw new Error;return e}var mz={depth:-1},u5={},bS={};function yz(e){return e.id}function gz(e){return e.parentId}function wb(){var e=yz,t=gz,n;function r(i){var o=Array.from(i),s=e,a=t,c,l,u,f,h,d,p,m,y=new Map;if(n!=null){let g=o.map((w,v)=>bz(n(w,v,i))),b=g.map(f5),x=new Set(g).add("");for(let w of b)x.has(w)||(x.add(w),g.push(w),b.push(f5(w)),o.push(bS));s=(w,v)=>g[v],a=(w,v)=>b[v]}for(u=0,c=o.length;u<c;++u)l=o[u],d=o[u]=new va(l),(p=s(l,u,i))!=null&&(p+="")&&(m=d.id=p,y.set(m,y.has(m)?u5:d)),(p=a(l,u,i))!=null&&(p+="")&&(d.parent=p);for(u=0;u<c;++u)if(d=o[u],p=d.parent){if(h=y.get(p),!h)throw new Error("missing: "+p);if(h===u5)throw new Error("ambiguous: "+p);h.children?h.children.push(d):h.children=[d],d.parent=h}else{if(f)throw new Error("multiple roots");f=d}if(!f)throw new Error("no root");if(n!=null){for(;f.data===bS&&f.children.length===1;)f=f.children[0],--c;for(let g=o.length-1;g>=0&&(d=o[g],d.data===bS);--g)d.data=null}if(f.parent=mz,f.eachBefore(function(g){g.depth=g.parent.depth+1,--c}).eachBefore(gS),f.parent=null,c>0)throw new Error("cycle");return f}return r.id=function(i){return arguments.length?(e=xb(i),r):e},r.parentId=function(i){return arguments.length?(t=xb(i),r):t},r.path=function(i){return arguments.length?(n=xb(i),r):n},r}function bz(e){e=`${e}`;let t=e.length;return xS(e,t-1)&&!xS(e,t-2)&&(e=e.slice(0,-1)),e[0]==="/"?e:`/${e}`}function f5(e){let t=e.length;if(t<2)return"";for(;--t>1&&!xS(e,t););return e.slice(0,t)}function xS(e,t){if(e[t]==="/"){let n=0;for(;t>0&&e[--t]==="\\";)++n;if(!(n&1))return!0}return!1}function xz(e,t){return e.parent===t.parent?1:2}function wS(e){var t=e.children;return t?t[0]:e.t}function _S(e){var t=e.children;return t?t[t.length-1]:e.t}function wz(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 _z(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 vz(e,t,n){return e.a.parent===t.parent?e.a:n}function _b(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}_b.prototype=Object.create(va.prototype);function Sz(e){for(var t=new _b(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 _b(o[s],s)),i.parent=n;return(t.parent=new _b(null,0)).children=[t],t}function Yc(){var e=xz,t=1,n=1,r=null;function i(l){var u=Sz(l);if(u.eachAfter(o),u.parent.m=-u.z,u.eachBefore(s),r)l.eachBefore(c);else{var f=l,h=l,d=l;l.eachBefore(function(b){b.x<f.x&&(f=b),b.x>h.x&&(h=b),b.depth>d.depth&&(d=b)});var p=f===h?1:e(f,h)/2,m=p-f.x,y=t/(h.x+p+m),g=n/(d.depth||1);l.eachBefore(function(b){b.x=(b.x+m)*y,b.y=b.depth*g})}return l}function o(l){var u=l.children,f=l.parent.children,h=l.i?f[l.i-1]:null;if(u){_z(l);var d=(u[0].z+u[u.length-1].z)/2;h?(l.z=h.z+e(l._,h._),l.m=l.z-d):l.z=d}else h&&(l.z=h.z+e(l._,h._));l.parent.A=a(l,h,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 h=l,d=l,p=u,m=h.parent.children[0],y=h.m,g=d.m,b=p.m,x=m.m,w;p=_S(p),h=wS(h),p&&h;)m=wS(m),d=_S(d),d.a=l,w=p.z+b-h.z-y+e(p._,h._),w>0&&(wz(vz(p,l,f),l,w),y+=w,g+=w),b+=p.m,y+=h.m,x+=m.m,g+=d.m;p&&!_S(d)&&(d.t=p,d.m+=b-g),h&&!wS(m)&&(m.t=h,m.m+=y-x,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 h5=23283064365386963e-26;function Wc(e=Math.random()){let t=(0<=e&&e<1?e/h5:Math.abs(e))|0;return()=>(t=1664525*t+1013904223|0,h5*(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 yp(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 gp=Symbol("implicit");function Gc(){var e=new Xn,t=[],n=[],r=gp;function i(o){let s=e.get(o);if(s===void 0){if(r!==gp)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 Gc(t,n).unknown(r)},He.apply(i,arguments),i}function Sa(){var e=Gc().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 h=t().length,d=i<r,p=d?i:r,m=d?r:i;o=(m-p)/Math.max(1,h-c+l*2),a&&(o=Math.floor(o)),p+=(m-p-o*(h-c))*u,s=o*(1-c),a&&(p=Math.round(p),s=Math.round(s));var y=ke(h).map(function(g){return p+o*g});return n(d?y.reverse():y)}return e.domain=function(h){return arguments.length?(t(h),f()):t()},e.range=function(h){return arguments.length?([r,i]=h,r=+r,i=+i,f()):[r,i]},e.rangeRound=function(h){return[r,i]=h,r=+r,i=+i,a=!0,f()},e.bandwidth=function(){return s},e.step=function(){return o},e.round=function(h){return arguments.length?(a=!!h,f()):a},e.padding=function(h){return arguments.length?(c=Math.min(1,l=+h),f()):c},e.paddingInner=function(h){return arguments.length?(c=Math.min(1,h),f()):c},e.paddingOuter=function(h){return arguments.length?(l=+h,f()):l},e.align=function(h){return arguments.length?(u=Math.max(0,Math.min(1,h)),f()):u},e.copy=function(){return Sa(t(),[r,i]).round(a).paddingInner(c).paddingOuter(l).align(u)},He.apply(f(),arguments)}function d5(e){var t=e.copy;return e.padding=e.paddingOuter,delete e.paddingInner,delete e.paddingOuter,e.copy=function(){return d5(t())},e}function vS(){return d5(Sa.apply(null,arguments).paddingInner(1))}function SS(e){return function(){return e}}function Cu(e){return+e}var p5=[0,1];function yr(e){return e}function MS(e,t){return(t-=e=+e)?function(n){return(n-e)/t}:SS(isNaN(t)?NaN:.5)}function Mz(e,t){var n;return e>t&&(n=e,e=t,t=n),function(r){return Math.max(e,Math.min(t,r))}}function Iz(e,t,n){var r=e[0],i=e[1],o=t[0],s=t[1];return i<r?(r=MS(i,r),o=n(s,o)):(r=MS(r,i),o=n(o,s)),function(a){return o(r(a))}}function Az(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]=MS(e[s],e[s+1]),o[s]=n(t[s],t[s+1]);return function(a){var c=ls(e,a,1,r)-1;return o[c](i[c](a))}}function vo(e,t){return t.domain(e.domain()).range(e.range()).interpolate(e.interpolate()).clamp(e.clamp()).unknown(e.unknown())}function Xc(){var e=p5,t=p5,n=Dr,r,i,o,s=yr,a,c,l;function u(){var h=Math.min(e.length,t.length);return s!==yr&&(s=Mz(e[0],e[h-1])),a=h>2?Az:Iz,c=l=null,f}function f(h){return h==null||isNaN(h=+h)?o:(c||(c=a(e.map(r),t,n)))(r(s(h)))}return f.invert=function(h){return s(i((l||(l=a(t,e.map(r),we)))(h)))},f.domain=function(h){return arguments.length?(e=Array.from(h,Cu),u()):e.slice()},f.range=function(h){return arguments.length?(t=Array.from(h),u()):t.slice()},f.rangeRound=function(h){return t=Array.from(h),n=Cc,u()},f.clamp=function(h){return arguments.length?(s=h?!0:yr,u()):s!==yr},f.interpolate=function(h){return arguments.length?(n=h,u()):n},f.unknown=function(h){return arguments.length?(o=h,f):o},function(h,d){return r=h,i=d,u()}}function bp(){return Xc()(yr,yr)}function IS(e,t,n,r){var i=iu(e,t,n),o;switch(r=go(r??",f"),r.type){case"s":{var s=Math.max(Math.abs(e),Math.abs(t));return r.precision==null&&!isNaN(o=b2(i,s))&&(r.precision=o),Pg(r,s)}case"":case"e":case"g":case"p":case"r":{r.precision==null&&!isNaN(o=x2(i,Math.max(Math.abs(e),Math.abs(t))))&&(r.precision=o-(r.type==="e"));break}case"f":case"%":{r.precision==null&&!isNaN(o=g2(i))&&(r.precision=o-(r.type==="%")*2);break}}return ni(r)}function _s(e){var t=e.domain;return e.ticks=function(n){var r=t();return Mn(r[0],r[r.length-1],n??10)},e.tickFormat=function(n,r){var i=t();return IS(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=fs(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 vs(){var e=bp();return e.copy=function(){return vo(e,vs())},He.apply(e,arguments),_s(e)}function xp(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,Cu),n):e.slice()},n.unknown=function(r){return arguments.length?(t=r,n):t},n.copy=function(){return xp(e).unknown(t)},e=arguments.length?Array.from(e,Cu):[0,1],_s(n)}function wp(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 m5(e){return Math.log(e)}function y5(e){return Math.exp(e)}function Tz(e){return-Math.log(-e)}function Ez(e){return-Math.exp(-e)}function Dz(e){return isFinite(e)?+("1e"+e):e<0?0:e}function Nz(e){return e===10?Dz:e===Math.E?Math.exp:t=>Math.pow(e,t)}function Oz(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 g5(e){return(t,n)=>-e(-t,n)}function AS(e){let t=e(m5,y5),n=t.domain,r=10,i,o;function s(){return i=Oz(r),o=Nz(r),n()[0]<0?(i=g5(i),o=g5(o),e(Tz,Ez)):e(m5,y5),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 h=i(l),d=i(u),p,m,y=a==null?10:+a,g=[];if(!(r%1)&&d-h<y){if(h=Math.floor(h),d=Math.ceil(d),l>0){for(;h<=d;++h)for(p=1;p<r;++p)if(m=h<0?p/o(-h):p*o(h),!(m<l)){if(m>u)break;g.push(m)}}else for(;h<=d;++h)for(p=r-1;p>=1;--p)if(m=h>0?p/o(-h):p*o(h),!(m<l)){if(m>u)break;g.push(m)}g.length*2<y&&(g=Mn(l,u,y))}else g=Mn(h,d,Math.min(d-h,y)).map(o);return f?g.reverse():g},t.tickFormat=(a,c)=>{if(a==null&&(a=10),c==null&&(c=r===10?"s":","),typeof c!="function"&&(!(r%1)&&(c=go(c)).precision==null&&(c.trim=!0),c=ni(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(wp(n(),{floor:a=>o(Math.floor(i(a))),ceil:a=>o(Math.ceil(i(a)))})),t}function _p(){let e=AS(Xc()).domain([1,10]);return e.copy=()=>vo(e,_p()).base(e.base()),He.apply(e,arguments),e}function b5(e){return function(t){return Math.sign(t)*Math.log1p(Math.abs(t/e))}}function x5(e){return function(t){return Math.sign(t)*Math.expm1(Math.abs(t))*e}}function TS(e){var t=1,n=e(b5(t),x5(t));return n.constant=function(r){return arguments.length?e(b5(t=+r),x5(t)):t},_s(n)}function vp(){var e=TS(Xc());return e.copy=function(){return vo(e,vp()).constant(e.constant())},He.apply(e,arguments)}function w5(e){return function(t){return t<0?-Math.pow(-t,e):Math.pow(t,e)}}function Bz(e){return e<0?-Math.sqrt(-e):Math.sqrt(e)}function Lz(e){return e<0?-e*e:e*e}function ES(e){var t=e(yr,yr),n=1;function r(){return n===1?e(yr,yr):n===.5?e(Bz,Lz):e(w5(n),w5(1/n))}return t.exponent=function(i){return arguments.length?(n=+i,r()):n},_s(t)}function Sp(){var e=ES(Xc());return e.copy=function(){return vo(e,Sp()).exponent(e.exponent())},He.apply(e,arguments),e}function Mp(){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]=Tv(e,s/a);return o}function o(s){return s==null||isNaN(s=+s)?r:t[ls(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(Et),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 Mp().domain(e).range(t).unknown(r)},He.apply(o,arguments)}function Ip(){var e=[.5],t=[0,1],n,r=1;function i(o){return o!=null&&o<=o?t[ls(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 Ip().domain(e).range(t).unknown(n)},He.apply(i,arguments)}var DS=new Date,NS=new Date;function ge(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=>ge(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)=>(DS.setTime(+o),NS.setTime(+s),e(DS),e(NS),Math.floor(n(DS,NS))),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 Ap=ge(()=>{},(e,t)=>{e.setTime(+e+t)},(e,t)=>t-e);Ap.every=e=>(e=Math.floor(e),!isFinite(e)||!(e>0)?null:e>1?ge(t=>{t.setTime(Math.floor(t/e)*e)},(t,n)=>{t.setTime(+t+n*e)},(t,n)=>(n-t)/e):Ap);var Lvt=Ap.range;var ln=ge(e=>{e.setTime(e-e.getMilliseconds())},(e,t)=>{e.setTime(+e+t*1e3)},(e,t)=>(t-e)/1e3,e=>e.getUTCSeconds()),_5=ln.range;var Ss=ge(e=>{e.setTime(e-e.getMilliseconds()-e.getSeconds()*1e3)},(e,t)=>{e.setTime(+e+t*6e4)},(e,t)=>(t-e)/6e4,e=>e.getMinutes()),Fz=Ss.range,Ms=ge(e=>{e.setUTCSeconds(0,0)},(e,t)=>{e.setTime(+e+t*6e4)},(e,t)=>(t-e)/6e4,e=>e.getUTCMinutes()),Cz=Ms.range;var Is=ge(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()),Rz=Is.range,As=ge(e=>{e.setUTCMinutes(0,0,0)},(e,t)=>{e.setTime(+e+t*36e5)},(e,t)=>(t-e)/36e5,e=>e.getUTCHours()),kz=As.range;var ii=ge(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),$z=ii.range,Qc=ge(e=>{e.setUTCHours(0,0,0,0)},(e,t)=>{e.setUTCDate(e.getUTCDate()+t)},(e,t)=>(t-e)/864e5,e=>e.getUTCDate()-1),Uz=Qc.range,Kc=ge(e=>{e.setUTCHours(0,0,0,0)},(e,t)=>{e.setUTCDate(e.getUTCDate()+t)},(e,t)=>(t-e)/864e5,e=>Math.floor(e/864e5)),Pz=Kc.range;function Jc(e){return ge(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 Or=Jc(0),Ma=Jc(1),vb=Jc(2),Sb=Jc(3),Mo=Jc(4),Mb=Jc(5),Ib=Jc(6),S5=Or.range,zz=Ma.range,qz=vb.range,Vz=Sb.range,jz=Mo.range,Yz=Mb.range,Wz=Ib.range;function tl(e){return ge(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 Br=tl(0),Ia=tl(1),Ab=tl(2),Tb=tl(3),Io=tl(4),Eb=tl(5),Db=tl(6),M5=Br.range,Gz=Ia.range,Xz=Ab.range,Hz=Tb.range,Zz=Io.range,Qz=Eb.range,Kz=Db.range;var Ts=ge(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()),Jz=Ts.range,Es=ge(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()),tq=Es.range;var Un=ge(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());Un.every=e=>!isFinite(e=Math.floor(e))||!(e>0)?null:ge(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 eq=Un.range,Pn=ge(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:ge(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 nq=Pn.range;function A5(e,t,n,r,i,o){let s=[[ln,1,1e3],[ln,5,5*1e3],[ln,15,15*1e3],[ln,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 h=u<l;h&&([l,u]=[u,l]);let d=f&&typeof f.range=="function"?f:c(l,u,f),p=d?d.range(l,+u+1):[];return h?p.reverse():p}function c(l,u,f){let h=Math.abs(u-l)/f,d=cs(([,,y])=>y).right(s,h);if(d===s.length)return e.every(iu(l/31536e6,u/31536e6,f));if(d===0)return Ap.every(Math.max(iu(l,u,f),1));let[p,m]=s[h/s[d-1][2]<s[d][2]/h?d-1:d];return p.every(m)}return[a,c]}var[OS,Ep]=A5(Pn,Es,Br,Kc,As,Ms),[BS,LS]=A5(Un,Ts,Or,ii,Is,Ss);function FS(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 CS(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 Dp(e,t,n){return{y:e,m:t,d:n,H:0,M:0,S:0,L:0}}function RS(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=Np(i),u=Op(i),f=Np(o),h=Op(o),d=Np(s),p=Op(s),m=Np(a),y=Op(a),g=Np(c),b=Op(c),x={a:C,A:R,b:F,B:k,c:null,d:B5,e:B5,f:Aq,g:Rq,G:$q,H:Sq,I:Mq,j:Iq,L:k5,m:Tq,M:Eq,p:$,q:U,Q:C5,s:R5,S:Dq,u:Nq,U:Oq,V:Bq,w:Lq,W:Fq,x:null,X:null,y:Cq,Y:kq,Z:Uq,"%":F5},w={a:G,A:et,b:rt,B:st,c:null,d:L5,e:L5,f:Vq,g:Jq,G:eV,H:Pq,I:zq,j:qq,L:U5,m:jq,M:Yq,p:j,q:ot,Q:C5,s:R5,S:Wq,u:Gq,U:Xq,V:Hq,w:Zq,W:Qq,x:null,X:null,y:Kq,Y:tV,Z:nV,"%":F5},v={a:N,A,b:O,B:L,c:S,d:N5,e:N5,f:xq,g:D5,G:E5,H:O5,I:O5,j:mq,L:bq,m:pq,M:yq,p:I,q:dq,Q:_q,s:vq,S:gq,u:cq,U:lq,V:uq,w:aq,W:fq,x:T,X:D,y:D5,Y:E5,Z:hq,"%":wq};x.x=_(n,x),x.X=_(r,x),x.c=_(t,x),w.x=_(n,w),w.X=_(r,w),w.c=_(t,w);function _(z,H){return function(nt){var P=[],Lt=-1,ft=0,Wt=z.length,Ht,J,oe;for(nt instanceof Date||(nt=new Date(+nt));++Lt<Wt;)z.charCodeAt(Lt)===37&&(P.push(z.slice(ft,Lt)),(J=T5[Ht=z.charAt(++Lt)])!=null?Ht=z.charAt(++Lt):J=Ht==="e"?" ":"0",(oe=H[Ht])&&(Ht=oe(nt,J)),P.push(Ht),ft=Lt+1);return P.push(z.slice(ft,Lt)),P.join("")}}function M(z,H){return function(nt){var P=Dp(1900,void 0,1),Lt=E(P,z,nt+="",0),ft,Wt;if(Lt!=nt.length)return null;if("Q"in P)return new Date(P.Q);if("s"in P)return new Date(P.s*1e3+("L"in P?P.L:0));if(H&&!("Z"in P)&&(P.Z=0),"p"in P&&(P.H=P.H%12+P.p*12),P.m===void 0&&(P.m="q"in P?P.q:0),"V"in P){if(P.V<1||P.V>53)return null;"w"in P||(P.w=1),"Z"in P?(ft=CS(Dp(P.y,0,1)),Wt=ft.getUTCDay(),ft=Wt>4||Wt===0?Ia.ceil(ft):Ia(ft),ft=Qc.offset(ft,(P.V-1)*7),P.y=ft.getUTCFullYear(),P.m=ft.getUTCMonth(),P.d=ft.getUTCDate()+(P.w+6)%7):(ft=FS(Dp(P.y,0,1)),Wt=ft.getDay(),ft=Wt>4||Wt===0?Ma.ceil(ft):Ma(ft),ft=ii.offset(ft,(P.V-1)*7),P.y=ft.getFullYear(),P.m=ft.getMonth(),P.d=ft.getDate()+(P.w+6)%7)}else("W"in P||"U"in P)&&("w"in P||(P.w="u"in P?P.u%7:"W"in P?1:0),Wt="Z"in P?CS(Dp(P.y,0,1)).getUTCDay():FS(Dp(P.y,0,1)).getDay(),P.m=0,P.d="W"in P?(P.w+6)%7+P.W*7-(Wt+5)%7:P.w+P.U*7-(Wt+6)%7);return"Z"in P?(P.H+=P.Z/100|0,P.M+=P.Z%100,CS(P)):FS(P)}}function E(z,H,nt,P){for(var Lt=0,ft=H.length,Wt=nt.length,Ht,J;Lt<ft;){if(P>=Wt)return-1;if(Ht=H.charCodeAt(Lt++),Ht===37){if(Ht=H.charAt(Lt++),J=v[Ht in T5?H.charAt(Lt++):Ht],!J||(P=J(z,nt,P))<0)return-1}else if(Ht!=nt.charCodeAt(P++))return-1}return P}function I(z,H,nt){var P=l.exec(H.slice(nt));return P?(z.p=u.get(P[0].toLowerCase()),nt+P[0].length):-1}function N(z,H,nt){var P=d.exec(H.slice(nt));return P?(z.w=p.get(P[0].toLowerCase()),nt+P[0].length):-1}function A(z,H,nt){var P=f.exec(H.slice(nt));return P?(z.w=h.get(P[0].toLowerCase()),nt+P[0].length):-1}function O(z,H,nt){var P=g.exec(H.slice(nt));return P?(z.m=b.get(P[0].toLowerCase()),nt+P[0].length):-1}function L(z,H,nt){var P=m.exec(H.slice(nt));return P?(z.m=y.get(P[0].toLowerCase()),nt+P[0].length):-1}function S(z,H,nt){return E(z,t,H,nt)}function T(z,H,nt){return E(z,n,H,nt)}function D(z,H,nt){return E(z,r,H,nt)}function C(z){return s[z.getDay()]}function R(z){return o[z.getDay()]}function F(z){return c[z.getMonth()]}function k(z){return a[z.getMonth()]}function $(z){return i[+(z.getHours()>=12)]}function U(z){return 1+~~(z.getMonth()/3)}function G(z){return s[z.getUTCDay()]}function et(z){return o[z.getUTCDay()]}function rt(z){return c[z.getUTCMonth()]}function st(z){return a[z.getUTCMonth()]}function j(z){return i[+(z.getUTCHours()>=12)]}function ot(z){return 1+~~(z.getUTCMonth()/3)}return{format:function(z){var H=_(z+="",x);return H.toString=function(){return z},H},parse:function(z){var H=M(z+="",!1);return H.toString=function(){return z},H},utcFormat:function(z){var H=_(z+="",w);return H.toString=function(){return z},H},utcParse:function(z){var H=M(z+="",!0);return H.toString=function(){return z},H}}}var T5={"-":"",_:" ",0:"0"},un=/^\s*\d+/,iq=/^%/,oq=/[\\^$*+?|[\]().{}]/g;function Jt(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 sq(e){return e.replace(oq,"\\$&")}function Np(e){return new RegExp("^(?:"+e.map(sq).join("|")+")","i")}function Op(e){return new Map(e.map((t,n)=>[t.toLowerCase(),n]))}function aq(e,t,n){var r=un.exec(t.slice(n,n+1));return r?(e.w=+r[0],n+r[0].length):-1}function cq(e,t,n){var r=un.exec(t.slice(n,n+1));return r?(e.u=+r[0],n+r[0].length):-1}function lq(e,t,n){var r=un.exec(t.slice(n,n+2));return r?(e.U=+r[0],n+r[0].length):-1}function uq(e,t,n){var r=un.exec(t.slice(n,n+2));return r?(e.V=+r[0],n+r[0].length):-1}function fq(e,t,n){var r=un.exec(t.slice(n,n+2));return r?(e.W=+r[0],n+r[0].length):-1}function E5(e,t,n){var r=un.exec(t.slice(n,n+4));return r?(e.y=+r[0],n+r[0].length):-1}function D5(e,t,n){var r=un.exec(t.slice(n,n+2));return r?(e.y=+r[0]+(+r[0]>68?1900:2e3),n+r[0].length):-1}function hq(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 dq(e,t,n){var r=un.exec(t.slice(n,n+1));return r?(e.q=r[0]*3-3,n+r[0].length):-1}function pq(e,t,n){var r=un.exec(t.slice(n,n+2));return r?(e.m=r[0]-1,n+r[0].length):-1}function N5(e,t,n){var r=un.exec(t.slice(n,n+2));return r?(e.d=+r[0],n+r[0].length):-1}function mq(e,t,n){var r=un.exec(t.slice(n,n+3));return r?(e.m=0,e.d=+r[0],n+r[0].length):-1}function O5(e,t,n){var r=un.exec(t.slice(n,n+2));return r?(e.H=+r[0],n+r[0].length):-1}function yq(e,t,n){var r=un.exec(t.slice(n,n+2));return r?(e.M=+r[0],n+r[0].length):-1}function gq(e,t,n){var r=un.exec(t.slice(n,n+2));return r?(e.S=+r[0],n+r[0].length):-1}function bq(e,t,n){var r=un.exec(t.slice(n,n+3));return r?(e.L=+r[0],n+r[0].length):-1}function xq(e,t,n){var r=un.exec(t.slice(n,n+6));return r?(e.L=Math.floor(r[0]/1e3),n+r[0].length):-1}function wq(e,t,n){var r=iq.exec(t.slice(n,n+1));return r?n+r[0].length:-1}function _q(e,t,n){var r=un.exec(t.slice(n));return r?(e.Q=+r[0],n+r[0].length):-1}function vq(e,t,n){var r=un.exec(t.slice(n));return r?(e.s=+r[0],n+r[0].length):-1}function B5(e,t){return Jt(e.getDate(),t,2)}function Sq(e,t){return Jt(e.getHours(),t,2)}function Mq(e,t){return Jt(e.getHours()%12||12,t,2)}function Iq(e,t){return Jt(1+ii.count(Un(e),e),t,3)}function k5(e,t){return Jt(e.getMilliseconds(),t,3)}function Aq(e,t){return k5(e,t)+"000"}function Tq(e,t){return Jt(e.getMonth()+1,t,2)}function Eq(e,t){return Jt(e.getMinutes(),t,2)}function Dq(e,t){return Jt(e.getSeconds(),t,2)}function Nq(e){var t=e.getDay();return t===0?7:t}function Oq(e,t){return Jt(Or.count(Un(e)-1,e),t,2)}function $5(e){var t=e.getDay();return t>=4||t===0?Mo(e):Mo.ceil(e)}function Bq(e,t){return e=$5(e),Jt(Mo.count(Un(e),e)+(Un(e).getDay()===4),t,2)}function Lq(e){return e.getDay()}function Fq(e,t){return Jt(Ma.count(Un(e)-1,e),t,2)}function Cq(e,t){return Jt(e.getFullYear()%100,t,2)}function Rq(e,t){return e=$5(e),Jt(e.getFullYear()%100,t,2)}function kq(e,t){return Jt(e.getFullYear()%1e4,t,4)}function $q(e,t){var n=e.getDay();return e=n>=4||n===0?Mo(e):Mo.ceil(e),Jt(e.getFullYear()%1e4,t,4)}function Uq(e){var t=e.getTimezoneOffset();return(t>0?"-":(t*=-1,"+"))+Jt(t/60|0,"0",2)+Jt(t%60,"0",2)}function L5(e,t){return Jt(e.getUTCDate(),t,2)}function Pq(e,t){return Jt(e.getUTCHours(),t,2)}function zq(e,t){return Jt(e.getUTCHours()%12||12,t,2)}function qq(e,t){return Jt(1+Qc.count(Pn(e),e),t,3)}function U5(e,t){return Jt(e.getUTCMilliseconds(),t,3)}function Vq(e,t){return U5(e,t)+"000"}function jq(e,t){return Jt(e.getUTCMonth()+1,t,2)}function Yq(e,t){return Jt(e.getUTCMinutes(),t,2)}function Wq(e,t){return Jt(e.getUTCSeconds(),t,2)}function Gq(e){var t=e.getUTCDay();return t===0?7:t}function Xq(e,t){return Jt(Br.count(Pn(e)-1,e),t,2)}function P5(e){var t=e.getUTCDay();return t>=4||t===0?Io(e):Io.ceil(e)}function Hq(e,t){return e=P5(e),Jt(Io.count(Pn(e),e)+(Pn(e).getUTCDay()===4),t,2)}function Zq(e){return e.getUTCDay()}function Qq(e,t){return Jt(Ia.count(Pn(e)-1,e),t,2)}function Kq(e,t){return Jt(e.getUTCFullYear()%100,t,2)}function Jq(e,t){return e=P5(e),Jt(e.getUTCFullYear()%100,t,2)}function tV(e,t){return Jt(e.getUTCFullYear()%1e4,t,4)}function eV(e,t){var n=e.getUTCDay();return e=n>=4||n===0?Io(e):Io.ceil(e),Jt(e.getUTCFullYear()%1e4,t,4)}function nV(){return"+0000"}function F5(){return"%"}function C5(e){return+e}function R5(e){return Math.floor(+e/1e3)}var Ru,ku,z5,Ao,q5;kS({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 kS(e){return Ru=RS(e),ku=Ru.format,z5=Ru.parse,Ao=Ru.utcFormat,q5=Ru.utcParse,Ru}function rV(e){return new Date(e)}function iV(e){return e instanceof Date?+e:+new Date(+e)}function Nb(e,t,n,r,i,o,s,a,c,l){var u=bp(),f=u.invert,h=u.domain,d=l(".%L"),p=l(":%S"),m=l("%I:%M"),y=l("%I %p"),g=l("%a %d"),b=l("%b %d"),x=l("%B"),w=l("%Y");function v(_){return(c(_)<_?d:a(_)<_?p:s(_)<_?m:o(_)<_?y:r(_)<_?i(_)<_?g:b:n(_)<_?x:w)(_)}return u.invert=function(_){return new Date(f(_))},u.domain=function(_){return arguments.length?h(Array.from(_,iV)):h().map(rV)},u.ticks=function(_){var M=h();return e(M[0],M[M.length-1],_??10)},u.tickFormat=function(_,M){return M==null?v:l(M)},u.nice=function(_){var M=h();return(!_||typeof _.range!="function")&&(_=t(M[0],M[M.length-1],_??10)),_?h(wp(M,_)):u},u.copy=function(){return vo(u,Nb(e,t,n,r,i,o,s,a,c,l))},u}function Ob(){return He.apply(Nb(BS,LS,Un,Ts,Or,ii,Is,Ss,ln,ku).domain([new Date(2e3,0,1),new Date(2e3,0,2)]),arguments)}function Bb(){return He.apply(Nb(OS,Ep,Pn,Es,Br,Qc,As,Ms,ln,Ao).domain([Date.UTC(2e3,0,1),Date.UTC(2e3,0,2)]),arguments)}function Bp(e,t){return t.domain(e.domain()).interpolator(e.interpolator()).clamp(e.clamp()).unknown(e.unknown())}function Lb(){var e=0,t=.5,n=1,r=1,i,o,s,a,c,l=yr,u,f=!1,h;function d(m){return isNaN(m=+m)?h:(m=.5+((m=+u(m))-o)*(r*m<r*o?a:c),l(f?Math.max(0,Math.min(1,m)):m))}d.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,d):[e,t,n]},d.clamp=function(m){return arguments.length?(f=!!m,d):f},d.interpolator=function(m){return arguments.length?(l=m,d):l};function p(m){return function(y){var g,b,x;return arguments.length?([g,b,x]=y,l=ho(m,[g,b,x]),d):[l(0),l(.5),l(1)]}}return d.range=p(Dr),d.rangeRound=p(Cc),d.unknown=function(m){return arguments.length?(h=m,d):h},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,d}}function Lp(){var e=_s(Lb()(yr));return e.copy=function(){return Bp(e,Lp())},yp.apply(e,arguments)}function Fb(){var e=AS(Lb()).domain([.1,1,10]);return e.copy=function(){return Bp(e,Fb()).base(e.base())},yp.apply(e,arguments)}function Cb(){var e=TS(Lb());return e.copy=function(){return Bp(e,Cb()).constant(e.constant())},yp.apply(e,arguments)}function Rb(){var e=ES(Lb());return e.copy=function(){return Bp(e,Rb()).exponent(e.exponent())},yp.apply(e,arguments)}function Y(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 $S=Y("1f77b4ff7f0e2ca02cd627289467bd8c564be377c27f7f7fbcbd2217becf");var US=Y("7fc97fbeaed4fdc086ffff99386cb0f0027fbf5b17666666");var PS=Y("1b9e77d95f027570b3e7298a66a61ee6ab02a6761d666666");var zS=Y("4269d0efb118ff725c6cc5b03ca951ff8ab7a463f297bbf59c6b4e9498a0");var qS=Y("a6cee31f78b4b2df8a33a02cfb9a99e31a1cfdbf6fff7f00cab2d66a3d9affff99b15928");var VS=Y("fbb4aeb3cde3ccebc5decbe4fed9a6ffffcce5d8bdfddaecf2f2f2");var jS=Y("b3e2cdfdcdaccbd5e8f4cae4e6f5c9fff2aef1e2cccccccc");var YS=Y("e41a1c377eb84daf4a984ea3ff7f00ffff33a65628f781bf999999");var WS=Y("66c2a5fc8d628da0cbe78ac3a6d854ffd92fe5c494b3b3b3");var GS=Y("8dd3c7ffffb3bebadafb807280b1d3fdb462b3de69fccde5d9d9d9bc80bdccebc5ffed6f");var XS=Y("4e79a7f28e2ce1575976b7b259a14fedc949af7aa1ff9da79c755fbab0ab");var ht=e=>Vv(e[e.length-1]);var kb=new Array(3).concat("d8b365f5f5f55ab4ac","a6611adfc27d80cdc1018571","a6611adfc27df5f5f580cdc1018571","8c510ad8b365f6e8c3c7eae55ab4ac01665e","8c510ad8b365f6e8c3f5f5f5c7eae55ab4ac01665e","8c510abf812ddfc27df6e8c3c7eae580cdc135978f01665e","8c510abf812ddfc27df6e8c3f5f5f5c7eae580cdc135978f01665e","5430058c510abf812ddfc27df6e8c3c7eae580cdc135978f01665e003c30","5430058c510abf812ddfc27df6e8c3f5f5f5c7eae580cdc135978f01665e003c30").map(Y),$b=ht(kb);var Ub=new Array(3).concat("af8dc3f7f7f77fbf7b","7b3294c2a5cfa6dba0008837","7b3294c2a5cff7f7f7a6dba0008837","762a83af8dc3e7d4e8d9f0d37fbf7b1b7837","762a83af8dc3e7d4e8f7f7f7d9f0d37fbf7b1b7837","762a839970abc2a5cfe7d4e8d9f0d3a6dba05aae611b7837","762a839970abc2a5cfe7d4e8f7f7f7d9f0d3a6dba05aae611b7837","40004b762a839970abc2a5cfe7d4e8d9f0d3a6dba05aae611b783700441b","40004b762a839970abc2a5cfe7d4e8f7f7f7d9f0d3a6dba05aae611b783700441b").map(Y),Pb=ht(Ub);var zb=new Array(3).concat("e9a3c9f7f7f7a1d76a","d01c8bf1b6dab8e1864dac26","d01c8bf1b6daf7f7f7b8e1864dac26","c51b7de9a3c9fde0efe6f5d0a1d76a4d9221","c51b7de9a3c9fde0eff7f7f7e6f5d0a1d76a4d9221","c51b7dde77aef1b6dafde0efe6f5d0b8e1867fbc414d9221","c51b7dde77aef1b6dafde0eff7f7f7e6f5d0b8e1867fbc414d9221","8e0152c51b7dde77aef1b6dafde0efe6f5d0b8e1867fbc414d9221276419","8e0152c51b7dde77aef1b6dafde0eff7f7f7e6f5d0b8e1867fbc414d9221276419").map(Y),qb=ht(zb);var Vb=new Array(3).concat("998ec3f7f7f7f1a340","5e3c99b2abd2fdb863e66101","5e3c99b2abd2f7f7f7fdb863e66101","542788998ec3d8daebfee0b6f1a340b35806","542788998ec3d8daebf7f7f7fee0b6f1a340b35806","5427888073acb2abd2d8daebfee0b6fdb863e08214b35806","5427888073acb2abd2d8daebf7f7f7fee0b6fdb863e08214b35806","2d004b5427888073acb2abd2d8daebfee0b6fdb863e08214b358067f3b08","2d004b5427888073acb2abd2d8daebf7f7f7fee0b6fdb863e08214b358067f3b08").map(Y),jb=ht(Vb);var Fp=new Array(3).concat("ef8a62f7f7f767a9cf","ca0020f4a58292c5de0571b0","ca0020f4a582f7f7f792c5de0571b0","b2182bef8a62fddbc7d1e5f067a9cf2166ac","b2182bef8a62fddbc7f7f7f7d1e5f067a9cf2166ac","b2182bd6604df4a582fddbc7d1e5f092c5de4393c32166ac","b2182bd6604df4a582fddbc7f7f7f7d1e5f092c5de4393c32166ac","67001fb2182bd6604df4a582fddbc7d1e5f092c5de4393c32166ac053061","67001fb2182bd6604df4a582fddbc7f7f7f7d1e5f092c5de4393c32166ac053061").map(Y),$u=ht(Fp);var Yb=new Array(3).concat("ef8a62ffffff999999","ca0020f4a582bababa404040","ca0020f4a582ffffffbababa404040","b2182bef8a62fddbc7e0e0e09999994d4d4d","b2182bef8a62fddbc7ffffffe0e0e09999994d4d4d","b2182bd6604df4a582fddbc7e0e0e0bababa8787874d4d4d","b2182bd6604df4a582fddbc7ffffffe0e0e0bababa8787874d4d4d","67001fb2182bd6604df4a582fddbc7e0e0e0bababa8787874d4d4d1a1a1a","67001fb2182bd6604df4a582fddbc7ffffffe0e0e0bababa8787874d4d4d1a1a1a").map(Y),Wb=ht(Yb);var Cp=new Array(3).concat("fc8d59ffffbf91bfdb","d7191cfdae61abd9e92c7bb6","d7191cfdae61ffffbfabd9e92c7bb6","d73027fc8d59fee090e0f3f891bfdb4575b4","d73027fc8d59fee090ffffbfe0f3f891bfdb4575b4","d73027f46d43fdae61fee090e0f3f8abd9e974add14575b4","d73027f46d43fdae61fee090ffffbfe0f3f8abd9e974add14575b4","a50026d73027f46d43fdae61fee090e0f3f8abd9e974add14575b4313695","a50026d73027f46d43fdae61fee090ffffbfe0f3f8abd9e974add14575b4313695").map(Y),Uu=ht(Cp);var Gb=new Array(3).concat("fc8d59ffffbf91cf60","d7191cfdae61a6d96a1a9641","d7191cfdae61ffffbfa6d96a1a9641","d73027fc8d59fee08bd9ef8b91cf601a9850","d73027fc8d59fee08bffffbfd9ef8b91cf601a9850","d73027f46d43fdae61fee08bd9ef8ba6d96a66bd631a9850","d73027f46d43fdae61fee08bffffbfd9ef8ba6d96a66bd631a9850","a50026d73027f46d43fdae61fee08bd9ef8ba6d96a66bd631a9850006837","a50026d73027f46d43fdae61fee08bffffbfd9ef8ba6d96a66bd631a9850006837").map(Y),Xb=ht(Gb);var Hb=new Array(3).concat("fc8d59ffffbf99d594","d7191cfdae61abdda42b83ba","d7191cfdae61ffffbfabdda42b83ba","d53e4ffc8d59fee08be6f59899d5943288bd","d53e4ffc8d59fee08bffffbfe6f59899d5943288bd","d53e4ff46d43fdae61fee08be6f598abdda466c2a53288bd","d53e4ff46d43fdae61fee08bffffbfe6f598abdda466c2a53288bd","9e0142d53e4ff46d43fdae61fee08be6f598abdda466c2a53288bd5e4fa2","9e0142d53e4ff46d43fdae61fee08bffffbfe6f598abdda466c2a53288bd5e4fa2").map(Y),Zb=ht(Hb);var Qb=new Array(3).concat("e5f5f999d8c92ca25f","edf8fbb2e2e266c2a4238b45","edf8fbb2e2e266c2a42ca25f006d2c","edf8fbccece699d8c966c2a42ca25f006d2c","edf8fbccece699d8c966c2a441ae76238b45005824","f7fcfde5f5f9ccece699d8c966c2a441ae76238b45005824","f7fcfde5f5f9ccece699d8c966c2a441ae76238b45006d2c00441b").map(Y),Kb=ht(Qb);var Jb=new Array(3).concat("e0ecf49ebcda8856a7","edf8fbb3cde38c96c688419d","edf8fbb3cde38c96c68856a7810f7c","edf8fbbfd3e69ebcda8c96c68856a7810f7c","edf8fbbfd3e69ebcda8c96c68c6bb188419d6e016b","f7fcfde0ecf4bfd3e69ebcda8c96c68c6bb188419d6e016b","f7fcfde0ecf4bfd3e69ebcda8c96c68c6bb188419d810f7c4d004b").map(Y),tx=ht(Jb);var ex=new Array(3).concat("e0f3dba8ddb543a2ca","f0f9e8bae4bc7bccc42b8cbe","f0f9e8bae4bc7bccc443a2ca0868ac","f0f9e8ccebc5a8ddb57bccc443a2ca0868ac","f0f9e8ccebc5a8ddb57bccc44eb3d32b8cbe08589e","f7fcf0e0f3dbccebc5a8ddb57bccc44eb3d32b8cbe08589e","f7fcf0e0f3dbccebc5a8ddb57bccc44eb3d32b8cbe0868ac084081").map(Y),nx=ht(ex);var rx=new Array(3).concat("fee8c8fdbb84e34a33","fef0d9fdcc8afc8d59d7301f","fef0d9fdcc8afc8d59e34a33b30000","fef0d9fdd49efdbb84fc8d59e34a33b30000","fef0d9fdd49efdbb84fc8d59ef6548d7301f990000","fff7ecfee8c8fdd49efdbb84fc8d59ef6548d7301f990000","fff7ecfee8c8fdd49efdbb84fc8d59ef6548d7301fb300007f0000").map(Y),ix=ht(rx);var ox=new Array(3).concat("ece2f0a6bddb1c9099","f6eff7bdc9e167a9cf02818a","f6eff7bdc9e167a9cf1c9099016c59","f6eff7d0d1e6a6bddb67a9cf1c9099016c59","f6eff7d0d1e6a6bddb67a9cf3690c002818a016450","fff7fbece2f0d0d1e6a6bddb67a9cf3690c002818a016450","fff7fbece2f0d0d1e6a6bddb67a9cf3690c002818a016c59014636").map(Y),sx=ht(ox);var ax=new Array(3).concat("ece7f2a6bddb2b8cbe","f1eef6bdc9e174a9cf0570b0","f1eef6bdc9e174a9cf2b8cbe045a8d","f1eef6d0d1e6a6bddb74a9cf2b8cbe045a8d","f1eef6d0d1e6a6bddb74a9cf3690c00570b0034e7b","fff7fbece7f2d0d1e6a6bddb74a9cf3690c00570b0034e7b","fff7fbece7f2d0d1e6a6bddb74a9cf3690c00570b0045a8d023858").map(Y),cx=ht(ax);var lx=new Array(3).concat("e7e1efc994c7dd1c77","f1eef6d7b5d8df65b0ce1256","f1eef6d7b5d8df65b0dd1c77980043","f1eef6d4b9dac994c7df65b0dd1c77980043","f1eef6d4b9dac994c7df65b0e7298ace125691003f","f7f4f9e7e1efd4b9dac994c7df65b0e7298ace125691003f","f7f4f9e7e1efd4b9dac994c7df65b0e7298ace125698004367001f").map(Y),ux=ht(lx);var fx=new Array(3).concat("fde0ddfa9fb5c51b8a","feebe2fbb4b9f768a1ae017e","feebe2fbb4b9f768a1c51b8a7a0177","feebe2fcc5c0fa9fb5f768a1c51b8a7a0177","feebe2fcc5c0fa9fb5f768a1dd3497ae017e7a0177","fff7f3fde0ddfcc5c0fa9fb5f768a1dd3497ae017e7a0177","fff7f3fde0ddfcc5c0fa9fb5f768a1dd3497ae017e7a017749006a").map(Y),hx=ht(fx);var dx=new Array(3).concat("edf8b17fcdbb2c7fb8","ffffcca1dab441b6c4225ea8","ffffcca1dab441b6c42c7fb8253494","ffffccc7e9b47fcdbb41b6c42c7fb8253494","ffffccc7e9b47fcdbb41b6c41d91c0225ea80c2c84","ffffd9edf8b1c7e9b47fcdbb41b6c41d91c0225ea80c2c84","ffffd9edf8b1c7e9b47fcdbb41b6c41d91c0225ea8253494081d58").map(Y),px=ht(dx);var mx=new Array(3).concat("f7fcb9addd8e31a354","ffffccc2e69978c679238443","ffffccc2e69978c67931a354006837","ffffccd9f0a3addd8e78c67931a354006837","ffffccd9f0a3addd8e78c67941ab5d238443005a32","ffffe5f7fcb9d9f0a3addd8e78c67941ab5d238443005a32","ffffe5f7fcb9d9f0a3addd8e78c67941ab5d238443006837004529").map(Y),yx=ht(mx);var gx=new Array(3).concat("fff7bcfec44fd95f0e","ffffd4fed98efe9929cc4c02","ffffd4fed98efe9929d95f0e993404","ffffd4fee391fec44ffe9929d95f0e993404","ffffd4fee391fec44ffe9929ec7014cc4c028c2d04","ffffe5fff7bcfee391fec44ffe9929ec7014cc4c028c2d04","ffffe5fff7bcfee391fec44ffe9929ec7014cc4c02993404662506").map(Y),bx=ht(gx);var xx=new Array(3).concat("ffeda0feb24cf03b20","ffffb2fecc5cfd8d3ce31a1c","ffffb2fecc5cfd8d3cf03b20bd0026","ffffb2fed976feb24cfd8d3cf03b20bd0026","ffffb2fed976feb24cfd8d3cfc4e2ae31a1cb10026","ffffccffeda0fed976feb24cfd8d3cfc4e2ae31a1cb10026","ffffccffeda0fed976feb24cfd8d3cfc4e2ae31a1cbd0026800026").map(Y),wx=ht(xx);var _x=new Array(3).concat("deebf79ecae13182bd","eff3ffbdd7e76baed62171b5","eff3ffbdd7e76baed63182bd08519c","eff3ffc6dbef9ecae16baed63182bd08519c","eff3ffc6dbef9ecae16baed64292c62171b5084594","f7fbffdeebf7c6dbef9ecae16baed64292c62171b5084594","f7fbffdeebf7c6dbef9ecae16baed64292c62171b508519c08306b").map(Y),vx=ht(_x);var Sx=new Array(3).concat("e5f5e0a1d99b31a354","edf8e9bae4b374c476238b45","edf8e9bae4b374c47631a354006d2c","edf8e9c7e9c0a1d99b74c47631a354006d2c","edf8e9c7e9c0a1d99b74c47641ab5d238b45005a32","f7fcf5e5f5e0c7e9c0a1d99b74c47641ab5d238b45005a32","f7fcf5e5f5e0c7e9c0a1d99b74c47641ab5d238b45006d2c00441b").map(Y),Mx=ht(Sx);var Ix=new Array(3).concat("f0f0f0bdbdbd636363","f7f7f7cccccc969696525252","f7f7f7cccccc969696636363252525","f7f7f7d9d9d9bdbdbd969696636363252525","f7f7f7d9d9d9bdbdbd969696737373525252252525","fffffff0f0f0d9d9d9bdbdbd969696737373525252252525","fffffff0f0f0d9d9d9bdbdbd969696737373525252252525000000").map(Y),Ax=ht(Ix);var Tx=new Array(3).concat("efedf5bcbddc756bb1","f2f0f7cbc9e29e9ac86a51a3","f2f0f7cbc9e29e9ac8756bb154278f","f2f0f7dadaebbcbddc9e9ac8756bb154278f","f2f0f7dadaebbcbddc9e9ac8807dba6a51a34a1486","fcfbfdefedf5dadaebbcbddc9e9ac8807dba6a51a34a1486","fcfbfdefedf5dadaebbcbddc9e9ac8807dba6a51a354278f3f007d").map(Y),Ex=ht(Tx);var Dx=new Array(3).concat("fee0d2fc9272de2d26","fee5d9fcae91fb6a4acb181d","fee5d9fcae91fb6a4ade2d26a50f15","fee5d9fcbba1fc9272fb6a4ade2d26a50f15","fee5d9fcbba1fc9272fb6a4aef3b2ccb181d99000d","fff5f0fee0d2fcbba1fc9272fb6a4aef3b2ccb181d99000d","fff5f0fee0d2fcbba1fc9272fb6a4aef3b2ccb181da50f1567000d").map(Y),Nx=ht(Dx);var Ox=new Array(3).concat("fee6cefdae6be6550d","feeddefdbe85fd8d3cd94701","feeddefdbe85fd8d3ce6550da63603","feeddefdd0a2fdae6bfd8d3ce6550da63603","feeddefdd0a2fdae6bfd8d3cf16913d948018c2d04","fff5ebfee6cefdd0a2fdae6bfd8d3cf16913d948018c2d04","fff5ebfee6cefdd0a2fdae6bfd8d3cf16913d94801a636037f2704").map(Y),Bx=ht(Ox);function Lx(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 Fx=du(Qn(300,.5,0),Qn(-240,.5,1));var Rx=du(Qn(-100,.75,.35),Qn(80,1.5,.8)),kx=du(Qn(260,.75,.35),Qn(80,1.5,.8)),Cx=Qn();function $x(e){(e<0||e>1)&&(e-=Math.floor(e));var t=Math.abs(e-.5);return Cx.h=360*e-100,Cx.s=1.5-1.5*t,Cx.l=.8-.9*t,Cx+""}var Ux=en(),oV=Math.PI/3,sV=Math.PI*2/3;function Px(e){var t;return e=(.5-e)*Math.PI,Ux.r=255*(t=Math.sin(e))*t,Ux.g=255*(t=Math.sin(e+oV))*t,Ux.b=255*(t=Math.sin(e+sV))*t,Ux+""}function zx(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 qx(e){var t=e.length;return function(n){return e[Math.max(0,Math.min(t-1,Math.floor(n*t)))]}}var Vx=qx(Y("44015444025645045745055946075a46085c460a5d460b5e470d60470e6147106347116447136548146748166848176948186a481a6c481b6d481c6e481d6f481f70482071482173482374482475482576482677482878482979472a7a472c7a472d7b472e7c472f7d46307e46327e46337f463480453581453781453882443983443a83443b84433d84433e85423f854240864241864142874144874045884046883f47883f48893e49893e4a893e4c8a3d4d8a3d4e8a3c4f8a3c508b3b518b3b528b3a538b3a548c39558c39568c38588c38598c375a8c375b8d365c8d365d8d355e8d355f8d34608d34618d33628d33638d32648e32658e31668e31678e31688e30698e306a8e2f6b8e2f6c8e2e6d8e2e6e8e2e6f8e2d708e2d718e2c718e2c728e2c738e2b748e2b758e2a768e2a778e2a788e29798e297a8e297b8e287c8e287d8e277e8e277f8e27808e26818e26828e26828e25838e25848e25858e24868e24878e23888e23898e238a8d228b8d228c8d228d8d218e8d218f8d21908d21918c20928c20928c20938c1f948c1f958b1f968b1f978b1f988b1f998a1f9a8a1e9b8a1e9c891e9d891f9e891f9f881fa0881fa1881fa1871fa28720a38620a48621a58521a68522a78522a88423a98324aa8325ab8225ac8226ad8127ad8128ae8029af7f2ab07f2cb17e2db27d2eb37c2fb47c31b57b32b67a34b67935b77937b87838b9773aba763bbb753dbc743fbc7340bd7242be7144bf7046c06f48c16e4ac16d4cc26c4ec36b50c46a52c56954c56856c66758c7655ac8645cc8635ec96260ca6063cb5f65cb5e67cc5c69cd5b6ccd5a6ece5870cf5773d05675d05477d1537ad1517cd2507fd34e81d34d84d44b86d54989d5488bd6468ed64590d74393d74195d84098d83e9bd93c9dd93ba0da39a2da37a5db36a8db34aadc32addc30b0dd2fb2dd2db5de2bb8de29bade28bddf26c0df25c2df23c5e021c8e020cae11fcde11dd0e11cd2e21bd5e21ad8e219dae319dde318dfe318e2e418e5e419e7e419eae51aece51befe51cf1e51df4e61ef6e620f8e621fbe723fde725")),jx=qx(Y("00000401000501010601010802010902020b02020d03030f03031204041405041606051806051a07061c08071e0907200a08220b09240c09260d0a290e0b2b100b2d110c2f120d31130d34140e36150e38160f3b180f3d19103f1a10421c10441d11471e114920114b21114e22115024125325125527125829115a2a115c2c115f2d11612f116331116533106734106936106b38106c390f6e3b0f703d0f713f0f72400f74420f75440f764510774710784910784a10794c117a4e117b4f127b51127c52137c54137d56147d57157e59157e5a167e5c167f5d177f5f187f601880621980641a80651a80671b80681c816a1c816b1d816d1d816e1e81701f81721f817320817521817621817822817922827b23827c23827e24828025828125818326818426818627818827818928818b29818c29818e2a81902a81912b81932b80942c80962c80982d80992d809b2e7f9c2e7f9e2f7fa02f7fa1307ea3307ea5317ea6317da8327daa337dab337cad347cae347bb0357bb2357bb3367ab5367ab73779b83779ba3878bc3978bd3977bf3a77c03a76c23b75c43c75c53c74c73d73c83e73ca3e72cc3f71cd4071cf4070d0416fd2426fd3436ed5446dd6456cd8456cd9466bdb476adc4869de4968df4a68e04c67e24d66e34e65e44f64e55064e75263e85362e95462ea5661eb5760ec5860ed5a5fee5b5eef5d5ef05f5ef1605df2625df2645cf3655cf4675cf4695cf56b5cf66c5cf66e5cf7705cf7725cf8745cf8765cf9785df9795df97b5dfa7d5efa7f5efa815ffb835ffb8560fb8761fc8961fc8a62fc8c63fc8e64fc9065fd9266fd9467fd9668fd9869fd9a6afd9b6bfe9d6cfe9f6dfea16efea36ffea571fea772fea973feaa74feac76feae77feb078feb27afeb47bfeb67cfeb77efeb97ffebb81febd82febf84fec185fec287fec488fec68afec88cfeca8dfecc8ffecd90fecf92fed194fed395fed597fed799fed89afdda9cfddc9efddea0fde0a1fde2a3fde3a5fde5a7fde7a9fde9aafdebacfcecaefceeb0fcf0b2fcf2b4fcf4b6fcf6b8fcf7b9fcf9bbfcfbbdfcfdbf")),Yx=qx(Y("00000401000501010601010802010a02020c02020e03021004031204031405041706041907051b08051d09061f0a07220b07240c08260d08290e092b10092d110a30120a32140b34150b37160b39180c3c190c3e1b0c411c0c431e0c451f0c48210c4a230c4c240c4f260c51280b53290b552b0b572d0b592f0a5b310a5c320a5e340a5f3609613809623909633b09643d09653e0966400a67420a68440a68450a69470b6a490b6a4a0c6b4c0c6b4d0d6c4f0d6c510e6c520e6d540f6d550f6d57106e59106e5a116e5c126e5d126e5f136e61136e62146e64156e65156e67166e69166e6a176e6c186e6d186e6f196e71196e721a6e741a6e751b6e771c6d781c6d7a1d6d7c1d6d7d1e6d7f1e6c801f6c82206c84206b85216b87216b88226a8a226a8c23698d23698f24699025689225689326679526679727669827669a28659b29649d29649f2a63a02a63a22b62a32c61a52c60a62d60a82e5fa92e5eab2f5ead305dae305cb0315bb1325ab3325ab43359b63458b73557b93556ba3655bc3754bd3853bf3952c03a51c13a50c33b4fc43c4ec63d4dc73e4cc83f4bca404acb4149cc4248ce4347cf4446d04545d24644d34743d44842d54a41d74b3fd84c3ed94d3dda4e3cdb503bdd513ade5238df5337e05536e15635e25734e35933e45a31e55c30e65d2fe75e2ee8602de9612bea632aeb6429eb6628ec6726ed6925ee6a24ef6c23ef6e21f06f20f1711ff1731df2741cf3761bf37819f47918f57b17f57d15f67e14f68013f78212f78410f8850ff8870ef8890cf98b0bf98c0af98e09fa9008fa9207fa9407fb9606fb9706fb9906fb9b06fb9d07fc9f07fca108fca309fca50afca60cfca80dfcaa0ffcac11fcae12fcb014fcb216fcb418fbb61afbb81dfbba1ffbbc21fbbe23fac026fac228fac42afac62df9c72ff9c932f9cb35f8cd37f8cf3af7d13df7d340f6d543f6d746f5d949f5db4cf4dd4ff4df53f4e156f3e35af3e55df2e661f2e865f2ea69f1ec6df1ed71f1ef75f1f179f2f27df2f482f3f586f3f68af4f88ef5f992f6fa96f8fb9af9fc9dfafda1fcffa4")),Wx=qx(Y("0d088710078813078916078a19068c1b068d1d068e20068f2206902406912605912805922a05932c05942e05952f059631059733059735049837049938049a3a049a3c049b3e049c3f049c41049d43039e44039e46039f48039f4903a04b03a14c02a14e02a25002a25102a35302a35502a45601a45801a45901a55b01a55c01a65e01a66001a66100a76300a76400a76600a76700a86900a86a00a86c00a86e00a86f00a87100a87201a87401a87501a87701a87801a87a02a87b02a87d03a87e03a88004a88104a78305a78405a78606a68707a68808a68a09a58b0aa58d0ba58e0ca48f0da4910ea3920fa39410a29511a19613a19814a099159f9a169f9c179e9d189d9e199da01a9ca11b9ba21d9aa31e9aa51f99a62098a72197a82296aa2395ab2494ac2694ad2793ae2892b02991b12a90b22b8fb32c8eb42e8db52f8cb6308bb7318ab83289ba3388bb3488bc3587bd3786be3885bf3984c03a83c13b82c23c81c33d80c43e7fc5407ec6417dc7427cc8437bc9447aca457acb4679cc4778cc4977cd4a76ce4b75cf4c74d04d73d14e72d24f71d35171d45270d5536fd5546ed6556dd7566cd8576bd9586ada5a6ada5b69db5c68dc5d67dd5e66de5f65de6164df6263e06363e16462e26561e26660e3685fe4695ee56a5de56b5de66c5ce76e5be76f5ae87059e97158e97257ea7457eb7556eb7655ec7754ed7953ed7a52ee7b51ef7c51ef7e50f07f4ff0804ef1814df1834cf2844bf3854bf3874af48849f48948f58b47f58c46f68d45f68f44f79044f79143f79342f89441f89540f9973ff9983ef99a3efa9b3dfa9c3cfa9e3bfb9f3afba139fba238fca338fca537fca636fca835fca934fdab33fdac33fdae32fdaf31fdb130fdb22ffdb42ffdb52efeb72dfeb82cfeba2cfebb2bfebd2afebe2afec029fdc229fdc328fdc527fdc627fdc827fdca26fdcb26fccd25fcce25fcd025fcd225fbd324fbd524fbd724fad824fada24f9dc24f9dd25f8df25f8e125f7e225f7e425f6e626f6e826f5e926f5eb27f4ed27f3ee27f3f027f2f227f1f426f1f525f0f724f0f921"));function Ze(e){return function(){return e}}var HS=Math.cos;var Pu=Math.min,Rp=Math.sin,te=Math.sqrt,ZS=1e-12,el=Math.PI,iIt=el/2,zu=2*el;function Gx(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 ga(t)}var cIt=Array.prototype.slice;function Xx(e){return typeof e=="object"&&"length"in e?e:Array.from(e)}function V5(e){this._context=e}V5.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 Ds(e){return new V5(e)}function Hx(e){return e[0]}function Zx(e){return e[1]}function kp(e,t){var n=Ze(!0),r=null,i=Ds,o=null,s=Gx(a);e=typeof e=="function"?e:e===void 0?Hx:Ze(e),t=typeof t=="function"?t:t===void 0?Zx:Ze(t);function a(c){var l,u=(c=Xx(c)).length,f,h=!1,d;for(r==null&&(o=i(d=s())),l=0;l<=u;++l)!(l<u&&n(f=c[l],l,c))===h&&((h=!h)?o.lineStart():o.lineEnd()),h&&o.point(+e(f,l,c),+t(f,l,c));if(d)return o=null,d+""||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 qu(e,t,n){var r=null,i=Ze(!0),o=null,s=Ds,a=null,c=Gx(l);e=typeof e=="function"?e:e===void 0?Hx:Ze(+e),t=typeof t=="function"?t:t===void 0?Ze(0):Ze(+t),n=typeof n=="function"?n:n===void 0?Zx:Ze(+n);function l(f){var h,d,p,m=(f=Xx(f)).length,y,g=!1,b,x=new Array(m),w=new Array(m);for(o==null&&(a=s(b=c())),h=0;h<=m;++h){if(!(h<m&&i(y=f[h],h,f))===g)if(g=!g)d=h,a.areaStart(),a.lineStart();else{for(a.lineEnd(),a.lineStart(),p=h-1;p>=d;--p)a.point(x[p],w[p]);a.lineEnd(),a.areaEnd()}g&&(x[h]=+e(y,h,f),w[h]=+t(y,h,f),a.point(r?+r(y,h,f):x[h],n?+n(y,h,f):w[h]))}if(b)return a=null,b+""||null}function u(){return kp().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 Qx=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 QS(e){return new Qx(e,!0)}function KS(e){return new Qx(e,!1)}var aV=te(3),$p={draw(e,t){let n=te(t+Pu(t/28,.75))*.59436,r=n/2,i=r*aV;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 Ns={draw(e,t){let n=te(t/el);e.moveTo(n,0),e.arc(0,0,n,0,zu)}};var Up={draw(e,t){let n=te(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 j5=te(1/3),cV=j5*2,Pp={draw(e,t){let n=te(t/cV),r=n*j5;e.moveTo(0,-n),e.lineTo(r,0),e.lineTo(0,n),e.lineTo(-r,0),e.closePath()}};var zp={draw(e,t){let n=te(t)*.62625;e.moveTo(0,-n),e.lineTo(n,0),e.lineTo(0,n),e.lineTo(-n,0),e.closePath()}};var qp={draw(e,t){let n=te(t-Pu(t/7,2))*.87559;e.moveTo(-n,0),e.lineTo(n,0),e.moveTo(0,n),e.lineTo(0,-n)}};var Vp={draw(e,t){let n=te(t),r=-n/2;e.rect(r,r,n,n)}};var jp={draw(e,t){let n=te(t)*.4431;e.moveTo(n,n),e.lineTo(n,-n),e.lineTo(-n,-n),e.lineTo(-n,n),e.closePath()}};var lV=.8908130915292852,Y5=Rp(el/10)/Rp(7*el/10),uV=Rp(zu/10)*Y5,fV=-HS(zu/10)*Y5,Yp={draw(e,t){let n=te(t*lV),r=uV*n,i=fV*n;e.moveTo(0,-n),e.lineTo(r,i);for(let o=1;o<5;++o){let s=zu*o/5,a=HS(s),c=Rp(s);e.lineTo(c*n,-a*n),e.lineTo(a*r-c*i,c*r+a*i)}e.closePath()}};var JS=te(3),Wp={draw(e,t){let n=-te(t/(JS*3));e.moveTo(0,n*2),e.lineTo(-JS*n,-n),e.lineTo(JS*n,-n),e.closePath()}};var hV=te(3),Gp={draw(e,t){let n=te(t)*.6824,r=n/2,i=n*hV/2;e.moveTo(0,-n),e.lineTo(i,r),e.lineTo(-i,r),e.closePath()}};var oi=-.5,si=te(3)/2,t3=1/te(12),dV=(t3/2+1)*3,Xp={draw(e,t){let n=te(t/dV),r=n/2,i=n*t3,o=r,s=n*t3+n,a=-o,c=s;e.moveTo(r,i),e.lineTo(o,s),e.lineTo(a,c),e.lineTo(oi*r-si*i,si*r+oi*i),e.lineTo(oi*o-si*s,si*o+oi*s),e.lineTo(oi*a-si*c,si*a+oi*c),e.lineTo(oi*r+si*i,oi*i-si*r),e.lineTo(oi*o+si*s,oi*s-si*o),e.lineTo(oi*a+si*c,oi*c-si*a),e.closePath()}};var Vu={draw(e,t){let n=te(t-Pu(t/6,1.7))*.6189;e.moveTo(-n,-n),e.lineTo(n,n),e.moveTo(-n,n),e.lineTo(n,-n)}};var Kx=[Ns,Up,Pp,Vp,Yp,Wp,Xp],e3=[Ns,qp,Vu,Gp,$p,jp,zp];function ai(){}function ju(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 Hp(e){this._context=e}Hp.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:ju(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:ju(this,e,t);break}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t}};function n3(e){return new Hp(e)}function W5(e){this._context=e}W5.prototype={areaStart:ai,areaEnd:ai,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:ju(this,e,t);break}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t}};function r3(e){return new W5(e)}function G5(e){this._context=e}G5.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:ju(this,e,t);break}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t}};function i3(e){return new G5(e)}function X5(e,t){this._basis=new Hp(e),this._beta=t}X5.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 o3=function e(t){function n(r){return t===1?new Hp(r):new X5(r,t)}return n.beta=function(r){return e(+r)},n}(.85);function Yu(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 Jx(e,t){this._context=e,this._k=(1-t)/6}Jx.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:Yu(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:Yu(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 s3=function e(t){function n(r){return new Jx(r,t)}return n.tension=function(r){return e(+r)},n}(0);function t1(e,t){this._context=e,this._k=(1-t)/6}t1.prototype={areaStart:ai,areaEnd:ai,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:Yu(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 a3=function e(t){function n(r){return new t1(r,t)}return n.tension=function(r){return e(+r)},n}(0);function e1(e,t){this._context=e,this._k=(1-t)/6}e1.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:Yu(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 c3=function e(t){function n(r){return new e1(r,t)}return n.tension=function(r){return e(+r)},n}(0);function Zp(e,t,n){var r=e._x1,i=e._y1,o=e._x2,s=e._y2;if(e._l01_a>ZS){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>ZS){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 H5(e,t){this._context=e,this._alpha=t}H5.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:Zp(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 l3=function e(t){function n(r){return t?new H5(r,t):new Jx(r,0)}return n.alpha=function(r){return e(+r)},n}(.5);function Z5(e,t){this._context=e,this._alpha=t}Z5.prototype={areaStart:ai,areaEnd:ai,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:Zp(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 u3=function e(t){function n(r){return t?new Z5(r,t):new t1(r,0)}return n.alpha=function(r){return e(+r)},n}(.5);function Q5(e,t){this._context=e,this._alpha=t}Q5.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:Zp(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 f3=function e(t){function n(r){return t?new Q5(r,t):new e1(r,0)}return n.alpha=function(r){return e(+r)},n}(.5);function K5(e){this._context=e}K5.prototype={areaStart:ai,areaEnd:ai,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 h3(e){return new K5(e)}function J5(e){return e<0?-1:1}function tD(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(J5(o)+J5(s))*Math.min(Math.abs(o),Math.abs(s),.5*Math.abs(a))||0}function eD(e,t){var n=e._x1-e._x0;return n?(3*(e._y1-e._y0)/n-t)/2:t}function d3(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 n1(e){this._context=e}n1.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:d3(this,this._t0,eD(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,d3(this,eD(this,n=tD(this,e,t)),n);break;default:d3(this,this._t0,n=tD(this,e,t));break}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t,this._t0=n}}};function nD(e){this._context=new rD(e)}(nD.prototype=Object.create(n1.prototype)).point=function(e,t){n1.prototype.point.call(this,t,e)};function rD(e){this._context=e}rD.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 p3(e){return new n1(e)}function m3(e){return new nD(e)}function oD(e){this._context=e}oD.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=iD(e),i=iD(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 iD(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 y3(e){return new oD(e)}function r1(e,t){this._context=e,this._t=t}r1.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 g3(e){return new r1(e,.5)}function b3(e){return new r1(e,0)}function x3(e){return new r1(e,1)}var Qp=e=>()=>e;function w3(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 Lr(e,t,n){this.k=e,this.x=t,this.y=n}Lr.prototype={constructor:Lr,scale:function(e){return e===1?this:new Lr(this.k*e,this.x,this.y)},translate:function(e,t){return e===0&t===0?this:new Lr(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 Kp=new Lr(1,0,0);_3.prototype=Lr.prototype;function _3(e){for(;!e.__zoom;)if(!(e=e.parentNode))return Kp;return e.__zoom}function i1(e){e.stopImmediatePropagation()}function Wu(e){e.preventDefault(),e.stopImmediatePropagation()}function pV(e){return(!e.ctrlKey||e.type==="wheel")&&!e.button}function mV(){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 sD(){return this.__zoom||Kp}function yV(e){return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*(e.ctrlKey?10:1)}function gV(){return navigator.maxTouchPoints||"ontouchstart"in this}function bV(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 v3(){var e=pV,t=mV,n=bV,r=yV,i=gV,o=[0,1/0],s=[[-1/0,-1/0],[1/0,1/0]],a=250,c=Hv,l=Dc("start","zoom","end"),u,f,h,d=500,p=150,m=0,y=10;function g(S){S.property("__zoom",sD).on("wheel.zoom",E,{passive:!1}).on("mousedown.zoom",I).on("dblclick.zoom",N).filter(i).on("touchstart.zoom",A).on("touchmove.zoom",O).on("touchend.zoom touchcancel.zoom",L).style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}g.transform=function(S,T,D,C){var R=S.selection?S.selection():S;R.property("__zoom",sD),S!==R?v(S,T,D,C):R.interrupt().each(function(){_(this,arguments).event(C).start().zoom(null,typeof T=="function"?T.apply(this,arguments):T).end()})},g.scaleBy=function(S,T,D,C){g.scaleTo(S,function(){var R=this.__zoom.k,F=typeof T=="function"?T.apply(this,arguments):T;return R*F},D,C)},g.scaleTo=function(S,T,D,C){g.transform(S,function(){var R=t.apply(this,arguments),F=this.__zoom,k=D==null?w(R):typeof D=="function"?D.apply(this,arguments):D,$=F.invert(k),U=typeof T=="function"?T.apply(this,arguments):T;return n(x(b(F,U),k,$),R,s)},D,C)},g.translateBy=function(S,T,D,C){g.transform(S,function(){return n(this.__zoom.translate(typeof T=="function"?T.apply(this,arguments):T,typeof D=="function"?D.apply(this,arguments):D),t.apply(this,arguments),s)},null,C)},g.translateTo=function(S,T,D,C,R){g.transform(S,function(){var F=t.apply(this,arguments),k=this.__zoom,$=C==null?w(F):typeof C=="function"?C.apply(this,arguments):C;return n(Kp.translate($[0],$[1]).scale(k.k).translate(typeof T=="function"?-T.apply(this,arguments):-T,typeof D=="function"?-D.apply(this,arguments):-D),F,s)},C,R)};function b(S,T){return T=Math.max(o[0],Math.min(o[1],T)),T===S.k?S:new Lr(T,S.x,S.y)}function x(S,T,D){var C=T[0]-D[0]*S.k,R=T[1]-D[1]*S.k;return C===S.x&&R===S.y?S:new Lr(S.k,C,R)}function w(S){return[(+S[0][0]+ +S[1][0])/2,(+S[0][1]+ +S[1][1])/2]}function v(S,T,D,C){S.on("start.zoom",function(){_(this,arguments).event(C).start()}).on("interrupt.zoom end.zoom",function(){_(this,arguments).event(C).end()}).tween("zoom",function(){var R=this,F=arguments,k=_(R,F).event(C),$=t.apply(R,F),U=D==null?w($):typeof D=="function"?D.apply(R,F):D,G=Math.max($[1][0]-$[0][0],$[1][1]-$[0][1]),et=R.__zoom,rt=typeof T=="function"?T.apply(R,F):T,st=c(et.invert(U).concat(G/et.k),rt.invert(U).concat(G/rt.k));return function(j){if(j===1)j=rt;else{var ot=st(j),z=G/ot[2];j=new Lr(z,U[0]-ot[0]*z,U[1]-ot[1]*z)}k.zoom(null,j)}})}function _(S,T,D){return!D&&S.__zooming||new M(S,T)}function M(S,T){this.that=S,this.args=T,this.active=0,this.sourceEvent=null,this.extent=t.apply(S,T),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,T){return this.mouse&&S!=="mouse"&&(this.mouse[1]=T.invert(this.mouse[0])),this.touch0&&S!=="touch"&&(this.touch0[1]=T.invert(this.touch0[0])),this.touch1&&S!=="touch"&&(this.touch1[1]=T.invert(this.touch1[0])),this.that.__zoom=T,this.emit("zoom"),this},end:function(){return--this.active===0&&(delete this.that.__zooming,this.emit("end")),this},emit:function(S){var T=Pt(this.that).datum();l.call(S,this.that,new w3(S,{sourceEvent:this.sourceEvent,target:g,type:S,transform:this.that.__zoom,dispatch:l}),T)}};function E(S,...T){if(!e.apply(this,arguments))return;var D=_(this,T).event(S),C=this.__zoom,R=Math.max(o[0],Math.min(o[1],C.k*Math.pow(2,r.apply(this,arguments)))),F=Fn(S);if(D.wheel)(D.mouse[0][0]!==F[0]||D.mouse[0][1]!==F[1])&&(D.mouse[1]=C.invert(D.mouse[0]=F)),clearTimeout(D.wheel);else{if(C.k===R)return;D.mouse=[F,C.invert(F)],po(this),D.start()}Wu(S),D.wheel=setTimeout(k,p),D.zoom("mouse",n(x(b(C,R),D.mouse[0],D.mouse[1]),D.extent,s));function k(){D.wheel=null,D.end()}}function I(S,...T){if(h||!e.apply(this,arguments))return;var D=S.currentTarget,C=_(this,T,!0).event(S),R=Pt(S.view).on("mousemove.zoom",U,!0).on("mouseup.zoom",G,!0),F=Fn(S,D),k=S.clientX,$=S.clientY;Ed(S.view),i1(S),C.mouse=[F,this.__zoom.invert(F)],po(this),C.start();function U(et){if(Wu(et),!C.moved){var rt=et.clientX-k,st=et.clientY-$;C.moved=rt*rt+st*st>m}C.event(et).zoom("mouse",n(x(C.that.__zoom,C.mouse[0]=Fn(et,D),C.mouse[1]),C.extent,s))}function G(et){R.on("mousemove.zoom mouseup.zoom",null),Dd(et.view,C.moved),Wu(et),C.event(et).end()}}function N(S,...T){if(e.apply(this,arguments)){var D=this.__zoom,C=Fn(S.changedTouches?S.changedTouches[0]:S,this),R=D.invert(C),F=D.k*(S.shiftKey?.5:2),k=n(x(b(D,F),C,R),t.apply(this,T),s);Wu(S),a>0?Pt(this).transition().duration(a).call(v,k,C,S):Pt(this).call(g.transform,k,C,S)}}function A(S,...T){if(e.apply(this,arguments)){var D=S.touches,C=D.length,R=_(this,T,S.changedTouches.length===C).event(S),F,k,$,U;for(i1(S),k=0;k<C;++k)$=D[k],U=Fn($,this),U=[U,this.__zoom.invert(U),$.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},d)),po(this),R.start())}}function O(S,...T){if(this.__zooming){var D=_(this,T).event(S),C=S.changedTouches,R=C.length,F,k,$,U;for(Wu(S),F=0;F<R;++F)k=C[F],$=Fn(k,this),D.touch0&&D.touch0[2]===k.identifier?D.touch0[0]=$:D.touch1&&D.touch1[2]===k.identifier&&(D.touch1[0]=$);if(k=D.that.__zoom,D.touch1){var G=D.touch0[0],et=D.touch0[1],rt=D.touch1[0],st=D.touch1[1],j=(j=rt[0]-G[0])*j+(j=rt[1]-G[1])*j,ot=(ot=st[0]-et[0])*ot+(ot=st[1]-et[1])*ot;k=b(k,Math.sqrt(j/ot)),$=[(G[0]+rt[0])/2,(G[1]+rt[1])/2],U=[(et[0]+st[0])/2,(et[1]+st[1])/2]}else if(D.touch0)$=D.touch0[0],U=D.touch0[1];else return;D.zoom("touch",n(x(k,$,U),D.extent,s))}}function L(S,...T){if(this.__zooming){var D=_(this,T).event(S),C=S.changedTouches,R=C.length,F,k;for(i1(S),h&&clearTimeout(h),h=setTimeout(function(){h=null},d),F=0;F<R;++F)k=C[F],D.touch0&&D.touch0[2]===k.identifier?delete D.touch0:D.touch1&&D.touch1[2]===k.identifier&&delete D.touch1;if(D.touch1&&!D.touch0&&(D.touch0=D.touch1,delete D.touch1),D.touch0)D.touch0[1]=this.__zoom.invert(D.touch0[0]);else if(D.end(),D.taps===2&&(k=Fn(k,this),Math.hypot(f[0]-k[0],f[1]-k[1])<y)){var $=Pt(this).on("dblclick.zoom");$&&$.apply(this,arguments)}}}return g.wheelDelta=function(S){return arguments.length?(r=typeof S=="function"?S:Qp(+S),g):r},g.filter=function(S){return arguments.length?(e=typeof S=="function"?S:Qp(!!S),g):e},g.touchable=function(S){return arguments.length?(i=typeof S=="function"?S:Qp(!!S),g):i},g.extent=function(S){return arguments.length?(t=typeof S=="function"?S:Qp([[+S[0][0],+S[0][1]],[+S[1][0],+S[1][1]]]),g):t},g.scaleExtent=function(S){return arguments.length?(o[0]=+S[0],o[1]=+S[1],g):[o[0],o[1]]},g.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],g):[[s[0][0],s[0][1]],[s[1][0],s[1][1]]]},g.constrain=function(S){return arguments.length?(n=S,g):n},g.duration=function(S){return arguments.length?(a=+S,g):a},g.interpolate=function(S){return arguments.length?(c=S,g):c},g.on=function(){var S=l.on.apply(l,arguments);return S===l?g:S},g.clickDistance=function(S){return arguments.length?(m=(S=+S)*S,g):Math.sqrt(m)},g.tapDistance=function(S){return arguments.length?(y=+S,g):y},g}function $e(e){return e!=null&&!Number.isNaN(e)}function fn(e,t){return+$e(t)-+$e(e)||Et(e,t)}function nl(e,t){return+$e(t)-+$e(e)||Gn(e,t)}function Jp(e){return e!=null&&`${e}`!=""}function Gu(e){return isFinite(e)?e:NaN}function ir(e){return e>0&&isFinite(e)?e:NaN}function Aa(e){return e<0&&isFinite(e)?e:NaN}function o1(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`${xV(e.getUTCFullYear(),4)}-${Os(e.getUTCMonth()+1,2)}-${Os(e.getUTCDate(),2)}${n||r||i||o?`T${Os(n,2)}:${Os(r,2)}${i||o?`:${Os(i,2)}${o?`.${Os(o,3)}`:""}`:""}Z`:""}`}function xV(e){return e<0?`-${Os(-e,6)}`:e>9999?`+${Os(e,6)}`:Os(e,4)}function Os(e,t){return`${e}`.padStart(t,"0")}var wV=/^(?:[-+]\d{2})?\d{4}(?:-\d{2}(?:-\d{2})?)?(?:T\d{2}:\d{2}(?::\d{2}(?:\.\d{3})?)?(?:Z|[-+]\d{2}:?\d{2})?)?$/;function tm(e,t){return wV.test(e+="")?new Date(e):typeof t=="function"?t(e):t}function Bs(e){if(e==null)return;let t=e[0],n=e[e.length-1];return Gn(t,n)}var Hu=1e3,Ea=Hu*60,Da=Ea*60,Eo=Da*24,To=Eo*7,rl=Eo*30,Ta=Eo*365,S3=[["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",Hu],["5 seconds",5*Hu],["15 seconds",15*Hu],["30 seconds",30*Hu],["minute",Ea],["5 minutes",5*Ea],["15 minutes",15*Ea],["30 minutes",30*Ea],["hour",Da],["3 hours",3*Da],["6 hours",6*Da],["12 hours",12*Da],["day",Eo],["2 days",2*Eo],["week",To],["2 weeks",2*To],["month",rl],["3 months",3*rl],["6 months",6*rl],["year",Ta],["2 years",2*Ta],["5 years",5*Ta],["10 years",10*Ta],["20 years",20*Ta],["50 years",50*Ta],["100 years",100*Ta]],M3=new Map([["second",Hu],["minute",Ea],["hour",Da],["day",Eo],["monday",To],["tuesday",To],["wednesday",To],["thursday",To],["friday",To],["saturday",To],["sunday",To],["week",To],["month",rl],["year",Ta]]),cD=new Map([["second",ln],["minute",Ss],["hour",Is],["day",ii],["monday",Ma],["tuesday",vb],["wednesday",Sb],["thursday",Mo],["friday",Mb],["saturday",Ib],["sunday",Or],["week",Or],["month",Ts],["year",Un]]),I3=new Map([["second",ln],["minute",Ms],["hour",As],["day",Kc],["monday",Ia],["tuesday",Ab],["wednesday",Tb],["thursday",Io],["friday",Eb],["saturday",Db],["sunday",Br],["week",Br],["month",Es],["year",Pn]]),Zu=Symbol("intervalDuration"),a1=Symbol("intervalType");for(let[e,t]of cD)t[Zu]=M3.get(e),t[a1]="time";for(let[e,t]of I3)t[Zu]=M3.get(e),t[a1]="utc";var em=[["year",Pn,"utc"],["month",Es,"utc"],["day",Kc,"utc",6*rl],["hour",As,"utc",3*Eo],["minute",Ms,"utc",6*Da],["second",ln,"utc",30*Ea]],s1=[["year",Un,"time"],["month",Ts,"time"],["day",ii,"time",6*rl],["hour",Is,"time",3*Eo],["minute",Ss,"time",6*Da],["second",ln,"time",30*Ea]],_V=[em[0],s1[0],em[1],s1[1],em[2],s1[2],...em.slice(3)];function c1(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=I3.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 A3(e){return lD(c1(e),"time")}function nm(e){return lD(c1(e),"utc")}function lD([e,t],n){let r=(n==="time"?cD:I3).get(e);return t>1&&(r=r.every(t),r[Zu]=M3.get(e)*t,r[a1]=n),r}function T3(e,t){if(!(t>1))return;let n=e[Zu];if(!S3.some(([,i])=>i===n)||n%Eo===0&&Eo<n&&n<rl)return;let[r]=S3[cs(([,i])=>Math.log(i)).center(S3,Math.log(n*t))];return(e[a1]==="time"?A3:nm)(r)}function aD(e,t,n){let r=t==="time"?ku:Ao;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=vV(n);switch(e){case"millisecond":return Xu(r(".%L"),r(":%M:%S"),i);case"second":return Xu(r(":%S"),r("%-I:%M"),i);case"minute":return Xu(r("%-I:%M"),r("%p"),i);case"hour":return Xu(r("%-I %p"),r("%b %-d"),i);case"day":return Xu(r("%-d"),r("%b"),i);case"month":return Xu(r("%b"),r("%Y"),i);case"year":return r("%Y")}throw new Error("unable to format time ticks")}function vV(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 Xq(e){return e==="time"?Hx:e==="utc"?Zp:Wq}function LD(e,t,n){let r=Yt(j0(t,(i,o)=>Math.abs(o-i)));if(r<1e3)return ND("millisecond","utc",n);for(let[i,o,s,a]of Xq(e)){if(r>a||i==="hour"&&!r)break;if(t.every(c=>o.floor(c)>=c))return ND(i,s,n)}}function Vu(e,t,n){return(r,i,o)=>{let s=e(r,i),a=t(r,i),c=i-Es(o);return i!==c&&o[c]!==void 0&&a===t(o[c],c)?s:n(s,a)}}var Jc=Object.getPrototypeOf(Uint8Array),Hq=Object.prototype.toString,sI=Symbol("reindex");function bt(e,t,n){let r=typeof t;return r==="string"?FD(e,aI(t),n):r==="function"?FD(e,t,n):r==="number"||t instanceof Date||r==="boolean"?Vt(e,fn(t),n):typeof t?.transform=="function"?CD(t.transform(e),n):Zq(CD(t,n),e?.[sI])}function Zq(e,t){return t?Jp(e,t):e}function FD(e,t,n){return Vt(e,n?.prototype instanceof Jc?Kq(t):t,n)}function CD(e,t){return t===void 0?Pe(e):e instanceof t?e:t.prototype instanceof Jc&&!(e instanceof Jc)?t.from(e,cI):t.from(e)}function Kq(e){return(t,n)=>cI(e(t,n))}var Ta=[null],aI=e=>t=>t[e],Ie={transform:rr},W={transform:e=>e};var Qp=()=>1,kD=()=>!0,Ue=e=>e==null?e:`${e}`,Dt=e=>e==null?e:+e;var tl=e=>e?e[0]:void 0,Ea=e=>e?e[1]:void 0,RD=e=>e?e[2]:void 0,fn=e=>()=>e;function Wu(e){let t=+`${e}`.slice(1)/100;return(n,r)=>Xn(n,t,r)}function Ze(e){return e instanceof Jc?e:Vt(e,cI,Float64Array)}function cI(e){return e==null?NaN:Number(e)}function $D(e){return Vt(e,lI)}function lI(e){return e instanceof Date&&!isNaN(e)?e:typeof e=="string"?Hp(e):e==null||isNaN(e=+e)?void 0:new Date(e)}function Ee(e,t){return e===void 0&&(e=t),e===null?[void 0,"none"]:Ba(e)?[void 0,e]:[e,void 0]}function re(e,t){return e===void 0&&(e=t),e===null||typeof e=="number"?[void 0,e]:[e,void 0]}function uI(e,t,n){if(e!=null)return nn(e,t,n)}function nn(e,t,n){let r=`${e}`.toLowerCase();if(!n.includes(r))throw new Error(`invalid ${t}: ${e}`);return r}function Pe(e){return e==null||e instanceof Array||e instanceof Jc?e:Array.from(e)}function Vt(e,t,n=Array){return e==null?e:e instanceof n?e.map(t):n.from(e,t)}function Da(e,t=Array){return e instanceof t?e.slice():t.from(e)}function fI({x:e,x1:t,x2:n}){return e!==void 0||t!==void 0||n!==void 0}function hI({y:e,y1:t,y2:n}){return e!==void 0||t!==void 0||n!==void 0}function Gu(e){return fI(e)||hI(e)||e.interval!==void 0}function hn(e){return e?.toString===Hq}function Ao(e){return hn(e)&&(e.type!==void 0||e.domain!==void 0)}function Lr(e){return hn(e)&&typeof e.transform!="function"}function To(e){return Lr(e)&&e.value===void 0&&e.channel===void 0}function dI(e,t,n,r=W){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 ke(e,t){return e===void 0&&t===void 0?[tl,Ea]:[e,t]}function Un({z:e,fill:t,stroke:n}={}){return e===void 0&&([e]=Ee(t)),e===void 0&&([e]=Ee(n)),e}function rr(e){let t=e.length,n=new Uint32Array(t);for(let r=0;r<t;++r)n[r]=r;return n}function Jp(e,t){return Vt(t,n=>e[n],e.constructor)}function Xu(e){return e.length===1?(t,n)=>e(Jp(n,t)):e}function Ds(e,t,n){return e.subarray?e.subarray(t,n):e.slice(t,n)}function Ns(e){return e!==null&&typeof e=="object"?e.valueOf():e}function Qx(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:Dn(e)},n=>t=n]}function En(e){return e==null?[e]:dn(e)}function Dn(e,t){return typeof e=="string"?e:e&&e.label!==void 0?e.label:t}function Hu(e,t){return{transform(n){let r=e.transform(n),i=t.transform(n);return De(r)||De(i)?Vt(r,(o,s)=>new Date((+r[s]+ +i[s])/2)):Vt(r,(o,s)=>(+r[s]+ +i[s])/2,Float64Array)},label:e.label}}function el(e,t){let n=pI(t?.interval,t?.type);return n?Vt(e,n):e}function pI(e,t){let n=Zu(e,t);return n&&(r=>$e(r)?n.floor(r):r)}function Zu(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)=>Re(Math.ceil(r*n),i*n).map(o=>o/n)}:{floor:r=>Math.floor(r/n)*n,offset:r=>r+n,range:(r,i)=>Re(Math.ceil(r/n),i/n).map(o=>o*n)}}if(typeof e=="string")return(t==="time"?iI:Kp)(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 Eo(e,t){if(e=Zu(e,t),e&&typeof e.range!="function")throw new Error("invalid interval: missing range method");return e}function UD(e,t){if(e=Eo(e,t),e&&typeof e.ceil!="function")throw new Error("invalid interval: missing ceil method");return e}function PD(e){return Na(e)&&typeof e?.floor=="function"&&e.floor()instanceof Date}function Na(e){return typeof e?.range=="function"}function si(e){return e===void 0||Lr(e)?e:{value:e}}function zD(e){return e==null?null:{transform:t=>bt(t,e,Float64Array),label:Dn(e)}}function qD(e){if(!ir(e))return!1;for(let t of e)if(t!=null)return typeof t=="object"&&"0"in t&&"1"in t}function ir(e){return e&&typeof e[Symbol.iterator]=="function"}function Jx(e){for(let t of e)if(t!=null)return typeof t!="object"||t instanceof Date}function Me(e){for(let t of e){if(t==null)continue;let n=typeof t;return n==="string"||n==="boolean"}}function De(e){for(let t of e)if(t!=null)return t instanceof Date}function VD(e){for(let t of e)if(t!=null)return typeof t=="string"&&isNaN(t)&&Hp(t)}function jD(e){for(let t of e)if(t!=null){if(typeof t!="string")return!1;if(t.trim())return!isNaN(t)}}function Bs(e){for(let t of e)if(t!=null)return typeof t=="number"}function t1(e,t){let n;for(let r of e)if(r!=null){if(!t(r))return!1;n=!0}return n}var Qq=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 Ba(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)||Qq.has(e))}function YD(e){return typeof e=="number"&&(0<=e&&e<=1||isNaN(e))}function te(e){return e==null||Os(e)}function Os(e){return/^\s*none\s*$/i.test(e)}function WD(e){return/^\s*round\s*$/i.test(e)}function e1(e,t){return uI(e,t,["middle","top-left","top","top-right","right","bottom-right","bottom","bottom-left","left"])}function Do(e="middle"){return e1(e,"frameAnchor")}function GD(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 Jq(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 tm(e){return ir(e)?Jq(e):e}function n1(e){return e===!0?e="frame":e===!1?e=null:e!=null&&(e=nn(e,"clip",["frame","sphere"])),e}var ai=Symbol("position"),Fr=Symbol("color"),nl=Symbol("radius"),rl=Symbol("length"),il=Symbol("opacity"),Ku=Symbol("symbol"),XD=Symbol("projection"),le=new Map([["x",ai],["y",ai],["fx",ai],["fy",ai],["r",nl],["color",Fr],["opacity",il],["symbol",Ku],["length",rl],["projection",XD]]);function HD(e){return e===ai||e===XD}function ZD(e){return e===ai||e===nl||e===rl||e===il}var mI=Math.sqrt(3),yI=2/mI,tV={draw(e,t){let n=Math.sqrt(t/Math.PI),r=n*yI,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()}},gI=new Map([["asterisk",Lp],["circle",As],["cross",Fp],["diamond",Cp],["diamond2",kp],["hexagon",tV],["plus",Rp],["square",$p],["square2",Up],["star",Pp],["times",$u],["triangle",zp],["triangle2",qp],["wye",Vp]]);function bI(e){return e&&typeof e.draw=="function"}function KD(e){return bI(e)?!0:typeof e!="string"?!1:gI.has(e.toLowerCase())}function Qu(e){if(e==null||bI(e))return e;let t=gI.get(`${e}`.toLowerCase());if(t)return t;throw new Error(`invalid symbol: ${e}`)}function QD(e){if(e==null||bI(e))return[void 0,e];if(typeof e=="string"){let t=gI.get(`${e}`.toLowerCase());if(t)return[void 0,t]}return[e,void 0]}function pn({filter:e,sort:t,reverse:n,transform:r,initializer:i,...o}={},s){if(r===void 0&&(e!=null&&(r=_I(e)),t!=null&&!To(t)&&(r=xI(r,SI(t))),n&&(r=xI(r,vI))),s!=null&&i!=null)throw new Error("transforms cannot be applied after initializers");return{...o,...(t===null||To(t))&&{sort:t},transform:xI(r,s)}}function _e({filter:e,sort:t,reverse:n,initializer:r,...i}={},o){return r===void 0&&(e!=null&&(r=_I(e)),t!=null&&!To(t)&&(r=wI(r,SI(t))),n&&(r=wI(r,vI))),{...i,...(t===null||To(t))&&{sort:t},initializer:wI(r,o)}}function xI(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,Pe(n),r,i)}}function wI(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 r1(e,t){return(e.initializer!=null?_e:pn)(e,t)}function JD(e,t){return r1(t,_I(e))}function _I(e){return(t,n)=>{let r=bt(t,e);return{data:t,facets:n.map(i=>i.filter(o=>r[o]))}}}function t5({sort:e,...t}={}){return{...r1(t,vI),sort:To(e)?e:null}}function vI(e,t){return{data:e,facets:t.map(n=>n.slice().reverse())}}function e5({seed:e,sort:t,...n}={}){return{...r1(n,n5(e==null?Math.random:zc(e))),sort:To(t)?t:null}}function i1(e,{sort:t,...n}={}){return{...(Lr(e)&&e.channel!==void 0?_e:r1)(n,SI(e)),sort:To(t)?t:null}}function SI(e){return(typeof e=="function"&&e.length!==1?eV:n5)(e)}function eV(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 n5(e){let t,n;({channel:t,value:e,order:n}={...si(e)});let r=t?.startsWith("-");if(r&&(t=t.slice(1)),n===void 0&&(n=r?Kc:un),typeof n!="function")switch(`${n}`.toLowerCase()){case"ascending":n=un;break;case"descending":n=Kc;break;default:throw new Error(`invalid order: ${n}`)}return(i,o,s)=>{let a;if(t===void 0)a=bt(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 nm(e,t){return o1(null,null,e,t)}function La(e={y:"count"},t={}){let{x:n=W}=t;if(n==null)throw new Error("missing channel: x");return o1(n,null,e,t)}function Fa(e={x:"count"},t={}){let{y:n=W}=t;if(n==null)throw new Error("missing channel: y");return o1(null,n,e,t)}function rm(e={fill:"count"},t={}){let{x:n,y:r}=t;if([n,r]=ke(n,r),n==null)throw new Error("missing channel: x");if(r==null)throw new Error("missing channel: y");return o1(n,r,e,t)}function o1(e,t,{data:n=c1,filter:r,sort:i,reverse:o,...s}={},a={}){s=MI(s,a),n=a5(n,W),i=i==null?void 0:o5("sort",i,a),r=r==null?void 0:s5("filter",r,a);let[c,l]=En(e),[u,f]=En(t),{z:h,fill:d,stroke:p,x1:m,x2:y,y1:g,y2:b,...x}=a,[w,v]=En(h),[_]=Ee(d),[M]=Ee(p),[E,I]=En(_),[N,A]=En(M);return{..."z"in a&&{z:w||h},..."fill"in a&&{fill:E||d},..."stroke"in a&&{stroke:N||p},...pn(x,(B,L,S)=>{let T=el(bt(B,e),S?.x),D=el(bt(B,t),S?.y),C=bt(B,h),k=bt(B,_),F=bt(B,M),R=im(s,{z:C,fill:k,stroke:F}),$=[],U=[],G=T&&l([]),et=D&&f([]),rt=C&&v([]),st=k&&I([]),j=F&&A([]),ot=0;for(let z of s)z.initialize(B);i&&i.initialize(B),r&&r.initialize(B);for(let z of L){let H=[];for(let nt of s)nt.scope("facet",z);i&&i.scope("facet",z),r&&r.scope("facet",z);for(let[nt,P]of Oa(z,R))for(let[Ot,ft]of Oa(P,D))for(let[jt,Wt]of Oa(ft,T)){let J={data:B};if(T&&(J.x=jt),D&&(J.y=Ot),R&&(J.z=nt),!(r&&!r.reduce(Wt,J))){H.push(ot++),U.push(n.reduceIndex(Wt,B,J)),T&&G.push(jt),D&&et.push(Ot),C&&rt.push(R===C?nt:C[Wt[0]]),k&&st.push(R===k?nt:k[Wt[0]]),F&&j.push(R===F?nt:F[Wt[0]]);for(let ie of s)ie.reduce(Wt,J);i&&i.reduce(Wt,J)}}$.push(H)}return AI($,i,o),{data:U,facets:$}}),...!No(s,"x")&&(c?{x:c}:{x1:m,x2:y}),...!No(s,"y")&&(u?{y:u}:{y1:g,y2:b}),...Object.fromEntries(s.map(({name:B,output:L})=>[B,L]))}}function No(e,...t){for(let{name:n}of e)if(t.includes(n))return!0;return!1}function II(e,t,n=s1){let r=Object.entries(e);return t.title!=null&&e.title===void 0&&r.push(["title",aV]),t.href!=null&&e.href===void 0&&r.push(["href",l1]),r.filter(([,i])=>i!==void 0).map(([i,o])=>o===null?nV(i):n(i,o,t))}function s1(e,t,n,r=a1){let i;hn(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 nV(e){return{name:e,initialize(){},scope(){},reduce(){}}}function a1(e,t,n,r=Ju){let i=Qx(e,n),o=r(t,i),s,a;return{label:Dn(o===em?null:i,o.label),initialize(c){s=i===void 0?c:bt(c,i),o.scope==="data"&&(a=o.reduceIndex(rr(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 Oa(e,t){return t?sn(e,n=>t[n]):[[,e]]}function Ju(e,t,n=rV){if(e==null)return n(e);if(typeof e.reduceIndex=="function")return e;if(typeof e.reduce=="function"&&hn(e))return oV(e);if(typeof e=="function")return sV(e);if(/^p\d{2}$/i.test(e))return Ls(Wu(e));switch(`${e}`.toLowerCase()){case"first":return l1;case"last":return cV;case"identity":return c1;case"count":return em;case"distinct":return lV;case"sum":return t==null?em:uV;case"proportion":return i5(t,"data");case"proportion-facet":return i5(t,"facet");case"deviation":return Ls(Hr);case"min":return Ls(ae);case"min-index":return Ls(z0);case"max":return Ls(Yt);case"max-index":return Ls(P0);case"mean":return r5(cs);case"median":return r5(Ti);case"variance":return Ls(aa);case"mode":return Ls(nu)}return n(e)}function rV(e){throw new Error(`invalid reduce: ${e}`)}function MI(e,t){return II(e,t,o5)}function o5(e,t,n){return s1(e,t,n,s5)}function s5(e,t,n){return a1(e,t,n,a5)}function a5(e,t){return Ju(e,t,iV)}function iV(e){switch(`${e}`.toLowerCase()){case"x":return fV;case"y":return hV;case"z":return TI}throw new Error(`invalid group reduce: ${e}`)}function im(e,t){for(let n in t){let r=t[n];if(r!==void 0&&!e.some(i=>i.name===n))return r}}function AI(e,t,n){if(t){let r=t.output.transform(),i=(o,s)=>un(r[o],r[s]);e.forEach(o=>o.sort(i))}n&&e.forEach(r=>r.reverse())}function oV(e){return console.warn("deprecated reduce interface; implement reduceIndex instead."),{...e,reduceIndex:e.reduce.bind(e)}}function sV(e){return{reduceIndex(t,n,r){return e(Jp(n,t),r)}}}function Ls(e){return{reduceIndex(t,n){return e(t,r=>n[r])}}}function r5(e){return{reduceIndex(t,n){let r=e(t,i=>n[i]);return De(n)?new Date(r):r}}}var c1={reduceIndex(e,t){return Jp(t,e)}},l1={reduceIndex(e,t){return t[e[0]]}},aV={reduceIndex(e,t){let r=ss(Ai(e,o=>o.length,o=>t[o]),Ea),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`,In(o,Ea)]}return i.map(([o,s])=>`${o} (${s.toLocaleString("en-US")})`).join(`
16
- `)}},cV={reduceIndex(e,t){return t[e[e.length-1]]}},em={label:"Frequency",reduceIndex(e){return e.length}},lV={label:"Distinct",reduceIndex(e,t){let n=new Gn;for(let r of e)n.add(t[r]);return n.size}},uV=Ls(In);function i5(e,t){return e==null?{scope:t,label:"Frequency",reduceIndex:(n,r,i=1)=>n.length/i}:{scope:t,reduceIndex:(n,r,i=1)=>In(n,o=>r[o])/i}}var fV={reduceIndex(e,t,{x:n}){return n}},hV={reduceIndex(e,t,{y:n}){return n}},TI={reduceIndex(e,t,{z:n}){return n}};function c5(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 tf(e,{scale:t,type:n,value:r,filter:i,hint:o,label:s=Dn(r)},a){return o===void 0&&typeof r?.transform=="function"&&(o=r.hint),DI(a,{scale:t,type:n,value:bt(e,r),label:s,filter:i,hint:o})}function u1(e,t){return Object.fromEntries(Object.entries(e).map(([n,r])=>[n,tf(t,r,n)]))}function ef(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:Vt(o,s)]}));return n.channels=e,n}function DI(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&&t1(r,Ba)?null:"color";break;case"fillOpacity":case"strokeOpacity":case"opacity":t.scale=n!==!0&&t1(r,YD)?null:"opacity";break;case"symbol":n!==!0&&t1(r,KD)?(t.scale=null,t.value=Vt(r,Qu)):t.scale="symbol";break;default:t.scale=le.has(e)?e:null;break}else if(n===!1)t.scale=null;else if(n!=null&&!le.has(n))throw new Error(`unknown scale: ${n}`);return t}function u5(e,t,n,r,i){let{order:o,reverse:s,reduce:a=!0,limit:c}=i;for(let l in i){if(!le.has(l))continue;let{value:u,order:f=o,reverse:h=s,reduce:d=a,limit:p=c}=si(i[l]),m=u?.startsWith("-");if(m&&(u=u.slice(1)),f=f===void 0?m!==(u==="width"||u==="height")?h5:f5:mV(f),d==null||d===!1)continue;let y=l==="fx"||l==="fy"?pV(t,r[l]):dV(n,l);if(!y)throw new Error(`missing channel for scale: ${l}`);let g=y.value,[b=0,x=1/0]=ir(p)?p:p<0?[p]:[0,p];if(u==null)y.domain=()=>{let w=Array.from(new Gn(g));return h&&(w=w.reverse()),(b!==0||x!==1/0)&&(w=w.slice(b,x)),w};else{let w=u==="data"?e:u==="height"?l5(n,"y1","y2"):u==="width"?l5(n,"x1","x2"):EI(n,u,u==="y"?"y2":u==="x"?"x2":void 0),v=Ju(d===!0?"max":d,w);y.domain=()=>{let _=nv(rr(g),M=>v.reduceIndex(M,w),M=>g[M]);return f&&_.sort(f),h&&_.reverse(),(b!==0||x!==1/0)&&(_=_.slice(b,x)),_.map(tl)}}}}function dV(e,t){for(let n in e){let r=e[n];if(r.scale===t)return r}}function pV(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 l5(e,t,n){let r=EI(e,t),i=EI(e,n);return Vt(i,(o,s)=>Math.abs(o-r[s]),Float64Array)}function EI(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 mV(e){if(e==null||typeof e=="function")return e;switch(`${e}`.toLowerCase()){case"ascending":return f5;case"descending":return h5}throw new Error(`invalid order: ${e}`)}function f5([e,t],[n,r]){return un(t,r)||un(e,n)}function h5([e,t],[n,r]){return Kc(t,r)||un(e,n)}function om(e,t){let n=e[t];if(n){for(;n.source;)n=n.source;return n.source===null?null:n}}function Ca(e={}){let{document:t=typeof window<"u"?window.document:void 0,clip:n}=e;return{document:t,clip:n1(n)}}function lt(e,{document:t}){return Pt(us(e).call(t.documentElement))}var NI=0,BI;function d5(){let e=NI;return NI=0,BI=void 0,e}function Pn(e){e!==BI&&(BI=e,console.warn(e),++NI)}var m5=Math.PI,Fs=2*m5,p5=.618;function y5({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(hn(e)){let v;if({type:e,domain:c,inset:v,insetTop:n=v!==void 0?v:n,insetRight:r=v!==void 0?v:r,insetBottom:i=v!==void 0?v:i,insetLeft:o=v!==void 0?v:o,clip:l=l,...a}=e,e==null)return}typeof e!="function"&&({type:e}=g5(e));let{width:u,height:f,marginLeft:h,marginRight:d,marginTop:p,marginBottom:m}=s,y=u-h-d-o-r,g=f-p-m-n-i;if(e=e?.({width:y,height:g,clip:l,...a}),e==null)return;l=yV(l,h,p,u-d,f-m);let b=h+o,x=p+n,w;if(c!=null){let[[v,_],[M,E]]=An(e).bounds(c),I=Math.min(y/(M-v),g/(E-_));I>0?(b-=(I*(v+M)-y)/2,x-=(I*(_+E)-g)/2,w=Uc({point(N,A){this.stream.point(N*I+b,A*I+x)}})):Pn("Warning: the projection could not be fit to the specified domain; using the default scale.")}return w??=b===0&&x===0?b5():Uc({point(v,_){this.stream.point(v+b,_+x)}}),{stream:v=>e.stream(w.stream(l(v)))}}function g5(e){switch(`${e}`.toLowerCase()){case"albers-usa":return Bi(E2,.7463,.4673);case"albers":return f1(sp,.7463,.4673);case"azimuthal-equal-area":return Bi(N2,4,4);case"azimuthal-equidistant":return Bi(O2,Fs,Fs);case"conic-conformal":return f1(C2,Fs,Fs);case"conic-equal-area":return f1(ba,6.1702,2.9781);case"conic-equidistant":return f1(R2,7.312,3.6282);case"equal-earth":return Bi(U2,5.4133,2.6347);case"equirectangular":return Bi(k2,Fs,m5);case"gnomonic":return Bi(z2,3.4641,3.4641);case"identity":return{type:b5};case"reflect-y":return{type:gV};case"mercator":return Bi(L2,Fs,Fs);case"orthographic":return Bi(V2,2,2);case"stereographic":return Bi(Y2,2,2);case"transverse-mercator":return Bi(G2,Fs,Fs);default:throw new Error(`unknown projection type: ${e}`)}}function yV(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 _u(t,n,r,i);default:throw new Error(`unknown projection clip type: ${e}`)}}function Bi(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 f1(e,t,n){let{type:r,aspectRatio:i}=Bi(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 b5=fn({stream:e=>e}),gV=fn(Uc({point(e,t){this.stream.point(e,-t)}}));function OI(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,h){a[l]=f,c[l]=h}});for(l=0;l<s;++l)u.point(i[l],o[l])}function x5({projection:e}={}){return e==null?!1:typeof e.stream=="function"?!0:(hn(e)&&(e=e.type),e!=null)}function w5(e){if(typeof e?.stream=="function")return p5;if(hn(e)&&(e=e.type),e!=null){if(typeof e!="function"){let{aspectRatio:t}=g5(e);if(t)return t}return p5}}function ka(e,t,{projection:n}){let{x:r,y:i}=e,o={};return r&&(o.x=r),i&&(o.y=i),o=ef(o,t),n&&r?.scale==="x"&&i?.scale==="y"&&OI("x","y",o,n),r&&(o.x=Ze(o.x)),i&&(o.y=Ze(o.y)),o}function _5(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)Dr(s,o);return[r,i]}var A5=new Map([["accent",gS],["category10",yS],["dark2",bS],["observable10",xS],["paired",wS],["pastel1",_S],["pastel2",vS],["set1",SS],["set2",IS],["set3",MS],["tableau10",AS]]);function T5(e){return e!=null&&A5.has(`${e}`.toLowerCase())}var v5=new Map([...A5,["brbg",Cs(Ab,Tb)],["prgn",Cs(Eb,Db)],["piyg",Cs(Nb,Bb)],["puor",Cs(Ob,Lb)],["rdbu",Cs(Dp,Lu)],["rdgy",Cs(Fb,Cb)],["rdylbu",Cs(Np,Fu)],["rdylgn",Cs(kb,Rb)],["spectral",Cs($b,Ub)],["burd",S5(Dp,Lu)],["buylrd",S5(Np,Fu)],["blues",mn(ux,fx)],["greens",mn(hx,dx)],["greys",mn(px,mx)],["oranges",mn(wx,_x)],["purples",mn(yx,gx)],["reds",mn(bx,xx)],["turbo",ks(Nx)],["viridis",ks(Ox)],["magma",ks(Lx)],["inferno",ks(Fx)],["plasma",ks(Cx)],["cividis",ks(vx)],["cubehelix",ks(Sx)],["warm",ks(Mx)],["cool",ks(Ax)],["bugn",mn(Pb,zb)],["bupu",mn(qb,Vb)],["gnbu",mn(jb,Yb)],["orrd",mn(Wb,Gb)],["pubu",mn(Zb,Kb)],["pubugn",mn(Xb,Hb)],["purd",mn(Qb,Jb)],["rdpu",mn(tx,ex)],["ylgn",mn(ix,ox)],["ylgnbu",mn(nx,rx)],["ylorbr",mn(sx,ax)],["ylorrd",mn(cx,lx)],["rainbow",I5(Tx)],["sinebow",I5(Dx)]]);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 Cs(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 S5(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 ks(e){return({length:t})=>Ln(e,Math.max(2,Math.floor(t)))}function I5(e){return({length:t})=>Ln(e,Math.floor(t)+1).slice(0,-1)}function LI(e){let t=`${e}`.toLowerCase();if(!v5.has(t))throw new Error(`unknown ordinal scheme: ${t}`);return v5.get(t)}function sm(e,t){let n=LI(e),r=typeof n=="function"?n({length:t}):n;return r.length!==t?r.slice(0,t):r}function E5(e,t="greys"){let n=new Set,[r,i]=sm(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 M5=new Map([["brbg",Tb],["prgn",Db],["piyg",Bb],["puor",Lb],["rdbu",Lu],["rdgy",Cb],["rdylbu",Fu],["rdylgn",Rb],["spectral",Ub],["burd",e=>Lu(1-e)],["buylrd",e=>Fu(1-e)],["blues",fx],["greens",dx],["greys",mx],["purples",gx],["reds",xx],["oranges",_x],["turbo",Nx],["viridis",Ox],["magma",Lx],["inferno",Fx],["plasma",Cx],["cividis",vx],["cubehelix",Sx],["warm",Mx],["cool",Ax],["bugn",zb],["bupu",Vb],["gnbu",Yb],["orrd",Gb],["pubugn",Hb],["pubu",Kb],["purd",Jb],["rdpu",ex],["ylgnbu",rx],["ylgn",ox],["ylorbr",ax],["ylorrd",lx],["rainbow",Tx],["sinebow",Dx]]);function nf(e){let t=`${e}`.toLowerCase();if(!M5.has(t))throw new Error(`unknown quantitative scheme: ${t}`);return M5.get(t)}var bV=new Set(["brbg","prgn","piyg","puor","rdbu","rdgy","rdylbu","rdylgn","spectral","burd","buylrd"]);function D5(e){return e!=null&&bV.has(`${e}`.toLowerCase())}var CI=e=>t=>e(1-t),FI=[0,1],N5=new Map([["number",xe],["rgb",Kr],["hsl",Ev],["hcl",Dv],["lab",lg]]);function kI(e){let t=`${e}`.toLowerCase();if(!N5.has(t))throw new Error(`unknown interpolator: ${t}`);return N5.get(t)}function of(e,t,n,{type:r,nice:i,clamp:o,zero:s,domain:a=$5(e,n),unknown:c,round:l,scheme:u,interval:f,range:h=le.get(e)===nl?vV(n,a):le.get(e)===rl?SV(n,a):le.get(e)===il?FI:void 0,interpolate:d=le.get(e)===Fr?u==null&&h!==void 0?Kr:nf(u!==void 0?u:r==="cyclical"?"rainbow":"turbo"):l?Nc:xe,reverse:p}){if(f=Eo(f,r),(r==="cyclical"||r==="sequential")&&(r="linear"),typeof d!="function"&&(d=kI(d)),p=!!p,h!==void 0){let m=(a=Pe(a)).length,y=(h=Pe(h)).length;if(m!==y){if(d.length===1)throw new Error("invalid piecewise interpolator");d=lo(d,h),h=void 0}}if(d.length===1?(p&&(d=CI(d),p=!1),h===void 0&&(h=Float64Array.from(a,(m,y)=>y/(a.length-1)),h.length===2&&(h=FI)),t.interpolate((h===FI?fn:am)(d))):t.interpolate(d),s){let[m,y]=se(a);(m>0||y<0)&&(a=Da(a),Es(a)!==Math.sign(m)?a[a.length-1]=0:a[0]=0)}return p&&(a=la(a)),t.domain(a).unknown(c),i&&(t.nice(xV(i,r)),a=t.domain()),h!==void 0&&t.range(h),o&&t.clamp(o),{type:r,domain:a,range:h,scale:t,interpolate:d,interval:f}}function xV(e,t){return e===!0?void 0:typeof e=="number"?e:UD(e,t)}function B5(e,t,n){return of(e,bs(),t,n)}function O5(e,t,n){return RI(e,t,{...n,exponent:.5})}function RI(e,t,{exponent:n=1,...r}){return of(e,bp().exponent(n),t,{...r,type:"pow"})}function L5(e,t,{base:n=10,domain:r=IV(t),...i}){return of(e,yp().base(n),t,{...i,domain:r})}function F5(e,t,{constant:n=1,...r}){return of(e,gp().constant(n),t,r)}function C5(e,t,{range:n,quantiles:r=n===void 0?5:(n=[...n]).length,n:i=r,scheme:o="rdylbu",domain:s=MV(t),unknown:a,interpolate:c,reverse:l}){return n===void 0&&(n=c!==void 0?Ln(c,i):le.get(e)===Fr?sm(o,i):void 0),s.length>0&&(s=xp(s,n===void 0?{length:i}:n).quantiles()),h1(e,t,{domain:s,range:n,reverse:l,unknown:a})}function k5(e,t,{range:n,n:r=n===void 0?5:(n=[...n]).length,scheme:i="rdylbu",domain:o=$5(e,t),unknown:s,interpolate:a,reverse:c}){let[l,u]=se(o),f;return n===void 0?(f=Sn(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):le.get(e)===Fr?sm(i,r):void 0):(f=Ln(xe(l,u),r+1).slice(1,-1),l instanceof Date&&(f=f.map(h=>new Date(h)))),Es(Pe(o))<0&&f.reverse(),h1(e,t,{domain:f,range:n,reverse:c,unknown:s})}function h1(e,t,{domain:n=[0],unknown:r,scheme:i="rdylbu",interpolate:o,range:s=o!==void 0?Ln(o,n.length+1):le.get(e)===Fr?sm(i,n.length+1):void 0,reverse:a}){n=Pe(n);let c=Es(n);if(!isNaN(c)&&!wV(n,c))throw new Error(`the ${e} scale has a non-monotonic domain`);return a&&(s=la(s)),{type:"threshold",scale:wp(c<0?la(n):n,s===void 0?[]:s).unknown(r),domain:n,range:s}}function wV(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 R5(e){return{type:"identity",scale:ZD(le.get(e))?pp():t=>t}}function rf(e,t=qu){return e.length?[ae(e,({value:n})=>n===void 0?n:ae(n,t)),Yt(e,({value:n})=>n===void 0?n:Yt(n,t))]:[0,1]}function $5(e,t){let n=le.get(e);return(n===nl||n===il||n===rl?_V:rf)(t)}function _V(e){return[0,e.length?Yt(e,({value:t})=>t===void 0?t:Yt(t,qu)):1]}function vV(e,t){let n=e.find(({radius:s})=>s!==void 0);if(n!==void 0)return[0,n.radius];let r=Xn(e,.5,({value:s})=>s===void 0?NaN:Xn(s,.25,nr)),i=t.map(s=>3*Math.sqrt(s/r)),o=30/Yt(i);return o<1?i.map(s=>s*o):i}function SV(e,t){let n=Ti(e,({value:o})=>o===void 0?NaN:Ti(o,Math.abs)),r=t.map(o=>12*o/n),i=60/Yt(r);return i<1?r.map(o=>o*i):r}function IV(e){for(let{value:t}of e)if(t!==void 0)for(let n of t){if(n>0)return rf(e,nr);if(n<0)return rf(e,Sa)}return[1,10]}function MV(e){let t=[];for(let{value:n}of e)if(n!==void 0)for(let r of n)t.push(r);return t}function am(e){return(t,n)=>r=>e(t+r*(n-t))}function d1(e,t,n,r,{type:i,nice:o,clamp:s,domain:a=rf(r),unknown:c,pivot:l=0,scheme:u,range:f,symmetric:h=!0,interpolate:d=le.get(e)===Fr?u==null&&f!==void 0?Kr:nf(u!==void 0?u:"rdbu"):xe,reverse:p}){l=+l,a=Pe(a);let[m,y]=a;if(a.length>2&&Pn(`Warning: the diverging ${e} scale domain contains extra elements.`),Yn(m,y)<0&&([m,y]=[y,m],p=!p),m=Math.min(m,l),y=Math.max(y,l),typeof d!="function"&&(d=kI(d)),f!==void 0&&(d=d.length===1?am(d)(...f):lo(d,f)),p&&(d=CI(d)),h){let g=n.apply(l),b=g-n.apply(m),x=n.apply(y)-g;b<x?m=n.invert(g-x):b>x&&(y=n.invert(g+b))}return t.domain([m,l,y]).unknown(c).interpolator(d),s&&t.clamp(s),o&&t.nice(o),{type:i,domain:[m,y],pivot:l,interpolate:d,scale:t}}function U5(e,t,n){return d1(e,Ep(),AV,t,n)}function P5(e,t,n){return $I(e,t,{...n,exponent:.5})}function $I(e,t,{exponent:n=1,...r}){return d1(e,Mb().exponent(n=+n),DV(n),t,{...r,type:"diverging-pow"})}function z5(e,t,{base:n=10,pivot:r=1,domain:i=rf(t,r<0?Sa:nr),...o}){return d1(e,Sb().base(n=+n),TV,t,{domain:i,pivot:r,...o})}function q5(e,t,{constant:n=1,...r}){return d1(e,Ib().constant(n=+n),NV(n),t,r)}var AV={apply(e){return e},invert(e){return e}},TV={apply:Math.log,invert:Math.exp},EV={apply(e){return Math.sign(e)*Math.sqrt(Math.abs(e))},invert(e){return Math.sign(e)*(e*e)}};function DV(e){return e===.5?EV:{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 NV(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 V5(e,t,n,r){return of(e,t,n,r)}function j5(e,t,n){return V5(e,wb(),t,n)}function Y5(e,t,n){return V5(e,_b(),t,n)}var sf=Symbol("ordinal");function G5(e,t,n,{type:r,interval:i,domain:o,range:s,reverse:a,hint:c}){return i=Eo(i,r),o===void 0&&(o=Q5(n,i,e)),(r==="categorical"||r===sf)&&(r="ordinal"),a&&(o=la(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 X5(e,t,{type:n,interval:r,domain:i,range:o,scheme:s,unknown:a,...c}){r=Eo(r,n),i===void 0&&(i=Q5(t,r,e));let l;if(le.get(e)===Ku)l=BV(t),o=o===void 0?OV(l):Vt(o,Qu);else if(le.get(e)===Fr&&(o===void 0&&(n==="ordinal"||n===sf)&&(o=E5(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=nf(s),f=o[0],h=o[1]-o[0];o=({length:d})=>Ln(p=>u(f+h*p),d)}else o=LI(s);if(a===hp)throw new Error(`implicit unknown on ${e} scale is not supported`);return G5(e,qc().unknown(a),t,{...c,type:n,domain:i,range:o,hint:l})}function H5(e,t,{align:n=.5,padding:r=.5,...i}){return K5(tS().align(n).padding(r),t,i,e)}function Z5(e,t,{align:n=.5,padding:r=.1,paddingInner:i=r,paddingOuter:o=e==="fx"||e==="fy"?0:r,...s}){return K5(wa().align(n).paddingInner(i).paddingOuter(o),t,s,e)}function K5(e,t,n,r){let{round:i}=n;return i!==void 0&&e.round(i=!!i),e=G5(r,e,t,n),e.round=i,e}function Q5(e,t,n){let r=new Gn;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]=se(r).map(t.floor,t);return t.range(i,t.offset(o))}if(r.size>1e4&&le.get(n)===ai)throw new Error(`implicit ordinal domain of ${n} scale has more than 10,000 values`);return ss(r,un)}function W5(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 BV(e){return{fill:W5(e,"fill"),stroke:W5(e,"stroke")}}function OV(e){return te(e.fill)?LS:zx}function cm(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:h,projection:d,facet:{label:p=t}={},...m}={}){let y={};for(let[g,b]of e){let x=m[g],w=sN(g,b,{round:le.get(g)===ai?a:void 0,nice:c,clamp:l,zero:u,align:f,padding:h,projection:d,...x});if(w){let{label:v=g==="fx"||g==="fy"?p:t,percent:_,transform:M,inset:E,insetTop:I=E!==void 0?E:g==="y"?r:0,insetRight:N=E!==void 0?E:g==="x"?i:0,insetBottom:A=E!==void 0?E:g==="y"?o:0,insetLeft:B=E!==void 0?E:g==="x"?s:0}=x||{};if(M==null)M=void 0;else if(typeof M!="function")throw new Error("invalid scale transform; not a function");w.percent=!!_,w.label=v===void 0?LV(b,w):v,w.transform=M,g==="x"||g==="fx"?(w.insetLeft=+B,w.insetRight=+N):(g==="y"||g==="fy")&&(w.insetTop=+I,w.insetBottom=+A),y[g]=w}}return y}function PI(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]=cN(i),n[r]=o,o.type=s,a!=null&&(o.interval=a),c!=null&&(o.label=c)}return n}function rN(e,t){let{x:n,y:r,fx:i,fy:o}=e,s=i||o?y1(t):t;i&&J5(i,s),o&&tN(o,s);let a=i||o?zI(e,t):t;n&&J5(n,a),r&&tN(r,a)}function LV(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!Bo(t)&&t.percent&&(n=`${n} (%)`),{inferred:!0,toString:()=>n}}function m1(e){return Math.sign(Es(e.domain()))*Math.sign(Es(e.range()))}function y1(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 zI({fx:e,fy:t},n){let{marginTop:r,marginRight:i,marginBottom:o,marginLeft:s,width:a,height:c}=y1(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 J5(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)],Bo(e)||(e.range=oN(e)),e.scale.range(e.range)}iN(e)}function tN(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],Bo(e)?e.range.reverse():e.range=oN(e),e.scale.range(e.range)}iN(e)}function iN(e){e.round===void 0&&kV(e)&&FV(e)<=30&&e.scale.round(!0)}function FV({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 oN(e){let t=e.scale.domain().length+qI(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 g1(e,t,n){return sN(e,n===void 0?void 0:[{hint:n}],{...t})}function sN(e,t=[],n={}){let r=CV(e,t,n);if(n.type===void 0&&n.domain===void 0&&n.range===void 0&&n.interval==null&&e!=="fx"&&e!=="fy"&&Bo({type:r})){let i=t.map(({value:o})=>o).filter(o=>o!==void 0);i.some(De)?Pn(`Warning: some data associated with the ${e} scale are dates. Dates are typically associated with a "utc" or "time" scale rather than a "${af(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 "${af(r)}".`):i.some(VD)?Pn(`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 "${af(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 "${af(r)}".`):i.some(jD)&&Pn(`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 "${af(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 "${af(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=p1(t,n,Ze);break;case"identity":switch(le.get(e)){case ai:n=p1(t,n,Ze);break;case Ku:n=p1(t,n,RV);break}break;case"utc":case"time":n=p1(t,n,$D);break}switch(r){case"diverging":return U5(e,t,n);case"diverging-sqrt":return P5(e,t,n);case"diverging-pow":return $I(e,t,n);case"diverging-log":return z5(e,t,n);case"diverging-symlog":return q5(e,t,n);case"categorical":case"ordinal":case sf:return X5(e,t,n);case"cyclical":case"sequential":case"linear":return B5(e,t,n);case"sqrt":return O5(e,t,n);case"threshold":return h1(e,t,n);case"quantile":return C5(e,t,n);case"quantize":return k5(e,t,n);case"pow":return RI(e,t,n);case"log":return L5(e,t,n);case"symlog":return F5(e,t,n);case"utc":return Y5(e,t,n);case"time":return j5(e,t,n);case"point":return H5(e,t,n);case"band":return Z5(e,t,n);case"identity":return R5(e);case void 0:return;default:throw new Error(`unknown scale type: ${r}`)}}function af(e){return typeof e=="symbol"?e.description:e}function eN(e){return typeof e=="string"?`${e}`.toLowerCase():e}var nN={toString:()=>"projection"};function CV(e,t,{type:n,domain:r,range:i,scheme:o,pivot:s,projection:a}){if(n=eN(n),e==="fx"||e==="fy")return"band";(e==="x"||e==="y")&&a!=null&&(n=nN);for(let l of t){let u=eN(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===nN)return;if(n!==void 0)return n;if(r===void 0&&!t.some(({value:l})=>l!==void 0))return;let c=le.get(e);if(c===nl)return"sqrt";if(c===il||c===rl)return"linear";if(c===Ku)return"ordinal";if((r||i||[]).length>2)return UI(c);if(r!==void 0){if(Me(r))return UI(c);if(De(r))return"utc"}else{let l=t.map(({value:u})=>u).filter(u=>u!==void 0);if(l.some(Me))return UI(c);if(l.some(De))return"utc"}if(c===Fr){if(s!=null||D5(o))return"diverging";if(T5(o))return"categorical"}return"linear"}function UI(e){switch(e){case ai:return"point";case Fr:return sf;default:return"ordinal"}}function Bo({type:e}){return e==="ordinal"||e==="point"||e==="band"||e===sf}function qI({type:e}){return e==="threshold"}function kV({type:e}){return e==="point"||e==="band"}function or(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 p1(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 RV(e){return Vt(e,Qu)}function Ra(e={}){let t;for(let n in e)if(le.has(n)&&Ao(e[n])){if(t!==void 0)throw new Error("ambiguous scale definition; multiple scales found");t=cN(g1(n,e[n]))}if(t===void 0)throw new Error("invalid scale definition; no scale found");return t}function aN(e){return t=>{if(!le.has(t=`${t}`))throw new Error(`unknown scale: ${t}`);return e[t]}}function cN({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:Da(n),...r!==void 0&&{range:Da(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 b1(e){let t,n;return(...r)=>((n?.length!==r.length||n.some((i,o)=>i!==r[o]))&&(n=r,t=e(...r)),t)}var $V=b1(e=>new Intl.NumberFormat(e)),UV=b1((e,t)=>new Intl.DateTimeFormat(e,{timeZone:"UTC",...t&&{month:t}})),PV=b1((e,t)=>new Intl.DateTimeFormat(e,{timeZone:"UTC",...t&&{weekday:t}}));function zV(e="en-US"){let t=$V(e);return n=>n!=null&&!isNaN(n)?t.format(n):void 0}function lN(e="en-US",t="short"){let n=UV(e,t);return r=>r!=null&&!isNaN(r=+new Date(Date.UTC(2e3,+r)))?n.format(r):void 0}function uN(e="en-US",t="short"){let n=PV(e,t);return r=>r!=null&&!isNaN(r=+new Date(Date.UTC(2001,0,+r)))?n.format(r):void 0}function VI(e){return Xx(e,"Invalid Date")}function qV(e="en-US"){let t=zV(e);return n=>(n instanceof Date?VI:typeof n=="number"?t:Ue)(n)}var Oi=qV();var Ne=(typeof window<"u"?window.devicePixelRatio>1:typeof it>"u")?0:.5,VV=0;function x1(){return`plot-clip-${++VV}`}function w1(e,{title:t,href:n,ariaLabel:r,ariaDescription:i,ariaHidden:o,target:s,fill:a,fillOpacity:c,stroke:l,strokeWidth:u,strokeOpacity:f,strokeLinejoin:h,strokeLinecap:d,strokeMiterlimit:p,strokeDasharray:m,strokeDashoffset:y,opacity:g,mixBlendMode:b,imageFilter:x,paintOrder:w,pointerEvents:v,shapeRendering:_,channels:M},{ariaLabel:E,fill:I="currentColor",fillOpacity:N,stroke:A="none",strokeOpacity:B,strokeWidth:L,strokeLinecap:S,strokeLinejoin:T,strokeMiterlimit:D,paintOrder:C}){I===null&&(a=null,c=null),A===null&&(l=null,f=null),te(I)?!te(A)&&(!te(a)||M?.fill)&&(A="none"):te(A)&&(!te(l)||M?.stroke)&&(I="none");let[k,F]=Ee(a,I),[R,$]=re(c,N),[U,G]=Ee(l,A),[et,rt]=re(f,B),[st,j]=re(g);Os(G)||(u===void 0&&(u=L),d===void 0&&(d=S),h===void 0&&(h=T),p===void 0&&!WD(h)&&(p=D),!Os(F)&&w===void 0&&(w=C));let[ot,z]=re(u);return I!==null&&(e.fill=ce(F,"currentColor"),e.fillOpacity=lm($,1)),A!==null&&(e.stroke=ce(G,"none"),e.strokeWidth=lm(z,1),e.strokeOpacity=lm(rt,1),e.strokeLinejoin=ce(h,"miter"),e.strokeLinecap=ce(d,"butt"),e.strokeMiterlimit=lm(p,4),e.strokeDasharray=ce(m,"none"),e.strokeDashoffset=ce(y,"0")),e.target=Ue(s),e.ariaLabel=Ue(E),e.ariaDescription=Ue(i),e.ariaHidden=Ue(o),e.opacity=lm(j,1),e.mixBlendMode=ce(b,"normal"),e.imageFilter=ce(x,"none"),e.paintOrder=ce(w,"normal"),e.pointerEvents=ce(v,"auto"),e.shapeRendering=ce(_,"auto"),{title:{value:t,optional:!0,filter:null},href:{value:n,optional:!0,filter:null},ariaLabel:{value:r,optional:!0,filter:null},fill:{value:k,scale:"auto",optional:!0},fillOpacity:{value:R,scale:"auto",optional:!0},stroke:{value:U,scale:"auto",optional:!0},strokeOpacity:{value:et,scale:"auto",optional:!0},strokeWidth:{value:ot,optional:!0},opacity:{value:st,scale:"auto",optional:!0}}}function jV(e,t){t&&e.filter(n=>Xp(t[n])).append("title").call(WV,t)}function YV(e,t){t&&e.filter(([n])=>Xp(t[n])).append("title").call(GV,t)}function WV(e,t){t&&e.text(n=>Oi(t[n]))}function GV(e,t){t&&e.text(([n])=>Oi(t[n]))}function Ht(e,{target:t,tip:n},{ariaLabel:r,title:i,fill:o,fillOpacity:s,stroke:a,strokeOpacity:c,strokeWidth:l,opacity:u,href:f}){r&&ut(e,"aria-label",h=>r[h]),o&&ut(e,"fill",h=>o[h]),s&&ut(e,"fill-opacity",h=>s[h]),a&&ut(e,"stroke",h=>a[h]),c&&ut(e,"stroke-opacity",h=>c[h]),l&&ut(e,"stroke-width",h=>l[h]),u&&ut(e,"opacity",h=>u[h]),f&&fN(e,h=>f[h],t),n||jV(e,i)}function ol(e,{target:t,tip:n},{ariaLabel:r,title:i,fill:o,fillOpacity:s,stroke:a,strokeOpacity:c,strokeWidth:l,opacity:u,href:f}){r&&ut(e,"aria-label",([h])=>r[h]),o&&ut(e,"fill",([h])=>o[h]),s&&ut(e,"fill-opacity",([h])=>s[h]),a&&ut(e,"stroke",([h])=>a[h]),c&&ut(e,"stroke-opacity",([h])=>c[h]),l&&ut(e,"stroke-width",([h])=>l[h]),u&&ut(e,"opacity",([h])=>u[h]),f&&fN(e,([h])=>f[h],t),n||YV(e,i)}function XV({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 um(e,t,n){let r=sn(e,i=>t[i]);return n===void 0&&r.size>1+e.length>>1&&Pn("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*_1(e,t,n,r){let{z:i}=n,{z:o}=r,s=XV(r,n),a=[...t,...s];for(let c of o?um(e,o,i):[e]){let l,u;t:for(let f of c){for(let h of a)if(!$e(h[f])){u&&u.push(-1);continue t}if(l===void 0){u&&(yield u),l=s.map(h=>Ns(h[f])),u=[f];continue}u.push(f);for(let h=0;h<s.length;++h)if(Ns(s[h][f])!==l[h]){yield u,l=s.map(p=>Ns(p[f])),u=[f];continue t}}u&&(yield u)}}function HV(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,h=x1();i=`url(#${h})`,e=lt("svg:g",r).call(d=>d.append("svg:clipPath").attr("id",h).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=x1();i=`url(#${a})`,e.append("clipPath").attr("id",a).append("path").attr("d",An(s)({type:"Sphere"}));break}}ut(e,"aria-label",t.ariaLabel),ut(e,"aria-description",t.ariaDescription),ut(e,"aria-hidden",t.ariaHidden),ut(e,"clip-path",i)}function Bt(e,t,n,r){HV(e,t,n,r),ut(e,"fill",t.fill),ut(e,"fill-opacity",t.fillOpacity),ut(e,"stroke",t.stroke),ut(e,"stroke-width",t.strokeWidth),ut(e,"stroke-opacity",t.strokeOpacity),ut(e,"stroke-linejoin",t.strokeLinejoin),ut(e,"stroke-linecap",t.strokeLinecap),ut(e,"stroke-miterlimit",t.strokeMiterlimit),ut(e,"stroke-dasharray",t.strokeDasharray),ut(e,"stroke-dashoffset",t.strokeDashoffset),ut(e,"shape-rendering",t.shapeRendering),ut(e,"filter",t.imageFilter),ut(e,"paint-order",t.paintOrder);let{pointerEvents:i=r.pointerSticky===!1?"none":void 0}=t;ut(e,"pointer-events",i)}function Nt(e,t){ZV(e,"mix-blend-mode",t.mixBlendMode),ut(e,"opacity",t.opacity)}function fN(e,t,n){e.each(function(r){let i=t(r);if(i!=null){let o=this.ownerDocument.createElementNS(Zr.svg,"a");o.setAttribute("fill","inherit"),o.setAttributeNS(Zr.xlink,"href",i),n!=null&&o.setAttribute("target",n),this.parentNode.insertBefore(o,this).appendChild(this)}})}function ut(e,t,n){n!=null&&e.attr(t,n)}function ZV(e,t,n){n!=null&&e.style(t,n)}function Mt(e,t,{x:n,y:r},i=Ne,o=Ne){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 ce(e,t){if((e=Ue(e))!==t)return e}function lm(e,t){if((e=Dt(e))!==t)return e}var KV=/^-?([_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 cf(e){if(e===void 0)return"plot-d6a7b5";if(e=`${e}`,!KV.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 yn({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 dN(e,t,n={}){let r=.5-Ne,i=.5+Ne,o=.5+Ne,s=.5-Ne;for(let{marginTop:m,marginRight:y,marginBottom:g,marginLeft:b}of t)m>r&&(r=m),y>i&&(i=y),g>o&&(o=g),b>s&&(s=b);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:h=640,height:d=QV(e,n,{width:h,marginTopDefault:r,marginRightDefault:i,marginBottomDefault:o,marginLeftDefault:s})+Math.max(0,c-r+u-o)}=n;h=+h,d=+d;let p={width:h,height:d,marginTop:c,marginRight:l,marginBottom:u,marginLeft:f};if(e.fx||e.fy){let{margin:m,marginTop:y=m!==void 0?m:c,marginRight:g=m!==void 0?m:l,marginBottom:b=m!==void 0?m:u,marginLeft:x=m!==void 0?m:f}=n.facet??{};y=+y,g=+g,b=+b,x=+x,p.facet={marginTop:y,marginRight:g,marginBottom:b,marginLeft:x}}return p}function QV({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,h=w5(i);if(h){let p=r?r.scale.domain().length:1,m=(1.1*f-.1)/(1.1*p-.1)*h,y=Math.max(.1,Math.min(10,m));return Math.round((s-u-c)*y+a+l)}let d=t?Bo(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=hN("y",t)/(hN("x",e)*o),m=r?r.scale.bandwidth():1,y=n?n.scale.bandwidth():1,g=m*(s-u-c)-e.insetLeft-e.insetRight;return(p*g+t.insetTop+t.insetBottom)/y+a+l}return!!(t||n)*Math.max(1,Math.min(60,d*f))*20+!!r*30+60}function hN(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]=se(r);return Math.abs(i(s)-i(o))}function mN(e,t){let{fx:n,fy:r}=cm(e,t),i=n?.scale.domain(),o=r?.scale.domain();return i&&o?R0(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 yN(e,{x:t,y:n}){return t&&=XI(t),n&&=XI(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 S1(e,{fx:t,fy:n}){let r=rr(e),i=t?.value,o=n?.value;return t&&n?Ai(r,s=>(s.fx=i[s[0]],s.fy=o[s[0]],s),s=>i[s],s=>o[s]):t?Ai(r,s=>(s.fx=i[s[0]],s),s=>i[s]):Ai(r,s=>(s.fy=o[s[0]],s),s=>o[s])}function gN(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 bN(e){let t=[],n=new Uint32Array(In(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 JV=new Map([["top",jI],["right",GI],["bottom",YI],["left",WI],["top-left",v1(jI,WI)],["top-right",v1(jI,GI)],["bottom-left",v1(YI,WI)],["bottom-right",v1(YI,GI)],["top-empty",ej],["right-empty",ij],["bottom-empty",nj],["left-empty",rj],["empty",oj]]);function xN(e){if(e==null)return null;let t=JV.get(`${e}`.toLowerCase());if(t)return t;throw new Error(`invalid facet anchor: ${e}`)}var pN=new WeakMap;function XI(e){let t=pN.get(e);return t||pN.set(e,t=new Wn(Vt(e,(n,r)=>[n,r]))),t}function $a(e,t){return XI(e).get(t)}function tj(e,t,n){return t=Ns(t),n=Ns(n),e.find(r=>Object.is(Ns(r.x),t)&&Object.is(Ns(r.y),n))}function I1(e,t,n){return tj(e,t,n)?.empty}function jI(e,{y:t},{y:n}){return t?$a(t,n)===0:!0}function YI(e,{y:t},{y:n}){return t?$a(t,n)===t.length-1:!0}function WI(e,{x:t},{x:n}){return t?$a(t,n)===0:!0}function GI(e,{x:t},{x:n}){return t?$a(t,n)===t.length-1:!0}function ej(e,{y:t},{x:n,y:r,empty:i}){if(i)return!1;if(!t)return;let o=$a(t,r);if(o>0)return I1(e,n,t[o-1])}function nj(e,{y:t},{x:n,y:r,empty:i}){if(i)return!1;if(!t)return;let o=$a(t,r);if(o<t.length-1)return I1(e,n,t[o+1])}function rj(e,{x:t},{x:n,y:r,empty:i}){if(i)return!1;if(!t)return;let o=$a(t,n);if(o>0)return I1(e,t[o-1],r)}function ij(e,{x:t},{x:n,y:r,empty:i}){if(i)return!1;if(!t)return;let o=$a(t,n);if(o<t.length-1)return I1(e,t[o+1],r)}function oj(e,t,{empty:n}){return n}function v1(e,t){return function(){return e.apply(null,arguments)&&t.apply(null,arguments)}}function M1(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 _t=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:h=0,marginTop:d=h,marginRight:p=h,marginBottom:m=h,marginLeft:y=h,clip:g=i?.clip,channels:b,tip:x,render:w}=r;if(this.data=t,this.sort=To(l)?l:null,this.initializer=_e(r).initializer,this.transform=this.initializer?r.transform:pn(r).transform,o===null||o===!1?this.facet=null:(this.facet=nn(o===!0?"include":o,"facet",["auto","include","exclude","super"]),this.fx=t===Ta&&typeof a=="string"?[a]:a,this.fy=t===Ta&&typeof c=="string"?[c]:c),this.facetAnchor=xN(s),n=tm(n),b!==void 0&&(n={...sj(b),...n}),i!==void 0&&(n={...w1(this,r,i),...n}),this.channels=Object.fromEntries(Object.entries(n).map(([v,_])=>{if(Lr(_.value)){let{value:M,label:E=_.label,scale:I=_.scale}=_.value;_={..._,label:E,scale:I,value:M}}if(t===Ta&&typeof _.value=="string"){let{value:M}=_;_={..._,value:[M]}}return[v,_]}).filter(([v,{value:_,optional:M}])=>{if(_!=null)return!0;if(M)return!1;throw new Error(`missing channel value: ${v}`)})),this.dx=+u,this.dy=+f,this.marginTop=+d,this.marginRight=+p,this.marginBottom=+m,this.marginLeft=+y,this.clip=n1(g),this.tip=aj(x),this.facet==="super"){if(a||c)throw new Error("super-faceting cannot use fx or fy");for(let v in this.channels){let{scale:_}=n[v];if(!(_!=="x"&&_!=="y"))throw new Error("super-faceting cannot use x or y")}}w!=null&&(this.render=uf(w,this.render))}initialize(t,n,r){let i=Pe(this.data);t===void 0&&i!=null&&(t=[rr(i)]);let o=t;this.transform!=null&&({facets:t,data:i}=this.transform(i,t,r),i=Pe(i)),t!==void 0&&(t.original=o);let s=u1(this.channels,i);return this.sort!=null&&u5(i,t,s,n,this.sort),{data:i,facets:t,channels:s}}filter(t,n,r){for(let i in n){let{filter:o=$e}=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"&&OI(i,o,n,r.projection)}}scale(t,n,r){let i=ef(t,n);return r.projection&&this.project(t,i,r),i}};function Ke(...e){return e.plot=_t.prototype.plot,e}function uf(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,h)=>t.call(this,c,l,u,f,h,a))}}function sj(e){return Object.fromEntries(Object.entries(tm(e)).map(([t,n])=>(n=typeof n=="string"?{value:n,label:t}:si(n),n.filter===void 0&&n.scale==null&&(n={...n,filter:null}),[t,n])))}function aj(e){return e===!0?"xy":e===!1||e==null?null:typeof e=="string"?nn(e,"tip",["x","y","xy"]):e}function Li(e,t){return e?.tip===!0?{...e,tip:t}:hn(e?.tip)&&e.tip.pointer===void 0?{...e,tip:{...e.tip,pointer:t}}:e}var wN=new WeakMap;function HI(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:uf(function(u,f,h,d,p,m){p={...p,pointerSticky:!1};let y=p.ownerSVGElement,{data:g}=p.getMarkState(this),b=wN.get(y);b||wN.set(y,b={sticky:!1,roots:[],renders:[]});let x=b.renders.push(G)-1,{x:w,y:v,fx:_,fy:M}=f,E=_?_(u.fx)-d.marginLeft:0,I=M?M(u.fy)-d.marginTop:0;w?.bandwidth&&(E+=w.bandwidth()/2),v?.bandwidth&&(I+=v.bandwidth()/2);let N=u.fi!=null,A;if(N){let j=b.facetStates;j||(b.facetStates=j=new Map),A=j.get(this),A||j.set(this,A=new Map)}let[B,L]=yn(this,d),{px:S,py:T}=h,D=S?j=>S[j]:ZI(h,B),C=T?j=>T[j]:KI(h,L),k,F,R,$;function U(j,ot){if(N)if($&&($=cancelAnimationFrame($)),j==null)A.delete(u.fi);else{A.set(u.fi,ot),$=requestAnimationFrame(()=>{$=null;for(let[z,H]of A)if(H<ot||H===ot&&z<u.fi){j=null;break}G(j)});return}G(j)}function G(j){if(k===j&&R===b.sticky)return;k=j,R=p.pointerSticky=b.sticky;let ot=k==null?[]:[k];N&&(ot.fx=u.fx,ot.fy=u.fy,ot.fi=u.fi);let z=m(ot,f,h,d,p);if(F){if(N){let H=F.parentNode,nt=F.getAttribute("transform"),P=z.getAttribute("transform");nt?z.setAttribute("transform",nt):z.removeAttribute("transform"),P?H.setAttribute("transform",P):H.removeAttribute("transform"),z.removeAttribute("aria-label"),z.removeAttribute("aria-description"),z.removeAttribute("aria-hidden")}F.replaceWith(z)}return b.roots[x]=F=z,k==null&&A?.size>1||p.dispatchValue(k==null?null:g[k]),z}function et(j){if(b.sticky||j.pointerType==="mouse"&&j.buttons===1)return;let[ot,z]=On(j);ot-=E,z-=I;let H=ot<d.marginLeft||ot>d.width-d.marginRight?1:e,nt=z<d.marginTop||z>d.height-d.marginBottom?1:t,P=null,Ot=s*s;for(let ft of u){let jt=H*(D(ft)-ot),Wt=nt*(C(ft)-z),J=jt*jt+Wt*Wt;J<=Ot&&(P=ft,Ot=J)}if(P!=null&&(e!==1||t!==1)){let ft=D(P)-ot,jt=C(P)-z;Ot=ft*ft+jt*jt}U(P,Ot)}function rt(j){j.pointerType==="mouse"&&k!=null&&(b.sticky&&b.roots.some(ot=>ot?.contains(j.target))||(b.sticky?(b.sticky=!1,b.renders.forEach(ot=>ot(null))):(b.sticky=!0,G(k)),j.stopImmediatePropagation()))}function st(j){j.pointerType==="mouse"&&(b.sticky||U(null))}return y.addEventListener("pointerenter",et),y.addEventListener("pointermove",et),y.addEventListener("pointerdown",rt),y.addEventListener("pointerleave",st),G(null)},c)}}function ff(e){return HI(1,1,e)}function hf(e){return HI(1,.01,e)}function sl(e){return HI(.01,1,e)}function ZI({x1:e,x2:t,x:n=e},r){return e&&t?i=>(e[i]+t[i])/2:n?i=>n[i]:()=>r}function KI({y1:e,y2:t,y:n=e},r){return e&&t?i=>(e[i]+t[i])/2:n?i=>n[i]:()=>r}function A1(e){return Bo(e)&&e.interval===void 0?void 0:"tabular-nums"}function _N(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:h,fontVariant:d=A1(e),round:p=!0,opacity:m,className:y}=t,g=Ca(t);y=cf(y),m=re(m)[1],h===null&&(h=()=>null);let b=lt("svg",g).attr("class",`${y}-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(B=>B.append("style").text(`:where(.${y}-ramp) {
15
+ ${n}`}function SV(e){return e==="time"?s1:e==="utc"?em:_V}function uD(e,t,n){let r=Xt(eg(t,(i,o)=>Math.abs(o-i)));if(r<1e3)return aD("millisecond","utc",n);for(let[i,o,s,a]of SV(e)){if(r>a||i==="hour"&&!r)break;if(t.every(c=>o.floor(c)>=c))return aD(i,s,n)}}function Xu(e,t,n){return(r,i,o)=>{let s=e(r,i),a=t(r,i),c=i-Bs(o);return i!==c&&o[c]!==void 0&&a===t(o[c],c)?s:n(s,a)}}var il=Object.getPrototypeOf(Uint8Array),MV=Object.prototype.toString,E3=Symbol("reindex");function bt(e,t,n){let r=typeof t;return r==="string"?fD(e,D3(t),n):r==="function"?fD(e,t,n):r==="number"||t instanceof Date||r==="boolean"?Yt(e,hn(t),n):typeof t?.transform=="function"?hD(t.transform(e),n):IV(hD(t,n),e?.[E3])}function IV(e,t){return t?im(e,t):e}function fD(e,t,n){return Yt(e,n?.prototype instanceof il?AV(t):t,n)}function hD(e,t){return t===void 0?Pe(e):e instanceof t?e:t.prototype instanceof il&&!(e instanceof il)?t.from(e,N3):t.from(e)}function AV(e){return(t,n)=>N3(e(t,n))}var Na=[null],D3=e=>t=>t[e],Ie={transform:or},W={transform:e=>e};var rm=()=>1,dD=()=>!0,Ue=e=>e==null?e:`${e}`,Nt=e=>e==null?e:+e;var ol=e=>e?e[0]:void 0,Oa=e=>e?e[1]:void 0,pD=e=>e?e[2]:void 0,hn=e=>()=>e;function Qu(e){let t=+`${e}`.slice(1)/100;return(n,r)=>Zn(n,t,r)}function Qe(e){return e instanceof il?e:Yt(e,N3,Float64Array)}function N3(e){return e==null?NaN:Number(e)}function mD(e){return Yt(e,O3)}function O3(e){return e instanceof Date&&!isNaN(e)?e:typeof e=="string"?tm(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"]:Fa(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 B3(e,t,n){if(e!=null)return rn(e,t,n)}function rn(e,t,n){let r=`${e}`.toLowerCase();if(!n.includes(r))throw new Error(`invalid ${t}: ${e}`);return r}function Pe(e){return e==null||e instanceof Array||e instanceof il?e:Array.from(e)}function Yt(e,t,n=Array){return e==null?e:e instanceof n?e.map(t):n.from(e,t)}function Ba(e,t=Array){return e instanceof t?e.slice():t.from(e)}function L3({x:e,x1:t,x2:n}){return e!==void 0||t!==void 0||n!==void 0}function F3({y:e,y1:t,y2:n}){return e!==void 0||t!==void 0||n!==void 0}function Ku(e){return L3(e)||F3(e)||e.interval!==void 0}function dn(e){return e?.toString===MV}function Do(e){return dn(e)&&(e.type!==void 0||e.domain!==void 0)}function Fr(e){return dn(e)&&typeof e.transform!="function"}function No(e){return Fr(e)&&e.value===void 0&&e.channel===void 0}function C3(e,t,n,r=W){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?[ol,Oa]:[e,t]}function zn({z:e,fill:t,stroke:n}={}){return e===void 0&&([e]=De(t)),e===void 0&&([e]=De(n)),e}function or(e){let t=e.length,n=new Uint32Array(t);for(let r=0;r<t;++r)n[r]=r;return n}function im(e,t){return Yt(t,n=>e[n],e.constructor)}function Ju(e){return e.length===1?(t,n)=>e(im(n,t)):e}function Ls(e,t,n){return e.subarray?e.subarray(t,n):e.slice(t,n)}function Fs(e){return e!==null&&typeof e=="object"?e.valueOf():e}function l1(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 pn(e){let t;return[{transform:()=>t,label:Nn(e)},n=>t=n]}function Dn(e){return e==null?[e]:pn(e)}function Nn(e,t){return typeof e=="string"?e:e&&e.label!==void 0?e.label:t}function tf(e,t){return{transform(n){let r=e.transform(n),i=t.transform(n);return Ne(r)||Ne(i)?Yt(r,(o,s)=>new Date((+r[s]+ +i[s])/2)):Yt(r,(o,s)=>(+r[s]+ +i[s])/2,Float64Array)},label:e.label}}function sl(e,t){let n=R3(t?.interval,t?.type);return n?Yt(e,n):e}function R3(e,t){let n=ef(e,t);return n&&(r=>$e(r)?n.floor(r):r)}function ef(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)=>ke(Math.ceil(r*n),i*n).map(o=>o/n)}:{floor:r=>Math.floor(r/n)*n,offset:r=>r+n,range:(r,i)=>ke(Math.ceil(r/n),i/n).map(o=>o*n)}}if(typeof e=="string")return(t==="time"?A3:nm)(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 Oo(e,t){if(e=ef(e,t),e&&typeof e.range!="function")throw new Error("invalid interval: missing range method");return e}function yD(e,t){if(e=Oo(e,t),e&&typeof e.ceil!="function")throw new Error("invalid interval: missing ceil method");return e}function gD(e){return La(e)&&typeof e?.floor=="function"&&e.floor()instanceof Date}function La(e){return typeof e?.range=="function"}function ci(e){return e===void 0||Fr(e)?e:{value:e}}function bD(e){return e==null?null:{transform:t=>bt(t,e,Float64Array),label:Nn(e)}}function xD(e){if(!sr(e))return!1;for(let t of e)if(t!=null)return typeof t=="object"&&"0"in t&&"1"in t}function sr(e){return e&&typeof e[Symbol.iterator]=="function"}function u1(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 Ne(e){for(let t of e)if(t!=null)return t instanceof Date}function wD(e){for(let t of e)if(t!=null)return typeof t=="string"&&isNaN(t)&&tm(t)}function _D(e){for(let t of e)if(t!=null){if(typeof t!="string")return!1;if(t.trim())return!isNaN(t)}}function Cs(e){for(let t of e)if(t!=null)return typeof t=="number"}function f1(e,t){let n;for(let r of e)if(r!=null){if(!t(r))return!1;n=!0}return n}var TV=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 Fa(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)||TV.has(e))}function vD(e){return typeof e=="number"&&(0<=e&&e<=1||isNaN(e))}function ee(e){return e==null||Rs(e)}function Rs(e){return/^\s*none\s*$/i.test(e)}function SD(e){return/^\s*round\s*$/i.test(e)}function h1(e,t){return B3(e,t,["middle","top-left","top","top-right","right","bottom-right","bottom","bottom-left","left"])}function Bo(e="middle"){return h1(e,"frameAnchor")}function MD(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 EV(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 om(e){return sr(e)?EV(e):e}function d1(e){return e===!0?e="frame":e===!1?e=null:e!=null&&(e=rn(e,"clip",["frame","sphere"])),e}var li=Symbol("position"),Cr=Symbol("color"),al=Symbol("radius"),cl=Symbol("length"),ll=Symbol("opacity"),nf=Symbol("symbol"),ID=Symbol("projection"),ue=new Map([["x",li],["y",li],["fx",li],["fy",li],["r",al],["color",Cr],["opacity",ll],["symbol",nf],["length",cl],["projection",ID]]);function AD(e){return e===li||e===ID}function TD(e){return e===li||e===al||e===cl||e===ll}var k3=Math.sqrt(3),$3=2/k3,DV={draw(e,t){let n=Math.sqrt(t/Math.PI),r=n*$3,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()}},U3=new Map([["asterisk",$p],["circle",Ns],["cross",Up],["diamond",Pp],["diamond2",zp],["hexagon",DV],["plus",qp],["square",Vp],["square2",jp],["star",Yp],["times",Vu],["triangle",Wp],["triangle2",Gp],["wye",Xp]]);function P3(e){return e&&typeof e.draw=="function"}function ED(e){return P3(e)?!0:typeof e!="string"?!1:U3.has(e.toLowerCase())}function rf(e){if(e==null||P3(e))return e;let t=U3.get(`${e}`.toLowerCase());if(t)return t;throw new Error(`invalid symbol: ${e}`)}function DD(e){if(e==null||P3(e))return[void 0,e];if(typeof e=="string"){let t=U3.get(`${e}`.toLowerCase());if(t)return[void 0,t]}return[e,void 0]}function mn({filter:e,sort:t,reverse:n,transform:r,initializer:i,...o}={},s){if(r===void 0&&(e!=null&&(r=V3(e)),t!=null&&!No(t)&&(r=z3(r,Y3(t))),n&&(r=z3(r,j3))),s!=null&&i!=null)throw new Error("transforms cannot be applied after initializers");return{...o,...(t===null||No(t))&&{sort:t},transform:z3(r,s)}}function ve({filter:e,sort:t,reverse:n,initializer:r,...i}={},o){return r===void 0&&(e!=null&&(r=V3(e)),t!=null&&!No(t)&&(r=q3(r,Y3(t))),n&&(r=q3(r,j3))),{...i,...(t===null||No(t))&&{sort:t},initializer:q3(r,o)}}function z3(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,Pe(n),r,i)}}function q3(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 p1(e,t){return(e.initializer!=null?ve:mn)(e,t)}function ND(e,t){return p1(t,V3(e))}function V3(e){return(t,n)=>{let r=bt(t,e);return{data:t,facets:n.map(i=>i.filter(o=>r[o]))}}}function OD({sort:e,...t}={}){return{...p1(t,j3),sort:No(e)?e:null}}function j3(e,t){return{data:e,facets:t.map(n=>n.slice().reverse())}}function BD({seed:e,sort:t,...n}={}){return{...p1(n,LD(e==null?Math.random:Wc(e))),sort:No(t)?t:null}}function m1(e,{sort:t,...n}={}){return{...(Fr(e)&&e.channel!==void 0?ve:p1)(n,Y3(e)),sort:No(t)?t:null}}function Y3(e){return(typeof e=="function"&&e.length!==1?NV:LD)(e)}function NV(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 LD(e){let t,n;({channel:t,value:e,order:n}={...ci(e)});let r=t?.startsWith("-");if(r&&(t=t.slice(1)),n===void 0&&(n=r?nl:fn),typeof n!="function")switch(`${n}`.toLowerCase()){case"ascending":n=fn;break;case"descending":n=nl;break;default:throw new Error(`invalid order: ${n}`)}return(i,o,s)=>{let a;if(t===void 0)a=bt(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 am(e,t){return y1(null,null,e,t)}function Ra(e={y:"count"},t={}){let{x:n=W}=t;if(n==null)throw new Error("missing channel: x");return y1(n,null,e,t)}function ka(e={x:"count"},t={}){let{y:n=W}=t;if(n==null)throw new Error("missing channel: y");return y1(null,n,e,t)}function cm(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 y1(n,r,e,t)}function y1(e,t,{data:n=x1,filter:r,sort:i,reverse:o,...s}={},a={}){s=G3(s,a),n=$D(n,W),i=i==null?void 0:RD("sort",i,a),r=r==null?void 0:kD("filter",r,a);let[c,l]=Dn(e),[u,f]=Dn(t),{z:h,fill:d,stroke:p,x1:m,x2:y,y1:g,y2:b,...x}=a,[w,v]=Dn(h),[_]=De(d),[M]=De(p),[E,I]=Dn(_),[N,A]=Dn(M);return{..."z"in a&&{z:w||h},..."fill"in a&&{fill:E||d},..."stroke"in a&&{stroke:N||p},...mn(x,(O,L,S)=>{let T=sl(bt(O,e),S?.x),D=sl(bt(O,t),S?.y),C=bt(O,h),R=bt(O,_),F=bt(O,M),k=lm(s,{z:C,fill:R,stroke:F}),$=[],U=[],G=T&&l([]),et=D&&f([]),rt=C&&v([]),st=R&&I([]),j=F&&A([]),ot=0;for(let z of s)z.initialize(O);i&&i.initialize(O),r&&r.initialize(O);for(let z of L){let H=[];for(let nt of s)nt.scope("facet",z);i&&i.scope("facet",z),r&&r.scope("facet",z);for(let[nt,P]of Ca(z,k))for(let[Lt,ft]of Ca(P,D))for(let[Wt,Ht]of Ca(ft,T)){let J={data:O};if(T&&(J.x=Wt),D&&(J.y=Lt),k&&(J.z=nt),!(r&&!r.reduce(Ht,J))){H.push(ot++),U.push(n.reduceIndex(Ht,O,J)),T&&G.push(Wt),D&&et.push(Lt),C&&rt.push(k===C?nt:C[Ht[0]]),R&&st.push(k===R?nt:R[Ht[0]]),F&&j.push(k===F?nt:F[Ht[0]]);for(let oe of s)oe.reduce(Ht,J);i&&i.reduce(Ht,J)}}$.push(H)}return X3($,i,o),{data:U,facets:$}}),...!Lo(s,"x")&&(c?{x:c}:{x1:m,x2:y}),...!Lo(s,"y")&&(u?{y:u}:{y1:g,y2:b}),...Object.fromEntries(s.map(({name:O,output:L})=>[O,L]))}}function Lo(e,...t){for(let{name:n}of e)if(t.includes(n))return!0;return!1}function W3(e,t,n=g1){let r=Object.entries(e);return t.title!=null&&e.title===void 0&&r.push(["title",RV]),t.href!=null&&e.href===void 0&&r.push(["href",w1]),r.filter(([,i])=>i!==void 0).map(([i,o])=>o===null?OV(i):n(i,o,t))}function g1(e,t,n,r=b1){let i;dn(t)&&"reduce"in t&&(i=t.scale,t=t.reduce);let o=r(e,t,n),[s,a]=pn(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 OV(e){return{name:e,initialize(){},scope(){},reduce(){}}}function b1(e,t,n,r=of){let i=l1(e,n),o=r(t,i),s,a;return{label:Nn(o===sm?null:i,o.label),initialize(c){s=i===void 0?c:bt(c,i),o.scope==="data"&&(a=o.reduceIndex(or(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 Ca(e,t){return t?an(e,n=>t[n]):[[,e]]}function of(e,t,n=BV){if(e==null)return n(e);if(typeof e.reduceIndex=="function")return e;if(typeof e.reduce=="function"&&dn(e))return FV(e);if(typeof e=="function")return CV(e);if(/^p\d{2}$/i.test(e))return ks(Qu(e));switch(`${e}`.toLowerCase()){case"first":return w1;case"last":return kV;case"identity":return x1;case"count":return sm;case"distinct":return $V;case"sum":return t==null?sm:UV;case"proportion":return CD(t,"data");case"proportion-facet":return CD(t,"facet");case"deviation":return ks(Qr);case"min":return ks(ce);case"min-index":return ks(K0);case"max":return ks(Xt);case"max-index":return ks(Q0);case"mean":return FD(hs);case"median":return FD(Di);case"variance":return ks(ua);case"mode":return ks(au)}return n(e)}function BV(e){throw new Error(`invalid reduce: ${e}`)}function G3(e,t){return W3(e,t,RD)}function RD(e,t,n){return g1(e,t,n,kD)}function kD(e,t,n){return b1(e,t,n,$D)}function $D(e,t){return of(e,t,LV)}function LV(e){switch(`${e}`.toLowerCase()){case"x":return PV;case"y":return zV;case"z":return H3}throw new Error(`invalid group reduce: ${e}`)}function lm(e,t){for(let n in t){let r=t[n];if(r!==void 0&&!e.some(i=>i.name===n))return r}}function X3(e,t,n){if(t){let r=t.output.transform(),i=(o,s)=>fn(r[o],r[s]);e.forEach(o=>o.sort(i))}n&&e.forEach(r=>r.reverse())}function FV(e){return console.warn("deprecated reduce interface; implement reduceIndex instead."),{...e,reduceIndex:e.reduce.bind(e)}}function CV(e){return{reduceIndex(t,n,r){return e(im(n,t),r)}}}function ks(e){return{reduceIndex(t,n){return e(t,r=>n[r])}}}function FD(e){return{reduceIndex(t,n){let r=e(t,i=>n[i]);return Ne(n)?new Date(r):r}}}var x1={reduceIndex(e,t){return im(t,e)}},w1={reduceIndex(e,t){return t[e[0]]}},RV={reduceIndex(e,t){let r=us(Ei(e,o=>o.length,o=>t[o]),Oa),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`,In(o,Oa)]}return i.map(([o,s])=>`${o} (${s.toLocaleString("en-US")})`).join(`
16
+ `)}},kV={reduceIndex(e,t){return t[e[e.length-1]]}},sm={label:"Frequency",reduceIndex(e){return e.length}},$V={label:"Distinct",reduceIndex(e,t){let n=new Hn;for(let r of e)n.add(t[r]);return n.size}},UV=ks(In);function CD(e,t){return e==null?{scope:t,label:"Frequency",reduceIndex:(n,r,i=1)=>n.length/i}:{scope:t,reduceIndex:(n,r,i=1)=>In(n,o=>r[o])/i}}var PV={reduceIndex(e,t,{x:n}){return n}},zV={reduceIndex(e,t,{y:n}){return n}},H3={reduceIndex(e,t,{z:n}){return n}};function UD(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 sf(e,{scale:t,type:n,value:r,filter:i,hint:o,label:s=Nn(r)},a){return o===void 0&&typeof r?.transform=="function"&&(o=r.hint),Q3(a,{scale:t,type:n,value:bt(e,r),label:s,filter:i,hint:o})}function _1(e,t){return Object.fromEntries(Object.entries(e).map(([n,r])=>[n,sf(t,r,n)]))}function af(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:Yt(o,s)]}));return n.channels=e,n}function Q3(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&&f1(r,Fa)?null:"color";break;case"fillOpacity":case"strokeOpacity":case"opacity":t.scale=n!==!0&&f1(r,vD)?null:"opacity";break;case"symbol":n!==!0&&f1(r,ED)?(t.scale=null,t.value=Yt(r,rf)):t.scale="symbol";break;default:t.scale=ue.has(e)?e:null;break}else if(n===!1)t.scale=null;else if(n!=null&&!ue.has(n))throw new Error(`unknown scale: ${n}`);return t}function zD(e,t,n,r,i){let{order:o,reverse:s,reduce:a=!0,limit:c}=i;for(let l in i){if(!ue.has(l))continue;let{value:u,order:f=o,reverse:h=s,reduce:d=a,limit:p=c}=ci(i[l]),m=u?.startsWith("-");if(m&&(u=u.slice(1)),f=f===void 0?m!==(u==="width"||u==="height")?VD:qD:jV(f),d==null||d===!1)continue;let y=l==="fx"||l==="fy"?VV(t,r[l]):qV(n,l);if(!y)throw new Error(`missing channel for scale: ${l}`);let g=y.value,[b=0,x=1/0]=sr(p)?p:p<0?[p]:[0,p];if(u==null)y.domain=()=>{let w=Array.from(new Hn(g));return h&&(w=w.reverse()),(b!==0||x!==1/0)&&(w=w.slice(b,x)),w};else{let w=u==="data"?e:u==="height"?PD(n,"y1","y2"):u==="width"?PD(n,"x1","x2"):Z3(n,u,u==="y"?"y2":u==="x"?"x2":void 0),v=of(d===!0?"max":d,w);y.domain=()=>{let _=Mv(or(g),M=>v.reduceIndex(M,w),M=>g[M]);return f&&_.sort(f),h&&_.reverse(),(b!==0||x!==1/0)&&(_=_.slice(b,x)),_.map(ol)}}}}function qV(e,t){for(let n in e){let r=e[n];if(r.scale===t)return r}}function VV(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 PD(e,t,n){let r=Z3(e,t),i=Z3(e,n);return Yt(i,(o,s)=>Math.abs(o-r[s]),Float64Array)}function Z3(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 jV(e){if(e==null||typeof e=="function")return e;switch(`${e}`.toLowerCase()){case"ascending":return qD;case"descending":return VD}throw new Error(`invalid order: ${e}`)}function qD([e,t],[n,r]){return fn(t,r)||fn(e,n)}function VD([e,t],[n,r]){return nl(t,r)||fn(e,n)}function um(e,t){let n=e[t];if(n){for(;n.source;)n=n.source;return n.source===null?null:n}}function $a(e={}){let{document:t=typeof window<"u"?window.document:void 0,clip:n}=e;return{document:t,clip:d1(n)}}function lt(e,{document:t}){return Pt(ps(e).call(t.documentElement))}var K3=0,J3;function jD(){let e=K3;return K3=0,J3=void 0,e}function qn(e){e!==J3&&(J3=e,console.warn(e),++K3)}var WD=Math.PI,$s=2*WD,YD=.618;function GD({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(dn(e)){let v;if({type:e,domain:c,inset:v,insetTop:n=v!==void 0?v:n,insetRight:r=v!==void 0?v:r,insetBottom:i=v!==void 0?v:i,insetLeft:o=v!==void 0?v:o,clip:l=l,...a}=e,e==null)return}typeof e!="function"&&({type:e}=XD(e));let{width:u,height:f,marginLeft:h,marginRight:d,marginTop:p,marginBottom:m}=s,y=u-h-d-o-r,g=f-p-m-n-i;if(e=e?.({width:y,height:g,clip:l,...a}),e==null)return;l=YV(l,h,p,u-d,f-m);let b=h+o,x=p+n,w;if(c!=null){let[[v,_],[M,E]]=Tn(e).bounds(c),I=Math.min(y/(M-v),g/(E-_));I>0?(b-=(I*(v+M)-y)/2,x-=(I*(_+E)-g)/2,w=jc({point(N,A){this.stream.point(N*I+b,A*I+x)}})):qn("Warning: the projection could not be fit to the specified domain; using the default scale.")}return w??=b===0&&x===0?HD():jc({point(v,_){this.stream.point(v+b,_+x)}}),{stream:v=>e.stream(w.stream(l(v)))}}function XD(e){switch(`${e}`.toLowerCase()){case"albers-usa":return Li(Z2,.7463,.4673);case"albers":return v1(fp,.7463,.4673);case"azimuthal-equal-area":return Li(K2,4,4);case"azimuthal-equidistant":return Li(tS,$s,$s);case"conic-conformal":return v1(rS,$s,$s);case"conic-equal-area":return v1(_a,6.1702,2.9781);case"conic-equidistant":return v1(oS,7.312,3.6282);case"equal-earth":return Li(aS,5.4133,2.6347);case"equirectangular":return Li(iS,$s,WD);case"gnomonic":return Li(lS,3.4641,3.4641);case"identity":return{type:HD};case"reflect-y":return{type:WV};case"mercator":return Li(eS,$s,$s);case"orthographic":return Li(fS,2,2);case"stereographic":return Li(dS,2,2);case"transverse-mercator":return Li(mS,$s,$s);default:throw new Error(`unknown projection type: ${e}`)}}function YV(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 Au(t,n,r,i);default:throw new Error(`unknown projection clip type: ${e}`)}}function Li(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 v1(e,t,n){let{type:r,aspectRatio:i}=Li(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 HD=hn({stream:e=>e}),WV=hn(jc({point(e,t){this.stream.point(e,-t)}}));function tM(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,h){a[l]=f,c[l]=h}});for(l=0;l<s;++l)u.point(i[l],o[l])}function ZD({projection:e}={}){return e==null?!1:typeof e.stream=="function"?!0:(dn(e)&&(e=e.type),e!=null)}function QD(e){if(typeof e?.stream=="function")return YD;if(dn(e)&&(e=e.type),e!=null){if(typeof e!="function"){let{aspectRatio:t}=XD(e);if(t)return t}return YD}}function Ua(e,t,{projection:n}){let{x:r,y:i}=e,o={};return r&&(o.x=r),i&&(o.y=i),o=af(o,t),n&&r?.scale==="x"&&i?.scale==="y"&&tM("x","y",o,n),r&&(o.x=Qe(o.x)),i&&(o.y=Qe(o.y)),o}function KD(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)Nr(s,o);return[r,i]}var rN=new Map([["accent",US],["category10",$S],["dark2",PS],["observable10",zS],["paired",qS],["pastel1",VS],["pastel2",jS],["set1",YS],["set2",WS],["set3",GS],["tableau10",XS]]);function iN(e){return e!=null&&rN.has(`${e}`.toLowerCase())}var JD=new Map([...rN,["brbg",Us(kb,$b)],["prgn",Us(Ub,Pb)],["piyg",Us(zb,qb)],["puor",Us(Vb,jb)],["rdbu",Us(Fp,$u)],["rdgy",Us(Yb,Wb)],["rdylbu",Us(Cp,Uu)],["rdylgn",Us(Gb,Xb)],["spectral",Us(Hb,Zb)],["burd",tN(Fp,$u)],["buylrd",tN(Cp,Uu)],["blues",yn(_x,vx)],["greens",yn(Sx,Mx)],["greys",yn(Ix,Ax)],["oranges",yn(Ox,Bx)],["purples",yn(Tx,Ex)],["reds",yn(Dx,Nx)],["turbo",Ps(zx)],["viridis",Ps(Vx)],["magma",Ps(jx)],["inferno",Ps(Yx)],["plasma",Ps(Wx)],["cividis",Ps(Lx)],["cubehelix",Ps(Fx)],["warm",Ps(Rx)],["cool",Ps(kx)],["bugn",yn(Qb,Kb)],["bupu",yn(Jb,tx)],["gnbu",yn(ex,nx)],["orrd",yn(rx,ix)],["pubu",yn(ax,cx)],["pubugn",yn(ox,sx)],["purd",yn(lx,ux)],["rdpu",yn(fx,hx)],["ylgn",yn(mx,yx)],["ylgnbu",yn(dx,px)],["ylorbr",yn(gx,bx)],["ylorrd",yn(xx,wx)],["rainbow",eN($x)],["sinebow",eN(Px)]]);function yn(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 Us(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 tN(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 Ps(e){return({length:t})=>Cn(e,Math.max(2,Math.floor(t)))}function eN(e){return({length:t})=>Cn(e,Math.floor(t)+1).slice(0,-1)}function eM(e){let t=`${e}`.toLowerCase();if(!JD.has(t))throw new Error(`unknown ordinal scheme: ${t}`);return JD.get(t)}function fm(e,t){let n=eM(e),r=typeof n=="function"?n({length:t}):n;return r.length!==t?r.slice(0,t):r}function oN(e,t="greys"){let n=new Set,[r,i]=fm(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 nN=new Map([["brbg",$b],["prgn",Pb],["piyg",qb],["puor",jb],["rdbu",$u],["rdgy",Wb],["rdylbu",Uu],["rdylgn",Xb],["spectral",Zb],["burd",e=>$u(1-e)],["buylrd",e=>Uu(1-e)],["blues",vx],["greens",Mx],["greys",Ax],["purples",Ex],["reds",Nx],["oranges",Bx],["turbo",zx],["viridis",Vx],["magma",jx],["inferno",Yx],["plasma",Wx],["cividis",Lx],["cubehelix",Fx],["warm",Rx],["cool",kx],["bugn",Kb],["bupu",tx],["gnbu",nx],["orrd",ix],["pubugn",sx],["pubu",cx],["purd",ux],["rdpu",hx],["ylgnbu",px],["ylgn",yx],["ylorbr",bx],["ylorrd",wx],["rainbow",$x],["sinebow",Px]]);function cf(e){let t=`${e}`.toLowerCase();if(!nN.has(t))throw new Error(`unknown quantitative scheme: ${t}`);return nN.get(t)}var GV=new Set(["brbg","prgn","piyg","puor","rdbu","rdgy","rdylbu","rdylgn","spectral","burd","buylrd"]);function sN(e){return e!=null&&GV.has(`${e}`.toLowerCase())}var rM=e=>t=>e(1-t),nM=[0,1],aN=new Map([["number",we],["rgb",Jr],["hsl",Zv],["hcl",Qv],["lab",wg]]);function iM(e){let t=`${e}`.toLowerCase();if(!aN.has(t))throw new Error(`unknown interpolator: ${t}`);return aN.get(t)}function uf(e,t,n,{type:r,nice:i,clamp:o,zero:s,domain:a=mN(e,n),unknown:c,round:l,scheme:u,interval:f,range:h=ue.get(e)===al?QV(n,a):ue.get(e)===cl?KV(n,a):ue.get(e)===ll?nM:void 0,interpolate:d=ue.get(e)===Cr?u==null&&h!==void 0?Jr:cf(u!==void 0?u:r==="cyclical"?"rainbow":"turbo"):l?Cc:we,reverse:p}){if(f=Oo(f,r),(r==="cyclical"||r==="sequential")&&(r="linear"),typeof d!="function"&&(d=iM(d)),p=!!p,h!==void 0){let m=(a=Pe(a)).length,y=(h=Pe(h)).length;if(m!==y){if(d.length===1)throw new Error("invalid piecewise interpolator");d=ho(d,h),h=void 0}}if(d.length===1?(p&&(d=rM(d),p=!1),h===void 0&&(h=Float64Array.from(a,(m,y)=>y/(a.length-1)),h.length===2&&(h=nM)),t.interpolate((h===nM?hn:hm)(d))):t.interpolate(d),s){let[m,y]=ae(a);(m>0||y<0)&&(a=Ba(a),Bs(a)!==Math.sign(m)?a[a.length-1]=0:a[0]=0)}return p&&(a=ha(a)),t.domain(a).unknown(c),i&&(t.nice(XV(i,r)),a=t.domain()),h!==void 0&&t.range(h),o&&t.clamp(o),{type:r,domain:a,range:h,scale:t,interpolate:d,interval:f}}function XV(e,t){return e===!0?void 0:typeof e=="number"?e:yD(e,t)}function cN(e,t,n){return uf(e,vs(),t,n)}function lN(e,t,n){return oM(e,t,{...n,exponent:.5})}function oM(e,t,{exponent:n=1,...r}){return uf(e,Sp().exponent(n),t,{...r,type:"pow"})}function uN(e,t,{base:n=10,domain:r=JV(t),...i}){return uf(e,_p().base(n),t,{...i,domain:r})}function fN(e,t,{constant:n=1,...r}){return uf(e,vp().constant(n),t,r)}function hN(e,t,{range:n,quantiles:r=n===void 0?5:(n=[...n]).length,n:i=r,scheme:o="rdylbu",domain:s=tj(t),unknown:a,interpolate:c,reverse:l}){return n===void 0&&(n=c!==void 0?Cn(c,i):ue.get(e)===Cr?fm(o,i):void 0),s.length>0&&(s=Mp(s,n===void 0?{length:i}:n).quantiles()),S1(e,t,{domain:s,range:n,reverse:l,unknown:a})}function dN(e,t,{range:n,n:r=n===void 0?5:(n=[...n]).length,scheme:i="rdylbu",domain:o=mN(e,t),unknown:s,interpolate:a,reverse:c}){let[l,u]=ae(o),f;return n===void 0?(f=Mn(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):ue.get(e)===Cr?fm(i,r):void 0):(f=Cn(we(l,u),r+1).slice(1,-1),l instanceof Date&&(f=f.map(h=>new Date(h)))),Bs(Pe(o))<0&&f.reverse(),S1(e,t,{domain:f,range:n,reverse:c,unknown:s})}function S1(e,t,{domain:n=[0],unknown:r,scheme:i="rdylbu",interpolate:o,range:s=o!==void 0?Cn(o,n.length+1):ue.get(e)===Cr?fm(i,n.length+1):void 0,reverse:a}){n=Pe(n);let c=Bs(n);if(!isNaN(c)&&!HV(n,c))throw new Error(`the ${e} scale has a non-monotonic domain`);return a&&(s=ha(s)),{type:"threshold",scale:Ip(c<0?ha(n):n,s===void 0?[]:s).unknown(r),domain:n,range:s}}function HV(e,t){for(let n=1,r=e.length,i=e[0];n<r;++n){let o=Gn(i,i=e[n]);if(o!==0&&o!==t)return!1}return!0}function pN(e){return{type:"identity",scale:TD(ue.get(e))?xp():t=>t}}function lf(e,t=Gu){return e.length?[ce(e,({value:n})=>n===void 0?n:ce(n,t)),Xt(e,({value:n})=>n===void 0?n:Xt(n,t))]:[0,1]}function mN(e,t){let n=ue.get(e);return(n===al||n===ll||n===cl?ZV:lf)(t)}function ZV(e){return[0,e.length?Xt(e,({value:t})=>t===void 0?t:Xt(t,Gu)):1]}function QV(e,t){let n=e.find(({radius:s})=>s!==void 0);if(n!==void 0)return[0,n.radius];let r=Zn(e,.5,({value:s})=>s===void 0?NaN:Zn(s,.25,ir)),i=t.map(s=>3*Math.sqrt(s/r)),o=30/Xt(i);return o<1?i.map(s=>s*o):i}function KV(e,t){let n=Di(e,({value:o})=>o===void 0?NaN:Di(o,Math.abs)),r=t.map(o=>12*o/n),i=60/Xt(r);return i<1?r.map(o=>o*i):r}function JV(e){for(let{value:t}of e)if(t!==void 0)for(let n of t){if(n>0)return lf(e,ir);if(n<0)return lf(e,Aa)}return[1,10]}function tj(e){let t=[];for(let{value:n}of e)if(n!==void 0)for(let r of n)t.push(r);return t}function hm(e){return(t,n)=>r=>e(t+r*(n-t))}function M1(e,t,n,r,{type:i,nice:o,clamp:s,domain:a=lf(r),unknown:c,pivot:l=0,scheme:u,range:f,symmetric:h=!0,interpolate:d=ue.get(e)===Cr?u==null&&f!==void 0?Jr:cf(u!==void 0?u:"rdbu"):we,reverse:p}){l=+l,a=Pe(a);let[m,y]=a;if(a.length>2&&qn(`Warning: the diverging ${e} scale domain contains extra elements.`),Gn(m,y)<0&&([m,y]=[y,m],p=!p),m=Math.min(m,l),y=Math.max(y,l),typeof d!="function"&&(d=iM(d)),f!==void 0&&(d=d.length===1?hm(d)(...f):ho(d,f)),p&&(d=rM(d)),h){let g=n.apply(l),b=g-n.apply(m),x=n.apply(y)-g;b<x?m=n.invert(g-x):b>x&&(y=n.invert(g+b))}return t.domain([m,l,y]).unknown(c).interpolator(d),s&&t.clamp(s),o&&t.nice(o),{type:i,domain:[m,y],pivot:l,interpolate:d,scale:t}}function yN(e,t,n){return M1(e,Lp(),ej,t,n)}function gN(e,t,n){return sM(e,t,{...n,exponent:.5})}function sM(e,t,{exponent:n=1,...r}){return M1(e,Rb().exponent(n=+n),ij(n),t,{...r,type:"diverging-pow"})}function bN(e,t,{base:n=10,pivot:r=1,domain:i=lf(t,r<0?Aa:ir),...o}){return M1(e,Fb().base(n=+n),nj,t,{domain:i,pivot:r,...o})}function xN(e,t,{constant:n=1,...r}){return M1(e,Cb().constant(n=+n),oj(n),t,r)}var ej={apply(e){return e},invert(e){return e}},nj={apply:Math.log,invert:Math.exp},rj={apply(e){return Math.sign(e)*Math.sqrt(Math.abs(e))},invert(e){return Math.sign(e)*(e*e)}};function ij(e){return e===.5?rj:{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 oj(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 wN(e,t,n,r){return uf(e,t,n,r)}function _N(e,t,n){return wN(e,Ob(),t,n)}function vN(e,t,n){return wN(e,Bb(),t,n)}var ff=Symbol("ordinal");function MN(e,t,n,{type:r,interval:i,domain:o,range:s,reverse:a,hint:c}){return i=Oo(i,r),o===void 0&&(o=DN(n,i,e)),(r==="categorical"||r===ff)&&(r="ordinal"),a&&(o=ha(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 IN(e,t,{type:n,interval:r,domain:i,range:o,scheme:s,unknown:a,...c}){r=Oo(r,n),i===void 0&&(i=DN(t,r,e));let l;if(ue.get(e)===nf)l=sj(t),o=o===void 0?aj(l):Yt(o,rf);else if(ue.get(e)===Cr&&(o===void 0&&(n==="ordinal"||n===ff)&&(o=oN(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=cf(s),f=o[0],h=o[1]-o[0];o=({length:d})=>Cn(p=>u(f+h*p),d)}else o=eM(s);if(a===gp)throw new Error(`implicit unknown on ${e} scale is not supported`);return MN(e,Gc().unknown(a),t,{...c,type:n,domain:i,range:o,hint:l})}function AN(e,t,{align:n=.5,padding:r=.5,...i}){return EN(vS().align(n).padding(r),t,i,e)}function TN(e,t,{align:n=.5,padding:r=.1,paddingInner:i=r,paddingOuter:o=e==="fx"||e==="fy"?0:r,...s}){return EN(Sa().align(n).paddingInner(i).paddingOuter(o),t,s,e)}function EN(e,t,n,r){let{round:i}=n;return i!==void 0&&e.round(i=!!i),e=MN(r,e,t,n),e.round=i,e}function DN(e,t,n){let r=new Hn;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&&ue.get(n)===li)throw new Error(`implicit ordinal domain of ${n} scale has more than 10,000 values`);return us(r,fn)}function SN(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 sj(e){return{fill:SN(e,"fill"),stroke:SN(e,"stroke")}}function aj(e){return ee(e.fill)?e3:Kx}function dm(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:h,projection:d,facet:{label:p=t}={},...m}={}){let y={};for(let[g,b]of e){let x=m[g],w=kN(g,b,{round:ue.get(g)===li?a:void 0,nice:c,clamp:l,zero:u,align:f,padding:h,projection:d,...x});if(w){let{label:v=g==="fx"||g==="fy"?p:t,percent:_,transform:M,inset:E,insetTop:I=E!==void 0?E:g==="y"?r:0,insetRight:N=E!==void 0?E:g==="x"?i:0,insetBottom:A=E!==void 0?E:g==="y"?o:0,insetLeft:O=E!==void 0?E:g==="x"?s:0}=x||{};if(M==null)M=void 0;else if(typeof M!="function")throw new Error("invalid scale transform; not a function");w.percent=!!_,w.label=v===void 0?cj(b,w):v,w.transform=M,g==="x"||g==="fx"?(w.insetLeft=+O,w.insetRight=+N):(g==="y"||g==="fy")&&(w.insetTop=+I,w.insetBottom=+A),y[g]=w}}return y}function cM(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]=UN(i),n[r]=o,o.type=s,a!=null&&(o.interval=a),c!=null&&(o.label=c)}return n}function FN(e,t){let{x:n,y:r,fx:i,fy:o}=e,s=i||o?T1(t):t;i&&NN(i,s),o&&ON(o,s);let a=i||o?lM(e,t):t;n&&NN(n,a),r&&ON(r,a)}function cj(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!Fo(t)&&t.percent&&(n=`${n} (%)`),{inferred:!0,toString:()=>n}}function A1(e){return Math.sign(Bs(e.domain()))*Math.sign(Bs(e.range()))}function T1(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 lM({fx:e,fy:t},n){let{marginTop:r,marginRight:i,marginBottom:o,marginLeft:s,width:a,height:c}=T1(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 NN(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)],Fo(e)||(e.range=RN(e)),e.scale.range(e.range)}CN(e)}function ON(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],Fo(e)?e.range.reverse():e.range=RN(e),e.scale.range(e.range)}CN(e)}function CN(e){e.round===void 0&&fj(e)&&lj(e)<=30&&e.scale.round(!0)}function lj({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 RN(e){let t=e.scale.domain().length+uM(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 E1(e,t,n){return kN(e,n===void 0?void 0:[{hint:n}],{...t})}function kN(e,t=[],n={}){let r=uj(e,t,n);if(n.type===void 0&&n.domain===void 0&&n.range===void 0&&n.interval==null&&e!=="fx"&&e!=="fy"&&Fo({type:r})){let i=t.map(({value:o})=>o).filter(o=>o!==void 0);i.some(Ne)?qn(`Warning: some data associated with the ${e} scale are dates. Dates are typically associated with a "utc" or "time" scale rather than a "${hf(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 "${hf(r)}".`):i.some(wD)?qn(`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 "${hf(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 "${hf(r)}".`):i.some(_D)&&qn(`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 "${hf(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 "${hf(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=I1(t,n,Qe);break;case"identity":switch(ue.get(e)){case li:n=I1(t,n,Qe);break;case nf:n=I1(t,n,hj);break}break;case"utc":case"time":n=I1(t,n,mD);break}switch(r){case"diverging":return yN(e,t,n);case"diverging-sqrt":return gN(e,t,n);case"diverging-pow":return sM(e,t,n);case"diverging-log":return bN(e,t,n);case"diverging-symlog":return xN(e,t,n);case"categorical":case"ordinal":case ff:return IN(e,t,n);case"cyclical":case"sequential":case"linear":return cN(e,t,n);case"sqrt":return lN(e,t,n);case"threshold":return S1(e,t,n);case"quantile":return hN(e,t,n);case"quantize":return dN(e,t,n);case"pow":return oM(e,t,n);case"log":return uN(e,t,n);case"symlog":return fN(e,t,n);case"utc":return vN(e,t,n);case"time":return _N(e,t,n);case"point":return AN(e,t,n);case"band":return TN(e,t,n);case"identity":return pN(e);case void 0:return;default:throw new Error(`unknown scale type: ${r}`)}}function hf(e){return typeof e=="symbol"?e.description:e}function BN(e){return typeof e=="string"?`${e}`.toLowerCase():e}var LN={toString:()=>"projection"};function uj(e,t,{type:n,domain:r,range:i,scheme:o,pivot:s,projection:a}){if(n=BN(n),e==="fx"||e==="fy")return"band";(e==="x"||e==="y")&&a!=null&&(n=LN);for(let l of t){let u=BN(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===LN)return;if(n!==void 0)return n;if(r===void 0&&!t.some(({value:l})=>l!==void 0))return;let c=ue.get(e);if(c===al)return"sqrt";if(c===ll||c===cl)return"linear";if(c===nf)return"ordinal";if((r||i||[]).length>2)return aM(c);if(r!==void 0){if(Ae(r))return aM(c);if(Ne(r))return"utc"}else{let l=t.map(({value:u})=>u).filter(u=>u!==void 0);if(l.some(Ae))return aM(c);if(l.some(Ne))return"utc"}if(c===Cr){if(s!=null||sN(o))return"diverging";if(iN(o))return"categorical"}return"linear"}function aM(e){switch(e){case li:return"point";case Cr:return ff;default:return"ordinal"}}function Fo({type:e}){return e==="ordinal"||e==="point"||e==="band"||e===ff}function uM({type:e}){return e==="threshold"}function fj({type:e}){return e==="point"||e==="band"}function ar(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 I1(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 Yt(e,rf)}function Pa(e={}){let t;for(let n in e)if(ue.has(n)&&Do(e[n])){if(t!==void 0)throw new Error("ambiguous scale definition; multiple scales found");t=UN(E1(n,e[n]))}if(t===void 0)throw new Error("invalid scale definition; no scale found");return t}function $N(e){return t=>{if(!ue.has(t=`${t}`))throw new Error(`unknown scale: ${t}`);return e[t]}}function UN({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:Ba(n),...r!==void 0&&{range:Ba(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 D1(e){let t,n;return(...r)=>((n?.length!==r.length||n.some((i,o)=>i!==r[o]))&&(n=r,t=e(...r)),t)}var dj=D1(e=>new Intl.NumberFormat(e)),pj=D1((e,t)=>new Intl.DateTimeFormat(e,{timeZone:"UTC",...t&&{month:t}})),mj=D1((e,t)=>new Intl.DateTimeFormat(e,{timeZone:"UTC",...t&&{weekday:t}}));function yj(e="en-US"){let t=dj(e);return n=>n!=null&&!isNaN(n)?t.format(n):void 0}function PN(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 zN(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 fM(e){return o1(e,"Invalid Date")}function gj(e="en-US"){let t=yj(e);return n=>(n instanceof Date?fM:typeof n=="number"?t:Ue)(n)}var Fi=gj();var Oe=(typeof window<"u"?window.devicePixelRatio>1:typeof it>"u")?0:.5,bj=0;function N1(){return`plot-clip-${++bj}`}function O1(e,{title:t,href:n,ariaLabel:r,ariaDescription:i,ariaHidden:o,target:s,fill:a,fillOpacity:c,stroke:l,strokeWidth:u,strokeOpacity:f,strokeLinejoin:h,strokeLinecap:d,strokeMiterlimit:p,strokeDasharray:m,strokeDashoffset:y,opacity:g,mixBlendMode:b,imageFilter:x,paintOrder:w,pointerEvents:v,shapeRendering:_,channels:M},{ariaLabel:E,fill:I="currentColor",fillOpacity:N,stroke:A="none",strokeOpacity:O,strokeWidth:L,strokeLinecap:S,strokeLinejoin:T,strokeMiterlimit:D,paintOrder:C}){I===null&&(a=null,c=null),A===null&&(l=null,f=null),ee(I)?!ee(A)&&(!ee(a)||M?.fill)&&(A="none"):ee(A)&&(!ee(l)||M?.stroke)&&(I="none");let[R,F]=De(a,I),[k,$]=ie(c,N),[U,G]=De(l,A),[et,rt]=ie(f,O),[st,j]=ie(g);Rs(G)||(u===void 0&&(u=L),d===void 0&&(d=S),h===void 0&&(h=T),p===void 0&&!SD(h)&&(p=D),!Rs(F)&&w===void 0&&(w=C));let[ot,z]=ie(u);return I!==null&&(e.fill=le(F,"currentColor"),e.fillOpacity=pm($,1)),A!==null&&(e.stroke=le(G,"none"),e.strokeWidth=pm(z,1),e.strokeOpacity=pm(rt,1),e.strokeLinejoin=le(h,"miter"),e.strokeLinecap=le(d,"butt"),e.strokeMiterlimit=pm(p,4),e.strokeDasharray=le(m,"none"),e.strokeDashoffset=le(y,"0")),e.target=Ue(s),e.ariaLabel=Ue(E),e.ariaDescription=Ue(i),e.ariaHidden=Ue(o),e.opacity=pm(j,1),e.mixBlendMode=le(b,"normal"),e.imageFilter=le(x,"none"),e.paintOrder=le(w,"normal"),e.pointerEvents=le(v,"auto"),e.shapeRendering=le(_,"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:k,scale:"auto",optional:!0},stroke:{value:U,scale:"auto",optional:!0},strokeOpacity:{value:et,scale:"auto",optional:!0},strokeWidth:{value:ot,optional:!0},opacity:{value:st,scale:"auto",optional:!0}}}function xj(e,t){t&&e.filter(n=>Jp(t[n])).append("title").call(_j,t)}function wj(e,t){t&&e.filter(([n])=>Jp(t[n])).append("title").call(vj,t)}function _j(e,t){t&&e.text(n=>Fi(t[n]))}function vj(e,t){t&&e.text(([n])=>Fi(t[n]))}function Zt(e,{target:t,tip:n},{ariaLabel:r,title:i,fill:o,fillOpacity:s,stroke:a,strokeOpacity:c,strokeWidth:l,opacity:u,href:f}){r&&ut(e,"aria-label",h=>r[h]),o&&ut(e,"fill",h=>o[h]),s&&ut(e,"fill-opacity",h=>s[h]),a&&ut(e,"stroke",h=>a[h]),c&&ut(e,"stroke-opacity",h=>c[h]),l&&ut(e,"stroke-width",h=>l[h]),u&&ut(e,"opacity",h=>u[h]),f&&qN(e,h=>f[h],t),n||xj(e,i)}function ul(e,{target:t,tip:n},{ariaLabel:r,title:i,fill:o,fillOpacity:s,stroke:a,strokeOpacity:c,strokeWidth:l,opacity:u,href:f}){r&&ut(e,"aria-label",([h])=>r[h]),o&&ut(e,"fill",([h])=>o[h]),s&&ut(e,"fill-opacity",([h])=>s[h]),a&&ut(e,"stroke",([h])=>a[h]),c&&ut(e,"stroke-opacity",([h])=>c[h]),l&&ut(e,"stroke-width",([h])=>l[h]),u&&ut(e,"opacity",([h])=>u[h]),f&&qN(e,([h])=>f[h],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 mm(e,t,n){let r=an(e,i=>t[i]);return n===void 0&&r.size>1+e.length>>1&&qn("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*B1(e,t,n,r){let{z:i}=n,{z:o}=r,s=Sj(r,n),a=[...t,...s];for(let c of o?mm(e,o,i):[e]){let l,u;t:for(let f of c){for(let h of a)if(!$e(h[f])){u&&u.push(-1);continue t}if(l===void 0){u&&(yield u),l=s.map(h=>Fs(h[f])),u=[f];continue}u.push(f);for(let h=0;h<s.length;++h)if(Fs(s[h][f])!==l[h]){yield u,l=s.map(p=>Fs(p[f])),u=[f];continue t}}u&&(yield u)}}function Mj(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,h=N1();i=`url(#${h})`,e=lt("svg:g",r).call(d=>d.append("svg:clipPath").attr("id",h).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=N1();i=`url(#${a})`,e.append("clipPath").attr("id",a).append("path").attr("d",Tn(s)({type:"Sphere"}));break}}ut(e,"aria-label",t.ariaLabel),ut(e,"aria-description",t.ariaDescription),ut(e,"aria-hidden",t.ariaHidden),ut(e,"clip-path",i)}function Bt(e,t,n,r){Mj(e,t,n,r),ut(e,"fill",t.fill),ut(e,"fill-opacity",t.fillOpacity),ut(e,"stroke",t.stroke),ut(e,"stroke-width",t.strokeWidth),ut(e,"stroke-opacity",t.strokeOpacity),ut(e,"stroke-linejoin",t.strokeLinejoin),ut(e,"stroke-linecap",t.strokeLinecap),ut(e,"stroke-miterlimit",t.strokeMiterlimit),ut(e,"stroke-dasharray",t.strokeDasharray),ut(e,"stroke-dashoffset",t.strokeDashoffset),ut(e,"shape-rendering",t.shapeRendering),ut(e,"filter",t.imageFilter),ut(e,"paint-order",t.paintOrder);let{pointerEvents:i=r.pointerSticky===!1?"none":void 0}=t;ut(e,"pointer-events",i)}function Ot(e,t){Ij(e,"mix-blend-mode",t.mixBlendMode),ut(e,"opacity",t.opacity)}function qN(e,t,n){e.each(function(r){let i=t(r);if(i!=null){let o=this.ownerDocument.createElementNS(Kr.svg,"a");o.setAttribute("fill","inherit"),o.setAttributeNS(Kr.xlink,"href",i),n!=null&&o.setAttribute("target",n),this.parentNode.insertBefore(o,this).appendChild(this)}})}function ut(e,t,n){n!=null&&e.attr(t,n)}function Ij(e,t,n){n!=null&&e.style(t,n)}function It(e,t,{x:n,y:r},i=Oe,o=Oe){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=Ue(e))!==t)return e}function pm(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 df(e){if(e===void 0)return"plot-d6a7b5";if(e=`${e}`,!Aj.test(e))throw new Error(`invalid class name: ${e}`);return e}function pf(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 gn({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 jN(e,t,n={}){let r=.5-Oe,i=.5+Oe,o=.5+Oe,s=.5-Oe;for(let{marginTop:m,marginRight:y,marginBottom:g,marginLeft:b}of t)m>r&&(r=m),y>i&&(i=y),g>o&&(o=g),b>s&&(s=b);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:h=640,height:d=Tj(e,n,{width:h,marginTopDefault:r,marginRightDefault:i,marginBottomDefault:o,marginLeftDefault:s})+Math.max(0,c-r+u-o)}=n;h=+h,d=+d;let p={width:h,height:d,marginTop:c,marginRight:l,marginBottom:u,marginLeft:f};if(e.fx||e.fy){let{margin:m,marginTop:y=m!==void 0?m:c,marginRight:g=m!==void 0?m:l,marginBottom:b=m!==void 0?m:u,marginLeft:x=m!==void 0?m:f}=n.facet??{};y=+y,g=+g,b=+b,x=+x,p.facet={marginTop:y,marginRight:g,marginBottom:b,marginLeft:x}}return p}function Tj({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,h=QD(i);if(h){let p=r?r.scale.domain().length:1,m=(1.1*f-.1)/(1.1*p-.1)*h,y=Math.max(.1,Math.min(10,m));return Math.round((s-u-c)*y+a+l)}let d=t?Fo(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=VN("y",t)/(VN("x",e)*o),m=r?r.scale.bandwidth():1,y=n?n.scale.bandwidth():1,g=m*(s-u-c)-e.insetLeft-e.insetRight;return(p*g+t.insetTop+t.insetBottom)/y+a+l}return!!(t||n)*Math.max(1,Math.min(60,d*f))*20+!!r*30+60}function VN(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 WN(e,t){let{fx:n,fy:r}=dm(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 GN(e,{x:t,y:n}){return t&&=yM(t),n&&=yM(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 F1(e,{fx:t,fy:n}){let r=or(e),i=t?.value,o=n?.value;return t&&n?Ei(r,s=>(s.fx=i[s[0]],s.fy=o[s[0]],s),s=>i[s],s=>o[s]):t?Ei(r,s=>(s.fx=i[s[0]],s),s=>i[s]):Ei(r,s=>(s.fy=o[s[0]],s),s=>o[s])}function XN(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 HN(e){let t=[],n=new Uint32Array(In(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 Ej=new Map([["top",hM],["right",mM],["bottom",dM],["left",pM],["top-left",L1(hM,pM)],["top-right",L1(hM,mM)],["bottom-left",L1(dM,pM)],["bottom-right",L1(dM,mM)],["top-empty",Nj],["right-empty",Lj],["bottom-empty",Oj],["left-empty",Bj],["empty",Fj]]);function ZN(e){if(e==null)return null;let t=Ej.get(`${e}`.toLowerCase());if(t)return t;throw new Error(`invalid facet anchor: ${e}`)}var YN=new WeakMap;function yM(e){let t=YN.get(e);return t||YN.set(e,t=new Xn(Yt(e,(n,r)=>[n,r]))),t}function za(e,t){return yM(e).get(t)}function Dj(e,t,n){return t=Fs(t),n=Fs(n),e.find(r=>Object.is(Fs(r.x),t)&&Object.is(Fs(r.y),n))}function C1(e,t,n){return Dj(e,t,n)?.empty}function hM(e,{y:t},{y:n}){return t?za(t,n)===0:!0}function dM(e,{y:t},{y:n}){return t?za(t,n)===t.length-1:!0}function pM(e,{x:t},{x:n}){return t?za(t,n)===0:!0}function mM(e,{x:t},{x:n}){return t?za(t,n)===t.length-1:!0}function Nj(e,{y:t},{x:n,y:r,empty:i}){if(i)return!1;if(!t)return;let o=za(t,r);if(o>0)return C1(e,n,t[o-1])}function Oj(e,{y:t},{x:n,y:r,empty:i}){if(i)return!1;if(!t)return;let o=za(t,r);if(o<t.length-1)return C1(e,n,t[o+1])}function Bj(e,{x:t},{x:n,y:r,empty:i}){if(i)return!1;if(!t)return;let o=za(t,n);if(o>0)return C1(e,t[o-1],r)}function Lj(e,{x:t},{x:n,y:r,empty:i}){if(i)return!1;if(!t)return;let o=za(t,n);if(o<t.length-1)return C1(e,t[o+1],r)}function Fj(e,t,{empty:n}){return n}function L1(e,t){return function(){return e.apply(null,arguments)&&t.apply(null,arguments)}}function R1(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 _t=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:h=0,marginTop:d=h,marginRight:p=h,marginBottom:m=h,marginLeft:y=h,clip:g=i?.clip,channels:b,tip:x,render:w}=r;if(this.data=t,this.sort=No(l)?l:null,this.initializer=ve(r).initializer,this.transform=this.initializer?r.transform:mn(r).transform,o===null||o===!1?this.facet=null:(this.facet=rn(o===!0?"include":o,"facet",["auto","include","exclude","super"]),this.fx=t===Na&&typeof a=="string"?[a]:a,this.fy=t===Na&&typeof c=="string"?[c]:c),this.facetAnchor=ZN(s),n=om(n),b!==void 0&&(n={...Cj(b),...n}),i!==void 0&&(n={...O1(this,r,i),...n}),this.channels=Object.fromEntries(Object.entries(n).map(([v,_])=>{if(Fr(_.value)){let{value:M,label:E=_.label,scale:I=_.scale}=_.value;_={..._,label:E,scale:I,value:M}}if(t===Na&&typeof _.value=="string"){let{value:M}=_;_={..._,value:[M]}}return[v,_]}).filter(([v,{value:_,optional:M}])=>{if(_!=null)return!0;if(M)return!1;throw new Error(`missing channel value: ${v}`)})),this.dx=+u,this.dy=+f,this.marginTop=+d,this.marginRight=+p,this.marginBottom=+m,this.marginLeft=+y,this.clip=d1(g),this.tip=Rj(x),this.facet==="super"){if(a||c)throw new Error("super-faceting cannot use fx or fy");for(let v in this.channels){let{scale:_}=n[v];if(!(_!=="x"&&_!=="y"))throw new Error("super-faceting cannot use x or y")}}w!=null&&(this.render=mf(w,this.render))}initialize(t,n,r){let i=Pe(this.data);t===void 0&&i!=null&&(t=[or(i)]);let o=t;this.transform!=null&&({facets:t,data:i}=this.transform(i,t,r),i=Pe(i)),t!==void 0&&(t.original=o);let s=_1(this.channels,i);return this.sort!=null&&zD(i,t,s,n,this.sort),{data:i,facets:t,channels:s}}filter(t,n,r){for(let i in n){let{filter:o=$e}=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"&&tM(i,o,n,r.projection)}}scale(t,n,r){let i=af(t,n);return r.projection&&this.project(t,i,r),i}};function Ke(...e){return e.plot=_t.prototype.plot,e}function mf(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,h)=>t.call(this,c,l,u,f,h,a))}}function Cj(e){return Object.fromEntries(Object.entries(om(e)).map(([t,n])=>(n=typeof n=="string"?{value:n,label:t}:ci(n),n.filter===void 0&&n.scale==null&&(n={...n,filter:null}),[t,n])))}function Rj(e){return e===!0?"xy":e===!1||e==null?null:typeof e=="string"?rn(e,"tip",["x","y","xy"]):e}function Ci(e,t){return e?.tip===!0?{...e,tip:t}:dn(e?.tip)&&e.tip.pointer===void 0?{...e,tip:{...e.tip,pointer:t}}:e}var QN=new WeakMap;function gM(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:mf(function(u,f,h,d,p,m){p={...p,pointerSticky:!1};let y=p.ownerSVGElement,{data:g}=p.getMarkState(this),b=QN.get(y);b||QN.set(y,b={sticky:!1,roots:[],renders:[]});let x=b.renders.push(G)-1,{x:w,y:v,fx:_,fy:M}=f,E=_?_(u.fx)-d.marginLeft:0,I=M?M(u.fy)-d.marginTop:0;w?.bandwidth&&(E+=w.bandwidth()/2),v?.bandwidth&&(I+=v.bandwidth()/2);let N=u.fi!=null,A;if(N){let j=b.facetStates;j||(b.facetStates=j=new Map),A=j.get(this),A||j.set(this,A=new Map)}let[O,L]=gn(this,d),{px:S,py:T}=h,D=S?j=>S[j]:bM(h,O),C=T?j=>T[j]:xM(h,L),R,F,k,$;function U(j,ot){if(N)if($&&($=cancelAnimationFrame($)),j==null)A.delete(u.fi);else{A.set(u.fi,ot),$=requestAnimationFrame(()=>{$=null;for(let[z,H]of A)if(H<ot||H===ot&&z<u.fi){j=null;break}G(j)});return}G(j)}function G(j){if(R===j&&k===b.sticky)return;R=j,k=p.pointerSticky=b.sticky;let ot=R==null?[]:[R];N&&(ot.fx=u.fx,ot.fy=u.fy,ot.fi=u.fi);let z=m(ot,f,h,d,p);if(F){if(N){let H=F.parentNode,nt=F.getAttribute("transform"),P=z.getAttribute("transform");nt?z.setAttribute("transform",nt):z.removeAttribute("transform"),P?H.setAttribute("transform",P):H.removeAttribute("transform"),z.removeAttribute("aria-label"),z.removeAttribute("aria-description"),z.removeAttribute("aria-hidden")}F.replaceWith(z)}return b.roots[x]=F=z,R==null&&A?.size>1||p.dispatchValue(R==null?null:g[R]),z}function et(j){if(b.sticky||j.pointerType==="mouse"&&j.buttons===1)return;let[ot,z]=Fn(j);ot-=E,z-=I;let H=ot<d.marginLeft||ot>d.width-d.marginRight?1:e,nt=z<d.marginTop||z>d.height-d.marginBottom?1:t,P=null,Lt=s*s;for(let ft of u){let Wt=H*(D(ft)-ot),Ht=nt*(C(ft)-z),J=Wt*Wt+Ht*Ht;J<=Lt&&(P=ft,Lt=J)}if(P!=null&&(e!==1||t!==1)){let ft=D(P)-ot,Wt=C(P)-z;Lt=ft*ft+Wt*Wt}U(P,Lt)}function rt(j){j.pointerType==="mouse"&&R!=null&&(b.sticky&&b.roots.some(ot=>ot?.contains(j.target))||(b.sticky?(b.sticky=!1,b.renders.forEach(ot=>ot(null))):(b.sticky=!0,G(R)),j.stopImmediatePropagation()))}function st(j){j.pointerType==="mouse"&&(b.sticky||U(null))}return y.addEventListener("pointerenter",et),y.addEventListener("pointermove",et),y.addEventListener("pointerdown",rt),y.addEventListener("pointerleave",st),G(null)},c)}}function qa(e){return gM(1,1,e)}function Va(e){return gM(1,.01,e)}function zs(e){return gM(.01,1,e)}function bM({x1:e,x2:t,x:n=e},r){return e&&t?i=>(e[i]+t[i])/2:n?i=>n[i]:()=>r}function xM({y1:e,y2:t,y:n=e},r){return e&&t?i=>(e[i]+t[i])/2:n?i=>n[i]:()=>r}function k1(e){return Fo(e)&&e.interval===void 0?void 0:"tabular-nums"}function KN(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:h,fontVariant:d=k1(e),round:p=!0,opacity:m,className:y}=t,g=$a(t);y=df(y),m=ie(m)[1],h===null&&(h=()=>null);let b=lt("svg",g).attr("class",`${y}-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(.${y}-ramp) {
17
17
  display: block;
18
18
  height: auto;
19
19
  height: intrinsic;
@@ -22,9 +22,9 @@ ${n}`}function Xq(e){return e==="time"?Hx:e==="utc"?Zp:Wq}function LD(e,t,n){let
22
22
  }
23
23
  :where(.${y}-ramp text) {
24
24
  white-space: pre;
25
- }`)).call(lf,u),x=B=>B.selectAll(".tick line").attr("y1",s+c-o),w,v=p?(B,L)=>B.rangeRound(L):(B,L)=>B.range(L),{type:_,domain:M,range:E,interpolate:I,scale:N,pivot:A}=e;if(I){let B=E===void 0?I:lo(I.length===1?am(I):I,E);w=v(N.copy(),Ln(xe(l,i-a),Math.min(M.length+(A!==void 0),E===void 0?1/0:E.length)));let L=256,S=g.document.createElement("canvas");S.width=L,S.height=1;let T=S.getContext("2d");for(let D=0,C=L-1;D<L;++D)T.fillStyle=B(D/C),T.fillRect(D,0,1,1);b.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(_==="threshold"){let B=M,L=h===void 0?S=>S:typeof h=="string"?ti(h):h;w=v(bs().domain([-1,E.length-1]),[l,i-a]),b.append("g").attr("fill-opacity",m).selectAll().data(E).enter().append("rect").attr("x",(S,T)=>w(T-1)).attr("y",s).attr("width",(S,T)=>w(T)-w(T-1)).attr("height",o-s-c).attr("fill",S=>S),f=Vt(B,(S,T)=>T),h=S=>L(B[S],S)}else w=v(wa().domain(M),[l,i-a]),b.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",N),x=()=>{};return b.append("g").attr("transform",`translate(0,${o-c})`).call(lv(w).ticks(Array.isArray(f)?null:f,typeof h=="string"?h:void 0).tickFormat(typeof h=="function"?h:void 0).tickSize(r).tickValues(Array.isArray(f)?f:null)).attr("font-size",null).attr("font-family",null).attr("font-variant",ce(d,"normal")).call(x).call(B=>B.select(".domain").remove()),n!==void 0&&b.append("text").attr("x",l).attr("y",s-6).attr("fill","currentColor").attr("font-weight","bold").text(n),b.node()}var df=Math.PI/180;function Fi(e,{marker:t,markerStart:n=t,markerMid:r=t,markerEnd:i=t}={}){e.markerStart=QI(n),e.markerMid=QI(r),e.markerEnd=QI(i)}function QI(e){if(e==null||e===!1)return null;if(e===!0)return SN;if(typeof e=="function")return e;switch(`${e}`.toLowerCase()){case"none":return null;case"arrow":return vN("auto");case"arrow-reverse":return vN("auto-start-reverse");case"dot":return cj;case"circle":case"circle-fill":return SN;case"circle-stroke":return lj;case"tick":return JI("auto");case"tick-x":return JI(90);case"tick-y":return JI(0)}throw new Error(`invalid marker: ${e}`)}function vN(e){return(t,n)=>lt("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 cj(e,t){return lt("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 SN(e,t){return lt("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 lj(e,t){return lt("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 JI(e){return(t,n)=>lt("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 uj=0;function Rs(e,t,{stroke:n},r){return MN(e,t,n&&(i=>n[i]),r)}function IN(e,t,{stroke:n},r){return MN(e,t,n&&(([i])=>n[i]),r)}function MN(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),h=a.get(l);h||a.set(l,h=new Map);let d=h.get(f);if(!d){let p=this.parentNode.insertBefore(l(f,s),this),m=`plot-marker-${++uj}`;p.setAttribute("id",m),h.set(f,d=`url(#${m})`)}return d}}t&&e.attr("marker-start",c(t)),n&&e.attr("marker-mid",c(n)),r&&e.attr("marker-end",c(r))}function al({inset:e,insetLeft:t,insetRight:n,...r}={}){return[t,n]=AN(e,t,n),{inset:e,insetLeft:t,insetRight:n,...r}}function cl({inset:e,insetTop:t,insetBottom:n,...r}={}){return[t,n]=AN(e,t,n),{inset:e,insetTop:t,insetBottom:n,...r}}function AN(e,t,n){return e===void 0&&t===void 0&&n===void 0?Ne?[1,0]:[.5,.5]:[t,n]}function TN(e,{interval:t}){return e={...si(e)},e.interval=Zu(e.interval===void 0?t:e.interval),e}function T1(e,t,n,r){let{[e]:i,[`${e}1`]:o,[`${e}2`]:s}=n,{value:a,interval:c}=TN(i,n);if(a==null||c==null&&!r)return n;let l=Dn(i);if(c==null){let d,p={transform:m=>d||(d=bt(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 h(d){return f!==void 0&&d===u?f:f=Vt(bt(u=d,a),p=>c.floor(p))}return t({...n,[e]:void 0,[`${e}1`]:o===void 0?{transform:h,label:l}:o,[`${e}2`]:s===void 0?{transform:d=>h(d).map(p=>c.offset(p)),label:l}:s})}function EN(e,t,n){let{[e]:r}=n,{value:i,interval:o}=TN(r,n);return i==null||o==null?n:t({...n,[e]:{label:Dn(r),transform:s=>{let a=Vt(bt(s,i),l=>o.floor(l)),c=a.map(l=>o.offset(l));return a.map(De(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 tM(e={}){return T1("x",al,e,!0)}function eM(e={}){return T1("y",cl,e,!0)}function E1(e={}){return T1("x",al,e)}function D1(e={}){return T1("y",cl,e)}function N1(e={}){return EN("x",al,e)}function B1(e={}){return EN("y",cl,e)}var DN={ariaLabel:"rule",fill:null,stroke:"currentColor"},fm=class extends _t{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}},Li(n,"x"),DN),this.insetTop=Dt(a),this.insetBottom=Dt(c),Fi(this,n)}render(t,n,r,i,o){let{x:s,y:a}=n,{x:c,y1:l,y2:u}=r,{width:f,height:h,marginTop:d,marginRight:p,marginLeft:m,marginBottom:y}=i,{insetTop:g,insetBottom:b}=this;return lt("svg:g",o).call(Bt,this,i,o).call(Mt,this,{x:c&&s},Ne,0).call(x=>x.selectAll().data(t).enter().append("line").call(Nt,this).attr("x1",c?w=>c[w]:(m+f-p)/2).attr("x2",c?w=>c[w]:(m+f-p)/2).attr("y1",l&&!or(a)?w=>l[w]+g:d+g).attr("y2",u&&!or(a)?a.bandwidth?w=>u[w]+a.bandwidth()-b:w=>u[w]-b:h-y-b).call(Ht,this,r).call(Rs,this,r,o)).node()}},hm=class extends _t{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}},Li(n,"y"),DN),this.insetRight=Dt(a),this.insetLeft=Dt(c),Fi(this,n)}render(t,n,r,i,o){let{x:s,y:a}=n,{y:c,x1:l,x2:u}=r,{width:f,height:h,marginTop:d,marginRight:p,marginLeft:m,marginBottom:y}=i,{insetLeft:g,insetRight:b}=this;return lt("svg:g",o).call(Bt,this,i,o).call(Mt,this,{y:c&&a},0,Ne).call(x=>x.selectAll().data(t).enter().append("line").call(Nt,this).attr("x1",l&&!or(s)?w=>l[w]+g:m+g).attr("x2",u&&!or(s)?s.bandwidth?w=>u[w]+s.bandwidth()-b:w=>u[w]-b:f-p-b).attr("y1",c?w=>c[w]:(d+h-y)/2).attr("y2",c?w=>c[w]:(d+h-y)/2).call(Ht,this,r).call(Rs,this,r,o)).node()}};function Cr(e,t){let{x:n=W,y:r,y1:i,y2:o,...s}=D1(t);return[i,o]=NN(r,i,o),new fm(e,{...s,x:n,y1:i,y2:o})}function kr(e,t){let{y:n=W,x:r,x1:i,x2:o,...s}=E1(t);return[i,o]=NN(r,i,o),new hm(e,{...s,y:n,x1:i,x2:o})}function NN(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 Ua(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 fj={ariaLabel:"text",strokeLinejoin:"round",strokeWidth:3,paintOrder:"stroke"},CN="\xAD",ul=class extends _t{constructor(t,n={}){let{x:r,y:i,text:o=ir(t)&&Jx(t)?W:Ie,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:h,fontFamily:d=h?"ui-monospace, monospace":void 0,fontSize:p,fontStyle:m,fontVariant:y,fontWeight:g,rotate:b}=n,[x,w]=re(b,0),[v,_]=mj(p);if(super(t,{x:{value:r,scale:"x",optional:!0},y:{value:i,scale:"y",optional:!0},fontSize:{value:v,optional:!0},rotate:{value:zD(x),optional:!0},text:{value:o,filter:Xp,optional:!0}},n,fj),this.rotate=w,this.textAnchor=ce(a,"middle"),this.lineAnchor=nn(c,"lineAnchor",["top","middle","bottom"]),this.lineHeight=+l,this.lineWidth=+u,this.textOverflow=rM(f),this.monospace=!!h,this.fontFamily=Ue(d),this.fontSize=_,this.fontStyle=Ue(m),this.fontVariant=Ue(y),this.fontWeight=Ue(g),this.frameAnchor=Do(s),!(this.lineWidth>=0))throw new Error(`invalid lineWidth: ${u}`);this.splitLines=oM(this),this.clipLine=sM(this)}render(t,n,r,i,o){let{x:s,y:a}=n,{x:c,y:l,rotate:u,text:f,title:h,fontSize:d}=r,{rotate:p}=this,[m,y]=yn(this,i);return lt("svg:g",o).call(Bt,this,i,o).call(iM,this,f,i).call(Mt,this,{x:c&&s,y:l&&a}).call(g=>g.selectAll().data(t).enter().append("text").call(Nt,this).call(hj,this,f,h).attr("transform",Ua`translate(${c?b=>c[b]:m},${l?b=>l[b]:y})${u?b=>` rotate(${u[b]})`:p?` rotate(${p})`:""}`).call(ut,"font-size",d&&(b=>d[b])).call(Ht,this,r)).node()}};function rM(e){return e==null?null:nn(e,"textOverflow",["clip","ellipsis","clip-start","clip-end","ellipsis-start","ellipsis-middle","ellipsis-end"]).replace(/^(clip|ellipsis)$/,"$1-end")}function hj(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(Oi(n[l])??"").map(c),f=u.length,h=i==="top"?.71:i==="bottom"?1-f:(164-f*100)/200;if(f>1){let d=0;for(let p=0;p<f;++p){if(++d,!u[p])continue;let m=this.ownerDocument.createElementNS(Zr.svg,"tspan");m.setAttribute("x",0),p===d-1?m.setAttribute("y",`${(h+p)*o}em`):m.setAttribute("dy",`${d*o}em`),m.textContent=u[p],this.appendChild(m),d=0}}else h&&this.setAttribute("y",`${h*o}em`),this.textContent=u[0];if(s&&!r&&u[0]!==n[l]){let d=this.ownerDocument.createElementNS(Zr.svg,"title");d.textContent=n[l],this.appendChild(d)}})}function Oo(e,{x:t,y:n,...r}={}){return r.frameAnchor===void 0&&([t,n]=ke(t,n)),new ul(e,{...r,x:t,y:n})}function O1(e,{x:t=W,...n}={}){return new ul(e,B1({...n,x:t}))}function L1(e,{y:t=W,...n}={}){return new ul(e,N1({...n,y:t}))}function iM(e,t,n){ut(e,"text-anchor",t.textAnchor),ut(e,"font-family",t.fontFamily),ut(e,"font-size",t.fontSize),ut(e,"font-style",t.fontStyle),ut(e,"font-variant",t.fontVariant===void 0?dj(n):t.fontVariant),ut(e,"font-weight",t.fontWeight)}function dj(e){return e&&(Bs(e)||De(e))?"tabular-nums":void 0}var pj=new Set(["inherit","initial","revert","unset","xx-small","x-small","small","medium","large","x-large","xx-large","xxx-large","larger","smaller"]);function mj(e){return e==null||typeof e=="number"?[void 0,e]:typeof e!="string"?[e,void 0]:(e=e.trim().toLowerCase(),pj.has(e)||/^[+-]?\d*\.?\d+(e[+-]?\d+)?(\w*|%)$/.test(e)?[void 0,e]:[e,void 0])}function yj(e,t,n){let r=[],i,o=0;for(let[s,a,c]of gj(e)){if(i===void 0&&(i=s),o>i&&n(e,i,a)>t&&(r.push(e.slice(i,o)+(e[o-1]===CN?"-":"")),i=s),c){r.push(e.slice(i,a)),i=void 0;continue}o=a}return r}function*gj(e){let t=0,n=0,r=e.length;for(;n<r;){let i=1;switch(e[n]){case CN: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(pf,u),x=O=>O.selectAll(".tick line").attr("y1",s+c-o),w,v=p?(O,L)=>O.rangeRound(L):(O,L)=>O.range(L),{type:_,domain:M,range:E,interpolate:I,scale:N,pivot:A}=e;if(I){let O=E===void 0?I:ho(I.length===1?hm(I):I,E);w=v(N.copy(),Cn(we(l,i-a),Math.min(M.length+(A!==void 0),E===void 0?1/0:E.length)));let L=256,S=g.document.createElement("canvas");S.width=L,S.height=1;let T=S.getContext("2d");for(let D=0,C=L-1;D<L;++D)T.fillStyle=O(D/C),T.fillRect(D,0,1,1);b.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(_==="threshold"){let O=M,L=h===void 0?S=>S:typeof h=="string"?ni(h):h;w=v(vs().domain([-1,E.length-1]),[l,i-a]),b.append("g").attr("fill-opacity",m).selectAll().data(E).enter().append("rect").attr("x",(S,T)=>w(T-1)).attr("y",s).attr("width",(S,T)=>w(T)-w(T-1)).attr("height",o-s-c).attr("fill",S=>S),f=Yt(O,(S,T)=>T),h=S=>L(O[S],S)}else w=v(Sa().domain(M),[l,i-a]),b.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",N),x=()=>{};return b.append("g").attr("transform",`translate(0,${o-c})`).call(Ov(w).ticks(Array.isArray(f)?null:f,typeof h=="string"?h:void 0).tickFormat(typeof h=="function"?h:void 0).tickSize(r).tickValues(Array.isArray(f)?f:null)).attr("font-size",null).attr("font-family",null).attr("font-variant",le(d,"normal")).call(x).call(O=>O.select(".domain").remove()),n!==void 0&&b.append("text").attr("x",l).attr("y",s-6).attr("fill","currentColor").attr("font-weight","bold").text(n),b.node()}var yf=Math.PI/180;function Ri(e,{marker:t,markerStart:n=t,markerMid:r=t,markerEnd:i=t}={}){e.markerStart=wM(n),e.markerMid=wM(r),e.markerEnd=wM(i)}function wM(e){if(e==null||e===!1)return null;if(e===!0)return tO;if(typeof e=="function")return e;switch(`${e}`.toLowerCase()){case"none":return null;case"arrow":return JN("auto");case"arrow-reverse":return JN("auto-start-reverse");case"dot":return kj;case"circle":case"circle-fill":return tO;case"circle-stroke":return $j;case"tick":return _M("auto");case"tick-x":return _M(90);case"tick-y":return _M(0)}throw new Error(`invalid marker: ${e}`)}function JN(e){return(t,n)=>lt("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 kj(e,t){return lt("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 tO(e,t){return lt("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 $j(e,t){return lt("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 _M(e){return(t,n)=>lt("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 Uj=0;function qs(e,t,{stroke:n},r){return nO(e,t,n&&(i=>n[i]),r)}function eO(e,t,{stroke:n},r){return nO(e,t,n&&(([i])=>n[i]),r)}function nO(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),h=a.get(l);h||a.set(l,h=new Map);let d=h.get(f);if(!d){let p=this.parentNode.insertBefore(l(f,s),this),m=`plot-marker-${++Uj}`;p.setAttribute("id",m),h.set(f,d=`url(#${m})`)}return d}}t&&e.attr("marker-start",c(t)),n&&e.attr("marker-mid",c(n)),r&&e.attr("marker-end",c(r))}function fl({inset:e,insetLeft:t,insetRight:n,...r}={}){return[t,n]=rO(e,t,n),{inset:e,insetLeft:t,insetRight:n,...r}}function hl({inset:e,insetTop:t,insetBottom:n,...r}={}){return[t,n]=rO(e,t,n),{inset:e,insetTop:t,insetBottom:n,...r}}function rO(e,t,n){return e===void 0&&t===void 0&&n===void 0?Oe?[1,0]:[.5,.5]:[t,n]}function iO(e,{interval:t}){return e={...ci(e)},e.interval=ef(e.interval===void 0?t:e.interval),e}function $1(e,t,n,r){let{[e]:i,[`${e}1`]:o,[`${e}2`]:s}=n,{value:a,interval:c}=iO(i,n);if(a==null||c==null&&!r)return n;let l=Nn(i);if(c==null){let d,p={transform:m=>d||(d=bt(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 h(d){return f!==void 0&&d===u?f:f=Yt(bt(u=d,a),p=>c.floor(p))}return t({...n,[e]:void 0,[`${e}1`]:o===void 0?{transform:h,label:l}:o,[`${e}2`]:s===void 0?{transform:d=>h(d).map(p=>c.offset(p)),label:l}:s})}function oO(e,t,n){let{[e]:r}=n,{value:i,interval:o}=iO(r,n);return i==null||o==null?n:t({...n,[e]:{label:Nn(r),transform:s=>{let a=Yt(bt(s,i),l=>o.floor(l)),c=a.map(l=>o.offset(l));return a.map(Ne(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 vM(e={}){return $1("x",fl,e,!0)}function SM(e={}){return $1("y",hl,e,!0)}function U1(e={}){return $1("x",fl,e)}function P1(e={}){return $1("y",hl,e)}function z1(e={}){return oO("x",fl,e)}function q1(e={}){return oO("y",hl,e)}var sO={ariaLabel:"rule",fill:null,stroke:"currentColor"},ym=class extends _t{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}},Ci(n,"x"),sO),this.insetTop=Nt(a),this.insetBottom=Nt(c),Ri(this,n)}render(t,n,r,i,o){let{x:s,y:a}=n,{x:c,y1:l,y2:u}=r,{width:f,height:h,marginTop:d,marginRight:p,marginLeft:m,marginBottom:y}=i,{insetTop:g,insetBottom:b}=this;return lt("svg:g",o).call(Bt,this,i,o).call(It,this,{x:c&&s},Oe,0).call(x=>x.selectAll().data(t).enter().append("line").call(Ot,this).attr("x1",c?w=>c[w]:(m+f-p)/2).attr("x2",c?w=>c[w]:(m+f-p)/2).attr("y1",l&&!ar(a)?w=>l[w]+g:d+g).attr("y2",u&&!ar(a)?a.bandwidth?w=>u[w]+a.bandwidth()-b:w=>u[w]-b:h-y-b).call(Zt,this,r).call(qs,this,r,o)).node()}},gm=class extends _t{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}},Ci(n,"y"),sO),this.insetRight=Nt(a),this.insetLeft=Nt(c),Ri(this,n)}render(t,n,r,i,o){let{x:s,y:a}=n,{y:c,x1:l,x2:u}=r,{width:f,height:h,marginTop:d,marginRight:p,marginLeft:m,marginBottom:y}=i,{insetLeft:g,insetRight:b}=this;return lt("svg:g",o).call(Bt,this,i,o).call(It,this,{y:c&&a},0,Oe).call(x=>x.selectAll().data(t).enter().append("line").call(Ot,this).attr("x1",l&&!ar(s)?w=>l[w]+g:m+g).attr("x2",u&&!ar(s)?s.bandwidth?w=>u[w]+s.bandwidth()-b:w=>u[w]-b:f-p-b).attr("y1",c?w=>c[w]:(d+h-y)/2).attr("y2",c?w=>c[w]:(d+h-y)/2).call(Zt,this,r).call(qs,this,r,o)).node()}};function Rr(e,t){let{x:n=W,y:r,y1:i,y2:o,...s}=P1(t);return[i,o]=aO(r,i,o),new ym(e,{...s,x:n,y1:i,y2:o})}function kr(e,t){let{y:n=W,x:r,x1:i,x2:o,...s}=U1(t);return[i,o]=aO(r,i,o),new gm(e,{...s,y:n,x1:i,x2:o})}function aO(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 ja(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 Pj={ariaLabel:"text",strokeLinejoin:"round",strokeWidth:3,paintOrder:"stroke"},hO="\xAD",pl=class extends _t{constructor(t,n={}){let{x:r,y:i,text:o=sr(t)&&u1(t)?W:Ie,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:h,fontFamily:d=h?"ui-monospace, monospace":void 0,fontSize:p,fontStyle:m,fontVariant:y,fontWeight:g,rotate:b}=n,[x,w]=ie(b,0),[v,_]=jj(p);if(super(t,{x:{value:r,scale:"x",optional:!0},y:{value:i,scale:"y",optional:!0},fontSize:{value:v,optional:!0},rotate:{value:bD(x),optional:!0},text:{value:o,filter:Jp,optional:!0}},n,Pj),this.rotate=w,this.textAnchor=le(a,"middle"),this.lineAnchor=rn(c,"lineAnchor",["top","middle","bottom"]),this.lineHeight=+l,this.lineWidth=+u,this.textOverflow=IM(f),this.monospace=!!h,this.fontFamily=Ue(d),this.fontSize=_,this.fontStyle=Ue(m),this.fontVariant=Ue(y),this.fontWeight=Ue(g),this.frameAnchor=Bo(s),!(this.lineWidth>=0))throw new Error(`invalid lineWidth: ${u}`);this.splitLines=TM(this),this.clipLine=EM(this)}render(t,n,r,i,o){let{x:s,y:a}=n,{x:c,y:l,rotate:u,text:f,title:h,fontSize:d}=r,{rotate:p}=this,[m,y]=gn(this,i);return lt("svg:g",o).call(Bt,this,i,o).call(AM,this,f,i).call(It,this,{x:c&&s,y:l&&a}).call(g=>g.selectAll().data(t).enter().append("text").call(Ot,this).call(zj,this,f,h).attr("transform",ja`translate(${c?b=>c[b]:m},${l?b=>l[b]:y})${u?b=>` rotate(${u[b]})`:p?` rotate(${p})`:""}`).call(ut,"font-size",d&&(b=>d[b])).call(Zt,this,r)).node()}};function IM(e){return e==null?null:rn(e,"textOverflow",["clip","ellipsis","clip-start","clip-end","ellipsis-start","ellipsis-middle","ellipsis-end"]).replace(/^(clip|ellipsis)$/,"$1-end")}function zj(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(Fi(n[l])??"").map(c),f=u.length,h=i==="top"?.71:i==="bottom"?1-f:(164-f*100)/200;if(f>1){let d=0;for(let p=0;p<f;++p){if(++d,!u[p])continue;let m=this.ownerDocument.createElementNS(Kr.svg,"tspan");m.setAttribute("x",0),p===d-1?m.setAttribute("y",`${(h+p)*o}em`):m.setAttribute("dy",`${d*o}em`),m.textContent=u[p],this.appendChild(m),d=0}}else h&&this.setAttribute("y",`${h*o}em`),this.textContent=u[0];if(s&&!r&&u[0]!==n[l]){let d=this.ownerDocument.createElementNS(Kr.svg,"title");d.textContent=n[l],this.appendChild(d)}})}function Co(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 V1(e,{x:t=W,...n}={}){return new pl(e,q1({...n,x:t}))}function j1(e,{y:t=W,...n}={}){return new pl(e,z1({...n,y:t}))}function AM(e,t,n){ut(e,"text-anchor",t.textAnchor),ut(e,"font-family",t.fontFamily),ut(e,"font-size",t.fontSize),ut(e,"font-style",t.fontStyle),ut(e,"font-variant",t.fontVariant===void 0?qj(n):t.fontVariant),ut(e,"font-weight",t.fontWeight)}function qj(e){return e&&(Cs(e)||Ne(e))?"tabular-nums":void 0}var Vj=new Set(["inherit","initial","revert","unset","xx-small","x-small","small","medium","large","x-large","xx-large","xxx-large","larger","smaller"]);function jj(e){return e==null||typeof e=="number"?[void 0,e]:typeof e!="string"?[e,void 0]:(e=e.trim().toLowerCase(),Vj.has(e)||/^[+-]?\d*\.?\d+(e[+-]?\d+)?(\w*|%)$/.test(e)?[void 0,e]:[e,void 0])}function Yj(e,t,n){let r=[],i,o=0;for(let[s,a,c]of Wj(e)){if(i===void 0&&(i=s),o>i&&n(e,i,a)>t&&(r.push(e.slice(i,o)+(e[o-1]===hO?"-":"")),i=s),c){r.push(e.slice(i,a)),i=void 0;continue}o=a}return r}function*Wj(e){let t=0,n=0,r=e.length;for(;n<r;){let i=1;switch(e[n]){case hO: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 BN={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 F1(e,t=0,n=e.length){let r=0;for(let i=t;i<n;i=pf(e,i))r+=BN[e[i]]??(RN(e,i)?120:BN.e);return r}function C1(e,t=0,n=e.length){let r=0;for(let i=t;i<n;i=pf(e,i))r+=RN(e,i)?126:63;return r}function oM({monospace:e,lineWidth:t,textOverflow:n}){if(n!=null||t==1/0)return o=>o.split(/\r\n?|\n/g);let r=e?C1:F1,i=t*100;return o=>yj(o,i,r)}function sM({monospace:e,lineWidth:t,textOverflow:n}){if(n==null||t==1/0)return o=>o;let r=e?C1:F1,i=t*100;switch(n){case"clip-start":return o=>LN(o,i,r,"");case"clip-end":return o=>ON(o,i,r,"");case"ellipsis-start":return o=>LN(o,i,r,ll);case"ellipsis-middle":return o=>bj(o,i,r,ll);case"ellipsis-end":return o=>ON(o,i,r,ll)}}var ll="\u2026";function fl(e,t,n,r){let i=[],o=0;for(let s=0,a=0,c=e.length;s<c;s=a){a=pf(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 ON(e,t,n,r){e=e.trim();let i=n(r),[o]=fl(e,t,n,i);return o<0?e:e.slice(0,o).trimEnd()+r}function bj(e,t,n,r){e=e.trim();let i=n(e);if(i<=t)return e;let o=n(r)/2,[s,a]=fl(e,t/2,n,o),[c]=fl(e,i-t/2-a+o,n,-o);return c<0?r:e.slice(0,s).trimEnd()+r+e.slice(pf(e,c)).trimStart()}function LN(e,t,n,r){e=e.trim();let i=n(e);if(i<=t)return e;let o=n(r),[s]=fl(e,i-t+o,n,-o);return s<0?r:r+e.slice(pf(e,s)).trimStart()}var nM=/[\p{Combining_Mark}\p{Emoji_Modifier}]+/uy,FN=/\p{Extended_Pictographic}/uy;function pf(e,t){return t+=xj(e,t)?2:1,_j(e,t)&&(t=nM.lastIndex),wj(e,t)?pf(e,t+1):t}function kN(e,t){return e.charCodeAt(t)<128}function xj(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 wj(e,t){return e.charCodeAt(t)===8205}function _j(e,t){return kN(e,t)?!1:(nM.lastIndex=t,nM.test(e))}function RN(e,t){return kN(e,t)?!1:(FN.lastIndex=t,FN.test(e))}var $N={ariaLabel:"vector",fill:"none",stroke:"currentColor",strokeWidth:1.5,strokeLinejoin:"round",strokeLinecap:"round"},UN=3.5,vj=UN*5,PN={draw(e,t,n){let r=t*n/vj;e.moveTo(0,0),e.lineTo(0,-t),e.moveTo(-r,r-t),e.lineTo(0,-t),e.lineTo(r,r-t)}},zN={draw(e,t,n){e.moveTo(-n,0),e.lineTo(0,-t),e.lineTo(n,0)}},Sj=new Map([["arrow",PN],["spike",zN]]);function Ij(e){return e&&typeof e.draw=="function"}function Mj(e){if(Ij(e))return e;let t=Sj.get(`${e}`.toLowerCase());if(t)return t;throw new Error(`invalid shape: ${e}`)}var hl=class extends _t{constructor(t,n={}){let{x:r,y:i,r:o=UN,length:s,rotate:a,shape:c=PN,anchor:l="middle",frameAnchor:u}=n,[f,h]=re(s,12),[d,p]=re(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:d,optional:!0}},n,$N),this.r=+o,this.length=h,this.rotate=p,this.shape=Mj(c),this.anchor=nn(l,"anchor",["start","middle","end"]),this.frameAnchor=Do(u)}render(t,n,r,i,o){let{x:s,y:a}=n,{x:c,y:l,length:u,rotate:f}=r,{length:h,rotate:d,anchor:p,shape:m,r:y}=this,[g,b]=yn(this,i);return lt("svg:g",o).call(Bt,this,i,o).call(Mt,this,{x:c&&s,y:l&&a}).call(x=>x.selectAll().data(t).enter().append("path").call(Nt,this).attr("transform",Ua`translate(${c?w=>c[w]:g},${l?w=>l[w]:b})${f?w=>` rotate(${f[w]})`:d?` rotate(${d})`:""}${p==="start"?"":p==="end"?u?w=>` translate(0,${u[w]})`:` translate(0,${h})`:u?w=>` translate(0,${u[w]/2})`:` translate(0,${h/2})`}`).attr("d",u?w=>{let v=Kn();return m.draw(v,u[w],y),v}:(()=>{let w=Kn();return m.draw(w,h,y),w})()).call(Ht,this,r)).node()}};function aM(e,t={}){let{x:n,y:r,...i}=t;return t.frameAnchor===void 0&&([n,r]=ke(n,r)),new hl(e,{...i,x:n,y:r})}function k1(e,t={}){let{x:n=W,...r}=t;return new hl(e,{...r,x:n})}function R1(e,t={}){let{y:n=W,...r}=t;return new hl(e,{...r,y:n})}function qN(e,t={}){let{shape:n=zN,stroke:r=$N.stroke,strokeWidth:i=1,fill:o=r,fillOpacity:s=.3,anchor:a="start",...c}=t;return aM(e,{...c,shape:n,stroke:r,strokeWidth:i,fill:o,fillOpacity:s,anchor:a})}function Pa(e,t){return arguments.length<2&&!ir(e)&&(t=e,e=null),t===void 0&&(t={}),[e,t]}function $1({anchor:e}={},t){return e===void 0?t[0]:nn(e,"anchor",t)}function VN(e){return $1(e,["left","right"])}function jN(e){return $1(e,["right","left"])}function YN(e){return $1(e,["bottom","top"])}function WN(e){return $1(e,["top","bottom"])}function dm(){let[e,t]=Pa(...arguments);return GN("y",VN(t),e,t)}function U1(){let[e,t]=Pa(...arguments);return GN("fy",jN(t),e,t)}function pm(){let[e,t]=Pa(...arguments);return XN("x",YN(t),e,t)}function P1(){let[e,t]=Pa(...arguments);return XN("fx",WN(t),e,t)}function GN(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:h,textStrokeWidth:d,tickSize:p=e==="y"?6:0,tickPadding:m,tickRotate:y,x:g,margin:b,marginTop:x=b===void 0?20:b,marginRight:w=b===void 0?t==="right"?40:0:b,marginBottom:v=b===void 0?20:b,marginLeft:_=b===void 0?t==="left"?40:0:b,label:M,labelAnchor:E,labelArrow:I,labelOffset:N,...A}){return p=Dt(p),m=Dt(m),y=Dt(y),E!==void 0&&(E=nn(E,"labelAnchor",["center","top","bottom"])),I=nB(I),Ke(p&&!te(o)?Aj(e,t,n,{stroke:o,strokeOpacity:s,strokeWidth:a,tickSize:p,tickPadding:m,tickRotate:y,x:g,...A}):null,te(c)?null:Ej(e,t,n,{fill:c,fillOpacity:l,stroke:f,strokeOpacity:h,strokeWidth:d,textAnchor:u,tickSize:p,tickPadding:m,tickRotate:y,x:g,marginTop:x,marginRight:w,marginBottom:v,marginLeft:_,...A}),!te(c)&&M!==null?Oo([],QN({fill:c,fillOpacity:l,...A},function(B,L,S,T,D){let C=T[e],{marginTop:k,marginRight:F,marginBottom:R,marginLeft:$}=e==="y"&&D.inset||D,U=E??(C.bandwidth?"center":"top"),G=N??(t==="right"?F:$)-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-k:U==="bottom"?R-3:0,this.dx=t==="right"?G:-G,this.ariaLabel=`${e}-axis label`,{facets:[[0]],channels:{text:{value:[eB(e,C,{anchor:t,label:M,labelAnchor:U,labelArrow:I})]}}}})):null)}function XN(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:h,textStrokeWidth:d,tickSize:p=e==="x"?6:0,tickPadding:m,tickRotate:y,y:g,margin:b,marginTop:x=b===void 0?t==="top"?30:0:b,marginRight:w=b===void 0?20:b,marginBottom:v=b===void 0?t==="bottom"?30:0:b,marginLeft:_=b===void 0?20:b,label:M,labelAnchor:E,labelArrow:I,labelOffset:N,...A}){return p=Dt(p),m=Dt(m),y=Dt(y),E!==void 0&&(E=nn(E,"labelAnchor",["center","left","right"])),I=nB(I),Ke(p&&!te(o)?Tj(e,t,n,{stroke:o,strokeOpacity:s,strokeWidth:a,tickSize:p,tickPadding:m,tickRotate:y,y:g,...A}):null,te(c)?null:Dj(e,t,n,{fill:c,fillOpacity:l,stroke:f,strokeOpacity:h,strokeWidth:d,textAnchor:u,tickSize:p,tickPadding:m,tickRotate:y,y:g,marginTop:x,marginRight:w,marginBottom:v,marginLeft:_,...A}),!te(c)&&M!==null?Oo([],QN({fill:c,fillOpacity:l,...A},function(B,L,S,T,D){let C=T[e],{marginTop:k,marginRight:F,marginBottom:R,marginLeft:$}=e==="x"&&D.inset||D,U=E??(C.bandwidth?"center":"right"),G=N??(t==="top"?k: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"?-G:G,this.dx=U==="right"?F-3:U==="left"?3-$:0,this.ariaLabel=`${e}-axis label`,{facets:[[0]],channels:{text:{value:[eB(e,C,{anchor:t,label:M,labelAnchor:U,labelArrow:I})]}}}})):null)}function Aj(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:h=0,y:d=e==="y"?void 0:null,...p}){return mf(R1,e,n,{ariaLabel:`${e}-axis tick`,ariaHidden:!0},{strokeWidth:r,strokeLinecap:i,strokeLinejoin:o,facetAnchor:s,frameAnchor:a,y:d,...p,dx:t==="left"?+h-Ne+ +u:+h+Ne-f,anchor:"start",length:c,shape:t==="left"?Lj:Fj})}function Tj(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:h=0,x:d=e==="x"?void 0:null,...p}){return mf(k1,e,n,{ariaLabel:`${e}-axis tick`,ariaHidden:!0},{strokeWidth:r,strokeLinejoin:o,strokeLinecap:i,facetAnchor:s,frameAnchor:a,x:d,...p,dy:t==="bottom"?+h-Ne-f:+h+Ne+ +u,anchor:"start",length:c,shape:t==="bottom"?Bj:Oj})}function Ej(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*df):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:h=0,insetLeft:d=h,insetRight:p=h,dx:m=0,y=e==="y"?void 0:null,...g}){return mf(L1,e,n,{ariaLabel:`${e}-axis tick label`},{facetAnchor:r,frameAnchor:i,text:c,textAnchor:l,lineAnchor:u,fontVariant:f,rotate:s,y,...g,dx:t==="left"?+m-o-a+ +d:+m+ +o+ +a-p},function(b,x,w,v,_){f===void 0&&(this.fontVariant=tB(b)),c===void 0&&(_.text=JN(b,x,w,v,t))})}function Dj(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*df):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:h=0,insetTop:d=h,insetBottom:p=h,dy:m=0,x:y=e==="x"?void 0:null,...g}){return mf(O1,e,n,{ariaLabel:`${e}-axis tick label`},{facetAnchor:r,frameAnchor:i,text:c===void 0?null:c,textAnchor:l,lineAnchor:u,fontVariant:f,rotate:s,x:y,...g,dy:t==="bottom"?+m+ +o+ +a-p:+m-o-a+ +d},function(b,x,w,v,_){f===void 0&&(this.fontVariant=tB(b)),c===void 0&&(_.text=JN(b,x,w,v,t))})}function z1(){let[e,t]=Pa(...arguments);return HN("y",VN(t),e,t)}function q1(){let[e,t]=Pa(...arguments);return HN("fy",jN(t),e,t)}function V1(){let[e,t]=Pa(...arguments);return ZN("x",YN(t),e,t)}function j1(){let[e,t]=Pa(...arguments);return ZN("fx",WN(t),e,t)}function HN(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 mf(kr,e,n,{ariaLabel:`${e}-grid`,ariaHidden:!0},{y:r,x1:o,x2:s,...KN(a)})}function ZN(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 mf(Cr,e,n,{ariaLabel:`${e}-grid`,ariaHidden:!0},{x:r,y1:o,y2:s,...KN(a)})}function KN({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 QN({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]=Ee(e),[,t]=re(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 mf(e,t,n,r,i,o){let s;function a(u,f,h,d,p,m){let y=u==null&&(t==="fx"||t==="fy"),{[t]:g}=d;if(!g)throw new Error(`missing scale: ${t}`);let b=g.domain(),{interval:x,ticks:w,tickFormat:v,tickSpacing:_=t==="x"?80:35}=i;if(typeof w=="string"&&rB(g)&&(x=w,w=void 0),w===void 0&&(w=Eo(x,g.type)??Nj(g,_)),u==null){if(ir(w))u=Pe(w);else if(Na(w))u=cM(w,...se(b));else if(g.interval){let E=g.interval;if(g.ticks){let[I,N]=se(b),A=(N-I)/E[Yu];E=oI(E,A/w)??E,u=cM(E,I,N)}else{u=b;let I=u.length;E=oI(E,I/w)??E,E!==g.interval&&(u=cM(E,...se(u)))}if(E===g.interval){let I=Math.round(u.length/w);I>1&&(u=u.filter((N,A)=>A%I===0))}}else g.ticks?u=g.ticks(w):u=b;if(!g.ticks&&u.length&&u!==b){let E=new Gn(b);u=u.filter(I=>E.has(I)),u.length||Pn(`Warning: the ${t}-axis ticks appear to not align with the scale domain, resulting in no ticks. Try different ticks?`)}t==="y"||t==="x"?f=[rr(u)]:s[t]={scale:t,value:W}}o?.call(this,g,u,w,v,s);let M=Object.fromEntries(Object.entries(s).map(([E,I])=>[E,{...I,value:bt(u,I.value)}]));return y&&(f=m.filterFacets(u,M)),{data:u,facets:f,channels:M}}let c=_e(i).initializer,l=e(n,_e({...i,initializer:a},c));return n==null?(s=l.channels,l.channels={}):s={},r!==void 0&&Object.assign(l,r),l.clip===void 0&&(l.clip=!1),l}function Nj(e,t){let[n,r]=se(e.range());return(r-n)/t}function JN(e,t,n,r,i){return{value:mm(e,t,n,r,i)}}function mm(e,t,n,r,i){return typeof r=="function"?r:r===void 0&&t&&De(t)?LD(e.type,t,i)??Oi:e.tickFormat?e.tickFormat(typeof n=="number"?n:null,r):r===void 0?Oi:typeof r=="string"?(De(e.domain())?So:ti)(r):fn(r)}function cM(e,t,n){return e.range(t,e.offset(e.floor(n)))}var Bj={draw(e,t){e.moveTo(0,0),e.lineTo(0,t)}},Oj={draw(e,t){e.moveTo(0,0),e.lineTo(0,-t)}},Lj={draw(e,t){e.moveTo(0,0),e.lineTo(-t,0)}},Fj={draw(e,t){e.moveTo(0,0),e.lineTo(t,0)}};function tB(e){return e.bandwidth&&!e.interval?void 0:"tabular-nums"}function eB(e,t,{anchor:n,label:r=t.label,labelAnchor:i,labelArrow:o}={}){if(!(r==null||r.inferred&&rB(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=m1(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 nB(e="auto"){return te(e)?!1:typeof e=="boolean"?e:nn(e,"labelArrow",["auto","up","right","down","left"])}function rB(e){return De(e.domain())}function iB(e,t){if(t==null)return t;let n=e(t);if(!n)throw new Error(`scale not found: ${t}`);return n}function oB(e,{opacity:t,...n}={}){if(!Bo(e)&&!qI(e))throw new Error(`swatches legend requires ordinal or threshold color scale (not ${e.type})`);return aB(e,n,(r,i,o,s)=>r.append("svg").attr("width",o).attr("height",s).attr("fill",i.scale).attr("fill-opacity",re(t)[1]).append("rect").attr("width","100%").attr("height","100%"))}function sB(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:te(t)?"currentColor":"none",strokeOpacity:i=1,strokeWidth:o=1.5,r:s=4.5,...a}={},c){let[l,u]=Ee(t),[f,h]=Ee(r),d=iB(c,l),p=iB(c,f),m=s*s*Math.PI;return n=re(n)[1],i=re(i)[1],o=re(o)[1],aB(e,a,(y,g,b,x)=>y.append("svg").attr("viewBox","-8 -8 16 16").attr("width",b).attr("height",x).attr("fill",l==="color"?w=>d.scale(w):u).attr("fill-opacity",n).attr("stroke",f==="color"?w=>p.scale(w):h).attr("stroke-opacity",i).attr("stroke-width",o).append("path").attr("d",w=>{let v=Kn();return e.scale(w).draw(v,m),v}))}function aB(e,t={},n){let{columns:r,tickFormat:i,fontVariant:o=A1(e),swatchSize:s=15,swatchWidth:a=s,swatchHeight:c=s,marginLeft:l=0,className:u,style:f,width:h}=t,d=Ca(t);u=cf(u),i=mm(e.scale,e.domain,void 0,i);let p=lt("div",d).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 cO={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 Y1(e,t=0,n=e.length){let r=0;for(let i=t;i<n;i=gf(e,i))r+=cO[e[i]]??(pO(e,i)?120:cO.e);return r}function W1(e,t=0,n=e.length){let r=0;for(let i=t;i<n;i=gf(e,i))r+=pO(e,i)?126:63;return r}function TM({monospace:e,lineWidth:t,textOverflow:n}){if(n!=null||t==1/0)return o=>o.split(/\r\n?|\n/g);let r=e?W1:Y1,i=t*100;return o=>Yj(o,i,r)}function EM({monospace:e,lineWidth:t,textOverflow:n}){if(n==null||t==1/0)return o=>o;let r=e?W1:Y1,i=t*100;switch(n){case"clip-start":return o=>uO(o,i,r,"");case"clip-end":return o=>lO(o,i,r,"");case"ellipsis-start":return o=>uO(o,i,r,dl);case"ellipsis-middle":return o=>Gj(o,i,r,dl);case"ellipsis-end":return o=>lO(o,i,r,dl)}}var dl="\u2026";function ml(e,t,n,r){let i=[],o=0;for(let s=0,a=0,c=e.length;s<c;s=a){a=gf(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 lO(e,t,n,r){e=e.trim();let i=n(r),[o]=ml(e,t,n,i);return o<0?e:e.slice(0,o).trimEnd()+r}function Gj(e,t,n,r){e=e.trim();let i=n(e);if(i<=t)return e;let o=n(r)/2,[s,a]=ml(e,t/2,n,o),[c]=ml(e,i-t/2-a+o,n,-o);return c<0?r:e.slice(0,s).trimEnd()+r+e.slice(gf(e,c)).trimStart()}function uO(e,t,n,r){e=e.trim();let i=n(e);if(i<=t)return e;let o=n(r),[s]=ml(e,i-t+o,n,-o);return s<0?r:r+e.slice(gf(e,s)).trimStart()}var MM=/[\p{Combining_Mark}\p{Emoji_Modifier}]+/uy,fO=/\p{Extended_Pictographic}/uy;function gf(e,t){return t+=Xj(e,t)?2:1,Zj(e,t)&&(t=MM.lastIndex),Hj(e,t)?gf(e,t+1):t}function dO(e,t){return e.charCodeAt(t)<128}function Xj(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 Hj(e,t){return e.charCodeAt(t)===8205}function Zj(e,t){return dO(e,t)?!1:(MM.lastIndex=t,MM.test(e))}function pO(e,t){return dO(e,t)?!1:(fO.lastIndex=t,fO.test(e))}var mO={ariaLabel:"vector",fill:"none",stroke:"currentColor",strokeWidth:1.5,strokeLinejoin:"round",strokeLinecap:"round"},yO=3.5,Qj=yO*5,gO={draw(e,t,n){let r=t*n/Qj;e.moveTo(0,0),e.lineTo(0,-t),e.moveTo(-r,r-t),e.lineTo(0,-t),e.lineTo(r,r-t)}},bO={draw(e,t,n){e.moveTo(-n,0),e.lineTo(0,-t),e.lineTo(n,0)}},Kj=new Map([["arrow",gO],["spike",bO]]);function Jj(e){return e&&typeof e.draw=="function"}function tY(e){if(Jj(e))return e;let t=Kj.get(`${e}`.toLowerCase());if(t)return t;throw new Error(`invalid shape: ${e}`)}var yl=class extends _t{constructor(t,n={}){let{x:r,y:i,r:o=yO,length:s,rotate:a,shape:c=gO,anchor:l="middle",frameAnchor:u}=n,[f,h]=ie(s,12),[d,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:d,optional:!0}},n,mO),this.r=+o,this.length=h,this.rotate=p,this.shape=tY(c),this.anchor=rn(l,"anchor",["start","middle","end"]),this.frameAnchor=Bo(u)}render(t,n,r,i,o){let{x:s,y:a}=n,{x:c,y:l,length:u,rotate:f}=r,{length:h,rotate:d,anchor:p,shape:m,r:y}=this,[g,b]=gn(this,i);return lt("svg:g",o).call(Bt,this,i,o).call(It,this,{x:c&&s,y:l&&a}).call(x=>x.selectAll().data(t).enter().append("path").call(Ot,this).attr("transform",ja`translate(${c?w=>c[w]:g},${l?w=>l[w]:b})${f?w=>` rotate(${f[w]})`:d?` rotate(${d})`:""}${p==="start"?"":p==="end"?u?w=>` translate(0,${u[w]})`:` translate(0,${h})`:u?w=>` translate(0,${u[w]/2})`:` translate(0,${h/2})`}`).attr("d",u?w=>{let v=Jn();return m.draw(v,u[w],y),v}:(()=>{let w=Jn();return m.draw(w,h,y),w})()).call(Zt,this,r)).node()}};function DM(e,t={}){let{x:n,y:r,...i}=t;return t.frameAnchor===void 0&&([n,r]=Re(n,r)),new yl(e,{...i,x:n,y:r})}function G1(e,t={}){let{x:n=W,...r}=t;return new yl(e,{...r,x:n})}function X1(e,t={}){let{y:n=W,...r}=t;return new yl(e,{...r,y:n})}function xO(e,t={}){let{shape:n=bO,stroke:r=mO.stroke,strokeWidth:i=1,fill:o=r,fillOpacity:s=.3,anchor:a="start",...c}=t;return DM(e,{...c,shape:n,stroke:r,strokeWidth:i,fill:o,fillOpacity:s,anchor:a})}function Ya(e,t){return arguments.length<2&&!sr(e)&&(t=e,e=null),t===void 0&&(t={}),[e,t]}function H1({anchor:e}={},t){return e===void 0?t[0]:rn(e,"anchor",t)}function wO(e){return H1(e,["left","right"])}function _O(e){return H1(e,["right","left"])}function vO(e){return H1(e,["bottom","top"])}function SO(e){return H1(e,["top","bottom"])}function bm(){let[e,t]=Ya(...arguments);return MO("y",wO(t),e,t)}function Z1(){let[e,t]=Ya(...arguments);return MO("fy",_O(t),e,t)}function xm(){let[e,t]=Ya(...arguments);return IO("x",vO(t),e,t)}function Q1(){let[e,t]=Ya(...arguments);return IO("fx",SO(t),e,t)}function MO(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:h,textStrokeWidth:d,tickSize:p=e==="y"?6:0,tickPadding:m,tickRotate:y,x:g,margin:b,marginTop:x=b===void 0?20:b,marginRight:w=b===void 0?t==="right"?40:0:b,marginBottom:v=b===void 0?20:b,marginLeft:_=b===void 0?t==="left"?40:0:b,label:M,labelAnchor:E,labelArrow:I,labelOffset:N,...A}){return p=Nt(p),m=Nt(m),y=Nt(y),E!==void 0&&(E=rn(E,"labelAnchor",["center","top","bottom"])),I=LO(I),Ke(p&&!ee(o)?eY(e,t,n,{stroke:o,strokeOpacity:s,strokeWidth:a,tickSize:p,tickPadding:m,tickRotate:y,x:g,...A}):null,ee(c)?null:rY(e,t,n,{fill:c,fillOpacity:l,stroke:f,strokeOpacity:h,strokeWidth:d,textAnchor:u,tickSize:p,tickPadding:m,tickRotate:y,x:g,marginTop:x,marginRight:w,marginBottom:v,marginLeft:_,...A}),!ee(c)&&M!==null?Co([],DO({fill:c,fillOpacity:l,...A},function(O,L,S,T,D){let C=T[e],{marginTop:R,marginRight:F,marginBottom:k,marginLeft:$}=e==="y"&&D.inset||D,U=E??(C.bandwidth?"center":"top"),G=N??(t==="right"?F:$)-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"?k-3:0,this.dx=t==="right"?G:-G,this.ariaLabel=`${e}-axis label`,{facets:[[0]],channels:{text:{value:[BO(e,C,{anchor:t,label:M,labelAnchor:U,labelArrow:I})]}}}})):null)}function IO(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:h,textStrokeWidth:d,tickSize:p=e==="x"?6:0,tickPadding:m,tickRotate:y,y:g,margin:b,marginTop:x=b===void 0?t==="top"?30:0:b,marginRight:w=b===void 0?20:b,marginBottom:v=b===void 0?t==="bottom"?30:0:b,marginLeft:_=b===void 0?20:b,label:M,labelAnchor:E,labelArrow:I,labelOffset:N,...A}){return p=Nt(p),m=Nt(m),y=Nt(y),E!==void 0&&(E=rn(E,"labelAnchor",["center","left","right"])),I=LO(I),Ke(p&&!ee(o)?nY(e,t,n,{stroke:o,strokeOpacity:s,strokeWidth:a,tickSize:p,tickPadding:m,tickRotate:y,y:g,...A}):null,ee(c)?null:iY(e,t,n,{fill:c,fillOpacity:l,stroke:f,strokeOpacity:h,strokeWidth:d,textAnchor:u,tickSize:p,tickPadding:m,tickRotate:y,y:g,marginTop:x,marginRight:w,marginBottom:v,marginLeft:_,...A}),!ee(c)&&M!==null?Co([],DO({fill:c,fillOpacity:l,...A},function(O,L,S,T,D){let C=T[e],{marginTop:R,marginRight:F,marginBottom:k,marginLeft:$}=e==="x"&&D.inset||D,U=E??(C.bandwidth?"center":"right"),G=N??(t==="top"?R:k)-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"?-G:G,this.dx=U==="right"?F-3:U==="left"?3-$:0,this.ariaLabel=`${e}-axis label`,{facets:[[0]],channels:{text:{value:[BO(e,C,{anchor:t,label:M,labelAnchor:U,labelArrow:I})]}}}})):null)}function eY(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:h=0,y:d=e==="y"?void 0:null,...p}){return bf(X1,e,n,{ariaLabel:`${e}-axis tick`,ariaHidden:!0},{strokeWidth:r,strokeLinecap:i,strokeLinejoin:o,facetAnchor:s,frameAnchor:a,y:d,...p,dx:t==="left"?+h-Oe+ +u:+h+Oe-f,anchor:"start",length:c,shape:t==="left"?cY:lY})}function nY(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:h=0,x:d=e==="x"?void 0:null,...p}){return bf(G1,e,n,{ariaLabel:`${e}-axis tick`,ariaHidden:!0},{strokeWidth:r,strokeLinejoin:o,strokeLinecap:i,facetAnchor:s,frameAnchor:a,x:d,...p,dy:t==="bottom"?+h-Oe-f:+h+Oe+ +u,anchor:"start",length:c,shape:t==="bottom"?sY:aY})}function rY(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*yf):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:h=0,insetLeft:d=h,insetRight:p=h,dx:m=0,y=e==="y"?void 0:null,...g}){return bf(j1,e,n,{ariaLabel:`${e}-axis tick label`},{facetAnchor:r,frameAnchor:i,text:c,textAnchor:l,lineAnchor:u,fontVariant:f,rotate:s,y,...g,dx:t==="left"?+m-o-a+ +d:+m+ +o+ +a-p},function(b,x,w,v,_){f===void 0&&(this.fontVariant=OO(b)),c===void 0&&(_.text=NO(b,x,w,v,t))})}function iY(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*yf):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:h=0,insetTop:d=h,insetBottom:p=h,dy:m=0,x:y=e==="x"?void 0:null,...g}){return bf(V1,e,n,{ariaLabel:`${e}-axis tick label`},{facetAnchor:r,frameAnchor:i,text:c===void 0?null:c,textAnchor:l,lineAnchor:u,fontVariant:f,rotate:s,x:y,...g,dy:t==="bottom"?+m+ +o+ +a-p:+m-o-a+ +d},function(b,x,w,v,_){f===void 0&&(this.fontVariant=OO(b)),c===void 0&&(_.text=NO(b,x,w,v,t))})}function K1(){let[e,t]=Ya(...arguments);return AO("y",wO(t),e,t)}function J1(){let[e,t]=Ya(...arguments);return AO("fy",_O(t),e,t)}function tw(){let[e,t]=Ya(...arguments);return TO("x",vO(t),e,t)}function ew(){let[e,t]=Ya(...arguments);return TO("fx",SO(t),e,t)}function AO(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 bf(kr,e,n,{ariaLabel:`${e}-grid`,ariaHidden:!0},{y:r,x1:o,x2:s,...EO(a)})}function TO(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 bf(Rr,e,n,{ariaLabel:`${e}-grid`,ariaHidden:!0},{x:r,y1:o,y2:s,...EO(a)})}function EO({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 DO({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 bf(e,t,n,r,i,o){let s;function a(u,f,h,d,p,m){let y=u==null&&(t==="fx"||t==="fy"),{[t]:g}=d;if(!g)throw new Error(`missing scale: ${t}`);let b=g.domain(),{interval:x,ticks:w,tickFormat:v,tickSpacing:_=t==="x"?80:35}=i;if(typeof w=="string"&&FO(g)&&(x=w,w=void 0),w===void 0&&(w=Oo(x,g.type)??oY(g,_)),u==null){if(sr(w))u=Pe(w);else if(La(w))u=NM(w,...ae(b));else if(g.interval){let E=g.interval;if(g.ticks){let[I,N]=ae(b),A=(N-I)/E[Zu];E=T3(E,A/w)??E,u=NM(E,I,N)}else{u=b;let I=u.length;E=T3(E,I/w)??E,E!==g.interval&&(u=NM(E,...ae(u)))}if(E===g.interval){let I=Math.round(u.length/w);I>1&&(u=u.filter((N,A)=>A%I===0))}}else g.ticks?u=g.ticks(w):u=b;if(!g.ticks&&u.length&&u!==b){let E=new Hn(b);u=u.filter(I=>E.has(I)),u.length||qn(`Warning: the ${t}-axis ticks appear to not align with the scale domain, resulting in no ticks. Try different ticks?`)}t==="y"||t==="x"?f=[or(u)]:s[t]={scale:t,value:W}}o?.call(this,g,u,w,v,s);let M=Object.fromEntries(Object.entries(s).map(([E,I])=>[E,{...I,value:bt(u,I.value)}]));return y&&(f=m.filterFacets(u,M)),{data:u,facets:f,channels:M}}let c=ve(i).initializer,l=e(n,ve({...i,initializer:a},c));return n==null?(s=l.channels,l.channels={}):s={},r!==void 0&&Object.assign(l,r),l.clip===void 0&&(l.clip=!1),l}function oY(e,t){let[n,r]=ae(e.range());return(r-n)/t}function NO(e,t,n,r,i){return{value:wm(e,t,n,r,i)}}function wm(e,t,n,r,i){return typeof r=="function"?r:r===void 0&&t&&Ne(t)?uD(e.type,t,i)??Fi:e.tickFormat?e.tickFormat(typeof n=="number"?n:null,r):r===void 0?Fi:typeof r=="string"?(Ne(e.domain())?Ao:ni)(r):hn(r)}function NM(e,t,n){return e.range(t,e.offset(e.floor(n)))}var sY={draw(e,t){e.moveTo(0,0),e.lineTo(0,t)}},aY={draw(e,t){e.moveTo(0,0),e.lineTo(0,-t)}},cY={draw(e,t){e.moveTo(0,0),e.lineTo(-t,0)}},lY={draw(e,t){e.moveTo(0,0),e.lineTo(t,0)}};function OO(e){return e.bandwidth&&!e.interval?void 0:"tabular-nums"}function BO(e,t,{anchor:n,label:r=t.label,labelAnchor:i,labelArrow:o}={}){if(!(r==null||r.inferred&&FO(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=A1(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 LO(e="auto"){return ee(e)?!1:typeof e=="boolean"?e:rn(e,"labelArrow",["auto","up","right","down","left"])}function FO(e){return Ne(e.domain())}function CO(e,t){if(t==null)return t;let n=e(t);if(!n)throw new Error(`scale not found: ${t}`);return n}function RO(e,{opacity:t,...n}={}){if(!Fo(e)&&!uM(e))throw new Error(`swatches legend requires ordinal or threshold color scale (not ${e.type})`);return $O(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 kO(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:ee(t)?"currentColor":"none",strokeOpacity:i=1,strokeWidth:o=1.5,r:s=4.5,...a}={},c){let[l,u]=De(t),[f,h]=De(r),d=CO(c,l),p=CO(c,f),m=s*s*Math.PI;return n=ie(n)[1],i=ie(i)[1],o=ie(o)[1],$O(e,a,(y,g,b,x)=>y.append("svg").attr("viewBox","-8 -8 16 16").attr("width",b).attr("height",x).attr("fill",l==="color"?w=>d.scale(w):u).attr("fill-opacity",n).attr("stroke",f==="color"?w=>p.scale(w):h).attr("stroke-opacity",i).attr("stroke-width",o).append("path").attr("d",w=>{let v=Jn();return e.scale(w).draw(v,m),v}))}function $O(e,t={},n){let{columns:r,tickFormat:i,fontVariant:o=k1(e),swatchSize:s=15,swatchWidth:a=s,swatchHeight:c=s,marginLeft:l=0,className:u,style:f,width:h}=t,d=$a(t);u=df(u),i=wm(e.scale,e.domain,void 0,i);let p=lt("div",d).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 Xq(e){return e==="time"?Hx:e==="utc"?Zp:Wq}function LD(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",h===void 0?null:`${+h}px`).style("font-variant",ce(o,"normal")).call(lf,f).node()}var Y1=new Map([["symbol",sB],["color",uB],["opacity",Cj]]);function cB(e={}){for(let[t,n]of Y1){let r=e[t];if(Ao(r)){let i=Ca(e),o;if(t==="symbol"){let{fill:s,stroke:a=s===void 0&&Ao(e.color)?"color":void 0}=e;o={fill:s,stroke:a}}return n(g1(t,r,o),lM(i,r,e),s=>Ao(e[s])?g1(s,e[s]):null)}}throw new Error("unknown legend type; no scale found")}function lB(e,t,n={}){return(r,i)=>{if(!Y1.has(r))throw new Error(`unknown legend type: ${r}`);if(r in e)return Y1.get(r)(e[r],lM(t,n[r],i),o=>e[o])}}function lM({className:e,...t},{label:n,ticks:r,tickFormat:i}={},o){return GD(o,{className:e,...t},{label:n,ticks:r,tickFormat:i})}function uB(e,{legend:t=!0,...n}){if(t===!0&&(t=e.type==="ordinal"?"swatches":"ramp"),e.domain!==void 0)switch(`${t}`.toLowerCase()){case"swatches":return oB(e,n);case"ramp":return _N(e,n);default:throw new Error(`unknown legend type: ${t}`)}}function Cj({type:e,interpolate:t,...n},{legend:r=!0,color:i=tn(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 uB({type:e,...n,interpolate:kj(i)},{legend:r,...o})}function kj(e){let{r:t,g:n,b:r}=tn(e)||tn(0,0,0);return i=>`rgba(${t},${n},${r},${i})`}function fB(e,t,n){let r=[];for(let[i,o]of Y1){let s=n[i];if(s?.legend&&i in e){let a=o(e[i],lM(t,e[i],s),c=>e[c]);a!=null&&r.push(a)}}return r}var Rj={ariaLabel:"frame",fill:"none",stroke:"currentColor",clip:!1},$j={ariaLabel:"frame",fill:null,stroke:"currentColor",strokeLinecap:"square",clip:!1},ym=class extends _t{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(Ta,void 0,t,n==null?Rj:$j),this.anchor=uI(n,"anchor",["top","right","bottom","left"]),this.insetTop=Dt(i),this.insetRight=Dt(o),this.insetBottom=Dt(s),this.insetLeft=Dt(a),this.rx=Dt(c),this.ry=Dt(l)}render(t,n,r,i,o){let{marginTop:s,marginRight:a,marginBottom:c,marginLeft:l,width:u,height:f}=i,{anchor:h,insetTop:d,insetRight:p,insetBottom:m,insetLeft:y,rx:g,ry:b}=this,x=l+y,w=u-a-p,v=s+d,_=f-c-m;return lt(h?"svg:line":"svg:rect",o).datum(0).call(Bt,this,i,o).call(Nt,this).call(Ht,this,r).call(Mt,this,{}).call(h==="left"?M=>M.attr("x1",x).attr("x2",x).attr("y1",v).attr("y2",_):h==="right"?M=>M.attr("x1",w).attr("x2",w).attr("y1",v).attr("y2",_):h==="top"?M=>M.attr("x1",x).attr("x2",w).attr("y1",v).attr("y2",v):h==="bottom"?M=>M.attr("x1",x).attr("x2",w).attr("y1",_).attr("y2",_):M=>M.attr("x",x).attr("y",v).attr("width",w-x).attr("height",_-v).attr("rx",g).attr("ry",b)).node()}};function yf(e){return new ym(e)}var uM={ariaLabel:"tip",fill:"var(--plot-background)",stroke:"currentColor"},Uj=new Set(["geometry","href","src","ariaLabel","scales"]),gm=class extends _t{constructor(t,n={}){n.tip&&(n={...n,tip:!1}),n.title===void 0&&ir(t)&&Jx(t)&&(n={...n,title:W});let{x:r,y:i,x1:o,x2:s,y1:a,y2:c,anchor:l,preferredAnchor:u="bottom",monospace:f,fontFamily:h=f?"ui-monospace, monospace":void 0,fontSize:d,fontStyle:p,fontVariant:m,fontWeight:y,lineHeight:g=1,lineWidth:b=20,frameAnchor:x,format:w,textAnchor:v="start",textOverflow:_,textPadding:M=8,title:E,pointerSize:I=12,pathFilter:N="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,uM),this.anchor=e1(l,"anchor"),this.preferredAnchor=e1(u,"preferredAnchor"),this.frameAnchor=Do(x),this.textAnchor=ce(v,"middle"),this.textPadding=+M,this.pointerSize=+I,this.pathFilter=Ue(N),this.lineHeight=+g,this.lineWidth=+b,this.textOverflow=rM(_),this.monospace=!!f,this.fontFamily=Ue(h),this.fontSize=Dt(d),this.fontStyle=Ue(p),this.fontVariant=Ue(m),this.fontWeight=Ue(y);for(let A in uM)A in this.channels&&(this[A]=uM[A]);this.splitLines=oM(this),this.clipLine=sM(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:h}=o,{anchor:d,monospace:p,lineHeight:m,lineWidth:y}=this,{textPadding:g,pointerSize:b,pathFilter:x}=this,{marginTop:w,marginLeft:v}=i,{x1:_,y1:M,x2:E,y2:I,x:N=_??E,y:A=M??I}=r,B=l?l(t.fx)-v:0,L=u?u(t.fy)-w:0,[S,T]=yn(this,i),D=ZI(r,S),C=KI(r,T),k=p?C1:F1,F=k(ll),R,$;"title"in r?(R=r.channels,$=jj):(R=Vj.call(this,r,n),$=Yj);let U=lt("svg:g",o).call(Bt,this,i,o).call(iM,this).call(Mt,this,{x:N&&a,y:A&&c}).call(rt=>rt.selectAll().data(t).enter().append("g").attr("transform",st=>`translate(${Math.round(D(st))},${Math.round(C(st))})`).call(Nt,this).call(st=>st.append("path").attr("filter",x)).call(st=>st.append("text").each(function(j){let ot=Pt(this);this.setAttribute("fill","currentColor"),this.setAttribute("fill-opacity",1),this.setAttribute("stroke","none");let z=$.call(s,j,t,R,n,r);if(typeof z=="string")for(let H of s.splitLines(z))G(ot,{value:s.clipLine(H)});else{let H=new Set;for(let nt of z){let{label:P=""}=nt;P&&H.has(P)||(H.add(P),G(ot,nt))}}})));function G(rt,{label:st,value:j,color:ot,opacity:z}){st??="",j??="";let H=ot!=null||z!=null,nt,P=y*100,[Ot]=fl(st,P,k,F);if(Ot>=0)st=st.slice(0,Ot).trimEnd()+ll,nt=j.trim(),j="";else{(st||!j&&!H)&&(j=" "+j);let[jt]=fl(j,P-k(st),k,F);jt>=0&&(nt=j.trim(),j=j.slice(0,jt).trimEnd()+ll)}let ft=rt.append("tspan").attr("x",0).attr("dy",`${m}em`).text("\u200B");st&&ft.append("tspan").attr("font-weight","bold").text(st),j&&ft.append(()=>h.createTextNode(j)),H&&ft.append("tspan").text(" \u25A0").attr("fill",ot).attr("fill-opacity",z).style("user-select","none"),nt&&ft.append("title").text(nt)}function et(){let{width:rt,height:st}=i.facet??i;U.selectChildren().each(function(j){let{x:ot,width:z,height:H}=this.getBBox();z=Math.round(z),H=Math.round(H);let nt=d;if(nt===void 0){let ft=D(j)+B,jt=C(j)+L,Wt=ft+z+b+g*2<rt,J=ft-z-b-g*2>0,ie=jt+H+b+g*2<st,gr=jt-H-b-g*2>0;nt=Wt&&J?ie&&gr?s.preferredAnchor:gr?"bottom":"top":ie&&gr?Wt?"left":"right":(Wt||J)&&(ie||gr)?`${gr?"bottom":"top"}-${Wt?"left":"right"}`:s.preferredAnchor}let P=this.firstChild,Ot=this.lastChild;if(P.setAttribute("d",qj(nt,b,g,z,H)),ot)for(let ft of Ot.childNodes)ft.setAttribute("x",-ot);Ot.setAttribute("y",`${+Pj(nt,Ot.childNodes.length,m).toFixed(6)}em`),Ot.setAttribute("transform",`translate(${zj(nt,b,g,z,H)})`)}),U.attr("visibility",null)}return t.length&&(U.attr("visibility","hidden"),f.isConnected?Promise.resolve().then(et):typeof requestAnimationFrame<"u"&&requestAnimationFrame(et)),U.node()}};function G1(e,{x:t,y:n,...r}={}){return r.frameAnchor===void 0&&([t,n]=ke(t,n)),new gm(e,{...r,x:t,y:n})}function Pj(e,t,n){return/^top(?:-|$)/.test(e)?.94-n:-.29-t*n}function zj(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 qj(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 Vj({channels:e},t){let n={},r=this.format;r=hB(r,e,"x"),r=hB(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=om(e,i);s&&(n[i]=s)}}for(let i in e){if(i in n||i in r||Uj.has(i))continue;let o=om(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]=(De(s)?So:ti)(o)}else if(o===void 0||o===!0){let s=t[i];this.format[i]=s?.bandwidth?mm(s,s.domain()):Oi}}return n}function hB(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 jj(e,t,{title:n}){return Oi(n.value[e],e)}function*Yj(e,t,n,r,i){for(let o in n){if(o==="fx"||o==="fy"){yield{label:W1(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:pB(r,n,"x"),value:dB(this.format.x2,n.x1,s,e)};else if(o==="y2"&&"y1"in n)yield{label:pB(r,n,"y"),value:dB(this.format.y2,n.y1,s,e)};else{let a=s.value[e],c=s.scale;if(!$e(a)&&c==null)continue;yield{label:W1(r,n,o),value:this.format[o](a,e),color:c==="color"?i[o][e]:null,opacity:c==="opacity"?i[o][e]:null}}}}function dB(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 pB(e,t,n){let r=W1(e,t,`${n}1`,n),i=W1(e,t,`${n}2`,n);return r===i?r:`${r}\u2013${i}`}function W1(e,t,n,r=n){let i=t[n],o=e[i?.scale??n];return String(o?.label??i?.label??r)}function xm(e={}){let{facet:t,style:n,title:r,subtitle:i,caption:o,ariaLabel:s,ariaDescription:a}=e,c=cf(e.className),l=e.marks===void 0?[]:yB(e.marks);l.push(...Qj(l));let u=Zj(t,e),f=new Map;for(let F of l){let R=gB(F,u,e);R&&f.set(F,R)}let h=new Map;u&&bm(h,[u],e),bm(h,f,e);let d=yB(Jj(l,h,e));for(let F of d){let R=gB(F,u,e);R&&f.set(F,R)}l.unshift(...d);let p=mN(h,e);if(p!==void 0){let F=u?M1(p,u):void 0;for(let $ of l){if($.facet===null||$.facet==="super")continue;let U=f.get($);U!==void 0&&(U.facetsIndex=$.fx!=null||$.fy!=null?M1(p,U):F)}let R=new Set;for(let{facetsIndex:$}of f.values())$?.forEach((U,G)=>{U?.length>0&&R.add(G)});p.forEach(0<R.size&&R.size<p.length?($,U)=>$.empty=!R.has(U):$=>$.empty=!1);for(let $ of l)if($.facet==="exclude"){let U=f.get($);U!==void 0&&(U.facetsIndex=bN(U.facetsIndex))}}for(let F of le.keys())Ao(e[F])&&F!=="fx"&&F!=="fy"&&h.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:R,channels:$}=f.get(F)??{},{data:U,facets:G,channels:et}=F.initialize(R,$,e);dM(et,e),m.set(F,{data:U,facets:G,channels:et})}let y=cm(bm(h,m,e),e),g=dN(y,l,e);rN(y,g);let b=PI(y),{fx:x,fy:w}=b,v=x||w?zI(y,g):g,_=x||w?sY(b,g):g,M=Ca(e),E=M.document,I=us("svg").call(E.documentElement),N=I;M.ownerSVGElement=I,M.className=c,M.projection=y5(e,v),M.filterFacets=(F,R)=>M1(p,{channels:R,groups:S1(F,R)}),M.getMarkState=F=>{let R=m.get(F),$=f.get(F);return{...R,channels:{...R.channels,...$?.channels}}},M.dispatchValue=F=>{N.value!==F&&(N.value=F,N.dispatchEvent(new Event("input",{bubbles:!0})))};let A=new Set;for(let[F,R]of m)if(F.initializer!=null){let $=F.facet==="super"?_:v,U=F.initializer(R.data,R.facets,R.channels,b,$,M);if(U.data!==void 0&&(R.data=U.data),U.facets!==void 0&&(R.facets=U.facets),U.channels!==void 0){let{fx:G,fy:et,...rt}=U.channels;Hj(rt),Object.assign(R.channels,rt);for(let st of Object.values(rt)){let{scale:j}=st;j!=null&&!HD(le.get(j))&&(wB(st,e),A.add(j))}(G!=null||et!=null)&&f.set(F,!0)}}if(A.size){let F=new Map;bm(F,m,e,G=>A.has(G)),bm(h,m,e,G=>A.has(G));let R=oY(cm(F,e),y),{scales:$,...U}=PI(R);Object.assign(y,R),Object.assign(b,U),Object.assign(b.scales,$)}let B,L;p!==void 0&&(B={x:x?.domain(),y:w?.domain()},p=yN(p,B),L=gN(x,w,g));for(let[F,R]of m)R.values=F.scale(R.channels,b,M);let{width:S,height:T}=g;Pt(I).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",T).attr("viewBox",`0 0 ${S} ${T}`).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",h===void 0?null:`${+h}px`).style("font-variant",le(o,"normal")).call(pf,f).node()}var nw=new Map([["symbol",kO],["color",zO],["opacity",uY]]);function UO(e={}){for(let[t,n]of nw){let r=e[t];if(Do(r)){let i=$a(e),o;if(t==="symbol"){let{fill:s,stroke:a=s===void 0&&Do(e.color)?"color":void 0}=e;o={fill:s,stroke:a}}return n(E1(t,r,o),OM(i,r,e),s=>Do(e[s])?E1(s,e[s]):null)}}throw new Error("unknown legend type; no scale found")}function PO(e,t,n={}){return(r,i)=>{if(!nw.has(r))throw new Error(`unknown legend type: ${r}`);if(r in e)return nw.get(r)(e[r],OM(t,n[r],i),o=>e[o])}}function OM({className:e,...t},{label:n,ticks:r,tickFormat:i}={},o){return MD(o,{className:e,...t},{label:n,ticks:r,tickFormat:i})}function zO(e,{legend:t=!0,...n}){if(t===!0&&(t=e.type==="ordinal"?"swatches":"ramp"),e.domain!==void 0)switch(`${t}`.toLowerCase()){case"swatches":return RO(e,n);case"ramp":return KN(e,n);default:throw new Error(`unknown legend type: ${t}`)}}function uY({type:e,interpolate:t,...n},{legend:r=!0,color:i=en(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 zO({type:e,...n,interpolate:fY(i)},{legend:r,...o})}function fY(e){let{r:t,g:n,b:r}=en(e)||en(0,0,0);return i=>`rgba(${t},${n},${r},${i})`}function qO(e,t,n){let r=[];for(let[i,o]of nw){let s=n[i];if(s?.legend&&i in e){let a=o(e[i],OM(t,e[i],s),c=>e[c]);a!=null&&r.push(a)}}return r}var hY={ariaLabel:"frame",fill:"none",stroke:"currentColor",clip:!1},dY={ariaLabel:"frame",fill:null,stroke:"currentColor",strokeLinecap:"square",clip:!1},_m=class extends _t{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(Na,void 0,t,n==null?hY:dY),this.anchor=B3(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:h,insetTop:d,insetRight:p,insetBottom:m,insetLeft:y,rx:g,ry:b}=this,x=l+y,w=u-a-p,v=s+d,_=f-c-m;return lt(h?"svg:line":"svg:rect",o).datum(0).call(Bt,this,i,o).call(Ot,this).call(Zt,this,r).call(It,this,{}).call(h==="left"?M=>M.attr("x1",x).attr("x2",x).attr("y1",v).attr("y2",_):h==="right"?M=>M.attr("x1",w).attr("x2",w).attr("y1",v).attr("y2",_):h==="top"?M=>M.attr("x1",x).attr("x2",w).attr("y1",v).attr("y2",v):h==="bottom"?M=>M.attr("x1",x).attr("x2",w).attr("y1",_).attr("y2",_):M=>M.attr("x",x).attr("y",v).attr("width",w-x).attr("height",_-v).attr("rx",g).attr("ry",b)).node()}};function xf(e){return new _m(e)}var BM={ariaLabel:"tip",fill:"var(--plot-background)",stroke:"currentColor"},pY=new Set(["geometry","href","src","ariaLabel","scales"]),vm=class extends _t{constructor(t,n={}){n.tip&&(n={...n,tip:!1}),n.title===void 0&&sr(t)&&u1(t)&&(n={...n,title:W});let{x:r,y:i,x1:o,x2:s,y1:a,y2:c,anchor:l,preferredAnchor:u="bottom",monospace:f,fontFamily:h=f?"ui-monospace, monospace":void 0,fontSize:d,fontStyle:p,fontVariant:m,fontWeight:y,lineHeight:g=1,lineWidth:b=20,frameAnchor:x,format:w,textAnchor:v="start",textOverflow:_,textPadding:M=8,title:E,pointerSize:I=12,pathFilter:N="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,BM),this.anchor=h1(l,"anchor"),this.preferredAnchor=h1(u,"preferredAnchor"),this.frameAnchor=Bo(x),this.textAnchor=le(v,"middle"),this.textPadding=+M,this.pointerSize=+I,this.pathFilter=Ue(N),this.lineHeight=+g,this.lineWidth=+b,this.textOverflow=IM(_),this.monospace=!!f,this.fontFamily=Ue(h),this.fontSize=Nt(d),this.fontStyle=Ue(p),this.fontVariant=Ue(m),this.fontWeight=Ue(y);for(let A in BM)A in this.channels&&(this[A]=BM[A]);this.splitLines=TM(this),this.clipLine=EM(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:h}=o,{anchor:d,monospace:p,lineHeight:m,lineWidth:y}=this,{textPadding:g,pointerSize:b,pathFilter:x}=this,{marginTop:w,marginLeft:v}=i,{x1:_,y1:M,x2:E,y2:I,x:N=_??E,y:A=M??I}=r,O=l?l(t.fx)-v:0,L=u?u(t.fy)-w:0,[S,T]=gn(this,i),D=bM(r,S),C=xM(r,T),R=p?W1:Y1,F=R(dl),k,$;"title"in r?(k=r.channels,$=xY):(k=bY.call(this,r,n),$=wY);let U=lt("svg:g",o).call(Bt,this,i,o).call(AM,this).call(It,this,{x:N&&a,y:A&&c}).call(rt=>rt.selectAll().data(t).enter().append("g").attr("transform",st=>`translate(${Math.round(D(st))},${Math.round(C(st))})`).call(Ot,this).call(st=>st.append("path").attr("filter",x)).call(st=>st.append("text").each(function(j){let ot=Pt(this);this.setAttribute("fill","currentColor"),this.setAttribute("fill-opacity",1),this.setAttribute("stroke","none");let z=$.call(s,j,t,k,n,r);if(typeof z=="string")for(let H of s.splitLines(z))G(ot,{value:s.clipLine(H)});else{let H=new Set;for(let nt of z){let{label:P=""}=nt;P&&H.has(P)||(H.add(P),G(ot,nt))}}})));function G(rt,{label:st,value:j,color:ot,opacity:z}){st??="",j??="";let H=ot!=null||z!=null,nt,P=y*100,[Lt]=ml(st,P,R,F);if(Lt>=0)st=st.slice(0,Lt).trimEnd()+dl,nt=j.trim(),j="";else{(st||!j&&!H)&&(j=" "+j);let[Wt]=ml(j,P-R(st),R,F);Wt>=0&&(nt=j.trim(),j=j.slice(0,Wt).trimEnd()+dl)}let ft=rt.append("tspan").attr("x",0).attr("dy",`${m}em`).text("\u200B");st&&ft.append("tspan").attr("font-weight","bold").text(st),j&&ft.append(()=>h.createTextNode(j)),H&&ft.append("tspan").text(" \u25A0").attr("fill",ot).attr("fill-opacity",z).style("user-select","none"),nt&&ft.append("title").text(nt)}function et(){let{width:rt,height:st}=i.facet??i;U.selectChildren().each(function(j){let{x:ot,width:z,height:H}=this.getBBox();z=Math.round(z),H=Math.round(H);let nt=d;if(nt===void 0){let ft=D(j)+O,Wt=C(j)+L,Ht=ft+z+b+g*2<rt,J=ft-z-b-g*2>0,oe=Wt+H+b+g*2<st,br=Wt-H-b-g*2>0;nt=Ht&&J?oe&&br?s.preferredAnchor:br?"bottom":"top":oe&&br?Ht?"left":"right":(Ht||J)&&(oe||br)?`${br?"bottom":"top"}-${Ht?"left":"right"}`:s.preferredAnchor}let P=this.firstChild,Lt=this.lastChild;if(P.setAttribute("d",gY(nt,b,g,z,H)),ot)for(let ft of Lt.childNodes)ft.setAttribute("x",-ot);Lt.setAttribute("y",`${+mY(nt,Lt.childNodes.length,m).toFixed(6)}em`),Lt.setAttribute("transform",`translate(${yY(nt,b,g,z,H)})`)}),U.attr("visibility",null)}return t.length&&(U.attr("visibility","hidden"),f.isConnected?Promise.resolve().then(et):typeof requestAnimationFrame<"u"&&requestAnimationFrame(et)),U.node()}};function iw(e,{x:t,y:n,...r}={}){return r.frameAnchor===void 0&&([t,n]=Re(t,n)),new vm(e,{...r,x:t,y:n})}function mY(e,t,n){return/^top(?:-|$)/.test(e)?.94-n:-.29-t*n}function yY(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 gY(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 bY({channels:e},t){let n={},r=this.format;r=VO(r,e,"x"),r=VO(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=um(e,i);s&&(n[i]=s)}}for(let i in e){if(i in n||i in r||pY.has(i))continue;let o=um(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]=(Ne(s)?Ao:ni)(o)}else if(o===void 0||o===!0){let s=t[i];this.format[i]=s?.bandwidth?wm(s,s.domain()):Fi}}return n}function VO(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 xY(e,t,{title:n}){return Fi(n.value[e],e)}function*wY(e,t,n,r,i){for(let o in n){if(o==="fx"||o==="fy"){yield{label:rw(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:YO(r,n,"x"),value:jO(this.format.x2,n.x1,s,e)};else if(o==="y2"&&"y1"in n)yield{label:YO(r,n,"y"),value:jO(this.format.y2,n.y1,s,e)};else{let a=s.value[e],c=s.scale;if(!$e(a)&&c==null)continue;yield{label:rw(r,n,o),value:this.format[o](a,e),color:c==="color"?i[o][e]:null,opacity:c==="opacity"?i[o][e]:null}}}}function jO(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 YO(e,t,n){let r=rw(e,t,`${n}1`,n),i=rw(e,t,`${n}2`,n);return r===i?r:`${r}\u2013${i}`}function rw(e,t,n,r=n){let i=t[n],o=e[i?.scale??n];return String(o?.label??i?.label??r)}function Mm(e={}){let{facet:t,style:n,title:r,subtitle:i,caption:o,ariaLabel:s,ariaDescription:a}=e,c=df(e.className),l=e.marks===void 0?[]:GO(e.marks);l.push(...TY(l));let u=IY(t,e),f=new Map;for(let F of l){let k=XO(F,u,e);k&&f.set(F,k)}let h=new Map;u&&Sm(h,[u],e),Sm(h,f,e);let d=GO(EY(l,h,e));for(let F of d){let k=XO(F,u,e);k&&f.set(F,k)}l.unshift(...d);let p=WN(h,e);if(p!==void 0){let F=u?R1(p,u):void 0;for(let $ of l){if($.facet===null||$.facet==="super")continue;let U=f.get($);U!==void 0&&(U.facetsIndex=$.fx!=null||$.fy!=null?R1(p,U):F)}let k=new Set;for(let{facetsIndex:$}of f.values())$?.forEach((U,G)=>{U?.length>0&&k.add(G)});p.forEach(0<k.size&&k.size<p.length?($,U)=>$.empty=!k.has(U):$=>$.empty=!1);for(let $ of l)if($.facet==="exclude"){let U=f.get($);U!==void 0&&(U.facetsIndex=HN(U.facetsIndex))}}for(let F of ue.keys())Do(e[F])&&F!=="fx"&&F!=="fy"&&h.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:k,channels:$}=f.get(F)??{},{data:U,facets:G,channels:et}=F.initialize(k,$,e);CM(et,e),m.set(F,{data:U,facets:G,channels:et})}let y=dm(Sm(h,m,e),e),g=jN(y,l,e);FN(y,g);let b=cM(y),{fx:x,fy:w}=b,v=x||w?lM(y,g):g,_=x||w?CY(b,g):g,M=$a(e),E=M.document,I=ps("svg").call(E.documentElement),N=I;M.ownerSVGElement=I,M.className=c,M.projection=GD(e,v),M.filterFacets=(F,k)=>R1(p,{channels:k,groups:F1(F,k)}),M.getMarkState=F=>{let k=m.get(F),$=f.get(F);return{...k,channels:{...k.channels,...$?.channels}}},M.dispatchValue=F=>{N.value!==F&&(N.value=F,N.dispatchEvent(new Event("input",{bubbles:!0})))};let A=new Set;for(let[F,k]of m)if(F.initializer!=null){let $=F.facet==="super"?_:v,U=F.initializer(k.data,k.facets,k.channels,b,$,M);if(U.data!==void 0&&(k.data=U.data),U.facets!==void 0&&(k.facets=U.facets),U.channels!==void 0){let{fx:G,fy:et,...rt}=U.channels;MY(rt),Object.assign(k.channels,rt);for(let st of Object.values(rt)){let{scale:j}=st;j!=null&&!AD(ue.get(j))&&(QO(st,e),A.add(j))}(G!=null||et!=null)&&f.set(F,!0)}}if(A.size){let F=new Map;Sm(F,m,e,G=>A.has(G)),Sm(h,m,e,G=>A.has(G));let k=FY(dm(F,e),y),{scales:$,...U}=cM(k);Object.assign(y,k),Object.assign(b,U),Object.assign(b.scales,$)}let O,L;p!==void 0&&(O={x:x?.domain(),y:w?.domain()},p=GN(p,O),L=XN(x,w,g));for(let[F,k]of m)k.values=F.scale(k.channels,b,M);let{width:S,height:T}=g;Pt(I).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",T).attr("viewBox",`0 0 ${S} ${T}`).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,4 +66,4 @@ ${m}`)).style("margin-left",l?`${+l}px`:null).style("width",h===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:R,values:$,facets:U}=m.get(F);if(p===void 0||F.facet==="super"){let G=null;if(U&&(G=U[0],G=F.filter(G,R,$),G.length===0))continue;let et=F.render(G,b,$,_,M);if(et==null)continue;I.appendChild(et)}else{let G;for(let et of p){if(!(F.facetAnchor?.(p,B,et)??!et.empty))continue;let rt=null;if(U){let j=f.has(F);if(rt=U[j?et.i:0],rt=F.filter(rt,R,$),rt.length===0)continue;!j&&rt===U[0]&&(rt=Ds(rt)),rt.fx=et.x,rt.fy=et.y,rt.fi=et.i}let st=F.render(rt,b,$,v,M);if(st!=null){(G??=Pt(I).append("g")).append(()=>st).datum(et);for(let j of["aria-label","aria-description","aria-hidden","transform"])st.hasAttribute(j)&&(G.attr(j,st.getAttribute(j)),st.removeAttribute(j))}}G?.selectChildren().attr("transform",L)}}let D=fB(y,M,e),{figure:C=r!=null||i!=null||o!=null||D.length>0}=e;C&&(N=E.createElement("figure"),N.className=`${c}-figure`,N.style.maxWidth="initial",r!=null&&N.append(mB(E,r,"h2")),i!=null&&N.append(mB(E,i,"h3")),N.append(...D,I),o!=null&&N.append(Wj(E,o))),N.scale=aN(b.scales),N.legend=lB(y,M,e);let k=d5();return k>0&&Pt(I).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(`${k.toLocaleString("en-US")} warning${k===1?"":"s"}. Please check the console.`),N}function mB(e,t,n){if(t.ownerDocument)return t;let r=e.createElement(n);return r.append(t),r}function Wj(e,t){let n=e.createElement("figcaption");return n.append(t),n}function Gj({marks:e=[],...t}={}){return xm({...t,marks:[...e,this]})}_t.prototype.plot=Gj;function yB(e){return e.flat(1/0).filter(t=>t!=null).map(Xj)}function Xj(e){return typeof e.render=="function"?e:new hM(e)}var hM=class extends _t{constructor(t){if(typeof t!="function")throw new TypeError("invalid mark; missing render function");super(),this.render=t}render(){}};function dM(e,t){for(let n in e)wB(e[n],t);return e}function wB(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:pI(s,i)}=t[n]??{};a!=null&&(e.value=Vt(e.value,a),e.transform=!1)}function Hj(e){for(let t in e)DI(t,e[t])}function bm(e,t,n,r=kD){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(!x5(n)){let c=n.x?.domain===void 0,l=n.y?.domain===void 0;if(c||l){let[u,f]=_5(s);c&&fM(e,"x",u),l&&fM(e,"y",f)}}}else fM(e,a,s)}return e}function fM(e,t,n){let r=e.get(t);r!==void 0?r.push(n):e.set(t,[n])}function Zj(e,t){if(e==null)return;let{x:n,y:r}=e;if(n==null&&r==null)return;let i=Pe(e.data);if(i==null)throw new Error("missing facet data");let o={};n!=null&&(o.fx=tf(i,{value:n,scale:"fx"})),r!=null&&(o.fy=tf(i,{value:r,scale:"fy"})),dM(o,t);let s=S1(i,o);return{channels:o,groups:s,data:e.data}}function gB(e,t,n){if(e.facet===null||e.facet==="super")return;let{fx:r,fy:i}=e;if(r!=null||i!=null){let c=Pe(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=tf(c,{value:r,scale:"fx"})),i!=null&&(l.fy=tf(c,{value:i,scale:"fy"})),dM(l,n),{channels:l,groups:S1(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)&&Pe(e.data)?.length===a.length&&Pn(`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 Kj(e,t={}){return _e({...t,x:null,y:null},(n,r,i,o,s,a)=>a.getMarkState(e))}function Qj(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)?hf:/^y$/i.test(i)?sl:ff,r=i(Kj(n,r)),r.title=null,o===void 0&&(r.preferredAnchor=i===sl?"left":"bottom");let s=G1(n.data,r);s.facet=n.facet,s.facetAnchor=n.facetAnchor,t.push(s)}}return t}function Jj(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:h}=u,x:{axis:d=c,grid:p=d===null?null:l}=i,y:{axis:m=c,grid:y=m===null?null:l}=o,fx:{axis:g=f,grid:b=g===null?null:h}=s,fy:{axis:x=f,grid:w=x===null?null:h}=a}=n;(r||!Ao(i)&&!bB("x",e))&&(d=p=null),(r||!Ao(o)&&!bB("y",e))&&(m=y=null),t.has("fx")||(g=b=null),t.has("fy")||(x=w=null),d===void 0&&(d=!Z1(e,"x")),m===void 0&&(m=!Z1(e,"y")),g===void 0&&(g=!Z1(e,"fx")),x===void 0&&(x=!Z1(e,"fy")),d===!0&&(d="bottom"),m===!0&&(m="left"),g===!0&&(g=d==="top"||d===null?"bottom":"top"),x===!0&&(x=m==="right"||m===null?"left":"right");let v=[];return H1(v,w,q1,a),X1(v,x,U1,"right","left",u,a),H1(v,b,j1,s),X1(v,g,P1,"top","bottom",u,s),H1(v,y,z1,o),X1(v,m,dm,"left","right",n,o),H1(v,p,V1,i),X1(v,d,pm,"bottom","top",n,i),v}function X1(e,t,n,r,i,o,s){if(!t)return;let a=tY(t);s=eY(a?r:t,o,s);let{line:c}=s;(n===dm||n===pm)&&c&&!Os(c)&&e.push(yf(nY(s))),e.push(n(s)),a&&e.push(n({...s,anchor:i,label:null}))}function H1(e,t,n,r){!t||Os(t)||e.push(n(rY(t,r)))}function tY(e){return/^\s*both\s*$/i.test(e)}function eY(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:h=t.label,labelAnchor:d,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:h,labelAnchor:d,labelArrow:p,labelOffset:m}}function nY(e){let{anchor:t,line:n}=e;return{anchor:t,facetAnchor:t+"-empty",stroke:n===!0?void 0:n}}function rY(e,{stroke:t=Ba(e)?e:void 0,ticks:n=iY(e)?e:void 0,tickSpacing:r,ariaLabel:i,ariaDescription:o}){return{stroke:t,ticks:n,tickSpacing:r,ariaLabel:i,ariaDescription:o}}function iY(e){switch(typeof e){case"number":return!0;case"string":return!Ba(e)}return ir(e)||typeof e?.range=="function"}function Z1(e,t){let n=`${t}-axis `;return e.some(r=>r.ariaLabel?.startsWith(n))}function bB(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 oY(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 sY({fx:e,fy:t},n){let{marginTop:r,marginRight:i,marginBottom:o,marginLeft:s,width:a,height:c}=y1(n),l=e&&xB(e),u=t&&xB(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 xB(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 aY=new Map([["basis",FS],["basis-closed",CS],["basis-open",kS],["bundle",RS],["bump-x",DS],["bump-y",NS],["cardinal",$S],["cardinal-closed",US],["cardinal-open",PS],["catmull-rom",zS],["catmull-rom-closed",qS],["catmull-rom-open",VS],["linear",Ms],["linear-closed",jS],["monotone-x",WS],["monotone-y",GS],["natural",XS],["step",HS],["step-after",KS],["step-before",ZS]]);function wm(e=Ms,t){if(typeof e=="function")return e;let n=aY.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 K1(e=za,t){return typeof e!="function"&&`${e}`.toLowerCase()==="auto"?za:wm(e,t)}function za(e){return Ms(e)}function Lo(e={y:"count"},t={}){[e,t]=mM(e,t);let{x:n,y:r}=t;return pM(Q1(n,t,W),null,null,r,e,al(t))}function Fo(e={x:"count"},t={}){[e,t]=mM(e,t);let{x:n,y:r}=t;return pM(null,Q1(r,t,W),n,null,e,cl(t))}function $s(e={fill:"count"},t={}){[e,t]=mM(e,t);let{x:n,y:r}=cY(t);return pM(n,r,null,null,e,al(cl(t)))}function SB(e,t,n={}){if(n?.interval==null)return n;let{reduce:r=l1}=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 gf(e={}){return SB(Lo,"y",Li(e,"x"))}function bf(e={}){return SB(Fo,"x",Li(e,"y"))}function pM(e,t,n,r,{data:i=c1,filter:o=em,sort:s,reverse:a,...c}={},l={}){e=_B(e),t=_B(t),c=lY(c,l),i=AB(i,W),s=s==null?void 0:IB("sort",s,l),o=o==null?void 0:MB("filter",o,l),n!=null&&No(c,"x","x1","x2")&&(n=null),r!=null&&No(c,"y","y1","y2")&&(r=null);let[u,f]=En(e),[h,d]=En(e),[p,m]=En(t),[y,g]=En(t),[b,x]=n!=null?[n,"x"]:r!=null?[r,"y"]:[],[w,v]=En(b),{x:_,y:M,z:E,fill:I,stroke:N,x1:A,x2:B,y1:L,y2:S,domain:T,cumulative:D,thresholds:C,interval:k,...F}=l,[R,$]=En(E),[U]=Ee(I),[G]=Ee(N),[et,rt]=En(U),[st,j]=En(G);return{..."z"in l&&{z:R||E},..."fill"in l&&{fill:et||I},..."stroke"in l&&{stroke:st||N},...pn(F,(ot,z,H)=>{let nt=el(bt(ot,b),H?.[x]),P=bt(ot,E),Ot=bt(ot,U),ft=bt(ot,G),jt=im(c,{z:P,fill:Ot,stroke:ft}),Wt=[],J=[],ie=nt&&v([]),gr=P&&$([]),ki=Ot&&rt([]),rF=ft&&j([]),M3=e&&f([]),iF=e&&d([]),A3=t&&m([]),oF=t&&g([]),sF=hY(e,t,ot),aF=0;for(let _l of c)_l.initialize(ot);s&&s.initialize(ot),o&&o.initialize(ot);for(let _l of z){let T3=[];for(let vl of c)vl.scope("facet",_l);s&&s.scope("facet",_l),o&&o.scope("facet",_l);for(let[vl,cF]of Oa(_l,jt))for(let[lF,ey]of Oa(cF,nt))for(let[Ri,Po]of sF(ey))if(jt&&(Po.z=vl),!(o&&!o.reduce(Ri,Po))){T3.push(aF++),J.push(i.reduceIndex(Ri,ot,Po)),nt&&ie.push(lF),P&&gr.push(jt===P?vl:P[(Ri.length>0?Ri:ey)[0]]),Ot&&ki.push(jt===Ot?vl:Ot[(Ri.length>0?Ri:ey)[0]]),ft&&rF.push(jt===ft?vl:ft[(Ri.length>0?Ri:ey)[0]]),M3&&(M3.push(Po.x1),iF.push(Po.x2)),A3&&(A3.push(Po.y1),oF.push(Po.y2));for(let uF of c)uF.reduce(Ri,Po);s&&s.reduce(Ri,Po)}Wt.push(T3)}return AI(Wt,s,a),{data:J,facets:Wt}}),...!No(c,"x")&&(u?{x1:u,x2:h,x:Hu(u,h)}:{x:_,x1:A,x2:B}),...!No(c,"y")&&(p?{y1:p,y2:y,y:Hu(p,y)}:{y:M,y1:L,y2:S}),...w&&{[x]:w},...Object.fromEntries(c.map(({name:ot,output:z})=>[ot,z]))}}function mM({cumulative:e,domain:t,thresholds:n,interval:r,...i},o){return[i,{cumulative:e,domain:t,thresholds:n,interval:r,...o}]}function Q1(e,{cumulative:t,domain:n,thresholds:r,interval:i},o){return e={...si(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=yM(e.thresholds,e.interval),e}function cY(e){let{x:t,y:n}=e;return t=Q1(t,e),n=Q1(n,e),[t.value,n.value]=ke(t.value,n.value),{x:t,y:n}}function _B(e){if(e==null)return;let{value:t,cumulative:n,domain:r=se,thresholds:i}=e,o=s=>{let a=bt(s,t),c;if(De(a)||fY(i)){a=Vt(a,lI,Float64Array);let[u,f]=typeof r=="function"?r(a):r,h=typeof i=="function"&&!Na(i)?i(a,u,f):i;typeof h=="number"&&(h=Sp(u,f,h)),Na(h)&&(r===se&&(u=h.floor(u),f=h.offset(h.floor(f))),h=h.range(u,h.offset(f))),c=h}else{a=Ze(a);let[u,f]=typeof r=="function"?r(a):r,h=typeof i=="function"&&!Na(i)?i(a,u,f):i;if(typeof h=="number")if(r===se){let d=as(u,f,h);if(isFinite(d))if(d>0){let p=Math.round(u/d),m=Math.round(f/d);p*d<=u||--p,m*d>f||++m;let y=m-p+1;h=new Float64Array(y);for(let g=0;g<y;++g)h[g]=(p+g)*d}else if(d<0){d=-d;let p=Math.round(u*d),m=Math.round(f*d);p/d<=u||--p,m/d>f||++m;let y=m-p+1;h=new Float64Array(y);for(let g=0;g<y;++g)h[g]=(p+g)/d}else h=[u];else h=[u]}else h=Sn(u,f,h);else Na(h)&&(r===se&&(u=h.floor(u),f=h.offset(h.floor(f))),h=h.range(u,h.offset(f)));c=h}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?pY:n>0?dY:gM)(l,c,a),l};return o.label=Dn(t),o}function yM(e,t,n=vB){if(e===void 0)return t===void 0?n:Eo(t);if(typeof e=="string"){switch(e.toLowerCase()){case"freedman-diaconis":return V0;case"scott":return bd;case"sturges":return ca;case"auto":return vB}return Kp(e)}return e}function lY(e,t){return II(e,t,IB)}function IB(e,t,n){return s1(e,t,n,MB)}function MB(e,t,n){return a1(e,t,n,AB)}function AB(e,t){return Ju(e,t,uY)}function uY(e){switch(`${e}`.toLowerCase()){case"x":return mY;case"x1":return gY;case"x2":return bY;case"y":return yY;case"y1":return xY;case"y2":return wY;case"z":return TI}throw new Error(`invalid bin reduce: ${e}`)}function vB(e,t,n){return Math.min(200,bd(e,t,n))}function fY(e){return PD(e)||ir(e)&&De(e)}function hY(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,[h,d]]of i.entries())yield[u[f],{data:n,x1:c,y1:h,x2:l,y2:d}]}}: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 gM(e,t,n){return t=Ze(t),r=>{let i=e.map(()=>[]);for(let o of r)i[os(t,n[o])-1]?.push(o);return i}}function dY(e,t,n){let r=gM(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 pY(e,t,n){let r=gM(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 TB(e,t){let n=(+e+ +t)/2;return e instanceof Date?new Date(n):n}var mY={reduceIndex(e,t,{x1:n,x2:r}){return TB(n,r)}},yY={reduceIndex(e,t,{y1:n,y2:r}){return TB(n,r)}},gY={reduceIndex(e,t,{x1:n}){return n}},bY={reduceIndex(e,t,{x2:n}){return n}},xY={reduceIndex(e,t,{y1:n}){return n}},wY={reduceIndex(e,t,{y2:n}){return n}};function xf(e={}){return fI(e)?e:{...e,x:W}}function wf(e={}){return hI(e)?e:{...e,y:W}}function EB(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=Da(e);let o=e[sI]=new Uint32Array(n+i);t=t.map(a=>Da(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 bM(e={},t={}){arguments.length===1&&([e,t]=Sf(e));let{y1:n,y:r=n,x:i,...o}=t,[s,a,c,l]=If(r,i,"y","x",e,o);return{...s,y1:n,y:a,x1:c,x2:l,x:Hu(c,l)}}function BB(e={},t={}){arguments.length===1&&([e,t]=Sf(e));let{y1:n,y:r=n,x:i}=t,[o,s,a]=If(r,i,"y","x",e,t);return{...o,y1:n,y:s,x:a}}function OB(e={},t={}){arguments.length===1&&([e,t]=Sf(e));let{y1:n,y:r=n,x:i}=t,[o,s,,a]=If(r,i,"y","x",e,t);return{...o,y1:n,y:s,x:a}}function xM(e={},t={}){arguments.length===1&&([e,t]=Sf(e));let{x1:n,x:r=n,y:i,...o}=t,[s,a,c,l]=If(r,i,"x","y",e,o);return{...s,x1:n,x:a,y1:c,y2:l,y:Hu(c,l)}}function LB(e={},t={}){arguments.length===1&&([e,t]=Sf(e));let{x1:n,x:r=n,y:i}=t,[o,s,a]=If(r,i,"x","y",e,t);return{...o,x1:n,x:s,y:a}}function FB(e={},t={}){arguments.length===1&&([e,t]=Sf(e));let{x1:n,x:r=n,y:i}=t,[o,s,,a]=If(r,i,"x","y",e,t);return{...o,x1:n,x:s,y:a}}function _f({x:e,x1:t,x2:n,...r}={}){return r=Li(r,"y"),t===void 0&&n===void 0?bM({x:e,...r}):([t,n]=dI(e,t,n),{...r,x1:t,x2:n})}function vf({y:e,y1:t,y2:n,...r}={}){return r=Li(r,"x"),t===void 0&&n===void 0?xM({y:e,...r}):([t,n]=dI(e,t,n),{...r,y1:t,y2:n})}function Sf(e){let{offset:t,order:n,reverse:r,...i}=e;return[{offset:t,order:n,reverse:r},i]}var _Y={length:!0};function If(e,t=Qp,n,r,{offset:i,order:o,reverse:s},a){if(t===null)throw new Error(`stack requires ${r}`);let c=Un(a),[l,u]=En(e),[f,h]=dn(t),[d,p]=dn(t);return f.hint=d.hint=_Y,i=vY(i),o=MY(o,i,r),[pn(a,(m,y,g)=>{({data:m,facets:y}=EB(m,y));let b=e==null?void 0:u(el(bt(m,e),g?.[n])),x=bt(m,t,Float64Array),w=bt(m,c),v=o&&o(m,b,x,w),_=m.length,M=h(new Float64Array(_)),E=p(new Float64Array(_)),I=[];for(let N of y){let A=b?Array.from(sn(N,B=>b[B]).values()):[N];if(v)for(let B of A)B.sort(v);for(let B of A){let L=0,S=0;s&&B.reverse();for(let T of B){let D=x[T];D<0?L=E[T]=(M[T]=L)+D:D>0?S=E[T]=(M[T]=S)+D:E[T]=M[T]=S}}I.push(A)}return i&&i(I,M,E,w),{data:m,facets:y}}),l,f,d]}function vY(e){if(e!=null){if(typeof e=="function")return e;switch(`${e}`.toLowerCase()){case"expand":case"normalize":return SY;case"center":case"silhouette":return IY;case"wiggle":return kB}throw new Error(`unknown offset: ${e}`)}}function CB(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 SY(e,t,n){for(let r of e)for(let i of r){let[o,s]=CB(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 IY(e,t,n){for(let r of e){for(let i of r){let[o,s]=CB(i,n);for(let a of i){let c=(s+o)/2;t[a]-=c,n[a]-=c}}RB(r,t,n)}$B(e,t,n)}function kB(e,t,n,r){for(let i of e){let o=new Wn,s=0;for(let a of i){let c=-1,l=a.map(d=>Math.abs(n[d]-t[d])),u=a.map(d=>{c=r?r[d]:++c;let p=n[d]-t[d],m=o.has(c)?p-o.get(c):0;return o.set(c,p),m}),f=[0,...$0(u)];for(let d of a)t[d]+=s,n[d]+=s;let h=In(l);h&&(s-=In(l,(d,p)=>(u[p]/2+f[p])*d)/h)}RB(i,t,n)}$B(e,t,n)}function RB(e,t,n){let r=ae(e,i=>ae(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=>(ae(a,c=>t[c])+Yt(a,c=>n[c]))/2),s=ae(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 MY(e,t,n){if(e===void 0&&t===kB)return DB(un);if(e!=null){if(typeof e=="string"){let r=e.startsWith("-"),i=r?Kc:un;switch((r?e.slice(1):e).toLowerCase()){case"value":case n:return AY(i);case"z":return TY(i);case"sum":return EY(i);case"appearance":return DY(i);case"inside-out":return DB(i)}return NB(aI(e))}if(typeof e=="function")return(e.length===1?NB:NY)(e);if(Array.isArray(e))return BY(e);throw new Error(`invalid order: ${e}`)}}function AY(e){return(t,n,r)=>(i,o)=>e(r[i],r[o])}function TY(e){return(t,n,r,i)=>(o,s)=>e(i[o],i[s])}function EY(e){return J1(e,(t,n,r,i)=>Ql(rr(t),o=>In(o,s=>r[s]),o=>i[o]))}function DY(e){return J1(e,(t,n,r,i)=>Ql(rr(t),o=>n[Sc(o,s=>r[s])],o=>i[o]))}function DB(e){return J1(e,(t,n,r,i)=>{let o=rr(t),s=Ql(o,f=>n[Sc(f,h=>r[h])],f=>i[f]),a=Ai(o,f=>In(f,h=>r[h]),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 NB(e){return t=>{let n=bt(t,e);return(r,i)=>un(n[r],n[i])}}function NY(e){return t=>(n,r)=>e(t[n],t[r])}function BY(e){return J1(un,()=>e)}function J1(e,t){return(n,r,i,o)=>{if(!o)throw new Error("missing channel: z");let s=new Wn(t(n,r,i,o).map((a,c)=>[a,c]));return(a,c)=>e(s.get(o[a]),s.get(o[c]))}}var OY={ariaLabel:"area",strokeWidth:1,strokeLinecap:"round",strokeLinejoin:"round",strokeMiterlimit:1},dl=class extends _t{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,OY),this.z=a,this.curve=wm(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 lt("svg:g",o).call(Bt,this,i,o).call(Mt,this,n,0,0).call(u=>u.selectAll().data(_1(t,[s,a,c,l],this,r)).enter().append("path").call(Nt,this).call(ol,this,r).attr("d",Ru().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 _m(e,t){return t===void 0?Us(e,{x:tl,y:Ea}):new dl(e,t)}function qa(e,t){let{y:n=Ie,...r}=bf(t);return new dl(e,_f(xf({...r,y1:n,y2:void 0})))}function Us(e,t){let{x:n=Ie,...r}=gf(t);return new dl(e,vf(wf({...r,x1:n,x2:void 0})))}var LY={ariaLabel:"link",fill:"none",stroke:"currentColor",strokeMiterlimit:1},vm=class extends _t{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,LY),this.curve=K1(a,c),Fi(this,n)}project(t,n,r){this.curve!==za&&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 lt("svg:g",o).call(Bt,this,i,o).call(Mt,this,n).call(f=>f.selectAll().data(t).enter().append("path").call(Nt,this).attr("d",u===za&&o.projection?FY(o.projection,s,a,c,l):h=>{let d=Kn(),p=u(d);return p.lineStart(),p.point(s[h],a[h]),p.point(c[h],l[h]),p.lineEnd(),d}).call(Ht,this,r).call(Rs,this,r,o)).node()}};function FY(e,t,n,r,i){let o=An(e);return t=Ze(t),n=Ze(n),r=Ze(r),i=Ze(i),s=>o({type:"LineString",coordinates:[[t[s],n[s]],[r[s],i[s]]]})}function tw(e,{x:t,x1:n,x2:r,y:i,y1:o,y2:s,...a}={}){return[n,r]=Sm(t,n,r),[o,s]=Sm(i,o,s),new vm(e,{...a,x1:n,x2:r,y1:o,y2:s})}function Sm(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 CY={ariaLabel:"arrow",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeMiterlimit:1,strokeWidth:1.5},Im=class extends _t{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:h=u,sweep:d}=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,CY),this.bend=a===!0?22.5:Math.max(-90,Math.min(90,a)),this.headAngle=+c,this.headLength=+l,this.insetStart=+f,this.insetEnd=+h,this.sweep=kY(d)}render(t,n,r,i,o){let{x1:s,y1:a,x2:c=s,y2:l=a,SW:u}=r,{strokeWidth:f,bend:h,headAngle:d,headLength:p,insetStart:m,insetEnd:y}=this,g=u?w=>u[w]:fn(f===void 0?1:f),b=d*df/2,x=p/1.5;return lt("svg:g",o).call(Bt,this,i,o).call(Mt,this,n).call(w=>w.selectAll().data(t).enter().append("path").call(Nt,this).attr("d",v=>{let _=s[v],M=a[v],E=c[v],I=l[v],N=Math.hypot(E-_,I-M);if(N<=m+y)return null;let A=Math.atan2(I-M,E-_),B=Math.min(x*g(v),N/3),L=this.sweep(_,M,E,I)*h*df,S=Math.hypot(N/Math.tan(L),N)/2;if(m||y)if(S<1e5){let et=Math.sign(L),[rt,st]=RY([_,M],[E,I],S,et);if(m&&([_,M]=UB([rt,st,S],[_,M,m],-et*Math.sign(m))),y){let[j,ot]=UB([rt,st,S],[E,I,y],et*Math.sign(y));A+=Math.atan2(ot-st,j-rt)-Math.atan2(I-st,E-rt),E=j,I=ot}}else{let et=E-_,rt=I-M,st=Math.hypot(et,rt);m&&(_+=et/st*m,M+=rt/st*m),y&&(E-=et/st*y,I-=rt/st*y)}let T=A+L,D=T+b,C=T-b,k=E-B*Math.cos(D),F=I-B*Math.sin(D),R=E-B*Math.cos(C),$=I-B*Math.sin(C),U=S<1e5?`A${S},${S} 0,0,${L>0?1:0} `:"L",G=B?`M${k},${F}L${E},${I}L${R},${$}`:"";return`M${_},${M}${U}${E},${I}${G}`}).call(Ht,this,r)).node()}};function kY(e=1){if(typeof e=="number")return fn(Math.sign(e));if(typeof e=="function")return(t,n,r,i)=>Math.sign(e(t,n,r,i));switch(nn(e,"sweep",["+x","-x","+y","-y"])){case"+x":return(t,n,r)=>$t(t,r);case"-x":return(t,n,r)=>Yn(t,r);case"+y":return(t,n,r,i)=>$t(n,i);case"-y":return(t,n,r,i)=>Yn(n,i)}}function RY([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 UB([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 PB(e,{x:t,x1:n,x2:r,y:i,y1:o,y2:s,...a}={}){return[n,r]=Sm(t,n,r),[o,s]=Sm(i,o,s),new Im(e,{...a,x1:n,x2:r,y1:o,y2:s})}var Mf=class extends _t{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=Dt(s),this.insetRight=Dt(a),this.insetBottom=Dt(c),this.insetLeft=Dt(l),this.rx=ce(u,"auto"),this.ry=ce(f,"auto")}render(t,n,r,i,o){let{rx:s,ry:a}=this;return lt("svg:g",o).call(Bt,this,i,o).call(this._transform,this,n).call(c=>c.selectAll().data(t).enter().append("rect").call(Nt,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(ut,"rx",s).call(ut,"ry",a).call(Ht,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)}},zB={ariaLabel:"bar"},Mm=class extends Mf{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,zB)}_transform(t,n,{x:r}){t.call(Mt,n,{x:r},0,0)}_x({x:t},{x1:n,x2:r},{marginLeft:i}){let{insetLeft:o}=this;return or(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 or(t)?s-i-o-a-c:l=>Math.max(0,Math.abs(r[l]-n[l])-a-c)}},Am=class extends Mf{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,zB)}_transform(t,n,{y:r}){t.call(Mt,n,{y:r},0,0)}_y({y:t},{y1:n,y2:r},{marginTop:i}){let{insetTop:o}=this;return or(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 or(t)?s-i-o-a-c:l=>Math.max(0,Math.abs(r[l]-n[l])-a-c)}};function Co(e,t={}){return Gu(t)||(t={...t,y:Ie,x2:W}),new Mm(e,_f(E1(xf(t))))}function ko(e,t={}){return Gu(t)||(t={...t,x:Ie,y2:W}),new Am(e,vf(D1(wf(t))))}var $Y={ariaLabel:"cell"},pl=class extends Mf{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,$Y)}_transform(t,n){t.call(Mt,n,{},0,0)}};function Va(e,{x:t,y:n,...r}={}){return[t,n]=ke(t,n),new pl(e,{...r,x:t,y:n})}function qB(e,{x:t=Ie,fill:n,stroke:r,...i}={}){return n===void 0&&Ee(r)[0]===void 0&&(n=W),new pl(e,{...i,x:t,fill:n,stroke:r})}function VB(e,{y:t=Ie,fill:n,stroke:r,...i}={}){return n===void 0&&Ee(r)[0]===void 0&&(n=W),new pl(e,{...i,y:t,fill:n,stroke:r})}var UY={ariaLabel:"dot",fill:"none",stroke:"currentColor",strokeWidth:1.5};function Tm(e){return e.sort===void 0&&e.reverse===void 0?i1({channel:"-r"},e):e}var ml=class extends _t{constructor(t,n={}){let{x:r,y:i,r:o,rotate:s,symbol:a=As,frameAnchor:c}=n,[l,u]=re(s,0),[f,h]=QD(a),[d,p]=re(o,f==null?3:4.5);super(t,{x:{value:r,scale:"x",optional:!0},y:{value:i,scale:"y",optional:!0},r:{value:d,scale:"r",filter:nr,optional:!0},rotate:{value:l,optional:!0},symbol:{value:f,scale:"auto",optional:!0}},Tm(n),UY),this.r=p,this.rotate=u,this.symbol=h,this.frameAnchor=Do(c);let{channels:m}=this,{symbol:y}=m;if(y){let{fill:g,stroke:b}=m;y.hint={fill:g?g.value===y.value?"color":"currentColor":this.fill??"currentColor",stroke:b?b.value===y.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:h}=r,{r:d,rotate:p,symbol:m}=this,[y,g]=yn(this,i),b=m===As,x=u?void 0:d*d*Math.PI;return Sa(d)&&(t=[]),lt("svg:g",o).call(Bt,this,i,o).call(Mt,this,{x:c&&s,y:l&&a}).call(w=>w.selectAll().data(t).enter().append(b?"circle":"path").call(Nt,this).call(b?v=>{v.attr("cx",c?_=>c[_]:y).attr("cy",l?_=>l[_]:g).attr("r",u?_=>u[_]:d)}:v=>{v.attr("transform",Ua`translate(${c?_=>c[_]:y},${l?_=>l[_]:g})${f?_=>` rotate(${f[_]})`:p?` rotate(${p})`:""}`).attr("d",u&&h?_=>{let M=Kn();return h[_].draw(M,u[_]*u[_]*Math.PI),M}:u?_=>{let M=Kn();return m.draw(M,u[_]*u[_]*Math.PI),M}:h?_=>{let M=Kn();return h[_].draw(M,x),M}:(()=>{let _=Kn();return m.draw(_,x),_})())}).call(Ht,this,r)).node()}};function ci(e,{x:t,y:n,...r}={}){return r.frameAnchor===void 0&&([t,n]=ke(t,n)),new ml(e,{...r,x:t,y:n})}function jB(e,{x:t=W,...n}={}){return new ml(e,B1({...n,x:t}))}function YB(e,{y:t=W,...n}={}){return new ml(e,N1({...n,y:t}))}function WB(e,t){return ci(e,{...t,symbol:"circle"})}function GB(e,t){return ci(e,{...t,symbol:"hexagon"})}var PY={ariaLabel:"line",fill:"none",stroke:"currentColor",strokeWidth:1.5,strokeLinecap:"round",strokeLinejoin:"round",strokeMiterlimit:1},yl=class extends _t{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,PY),this.z=o,this.curve=K1(s,a),Fi(this,n)}filter(t){return t}project(t,n,r){this.curve!==za&&super.project(t,n,r)}render(t,n,r,i,o){let{x:s,y:a}=r,{curve:c}=this;return lt("svg:g",o).call(Bt,this,i,o).call(Mt,this,n).call(l=>l.selectAll().data(_1(t,[s,a],this,r)).enter().append("path").call(Nt,this).call(ol,this,r).call(IN,this,r,o).attr("d",c===za&&o.projection?zY(o.projection,s,a):Op().curve(c).defined(u=>u>=0).x(u=>s[u]).y(u=>a[u]))).node()}};function zY(e,t,n){let r=An(e);return t=Ze(t),n=Ze(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 gl(e,{x:t,y:n,...r}={}){return[t,n]=ke(t,n),new yl(e,{...r,x:t,y:n})}function ja(e,{x:t=W,y:n=Ie,...r}={}){return new yl(e,bf({...r,x:t,y:n}))}function Ya(e,{x:t=Ie,y:n=W,...r}={}){return new yl(e,gf({...r,x:t,y:n}))}var qY={ariaLabel:"rect"},bl=class extends _t{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:h,ry:d}=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,qY),this.insetTop=Dt(c),this.insetRight=Dt(l),this.insetBottom=Dt(u),this.insetLeft=Dt(f),this.rx=ce(h,"auto"),this.ry=ce(d,"auto")}render(t,n,r,i,o){let{x:s,y:a}=n,{x1:c,y1:l,x2:u,y2:f}=r,{marginTop:h,marginRight:d,marginBottom:p,marginLeft:m,width:y,height:g}=i,{projection:b}=o,{insetTop:x,insetRight:w,insetBottom:v,insetLeft:_,rx:M,ry:E}=this,I=(s?.bandwidth?s.bandwidth():0)-_-w,N=(a?.bandwidth?a.bandwidth():0)-x-v;return lt("svg:g",o).call(Bt,this,i,o).call(Mt,this,{},0,0).call(A=>A.selectAll().data(t).enter().append("rect").call(Nt,this).attr("x",c&&(b||!or(s))?u?B=>Math.min(c[B],u[B])+_:B=>c[B]+_:m+_).attr("y",l&&(b||!or(a))?f?B=>Math.min(l[B],f[B])+x:B=>l[B]+x:h+x).attr("width",c&&(b||!or(s))?u?B=>Math.max(0,Math.abs(u[B]-c[B])+I):I:y-d-m-w-_).attr("height",l&&(b||!or(a))?f?B=>Math.max(0,Math.abs(l[B]-f[B])+N):N:g-h-p-x-v).call(ut,"rx",M).call(ut,"ry",E).call(Ht,this,r)).node()}};function Em(e,t){return new bl(e,tM(eM(t)))}function Af(e,t={}){return Gu(t)||(t={...t,y:Ie,x2:W,interval:1}),new bl(e,_f(eM(xf(t))))}function Tf(e,t={}){return Gu(t)||(t={...t,x:Ie,y2:W,interval:1}),new bl(e,vf(tM(wf(t))))}function _M(e,t){t=VY(t);let{x:n,y:r,color:i,size:o}=t,s=ew(e,n),a=ew(e,r),c=ew(e,i),l=ew(e,o),{fx:u,fy:f,x:{value:h,reduce:d,zero:p,...m},y:{value:y,reduce:g,zero:b,...x},color:{value:w,color:v,reduce:_},size:{value:M,reduce:E},mark:I}=t;if(d===void 0&&(d=g==null&&h==null&&M==null&&y!=null?"count":null),g===void 0&&(g=d==null&&y==null&&M==null&&h!=null?"count":null),E===void 0&&M==null&&_==null&&d==null&&g==null&&(h==null||Me(s))&&(y==null||Me(a))&&(E="count"),p===void 0&&(p=nw(d)?!0:void 0),b===void 0&&(b=nw(g)?!0:void 0),h==null&&y==null)throw new Error("must specify x or y");if(d!=null&&y==null)throw new Error("reducing x requires y");if(g!=null&&h==null)throw new Error("reducing y requires x");I===void 0&&(I=M!=null||E!=null?"dot":nw(d)||nw(g)||_!=null?"bar":h!=null&&y!=null?Me(s)||Me(a)||d==null&&g==null&&!Dm(s)&&!Dm(a)?"dot":"line":h!=null||y!=null?"rule":null);let N,A,B;switch(I){case"dot":B=ci,A="stroke";break;case"line":B=s&&a||d!=null||g!=null?b||g!=null||s&&Dm(s)?Ya:p||d!=null||a&&Dm(a)?ja:gl:s?ja:Ya,A="stroke",HB(c)&&(N=null);break;case"area":B=!(b||g!=null)&&(p||d!=null||a&&Dm(a))?qa:Us,A="fill",HB(c)&&(N=null);break;case"rule":B=s?Cr:kr,A="stroke";break;case"bar":B=d!=null?Me(a)?XB(d)&&s&&Me(s)?Va:Co:Af:g!=null?Me(s)?XB(g)&&a&&Me(a)?Va:ko:Tf:_!=null||E!=null?s&&Me(s)&&a&&Me(a)?Va:s&&Me(s)?ko:a&&Me(a)?Co:Em:s&&Bs(s)&&!(a&&Bs(a))?Co:a&&Bs(a)&&!(s&&Bs(s))?ko:Va,A="fill";break;default:throw new Error(`invalid mark: ${I}`)}let L={fx:u,fy:f,x:s??void 0,y:a??void 0,[A]:c??v,z:N,r:l??void 0,tip:!0},S,T={[A]:_??void 0,r:E??void 0};if(d!=null&&g!=null)throw new Error("cannot reduce both x and y");return g!=null?(T.y=g,S=Me(s)?La:Lo):d!=null?(T.x=d,S=Me(a)?Fa:Fo):(_!=null||E!=null)&&(s&&a?S=Me(s)&&Me(a)?rm:Me(s)?Fo:Me(a)?Lo:$s:s?S=Me(s)?La:Lo:a&&(S=Me(a)?Fa:Fo)),(S===$s||S===Lo)&&(L.x={value:s,...m}),(S===$s||S===Fo)&&(L.y={value:a,...x}),p===void 0&&(p=s&&!(S===$s||S===Lo)&&(B===Co||B===qa||B===Af||B===kr)),b===void 0&&(b=a&&!(S===$s||S===Fo)&&(B===ko||B===Us||B===Tf||B===Cr)),{fx:u??null,fy:f??null,x:{value:h??null,reduce:d??null,zero:!!p,...m},y:{value:y??null,reduce:g??null,zero:!!b,...x},color:{value:w??null,reduce:_??null,...v!==void 0&&{color:v}},size:{value:M??null,reduce:E??null},mark:I,markImpl:ZB[B],markOptions:L,transformImpl:ZB[S],transformOptions:T,colorMode:A}}function KB(e,t){let n=_M(e,t),{fx:r,fy:i,x:{zero:o},y:{zero:s},markOptions:a,transformOptions:c,colorMode:l}=n,u=wM[n.markImpl],f=wM[n.transformImpl],h=r!=null||i!=null?yf({strokeOpacity:.1}):null,d=[o?Cr([0]):null,s?kr([0]):null],p=u(e,f?f(c,a):a);return l==="stroke"?Ke(h,d,p):Ke(h,p,d)}function Dm(e){let t,n;for(let r of e){if(r==null)continue;if(t===void 0){t=r;continue}let i=Math.sign($t(t,r));if(i){if(n!==void 0&&i!==n)return!1;t=r,n=i}}return!0}function VY({x:e,y:t,color:n,size:r,fx:i,fy:o,mark:s}={}){return Lr(e)||(e=Ef(e)),Lr(t)||(t=Ef(t)),Lr(n)||(n=Ba(n)?{color:n}:Ef(n)),Lr(r)||(r=Ef(r)),Lr(i)&&({value:i}=Ef(i)),Lr(o)&&({value:o}=Ef(o)),s!=null&&(s=`${s}`.toLowerCase()),{x:e,y:t,color:n,size:r,fx:i,fy:o,mark:s}}function ew(e,t){let n=bt(e,t.value);return n&&(n.label=Dn(t.value)),n}function Ef(e){return jY(e)?{reduce:e}:{value:e}}function nw(e){return/^(?:distinct|count|sum|proportion)$/i.test(e)}function XB(e){return/^(?:first|last|mode)$/i.test(e)}function jY(e){if(e==null)return!1;if(typeof e.reduceIndex=="function"||typeof e.reduce=="function"&&hn(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 HB(e){return e?new Gn(e).size>e.length>>1:!1}var wM={dot:ci,line:gl,lineX:ja,lineY:Ya,areaX:qa,areaY:Us,ruleX:Cr,ruleY:kr,barX:Co,barY:ko,rect:Em,rectX:Af,rectY:Tf,cell:Va,bin:$s,binX:Lo,binY:Fo,group:rm,groupX:La,groupY:Fa},ZB=Object.fromEntries(Object.entries(wM).map(([e,t])=>[t,e]));function Df(e,t={}){let{x:n,x1:r,x2:i}=t;n===void 0&&r===void 0&&i===void 0&&(t={...t,x:n=W});let o={};return n!=null&&(o.x=e),r!=null&&(o.x1=e),i!=null&&(o.x2=e),yr(o,t)}function Nf(e,t={}){let{y:n,y1:r,y2:i}=t;n===void 0&&r===void 0&&i===void 0&&(t={...t,y:n=W});let o={};return n!=null&&(o.y=e),r!=null&&(o.y1=e),i!=null&&(o.y2=e),yr(o,t)}function yr(e={},t={}){let n=Un(t),r=Object.entries(e).map(([i,o])=>{let s=Qx(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:YY(o)}});return{...pn(t,(i,o)=>{let s=bt(i,n),a=r.map(({input:l})=>bt(i,l)),c=r.map(({setOutput:l})=>l(new Array(i.length)));for(let l of o)for(let u of s?sn(l,f=>s[f]).values():[l])r.forEach(({map:f},h)=>f.mapIndex(u,a[h],c[h]));return{data:i,facets:o}}),...Object.fromEntries(r.map(({key:i,output:o})=>[i,o]))}}function YY(e){if(e==null)throw new Error("missing map");if(typeof e.mapIndex=="function")return e;if(typeof e.map=="function"&&hn(e))return WY(e);if(typeof e=="function")return vM(Xu(e));switch(`${e}`.toLowerCase()){case"cumsum":return XY;case"rank":return vM((t,n)=>xd(t,r=>n[r]));case"quantile":return vM((t,n)=>GY(t,r=>n[r]))}throw new Error(`invalid map: ${e}`)}function WY(e){return console.warn("deprecated map interface; implement mapIndex instead."),{mapIndex:e.map.bind(e)}}function GY(e,t){let n=oo(e,t)-1;return xd(e,t).map(r=>r/n)}function vM(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 XY={mapIndex(e,t,n){let r=0;for(let i of e)n[i]=r+=t[i]}};function QB(e={},t){return arguments.length===1&&(t=e),Df(Bf(e),t)}function JB(e={},t){return arguments.length===1&&(t=e),Nf(Bf(e),t)}function Bf(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=ZY(r),Pn(`Warning: the shift option is deprecated; please use anchor "${i}" instead.`)),!((t=Math.floor(t))>0))throw new Error(`invalid k: ${t}`);return KY(n)(t,HY(i,t),o)}function HY(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 ZY(e){switch(`${e}`.toLowerCase()){case"centered":return"middle";case"leading":return"start";case"trailing":return"end"}throw new Error(`invalid shift: ${e}`)}function KY(e="mean"){if(typeof e=="string"){if(/^p\d{2}$/i.test(e))return rw(Wu(e));switch(e.toLowerCase()){case"deviation":return rw(Hr);case"max":return iw((t,n)=>Yt(t,r=>n[r]));case"mean":return QY;case"median":return rw(Ti);case"min":return iw((t,n)=>ae(t,r=>n[r]));case"mode":return iw((t,n)=>nu(t,r=>n[r]));case"sum":return tO;case"variance":return rw(aa);case"difference":return eW;case"ratio":return nW;case"first":return rW;case"last":return iW}}if(typeof e!="function")throw new Error(`invalid reduce: ${e}`);return iw(Xu(e))}function rw(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(Ds(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(Ds(i,0,c+t),a);for(let c=0,l=i.length-n;c<l;++c)s[i[c+n]]=e(Ds(i,c,c+t),a)}}}function iw(e){return(t,n,r)=>r?{mapIndex(i,o,s){let a=0;for(let c=0;c<t-1;++c)a+=$e(o[i[c]]);for(let c=0,l=i.length-t+1;c<l;++c)a+=$e(o[i[c+t-1]]),a===t&&(s[i[c+n]]=e(Ds(i,c,c+t),o)),a-=$e(o[i[c]])}}:{mapIndex(i,o,s){for(let a=-n;a<0;++a)s[i[a+n]]=e(Ds(i,0,a+t),o);for(let a=0,c=i.length-n;a<c;++a)s[i[a+n]]=e(Ds(i,a,a+t),o)}}}function tO(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 QY(e,t,n){if(n){let r=tO(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]],h=i[r[l]];f!==null&&!isNaN(f=+f)&&(s+=f,++a),o[r[l+t]]=s/a,h!==null&&!isNaN(h=+h)&&(s-=h,--a)}}}}function JY(e,t,n,r){for(let i=n+r;n<i;++n){let o=e[t[n]];if($e(o))return o}}function tW(e,t,n,r){for(let i=n+r-1;i>=n;--i){let o=e[t[i]];if($e(o))return o}}function eO(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 nO(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 eW(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]]=nO(i,r,s,e)-eO(i,r,s,e)}}}function nW(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]]=nO(i,r,s,e)/eO(i,r,s,e)}}}function rW(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]]=JY(i,r,s,e)}}}function iW(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]]=tW(i,r,s,e)}}}var Ps={n:20,k:2,color:"currentColor",opacity:.2,strict:!0,anchor:"end"};function rO(e,{x:t=W,y:n,k:r=Ps.k,color:i=Ps.color,opacity:o=Ps.opacity,fill:s=i,fillOpacity:a=o,stroke:c=i,strokeOpacity:l,strokeWidth:u,...f}={}){return Ke(te(s)?null:qa(e,yr({x1:Wa({k:-r,...f}),x2:Wa({k:r,...f})},{x1:t,x2:t,y:n,fill:s,fillOpacity:a,...f})),te(c)?null:ja(e,yr({x:Wa(f)},{x:t,y:n,stroke:c,strokeOpacity:l,strokeWidth:u,...f})))}function iO(e,{x:t,y:n=W,k:r=Ps.k,color:i=Ps.color,opacity:o=Ps.opacity,fill:s=i,fillOpacity:a=o,stroke:c=i,strokeOpacity:l,strokeWidth:u,...f}={}){return Ke(te(s)?null:Us(e,yr({y1:Wa({k:-r,...f}),y2:Wa({k:r,...f})},{x:t,y1:n,y2:n,fill:s,fillOpacity:a,...f})),te(c)?null:Ya(e,yr({y:Wa(f)},{x:t,y:n,stroke:c,strokeOpacity:l,strokeWidth:u,...f})))}function Wa({n:e=Ps.n,k:t=0,strict:n=Ps.strict,anchor:r=Ps.anchor}={}){return Bf({k:e,reduce:i=>cs(i)+t*(Hr(i)||0),strict:n,anchor:r})}var oW={ariaLabel:"tick",fill:null,stroke:"currentColor"},ow=class extends _t{constructor(t,n,r){super(t,n,r,oW),Fi(this,r)}render(t,n,r,i,o){return lt("svg:g",o).call(Bt,this,i,o).call(this._transform,this,n).call(s=>s.selectAll().data(t).enter().append("line").call(Nt,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(Ht,this,r).call(Rs,this,r,o)).node()}},Nm=class extends ow{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=Dt(s),this.insetBottom=Dt(a)}_transform(t,n,{x:r}){t.call(Mt,n,{x:r},Ne,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}},Bm=class extends ow{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=Dt(s),this.insetLeft=Dt(a)}_transform(t,n,{y:r}){t.call(Mt,n,{y:r},0,Ne)}_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 sw(e,{x:t=W,...n}={}){return new Nm(e,{...n,x:t})}function aw(e,{y:t=W,...n}={}){return new Bm(e,{...n,y:t})}function oO(e,{x:t=W,y:n=null,fill:r="#ccc",fillOpacity:i,stroke:o="currentColor",strokeOpacity:s,strokeWidth:a=2,sort:c,...l}={}){let u=n!=null?Fa:nm;return Ke(kr(e,u({x1:SM,x2:IM},{x:t,y:n,stroke:o,strokeOpacity:s,...l})),Co(e,u({x1:"p25",x2:"p75"},{x:t,y:n,fill:r,fillOpacity:i,...l})),sw(e,u({x:"p50"},{x:t,y:n,stroke:o,strokeOpacity:s,strokeWidth:a,sort:c,...l})),ci(e,yr({x:aO},{x:t,y:n,z:n,stroke:o,strokeOpacity:s,...l})))}function sO(e,{y:t=W,x:n=null,fill:r="#ccc",fillOpacity:i,stroke:o="currentColor",strokeOpacity:s,strokeWidth:a=2,sort:c,...l}={}){let u=n!=null?La:nm;return Ke(Cr(e,u({y1:SM,y2:IM},{x:n,y:t,stroke:o,strokeOpacity:s,...l})),ko(e,u({y1:"p25",y2:"p75"},{x:n,y:t,fill:r,fillOpacity:i,...l})),aw(e,u({y:"p50"},{x:n,y:t,stroke:o,strokeOpacity:s,strokeWidth:a,sort:c,...l})),ci(e,yr({y:aO},{x:n,y:t,z:n,stroke:o,strokeOpacity:s,...l})))}function aO(e){let t=SM(e),n=IM(e);return e.map(r=>r<t||r>n?r:NaN)}function SM(e){let t=cO(e)*2.5-lO(e)*1.5;return ae(e,n=>n>=t?n:NaN)}function IM(e){let t=lO(e)*2.5-cO(e)*1.5;return Yt(e,n=>n<=t?n:NaN)}function cO(e){return Xn(e,.25)}function lO(e){return Xn(e,.75)}var sW={ariaLabel:"raster",stroke:null,pixelSize:1};function Of(e,t){let n=+e;if(isNaN(n))throw new Error(`invalid ${t}: ${e}`);return n}function uO(e,t){let n=Math.floor(e);if(isNaN(n))throw new Error(`invalid ${t}: ${e}`);return n}var Lm=class extends _t{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:h=c==null?s:void 0,pixelSize:d=i.pixelSize,blur:p=0,interpolate:m}=r;if(o!=null&&(o=uO(o,"width")),s!=null&&(s=uO(s,"height")),l!=null&&(l=Of(l,"x1")),u!=null&&(u=Of(u,"y1")),f!=null&&(f=Of(f,"x2")),h!=null&&(h=Of(h,"y2")),a==null&&(l==null||f==null))throw new Error("missing x");if(c==null&&(u==null||h==null))throw new Error("missing y");t!=null&&o!=null&&s!=null&&(a===void 0&&l!=null&&f!=null&&(a=pW(l,f,o,s)),c===void 0&&u!=null&&h!=null&&(c=mW(u,h,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:h==null?null:[h],scale:"y",optional:!0,filter:null},...n},r,i),this.width=o,this.height=s,this.pixelSize=Of(d,"pixelSize"),this.blur=Of(p,"blur"),this.interpolate=a==null||c==null?null:aW(m)}},Fm=class extends Lm{constructor(t,n={}){let{imageRendering:r}=n;if(t==null){let{fill:i,fillOpacity:o}=n;re(o)[0]!==void 0&&(n=cw("fillOpacity",n)),Ee(i)[0]!==void 0&&(n=cw("fill",n))}super(t,void 0,n,sW),this.imageRendering=ce(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]??(T=>T),{x:a,y:c}=r,{document:l}=o,[u,f,h,d]=hO(r,i,o),p=h-u,m=d-f,{pixelSize:y,width:g=Math.round(Math.abs(p)/y),height:b=Math.round(Math.abs(m)/y)}=this,x=g*b,{fill:w,fillOpacity:v}=r,_=0;if(this.interpolate){let T=g/p,D=b/m,C=Vt(a,F=>(F-u)*T,Float64Array),k=Vt(c,F=>(F-f)*D,Float64Array);w&&(w=this.interpolate(t,g,b,C,k,w)),v&&(v=this.interpolate(t,g,b,C,k,v))}else this.data==null&&t&&(_=t.fi*x);let M=l.createElement("canvas");M.width=g,M.height=b;let E=M.getContext("2d"),I=E.createImageData(g,b),N=I.data,{r:A,g:B,b:L}=tn(this.fill)??{r:0,g:0,b:0},S=(this.fillOpacity??1)*255;for(let T=0;T<x;++T){let D=T<<2;if(w){let C=s(w[T+_]);if(C==null){N[D+3]=0;continue}({r:A,g:B,b:L}=tn(C))}v&&(S=v[T+_]*255),N[D+0]=A,N[D+1]=B,N[D+2]=L,N[D+3]=S}return this.blur>0&&tv(I,this.blur),E.putImageData(I,0,0),lt("svg:g",o).call(Bt,this,i,o).call(Mt,this,n).call(T=>T.append("image").attr("transform",`translate(${u},${f}) scale(${Math.sign(h-u)},${Math.sign(d-f)})`).attr("width",Math.abs(p)).attr("height",Math.abs(m)).attr("preserveAspectRatio","none").call(ut,"image-rendering",this.imageRendering).call(Nt,this).attr("xlink:href",M.toDataURL())).node()}};function MM(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&&qD(t)&&(r=tl,i=Ea,o===void 0&&(o=RD)),[t,{...s,x:r,y:i,[e]:o}]}function fO(){let[e,t]=MM("fill",...arguments);return new Fm(e,e==null||t.fill!==void 0||t.fillOpacity!==void 0?t:{...t,fill:W})}function hO({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 AM({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),hO(ef(a,i),o,s)}function cw(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,h,d,p]=AM(o,s,a,c),m=d-f,y=p-h,{pixelSize:g}=this,{width:b=Math.round(Math.abs(m)/g),height:x=Math.round(Math.abs(y)/g)}=t,w=new Array(b*x*(i?i.length:1)),v=m/b,_=y/x,M=0;for(let E of i??[void 0])for(let I=.5;I<x;++I)for(let N=.5;N<b;++N,++M)w[M]=n(l.invert(f+N*v),u.invert(h+I*_),E);return{data:w,facets:i,channels:{[e]:{value:w,scale:"auto"}}}})}function aW(e){if(typeof e=="function")return e;if(e==null)return lw;switch(`${e}`.toLowerCase()){case"none":return lw;case"nearest":return km;case"barycentric":return Cm();case"random-walk":return Rm()}throw new Error(`invalid interpolate: ${e}`)}function lw(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 Cm({random:e=zc(42)}={}){return(t,n,r,i,o,s)=>{let{points:a,triangles:c,hull:l}=Jr.from(t,d=>i[d],d=>o[d]),u=new s.constructor(n*r).fill(NaN),f=new Uint8Array(n*r),h=dW(s,e);for(let d=0;d<c.length;d+=3){let p=c[d],m=c[d+1],y=c[d+2],g=a[2*p],b=a[2*m],x=a[2*y],w=a[2*p+1],v=a[2*m+1],_=a[2*y+1],M=Math.min(g,b,x),E=Math.max(g,b,x),I=Math.min(w,v,_),N=Math.max(w,v,_),A=(v-_)*(g-x)+(w-_)*(x-b);if(!A)continue;let B=s[t[p]],L=s[t[m]],S=s[t[y]];for(let T=Math.floor(M);T<E;++T)for(let D=Math.floor(I);D<N;++D){if(T<0||T>=n||D<0||D>=r)continue;let C=T+.5,k=D+.5,F=((v-_)*(C-x)+(k-_)*(x-b))/A;if(F<0)continue;let R=((_-w)*(C-x)+(k-_)*(g-x))/A;if(R<0)continue;let $=1-F-R;if($<0)continue;let U=T+n*D;u[U]=h(B,F,L,R,S,$,T,D),f[U]=1}}return cW(u,f,i,o,s,n,r,l,t,h),u}}function cW(e,t,n,r,i,o,s,a,c,l){n=Float64Array.from(a,d=>n[c[d]]),r=Float64Array.from(a,d=>r[c[d]]),i=Array.from(a,d=>i[c[d]]);let u=n.length,f=Array.from({length:u},(d,p)=>uW(p,n,r)),h=0;for(let d=0;d<s;++d){let p=d+.5;for(let m=0;m<o;++m){let y=m+o*d;if(!t[y]){let g=m+.5;for(let b=0;b<u;++b){let x=(u+h+(b%2?(b+1)/2:-b/2))%u;if(f[x](g,p)){let w=lW(n.at(x-1),r.at(x-1),n[x],r[x],g,p);e[y]=l(i.at(x-1),w,i[x],1-w,i[x],0,m,d),h=x;break}}}}}}function lW(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 Om(e,t,n,r){return e*r-n*t}function uW(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),h=s-c,d=a-l,p=i-s,m=o-a,y=c-u,g=l-f,b=Math.hypot(h,d),x=Math.hypot(p,m),w=Math.hypot(y,g);return(v,_)=>{let M=v-s,E=_-a,I=v-c,N=_-l;return Om(M,E,I,N)>-1e-6&&Om(M,E,h,d)*x-Om(M,E,p,m)*b>-1e-6&&Om(I,N,y,g)*b-Om(I,N,h,d)*w<=0}}function km(e,t,n,r,i,o){let s=new o.constructor(t*n),a=Jr.from(e,u=>r[u],u=>i[u]),c,l;for(let u=.5,f=0;u<n;++u){l=c;for(let h=.5;h<t;++h,++f)l=a.find(h,u,l),h===.5&&(c=l),s[f]=o[e[l]]}return s}function Rm({random:e=zc(42),minDistance:t=.5,maxSteps:n=2}={}){return(r,i,o,s,a,c)=>{let l=new c.constructor(i*o),u=Jr.from(r,p=>s[p],p=>a[p]),f,h,d;for(let p=.5,m=0;p<o;++p){h=f;for(let y=.5;y<i;++y,++m){let g=y,b=p;d=h=u.find(g,b,h),y===.5&&(f=h);let x,w=0;for(;(x=Math.hypot(s[r[d]]-g,a[r[d]]-b))>t&&w<n;){let v=e(y,p,w)*2*Math.PI;g+=Math.cos(v)*x,b+=Math.sin(v)*x,d=u.find(g,b,d),++w}l[m]=c[r[d]]}}return l}}function fW(e,t,n,r,i,o){return t*e+r*n+o*i}function hW(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 dW(e,t){return Bs(e)||De(e)?fW:hW(t)}function pW(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 mW(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 dO={ariaLabel:"contour",fill:"none",stroke:"currentColor",strokeMiterlimit:1,pixelSize:2},$m=class extends Lm{constructor(t,{smooth:n=!0,value:r,...i}={}){let o=w1({},i,dO);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:Dn(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=cw("value",{value:r,...i}),r=null}else{let{interpolate:a}=i;r===void 0&&(r=W),a===void 0&&(i.interpolate="nearest")}super(t,{value:{value:r,optional:!0}},yW(i),dO);let s={geometry:{value:W}};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=An();return lt("svg:g",o).call(Bt,this,i,o).call(Mt,this,n).call(c=>{c.selectAll().data(t).enter().append("path").call(Nt,this).attr("d",l=>a(s[l])).call(Ht,this,r)}).node()}};function yW({thresholds:e,interval:t,...n}){return e=yM(e,t,ca),_e(n,function(r,i,o,s,a,c){let[l,u,f,h]=AM(o,s,a,c),d=f-l,p=h-u,{pixelSize:m,width:y=Math.round(Math.abs(d)/m),height:g=Math.round(Math.abs(p)/m)}=this,b=y/d,x=g/p,w=o.value.value,v=[];if(this.interpolate){let{x:N,y:A}=ka(o,s,c),B=Vt(N,D=>(D-l)*b,Float64Array),L=Vt(A,D=>(D-u)*x,Float64Array),S=[o.x,o.y,o.value],T=[B,L,w];for(let D of i){let C=this.filter(D,S,T);v.push(this.interpolate(C,y,g,B,L,w))}}else if(i){let N=y*g,A=i.length;for(let B=0;B<A;++B)v.push(w.slice(B*N,B*N+N))}else v.push(w);if(this.blur>0)for(let N of v)pd({data:N,width:y,height:g},this.blur);let _=gW(e,w,...bW(v));if(_===null)throw new Error(`unsupported thresholds: ${e}`);let{contour:M}=ma().size([y,g]).smooth(this.smooth),E=[],I=[];for(let N of v)I.push(Re(E.length,E.push(...Vt(_,A=>M(N,A)))));for(let{coordinates:N}of E)for(let A of N)for(let B of A)for(let L of B)L[0]=L[0]/b+l,L[1]=L[1]/x+u;return{data:E,facets:I,channels:u1(this.contourChannels,E)}})}function gW(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 Pe(e);let i=Sn(...tu(n,r,e),e);for(;i[i.length-1]>=r;)i.pop();for(;i[1]<n;)i.shift();return i}function mO(){return new $m(...MM("value",...arguments))}function bW(e){return[ae(e,t=>ae(t,pO)),Yt(e,t=>Yt(t,pO))]}function pO(e){return isFinite(e)?e:NaN}function bO(e,t){return TM(ff,e,t)}function xO(e,t={}){return TM(hf,e,t)}function wO(e,t={}){return TM(sl,e,t)}function TM(e,t,n={}){let{x:r,y:i,maxRadius:o}=n,s=e({px:r,py:i,maxRadius:o}),a=[];r!=null&&a.push(Cr(t,yO("x",{...s,inset:-6},n))),i!=null&&a.push(kr(t,yO("y",{...s,inset:-6},n))),r!=null&&a.push(Oo(t,gO("x",{...s,dy:9,frameAnchor:"bottom",lineAnchor:"top"},n))),i!=null&&a.push(Oo(t,gO("y",{...s,dx:-9,frameAnchor:"left",textAnchor:"end"},n)));for(let c of a)c.ariaLabel=`crosshair ${c.ariaLabel}`;return Ke(...a)}function _O(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:xW(e,u)}}function xW(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,...h}={},...d}=t.call(this,n,r,{...c,x:s,y:a},...l);return{channels:{...h,...u&&{px:u,...e==="x"&&{x:u}},...f&&{py:f,...e==="y"&&{y:f}}},...d}}}function yO(e,t,n){let{color:r="currentColor",opacity:i=.2,ruleStroke:o=r,ruleStrokeOpacity:s=i,ruleStrokeWidth:a}=n;return{..._O(e,t,n),stroke:o,strokeOpacity:s,strokeWidth:a}}function gO(e,t,n){let{color:r="currentColor",textFill:i=r,textFillOpacity:o,textStroke:s="var(--plot-background)",textStrokeOpacity:a,textStrokeWidth:c=5}=n;return{..._O(e,t,wW(e,n)),fill:i,fillOpacity:o,stroke:s,strokeOpacity:a,strokeWidth:c}}function wW(e,t){return _e(t,(n,r,i)=>({channels:{text:{value:om(i,e)?.value}}}))}var _W={ariaLabel:"delaunay link",fill:"none",stroke:"currentColor",strokeMiterlimit:1},vW={ariaLabel:"delaunay mesh",fill:null,stroke:"currentColor",strokeOpacity:.2},SW={ariaLabel:"hull",fill:"none",stroke:"currentColor",strokeWidth:1.5,strokeMiterlimit:1},IW={ariaLabel:"voronoi",fill:"none",stroke:"currentColor",strokeMiterlimit:1},MW={ariaLabel:"voronoi mesh",fill:null,stroke:"currentColor",strokeOpacity:.2},EM=class extends _t{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,_W),this.curve=wm(s,a),Fi(this,n)}render(t,n,r,i,o){let{x:s,y:a}=n,{x:c,y:l,z:u}=r,{curve:f}=this,[h,d]=yn(this,i),p=c?b=>c[b]:fn(h),m=l?b=>l[b]:fn(d),y=this;function g(b){let x=-1,w=[],v={};for(let S in r)v[S]=[];let _=[],M=[],E=[],I=[];function N(S,T){S=b[S],T=b[T],w.push(++x),_[x]=p(S),E[x]=m(S),M[x]=p(T),I[x]=m(T);for(let D in r)v[D].push(r[D][T])}let{halfedges:A,hull:B,triangles:L}=Jr.from(b,p,m);for(let S=0;S<A.length;++S){let T=A[S];T>S&&N(L[S],L[T])}for(let S=0;S<B.length;++S)N(B[S],B[(S+1)%B.length]);Pt(this).selectAll().data(w).enter().append("path").call(Nt,y).attr("d",S=>{let T=Kn(),D=f(T);return D.lineStart(),D.point(_[S],E[S]),D.point(M[S],I[S]),D.lineEnd(),T}).call(Ht,y,v).call(Rs,y,v,o)}return lt("svg:g",o).call(Bt,this,i,o).call(Mt,this,{x:c&&s,y:l&&a}).call(u?b=>b.selectAll().data(sn(t,x=>u[x]).values()).enter().append("g").each(g):b=>b.datum(t).each(g)).node()}},Um=class extends _t{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,h]=yn(this,i),d=c?g=>c[g]:fn(f),p=l?g=>l[g]:fn(h),m=this;function y(g){let b=Jr.from(g,d,p);Pt(this).append("path").datum(g[0]).call(Nt,m).attr("d",m._render(b,i)).call(Ht,m,r)}return lt("svg:g",o).call(Bt,this,i,o).call(Mt,this,{x:c&&s,y:l&&a}).call(u?g=>g.selectAll().data(sn(t,b=>u[b]).values()).enter().append("g").each(y):g=>g.datum(t).each(y)).node()}},DM=class extends Um{constructor(t,n={}){super(t,n,vW),this.fill="none"}_render(t){return t.render()}},NM=class extends Um{constructor(t,n={}){super(t,n,SW,Un)}_render(t){return t.renderHull()}},BM=class extends _t{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,IW)}render(t,n,r,i,o){let{x:s,y:a}=n,{x:c,y:l,z:u}=r,[f,h]=yn(this,i),d=c?g=>c[g]:fn(f),p=l?g=>l[g]:fn(h),m=this;function y(g){let b=Jr.from(g,d,p),x=vO(b,i);Pt(this).selectAll().data(g).enter().append("path").call(Nt,m).attr("d",(w,v)=>x.renderCell(v)).call(Ht,m,r)}return lt("svg:g",o).call(Bt,this,i,o).call(Mt,this,{x:c&&s,y:l&&a}).call(u?g=>g.selectAll().data(sn(t,b=>u[b]).values()).enter().append("g").each(y):g=>g.datum(t).each(y)).node()}},OM=class extends Um{constructor(t,n){super(t,n,MW),this.fill="none"}_render(t,n){return vO(t,n).render()}};function vO(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 Pm(e,t,{x:n,y:r,...i}={}){return[n,r]=ke(n,r),new e(t,{...i,x:n,y:r})}function SO(e,t){return Pm(EM,e,t)}function IO(e,t){return Pm(DM,e,t)}function MO(e,t){return Pm(NM,e,t)}function AO(e,t){return Pm(BM,e,t)}function TO(e,t){return Pm(OM,e,t)}var AW={ariaLabel:"density",fill:"none",stroke:"currentColor",strokeMiterlimit:1},zm=class extends _t{constructor(t,{x:n,y:r,z:i,weight:o,fill:s,stroke:a,...c}={}){let l=EO(s)&&(s="currentColor",!0),u=EO(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}},EW({...c,fill:s,stroke:a},l,u),AW),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=An();return lt("svg:g",o).call(Bt,this,i,o).call(Mt,this,{}).call(c=>c.selectAll().data(t).enter().append("path").call(Nt,this).call(Ht,this,r).attr("d",l=>a(s[l]))).node()}};function DO(e,{x:t,y:n,...r}={}){return[t,n]=ke(t,n),new zm(e,{...r,x:t,y:n})}var TW=new Set(["x","y","z","weight"]);function EW(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"?Ze(o):+o,_e(e,function(s,a,c,l,u,f){let h=c.weight?Ze(c.weight.value):null,d=c.z?.value,{z:p}=this,[m,y]=yn(this,u),{width:g,height:b}=u,{x,y:w}=ka(c,l,f),v=Object.fromEntries(Object.entries(c).filter(([L])=>!TW.has(L)).map(([L,S])=>[L,{...S,value:[]}])),_=t&&[],M=n&&[],E=qv().x(x?L=>x[L]:m).y(w?L=>w[L]:y).weight(h?L=>h[L]:1).size([g,b]).bandwidth(i),I=[];for(let L of a){let S=[];I.push(S);for(let T of d?um(L,d,p):[L]){let D=E.contours(T);S.push([T,D])}}let N=o;if(!(N instanceof Jc)){let L=0;for(let S of I)for(let[,T]of S){let D=T.max;D>L&&(L=D)}N=Float64Array.from({length:o-1},(S,T)=>L*100*(T+1)/o)}let A=[],B=[];for(let L of I){let S=[];A.push(S);for(let[T,D]of L)for(let C of N){S.push(B.length),B.push(D(C/100)),_&&_.push(C),M&&M.push(C);for(let k in v)v[k].value.push(c[k].value[T[0]])}}return _&&_.push(0),M&&M.push(0),{data:s,facets:A,channels:{...v,..._&&{fill:{value:_,scale:"color"}},...M&&{stroke:{value:M,scale:"color"}},contours:{value:B}}}})}function EO(e){return/^density$/i.test(e)}function OO(e,{x1:t,x2:n,y1:r,y2:i,x:o=t===void 0&&n===void 0?Ie:void 0,y:s=r===void 0&&i===void 0?W:void 0,fill:a,positiveFill:c="#3ca951",negativeFill:l="#4269d0",fillOpacity:u=1,positiveFillOpacity:f=u,negativeFillOpacity:h=u,stroke:d,strokeOpacity:p,z:m=Ee(d)[0],clip:y,tip:g,render:b,...x}={}){return[t,n]=NO(o,t,n),[r,i]=NO(s,r,i),t===n&&r===i&&(r=Ga(0)),{tip:g}=Li({tip:g},"x"),Ke(te(c)?null:Object.assign(_m(e,{x1:t,x2:n,y1:r,y2:i,z:m,fill:c,fillOpacity:f,render:uf(b,BO(!0)),clip:y,...x}),{ariaLabel:"positive difference"}),te(l)?null:Object.assign(_m(e,{x1:t,x2:n,y1:r,y2:i,z:m,fill:l,fillOpacity:h,render:uf(b,BO(!1)),clip:y,...x}),{ariaLabel:"negative difference"}),gl(e,{x:n,y:i,z:m,stroke:d,strokeOpacity:p,tip:g,clip:!0,...x}))}function NO(e,t,n){return t===void 0&&n===void 0?t=n=Ga(e):t===void 0?(n=Ga(n),t=e===void 0?n:Ga(e)):n===void 0?(t=Ga(t),n=e===void 0?t:Ga(e)):(t=Ga(t),n=Ga(n)),[t,n]}function Ga(e){let t,{value:n,label:r=Dn(n)}=si(e);return{transform:i=>t||(t=bt(i,n)),label:r}}function BO(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===m1(n.y)<0?u:f).fill(l);let h=s(t,n,{...r,x2:a,y2:f},i,o),d=s(t,n,{...r,x1:c,y1:u},i,o),p=h.querySelector("g")??h,m=d.querySelector("g")??d;for(let y=0;p.firstChild;y+=2){let g=x1(),b=lt("svg:clipPath",o).attr("id",g).node();b.appendChild(p.firstChild),m.childNodes[y].setAttribute("clip-path",`url(#${g})`),m.insertBefore(b,m.childNodes[y])}return d}}var DW={ariaLabel:"geo",fill:"none",stroke:"currentColor",strokeWidth:1,strokeLinecap:"round",strokeLinejoin:"round",strokeMiterlimit:1},qm=class extends _t{constructor(t,n={}){let[r,i]=re(n.r,3);super(t,{geometry:{value:n.geometry,scale:"projection"},r:{value:r,scale:"r",filter:nr,optional:!0}},Tm(n),DW),this.r=i}render(t,n,r,i,o){let{geometry:s,r:a}=r,c=An(o.projection??NW(n)),{r:l}=this;return Sa(l)?t=[]:l!==void 0&&c.pointRadius(l),lt("svg:g",o).call(Bt,this,i,o).call(Mt,this,n).call(u=>{u.selectAll().data(t).enter().append("path").call(Nt,this).attr("d",a?f=>c.pointRadius(a[f])(s[f]):f=>c(s[f])).call(Ht,this,r)}).node()}};function NW({x:e,y:t}){if(e||t)return e??=n=>n,t??=n=>n,Uc({point(n,r){this.stream.point(e(n),t(r))}})}function uw(e,{geometry:t=W,...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 qm(e,{geometry:t,...n})}function LO({strokeWidth:e=1.5,...t}={}){return uw({type:"Sphere"},{strokeWidth:e,...t})}function FO({strokeOpacity:e=.1,...t}={}){return uw(u2(),{strokeOpacity:e,...t})}var Lf=.5,Ff=0;function CO(e={fill:"count"},{binWidth:t,...n}={}){let{z:r}=n;return t=t===void 0?20:Dt(t),e=MI(e,n),No(e,"fill")&&(n.channels={...n.channels,fill:{value:[]}}),n.symbol===void 0&&(n.symbol="hexagon"),n.r===void 0&&!No(e,"r")&&(n.r=t/2),_e(n,(i,o,s,a,c,l)=>{let{x:u,y:f,z:h,fill:d,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}=ka(s,a,l)),h=h?h.value:bt(i,r),d=d?.value,p=p?.value,m=m?.value;let y=im(e,{z:h,fill:d,stroke:p,symbol:m}),g=h&&[],b=d&&[],x=p&&[],w=m&&[],v=[],_=[],M=[],E=-1;for(let B of e)B.initialize(i);for(let B of o){let L=[];for(let S of e)S.scope("facet",B);for(let[S,T]of Oa(B,y))for(let{index:D,extent:C}of BW(i,T,u,f,t)){L.push(++E),_.push(C.x),M.push(C.y),h&&g.push(y===h?S:h[D[0]]),d&&b.push(y===d?S:d[D[0]]),p&&x.push(y===p?S:p[D[0]]),m&&w.push(y===m?S:m[D[0]]);for(let k of e)k.reduce(D,C)}v.push(L)}let I=s.x.scale,N=s.y.scale,A={x:{value:_,source:a[I]?{value:Vt(_,a[I].invert),scale:I}:null},y:{value:M,source:a[N]?{value:Vt(M,a[N].invert),scale:N}:null},...h&&{z:{value:g}},...d&&{fill:{value:b,scale:"auto"}},...p&&{stroke:{value:x,scale:"auto"}},...m&&{symbol:{value:w,scale:"auto"}},...Object.fromEntries(e.map(({name:B,output:L})=>[B,{scale:"auto",label:L.label,radius:B==="r"?t/2:void 0,value:L.transform()}]))};return{data:i,facets:v,channels:A}})}function BW(e,t,n,r,i){let o=i*(1.5/mI),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-Ff)/o),f=Math.round(c=(c-Lf)/i-(u&1)/2),h=l-u;if(Math.abs(h)*3>1){let m=c-f,y=f+(c<f?-1:1)/2,g=u+(l<u?-1:1),b=c-y,x=l-g;m*m+h*h>b*b+x*x&&(f=y+(u&1?1:-1)/2,u=g)}let d=`${f},${u}`,p=s.get(d);p===void 0&&(p={index:[],extent:{data:e,x:(f+(u&1)/2)*i+Lf,y:u*o+Ff}},s.set(d,p)),p.index.push(a)}return s.values()}var OW={ariaLabel:"hexgrid",fill:"none",stroke:"currentColor",strokeOpacity:.1};function kO(e){return new Vm(e)}var Vm=class extends _t{constructor({binWidth:t=20,clip:n=!0,...r}={}){super(Ta,void 0,{clip:n,...r},OW),this.binWidth=Dt(t)}render(t,n,r,i,o){let{binWidth:s}=this,{marginTop:a,marginRight:c,marginBottom:l,marginLeft:u,width:f,height:h}=i,d=u-Lf,p=f-c-Lf,m=a-Ff,y=h-l-Ff,g=s/2,b=g*yI,x=b/2,w=g*2,v=b*1.5,_=Math.floor(d/w),M=Math.ceil(p/w),E=Math.floor((m+x)/v),I=Math.ceil((y-x)/v)+1,N=`m0,${Xa(-b)}l${Xa(g)},${Xa(x)}v${Xa(b)}l${Xa(-g)},${Xa(x)}`,A=N;for(let B=E;B<I;++B)for(let L=_;L<M;++L)A+=`M${Xa(L*w+(B&1)*g)},${Xa(B*v)}${N}`;return lt("svg:g",o).datum(0).call(Bt,this,i,o).call(Mt,this,{},Ne+Lf,Ne+Ff).call(B=>B.append("path").call(Nt,this).call(Ht,this,r).attr("d",A)).node()}};function Xa(e){return Math.round(e*1e3)/1e3}var LW={ariaLabel:"image",fill:null,stroke:null};function FW(e){return/^\.*\//.test(e)}function CW(e){return/^(blob|data|file|http|https):/i.test(e)}function kW(e){return typeof e=="string"&&(FW(e)||CW(e))?[void 0,e]:[e,void 0]}var jm=class extends _t{constructor(t,n={}){let{x:r,y:i,r:o,width:s,height:a,rotate:c,src:l,preserveAspectRatio:u,crossOrigin:f,frameAnchor:h,imageRendering:d}=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]=kW(l),[y,g]=re(o),[b,x]=re(s,g!==void 0?g*2:void 0),[w,v]=re(a,g!==void 0?g*2:void 0),[_,M]=re(c,0);super(t,{x:{value:r,scale:"x",optional:!0},y:{value:i,scale:"y",optional:!0},r:{value:y,scale:"r",filter:nr,optional:!0},width:{value:b,filter:nr,optional:!0},height:{value:w,filter:nr,optional:!0},rotate:{value:_,optional:!0},src:{value:p,optional:!0}},Tm(n),LW),this.src=m,this.width=x,this.rotate=M,this.height=v,this.r=g,this.preserveAspectRatio=ce(u,"xMidYMid"),this.crossOrigin=Ue(f),this.frameAnchor=Do(h),this.imageRendering=ce(d,"auto")}render(t,n,r,i,o){let{x:s,y:a}=n,{x:c,y:l,width:u,height:f,r:h,rotate:d,src:p}=r,{r:m,width:y,height:g,rotate:b}=this,[x,w]=yn(this,i);return lt("svg:g",o).call(Bt,this,i,o).call(Mt,this,{x:c&&s,y:l&&a}).call(v=>v.selectAll().data(t).enter().append("image").call(Nt,this).attr("x",RO(c,u,h,x,y,m)).attr("y",RO(l,f,h,w,g,m)).attr("width",u?_=>u[_]:y!==void 0?y:h?_=>h[_]*2:m*2).attr("height",f?_=>f[_]:g!==void 0?g:h?_=>h[_]*2:m*2).attr("transform",d?_=>`rotate(${d[_]})`:b?`rotate(${b})`:null).attr("transform-origin",d||b?Ua`${c?_=>c[_]:x}px ${l?_=>l[_]:w}px`:null).call(ut,"href",p?_=>p[_]:this.src).call(ut,"preserveAspectRatio",this.preserveAspectRatio).call(ut,"crossorigin",this.crossOrigin).call(ut,"image-rendering",this.imageRendering).call(ut,"clip-path",h?_=>`circle(${h[_]}px)`:m!==void 0?`circle(${m}px)`:null).call(Ht,this,r)).node()}};function RO(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 $O(e,{x:t,y:n,...r}={}){return r.frameAnchor===void 0&&([t,n]=ke(t,n)),new jm(e,{...r,x:t,y:n})}function RW(e,t,n){var r=1e-8,i=t-1,o=n-1,s=0,a,c,l,u,f,h,d,p,m,y,g;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)),d=(2.30753+u*.27061)/(1+u*(.99229+u*.04481))-u,e<.5&&(d=-d),p=(d*d-3)/6,m=2/(1/(2*t-1)+1/(2*n-1)),y=d*Math.sqrt(p+m)/m-(1/(2*n-1)-1/(2*t-1))*(p+5/6-2/(3*m)),d=t/(t+n*Math.exp(2*y))):(a=Math.log(t/(t+n)),c=Math.log(n/(t+n)),u=Math.exp(t*a)/t,f=Math.exp(n*c)/n,y=u+f,e<u/y?d=Math.pow(t*y*e,1/t):d=1-Math.pow(n*y*(1-e),1/n)),g=-Cf(t)-Cf(n)+Cf(t+n);s<10;s++){if(d===0||d===1)return d;if(h=$W(d,t,n)-e,u=Math.exp(i*Math.log(d)+o*Math.log(1-d)+g),f=h/u,d-=u=f/(1-.5*Math.min(1,f*(i/d-o/(1-d)))),d<=0&&(d=.5*(d+u)),d>=1&&(d=.5*(d+u+1)),Math.abs(u)<r*d&&s>0)break}return d}function $W(e,t,n){var r=e===0||e===1?0:Math.exp(Cf(t+n)-Cf(t)-Cf(n)+t*Math.log(e)+n*Math.log(1-e));return e<0||e>1?!1:e<(t+1)/(t+n+2)?r*UO(e,t,n)/t:1-r*UO(1-e,n,t)/n}function UO(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,h,d;for(Math.abs(l)<r&&(l=r),l=1/l,d=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,d*=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,h=l*c,d*=h,!(Math.abs(h-1)<3e-7));i++);return d}function Cf(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 PO(e,t){var n=RW(2*Math.min(e,1-e),.5*t,.5);return n=Math.sqrt(t*(1-n)/n),e>.5?n:-n}var UW={ariaLabel:"linear-regression",fill:"currentColor",fillOpacity:.1,stroke:"currentColor",strokeWidth:1.5,strokeLinecap:"round",strokeLinejoin:"round",strokeMiterlimit:1},fw=class extends _t{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,UW),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 lt("svg:g",o).call(Bt,this,i,o).call(Mt,this,n).call(u=>u.selectAll().data(c?um(t,c,this.z):[t]).enter().call(f=>f.append("path").attr("fill","none").call(Nt,this).call(ol,this,{...r,fill:null,fillOpacity:null}).attr("d",h=>this._renderLine(h,s,a)).call(l&&!Os(this.fill)?h=>h.select(PW).attr("stroke","none").call(Nt,this).call(ol,this,{...r,stroke:null,strokeOpacity:null,strokeWidth:null}).attr("d",d=>this._renderBand(d,s,a)):()=>{}))).node()}};function PW(){return this.parentNode.insertBefore(this.ownerDocument.createElementNS(Zr.svg,"path"),this)}var LM=class extends fw{constructor(t,n){super(t,n)}_renderBand(t,n,r){let{ci:i,precision:o}=this,[s,a]=se(t,u=>r[u]),c=hw(t,r,n),l=VO(t,r,n,(1-i)/2,c);return Ru().y(u=>u).x0(u=>l(u,-1)).x1(u=>l(u,1))(Re(s,a-o/2,o).concat(a))}_renderLine(t,n,r){let[i,o]=se(t,a=>r[a]),s=hw(t,r,n);return`M${s(i)},${i}L${s(o)},${o}`}},FM=class extends fw{constructor(t,n){super(t,n)}_renderBand(t,n,r){let{ci:i,precision:o}=this,[s,a]=se(t,u=>n[u]),c=hw(t,n,r),l=VO(t,n,r,(1-i)/2,c);return Ru().x(u=>u).y0(u=>l(u,-1)).y1(u=>l(u,1))(Re(s,a-o/2,o).concat(a))}_renderLine(t,n,r){let[i,o]=se(t,a=>n[a]),s=hw(t,n,r);return`M${i},${s(i)}L${o},${s(o)}`}};function zO(e,{y:t=Ie,x:n=W,stroke:r,fill:i=te(r)?"currentColor":r,...o}={}){return new LM(e,bf({...o,x:n,y:t,fill:i,stroke:r}))}function qO(e,{x:t=Ie,y:n=W,stroke:r,fill:i=te(r)?"currentColor":r,...o}={}){return new FM(e,gf({...o,x:t,y:n,fill:i,stroke:r}))}function hw(e,t,n){let r=0,i=0,o=0,s=0;for(let u of e){let f=t[u],h=n[u];r+=f,i+=h,o+=f*h,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 VO(e,t,n,r,i){let o=In(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=PO(r,e.length-2);return(u,f)=>{let h=i(u),d=c*Math.sqrt(1/e.length+(u-o)**2/s);return h+f*l*d}}function Ym({path:e=W,delimiter:t,frameAnchor:n,treeLayout:r=Pc,treeSort:i,treeSeparation:o,treeAnchor:s,treeFilter:a,...c}={}){s=yw(s),i=WO(i),a!=null&&(a=kM(a)),n===void 0&&(n=s.frameAnchor);let l=GO(t),u=tL(c,kM),[f,h]=dn(),[d,p]=dn();return{x:f,y:d,frameAnchor:n,...pn(c,(m,y)=>{let g=l(bt(m,e)),b=h([]),x=p([]),w=-1,v=[],_=[],M=lb().path(I=>g[I]),E=r();E.nodeSize&&E.nodeSize([1,1]),E.separation&&o!==void 0&&E.separation(o??Qp);for(let I of u)I[pw]=I[QO]([]);for(let I of y){let N=[],A=M(I.filter(B=>g[B]!=null)).each(B=>B.data=m[B.data]);i!=null&&A.sort(i),E(A);for(let B of A.descendants())if(!(a!=null&&!a(B))){N.push(++w),v[w]=B.data,s.position(B,w,b,x);for(let L of u)L[pw][w]=L[JO](B)}_.push(N)}return{data:v,facets:_}}),...Object.fromEntries(u)}}function mw({path:e=W,delimiter:t,curve:n="bump-x",stroke:r="#555",strokeWidth:i=1.5,strokeOpacity:o=.5,treeLayout:s=Pc,treeSort:a,treeSeparation:c,treeAnchor:l,treeFilter:u,...f}={}){l=yw(l),a=WO(a),u!=null&&(u=YO(u)),f={curve:n,stroke:r,strokeWidth:i,strokeOpacity:o,...f};let h=GO(t),d=tL(f,YO),[p,m]=dn(),[y,g]=dn(),[b,x]=dn(),[w,v]=dn();return{x1:p,x2:y,y1:b,y2:w,...pn(f,(_,M)=>{let E=h(bt(_,e)),I=m([]),N=g([]),A=x([]),B=v([]),L=-1,S=[],T=[],D=lb().path(k=>E[k]),C=s();C.nodeSize&&C.nodeSize([1,1]),C.separation&&c!==void 0&&C.separation(c??Qp);for(let k of d)k[pw]=k[QO]([]);for(let k of M){let F=[],R=D(k.filter($=>E[$]!=null)).each($=>$.data=_[$.data]);a!=null&&R.sort(a),C(R);for(let{source:$,target:U}of R.links())if(!(u!=null&&!u(U,$))){F.push(++L),S[L]=U.data,l.position($,L,I,A),l.position(U,L,N,B);for(let G of d)G[pw][L]=G[JO](U,$)}T.push(F)}return{data:S,facets:T}}),...Object.fromEntries(d)}}function yw(e="left"){switch(`${e}`.trim().toLowerCase()){case"left":return zW;case"right":return qW}throw new Error(`invalid tree anchor: ${e}`)}var zW={frameAnchor:"left",dx:6,position({x:e,y:t},n,r,i){r[n]=t,i[n]=-e}},qW={frameAnchor:"right",dx:-6,position({x:e,y:t},n,r,i){r[n]=-t,i[n]=-e}};function WO(e){return e==null||typeof e=="function"?e:`${e}`.trim().toLowerCase().startsWith("node:")?jO(kM(e)):jO(VW(e))}function jO(e){return(t,n)=>un(e(t),e(n))}function VW(e){return t=>t.data?.[e]}function GO(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=>jW(r,t))}var CM=92,XO=47;function jW(e,t){if(t===CM)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 CM: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 XO: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 YW(e){let t=!1;for(let n=0,r=e.length;n<r;++n){switch(e.charCodeAt(n)){case CM:if(!t){t=!0;continue}case XO:t&&(e=e.slice(0,n-1)+e.slice(n),--n,--r);break}t=!1}return e}function HO(e){return hn(e)&&typeof e.node=="function"}function WW(e){return hn(e)&&typeof e.link=="function"}function kM(e){if(HO(e))return e.node;if(e=`${e}`.trim().toLowerCase(),!!e.startsWith("node:")){switch(e){case"node:name":return $M;case"node:path":return RM;case"node:internal":return ZO;case"node:external":return KO;case"node:depth":return UM;case"node:height":return PM}throw new Error(`invalid node value: ${e}`)}}function YO(e){if(HO(e))return e.node;if(WW(e))return e.link;if(e=`${e}`.trim().toLowerCase(),!(!e.startsWith("node:")&&!e.startsWith("parent:"))){switch(e){case"parent:name":return dw($M);case"parent:path":return dw(RM);case"parent:depth":return dw(UM);case"parent:height":return dw(PM);case"node:name":return $M;case"node:path":return RM;case"node:internal":return ZO;case"node:external":return KO;case"node:depth":return UM;case"node:height":return PM}throw new Error(`invalid link value: ${e}`)}}function RM(e){return e.id}function $M(e){return GW(e.id)}function UM(e){return e.depth}function PM(e){return e.height}function ZO(e){return!!e.children}function KO(e){return!e.children}function dw(e){return(t,n)=>n==null?void 0:e(n)}function GW(e){let t=e.length;for(;--t>0&&!XW(e,t););return YW(e.slice(t+1))}function XW(e,t){if(e[t]==="/"){let n=0;for(;t>0&&e[--t]==="\\";)++n;if(!(n&1))return!0}return!1}var QO=2,JO=3,pw=4;function tL(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 zM(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:h=u,dot:d=te(f)&&te(h),text:p="node:name",textStroke:m="var(--plot-background)",title:y="node:path",dx:g,dy:b,textAnchor:x,treeLayout:w=Pc,textLayout:v=w===Pc||w===ab?"mirrored":"normal",tip:_,...M}={}){if(g===void 0&&(g=yw(M.treeAnchor).dx),x!==void 0)throw new Error("textAnchor is not a configurable tree option");v=nn(v,"textLayout",["mirrored","normal"]);function E(I){return Oo(e,Ym({treeLayout:w,text:p,fill:t===void 0?"currentColor":t,stroke:m,dx:g,dy:b,title:y,...I,...M}))}return Ke(tw(e,mw({treeLayout:w,markerStart:f,markerEnd:h,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})),d?ci(e,Ym({treeLayout:w,fill:t===void 0?"node:internal":t,title:y,tip:_,...M})):null,p!=null?v==="mirrored"?[E({textAnchor:"start",treeFilter:"node:external"}),E({textAnchor:"end",treeFilter:"node:internal",dx:-g})]:E():null)}function eL(e,t){return zM(e,{...t,treeLayout:ab})}function nL({geometry:e=W,...t}={}){return _e({...t,x:null,y:null},(n,r,i,o,s,{projection:a})=>{let c=bt(n,e),l=c.length,u=new Float64Array(l),f=new Float64Array(l),h=An(a);for(let d=0;d<l;++d)[u[d],f[d]]=h.centroid(c[d]);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 rL({geometry:e=W,...t}={}){let n;return{...t,x:{transform:r=>Float64Array.from(n=bt(bt(r,e),i2),([i])=>i)},y:{transform:()=>Float64Array.from(n,([,r])=>r)}}}var pL=gF(dL(),1);var nG=({marginLeft:e})=>[1,e],rG=({width:e,marginRight:t})=>[-1,e-t],iG=({width:e,marginLeft:t,marginRight:n})=>[0,(t+e-n)/2],oG=({marginTop:e})=>[1,e],sG=({height:e,marginBottom:t})=>[-1,e-t],aG=({height:e,marginTop:t,marginBottom:n})=>[0,(t+e-n)/2];function mL(e){return typeof e=="string"?{anchor:e}:e}function yL(e={},t={}){arguments.length===1&&([e,t]=bL(e));let{anchor:n="left",padding:r=1,r:i=t.r}=mL(e);switch(`${n}`.toLowerCase()){case"left":n=nG;break;case"right":n=rG;break;case"middle":n=iG;break;default:throw new Error(`unknown dodge anchor: ${n}`)}return xL("x","y",n,Dt(r),i,t)}function gL(e={},t={}){arguments.length===1&&([e,t]=bL(e));let{anchor:n="bottom",padding:r=1,r:i=t.r}=mL(e);switch(`${n}`.toLowerCase()){case"top":n=oG;break;case"bottom":n=sG;break;case"middle":n=aG;break;default:throw new Error(`unknown dodge anchor: ${n}`)}return xL("y","x",n,Dt(r),i,t)}function bL(e){let{anchor:t,padding:n,...r}=e,{r:i}=r;return[{anchor:t,padding:n,r:i},r]}function xL(e,t,n,r,i,o){if(i!=null&&typeof i!="number"){let{channels:s,sort:a,reverse:c}=o;s=tm(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]:h,r:d}=c;if(!c[t])throw new Error(`missing channel: ${t}`);({[t]:h}=ka(c,l,f));let p=d?void 0:i!==void 0?Dt(i):this.r!==void 0?this.r:3;d&&(d=bt(d.value,l[d.scale]||W,Float64Array));let[m,y]=n(u),g=m?lG:cG,b=new Float64Array(h.length),x=d?w=>d[w]:()=>p;for(let w of a){let v=(0,pL.default)();w=w.filter(d?M=>qu(h[M])&&nr(d[M]):M=>qu(h[M]));let _=new Float64Array(2*w.length+2);for(let M of w){let E=x(M),I=m?E+r:0,N=h[M]-E,A=h[M]+E,B=2;v.queryInterval(N-r,A+r,([,,S])=>{let T=b[S]-I,D=h[M]-h[S],C=r+(d?d[M]+d[S]:2*p),k=Math.sqrt(C*C-D*D);_[B++]=T-k,_[B++]=T+k});let L=_.slice(0,B);m&&(L=L.filter(S=>S>=0));t:for(let S of L.sort(g)){for(let T=0;T<B;T+=2)if(_[T]+1e-6<S&&S<_[T+1]-1e-6)continue t;b[M]=S+I;break}v.insert([N,A,M])}}m||(m=1);for(let w of a)for(let v of w)b[v]=b[v]*m+y;return{data:s,facets:a,channels:{[e]:{value:b,source:null},[t]:{value:h,source:c[t]},...d&&{r:{value:d,source:c.r}}}}})}function cG(e,t){return Math.abs(e)-Math.abs(t)}function lG(e,t){return e-t}function _L(e,t){return arguments.length===1&&({basis:e,...t}=e),Df(xw(e),t)}function vL(e,t){return arguments.length===1&&({basis:e,...t}=e),Nf(xw(e),t)}function xw(e){if(e===void 0)return wL;if(typeof e=="function")return ww(Xu(e));if(/^p\d{2}$/i.test(e))return Uf(Wu(e));switch(`${e}`.toLowerCase()){case"deviation":return hG;case"first":return wL;case"last":return fG;case"max":return dG;case"mean":return pG;case"median":return mG;case"min":return yG;case"sum":return gG;case"extent":return uG}throw new Error(`invalid basis: ${e}`)}function ww(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 Uf(e){return ww((t,n)=>e(t,r=>n[r]))}var uG={mapIndex(e,t,n){let[r,i]=se(e,s=>t[s]),o=i-r;for(let s of e)n[s]=t[s]===null?NaN:(t[s]-r)/o}},wL=ww((e,t)=>{for(let n=0;n<e.length;++n){let r=t[e[n]];if($e(r))return r}}),fG=ww((e,t)=>{for(let n=e.length-1;n>=0;--n){let r=t[e[n]];if($e(r))return r}}),hG={mapIndex(e,t,n){let r=cs(e,o=>t[o]),i=Hr(e,o=>t[o]);for(let o of e)n[o]=t[o]===null?NaN:i?(t[o]-r)/i:0}},dG=Uf(Yt),pG=Uf(cs),mG=Uf(Ti),yG=Uf(ae),gG=Uf(In);function SL(e,t){return bG("x",e,t)}function bG(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]=Kx(t.replace(/^[+-]/,"")),i*=l}t=Zu(t),r=(l,u)=>t.offset(l,u)}let o=`${e}1`,s=`${e}2`,a=yr({[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]=se(l);return l.domain=i<0?[u,r(f,i)]:[r(u,i),f],l},a}function IL(e,t={}){if(typeof e=="string")switch(e.toLowerCase()){case"first":return GM(t);case"last":return XM(t)}if(typeof e=="function")return Ha(null,e,t);let n,r;for(n in e){if(r!==void 0)throw new Error("ambiguous selector; multiple inputs");r=xG(e[n])}if(r===void 0)throw new Error(`invalid selector: ${e}`);return Ha(n,r,t)}function xG(e){if(typeof e=="function")return e;switch(`${e}`.toLowerCase()){case"min":return HM;case"max":return ZM}throw new Error(`unknown selector: ${e}`)}function GM(e){return Ha(null,wG,e)}function XM(e){return Ha(null,_G,e)}function ML(e){return Ha("x",HM,e)}function AL(e){return Ha("y",HM,e)}function TL(e){return Ha("x",ZM,e)}function EL(e){return Ha("y",ZM,e)}function*wG(e){yield e[0]}function*_G(e){yield e[e.length-1]}function*HM(e,t){yield Y0(e,n=>t[n])}function*ZM(e,t){yield Sc(e,n=>t[n])}function Ha(e,t,n){if(e!=null){if(n[e]==null)throw new Error(`missing channel: ${e}`);e=n[e]}let r=Un(n);return pn(n,(i,o)=>{let s=bt(i,r),a=bt(i,e),c=[];for(let l of o){let u=[];for(let f of s?sn(l,h=>s[h]).values():[l])for(let h of t(f,a))u.push(h);c.push(u)}return{data:i,facets:c}})}var vG=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"],["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"],["xLabelArrow","x.labelArrow"],["xLabelOffset","x.labelOffset"],["xFontVariant","x.fontVariant"],["xAriaLabel","x.ariaLabel"],["xAriaDescription","x.ariaDescription"],["xPercent","x.percent"],["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"],["yLabelArrow","y.labelArrow"],["yLabelOffset","y.labelOffset"],["yFontVariant","y.fontVariant"],["yAriaLabel","y.ariaLabel"],["yAriaDescription","y.ariaDescription"],["yPercent","y.percent"],["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"],["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"],["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"],["colorPercent","color.percent"],["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"],["opacityPercent","opacity.percent"],["opacityReverse","opacity.reverse"],["opacityZero","opacity.zero"],["opacityTickFormat","opacity.tickFormat"],["opacityBase","opacity.base"],["opacityExponent","opacity.exponent"],["opacityConstant","opacity.constant"],["symbolScale","symbol.type"],["symbolDomain","symbol.domain"],["symbolRange","symbol.range"],["rScale","r.type"],["rDomain","r.domain"],["rRange","r.range"],["rClamp","r.clamp"],["rNice","r.nice"],["rPercent","r.percent"],["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"],["lengthPercent","length.percent"],["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 SG(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 DL(e,t,n){for(let r in e){let i=vG.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&&SG(t,i.split("."),o)}}var IG=new Set(["frame","hexgrid","sphere","graticule"]);async function BL(e){let t={marks:[]},n=[],{attributes:r,marks:i}=e;DL(r,t,n);let o=[];for(let a of i)for(let{type:c,data:l,options:u}of a.plotSpecs()){if(IG.has(c))t.marks.push(Xm[c](u));else if(fd(l)){let f=Object.fromEntries(Object.entries(u).map(([h,d])=>{let p=d;if(typeof d=="string")p=l.getChild(d)??d;else if(typeof d=="object"){let m=l.getChild(d.value);p=m?{value:m}:d}return[h,p]}));t.marks.push(Xm[c]({length:l.numRows},f))}else t.marks.push(Xm[c](l,u));o.push(a.index)}AG(t,e);let s=xm(t);TG(s,o),MG(e,s,r,n);for(let a of e.interactors)await a.init(s);return s}function MG(e,t,n,r){r.forEach(i=>{let o=n[i];if(o===js){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 AG(e,t){let{marks:n}=t;_w("x",e,n),_w("y",e,n),_w("fx",e,n),_w("fy",e,n)}function _w(e,t,n){let r=t[e]||{};if(r.axis===null||r.label!==void 0)return;let i=n.map(l=>l.channelField(e)?.field);if(i.every(l=>l==null))return;let o,s,a;for(let l=0;l<i.length;++l){let{column:u,label:f}=i[l]||{};u===void 0&&f===void 0||(o===void 0&&s===void 0?(o=u,s=f,a=EG(n[l].data,e)||"number"):s!==f?s=void 0:o!==u&&(o=void 0))}let c=s||o;if(c!==void 0){if((a==="number"||a==="date")&&(e==="x"||e==="y")){r.percent&&(c=`${c} (%)`);let l=(e==="x"?1:-1)*(r.reverse?-1:1);e==="x"||r.labelAnchor==="center"?c=e==="x"==l<0?`\u2190 ${c}`:`${c} \u2192`:c=`${l<0?"\u2191 ":"\u2193 "}${c}`}t[e]={...r,label:c}}}function TG(e,t){let n=e.querySelectorAll('g[aria-label="facet"]');if(n.length)for(let r of n)NL(r,t);else NL(e,t)}function NL(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 EG(e,t){let{columns:n}=e,r=n[t]??n[t+"1"]??n[t+"2"];if(r){for(let i of r)if(i!=null)return i instanceof Date?"date":typeof i}}var DG={width:640,marginLeft:40,marginRight:20,marginTop:20,marginBottom:30},KM=class{constructor(t){this.attributes={...DG},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=J_()}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(t=400){let{top:n,bottom:r}=this.margins(),i=this.getAttribute("height");return i==null&&t!=null&&(i=t,this.setAttribute("height",i,{silent:!0})),i-n-r}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 BL(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 hd(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 vw(e){return typeof e!="string"?!1:(e=e.toLowerCase().trim(),e==="none"||e==="currentcolor"||e.startsWith("url(")&&e.endsWith(")")||e.startsWith("var(")&&e.endsWith(")")||Tr(e)!==null)}var NG=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 OL(e){return NG.has(e)}var BG=new Set(["asterisk","circle","cross","diamond","diamond2","hexagon","plus","square","square2","star","times","triangle","triangle2","wye"]);function LL(e){return BG.has(`${e}`.toLowerCase())}function zs(e){return fd(e)?OG(e):LG(e)}function OG(e){let{numRows:t,numCols:n,schema:{fields:r}}=e,i={};for(let o=0;o<n;++o){let s=r[o].name;i[s]?console.warn(`Redundant column name "${s}". Skipping...`):i[s]=H_(e.getChildAt(o))}return{numRows:t,columns:i}}function LG(e){let t=e.length;if(typeof e[0]=="object"){let n=t?Object.keys(e[0]):[],r={};return n.length>0&&n.forEach(i=>{r[i]=e.map(o=>o[i])}),{numRows:t,columns:r}}else return{numRows:t,values:e}}var FL=e=>e==="stroke"||e==="fill",FG=e=>/opacity$/i.test(e),CG=e=>e==="symbol",kG=(e,t)=>e!=="sort"&&e!=="tip"&&t!=null&&!Array.isArray(t),QM=(e,t)=>({channel:e,field:t,as:t instanceof pr?t.column:e}),JM=(e,t)=>({channel:e,value:t}),Sw=e=>Array.isArray(e),sr=class extends Yf{constructor(t,n,r,i={}){super(n?.options?.filterBy),this.type=t,this.reqs=i,this.source=n,Sw(this.source)&&(this.data=zs(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 h in u)s.add(h),c(h,u[h]);else if(f==="function"&&u[Vf]){let h=u(this,l);for(let d in h)c(d,h[d])}else if(f==="string")OL(l)||FL(l)&&vw(u)||CG(l)&&LL(u)?o.push(JM(l,u)):o.push(QM(l,S0(u)));else if(rs(u))if(Array.isArray(u.columns))o.push(QM(l,u)),a.add(u);else{let h=JM(l,u.value);o.push(h),u.addEventListener("value",d=>(h.value=d,this.update()))}else f==="object"&&kG(l,u)?o.push(QM(l,u)):u!==void 0&&o.push(JM(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||Sw(this.source)}hasFieldInfo(){return!!this._fieldInfo}channel(t){return this.channels.find(n=>n.channel===t)}channelField(t,{exact:n=!1}={}){let r=n?this.channel(t):this.channels.find(i=>i.channel.startsWith(t));return r?.field?r: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){if(!s)continue;let a=s.stats?.stats||[],c=s.stats?.column??s,l=i.get(c)??i.set(c,new Set).get(c);a.forEach(u=>l.add(u)),r[o]?.forEach(u=>l.add(u))}return Array.from(i,([o,s])=>({table:t,column:o,stats:s}))}fieldInfo(t){let n=Object.fromEntries(t.map(r=>[r.column,r]));for(let r of this.channels){let{field:i}=r;i&&Object.assign(r,n[i.stats?.column??i])}return this._fieldInfo=!0,this}query(t=[]){if(this.hasOwnData())return null;let{channels:n,source:{table:r}}=this;return t3(n,r).where(t)}queryPending(){return this.plot.pending(this),this}queryResult(t){return this.data=zs(t),this}update(){return this.plot.update(this)}plotSpecs(){let{type:t,detail:n,channels:r}=this,{numRows:i,values:o,columns:s}=this.data||{},a={},c={};for(let f of r){let h=n.has(f.channel)?c:a;h[f.channel]=zn(f,s)}n.size&&(a.channels=c);let l=o??(this.data?{length:i}:null);return[{type:t,data:l,options:a}]}};function zn(e,t){let n=t?.[e.as]??e.as;return Object.hasOwn(e,"value")?e.value:FL(e.channel)?{value:n,scale:"color"}:FG(e.channel)?{value:n,scale:"opacity"}:n}function t3(e,t,n=[]){let r=Ft.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 wl(e,t){let{plot:n}=e,r=n.getAttribute(`${t}Scale`);if(!r){let{type:o}=e.channelField(t);r=o==="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 ud(i)}function Rr(e,t,n,r,i=1,o){let{field:s}=e.channelField(t);o=o??s;let{type:a,apply:c,sqlApply:l}=wl(e,t),u=!!e.plot.getAttribute(`${t}Reverse`),[f,h]=r.map(b=>c(b)),d=l(o),p=a==="time"||a==="utc"?d:o,m=h===f?0:(n-i)/(h-f),y=m!==1?` * ${m}::DOUBLE`:"";return[u?q`(${h} - ${d}::DOUBLE)${y}`:q`(${d}::DOUBLE - ${f})${y}`,p]}var e3={x:["min","max"]},n3={y:["min","max"]},Iw={...e3,...n3};function CL(e,t,n,r,i){let{plot:o}=e,s=o.getAttribute(r),a=o.getAttribute(i);if(Array.isArray(s)&&!s[gn])return s;{let{column:c,min:l,max:u}=e.channelField(n),f=r3(t,c)||(a?bs().domain([l,u]).nice().domain():[l,u]);return s!==js&&(f[gn]=!0),o.setAttribute(r,f,{silent:!0}),f}}function Ro(e,t){return CL(e,t,"x","xDomain","xNice")}function $o(e,t){return CL(e,t,"y","yDomain","yNice")}function r3(e,t){if(!e)return;let n,r,i=(o,s)=>{if(o==="BETWEEN"&&`${s.field}`===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 i3=class extends sr{constructor(t,n,r){let i=t.endsWith("X")?"y":t.endsWith("Y")?"x":null,o=i?{[i]:["min","max"]}:void 0;super(t,n,r,o),this.dim=i}query(t=[]){let{plot:n,dim:r,source:i}=this,{optimize:o=!0}=i.options||{},s=super.query(t);if(!r)return s;let a=r==="x"?"y":"x",c=this.channelField(a,{exact:!0})?.as,{field:l,as:u,type:f,min:h,max:d}=this.channelField(r);if(o&&(f==="date"||f==="number")&&c){let m=r==="x"?n.innerWidth():n.innerHeight(),[y,g]=r3(t,l)||[h,d],[b]=Rr(this,r,m,[y,g],1,u),x=s.select().map(w=>w.as).filter(w=>w!==u&&w!==c);return RG(s,b,u,c,x)}else return s.orderby(l)}};function RG(e,t,n,r,i=[]){let o=q`FLOOR(${t})::INTEGER`,s=a=>Ft.from(e).select(a).groupby(o,i);return Ft.union(s([{[n]:sa(n),[r]:M0(r,n)},...i]),s([{[n]:oa(n),[r]:A0(r,n)},...i]),s([{[n]:M0(n,r),[r]:sa(r)},...i]),s([{[n]:A0(n,r),[r]:oa(r)},...i])).orderby(i,n)}function kL(e,t=[]){return new t.constructor(e)}function RL(e,t,n){let r=kL(e,n),i=n.length;for(let o=0;o<i;++o)r[t[o]]=n[o];return r}function $L(e,t,n,r,i,o,s){let a=n.length,c=e*t,l=i.map(d=>r[d]),u={},f=[],h=new Int32Array(a);if(o?.length){let d=o.map(m=>r[m]),p={};for(let m=0;m<a;++m){let y=d.map(g=>g[m]);h[m]=p[y]??=f.push(y)-1}for(let m=0;m<o.length;++m)u[o[m]]=f.map(y=>y[m])}else f.push([]);if(s){let d=n.map(y=>y%e),p=n.map(y=>Math.floor(y/e)),m=f.map(()=>[]);for(let y=0;y<a;++y)m[h[y]].push(y);i.forEach((y,g)=>{let b=l[g];u[y]=f.map((x,w)=>s(m[w],e,t,d,p,b))})}else i.forEach((d,p)=>{let m=l[p],y=u[d]=f.map(()=>kL(c,m));for(let g=0;g<a;++g)y[h[g]][n[g]]=m[g]});return{numRows:f.length,columns:u}}function Hm(e){let t=1/0,n=-1/0;return e.forEach(r=>{let i=r.length;for(let o=0;o<i;++o){let s=r[o];s<t&&(t=s),s>n&&(n=s)}}),Number.isFinite(t)&&Number.isFinite(n)?[t,n]:[0,1]}function UL(e){let t=new Gn;return e.forEach(n=>{let r=n.length;for(let i=0;i<r;++i)t.add(n[i])}),Array.from(t).sort($t)}function rn(e,t){return Xl(e)?(e.addEventListener("value",t),e.value):e}function Zm(e,t=!1){let n=new Float64Array(5),r=new Float64Array(4);$G(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 $G(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),h=Float64Array.of(1,0,l[0],l[1],0,0,0,0,0,0),d,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],d=p-2;d>0;d-=2)f[d]+=l[p]*f[d-2]-l[p+1]*f[d-1],f[d+1]+=l[p]*f[d-1]+l[p+1]*f[d-2];for(d=0;d<=p;d+=2)f[d]+=i[p]*h[d]-i[p+1]*h[d+1],f[d+1]+=i[p]*h[d+1]+i[p+1]*h[d];for(h[p+2]=l[p]*h[p]-l[p+1]*h[p+1],h[p+3]=l[p]*h[p+1]+l[p+1]*h[p],d=p;d>0;d-=2)h[d]+=l[p]*h[d-2]-l[p+1]*h[d-1],h[d+1]+=l[p]*h[d-1]+l[p+1]*h[d-2]}for(p=0;p<4;++p)d=p<<1,t[p]=f[d]/u,e[p+1]=h[d+2]}function PL(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);Mw(e,n.subarray(u),r,1,o,s,a,f)}for(let l=0;l<r;++l){let u=c.subarray(l);Mw(t,u,i,r,o,s,a,u)}return c}function Mw(e,t,n,r=1,i=new Float64Array(n),o=new Float64Array(n),s=new Float64Array(5),a=i,c=UG){let l=r*2,u=r*3,f=r*4,h=r*n,d,p;for(c(i,t,n,r,e.b_causal,3,e.a,4,e.sum_causal,s,e.sigma),p=4,d=f;p<n;++p,d+=r)i[p]=e.b_causal[0]*t[d]+e.b_causal[1]*t[d-r]+e.b_causal[2]*t[d-l]+e.b_causal[3]*t[d-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,d=h-r*5;p<n;++p,d-=r)o[p]=e.b_anticausal[1]*t[d+r]+e.b_anticausal[2]*t[d+l]+e.b_anticausal[3]*t[d+u]+e.b_anticausal[4]*t[d+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,d=0;p<n;++p,d+=r)a[d]=i[p]+o[n-p-1];else for(p=0,d=0;p<n;++p,d+=r)a[d]=Math.max(0,i[p]+o[n-p-1]);return a}function UG(e,t,n,r,i,o,s,a,c,l,u,f=.5){let h=Math.abs(r)*n,d=r<0?h+r:0,p,m,y;for(m=0;m<=a;++m)for(l[m]=m<=o?i[m]:0,y=1;y<=a&&y<=m;++y)l[m]-=s[y]*l[m-y];for(y=0;y<a;++y)for(e[y]=0,m=1;m<=y;++m)p=d+r*m,p>=0&&p<h&&(e[y]+=l[y-m]*t[p]);let g=t[d],b=Math.ceil(u*10);for(m=0;m<b;++m){for(y=0;y<a;++y)e[y]+=l[y]*g;if(c-=Math.abs(l[0]),c<=f)break;for(l[a]=m+a<=o?i[m+a]:0,y=1;y<=a;++y)l[a]-=s[y]*l[a-y];for(y=0;y<a;++y)l[y]=l[y+1]}}var qs="density",Ci=class extends sr{constructor(t,n,r){let{bandwidth:i=0,interpolate:o="none",pixelSize:s=1,pad:a=1,width:c,height:l,...u}=r,f=PG(u);super(t,n,u,Iw),this.densityMap=f,this.bandwidth=rn(i,h=>(this.bandwidth=h,this.grids?this.convolve().update():null)),this.interpolate=rn(o,h=>(this.interpolate=h,this.requestUpdate())),this.pixelSize=rn(s,h=>(this.pixelSize=h,this.requestUpdate())),this.pad=rn(a,h=>(this.pad=h,this.requestUpdate())),this.width=rn(c,h=>(this.width=h,this.requestUpdate())),this.height=rn(l,h=>(this.height=h,this.requestUpdate()))}setPlot(t,n){let r=()=>{this.hasFieldInfo()&&this.requestUpdate()};t.addAttributeListener("xDomain",r),t.addAttributeListener("yDomain",r),super.setPlot(t,n)}get filterIndexable(){let t=this.plot.getAttribute("xDomain"),n=this.plot.getAttribute("yDomain");return t&&n&&!t[gn]&&!n[gn]}query(t=[]){let{interpolate:n,pad:r,channels:i,densityMap:o,source:s}=this,[a,c]=this.extentX=Ro(this,t),[l,u]=this.extentY=$o(this,t),[f,h]=this.bins=this.binDimensions(),[d,p]=Rr(this,"x",f,[a,c],r),[m,y]=Rr(this,"y",h,[l,u],r),g=r?[Le(p,[+a,+c]),Le(y,[+l,+u])]:[gc(+a,p),yc(p,+c),gc(+l,y),yc(y,+u)],b=Ft.from(s.table).where(t.concat(g)),x=this.groupby=[],w={};for(let _ of i)if(Object.hasOwn(_,"field")){let{as:M,channel:E,field:I}=_;I.aggregate?(w[E]=I,o[E]=!0):E==="weight"?w[qs]=Mi(I):E!=="x"&&E!=="y"&&(b.select({[M]:I}),x.push(M))}let v=this.aggr=Object.keys(w);if(w.density&&v.length>1)throw new Error("Weight option can not be used with custom aggregates.");if(v.length||(v.push(qs),w.density=Ii()),n==="linear"){if(v.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 VG(b,d,m,w[qs],f,x)}else return qG(b,d,m,w,f,x)}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,i=zG(this.interpolate),{columns:o}=zs(t);return this.grids0=$L(n,r,o.index,o,this.aggr,this.groupby,i),this.convolve()}convolve(){let{aggr:t,bandwidth:n,bins:r,grids0:i,plot:o}=this;if(this.grids=i,n>0){let s=t.length===1?t[0]:t.includes(qs)?qs:null;if(!s)return console.warn("No compatible grid found for smoothing."),this;let a=i.columns[s],c=o.innerWidth(),l=o.innerHeight(),[u,f]=r,h=a.some(m=>m.some(y=>y<0)),d=Zm(n*(u-1)/c,h),p=Zm(n*(f-1)/l,h);this.grids={numRows:i.numRows,columns:{...i.columns,[s]:a.map(m=>PL(d,p,m,r))}}}return this}};function PG(e){let t={};for(let n in e)e[n]==="density"&&(delete e[n],t[n]=!0);return t}function zG(e="none"){if(typeof e=="function")return e;switch(e.toLowerCase()){case"none":case"linear":return;case"nearest":return km;case"barycentric":return Cm();case"random-walk":return Rm()}throw new Error(`invalid interpolate: ${e}`)}function qG(e,t,n,r,i,o){return e.select({index:q`FLOOR(${t})::INTEGER + FLOOR(${n})::INTEGER * ${i}`,...r}).groupby("index",o)}function VG(e,t,n,r,i,o){let s=r?.column?`* ${r.column}`:"",a=(h,d)=>e.clone().select({xp:t,yp:n,i:h,w:d}),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 Ft.from(Ft.unionAll(c,l,u,f)).select({index:"i",density:Mi("w")},o).groupby("index",o).having(ad("density",0))}var o3=class extends Ci{constructor(t,n){let{thresholds:r=10,...i}=n;super("geo",t,{bandwidth:20,interpolate:"linear",pixelSize:2,...i}),this.thresholds=rn(r,o=>(this.thresholds=o,this.grids?this.contours().update():null))}convolve(){return super.convolve().contours()}contours(){let{bins:t,densityMap:n,grids:r,thresholds:i,plot:o}=this,{numRows:s,columns:a}=r,c=i,l;if(Array.isArray(c))l=c;else{let[,A]=Hm(a.density);l=Array.from({length:c-1},(B,L)=>A*(L+1)/c)}(n.fill||n.stroke)&&this.plot.getAttribute("colorScale")!=="log"&&this.plot.setAttribute("colorZero",!0);let[u,f]=t,[h,d]=o.getAttribute("xDomain"),[p,m]=o.getAttribute("yDomain"),y=(d-h)/u,g=(m-p)/f,b=+h,x=+p,w=A=>b+A*y,v=A=>x+A*g,_=ma().size(t),M=this.contourData=Array(s*l.length),{density:E,...I}=a,N=Object.entries(I);for(let A=0,B=0;A<s;++A){let L=E[A],S=N.reduce((T,[D,C])=>(T[D]=C[A],T),{});for(let T=0;T<l.length;++T,++B)M[B]=Object.assign(jG(_.contour(L,l[T]),w,v),S)}return this}plotSpecs(){let{type:t,channels:n,densityMap:r,contourData:i}=this,o={};for(let s of n){let{channel:a}=s;a!=="x"&&a!=="y"&&(o[a]=zn(s))}for(let s in r)r[s]&&(o[s]=zn({channel:s,as:"value"}));return[{type:t,data:i,options:o}]}};function jG(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 Aw(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 zL(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 qL(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 VL(e={}){let{r:t=0,g:n=0,b:r=0,opacity:i=1}=typeof e=="string"?tn(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 jL(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:h=1}=typeof c=="string"?tn(c):c,d=a<<2;i[d+0]=l,i[d+1]=u,i[d+2]=f,i[d+3]=255*h|0,r[t[a]]=d}return(a,c,l,u)=>{if(u.map)for(let f=0,h=0;f<l;++f)for(let d=0,p=(l-f-1)*c;d<c;++d,h+=4){let m=r[u[d+p]];a[h+0]=i[m+0],a[h+1]=i[m+1],a[h+2]=i[m+2],a[h+3]=i[m+3]}else{let f=r[u];for(let h=0,d=0;h<l;++h)for(let p=0;p<c;++p,d+=4)a[d+0]=i[f+0],a[d+1]=i[f+1],a[d+2]=i[f+2],a[d+3]=i[f+3]}}}function YL(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"?tn(a):a,h=s<<2;i[h+0]=c,i[h+1]=l,i[h+2]=u,i[h+3]=255*f|0}return(s,a,c,l)=>{for(let u=0,f=0;u<c;++u)for(let h=0,d=(c-u-1)*a;h<a;++h,f+=4){let p=o*n(l[h+d])<<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 Pf=class extends Ci{constructor(t,n){super("image",t,n),this.image=null}setPlot(t,n){let r=()=>{this.hasFieldInfo()&&this.rasterize()};t.addAttributeListener("schemeColor",r),super.setPlot(t,n)}convolve(){return super.convolve().rasterize()}rasterize(){let{bins:t,grids:n}=this,[r,i]=t,{numRows:o,columns:s}=n,{canvas:a,ctx:c,img:l}=XG(this,r,i),{alpha:u,alphaProp:f,color:h,colorProp:d}=a3(this),p=s[f]??[],m=s[d]??[];return this.data={numRows:o,columns:{src:Array.from({length:o},(y,g)=>(h?.(l.data,r,i,m[g]),u?.(l.data,r,i,p[g]),c.putImageData(l,0,0),a.toDataURL()))}},this}plotSpecs(){let{type:t,plot:n,data:{numRows:r,columns:i}}=this,o={src:i.src,width:n.innerWidth(),height:n.innerHeight(),preserveAspectRatio:"none",imageRendering:this.channel("imageRendering")?.value,frameAnchor:"middle"};return[{type:t,data:{length:r},options:o}]}},s3=class extends Pf{constructor(t,n){super(t,{bandwidth:20,interpolate:"linear",pixelSize:2,...n})}};function a3(e){let{aggr:t,densityMap:n,groupby:r,plot:i}=e,o=t.includes(qs),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":vw(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"?qs:null),h=c?.as??(u==="grid"?qs:null),d=l!=="grid"&&l!=="group"?VL(l):WG(e,f),p=u!=="grid"?zL(u):YG(e,h);return{alphaProp:h,colorProp:f,alpha:p,color:d}}function YG(e,t){let{plot:n,grids:r}=e,i=n.getAttribute("opacityDomain"),o=i===js,s=i?.[gn],a=!o&&!s&&i||Hm(r.columns[t]);(o||s||!i)&&(o||(a[gn]=!0),n.setAttribute("opacityDomain",a));let c=Ra({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 qL(c)}function WG(e,t){let{plot:n,grids:r}=e,i=r.columns[t],o=!i[0]?.map,s=o||Array.isArray(i[0]),a=n.getAttribute("colorDomain"),c=a===js,l=a?.[gn],u=!c&&!l&&a||(o?i.sort($t):s?UL(i):Hm(i));(c||l||!a)&&(c||(u[gn]=!0),n.setAttribute("colorDomain",u));let f=Ra({color:{type:n.getAttribute("colorScale"),domain:u,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(s)return jL(f);{let h=Ra({x:{type:GG(f.type),domain:f.domain,reverse:f.reverse,range:[0,1],clamp:f.clamp,base:f.base,exponent:f.exponent,constant:f.constant}});return YL(1024,f,h.apply)}}function GG(e){return e.endsWith("symlog")?"symlog":e.endsWith("log")?"log":e.endsWith("pow")?"pow":e.endsWith("sqrt")?"sqrt":e==="diverging"?"linear":e}function XG(e,t,n){if(!e.image||e.image.w!==t||e.image.h!==n){let r=Aw(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 c3=class extends Pf{constructor(t,n){let{normalize:r=!0,...i}=n;super(t,i),this.normalize=rn(r,o=>(this.normalize=o,this.requestUpdate()))}query(t=[]){let{channels:n,normalize:r,source:i,pad:o}=this,[s,a]=this.bins=this.binDimensions(),[c]=Rr(this,"x",s,Ro(this,t),o),[l]=Rr(this,"y",a,$o(this,t),o),u=Ft.from(i.table).where(HG(this,t));this.aggr=["density"];let f=this.groupby=[],h=[];for(let d of n)if(Object.hasOwn(d,"field")){let{channel:p,field:m}=d;p==="z"?(u.select({[p]:m}),h.push("z")):p!=="x"&&p!=="y"&&(u.select({[p]:m}),f.push(p))}return ZG(u,c,l,h,s,a,f,r)}};function HG(e,t){if(Array.isArray(t)&&!t.length)return t;let{column:n}=e.channelField("x"),{column:r}=e.channelField("y"),i=s=>{let a=`${s.field}`;return s.op!=="BETWEEN"||a!==n&&a!==r},o=s=>s.op==="AND"?Ar(s.children.filter(a=>i(a))):s;return Array.isArray(t)?t.filter(s=>i(s)).map(s=>o(s)):o(t)}function ZG(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=Ft.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(Ar(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=Ft.select({x:q`GREATEST(MAX(ABS(dx)), MAX(ABS(dy)))`}).from("pairs"),h=Ft.select({i:q`UNNEST(range((${f})))::INTEGER`}),d=Ft.unionAll(Ft.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)`),Ft.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)`),Ft.select(c,{x:"x0",y:"y0"}).from("pairs").where(sd("dx"))),p=["x"].concat(c).join(", "),m=Ft.from("raster").select(c,"x","y",a?{w:q`1.0 / COUNT(*) OVER (PARTITION BY ${p})`}:null).where(Ar(Le("x",[0,i],!0),Le("y",[0,o],!0)));return Ft.with({pairs:u,indices:h,raster:d,points:m}).from("points").select(s,{index:q`x + y * ${i}::INTEGER`,density:a?Mi("w"):Ii()}).groupby("index",s)}var l3=class extends sr{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"?e3:n3),this.dim=a,this.bins=rn(i,c=>(this.bins=c,this.requestUpdate())),this.bandwidth=rn(o,c=>(this.bandwidth=c,this.grid?this.convolve().update():null))}get filterIndexable(){let t=this.dim==="x"?"xDomain":"yDomain",n=this.plot.getAttribute(t);return n&&!n[gn]}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"?Ro:$o)(this,t),[a,c]=Rr(this,i,n,s),l=t3(r,o,[i]).where(t.concat(Le(c,s))),u=this.channelField("weight")?"weight":null;return KG(l,a,u)}queryResult(t){let{columns:{index:n,density:r}}=zs(t);return this.grid=RL(this.bins,n,r),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=Zm(n*(t-1)/l,c),f=Mw(u,i,t),h=r==="x"?"y":"x",d=this.channelField(r).as,p=+s,m=(a-p)/(t-1),y=1/m,g=new Float64Array(t),b=new Float64Array(t);for(let x=0;x<t;++x)g[x]=p+x*m,b[x]=f[x]*y;return this.data={numRows:t,columns:{[d]:g,[h]:b}},this}plotSpecs(){let{type:t,data:{numRows:n,columns:r},channels:i,dim:o}=this,s=o==="x"?{y:r.y}:{x:r.x};for(let a of i)s[a.channel]=zn(a,r);return[{type:t,data:{length:n},options:s}]}};function KG(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 Ft.from(Ft.unionAll(i,o)).select({index:"i",density:Mi("w")}).groupby("index").having(F_("density",0))}var u3=class extends Ci{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=wl(this,"x"),c=wl(this,"y"),[l,u]=r.map(y=>a.apply(y)),[f,h]=i.map(y=>c.apply(y)),d=(u-l)/(o-n),p=(h-f)/(s-n),m=n?0:.5;return this.data=QG(this.grids,t,l,f,d,p,a.invert,c.invert,m),this}plotSpecs(){let{type:t,channels:n,densityMap:r,data:{numRows:i,columns:o}}=this,s={};for(let a of n){let{channel:c}=a;s[c]=c==="x"||c==="y"?o[c]:zn(a,o)}for(let a in r)r[a]&&(s[a]=o.density);return[{type:t,data:{length:i},options:s}]}};function QG(e,t,n,r,i,o,s,a,c){let l=1/(i*o),[u,f]=t,h=u*f,d=h*e.numRows,p=new Float64Array(d),m=new Float64Array(d),y=new Float64Array(d),g={x:p,y:m,density:y},{density:b,...x}=e.columns;for(let v in x)g[v]=new x[v].constructor(d);let w=0;for(let v=0;v<e.numRows;++v){for(let M in x)g[M].fill(x[M][v],w,w+h);let _=b[v];for(let M=0,E=0;E<f;++E)for(let I=0;I<u;++I,++w,++M)p[w]=s(n+(I+c)*i),m[w]=a(r+(E+c)*o),y[w]=_[M]*l}return{numRows:d,columns:g}}var JG="geom",f3=class extends sr{constructor(t,n={},r){!Sw(t)&&!n?.geometry&&(n.geometry=j_(JG)),super("geo",t,n,r)}queryResult(t){super.queryResult(t);let n=this.channelField("geometry")?.as;if(n){let{columns:r}=this.data;typeof r[n][0]=="string"&&(r[n]=r[n].map(i=>JSON.parse(i)))}return this}};var h3=class extends sr{constructor(t,n){let{type:r="hexagon",binWidth:i=20,...o}=n;super(r,t,{r:i/2,clip:!0,...o},Iw),this.binWidth=rn(i,s=>(this.binWidth=s,this.requestUpdate()))}get filterIndexable(){let t=this.plot.getAttribute("xDomain"),n=this.plot.getAttribute("yDomain");return t&&n&&!t[gn]&&!n[gn]}query(t=[]){if(this.hasOwnData())return null;let{plot:n,binWidth:r,channels:i,source:o}=this,[s,a]=Ro(this,t),[c,l]=$o(this,t),u=.5-n.getAttribute("marginLeft"),f=0-n.getAttribute("marginTop"),h=`${r}::DOUBLE`,d=`${r*(1.5/Math.sqrt(3))}::DOUBLE`,p=`${n.innerWidth()/(a-s)}::DOUBLE`,m=`${n.innerHeight()/(l-c)}::DOUBLE`,y,g,b=new Set,x={},w;for(let I of i)I.channel==="orderby"?w=I.value:I.channel==="x"?y=I:I.channel==="y"?g=I:Object.hasOwn(I,"field")&&(x[I.as]=I.field,I.field.aggregate&&I.field.columns.forEach(N=>b.add(N)));let v=Ft.select({[y.as]:q`${s}::DOUBLE + ((x + 0.5 * (y & 1)) * ${h} + ${u})::DOUBLE / ${p}`,[g.as]:q`${l}::DOUBLE - (y * ${d} + ${f})::DOUBLE / ${m}`,...x}).groupby("x","y");w&&v.orderby(w);let _=`${p} * (${y.field} - ${s}::DOUBLE)`,M=`${m} * (${l}::DOUBLE - ${g.field})`,E=Ft.select({py:q`(${M} - ${f}) / ${d}`,pj:q`ROUND(py)::INTEGER`,px:q`(${_} - ${u}) / ${h} - 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(b)).from(o.table).where(mc(y.field),mc(g.field),t);return v.from(E)}};var d3=class extends Ci{constructor(t,n){let{origin:r=[0,0],dim:i="xy",...o}=n;super("image",t,o),this.image=null,this.origin=r,this.tileX=i.toLowerCase().includes("x"),this.tileY=i.toLowerCase().includes("y")}setPlot(t,n){let r=()=>{this.hasFieldInfo()&&this.rasterize()};t.addAttributeListener("schemeColor",r),super.setPlot(t,n)}requestQuery(){return this.requestTiles()}query(t=[]){return this._filter=t,null}tileQuery(t){let{interpolate:n,pad:r,channels:i,densityMap:o,source:s}=this,[[a,c],[l,u]]=t,[f,h]=this.bins,[d,p]=Rr(this,"x",f,[a,c],r),[m,y]=Rr(this,"y",h,[l,u],r),g=r?[Le(p,[+a,+c]),Le(y,[+l,+u])]:[gc(+a,p),yc(p,+c),gc(+l,y),yc(y,+u)],b=Ft.from(s.table).where(g),x=this.groupby=[],w={};for(let _ of i)if(Object.hasOwn(_,"field")){let{as:M,channel:E,field:I}=_;I.aggregate?(w[E]=I,o[E]=!0):E==="weight"?w.density=Mi(I):E!=="x"&&E!=="y"&&(b.select({[M]:I}),x.push(M))}let v=this.aggr=Object.keys(w);if(w.density&&v.length>1)throw new Error("Weight option can not be used with custom aggregates.");if(v.length||(v.push("density"),w.density=Ii()),n==="linear"){if(v.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 iX(b,d,m,w.density,f,x)}else return rX(b,d,m,w,f,x)}async requestTiles(){let t=Z_();this.prefetch&&t.cancel(this.prefetch);let{pad:n,tileX:r,tileY:i,origin:[o,s]}=this,[a,c]=this.bins=this.binDimensions(),[l,u]=Ro(this,this._filter),[f,h]=$o(this,this._filter),d=u-l,p=h-f,m=Math.floor((l-o)*(a-n)/d),y=Math.floor((f-s)*(c-n)/p),g=(A,B)=>[[o+A*d,o+(A+1)*d],[s+B*p,s+(B+1)*p]],b=Math.floor((l-o)/d),x=r?WL((u-o)/d):b,w=Math.floor((f-s)/p),v=i?WL((h-s)/p):w,_=[];for(let A=b;A<=x;++A)for(let B=w;B<=v;++B)_.push([A,B]);let M=_.map(([A,B])=>t.query(this.tileQuery(g(A,B)))),E=[];if(r)for(let A=w;A<=v;++A)E.push([x+1,A]),E.push([b-1,A]);if(i){let A=r?b-1:b,B=r?x+1:x;for(let L=A;L<=B;++L)E.push([L,v+1]),E.push([L,w-1])}this.prefetch=E.map(([A,B])=>t.prefetch(this.tileQuery(g(A,B))));let I=await Promise.all(M),N=tX(a,c,m,y,_,I);this.grids0={numRows:N.length,columns:{density:[N]}},this.convolve().update()}convolve(){return super.convolve().rasterize()}rasterize(){let{bins:t,grids:n}=this,[r,i]=t,{numRows:o,columns:s}=n,{canvas:a,ctx:c,img:l}=nX(this,r,i),{alpha:u,alphaProp:f,color:h,colorProp:d}=a3(this),p=s[f]??[],m=s[d]??[];return this.data={numRows:o,columns:{src:Array.from({length:o},(y,g)=>(h?.(l.data,r,i,m[g]),u?.(l.data,r,i,p[g]),c.putImageData(l,0,0),a.toDataURL()))}},this}plotSpecs(){let{type:t,plot:n,data:{numRows:r,columns:i}}=this,o={src:i.src,width:n.innerWidth(),height:n.innerHeight(),preserveAspectRatio:"none",imageRendering:this.channel("imageRendering")?.value,frameAnchor:"middle"};return[{type:t,data:{length:r},options:o}]}};function tX(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,h=u*t-r;eX(e,t,s,a,f,h)}),s}function eX(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,h=o+Math.floor(u/e);0<=f&&f<e&&0<=h&&h<t&&(n[f+h*e]=c[l])}}function nX(e,t,n){if(!e.image||e.image.w!==t||e.image.h!==n){let r=Aw(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 rX(e,t,n,r,i,o){return e.select({index:q`FLOOR(${t})::INTEGER + FLOOR(${n})::INTEGER * ${i}`,...r}).groupby("index",o)}function iX(e,t,n,r,i,o){let s=r.column?`* ${r.column}`:"",a=(h,d)=>e.clone().select({xp:t,yp:n,i:h,w:d}),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 Ft.from(Ft.unionAll(c,l,u,f)).select({index:"i",density:Mi("w")},o).groupby("index",o).having(ad("density",0))}function WL(e){let t=Math.floor(e);return t===e?t-1:t}function oX(e,t,n){var r=1e-8,i=t-1,o=n-1,s=0,a,c,l,u,f,h,d,p,m,y,g;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)),d=(2.30753+u*.27061)/(1+u*(.99229+u*.04481))-u,e<.5&&(d=-d),p=(d*d-3)/6,m=2/(1/(2*t-1)+1/(2*n-1)),y=d*Math.sqrt(p+m)/m-(1/(2*n-1)-1/(2*t-1))*(p+5/6-2/(3*m)),d=t/(t+n*Math.exp(2*y))):(a=Math.log(t/(t+n)),c=Math.log(n/(t+n)),u=Math.exp(t*a)/t,f=Math.exp(n*c)/n,y=u+f,e<u/y?d=Math.pow(t*y*e,1/t):d=1-Math.pow(n*y*(1-e),1/n)),g=-zf(t)-zf(n)+zf(t+n);s<10;s++){if(d===0||d===1)return d;if(h=sX(d,t,n)-e,u=Math.exp(i*Math.log(d)+o*Math.log(1-d)+g),f=h/u,d-=u=f/(1-.5*Math.min(1,f*(i/d-o/(1-d)))),d<=0&&(d=.5*(d+u)),d>=1&&(d=.5*(d+u+1)),Math.abs(u)<r*d&&s>0)break}return d}function sX(e,t,n){var r=e===0||e===1?0:Math.exp(zf(t+n)-zf(t)-zf(n)+t*Math.log(e)+n*Math.log(1-e));return e<0||e>1?0:e<(t+1)/(t+n+2)?r*GL(e,t,n)/t:1-r*GL(1-e,n,t)/n}function GL(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,h,d;for(Math.abs(l)<r&&(l=r),l=1/l,d=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,d*=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,h=l*c,d*=h,!(Math.abs(h-1)<3e-7));i++);return d}function zf(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 XL(e,t){var n=oX(2*Math.min(e,1-e),.5*t,.5);return n=Math.sqrt(t*(1-n)/n),e>.5?n:-n}var m3=class extends sr{constructor(t,n){let{ci:r=.95,precision:i=4,...o}=n;super("line",t,o);let s=()=>this.modelFit?this.confidenceBand().update():null;this.ci=rn(r,a=>(this.ci=a,s())),this.precision=rn(i,a=>(this.precision=a,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 Ft.from(super.query(t)).select({intercept:R_(r,n),slope:$_(r,n),n:U_(r,n),ssy:P_(r,n),ssx:z_(r,n),xm:q_(r,n),x0:T0(sa(n).where(mc(r))),x1:T0(oa(n).where(mc(r)))}).select(i).groupby(i)}queryResult(t){return this.modelFit=zs(t),this.lineData=aX(this.modelFit),this.confidenceBand()}confidenceBand(){let{ci:t,modelFit:n,precision:r,plot:i}=this,o=i.innerWidth();return this.areaData=t?cX(n,t,r,o):null,this}plotSpecs(){let{lineData:t,areaData:n,channels:r,ci:i}=this,o=t.columns,s=i?n.columns:{},a={x:o.x,y:o.y},c={x:s.x,y1:s.y1,y2:s.y2,fillOpacity:.1};for(let l of r)switch(l.channel){case"x":case"y":case"fill":break;case"tip":c.tip=zn(l,s);break;case"stroke":a.stroke=zn(l,o),c.fill=zn(l,s);break;case"strokeOpacity":a.strokeOpacity=zn(l,o);break;case"fillOpacity":c.fillOpacity=zn(l,s);break;default:a[l.channel]=zn(l,o),c[l.channel]=zn(l,s);break}return[...i?[{type:"areaY",data:{length:n.numRows},options:c}]:[],{type:"line",data:{length:t.numRows},options:a}]}};function p3(e,t){if(e.concat)return e.concat(t);let n=new e.constructor(e.length+t.length);return n.set(e,0),n.set(t,e.length),n}function aX(e){let{x0:t,x1:n,xm:r,intercept:i,slope:o,n:s,ssx:a,ssy:c,...l}=e.columns,u=(d,p)=>i[p]+d*o[p],f=p3(t,n),h=p3(t.map(u),n.map(u));for(let d in l)l[d]=p3(l[d],l[d]);return{numRows:f.length,columns:{x:f,y:h,...l}}}function cX(e,t,n,r){let i=e.numRows,{x0:o,x1:s,xm:a,intercept:c,slope:l,n:u,ssx:f,ssy:h,...d}=e.columns,p=Object.keys(d),m={x:[],y1:[],y2:[]};p.forEach(y=>m[y]=[]);for(let y=0;y<i;++y){let g=n*(s[y]-o[y])/r,b=XL((1-t)/2,u[y]-2)*Math.sqrt(h[y]/(u[y]-2));Re(o[y],s[y]-g/2,g).concat(s[y]).forEach(x=>{let w=c[y]+x*l[y],v=b*Math.sqrt(1/u[y]+(x-a[y])**2/f[y]);m.x.push(x),m.y1.push(w-v),m.y2.push(w+v),p.forEach(_=>m[_].push(d[_][y]))})}return{numRows:m.x.length,columns:m}}function HL(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 qf(e){let t={};for(let n in e)t[HL(n)]=e[n];return t}function lX(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 y3=class{constructor(t,{selection:n,channels:r={}}){this.mark=lX(t),this.selection=n;let i=Object.entries(qf(r));this.channels=i.length?i:[["opacity",.2]],this.selection.addEventListener("value",jf(()=>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 uX(o,s);for(let c=0;c<n.length;++c){let l=n[c],u=i[c],f=a(l.__data__);for(let h=0;h<r.length;++h){let[d,p]=r[h];l.setAttribute(d,f?u[h]:p)}}}};async function uX(e,t){let n=t?.predicate(e);if(!n||n.length===0)return()=>!0;let r=e.filterBy?.predicate(e,!0),i={__:Ar(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 g3(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 ZL(){return g3(Rv())}function KL(){return g3(Cv())}function QL(){return g3(kv())}function Km(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 Uo(e,t){let n=e.channelField(t)?.field;return n?.basis||n}function Qm(e,t,n=1){return t.invert(n*Math.floor(e/n))}function Tw(){let e=this,t=e.getScreenCTM,n;e.getScreenCTM=()=>e.isConnected?n=t.call(e):n}var Jm=class{constructor(t,{channel:n,selection:r,field:i=void 0,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||Uo(t,n),this.style=a&&qf(a),this.brush=n==="y"?QL():KL(),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=>Qm(r,this.scale,this.pixelSize)).sort((r,i)=>r-i)),Km(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?Le(i,t):null}}init(t,n){let{brush:r,channel:i,style:o}=this;this.scale=t.scale(i);let s=t.scale("x").range,a=t.scale("y").range;r.extent([[ae(s),ae(a)],[Yt(s),Yt(a)]]);let c=Pt(t).selectAll('g[aria-label="facet"]');if(n=c.size()?c:Pt(n??t),this.g=n.append("g").attr("class",`interval-${i}`).each(Tw).call(r).call(r.moveSilent,this.value?.map(this.scale.apply)),o){let l=this.g.selectAll("rect.selection");for(let u in o)l.attr(u,o[u])}t.addEventListener("pointerenter",l=>{l.buttons||this.activate()})}};var Ew=(e,t)=>e-t,b3=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||Uo(t,"x"),this.yfield=i||Uo(t,"y"),this.style=a&&qf(a),this.brush=ZL(),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=>Qm(u,i,r)).sort(Ew),a=[c[1],l[1]].map(u=>Qm(u,o,r)).sort(Ew)}(!Km(s,n?.[0])||!Km(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?Ar(Le(i,t[0]),Le(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([[ae(s),ae(a)],[Yt(s),Yt(a)]]);let c=Pt(t).selectAll('g[aria-label="facet"]'),l=c.size()?c:Pt(t);if(this.g=l.append("g").attr("class","interval-xy").each(Tw).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(Ew),[h,d]=this.value[1].map(o.apply).sort(Ew);this.g.call(n.moveSilent,[[u,h],[f,d]])}t.addEventListener("pointerenter",u=>{u.buttons||this.activate()})}};var x3=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||Uo(t,[r])}clause(t){let{clients:n,field:r}=this,i=t?L_(r,rd(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=Pt(t).selectAll('g[aria-label="facet"]'),l=c.size()?c:Pt(t),u=t.scale(i),f=!Q_(o);l.on("pointerdown pointermove",function(h){let[d,p]=On(h,this),m=fX(s.columns[a],u.invert(i==="x"?d:p));o.update(f?m:n.clause(m))}),!f&&t.addEventListener("pointerenter",h=>{h.buttons||this.selection.activate(this.clause(0))})}};function fX(e,t){let n=1/0,r;for(let i=0;i<e.length;++i){let o=Math.abs(e[i]-t);o<n&&(n=o,r=e[i])}return r}var JL=(e,t)=>e-t,_3=class{constructor(t,{x:n=new _c,y:r=new _c,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||Uo(t,"x"),this.yfield=o||Uo(t,"y"),this.zoom=w3(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=hX(t,this.xscale);this.xsel.update(this.clause(n,this.xfield,this.xscale))}if(this.pany){let n=dX(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?Le(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(JL),c=this.yscale.range.slice().sort(JL),l=w3(n,[-1/0,1/0],a),u=w3(r,[-1/0,1/0],c),f=tI().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 Or(1,0,0)).on("zoom",({transform:h})=>this.publish(h));if(Pt(i).call(f),n||r){let h=!1;i.addEventListener("pointerenter",d=>{if(!h&&(h=!0,!d.buttons)){if(n){let{xscale:p,xfield:m}=this;o.activate(this.clause(p.domain,m,p))}if(r){let{yscale:p,yfield:m}=this;s.activate(this.clause(p.domain,m,p))}}}),i.addEventListener("pointerleave",()=>h=!1)}}};function w3(e,t,n){return e?Array.isArray(e)?e:t:n}function hX(e,t){return t.range.map(e.invertX,e).map(t.invert,t)}function dX(e,t){return t.range.map(e.invertY,e).map(t.invert,t)}var ty=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"?["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],{exact:!0});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)=>C_(n[l].field,rd(c)));return a.length>1?Ar(a):a[0]});i=o.length>1?od(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:{columns:a={}}={}}=i;r??=l=>o.map(u=>a[u.as][l.__data__]),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,h=null;if(pX(c,f)){let d=r(f);(l.shiftKey||l.metaKey)&&u?.length?(h=u.filter(p=>v3(p,d)),h.length===u.length&&h.push(d)):u?.length===1&&!v3(u[0],d)?h=null:h=[d]}this.value=h,mX(u,h)&&s.update(this.clause(h))}),t.addEventListener("pointerenter",l=>{l.buttons||this.selection.activate(this.clause([this.channels.map(()=>0)]))})}};function pX(e,t){return e.has(t)||e.has(t.parentNode)||e.has(t.parentNode?.parentNode)}function mX(e,t){return e==null||t==null?e!=null||t!=null:e.length!==t.length||e.some((n,r)=>v3(n,t[r]))}function v3(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 eF=":scope > div, :scope > span",Dw="swatch",tF="ramp",S3=class{constructor(t,n){let{as:r,field:i,...o}=n;this.channel=t,this.options={label:null,...o},this.type=null,this.handler=null,this.selection=r,this.field=i,this.legend=null,this.element=document.createElement("div"),this.element.setAttribute("class","legend"),Object.assign(this.element,{value:this})}setPlot(t){this.plot=t}init(t){let n=yX(this,t);return this.element.replaceChildren(n),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(eF);for(let i of r){let o=n?n.has(i.__data__):!0;i.style.opacity=o?1:.2}}};function yX(e,t){let{channel:n,options:r,selection:i}=e,o=t.scale(n),s=o.type==="ordinal"?Dw:tF,a=s===Dw?r:r.label?{tickSize:2,...r}:{tickSize:2,marginTop:1,height:29,...r},c=t.legend(n,a);e.legend=c;let l=!!i;if(l&&s===tF){let u=a.width??240,f=wX(o,u);f?c.scale=function(h){return h==="x"?{range:[0,u]}:h==="y"?{range:[-10,0]}:h===n?f:void 0}:l=!1}if(l){let u=gX(e,s);s===Dw?(u.init(c,eF,f=>[f.__data__]),e.update()):u.init(c,c.querySelector("g:last-of-type"))}return c}function gX(e,t){let{channel:n,handler:r,selection:i}=e;if(r)return r;let o=bX(e);if(t===Dw)e.handler=new ty(o,{selection:i,channels:[n]}),i.addEventListener("value",()=>e.update());else{let s={fill:"none",stroke:"currentColor"};e.handler=new Jm(o,{selection:i,channel:n,brush:s})}return e.handler}function bX(e){let{channel:t,plot:n}=e,r=e.field??xX(n.marks,t)??"value";if(r){let i={field:r};return{plot:n,channelField:o=>t===o?i:void 0}}}function xX(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)for(let i of n){let o=e[r].channelField(i,{exact:!0});if(o)return o.field}return null}function wX(e,t){let{apply:n,invert:r,interpolate:i,...o}=e,s=e.type;s.startsWith("diverging-")&&(s=s.slice(11));let a;switch(s){case"log":case"pow":case"sqrt":case"symlog":a=s;break;case"threshold":case"quantize":case"quantile":return console.warn(`Legends do not yet support ${s} scales.`),null;default:a="linear"}return Ra({x:{...o,type:a,range:[0,t]}})}var _X=new Set(["rectY-x","rectX-y","rect-x","rect-y"]);function nF(e,t={steps:25}){let n=(r,i)=>_X.has(`${r.type}-${i}`)?{[`${i}1`]:I3(r,i,e,t),[`${i}2`]:I3(r,i,e,{...t,offset:1})}:{[i]:I3(r,i,e,t)};return n[Vf]=!0,n}function I3(e,t,n,r){return{column:n,label:n,get stats(){return{column:n,stats:["min","max"]}},get columns(){return[n]},get basis(){return n},toString(){let{apply:i,sqlApply:o,sqlInvert:s}=wl(e,t),{min:a,max:c}=e.channelField(t),l=vX(i(a),i(c),r),u=o(n),f=l.min===0?u:`(${u} - ${l.min})`,h=`${(l.max-l.min)/l.steps}::DOUBLE`,d=r.offset?`${r.offset} + `:"",p=`${l.min} + ${h} * (${d}FLOOR(${f} / ${h}))`;return`${s(p)}`}}}function vX(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],h;for(let m=0,y=f.length;m<y;++m)h=u/f[m],h>=i&&s/h<=a&&(u=h);h=Math.log(u);let d=h>=0?0:~~(-h/c)+1,p=Math.pow(10,-d-1);h=Math.floor(e/u+p)*u,e=e<h?h-u:h,t=Math.ceil(t/u)*u,r=Math.round((t-e)/u)}return{min:e,max:t,steps:r}}export{i3 as ConnectedMark,o3 as ContourMark,c3 as DenseLineMark,l3 as Density1DMark,u3 as Density2DMark,js as Fixed,f3 as GeoMark,Ci as Grid2DMark,s3 as HeatmapMark,h3 as HexbinMark,y3 as Highlight,Jm as Interval1D,b3 as Interval2D,S3 as Legend,sr as Mark,x3 as Nearest,_3 as PanZoom,KM as Plot,Pf as RasterMark,d3 as RasterTileMark,m3 as RegressionMark,ty as Toggle,Vf as Transform,gn as Transient,nF as bin};
69
+ }`)).call(pf,n);for(let F of l){let{channels:k,values:$,facets:U}=m.get(F);if(p===void 0||F.facet==="super"){let G=null;if(U&&(G=U[0],G=F.filter(G,k,$),G.length===0))continue;let et=F.render(G,b,$,_,M);if(et==null)continue;I.appendChild(et)}else{let G;for(let et of p){if(!(F.facetAnchor?.(p,O,et)??!et.empty))continue;let rt=null;if(U){let j=f.has(F);if(rt=U[j?et.i:0],rt=F.filter(rt,k,$),rt.length===0)continue;!j&&rt===U[0]&&(rt=Ls(rt)),rt.fx=et.x,rt.fy=et.y,rt.fi=et.i}let st=F.render(rt,b,$,v,M);if(st!=null){(G??=Pt(I).append("g")).append(()=>st).datum(et);for(let j of["aria-label","aria-description","aria-hidden","transform"])st.hasAttribute(j)&&(G.attr(j,st.getAttribute(j)),st.removeAttribute(j))}}G?.selectChildren().attr("transform",L)}}let D=qO(y,M,e),{figure:C=r!=null||i!=null||o!=null||D.length>0}=e;C&&(N=E.createElement("figure"),N.className=`${c}-figure`,N.style.maxWidth="initial",r!=null&&N.append(WO(E,r,"h2")),i!=null&&N.append(WO(E,i,"h3")),N.append(...D,I),o!=null&&N.append(_Y(E,o))),N.scale=$N(b.scales),N.legend=PO(y,M,e);let R=jD();return R>0&&Pt(I).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.`),N}function WO(e,t,n){if(t.ownerDocument)return t;let r=e.createElement(n);return r.append(t),r}function _Y(e,t){let n=e.createElement("figcaption");return n.append(t),n}function vY({marks:e=[],...t}={}){return Mm({...t,marks:[...e,this]})}_t.prototype.plot=vY;function GO(e){return e.flat(1/0).filter(t=>t!=null).map(SY)}function SY(e){return typeof e.render=="function"?e:new FM(e)}var FM=class extends _t{constructor(t){if(typeof t!="function")throw new TypeError("invalid mark; missing render function");super(),this.render=t}render(){}};function CM(e,t){for(let n in e)QO(e[n],t);return e}function QO(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:R3(s,i)}=t[n]??{};a!=null&&(e.value=Yt(e.value,a),e.transform=!1)}function MY(e){for(let t in e)Q3(t,e[t])}function Sm(e,t,n,r=dD){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(!ZD(n)){let c=n.x?.domain===void 0,l=n.y?.domain===void 0;if(c||l){let[u,f]=KD(s);c&&LM(e,"x",u),l&&LM(e,"y",f)}}}else LM(e,a,s)}return e}function LM(e,t,n){let r=e.get(t);r!==void 0?r.push(n):e.set(t,[n])}function IY(e,t){if(e==null)return;let{x:n,y:r}=e;if(n==null&&r==null)return;let i=Pe(e.data);if(i==null)throw new Error("missing facet data");let o={};n!=null&&(o.fx=sf(i,{value:n,scale:"fx"})),r!=null&&(o.fy=sf(i,{value:r,scale:"fy"})),CM(o,t);let s=F1(i,o);return{channels:o,groups:s,data:e.data}}function XO(e,t,n){if(e.facet===null||e.facet==="super")return;let{fx:r,fy:i}=e;if(r!=null||i!=null){let c=Pe(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=sf(c,{value:r,scale:"fx"})),i!=null&&(l.fy=sf(c,{value:i,scale:"fy"})),CM(l,n),{channels:l,groups:F1(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)&&Pe(e.data)?.length===a.length&&qn(`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 AY(e,t={}){return ve({...t,x:null,y:null},(n,r,i,o,s,a)=>a.getMarkState(e))}function TY(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)?Va:/^y$/i.test(i)?zs:qa,r=i(AY(n,r)),r.title=null,o===void 0&&(r.preferredAnchor=i===zs?"left":"bottom");let s=iw(n.data,r);s.facet=n.facet,s.facetAnchor=n.facetAnchor,t.push(s)}}return t}function EY(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:h}=u,x:{axis:d=c,grid:p=d===null?null:l}=i,y:{axis:m=c,grid:y=m===null?null:l}=o,fx:{axis:g=f,grid:b=g===null?null:h}=s,fy:{axis:x=f,grid:w=x===null?null:h}=a}=n;(r||!Do(i)&&!HO("x",e))&&(d=p=null),(r||!Do(o)&&!HO("y",e))&&(m=y=null),t.has("fx")||(g=b=null),t.has("fy")||(x=w=null),d===void 0&&(d=!aw(e,"x")),m===void 0&&(m=!aw(e,"y")),g===void 0&&(g=!aw(e,"fx")),x===void 0&&(x=!aw(e,"fy")),d===!0&&(d="bottom"),m===!0&&(m="left"),g===!0&&(g=d==="top"||d===null?"bottom":"top"),x===!0&&(x=m==="right"||m===null?"left":"right");let v=[];return sw(v,w,J1,a),ow(v,x,Z1,"right","left",u,a),sw(v,b,ew,s),ow(v,g,Q1,"top","bottom",u,s),sw(v,y,K1,o),ow(v,m,bm,"left","right",n,o),sw(v,p,tw,i),ow(v,d,xm,"bottom","top",n,i),v}function ow(e,t,n,r,i,o,s){if(!t)return;let a=DY(t);s=NY(a?r:t,o,s);let{line:c}=s;(n===bm||n===xm)&&c&&!Rs(c)&&e.push(xf(OY(s))),e.push(n(s)),a&&e.push(n({...s,anchor:i,label:null}))}function sw(e,t,n,r){!t||Rs(t)||e.push(n(BY(t,r)))}function DY(e){return/^\s*both\s*$/i.test(e)}function NY(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:h=t.label,labelAnchor:d,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:h,labelAnchor:d,labelArrow:p,labelOffset:m}}function OY(e){let{anchor:t,line:n}=e;return{anchor:t,facetAnchor:t+"-empty",stroke:n===!0?void 0:n}}function BY(e,{stroke:t=Fa(e)?e:void 0,ticks:n=LY(e)?e:void 0,tickSpacing:r,ariaLabel:i,ariaDescription:o}){return{stroke:t,ticks:n,tickSpacing:r,ariaLabel:i,ariaDescription:o}}function LY(e){switch(typeof e){case"number":return!0;case"string":return!Fa(e)}return sr(e)||typeof e?.range=="function"}function aw(e,t){let n=`${t}-axis `;return e.some(r=>r.ariaLabel?.startsWith(n))}function HO(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 FY(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 CY({fx:e,fy:t},n){let{marginTop:r,marginRight:i,marginBottom:o,marginLeft:s,width:a,height:c}=T1(n),l=e&&ZO(e),u=t&&ZO(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 ZO(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 RY=new Map([["basis",n3],["basis-closed",r3],["basis-open",i3],["bundle",o3],["bump-x",QS],["bump-y",KS],["cardinal",s3],["cardinal-closed",a3],["cardinal-open",c3],["catmull-rom",l3],["catmull-rom-closed",u3],["catmull-rom-open",f3],["linear",Ds],["linear-closed",h3],["monotone-x",p3],["monotone-y",m3],["natural",y3],["step",g3],["step-after",x3],["step-before",b3]]);function Im(e=Ds,t){if(typeof e=="function")return e;let n=RY.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 cw(e=Wa,t){return typeof e!="function"&&`${e}`.toLowerCase()==="auto"?Wa:Im(e,t)}function Wa(e){return Ds(e)}function Ro(e={y:"count"},t={}){[e,t]=kM(e,t);let{x:n,y:r}=t;return RM(lw(n,t,W),null,null,r,e,fl(t))}function ko(e={x:"count"},t={}){[e,t]=kM(e,t);let{x:n,y:r}=t;return RM(null,lw(r,t,W),n,null,e,hl(t))}function Vs(e={fill:"count"},t={}){[e,t]=kM(e,t);let{x:n,y:r}=kY(t);return RM(n,r,null,null,e,fl(hl(t)))}function tB(e,t,n={}){if(n?.interval==null)return n;let{reduce:r=w1}=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 tB(Ro,"y",Ci(e,"x"))}function _f(e={}){return tB(ko,"x",Ci(e,"y"))}function RM(e,t,n,r,{data:i=x1,filter:o=sm,sort:s,reverse:a,...c}={},l={}){e=KO(e),t=KO(t),c=$Y(c,l),i=rB(i,W),s=s==null?void 0:eB("sort",s,l),o=o==null?void 0:nB("filter",o,l),n!=null&&Lo(c,"x","x1","x2")&&(n=null),r!=null&&Lo(c,"y","y1","y2")&&(r=null);let[u,f]=Dn(e),[h,d]=Dn(e),[p,m]=Dn(t),[y,g]=Dn(t),[b,x]=n!=null?[n,"x"]:r!=null?[r,"y"]:[],[w,v]=Dn(b),{x:_,y:M,z:E,fill:I,stroke:N,x1:A,x2:O,y1:L,y2:S,domain:T,cumulative:D,thresholds:C,interval:R,...F}=l,[k,$]=Dn(E),[U]=De(I),[G]=De(N),[et,rt]=Dn(U),[st,j]=Dn(G);return{..."z"in l&&{z:k||E},..."fill"in l&&{fill:et||I},..."stroke"in l&&{stroke:st||N},...mn(F,(ot,z,H)=>{let nt=sl(bt(ot,b),H?.[x]),P=bt(ot,E),Lt=bt(ot,U),ft=bt(ot,G),Wt=lm(c,{z:P,fill:Lt,stroke:ft}),Ht=[],J=[],oe=nt&&v([]),br=P&&$([]),Ui=Lt&&rt([]),OL=ft&&j([]),GI=e&&f([]),BL=e&&d([]),XI=t&&m([]),LL=t&&g([]),FL=zY(e,t,ot),CL=0;for(let Il of c)Il.initialize(ot);s&&s.initialize(ot),o&&o.initialize(ot);for(let Il of z){let HI=[];for(let Al of c)Al.scope("facet",Il);s&&s.scope("facet",Il),o&&o.scope("facet",Il);for(let[Al,RL]of Ca(Il,Wt))for(let[kL,ly]of Ca(RL,nt))for(let[Pi,Vo]of FL(ly))if(Wt&&(Vo.z=Al),!(o&&!o.reduce(Pi,Vo))){HI.push(CL++),J.push(i.reduceIndex(Pi,ot,Vo)),nt&&oe.push(kL),P&&br.push(Wt===P?Al:P[(Pi.length>0?Pi:ly)[0]]),Lt&&Ui.push(Wt===Lt?Al:Lt[(Pi.length>0?Pi:ly)[0]]),ft&&OL.push(Wt===ft?Al:ft[(Pi.length>0?Pi:ly)[0]]),GI&&(GI.push(Vo.x1),BL.push(Vo.x2)),XI&&(XI.push(Vo.y1),LL.push(Vo.y2));for(let $L of c)$L.reduce(Pi,Vo);s&&s.reduce(Pi,Vo)}Ht.push(HI)}return X3(Ht,s,a),{data:J,facets:Ht}}),...!Lo(c,"x")&&(u?{x1:u,x2:h,x:tf(u,h)}:{x:_,x1:A,x2:O}),...!Lo(c,"y")&&(p?{y1:p,y2:y,y:tf(p,y)}:{y:M,y1:L,y2:S}),...w&&{[x]:w},...Object.fromEntries(c.map(({name:ot,output:z})=>[ot,z]))}}function kM({cumulative:e,domain:t,thresholds:n,interval:r,...i},o){return[i,{cumulative:e,domain:t,thresholds:n,interval:r,...o}]}function lw(e,{cumulative:t,domain:n,thresholds:r,interval:i},o){return e={...ci(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=$M(e.thresholds,e.interval),e}function kY(e){let{x:t,y:n}=e;return t=lw(t,e),n=lw(n,e),[t.value,n.value]=Re(t.value,n.value),{x:t,y:n}}function KO(e){if(e==null)return;let{value:t,cumulative:n,domain:r=ae,thresholds:i}=e,o=s=>{let a=bt(s,t),c;if(Ne(a)||PY(i)){a=Yt(a,O3,Float64Array);let[u,f]=typeof r=="function"?r(a):r,h=typeof i=="function"&&!La(i)?i(a,u,f):i;typeof h=="number"&&(h=Ep(u,f,h)),La(h)&&(r===ae&&(u=h.floor(u),f=h.offset(h.floor(f))),h=h.range(u,h.offset(f))),c=h}else{a=Qe(a);let[u,f]=typeof r=="function"?r(a):r,h=typeof i=="function"&&!La(i)?i(a,u,f):i;if(typeof h=="number")if(r===ae){let d=fs(u,f,h);if(isFinite(d))if(d>0){let p=Math.round(u/d),m=Math.round(f/d);p*d<=u||--p,m*d>f||++m;let y=m-p+1;h=new Float64Array(y);for(let g=0;g<y;++g)h[g]=(p+g)*d}else if(d<0){d=-d;let p=Math.round(u*d),m=Math.round(f*d);p/d<=u||--p,m/d>f||++m;let y=m-p+1;h=new Float64Array(y);for(let g=0;g<y;++g)h[g]=(p+g)/d}else h=[u];else h=[u]}else h=Mn(u,f,h);else La(h)&&(r===ae&&(u=h.floor(u),f=h.offset(h.floor(f))),h=h.range(u,h.offset(f)));c=h}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?VY:n>0?qY:UM)(l,c,a),l};return o.label=Nn(t),o}function $M(e,t,n=JO){if(e===void 0)return t===void 0?n:Oo(t);if(typeof e=="string"){switch(e.toLowerCase()){case"freedman-diaconis":return tg;case"scott":return Sd;case"sturges":return fa;case"auto":return JO}return nm(e)}return e}function $Y(e,t){return W3(e,t,eB)}function eB(e,t,n){return g1(e,t,n,nB)}function nB(e,t,n){return b1(e,t,n,rB)}function rB(e,t){return of(e,t,UY)}function UY(e){switch(`${e}`.toLowerCase()){case"x":return jY;case"x1":return WY;case"x2":return GY;case"y":return YY;case"y1":return XY;case"y2":return HY;case"z":return H3}throw new Error(`invalid bin reduce: ${e}`)}function JO(e,t,n){return Math.min(200,Sd(e,t,n))}function PY(e){return gD(e)||sr(e)&&Ne(e)}function zY(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,[h,d]]of i.entries())yield[u[f],{data:n,x1:c,y1:h,x2:l,y2:d}]}}: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 UM(e,t,n){return t=Qe(t),r=>{let i=e.map(()=>[]);for(let o of r)i[ls(t,n[o])-1]?.push(o);return i}}function qY(e,t,n){let r=UM(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 VY(e,t,n){let r=UM(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 iB(e,t){let n=(+e+ +t)/2;return e instanceof Date?new Date(n):n}var jY={reduceIndex(e,t,{x1:n,x2:r}){return iB(n,r)}},YY={reduceIndex(e,t,{y1:n,y2:r}){return iB(n,r)}},WY={reduceIndex(e,t,{x1:n}){return n}},GY={reduceIndex(e,t,{x2:n}){return n}},XY={reduceIndex(e,t,{y1:n}){return n}},HY={reduceIndex(e,t,{y2:n}){return n}};function vf(e={}){return L3(e)?e:{...e,x:W}}function Sf(e={}){return F3(e)?e:{...e,y:W}}function oB(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=Ba(e);let o=e[E3]=new Uint32Array(n+i);t=t.map(a=>Ba(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 PM(e={},t={}){arguments.length===1&&([e,t]=Af(e));let{y1:n,y:r=n,x:i,...o}=t,[s,a,c,l]=Tf(r,i,"y","x",e,o);return{...s,y1:n,y:a,x1:c,x2:l,x:tf(c,l)}}function cB(e={},t={}){arguments.length===1&&([e,t]=Af(e));let{y1:n,y:r=n,x:i}=t,[o,s,a]=Tf(r,i,"y","x",e,t);return{...o,y1:n,y:s,x:a}}function lB(e={},t={}){arguments.length===1&&([e,t]=Af(e));let{y1:n,y:r=n,x:i}=t,[o,s,,a]=Tf(r,i,"y","x",e,t);return{...o,y1:n,y:s,x:a}}function zM(e={},t={}){arguments.length===1&&([e,t]=Af(e));let{x1:n,x:r=n,y:i,...o}=t,[s,a,c,l]=Tf(r,i,"x","y",e,o);return{...s,x1:n,x:a,y1:c,y2:l,y:tf(c,l)}}function uB(e={},t={}){arguments.length===1&&([e,t]=Af(e));let{x1:n,x:r=n,y:i}=t,[o,s,a]=Tf(r,i,"x","y",e,t);return{...o,x1:n,x:s,y:a}}function fB(e={},t={}){arguments.length===1&&([e,t]=Af(e));let{x1:n,x:r=n,y:i}=t,[o,s,,a]=Tf(r,i,"x","y",e,t);return{...o,x1:n,x:s,y:a}}function Mf({x:e,x1:t,x2:n,...r}={}){return r=Ci(r,"y"),t===void 0&&n===void 0?PM({x:e,...r}):([t,n]=C3(e,t,n),{...r,x1:t,x2:n})}function If({y:e,y1:t,y2:n,...r}={}){return r=Ci(r,"x"),t===void 0&&n===void 0?zM({y:e,...r}):([t,n]=C3(e,t,n),{...r,y1:t,y2:n})}function Af(e){let{offset:t,order:n,reverse:r,...i}=e;return[{offset:t,order:n,reverse:r},i]}var ZY={length:!0};function Tf(e,t=rm,n,r,{offset:i,order:o,reverse:s},a){if(t===null)throw new Error(`stack requires ${r}`);let c=zn(a),[l,u]=Dn(e),[f,h]=pn(t),[d,p]=pn(t);return f.hint=d.hint=ZY,i=QY(i),o=tW(o,i,r),[mn(a,(m,y,g)=>{({data:m,facets:y}=oB(m,y));let b=e==null?void 0:u(sl(bt(m,e),g?.[n])),x=bt(m,t,Float64Array),w=bt(m,c),v=o&&o(m,b,x,w),_=m.length,M=h(new Float64Array(_)),E=p(new Float64Array(_)),I=[];for(let N of y){let A=b?Array.from(an(N,O=>b[O]).values()):[N];if(v)for(let O of A)O.sort(v);for(let O of A){let L=0,S=0;s&&O.reverse();for(let T of O){let D=x[T];D<0?L=E[T]=(M[T]=L)+D:D>0?S=E[T]=(M[T]=S)+D:E[T]=M[T]=S}}I.push(A)}return i&&i(I,M,E,w),{data:m,facets:y}}),l,f,d]}function QY(e){if(e!=null){if(typeof e=="function")return e;switch(`${e}`.toLowerCase()){case"expand":case"normalize":return KY;case"center":case"silhouette":return JY;case"wiggle":return dB}throw new Error(`unknown offset: ${e}`)}}function hB(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 KY(e,t,n){for(let r of e)for(let i of r){let[o,s]=hB(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 JY(e,t,n){for(let r of e){for(let i of r){let[o,s]=hB(i,n);for(let a of i){let c=(s+o)/2;t[a]-=c,n[a]-=c}}pB(r,t,n)}mB(e,t,n)}function dB(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(d=>Math.abs(n[d]-t[d])),u=a.map(d=>{c=r?r[d]:++c;let p=n[d]-t[d],m=o.has(c)?p-o.get(c):0;return o.set(c,p),m}),f=[0,...H0(u)];for(let d of a)t[d]+=s,n[d]+=s;let h=In(l);h&&(s-=In(l,(d,p)=>(u[p]/2+f[p])*d)/h)}pB(i,t,n)}mB(e,t,n)}function pB(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 mB(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])+Xt(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 tW(e,t,n){if(e===void 0&&t===dB)return sB(fn);if(e!=null){if(typeof e=="string"){let r=e.startsWith("-"),i=r?nl:fn;switch((r?e.slice(1):e).toLowerCase()){case"value":case n:return eW(i);case"z":return nW(i);case"sum":return rW(i);case"appearance":return iW(i);case"inside-out":return sB(i)}return aB(D3(e))}if(typeof e=="function")return(e.length===1?aB:oW)(e);if(Array.isArray(e))return sW(e);throw new Error(`invalid order: ${e}`)}}function eW(e){return(t,n,r)=>(i,o)=>e(r[i],r[o])}function nW(e){return(t,n,r,i)=>(o,s)=>e(i[o],i[s])}function rW(e){return uw(e,(t,n,r,i)=>ru(or(t),o=>In(o,s=>r[s]),o=>i[o]))}function iW(e){return uw(e,(t,n,r,i)=>ru(or(t),o=>n[Ec(o,s=>r[s])],o=>i[o]))}function sB(e){return uw(e,(t,n,r,i)=>{let o=or(t),s=ru(o,f=>n[Ec(f,h=>r[h])],f=>i[f]),a=Ei(o,f=>In(f,h=>r[h]),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 aB(e){return t=>{let n=bt(t,e);return(r,i)=>fn(n[r],n[i])}}function oW(e){return t=>(n,r)=>e(t[n],t[r])}function sW(e){return uw(fn,()=>e)}function uw(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 aW={ariaLabel:"area",strokeWidth:1,strokeLinecap:"round",strokeLinejoin:"round",strokeMiterlimit:1},gl=class extends _t{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:zn(n),optional:!0}},n,aW),this.z=a,this.curve=Im(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 lt("svg:g",o).call(Bt,this,i,o).call(It,this,n,0,0).call(u=>u.selectAll().data(B1(t,[s,a,c,l],this,r)).enter().append("path").call(Ot,this).call(ul,this,r).attr("d",qu().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 Am(e,t){return t===void 0?js(e,{x:ol,y:Oa}):new gl(e,t)}function Ga(e,t){let{y:n=Ie,...r}=_f(t);return new gl(e,Mf(vf({...r,y1:n,y2:void 0})))}function js(e,t){let{x:n=Ie,...r}=wf(t);return new gl(e,If(Sf({...r,x1:n,x2:void 0})))}var cW={ariaLabel:"link",fill:"none",stroke:"currentColor",strokeMiterlimit:1},Tm=class extends _t{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,cW),this.curve=cw(a,c),Ri(this,n)}project(t,n,r){this.curve!==Wa&&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 lt("svg:g",o).call(Bt,this,i,o).call(It,this,n).call(f=>f.selectAll().data(t).enter().append("path").call(Ot,this).attr("d",u===Wa&&o.projection?lW(o.projection,s,a,c,l):h=>{let d=Jn(),p=u(d);return p.lineStart(),p.point(s[h],a[h]),p.point(c[h],l[h]),p.lineEnd(),d}).call(Zt,this,r).call(qs,this,r,o)).node()}};function lW(e,t,n,r,i){let o=Tn(e);return t=Qe(t),n=Qe(n),r=Qe(r),i=Qe(i),s=>o({type:"LineString",coordinates:[[t[s],n[s]],[r[s],i[s]]]})}function fw(e,{x:t,x1:n,x2:r,y:i,y1:o,y2:s,...a}={}){return[n,r]=Em(t,n,r),[o,s]=Em(i,o,s),new Tm(e,{...a,x1:n,x2:r,y1:o,y2:s})}function Em(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 uW={ariaLabel:"arrow",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeMiterlimit:1,strokeWidth:1.5},Dm=class extends _t{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:h=u,sweep:d}=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,uW),this.bend=a===!0?22.5:Math.max(-90,Math.min(90,a)),this.headAngle=+c,this.headLength=+l,this.insetStart=+f,this.insetEnd=+h,this.sweep=fW(d)}render(t,n,r,i,o){let{x1:s,y1:a,x2:c=s,y2:l=a,SW:u}=r,{strokeWidth:f,bend:h,headAngle:d,headLength:p,insetStart:m,insetEnd:y}=this,g=u?w=>u[w]:hn(f===void 0?1:f),b=d*yf/2,x=p/1.5;return lt("svg:g",o).call(Bt,this,i,o).call(It,this,n).call(w=>w.selectAll().data(t).enter().append("path").call(Ot,this).attr("d",v=>{let _=s[v],M=a[v],E=c[v],I=l[v],N=Math.hypot(E-_,I-M);if(N<=m+y)return null;let A=Math.atan2(I-M,E-_),O=Math.min(x*g(v),N/3),L=this.sweep(_,M,E,I)*h*yf,S=Math.hypot(N/Math.tan(L),N)/2;if(m||y)if(S<1e5){let et=Math.sign(L),[rt,st]=hW([_,M],[E,I],S,et);if(m&&([_,M]=yB([rt,st,S],[_,M,m],-et*Math.sign(m))),y){let[j,ot]=yB([rt,st,S],[E,I,y],et*Math.sign(y));A+=Math.atan2(ot-st,j-rt)-Math.atan2(I-st,E-rt),E=j,I=ot}}else{let et=E-_,rt=I-M,st=Math.hypot(et,rt);m&&(_+=et/st*m,M+=rt/st*m),y&&(E-=et/st*y,I-=rt/st*y)}let T=A+L,D=T+b,C=T-b,R=E-O*Math.cos(D),F=I-O*Math.sin(D),k=E-O*Math.cos(C),$=I-O*Math.sin(C),U=S<1e5?`A${S},${S} 0,0,${L>0?1:0} `:"L",G=O?`M${R},${F}L${E},${I}L${k},${$}`:"";return`M${_},${M}${U}${E},${I}${G}`}).call(Zt,this,r)).node()}};function fW(e=1){if(typeof e=="number")return hn(Math.sign(e));if(typeof e=="function")return(t,n,r,i)=>Math.sign(e(t,n,r,i));switch(rn(e,"sweep",["+x","-x","+y","-y"])){case"+x":return(t,n,r)=>Et(t,r);case"-x":return(t,n,r)=>Gn(t,r);case"+y":return(t,n,r,i)=>Et(n,i);case"-y":return(t,n,r,i)=>Gn(n,i)}}function hW([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 yB([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 gB(e,{x:t,x1:n,x2:r,y:i,y1:o,y2:s,...a}={}){return[n,r]=Em(t,n,r),[o,s]=Em(i,o,s),new Dm(e,{...a,x1:n,x2:r,y1:o,y2:s})}var Ef=class extends _t{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 lt("svg:g",o).call(Bt,this,i,o).call(this._transform,this,n).call(c=>c.selectAll().data(t).enter().append("rect").call(Ot,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(ut,"rx",s).call(ut,"ry",a).call(Zt,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)}},bB={ariaLabel:"bar"},Nm=class extends Ef{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,bB)}_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 ar(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 ar(t)?s-i-o-a-c:l=>Math.max(0,Math.abs(r[l]-n[l])-a-c)}},Om=class extends Ef{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,bB)}_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 ar(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 ar(t)?s-i-o-a-c:l=>Math.max(0,Math.abs(r[l]-n[l])-a-c)}};function $o(e,t={}){return Ku(t)||(t={...t,y:Ie,x2:W}),new Nm(e,Mf(U1(vf(t))))}function Uo(e,t={}){return Ku(t)||(t={...t,x:Ie,y2:W}),new Om(e,If(P1(Sf(t))))}var dW={ariaLabel:"cell"},bl=class extends Ef{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,dW)}_transform(t,n){t.call(It,n,{},0,0)}};function Xa(e,{x:t,y:n,...r}={}){return[t,n]=Re(t,n),new bl(e,{...r,x:t,y:n})}function xB(e,{x:t=Ie,fill:n,stroke:r,...i}={}){return n===void 0&&De(r)[0]===void 0&&(n=W),new bl(e,{...i,x:t,fill:n,stroke:r})}function wB(e,{y:t=Ie,fill:n,stroke:r,...i}={}){return n===void 0&&De(r)[0]===void 0&&(n=W),new bl(e,{...i,y:t,fill:n,stroke:r})}var pW={ariaLabel:"dot",fill:"none",stroke:"currentColor",strokeWidth:1.5};function Bm(e){return e.sort===void 0&&e.reverse===void 0?m1({channel:"-r"},e):e}var xl=class extends _t{constructor(t,n={}){let{x:r,y:i,r:o,rotate:s,symbol:a=Ns,frameAnchor:c}=n,[l,u]=ie(s,0),[f,h]=DD(a),[d,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:d,scale:"r",filter:ir,optional:!0},rotate:{value:l,optional:!0},symbol:{value:f,scale:"auto",optional:!0}},Bm(n),pW),this.r=p,this.rotate=u,this.symbol=h,this.frameAnchor=Bo(c);let{channels:m}=this,{symbol:y}=m;if(y){let{fill:g,stroke:b}=m;y.hint={fill:g?g.value===y.value?"color":"currentColor":this.fill??"currentColor",stroke:b?b.value===y.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:h}=r,{r:d,rotate:p,symbol:m}=this,[y,g]=gn(this,i),b=m===Ns,x=u?void 0:d*d*Math.PI;return Aa(d)&&(t=[]),lt("svg:g",o).call(Bt,this,i,o).call(It,this,{x:c&&s,y:l&&a}).call(w=>w.selectAll().data(t).enter().append(b?"circle":"path").call(Ot,this).call(b?v=>{v.attr("cx",c?_=>c[_]:y).attr("cy",l?_=>l[_]:g).attr("r",u?_=>u[_]:d)}:v=>{v.attr("transform",ja`translate(${c?_=>c[_]:y},${l?_=>l[_]:g})${f?_=>` rotate(${f[_]})`:p?` rotate(${p})`:""}`).attr("d",u&&h?_=>{let M=Jn();return h[_].draw(M,u[_]*u[_]*Math.PI),M}:u?_=>{let M=Jn();return m.draw(M,u[_]*u[_]*Math.PI),M}:h?_=>{let M=Jn();return h[_].draw(M,x),M}:(()=>{let _=Jn();return m.draw(_,x),_})())}).call(Zt,this,r)).node()}};function ui(e,{x:t,y:n,...r}={}){return r.frameAnchor===void 0&&([t,n]=Re(t,n)),new xl(e,{...r,x:t,y:n})}function _B(e,{x:t=W,...n}={}){return new xl(e,q1({...n,x:t}))}function vB(e,{y:t=W,...n}={}){return new xl(e,z1({...n,y:t}))}function SB(e,t){return ui(e,{...t,symbol:"circle"})}function MB(e,t){return ui(e,{...t,symbol:"hexagon"})}var mW={ariaLabel:"line",fill:"none",stroke:"currentColor",strokeWidth:1.5,strokeLinecap:"round",strokeLinejoin:"round",strokeMiterlimit:1},wl=class extends _t{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:zn(n),optional:!0}},n,mW),this.z=o,this.curve=cw(s,a),Ri(this,n)}filter(t){return t}project(t,n,r){this.curve!==Wa&&super.project(t,n,r)}render(t,n,r,i,o){let{x:s,y:a}=r,{curve:c}=this;return lt("svg:g",o).call(Bt,this,i,o).call(It,this,n).call(l=>l.selectAll().data(B1(t,[s,a],this,r)).enter().append("path").call(Ot,this).call(ul,this,r).call(eO,this,r,o).attr("d",c===Wa&&o.projection?yW(o.projection,s,a):kp().curve(c).defined(u=>u>=0).x(u=>s[u]).y(u=>a[u]))).node()}};function yW(e,t,n){let r=Tn(e);return t=Qe(t),n=Qe(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 _l(e,{x:t,y:n,...r}={}){return[t,n]=Re(t,n),new wl(e,{...r,x:t,y:n})}function Ha(e,{x:t=W,y:n=Ie,...r}={}){return new wl(e,_f({...r,x:t,y:n}))}function Za(e,{x:t=Ie,y:n=W,...r}={}){return new wl(e,wf({...r,x:t,y:n}))}var gW={ariaLabel:"rect"},vl=class extends _t{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:h,ry:d}=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,gW),this.insetTop=Nt(c),this.insetRight=Nt(l),this.insetBottom=Nt(u),this.insetLeft=Nt(f),this.rx=le(h,"auto"),this.ry=le(d,"auto")}render(t,n,r,i,o){let{x:s,y:a}=n,{x1:c,y1:l,x2:u,y2:f}=r,{marginTop:h,marginRight:d,marginBottom:p,marginLeft:m,width:y,height:g}=i,{projection:b}=o,{insetTop:x,insetRight:w,insetBottom:v,insetLeft:_,rx:M,ry:E}=this,I=(s?.bandwidth?s.bandwidth():0)-_-w,N=(a?.bandwidth?a.bandwidth():0)-x-v;return lt("svg:g",o).call(Bt,this,i,o).call(It,this,{},0,0).call(A=>A.selectAll().data(t).enter().append("rect").call(Ot,this).attr("x",c&&(b||!ar(s))?u?O=>Math.min(c[O],u[O])+_:O=>c[O]+_:m+_).attr("y",l&&(b||!ar(a))?f?O=>Math.min(l[O],f[O])+x:O=>l[O]+x:h+x).attr("width",c&&(b||!ar(s))?u?O=>Math.max(0,Math.abs(u[O]-c[O])+I):I:y-d-m-w-_).attr("height",l&&(b||!ar(a))?f?O=>Math.max(0,Math.abs(l[O]-f[O])+N):N:g-h-p-x-v).call(ut,"rx",M).call(ut,"ry",E).call(Zt,this,r)).node()}};function Lm(e,t){return new vl(e,vM(SM(t)))}function Df(e,t={}){return Ku(t)||(t={...t,y:Ie,x2:W,interval:1}),new vl(e,Mf(SM(vf(t))))}function Nf(e,t={}){return Ku(t)||(t={...t,x:Ie,y2:W,interval:1}),new vl(e,If(vM(Sf(t))))}function VM(e,t){t=bW(t);let{x:n,y:r,color:i,size:o}=t,s=hw(e,n),a=hw(e,r),c=hw(e,i),l=hw(e,o),{fx:u,fy:f,x:{value:h,reduce:d,zero:p,...m},y:{value:y,reduce:g,zero:b,...x},color:{value:w,color:v,reduce:_},size:{value:M,reduce:E},mark:I}=t;if(d===void 0&&(d=g==null&&h==null&&M==null&&y!=null?"count":null),g===void 0&&(g=d==null&&y==null&&M==null&&h!=null?"count":null),E===void 0&&M==null&&_==null&&d==null&&g==null&&(h==null||Ae(s))&&(y==null||Ae(a))&&(E="count"),p===void 0&&(p=dw(d)?!0:void 0),b===void 0&&(b=dw(g)?!0:void 0),h==null&&y==null)throw new Error("must specify x or y");if(d!=null&&y==null)throw new Error("reducing x requires y");if(g!=null&&h==null)throw new Error("reducing y requires x");I===void 0&&(I=M!=null||E!=null?"dot":dw(d)||dw(g)||_!=null?"bar":h!=null&&y!=null?Ae(s)||Ae(a)||d==null&&g==null&&!Fm(s)&&!Fm(a)?"dot":"line":h!=null||y!=null?"rule":null);let N,A,O;switch(I){case"dot":O=ui,A="stroke";break;case"line":O=s&&a||d!=null||g!=null?b||g!=null||s&&Fm(s)?Za:p||d!=null||a&&Fm(a)?Ha:_l:s?Ha:Za,A="stroke",AB(c)&&(N=null);break;case"area":O=!(b||g!=null)&&(p||d!=null||a&&Fm(a))?Ga:js,A="fill",AB(c)&&(N=null);break;case"rule":O=s?Rr:kr,A="stroke";break;case"bar":O=d!=null?Ae(a)?IB(d)&&s&&Ae(s)?Xa:$o:Df:g!=null?Ae(s)?IB(g)&&a&&Ae(a)?Xa:Uo:Nf:_!=null||E!=null?s&&Ae(s)&&a&&Ae(a)?Xa:s&&Ae(s)?Uo:a&&Ae(a)?$o:Lm:s&&Cs(s)&&!(a&&Cs(a))?$o:a&&Cs(a)&&!(s&&Cs(s))?Uo:Xa,A="fill";break;default:throw new Error(`invalid mark: ${I}`)}let L={fx:u,fy:f,x:s??void 0,y:a??void 0,[A]:c??v,z:N,r:l??void 0,tip:!0},S,T={[A]:_??void 0,r:E??void 0};if(d!=null&&g!=null)throw new Error("cannot reduce both x and y");return g!=null?(T.y=g,S=Ae(s)?Ra:Ro):d!=null?(T.x=d,S=Ae(a)?ka:ko):(_!=null||E!=null)&&(s&&a?S=Ae(s)&&Ae(a)?cm:Ae(s)?ko:Ae(a)?Ro:Vs:s?S=Ae(s)?Ra:Ro:a&&(S=Ae(a)?ka:ko)),(S===Vs||S===Ro)&&(L.x={value:s,...m}),(S===Vs||S===ko)&&(L.y={value:a,...x}),p===void 0&&(p=s&&!(S===Vs||S===Ro)&&(O===$o||O===Ga||O===Df||O===kr)),b===void 0&&(b=a&&!(S===Vs||S===ko)&&(O===Uo||O===js||O===Nf||O===Rr)),{fx:u??null,fy:f??null,x:{value:h??null,reduce:d??null,zero:!!p,...m},y:{value:y??null,reduce:g??null,zero:!!b,...x},color:{value:w??null,reduce:_??null,...v!==void 0&&{color:v}},size:{value:M??null,reduce:E??null},mark:I,markImpl:TB[O],markOptions:L,transformImpl:TB[S],transformOptions:T,colorMode:A}}function EB(e,t){let n=VM(e,t),{fx:r,fy:i,x:{zero:o},y:{zero:s},markOptions:a,transformOptions:c,colorMode:l}=n,u=qM[n.markImpl],f=qM[n.transformImpl],h=r!=null||i!=null?xf({strokeOpacity:.1}):null,d=[o?Rr([0]):null,s?kr([0]):null],p=u(e,f?f(c,a):a);return l==="stroke"?Ke(h,d,p):Ke(h,p,d)}function Fm(e){let t,n;for(let r of e){if(r==null)continue;if(t===void 0){t=r;continue}let i=Math.sign(Et(t,r));if(i){if(n!==void 0&&i!==n)return!1;t=r,n=i}}return!0}function bW({x:e,y:t,color:n,size:r,fx:i,fy:o,mark:s}={}){return Fr(e)||(e=Of(e)),Fr(t)||(t=Of(t)),Fr(n)||(n=Fa(n)?{color:n}:Of(n)),Fr(r)||(r=Of(r)),Fr(i)&&({value:i}=Of(i)),Fr(o)&&({value:o}=Of(o)),s!=null&&(s=`${s}`.toLowerCase()),{x:e,y:t,color:n,size:r,fx:i,fy:o,mark:s}}function hw(e,t){let n=bt(e,t.value);return n&&(n.label=Nn(t.value)),n}function Of(e){return xW(e)?{reduce:e}:{value:e}}function dw(e){return/^(?:distinct|count|sum|proportion)$/i.test(e)}function IB(e){return/^(?:first|last|mode)$/i.test(e)}function xW(e){if(e==null)return!1;if(typeof e.reduceIndex=="function"||typeof e.reduce=="function"&&dn(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 AB(e){return e?new Hn(e).size>e.length>>1:!1}var qM={dot:ui,line:_l,lineX:Ha,lineY:Za,areaX:Ga,areaY:js,ruleX:Rr,ruleY:kr,barX:$o,barY:Uo,rect:Lm,rectX:Df,rectY:Nf,cell:Xa,bin:Vs,binX:Ro,binY:ko,group:cm,groupX:Ra,groupY:ka},TB=Object.fromEntries(Object.entries(qM).map(([e,t])=>[t,e]));function Bf(e,t={}){let{x:n,x1:r,x2:i}=t;n===void 0&&r===void 0&&i===void 0&&(t={...t,x:n=W});let o={};return n!=null&&(o.x=e),r!=null&&(o.x1=e),i!=null&&(o.x2=e),gr(o,t)}function Lf(e,t={}){let{y:n,y1:r,y2:i}=t;n===void 0&&r===void 0&&i===void 0&&(t={...t,y:n=W});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=zn(t),r=Object.entries(e).map(([i,o])=>{let s=l1(i,t);if(s==null)throw new Error(`missing channel: ${i}`);let[a,c]=pn(s);return{key:i,input:s,output:a,setOutput:c,map:wW(o)}});return{...mn(t,(i,o)=>{let s=bt(i,n),a=r.map(({input:l})=>bt(i,l)),c=r.map(({setOutput:l})=>l(new Array(i.length)));for(let l of o)for(let u of s?an(l,f=>s[f]).values():[l])r.forEach(({map:f},h)=>f.mapIndex(u,a[h],c[h]));return{data:i,facets:o}}),...Object.fromEntries(r.map(({key:i,output:o})=>[i,o]))}}function wW(e){if(e==null)throw new Error("missing map");if(typeof e.mapIndex=="function")return e;if(typeof e.map=="function"&&dn(e))return _W(e);if(typeof e=="function")return jM(Ju(e));switch(`${e}`.toLowerCase()){case"cumsum":return SW;case"rank":return jM((t,n)=>Md(t,r=>n[r]));case"quantile":return jM((t,n)=>vW(t,r=>n[r]))}throw new Error(`invalid map: ${e}`)}function _W(e){return console.warn("deprecated map interface; implement mapIndex instead."),{mapIndex:e.map.bind(e)}}function vW(e,t){let n=co(e,t)-1;return Md(e,t).map(r=>r/n)}function jM(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 SW={mapIndex(e,t,n){let r=0;for(let i of e)n[i]=r+=t[i]}};function DB(e={},t){return arguments.length===1&&(t=e),Bf(Ff(e),t)}function NB(e={},t){return arguments.length===1&&(t=e),Lf(Ff(e),t)}function Ff(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=IW(r),qn(`Warning: the shift option is deprecated; please use anchor "${i}" instead.`)),!((t=Math.floor(t))>0))throw new Error(`invalid k: ${t}`);return AW(n)(t,MW(i,t),o)}function MW(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 IW(e){switch(`${e}`.toLowerCase()){case"centered":return"middle";case"leading":return"start";case"trailing":return"end"}throw new Error(`invalid shift: ${e}`)}function AW(e="mean"){if(typeof e=="string"){if(/^p\d{2}$/i.test(e))return pw(Qu(e));switch(e.toLowerCase()){case"deviation":return pw(Qr);case"max":return mw((t,n)=>Xt(t,r=>n[r]));case"mean":return TW;case"median":return pw(Di);case"min":return mw((t,n)=>ce(t,r=>n[r]));case"mode":return mw((t,n)=>au(t,r=>n[r]));case"sum":return OB;case"variance":return pw(ua);case"difference":return NW;case"ratio":return OW;case"first":return BW;case"last":return LW}}if(typeof e!="function")throw new Error(`invalid reduce: ${e}`);return mw(Ju(e))}function pw(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(Ls(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(Ls(i,0,c+t),a);for(let c=0,l=i.length-n;c<l;++c)s[i[c+n]]=e(Ls(i,c,c+t),a)}}}function mw(e){return(t,n,r)=>r?{mapIndex(i,o,s){let a=0;for(let c=0;c<t-1;++c)a+=$e(o[i[c]]);for(let c=0,l=i.length-t+1;c<l;++c)a+=$e(o[i[c+t-1]]),a===t&&(s[i[c+n]]=e(Ls(i,c,c+t),o)),a-=$e(o[i[c]])}}:{mapIndex(i,o,s){for(let a=-n;a<0;++a)s[i[a+n]]=e(Ls(i,0,a+t),o);for(let a=0,c=i.length-n;a<c;++a)s[i[a+n]]=e(Ls(i,a,a+t),o)}}}function OB(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 TW(e,t,n){if(n){let r=OB(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]],h=i[r[l]];f!==null&&!isNaN(f=+f)&&(s+=f,++a),o[r[l+t]]=s/a,h!==null&&!isNaN(h=+h)&&(s-=h,--a)}}}}function EW(e,t,n,r){for(let i=n+r;n<i;++n){let o=e[t[n]];if($e(o))return o}}function DW(e,t,n,r){for(let i=n+r-1;i>=n;--i){let o=e[t[i]];if($e(o))return o}}function BB(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 LB(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 NW(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]]=LB(i,r,s,e)-BB(i,r,s,e)}}}function OW(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]]=LB(i,r,s,e)/BB(i,r,s,e)}}}function BW(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]]=EW(i,r,s,e)}}}function LW(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]]=DW(i,r,s,e)}}}var Ys={n:20,k:2,color:"currentColor",opacity:.2,strict:!0,anchor:"end"};function FB(e,{x:t=W,y:n,k:r=Ys.k,color:i=Ys.color,opacity:o=Ys.opacity,fill:s=i,fillOpacity:a=o,stroke:c=i,strokeOpacity:l,strokeWidth:u,...f}={}){return Ke(ee(s)?null:Ga(e,gr({x1:Qa({k:-r,...f}),x2:Qa({k:r,...f})},{x1:t,x2:t,y:n,fill:s,fillOpacity:a,...f})),ee(c)?null:Ha(e,gr({x:Qa(f)},{x:t,y:n,stroke:c,strokeOpacity:l,strokeWidth:u,...f})))}function CB(e,{x:t,y:n=W,k:r=Ys.k,color:i=Ys.color,opacity:o=Ys.opacity,fill:s=i,fillOpacity:a=o,stroke:c=i,strokeOpacity:l,strokeWidth:u,...f}={}){return Ke(ee(s)?null:js(e,gr({y1:Qa({k:-r,...f}),y2:Qa({k:r,...f})},{x:t,y1:n,y2:n,fill:s,fillOpacity:a,...f})),ee(c)?null:Za(e,gr({y:Qa(f)},{x:t,y:n,stroke:c,strokeOpacity:l,strokeWidth:u,...f})))}function Qa({n:e=Ys.n,k:t=0,strict:n=Ys.strict,anchor:r=Ys.anchor}={}){return Ff({k:e,reduce:i=>hs(i)+t*(Qr(i)||0),strict:n,anchor:r})}var FW={ariaLabel:"tick",fill:null,stroke:"currentColor"},yw=class extends _t{constructor(t,n,r){super(t,n,r,FW),Ri(this,r)}render(t,n,r,i,o){return lt("svg:g",o).call(Bt,this,i,o).call(this._transform,this,n).call(s=>s.selectAll().data(t).enter().append("line").call(Ot,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(Zt,this,r).call(qs,this,r,o)).node()}},Cm=class extends yw{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},Oe,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}},Rm=class extends yw{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,Oe)}_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 gw(e,{x:t=W,...n}={}){return new Cm(e,{...n,x:t})}function bw(e,{y:t=W,...n}={}){return new Rm(e,{...n,y:t})}function RB(e,{x:t=W,y:n=null,fill:r="#ccc",fillOpacity:i,stroke:o="currentColor",strokeOpacity:s,strokeWidth:a=2,sort:c,...l}={}){let u=n!=null?ka:am;return Ke(kr(e,u({x1:YM,x2:WM},{x:t,y:n,stroke:o,strokeOpacity:s,...l})),$o(e,u({x1:"p25",x2:"p75"},{x:t,y:n,fill:r,fillOpacity:i,...l})),gw(e,u({x:"p50"},{x:t,y:n,stroke:o,strokeOpacity:s,strokeWidth:a,sort:c,...l})),ui(e,gr({x:$B},{x:t,y:n,z:n,stroke:o,strokeOpacity:s,...l})))}function kB(e,{y:t=W,x:n=null,fill:r="#ccc",fillOpacity:i,stroke:o="currentColor",strokeOpacity:s,strokeWidth:a=2,sort:c,...l}={}){let u=n!=null?Ra:am;return Ke(Rr(e,u({y1:YM,y2:WM},{x:n,y:t,stroke:o,strokeOpacity:s,...l})),Uo(e,u({y1:"p25",y2:"p75"},{x:n,y:t,fill:r,fillOpacity:i,...l})),bw(e,u({y:"p50"},{x:n,y:t,stroke:o,strokeOpacity:s,strokeWidth:a,sort:c,...l})),ui(e,gr({y:$B},{x:n,y:t,z:n,stroke:o,strokeOpacity:s,...l})))}function $B(e){let t=YM(e),n=WM(e);return e.map(r=>r<t||r>n?r:NaN)}function YM(e){let t=UB(e)*2.5-PB(e)*1.5;return ce(e,n=>n>=t?n:NaN)}function WM(e){let t=PB(e)*2.5-UB(e)*1.5;return Xt(e,n=>n<=t?n:NaN)}function UB(e){return Zn(e,.25)}function PB(e){return Zn(e,.75)}var CW={ariaLabel:"raster",stroke:null,pixelSize:1};function Cf(e,t){let n=+e;if(isNaN(n))throw new Error(`invalid ${t}: ${e}`);return n}function zB(e,t){let n=Math.floor(e);if(isNaN(n))throw new Error(`invalid ${t}: ${e}`);return n}var $m=class extends _t{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:h=c==null?s:void 0,pixelSize:d=i.pixelSize,blur:p=0,interpolate:m}=r;if(o!=null&&(o=zB(o,"width")),s!=null&&(s=zB(s,"height")),l!=null&&(l=Cf(l,"x1")),u!=null&&(u=Cf(u,"y1")),f!=null&&(f=Cf(f,"x2")),h!=null&&(h=Cf(h,"y2")),a==null&&(l==null||f==null))throw new Error("missing x");if(c==null&&(u==null||h==null))throw new Error("missing y");t!=null&&o!=null&&s!=null&&(a===void 0&&l!=null&&f!=null&&(a=VW(l,f,o,s)),c===void 0&&u!=null&&h!=null&&(c=jW(u,h,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:h==null?null:[h],scale:"y",optional:!0,filter:null},...n},r,i),this.width=o,this.height=s,this.pixelSize=Cf(d,"pixelSize"),this.blur=Cf(p,"blur"),this.interpolate=a==null||c==null?null:RW(m)}},Um=class extends $m{constructor(t,n={}){let{imageRendering:r}=n;if(t==null){let{fill:i,fillOpacity:o}=n;ie(o)[0]!==void 0&&(n=xw("fillOpacity",n)),De(i)[0]!==void 0&&(n=xw("fill",n))}super(t,void 0,n,CW),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]??(T=>T),{x:a,y:c}=r,{document:l}=o,[u,f,h,d]=VB(r,i,o),p=h-u,m=d-f,{pixelSize:y,width:g=Math.round(Math.abs(p)/y),height:b=Math.round(Math.abs(m)/y)}=this,x=g*b,{fill:w,fillOpacity:v}=r,_=0;if(this.interpolate){let T=g/p,D=b/m,C=Yt(a,F=>(F-u)*T,Float64Array),R=Yt(c,F=>(F-f)*D,Float64Array);w&&(w=this.interpolate(t,g,b,C,R,w)),v&&(v=this.interpolate(t,g,b,C,R,v))}else this.data==null&&t&&(_=t.fi*x);let M=l.createElement("canvas");M.width=g,M.height=b;let E=M.getContext("2d"),I=E.createImageData(g,b),N=I.data,{r:A,g:O,b:L}=en(this.fill)??{r:0,g:0,b:0},S=(this.fillOpacity??1)*255;for(let T=0;T<x;++T){let D=T<<2;if(w){let C=s(w[T+_]);if(C==null){N[D+3]=0;continue}({r:A,g:O,b:L}=en(C))}v&&(S=v[T+_]*255),N[D+0]=A,N[D+1]=O,N[D+2]=L,N[D+3]=S}return this.blur>0&&vv(I,this.blur),E.putImageData(I,0,0),lt("svg:g",o).call(Bt,this,i,o).call(It,this,n).call(T=>T.append("image").attr("transform",`translate(${u},${f}) scale(${Math.sign(h-u)},${Math.sign(d-f)})`).attr("width",Math.abs(p)).attr("height",Math.abs(m)).attr("preserveAspectRatio","none").call(ut,"image-rendering",this.imageRendering).call(Ot,this).attr("xlink:href",M.toDataURL())).node()}};function GM(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&&xD(t)&&(r=ol,i=Oa,o===void 0&&(o=pD)),[t,{...s,x:r,y:i,[e]:o}]}function qB(){let[e,t]=GM("fill",...arguments);return new Um(e,e==null||t.fill!==void 0||t.fillOpacity!==void 0?t:{...t,fill:W})}function VB({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 XM({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),VB(af(a,i),o,s)}function xw(e,t={}){let{[e]:n}=t;if(typeof n!="function")throw new Error(`invalid ${e}: not a function`);return ve({...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,h,d,p]=XM(o,s,a,c),m=d-f,y=p-h,{pixelSize:g}=this,{width:b=Math.round(Math.abs(m)/g),height:x=Math.round(Math.abs(y)/g)}=t,w=new Array(b*x*(i?i.length:1)),v=m/b,_=y/x,M=0;for(let E of i??[void 0])for(let I=.5;I<x;++I)for(let N=.5;N<b;++N,++M)w[M]=n(l.invert(f+N*v),u.invert(h+I*_),E);return{data:w,facets:i,channels:{[e]:{value:w,scale:"auto"}}}})}function RW(e){if(typeof e=="function")return e;if(e==null)return ww;switch(`${e}`.toLowerCase()){case"none":return ww;case"nearest":return zm;case"barycentric":return Pm();case"random-walk":return qm()}throw new Error(`invalid interpolate: ${e}`)}function ww(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 Pm({random:e=Wc(42)}={}){return(t,n,r,i,o,s)=>{let{points:a,triangles:c,hull:l}=ei.from(t,d=>i[d],d=>o[d]),u=new s.constructor(n*r).fill(NaN),f=new Uint8Array(n*r),h=qW(s,e);for(let d=0;d<c.length;d+=3){let p=c[d],m=c[d+1],y=c[d+2],g=a[2*p],b=a[2*m],x=a[2*y],w=a[2*p+1],v=a[2*m+1],_=a[2*y+1],M=Math.min(g,b,x),E=Math.max(g,b,x),I=Math.min(w,v,_),N=Math.max(w,v,_),A=(v-_)*(g-x)+(w-_)*(x-b);if(!A)continue;let O=s[t[p]],L=s[t[m]],S=s[t[y]];for(let T=Math.floor(M);T<E;++T)for(let D=Math.floor(I);D<N;++D){if(T<0||T>=n||D<0||D>=r)continue;let C=T+.5,R=D+.5,F=((v-_)*(C-x)+(R-_)*(x-b))/A;if(F<0)continue;let k=((_-w)*(C-x)+(R-_)*(g-x))/A;if(k<0)continue;let $=1-F-k;if($<0)continue;let U=T+n*D;u[U]=h(O,F,L,k,S,$,T,D),f[U]=1}}return kW(u,f,i,o,s,n,r,l,t,h),u}}function kW(e,t,n,r,i,o,s,a,c,l){n=Float64Array.from(a,d=>n[c[d]]),r=Float64Array.from(a,d=>r[c[d]]),i=Array.from(a,d=>i[c[d]]);let u=n.length,f=Array.from({length:u},(d,p)=>UW(p,n,r)),h=0;for(let d=0;d<s;++d){let p=d+.5;for(let m=0;m<o;++m){let y=m+o*d;if(!t[y]){let g=m+.5;for(let b=0;b<u;++b){let x=(u+h+(b%2?(b+1)/2:-b/2))%u;if(f[x](g,p)){let w=$W(n.at(x-1),r.at(x-1),n[x],r[x],g,p);e[y]=l(i.at(x-1),w,i[x],1-w,i[x],0,m,d),h=x;break}}}}}}function $W(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 km(e,t,n,r){return e*r-n*t}function UW(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),h=s-c,d=a-l,p=i-s,m=o-a,y=c-u,g=l-f,b=Math.hypot(h,d),x=Math.hypot(p,m),w=Math.hypot(y,g);return(v,_)=>{let M=v-s,E=_-a,I=v-c,N=_-l;return km(M,E,I,N)>-1e-6&&km(M,E,h,d)*x-km(M,E,p,m)*b>-1e-6&&km(I,N,y,g)*b-km(I,N,h,d)*w<=0}}function zm(e,t,n,r,i,o){let s=new o.constructor(t*n),a=ei.from(e,u=>r[u],u=>i[u]),c,l;for(let u=.5,f=0;u<n;++u){l=c;for(let h=.5;h<t;++h,++f)l=a.find(h,u,l),h===.5&&(c=l),s[f]=o[e[l]]}return s}function qm({random:e=Wc(42),minDistance:t=.5,maxSteps:n=2}={}){return(r,i,o,s,a,c)=>{let l=new c.constructor(i*o),u=ei.from(r,p=>s[p],p=>a[p]),f,h,d;for(let p=.5,m=0;p<o;++p){h=f;for(let y=.5;y<i;++y,++m){let g=y,b=p;d=h=u.find(g,b,h),y===.5&&(f=h);let x,w=0;for(;(x=Math.hypot(s[r[d]]-g,a[r[d]]-b))>t&&w<n;){let v=e(y,p,w)*2*Math.PI;g+=Math.cos(v)*x,b+=Math.sin(v)*x,d=u.find(g,b,d),++w}l[m]=c[r[d]]}}return l}}function PW(e,t,n,r,i,o){return t*e+r*n+o*i}function zW(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 qW(e,t){return Cs(e)||Ne(e)?PW:zW(t)}function VW(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 jW(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 jB={ariaLabel:"contour",fill:"none",stroke:"currentColor",strokeMiterlimit:1,pixelSize:2},Vm=class extends $m{constructor(t,{smooth:n=!0,value:r,...i}={}){let o=O1({},i,jB);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:Nn(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=xw("value",{value:r,...i}),r=null}else{let{interpolate:a}=i;r===void 0&&(r=W),a===void 0&&(i.interpolate="nearest")}super(t,{value:{value:r,optional:!0}},YW(i),jB);let s={geometry:{value:W}};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=Tn();return lt("svg:g",o).call(Bt,this,i,o).call(It,this,n).call(c=>{c.selectAll().data(t).enter().append("path").call(Ot,this).attr("d",l=>a(s[l])).call(Zt,this,r)}).node()}};function YW({thresholds:e,interval:t,...n}){return e=$M(e,t,fa),ve(n,function(r,i,o,s,a,c){let[l,u,f,h]=XM(o,s,a,c),d=f-l,p=h-u,{pixelSize:m,width:y=Math.round(Math.abs(d)/m),height:g=Math.round(Math.abs(p)/m)}=this,b=y/d,x=g/p,w=o.value.value,v=[];if(this.interpolate){let{x:N,y:A}=Ua(o,s,c),O=Yt(N,D=>(D-l)*b,Float64Array),L=Yt(A,D=>(D-u)*x,Float64Array),S=[o.x,o.y,o.value],T=[O,L,w];for(let D of i){let C=this.filter(D,S,T);v.push(this.interpolate(C,y,g,O,L,w))}}else if(i){let N=y*g,A=i.length;for(let O=0;O<A;++O)v.push(w.slice(O*N,O*N+N))}else v.push(w);if(this.blur>0)for(let N of v)xd({data:N,width:y,height:g},this.blur);let _=WW(e,w,...GW(v));if(_===null)throw new Error(`unsupported thresholds: ${e}`);let{contour:M}=ba().size([y,g]).smooth(this.smooth),E=[],I=[];for(let N of v)I.push(ke(E.length,E.push(...Yt(_,A=>M(N,A)))));for(let{coordinates:N}of E)for(let A of N)for(let O of A)for(let L of O)L[0]=L[0]/b+l,L[1]=L[1]/x+u;return{data:E,facets:I,channels:_1(this.contourChannels,E)}})}function WW(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 Pe(e);let i=Mn(...ou(n,r,e),e);for(;i[i.length-1]>=r;)i.pop();for(;i[1]<n;)i.shift();return i}function WB(){return new Vm(...GM("value",...arguments))}function GW(e){return[ce(e,t=>ce(t,YB)),Xt(e,t=>Xt(t,YB))]}function YB(e){return isFinite(e)?e:NaN}function HB(e,t){return HM(qa,e,t)}function ZB(e,t={}){return HM(Va,e,t)}function QB(e,t={}){return HM(zs,e,t)}function HM(e,t,n={}){let{x:r,y:i,maxRadius:o}=n,s=e({px:r,py:i,maxRadius:o}),a=[];r!=null&&a.push(Rr(t,GB("x",{...s,inset:-6},n))),i!=null&&a.push(kr(t,GB("y",{...s,inset:-6},n))),r!=null&&a.push(Co(t,XB("x",{...s,dy:9,frameAnchor:"bottom",lineAnchor:"top"},n))),i!=null&&a.push(Co(t,XB("y",{...s,dx:-9,frameAnchor:"left",textAnchor:"end"},n)));for(let c of a)c.ariaLabel=`crosshair ${c.ariaLabel}`;return Ke(...a)}function KB(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:XW(e,u)}}function XW(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,...h}={},...d}=t.call(this,n,r,{...c,x:s,y:a},...l);return{channels:{...h,...u&&{px:u,...e==="x"&&{x:u}},...f&&{py:f,...e==="y"&&{y:f}}},...d}}}function GB(e,t,n){let{color:r="currentColor",opacity:i=.2,ruleStroke:o=r,ruleStrokeOpacity:s=i,ruleStrokeWidth:a}=n;return{...KB(e,t,n),stroke:o,strokeOpacity:s,strokeWidth:a}}function XB(e,t,n){let{color:r="currentColor",textFill:i=r,textFillOpacity:o,textStroke:s="var(--plot-background)",textStrokeOpacity:a,textStrokeWidth:c=5}=n;return{...KB(e,t,HW(e,n)),fill:i,fillOpacity:o,stroke:s,strokeOpacity:a,strokeWidth:c}}function HW(e,t){return ve(t,(n,r,i)=>({channels:{text:{value:um(i,e)?.value}}}))}var ZW={ariaLabel:"delaunay link",fill:"none",stroke:"currentColor",strokeMiterlimit:1},QW={ariaLabel:"delaunay mesh",fill:null,stroke:"currentColor",strokeOpacity:.2},KW={ariaLabel:"hull",fill:"none",stroke:"currentColor",strokeWidth:1.5,strokeMiterlimit:1},JW={ariaLabel:"voronoi",fill:"none",stroke:"currentColor",strokeMiterlimit:1},tG={ariaLabel:"voronoi mesh",fill:null,stroke:"currentColor",strokeOpacity:.2},ZM=class extends _t{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,ZW),this.curve=Im(s,a),Ri(this,n)}render(t,n,r,i,o){let{x:s,y:a}=n,{x:c,y:l,z:u}=r,{curve:f}=this,[h,d]=gn(this,i),p=c?b=>c[b]:hn(h),m=l?b=>l[b]:hn(d),y=this;function g(b){let x=-1,w=[],v={};for(let S in r)v[S]=[];let _=[],M=[],E=[],I=[];function N(S,T){S=b[S],T=b[T],w.push(++x),_[x]=p(S),E[x]=m(S),M[x]=p(T),I[x]=m(T);for(let D in r)v[D].push(r[D][T])}let{halfedges:A,hull:O,triangles:L}=ei.from(b,p,m);for(let S=0;S<A.length;++S){let T=A[S];T>S&&N(L[S],L[T])}for(let S=0;S<O.length;++S)N(O[S],O[(S+1)%O.length]);Pt(this).selectAll().data(w).enter().append("path").call(Ot,y).attr("d",S=>{let T=Jn(),D=f(T);return D.lineStart(),D.point(_[S],E[S]),D.point(M[S],I[S]),D.lineEnd(),T}).call(Zt,y,v).call(qs,y,v,o)}return lt("svg:g",o).call(Bt,this,i,o).call(It,this,{x:c&&s,y:l&&a}).call(u?b=>b.selectAll().data(an(t,x=>u[x]).values()).enter().append("g").each(g):b=>b.datum(t).each(g)).node()}},jm=class extends _t{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,h]=gn(this,i),d=c?g=>c[g]:hn(f),p=l?g=>l[g]:hn(h),m=this;function y(g){let b=ei.from(g,d,p);Pt(this).append("path").datum(g[0]).call(Ot,m).attr("d",m._render(b,i)).call(Zt,m,r)}return lt("svg:g",o).call(Bt,this,i,o).call(It,this,{x:c&&s,y:l&&a}).call(u?g=>g.selectAll().data(an(t,b=>u[b]).values()).enter().append("g").each(y):g=>g.datum(t).each(y)).node()}},QM=class extends jm{constructor(t,n={}){super(t,n,QW),this.fill="none"}_render(t){return t.render()}},KM=class extends jm{constructor(t,n={}){super(t,n,KW,zn)}_render(t){return t.renderHull()}},JM=class extends _t{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,JW)}render(t,n,r,i,o){let{x:s,y:a}=n,{x:c,y:l,z:u}=r,[f,h]=gn(this,i),d=c?g=>c[g]:hn(f),p=l?g=>l[g]:hn(h),m=this;function y(g){let b=ei.from(g,d,p),x=JB(b,i);Pt(this).selectAll().data(g).enter().append("path").call(Ot,m).attr("d",(w,v)=>x.renderCell(v)).call(Zt,m,r)}return lt("svg:g",o).call(Bt,this,i,o).call(It,this,{x:c&&s,y:l&&a}).call(u?g=>g.selectAll().data(an(t,b=>u[b]).values()).enter().append("g").each(y):g=>g.datum(t).each(y)).node()}},tI=class extends jm{constructor(t,n){super(t,n,tG),this.fill="none"}_render(t,n){return JB(t,n).render()}};function JB(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 Ym(e,t,{x:n,y:r,...i}={}){return[n,r]=Re(n,r),new e(t,{...i,x:n,y:r})}function t7(e,t){return Ym(ZM,e,t)}function e7(e,t){return Ym(QM,e,t)}function n7(e,t){return Ym(KM,e,t)}function r7(e,t){return Ym(JM,e,t)}function i7(e,t){return Ym(tI,e,t)}var eG={ariaLabel:"density",fill:"none",stroke:"currentColor",strokeMiterlimit:1},Wm=class extends _t{constructor(t,{x:n,y:r,z:i,weight:o,fill:s,stroke:a,...c}={}){let l=o7(s)&&(s="currentColor",!0),u=o7(a)&&(a="currentColor",!0);super(t,{x:{value:n,scale:"x",optional:!0},y:{value:r,scale:"y",optional:!0},z:{value:zn({z:i,fill:s,stroke:a}),optional:!0},weight:{value:o,optional:!0}},rG({...c,fill:s,stroke:a},l,u),eG),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=Tn();return lt("svg:g",o).call(Bt,this,i,o).call(It,this,{}).call(c=>c.selectAll().data(t).enter().append("path").call(Ot,this).call(Zt,this,r).attr("d",l=>a(s[l]))).node()}};function s7(e,{x:t,y:n,...r}={}){return[t,n]=Re(t,n),new Wm(e,{...r,x:t,y:n})}var nG=new Set(["x","y","z","weight"]);function rG(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"?Qe(o):+o,ve(e,function(s,a,c,l,u,f){let h=c.weight?Qe(c.weight.value):null,d=c.z?.value,{z:p}=this,[m,y]=gn(this,u),{width:g,height:b}=u,{x,y:w}=Ua(c,l,f),v=Object.fromEntries(Object.entries(c).filter(([L])=>!nG.has(L)).map(([L,S])=>[L,{...S,value:[]}])),_=t&&[],M=n&&[],E=u2().x(x?L=>x[L]:m).y(w?L=>w[L]:y).weight(h?L=>h[L]:1).size([g,b]).bandwidth(i),I=[];for(let L of a){let S=[];I.push(S);for(let T of d?mm(L,d,p):[L]){let D=E.contours(T);S.push([T,D])}}let N=o;if(!(N instanceof il)){let L=0;for(let S of I)for(let[,T]of S){let D=T.max;D>L&&(L=D)}N=Float64Array.from({length:o-1},(S,T)=>L*100*(T+1)/o)}let A=[],O=[];for(let L of I){let S=[];A.push(S);for(let[T,D]of L)for(let C of N){S.push(O.length),O.push(D(C/100)),_&&_.push(C),M&&M.push(C);for(let R in v)v[R].value.push(c[R].value[T[0]])}}return _&&_.push(0),M&&M.push(0),{data:s,facets:A,channels:{...v,..._&&{fill:{value:_,scale:"color"}},...M&&{stroke:{value:M,scale:"color"}},contours:{value:O}}}})}function o7(e){return/^density$/i.test(e)}function l7(e,{x1:t,x2:n,y1:r,y2:i,x:o=t===void 0&&n===void 0?Ie:void 0,y:s=r===void 0&&i===void 0?W:void 0,fill:a,positiveFill:c="#3ca951",negativeFill:l="#4269d0",fillOpacity:u=1,positiveFillOpacity:f=u,negativeFillOpacity:h=u,stroke:d,strokeOpacity:p,z:m=De(d)[0],clip:y,tip:g,render:b,...x}={}){return[t,n]=a7(o,t,n),[r,i]=a7(s,r,i),t===n&&r===i&&(r=Ka(0)),{tip:g}=Ci({tip:g},"x"),Ke(ee(c)?null:Object.assign(Am(e,{x1:t,x2:n,y1:r,y2:i,z:m,fill:c,fillOpacity:f,render:mf(b,c7(!0)),clip:y,...x}),{ariaLabel:"positive difference"}),ee(l)?null:Object.assign(Am(e,{x1:t,x2:n,y1:r,y2:i,z:m,fill:l,fillOpacity:h,render:mf(b,c7(!1)),clip:y,...x}),{ariaLabel:"negative difference"}),_l(e,{x:n,y:i,z:m,stroke:d,strokeOpacity:p,tip:g,clip:!0,...x}))}function a7(e,t,n){return t===void 0&&n===void 0?t=n=Ka(e):t===void 0?(n=Ka(n),t=e===void 0?n:Ka(e)):n===void 0?(t=Ka(t),n=e===void 0?t:Ka(e)):(t=Ka(t),n=Ka(n)),[t,n]}function Ka(e){let t,{value:n,label:r=Nn(n)}=ci(e);return{transform:i=>t||(t=bt(i,n)),label:r}}function c7(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===A1(n.y)<0?u:f).fill(l);let h=s(t,n,{...r,x2:a,y2:f},i,o),d=s(t,n,{...r,x1:c,y1:u},i,o),p=h.querySelector("g")??h,m=d.querySelector("g")??d;for(let y=0;p.firstChild;y+=2){let g=N1(),b=lt("svg:clipPath",o).attr("id",g).node();b.appendChild(p.firstChild),m.childNodes[y].setAttribute("clip-path",`url(#${g})`),m.insertBefore(b,m.childNodes[y])}return d}}var iG={ariaLabel:"geo",fill:"none",stroke:"currentColor",strokeWidth:1,strokeLinecap:"round",strokeLinejoin:"round",strokeMiterlimit:1},Gm=class extends _t{constructor(t,n={}){let[r,i]=ie(n.r,3);super(t,{geometry:{value:n.geometry,scale:"projection"},r:{value:r,scale:"r",filter:ir,optional:!0}},Bm(n),iG),this.r=i}render(t,n,r,i,o){let{geometry:s,r:a}=r,c=Tn(o.projection??oG(n)),{r:l}=this;return Aa(l)?t=[]:l!==void 0&&c.pointRadius(l),lt("svg:g",o).call(Bt,this,i,o).call(It,this,n).call(u=>{u.selectAll().data(t).enter().append("path").call(Ot,this).attr("d",a?f=>c.pointRadius(a[f])(s[f]):f=>c(s[f])).call(Zt,this,r)}).node()}};function oG({x:e,y:t}){if(e||t)return e??=n=>n,t??=n=>n,jc({point(n,r){this.stream.point(e(n),t(r))}})}function _w(e,{geometry:t=W,...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 Gm(e,{geometry:t,...n})}function u7({strokeWidth:e=1.5,...t}={}){return _w({type:"Sphere"},{strokeWidth:e,...t})}function f7({strokeOpacity:e=.1,...t}={}){return _w(B2(),{strokeOpacity:e,...t})}var Rf=.5,kf=0;function h7(e={fill:"count"},{binWidth:t,...n}={}){let{z:r}=n;return t=t===void 0?20:Nt(t),e=G3(e,n),Lo(e,"fill")&&(n.channels={...n.channels,fill:{value:[]}}),n.symbol===void 0&&(n.symbol="hexagon"),n.r===void 0&&!Lo(e,"r")&&(n.r=t/2),ve(n,(i,o,s,a,c,l)=>{let{x:u,y:f,z:h,fill:d,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}=Ua(s,a,l)),h=h?h.value:bt(i,r),d=d?.value,p=p?.value,m=m?.value;let y=lm(e,{z:h,fill:d,stroke:p,symbol:m}),g=h&&[],b=d&&[],x=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,T]of Ca(O,y))for(let{index:D,extent:C}of sG(i,T,u,f,t)){L.push(++E),_.push(C.x),M.push(C.y),h&&g.push(y===h?S:h[D[0]]),d&&b.push(y===d?S:d[D[0]]),p&&x.push(y===p?S:p[D[0]]),m&&w.push(y===m?S:m[D[0]]);for(let R of e)R.reduce(D,C)}v.push(L)}let I=s.x.scale,N=s.y.scale,A={x:{value:_,source:a[I]?{value:Yt(_,a[I].invert),scale:I}:null},y:{value:M,source:a[N]?{value:Yt(M,a[N].invert),scale:N}:null},...h&&{z:{value:g}},...d&&{fill:{value:b,scale:"auto"}},...p&&{stroke:{value:x,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:v,channels:A}})}function sG(e,t,n,r,i){let o=i*(1.5/k3),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-kf)/o),f=Math.round(c=(c-Rf)/i-(u&1)/2),h=l-u;if(Math.abs(h)*3>1){let m=c-f,y=f+(c<f?-1:1)/2,g=u+(l<u?-1:1),b=c-y,x=l-g;m*m+h*h>b*b+x*x&&(f=y+(u&1?1:-1)/2,u=g)}let d=`${f},${u}`,p=s.get(d);p===void 0&&(p={index:[],extent:{data:e,x:(f+(u&1)/2)*i+Rf,y:u*o+kf}},s.set(d,p)),p.index.push(a)}return s.values()}var aG={ariaLabel:"hexgrid",fill:"none",stroke:"currentColor",strokeOpacity:.1};function d7(e){return new Xm(e)}var Xm=class extends _t{constructor({binWidth:t=20,clip:n=!0,...r}={}){super(Na,void 0,{clip:n,...r},aG),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:h}=i,d=u-Rf,p=f-c-Rf,m=a-kf,y=h-l-kf,g=s/2,b=g*$3,x=b/2,w=g*2,v=b*1.5,_=Math.floor(d/w),M=Math.ceil(p/w),E=Math.floor((m+x)/v),I=Math.ceil((y-x)/v)+1,N=`m0,${Ja(-b)}l${Ja(g)},${Ja(x)}v${Ja(b)}l${Ja(-g)},${Ja(x)}`,A=N;for(let O=E;O<I;++O)for(let L=_;L<M;++L)A+=`M${Ja(L*w+(O&1)*g)},${Ja(O*v)}${N}`;return lt("svg:g",o).datum(0).call(Bt,this,i,o).call(It,this,{},Oe+Rf,Oe+kf).call(O=>O.append("path").call(Ot,this).call(Zt,this,r).attr("d",A)).node()}};function Ja(e){return Math.round(e*1e3)/1e3}var cG={ariaLabel:"image",fill:null,stroke:null};function lG(e){return/^\.*\//.test(e)}function uG(e){return/^(blob|data|file|http|https):/i.test(e)}function fG(e){return typeof e=="string"&&(lG(e)||uG(e))?[void 0,e]:[e,void 0]}var Hm=class extends _t{constructor(t,n={}){let{x:r,y:i,r:o,width:s,height:a,rotate:c,src:l,preserveAspectRatio:u,crossOrigin:f,frameAnchor:h,imageRendering:d}=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]=fG(l),[y,g]=ie(o),[b,x]=ie(s,g!==void 0?g*2:void 0),[w,v]=ie(a,g!==void 0?g*2:void 0),[_,M]=ie(c,0);super(t,{x:{value:r,scale:"x",optional:!0},y:{value:i,scale:"y",optional:!0},r:{value:y,scale:"r",filter:ir,optional:!0},width:{value:b,filter:ir,optional:!0},height:{value:w,filter:ir,optional:!0},rotate:{value:_,optional:!0},src:{value:p,optional:!0}},Bm(n),cG),this.src=m,this.width=x,this.rotate=M,this.height=v,this.r=g,this.preserveAspectRatio=le(u,"xMidYMid"),this.crossOrigin=Ue(f),this.frameAnchor=Bo(h),this.imageRendering=le(d,"auto")}render(t,n,r,i,o){let{x:s,y:a}=n,{x:c,y:l,width:u,height:f,r:h,rotate:d,src:p}=r,{r:m,width:y,height:g,rotate:b}=this,[x,w]=gn(this,i);return lt("svg:g",o).call(Bt,this,i,o).call(It,this,{x:c&&s,y:l&&a}).call(v=>v.selectAll().data(t).enter().append("image").call(Ot,this).attr("x",p7(c,u,h,x,y,m)).attr("y",p7(l,f,h,w,g,m)).attr("width",u?_=>u[_]:y!==void 0?y:h?_=>h[_]*2:m*2).attr("height",f?_=>f[_]:g!==void 0?g:h?_=>h[_]*2:m*2).attr("transform",d?_=>`rotate(${d[_]})`:b?`rotate(${b})`:null).attr("transform-origin",d||b?ja`${c?_=>c[_]:x}px ${l?_=>l[_]:w}px`:null).call(ut,"href",p?_=>p[_]:this.src).call(ut,"preserveAspectRatio",this.preserveAspectRatio).call(ut,"crossorigin",this.crossOrigin).call(ut,"image-rendering",this.imageRendering).call(ut,"clip-path",h?_=>`circle(${h[_]}px)`:m!==void 0?`circle(${m}px)`:null).call(Zt,this,r)).node()}};function p7(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 m7(e,{x:t,y:n,...r}={}){return r.frameAnchor===void 0&&([t,n]=Re(t,n)),new Hm(e,{...r,x:t,y:n})}function hG(e,t,n){var r=1e-8,i=t-1,o=n-1,s=0,a,c,l,u,f,h,d,p,m,y,g;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)),d=(2.30753+u*.27061)/(1+u*(.99229+u*.04481))-u,e<.5&&(d=-d),p=(d*d-3)/6,m=2/(1/(2*t-1)+1/(2*n-1)),y=d*Math.sqrt(p+m)/m-(1/(2*n-1)-1/(2*t-1))*(p+5/6-2/(3*m)),d=t/(t+n*Math.exp(2*y))):(a=Math.log(t/(t+n)),c=Math.log(n/(t+n)),u=Math.exp(t*a)/t,f=Math.exp(n*c)/n,y=u+f,e<u/y?d=Math.pow(t*y*e,1/t):d=1-Math.pow(n*y*(1-e),1/n)),g=-$f(t)-$f(n)+$f(t+n);s<10;s++){if(d===0||d===1)return d;if(h=dG(d,t,n)-e,u=Math.exp(i*Math.log(d)+o*Math.log(1-d)+g),f=h/u,d-=u=f/(1-.5*Math.min(1,f*(i/d-o/(1-d)))),d<=0&&(d=.5*(d+u)),d>=1&&(d=.5*(d+u+1)),Math.abs(u)<r*d&&s>0)break}return d}function dG(e,t,n){var r=e===0||e===1?0:Math.exp($f(t+n)-$f(t)-$f(n)+t*Math.log(e)+n*Math.log(1-e));return e<0||e>1?!1:e<(t+1)/(t+n+2)?r*y7(e,t,n)/t:1-r*y7(1-e,n,t)/n}function y7(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,h,d;for(Math.abs(l)<r&&(l=r),l=1/l,d=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,d*=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,h=l*c,d*=h,!(Math.abs(h-1)<3e-7));i++);return d}function $f(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 g7(e,t){var n=hG(2*Math.min(e,1-e),.5*t,.5);return n=Math.sqrt(t*(1-n)/n),e>.5?n:-n}var pG={ariaLabel:"linear-regression",fill:"currentColor",fillOpacity:.1,stroke:"currentColor",strokeWidth:1.5,strokeLinecap:"round",strokeLinejoin:"round",strokeMiterlimit:1},vw=class extends _t{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:zn(n),optional:!0}},n,pG),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 lt("svg:g",o).call(Bt,this,i,o).call(It,this,n).call(u=>u.selectAll().data(c?mm(t,c,this.z):[t]).enter().call(f=>f.append("path").attr("fill","none").call(Ot,this).call(ul,this,{...r,fill:null,fillOpacity:null}).attr("d",h=>this._renderLine(h,s,a)).call(l&&!Rs(this.fill)?h=>h.select(mG).attr("stroke","none").call(Ot,this).call(ul,this,{...r,stroke:null,strokeOpacity:null,strokeWidth:null}).attr("d",d=>this._renderBand(d,s,a)):()=>{}))).node()}};function mG(){return this.parentNode.insertBefore(this.ownerDocument.createElementNS(Kr.svg,"path"),this)}var eI=class extends vw{constructor(t,n){super(t,n)}_renderBand(t,n,r){let{ci:i,precision:o}=this,[s,a]=ae(t,u=>r[u]),c=Sw(t,r,n),l=w7(t,r,n,(1-i)/2,c);return qu().y(u=>u).x0(u=>l(u,-1)).x1(u=>l(u,1))(ke(s,a-o/2,o).concat(a))}_renderLine(t,n,r){let[i,o]=ae(t,a=>r[a]),s=Sw(t,r,n);return`M${s(i)},${i}L${s(o)},${o}`}},nI=class extends vw{constructor(t,n){super(t,n)}_renderBand(t,n,r){let{ci:i,precision:o}=this,[s,a]=ae(t,u=>n[u]),c=Sw(t,n,r),l=w7(t,n,r,(1-i)/2,c);return qu().x(u=>u).y0(u=>l(u,-1)).y1(u=>l(u,1))(ke(s,a-o/2,o).concat(a))}_renderLine(t,n,r){let[i,o]=ae(t,a=>n[a]),s=Sw(t,n,r);return`M${i},${s(i)}L${o},${s(o)}`}};function b7(e,{y:t=Ie,x:n=W,stroke:r,fill:i=ee(r)?"currentColor":r,...o}={}){return new eI(e,_f({...o,x:n,y:t,fill:i,stroke:r}))}function x7(e,{x:t=Ie,y:n=W,stroke:r,fill:i=ee(r)?"currentColor":r,...o}={}){return new nI(e,wf({...o,x:t,y:n,fill:i,stroke:r}))}function Sw(e,t,n){let r=0,i=0,o=0,s=0;for(let u of e){let f=t[u],h=n[u];r+=f,i+=h,o+=f*h,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 w7(e,t,n,r,i){let o=In(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=g7(r,e.length-2);return(u,f)=>{let h=i(u),d=c*Math.sqrt(1/e.length+(u-o)**2/s);return h+f*l*d}}function Zm({path:e=W,delimiter:t,frameAnchor:n,treeLayout:r=Yc,treeSort:i,treeSeparation:o,treeAnchor:s,treeFilter:a,...c}={}){s=Tw(s),i=S7(i),a!=null&&(a=iI(a)),n===void 0&&(n=s.frameAnchor);let l=M7(t),u=O7(c,iI),[f,h]=pn(),[d,p]=pn();return{x:f,y:d,frameAnchor:n,...mn(c,(m,y)=>{let g=l(bt(m,e)),b=h([]),x=p([]),w=-1,v=[],_=[],M=wb().path(I=>g[I]),E=r();E.nodeSize&&E.nodeSize([1,1]),E.separation&&o!==void 0&&E.separation(o??rm);for(let I of u)I[Iw]=I[D7]([]);for(let I of y){let N=[],A=M(I.filter(O=>g[O]!=null)).each(O=>O.data=m[O.data]);i!=null&&A.sort(i),E(A);for(let O of A.descendants())if(!(a!=null&&!a(O))){N.push(++w),v[w]=O.data,s.position(O,w,b,x);for(let L of u)L[Iw][w]=L[N7](O)}_.push(N)}return{data:v,facets:_}}),...Object.fromEntries(u)}}function Aw({path:e=W,delimiter:t,curve:n="bump-x",stroke:r="#555",strokeWidth:i=1.5,strokeOpacity:o=.5,treeLayout:s=Yc,treeSort:a,treeSeparation:c,treeAnchor:l,treeFilter:u,...f}={}){l=Tw(l),a=S7(a),u!=null&&(u=v7(u)),f={curve:n,stroke:r,strokeWidth:i,strokeOpacity:o,...f};let h=M7(t),d=O7(f,v7),[p,m]=pn(),[y,g]=pn(),[b,x]=pn(),[w,v]=pn();return{x1:p,x2:y,y1:b,y2:w,...mn(f,(_,M)=>{let E=h(bt(_,e)),I=m([]),N=g([]),A=x([]),O=v([]),L=-1,S=[],T=[],D=wb().path(R=>E[R]),C=s();C.nodeSize&&C.nodeSize([1,1]),C.separation&&c!==void 0&&C.separation(c??rm);for(let R of d)R[Iw]=R[D7]([]);for(let R of M){let F=[],k=D(R.filter($=>E[$]!=null)).each($=>$.data=_[$.data]);a!=null&&k.sort(a),C(k);for(let{source:$,target:U}of k.links())if(!(u!=null&&!u(U,$))){F.push(++L),S[L]=U.data,l.position($,L,I,A),l.position(U,L,N,O);for(let G of d)G[Iw][L]=G[N7](U,$)}T.push(F)}return{data:S,facets:T}}),...Object.fromEntries(d)}}function Tw(e="left"){switch(`${e}`.trim().toLowerCase()){case"left":return yG;case"right":return gG}throw new Error(`invalid tree anchor: ${e}`)}var yG={frameAnchor:"left",dx:6,position({x:e,y:t},n,r,i){r[n]=t,i[n]=-e}},gG={frameAnchor:"right",dx:-6,position({x:e,y:t},n,r,i){r[n]=-t,i[n]=-e}};function S7(e){return e==null||typeof e=="function"?e:`${e}`.trim().toLowerCase().startsWith("node:")?_7(iI(e)):_7(bG(e))}function _7(e){return(t,n)=>fn(e(t),e(n))}function bG(e){return t=>t.data?.[e]}function M7(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=>xG(r,t))}var rI=92,I7=47;function xG(e,t){if(t===rI)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 rI: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 I7: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 wG(e){let t=!1;for(let n=0,r=e.length;n<r;++n){switch(e.charCodeAt(n)){case rI:if(!t){t=!0;continue}case I7:t&&(e=e.slice(0,n-1)+e.slice(n),--n,--r);break}t=!1}return e}function A7(e){return dn(e)&&typeof e.node=="function"}function _G(e){return dn(e)&&typeof e.link=="function"}function iI(e){if(A7(e))return e.node;if(e=`${e}`.trim().toLowerCase(),!!e.startsWith("node:")){switch(e){case"node:name":return sI;case"node:path":return oI;case"node:internal":return T7;case"node:external":return E7;case"node:depth":return aI;case"node:height":return cI}throw new Error(`invalid node value: ${e}`)}}function v7(e){if(A7(e))return e.node;if(_G(e))return e.link;if(e=`${e}`.trim().toLowerCase(),!(!e.startsWith("node:")&&!e.startsWith("parent:"))){switch(e){case"parent:name":return Mw(sI);case"parent:path":return Mw(oI);case"parent:depth":return Mw(aI);case"parent:height":return Mw(cI);case"node:name":return sI;case"node:path":return oI;case"node:internal":return T7;case"node:external":return E7;case"node:depth":return aI;case"node:height":return cI}throw new Error(`invalid link value: ${e}`)}}function oI(e){return e.id}function sI(e){return vG(e.id)}function aI(e){return e.depth}function cI(e){return e.height}function T7(e){return!!e.children}function E7(e){return!e.children}function Mw(e){return(t,n)=>n==null?void 0:e(n)}function vG(e){let t=e.length;for(;--t>0&&!SG(e,t););return wG(e.slice(t+1))}function SG(e,t){if(e[t]==="/"){let n=0;for(;t>0&&e[--t]==="\\";)++n;if(!(n&1))return!0}return!1}var D7=2,N7=3,Iw=4;function O7(e,t){let n=[];for(let r in e){let i=e[r],o=t(i);o!==void 0&&n.push([r,...pn(i),o])}return n}function lI(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:h=u,dot:d=ee(f)&&ee(h),text:p="node:name",textStroke:m="var(--plot-background)",title:y="node:path",dx:g,dy:b,textAnchor:x,treeLayout:w=Yc,textLayout:v=w===Yc||w===bb?"mirrored":"normal",tip:_,...M}={}){if(g===void 0&&(g=Tw(M.treeAnchor).dx),x!==void 0)throw new Error("textAnchor is not a configurable tree option");v=rn(v,"textLayout",["mirrored","normal"]);function E(I){return Co(e,Zm({treeLayout:w,text:p,fill:t===void 0?"currentColor":t,stroke:m,dx:g,dy:b,title:y,...I,...M}))}return Ke(fw(e,Aw({treeLayout:w,markerStart:f,markerEnd:h,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})),d?ui(e,Zm({treeLayout:w,fill:t===void 0?"node:internal":t,title:y,tip:_,...M})):null,p!=null?v==="mirrored"?[E({textAnchor:"start",treeFilter:"node:external"}),E({textAnchor:"end",treeFilter:"node:internal",dx:-g})]:E():null)}function B7(e,t){return lI(e,{...t,treeLayout:bb})}function L7({geometry:e=W,...t}={}){return ve({...t,x:null,y:null},(n,r,i,o,s,{projection:a})=>{let c=bt(n,e),l=c.length,u=new Float64Array(l),f=new Float64Array(l),h=Tn(a);for(let d=0;d<l;++d)[u[d],f[d]]=h.centroid(c[d]);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 F7({geometry:e=W,...t}={}){let n;return{...t,x:{transform:r=>Float64Array.from(n=bt(bt(r,e),A2),([i])=>i)},y:{transform:()=>Float64Array.from(n,([,r])=>r)}}}var Y7=YL(j7(),1);var OG=({marginLeft:e})=>[1,e],BG=({width:e,marginRight:t})=>[-1,e-t],LG=({width:e,marginLeft:t,marginRight:n})=>[0,(t+e-n)/2],FG=({marginTop:e})=>[1,e],CG=({height:e,marginBottom:t})=>[-1,e-t],RG=({height:e,marginTop:t,marginBottom:n})=>[0,(t+e-n)/2];function W7(e){return typeof e=="string"?{anchor:e}:e}function G7(e={},t={}){arguments.length===1&&([e,t]=H7(e));let{anchor:n="left",padding:r=1,r:i=t.r}=W7(e);switch(`${n}`.toLowerCase()){case"left":n=OG;break;case"right":n=BG;break;case"middle":n=LG;break;default:throw new Error(`unknown dodge anchor: ${n}`)}return Z7("x","y",n,Nt(r),i,t)}function X7(e={},t={}){arguments.length===1&&([e,t]=H7(e));let{anchor:n="bottom",padding:r=1,r:i=t.r}=W7(e);switch(`${n}`.toLowerCase()){case"top":n=FG;break;case"bottom":n=CG;break;case"middle":n=RG;break;default:throw new Error(`unknown dodge anchor: ${n}`)}return Z7("y","x",n,Nt(r),i,t)}function H7(e){let{anchor:t,padding:n,...r}=e,{r:i}=r;return[{anchor:t,padding:n,r:i},r]}function Z7(e,t,n,r,i,o){if(i!=null&&typeof i!="number"){let{channels:s,sort:a,reverse:c}=o;s=om(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 ve(o,function(s,a,c,l,u,f){let{[t]:h,r:d}=c;if(!c[t])throw new Error(`missing channel: ${t}`);({[t]:h}=Ua(c,l,f));let p=d?void 0:i!==void 0?Nt(i):this.r!==void 0?this.r:3;d&&(d=bt(d.value,l[d.scale]||W,Float64Array));let[m,y]=n(u),g=m?$G:kG,b=new Float64Array(h.length),x=d?w=>d[w]:()=>p;for(let w of a){let v=(0,Y7.default)();w=w.filter(d?M=>Gu(h[M])&&ir(d[M]):M=>Gu(h[M]));let _=new Float64Array(2*w.length+2);for(let M of w){let E=x(M),I=m?E+r:0,N=h[M]-E,A=h[M]+E,O=2;v.queryInterval(N-r,A+r,([,,S])=>{let T=b[S]-I,D=h[M]-h[S],C=r+(d?d[M]+d[S]:2*p),R=Math.sqrt(C*C-D*D);_[O++]=T-R,_[O++]=T+R});let L=_.slice(0,O);m&&(L=L.filter(S=>S>=0));t:for(let S of L.sort(g)){for(let T=0;T<O;T+=2)if(_[T]+1e-6<S&&S<_[T+1]-1e-6)continue t;b[M]=S+I;break}v.insert([N,A,M])}}m||(m=1);for(let w of a)for(let v of w)b[v]=b[v]*m+y;return{data:s,facets:a,channels:{[e]:{value:b,source:null},[t]:{value:h,source:c[t]},...d&&{r:{value:d,source:c.r}}}}})}function kG(e,t){return Math.abs(e)-Math.abs(t)}function $G(e,t){return e-t}function K7(e,t){return arguments.length===1&&({basis:e,...t}=e),Bf(Nw(e),t)}function J7(e,t){return arguments.length===1&&({basis:e,...t}=e),Lf(Nw(e),t)}function Nw(e){if(e===void 0)return Q7;if(typeof e=="function")return Ow(Ju(e));if(/^p\d{2}$/i.test(e))return qf(Qu(e));switch(`${e}`.toLowerCase()){case"deviation":return zG;case"first":return Q7;case"last":return PG;case"max":return qG;case"mean":return VG;case"median":return jG;case"min":return YG;case"sum":return WG;case"extent":return UG}throw new Error(`invalid basis: ${e}`)}function Ow(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 qf(e){return Ow((t,n)=>e(t,r=>n[r]))}var UG={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}},Q7=Ow((e,t)=>{for(let n=0;n<e.length;++n){let r=t[e[n]];if($e(r))return r}}),PG=Ow((e,t)=>{for(let n=e.length-1;n>=0;--n){let r=t[e[n]];if($e(r))return r}}),zG={mapIndex(e,t,n){let r=hs(e,o=>t[o]),i=Qr(e,o=>t[o]);for(let o of e)n[o]=t[o]===null?NaN:i?(t[o]-r)/i:0}},qG=qf(Xt),VG=qf(hs),jG=qf(Di),YG=qf(ce),WG=qf(In);function tL(e,t){return GG("x",e,t)}function GG(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]=c1(t.replace(/^[+-]/,"")),i*=l}t=ef(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 eL(e,t={}){if(typeof e=="string")switch(e.toLowerCase()){case"first":return Jm(t);case"last":return ty(t)}if(typeof e=="function")return tc(null,e,t);let n,r;for(n in e){if(r!==void 0)throw new Error("ambiguous selector; multiple inputs");r=XG(e[n])}if(r===void 0)throw new Error(`invalid selector: ${e}`);return tc(n,r,t)}function XG(e){if(typeof e=="function")return e;switch(`${e}`.toLowerCase()){case"min":return mI;case"max":return yI}throw new Error(`unknown selector: ${e}`)}function Jm(e){return tc(null,HG,e)}function ty(e){return tc(null,ZG,e)}function Bw(e){return tc("x",mI,e)}function Lw(e){return tc("y",mI,e)}function Fw(e){return tc("x",yI,e)}function Cw(e){return tc("y",yI,e)}function*HG(e){yield e[0]}function*ZG(e){yield e[e.length-1]}function*mI(e,t){yield ng(e,n=>t[n])}function*yI(e,t){yield Ec(e,n=>t[n])}function tc(e,t,n){if(e!=null){if(n[e]==null)throw new Error(`missing channel: ${e}`);e=n[e]}let r=zn(n);return mn(n,(i,o)=>{let s=bt(i,r),a=bt(i,e),c=[];for(let l of o){let u=[];for(let f of s?an(l,h=>s[h]).values():[l])for(let h of t(f,a))u.push(h);c.push(u)}return{data:i,facets:c}})}var QG=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"],["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"],["xLabelArrow","x.labelArrow"],["xLabelOffset","x.labelOffset"],["xFontVariant","x.fontVariant"],["xAriaLabel","x.ariaLabel"],["xAriaDescription","x.ariaDescription"],["xPercent","x.percent"],["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"],["yLabelArrow","y.labelArrow"],["yLabelOffset","y.labelOffset"],["yFontVariant","y.fontVariant"],["yAriaLabel","y.ariaLabel"],["yAriaDescription","y.ariaDescription"],["yPercent","y.percent"],["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"],["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"],["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"],["colorPercent","color.percent"],["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"],["opacityPercent","opacity.percent"],["opacityReverse","opacity.reverse"],["opacityZero","opacity.zero"],["opacityTickFormat","opacity.tickFormat"],["opacityBase","opacity.base"],["opacityExponent","opacity.exponent"],["opacityConstant","opacity.constant"],["symbolScale","symbol.type"],["symbolDomain","symbol.domain"],["symbolRange","symbol.range"],["rScale","r.type"],["rDomain","r.domain"],["rRange","r.range"],["rClamp","r.clamp"],["rNice","r.nice"],["rPercent","r.percent"],["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"],["lengthPercent","length.percent"],["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 KG(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 nL(e,t,n){for(let r in e){let i=QG.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&&KG(t,i.split("."),o)}}var JG=new Set(["frame","hexgrid","sphere","graticule"]),tX=new Map([["first",Jm],["last",ty],["maxX",Fw],["maxY",Cw],["minX",Bw],["minY",Lw],["nearest",qa],["nearestX",Va],["nearestXY",zs]]);async function iL(e){let t={marks:[]},n=[],{attributes:r,marks:i}=e;nL(r,t,n);let o=[];for(let a of i)for(let{type:c,data:l,options:u}of a.plotSpecs()){let{select:f,...h}=u,d=tX.get(f)?.(h)??h,p=JG.has(c)?[d]:[l,d];t.marks.push(gI[c](...p)),o.push(a.index)}nX(t,e);let s=Mm(t);rX(s,o),eX(e,s,r,n);for(let a of e.interactors)await a.init(s);return s}function eX(e,t,n,r){r.forEach(i=>{let o=n[i];if(o===Xs){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 nX(e,t){let{marks:n}=t;Rw("x",e,n),Rw("y",e,n),Rw("fx",e,n),Rw("fy",e,n)}function Rw(e,t,n){let r=t[e]||{};if(r.axis===null||r.label!==void 0)return;let i=n.map(l=>l.channelField(e)?.field);if(i.every(l=>l==null))return;let o,s,a;for(let l=0;l<i.length;++l){let{column:u,label:f}=i[l]||{};u===void 0&&f===void 0||(o===void 0&&s===void 0?(o=u,s=f,a=iX(n[l].data,e)||"number"):s!==f?s=void 0:o!==u&&(o=void 0))}let c=s||o;if(c!==void 0){if((a==="number"||a==="date")&&(e==="x"||e==="y")){r.percent&&(c=`${c} (%)`);let l=(e==="x"?1:-1)*(r.reverse?-1:1);e==="x"||r.labelAnchor==="center"?c=e==="x"==l<0?`\u2190 ${c}`:`${c} \u2192`:c=`${l<0?"\u2191 ":"\u2193 "}${c}`}t[e]={...r,label:c}}}function rX(e,t){let n=e.querySelectorAll('g[aria-label="facet"]');if(n.length)for(let r of n)rL(r,t);else rL(e,t)}function rL(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 iX(e,t){if(!e)return;let{columns:n}=e,r=n[t]??n[t+"1"]??n[t+"2"];if(r){for(let i of r)if(i!=null)return i instanceof Date?"date":typeof i}}var oX={width:640,marginLeft:40,marginRight:20,marginTop:20,marginBottom:30},bI=class{constructor(t){this.attributes={...oX},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=_v()}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(t=400){let{top:n,bottom:r}=this.margins(),i=this.getAttribute("height");return i==null&&t!=null&&(i=t,this.setAttribute("height",i,{silent:!0})),i-n-r}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 iL(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 md(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 kw(e){return typeof e!="string"?!1:(e=e.toLowerCase().trim(),e==="none"||e==="currentcolor"||e.startsWith("url(")&&e.endsWith(")")||e.startsWith("var(")&&e.endsWith(")")||Er(e)!==null)}var sX=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","select"]);function oL(e){return sX.has(e)}var aX=new Set(["asterisk","circle","cross","diamond","diamond2","hexagon","plus","square","square2","star","times","triangle","triangle2","wye"]);function sL(e){return aX.has(`${e}`.toLowerCase())}function ki(e){return yv(e)?cX(e):lX(e)}function cX(e){let{numRows:t,numCols:n,schema:{fields:r}}=e,i={};for(let o=0;o<n;++o){let s=r[o].name;i[s]?console.warn(`Redundant column name "${s}". Skipping...`):i[s]=bv(e.getChildAt(o))}return{numRows:t,columns:i}}function lX(e){let t=e.length;if(typeof e[0]=="object"){let n=t?Object.keys(e[0]):[],r={};return n.length>0&&n.forEach(i=>{r[i]=e.map(o=>o[i])}),{numRows:t,columns:r}}else return{numRows:t,values:e}}var aL=e=>e==="stroke"||e==="fill",uX=e=>/opacity$/i.test(e),fX=e=>e==="symbol",hX=(e,t)=>e!=="sort"&&e!=="tip"&&t!=null&&!Array.isArray(t),xI=(e,t)=>({channel:e,field:t,as:t instanceof mr?t.column:e}),wI=(e,t)=>({channel:e,value:t}),$w=e=>Array.isArray(e),On=class extends Xf{constructor(t,n,r,i={}){super(n?.options?.filterBy),this.type=t,this.reqs=i,this.source=n,$w(this.source)&&(this.data=ki(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 h in u)s.add(h),c(h,u[h]);else if(f==="function"&&u[Wf]){let h=u(this,l);for(let d in h)c(d,h[d])}else if(f==="string")oL(l)||aL(l)&&kw(u)||fX(l)&&sL(u)?o.push(wI(l,u)):o.push(xI(l,O0(u)));else if(ss(u))if(Array.isArray(u.columns))o.push(xI(l,u)),a.add(u);else{let h=wI(l,u.value);o.push(h),u.addEventListener("value",d=>(h.value=d,this.update()))}else f==="object"&&hX(l,u)?o.push(xI(l,u)):u!==void 0&&o.push(wI(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||$w(this.source)}hasFieldInfo(){return!!this._fieldInfo}channel(t){return this.channels.find(n=>n.channel===t)}channelField(t,{exact:n=!1}={}){let r=n?this.channel(t):this.channels.find(i=>i.channel.startsWith(t));return r?.field?r: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){if(!s)continue;let a=s.stats?.stats||[],c=s.stats?.column??s,l=i.get(c)??i.set(c,new Set).get(c);a.forEach(u=>l.add(u)),r[o]?.forEach(u=>l.add(u))}return Array.from(i,([o,s])=>({table:t,column:o,stats:s}))}fieldInfo(t){let n=Object.fromEntries(t.map(r=>[r.column,r]));for(let r of this.channels){let{field:i}=r;i&&Object.assign(r,n[i.stats?.column??i])}return this._fieldInfo=!0,this}query(t=[]){if(this.hasOwnData())return null;let{channels:n,source:{table:r}}=this;return ey(n,r).where(t)}queryPending(){return this.plot.pending(this),this}queryResult(t){return this.data=ki(t),this}update(){return this.plot.update(this)}plotSpecs(){let{type:t,data:n,detail:r,channels:i}=this;return _I(t,r,i,n)}};function Vn(e,t){let n=t?.[e.as]??e.as;return Object.hasOwn(e,"value")?e.value:aL(e.channel)?{value:n,scale:"color"}:uX(e.channel)?{value:n,scale:"opacity"}:n}function ey(e,t,n=[]){let r=Ct.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 _I(e,t,n,r,i={}){let{numRows:o,values:s,columns:a}=r??{},c={};for(let f of n){let h=t.has(f.channel)?c:i;h[f.channel]=Vn(f,a)}return t.size&&(i.channels=c),[{type:e,data:s??(r?{length:o}:null),options:i}]}function Ml(e,t){let{plot:n}=e,r=n.getAttribute(`${t}Scale`);if(!r){let{type:o}=e.channelField(t);r=o==="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 hd(i)}function $r(e,t,n,r,i=1,o){let{field:s}=e.channelField(t);o=o??s;let{type:a,apply:c,sqlApply:l}=Ml(e,t),u=!!e.plot.getAttribute(`${t}Reverse`),[f,h]=r.map(b=>c(b)),d=l(o),p=a==="time"||a==="utc"?d:o,m=h===f?0:(n-i)/(h-f),y=m!==1?` * ${m}::DOUBLE`:"";return[u?q`(${h} - ${d}::DOUBLE)${y}`:q`(${d}::DOUBLE - ${f})${y}`,p]}var vI={x:["min","max"]},SI={y:["min","max"]},Uw={...vI,...SI};function cL(e,t,n,r,i){let{plot:o}=e,s=o.getAttribute(r),a=o.getAttribute(i);if(Array.isArray(s)&&!s[bn])return s;{let{column:c,min:l,max:u}=e.channelField(n),f=MI(t,c)||(a?vs().domain([l,u]).nice().domain():[l,u]);return s!==Xs&&(f[bn]=!0),o.setAttribute(r,f,{silent:!0}),f}}function Po(e,t){return cL(e,t,"x","xDomain","xNice")}function zo(e,t){return cL(e,t,"y","yDomain","yNice")}function MI(e,t){if(!e)return;let n,r,i=(o,s)=>{if(o==="BETWEEN"&&`${s.field}`===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 II=class extends On{constructor(t,n,r){let i=t.endsWith("X")?"y":t.endsWith("Y")?"x":null,o=i?{[i]:["min","max"]}:void 0;super(t,n,r,o),this.dim=i}query(t=[]){let{plot:n,dim:r,source:i}=this,{optimize:o=!0}=i.options||{},s=super.query(t);if(!r)return s;let a=r==="x"?"y":"x",c=this.channelField(a,{exact:!0})?.as,{field:l,as:u,type:f,min:h,max:d}=this.channelField(r);if(o&&(f==="date"||f==="number")&&c){let m=r==="x"?n.innerWidth():n.innerHeight(),[y,g]=MI(t,l)||[h,d],[b]=$r(this,r,m,[y,g],1,u),x=s.select().map(w=>w.as).filter(w=>w!==u&&w!==c);return dX(s,b,u,c,x)}else return s.orderby(l)}};function dX(e,t,n,r,i=[]){let o=q`FLOOR(${t})::INTEGER`,s=a=>Ct.from(e).select(a).groupby(o,i);return Ct.union(s([{[n]:la(n),[r]:L0(r,n)},...i]),s([{[n]:ca(n),[r]:F0(r,n)},...i]),s([{[n]:L0(n,r),[r]:la(r)},...i]),s([{[n]:F0(n,r),[r]:ca(r)},...i])).orderby(i,n)}function lL(e,t=[]){return new t.constructor(e)}function uL(e,t,n){let r=lL(e,n),i=n.length;for(let o=0;o<i;++o)r[t[o]]=n[o];return r}function fL(e,t,n,r,i,o,s){let a=n.length,c=e*t,l=i.map(d=>r[d]),u={},f=[],h=new Int32Array(a);if(o?.length){let d=o.map(m=>r[m]),p={};for(let m=0;m<a;++m){let y=d.map(g=>g[m]);h[m]=p[y]??=f.push(y)-1}for(let m=0;m<o.length;++m)u[o[m]]=f.map(y=>y[m])}else f.push([]);if(s){let d=n.map(y=>y%e),p=n.map(y=>Math.floor(y/e)),m=f.map(()=>[]);for(let y=0;y<a;++y)m[h[y]].push(y);i.forEach((y,g)=>{let b=l[g];u[y]=f.map((x,w)=>s(m[w],e,t,d,p,b))})}else i.forEach((d,p)=>{let m=l[p],y=u[d]=f.map(()=>lL(c,m));for(let g=0;g<a;++g)y[h[g]][n[g]]=m[g]});return{numRows:f.length,columns:u}}function ny(e){let t=1/0,n=-1/0;return e.forEach(r=>{let i=r.length;for(let o=0;o<i;++o){let s=r[o];s<t&&(t=s),s>n&&(n=s)}}),Number.isFinite(t)&&Number.isFinite(n)?[t,n]:[0,1]}function hL(e){let t=new Hn;return e.forEach(n=>{let r=n.length;for(let i=0;i<r;++i)t.add(n[i])}),Array.from(t).sort(Et)}function ze(e,t){return Jl(e)?(e.addEventListener("value",t),e.value):e}function ry(e,t=!1){let n=new Float64Array(5),r=new Float64Array(4);pX(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 pX(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),h=Float64Array.of(1,0,l[0],l[1],0,0,0,0,0,0),d,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],d=p-2;d>0;d-=2)f[d]+=l[p]*f[d-2]-l[p+1]*f[d-1],f[d+1]+=l[p]*f[d-1]+l[p+1]*f[d-2];for(d=0;d<=p;d+=2)f[d]+=i[p]*h[d]-i[p+1]*h[d+1],f[d+1]+=i[p]*h[d+1]+i[p+1]*h[d];for(h[p+2]=l[p]*h[p]-l[p+1]*h[p+1],h[p+3]=l[p]*h[p+1]+l[p+1]*h[p],d=p;d>0;d-=2)h[d]+=l[p]*h[d-2]-l[p+1]*h[d-1],h[d+1]+=l[p]*h[d-1]+l[p+1]*h[d-2]}for(p=0;p<4;++p)d=p<<1,t[p]=f[d]/u,e[p+1]=h[d+2]}function dL(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);Pw(e,n.subarray(u),r,1,o,s,a,f)}for(let l=0;l<r;++l){let u=c.subarray(l);Pw(t,u,i,r,o,s,a,u)}return c}function Pw(e,t,n,r=1,i=new Float64Array(n),o=new Float64Array(n),s=new Float64Array(5),a=i,c=mX){let l=r*2,u=r*3,f=r*4,h=r*n,d,p;for(c(i,t,n,r,e.b_causal,3,e.a,4,e.sum_causal,s,e.sigma),p=4,d=f;p<n;++p,d+=r)i[p]=e.b_causal[0]*t[d]+e.b_causal[1]*t[d-r]+e.b_causal[2]*t[d-l]+e.b_causal[3]*t[d-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,d=h-r*5;p<n;++p,d-=r)o[p]=e.b_anticausal[1]*t[d+r]+e.b_anticausal[2]*t[d+l]+e.b_anticausal[3]*t[d+u]+e.b_anticausal[4]*t[d+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,d=0;p<n;++p,d+=r)a[d]=i[p]+o[n-p-1];else for(p=0,d=0;p<n;++p,d+=r)a[d]=Math.max(0,i[p]+o[n-p-1]);return a}function mX(e,t,n,r,i,o,s,a,c,l,u,f=.5){let h=Math.abs(r)*n,d=r<0?h+r:0,p,m,y;for(m=0;m<=a;++m)for(l[m]=m<=o?i[m]:0,y=1;y<=a&&y<=m;++y)l[m]-=s[y]*l[m-y];for(y=0;y<a;++y)for(e[y]=0,m=1;m<=y;++m)p=d+r*m,p>=0&&p<h&&(e[y]+=l[y-m]*t[p]);let g=t[d],b=Math.ceil(u*10);for(m=0;m<b;++m){for(y=0;y<a;++y)e[y]+=l[y]*g;if(c-=Math.abs(l[0]),c<=f)break;for(l[a]=m+a<=o?i[m+a]:0,y=1;y<=a;++y)l[a]-=s[y]*l[a-y];for(y=0;y<a;++y)l[y]=l[y+1]}}var Ws="density",$i=class extends On{constructor(t,n,r){let{bandwidth:i=0,interpolate:o="none",pixelSize:s=1,pad:a=1,width:c,height:l,...u}=r,f=yX(u);super(t,n,u,Uw),this.densityMap=f,this.bandwidth=ze(i,h=>(this.bandwidth=h,this.grids?this.convolve().update():null)),this.interpolate=ze(o,h=>(this.interpolate=h,this.requestUpdate())),this.pixelSize=ze(s,h=>(this.pixelSize=h,this.requestUpdate())),this.pad=ze(a,h=>(this.pad=h,this.requestUpdate())),this.width=ze(c,h=>(this.width=h,this.requestUpdate())),this.height=ze(l,h=>(this.height=h,this.requestUpdate()))}setPlot(t,n){let r=()=>{this.hasFieldInfo()&&this.requestUpdate()};t.addAttributeListener("xDomain",r),t.addAttributeListener("yDomain",r),super.setPlot(t,n)}get filterIndexable(){let t=this.plot.getAttribute("xDomain"),n=this.plot.getAttribute("yDomain");return t&&n&&!t[bn]&&!n[bn]}query(t=[]){let{interpolate:n,pad:r,channels:i,densityMap:o,source:s}=this,[a,c]=this.extentX=Po(this,t),[l,u]=this.extentY=zo(this,t),[f,h]=this.bins=this.binDimensions(),[d,p]=$r(this,"x",f,[a,c],r),[m,y]=$r(this,"y",h,[l,u],r),g=r?[sn(p,[+a,+c]),sn(y,[+l,+u])]:[vc(+a,p),_c(p,+c),vc(+l,y),_c(y,+u)],b=Ct.from(s.table).where(t.concat(g)),x=this.groupby=[],w={};for(let _ of i)if(Object.hasOwn(_,"field")){let{as:M,channel:E,field:I}=_;I.aggregate?(w[E]=I,o[E]=!0):E==="weight"?w[Ws]=Ai(I):E!=="x"&&E!=="y"&&(b.select({[M]:I}),x.push(M))}let v=this.aggr=Object.keys(w);if(w.density&&v.length>1)throw new Error("Weight option can not be used with custom aggregates.");if(v.length||(v.push(Ws),w.density=Tr()),n==="linear"){if(v.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 xX(b,d,m,w[Ws],f,x)}else return bX(b,d,m,w,f,x)}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,i=gX(this.interpolate),{columns:o}=ki(t);return this.grids0=fL(n,r,o.index,o,this.aggr,this.groupby,i),this.convolve()}convolve(){let{aggr:t,bandwidth:n,bins:r,grids0:i,plot:o}=this;if(this.grids=i,n>0){let s=t.length===1?t[0]:t.includes(Ws)?Ws:null;if(!s)return console.warn("No compatible grid found for smoothing."),this;let a=i.columns[s],c=o.innerWidth(),l=o.innerHeight(),[u,f]=r,h=a.some(m=>m.some(y=>y<0)),d=ry(n*(u-1)/c,h),p=ry(n*(f-1)/l,h);this.grids={numRows:i.numRows,columns:{...i.columns,[s]:a.map(m=>dL(d,p,m,r))}}}return this}};function yX(e){let t={};for(let n in e)e[n]==="density"&&(delete e[n],t[n]=!0);return t}function gX(e="none"){if(typeof e=="function")return e;switch(e.toLowerCase()){case"none":case"linear":return;case"nearest":return zm;case"barycentric":return Pm();case"random-walk":return qm()}throw new Error(`invalid interpolate: ${e}`)}function bX(e,t,n,r,i,o){return e.select({index:q`FLOOR(${t})::INTEGER + FLOOR(${n})::INTEGER * ${i}`,...r}).groupby("index",o)}function xX(e,t,n,r,i,o){let s=r?.column?`* ${r.column}`:"",a=(h,d)=>e.clone().select({xp:t,yp:n,i:h,w:d}),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 Ct.from(Ct.unionAll(c,l,u,f)).select({index:"i",density:Ai("w")},o).groupby("index",o).having(ld("density",0))}var AI=class extends $i{constructor(t,n){let{thresholds:r=10,...i}=n;super("geo",t,{bandwidth:20,interpolate:"linear",pixelSize:2,...i}),this.thresholds=ze(r,o=>(this.thresholds=o,this.grids?this.contours().update():null))}convolve(){return super.convolve().contours()}contours(){let{bins:t,densityMap:n,grids:r,thresholds:i,plot:o}=this,{numRows:s,columns:a}=r,c=i,l;if(Array.isArray(c))l=c;else{let[,A]=ny(a.density);l=Array.from({length:c-1},(O,L)=>A*(L+1)/c)}(n.fill||n.stroke)&&this.plot.getAttribute("colorScale")!=="log"&&this.plot.setAttribute("colorZero",!0);let[u,f]=t,[h,d]=o.getAttribute("xDomain"),[p,m]=o.getAttribute("yDomain"),y=(d-h)/u,g=(m-p)/f,b=+h,x=+p,w=A=>b+A*y,v=A=>x+A*g,_=ba().size(t),M=this.contourData=Array(s*l.length),{density:E,...I}=a,N=Object.entries(I);for(let A=0,O=0;A<s;++A){let L=E[A],S=N.reduce((T,[D,C])=>(T[D]=C[A],T),{});for(let T=0;T<l.length;++T,++O)M[O]=Object.assign(wX(_.contour(L,l[T]),w,v),S)}return this}plotSpecs(){let{type:t,channels:n,densityMap:r,contourData:i}=this,o={};for(let s of n){let{channel:a}=s;a!=="x"&&a!=="y"&&(o[a]=Vn(s))}for(let s in r)r[s]&&(o[s]=Vn({channel:s,as:"value"}));return[{type:t,data:i,options:o}]}};function wX(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 iy(e){return Array.from({length:e},(t,n)=>n)}function zw(e,t){let n=t.reduce((i,o,s)=>(i[o]=s,i),{}),r=iy(e.length);return r.sort((i,o)=>n[e[i]]-n[e[o]]),r}function qw(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 pL(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 mL(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 yL(e={}){let{r:t=0,g:n=0,b:r=0,opacity:i=1}=typeof e=="string"?en(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 gL(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:h=1}=typeof c=="string"?en(c):c,d=a<<2;i[d+0]=l,i[d+1]=u,i[d+2]=f,i[d+3]=255*h|0,r[t[a]]=d}return(a,c,l,u)=>{if(u.map)for(let f=0,h=0;f<l;++f)for(let d=0,p=(l-f-1)*c;d<c;++d,h+=4){let m=r[u[d+p]];a[h+0]=i[m+0],a[h+1]=i[m+1],a[h+2]=i[m+2],a[h+3]=i[m+3]}else{let f=r[u];for(let h=0,d=0;h<l;++h)for(let p=0;p<c;++p,d+=4)a[d+0]=i[f+0],a[d+1]=i[f+1],a[d+2]=i[f+2],a[d+3]=i[f+3]}}}function bL(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"?en(a):a,h=s<<2;i[h+0]=c,i[h+1]=l,i[h+2]=u,i[h+3]=255*f|0}return(s,a,c,l)=>{for(let u=0,f=0;u<c;++u)for(let h=0,d=(c-u-1)*a;h<a;++h,f+=4){let p=o*n(l[h+d])<<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 Vf=class extends $i{constructor(t,n){super("image",t,n),this.image=null}setPlot(t,n){let r=()=>{this.hasFieldInfo()&&this.rasterize()};t.addAttributeListener("schemeColor",r),super.setPlot(t,n)}convolve(){return super.convolve().rasterize()}rasterize(){let{bins:t,grids:n}=this,[r,i]=t,{numRows:o,columns:s}=n,{canvas:a,ctx:c,img:l}=MX(this,r,i),{alpha:u,alphaProp:f,color:h,colorProp:d}=EI(this),p=s[f]??[],m=s[d]??[],y=o>1&&d&&this.groupby?.includes(d)?zw(m,this.plot.getAttribute("colorDomain")):iy(o);return this.data={numRows:o,columns:{src:Array.from({length:o},(g,b)=>(h?.(l.data,r,i,m[y[b]]),u?.(l.data,r,i,p[y[b]]),c.putImageData(l,0,0),a.toDataURL()))}},this}plotSpecs(){let{type:t,plot:n,data:{numRows:r,columns:i}}=this,o={src:i.src,width:n.innerWidth(),height:n.innerHeight(),preserveAspectRatio:"none",imageRendering:this.channel("imageRendering")?.value,frameAnchor:"middle"};return[{type:t,data:{length:r},options:o}]}},TI=class extends Vf{constructor(t,n){super(t,{bandwidth:20,interpolate:"linear",pixelSize:2,...n})}};function EI(e){let{aggr:t,densityMap:n,groupby:r,plot:i}=e,o=t.includes(Ws),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":kw(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"?Ws:null),h=c?.as??(u==="grid"?Ws:null),d=l!=="grid"&&l!=="group"?yL(l):vX(e,f),p=u!=="grid"?pL(u):_X(e,h);return{alphaProp:h,colorProp:f,alpha:p,color:d}}function _X(e,t){let{plot:n,grids:r}=e,i=n.getAttribute("opacityDomain"),o=i===Xs,s=i?.[bn],a=!o&&!s&&i||ny(r.columns[t]);(o||s||!i)&&(o||(a[bn]=!0),n.setAttribute("opacityDomain",a));let c=Pa({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 mL(c)}function vX(e,t){let{plot:n,grids:r}=e,i=r.columns[t],o=!i[0]?.map,s=o||Array.isArray(i[0]),a=n.getAttribute("colorDomain"),c=a===Xs,l=a?.[bn],u=!c&&!l&&a||(o?i.slice().sort(Et):s?hL(i):ny(i));(c||l||!a)&&(c||(u[bn]=!0),n.setAttribute("colorDomain",u));let f=Pa({color:{type:n.getAttribute("colorScale"),domain:u,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(s)return gL(f);{let h=Pa({x:{type:SX(f.type),domain:f.domain,reverse:f.reverse,range:[0,1],clamp:f.clamp,base:f.base,exponent:f.exponent,constant:f.constant}});return bL(1024,f,h.apply)}}function SX(e){return e.endsWith("symlog")?"symlog":e.endsWith("log")?"log":e.endsWith("pow")?"pow":e.endsWith("sqrt")?"sqrt":e==="diverging"?"linear":e}function MX(e,t,n){if(!e.image||e.image.w!==t||e.image.h!==n){let r=qw(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 DI=class extends Vf{constructor(t,n){let{normalize:r=!0,...i}=n;super(t,i),this.normalize=ze(r,o=>(this.normalize=o,this.requestUpdate()))}query(t=[]){let{channels:n,normalize:r,source:i,pad:o}=this,[s,a]=this.bins=this.binDimensions(),[c]=$r(this,"x",s,Po(this,t),o),[l]=$r(this,"y",a,zo(this,t),o),u=Ct.from(i.table).where(IX(this,t));this.aggr=["density"];let f=this.groupby=[],h=[];for(let d of n)if(Object.hasOwn(d,"field")){let{channel:p,field:m}=d;p==="z"?(u.select({[p]:m}),h.push("z")):p!=="x"&&p!=="y"&&(u.select({[p]:m}),f.push(p))}return AX(u,c,l,h,s,a,f,r)}};function IX(e,t){if(Array.isArray(t)&&!t.length)return t;let{column:n}=e.channelField("x"),{column:r}=e.channelField("y"),i=s=>{let a=`${s.field}`;return s.op!=="BETWEEN"||a!==n&&a!==r},o=s=>s.op==="AND"?Zr(s.children.filter(a=>i(a))):s;return Array.isArray(t)?t.filter(s=>i(s)).map(s=>o(s)):o(t)}function AX(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=Ct.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(Zr(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=Ct.select({x:q`GREATEST(MAX(ABS(dx)), MAX(ABS(dy)))`}).from("pairs"),h=Ct.select({i:q`UNNEST(range((${f})))::INTEGER`}),d=Ct.unionAll(Ct.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)`),Ct.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)`),Ct.select(c,{x:"x0",y:"y0"}).from("pairs").where(cd("dx"))),p=["x"].concat(c).join(", "),m=Ct.from("raster").select(c,"x","y",a?{w:q`1.0 / COUNT(*) OVER (PARTITION BY ${p})`}:null).where(Zr(sn("x",[0,i],!0),sn("y",[0,o],!0)));return Ct.with({pairs:u,indices:h,raster:d,points:m}).from("points").select(s,{index:q`x + y * ${i}::INTEGER`,density:a?Ai("w"):Tr()}).groupby("index",s)}var NI=class extends On{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"?vI:SI),this.dim=a,this.bins=ze(i,c=>(this.bins=c,this.requestUpdate())),this.bandwidth=ze(o,c=>(this.bandwidth=c,this.grid?this.convolve().update():null))}get filterIndexable(){let t=this.dim==="x"?"xDomain":"yDomain",n=this.plot.getAttribute(t);return n&&!n[bn]}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"?Po:zo)(this,t),[a,c]=$r(this,i,n,s),l=ey(r,o,[i]).where(t.concat(sn(c,s))),u=this.channelField("weight")?"weight":null;return TX(l,a,u)}queryResult(t){let{columns:{index:n,density:r}}=ki(t);return this.grid=uL(this.bins,n,r),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=ry(n*(t-1)/l,c),f=Pw(u,i,t),h=r==="x"?"y":"x",d=this.channelField(r).as,p=+s,m=(a-p)/(t-1),y=1/m,g=new Float64Array(t),b=new Float64Array(t);for(let x=0;x<t;++x)g[x]=p+x*m,b[x]=f[x]*y;return this.data={numRows:t,columns:{[d]:g,[h]:b}},this}plotSpecs(){let{type:t,data:{numRows:n,columns:r},channels:i,dim:o}=this,s=o==="x"?{y:r.y}:{x:r.x};for(let a of i)s[a.channel]=Vn(a,r);return[{type:t,data:{length:n},options:s}]}};function TX(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 Ct.from(Ct.unionAll(i,o)).select({index:"i",density:Ai("w")}).groupby("index").having(H_("density",0))}var OI=class extends $i{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=Ml(this,"x"),c=Ml(this,"y"),[l,u]=r.map(y=>a.apply(y)),[f,h]=i.map(y=>c.apply(y)),d=(u-l)/(o-n),p=(h-f)/(s-n),m=n?0:.5;return this.data=EX(this.grids,t,l,f,d,p,a.invert,c.invert,m),this}plotSpecs(){let{type:t,channels:n,densityMap:r,data:{numRows:i,columns:o}}=this,s={};for(let a of n){let{channel:c}=a;s[c]=c==="x"||c==="y"?o[c]:Vn(a,o)}for(let a in r)r[a]&&(s[a]=o.density);return[{type:t,data:{length:i},options:s}]}};function EX(e,t,n,r,i,o,s,a,c){let l=1/(i*o),[u,f]=t,h=u*f,d=h*e.numRows,p=new Float64Array(d),m=new Float64Array(d),y=new Float64Array(d),g={x:p,y:m,density:y},{density:b,...x}=e.columns;for(let v in x)g[v]=new x[v].constructor(d);let w=0;for(let v=0;v<e.numRows;++v){for(let M in x)g[M].fill(x[M][v],w,w+h);let _=b[v];for(let M=0,E=0;E<f;++E)for(let I=0;I<u;++I,++w,++M)p[w]=s(n+(I+c)*i),m[w]=a(r+(E+c)*o),y[w]=_[M]*l}return{numRows:d,columns:g}}function DX(e,t,n){var r=1e-8,i=t-1,o=n-1,s=0,a,c,l,u,f,h,d,p,m,y,g;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)),d=(2.30753+u*.27061)/(1+u*(.99229+u*.04481))-u,e<.5&&(d=-d),p=(d*d-3)/6,m=2/(1/(2*t-1)+1/(2*n-1)),y=d*Math.sqrt(p+m)/m-(1/(2*n-1)-1/(2*t-1))*(p+5/6-2/(3*m)),d=t/(t+n*Math.exp(2*y))):(a=Math.log(t/(t+n)),c=Math.log(n/(t+n)),u=Math.exp(t*a)/t,f=Math.exp(n*c)/n,y=u+f,e<u/y?d=Math.pow(t*y*e,1/t):d=1-Math.pow(n*y*(1-e),1/n)),g=-jf(t)-jf(n)+jf(t+n);s<10;s++){if(d===0||d===1)return d;if(h=NX(d,t,n)-e,u=Math.exp(i*Math.log(d)+o*Math.log(1-d)+g),f=h/u,d-=u=f/(1-.5*Math.min(1,f*(i/d-o/(1-d)))),d<=0&&(d=.5*(d+u)),d>=1&&(d=.5*(d+u+1)),Math.abs(u)<r*d&&s>0)break}return d}function NX(e,t,n){var r=e===0||e===1?0:Math.exp(jf(t+n)-jf(t)-jf(n)+t*Math.log(e)+n*Math.log(1-e));return e<0||e>1?0:e<(t+1)/(t+n+2)?r*xL(e,t,n)/t:1-r*xL(1-e,n,t)/n}function xL(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,h,d;for(Math.abs(l)<r&&(l=r),l=1/l,d=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,d*=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,h=l*c,d*=h,!(Math.abs(h-1)<3e-7));i++);return d}function jf(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 wL(e,t){var n=DX(2*Math.min(e,1-e),.5*t,.5);return n=Math.sqrt(t*(1-n)/n),e>.5?n:-n}function _L(e){let t=-Math.log((1-e)*(1+e)),n;return t<6.25?(t-=3.125,n=-364441206401782e-35,n=-16850591381820166e-35+n*t,n=128584807152564e-32+n*t,n=11157877678025181e-33+n*t,n=-1333171662854621e-31+n*t,n=20972767875968562e-33+n*t,n=6637638134358324e-30+n*t,n=-4054566272975207e-29+n*t,n=-8151934197605472e-29+n*t,n=26335093153082323e-28+n*t,n=-12975133253453532e-27+n*t,n=-5415412054294628e-26+n*t,n=10512122733215323e-25+n*t,n=-4112633980346984e-24+n*t,n=-29070369957882005e-24+n*t,n=42347877827932404e-23+n*t,n=-13654692000834679e-22+n*t,n=-13882523362786469e-21+n*t,n=.00018673420803405714+n*t,n=-.000740702534166267+n*t,n=-.006033670871430149+n*t,n=.24015818242558962+n*t,n=1.6536545626831027+n*t):t<16?(t=Math.sqrt(t)-3.25,n=22137376921775787e-25,n=9075656193888539e-23+n*t,n=-27517406297064545e-23+n*t,n=18239629214389228e-24+n*t,n=15027403968909828e-22+n*t,n=-4013867526981546e-21+n*t,n=29234449089955446e-22+n*t,n=12475304481671779e-21+n*t,n=-47318229009055734e-21+n*t,n=6828485145957318e-20+n*t,n=24031110387097894e-21+n*t,n=-.0003550375203628475+n*t,n=.0009532893797373805+n*t,n=-.0016882755560235047+n*t,n=.002491442096107851+n*t,n=-.003751208507569241+n*t,n=.005370914553590064+n*t,n=1.0052589676941592+n*t,n=3.0838856104922208+n*t):Number.isFinite(t)?(t=Math.sqrt(t)-5,n=-27109920616438573e-27,n=-2555641816996525e-25+n*t,n=15076572693500548e-25+n*t,n=-3789465440126737e-24+n*t,n=761570120807834e-23+n*t,n=-1496002662714924e-23+n*t,n=2914795345090108e-23+n*t,n=-6771199775845234e-23+n*t,n=22900482228026655e-23+n*t,n=-99298272942317e-20+n*t,n=4526062597223154e-21+n*t,n=-1968177810553167e-20+n*t,n=7599527703001776e-20+n*t,n=-.00021503011930044477+n*t,n=-.00013871931833623122+n*t,n=1.0103004648645344+n*t,n=4.849906401408584+n*t):n=1/0,n*e}var BI=class extends On{constructor(t,n,r){let i=t.endsWith("X")?"y":"x",{ci:o=.95,...s}=r;super(t,n,s),this.dim=i,this.field=this.channelField(i).field,this.channels=this.channels.filter(a=>a.channel!==i),this.ci=ze(o,a=>(this.ci=a,this.update()))}query(t=[]){let{channels:n,field:r,source:{table:i}}=this,o=n.concat([{field:K_(r),as:"__avg__"},{field:Tr(r),as:"__n__"},{field:J_(r),as:"__sd__"}]);return ey(o,i).where(t)}queryResult(t){return this.data=ki(t),this}plotSpecs(){let{type:t,dim:n,detail:r,data:i,ci:o,channels:s}=this,a=Math.SQRT2*_L(o),{columns:{__avg__:c,__sd__:l,__n__:u}}=i,f={[`${n}1`]:c.map((h,d)=>h-a*l[d]/Math.sqrt(u[d])),[`${n}2`]:c.map((h,d)=>h+a*l[d]/Math.sqrt(u[d]))};return _I(t,r,s,i,f)}};var OX="geom",LI=class extends On{constructor(t,n={},r){!$w(t)&&!n?.geometry&&(n.geometry=av(OX)),super("geo",t,n,r)}queryResult(t){super.queryResult(t);let n=this.channelField("geometry")?.as;if(n){let{columns:r}=this.data;typeof r[n][0]=="string"&&(r[n]=r[n].map(i=>JSON.parse(i)))}return this}};var FI=class extends On{constructor(t,n){let{type:r="hexagon",binWidth:i=20,...o}=n;super(r,t,{r:i/2,clip:!0,...o},Uw),this.binWidth=ze(i,s=>(this.binWidth=s,this.requestUpdate()))}get filterIndexable(){let t=this.plot.getAttribute("xDomain"),n=this.plot.getAttribute("yDomain");return t&&n&&!t[bn]&&!n[bn]}query(t=[]){if(this.hasOwnData())return null;let{plot:n,binWidth:r,channels:i,source:o}=this,[s,a]=Po(this,t),[c,l]=zo(this,t),u=.5-n.getAttribute("marginLeft"),f=0-n.getAttribute("marginTop"),h=`${r}::DOUBLE`,d=`${r*(1.5/Math.sqrt(3))}::DOUBLE`,p=`${n.innerWidth()/(a-s)}::DOUBLE`,m=`${n.innerHeight()/(l-c)}::DOUBLE`,y,g,b=new Set,x={},w;for(let I of i)I.channel==="orderby"?w=I.value:I.channel==="x"?y=I:I.channel==="y"?g=I:Object.hasOwn(I,"field")&&(x[I.as]=I.field,I.field.aggregate&&I.field.columns.forEach(N=>b.add(N)));let v=Ct.select({[y.as]:q`${s}::DOUBLE + ((x + 0.5 * (y & 1)) * ${h} + ${u})::DOUBLE / ${p}`,[g.as]:q`${l}::DOUBLE - (y * ${d} + ${f})::DOUBLE / ${m}`,...x}).groupby("x","y");w&&v.orderby(w);let _=`${p} * (${y.field} - ${s}::DOUBLE)`,M=`${m} * (${l}::DOUBLE - ${g.field})`,E=Ct.select({py:q`(${M} - ${f}) / ${d}`,pj:q`ROUND(py)::INTEGER`,px:q`(${_} - ${u}) / ${h} - 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(b)).from(o.table).where(wc(y.field),wc(g.field),t);return v.from(E)}};var CI=class extends $i{constructor(t,n){let{origin:r=[0,0],dim:i="xy",...o}=n;super("image",t,o),this.image=null,this.origin=r,this.tileX=i.toLowerCase().includes("x"),this.tileY=i.toLowerCase().includes("y")}setPlot(t,n){let r=()=>{this.hasFieldInfo()&&this.rasterize()};t.addAttributeListener("schemeColor",r),super.setPlot(t,n)}requestQuery(){return this.requestTiles()}query(t=[]){return this._filter=t,null}tileQuery(t){let{interpolate:n,pad:r,channels:i,densityMap:o,source:s}=this,[[a,c],[l,u]]=t,[f,h]=this.bins,[d,p]=$r(this,"x",f,[a,c],r),[m,y]=$r(this,"y",h,[l,u],r),g=r?[sn(p,[+a,+c]),sn(y,[+l,+u])]:[vc(+a,p),_c(p,+c),vc(+l,y),_c(y,+u)],b=Ct.from(s.table).where(g),x=this.groupby=[],w={};for(let _ of i)if(Object.hasOwn(_,"field")){let{as:M,channel:E,field:I}=_;I.aggregate?(w[E]=I,o[E]=!0):E==="weight"?w.density=Ai(I):E!=="x"&&E!=="y"&&(b.select({[M]:I}),x.push(M))}let v=this.aggr=Object.keys(w);if(w.density&&v.length>1)throw new Error("Weight option can not be used with custom aggregates.");if(v.length||(v.push("density"),w.density=Tr()),n==="linear"){if(v.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 RX(b,d,m,w.density,f,x)}else return CX(b,d,m,w,f,x)}async requestTiles(){let t=xv();this.prefetch&&t.cancel(this.prefetch);let{pad:n,tileX:r,tileY:i,origin:[o,s]}=this,[a,c]=this.bins=this.binDimensions(),[l,u]=Po(this,this._filter),[f,h]=zo(this,this._filter),d=u-l,p=h-f,m=Math.floor((l-o)*(a-n)/d),y=Math.floor((f-s)*(c-n)/p),g=(A,O)=>[[o+A*d,o+(A+1)*d],[s+O*p,s+(O+1)*p]],b=Math.floor((l-o)/d),x=r?vL((u-o)/d):b,w=Math.floor((f-s)/p),v=i?vL((h-s)/p):w,_=[];for(let A=b;A<=x;++A)for(let O=w;O<=v;++O)_.push([A,O]);let M=_.map(([A,O])=>t.query(this.tileQuery(g(A,O)))),E=[];if(r)for(let A=w;A<=v;++A)E.push([x+1,A]),E.push([b-1,A]);if(i){let A=r?b-1:b,O=r?x+1:x;for(let L=A;L<=O;++L)E.push([L,v+1]),E.push([L,w-1])}this.prefetch=E.map(([A,O])=>t.prefetch(this.tileQuery(g(A,O))));let I=await Promise.all(M),N=BX(a,c,m,y,_,I);this.grids0={numRows:N.length,columns:{density:[N]}},this.convolve().update()}convolve(){return super.convolve().rasterize()}rasterize(){let{bins:t,grids:n}=this,[r,i]=t,{numRows:o,columns:s}=n,{canvas:a,ctx:c,img:l}=FX(this,r,i),{alpha:u,alphaProp:f,color:h,colorProp:d}=EI(this),p=s[f]??[],m=s[d]??[],y=o>1&&d&&this.groupby?.includes(d)?zw(m,this.plot.getAttribute("colorDomain")):iy(o);return this.data={numRows:o,columns:{src:Array.from({length:o},(g,b)=>(h?.(l.data,r,i,m[y[b]]),u?.(l.data,r,i,p[y[b]]),c.putImageData(l,0,0),a.toDataURL()))}},this}plotSpecs(){let{type:t,plot:n,data:{numRows:r,columns:i}}=this,o={src:i.src,width:n.innerWidth(),height:n.innerHeight(),preserveAspectRatio:"none",imageRendering:this.channel("imageRendering")?.value,frameAnchor:"middle"};return[{type:t,data:{length:r},options:o}]}};function BX(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,h=u*t-r;LX(e,t,s,a,f,h)}),s}function LX(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,h=o+Math.floor(u/e);0<=f&&f<e&&0<=h&&h<t&&(n[f+h*e]=c[l])}}function FX(e,t,n){if(!e.image||e.image.w!==t||e.image.h!==n){let r=qw(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 CX(e,t,n,r,i,o){return e.select({index:q`FLOOR(${t})::INTEGER + FLOOR(${n})::INTEGER * ${i}`,...r}).groupby("index",o)}function RX(e,t,n,r,i,o){let s=r.column?`* ${r.column}`:"",a=(h,d)=>e.clone().select({xp:t,yp:n,i:h,w:d}),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 Ct.from(Ct.unionAll(c,l,u,f)).select({index:"i",density:Ai("w")},o).groupby("index",o).having(ld("density",0))}function vL(e){let t=Math.floor(e);return t===e?t-1:t}var kI=class extends On{constructor(t,n){let{ci:r=.95,precision:i=4,...o}=n;super("line",t,o);let s=()=>this.modelFit?this.confidenceBand().update():null;this.ci=ze(r,a=>(this.ci=a,s())),this.precision=ze(i,a=>(this.precision=a,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 Ct.from(super.query(t)).select({intercept:tv(r,n),slope:ev(r,n),n:nv(r,n),ssy:rv(r,n),ssx:iv(r,n),xm:ov(r,n),x0:C0(la(n).where(wc(r))),x1:C0(ca(n).where(wc(r)))}).select(i).groupby(i)}queryResult(t){return this.modelFit=ki(t),this.lineData=kX(this.modelFit),this.confidenceBand()}confidenceBand(){let{ci:t,modelFit:n,precision:r,plot:i}=this,o=i.innerWidth();return this.areaData=t?$X(n,t,r,o):null,this}plotSpecs(){let{lineData:t,areaData:n,channels:r,ci:i}=this,o=t.columns,s=i?n.columns:{},a={x:o.x,y:o.y},c={x:s.x,y1:s.y1,y2:s.y2,fillOpacity:.1};for(let l of r)switch(l.channel){case"x":case"y":case"fill":break;case"tip":c.tip=Vn(l,s);break;case"stroke":a.stroke=Vn(l,o),c.fill=Vn(l,s);break;case"strokeOpacity":a.strokeOpacity=Vn(l,o);break;case"fillOpacity":c.fillOpacity=Vn(l,s);break;default:a[l.channel]=Vn(l,o),c[l.channel]=Vn(l,s);break}return[...i?[{type:"areaY",data:{length:n.numRows},options:c}]:[],{type:"line",data:{length:t.numRows},options:a}]}};function RI(e,t){if(e.concat)return e.concat(t);let n=new e.constructor(e.length+t.length);return n.set(e,0),n.set(t,e.length),n}function kX(e){let{x0:t,x1:n,xm:r,intercept:i,slope:o,n:s,ssx:a,ssy:c,...l}=e.columns,u=(d,p)=>i[p]+d*o[p],f=RI(t,n),h=RI(t.map(u),n.map(u));for(let d in l)l[d]=RI(l[d],l[d]);return{numRows:f.length,columns:{x:f,y:h,...l}}}function $X(e,t,n,r){let i=e.numRows,{x0:o,x1:s,xm:a,intercept:c,slope:l,n:u,ssx:f,ssy:h,...d}=e.columns,p=Object.keys(d),m={x:[],y1:[],y2:[]};p.forEach(y=>m[y]=[]);for(let y=0;y<i;++y){let g=n*(s[y]-o[y])/r,b=wL((1-t)/2,u[y]-2)*Math.sqrt(h[y]/(u[y]-2));ke(o[y],s[y]-g/2,g).concat(s[y]).forEach(x=>{let w=c[y]+x*l[y],v=b*Math.sqrt(1/u[y]+(x-a[y])**2/f[y]);m.x.push(x),m.y1.push(w-v),m.y2.push(w+v),p.forEach(_=>m[_].push(d[_][y]))})}return{numRows:m.x.length,columns:m}}function SL(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 Yf(e){let t={};for(let n in e)t[SL(n)]=e[n];return t}function UX(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 $I=class{constructor(t,{selection:n,channels:r={}}){this.mark=UX(t),this.selection=n;let i=Object.entries(Yf(r));this.channels=i.length?i:[["opacity",.2]],this.selection.addEventListener("value",Gf(()=>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 PX(o,s);for(let c=0;c<n.length;++c){let l=n[c],u=i[c],f=l.__data__,h=a(Array.isArray(f)?f[0]:f);for(let d=0;d<r.length;++d){let[p,m]=r[d];l.setAttribute(p,h?u[d]:m)}}}};async function PX(e,t){let n=t?.predicate(e);if(!n||n.length===0)return()=>!0;let r=e.filterBy?.predicate(e,!0),i={__:Zr(n)},o=e.query(r);(o.queries||[o]).forEach(c=>{c.groupby().length?c.select(i):c.$select(i)});let s=await e.coordinator.query(o),a=s.getChild?.("__");return s.numRows||s.length?a?c=>a.get(c):c=>s[c].__:()=>!1}function UI(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 ML(){return UI(o2())}function IL(){return UI(r2())}function AL(){return UI(i2())}function oy(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 qo(e,t){let n=e.channelField(t)?.field;return n?.basis||n}function sy(e,t,n=1){return t.invert(n*Math.floor(e/n))}function Vw(){let e=this,t=e.getScreenCTM,n;e.getScreenCTM=()=>e.isConnected?n=t.call(e):n}var ay=class{constructor(t,{channel:n,selection:r,field:i=void 0,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||qo(t,n),this.style=a&&Yf(a),this.brush=n==="y"?AL():IL(),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=>sy(r,this.scale,this.pixelSize)).sort((r,i)=>r-i)),oy(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 gd(i,t,{source:this,clients:this.peers?n.plot.markSet:new Set().add(n),scale:o,pixelSize:r})}init(t,n){let{brush:r,channel:i,style:o}=this;this.scale=t.scale(i);let s=t.scale("x").range,a=t.scale("y").range;r.extent([[ce(s),ce(a)],[Xt(s),Xt(a)]]);let c=this.value?.map(this.scale.apply).sort(Et),l=Pt(t).selectAll('g[aria-label="facet"]');if(n=l.size()?l:Pt(n??t),this.g=n.append("g").attr("class",`interval-${i}`).each(Vw).call(r).call(r.moveSilent,c),o){let u=this.g.selectAll("rect.selection");for(let f in o)u.attr(f,o[f])}t.addEventListener("pointerenter",u=>{u.buttons||this.activate()})}};var PI=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||qo(t,"x"),this.yfield=i||qo(t,"y"),this.style=a&&Yf(a),this.brush=ML(),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=>sy(u,i,r)).sort(Et),a=[c[1],l[1]].map(u=>sy(u,o,r)).sort(Et)}(!oy(s,n?.[0])||!oy(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 wv([i,o],t,{source:this,clients:this.peers?n.plot.markSet:new Set().add(n),scales:[s,a],pixelSize:r})}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)],[Xt(s),Xt(a)]]);let c=Pt(t).selectAll('g[aria-label="facet"]'),l=c.size()?c:Pt(t);if(this.g=l.append("g").attr("class","interval-xy").each(Vw).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(Et),[h,d]=this.value[1].map(o.apply).sort(Et);this.g.call(n.moveSilent,[[u,h],[f,d]])}t.addEventListener("pointerenter",u=>{u.buttons||this.activate()})}};var zI=class{constructor(t,{selection:n,pointer:r,channels:i,fields:o,maxRadius:s=40}){this.mark=t,this.selection=n,this.clients=new Set().add(t),this.pointer=r,this.channels=i||(r==="x"?["x"]:r==="y"?["y"]:["x","y"]),this.fields=o||this.channels.map(a=>qo(t,[a])),this.maxRadius=s,this.valueIndex=-1}clause(t){let{clients:n,fields:r}=this;return yd(r,t&&[t],{source:this,clients:n})}init(t){let n=this,{mark:r,channels:i,selection:o,maxRadius:s}=this,{data:{columns:a}}=r,c=i.map(b=>r.channelField(b).as),l=!pv(o),u=Pt(t).selectAll('g[aria-label="facet"]'),f=u.size()?u:Pt(t),h=t.scale("x").apply,d=t.scale("y").apply,p=Array.from(a[r.channelField("x").as],h),m=Array.from(a[r.channelField("y").as],d),y=this.pointer==="y"?.01:1,g=this.pointer==="x"?.01:1;f.on("pointerenter pointerdown pointermove",function(b){let[x,w]=Fn(b,this),v=zX(p,m,x,w,y,g,s);if(v!==this.valueIndex){this.valueIndex=v;let _=v<0?void 0:c.map(M=>a[M][v]);l?v>-1&&o.update(_.length>1?_:_[0]):o.update(n.clause(_))}}),!l&&(f.on("pointerleave",()=>{o.update(n.clause(void 0))}),t.addEventListener("pointerenter",b=>{if(!b.buttons){let x=this.channels.map(()=>0);o.activate(this.clause(x))}}))}};function zX(e,t,n,r,i,o,s){let a=s*s,c=-1;for(let l=0;l<e.length;++l){let u=i*(e[l]-n),f=o*(t[l]-r),h=u*u+f*f;h<=a&&(a=h,c=l)}return c}var TL=(e,t)=>e-t,VI=class{constructor(t,{x:n=new Ac,y:r=new Ac,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||qo(t,"x"),this.yfield=o||qo(t,"y"),this.zoom=qI(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=qX(t,this.xscale);this.xsel.update(this.clause(n,this.xfield,this.xscale))}if(this.pany){let n=VX(t,this.yscale);this.ysel.update(this.clause(n,this.yfield,this.yscale))}}clause(t,n,r){return gd(n,t,{source:this,clients:this.mark.plot.markSet,scale:r})}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(TL),c=this.yscale.range.slice().sort(TL),l=qI(n,[-1/0,1/0],a),u=qI(r,[-1/0,1/0],c),f=v3().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 Lr(1,0,0)).on("zoom",({transform:h})=>this.publish(h));if(Pt(i).call(f),n||r){let h=!1;i.addEventListener("pointerenter",d=>{if(!h&&(h=!0,!d.buttons)){if(n){let{xscale:p,xfield:m}=this;o.activate(this.clause(p.domain,m,p))}if(r){let{yscale:p,yfield:m}=this;s.activate(this.clause(p.domain,m,p))}}}),i.addEventListener("pointerleave",()=>h=!1)}}};function qI(e,t,n){return e?Array.isArray(e)?e:t:n}function qX(e,t){return t.range.map(e.invertX,e).map(t.invert,t)}function VX(e,t){return t.range.map(e.invertY,e).map(t.invert,t)}var cy=class{constructor(t,{selection:n,channels:r,peers:i=!0}){this.value=null,this.mark=t,this.selection=n,this.peers=i;let o=this.fields=[],s=this.as=[];r.forEach(a=>{let c=a==="color"?["color","fill","stroke"]:a==="x"?["x","x1","x2"]:a==="y"?["y","y1","y2"]:[a];for(let l=0;l<c.length;++l){let u=t.channelField(c[l],{exact:!0});if(u){o.push(u.field?.basis||u.field),s.push(u.as);return}}throw new Error(`Missing channel: ${a}`)})}clause(t){let{fields:n,mark:r}=this;return yd(n,t,{source:this,clients:this.peers?r.plot.markSet:new Set().add(r)})}init(t,n,r){let{mark:i,as:o,selection:s}=this,{data:{columns:a={}}={}}=i;r??=l=>o.map(u=>{let f=l.__data__;return a[u][Array.isArray(f)?f[0]:f]}),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,h=null;if(jX(c,f)){let d=r(f);(l.shiftKey||l.metaKey)&&u?.length?(h=u.filter(p=>jI(p,d)),h.length===u.length&&h.push(d)):u?.length===1&&!jI(u[0],d)?h=null:h=[d]}this.value=h,YX(u,h)&&s.update(this.clause(h))}),t.addEventListener("pointerenter",l=>{l.buttons||this.selection.activate(this.clause([this.fields.map(()=>0)]))})}};function jX(e,t){return e.has(t)||e.has(t.parentNode)||e.has(t.parentNode?.parentNode)}function YX(e,t){return e==null||t==null?e!=null||t!=null:e.length!==t.length||e.some((n,r)=>jI(n,t[r]))}function jI(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 DL=":scope > div, :scope > span",jw="swatch",EL="ramp",YI=class{constructor(t,n){let{as:r,field:i,...o}=n;this.channel=t,this.options={label:null,...o},this.type=null,this.handler=null,this.selection=r,this.field=i,this.legend=null,this.element=document.createElement("div"),this.element.setAttribute("class","legend"),Object.defineProperty(this.element,"value",{value:this})}setPlot(t){this.plot=t}init(t){let n=WX(this,t);return this.element.replaceChildren(n),this.element}update(){if(!this.legend)return;let{selection:t,handler:n}=this,{single:r,value:i}=t,o=r?i:t.valueFor(n),s=o&&o.length?new Set(o.map(c=>c[0])):null,a=this.legend.querySelectorAll(DL);for(let c of a){let l=s?s.has(c.__data__):!0;c.style.opacity=l?1:.2}}};function WX(e,t){let{channel:n,options:r,selection:i}=e,o=t.scale(n),s=o.type==="ordinal"?jw:EL,a=s===jw?r:r.label?{tickSize:2,...r}:{tickSize:2,marginTop:1,height:29,...r},c=t.legend(n,a);e.legend=c;let l=!!i;if(l&&s===EL){let u=a.width??240,f=ZX(o,u);f?c.scale=function(h){return h==="x"?{range:[0,u]}:h==="y"?{range:[-10,0]}:h===n?f:void 0}:l=!1}if(l){let u=GX(e,s);s===jw?(u.init(c,DL,f=>[f.__data__]),e.update()):u.init(c,c.querySelector("g:last-of-type"))}return c}function GX(e,t){let{channel:n,handler:r,selection:i}=e;if(r)return r;let o=XX(e);return t===jw?(e.handler=new cy(o,{selection:i,channels:[n],peers:!1}),i.addEventListener("value",()=>e.update())):e.handler=new ay(o,{selection:i,channel:n,brush:{fill:"none",stroke:"currentColor"},peers:!1}),e.handler}function XX(e){let{channel:t,plot:n}=e,r=e.field??HX(n.marks,t)??"value";if(r){let i={field:r};return{plot:n,channelField:o=>t===o?i:void 0}}}function HX(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)for(let i of n){let o=e[r].channelField(i,{exact:!0});if(o)return o.field}return null}function ZX(e,t){let{apply:n,invert:r,interpolate:i,...o}=e,s=e.type;s.startsWith("diverging-")&&(s=s.slice(11));let a;switch(s){case"log":case"pow":case"sqrt":case"symlog":a=s;break;case"threshold":case"quantize":case"quantile":return console.warn(`Legends do not yet support ${s} scales.`),null;default:a="linear"}return Pa({x:{...o,type:a,range:[0,t]}})}var QX=new Set(["rectY-x","rectX-y","rect-x","rect-y","ruleY-x","ruleX-y"]);function NL(e,t={steps:25}){let n=(r,i)=>QX.has(`${r.type}-${i}`)?{[`${i}1`]:WI(r,i,e,t),[`${i}2`]:WI(r,i,e,{...t,offset:1})}:{[i]:WI(r,i,e,t)};return n[Wf]=!0,n}function WI(e,t,n,r){return{column:n,label:n,get stats(){return{column:n,stats:["min","max"]}},get columns(){return[n]},get basis(){return n},toString(){let{apply:i,sqlApply:o,sqlInvert:s}=Ml(e,t),{min:a,max:c}=e.channelField(t),l=KX(i(a),i(c),r),u=o(n),f=l.min===0?u:`(${u} - ${l.min})`,h=`${(l.max-l.min)/l.steps}::DOUBLE`,d=r.offset?`${r.offset} + `:"",p=`${l.min} + ${h} * (${d}FLOOR(${f} / ${h}))`;return`${s(p)}`}}}function KX(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],h;for(let m=0,y=f.length;m<y;++m)h=u/f[m],h>=i&&s/h<=a&&(u=h);h=Math.log(u);let d=h>=0?0:~~(-h/c)+1,p=Math.pow(10,-d-1);h=Math.floor(e/u+p)*u,e=e<h?h-u:h,t=Math.ceil(t/u)*u,r=Math.round((t-e)/u)}return{min:e,max:t,steps:r}}export{II as ConnectedMark,AI as ContourMark,DI as DenseLineMark,NI as Density1DMark,OI as Density2DMark,BI as ErrorBarMark,Xs as Fixed,LI as GeoMark,$i as Grid2DMark,TI as HeatmapMark,FI as HexbinMark,$I as Highlight,ay as Interval1D,PI as Interval2D,YI as Legend,On as Mark,zI as Nearest,VI as PanZoom,bI as Plot,Vf as RasterMark,CI as RasterTileMark,kI as RegressionMark,cy as Toggle,Wf as Transform,bn as Transient,NL as bin};