@uwdata/vgplot 0.5.0 → 0.6.1

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,30 +1,39 @@
1
- var K9=Object.create;var gw=Object.defineProperty;var J9=Object.getOwnPropertyDescriptor;var tU=Object.getOwnPropertyNames;var eU=Object.getPrototypeOf,nU=Object.prototype.hasOwnProperty;var Z4=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),_r=(e,t)=>{for(var n in t)gw(e,n,{get:t[n],enumerable:!0})},rU=(e,t,n,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of tU(t))!nU.call(e,i)&&i!==n&&gw(e,i,{get:()=>t[i],enumerable:!(r=J9(t,i))||r.enumerable});return e};var iU=(e,t,n)=>(n=e!=null?K9(eU(e)):{},rU(t||!e||!e.__esModule?gw(n,"default",{value:e,enumerable:!0}):n,e));var LP=Z4((F7t,FP)=>{"use strict";function xJ(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 _J(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 wJ(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 vJ(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 SJ(e,t,n,r,i){for(;r<=i;){var o=r+i>>>1,s=e[o],a=n!==void 0?n(s,t):s-t;if(a===0)return o;a<=0?r=o+1:i=o-1}return-1}function ay(e,t,n,r,i,o){return typeof n=="function"?o(e,t,n,r===void 0?0:r|0,i===void 0?e.length-1:i|0):o(e,t,void 0,n===void 0?0:n|0,r===void 0?e.length-1:r|0)}FP.exports={ge:function(e,t,n,r,i){return ay(e,t,n,r,i,xJ)},gt:function(e,t,n,r,i){return ay(e,t,n,r,i,_J)},lt:function(e,t,n,r,i){return ay(e,t,n,r,i,wJ)},le:function(e,t,n,r,i){return ay(e,t,n,r,i,vJ)},eq:function(e,t,n,r,i){return ay(e,t,n,r,i,SJ)}}});var jP=Z4((L7t,qP)=>{"use strict";var tw=LP(),id=0,Ul=1,J_=2;qP.exports=TJ;function EM(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 cy=EM.prototype;function IM(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 PP(e,t){var n=od(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 CP(e,t){var n=e.intervals([]);n.push(t),PP(e,n)}function BP(e,t){var n=e.intervals([]),r=n.indexOf(t);return r<0?id:(n.splice(r,1),PP(e,n),Ul)}cy.intervals=function(e){return e.push.apply(e,this.leftPoints),this.left&&this.left.intervals(e),this.right&&this.right.intervals(e),e};cy.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)?CP(this,e):this.left.insert(e):this.left=od([e]);else if(e[0]>this.mid)this.right?4*(this.right.count+1)>3*(t+1)?CP(this,e):this.right.insert(e):this.right=od([e]);else{var n=tw.ge(this.leftPoints,e,MM),r=tw.ge(this.rightPoints,e,AM);this.leftPoints.splice(n,0,e),this.rightPoints.splice(r,0,e)}};cy.remove=function(e){var t=this.count-this.leftPoints;if(e[1]<this.mid){if(!this.left)return id;var n=this.right?this.right.count:0;if(4*n>3*(t-1))return BP(this,e);var r=this.left.remove(e);return r===J_?(this.left=null,this.count-=1,Ul):(r===Ul&&(this.count-=1),r)}else if(e[0]>this.mid){if(!this.right)return id;var i=this.left?this.left.count:0;if(4*i>3*(t-1))return BP(this,e);var r=this.right.remove(e);return r===J_?(this.right=null,this.count-=1,Ul):(r===Ul&&(this.count-=1),r)}else{if(this.count===1)return this.leftPoints[0]===e?J_:id;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}IM(this,s),this.count=(this.left?this.left.count:0)+(this.right?this.right.count:0)+this.leftPoints.length}else this.left?IM(this,this.left):IM(this,this.right);return Ul}for(var a=tw.ge(this.leftPoints,e,MM);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=tw.ge(this.rightPoints,e,AM);r<this.rightPoints.length&&this.rightPoints[r][1]===e[1];++r)if(this.rightPoints[r]===e)return this.rightPoints.splice(r,1),Ul}return id}};function UP(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 $P(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 zP(e,t){for(var n=0;n<e.length;++n){var r=t(e[n]);if(r)return r}}cy.queryPoint=function(e,t){if(e<this.mid){if(this.left){var n=this.left.queryPoint(e,t);if(n)return n}return UP(this.leftPoints,e,t)}else if(e>this.mid){if(this.right){var n=this.right.queryPoint(e,t);if(n)return n}return $P(this.rightPoints,e,t)}else return zP(this.leftPoints,t)};cy.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?UP(this.leftPoints,t,n):e>this.mid?$P(this.rightPoints,e,n):zP(this.leftPoints,n)};function IJ(e,t){return e-t}function MM(e,t){var n=e[0]-t[0];return n||e[1]-t[1]}function AM(e,t){var n=e[1]-t[1];return n||e[0]-t[0]}function od(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(IJ);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(MM),l.sort(AM),new EM(r,od(i),od(o),c,l)}function TM(e){this.root=e}var sd=TM.prototype;sd.insert=function(e){this.root?this.root.insert(e):this.root=new EM(e[0],null,null,[e],[e])};sd.remove=function(e){if(this.root){var t=this.root.remove(e);return t===J_&&(this.root=null),t!==id}return!1};sd.queryPoint=function(e,t){if(this.root)return this.root.queryPoint(e,t)};sd.queryInterval=function(e,t,n){if(e<=t&&this.root)return this.root.queryInterval(e,t,n)};Object.defineProperty(sd,"count",{get:function(){return this.root?this.root.count:0}});Object.defineProperty(sd,"intervals",{get:function(){return this.root?this.root.intervals([]):[]}});function TJ(e){return!e||e.length===0?new TM(null):new TM(od(e))}});var Q4={};function xd(e,t=!1){let n,r,i=Q4;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=Q4,a(u)}),i=l}return t?c:a}var cr=class{constructor(t){this._filterBy=t,this._requestUpdate=xd(()=>this.requestQuery(),!0),this._coordinator=null}get coordinator(){return this._coordinator}set coordinator(t){this._coordinator=t}get filterBy(){return this._filterBy}get filterIndexable(){return!0}fields(){return null}fieldInfo(){return this}query(){return null}queryPending(){return this}queryResult(){return this}queryError(t){return console.error(t),this}requestQuery(t){let n=t||this.query(this.filterBy?.predicate(this));return this._coordinator.requestQuery(this,n)}requestUpdate(){this._requestUpdate()}update(){return this}};function J4(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 K4(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 Ct(e){return this instanceof Ct?(this.v=e,this):new Ct(e)}function wr(e,t,n){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var r=n.apply(e,t||[]),i,o=[];return i={},s("next"),s("throw"),s("return"),i[Symbol.asyncIterator]=function(){return this},i;function s(d){r[d]&&(i[d]=function(h){return new Promise(function(p,y){o.push([d,h,p,y])>1||a(d,h)})})}function a(d,h){try{c(r[d](h))}catch(p){f(o[0][3],p)}}function c(d){d.value instanceof Ct?Promise.resolve(d.value.v).then(l,u):f(o[0][2],d)}function l(d){a("next",d)}function u(d){a("throw",d)}function f(d,h){d(h),o.shift(),o.length&&a(o[0][0],o[0][1])}}function jl(e){var t,n;return t={},r("next"),r("throw",function(i){throw i}),r("return"),t[Symbol.iterator]=function(){return this},t;function r(i,o){t[i]=e[i]?function(s){return(n=!n)?{value:Ct(e[i](s)),done:!1}:o?o(s):s}:o}}function bi(e){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var t=e[Symbol.asyncIterator],n;return t?t.call(e):(e=typeof K4=="function"?K4(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 Sw={};_r(Sw,{compareArrayLike:()=>vw,joinUint8Arrays:()=>Sr,memcpy:()=>Vl,rebaseValueOffsets:()=>Uy,toArrayBufferView:()=>Pt,toArrayBufferViewAsyncIterator:()=>_i,toArrayBufferViewIterator:()=>Xi,toBigInt64Array:()=>fU,toBigUint64Array:()=>pU,toFloat32Array:()=>mU,toFloat32ArrayAsyncIterator:()=>OU,toFloat32ArrayIterator:()=>SU,toFloat64Array:()=>yU,toFloat64ArrayAsyncIterator:()=>DU,toFloat64ArrayIterator:()=>IU,toInt16Array:()=>uU,toInt16ArrayAsyncIterator:()=>MU,toInt16ArrayIterator:()=>xU,toInt32Array:()=>gc,toInt32ArrayAsyncIterator:()=>AU,toInt32ArrayIterator:()=>_U,toInt8Array:()=>lU,toInt8ArrayAsyncIterator:()=>EU,toInt8ArrayIterator:()=>bU,toUint16Array:()=>dU,toUint16ArrayAsyncIterator:()=>NU,toUint16ArrayIterator:()=>wU,toUint32Array:()=>hU,toUint32ArrayAsyncIterator:()=>RU,toUint32ArrayIterator:()=>vU,toUint8Array:()=>Ot,toUint8ArrayAsyncIterator:()=>ww,toUint8ArrayIterator:()=>_w,toUint8ClampedArray:()=>gU,toUint8ClampedArrayAsyncIterator:()=>kU,toUint8ClampedArrayIterator:()=>TU});var oU=new TextDecoder("utf-8"),_d=e=>oU.decode(e),sU=new TextEncoder,ra=e=>sU.encode(e);var aU=e=>typeof e=="number",tR=e=>typeof e=="boolean",tn=e=>typeof e=="function",jn=e=>e!=null&&Object(e)===e,vr=e=>jn(e)&&tn(e.then);var xi=e=>jn(e)&&tn(e[Symbol.iterator]),Yr=e=>jn(e)&&tn(e[Symbol.asyncIterator]),ky=e=>jn(e)&&jn(e.schema);var Fy=e=>jn(e)&&"done"in e&&"value"in e;var Ly=e=>jn(e)&&tn(e.stat)&&aU(e.fd);var Cy=e=>jn(e)&&wd(e.body),By=e=>"_getDOMStream"in e&&"_getNodeStream"in e,eR=e=>jn(e)&&tn(e.abort)&&tn(e.getWriter)&&!By(e),wd=e=>jn(e)&&tn(e.cancel)&&tn(e.getReader)&&!By(e),nR=e=>jn(e)&&tn(e.end)&&tn(e.write)&&tR(e.writable)&&!By(e),Py=e=>jn(e)&&tn(e.read)&&tn(e.pipe)&&tR(e.readable)&&!By(e),rR=e=>jn(e)&&tn(e.clear)&&tn(e.bytes)&&tn(e.position)&&tn(e.setPosition)&&tn(e.capacity)&&tn(e.getBufferIdentifier)&&tn(e.createLong);var xw=typeof SharedArrayBuffer<"u"?SharedArrayBuffer:ArrayBuffer;function cU(e){let t=e[0]?[e[0]]:[],n,r,i,o;for(let s,a,c=0,l=0,u=e.length;++c<u;){if(s=t[l],a=e[c],!s||!a||s.buffer!==a.buffer||a.byteOffset<s.byteOffset){a&&(t[++l]=a);continue}if({byteOffset:n,byteLength:i}=s,{byteOffset:r,byteLength:o}=a,n+i<r||r+o<n){a&&(t[++l]=a);continue}t[l]=new Uint8Array(s.buffer,n,r-n+o)}return t}function Vl(e,t,n=0,r=t.byteLength){let i=e.byteLength,o=new Uint8Array(e.buffer,e.byteOffset,i),s=new Uint8Array(t.buffer,t.byteOffset,Math.min(r,i));return o.set(s,n),e}function Sr(e,t){let n=cU(e),r=n.reduce((u,f)=>u+f.byteLength,0),i,o,s,a=0,c=-1,l=Math.min(t||Number.POSITIVE_INFINITY,r);for(let u=n.length;++c<u;){if(i=n[c],o=i.subarray(0,Math.min(i.length,l-a)),l<=a+o.length){o.length<i.length?n[c]=i.subarray(o.length):o.length===i.length&&c++,s?Vl(s,o,a):s=o;break}Vl(s||(s=new Uint8Array(l)),o,a),a+=o.length}return[s||new Uint8Array(0),n.slice(c),r-(s?s.byteLength:0)]}function Pt(e,t){let n=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=ra(n)),n instanceof ArrayBuffer?new e(n):n instanceof xw?new e(n):rR(n)?Pt(e,n.bytes()):ArrayBuffer.isView(n)?n.byteLength<=0?new e(0):new e(n.buffer,n.byteOffset,n.byteLength/e.BYTES_PER_ELEMENT):e.from(n)):new e(0)}var lU=e=>Pt(Int8Array,e),uU=e=>Pt(Int16Array,e),gc=e=>Pt(Int32Array,e),fU=e=>Pt(BigInt64Array,e),Ot=e=>Pt(Uint8Array,e),dU=e=>Pt(Uint16Array,e),hU=e=>Pt(Uint32Array,e),pU=e=>Pt(BigUint64Array,e),mU=e=>Pt(Float32Array,e),yU=e=>Pt(Float64Array,e),gU=e=>Pt(Uint8ClampedArray,e),bw=e=>(e.next(),e);function*Xi(e,t){let n=function*(i){yield i},r=typeof t=="string"||ArrayBuffer.isView(t)||t instanceof ArrayBuffer||t instanceof xw?n(t):xi(t)?t:n(t);return yield*bw(function*(i){let o=null;do o=i.next(yield Pt(e,o));while(!o.done)}(r[Symbol.iterator]())),new e}var bU=e=>Xi(Int8Array,e),xU=e=>Xi(Int16Array,e),_U=e=>Xi(Int32Array,e),_w=e=>Xi(Uint8Array,e),wU=e=>Xi(Uint16Array,e),vU=e=>Xi(Uint32Array,e),SU=e=>Xi(Float32Array,e),IU=e=>Xi(Float64Array,e),TU=e=>Xi(Uint8ClampedArray,e);function _i(e,t){return wr(this,arguments,function*(){if(vr(t))return yield Ct(yield Ct(yield*jl(bi(_i(e,yield Ct(t))))));let r=function(s){return wr(this,arguments,function*(){yield yield Ct(yield Ct(s))})},i=function(s){return wr(this,arguments,function*(){yield Ct(yield*jl(bi(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 xw?r(t):xi(t)?i(t):Yr(t)?t:r(t);return yield Ct(yield*jl(bi(bw(function(s){return wr(this,arguments,function*(){let a=null;do a=yield Ct(s.next(yield yield Ct(Pt(e,a))));while(!a.done)})}(o[Symbol.asyncIterator]()))))),yield Ct(new e)})}var EU=e=>_i(Int8Array,e),MU=e=>_i(Int16Array,e),AU=e=>_i(Int32Array,e),ww=e=>_i(Uint8Array,e),NU=e=>_i(Uint16Array,e),RU=e=>_i(Uint32Array,e),OU=e=>_i(Float32Array,e),DU=e=>_i(Float64Array,e),kU=e=>_i(Uint8ClampedArray,e);function Uy(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 vw(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 $y(FU(e))},fromAsyncIterable(e){return $y(LU(e))},fromDOMStream(e){return $y(CU(e))},fromNodeStream(e){return $y(BU(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')}},$y=e=>(e.next(),e);function*FU(e){let t,n=!1,r=[],i,o,s,a=0;function c(){return o==="peek"?Sr(r,s)[0]:([i,r,a]=Sr(r,s),i)}({cmd:o,size:s}=yield null);let l=_w(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 LU(e){return wr(this,arguments,function*(){let n,r=!1,i=[],o,s,a,c=0;function l(){return s==="peek"?Sr(i,a)[0]:([o,i,c]=Sr(i,a),o)}({cmd:s,size:a}=yield yield Ct(null));let u=ww(e)[Symbol.asyncIterator]();try{do if({done:n,value:o}=Number.isNaN(a-c)?yield Ct(u.next()):yield Ct(u.next(a-c)),!n&&o.byteLength>0&&(i.push(o),c+=o.byteLength),n||a<=c)do({cmd:s,size:a}=yield yield Ct(l()));while(a<c);while(!n)}catch(f){(r=!0)&&typeof u.throw=="function"&&(yield Ct(u.throw(f)))}finally{r===!1&&typeof u.return=="function"&&(yield Ct(u.return(new Uint8Array(0))))}return yield Ct(null)})}function CU(e){return wr(this,arguments,function*(){let n=!1,r=!1,i=[],o,s,a,c=0;function l(){return s==="peek"?Sr(i,a)[0]:([o,i,c]=Sr(i,a),o)}({cmd:s,size:a}=yield yield Ct(null));let u=new Tw(e);try{do if({done:n,value:o}=Number.isNaN(a-c)?yield Ct(u.read()):yield Ct(u.read(a-c)),!n&&o.byteLength>0&&(i.push(Ot(o)),c+=o.byteLength),n||a<=c)do({cmd:s,size:a}=yield yield Ct(l()));while(a<c);while(!n)}catch(f){(r=!0)&&(yield Ct(u.cancel(f)))}finally{r===!1?yield Ct(u.cancel()):e.locked&&u.releaseLock()}return yield Ct(null)})}var Tw=class{constructor(t){this.source=t,this.reader=null,this.reader=this.source.getReader(),this.reader.closed.catch(()=>{})}get closed(){return this.reader?this.reader.closed.catch(()=>{}):Promise.resolve()}releaseLock(){this.reader&&this.reader.releaseLock(),this.reader=null}cancel(t){return Z(this,void 0,void 0,function*(){let{reader:n,source:r}=this;n&&(yield n.cancel(t).catch(()=>{})),r&&r.locked&&this.releaseLock()})}read(t){return Z(this,void 0,void 0,function*(){if(t===0)return{done:this.reader==null,value:new Uint8Array(0)};let n=yield this.reader.read();return!n.done&&(n.value=Ot(n)),n})}},Iw=(e,t)=>{let n=i=>r([t,i]),r;return[t,n,new Promise(i=>(r=i)&&e.once(t,n))]};function BU(e){return wr(this,arguments,function*(){let n=[],r="error",i=!1,o=null,s,a,c=0,l=[],u;function f(){return s==="peek"?Sr(l,a)[0]:([u,l,c]=Sr(l,a),u)}if({cmd:s,size:a}=yield yield Ct(null),e.isTTY)return yield yield Ct(new Uint8Array(0)),yield Ct(null);try{n[0]=Iw(e,"end"),n[1]=Iw(e,"error");do{if(n[2]=Iw(e,"readable"),[r,o]=yield Ct(Promise.race(n.map(h=>h[2]))),r==="error")break;if((i=r==="end")||(Number.isFinite(a-c)?(u=Ot(e.read(a-c)),u.byteLength<a-c&&(u=Ot(e.read()))):u=Ot(e.read()),u.byteLength>0&&(l.push(u),c+=u.byteLength)),i||a<=c)do({cmd:s,size:a}=yield yield Ct(f()));while(a<c)}while(!i)}finally{yield Ct(d(n,r==="error"?o:null))}return yield Ct(null);function d(h,p){return u=l=null,new Promise((y,b)=>{for(let[m,g]of h)e.off(m,g);try{let m=e.destroy;m&&m.call(e,p),p=void 0}catch(m){p=m||p}finally{p!=null?b(p):y()}})}})}var Ie;(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"})(Ie||(Ie={}));var me;(function(e){e[e.Sparse=0]="Sparse",e[e.Dense=1]="Dense"})(me||(me={}));var xe;(function(e){e[e.HALF=0]="HALF",e[e.SINGLE=1]="SINGLE",e[e.DOUBLE=2]="DOUBLE"})(xe||(xe={}));var _n;(function(e){e[e.DAY=0]="DAY",e[e.MILLISECOND=1]="MILLISECOND"})(_n||(_n={}));var pt;(function(e){e[e.SECOND=0]="SECOND",e[e.MILLISECOND=1]="MILLISECOND",e[e.MICROSECOND=2]="MICROSECOND",e[e.NANOSECOND=3]="NANOSECOND"})(pt||(pt={}));var Vn;(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"})(Vn||(Vn={}));var Qt;(function(e){e[e.NONE=0]="NONE",e[e.Schema=1]="Schema",e[e.DictionaryBatch=2]="DictionaryBatch",e[e.RecordBatch=3]="RecordBatch",e[e.Tensor=4]="Tensor",e[e.SparseTensor=5]="SparseTensor"})(Qt||(Qt={}));var D;(function(e){e[e.NONE=0]="NONE",e[e.Null=1]="Null",e[e.Int=2]="Int",e[e.Float=3]="Float",e[e.Binary=4]="Binary",e[e.Utf8=5]="Utf8",e[e.Bool=6]="Bool",e[e.Decimal=7]="Decimal",e[e.Date=8]="Date",e[e.Time=9]="Time",e[e.Timestamp=10]="Timestamp",e[e.Interval=11]="Interval",e[e.List=12]="List",e[e.Struct=13]="Struct",e[e.Union=14]="Union",e[e.FixedSizeBinary=15]="FixedSizeBinary",e[e.FixedSizeList=16]="FixedSizeList",e[e.Map=17]="Map",e[e.Duration=18]="Duration",e[e.Dictionary=-1]="Dictionary",e[e.Int8=-2]="Int8",e[e.Int16=-3]="Int16",e[e.Int32=-4]="Int32",e[e.Int64=-5]="Int64",e[e.Uint8=-6]="Uint8",e[e.Uint16=-7]="Uint16",e[e.Uint32=-8]="Uint32",e[e.Uint64=-9]="Uint64",e[e.Float16=-10]="Float16",e[e.Float32=-11]="Float32",e[e.Float64=-12]="Float64",e[e.DateDay=-13]="DateDay",e[e.DateMillisecond=-14]="DateMillisecond",e[e.TimestampSecond=-15]="TimestampSecond",e[e.TimestampMillisecond=-16]="TimestampMillisecond",e[e.TimestampMicrosecond=-17]="TimestampMicrosecond",e[e.TimestampNanosecond=-18]="TimestampNanosecond",e[e.TimeSecond=-19]="TimeSecond",e[e.TimeMillisecond=-20]="TimeMillisecond",e[e.TimeMicrosecond=-21]="TimeMicrosecond",e[e.TimeNanosecond=-22]="TimeNanosecond",e[e.DenseUnion=-23]="DenseUnion",e[e.SparseUnion=-24]="SparseUnion",e[e.IntervalDayTime=-25]="IntervalDayTime",e[e.IntervalYearMonth=-26]="IntervalYearMonth",e[e.DurationSecond=-27]="DurationSecond",e[e.DurationMillisecond=-28]="DurationMillisecond",e[e.DurationMicrosecond=-29]="DurationMicrosecond",e[e.DurationNanosecond=-30]="DurationNanosecond"})(D||(D={}));var Gr;(function(e){e[e.OFFSET=0]="OFFSET",e[e.DATA=1]="DATA",e[e.VALIDITY=2]="VALIDITY",e[e.TYPE=3]="TYPE"})(Gr||(Gr={}));var Vw={};_r(Vw,{clampIndex:()=>A$,clampRange:()=>Td,createElementComparator:()=>sa});var Ew={};_r(Ew,{valueToString:()=>wi});function wi(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=>wi(t))}]`:`[${e}]`:ArrayBuffer.isView(e)?`[${e}]`:JSON.stringify(e,(t,n)=>typeof n=="bigint"?`${n}`:n)}var Aw={};_r(Aw,{BN:()=>Sd,bigNumToBigInt:()=>sR,bigNumToString:()=>Wl,isArrowBigNumSymbol:()=>iR});var iR=Symbol.for("isArrowBigNum");function vi(e,...t){return t.length===0?Object.setPrototypeOf(Pt(this.TypedArray,e),this.constructor.prototype):Object.setPrototypeOf(new this.TypedArray(e,...t),this.constructor.prototype)}vi.prototype[iR]=!0;vi.prototype.toJSON=function(){return`"${Wl(this)}"`};vi.prototype.valueOf=function(){return oR(this)};vi.prototype.toString=function(){return Wl(this)};vi.prototype[Symbol.toPrimitive]=function(e="default"){switch(e){case"number":return oR(this);case"string":return Wl(this);case"default":return sR(this)}return Wl(this)};function Yl(...e){return vi.apply(this,e)}function Gl(...e){return vi.apply(this,e)}function vd(...e){return vi.apply(this,e)}Object.setPrototypeOf(Yl.prototype,Object.create(Int32Array.prototype));Object.setPrototypeOf(Gl.prototype,Object.create(Uint32Array.prototype));Object.setPrototypeOf(vd.prototype,Object.create(Uint32Array.prototype));Object.assign(Yl.prototype,vi.prototype,{constructor:Yl,signed:!0,TypedArray:Int32Array,BigIntArray:BigInt64Array});Object.assign(Gl.prototype,vi.prototype,{constructor:Gl,signed:!1,TypedArray:Uint32Array,BigIntArray:BigUint64Array});Object.assign(vd.prototype,vi.prototype,{constructor:vd,signed:!0,TypedArray:Uint32Array,BigIntArray:BigUint64Array});function oR(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 Wl=e=>{if(e.byteLength===8)return`${new e.BigIntArray(e.buffer,e.byteOffset,1)[0]}`;if(!e.signed)return Mw(e);let t=new Uint16Array(e.buffer,e.byteOffset,e.byteLength/2);if(new Int16Array([t.at(-1)])[0]>=0)return Mw(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`-${Mw(t)}`},sR=e=>e.byteLength===8?new e.BigIntArray(e.buffer,e.byteOffset,1)[0]:Wl(e);function Mw(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 Sd=class e{static new(t,n){switch(n){case!0:return new Yl(t);case!1:return new Gl(t)}switch(t.constructor){case Int8Array:case Int16Array:case Int32Array:case BigInt64Array:return new Yl(t)}return t.byteLength===16?new vd(t):new Gl(t)}static signed(t){return new Yl(t)}static unsigned(t){return new Gl(t)}static decimal(t){return new vd(t)}constructor(t,n){return e.new(t,n)}};function lr(e){if(typeof e=="bigint"&&(e<Number.MIN_SAFE_INTEGER||e>Number.MAX_SAFE_INTEGER))throw new TypeError(`${e} is not safe to convert to a number.`);return Number(e)}var aR,cR,lR,uR,fR,dR,hR,pR,mR,yR,gR,bR,xR,_R,wR,vR,SR,IR,TR,ER,at=class e{static isNull(t){return t?.typeId===D.Null}static isInt(t){return t?.typeId===D.Int}static isFloat(t){return t?.typeId===D.Float}static isBinary(t){return t?.typeId===D.Binary}static isUtf8(t){return t?.typeId===D.Utf8}static isBool(t){return t?.typeId===D.Bool}static isDecimal(t){return t?.typeId===D.Decimal}static isDate(t){return t?.typeId===D.Date}static isTime(t){return t?.typeId===D.Time}static isTimestamp(t){return t?.typeId===D.Timestamp}static isInterval(t){return t?.typeId===D.Interval}static isDuration(t){return t?.typeId===D.Duration}static isList(t){return t?.typeId===D.List}static isStruct(t){return t?.typeId===D.Struct}static isUnion(t){return t?.typeId===D.Union}static isFixedSizeBinary(t){return t?.typeId===D.FixedSizeBinary}static isFixedSizeList(t){return t?.typeId===D.FixedSizeList}static isMap(t){return t?.typeId===D.Map}static isDictionary(t){return t?.typeId===D.Dictionary}static isDenseUnion(t){return e.isUnion(t)&&t.mode===me.Dense}static isSparseUnion(t){return e.isUnion(t)&&t.mode===me.Sparse}get typeId(){return D.NONE}};aR=Symbol.toStringTag;at[aR]=(e=>(e.children=null,e.ArrayType=Array,e[Symbol.toStringTag]="DataType"))(at.prototype);var Yn=class extends at{toString(){return"Null"}get typeId(){return D.Null}};cR=Symbol.toStringTag;Yn[cR]=(e=>e[Symbol.toStringTag]="Null")(Yn.prototype);var Pe=class extends at{constructor(t,n){super(),this.isSigned=t,this.bitWidth=n}get typeId(){return D.Int}get ArrayType(){switch(this.bitWidth){case 8:return this.isSigned?Int8Array:Uint8Array;case 16:return this.isSigned?Int16Array:Uint16Array;case 32:return this.isSigned?Int32Array:Uint32Array;case 64:return this.isSigned?BigInt64Array:BigUint64Array}throw new Error(`Unrecognized ${this[Symbol.toStringTag]} type`)}toString(){return`${this.isSigned?"I":"Ui"}nt${this.bitWidth}`}};lR=Symbol.toStringTag;Pe[lR]=(e=>(e.isSigned=null,e.bitWidth=null,e[Symbol.toStringTag]="Int"))(Pe.prototype);var zy=class extends Pe{constructor(){super(!0,8)}get ArrayType(){return Int8Array}},qy=class extends Pe{constructor(){super(!0,16)}get ArrayType(){return Int16Array}},Hi=class extends Pe{constructor(){super(!0,32)}get ArrayType(){return Int32Array}},jy=class extends Pe{constructor(){super(!0,64)}get ArrayType(){return BigInt64Array}},Vy=class extends Pe{constructor(){super(!1,8)}get ArrayType(){return Uint8Array}},Yy=class extends Pe{constructor(){super(!1,16)}get ArrayType(){return Uint16Array}},Gy=class extends Pe{constructor(){super(!1,32)}get ArrayType(){return Uint32Array}},Wy=class extends Pe{constructor(){super(!1,64)}get ArrayType(){return BigUint64Array}};Object.defineProperty(zy.prototype,"ArrayType",{value:Int8Array});Object.defineProperty(qy.prototype,"ArrayType",{value:Int16Array});Object.defineProperty(Hi.prototype,"ArrayType",{value:Int32Array});Object.defineProperty(jy.prototype,"ArrayType",{value:BigInt64Array});Object.defineProperty(Vy.prototype,"ArrayType",{value:Uint8Array});Object.defineProperty(Yy.prototype,"ArrayType",{value:Uint16Array});Object.defineProperty(Gy.prototype,"ArrayType",{value:Uint32Array});Object.defineProperty(Wy.prototype,"ArrayType",{value:BigUint64Array});var ur=class extends at{constructor(t){super(),this.precision=t}get typeId(){return D.Float}get ArrayType(){switch(this.precision){case xe.HALF:return Uint16Array;case xe.SINGLE:return Float32Array;case xe.DOUBLE:return Float64Array}throw new Error(`Unrecognized ${this[Symbol.toStringTag]} type`)}toString(){return`Float${this.precision<<5||16}`}};uR=Symbol.toStringTag;ur[uR]=(e=>(e.precision=null,e[Symbol.toStringTag]="Float"))(ur.prototype);var Xy=class extends ur{constructor(){super(xe.HALF)}},Hy=class extends ur{constructor(){super(xe.SINGLE)}},Zy=class extends ur{constructor(){super(xe.DOUBLE)}};Object.defineProperty(Xy.prototype,"ArrayType",{value:Uint16Array});Object.defineProperty(Hy.prototype,"ArrayType",{value:Float32Array});Object.defineProperty(Zy.prototype,"ArrayType",{value:Float64Array});var Yo=class extends at{constructor(){super()}get typeId(){return D.Binary}toString(){return"Binary"}};fR=Symbol.toStringTag;Yo[fR]=(e=>(e.ArrayType=Uint8Array,e[Symbol.toStringTag]="Binary"))(Yo.prototype);var Go=class extends at{constructor(){super()}get typeId(){return D.Utf8}toString(){return"Utf8"}};dR=Symbol.toStringTag;Go[dR]=(e=>(e.ArrayType=Uint8Array,e[Symbol.toStringTag]="Utf8"))(Go.prototype);var Wo=class extends at{constructor(){super()}get typeId(){return D.Bool}toString(){return"Bool"}};hR=Symbol.toStringTag;Wo[hR]=(e=>(e.ArrayType=Uint8Array,e[Symbol.toStringTag]="Bool"))(Wo.prototype);var Xo=class extends at{constructor(t,n,r=128){super(),this.scale=t,this.precision=n,this.bitWidth=r}get typeId(){return D.Decimal}toString(){return`Decimal[${this.precision}e${this.scale>0?"+":""}${this.scale}]`}};pR=Symbol.toStringTag;Xo[pR]=(e=>(e.scale=null,e.precision=null,e.ArrayType=Uint32Array,e[Symbol.toStringTag]="Decimal"))(Xo.prototype);var Ho=class extends at{constructor(t){super(),this.unit=t}get typeId(){return D.Date}toString(){return`Date${(this.unit+1)*32}<${_n[this.unit]}>`}};mR=Symbol.toStringTag;Ho[mR]=(e=>(e.unit=null,e.ArrayType=Int32Array,e[Symbol.toStringTag]="Date"))(Ho.prototype);var Si=class extends at{constructor(t,n){super(),this.unit=t,this.bitWidth=n}get typeId(){return D.Time}toString(){return`Time${this.bitWidth}<${pt[this.unit]}>`}get ArrayType(){switch(this.bitWidth){case 32:return Int32Array;case 64:return BigInt64Array}throw new Error(`Unrecognized ${this[Symbol.toStringTag]} type`)}};yR=Symbol.toStringTag;Si[yR]=(e=>(e.unit=null,e.bitWidth=null,e[Symbol.toStringTag]="Time"))(Si.prototype);var Zo=class extends at{constructor(t,n){super(),this.unit=t,this.timezone=n}get typeId(){return D.Timestamp}toString(){return`Timestamp<${pt[this.unit]}${this.timezone?`, ${this.timezone}`:""}>`}};gR=Symbol.toStringTag;Zo[gR]=(e=>(e.unit=null,e.timezone=null,e.ArrayType=Int32Array,e[Symbol.toStringTag]="Timestamp"))(Zo.prototype);var Qo=class extends at{constructor(t){super(),this.unit=t}get typeId(){return D.Interval}toString(){return`Interval<${Vn[this.unit]}>`}};bR=Symbol.toStringTag;Qo[bR]=(e=>(e.unit=null,e.ArrayType=Int32Array,e[Symbol.toStringTag]="Interval"))(Qo.prototype);var Ko=class extends at{constructor(t){super(),this.unit=t}get typeId(){return D.Duration}toString(){return`Duration<${pt[this.unit]}>`}};xR=Symbol.toStringTag;Ko[xR]=(e=>(e.unit=null,e.ArrayType=BigInt64Array,e[Symbol.toStringTag]="Duration"))(Ko.prototype);var Ii=class extends at{constructor(t){super(),this.children=[t]}get typeId(){return D.List}toString(){return`List<${this.valueType}>`}get valueType(){return this.children[0].type}get valueField(){return this.children[0]}get ArrayType(){return this.valueType.ArrayType}};_R=Symbol.toStringTag;Ii[_R]=(e=>(e.children=null,e[Symbol.toStringTag]="List"))(Ii.prototype);var ye=class extends at{constructor(t){super(),this.children=t}get typeId(){return D.Struct}toString(){return`Struct<{${this.children.map(t=>`${t.name}:${t.type}`).join(", ")}}>`}};wR=Symbol.toStringTag;ye[wR]=(e=>(e.children=null,e[Symbol.toStringTag]="Struct"))(ye.prototype);var Ti=class extends at{constructor(t,n,r){super(),this.mode=t,this.children=r,this.typeIds=n=Int32Array.from(n),this.typeIdToChildIndex=n.reduce((i,o,s)=>(i[o]=s)&&i||i,Object.create(null))}get typeId(){return D.Union}toString(){return`${this[Symbol.toStringTag]}<${this.children.map(t=>`${t.type}`).join(" | ")}>`}};vR=Symbol.toStringTag;Ti[vR]=(e=>(e.mode=null,e.typeIds=null,e.children=null,e.typeIdToChildIndex=null,e.ArrayType=Int8Array,e[Symbol.toStringTag]="Union"))(Ti.prototype);var Jo=class extends at{constructor(t){super(),this.byteWidth=t}get typeId(){return D.FixedSizeBinary}toString(){return`FixedSizeBinary[${this.byteWidth}]`}};SR=Symbol.toStringTag;Jo[SR]=(e=>(e.byteWidth=null,e.ArrayType=Uint8Array,e[Symbol.toStringTag]="FixedSizeBinary"))(Jo.prototype);var Ei=class extends at{constructor(t,n){super(),this.listSize=t,this.children=[n]}get typeId(){return D.FixedSizeList}get valueType(){return this.children[0].type}get valueField(){return this.children[0]}get ArrayType(){return this.valueType.ArrayType}toString(){return`FixedSizeList[${this.listSize}]<${this.valueType}>`}};IR=Symbol.toStringTag;Ei[IR]=(e=>(e.children=null,e.listSize=null,e[Symbol.toStringTag]="FixedSizeList"))(Ei.prototype);var Mi=class extends at{constructor(t,n=!1){var r,i,o;if(super(),this.children=[t],this.keysSorted=n,t&&(t.name="entries",!((r=t?.type)===null||r===void 0)&&r.children)){let s=(i=t?.type)===null||i===void 0?void 0:i.children[0];s&&(s.name="key");let a=(o=t?.type)===null||o===void 0?void 0:o.children[1];a&&(a.name="value")}}get typeId(){return D.Map}get keyType(){return this.children[0].type.children[0].type}get valueType(){return this.children[0].type.children[1].type}get childType(){return this.children[0].type}toString(){return`Map<{${this.children[0].type.children.map(t=>`${t.name}:${t.type}`).join(", ")}}>`}};TR=Symbol.toStringTag;Mi[TR]=(e=>(e.children=null,e.keysSorted=null,e[Symbol.toStringTag]="Map_"))(Mi.prototype);var PU=(e=>()=>++e)(-1),Ir=class extends at{constructor(t,n,r,i){super(),this.indices=n,this.dictionary=t,this.isOrdered=i||!1,this.id=r==null?PU():lr(r)}get typeId(){return D.Dictionary}get children(){return this.dictionary.children}get valueType(){return this.dictionary}get ArrayType(){return this.dictionary.ArrayType}toString(){return`Dictionary<${this.indices}, ${this.dictionary}>`}};ER=Symbol.toStringTag;Ir[ER]=(e=>(e.id=null,e.indices=null,e.isOrdered=null,e.dictionary=null,e[Symbol.toStringTag]="Dictionary"))(Ir.prototype);function Tr(e){let t=e;switch(e.typeId){case D.Decimal:return e.bitWidth/32;case D.Timestamp:return 2;case D.Date:return 1+t.unit;case D.Interval:return 1+t.unit;case D.FixedSizeList:return t.listSize;case D.FixedSizeBinary:return t.byteWidth;default:return 1}}var ut=class{visitMany(t,...n){return t.map((r,i)=>this.visit(r,...n.map(o=>o[i])))}visit(...t){return this.getVisitFn(t[0],!1).apply(this,t)}getVisitFn(t,n=!0){return UU(this,t,n)}getVisitFnByTypeId(t,n=!0){return Xl(this,t,n)}visitNull(t,...n){return null}visitBool(t,...n){return null}visitInt(t,...n){return null}visitFloat(t,...n){return null}visitUtf8(t,...n){return null}visitBinary(t,...n){return null}visitFixedSizeBinary(t,...n){return null}visitDate(t,...n){return null}visitTimestamp(t,...n){return null}visitTime(t,...n){return null}visitDecimal(t,...n){return null}visitList(t,...n){return null}visitStruct(t,...n){return null}visitUnion(t,...n){return null}visitDictionary(t,...n){return null}visitInterval(t,...n){return null}visitDuration(t,...n){return null}visitFixedSizeList(t,...n){return null}visitMap(t,...n){return null}};function UU(e,t,n=!0){return typeof t=="number"?Xl(e,t,n):typeof t=="string"&&t in D?Xl(e,D[t],n):t&&t instanceof at?Xl(e,MR(t),n):t?.type&&t.type instanceof at?Xl(e,MR(t.type),n):Xl(e,D.NONE,n)}function Xl(e,t,n=!0){let r=null;switch(t){case D.Null:r=e.visitNull;break;case D.Bool:r=e.visitBool;break;case D.Int:r=e.visitInt;break;case D.Int8:r=e.visitInt8||e.visitInt;break;case D.Int16:r=e.visitInt16||e.visitInt;break;case D.Int32:r=e.visitInt32||e.visitInt;break;case D.Int64:r=e.visitInt64||e.visitInt;break;case D.Uint8:r=e.visitUint8||e.visitInt;break;case D.Uint16:r=e.visitUint16||e.visitInt;break;case D.Uint32:r=e.visitUint32||e.visitInt;break;case D.Uint64:r=e.visitUint64||e.visitInt;break;case D.Float:r=e.visitFloat;break;case D.Float16:r=e.visitFloat16||e.visitFloat;break;case D.Float32:r=e.visitFloat32||e.visitFloat;break;case D.Float64:r=e.visitFloat64||e.visitFloat;break;case D.Utf8:r=e.visitUtf8;break;case D.Binary:r=e.visitBinary;break;case D.FixedSizeBinary:r=e.visitFixedSizeBinary;break;case D.Date:r=e.visitDate;break;case D.DateDay:r=e.visitDateDay||e.visitDate;break;case D.DateMillisecond:r=e.visitDateMillisecond||e.visitDate;break;case D.Timestamp:r=e.visitTimestamp;break;case D.TimestampSecond:r=e.visitTimestampSecond||e.visitTimestamp;break;case D.TimestampMillisecond:r=e.visitTimestampMillisecond||e.visitTimestamp;break;case D.TimestampMicrosecond:r=e.visitTimestampMicrosecond||e.visitTimestamp;break;case D.TimestampNanosecond:r=e.visitTimestampNanosecond||e.visitTimestamp;break;case D.Time:r=e.visitTime;break;case D.TimeSecond:r=e.visitTimeSecond||e.visitTime;break;case D.TimeMillisecond:r=e.visitTimeMillisecond||e.visitTime;break;case D.TimeMicrosecond:r=e.visitTimeMicrosecond||e.visitTime;break;case D.TimeNanosecond:r=e.visitTimeNanosecond||e.visitTime;break;case D.Decimal:r=e.visitDecimal;break;case D.List:r=e.visitList;break;case D.Struct:r=e.visitStruct;break;case D.Union:r=e.visitUnion;break;case D.DenseUnion:r=e.visitDenseUnion||e.visitUnion;break;case D.SparseUnion:r=e.visitSparseUnion||e.visitUnion;break;case D.Dictionary:r=e.visitDictionary;break;case D.Interval:r=e.visitInterval;break;case D.IntervalDayTime:r=e.visitIntervalDayTime||e.visitInterval;break;case D.IntervalYearMonth:r=e.visitIntervalYearMonth||e.visitInterval;break;case D.Duration:r=e.visitDuration;break;case D.DurationSecond:r=e.visitDurationSecond||e.visitDuration;break;case D.DurationMillisecond:r=e.visitDurationMillisecond||e.visitDuration;break;case D.DurationMicrosecond:r=e.visitDurationMicrosecond||e.visitDuration;break;case D.DurationNanosecond:r=e.visitDurationNanosecond||e.visitDuration;break;case D.FixedSizeList:r=e.visitFixedSizeList;break;case D.Map:r=e.visitMap;break}if(typeof r=="function")return r;if(!n)return()=>null;throw new Error(`Unrecognized type '${D[t]}'`)}function MR(e){switch(e.typeId){case D.Null:return D.Null;case D.Int:{let{bitWidth:t,isSigned:n}=e;switch(t){case 8:return n?D.Int8:D.Uint8;case 16:return n?D.Int16:D.Uint16;case 32:return n?D.Int32:D.Uint32;case 64:return n?D.Int64:D.Uint64}return D.Int}case D.Float:switch(e.precision){case xe.HALF:return D.Float16;case xe.SINGLE:return D.Float32;case xe.DOUBLE:return D.Float64}return D.Float;case D.Binary:return D.Binary;case D.Utf8:return D.Utf8;case D.Bool:return D.Bool;case D.Decimal:return D.Decimal;case D.Time:switch(e.unit){case pt.SECOND:return D.TimeSecond;case pt.MILLISECOND:return D.TimeMillisecond;case pt.MICROSECOND:return D.TimeMicrosecond;case pt.NANOSECOND:return D.TimeNanosecond}return D.Time;case D.Timestamp:switch(e.unit){case pt.SECOND:return D.TimestampSecond;case pt.MILLISECOND:return D.TimestampMillisecond;case pt.MICROSECOND:return D.TimestampMicrosecond;case pt.NANOSECOND:return D.TimestampNanosecond}return D.Timestamp;case D.Date:switch(e.unit){case _n.DAY:return D.DateDay;case _n.MILLISECOND:return D.DateMillisecond}return D.Date;case D.Interval:switch(e.unit){case Vn.DAY_TIME:return D.IntervalDayTime;case Vn.YEAR_MONTH:return D.IntervalYearMonth}return D.Interval;case D.Duration:switch(e.unit){case pt.SECOND:return D.DurationSecond;case pt.MILLISECOND:return D.DurationMillisecond;case pt.MICROSECOND:return D.DurationMicrosecond;case pt.NANOSECOND:return D.DurationNanosecond}return D.Duration;case D.Map:return D.Map;case D.List:return D.List;case D.Struct:return D.Struct;case D.Union:switch(e.mode){case me.Dense:return D.DenseUnion;case me.Sparse:return D.SparseUnion}return D.Union;case D.FixedSizeBinary:return D.FixedSizeBinary;case D.FixedSizeList:return D.FixedSizeList;case D.Dictionary:return D.Dictionary}throw new Error(`Unrecognized type '${D[e.typeId]}'`)}ut.prototype.visitInt8=null;ut.prototype.visitInt16=null;ut.prototype.visitInt32=null;ut.prototype.visitInt64=null;ut.prototype.visitUint8=null;ut.prototype.visitUint16=null;ut.prototype.visitUint32=null;ut.prototype.visitUint64=null;ut.prototype.visitFloat16=null;ut.prototype.visitFloat32=null;ut.prototype.visitFloat64=null;ut.prototype.visitDateDay=null;ut.prototype.visitDateMillisecond=null;ut.prototype.visitTimestampSecond=null;ut.prototype.visitTimestampMillisecond=null;ut.prototype.visitTimestampMicrosecond=null;ut.prototype.visitTimestampNanosecond=null;ut.prototype.visitTimeSecond=null;ut.prototype.visitTimeMillisecond=null;ut.prototype.visitTimeMicrosecond=null;ut.prototype.visitTimeNanosecond=null;ut.prototype.visitDenseUnion=null;ut.prototype.visitSparseUnion=null;ut.prototype.visitIntervalDayTime=null;ut.prototype.visitIntervalYearMonth=null;ut.prototype.visitDuration=null;ut.prototype.visitDurationSecond=null;ut.prototype.visitDurationMillisecond=null;ut.prototype.visitDurationMicrosecond=null;ut.prototype.visitDurationNanosecond=null;var Nw={};_r(Nw,{float64ToUint16:()=>Id,uint16ToFloat64:()=>Qy});var AR=new Float64Array(1),Hl=new Uint32Array(AR.buffer);function Qy(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 Id(e){if(e!==e)return 32256;AR[0]=e;let t=(Hl[1]&2147483648)>>16&65535,n=Hl[1]&2146435072,r=0;return n>=1089470464?Hl[0]>0?n=31744:(n=(n&2080374784)>>16,r=(Hl[1]&1048575)>>10):n<=1056964608?(r=1048576+(Hl[1]&1048575),r=1048576+(r<<(n>>20)-998)>>21,n=0):(n=n-1056964608>>10,r=(Hl[1]&1048575)+512>>10),t|n|r&65535}var vt=class extends ut{};function Mt(e){return(t,n,r)=>{if(t.setValid(n,r!=null))return e(t,n,r)}}var $U=(e,t,n)=>{e[t]=Math.trunc(n/864e5)},Rw=(e,t,n)=>{e[t]=Math.trunc(n%4294967296),e[t+1]=Math.trunc(n/4294967296)},zU=(e,t,n)=>{e[t]=Math.trunc(n*1e3%4294967296),e[t+1]=Math.trunc(n*1e3/4294967296)},qU=(e,t,n)=>{e[t]=Math.trunc(n*1e6%4294967296),e[t+1]=Math.trunc(n*1e6/4294967296)},NR=(e,t,n,r)=>{if(n+1<t.length){let{[n]:i,[n+1]:o}=t;e.set(r.subarray(0,o-i),i)}},jU=({offset:e,values:t},n,r)=>{let i=e+n;r?t[i>>3]|=1<<i%8:t[i>>3]&=~(1<<i%8)},ts=({values:e},t,n)=>{e[t]=n},Ow=({values:e},t,n)=>{e[t]=n},RR=({values:e},t,n)=>{e[t]=Id(n)},VU=(e,t,n)=>{switch(e.type.precision){case xe.HALF:return RR(e,t,n);case xe.SINGLE:case xe.DOUBLE:return Ow(e,t,n)}},Ky=({values:e},t,n)=>{$U(e,t,n.valueOf())},Jy=({values:e},t,n)=>{Rw(e,t*2,n.valueOf())},Dw=({stride:e,values:t},n,r)=>{t.set(r.subarray(0,e),e*n)},YU=({values:e,valueOffsets:t},n,r)=>NR(e,t,n,r),GU=({values:e,valueOffsets:t},n,r)=>{NR(e,t,n,ra(r))},kw=(e,t,n)=>{e.type.unit===_n.DAY?Ky(e,t,n):Jy(e,t,n)},tg=({values:e},t,n)=>Rw(e,t*2,n/1e3),eg=({values:e},t,n)=>Rw(e,t*2,n),ng=({values:e},t,n)=>zU(e,t*2,n),rg=({values:e},t,n)=>qU(e,t*2,n),Fw=(e,t,n)=>{switch(e.type.unit){case pt.SECOND:return tg(e,t,n);case pt.MILLISECOND:return eg(e,t,n);case pt.MICROSECOND:return ng(e,t,n);case pt.NANOSECOND:return rg(e,t,n)}},ig=({values:e},t,n)=>{e[t]=n},og=({values:e},t,n)=>{e[t]=n},sg=({values:e},t,n)=>{e[t]=n},ag=({values:e},t,n)=>{e[t]=n},Lw=(e,t,n)=>{switch(e.type.unit){case pt.SECOND:return ig(e,t,n);case pt.MILLISECOND:return og(e,t,n);case pt.MICROSECOND:return sg(e,t,n);case pt.NANOSECOND:return ag(e,t,n)}},Cw=({values:e,stride:t},n,r)=>{e.set(r.subarray(0,t),t*n)},WU=(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))},XU=(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},HU=(e,t)=>(n,r,i,o)=>r&&n(r,e,t[o]),ZU=(e,t)=>(n,r,i,o)=>r&&n(r,e,t.get(o)),QU=(e,t)=>(n,r,i,o)=>r&&n(r,e,t.get(i.name)),KU=(e,t)=>(n,r,i,o)=>r&&n(r,e,t[i.name]),JU=(e,t,n)=>{let r=e.type.children.map(o=>wn.getVisitFn(o.type)),i=n instanceof Map?QU(t,n):n instanceof jt?ZU(t,n):Array.isArray(n)?HU(t,n):KU(t,n);e.type.children.forEach((o,s)=>i(r[s],e.children[s],o,s))},t$=(e,t,n)=>{e.type.mode===me.Dense?OR(e,t,n):DR(e,t,n)},OR=(e,t,n)=>{let r=e.type.typeIdToChildIndex[e.typeIds[t]],i=e.children[r];wn.visit(i,e.valueOffsets[t],n)},DR=(e,t,n)=>{let r=e.type.typeIdToChildIndex[e.typeIds[t]],i=e.children[r];wn.visit(i,t,n)},e$=(e,t,n)=>{var r;(r=e.dictionary)===null||r===void 0||r.set(e.values[t],n)},Bw=(e,t,n)=>{e.type.unit===Vn.DAY_TIME?cg(e,t,n):lg(e,t,n)},cg=({values:e},t,n)=>{e.set(n.subarray(0,2),2*t)},lg=({values:e},t,n)=>{e[t]=n[0]*12+n[1]%12},ug=({values:e},t,n)=>{e[t]=n},fg=({values:e},t,n)=>{e[t]=n},dg=({values:e},t,n)=>{e[t]=n},hg=({values:e},t,n)=>{e[t]=n},Pw=(e,t,n)=>{switch(e.type.unit){case pt.SECOND:return ug(e,t,n);case pt.MILLISECOND:return fg(e,t,n);case pt.MICROSECOND:return dg(e,t,n);case pt.NANOSECOND:return hg(e,t,n)}},n$=(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))};vt.prototype.visitBool=Mt(jU);vt.prototype.visitInt=Mt(ts);vt.prototype.visitInt8=Mt(ts);vt.prototype.visitInt16=Mt(ts);vt.prototype.visitInt32=Mt(ts);vt.prototype.visitInt64=Mt(ts);vt.prototype.visitUint8=Mt(ts);vt.prototype.visitUint16=Mt(ts);vt.prototype.visitUint32=Mt(ts);vt.prototype.visitUint64=Mt(ts);vt.prototype.visitFloat=Mt(VU);vt.prototype.visitFloat16=Mt(RR);vt.prototype.visitFloat32=Mt(Ow);vt.prototype.visitFloat64=Mt(Ow);vt.prototype.visitUtf8=Mt(GU);vt.prototype.visitBinary=Mt(YU);vt.prototype.visitFixedSizeBinary=Mt(Dw);vt.prototype.visitDate=Mt(kw);vt.prototype.visitDateDay=Mt(Ky);vt.prototype.visitDateMillisecond=Mt(Jy);vt.prototype.visitTimestamp=Mt(Fw);vt.prototype.visitTimestampSecond=Mt(tg);vt.prototype.visitTimestampMillisecond=Mt(eg);vt.prototype.visitTimestampMicrosecond=Mt(ng);vt.prototype.visitTimestampNanosecond=Mt(rg);vt.prototype.visitTime=Mt(Lw);vt.prototype.visitTimeSecond=Mt(ig);vt.prototype.visitTimeMillisecond=Mt(og);vt.prototype.visitTimeMicrosecond=Mt(sg);vt.prototype.visitTimeNanosecond=Mt(ag);vt.prototype.visitDecimal=Mt(Cw);vt.prototype.visitList=Mt(WU);vt.prototype.visitStruct=Mt(JU);vt.prototype.visitUnion=Mt(t$);vt.prototype.visitDenseUnion=Mt(OR);vt.prototype.visitSparseUnion=Mt(DR);vt.prototype.visitDictionary=Mt(e$);vt.prototype.visitInterval=Mt(Bw);vt.prototype.visitIntervalDayTime=Mt(cg);vt.prototype.visitIntervalYearMonth=Mt(lg);vt.prototype.visitDuration=Mt(Pw);vt.prototype.visitDurationSecond=Mt(ug);vt.prototype.visitDurationMillisecond=Mt(fg);vt.prototype.visitDurationMicrosecond=Mt(dg);vt.prototype.visitDurationNanosecond=Mt(hg);vt.prototype.visitFixedSizeList=Mt(n$);vt.prototype.visitMap=Mt(XU);var wn=new vt;var Ai=Symbol.for("parent"),Zl=Symbol.for("rowIndex"),ia=class{constructor(t,n){return this[Ai]=t,this[Zl]=n,new Proxy(this,new $w)}toArray(){return Object.values(this.toJSON())}toJSON(){let t=this[Zl],n=this[Ai],r=n.type.children,i={};for(let o=-1,s=r.length;++o<s;)i[r[o].name]=je.visit(n.children[o],t);return i}toString(){return`{${[...this].map(([t,n])=>`${wi(t)}: ${wi(n)}`).join(", ")}}`}[Symbol.for("nodejs.util.inspect.custom")](){return this.toString()}[Symbol.iterator](){return new Uw(this[Ai],this[Zl])}},Uw=class{constructor(t,n){this.childIndex=0,this.children=t.children,this.rowIndex=n,this.childFields=t.type.children,this.numChildren=this.childFields.length}[Symbol.iterator](){return this}next(){let t=this.childIndex;return t<this.numChildren?(this.childIndex=t+1,{done:!1,value:[this.childFields[t].name,je.visit(this.children[t],this.rowIndex)]}):{done:!0,value:null}}};Object.defineProperties(ia.prototype,{[Symbol.toStringTag]:{enumerable:!1,configurable:!1,value:"Row"},[Ai]:{writable:!0,enumerable:!1,configurable:!1,value:null},[Zl]:{writable:!0,enumerable:!1,configurable:!1,value:-1}});var $w=class{isExtensible(){return!1}deleteProperty(){return!1}preventExtensions(){return!0}ownKeys(t){return t[Ai].type.children.map(n=>n.name)}has(t,n){return t[Ai].type.children.findIndex(r=>r.name===n)!==-1}getOwnPropertyDescriptor(t,n){if(t[Ai].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[Ai].type.children.findIndex(i=>i.name===n);if(r!==-1){let i=je.visit(t[Ai].children[r],t[Zl]);return Reflect.set(t,n,i),i}}set(t,n,r){let i=t[Ai].type.children.findIndex(o=>o.name===n);return i!==-1?(wn.visit(t[Ai].children[i],t[Zl],r),Reflect.set(t,n,r)):Reflect.has(t,n)||typeof n=="symbol"?Reflect.set(t,n,r):!1}};var gt=class extends ut{};function Tt(e){return(t,n)=>t.getValid(n)?e(t,n):null}var r$=(e,t)=>864e5*e[t],zw=(e,t)=>4294967296*e[t+1]+(e[t]>>>0),i$=(e,t)=>4294967296*(e[t+1]/1e3)+(e[t]>>>0)/1e3,o$=(e,t)=>4294967296*(e[t+1]/1e6)+(e[t]>>>0)/1e6,kR=e=>new Date(e),s$=(e,t)=>kR(r$(e,t)),a$=(e,t)=>kR(zw(e,t)),c$=(e,t)=>null,FR=(e,t,n)=>{if(n+1>=t.length)return null;let r=t[n],i=t[n+1];return e.subarray(r,i)},l$=({offset:e,values:t},n)=>{let r=e+n;return(t[r>>3]&1<<r%8)!==0},LR=({values:e},t)=>s$(e,t),CR=({values:e},t)=>a$(e,t*2),oa=({stride:e,values:t},n)=>t[e*n],u$=({stride:e,values:t},n)=>Qy(t[e*n]),BR=({values:e},t)=>e[t],f$=({stride:e,values:t},n)=>t.subarray(e*n,e*(n+1)),d$=({values:e,valueOffsets:t},n)=>FR(e,t,n),h$=({values:e,valueOffsets:t},n)=>{let r=FR(e,t,n);return r!==null?_d(r):null},p$=({values:e},t)=>e[t],m$=({type:e,values:t},n)=>e.precision!==xe.HALF?t[n]:Qy(t[n]),y$=(e,t)=>e.type.unit===_n.DAY?LR(e,t):CR(e,t),PR=({values:e},t)=>1e3*zw(e,t*2),UR=({values:e},t)=>zw(e,t*2),$R=({values:e},t)=>i$(e,t*2),zR=({values:e},t)=>o$(e,t*2),g$=(e,t)=>{switch(e.type.unit){case pt.SECOND:return PR(e,t);case pt.MILLISECOND:return UR(e,t);case pt.MICROSECOND:return $R(e,t);case pt.NANOSECOND:return zR(e,t)}},qR=({values:e},t)=>e[t],jR=({values:e},t)=>e[t],VR=({values:e},t)=>e[t],YR=({values:e},t)=>e[t],b$=(e,t)=>{switch(e.type.unit){case pt.SECOND:return qR(e,t);case pt.MILLISECOND:return jR(e,t);case pt.MICROSECOND:return VR(e,t);case pt.NANOSECOND:return YR(e,t)}},x$=({values:e,stride:t},n)=>Sd.decimal(e.subarray(t*n,t*(n+1))),_$=(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 jt([c])},w$=(e,t)=>{let{valueOffsets:n,children:r}=e,{[t]:i,[t+1]:o}=n,s=r[0];return new Zi(s.slice(i,o-i))},v$=(e,t)=>new ia(e,t),S$=(e,t)=>e.type.mode===me.Dense?GR(e,t):WR(e,t),GR=(e,t)=>{let n=e.type.typeIdToChildIndex[e.typeIds[t]],r=e.children[n];return je.visit(r,e.valueOffsets[t])},WR=(e,t)=>{let n=e.type.typeIdToChildIndex[e.typeIds[t]],r=e.children[n];return je.visit(r,t)},I$=(e,t)=>{var n;return(n=e.dictionary)===null||n===void 0?void 0:n.get(e.values[t])},T$=(e,t)=>e.type.unit===Vn.DAY_TIME?XR(e,t):HR(e,t),XR=({values:e},t)=>e.subarray(2*t,2*(t+1)),HR=({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},ZR=({values:e},t)=>e[t],QR=({values:e},t)=>e[t],KR=({values:e},t)=>e[t],JR=({values:e},t)=>e[t],E$=(e,t)=>{switch(e.type.unit){case pt.SECOND:return ZR(e,t);case pt.MILLISECOND:return QR(e,t);case pt.MICROSECOND:return KR(e,t);case pt.NANOSECOND:return JR(e,t)}},M$=(e,t)=>{let{stride:n,children:r}=e,o=r[0].slice(t*n,n);return new jt([o])};gt.prototype.visitNull=Tt(c$);gt.prototype.visitBool=Tt(l$);gt.prototype.visitInt=Tt(p$);gt.prototype.visitInt8=Tt(oa);gt.prototype.visitInt16=Tt(oa);gt.prototype.visitInt32=Tt(oa);gt.prototype.visitInt64=Tt(BR);gt.prototype.visitUint8=Tt(oa);gt.prototype.visitUint16=Tt(oa);gt.prototype.visitUint32=Tt(oa);gt.prototype.visitUint64=Tt(BR);gt.prototype.visitFloat=Tt(m$);gt.prototype.visitFloat16=Tt(u$);gt.prototype.visitFloat32=Tt(oa);gt.prototype.visitFloat64=Tt(oa);gt.prototype.visitUtf8=Tt(h$);gt.prototype.visitBinary=Tt(d$);gt.prototype.visitFixedSizeBinary=Tt(f$);gt.prototype.visitDate=Tt(y$);gt.prototype.visitDateDay=Tt(LR);gt.prototype.visitDateMillisecond=Tt(CR);gt.prototype.visitTimestamp=Tt(g$);gt.prototype.visitTimestampSecond=Tt(PR);gt.prototype.visitTimestampMillisecond=Tt(UR);gt.prototype.visitTimestampMicrosecond=Tt($R);gt.prototype.visitTimestampNanosecond=Tt(zR);gt.prototype.visitTime=Tt(b$);gt.prototype.visitTimeSecond=Tt(qR);gt.prototype.visitTimeMillisecond=Tt(jR);gt.prototype.visitTimeMicrosecond=Tt(VR);gt.prototype.visitTimeNanosecond=Tt(YR);gt.prototype.visitDecimal=Tt(x$);gt.prototype.visitList=Tt(_$);gt.prototype.visitStruct=Tt(v$);gt.prototype.visitUnion=Tt(S$);gt.prototype.visitDenseUnion=Tt(GR);gt.prototype.visitSparseUnion=Tt(WR);gt.prototype.visitDictionary=Tt(I$);gt.prototype.visitInterval=Tt(T$);gt.prototype.visitIntervalDayTime=Tt(XR);gt.prototype.visitIntervalYearMonth=Tt(HR);gt.prototype.visitDuration=Tt(E$);gt.prototype.visitDurationSecond=Tt(ZR);gt.prototype.visitDurationMillisecond=Tt(QR);gt.prototype.visitDurationMicrosecond=Tt(KR);gt.prototype.visitDurationNanosecond=Tt(JR);gt.prototype.visitFixedSizeList=Tt(M$);gt.prototype.visitMap=Tt(w$);var je=new gt;var Wr=Symbol.for("keys"),Ql=Symbol.for("vals"),Zi=class{constructor(t){return this[Wr]=new jt([t.children[0]]).memoize(),this[Ql]=t.children[1],new Proxy(this,new jw)}[Symbol.iterator](){return new qw(this[Wr],this[Ql])}get size(){return this[Wr].length}toArray(){return Object.values(this.toJSON())}toJSON(){let t=this[Wr],n=this[Ql],r={};for(let i=-1,o=t.length;++i<o;)r[t.get(i)]=je.visit(n,i);return r}toString(){return`{${[...this].map(([t,n])=>`${wi(t)}: ${wi(n)}`).join(", ")}}`}[Symbol.for("nodejs.util.inspect.custom")](){return this.toString()}},qw=class{constructor(t,n){this.keys=t,this.vals=n,this.keyIndex=0,this.numKeys=t.length}[Symbol.iterator](){return this}next(){let t=this.keyIndex;return t===this.numKeys?{done:!0,value:null}:(this.keyIndex++,{done:!1,value:[this.keys.get(t),je.visit(this.vals,t)]})}},jw=class{isExtensible(){return!1}deleteProperty(){return!1}preventExtensions(){return!0}ownKeys(t){return t[Wr].toArray().map(String)}has(t,n){return t[Wr].includes(n)}getOwnPropertyDescriptor(t,n){if(t[Wr].indexOf(n)!==-1)return{writable:!0,enumerable:!0,configurable:!0}}get(t,n){if(Reflect.has(t,n))return t[n];let r=t[Wr].indexOf(n);if(r!==-1){let i=je.visit(Reflect.get(t,Ql),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,Ql),i,r),Reflect.set(t,n,r)):Reflect.has(t,n)?Reflect.set(t,n,r):!1}};Object.defineProperties(Zi.prototype,{[Symbol.toStringTag]:{enumerable:!1,configurable:!1,value:"Row"},[Wr]:{writable:!0,enumerable:!1,configurable:!1,value:null},[Ql]:{writable:!0,enumerable:!1,configurable:!1,value:null}});function A$(e,t,n){let r=e.length,i=t>-1?t:r+t%r;return n?n(e,i):i}var tO;function Td(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&&(tO=o,o=s,s=tO),s>i&&(s=i),r?r(e,o,s):[o,s]}var eO=e=>e!==e;function sa(e){if(typeof e!=="object"||e===null)return eO(e)?eO: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?vw(e,n):!1:e instanceof Map?R$(e):Array.isArray(e)?N$(e):e instanceof jt?O$(e):D$(e,!0)}function N$(e){let t=[];for(let n=-1,r=e.length;++n<r;)t[n]=sa(e[n]);return pg(t)}function R$(e){let t=-1,n=[];for(let r of e.values())n[++t]=sa(r);return pg(n)}function O$(e){let t=[];for(let n=-1,r=e.length;++n<r;)t[n]=sa(e.get(n));return pg(t)}function D$(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]=sa(e[n[i]]);return pg(r,n)}function pg(e,t){return n=>{if(!n||typeof n!="object")return!1;switch(n.constructor){case Array:return k$(e,n);case Map:return nO(e,n,n.keys());case Zi:case ia:case Object:case void 0:return nO(e,n,t||Object.keys(n))}return n instanceof jt?F$(e,n):!1}}function k$(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 F$(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 nO(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 Yw={};_r(Yw,{BitIterator:()=>bc,getBit:()=>rO,getBool:()=>yg,packBools:()=>_c,popcnt_array:()=>iO,popcnt_bit_range:()=>Ed,popcnt_uint32:()=>mg,setBool:()=>L$,truncateBitmap:()=>xc});function yg(e,t,n,r){return(n&1<<r)!==0}function rO(e,t,n,r){return(n&1<<r)>>r}function L$(e,t,n){return n?!!(e[t>>3]|=1<<t%8)||!0:!(e[t>>3]&=~(1<<t%8))&&!1}function xc(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):_c(new bc(n,e,t,null,yg)).subarray(0,r)),i}return n}function _c(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 bc=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 Ed(e,t,n){if(n-t<=0)return 0;if(n-t<8){let o=0;for(let s of new bc(e,t,n-t,e,rO))o+=s;return o}let r=n>>3<<3,i=t+(t%8===0?0:8-t%8);return Ed(e,t,i)+Ed(e,r,n)+iO(e,i>>3,r-i>>3)}function iO(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+=mg(o.getUint32(i)),i+=4;for(;s-i>=2;)r+=mg(o.getUint16(i)),i+=2;for(;s-i>=1;)r+=mg(o.getUint8(i)),i+=1;return r}function mg(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 C$=-1,se=class e{get typeId(){return this.type.typeId}get ArrayType(){return this.type.ArrayType}get buffers(){return[this.valueOffsets,this.values,this.nullBitmap,this.typeIds]}get nullable(){if(this._nullCount!==0){let{type:t}=this;return at.isSparseUnion(t)?this.children.some(n=>n.nullable):at.isDenseUnion(t)?this.children.some(n=>n.nullable):this.nullBitmap&&this.nullBitmap.byteLength>0}return!0}get byteLength(){let t=0,{valueOffsets:n,values:r,nullBitmap:i,typeIds:o}=this;return n&&(t+=n.byteLength),r&&(t+=r.byteLength),i&&(t+=i.byteLength),o&&(t+=o.byteLength),this.children.reduce((s,a)=>s+a.byteLength,t)}get nullCount(){if(at.isUnion(this.type))return this.children.reduce((r,i)=>r+i.nullCount,0);let t=this._nullCount,n;return t<=C$&&(n=this.nullBitmap)&&(this._nullCount=t=this.length-Ed(n,this.offset,this.offset+this.length)),t}constructor(t,n,r,i,o,s=[],a){this.type=t,this.children=s,this.dictionary=a,this.offset=Math.floor(Math.max(n||0,0)),this.length=Math.floor(Math.max(r||0,0)),this._nullCount=Math.floor(Math.max(i||0,-1));let c;o instanceof e?(this.stride=o.stride,this.values=o.values,this.typeIds=o.typeIds,this.nullBitmap=o.nullBitmap,this.valueOffsets=o.valueOffsets):(this.stride=Tr(t),o&&((c=o[0])&&(this.valueOffsets=c),(c=o[1])&&(this.values=c),(c=o[2])&&(this.nullBitmap=c),(c=o[3])&&(this.typeIds=c)))}getValid(t){let{type:n}=this;if(at.isUnion(n)){let r=n,i=this.children[r.typeIdToChildIndex[this.typeIds[t]]],o=r.mode===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(at.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(xc(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===D.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(xc(this.offset,n,this.nullBitmap),0);let o=this.buffers;return o[Gr.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[Gr.TYPE])&&(s[Gr.TYPE]=o.subarray(t,t+n)),(o=s[Gr.OFFSET])&&(s[Gr.OFFSET]=o.subarray(t,t+n+1))||(o=s[Gr.DATA])&&(s[Gr.DATA]=i===6?o:o.subarray(r*t,r*(t+n))),s}_sliceChildren(t,n,r){return t.map(i=>i.slice(n,r))}};se.prototype.children=Object.freeze([]);var Gw=class e extends ut{visit(t){return this.getVisitFn(t.type).call(this,t)}visitNull(t){let{["type"]:n,["offset"]:r=0,["length"]:i=0}=t;return new se(n,r,i,i)}visitBool(t){let{["type"]:n,["offset"]:r=0}=t,i=Ot(t.nullBitmap),o=Pt(n.ArrayType,t.data),{["length"]:s=o.length>>3,["nullCount"]:a=t.nullBitmap?-1:0}=t;return new se(n,r,s,a,[void 0,o,i])}visitInt(t){let{["type"]:n,["offset"]:r=0}=t,i=Ot(t.nullBitmap),o=Pt(n.ArrayType,t.data),{["length"]:s=o.length,["nullCount"]:a=t.nullBitmap?-1:0}=t;return new se(n,r,s,a,[void 0,o,i])}visitFloat(t){let{["type"]:n,["offset"]:r=0}=t,i=Ot(t.nullBitmap),o=Pt(n.ArrayType,t.data),{["length"]:s=o.length,["nullCount"]:a=t.nullBitmap?-1:0}=t;return new se(n,r,s,a,[void 0,o,i])}visitUtf8(t){let{["type"]:n,["offset"]:r=0}=t,i=Ot(t.data),o=Ot(t.nullBitmap),s=gc(t.valueOffsets),{["length"]:a=s.length-1,["nullCount"]:c=t.nullBitmap?-1:0}=t;return new se(n,r,a,c,[s,i,o])}visitBinary(t){let{["type"]:n,["offset"]:r=0}=t,i=Ot(t.data),o=Ot(t.nullBitmap),s=gc(t.valueOffsets),{["length"]:a=s.length-1,["nullCount"]:c=t.nullBitmap?-1:0}=t;return new se(n,r,a,c,[s,i,o])}visitFixedSizeBinary(t){let{["type"]:n,["offset"]:r=0}=t,i=Ot(t.nullBitmap),o=Pt(n.ArrayType,t.data),{["length"]:s=o.length/Tr(n),["nullCount"]:a=t.nullBitmap?-1:0}=t;return new se(n,r,s,a,[void 0,o,i])}visitDate(t){let{["type"]:n,["offset"]:r=0}=t,i=Ot(t.nullBitmap),o=Pt(n.ArrayType,t.data),{["length"]:s=o.length/Tr(n),["nullCount"]:a=t.nullBitmap?-1:0}=t;return new se(n,r,s,a,[void 0,o,i])}visitTimestamp(t){let{["type"]:n,["offset"]:r=0}=t,i=Ot(t.nullBitmap),o=Pt(n.ArrayType,t.data),{["length"]:s=o.length/Tr(n),["nullCount"]:a=t.nullBitmap?-1:0}=t;return new se(n,r,s,a,[void 0,o,i])}visitTime(t){let{["type"]:n,["offset"]:r=0}=t,i=Ot(t.nullBitmap),o=Pt(n.ArrayType,t.data),{["length"]:s=o.length/Tr(n),["nullCount"]:a=t.nullBitmap?-1:0}=t;return new se(n,r,s,a,[void 0,o,i])}visitDecimal(t){let{["type"]:n,["offset"]:r=0}=t,i=Ot(t.nullBitmap),o=Pt(n.ArrayType,t.data),{["length"]:s=o.length/Tr(n),["nullCount"]:a=t.nullBitmap?-1:0}=t;return new se(n,r,s,a,[void 0,o,i])}visitList(t){let{["type"]:n,["offset"]:r=0,["child"]:i}=t,o=Ot(t.nullBitmap),s=gc(t.valueOffsets),{["length"]:a=s.length-1,["nullCount"]:c=t.nullBitmap?-1:0}=t;return new se(n,r,a,c,[s,void 0,o],[i])}visitStruct(t){let{["type"]:n,["offset"]:r=0,["children"]:i=[]}=t,o=Ot(t.nullBitmap),{length:s=i.reduce((c,{length:l})=>Math.max(c,l),0),nullCount:a=t.nullBitmap?-1:0}=t;return new se(n,r,s,a,[void 0,void 0,o],i)}visitUnion(t){let{["type"]:n,["offset"]:r=0,["children"]:i=[]}=t,o=Pt(n.ArrayType,t.typeIds),{["length"]:s=o.length,["nullCount"]:a=-1}=t;if(at.isSparseUnion(n))return new se(n,r,s,a,[void 0,void 0,void 0,o],i);let c=gc(t.valueOffsets);return new se(n,r,s,a,[c,void 0,void 0,o],i)}visitDictionary(t){let{["type"]:n,["offset"]:r=0}=t,i=Ot(t.nullBitmap),o=Pt(n.indices.ArrayType,t.data),{["dictionary"]:s=new jt([new e().visit({type:n.dictionary})])}=t,{["length"]:a=o.length,["nullCount"]:c=t.nullBitmap?-1:0}=t;return new se(n,r,a,c,[void 0,o,i],[],s)}visitInterval(t){let{["type"]:n,["offset"]:r=0}=t,i=Ot(t.nullBitmap),o=Pt(n.ArrayType,t.data),{["length"]:s=o.length/Tr(n),["nullCount"]:a=t.nullBitmap?-1:0}=t;return new se(n,r,s,a,[void 0,o,i])}visitDuration(t){let{["type"]:n,["offset"]:r=0}=t,i=Ot(t.nullBitmap),o=Pt(n.ArrayType,t.data),{["length"]:s=o.length,["nullCount"]:a=t.nullBitmap?-1:0}=t;return new se(n,r,s,a,[void 0,o,i])}visitFixedSizeList(t){let{["type"]:n,["offset"]:r=0,["child"]:i=new e().visit({type:n.valueType})}=t,o=Ot(t.nullBitmap),{["length"]:s=i.length/Tr(n),["nullCount"]:a=t.nullBitmap?-1:0}=t;return new se(n,r,s,a,[void 0,void 0,o],[i])}visitMap(t){let{["type"]:n,["offset"]:r=0,["child"]:i=new e().visit({type:n.childType})}=t,o=Ot(t.nullBitmap),s=gc(t.valueOffsets),{["length"]:a=s.length-1,["nullCount"]:c=t.nullBitmap?-1:0}=t;return new se(n,r,a,c,[s,void 0,o],[i])}},B$=new Gw;function Dt(e){return B$.visit(e)}var Md=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 gg(e){return e.reduce((t,n)=>t+n.nullCount,0)}function bg(e){return e.reduce((t,n,r)=>(t[r+1]=t[r]+n.length,t),new Uint32Array(e.length+1))}function xg(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 Ww(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 Ad(e,t){return e.getValid(t)}function aa(e){function t(n,r,i){return e(n[r],i)}return function(n){let r=this.data;return Ww(r,this._offsets,n,t)}}function _g(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=Ww(o,this._offsets,r,n);return t=void 0,s}}function wg(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):Ww(o,this._offsets,i,n);return t=void 0,s}}var bt=class extends ut{};function P$(e,t){return t===null&&e.length>0?0:-1}function U$(e,t){let{nullBitmap:n}=e;if(!n||e.nullCount<=0)return-1;let r=0;for(let i of new bc(n,e.offset+(t||0),e.length,n,yg)){if(!i)return r;++r}return-1}function kt(e,t,n){if(t===void 0)return-1;if(t===null)switch(e.typeId){case D.Union:break;case D.Dictionary:break;default:return U$(e,n)}let r=je.getVisitFn(e),i=sa(t);for(let o=(n||0)-1,s=e.length;++o<s;)if(i(r(e,o)))return o;return-1}function oO(e,t,n){let r=je.getVisitFn(e),i=sa(t);for(let o=(n||0)-1,s=e.length;++o<s;)if(i(r(e,o)))return o;return-1}bt.prototype.visitNull=P$;bt.prototype.visitBool=kt;bt.prototype.visitInt=kt;bt.prototype.visitInt8=kt;bt.prototype.visitInt16=kt;bt.prototype.visitInt32=kt;bt.prototype.visitInt64=kt;bt.prototype.visitUint8=kt;bt.prototype.visitUint16=kt;bt.prototype.visitUint32=kt;bt.prototype.visitUint64=kt;bt.prototype.visitFloat=kt;bt.prototype.visitFloat16=kt;bt.prototype.visitFloat32=kt;bt.prototype.visitFloat64=kt;bt.prototype.visitUtf8=kt;bt.prototype.visitBinary=kt;bt.prototype.visitFixedSizeBinary=kt;bt.prototype.visitDate=kt;bt.prototype.visitDateDay=kt;bt.prototype.visitDateMillisecond=kt;bt.prototype.visitTimestamp=kt;bt.prototype.visitTimestampSecond=kt;bt.prototype.visitTimestampMillisecond=kt;bt.prototype.visitTimestampMicrosecond=kt;bt.prototype.visitTimestampNanosecond=kt;bt.prototype.visitTime=kt;bt.prototype.visitTimeSecond=kt;bt.prototype.visitTimeMillisecond=kt;bt.prototype.visitTimeMicrosecond=kt;bt.prototype.visitTimeNanosecond=kt;bt.prototype.visitDecimal=kt;bt.prototype.visitList=kt;bt.prototype.visitStruct=kt;bt.prototype.visitUnion=kt;bt.prototype.visitDenseUnion=oO;bt.prototype.visitSparseUnion=oO;bt.prototype.visitDictionary=kt;bt.prototype.visitInterval=kt;bt.prototype.visitIntervalDayTime=kt;bt.prototype.visitIntervalYearMonth=kt;bt.prototype.visitDuration=kt;bt.prototype.visitDurationSecond=kt;bt.prototype.visitDurationMillisecond=kt;bt.prototype.visitDurationMicrosecond=kt;bt.prototype.visitDurationNanosecond=kt;bt.prototype.visitFixedSizeList=kt;bt.prototype.visitMap=kt;var wc=new bt;var xt=class extends ut{};function Et(e){let{type:t}=e;if(e.nullCount===0&&e.stride===1&&(t.typeId===D.Timestamp||t instanceof Pe&&t.bitWidth!==64||t instanceof Si&&t.bitWidth!==64||t instanceof ur&&t.precision!==xe.HALF))return new Md(e.data.length,r=>{let i=e.data[r];return i.values.subarray(0,i.length)[Symbol.iterator]()});let n=0;return new Md(e.data.length,r=>{let o=e.data[r].length,s=e.slice(n,n+o);return n+=o,new Xw(s)})}var Xw=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}};xt.prototype.visitNull=Et;xt.prototype.visitBool=Et;xt.prototype.visitInt=Et;xt.prototype.visitInt8=Et;xt.prototype.visitInt16=Et;xt.prototype.visitInt32=Et;xt.prototype.visitInt64=Et;xt.prototype.visitUint8=Et;xt.prototype.visitUint16=Et;xt.prototype.visitUint32=Et;xt.prototype.visitUint64=Et;xt.prototype.visitFloat=Et;xt.prototype.visitFloat16=Et;xt.prototype.visitFloat32=Et;xt.prototype.visitFloat64=Et;xt.prototype.visitUtf8=Et;xt.prototype.visitBinary=Et;xt.prototype.visitFixedSizeBinary=Et;xt.prototype.visitDate=Et;xt.prototype.visitDateDay=Et;xt.prototype.visitDateMillisecond=Et;xt.prototype.visitTimestamp=Et;xt.prototype.visitTimestampSecond=Et;xt.prototype.visitTimestampMillisecond=Et;xt.prototype.visitTimestampMicrosecond=Et;xt.prototype.visitTimestampNanosecond=Et;xt.prototype.visitTime=Et;xt.prototype.visitTimeSecond=Et;xt.prototype.visitTimeMillisecond=Et;xt.prototype.visitTimeMicrosecond=Et;xt.prototype.visitTimeNanosecond=Et;xt.prototype.visitDecimal=Et;xt.prototype.visitList=Et;xt.prototype.visitStruct=Et;xt.prototype.visitUnion=Et;xt.prototype.visitDenseUnion=Et;xt.prototype.visitSparseUnion=Et;xt.prototype.visitDictionary=Et;xt.prototype.visitInterval=Et;xt.prototype.visitIntervalDayTime=Et;xt.prototype.visitIntervalYearMonth=Et;xt.prototype.visitDuration=Et;xt.prototype.visitDurationSecond=Et;xt.prototype.visitDurationMillisecond=Et;xt.prototype.visitDurationMicrosecond=Et;xt.prototype.visitDurationNanosecond=Et;xt.prototype.visitFixedSizeList=Et;xt.prototype.visitMap=Et;var Kl=new xt;var $$=(e,t)=>e+t,Qi=class extends ut{visitNull(t,n){return 0}visitInt(t,n){return t.type.bitWidth/8}visitFloat(t,n){return t.type.ArrayType.BYTES_PER_ELEMENT}visitBool(t,n){return 1/8}visitDecimal(t,n){return t.type.bitWidth/8}visitDate(t,n){return(t.type.unit+1)*4}visitTime(t,n){return t.type.bitWidth/8}visitTimestamp(t,n){return t.type.unit===pt.SECOND?4:8}visitInterval(t,n){return(t.type.unit+1)*4}visitDuration(t,n){return 8}visitStruct(t,n){return t.children.reduce((r,i)=>r+Er.visit(i,n),0)}visitFixedSizeBinary(t,n){return t.type.byteWidth}visitMap(t,n){return 8+t.children.reduce((r,i)=>r+Er.visit(i,n),0)}visitDictionary(t,n){var r;return t.type.indices.bitWidth/8+(((r=t.dictionary)===null||r===void 0?void 0:r.getByteLength(t.values[n]))||0)}},z$=({valueOffsets:e},t)=>8+(e[t+1]-e[t]),q$=({valueOffsets:e},t)=>8+(e[t+1]-e[t]),j$=({valueOffsets:e,stride:t,children:n},r)=>{let i=n[0],{[r*t]:o}=e,{[r*t+1]:s}=e,a=Er.getVisitFn(i.type),c=i.slice(o,s-o),l=8;for(let u=-1,f=s-o;++u<f;)l+=a(c,u);return l},V$=({stride:e,children:t},n)=>{let r=t[0],i=r.slice(n*e,e),o=Er.getVisitFn(r.type),s=0;for(let a=-1,c=i.length;++a<c;)s+=o(i,a);return s},Y$=(e,t)=>e.type.mode===me.Dense?sO(e,t):aO(e,t),sO=({type:e,children:t,typeIds:n,valueOffsets:r},i)=>{let o=e.typeIdToChildIndex[n[i]];return 8+Er.visit(t[o],r[i])},aO=({children:e},t)=>4+Er.visitMany(e,e.map(()=>t)).reduce($$,0);Qi.prototype.visitUtf8=z$;Qi.prototype.visitBinary=q$;Qi.prototype.visitList=j$;Qi.prototype.visitFixedSizeList=V$;Qi.prototype.visitUnion=Y$;Qi.prototype.visitDenseUnion=sO;Qi.prototype.visitSparseUnion=aO;var Er=new Qi;var cO,lO={},uO={},jt=class e{constructor(t){var n,r,i;let o=t[0]instanceof e?t.flatMap(a=>a.data):t;if(o.length===0||o.some(a=>!(a instanceof se)))throw new TypeError("Vector constructor expects an Array of Data instances.");let s=(n=o[0])===null||n===void 0?void 0:n.type;switch(o.length){case 0:this._offsets=[0];break;case 1:{let{get:a,set:c,indexOf:l,byteLength:u}=lO[s.typeId],f=o[0];this.isValid=d=>Ad(f,d),this.get=d=>a(f,d),this.set=(d,h)=>c(f,d,h),this.indexOf=d=>l(f,d),this.getByteLength=d=>u(f,d),this._offsets=[0,f.length];break}default:Object.setPrototypeOf(this,uO[s.typeId]),this._offsets=bg(o);break}this.data=o,this.type=s,this.stride=Tr(s),this.numChildren=(i=(r=s.children)===null||r===void 0?void 0:r.length)!==null&&i!==void 0?i:0,this.length=this._offsets.at(-1)}get byteLength(){return this.data.reduce((t,n)=>t+n.byteLength,0)}get nullCount(){return gg(this.data)}get ArrayType(){return this.type.ArrayType}get[Symbol.toStringTag](){return`${this.VectorName}<${this.type[Symbol.toStringTag]}>`}get VectorName(){return`${D[this.type.typeId]}Vector`}isValid(t){return!1}get(t){return null}set(t,n){}indexOf(t,n){return-1}includes(t,n){return this.indexOf(t,n)>-1}getByteLength(t){return 0}[Symbol.iterator](){return Kl.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(Td(this,t,n,({data:r,_offsets:i},o,s)=>xg(r,i,o,s)))}toJSON(){return[...this]}toArray(){let{type:t,data:n,length:r,stride:i,ArrayType:o}=this;switch(t.typeId){case D.Int:case D.Float:case D.Decimal:case D.Time:case D.Timestamp:switch(n.length){case 0:return new o;case 1:return n[0].values.subarray(0,r*i);default:return n.reduce((s,{values:a,length:c})=>(s.array.set(a.subarray(0,c*i),s.offset),s.offset+=c*i,s),{array:new o(r*i),offset:0}).array}}return[...this]}toString(){return`[${[...this].join(",")}]`}getChild(t){var n;return this.getChildAt((n=this.type.children)===null||n===void 0?void 0:n.findIndex(r=>r.name===t))}getChildAt(t){return t>-1&&t<this.numChildren?new e(this.data.map(({children:n})=>n[t])):null}get isMemoized(){return at.isDictionary(this.type)?this.data[0].dictionary.isMemoized:!1}memoize(){if(at.isDictionary(this.type)){let t=new vg(this.data[0].dictionary),n=this.data.map(r=>{let i=r.clone();return i.dictionary=t,i});return new e(n)}return new vg(this)}unmemoize(){if(at.isDictionary(this.type)&&this.isMemoized){let t=this.data[0].dictionary.unmemoize(),n=this.data.map(r=>{let i=r.clone();return i.dictionary=t,i});return new e(n)}return this}};cO=Symbol.toStringTag;jt[cO]=(e=>{e.type=at.prototype,e.data=[],e.length=0,e.stride=1,e.numChildren=0,e._offsets=new Uint32Array([0]),e[Symbol.isConcatSpreadable]=!0;let t=Object.keys(D).map(n=>D[n]).filter(n=>typeof n=="number"&&n!==D.NONE);for(let n of t){let r=je.getVisitFnByTypeId(n),i=wn.getVisitFnByTypeId(n),o=wc.getVisitFnByTypeId(n),s=Er.getVisitFnByTypeId(n);lO[n]={get:r,set:i,indexOf:o,byteLength:s},uO[n]=Object.create(e,{isValid:{value:aa(Ad)},get:{value:aa(je.getVisitFnByTypeId(n))},set:{value:_g(wn.getVisitFnByTypeId(n))},indexOf:{value:wg(wc.getVisitFnByTypeId(n))},getByteLength:{value:aa(Er.getVisitFnByTypeId(n))}})}return"Vector"})(jt.prototype);var vg=class e extends jt{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 jt(this.data)}),Object.defineProperty(this,"memoize",{value:()=>this})}};function fO(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
- switch (x) {${n.map(r=>`
3
- case ${G$(r)}:`).join("")}
1
+ var nX=Object.create;var tA=Object.defineProperty;var iX=Object.getOwnPropertyDescriptor;var oX=Object.getOwnPropertyNames;var sX=Object.getPrototypeOf,aX=Object.prototype.hasOwnProperty;var ek=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),Ir=(e,t)=>{for(var r in t)tA(e,r,{get:t[r],enumerable:!0})},cX=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of oX(t))!aX.call(e,i)&&i!==r&&tA(e,i,{get:()=>t[i],enumerable:!(n=iX(t,i))||n.enumerable});return e};var lX=(e,t,r)=>(r=e!=null?nX(sX(e)):{},cX(t||!e||!e.__esModule?tA(r,"default",{value:e,enumerable:!0}):r,e));var OW=ek((Ane,BW)=>{"use strict";function Jut(e,t,r,n,i){for(var o=i+1;n<=i;){var s=n+i>>>1,a=e[s],c=r!==void 0?r(a,t):a-t;c>=0?(o=s,i=s-1):n=s+1}return o}function tft(e,t,r,n,i){for(var o=i+1;n<=i;){var s=n+i>>>1,a=e[s],c=r!==void 0?r(a,t):a-t;c>0?(o=s,i=s-1):n=s+1}return o}function eft(e,t,r,n,i){for(var o=n-1;n<=i;){var s=n+i>>>1,a=e[s],c=r!==void 0?r(a,t):a-t;c<0?(o=s,n=s+1):i=s-1}return o}function rft(e,t,r,n,i){for(var o=n-1;n<=i;){var s=n+i>>>1,a=e[s],c=r!==void 0?r(a,t):a-t;c<=0?(o=s,n=s+1):i=s-1}return o}function nft(e,t,r,n,i){for(;n<=i;){var o=n+i>>>1,s=e[o],a=r!==void 0?r(s,t):s-t;if(a===0)return o;a<=0?n=o+1:i=o-1}return-1}function dx(e,t,r,n,i,o){return typeof r=="function"?o(e,t,r,n===void 0?0:n|0,i===void 0?e.length-1:i|0):o(e,t,void 0,r===void 0?0:r|0,n===void 0?e.length-1:n|0)}BW.exports={ge:function(e,t,r,n,i){return dx(e,t,r,n,i,Jut)},gt:function(e,t,r,n,i){return dx(e,t,r,n,i,tft)},lt:function(e,t,r,n,i){return dx(e,t,r,n,i,eft)},le:function(e,t,r,n,i){return dx(e,t,r,n,i,rft)},eq:function(e,t,r,n,i){return dx(e,t,r,n,i,nft)}}});var PW=ek((Mne,UW)=>{"use strict";var UT=OW(),dm=0,Td=1,CT=2;UW.exports=oft;function fF(e,t,r,n,i){this.mid=e,this.left=t,this.right=r,this.leftPoints=n,this.rightPoints=i,this.count=(t?t.count:0)+(r?r.count:0)+n.length}var hx=fF.prototype;function lF(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 LW(e,t){var r=hm(t);e.mid=r.mid,e.left=r.left,e.right=r.right,e.leftPoints=r.leftPoints,e.rightPoints=r.rightPoints,e.count=r.count}function NW(e,t){var r=e.intervals([]);r.push(t),LW(e,r)}function FW(e,t){var r=e.intervals([]),n=r.indexOf(t);return n<0?dm:(r.splice(n,1),LW(e,r),Td)}hx.intervals=function(e){return e.push.apply(e,this.leftPoints),this.left&&this.left.intervals(e),this.right&&this.right.intervals(e),e};hx.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)?NW(this,e):this.left.insert(e):this.left=hm([e]);else if(e[0]>this.mid)this.right?4*(this.right.count+1)>3*(t+1)?NW(this,e):this.right.insert(e):this.right=hm([e]);else{var r=UT.ge(this.leftPoints,e,dF),n=UT.ge(this.rightPoints,e,hF);this.leftPoints.splice(r,0,e),this.rightPoints.splice(n,0,e)}};hx.remove=function(e){var t=this.count-this.leftPoints;if(e[1]<this.mid){if(!this.left)return dm;var r=this.right?this.right.count:0;if(4*r>3*(t-1))return FW(this,e);var n=this.left.remove(e);return n===CT?(this.left=null,this.count-=1,Td):(n===Td&&(this.count-=1),n)}else if(e[0]>this.mid){if(!this.right)return dm;var i=this.left?this.left.count:0;if(4*i>3*(t-1))return FW(this,e);var n=this.right.remove(e);return n===CT?(this.right=null,this.count-=1,Td):(n===Td&&(this.count-=1),n)}else{if(this.count===1)return this.leftPoints[0]===e?CT:dm;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,n=this.right;o.count-=s.count,o.right=s.left,s.left=a,s.right=n}lF(this,s),this.count=(this.left?this.left.count:0)+(this.right?this.right.count:0)+this.leftPoints.length}else this.left?lF(this,this.left):lF(this,this.right);return Td}for(var a=UT.ge(this.leftPoints,e,dF);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 n=UT.ge(this.rightPoints,e,hF);n<this.rightPoints.length&&this.rightPoints[n][1]===e[1];++n)if(this.rightPoints[n]===e)return this.rightPoints.splice(n,1),Td}return dm}};function RW(e,t,r){for(var n=0;n<e.length&&e[n][0]<=t;++n){var i=r(e[n]);if(i)return i}}function kW(e,t,r){for(var n=e.length-1;n>=0&&e[n][1]>=t;--n){var i=r(e[n]);if(i)return i}}function CW(e,t){for(var r=0;r<e.length;++r){var n=t(e[r]);if(n)return n}}hx.queryPoint=function(e,t){if(e<this.mid){if(this.left){var r=this.left.queryPoint(e,t);if(r)return r}return RW(this.leftPoints,e,t)}else if(e>this.mid){if(this.right){var r=this.right.queryPoint(e,t);if(r)return r}return kW(this.rightPoints,e,t)}else return CW(this.leftPoints,t)};hx.queryInterval=function(e,t,r){if(e<this.mid&&this.left){var n=this.left.queryInterval(e,t,r);if(n)return n}if(t>this.mid&&this.right){var n=this.right.queryInterval(e,t,r);if(n)return n}return t<this.mid?RW(this.leftPoints,t,r):e>this.mid?kW(this.rightPoints,e,r):CW(this.leftPoints,r)};function ift(e,t){return e-t}function dF(e,t){var r=e[0]-t[0];return r||e[1]-t[1]}function hF(e,t){var r=e[1]-t[1];return r||e[0]-t[0]}function hm(e){if(e.length===0)return null;for(var t=[],r=0;r<e.length;++r)t.push(e[r][0],e[r][1]);t.sort(ift);for(var n=t[t.length>>1],i=[],o=[],s=[],r=0;r<e.length;++r){var a=e[r];a[1]<n?i.push(a):n<a[0]?o.push(a):s.push(a)}var c=s,l=s.slice();return c.sort(dF),l.sort(hF),new fF(n,hm(i),hm(o),c,l)}function uF(e){this.root=e}var pm=uF.prototype;pm.insert=function(e){this.root?this.root.insert(e):this.root=new fF(e[0],null,null,[e],[e])};pm.remove=function(e){if(this.root){var t=this.root.remove(e);return t===CT&&(this.root=null),t!==dm}return!1};pm.queryPoint=function(e,t){if(this.root)return this.root.queryPoint(e,t)};pm.queryInterval=function(e,t,r){if(e<=t&&this.root)return this.root.queryInterval(e,t,r)};Object.defineProperty(pm,"count",{get:function(){return this.root?this.root.count:0}});Object.defineProperty(pm,"intervals",{get:function(){return this.root?this.root.intervals([]):[]}});function oft(e){return!e||e.length===0?new uF(null):new uF(hm(e))}});var rk={};function Tm(e,t=!1){let r,n,i=rk;function o(l){r=e(l).then(()=>{if(n){let{value:u}=n;n=null,o(u)}else r=null})}function s(l){n={event:l}}function a(l){r?s(l):o(l)}function c(l){i!==l&&requestAnimationFrame(()=>{let u=i;i=rk,a(u)}),i=l}return t?c:a}var ai=class{constructor(t){this._filterBy=t,this._requestUpdate=Tm(()=>this.requestQuery(),!0),this._coordinator=null}get coordinator(){return this._coordinator}set coordinator(t){this._coordinator=t}get filterBy(){return this._filterBy}get filterIndexable(){return!0}fields(){return null}fieldInfo(){return this}query(){return null}queryPending(){return this}queryResult(){return this}queryError(t){return console.error(t),this}requestQuery(t){let r=t||this.query(this.filterBy?.predicate(this));return this._coordinator.requestQuery(this,r)}requestUpdate(){this._requestUpdate()}update(){return this}};function zx(e,t){var r={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,n=Object.getOwnPropertySymbols(e);i<n.length;i++)t.indexOf(n[i])<0&&Object.prototype.propertyIsEnumerable.call(e,n[i])&&(r[n[i]]=e[n[i]]);return r}function P(e,t,r,n){function i(o){return o instanceof r?o:new r(function(s){s(o)})}return new(r||(r=Promise))(function(o,s){function a(u){try{l(n.next(u))}catch(f){s(f)}}function c(u){try{l(n.throw(u))}catch(f){s(f)}}function l(u){u.done?o(u.value):i(u.value).then(a,c)}l((n=n.apply(e,t||[])).next())})}function nk(e){var t=typeof Symbol=="function"&&Symbol.iterator,r=t&&e[t],n=0;if(r)return r.call(e);if(e&&typeof e.length=="number")return{next:function(){return e&&n>=e.length&&(e=void 0),{value:e&&e[n++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function H(e){return this instanceof H?(this.v=e,this):new H(e)}function $e(e,t,r){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var n=r.apply(e,t||[]),i,o=[];return i={},s("next"),s("throw"),s("return"),i[Symbol.asyncIterator]=function(){return this},i;function s(d){n[d]&&(i[d]=function(h){return new Promise(function(p,y){o.push([d,h,p,y])>1||a(d,h)})})}function a(d,h){try{c(n[d](h))}catch(p){f(o[0][3],p)}}function c(d){d.value instanceof H?Promise.resolve(d.value.v).then(l,u):f(o[0][2],d)}function l(d){a("next",d)}function u(d){a("throw",d)}function f(d,h){d(h),o.shift(),o.length&&a(o[0][0],o[0][1])}}function Ji(e){var t,r;return t={},n("next"),n("throw",function(i){throw i}),n("return"),t[Symbol.iterator]=function(){return this},t;function n(i,o){t[i]=e[i]?function(s){return(r=!r)?{value:H(e[i](s)),done:!1}:o?o(s):s}:o}}function fr(e){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var t=e[Symbol.asyncIterator],r;return t?t.call(e):(e=typeof nk=="function"?nk(e):e[Symbol.iterator](),r={},n("next"),n("throw"),n("return"),r[Symbol.asyncIterator]=function(){return this},r);function n(o){r[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 sA={};Ir(sA,{compareArrayLike:()=>oA,joinUint8Arrays:()=>Mi,memcpy:()=>Em,rebaseValueOffsets:()=>Hx,toArrayBufferView:()=>te,toArrayBufferViewAsyncIterator:()=>No,toArrayBufferViewIterator:()=>Ts,toBigInt64Array:()=>Xx,toBigUint64Array:()=>bX,toFloat32Array:()=>xX,toFloat32ArrayAsyncIterator:()=>RX,toFloat32ArrayIterator:()=>MX,toFloat64Array:()=>_X,toFloat64ArrayAsyncIterator:()=>kX,toFloat64ArrayIterator:()=>EX,toInt16Array:()=>mX,toInt16ArrayAsyncIterator:()=>OX,toInt16ArrayIterator:()=>SX,toInt32Array:()=>Vu,toInt32ArrayAsyncIterator:()=>NX,toInt32ArrayIterator:()=>IX,toInt8Array:()=>pX,toInt8ArrayAsyncIterator:()=>BX,toInt8ArrayIterator:()=>vX,toUint16Array:()=>yX,toUint16ArrayAsyncIterator:()=>FX,toUint16ArrayIterator:()=>TX,toUint32Array:()=>gX,toUint32ArrayAsyncIterator:()=>LX,toUint32ArrayIterator:()=>AX,toUint8Array:()=>Et,toUint8ArrayAsyncIterator:()=>iA,toUint8ArrayIterator:()=>nA,toUint8ClampedArray:()=>wX,toUint8ClampedArrayAsyncIterator:()=>CX,toUint8ClampedArrayIterator:()=>DX});var uX=new TextDecoder("utf-8"),Am=e=>uX.decode(e),fX=new TextEncoder,Is=e=>fX.encode(e);var dX=e=>typeof e=="number",ik=e=>typeof e=="boolean",$r=e=>typeof e=="function",Cn=e=>e!=null&&Object(e)===e,Ai=e=>Cn(e)&&$r(e.then);var Oo=e=>Cn(e)&&$r(e[Symbol.iterator]),to=e=>Cn(e)&&$r(e[Symbol.asyncIterator]),Vx=e=>Cn(e)&&Cn(e.schema);var jx=e=>Cn(e)&&"done"in e&&"value"in e;var qx=e=>Cn(e)&&$r(e.stat)&&dX(e.fd);var Yx=e=>Cn(e)&&Mm(e.body),Wx=e=>"_getDOMStream"in e&&"_getNodeStream"in e,ok=e=>Cn(e)&&$r(e.abort)&&$r(e.getWriter)&&!Wx(e),Mm=e=>Cn(e)&&$r(e.cancel)&&$r(e.getReader)&&!Wx(e),sk=e=>Cn(e)&&$r(e.end)&&$r(e.write)&&ik(e.writable)&&!Wx(e),Gx=e=>Cn(e)&&$r(e.read)&&$r(e.pipe)&&ik(e.readable)&&!Wx(e),ak=e=>Cn(e)&&$r(e.clear)&&$r(e.bytes)&&$r(e.position)&&$r(e.setPosition)&&$r(e.capacity)&&$r(e.getBufferIdentifier)&&$r(e.createLong);var rA=typeof SharedArrayBuffer<"u"?SharedArrayBuffer:ArrayBuffer;function hX(e){let t=e[0]?[e[0]]:[],r,n,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:r,byteLength:i}=s,{byteOffset:n,byteLength:o}=a,r+i<n||n+o<r){a&&(t[++l]=a);continue}t[l]=new Uint8Array(s.buffer,r,n-r+o)}return t}function Em(e,t,r=0,n=t.byteLength){let i=e.byteLength,o=new Uint8Array(e.buffer,e.byteOffset,i),s=new Uint8Array(t.buffer,t.byteOffset,Math.min(n,i));return o.set(s,r),e}function Mi(e,t){let r=hX(e),n=r.reduce((u,f)=>u+f.byteLength,0),i,o,s,a=0,c=-1,l=Math.min(t||Number.POSITIVE_INFINITY,n);for(let u=r.length;++c<u;){if(i=r[c],o=i.subarray(0,Math.min(i.length,l-a)),l<=a+o.length){o.length<i.length?r[c]=i.subarray(o.length):o.length===i.length&&c++,s?Em(s,o,a):s=o;break}Em(s||(s=new Uint8Array(l)),o,a),a+=o.length}return[s||new Uint8Array(0),r.slice(c),n-(s?s.byteLength:0)]}function te(e,t){let r=jx(t)?t.value:t;return r instanceof e?e===Uint8Array?new e(r.buffer,r.byteOffset,r.byteLength):r:r?(typeof r=="string"&&(r=Is(r)),r instanceof ArrayBuffer?new e(r):r instanceof rA?new e(r):ak(r)?te(e,r.bytes()):ArrayBuffer.isView(r)?r.byteLength<=0?new e(0):new e(r.buffer,r.byteOffset,r.byteLength/e.BYTES_PER_ELEMENT):e.from(r)):new e(0)}var pX=e=>te(Int8Array,e),mX=e=>te(Int16Array,e),Vu=e=>te(Int32Array,e),Xx=e=>te(BigInt64Array,e),Et=e=>te(Uint8Array,e),yX=e=>te(Uint16Array,e),gX=e=>te(Uint32Array,e),bX=e=>te(BigUint64Array,e),xX=e=>te(Float32Array,e),_X=e=>te(Float64Array,e),wX=e=>te(Uint8ClampedArray,e),eA=e=>(e.next(),e);function*Ts(e,t){let r=function*(i){yield i},n=typeof t=="string"||ArrayBuffer.isView(t)||t instanceof ArrayBuffer||t instanceof rA?r(t):Oo(t)?t:r(t);return yield*eA(function*(i){let o=null;do o=i.next(yield te(e,o));while(!o.done)}(n[Symbol.iterator]())),new e}var vX=e=>Ts(Int8Array,e),SX=e=>Ts(Int16Array,e),IX=e=>Ts(Int32Array,e),nA=e=>Ts(Uint8Array,e),TX=e=>Ts(Uint16Array,e),AX=e=>Ts(Uint32Array,e),MX=e=>Ts(Float32Array,e),EX=e=>Ts(Float64Array,e),DX=e=>Ts(Uint8ClampedArray,e);function No(e,t){return $e(this,arguments,function*(){if(Ai(t))return yield H(yield H(yield*Ji(fr(No(e,yield H(t))))));let n=function(s){return $e(this,arguments,function*(){yield yield H(yield H(s))})},i=function(s){return $e(this,arguments,function*(){yield H(yield*Ji(fr(eA(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 rA?n(t):Oo(t)?i(t):to(t)?t:n(t);return yield H(yield*Ji(fr(eA(function(s){return $e(this,arguments,function*(){let a=null;do a=yield H(s.next(yield yield H(te(e,a))));while(!a.done)})}(o[Symbol.asyncIterator]()))))),yield H(new e)})}var BX=e=>No(Int8Array,e),OX=e=>No(Int16Array,e),NX=e=>No(Int32Array,e),iA=e=>No(Uint8Array,e),FX=e=>No(Uint16Array,e),LX=e=>No(Uint32Array,e),RX=e=>No(Float32Array,e),kX=e=>No(Float64Array,e),CX=e=>No(Uint8ClampedArray,e);function Hx(e,t,r){if(e!==0){r=r.slice(0,t);for(let n=-1,i=r.length;++n<i;)r[n]+=e}return r.subarray(0,t)}function oA(e,t){let r=0,n=e.length;if(n!==t.length)return!1;if(n>0)do if(e[r]!==t[r])return!1;while(++r<n);return!0}var on={fromIterable(e){return Zx(UX(e))},fromAsyncIterable(e){return Zx(PX(e))},fromDOMStream(e){return Zx($X(e))},fromNodeStream(e){return Zx(zX(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')}},Zx=e=>(e.next(),e);function*UX(e){let t,r=!1,n=[],i,o,s,a=0;function c(){return o==="peek"?Mi(n,s)[0]:([i,n,a]=Mi(n,s),i)}({cmd:o,size:s}=(yield null)||{cmd:"read",size:0});let l=nA(e)[Symbol.iterator]();try{do if({done:t,value:i}=Number.isNaN(s-a)?l.next():l.next(s-a),!t&&i.byteLength>0&&(n.push(i),a+=i.byteLength),t||s<=a)do({cmd:o,size:s}=yield c());while(s<a);while(!t)}catch(u){(r=!0)&&typeof l.throw=="function"&&l.throw(u)}finally{r===!1&&typeof l.return=="function"&&l.return(null)}return null}function PX(e){return $e(this,arguments,function*(){let r,n=!1,i=[],o,s,a,c=0;function l(){return s==="peek"?Mi(i,a)[0]:([o,i,c]=Mi(i,a),o)}({cmd:s,size:a}=(yield yield H(null))||{cmd:"read",size:0});let u=iA(e)[Symbol.asyncIterator]();try{do if({done:r,value:o}=Number.isNaN(a-c)?yield H(u.next()):yield H(u.next(a-c)),!r&&o.byteLength>0&&(i.push(o),c+=o.byteLength),r||a<=c)do({cmd:s,size:a}=yield yield H(l()));while(a<c);while(!r)}catch(f){(n=!0)&&typeof u.throw=="function"&&(yield H(u.throw(f)))}finally{n===!1&&typeof u.return=="function"&&(yield H(u.return(new Uint8Array(0))))}return yield H(null)})}function $X(e){return $e(this,arguments,function*(){let r=!1,n=!1,i=[],o,s,a,c=0;function l(){return s==="peek"?Mi(i,a)[0]:([o,i,c]=Mi(i,a),o)}({cmd:s,size:a}=(yield yield H(null))||{cmd:"read",size:0});let u=new cA(e);try{do if({done:r,value:o}=Number.isNaN(a-c)?yield H(u.read()):yield H(u.read(a-c)),!r&&o.byteLength>0&&(i.push(Et(o)),c+=o.byteLength),r||a<=c)do({cmd:s,size:a}=yield yield H(l()));while(a<c);while(!r)}catch(f){(n=!0)&&(yield H(u.cancel(f)))}finally{n===!1?yield H(u.cancel()):e.locked&&u.releaseLock()}return yield H(null)})}var cA=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 P(this,void 0,void 0,function*(){let{reader:r,source:n}=this;r&&(yield r.cancel(t).catch(()=>{})),n&&n.locked&&this.releaseLock()})}read(t){return P(this,void 0,void 0,function*(){if(t===0)return{done:this.reader==null,value:new Uint8Array(0)};let r=yield this.reader.read();return!r.done&&(r.value=Et(r)),r})}},aA=(e,t)=>{let r=i=>n([t,i]),n;return[t,r,new Promise(i=>(n=i)&&e.once(t,r))]};function zX(e){return $e(this,arguments,function*(){let r=[],n="error",i=!1,o=null,s,a,c=0,l=[],u;function f(){return s==="peek"?Mi(l,a)[0]:([u,l,c]=Mi(l,a),u)}if({cmd:s,size:a}=(yield yield H(null))||{cmd:"read",size:0},e.isTTY)return yield yield H(new Uint8Array(0)),yield H(null);try{r[0]=aA(e,"end"),r[1]=aA(e,"error");do{if(r[2]=aA(e,"readable"),[n,o]=yield H(Promise.race(r.map(h=>h[2]))),n==="error")break;if((i=n==="end")||(Number.isFinite(a-c)?(u=Et(e.read(a-c)),u.byteLength<a-c&&(u=Et(e.read()))):u=Et(e.read()),u.byteLength>0&&(l.push(u),c+=u.byteLength)),i||a<=c)do({cmd:s,size:a}=yield yield H(f()));while(a<c)}while(!i)}finally{yield H(d(r,n==="error"?o:null))}return yield H(null);function d(h,p){return u=l=null,new Promise((y,g)=>{for(let[m,b]of h)e.off(m,b);try{let m=e.destroy;m&&m.call(e,p),p=void 0}catch(m){p=m||p}finally{p!=null?g(p):y()}})}})}var Ee;(function(e){e[e.V1=0]="V1",e[e.V2=1]="V2",e[e.V3=2]="V3",e[e.V4=3]="V4",e[e.V5=4]="V5"})(Ee||(Ee={}));var Ue;(function(e){e[e.Sparse=0]="Sparse",e[e.Dense=1]="Dense"})(Ue||(Ue={}));var Le;(function(e){e[e.HALF=0]="HALF",e[e.SINGLE=1]="SINGLE",e[e.DOUBLE=2]="DOUBLE"})(Le||(Le={}));var Tr;(function(e){e[e.DAY=0]="DAY",e[e.MILLISECOND=1]="MILLISECOND"})(Tr||(Tr={}));var ft;(function(e){e[e.SECOND=0]="SECOND",e[e.MILLISECOND=1]="MILLISECOND",e[e.MICROSECOND=2]="MICROSECOND",e[e.NANOSECOND=3]="NANOSECOND"})(ft||(ft={}));var Wr;(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"})(Wr||(Wr={}));var As=new Int32Array(2),Kx=new Float32Array(As.buffer),Qx=new Float64Array(As.buffer),Dd=new Uint16Array(new Uint8Array([1,0]).buffer)[0]===1;var Dm;(function(e){e[e.UTF8_BYTES=1]="UTF8_BYTES",e[e.UTF16_STRING=2]="UTF16_STRING"})(Dm||(Dm={}));var Ar=class e{constructor(t){this.bytes_=t,this.position_=0,this.text_decoder_=new TextDecoder}static allocate(t){return new e(new Uint8Array(t))}clear(){this.position_=0}bytes(){return this.bytes_}position(){return this.position_}setPosition(t){this.position_=t}capacity(){return this.bytes_.length}readInt8(t){return this.readUint8(t)<<24>>24}readUint8(t){return this.bytes_[t]}readInt16(t){return this.readUint16(t)<<16>>16}readUint16(t){return this.bytes_[t]|this.bytes_[t+1]<<8}readInt32(t){return this.bytes_[t]|this.bytes_[t+1]<<8|this.bytes_[t+2]<<16|this.bytes_[t+3]<<24}readUint32(t){return this.readInt32(t)>>>0}readInt64(t){return BigInt.asIntN(64,BigInt(this.readUint32(t))+(BigInt(this.readUint32(t+4))<<BigInt(32)))}readUint64(t){return BigInt.asUintN(64,BigInt(this.readUint32(t))+(BigInt(this.readUint32(t+4))<<BigInt(32)))}readFloat32(t){return As[0]=this.readInt32(t),Kx[0]}readFloat64(t){return As[Dd?0:1]=this.readInt32(t),As[Dd?1:0]=this.readInt32(t+4),Qx[0]}writeInt8(t,r){this.bytes_[t]=r}writeUint8(t,r){this.bytes_[t]=r}writeInt16(t,r){this.bytes_[t]=r,this.bytes_[t+1]=r>>8}writeUint16(t,r){this.bytes_[t]=r,this.bytes_[t+1]=r>>8}writeInt32(t,r){this.bytes_[t]=r,this.bytes_[t+1]=r>>8,this.bytes_[t+2]=r>>16,this.bytes_[t+3]=r>>24}writeUint32(t,r){this.bytes_[t]=r,this.bytes_[t+1]=r>>8,this.bytes_[t+2]=r>>16,this.bytes_[t+3]=r>>24}writeInt64(t,r){this.writeInt32(t,Number(BigInt.asIntN(32,r))),this.writeInt32(t+4,Number(BigInt.asIntN(32,r>>BigInt(32))))}writeUint64(t,r){this.writeUint32(t,Number(BigInt.asUintN(32,r))),this.writeUint32(t+4,Number(BigInt.asUintN(32,r>>BigInt(32))))}writeFloat32(t,r){Kx[0]=r,this.writeInt32(t,As[0])}writeFloat64(t,r){Qx[0]=r,this.writeInt32(t,As[Dd?0:1]),this.writeInt32(t+4,As[Dd?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 r=0;r<4;r++)t+=String.fromCharCode(this.readInt8(this.position_+4+r));return t}__offset(t,r){let n=t-this.readInt32(t);return r<this.readInt16(n)?this.readInt16(n+r):0}__union(t,r){return t.bb_pos=r+this.readInt32(r),t.bb=this,t}__string(t,r){t+=this.readInt32(t);let n=this.readInt32(t);t+=4;let i=this.bytes_.subarray(t,t+n);return r===Dm.UTF8_BYTES?i:this.text_decoder_.decode(i)}__union_with_string(t,r){return typeof t=="string"?this.__string(r):this.__union(t,r)}__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 r=0;r<4;r++)if(t.charCodeAt(r)!=this.readInt8(this.position()+4+r))return!1;return!0}createScalarList(t,r){let n=[];for(let i=0;i<r;++i){let o=t(i);o!==null&&n.push(o)}return n}createObjList(t,r){let n=[];for(let i=0;i<r;++i){let o=t(i);o!==null&&n.push(o.unpack())}return n}};var Lo=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 r;t?r=t:r=1024,this.bb=Ar.allocate(r),this.space=r}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,r){t>this.minalign&&(this.minalign=t);let n=~(this.bb.capacity()-this.space+r)+1&t-1;for(;this.space<n+t+r;){let i=this.bb.capacity();this.bb=e.growByteBuffer(this.bb),this.space+=this.bb.capacity()-i}this.pad(n)}pad(t){for(let r=0;r<t;r++)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,r,n){(this.force_defaults||r!=n)&&(this.addInt8(r),this.slot(t))}addFieldInt16(t,r,n){(this.force_defaults||r!=n)&&(this.addInt16(r),this.slot(t))}addFieldInt32(t,r,n){(this.force_defaults||r!=n)&&(this.addInt32(r),this.slot(t))}addFieldInt64(t,r,n){(this.force_defaults||r!==n)&&(this.addInt64(r),this.slot(t))}addFieldFloat32(t,r,n){(this.force_defaults||r!=n)&&(this.addFloat32(r),this.slot(t))}addFieldFloat64(t,r,n){(this.force_defaults||r!=n)&&(this.addFloat64(r),this.slot(t))}addFieldOffset(t,r,n){(this.force_defaults||r!=n)&&(this.addOffset(r),this.slot(t))}addFieldStruct(t,r,n){r!=n&&(this.nested(r),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 r=t.capacity();if(r&3221225472)throw new Error("FlatBuffers: cannot grow buffer beyond 2 gigabytes.");let n=r<<1,i=Ar.allocate(n);return i.setPosition(n-r),i.bytes().set(t.bytes(),n-r),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 r=0;r<t;r++)this.vtable[r]=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(),r=this.vtable_in_use-1;for(;r>=0&&this.vtable[r]==0;r--);let n=r+1;for(;r>=0;r--)this.addInt16(this.vtable[r]!=0?t-this.vtable[r]:0);let i=2;this.addInt16(t-this.object_start);let o=(n+i)*2;this.addInt16(o);let s=0,a=this.space;t:for(r=0;r<this.vtables.length;r++){let c=this.bb.capacity()-this.vtables[r];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[r];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,r,n){let i=n?4:0;if(r){let o=r;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,r){this.finish(t,r,!0)}requiredField(t,r){let n=this.bb.capacity()-t,i=n-this.bb.readInt32(n);if(!(r<this.bb.readInt16(i)&&this.bb.readInt16(i+r)!=0))throw new TypeError("FlatBuffers: field "+r+" must be set")}startVector(t,r,n){this.notNested(),this.vector_num_elems=r,this.prep(4,t*r),this.prep(n,t*r)}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 r=this.createString(t);return this.string_maps.set(t,r),r}createString(t){if(t==null)return 0;let r;t instanceof Uint8Array?r=t:r=this.text_encoder.encode(t),this.addInt8(0),this.startVector(1,r.length,1),this.bb.setPosition(this.space-=r.length);for(let n=0,i=this.space,o=this.bb.bytes();n<r.length;n++)o[i++]=r[n];return this.endVector()}createObjectOffset(t){return t===null?0:typeof t=="string"?this.createString(t):t.pack(this)}createObjectOffsetList(t){let r=[];for(let n=0;n<t.length;++n){let i=t[n];if(i!==null)r.push(this.createObjectOffset(i));else throw new TypeError("FlatBuffers: Argument for createObjectOffsetList cannot contain null.")}return r}createStructOffsetList(t,r){return r(this,t.length),this.createObjectOffsetList(t.slice().reverse()),this.endVector()}};var Bm;(function(e){e[e.BUFFER=0]="BUFFER"})(Bm||(Bm={}));var Om;(function(e){e[e.LZ4_FRAME=0]="LZ4_FRAME",e[e.ZSTD=1]="ZSTD"})(Om||(Om={}));var t_=class e{constructor(){this.bb=null,this.bb_pos=0}__init(t,r){return this.bb_pos=t,this.bb=r,this}static getRootAsBodyCompression(t,r){return(r||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsBodyCompression(t,r){return t.setPosition(t.position()+4),(r||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):Om.LZ4_FRAME}method(){let t=this.bb.__offset(this.bb_pos,6);return t?this.bb.readInt8(this.bb_pos+t):Bm.BUFFER}static startBodyCompression(t){t.startObject(2)}static addCodec(t,r){t.addFieldInt8(0,r,Om.LZ4_FRAME)}static addMethod(t,r){t.addFieldInt8(1,r,Bm.BUFFER)}static endBodyCompression(t){return t.endObject()}static createBodyCompression(t,r,n){return e.startBodyCompression(t),e.addCodec(t,r),e.addMethod(t,n),e.endBodyCompression(t)}};var Bd=class{constructor(){this.bb=null,this.bb_pos=0}__init(t,r){return this.bb_pos=t,this.bb=r,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,r,n){return t.prep(8,16),t.writeInt64(BigInt(n??0)),t.writeInt64(BigInt(r??0)),t.offset()}};var Od=class{constructor(){this.bb=null,this.bb_pos=0}__init(t,r){return this.bb_pos=t,this.bb=r,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,r,n){return t.prep(8,16),t.writeInt64(BigInt(n??0)),t.writeInt64(BigInt(r??0)),t.offset()}};var Ei=class e{constructor(){this.bb=null,this.bb_pos=0}__init(t,r){return this.bb_pos=t,this.bb=r,this}static getRootAsRecordBatch(t,r){return(r||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsRecordBatch(t,r){return t.setPosition(t.position()+4),(r||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,r){let n=this.bb.__offset(this.bb_pos,6);return n?(r||new Od).__init(this.bb.__vector(this.bb_pos+n)+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,r){let n=this.bb.__offset(this.bb_pos,8);return n?(r||new Bd).__init(this.bb.__vector(this.bb_pos+n)+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 r=this.bb.__offset(this.bb_pos,10);return r?(t||new t_).__init(this.bb.__indirect(this.bb_pos+r),this.bb):null}static startRecordBatch(t){t.startObject(4)}static addLength(t,r){t.addFieldInt64(0,r,BigInt("0"))}static addNodes(t,r){t.addFieldOffset(1,r,0)}static startNodesVector(t,r){t.startVector(16,r,8)}static addBuffers(t,r){t.addFieldOffset(2,r,0)}static startBuffersVector(t,r){t.startVector(16,r,8)}static addCompression(t,r){t.addFieldOffset(3,r,0)}static endRecordBatch(t){return t.endObject()}};var Ba=class e{constructor(){this.bb=null,this.bb_pos=0}__init(t,r){return this.bb_pos=t,this.bb=r,this}static getRootAsDictionaryBatch(t,r){return(r||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsDictionaryBatch(t,r){return t.setPosition(t.position()+4),(r||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 r=this.bb.__offset(this.bb_pos,6);return r?(t||new Ei).__init(this.bb.__indirect(this.bb_pos+r),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,r){t.addFieldInt64(0,r,BigInt("0"))}static addData(t,r){t.addFieldOffset(1,r,0)}static addIsDelta(t,r){t.addFieldInt8(2,+r,0)}static endDictionaryBatch(t){return t.endObject()}};var yl;(function(e){e[e.Little=0]="Little",e[e.Big=1]="Big"})(yl||(yl={}));var Nm;(function(e){e[e.DenseArray=0]="DenseArray"})(Nm||(Nm={}));var Ro=class e{constructor(){this.bb=null,this.bb_pos=0}__init(t,r){return this.bb_pos=t,this.bb=r,this}static getRootAsInt(t,r){return(r||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsInt(t,r){return t.setPosition(t.position()+4),(r||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,r){t.addFieldInt32(0,r,0)}static addIsSigned(t,r){t.addFieldInt8(1,+r,0)}static endInt(t){return t.endObject()}static createInt(t,r,n){return e.startInt(t),e.addBitWidth(t,r),e.addIsSigned(t,n),e.endInt(t)}};var Ms=class e{constructor(){this.bb=null,this.bb_pos=0}__init(t,r){return this.bb_pos=t,this.bb=r,this}static getRootAsDictionaryEncoding(t,r){return(r||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsDictionaryEncoding(t,r){return t.setPosition(t.position()+4),(r||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 r=this.bb.__offset(this.bb_pos,6);return r?(t||new Ro).__init(this.bb.__indirect(this.bb_pos+r),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):Nm.DenseArray}static startDictionaryEncoding(t){t.startObject(4)}static addId(t,r){t.addFieldInt64(0,r,BigInt("0"))}static addIndexType(t,r){t.addFieldOffset(1,r,0)}static addIsOrdered(t,r){t.addFieldInt8(2,+r,0)}static addDictionaryKind(t,r){t.addFieldInt16(3,r,Nm.DenseArray)}static endDictionaryEncoding(t){return t.endObject()}};var zr=class e{constructor(){this.bb=null,this.bb_pos=0}__init(t,r){return this.bb_pos=t,this.bb=r,this}static getRootAsKeyValue(t,r){return(r||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsKeyValue(t,r){return t.setPosition(t.position()+4),(r||new e).__init(t.readInt32(t.position())+t.position(),t)}key(t){let r=this.bb.__offset(this.bb_pos,4);return r?this.bb.__string(this.bb_pos+r,t):null}value(t){let r=this.bb.__offset(this.bb_pos,6);return r?this.bb.__string(this.bb_pos+r,t):null}static startKeyValue(t){t.startObject(2)}static addKey(t,r){t.addFieldOffset(0,r,0)}static addValue(t,r){t.addFieldOffset(1,r,0)}static endKeyValue(t){return t.endObject()}static createKeyValue(t,r,n){return e.startKeyValue(t),e.addKey(t,r),e.addValue(t,n),e.endKeyValue(t)}};var Fm=class e{constructor(){this.bb=null,this.bb_pos=0}__init(t,r){return this.bb_pos=t,this.bb=r,this}static getRootAsBinary(t,r){return(r||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsBinary(t,r){return t.setPosition(t.position()+4),(r||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 Lm=class e{constructor(){this.bb=null,this.bb_pos=0}__init(t,r){return this.bb_pos=t,this.bb=r,this}static getRootAsBool(t,r){return(r||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsBool(t,r){return t.setPosition(t.position()+4),(r||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 gl=class e{constructor(){this.bb=null,this.bb_pos=0}__init(t,r){return this.bb_pos=t,this.bb=r,this}static getRootAsDate(t,r){return(r||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsDate(t,r){return t.setPosition(t.position()+4),(r||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):Tr.MILLISECOND}static startDate(t){t.startObject(1)}static addUnit(t,r){t.addFieldInt16(0,r,Tr.MILLISECOND)}static endDate(t){return t.endObject()}static createDate(t,r){return e.startDate(t),e.addUnit(t,r),e.endDate(t)}};var Es=class e{constructor(){this.bb=null,this.bb_pos=0}__init(t,r){return this.bb_pos=t,this.bb=r,this}static getRootAsDecimal(t,r){return(r||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsDecimal(t,r){return t.setPosition(t.position()+4),(r||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,r){t.addFieldInt32(0,r,0)}static addScale(t,r){t.addFieldInt32(1,r,0)}static addBitWidth(t,r){t.addFieldInt32(2,r,128)}static endDecimal(t){return t.endObject()}static createDecimal(t,r,n,i){return e.startDecimal(t),e.addPrecision(t,r),e.addScale(t,n),e.addBitWidth(t,i),e.endDecimal(t)}};var bl=class e{constructor(){this.bb=null,this.bb_pos=0}__init(t,r){return this.bb_pos=t,this.bb=r,this}static getRootAsDuration(t,r){return(r||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsDuration(t,r){return t.setPosition(t.position()+4),(r||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):ft.MILLISECOND}static startDuration(t){t.startObject(1)}static addUnit(t,r){t.addFieldInt16(0,r,ft.MILLISECOND)}static endDuration(t){return t.endObject()}static createDuration(t,r){return e.startDuration(t),e.addUnit(t,r),e.endDuration(t)}};var xl=class e{constructor(){this.bb=null,this.bb_pos=0}__init(t,r){return this.bb_pos=t,this.bb=r,this}static getRootAsFixedSizeBinary(t,r){return(r||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsFixedSizeBinary(t,r){return t.setPosition(t.position()+4),(r||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,r){t.addFieldInt32(0,r,0)}static endFixedSizeBinary(t){return t.endObject()}static createFixedSizeBinary(t,r){return e.startFixedSizeBinary(t),e.addByteWidth(t,r),e.endFixedSizeBinary(t)}};var _l=class e{constructor(){this.bb=null,this.bb_pos=0}__init(t,r){return this.bb_pos=t,this.bb=r,this}static getRootAsFixedSizeList(t,r){return(r||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsFixedSizeList(t,r){return t.setPosition(t.position()+4),(r||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,r){t.addFieldInt32(0,r,0)}static endFixedSizeList(t){return t.endObject()}static createFixedSizeList(t,r){return e.startFixedSizeList(t),e.addListSize(t,r),e.endFixedSizeList(t)}};var wl=class e{constructor(){this.bb=null,this.bb_pos=0}__init(t,r){return this.bb_pos=t,this.bb=r,this}static getRootAsFloatingPoint(t,r){return(r||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsFloatingPoint(t,r){return t.setPosition(t.position()+4),(r||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):Le.HALF}static startFloatingPoint(t){t.startObject(1)}static addPrecision(t,r){t.addFieldInt16(0,r,Le.HALF)}static endFloatingPoint(t){return t.endObject()}static createFloatingPoint(t,r){return e.startFloatingPoint(t),e.addPrecision(t,r),e.endFloatingPoint(t)}};var vl=class e{constructor(){this.bb=null,this.bb_pos=0}__init(t,r){return this.bb_pos=t,this.bb=r,this}static getRootAsInterval(t,r){return(r||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsInterval(t,r){return t.setPosition(t.position()+4),(r||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):Wr.YEAR_MONTH}static startInterval(t){t.startObject(1)}static addUnit(t,r){t.addFieldInt16(0,r,Wr.YEAR_MONTH)}static endInterval(t){return t.endObject()}static createInterval(t,r){return e.startInterval(t),e.addUnit(t,r),e.endInterval(t)}};var Rm=class e{constructor(){this.bb=null,this.bb_pos=0}__init(t,r){return this.bb_pos=t,this.bb=r,this}static getRootAsLargeBinary(t,r){return(r||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsLargeBinary(t,r){return t.setPosition(t.position()+4),(r||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 km=class e{constructor(){this.bb=null,this.bb_pos=0}__init(t,r){return this.bb_pos=t,this.bb=r,this}static getRootAsLargeUtf8(t,r){return(r||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsLargeUtf8(t,r){return t.setPosition(t.position()+4),(r||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 Cm=class e{constructor(){this.bb=null,this.bb_pos=0}__init(t,r){return this.bb_pos=t,this.bb=r,this}static getRootAsList(t,r){return(r||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsList(t,r){return t.setPosition(t.position()+4),(r||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 Sl=class e{constructor(){this.bb=null,this.bb_pos=0}__init(t,r){return this.bb_pos=t,this.bb=r,this}static getRootAsMap(t,r){return(r||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsMap(t,r){return t.setPosition(t.position()+4),(r||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,r){t.addFieldInt8(0,+r,0)}static endMap(t){return t.endObject()}static createMap(t,r){return e.startMap(t),e.addKeysSorted(t,r),e.endMap(t)}};var Um=class e{constructor(){this.bb=null,this.bb_pos=0}__init(t,r){return this.bb_pos=t,this.bb=r,this}static getRootAsNull(t,r){return(r||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsNull(t,r){return t.setPosition(t.position()+4),(r||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 Pm=class e{constructor(){this.bb=null,this.bb_pos=0}__init(t,r){return this.bb_pos=t,this.bb=r,this}static getRootAsStruct_(t,r){return(r||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsStruct_(t,r){return t.setPosition(t.position()+4),(r||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 Oa=class e{constructor(){this.bb=null,this.bb_pos=0}__init(t,r){return this.bb_pos=t,this.bb=r,this}static getRootAsTime(t,r){return(r||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsTime(t,r){return t.setPosition(t.position()+4),(r||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):ft.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,r){t.addFieldInt16(0,r,ft.MILLISECOND)}static addBitWidth(t,r){t.addFieldInt32(1,r,32)}static endTime(t){return t.endObject()}static createTime(t,r,n){return e.startTime(t),e.addUnit(t,r),e.addBitWidth(t,n),e.endTime(t)}};var Na=class e{constructor(){this.bb=null,this.bb_pos=0}__init(t,r){return this.bb_pos=t,this.bb=r,this}static getRootAsTimestamp(t,r){return(r||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsTimestamp(t,r){return t.setPosition(t.position()+4),(r||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):ft.SECOND}timezone(t){let r=this.bb.__offset(this.bb_pos,6);return r?this.bb.__string(this.bb_pos+r,t):null}static startTimestamp(t){t.startObject(2)}static addUnit(t,r){t.addFieldInt16(0,r,ft.SECOND)}static addTimezone(t,r){t.addFieldOffset(1,r,0)}static endTimestamp(t){return t.endObject()}static createTimestamp(t,r,n){return e.startTimestamp(t),e.addUnit(t,r),e.addTimezone(t,n),e.endTimestamp(t)}};var ko=class e{constructor(){this.bb=null,this.bb_pos=0}__init(t,r){return this.bb_pos=t,this.bb=r,this}static getRootAsUnion(t,r){return(r||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsUnion(t,r){return t.setPosition(t.position()+4),(r||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):Ue.Sparse}typeIds(t){let r=this.bb.__offset(this.bb_pos,6);return r?this.bb.readInt32(this.bb.__vector(this.bb_pos+r)+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,r){t.addFieldInt16(0,r,Ue.Sparse)}static addTypeIds(t,r){t.addFieldOffset(1,r,0)}static createTypeIdsVector(t,r){t.startVector(4,r.length,4);for(let n=r.length-1;n>=0;n--)t.addInt32(r[n]);return t.endVector()}static startTypeIdsVector(t,r){t.startVector(4,r,4)}static endUnion(t){return t.endObject()}static createUnion(t,r,n){return e.startUnion(t),e.addMode(t,r),e.addTypeIds(t,n),e.endUnion(t)}};var $m=class e{constructor(){this.bb=null,this.bb_pos=0}__init(t,r){return this.bb_pos=t,this.bb=r,this}static getRootAsUtf8(t,r){return(r||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsUtf8(t,r){return t.setPosition(t.position()+4),(r||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 Re;(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"})(Re||(Re={}));var Tn=class e{constructor(){this.bb=null,this.bb_pos=0}__init(t,r){return this.bb_pos=t,this.bb=r,this}static getRootAsField(t,r){return(r||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsField(t,r){return t.setPosition(t.position()+4),(r||new e).__init(t.readInt32(t.position())+t.position(),t)}name(t){let r=this.bb.__offset(this.bb_pos,4);return r?this.bb.__string(this.bb_pos+r,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):Re.NONE}type(t){let r=this.bb.__offset(this.bb_pos,10);return r?this.bb.__union(t,this.bb_pos+r):null}dictionary(t){let r=this.bb.__offset(this.bb_pos,12);return r?(t||new Ms).__init(this.bb.__indirect(this.bb_pos+r),this.bb):null}children(t,r){let n=this.bb.__offset(this.bb_pos,14);return n?(r||new e).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+n)+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,r){let n=this.bb.__offset(this.bb_pos,16);return n?(r||new zr).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+n)+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,r){t.addFieldOffset(0,r,0)}static addNullable(t,r){t.addFieldInt8(1,+r,0)}static addTypeType(t,r){t.addFieldInt8(2,r,Re.NONE)}static addType(t,r){t.addFieldOffset(3,r,0)}static addDictionary(t,r){t.addFieldOffset(4,r,0)}static addChildren(t,r){t.addFieldOffset(5,r,0)}static createChildrenVector(t,r){t.startVector(4,r.length,4);for(let n=r.length-1;n>=0;n--)t.addOffset(r[n]);return t.endVector()}static startChildrenVector(t,r){t.startVector(4,r,4)}static addCustomMetadata(t,r){t.addFieldOffset(6,r,0)}static createCustomMetadataVector(t,r){t.startVector(4,r.length,4);for(let n=r.length-1;n>=0;n--)t.addOffset(r[n]);return t.endVector()}static startCustomMetadataVector(t,r){t.startVector(4,r,4)}static endField(t){return t.endObject()}};var ci=class e{constructor(){this.bb=null,this.bb_pos=0}__init(t,r){return this.bb_pos=t,this.bb=r,this}static getRootAsSchema(t,r){return(r||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsSchema(t,r){return t.setPosition(t.position()+4),(r||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):yl.Little}fields(t,r){let n=this.bb.__offset(this.bb_pos,6);return n?(r||new Tn).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+n)+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,r){let n=this.bb.__offset(this.bb_pos,8);return n?(r||new zr).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+n)+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 r=this.bb.__offset(this.bb_pos,10);return r?this.bb.readInt64(this.bb.__vector(this.bb_pos+r)+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,r){t.addFieldInt16(0,r,yl.Little)}static addFields(t,r){t.addFieldOffset(1,r,0)}static createFieldsVector(t,r){t.startVector(4,r.length,4);for(let n=r.length-1;n>=0;n--)t.addOffset(r[n]);return t.endVector()}static startFieldsVector(t,r){t.startVector(4,r,4)}static addCustomMetadata(t,r){t.addFieldOffset(2,r,0)}static createCustomMetadataVector(t,r){t.startVector(4,r.length,4);for(let n=r.length-1;n>=0;n--)t.addOffset(r[n]);return t.endVector()}static startCustomMetadataVector(t,r){t.startVector(4,r,4)}static addFeatures(t,r){t.addFieldOffset(3,r,0)}static createFeaturesVector(t,r){t.startVector(8,r.length,8);for(let n=r.length-1;n>=0;n--)t.addInt64(r[n]);return t.endVector()}static startFeaturesVector(t,r){t.startVector(8,r,8)}static endSchema(t){return t.endObject()}static finishSchemaBuffer(t,r){t.finish(r)}static finishSizePrefixedSchemaBuffer(t,r){t.finish(r,void 0,!0)}static createSchema(t,r,n,i,o){return e.startSchema(t),e.addEndianness(t,r),e.addFields(t,n),e.addCustomMetadata(t,i),e.addFeatures(t,o),e.endSchema(t)}};var oe;(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"})(oe||(oe={}));var F;(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"})(F||(F={}));var Co;(function(e){e[e.OFFSET=0]="OFFSET",e[e.DATA=1]="DATA",e[e.VALIDITY=2]="VALIDITY",e[e.TYPE=3]="TYPE"})(Co||(Co={}));var MA={};Ir(MA,{clampIndex:()=>EH,clampRange:()=>qm,createElementComparator:()=>Al});var lA={};Ir(lA,{valueToString:()=>Uo});function Uo(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=>Uo(t))}]`:`[${e}]`:ArrayBuffer.isView(e)?`[${e}]`:JSON.stringify(e,(t,r)=>typeof r=="bigint"?`${r}`:r)}var fA={};Ir(fA,{BN:()=>Vm,bigNumToBigInt:()=>uk,bigNumToString:()=>Ld,isArrowBigNumSymbol:()=>ck});var ck=Symbol.for("isArrowBigNum");function Po(e,...t){return t.length===0?Object.setPrototypeOf(te(this.TypedArray,e),this.constructor.prototype):Object.setPrototypeOf(new this.TypedArray(e,...t),this.constructor.prototype)}Po.prototype[ck]=!0;Po.prototype.toJSON=function(){return`"${Ld(this)}"`};Po.prototype.valueOf=function(){return lk(this)};Po.prototype.toString=function(){return Ld(this)};Po.prototype[Symbol.toPrimitive]=function(e="default"){switch(e){case"number":return lk(this);case"string":return Ld(this);case"default":return uk(this)}return Ld(this)};function Nd(...e){return Po.apply(this,e)}function Fd(...e){return Po.apply(this,e)}function zm(...e){return Po.apply(this,e)}Object.setPrototypeOf(Nd.prototype,Object.create(Int32Array.prototype));Object.setPrototypeOf(Fd.prototype,Object.create(Uint32Array.prototype));Object.setPrototypeOf(zm.prototype,Object.create(Uint32Array.prototype));Object.assign(Nd.prototype,Po.prototype,{constructor:Nd,signed:!0,TypedArray:Int32Array,BigIntArray:BigInt64Array});Object.assign(Fd.prototype,Po.prototype,{constructor:Fd,signed:!1,TypedArray:Uint32Array,BigIntArray:BigUint64Array});Object.assign(zm.prototype,Po.prototype,{constructor:zm,signed:!0,TypedArray:Uint32Array,BigIntArray:BigUint64Array});function lk(e){let{buffer:t,byteOffset:r,length:n,signed:i}=e,o=new BigUint64Array(t,r,n),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 Ld=e=>{if(e.byteLength===8)return`${new e.BigIntArray(e.buffer,e.byteOffset,1)[0]}`;if(!e.signed)return uA(e);let t=new Uint16Array(e.buffer,e.byteOffset,e.byteLength/2);if(new Int16Array([t.at(-1)])[0]>=0)return uA(e);t=t.slice();let n=1;for(let o=0;o<t.length;o++){let s=t[o],a=~s+n;t[o]=a,n&=s===0?1:0}return`-${uA(t)}`},uk=e=>e.byteLength===8?new e.BigIntArray(e.buffer,e.byteOffset,1)[0]:Ld(e);function uA(e){let t="",r=new Uint32Array(2),n=new Uint16Array(e.buffer,e.byteOffset,e.byteLength/2),i=new Uint32Array((n=new Uint16Array(n).reverse()).buffer),o=-1,s=n.length-1;do{for(r[0]=n[o=0];o<s;)n[o++]=r[1]=r[0]/10,r[0]=(r[0]-r[1]*10<<16)+n[o];n[o]=r[1]=r[0]/10,r[0]=r[0]-r[1]*10,t=`${r[0]}${t}`}while(i[0]||i[1]||i[2]||i[3]);return t??"0"}var Vm=class e{static new(t,r){switch(r){case!0:return new Nd(t);case!1:return new Fd(t)}switch(t.constructor){case Int8Array:case Int16Array:case Int32Array:case BigInt64Array:return new Nd(t)}return t.byteLength===16?new zm(t):new Fd(t)}static signed(t){return new Nd(t)}static unsigned(t){return new Fd(t)}static decimal(t){return new zm(t)}constructor(t,r){return e.new(t,r)}};function or(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 fk,dk,hk,pk,mk,yk,gk,bk,xk,_k,wk,vk,Sk,Ik,Tk,Ak,Mk,Ek,Dk,Bk,Ok,Nk,lt=class e{static isNull(t){return t?.typeId===F.Null}static isInt(t){return t?.typeId===F.Int}static isFloat(t){return t?.typeId===F.Float}static isBinary(t){return t?.typeId===F.Binary}static isLargeBinary(t){return t?.typeId===F.LargeBinary}static isUtf8(t){return t?.typeId===F.Utf8}static isLargeUtf8(t){return t?.typeId===F.LargeUtf8}static isBool(t){return t?.typeId===F.Bool}static isDecimal(t){return t?.typeId===F.Decimal}static isDate(t){return t?.typeId===F.Date}static isTime(t){return t?.typeId===F.Time}static isTimestamp(t){return t?.typeId===F.Timestamp}static isInterval(t){return t?.typeId===F.Interval}static isDuration(t){return t?.typeId===F.Duration}static isList(t){return t?.typeId===F.List}static isStruct(t){return t?.typeId===F.Struct}static isUnion(t){return t?.typeId===F.Union}static isFixedSizeBinary(t){return t?.typeId===F.FixedSizeBinary}static isFixedSizeList(t){return t?.typeId===F.FixedSizeList}static isMap(t){return t?.typeId===F.Map}static isDictionary(t){return t?.typeId===F.Dictionary}static isDenseUnion(t){return e.isUnion(t)&&t.mode===Ue.Dense}static isSparseUnion(t){return e.isUnion(t)&&t.mode===Ue.Sparse}constructor(t){this.typeId=t}};fk=Symbol.toStringTag;lt[fk]=(e=>(e.children=null,e.ArrayType=Array,e.OffsetArrayType=Int32Array,e[Symbol.toStringTag]="DataType"))(lt.prototype);var Un=class extends lt{constructor(){super(F.Null)}toString(){return"Null"}};dk=Symbol.toStringTag;Un[dk]=(e=>e[Symbol.toStringTag]="Null")(Un.prototype);var br=class extends lt{constructor(t,r){super(F.Int),this.isSigned=t,this.bitWidth=r}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}`}};hk=Symbol.toStringTag;br[hk]=(e=>(e.isSigned=null,e.bitWidth=null,e[Symbol.toStringTag]="Int"))(br.prototype);var e_=class extends br{constructor(){super(!0,8)}get ArrayType(){return Int8Array}},r_=class extends br{constructor(){super(!0,16)}get ArrayType(){return Int16Array}},Ds=class extends br{constructor(){super(!0,32)}get ArrayType(){return Int32Array}},n_=class extends br{constructor(){super(!0,64)}get ArrayType(){return BigInt64Array}},i_=class extends br{constructor(){super(!1,8)}get ArrayType(){return Uint8Array}},o_=class extends br{constructor(){super(!1,16)}get ArrayType(){return Uint16Array}},s_=class extends br{constructor(){super(!1,32)}get ArrayType(){return Uint32Array}},a_=class extends br{constructor(){super(!1,64)}get ArrayType(){return BigUint64Array}};Object.defineProperty(e_.prototype,"ArrayType",{value:Int8Array});Object.defineProperty(r_.prototype,"ArrayType",{value:Int16Array});Object.defineProperty(Ds.prototype,"ArrayType",{value:Int32Array});Object.defineProperty(n_.prototype,"ArrayType",{value:BigInt64Array});Object.defineProperty(i_.prototype,"ArrayType",{value:Uint8Array});Object.defineProperty(o_.prototype,"ArrayType",{value:Uint16Array});Object.defineProperty(s_.prototype,"ArrayType",{value:Uint32Array});Object.defineProperty(a_.prototype,"ArrayType",{value:BigUint64Array});var li=class extends lt{constructor(t){super(F.Float),this.precision=t}get ArrayType(){switch(this.precision){case Le.HALF:return Uint16Array;case Le.SINGLE:return Float32Array;case Le.DOUBLE:return Float64Array}throw new Error(`Unrecognized ${this[Symbol.toStringTag]} type`)}toString(){return`Float${this.precision<<5||16}`}};pk=Symbol.toStringTag;li[pk]=(e=>(e.precision=null,e[Symbol.toStringTag]="Float"))(li.prototype);var c_=class extends li{constructor(){super(Le.HALF)}},l_=class extends li{constructor(){super(Le.SINGLE)}},u_=class extends li{constructor(){super(Le.DOUBLE)}};Object.defineProperty(c_.prototype,"ArrayType",{value:Uint16Array});Object.defineProperty(l_.prototype,"ArrayType",{value:Float32Array});Object.defineProperty(u_.prototype,"ArrayType",{value:Float64Array});var Fa=class extends lt{constructor(){super(F.Binary)}toString(){return"Binary"}};mk=Symbol.toStringTag;Fa[mk]=(e=>(e.ArrayType=Uint8Array,e[Symbol.toStringTag]="Binary"))(Fa.prototype);var La=class extends lt{constructor(){super(F.LargeBinary)}toString(){return"LargeBinary"}};yk=Symbol.toStringTag;La[yk]=(e=>(e.ArrayType=Uint8Array,e.OffsetArrayType=BigInt64Array,e[Symbol.toStringTag]="LargeBinary"))(La.prototype);var Ra=class extends lt{constructor(){super(F.Utf8)}toString(){return"Utf8"}};gk=Symbol.toStringTag;Ra[gk]=(e=>(e.ArrayType=Uint8Array,e[Symbol.toStringTag]="Utf8"))(Ra.prototype);var ka=class extends lt{constructor(){super(F.LargeUtf8)}toString(){return"LargeUtf8"}};bk=Symbol.toStringTag;ka[bk]=(e=>(e.ArrayType=Uint8Array,e.OffsetArrayType=BigInt64Array,e[Symbol.toStringTag]="LargeUtf8"))(ka.prototype);var Ca=class extends lt{constructor(){super(F.Bool)}toString(){return"Bool"}};xk=Symbol.toStringTag;Ca[xk]=(e=>(e.ArrayType=Uint8Array,e[Symbol.toStringTag]="Bool"))(Ca.prototype);var Ua=class extends lt{constructor(t,r,n=128){super(F.Decimal),this.scale=t,this.precision=r,this.bitWidth=n}toString(){return`Decimal[${this.precision}e${this.scale>0?"+":""}${this.scale}]`}};_k=Symbol.toStringTag;Ua[_k]=(e=>(e.scale=null,e.precision=null,e.ArrayType=Uint32Array,e[Symbol.toStringTag]="Decimal"))(Ua.prototype);var Pa=class extends lt{constructor(t){super(F.Date),this.unit=t}toString(){return`Date${(this.unit+1)*32}<${Tr[this.unit]}>`}};wk=Symbol.toStringTag;Pa[wk]=(e=>(e.unit=null,e.ArrayType=Int32Array,e[Symbol.toStringTag]="Date"))(Pa.prototype);var $o=class extends lt{constructor(t,r){super(F.Time),this.unit=t,this.bitWidth=r}toString(){return`Time${this.bitWidth}<${ft[this.unit]}>`}get ArrayType(){switch(this.bitWidth){case 32:return Int32Array;case 64:return BigInt64Array}throw new Error(`Unrecognized ${this[Symbol.toStringTag]} type`)}};vk=Symbol.toStringTag;$o[vk]=(e=>(e.unit=null,e.bitWidth=null,e[Symbol.toStringTag]="Time"))($o.prototype);var $a=class extends lt{constructor(t,r){super(F.Timestamp),this.unit=t,this.timezone=r}toString(){return`Timestamp<${ft[this.unit]}${this.timezone?`, ${this.timezone}`:""}>`}};Sk=Symbol.toStringTag;$a[Sk]=(e=>(e.unit=null,e.timezone=null,e.ArrayType=Int32Array,e[Symbol.toStringTag]="Timestamp"))($a.prototype);var za=class extends lt{constructor(t){super(F.Interval),this.unit=t}toString(){return`Interval<${Wr[this.unit]}>`}};Ik=Symbol.toStringTag;za[Ik]=(e=>(e.unit=null,e.ArrayType=Int32Array,e[Symbol.toStringTag]="Interval"))(za.prototype);var Va=class extends lt{constructor(t){super(F.Duration),this.unit=t}toString(){return`Duration<${ft[this.unit]}>`}};Tk=Symbol.toStringTag;Va[Tk]=(e=>(e.unit=null,e.ArrayType=BigInt64Array,e[Symbol.toStringTag]="Duration"))(Va.prototype);var zo=class extends lt{constructor(t){super(F.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}};Ak=Symbol.toStringTag;zo[Ak]=(e=>(e.children=null,e[Symbol.toStringTag]="List"))(zo.prototype);var ze=class extends lt{constructor(t){super(F.Struct),this.children=t}toString(){return`Struct<{${this.children.map(t=>`${t.name}:${t.type}`).join(", ")}}>`}};Mk=Symbol.toStringTag;ze[Mk]=(e=>(e.children=null,e[Symbol.toStringTag]="Struct"))(ze.prototype);var Vo=class extends lt{constructor(t,r,n){super(F.Union),this.mode=t,this.children=n,this.typeIds=r=Int32Array.from(r),this.typeIdToChildIndex=r.reduce((i,o,s)=>(i[o]=s)&&i||i,Object.create(null))}toString(){return`${this[Symbol.toStringTag]}<${this.children.map(t=>`${t.type}`).join(" | ")}>`}};Ek=Symbol.toStringTag;Vo[Ek]=(e=>(e.mode=null,e.typeIds=null,e.children=null,e.typeIdToChildIndex=null,e.ArrayType=Int8Array,e[Symbol.toStringTag]="Union"))(Vo.prototype);var ja=class extends lt{constructor(t){super(F.FixedSizeBinary),this.byteWidth=t}toString(){return`FixedSizeBinary[${this.byteWidth}]`}};Dk=Symbol.toStringTag;ja[Dk]=(e=>(e.byteWidth=null,e.ArrayType=Uint8Array,e[Symbol.toStringTag]="FixedSizeBinary"))(ja.prototype);var jo=class extends lt{constructor(t,r){super(F.FixedSizeList),this.listSize=t,this.children=[r]}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}>`}};Bk=Symbol.toStringTag;jo[Bk]=(e=>(e.children=null,e.listSize=null,e[Symbol.toStringTag]="FixedSizeList"))(jo.prototype);var qo=class extends lt{constructor(t,r=!1){var n,i,o;if(super(F.Map),this.children=[t],this.keysSorted=r,t&&(t.name="entries",!((n=t?.type)===null||n===void 0)&&n.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(", ")}}>`}};Ok=Symbol.toStringTag;qo[Ok]=(e=>(e.children=null,e.keysSorted=null,e[Symbol.toStringTag]="Map_"))(qo.prototype);var VX=(e=>()=>++e)(-1),Di=class extends lt{constructor(t,r,n,i){super(F.Dictionary),this.indices=r,this.dictionary=t,this.isOrdered=i||!1,this.id=n==null?VX():or(n)}get children(){return this.dictionary.children}get valueType(){return this.dictionary}get ArrayType(){return this.dictionary.ArrayType}toString(){return`Dictionary<${this.indices}, ${this.dictionary}>`}};Nk=Symbol.toStringTag;Di[Nk]=(e=>(e.id=null,e.indices=null,e.isOrdered=null,e.dictionary=null,e[Symbol.toStringTag]="Dictionary"))(Di.prototype);function Bi(e){let t=e;switch(e.typeId){case F.Decimal:return e.bitWidth/32;case F.Timestamp:return 2;case F.Date:return 1+t.unit;case F.Interval:return 1+t.unit;case F.FixedSizeList:return t.listSize;case F.FixedSizeBinary:return t.byteWidth;default:return 1}}var xt=class{visitMany(t,...r){return t.map((n,i)=>this.visit(n,...r.map(o=>o[i])))}visit(...t){return this.getVisitFn(t[0],!1).apply(this,t)}getVisitFn(t,r=!0){return jX(this,t,r)}getVisitFnByTypeId(t,r=!0){return Rd(this,t,r)}visitNull(t,...r){return null}visitBool(t,...r){return null}visitInt(t,...r){return null}visitFloat(t,...r){return null}visitUtf8(t,...r){return null}visitLargeUtf8(t,...r){return null}visitBinary(t,...r){return null}visitLargeBinary(t,...r){return null}visitFixedSizeBinary(t,...r){return null}visitDate(t,...r){return null}visitTimestamp(t,...r){return null}visitTime(t,...r){return null}visitDecimal(t,...r){return null}visitList(t,...r){return null}visitStruct(t,...r){return null}visitUnion(t,...r){return null}visitDictionary(t,...r){return null}visitInterval(t,...r){return null}visitDuration(t,...r){return null}visitFixedSizeList(t,...r){return null}visitMap(t,...r){return null}};function jX(e,t,r=!0){return typeof t=="number"?Rd(e,t,r):typeof t=="string"&&t in F?Rd(e,F[t],r):t&&t instanceof lt?Rd(e,Fk(t),r):t?.type&&t.type instanceof lt?Rd(e,Fk(t.type),r):Rd(e,F.NONE,r)}function Rd(e,t,r=!0){let n=null;switch(t){case F.Null:n=e.visitNull;break;case F.Bool:n=e.visitBool;break;case F.Int:n=e.visitInt;break;case F.Int8:n=e.visitInt8||e.visitInt;break;case F.Int16:n=e.visitInt16||e.visitInt;break;case F.Int32:n=e.visitInt32||e.visitInt;break;case F.Int64:n=e.visitInt64||e.visitInt;break;case F.Uint8:n=e.visitUint8||e.visitInt;break;case F.Uint16:n=e.visitUint16||e.visitInt;break;case F.Uint32:n=e.visitUint32||e.visitInt;break;case F.Uint64:n=e.visitUint64||e.visitInt;break;case F.Float:n=e.visitFloat;break;case F.Float16:n=e.visitFloat16||e.visitFloat;break;case F.Float32:n=e.visitFloat32||e.visitFloat;break;case F.Float64:n=e.visitFloat64||e.visitFloat;break;case F.Utf8:n=e.visitUtf8;break;case F.LargeUtf8:n=e.visitLargeUtf8;break;case F.Binary:n=e.visitBinary;break;case F.LargeBinary:n=e.visitLargeBinary;break;case F.FixedSizeBinary:n=e.visitFixedSizeBinary;break;case F.Date:n=e.visitDate;break;case F.DateDay:n=e.visitDateDay||e.visitDate;break;case F.DateMillisecond:n=e.visitDateMillisecond||e.visitDate;break;case F.Timestamp:n=e.visitTimestamp;break;case F.TimestampSecond:n=e.visitTimestampSecond||e.visitTimestamp;break;case F.TimestampMillisecond:n=e.visitTimestampMillisecond||e.visitTimestamp;break;case F.TimestampMicrosecond:n=e.visitTimestampMicrosecond||e.visitTimestamp;break;case F.TimestampNanosecond:n=e.visitTimestampNanosecond||e.visitTimestamp;break;case F.Time:n=e.visitTime;break;case F.TimeSecond:n=e.visitTimeSecond||e.visitTime;break;case F.TimeMillisecond:n=e.visitTimeMillisecond||e.visitTime;break;case F.TimeMicrosecond:n=e.visitTimeMicrosecond||e.visitTime;break;case F.TimeNanosecond:n=e.visitTimeNanosecond||e.visitTime;break;case F.Decimal:n=e.visitDecimal;break;case F.List:n=e.visitList;break;case F.Struct:n=e.visitStruct;break;case F.Union:n=e.visitUnion;break;case F.DenseUnion:n=e.visitDenseUnion||e.visitUnion;break;case F.SparseUnion:n=e.visitSparseUnion||e.visitUnion;break;case F.Dictionary:n=e.visitDictionary;break;case F.Interval:n=e.visitInterval;break;case F.IntervalDayTime:n=e.visitIntervalDayTime||e.visitInterval;break;case F.IntervalYearMonth:n=e.visitIntervalYearMonth||e.visitInterval;break;case F.Duration:n=e.visitDuration;break;case F.DurationSecond:n=e.visitDurationSecond||e.visitDuration;break;case F.DurationMillisecond:n=e.visitDurationMillisecond||e.visitDuration;break;case F.DurationMicrosecond:n=e.visitDurationMicrosecond||e.visitDuration;break;case F.DurationNanosecond:n=e.visitDurationNanosecond||e.visitDuration;break;case F.FixedSizeList:n=e.visitFixedSizeList;break;case F.Map:n=e.visitMap;break}if(typeof n=="function")return n;if(!r)return()=>null;throw new Error(`Unrecognized type '${F[t]}'`)}function Fk(e){switch(e.typeId){case F.Null:return F.Null;case F.Int:{let{bitWidth:t,isSigned:r}=e;switch(t){case 8:return r?F.Int8:F.Uint8;case 16:return r?F.Int16:F.Uint16;case 32:return r?F.Int32:F.Uint32;case 64:return r?F.Int64:F.Uint64}return F.Int}case F.Float:switch(e.precision){case Le.HALF:return F.Float16;case Le.SINGLE:return F.Float32;case Le.DOUBLE:return F.Float64}return F.Float;case F.Binary:return F.Binary;case F.LargeBinary:return F.LargeBinary;case F.Utf8:return F.Utf8;case F.LargeUtf8:return F.LargeUtf8;case F.Bool:return F.Bool;case F.Decimal:return F.Decimal;case F.Time:switch(e.unit){case ft.SECOND:return F.TimeSecond;case ft.MILLISECOND:return F.TimeMillisecond;case ft.MICROSECOND:return F.TimeMicrosecond;case ft.NANOSECOND:return F.TimeNanosecond}return F.Time;case F.Timestamp:switch(e.unit){case ft.SECOND:return F.TimestampSecond;case ft.MILLISECOND:return F.TimestampMillisecond;case ft.MICROSECOND:return F.TimestampMicrosecond;case ft.NANOSECOND:return F.TimestampNanosecond}return F.Timestamp;case F.Date:switch(e.unit){case Tr.DAY:return F.DateDay;case Tr.MILLISECOND:return F.DateMillisecond}return F.Date;case F.Interval:switch(e.unit){case Wr.DAY_TIME:return F.IntervalDayTime;case Wr.YEAR_MONTH:return F.IntervalYearMonth}return F.Interval;case F.Duration:switch(e.unit){case ft.SECOND:return F.DurationSecond;case ft.MILLISECOND:return F.DurationMillisecond;case ft.MICROSECOND:return F.DurationMicrosecond;case ft.NANOSECOND:return F.DurationNanosecond}return F.Duration;case F.Map:return F.Map;case F.List:return F.List;case F.Struct:return F.Struct;case F.Union:switch(e.mode){case Ue.Dense:return F.DenseUnion;case Ue.Sparse:return F.SparseUnion}return F.Union;case F.FixedSizeBinary:return F.FixedSizeBinary;case F.FixedSizeList:return F.FixedSizeList;case F.Dictionary:return F.Dictionary}throw new Error(`Unrecognized type '${F[e.typeId]}'`)}xt.prototype.visitInt8=null;xt.prototype.visitInt16=null;xt.prototype.visitInt32=null;xt.prototype.visitInt64=null;xt.prototype.visitUint8=null;xt.prototype.visitUint16=null;xt.prototype.visitUint32=null;xt.prototype.visitUint64=null;xt.prototype.visitFloat16=null;xt.prototype.visitFloat32=null;xt.prototype.visitFloat64=null;xt.prototype.visitDateDay=null;xt.prototype.visitDateMillisecond=null;xt.prototype.visitTimestampSecond=null;xt.prototype.visitTimestampMillisecond=null;xt.prototype.visitTimestampMicrosecond=null;xt.prototype.visitTimestampNanosecond=null;xt.prototype.visitTimeSecond=null;xt.prototype.visitTimeMillisecond=null;xt.prototype.visitTimeMicrosecond=null;xt.prototype.visitTimeNanosecond=null;xt.prototype.visitDenseUnion=null;xt.prototype.visitSparseUnion=null;xt.prototype.visitIntervalDayTime=null;xt.prototype.visitIntervalYearMonth=null;xt.prototype.visitDuration=null;xt.prototype.visitDurationSecond=null;xt.prototype.visitDurationMillisecond=null;xt.prototype.visitDurationMicrosecond=null;xt.prototype.visitDurationNanosecond=null;var dA={};Ir(dA,{float64ToUint16:()=>jm,uint16ToFloat64:()=>f_});var Lk=new Float64Array(1),kd=new Uint32Array(Lk.buffer);function f_(e){let t=(e&31744)>>10,r=(e&1023)/1024,n=Math.pow(-1,(e&32768)>>15);switch(t){case 31:return n*(r?Number.NaN:1/0);case 0:return n*(r?6103515625e-14*r:0)}return n*Math.pow(2,t-15)*(1+r)}function jm(e){if(e!==e)return 32256;Lk[0]=e;let t=(kd[1]&2147483648)>>16&65535,r=kd[1]&2146435072,n=0;return r>=1089470464?kd[0]>0?r=31744:(r=(r&2080374784)>>16,n=(kd[1]&1048575)>>10):r<=1056964608?(n=1048576+(kd[1]&1048575),n=1048576+(n<<(r>>20)-998)>>21,r=0):(r=r-1056964608>>10,n=(kd[1]&1048575)+512>>10),t|r|n&65535}var At=class extends xt{};function Ut(e){return(t,r,n)=>{if(t.setValid(r,n!=null))return e(t,r,n)}}var qX=(e,t,r)=>{e[t]=Math.trunc(r/864e5)},hA=(e,t,r)=>{e[t]=Math.trunc(r%4294967296),e[t+1]=Math.trunc(r/4294967296)},YX=(e,t,r)=>{e[t]=Math.trunc(r*1e3%4294967296),e[t+1]=Math.trunc(r*1e3/4294967296)},WX=(e,t,r)=>{e[t]=Math.trunc(r*1e6%4294967296),e[t+1]=Math.trunc(r*1e6/4294967296)},Rk=(e,t,r,n)=>{if(r+1<t.length){let i=or(t[r]),o=or(t[r+1]);e.set(n.subarray(0,o-i),i)}},GX=({offset:e,values:t},r,n)=>{let i=e+r;n?t[i>>3]|=1<<i%8:t[i>>3]&=~(1<<i%8)},qa=({values:e},t,r)=>{e[t]=r},pA=({values:e},t,r)=>{e[t]=r},kk=({values:e},t,r)=>{e[t]=jm(r)},XX=(e,t,r)=>{switch(e.type.precision){case Le.HALF:return kk(e,t,r);case Le.SINGLE:case Le.DOUBLE:return pA(e,t,r)}},d_=({values:e},t,r)=>{qX(e,t,r.valueOf())},h_=({values:e},t,r)=>{hA(e,t*2,r.valueOf())},mA=({stride:e,values:t},r,n)=>{t.set(n.subarray(0,e),e*r)},Ck=({values:e,valueOffsets:t},r,n)=>Rk(e,t,r,n),Uk=({values:e,valueOffsets:t},r,n)=>Rk(e,t,r,Is(n)),yA=(e,t,r)=>{e.type.unit===Tr.DAY?d_(e,t,r):h_(e,t,r)},p_=({values:e},t,r)=>hA(e,t*2,r/1e3),m_=({values:e},t,r)=>hA(e,t*2,r),y_=({values:e},t,r)=>YX(e,t*2,r),g_=({values:e},t,r)=>WX(e,t*2,r),gA=(e,t,r)=>{switch(e.type.unit){case ft.SECOND:return p_(e,t,r);case ft.MILLISECOND:return m_(e,t,r);case ft.MICROSECOND:return y_(e,t,r);case ft.NANOSECOND:return g_(e,t,r)}},b_=({values:e},t,r)=>{e[t]=r},x_=({values:e},t,r)=>{e[t]=r},__=({values:e},t,r)=>{e[t]=r},w_=({values:e},t,r)=>{e[t]=r},bA=(e,t,r)=>{switch(e.type.unit){case ft.SECOND:return b_(e,t,r);case ft.MILLISECOND:return x_(e,t,r);case ft.MICROSECOND:return __(e,t,r);case ft.NANOSECOND:return w_(e,t,r)}},xA=({values:e,stride:t},r,n)=>{e.set(n.subarray(0,t),t*r)},HX=(e,t,r)=>{let n=e.children[0],i=e.valueOffsets,o=sn.getVisitFn(n);if(Array.isArray(r))for(let s=-1,a=i[t],c=i[t+1];a<c;)o(n,a++,r[++s]);else for(let s=-1,a=i[t],c=i[t+1];a<c;)o(n,a++,r.get(++s))},ZX=(e,t,r)=>{let n=e.children[0],{valueOffsets:i}=e,o=sn.getVisitFn(n),{[t]:s,[t+1]:a}=i,c=r instanceof Map?r.entries():Object.entries(r);for(let l of c)if(o(n,s,l),++s>=a)break},KX=(e,t)=>(r,n,i,o)=>n&&r(n,e,t[o]),QX=(e,t)=>(r,n,i,o)=>n&&r(n,e,t.get(o)),JX=(e,t)=>(r,n,i,o)=>n&&r(n,e,t.get(i.name)),tH=(e,t)=>(r,n,i,o)=>n&&r(n,e,t[i.name]),eH=(e,t,r)=>{let n=e.type.children.map(o=>sn.getVisitFn(o.type)),i=r instanceof Map?JX(t,r):r instanceof le?QX(t,r):Array.isArray(r)?KX(t,r):tH(t,r);e.type.children.forEach((o,s)=>i(n[s],e.children[s],o,s))},rH=(e,t,r)=>{e.type.mode===Ue.Dense?Pk(e,t,r):$k(e,t,r)},Pk=(e,t,r)=>{let n=e.type.typeIdToChildIndex[e.typeIds[t]],i=e.children[n];sn.visit(i,e.valueOffsets[t],r)},$k=(e,t,r)=>{let n=e.type.typeIdToChildIndex[e.typeIds[t]],i=e.children[n];sn.visit(i,t,r)},nH=(e,t,r)=>{var n;(n=e.dictionary)===null||n===void 0||n.set(e.values[t],r)},_A=(e,t,r)=>{e.type.unit===Wr.DAY_TIME?v_(e,t,r):S_(e,t,r)},v_=({values:e},t,r)=>{e.set(r.subarray(0,2),2*t)},S_=({values:e},t,r)=>{e[t]=r[0]*12+r[1]%12},I_=({values:e},t,r)=>{e[t]=r},T_=({values:e},t,r)=>{e[t]=r},A_=({values:e},t,r)=>{e[t]=r},M_=({values:e},t,r)=>{e[t]=r},wA=(e,t,r)=>{switch(e.type.unit){case ft.SECOND:return I_(e,t,r);case ft.MILLISECOND:return T_(e,t,r);case ft.MICROSECOND:return A_(e,t,r);case ft.NANOSECOND:return M_(e,t,r)}},iH=(e,t,r)=>{let{stride:n}=e,i=e.children[0],o=sn.getVisitFn(i);if(Array.isArray(r))for(let s=-1,a=t*n;++s<n;)o(i,a+s,r[s]);else for(let s=-1,a=t*n;++s<n;)o(i,a+s,r.get(s))};At.prototype.visitBool=Ut(GX);At.prototype.visitInt=Ut(qa);At.prototype.visitInt8=Ut(qa);At.prototype.visitInt16=Ut(qa);At.prototype.visitInt32=Ut(qa);At.prototype.visitInt64=Ut(qa);At.prototype.visitUint8=Ut(qa);At.prototype.visitUint16=Ut(qa);At.prototype.visitUint32=Ut(qa);At.prototype.visitUint64=Ut(qa);At.prototype.visitFloat=Ut(XX);At.prototype.visitFloat16=Ut(kk);At.prototype.visitFloat32=Ut(pA);At.prototype.visitFloat64=Ut(pA);At.prototype.visitUtf8=Ut(Uk);At.prototype.visitLargeUtf8=Ut(Uk);At.prototype.visitBinary=Ut(Ck);At.prototype.visitLargeBinary=Ut(Ck);At.prototype.visitFixedSizeBinary=Ut(mA);At.prototype.visitDate=Ut(yA);At.prototype.visitDateDay=Ut(d_);At.prototype.visitDateMillisecond=Ut(h_);At.prototype.visitTimestamp=Ut(gA);At.prototype.visitTimestampSecond=Ut(p_);At.prototype.visitTimestampMillisecond=Ut(m_);At.prototype.visitTimestampMicrosecond=Ut(y_);At.prototype.visitTimestampNanosecond=Ut(g_);At.prototype.visitTime=Ut(bA);At.prototype.visitTimeSecond=Ut(b_);At.prototype.visitTimeMillisecond=Ut(x_);At.prototype.visitTimeMicrosecond=Ut(__);At.prototype.visitTimeNanosecond=Ut(w_);At.prototype.visitDecimal=Ut(xA);At.prototype.visitList=Ut(HX);At.prototype.visitStruct=Ut(eH);At.prototype.visitUnion=Ut(rH);At.prototype.visitDenseUnion=Ut(Pk);At.prototype.visitSparseUnion=Ut($k);At.prototype.visitDictionary=Ut(nH);At.prototype.visitInterval=Ut(_A);At.prototype.visitIntervalDayTime=Ut(v_);At.prototype.visitIntervalYearMonth=Ut(S_);At.prototype.visitDuration=Ut(wA);At.prototype.visitDurationSecond=Ut(I_);At.prototype.visitDurationMillisecond=Ut(T_);At.prototype.visitDurationMicrosecond=Ut(A_);At.prototype.visitDurationNanosecond=Ut(M_);At.prototype.visitFixedSizeList=Ut(iH);At.prototype.visitMap=Ut(ZX);var sn=new At;var Yo=Symbol.for("parent"),Cd=Symbol.for("rowIndex"),Il=class{constructor(t,r){return this[Yo]=t,this[Cd]=r,new Proxy(this,new SA)}toArray(){return Object.values(this.toJSON())}toJSON(){let t=this[Cd],r=this[Yo],n=r.type.children,i={};for(let o=-1,s=n.length;++o<s;)i[n[o].name]=Mr.visit(r.children[o],t);return i}toString(){return`{${[...this].map(([t,r])=>`${Uo(t)}: ${Uo(r)}`).join(", ")}}`}[Symbol.for("nodejs.util.inspect.custom")](){return this.toString()}[Symbol.iterator](){return new vA(this[Yo],this[Cd])}},vA=class{constructor(t,r){this.childIndex=0,this.children=t.children,this.rowIndex=r,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,Mr.visit(this.children[t],this.rowIndex)]}):{done:!0,value:null}}};Object.defineProperties(Il.prototype,{[Symbol.toStringTag]:{enumerable:!1,configurable:!1,value:"Row"},[Yo]:{writable:!0,enumerable:!1,configurable:!1,value:null},[Cd]:{writable:!0,enumerable:!1,configurable:!1,value:-1}});var SA=class{isExtensible(){return!1}deleteProperty(){return!1}preventExtensions(){return!0}ownKeys(t){return t[Yo].type.children.map(r=>r.name)}has(t,r){return t[Yo].type.children.findIndex(n=>n.name===r)!==-1}getOwnPropertyDescriptor(t,r){if(t[Yo].type.children.findIndex(n=>n.name===r)!==-1)return{writable:!0,enumerable:!0,configurable:!0}}get(t,r){if(Reflect.has(t,r))return t[r];let n=t[Yo].type.children.findIndex(i=>i.name===r);if(n!==-1){let i=Mr.visit(t[Yo].children[n],t[Cd]);return Reflect.set(t,r,i),i}}set(t,r,n){let i=t[Yo].type.children.findIndex(o=>o.name===r);return i!==-1?(sn.visit(t[Yo].children[i],t[Cd],n),Reflect.set(t,r,n)):Reflect.has(t,r)||typeof r=="symbol"?Reflect.set(t,r,n):!1}};var _t=class extends xt{};function Lt(e){return(t,r)=>t.getValid(r)?e(t,r):null}var oH=(e,t)=>864e5*e[t],IA=(e,t)=>4294967296*e[t+1]+(e[t]>>>0),sH=(e,t)=>4294967296*(e[t+1]/1e3)+(e[t]>>>0)/1e3,aH=(e,t)=>4294967296*(e[t+1]/1e6)+(e[t]>>>0)/1e6,zk=e=>new Date(e),cH=(e,t)=>zk(oH(e,t)),lH=(e,t)=>zk(IA(e,t)),uH=(e,t)=>null,Vk=(e,t,r)=>{if(r+1>=t.length)return null;let n=or(t[r]),i=or(t[r+1]);return e.subarray(n,i)},fH=({offset:e,values:t},r)=>{let n=e+r;return(t[n>>3]&1<<n%8)!==0},jk=({values:e},t)=>cH(e,t),qk=({values:e},t)=>lH(e,t*2),Tl=({stride:e,values:t},r)=>t[e*r],dH=({stride:e,values:t},r)=>f_(t[e*r]),Yk=({values:e},t)=>e[t],hH=({stride:e,values:t},r)=>t.subarray(e*r,e*(r+1)),Wk=({values:e,valueOffsets:t},r)=>Vk(e,t,r),Gk=({values:e,valueOffsets:t},r)=>{let n=Vk(e,t,r);return n!==null?Am(n):null},pH=({values:e},t)=>e[t],mH=({type:e,values:t},r)=>e.precision!==Le.HALF?t[r]:f_(t[r]),yH=(e,t)=>e.type.unit===Tr.DAY?jk(e,t):qk(e,t),Xk=({values:e},t)=>1e3*IA(e,t*2),Hk=({values:e},t)=>IA(e,t*2),Zk=({values:e},t)=>sH(e,t*2),Kk=({values:e},t)=>aH(e,t*2),gH=(e,t)=>{switch(e.type.unit){case ft.SECOND:return Xk(e,t);case ft.MILLISECOND:return Hk(e,t);case ft.MICROSECOND:return Zk(e,t);case ft.NANOSECOND:return Kk(e,t)}},Qk=({values:e},t)=>e[t],Jk=({values:e},t)=>e[t],tC=({values:e},t)=>e[t],eC=({values:e},t)=>e[t],bH=(e,t)=>{switch(e.type.unit){case ft.SECOND:return Qk(e,t);case ft.MILLISECOND:return Jk(e,t);case ft.MICROSECOND:return tC(e,t);case ft.NANOSECOND:return eC(e,t)}},xH=({values:e,stride:t},r)=>Vm.decimal(e.subarray(t*r,t*(r+1))),_H=(e,t)=>{let{valueOffsets:r,stride:n,children:i}=e,{[t*n]:o,[t*n+1]:s}=r,c=i[0].slice(o,s-o);return new le([c])},wH=(e,t)=>{let{valueOffsets:r,children:n}=e,{[t]:i,[t+1]:o}=r,s=n[0];return new Bs(s.slice(i,o-i))},vH=(e,t)=>new Il(e,t),SH=(e,t)=>e.type.mode===Ue.Dense?rC(e,t):nC(e,t),rC=(e,t)=>{let r=e.type.typeIdToChildIndex[e.typeIds[t]],n=e.children[r];return Mr.visit(n,e.valueOffsets[t])},nC=(e,t)=>{let r=e.type.typeIdToChildIndex[e.typeIds[t]],n=e.children[r];return Mr.visit(n,t)},IH=(e,t)=>{var r;return(r=e.dictionary)===null||r===void 0?void 0:r.get(e.values[t])},TH=(e,t)=>e.type.unit===Wr.DAY_TIME?iC(e,t):oC(e,t),iC=({values:e},t)=>e.subarray(2*t,2*(t+1)),oC=({values:e},t)=>{let r=e[t],n=new Int32Array(2);return n[0]=Math.trunc(r/12),n[1]=Math.trunc(r%12),n},sC=({values:e},t)=>e[t],aC=({values:e},t)=>e[t],cC=({values:e},t)=>e[t],lC=({values:e},t)=>e[t],AH=(e,t)=>{switch(e.type.unit){case ft.SECOND:return sC(e,t);case ft.MILLISECOND:return aC(e,t);case ft.MICROSECOND:return cC(e,t);case ft.NANOSECOND:return lC(e,t)}},MH=(e,t)=>{let{stride:r,children:n}=e,o=n[0].slice(t*r,r);return new le([o])};_t.prototype.visitNull=Lt(uH);_t.prototype.visitBool=Lt(fH);_t.prototype.visitInt=Lt(pH);_t.prototype.visitInt8=Lt(Tl);_t.prototype.visitInt16=Lt(Tl);_t.prototype.visitInt32=Lt(Tl);_t.prototype.visitInt64=Lt(Yk);_t.prototype.visitUint8=Lt(Tl);_t.prototype.visitUint16=Lt(Tl);_t.prototype.visitUint32=Lt(Tl);_t.prototype.visitUint64=Lt(Yk);_t.prototype.visitFloat=Lt(mH);_t.prototype.visitFloat16=Lt(dH);_t.prototype.visitFloat32=Lt(Tl);_t.prototype.visitFloat64=Lt(Tl);_t.prototype.visitUtf8=Lt(Gk);_t.prototype.visitLargeUtf8=Lt(Gk);_t.prototype.visitBinary=Lt(Wk);_t.prototype.visitLargeBinary=Lt(Wk);_t.prototype.visitFixedSizeBinary=Lt(hH);_t.prototype.visitDate=Lt(yH);_t.prototype.visitDateDay=Lt(jk);_t.prototype.visitDateMillisecond=Lt(qk);_t.prototype.visitTimestamp=Lt(gH);_t.prototype.visitTimestampSecond=Lt(Xk);_t.prototype.visitTimestampMillisecond=Lt(Hk);_t.prototype.visitTimestampMicrosecond=Lt(Zk);_t.prototype.visitTimestampNanosecond=Lt(Kk);_t.prototype.visitTime=Lt(bH);_t.prototype.visitTimeSecond=Lt(Qk);_t.prototype.visitTimeMillisecond=Lt(Jk);_t.prototype.visitTimeMicrosecond=Lt(tC);_t.prototype.visitTimeNanosecond=Lt(eC);_t.prototype.visitDecimal=Lt(xH);_t.prototype.visitList=Lt(_H);_t.prototype.visitStruct=Lt(vH);_t.prototype.visitUnion=Lt(SH);_t.prototype.visitDenseUnion=Lt(rC);_t.prototype.visitSparseUnion=Lt(nC);_t.prototype.visitDictionary=Lt(IH);_t.prototype.visitInterval=Lt(TH);_t.prototype.visitIntervalDayTime=Lt(iC);_t.prototype.visitIntervalYearMonth=Lt(oC);_t.prototype.visitDuration=Lt(AH);_t.prototype.visitDurationSecond=Lt(sC);_t.prototype.visitDurationMillisecond=Lt(aC);_t.prototype.visitDurationMicrosecond=Lt(cC);_t.prototype.visitDurationNanosecond=Lt(lC);_t.prototype.visitFixedSizeList=Lt(MH);_t.prototype.visitMap=Lt(wH);var Mr=new _t;var ro=Symbol.for("keys"),Ud=Symbol.for("vals"),Bs=class{constructor(t){return this[ro]=new le([t.children[0]]).memoize(),this[Ud]=t.children[1],new Proxy(this,new AA)}[Symbol.iterator](){return new TA(this[ro],this[Ud])}get size(){return this[ro].length}toArray(){return Object.values(this.toJSON())}toJSON(){let t=this[ro],r=this[Ud],n={};for(let i=-1,o=t.length;++i<o;)n[t.get(i)]=Mr.visit(r,i);return n}toString(){return`{${[...this].map(([t,r])=>`${Uo(t)}: ${Uo(r)}`).join(", ")}}`}[Symbol.for("nodejs.util.inspect.custom")](){return this.toString()}},TA=class{constructor(t,r){this.keys=t,this.vals=r,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),Mr.visit(this.vals,t)]})}},AA=class{isExtensible(){return!1}deleteProperty(){return!1}preventExtensions(){return!0}ownKeys(t){return t[ro].toArray().map(String)}has(t,r){return t[ro].includes(r)}getOwnPropertyDescriptor(t,r){if(t[ro].indexOf(r)!==-1)return{writable:!0,enumerable:!0,configurable:!0}}get(t,r){if(Reflect.has(t,r))return t[r];let n=t[ro].indexOf(r);if(n!==-1){let i=Mr.visit(Reflect.get(t,Ud),n);return Reflect.set(t,r,i),i}}set(t,r,n){let i=t[ro].indexOf(r);return i!==-1?(sn.visit(Reflect.get(t,Ud),i,n),Reflect.set(t,r,n)):Reflect.has(t,r)?Reflect.set(t,r,n):!1}};Object.defineProperties(Bs.prototype,{[Symbol.toStringTag]:{enumerable:!1,configurable:!1,value:"Row"},[ro]:{writable:!0,enumerable:!1,configurable:!1,value:null},[Ud]:{writable:!0,enumerable:!1,configurable:!1,value:null}});function EH(e,t,r){let n=e.length,i=t>-1?t:n+t%n;return r?r(e,i):i}var uC;function qm(e,t,r,n){let{length:i=0}=e,o=typeof t!="number"?0:t,s=typeof r!="number"?i:r;return o<0&&(o=(o%i+i)%i),s<0&&(s=(s%i+i)%i),s<o&&(uC=o,o=s,s=uC),s>i&&(s=i),n?n(e,o,s):[o,s]}var fC=e=>e!==e;function Al(e){if(typeof e!=="object"||e===null)return fC(e)?fC:r=>r===e;if(e instanceof Date){let r=e.valueOf();return n=>n instanceof Date?n.valueOf()===r:!1}return ArrayBuffer.isView(e)?r=>r?oA(e,r):!1:e instanceof Map?BH(e):Array.isArray(e)?DH(e):e instanceof le?OH(e):NH(e,!0)}function DH(e){let t=[];for(let r=-1,n=e.length;++r<n;)t[r]=Al(e[r]);return E_(t)}function BH(e){let t=-1,r=[];for(let n of e.values())r[++t]=Al(n);return E_(r)}function OH(e){let t=[];for(let r=-1,n=e.length;++r<n;)t[r]=Al(e.get(r));return E_(t)}function NH(e,t=!1){let r=Object.keys(e);if(!t&&r.length===0)return()=>!1;let n=[];for(let i=-1,o=r.length;++i<o;)n[i]=Al(e[r[i]]);return E_(n,r)}function E_(e,t){return r=>{if(!r||typeof r!="object")return!1;switch(r.constructor){case Array:return FH(e,r);case Map:return dC(e,r,r.keys());case Bs:case Il:case Object:case void 0:return dC(e,r,t||Object.keys(r))}return r instanceof le?LH(e,r):!1}}function FH(e,t){let r=e.length;if(t.length!==r)return!1;for(let n=-1;++n<r;)if(!e[n](t[n]))return!1;return!0}function LH(e,t){let r=e.length;if(t.length!==r)return!1;for(let n=-1;++n<r;)if(!e[n](t.get(n)))return!1;return!0}function dC(e,t,r){let n=r[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=n.next(),u=i.next();for(;s<a&&!l.done&&!u.done&&!c.done&&!(l.value!==u.value||!e[s](c.value));++s,l=n.next(),u=i.next(),c=o.next());return s===a&&l.done&&u.done&&c.done?!0:(n.return&&n.return(),i.return&&i.return(),o.return&&o.return(),!1)}var EA={};Ir(EA,{BitIterator:()=>ju,getBit:()=>hC,getBool:()=>B_,packBools:()=>Yu,popcnt_array:()=>pC,popcnt_bit_range:()=>Ym,popcnt_uint32:()=>D_,setBool:()=>RH,truncateBitmap:()=>qu});function B_(e,t,r,n){return(r&1<<n)!==0}function hC(e,t,r,n){return(r&1<<n)>>n}function RH(e,t,r){return r?!!(e[t>>3]|=1<<t%8)||!0:!(e[t>>3]&=~(1<<t%8))&&!1}function qu(e,t,r){let n=r.byteLength+7&-8;if(e>0||r.byteLength<n){let i=new Uint8Array(n);return i.set(e%8===0?r.subarray(e>>3):Yu(new ju(r,e,t,null,B_)).subarray(0,n)),i}return r}function Yu(e){let t=[],r=0,n=0,i=0;for(let s of e)s&&(i|=1<<n),++n===8&&(t[r++]=i,i=n=0);(r===0||n>0)&&(t[r++]=i);let o=new Uint8Array(t.length+7&-8);return o.set(t),o}var ju=class{constructor(t,r,n,i,o){this.bytes=t,this.length=n,this.context=i,this.get=o,this.bit=r%8,this.byteIndex=r>>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 Ym(e,t,r){if(r-t<=0)return 0;if(r-t<8){let o=0;for(let s of new ju(e,t,r-t,e,hC))o+=s;return o}let n=r>>3<<3,i=t+(t%8===0?0:8-t%8);return Ym(e,t,i)+Ym(e,n,r)+pC(e,i>>3,n-i>>3)}function pC(e,t,r){let n=0,i=Math.trunc(t),o=new DataView(e.buffer,e.byteOffset,e.byteLength),s=r===void 0?e.byteLength:i+r;for(;s-i>=4;)n+=D_(o.getUint32(i)),i+=4;for(;s-i>=2;)n+=D_(o.getUint16(i)),i+=2;for(;s-i>=1;)n+=D_(o.getUint8(i)),i+=1;return n}function D_(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 kH=-1,_e=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 lt.isSparseUnion(t)?this.children.some(r=>r.nullable):lt.isDenseUnion(t)?this.children.some(r=>r.nullable):this.nullBitmap&&this.nullBitmap.byteLength>0}return!0}get byteLength(){let t=0,{valueOffsets:r,values:n,nullBitmap:i,typeIds:o}=this;return r&&(t+=r.byteLength),n&&(t+=n.byteLength),i&&(t+=i.byteLength),o&&(t+=o.byteLength),this.children.reduce((s,a)=>s+a.byteLength,t)}get nullCount(){if(lt.isUnion(this.type))return this.children.reduce((n,i)=>n+i.nullCount,0);let t=this._nullCount,r;return t<=kH&&(r=this.nullBitmap)&&(this._nullCount=t=this.length-Ym(r,this.offset,this.offset+this.length)),t}constructor(t,r,n,i,o,s=[],a){this.type=t,this.children=s,this.dictionary=a,this.offset=Math.floor(Math.max(r||0,0)),this.length=Math.floor(Math.max(n||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=Bi(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:r}=this;if(lt.isUnion(r)){let n=r,i=this.children[n.typeIdToChildIndex[this.typeIds[t]]],o=n.mode===Ue.Dense?this.valueOffsets[t]:t;return i.getValid(o)}if(this.nullable&&this.nullCount>0){let n=this.offset+t;return(this.nullBitmap[n>>3]&1<<n%8)!==0}return!0}setValid(t,r){let n,{type:i}=this;if(lt.isUnion(i)){let o=i,s=this.children[o.typeIdToChildIndex[this.typeIds[t]]],a=o.mode===Ue.Dense?this.valueOffsets[t]:t;n=s.getValid(a),s.setValid(a,r)}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(qu(s,a,this.nullBitmap),0),Object.assign(this,{nullBitmap:o,_nullCount:-1}));let f=o[u];n=(f&l)!==0,r?o[u]=f|l:o[u]=f&~l}return n!==!!r&&(this._nullCount=this.nullCount+(r?-1:1)),r}clone(t=this.type,r=this.offset,n=this.length,i=this._nullCount,o=this,s=this.children){return new e(t,r,n,i,o,s,this.dictionary)}slice(t,r){let{stride:n,typeId:i,children:o}=this,s=+(this._nullCount===0)-1,a=i===16?n:1,c=this._sliceBuffers(t,r,n,i);return this.clone(this.type,this.offset+t,r,s,c,o.length===0||this.valueOffsets?o:this._sliceChildren(o,a*t,a*r))}_changeLengthAndBackfillNullBitmap(t){if(this.typeId===F.Null)return this.clone(this.type,0,t,0);let{length:r,nullCount:n}=this,i=new Uint8Array((t+63&-64)>>3).fill(255,0,r>>3);i[r>>3]=(1<<r-(r&-8))-1,n>0&&i.set(qu(this.offset,r,this.nullBitmap),0);let o=this.buffers;return o[Co.VALIDITY]=i,this.clone(this.type,0,t,n+(t-r),o)}_sliceBuffers(t,r,n,i){let o,{buffers:s}=this;return(o=s[Co.TYPE])&&(s[Co.TYPE]=o.subarray(t,t+r)),(o=s[Co.OFFSET])&&(s[Co.OFFSET]=o.subarray(t,t+r+1))||(o=s[Co.DATA])&&(s[Co.DATA]=i===6?o:o.subarray(n*t,n*(t+r))),s}_sliceChildren(t,r,n){return t.map(i=>i.slice(r,n))}};_e.prototype.children=Object.freeze([]);var DA=class e extends xt{visit(t){return this.getVisitFn(t.type).call(this,t)}visitNull(t){let{["type"]:r,["offset"]:n=0,["length"]:i=0}=t;return new _e(r,n,i,i)}visitBool(t){let{["type"]:r,["offset"]:n=0}=t,i=Et(t.nullBitmap),o=te(r.ArrayType,t.data),{["length"]:s=o.length>>3,["nullCount"]:a=t.nullBitmap?-1:0}=t;return new _e(r,n,s,a,[void 0,o,i])}visitInt(t){let{["type"]:r,["offset"]:n=0}=t,i=Et(t.nullBitmap),o=te(r.ArrayType,t.data),{["length"]:s=o.length,["nullCount"]:a=t.nullBitmap?-1:0}=t;return new _e(r,n,s,a,[void 0,o,i])}visitFloat(t){let{["type"]:r,["offset"]:n=0}=t,i=Et(t.nullBitmap),o=te(r.ArrayType,t.data),{["length"]:s=o.length,["nullCount"]:a=t.nullBitmap?-1:0}=t;return new _e(r,n,s,a,[void 0,o,i])}visitUtf8(t){let{["type"]:r,["offset"]:n=0}=t,i=Et(t.data),o=Et(t.nullBitmap),s=Vu(t.valueOffsets),{["length"]:a=s.length-1,["nullCount"]:c=t.nullBitmap?-1:0}=t;return new _e(r,n,a,c,[s,i,o])}visitLargeUtf8(t){let{["type"]:r,["offset"]:n=0}=t,i=Et(t.data),o=Et(t.nullBitmap),s=Xx(t.valueOffsets),{["length"]:a=s.length-1,["nullCount"]:c=t.nullBitmap?-1:0}=t;return new _e(r,n,a,c,[s,i,o])}visitBinary(t){let{["type"]:r,["offset"]:n=0}=t,i=Et(t.data),o=Et(t.nullBitmap),s=Vu(t.valueOffsets),{["length"]:a=s.length-1,["nullCount"]:c=t.nullBitmap?-1:0}=t;return new _e(r,n,a,c,[s,i,o])}visitLargeBinary(t){let{["type"]:r,["offset"]:n=0}=t,i=Et(t.data),o=Et(t.nullBitmap),s=Xx(t.valueOffsets),{["length"]:a=s.length-1,["nullCount"]:c=t.nullBitmap?-1:0}=t;return new _e(r,n,a,c,[s,i,o])}visitFixedSizeBinary(t){let{["type"]:r,["offset"]:n=0}=t,i=Et(t.nullBitmap),o=te(r.ArrayType,t.data),{["length"]:s=o.length/Bi(r),["nullCount"]:a=t.nullBitmap?-1:0}=t;return new _e(r,n,s,a,[void 0,o,i])}visitDate(t){let{["type"]:r,["offset"]:n=0}=t,i=Et(t.nullBitmap),o=te(r.ArrayType,t.data),{["length"]:s=o.length/Bi(r),["nullCount"]:a=t.nullBitmap?-1:0}=t;return new _e(r,n,s,a,[void 0,o,i])}visitTimestamp(t){let{["type"]:r,["offset"]:n=0}=t,i=Et(t.nullBitmap),o=te(r.ArrayType,t.data),{["length"]:s=o.length/Bi(r),["nullCount"]:a=t.nullBitmap?-1:0}=t;return new _e(r,n,s,a,[void 0,o,i])}visitTime(t){let{["type"]:r,["offset"]:n=0}=t,i=Et(t.nullBitmap),o=te(r.ArrayType,t.data),{["length"]:s=o.length/Bi(r),["nullCount"]:a=t.nullBitmap?-1:0}=t;return new _e(r,n,s,a,[void 0,o,i])}visitDecimal(t){let{["type"]:r,["offset"]:n=0}=t,i=Et(t.nullBitmap),o=te(r.ArrayType,t.data),{["length"]:s=o.length/Bi(r),["nullCount"]:a=t.nullBitmap?-1:0}=t;return new _e(r,n,s,a,[void 0,o,i])}visitList(t){let{["type"]:r,["offset"]:n=0,["child"]:i}=t,o=Et(t.nullBitmap),s=Vu(t.valueOffsets),{["length"]:a=s.length-1,["nullCount"]:c=t.nullBitmap?-1:0}=t;return new _e(r,n,a,c,[s,void 0,o],[i])}visitStruct(t){let{["type"]:r,["offset"]:n=0,["children"]:i=[]}=t,o=Et(t.nullBitmap),{length:s=i.reduce((c,{length:l})=>Math.max(c,l),0),nullCount:a=t.nullBitmap?-1:0}=t;return new _e(r,n,s,a,[void 0,void 0,o],i)}visitUnion(t){let{["type"]:r,["offset"]:n=0,["children"]:i=[]}=t,o=te(r.ArrayType,t.typeIds),{["length"]:s=o.length,["nullCount"]:a=-1}=t;if(lt.isSparseUnion(r))return new _e(r,n,s,a,[void 0,void 0,void 0,o],i);let c=Vu(t.valueOffsets);return new _e(r,n,s,a,[c,void 0,void 0,o],i)}visitDictionary(t){let{["type"]:r,["offset"]:n=0}=t,i=Et(t.nullBitmap),o=te(r.indices.ArrayType,t.data),{["dictionary"]:s=new le([new e().visit({type:r.dictionary})])}=t,{["length"]:a=o.length,["nullCount"]:c=t.nullBitmap?-1:0}=t;return new _e(r,n,a,c,[void 0,o,i],[],s)}visitInterval(t){let{["type"]:r,["offset"]:n=0}=t,i=Et(t.nullBitmap),o=te(r.ArrayType,t.data),{["length"]:s=o.length/Bi(r),["nullCount"]:a=t.nullBitmap?-1:0}=t;return new _e(r,n,s,a,[void 0,o,i])}visitDuration(t){let{["type"]:r,["offset"]:n=0}=t,i=Et(t.nullBitmap),o=te(r.ArrayType,t.data),{["length"]:s=o.length,["nullCount"]:a=t.nullBitmap?-1:0}=t;return new _e(r,n,s,a,[void 0,o,i])}visitFixedSizeList(t){let{["type"]:r,["offset"]:n=0,["child"]:i=new e().visit({type:r.valueType})}=t,o=Et(t.nullBitmap),{["length"]:s=i.length/Bi(r),["nullCount"]:a=t.nullBitmap?-1:0}=t;return new _e(r,n,s,a,[void 0,void 0,o],[i])}visitMap(t){let{["type"]:r,["offset"]:n=0,["child"]:i=new e().visit({type:r.childType})}=t,o=Et(t.nullBitmap),s=Vu(t.valueOffsets),{["length"]:a=s.length-1,["nullCount"]:c=t.nullBitmap?-1:0}=t;return new _e(r,n,a,c,[s,void 0,o],[i])}},CH=new DA;function Vt(e){return CH.visit(e)}var Wm=class{constructor(t=0,r){this.numChunks=t,this.getChunkIterator=r,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 mC(e){return e.some(t=>t.nullable)}function O_(e){return e.reduce((t,r)=>t+r.nullCount,0)}function N_(e){return e.reduce((t,r,n)=>(t[n+1]=t[n]+r.length,t),new Uint32Array(e.length+1))}function F_(e,t,r,n){let i=[];for(let o=-1,s=e.length;++o<s;){let a=e[o],c=t[o],{length:l}=a;if(c>=n)break;if(r>=c+l)continue;if(c>=r&&c+l<=n){i.push(a);continue}let u=Math.max(0,r-c),f=Math.min(n-c,l);i.push(a.slice(u,f-u))}return i.length===0&&i.push(e[0].slice(0,0)),i}function BA(e,t,r,n){let i=0,o=0,s=t.length-1;do{if(i>=s-1)return r<t[s]?n(e,i,r-t[i]):null;o=i+Math.trunc((s-i)*.5),r<t[o]?s=o:i=o}while(i<s)}function Gm(e,t){return e.getValid(t)}function Pd(e){function t(r,n,i){return e(r[n],i)}return function(r){let n=this.data;return BA(n,this._offsets,r,t)}}function L_(e){let t;function r(n,i,o){return e(n[i],o,t)}return function(n,i){let o=this.data;t=i;let s=BA(o,this._offsets,n,r);return t=void 0,s}}function R_(e){let t;function r(n,i,o){let s=o,a=0,c=0;for(let l=i-1,u=n.length;++l<u;){let f=n[l];if(~(a=e(f,t,s)))return c+a;s=0,c+=f.length}return-1}return function(n,i){t=n;let o=this.data,s=typeof i!="number"?r(o,0,0):BA(o,this._offsets,i,r);return t=void 0,s}}var wt=class extends xt{};function UH(e,t){return t===null&&e.length>0?0:-1}function PH(e,t){let{nullBitmap:r}=e;if(!r||e.nullCount<=0)return-1;let n=0;for(let i of new ju(r,e.offset+(t||0),e.length,r,B_)){if(!i)return n;++n}return-1}function jt(e,t,r){if(t===void 0)return-1;if(t===null)switch(e.typeId){case F.Union:break;case F.Dictionary:break;default:return PH(e,r)}let n=Mr.getVisitFn(e),i=Al(t);for(let o=(r||0)-1,s=e.length;++o<s;)if(i(n(e,o)))return o;return-1}function yC(e,t,r){let n=Mr.getVisitFn(e),i=Al(t);for(let o=(r||0)-1,s=e.length;++o<s;)if(i(n(e,o)))return o;return-1}wt.prototype.visitNull=UH;wt.prototype.visitBool=jt;wt.prototype.visitInt=jt;wt.prototype.visitInt8=jt;wt.prototype.visitInt16=jt;wt.prototype.visitInt32=jt;wt.prototype.visitInt64=jt;wt.prototype.visitUint8=jt;wt.prototype.visitUint16=jt;wt.prototype.visitUint32=jt;wt.prototype.visitUint64=jt;wt.prototype.visitFloat=jt;wt.prototype.visitFloat16=jt;wt.prototype.visitFloat32=jt;wt.prototype.visitFloat64=jt;wt.prototype.visitUtf8=jt;wt.prototype.visitLargeUtf8=jt;wt.prototype.visitBinary=jt;wt.prototype.visitLargeBinary=jt;wt.prototype.visitFixedSizeBinary=jt;wt.prototype.visitDate=jt;wt.prototype.visitDateDay=jt;wt.prototype.visitDateMillisecond=jt;wt.prototype.visitTimestamp=jt;wt.prototype.visitTimestampSecond=jt;wt.prototype.visitTimestampMillisecond=jt;wt.prototype.visitTimestampMicrosecond=jt;wt.prototype.visitTimestampNanosecond=jt;wt.prototype.visitTime=jt;wt.prototype.visitTimeSecond=jt;wt.prototype.visitTimeMillisecond=jt;wt.prototype.visitTimeMicrosecond=jt;wt.prototype.visitTimeNanosecond=jt;wt.prototype.visitDecimal=jt;wt.prototype.visitList=jt;wt.prototype.visitStruct=jt;wt.prototype.visitUnion=jt;wt.prototype.visitDenseUnion=yC;wt.prototype.visitSparseUnion=yC;wt.prototype.visitDictionary=jt;wt.prototype.visitInterval=jt;wt.prototype.visitIntervalDayTime=jt;wt.prototype.visitIntervalYearMonth=jt;wt.prototype.visitDuration=jt;wt.prototype.visitDurationSecond=jt;wt.prototype.visitDurationMillisecond=jt;wt.prototype.visitDurationMicrosecond=jt;wt.prototype.visitDurationNanosecond=jt;wt.prototype.visitFixedSizeList=jt;wt.prototype.visitMap=jt;var Wu=new wt;var vt=class extends xt{};function Rt(e){let{type:t}=e;if(e.nullCount===0&&e.stride===1&&(t.typeId===F.Timestamp||t instanceof br&&t.bitWidth!==64||t instanceof $o&&t.bitWidth!==64||t instanceof li&&t.precision!==Le.HALF))return new Wm(e.data.length,n=>{let i=e.data[n];return i.values.subarray(0,i.length)[Symbol.iterator]()});let r=0;return new Wm(e.data.length,n=>{let o=e.data[n].length,s=e.slice(r,r+o);return r+=o,new OA(s)})}var OA=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}};vt.prototype.visitNull=Rt;vt.prototype.visitBool=Rt;vt.prototype.visitInt=Rt;vt.prototype.visitInt8=Rt;vt.prototype.visitInt16=Rt;vt.prototype.visitInt32=Rt;vt.prototype.visitInt64=Rt;vt.prototype.visitUint8=Rt;vt.prototype.visitUint16=Rt;vt.prototype.visitUint32=Rt;vt.prototype.visitUint64=Rt;vt.prototype.visitFloat=Rt;vt.prototype.visitFloat16=Rt;vt.prototype.visitFloat32=Rt;vt.prototype.visitFloat64=Rt;vt.prototype.visitUtf8=Rt;vt.prototype.visitLargeUtf8=Rt;vt.prototype.visitBinary=Rt;vt.prototype.visitLargeBinary=Rt;vt.prototype.visitFixedSizeBinary=Rt;vt.prototype.visitDate=Rt;vt.prototype.visitDateDay=Rt;vt.prototype.visitDateMillisecond=Rt;vt.prototype.visitTimestamp=Rt;vt.prototype.visitTimestampSecond=Rt;vt.prototype.visitTimestampMillisecond=Rt;vt.prototype.visitTimestampMicrosecond=Rt;vt.prototype.visitTimestampNanosecond=Rt;vt.prototype.visitTime=Rt;vt.prototype.visitTimeSecond=Rt;vt.prototype.visitTimeMillisecond=Rt;vt.prototype.visitTimeMicrosecond=Rt;vt.prototype.visitTimeNanosecond=Rt;vt.prototype.visitDecimal=Rt;vt.prototype.visitList=Rt;vt.prototype.visitStruct=Rt;vt.prototype.visitUnion=Rt;vt.prototype.visitDenseUnion=Rt;vt.prototype.visitSparseUnion=Rt;vt.prototype.visitDictionary=Rt;vt.prototype.visitInterval=Rt;vt.prototype.visitIntervalDayTime=Rt;vt.prototype.visitIntervalYearMonth=Rt;vt.prototype.visitDuration=Rt;vt.prototype.visitDurationSecond=Rt;vt.prototype.visitDurationMillisecond=Rt;vt.prototype.visitDurationMicrosecond=Rt;vt.prototype.visitDurationNanosecond=Rt;vt.prototype.visitFixedSizeList=Rt;vt.prototype.visitMap=Rt;var $d=new vt;var gC,bC={},xC={},le=class e{constructor(t){var r,n,i;let o=t[0]instanceof e?t.flatMap(a=>a.data):t;if(o.length===0||o.some(a=>!(a instanceof _e)))throw new TypeError("Vector constructor expects an Array of Data instances.");let s=(r=o[0])===null||r===void 0?void 0:r.type;switch(o.length){case 0:this._offsets=[0];break;case 1:{let{get:a,set:c,indexOf:l}=bC[s.typeId],u=o[0];this.isValid=f=>Gm(u,f),this.get=f=>a(u,f),this.set=(f,d)=>c(u,f,d),this.indexOf=f=>l(u,f),this._offsets=[0,u.length];break}default:Object.setPrototypeOf(this,xC[s.typeId]),this._offsets=N_(o);break}this.data=o,this.type=s,this.stride=Bi(s),this.numChildren=(i=(n=s.children)===null||n===void 0?void 0:n.length)!==null&&i!==void 0?i:0,this.length=this._offsets.at(-1)}get byteLength(){return this.data.reduce((t,r)=>t+r.byteLength,0)}get nullable(){return mC(this.data)}get nullCount(){return O_(this.data)}get ArrayType(){return this.type.ArrayType}get[Symbol.toStringTag](){return`${this.VectorName}<${this.type[Symbol.toStringTag]}>`}get VectorName(){return`${F[this.type.typeId]}Vector`}isValid(t){return!1}get(t){return null}set(t,r){}indexOf(t,r){return-1}includes(t,r){return this.indexOf(t,r)>-1}[Symbol.iterator](){return $d.visit(this)}concat(...t){return new e(this.data.concat(t.flatMap(r=>r.data).flat(Number.POSITIVE_INFINITY)))}slice(t,r){return new e(qm(this,t,r,({data:n,_offsets:i},o,s)=>F_(n,i,o,s)))}toJSON(){return[...this]}toArray(){let{type:t,data:r,length:n,stride:i,ArrayType:o}=this;switch(t.typeId){case F.Int:case F.Float:case F.Decimal:case F.Time:case F.Timestamp:switch(r.length){case 0:return new o;case 1:return r[0].values.subarray(0,n*i);default:return r.reduce((s,{values:a,length:c})=>(s.array.set(a.subarray(0,c*i),s.offset),s.offset+=c*i,s),{array:new o(n*i),offset:0}).array}}return[...this]}toString(){return`[${[...this].join(",")}]`}getChild(t){var r;return this.getChildAt((r=this.type.children)===null||r===void 0?void 0:r.findIndex(n=>n.name===t))}getChildAt(t){return t>-1&&t<this.numChildren?new e(this.data.map(({children:r})=>r[t])):null}get isMemoized(){return lt.isDictionary(this.type)?this.data[0].dictionary.isMemoized:!1}memoize(){if(lt.isDictionary(this.type)){let t=new k_(this.data[0].dictionary),r=this.data.map(n=>{let i=n.clone();return i.dictionary=t,i});return new e(r)}return new k_(this)}unmemoize(){if(lt.isDictionary(this.type)&&this.isMemoized){let t=this.data[0].dictionary.unmemoize(),r=this.data.map(n=>{let i=n.clone();return i.dictionary=t,i});return new e(r)}return this}};gC=Symbol.toStringTag;le[gC]=(e=>{e.type=lt.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(F).map(r=>F[r]).filter(r=>typeof r=="number"&&r!==F.NONE);for(let r of t){let n=Mr.getVisitFnByTypeId(r),i=sn.getVisitFnByTypeId(r),o=Wu.getVisitFnByTypeId(r);bC[r]={get:n,set:i,indexOf:o},xC[r]=Object.create(e,{isValid:{value:Pd(Gm)},get:{value:Pd(Mr.getVisitFnByTypeId(r))},set:{value:L_(sn.getVisitFnByTypeId(r))},indexOf:{value:R_(Wu.getVisitFnByTypeId(r))}})}return"Vector"})(le.prototype);var k_=class e extends le{constructor(t){super(t.data);let r=this.get,n=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=r.call(this,s);return o[s]=c,c}}),Object.defineProperty(this,"set",{value(s,a){n.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 le(this.data)}),Object.defineProperty(this,"memoize",{value:()=>this})}};function _C(e){if(!e||e.length<=0)return function(i){return!0};let t="",r=e.filter(n=>n===n);return r.length>0&&(t=`
2
+ switch (x) {${r.map(n=>`
3
+ case ${$H(n)}:`).join("")}
4
4
  return false;
5
- }`),e.length!==n.length&&(t=`if (x !== x) return false;
5
+ }`),e.length!==r.length&&(t=`if (x !== x) return false;
6
6
  ${t}`),new Function("x",`${t}
7
- return true;`)}function G$(e){return typeof e!="bigint"?wi(e):`${wi(e)}n`}var Hw=(e,t)=>(Math.ceil(e)*t+63&-64||64)/t,W$=(e,t=0)=>e.length>=t?e.subarray(0,t):Vl(new e.constructor(t),e,0),ca=class{constructor(t,n=1){this.buffer=t,this.stride=n,this.BYTES_PER_ELEMENT=t.BYTES_PER_ELEMENT,this.ArrayType=t.constructor,this._resize(this.length=Math.ceil(t.length/n))}get byteLength(){return Math.ceil(this.length*this.stride)*this.BYTES_PER_ELEMENT}get reservedLength(){return this.buffer.length/this.stride}get reservedByteLength(){return this.buffer.byteLength}set(t,n){return this}append(t){return this.set(this.length,t)}reserve(t){if(t>0){this.length+=t;let n=this.stride,r=this.length*n,i=this.buffer.length;r>=i&&this._resize(i===0?Hw(r*1,this.BYTES_PER_ELEMENT):Hw(r*2,this.BYTES_PER_ELEMENT))}return this}flush(t=this.length){t=Hw(t*this.stride,this.BYTES_PER_ELEMENT);let n=W$(this.buffer,t);return this.clear(),n}clear(){return this.length=0,this._resize(0),this}_resize(t){return this.buffer=Vl(new this.ArrayType(t),this.buffer)}};ca.prototype.offset=0;var es=class extends ca{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}},Jl=class extends es{constructor(t=new Uint8Array(0)){super(t,1/8),this.numValid=0}get numInvalid(){return this.length-this.numValid}get(t){return this.buffer[t>>3]>>t%8&1}set(t,n){let{buffer:r}=this.reserve(t-this.length+1),i=t>>3,o=t%8,s=r[i]>>o&1;return n?s===0&&(r[i]|=1<<o,++this.numValid):s===1&&(r[i]&=~(1<<o),--this.numValid),this}clear(){return this.numValid=0,super.clear()}},tu=class extends es{constructor(t=new Int32Array(1)){super(t,1)}append(t){return this.set(this.length-1,t)}set(t,n){let r=this.length-1,i=this.reserve(t-r+1).buffer;return r<t++&&i.fill(i[r],r,t),i[t]=i[t-1]+n,this}flush(t=this.length-1){return t>this.length&&this.set(t-1,0),super.flush(t+1)}};var _e=class{static throughNode(t){throw new Error('"throughNode" not available in this environment')}static throughDOM(t){throw new Error('"throughDOM" not available in this environment')}constructor({type:t,nullValues:n}){this.length=0,this.finished=!1,this.type=t,this.children=[],this.nullValues=n,this.stride=Tr(t),this._nulls=new Jl,n&&n.length>0&&(this._isValid=fO(n))}toVector(){return new jt([this.flush()])}get ArrayType(){return this.type.ArrayType}get nullCount(){return this._nulls.numInvalid}get numChildren(){return this.children.length}get byteLength(){let t=0,{_offsets:n,_values:r,_nulls:i,_typeIds:o,children:s}=this;return n&&(t+=n.byteLength),r&&(t+=r.byteLength),i&&(t+=i.byteLength),o&&(t+=o.byteLength),s.reduce((a,c)=>a+c.byteLength,t)}get reservedLength(){return this._nulls.reservedLength}get reservedByteLength(){let t=0;return this._offsets&&(t+=this._offsets.reservedByteLength),this._values&&(t+=this._values.reservedByteLength),this._nulls&&(t+=this._nulls.reservedByteLength),this._typeIds&&(t+=this._typeIds.reservedByteLength),this.children.reduce((n,r)=>n+r.reservedByteLength,t)}get valueOffsets(){return this._offsets?this._offsets.buffer:null}get values(){return this._values?this._values.buffer:null}get nullBitmap(){return this._nulls?this._nulls.buffer:null}get typeIds(){return this._typeIds?this._typeIds.buffer:null}append(t){return this.set(this.length,t)}isValid(t){return this._isValid(t)}set(t,n){return this.setValid(t,this.isValid(n))&&this.setValue(t,n),this}setValue(t,n){this._setValue(this,t,n)}setValid(t,n){return this.length=this._nulls.set(t,+n).length,n}addChild(t,n=`${this.numChildren}`){throw new Error(`Cannot append children to non-nested type "${this.type}"`)}getChildAt(t){return this.children[t]||null}flush(){let t,n,r,i,{type:o,length:s,nullCount:a,_typeIds:c,_offsets:l,_values:u,_nulls:f}=this;(n=c?.flush(s))?i=l?.flush(s):(i=l?.flush(s))?t=u?.flush(l.last()):t=u?.flush(s),a>0&&(r=f?.flush(s));let d=this.children.map(h=>h.flush());return this.clear(),Dt({type:o,length:s,nullCount:a,children:d,child:d[0],data:t,typeIds:n,nullBitmap:r,valueOffsets:i})}finish(){this.finished=!0;for(let t of this.children)t.finish();return this}clear(){var t,n,r,i;this.length=0,(t=this._nulls)===null||t===void 0||t.clear(),(n=this._values)===null||n===void 0||n.clear(),(r=this._offsets)===null||r===void 0||r.clear(),(i=this._typeIds)===null||i===void 0||i.clear();for(let o of this.children)o.clear();return this}};_e.prototype.length=1;_e.prototype.stride=1;_e.prototype.children=null;_e.prototype.finished=!1;_e.prototype.nullValues=null;_e.prototype._isValid=()=>!0;var Ve=class extends _e{constructor(t){super(t),this._values=new es(new this.ArrayType(0),this.stride)}setValue(t,n){let r=this._values;return r.reserve(t-r.length+1),super.setValue(t,n)}},Ki=class extends _e{constructor(t){super(t),this._pendingLength=0,this._offsets=new tu}setValue(t,n){let r=this._pending||(this._pending=new Map),i=r.get(t);i&&(this._pendingLength-=i.length),this._pendingLength+=n instanceof Zi?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 vc=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 Ji=new Int32Array(2),Sg=new Float32Array(Ji.buffer),Ig=new Float64Array(Ji.buffer),eu=new Uint16Array(new Uint8Array([1,0]).buffer)[0]===1;var Nd;(function(e){e[e.UTF8_BYTES=1]="UTF8_BYTES",e[e.UTF16_STRING=2]="UTF16_STRING"})(Nd||(Nd={}));var Mr=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 Ji[0]=this.readInt32(t),Sg[0]}readFloat64(t){return Ji[eu?0:1]=this.readInt32(t),Ji[eu?1:0]=this.readInt32(t+4),Ig[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){Sg[0]=n,this.writeInt32(t,Ji[0])}writeFloat64(t,n){Ig[0]=n,this.writeInt32(t,Ji[eu?0:1]),this.writeInt32(t+4,Ji[eu?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===Nd.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 Sc=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=Mr.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=Mr.allocate(r);return i.setPosition(r-n),i.bytes().set(t.bytes(),r-n),i}addOffset(t){this.prep(4,0),this.writeInt32(this.offset()-t+4)}startObject(t){this.notNested(),this.vtable==null&&(this.vtable=[]),this.vtable_in_use=t;for(let n=0;n<t;n++)this.vtable[n]=0;this.isNested=!0,this.object_start=this.offset()}endObject(){if(this.vtable==null||!this.isNested)throw new Error("FlatBuffers: endObject called without startObject");this.addInt32(0);let t=this.offset(),n=this.vtable_in_use-1;for(;n>=0&&this.vtable[n]==0;n--);let r=n+1;for(;n>=0;n--)this.addInt16(this.vtable[n]!=0?t-this.vtable[n]:0);let i=2;this.addInt16(t-this.object_start);let o=(r+i)*2;this.addInt16(o);let s=0,a=this.space;t:for(n=0;n<this.vtables.length;n++){let c=this.bb.capacity()-this.vtables[n];if(o==this.bb.readInt16(c)){for(let l=2;l<o;l+=2)if(this.bb.readInt16(a+l)!=this.bb.readInt16(c+l))continue t;s=this.vtables[n];break}}return s?(this.space=this.bb.capacity()-t,this.bb.writeInt32(this.space,s-t)):(this.vtables.push(this.offset()),this.bb.writeInt32(this.bb.capacity()-t,this.offset()-t)),this.isNested=!1,t}finish(t,n,r){let i=r?4:0;if(n){let o=n;if(this.prep(this.minalign,8+i),o.length!=4)throw new TypeError("FlatBuffers: file identifier must be length "+4);for(let s=3;s>=0;s--)this.writeInt8(o.charCodeAt(s))}this.prep(this.minalign,4+i),this.addOffset(t),i&&this.addInt32(this.bb.capacity()-this.space),this.bb.setPosition(this.space)}finishSizePrefixed(t,n){this.finish(t,n,!0)}requiredField(t,n){let r=this.bb.capacity()-t,i=r-this.bb.readInt32(r);if(!(n<this.bb.readInt16(i)&&this.bb.readInt16(i+n)!=0))throw new TypeError("FlatBuffers: field "+n+" must be set")}startVector(t,n,r){this.notNested(),this.vector_num_elems=n,this.prep(4,t*n),this.prep(r,t*n)}endVector(){return this.writeInt32(this.vector_num_elems),this.offset()}createSharedString(t){if(!t)return 0;if(this.string_maps||(this.string_maps=new Map),this.string_maps.has(t))return this.string_maps.get(t);let n=this.createString(t);return this.string_maps.set(t,n),n}createString(t){if(t==null)return 0;let n;t instanceof Uint8Array?n=t:n=this.text_encoder.encode(t),this.addInt8(0),this.startVector(1,n.length,1),this.bb.setPosition(this.space-=n.length);for(let r=0,i=this.space,o=this.bb.bytes();r<n.length;r++)o[i++]=n[r];return this.endVector()}createObjectOffset(t){return t===null?0:typeof t=="string"?this.createString(t):t.pack(this)}createObjectOffsetList(t){let n=[];for(let r=0;r<t.length;++r){let i=t[r];if(i!==null)n.push(this.createObjectOffset(i));else throw new TypeError("FlatBuffers: Argument for createObjectOffsetList cannot contain null.")}return n}createStructOffsetList(t,n){return n(this,t.length),this.createObjectOffsetList(t.slice().reverse()),this.endVector()}};var en=class e{constructor(){this.bb=null,this.bb_pos=0}__init(t,n){return this.bb_pos=t,this.bb=n,this}static getRootAsKeyValue(t,n){return(n||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsKeyValue(t,n){return t.setPosition(t.position()+4),(n||new e).__init(t.readInt32(t.position())+t.position(),t)}key(t){let n=this.bb.__offset(this.bb_pos,4);return n?this.bb.__string(this.bb_pos+n,t):null}value(t){let n=this.bb.__offset(this.bb_pos,6);return n?this.bb.__string(this.bb_pos+n,t):null}static startKeyValue(t){t.startObject(2)}static addKey(t,n){t.addFieldOffset(0,n,0)}static addValue(t,n){t.addFieldOffset(1,n,0)}static endKeyValue(t){return t.endObject()}static createKeyValue(t,n,r){return e.startKeyValue(t),e.addKey(t,n),e.addValue(t,r),e.endKeyValue(t)}};var la;(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"})(la||(la={}));var ua;(function(e){e[e.Little=0]="Little",e[e.Big=1]="Big"})(ua||(ua={}));var Rd;(function(e){e[e.DenseArray=0]="DenseArray"})(Rd||(Rd={}));var Ri=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 to=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 Ri).__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):Rd.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,Rd.DenseArray)}static endDictionaryEncoding(t){return t.endObject()}};var Od=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 Dd=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 kd;(function(e){e[e.DAY=0]="DAY",e[e.MILLISECOND=1]="MILLISECOND"})(kd||(kd={}));var fa=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):kd.MILLISECOND}static startDate(t){t.startObject(1)}static addUnit(t,n){t.addFieldInt16(0,n,kd.MILLISECOND)}static endDate(t){return t.endObject()}static createDate(t,n){return e.startDate(t),e.addUnit(t,n),e.endDate(t)}};var eo=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 Oi;(function(e){e[e.SECOND=0]="SECOND",e[e.MILLISECOND=1]="MILLISECOND",e[e.MICROSECOND=2]="MICROSECOND",e[e.NANOSECOND=3]="NANOSECOND"})(Oi||(Oi={}));var da=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):Oi.MILLISECOND}static startDuration(t){t.startObject(1)}static addUnit(t,n){t.addFieldInt16(0,n,Oi.MILLISECOND)}static endDuration(t){return t.endObject()}static createDuration(t,n){return e.startDuration(t),e.addUnit(t,n),e.endDuration(t)}};var ha=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 pa=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 Fd;(function(e){e[e.HALF=0]="HALF",e[e.SINGLE=1]="SINGLE",e[e.DOUBLE=2]="DOUBLE"})(Fd||(Fd={}));var ma=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):Fd.HALF}static startFloatingPoint(t){t.startObject(1)}static addPrecision(t,n){t.addFieldInt16(0,n,Fd.HALF)}static endFloatingPoint(t){return t.endObject()}static createFloatingPoint(t,n){return e.startFloatingPoint(t),e.addPrecision(t,n),e.endFloatingPoint(t)}};var Ld;(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"})(Ld||(Ld={}));var ya=class e{constructor(){this.bb=null,this.bb_pos=0}__init(t,n){return this.bb_pos=t,this.bb=n,this}static 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):Ld.YEAR_MONTH}static startInterval(t){t.startObject(1)}static addUnit(t,n){t.addFieldInt16(0,n,Ld.YEAR_MONTH)}static endInterval(t){return t.endObject()}static createInterval(t,n){return e.startInterval(t),e.addUnit(t,n),e.endInterval(t)}};var Cd=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 ga=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 Bd=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 Pd=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 ns=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):Oi.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,Oi.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 rs=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):Oi.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,Oi.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 Ud;(function(e){e[e.Sparse=0]="Sparse",e[e.Dense=1]="Dense"})(Ud||(Ud={}));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 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):Ud.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,Ud.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 $d=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 ge;(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"})(ge||(ge={}));var kn=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):ge.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 to).__init(this.bb.__indirect(this.bb_pos+n),this.bb):null}children(t,n){let r=this.bb.__offset(this.bb_pos,14);return r?(n||new e).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+r)+t*4),this.bb):null}childrenLength(){let t=this.bb.__offset(this.bb_pos,14);return t?this.bb.__vector_len(this.bb_pos+t):0}customMetadata(t,n){let r=this.bb.__offset(this.bb_pos,16);return r?(n||new en).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+r)+t*4),this.bb):null}customMetadataLength(){let t=this.bb.__offset(this.bb_pos,16);return t?this.bb.__vector_len(this.bb_pos+t):0}static startField(t){t.startObject(7)}static addName(t,n){t.addFieldOffset(0,n,0)}static addNullable(t,n){t.addFieldInt8(1,+n,0)}static addTypeType(t,n){t.addFieldInt8(2,n,ge.NONE)}static addType(t,n){t.addFieldOffset(3,n,0)}static addDictionary(t,n){t.addFieldOffset(4,n,0)}static addChildren(t,n){t.addFieldOffset(5,n,0)}static createChildrenVector(t,n){t.startVector(4,n.length,4);for(let r=n.length-1;r>=0;r--)t.addOffset(n[r]);return t.endVector()}static startChildrenVector(t,n){t.startVector(4,n,4)}static addCustomMetadata(t,n){t.addFieldOffset(6,n,0)}static createCustomMetadataVector(t,n){t.startVector(4,n.length,4);for(let r=n.length-1;r>=0;r--)t.addOffset(n[r]);return t.endVector()}static startCustomMetadataVector(t,n){t.startVector(4,n,4)}static endField(t){return t.endObject()}};var fr=class e{constructor(){this.bb=null,this.bb_pos=0}__init(t,n){return this.bb_pos=t,this.bb=n,this}static getRootAsSchema(t,n){return(n||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsSchema(t,n){return t.setPosition(t.position()+4),(n||new e).__init(t.readInt32(t.position())+t.position(),t)}endianness(){let t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt16(this.bb_pos+t):ua.Little}fields(t,n){let r=this.bb.__offset(this.bb_pos,6);return r?(n||new kn).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+r)+t*4),this.bb):null}fieldsLength(){let t=this.bb.__offset(this.bb_pos,6);return t?this.bb.__vector_len(this.bb_pos+t):0}customMetadata(t,n){let r=this.bb.__offset(this.bb_pos,8);return r?(n||new en).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+r)+t*4),this.bb):null}customMetadataLength(){let t=this.bb.__offset(this.bb_pos,8);return t?this.bb.__vector_len(this.bb_pos+t):0}features(t){let n=this.bb.__offset(this.bb_pos,10);return n?this.bb.readInt64(this.bb.__vector(this.bb_pos+n)+t*8):BigInt(0)}featuresLength(){let t=this.bb.__offset(this.bb_pos,10);return t?this.bb.__vector_len(this.bb_pos+t):0}static startSchema(t){t.startObject(4)}static addEndianness(t,n){t.addFieldInt16(0,n,ua.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 Ar=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):la.V1}schema(t){let n=this.bb.__offset(this.bb_pos,6);return n?(t||new fr).__init(this.bb.__indirect(this.bb_pos+n),this.bb):null}dictionaries(t,n){let r=this.bb.__offset(this.bb_pos,8);return r?(n||new vc).__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 vc).__init(this.bb.__vector(this.bb_pos+r)+t*24,this.bb):null}recordBatchesLength(){let t=this.bb.__offset(this.bb_pos,10);return t?this.bb.__vector_len(this.bb_pos+t):0}customMetadata(t,n){let r=this.bb.__offset(this.bb_pos,12);return r?(n||new en).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+r)+t*4),this.bb):null}customMetadataLength(){let t=this.bb.__offset(this.bb_pos,12);return t?this.bb.__vector_len(this.bb_pos+t):0}static startFooter(t){t.startObject(5)}static addVersion(t,n){t.addFieldInt16(0,n,la.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=Ie.V5){this.fields=t||[],this.metadata=n||new Map,r||(r=Zw(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=Eg(Eg(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:Eg(Eg(new Map,r[c].metadata),a.metadata)}))&&!1:!0}),s=Zw(o,new Map);return new e([...r,...o],i,new Map([...this.dictionaries,...s]))}};re.prototype.fields=null;re.prototype.metadata=null;re.prototype.dictionaries=null;var Ut=class e{static new(...t){let[n,r,i,o]=t;return t[0]&&typeof t[0]=="object"&&({name:n}=t[0],r===void 0&&(r=t[0].type),i===void 0&&(i=t[0].nullable),o===void 0&&(o=t[0].metadata)),new e(`${n}`,r,i,o)}constructor(t,n,r=!1,i){this.name=t,this.type=n,this.nullable=r,this.metadata=i||new Map}get typeId(){return this.type.typeId}get[Symbol.toStringTag](){return"Field"}toString(){return`${this.name}: ${this.type}`}clone(...t){let[n,r,i,o]=t;return!t[0]||typeof t[0]!="object"?[n=this.name,r=this.type,i=this.nullable,o=this.metadata]=t:{name:n=this.name,type:r=this.type,nullable:i=this.nullable,metadata:o=this.metadata}=t[0],e.new(n,r,i,o)}};Ut.prototype.type=null;Ut.prototype.name=null;Ut.prototype.nullable=null;Ut.prototype.metadata=null;function Eg(e,t){return new Map([...e||new Map,...t||new Map])}function Zw(e,t=new Map){for(let n=-1,r=e.length;++n<r;){let o=e[n].type;if(at.isDictionary(o)){if(!t.has(o.id))t.set(o.id,o.dictionary);else if(t.get(o.id)!==o.dictionary)throw new Error("Cannot create Schema containing two different dictionaries with the same Id")}o.children&&o.children.length>0&&Zw(o.children,t)}return t}var X$=Sc,H$=Mr,is=class{static decode(t){t=new H$(Ot(t));let n=Ar.getRootAsFooter(t),r=re.decode(n.schema(),new Map,n.version());return new Qw(r,n)}static encode(t){let n=new X$,r=re.encode(n,t.schema);Ar.startRecordBatchesVector(n,t.numRecordBatches);for(let s of[...t.recordBatches()].slice().reverse())os.encode(n,s);let i=n.endVector();Ar.startDictionariesVector(n,t.numDictionaries);for(let s of[...t.dictionaryBatches()].slice().reverse())os.encode(n,s);let o=n.endVector();return Ar.startFooter(n),Ar.addSchema(n,r),Ar.addVersion(n,Ie.V5),Ar.addRecordBatches(n,i),Ar.addDictionaries(n,o),Ar.finishFooterBuffer(n,Ar.endFooter(n)),n.asUint8Array()}get numRecordBatches(){return this._recordBatches.length}get numDictionaries(){return this._dictionaryBatches.length}constructor(t,n=Ie.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 Qw=class extends is{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 os.decode(n)}return null}getDictionaryBatch(t){if(t>=0&&t<this.numDictionaries){let n=this._footer.dictionaries(t);if(n)return os.decode(n)}return null}},os=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 vc.createBlock(t,i,r,o)}constructor(t,n,r){this.metaDataLength=t,this.offset=lr(r),this.bodyLength=lr(n)}};var be=Object.freeze({done:!0,value:void 0}),zd=class{constructor(t){this._json=t}get schema(){return this._json.schema}get batches(){return this._json.batches||[]}get dictionaries(){return this._json.dictionaries||[]}},Ic=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())}},Mg=class extends Ic{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 no=class extends Mg{write(t){if((t=Ot(t)).byteLength>0)return super.write(t)}toString(t=!1){return t?_d(this.toUint8Array(!0)):this.toUint8Array(!1).then(_d)}toUint8Array(t=!1){return t?Sr(this._values)[0]:Z(this,void 0,void 0,function*(){var n,r,i,o;let s=[],a=0;try{for(var c=!0,l=bi(this),u;u=yield l.next(),n=u.done,!n;c=!0){o=u.value,c=!1;let f=o;s.push(f),a+=f.byteLength}}catch(f){r={error:f}}finally{try{!c&&!n&&(i=l.return)&&(yield i.call(l))}finally{if(r)throw r.error}}return Sr(s,a)[0]})}},ro=class{constructor(t){t&&(this.source=new Kw(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)}},Hr=class e{constructor(t){t instanceof e?this.source=t.source:t instanceof no?this.source=new ss(xn.fromAsyncIterable(t)):Py(t)?this.source=new ss(xn.fromNodeStream(t)):wd(t)?this.source=new ss(xn.fromDOMStream(t)):Cy(t)?this.source=new ss(xn.fromDOMStream(t.body)):xi(t)?this.source=new ss(xn.fromIterable(t)):vr(t)?this.source=new ss(xn.fromAsyncIterable(t)):Yr(t)&&(this.source=new ss(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)}},Kw=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)}},ss=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 qd=class extends ro{constructor(t,n){super(),this.position=0,this.buffer=Ot(t),this.size=n===void 0?this.buffer.byteLength:n}readInt32(t){let{buffer:n,byteOffset:r}=this.readAt(t,4);return new DataView(n,r).getInt32(0,!0)}seek(t){return this.position=Math.min(t,this.size),t<this.size}read(t){let{buffer:n,size:r,position:i}=this;return n&&i<r?(typeof t!="number"&&(t=Number.POSITIVE_INFINITY),this.position=Math.min(r,i+Math.min(r-i,t)),n.subarray(i,this.position)):null}readAt(t,n){let r=this.buffer,i=Math.min(this.size,t+n);return r?r.subarray(t,i):new Uint8Array(n)}close(){this.buffer&&(this.buffer=null)}throw(t){return this.close(),{done:!0,value:t}}return(t){return this.close(),{done:!0,value:t}}},ba=class extends Hr{constructor(t,n){super(),this.position=0,this._handle=t,typeof n=="number"?this.size=n:this._pending=Z(this,void 0,void 0,function*(){this.size=(yield t.stat()).size,delete this._pending})}readInt32(t){return Z(this,void 0,void 0,function*(){let{buffer:n,byteOffset:r}=yield this.readAt(t,4);return new DataView(n,r).getInt32(0,!0)})}seek(t){return Z(this,void 0,void 0,function*(){return this._pending&&(yield this._pending),this.position=Math.min(t,this.size),t<this.size})}read(t){return Z(this,void 0,void 0,function*(){this._pending&&(yield this._pending);let{_handle:n,size:r,position:i}=this;if(n&&i<r){typeof t!="number"&&(t=Number.POSITIVE_INFINITY);let o=i,s=0,a=0,c=Math.min(r,o+Math.min(r-o,t)),l=new Uint8Array(Math.max(0,(this.position=c)-o));for(;(o+=a)<c&&(s+=a)<l.byteLength;)({bytesRead:a}=yield n.read(l,s,l.byteLength-s,o));return l}return null})}readAt(t,n){return Z(this,void 0,void 0,function*(){this._pending&&(yield this._pending);let{_handle:r,size:i}=this;if(r&&t+n<i){let o=Math.min(i,t+n),s=new Uint8Array(o-t);return(yield r.read(s,0,n,t)).buffer}return new Uint8Array(n)})}close(){return Z(this,void 0,void 0,function*(){let t=this._handle;this._handle=null,t&&(yield t.close())})}throw(t){return Z(this,void 0,void 0,function*(){return yield this.close(),{done:!0,value:t}})}return(t){return Z(this,void 0,void 0,function*(){return yield this.close(),{done:!0,value:t}})}};var tv={};_r(tv,{BaseInt64:()=>jd,Int128:()=>Vd,Int64:()=>as,Uint64:()=>Ne});function nu(e){return e<0&&(e=4294967295+e+1),`0x${e.toString(16)}`}var ru=8,Jw=[1,10,100,1e3,1e4,1e5,1e6,1e7,1e8],jd=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`${nu(this.buffer[1])} ${nu(this.buffer[0])}`}},Ne=class e extends jd{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=ru<r-o?ru:r-o,a=new e(new Uint32Array([Number.parseInt(t.slice(o,o+s),10),0])),c=new e(new Uint32Array([Jw[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)}},as=class e extends jd{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=ru<i-s?ru:i-s,c=new e(new Uint32Array([Number.parseInt(t.slice(s,s+a),10),0])),l=new e(new Uint32Array([Jw[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)}},Vd=class e{constructor(t){this.buffer=t}high(){return new as(new Uint32Array(this.buffer.buffer,this.buffer.byteOffset+8,2))}low(){return new as(new Uint32Array(this.buffer.buffer,this.buffer.byteOffset,2))}negate(){return this.buffer[0]=~this.buffer[0]+1,this.buffer[1]=~this.buffer[1],this.buffer[2]=~this.buffer[2],this.buffer[3]=~this.buffer[3],this.buffer[0]==0&&++this.buffer[1],this.buffer[1]==0&&++this.buffer[2],this.buffer[2]==0&&++this.buffer[3],this}times(t){let n=new Ne(new Uint32Array([this.buffer[3],0])),r=new Ne(new Uint32Array([this.buffer[2],0])),i=new Ne(new Uint32Array([this.buffer[1],0])),o=new Ne(new Uint32Array([this.buffer[0],0])),s=new Ne(new Uint32Array([t.buffer[3],0])),a=new Ne(new Uint32Array([t.buffer[2],0])),c=new Ne(new Uint32Array([t.buffer[1],0])),l=new Ne(new Uint32Array([t.buffer[0],0])),u=Ne.multiply(o,l);this.buffer[0]=u.low();let f=new Ne(new Uint32Array([u.high(),0]));return u=Ne.multiply(i,l),f.plus(u),u=Ne.multiply(o,c),f.plus(u),this.buffer[1]=f.low(),this.buffer[3]=f.lessThan(u)?1:0,this.buffer[2]=f.high(),new Ne(new Uint32Array(this.buffer.buffer,this.buffer.byteOffset+8,2)).plus(Ne.multiply(r,l)).plus(Ne.multiply(i,c)).plus(Ne.multiply(o,a)),this.buffer[3]+=Ne.multiply(n,l).plus(Ne.multiply(r,c)).plus(Ne.multiply(i,a)).plus(Ne.multiply(o,s)).low(),this}plus(t){let n=new Uint32Array(4);return n[3]=this.buffer[3]+t.buffer[3]>>>0,n[2]=this.buffer[2]+t.buffer[2]>>>0,n[1]=this.buffer[1]+t.buffer[1]>>>0,n[0]=this.buffer[0]+t.buffer[0]>>>0,n[0]<this.buffer[0]>>>0&&++n[1],n[1]<this.buffer[1]>>>0&&++n[2],n[2]<this.buffer[2]>>>0&&++n[3],this.buffer[3]=n[3],this.buffer[2]=n[2],this.buffer[1]=n[1],this.buffer[0]=n[0],this}hex(){return`${nu(this.buffer[3])} ${nu(this.buffer[2])} ${nu(this.buffer[1])} ${nu(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=ru<i-s?ru:i-s,c=new e(new Uint32Array([Number.parseInt(t.slice(s,s+a),10),0,0,0])),l=new e(new Uint32Array([Jw[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 Yd=class extends ut{constructor(t,n,r,i,o=Ie.V5){super(),this.nodesIndex=-1,this.buffersIndex=-1,this.bytes=t,this.nodes=n,this.buffers=r,this.dictionaries=i,this.metadataVersion=o}visit(t){return super.visit(t instanceof Ut?t.type:t)}visitNull(t,{length:n}=this.nextFieldNode()){return Dt({type:t,length:n})}visitBool(t,{length:n,nullCount:r}=this.nextFieldNode()){return Dt({type:t,length:n,nullCount:r,nullBitmap:this.readNullBitmap(t,r),data:this.readData(t)})}visitInt(t,{length:n,nullCount:r}=this.nextFieldNode()){return Dt({type:t,length:n,nullCount:r,nullBitmap:this.readNullBitmap(t,r),data:this.readData(t)})}visitFloat(t,{length:n,nullCount:r}=this.nextFieldNode()){return Dt({type:t,length:n,nullCount:r,nullBitmap:this.readNullBitmap(t,r),data:this.readData(t)})}visitUtf8(t,{length:n,nullCount:r}=this.nextFieldNode()){return Dt({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 Dt({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 Dt({type:t,length:n,nullCount:r,nullBitmap:this.readNullBitmap(t,r),data:this.readData(t)})}visitDate(t,{length:n,nullCount:r}=this.nextFieldNode()){return Dt({type:t,length:n,nullCount:r,nullBitmap:this.readNullBitmap(t,r),data:this.readData(t)})}visitTimestamp(t,{length:n,nullCount:r}=this.nextFieldNode()){return Dt({type:t,length:n,nullCount:r,nullBitmap:this.readNullBitmap(t,r),data:this.readData(t)})}visitTime(t,{length:n,nullCount:r}=this.nextFieldNode()){return Dt({type:t,length:n,nullCount:r,nullBitmap:this.readNullBitmap(t,r),data:this.readData(t)})}visitDecimal(t,{length:n,nullCount:r}=this.nextFieldNode()){return Dt({type:t,length:n,nullCount:r,nullBitmap:this.readNullBitmap(t,r),data:this.readData(t)})}visitList(t,{length:n,nullCount:r}=this.nextFieldNode()){return Dt({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 Dt({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<Ie.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 Dt({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 Dt({type:t,length:n,nullCount:r,typeIds:this.readTypeIds(t),children:this.visitMany(t.children)})}visitDictionary(t,{length:n,nullCount:r}=this.nextFieldNode()){return Dt({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 Dt({type:t,length:n,nullCount:r,nullBitmap:this.readNullBitmap(t,r),data:this.readData(t)})}visitDuration(t,{length:n,nullCount:r}=this.nextFieldNode()){return Dt({type:t,length:n,nullCount:r,nullBitmap:this.readNullBitmap(t,r),data:this.readData(t)})}visitFixedSizeList(t,{length:n,nullCount:r}=this.nextFieldNode()){return Dt({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 Dt({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)}},Ag=class extends Yd{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):_c(this.sources[r])}readOffsets(t,{offset:n}=this.nextBufferRange()){return Pt(Uint8Array,Pt(Int32Array,this.sources[n]))}readTypeIds(t,{offset:n}=this.nextBufferRange()){return Pt(Uint8Array,Pt(t.ArrayType,this.sources[n]))}readData(t,{offset:n}=this.nextBufferRange()){let{sources:r}=this;return at.isTimestamp(t)?Pt(Uint8Array,as.convertArray(r[n])):(at.isInt(t)||at.isTime(t))&&t.bitWidth===64||at.isDuration(t)?Pt(Uint8Array,as.convertArray(r[n])):at.isDate(t)&&t.unit===_n.MILLISECOND?Pt(Uint8Array,as.convertArray(r[n])):at.isDecimal(t)?Pt(Uint8Array,Vd.convertArray(r[n])):at.isBinary(t)||at.isFixedSizeBinary(t)?Z$(r[n]):at.isBool(t)?_c(r[n]):at.isUtf8(t)?ra(r[n].join("")):Pt(Uint8Array,Pt(t.ArrayType,r[n].map(i=>+i)))}};function Z$(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 iu=class extends Ki{constructor(t){super(t),this._values=new ca(new Uint8Array(0))}get byteLength(){let t=this._pendingLength+this.length*4;return this._offsets&&(t+=this._offsets.byteLength),this._values&&(t+=this._values.byteLength),this._nulls&&(t+=this._nulls.byteLength),t}setValue(t,n){return super.setValue(t,Ot(n))}_flushPending(t,n){let r=this._offsets,i=this._values.reserve(n).buffer,o=0;for(let[s,a]of t)if(a===void 0)r.set(s,0);else{let c=a.length;i.set(a,o),r.set(s,c),o+=c}}};var Ng=class extends _e{constructor(t){super(t),this._values=new Jl}setValue(t,n){this._values.set(t,+n)}};var Tc=class extends Ve{};Tc.prototype._setValue=kw;var Gd=class extends Tc{};Gd.prototype._setValue=Ky;var Wd=class extends Tc{};Wd.prototype._setValue=Jy;var Xd=class extends Ve{};Xd.prototype._setValue=Cw;var Rg=class extends _e{constructor({type:t,nullValues:n,dictionaryHashFunction:r}){super({type:new Ir(t.dictionary,t.indices,t.id,t.isOrdered)}),this._nulls=null,this._dictionaryOffset=0,this._keysToIndices=Object.create(null),this.indices=Ec({type:this.type.indices,nullValues:n}),this.dictionary=Ec({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 Hd=class extends Ve{};Hd.prototype._setValue=Dw;var Og=class extends _e{setValue(t,n){let[r]=this.children,i=t*this.stride;for(let o=-1,s=n.length;++o<s;)r.set(i+o,n[o])}addChild(t,n="0"){if(this.numChildren>0)throw new Error("FixedSizeListBuilder can only have one child.");let r=this.children.push(t);return this.type=new Ei(this.type.listSize,new Ut(n,t.type,!0)),r}};var Mc=class extends Ve{setValue(t,n){this._values.set(t,n)}},Dg=class extends Mc{setValue(t,n){super.setValue(t,Id(n))}},kg=class extends Mc{},Fg=class extends Mc{};var Ac=class extends Ve{};Ac.prototype._setValue=Bw;var Zd=class extends Ac{};Zd.prototype._setValue=cg;var Qd=class extends Ac{};Qd.prototype._setValue=lg;var cs=class extends Ve{};cs.prototype._setValue=Pw;var Kd=class extends cs{};Kd.prototype._setValue=ug;var Jd=class extends cs{};Jd.prototype._setValue=fg;var th=class extends cs{};th.prototype._setValue=dg;var eh=class extends cs{};eh.prototype._setValue=hg;var Zr=class extends Ve{setValue(t,n){this._values.set(t,n)}},Lg=class extends Zr{},Cg=class extends Zr{},Bg=class extends Zr{},Pg=class extends Zr{},Ug=class extends Zr{},$g=class extends Zr{},zg=class extends Zr{},qg=class extends Zr{};var jg=class extends Ki{constructor(t){super(t),this._offsets=new tu}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 Ii(new Ut(n,t.type,!0)),this.numChildren-1}_flushPending(t){let n=this._offsets,[r]=this.children;for(let[i,o]of t)if(typeof o>"u")n.set(i,0);else{let s=o,a=s.length,c=n.set(i,a).buffer[i];for(let l=-1;++l<a;)r.set(c+l,s[l])}}};var Vg=class extends Ki{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 Mi(new Ut(n,t.type,!0),this.type.keysSorted),this.numChildren-1}_flushPending(t){let n=this._offsets,[r]=this.children;for(let[i,o]of t)if(o===void 0)n.set(i,0);else{let{[i]:s,[i+1]:a}=n.set(i,o.size).buffer;for(let c of o.entries())if(r.set(s,c),++s>=a)break}}};var Yg=class extends _e{setValue(t,n){}setValid(t,n){return this.length=Math.max(t+1,this.length),n}};var Gg=class extends _e{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 Ut(n,t.type,!0)]),r}};var ls=class extends Ve{};ls.prototype._setValue=Fw;var nh=class extends ls{};nh.prototype._setValue=tg;var rh=class extends ls{};rh.prototype._setValue=eg;var ih=class extends ls{};ih.prototype._setValue=ng;var oh=class extends ls{};oh.prototype._setValue=rg;var us=class extends Ve{};us.prototype._setValue=Lw;var sh=class extends us{};sh.prototype._setValue=ig;var ah=class extends us{};ah.prototype._setValue=og;var ch=class extends us{};ch.prototype._setValue=sg;var lh=class extends us{};lh.prototype._setValue=ag;var ou=class extends _e{constructor(t){super(t),this._typeIds=new es(new Int8Array(0),1),typeof t.valueToChildTypeId=="function"&&(this._valueToChildTypeId=t.valueToChildTypeId)}get typeIdToChildIndex(){return this.type.typeIdToChildIndex}append(t,n){return this.set(this.length,t,n)}set(t,n,r){return r===void 0&&(r=this._valueToChildTypeId(this,n,t)),this.setValue(t,n,r),this}setValue(t,n,r){this._typeIds.set(t,r);let i=this.type.typeIdToChildIndex[r],o=this.children[i];o?.set(t,n)}addChild(t,n=`${this.children.length}`){let r=this.children.push(t),{type:{children:i,mode:o,typeIds:s}}=this,a=[...i,new Ut(n,t.type)];return this.type=new Ti(o,[...s,r],a),r}_valueToChildTypeId(t,n,r){throw new Error("Cannot map UnionBuilder value to child typeId. Pass the `childTypeId` as the second argument to unionBuilder.append(), or supply a `valueToChildTypeId` function as part of the UnionBuilder constructor options.")}},Wg=class extends ou{},Xg=class extends ou{constructor(t){super(t),this._offsets=new es(new Int32Array(0))}setValue(t,n,r){let i=this._typeIds.set(t,r).buffer[t],o=this.getChildAt(this.type.typeIdToChildIndex[i]),s=this._offsets.set(t,o.length).buffer[t];o?.set(s,n)}};var uh=class extends Ki{constructor(t){super(t),this._values=new ca(new Uint8Array(0))}get byteLength(){let t=this._pendingLength+this.length*4;return this._offsets&&(t+=this._offsets.byteLength),this._values&&(t+=this._values.byteLength),this._nulls&&(t+=this._nulls.byteLength),t}setValue(t,n){return super.setValue(t,ra(n))}_flushPending(t,n){}};uh.prototype._flushPending=iu.prototype._flushPending;var ev=class extends ut{visitNull(){return Yg}visitBool(){return Ng}visitInt(){return Zr}visitInt8(){return Lg}visitInt16(){return Cg}visitInt32(){return Bg}visitInt64(){return Pg}visitUint8(){return Ug}visitUint16(){return $g}visitUint32(){return zg}visitUint64(){return qg}visitFloat(){return Mc}visitFloat16(){return Dg}visitFloat32(){return kg}visitFloat64(){return Fg}visitUtf8(){return uh}visitBinary(){return iu}visitFixedSizeBinary(){return Hd}visitDate(){return Tc}visitDateDay(){return Gd}visitDateMillisecond(){return Wd}visitTimestamp(){return ls}visitTimestampSecond(){return nh}visitTimestampMillisecond(){return rh}visitTimestampMicrosecond(){return ih}visitTimestampNanosecond(){return oh}visitTime(){return us}visitTimeSecond(){return sh}visitTimeMillisecond(){return ah}visitTimeMicrosecond(){return ch}visitTimeNanosecond(){return lh}visitDecimal(){return Xd}visitList(){return jg}visitStruct(){return Gg}visitUnion(){return ou}visitDenseUnion(){return Xg}visitSparseUnion(){return Wg}visitDictionary(){return Rg}visitInterval(){return Ac}visitIntervalDayTime(){return Zd}visitIntervalYearMonth(){return Qd}visitDuration(){return cs}visitDurationSecond(){return Kd}visitDurationMillisecond(){return Jd}visitDurationMicrosecond(){return th}visistDurationNanosecond(){return eh}visitFixedSizeList(){return Og}visitMap(){return Vg}},dO=new ev;var _t=class extends ut{compareSchemas(t,n){return t===n||n instanceof t.constructor&&this.compareManyFields(t.fields,n.fields)}compareManyFields(t,n){return t===n||Array.isArray(t)&&Array.isArray(n)&&t.length===n.length&&t.every((r,i)=>this.compareFields(r,n[i]))}compareFields(t,n){return t===n||n instanceof t.constructor&&t.name===n.name&&t.nullable===n.nullable&&this.visit(t.type,n.type)}};function Gn(e,t){return t instanceof e.constructor}function fh(e,t){return e===t||Gn(e,t)}function fs(e,t){return e===t||Gn(e,t)&&e.bitWidth===t.bitWidth&&e.isSigned===t.isSigned}function Hg(e,t){return e===t||Gn(e,t)&&e.precision===t.precision}function Q$(e,t){return e===t||Gn(e,t)&&e.byteWidth===t.byteWidth}function nv(e,t){return e===t||Gn(e,t)&&e.unit===t.unit}function dh(e,t){return e===t||Gn(e,t)&&e.unit===t.unit&&e.timezone===t.timezone}function hh(e,t){return e===t||Gn(e,t)&&e.unit===t.unit&&e.bitWidth===t.bitWidth}function K$(e,t){return e===t||Gn(e,t)&&e.children.length===t.children.length&&io.compareManyFields(e.children,t.children)}function J$(e,t){return e===t||Gn(e,t)&&e.children.length===t.children.length&&io.compareManyFields(e.children,t.children)}function rv(e,t){return e===t||Gn(e,t)&&e.mode===t.mode&&e.typeIds.every((n,r)=>n===t.typeIds[r])&&io.compareManyFields(e.children,t.children)}function tz(e,t){return e===t||Gn(e,t)&&e.id===t.id&&e.isOrdered===t.isOrdered&&io.visit(e.indices,t.indices)&&io.visit(e.dictionary,t.dictionary)}function iv(e,t){return e===t||Gn(e,t)&&e.unit===t.unit}function ph(e,t){return e===t||Gn(e,t)&&e.unit===t.unit}function ez(e,t){return e===t||Gn(e,t)&&e.listSize===t.listSize&&e.children.length===t.children.length&&io.compareManyFields(e.children,t.children)}function nz(e,t){return e===t||Gn(e,t)&&e.keysSorted===t.keysSorted&&e.children.length===t.children.length&&io.compareManyFields(e.children,t.children)}_t.prototype.visitNull=fh;_t.prototype.visitBool=fh;_t.prototype.visitInt=fs;_t.prototype.visitInt8=fs;_t.prototype.visitInt16=fs;_t.prototype.visitInt32=fs;_t.prototype.visitInt64=fs;_t.prototype.visitUint8=fs;_t.prototype.visitUint16=fs;_t.prototype.visitUint32=fs;_t.prototype.visitUint64=fs;_t.prototype.visitFloat=Hg;_t.prototype.visitFloat16=Hg;_t.prototype.visitFloat32=Hg;_t.prototype.visitFloat64=Hg;_t.prototype.visitUtf8=fh;_t.prototype.visitBinary=fh;_t.prototype.visitFixedSizeBinary=Q$;_t.prototype.visitDate=nv;_t.prototype.visitDateDay=nv;_t.prototype.visitDateMillisecond=nv;_t.prototype.visitTimestamp=dh;_t.prototype.visitTimestampSecond=dh;_t.prototype.visitTimestampMillisecond=dh;_t.prototype.visitTimestampMicrosecond=dh;_t.prototype.visitTimestampNanosecond=dh;_t.prototype.visitTime=hh;_t.prototype.visitTimeSecond=hh;_t.prototype.visitTimeMillisecond=hh;_t.prototype.visitTimeMicrosecond=hh;_t.prototype.visitTimeNanosecond=hh;_t.prototype.visitDecimal=fh;_t.prototype.visitList=K$;_t.prototype.visitStruct=J$;_t.prototype.visitUnion=rv;_t.prototype.visitDenseUnion=rv;_t.prototype.visitSparseUnion=rv;_t.prototype.visitDictionary=tz;_t.prototype.visitInterval=iv;_t.prototype.visitIntervalDayTime=iv;_t.prototype.visitIntervalYearMonth=iv;_t.prototype.visitDuration=ph;_t.prototype.visitDurationSecond=ph;_t.prototype.visitDurationMillisecond=ph;_t.prototype.visitDurationMicrosecond=ph;_t.prototype.visitDurationNanosecond=ph;_t.prototype.visitFixedSizeList=ez;_t.prototype.visitMap=nz;var io=new _t;function Nc(e,t){return io.compareSchemas(e,t)}function hO(e,t){return io.compareFields(e,t)}function pO(e,t){return io.visit(e,t)}function Ec(e){let t=e.type,n=new(dO.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(Ec(Object.assign(Object.assign({},l),{type:c})))}}return n}function Zg(e,t){return rz(e,t.map(n=>n.data.concat()))}function rz(e,t){let n=[...e.fields],r=[],i={numBatches:t.reduce((f,d)=>Math.max(f,d.length),0)},o=0,s=0,a=-1,c=t.length,l,u=[];for(;i.numBatches-- >0;){for(s=Number.POSITIVE_INFINITY,a=-1;++a<c;)u[a]=l=t[a].shift(),s=Math.min(s,l?l.length:s);Number.isFinite(s)&&(u=iz(n,s,u,t,i),s>0&&(r[o++]=Dt({type:new ye(n),length:s,nullCount:0,children:u.slice()})))}return[e=e.assign(n),r.map(f=>new ke(e,f))]}function iz(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:Dt({type:f.type,length:t,nullCount:t,nullBitmap:new Uint8Array(s)})}}return n}var mO,on=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 ke)return[c];if(c instanceof e)return c.batches;if(c instanceof se){if(c.type instanceof ye)return[new ke(new re(c.type.children),c)]}else{if(Array.isArray(c))return c.flatMap(l=>s(l));if(typeof c[Symbol.iterator]=="function")return[...c].flatMap(l=>s(l));if(typeof c=="object"){let l=Object.keys(c),u=l.map(h=>new jt([c[h]])),f=new re(l.map((h,p)=>new Ut(String(h),u[p].type))),[,d]=Zg(f,u);return d.length===0?[new ke(c)]:d}}}return[]},a=t.flatMap(c=>s(c));if(i=(r=i??((n=a[0])===null||n===void 0?void 0:n.schema))!==null&&r!==void 0?r:new re([]),!(i instanceof re))throw new TypeError("Table constructor expects a [Schema, RecordBatch[]] pair.");for(let c of a){if(!(c instanceof ke))throw new TypeError("Table constructor expects a [Schema, RecordBatch[]] pair.");if(!Nc(i,c.schema))throw new TypeError("Table and inner RecordBatch schemas must be equivalent.")}this.schema=i,this.batches=a,this._offsets=o??bg(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=gg(this.data)),this._nullCount}isValid(t){return!1}get(t){return null}set(t,n){}indexOf(t,n){return-1}getByteLength(t){return 0}[Symbol.iterator](){return this.batches.length>0?Kl.visit(new jt(this.data)):new Array(0)[Symbol.iterator]()}toArray(){return[...this]}toString(){return`[
7
+ return true;`)}function $H(e){return typeof e!="bigint"?Uo(e):`${Uo(e)}n`}function NA(e,t){let r=Math.ceil(e)*t-1;return(r-r%64+64||64)/t}function wC(e,t=0){return e.length>=t?e.subarray(0,t):Em(new e.constructor(t),e,0)}var Wo=class{constructor(t,r=0,n=1){this.length=Math.ceil(r/n),this.buffer=new t(this.length),this.stride=n,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,r){return this}append(t){return this.set(this.length,t)}reserve(t){if(t>0){this.length+=t;let r=this.stride,n=this.length*r,i=this.buffer.length;n>=i&&this._resize(i===0?NA(n*1,this.BYTES_PER_ELEMENT):NA(n*2,this.BYTES_PER_ELEMENT))}return this}flush(t=this.length){t=NA(t*this.stride,this.BYTES_PER_ELEMENT);let r=wC(this.buffer,t);return this.clear(),r}clear(){return this.length=0,this.buffer=new this.ArrayType,this}_resize(t){return this.buffer=wC(this.buffer,t)}},Ya=class extends Wo{last(){return this.get(this.length-1)}get(t){return this.buffer[t]}set(t,r){return this.reserve(t-this.length+1),this.buffer[t*this.stride]=r,this}},zd=class extends Ya{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,r){let{buffer:n}=this.reserve(t-this.length+1),i=t>>3,o=t%8,s=n[i]>>o&1;return r?s===0&&(n[i]|=1<<o,++this.numValid):s===1&&(n[i]&=~(1<<o),--this.numValid),this}clear(){return this.numValid=0,super.clear()}},Vd=class extends Ya{constructor(t){super(t.OffsetArrayType,1,1)}append(t){return this.set(this.length-1,t)}set(t,r){let n=this.length-1,i=this.reserve(t-n+1).buffer;return n<t++&&n>=0&&i.fill(i[n],n,t),i[t]=i[t-1]+r,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 Ge=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:r}){this.length=0,this.finished=!1,this.type=t,this.children=[],this.nullValues=r,this.stride=Bi(t),this._nulls=new zd,r&&r.length>0&&(this._isValid=_C(r))}toVector(){return new le([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:r,_values:n,_nulls:i,_typeIds:o,children:s}=this;return r&&(t+=r.byteLength),n&&(t+=n.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((r,n)=>r+n.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,r){return this.setValid(t,this.isValid(r))&&this.setValue(t,r),this}setValue(t,r){this._setValue(this,t,r)}setValid(t,r){return this.length=this._nulls.set(t,+r).length,r}addChild(t,r=`${this.numChildren}`){throw new Error(`Cannot append children to non-nested type "${this.type}"`)}getChildAt(t){return this.children[t]||null}flush(){let t,r,n,i,{type:o,length:s,nullCount:a,_typeIds:c,_offsets:l,_values:u,_nulls:f}=this;(r=c?.flush(s))?i=l?.flush(s):(i=l?.flush(s))?t=u?.flush(l.last()):t=u?.flush(s),a>0&&(n=f?.flush(s));let d=this.children.map(h=>h.flush());return this.clear(),Vt({type:o,length:s,nullCount:a,children:d,child:d[0],data:t,typeIds:r,nullBitmap:n,valueOffsets:i})}finish(){this.finished=!0;for(let t of this.children)t.finish();return this}clear(){var t,r,n,i;this.length=0,(t=this._nulls)===null||t===void 0||t.clear(),(r=this._values)===null||r===void 0||r.clear(),(n=this._offsets)===null||n===void 0||n.clear(),(i=this._typeIds)===null||i===void 0||i.clear();for(let o of this.children)o.clear();return this}};Ge.prototype.length=1;Ge.prototype.stride=1;Ge.prototype.children=null;Ge.prototype.finished=!1;Ge.prototype.nullValues=null;Ge.prototype._isValid=()=>!0;var Er=class extends Ge{constructor(t){super(t),this._values=new Ya(this.ArrayType,0,this.stride)}setValue(t,r){let n=this._values;return n.reserve(t-n.length+1),super.setValue(t,r)}},ui=class extends Ge{constructor(t){super(t),this._pendingLength=0,this._offsets=new Vd(t.type)}setValue(t,r){let n=this._pending||(this._pending=new Map),i=n.get(t);i&&(this._pendingLength-=i.length),this._pendingLength+=r instanceof Bs?r[ro].length:r.length,n.set(t,r)}setValid(t,r){return super.setValid(t,r)?!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,r=this._pendingLength;return this._pendingLength=0,this._pending=void 0,t&&t.size>0&&this._flushPending(t,r),this}};var Gu=class{constructor(){this.bb=null,this.bb_pos=0}__init(t,r){return this.bb_pos=t,this.bb=r,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,r,n,i){return t.prep(8,24),t.writeInt64(BigInt(i??0)),t.pad(4),t.writeInt32(n),t.writeInt64(BigInt(r??0)),t.offset()}};var Oi=class e{constructor(){this.bb=null,this.bb_pos=0}__init(t,r){return this.bb_pos=t,this.bb=r,this}static getRootAsFooter(t,r){return(r||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsFooter(t,r){return t.setPosition(t.position()+4),(r||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):Ee.V1}schema(t){let r=this.bb.__offset(this.bb_pos,6);return r?(t||new ci).__init(this.bb.__indirect(this.bb_pos+r),this.bb):null}dictionaries(t,r){let n=this.bb.__offset(this.bb_pos,8);return n?(r||new Gu).__init(this.bb.__vector(this.bb_pos+n)+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,r){let n=this.bb.__offset(this.bb_pos,10);return n?(r||new Gu).__init(this.bb.__vector(this.bb_pos+n)+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,r){let n=this.bb.__offset(this.bb_pos,12);return n?(r||new zr).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+n)+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,r){t.addFieldInt16(0,r,Ee.V1)}static addSchema(t,r){t.addFieldOffset(1,r,0)}static addDictionaries(t,r){t.addFieldOffset(2,r,0)}static startDictionariesVector(t,r){t.startVector(24,r,8)}static addRecordBatches(t,r){t.addFieldOffset(3,r,0)}static startRecordBatchesVector(t,r){t.startVector(24,r,8)}static addCustomMetadata(t,r){t.addFieldOffset(4,r,0)}static createCustomMetadataVector(t,r){t.startVector(4,r.length,4);for(let n=r.length-1;n>=0;n--)t.addOffset(r[n]);return t.endVector()}static startCustomMetadataVector(t,r){t.startVector(4,r,4)}static endFooter(t){return t.endObject()}static finishFooterBuffer(t,r){t.finish(r)}static finishSizePrefixedFooterBuffer(t,r){t.finish(r,void 0,!0)}};var Ie=class e{constructor(t=[],r,n,i=Ee.V5){this.fields=t||[],this.metadata=r||new Map,n||(n=FA(t)),this.dictionaries=n,this.metadataVersion=i}get[Symbol.toStringTag](){return"Schema"}get names(){return this.fields.map(t=>t.name)}toString(){return`Schema<{ ${this.fields.map((t,r)=>`${r}: ${t}`).join(", ")} }>`}select(t){let r=new Set(t),n=this.fields.filter(i=>r.has(i.name));return new e(n,this.metadata)}selectAt(t){let r=t.map(n=>this.fields[n]).filter(Boolean);return new e(r,this.metadata)}assign(...t){let r=t[0]instanceof e?t[0]:Array.isArray(t[0])?new e(t[0]):new e(t),n=[...this.fields],i=C_(C_(new Map,this.metadata),r.metadata),o=r.fields.filter(a=>{let c=n.findIndex(l=>l.name===a.name);return~c?(n[c]=a.clone({metadata:C_(C_(new Map,n[c].metadata),a.metadata)}))&&!1:!0}),s=FA(o,new Map);return new e([...n,...o],i,new Map([...this.dictionaries,...s]))}};Ie.prototype.fields=null;Ie.prototype.metadata=null;Ie.prototype.dictionaries=null;var re=class e{static new(...t){let[r,n,i,o]=t;return t[0]&&typeof t[0]=="object"&&({name:r}=t[0],n===void 0&&(n=t[0].type),i===void 0&&(i=t[0].nullable),o===void 0&&(o=t[0].metadata)),new e(`${r}`,n,i,o)}constructor(t,r,n=!1,i){this.name=t,this.type=r,this.nullable=n,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[r,n,i,o]=t;return!t[0]||typeof t[0]!="object"?[r=this.name,n=this.type,i=this.nullable,o=this.metadata]=t:{name:r=this.name,type:n=this.type,nullable:i=this.nullable,metadata:o=this.metadata}=t[0],e.new(r,n,i,o)}};re.prototype.type=null;re.prototype.name=null;re.prototype.nullable=null;re.prototype.metadata=null;function C_(e,t){return new Map([...e||new Map,...t||new Map])}function FA(e,t=new Map){for(let r=-1,n=e.length;++r<n;){let o=e[r].type;if(lt.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&&FA(o.children,t)}return t}var zH=Lo,VH=Ar,Wa=class{static decode(t){t=new VH(Et(t));let r=Oi.getRootAsFooter(t),n=Ie.decode(r.schema(),new Map,r.version());return new LA(n,r)}static encode(t){let r=new zH,n=Ie.encode(r,t.schema);Oi.startRecordBatchesVector(r,t.numRecordBatches);for(let s of[...t.recordBatches()].slice().reverse())Ga.encode(r,s);let i=r.endVector();Oi.startDictionariesVector(r,t.numDictionaries);for(let s of[...t.dictionaryBatches()].slice().reverse())Ga.encode(r,s);let o=r.endVector();return Oi.startFooter(r),Oi.addSchema(r,n),Oi.addVersion(r,Ee.V5),Oi.addRecordBatches(r,i),Oi.addDictionaries(r,o),Oi.finishFooterBuffer(r,Oi.endFooter(r)),r.asUint8Array()}get numRecordBatches(){return this._recordBatches.length}get numDictionaries(){return this._dictionaryBatches.length}constructor(t,r=Ee.V5,n,i){this.schema=t,this.version=r,n&&(this._recordBatches=n),i&&(this._dictionaryBatches=i)}*recordBatches(){for(let t,r=-1,n=this.numRecordBatches;++r<n;)(t=this.getRecordBatch(r))&&(yield t)}*dictionaryBatches(){for(let t,r=-1,n=this.numDictionaries;++r<n;)(t=this.getDictionaryBatch(r))&&(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 LA=class extends Wa{get numRecordBatches(){return this._footer.recordBatchesLength()}get numDictionaries(){return this._footer.dictionariesLength()}constructor(t,r){super(t,r.version()),this._footer=r}getRecordBatch(t){if(t>=0&&t<this.numRecordBatches){let r=this._footer.recordBatches(t);if(r)return Ga.decode(r)}return null}getDictionaryBatch(t){if(t>=0&&t<this.numDictionaries){let r=this._footer.dictionaries(t);if(r)return Ga.decode(r)}return null}},Ga=class e{static decode(t){return new e(t.metaDataLength(),t.bodyLength(),t.offset())}static encode(t,r){let{metaDataLength:n}=r,i=BigInt(r.offset),o=BigInt(r.bodyLength);return Gu.createBlock(t,i,n,o)}constructor(t,r,n){this.metaDataLength=t,this.offset=or(n),this.bodyLength=or(r)}};var Ve=Object.freeze({done:!0,value:void 0}),Xm=class{constructor(t){this._json=t}get schema(){return this._json.schema}get batches(){return this._json.batches||[]}get dictionaries(){return this._json.dictionaries||[]}},Xu=class{tee(){return this._getDOMStream().tee()}pipe(t,r){return this._getNodeStream().pipe(t,r)}pipeTo(t,r){return this._getDOMStream().pipeTo(t,r)}pipeThrough(t,r){return this._getDOMStream().pipeThrough(t,r)}_getDOMStream(){return this._DOMStream||(this._DOMStream=this.toDOMStream())}_getNodeStream(){return this._nodeStream||(this._nodeStream=this.toNodeStream())}},U_=class extends Xu{constructor(){super(),this._values=[],this.resolvers=[],this._closedPromise=new Promise(t=>this._closedPromiseResolve=t)}get closed(){return this._closedPromise}cancel(t){return P(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(Ve);this._closedPromiseResolve(),this._closedPromiseResolve=void 0}}[Symbol.asyncIterator](){return this}toDOMStream(t){return on.toDOMStream(this._closedPromiseResolve||this._error?this:this._values,t)}toNodeStream(t){return on.toNodeStream(this._closedPromiseResolve||this._error?this:this._values,t)}throw(t){return P(this,void 0,void 0,function*(){return yield this.abort(t),Ve})}return(t){return P(this,void 0,void 0,function*(){return yield this.close(),Ve})}read(t){return P(this,void 0,void 0,function*(){return(yield this.next(t,"read")).value})}peek(t){return P(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((r,n)=>{this.resolvers.push({resolve:r,reject:n})}):Promise.resolve(Ve)}_ensureOpen(){if(this._closedPromiseResolve)return!0;throw new Error("AsyncQueue is closed")}};var Os=class extends U_{write(t){if((t=Et(t)).byteLength>0)return super.write(t)}toString(t=!1){return t?Am(this.toUint8Array(!0)):this.toUint8Array(!1).then(Am)}toUint8Array(t=!1){return t?Mi(this._values)[0]:P(this,void 0,void 0,function*(){var r,n,i,o;let s=[],a=0;try{for(var c=!0,l=fr(this),u;u=yield l.next(),r=u.done,!r;c=!0){o=u.value,c=!1;let f=o;s.push(f),a+=f.byteLength}}catch(f){n={error:f}}finally{try{!c&&!r&&(i=l.return)&&(yield i.call(l))}finally{if(n)throw n.error}}return Mi(s,a)[0]})}},Ns=class{constructor(t){t&&(this.source=new RA(on.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)}},no=class e{constructor(t){t instanceof e?this.source=t.source:t instanceof Os?this.source=new Xa(on.fromAsyncIterable(t)):Gx(t)?this.source=new Xa(on.fromNodeStream(t)):Mm(t)?this.source=new Xa(on.fromDOMStream(t)):Yx(t)?this.source=new Xa(on.fromDOMStream(t.body)):Oo(t)?this.source=new Xa(on.fromIterable(t)):Ai(t)?this.source=new Xa(on.fromAsyncIterable(t)):to(t)&&(this.source=new Xa(on.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)}},RA=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,r="read"){return this.source.next({cmd:r,size:t})}throw(t){return Object.create(this.source.throw&&this.source.throw(t)||Ve)}return(t){return Object.create(this.source.return&&this.source.return(t)||Ve)}},Xa=class{constructor(t){this.source=t,this._closedPromise=new Promise(r=>this._closedPromiseResolve=r)}cancel(t){return P(this,void 0,void 0,function*(){yield this.return(t)})}get closed(){return this._closedPromise}read(t){return P(this,void 0,void 0,function*(){return(yield this.next(t,"read")).value})}peek(t){return P(this,void 0,void 0,function*(){return(yield this.next(t,"peek")).value})}next(t,r="read"){return P(this,void 0,void 0,function*(){return yield this.source.next({cmd:r,size:t})})}throw(t){return P(this,void 0,void 0,function*(){let r=this.source.throw&&(yield this.source.throw(t))||Ve;return this._closedPromiseResolve&&this._closedPromiseResolve(),this._closedPromiseResolve=void 0,Object.create(r)})}return(t){return P(this,void 0,void 0,function*(){let r=this.source.return&&(yield this.source.return(t))||Ve;return this._closedPromiseResolve&&this._closedPromiseResolve(),this._closedPromiseResolve=void 0,Object.create(r)})}};var Hm=class extends Ns{constructor(t,r){super(),this.position=0,this.buffer=Et(t),this.size=r===void 0?this.buffer.byteLength:r}readInt32(t){let{buffer:r,byteOffset:n}=this.readAt(t,4);return new DataView(r,n).getInt32(0,!0)}seek(t){return this.position=Math.min(t,this.size),t<this.size}read(t){let{buffer:r,size:n,position:i}=this;return r&&i<n?(typeof t!="number"&&(t=Number.POSITIVE_INFINITY),this.position=Math.min(n,i+Math.min(n-i,t)),r.subarray(i,this.position)):null}readAt(t,r){let n=this.buffer,i=Math.min(this.size,t+r);return n?n.subarray(t,i):new Uint8Array(r)}close(){this.buffer&&(this.buffer=null)}throw(t){return this.close(),{done:!0,value:t}}return(t){return this.close(),{done:!0,value:t}}},Ml=class extends no{constructor(t,r){super(),this.position=0,this._handle=t,typeof r=="number"?this.size=r:this._pending=P(this,void 0,void 0,function*(){this.size=(yield t.stat()).size,delete this._pending})}readInt32(t){return P(this,void 0,void 0,function*(){let{buffer:r,byteOffset:n}=yield this.readAt(t,4);return new DataView(r,n).getInt32(0,!0)})}seek(t){return P(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 P(this,void 0,void 0,function*(){this._pending&&(yield this._pending);let{_handle:r,size:n,position:i}=this;if(r&&i<n){typeof t!="number"&&(t=Number.POSITIVE_INFINITY);let o=i,s=0,a=0,c=Math.min(n,o+Math.min(n-o,t)),l=new Uint8Array(Math.max(0,(this.position=c)-o));for(;(o+=a)<c&&(s+=a)<l.byteLength;)({bytesRead:a}=yield r.read(l,s,l.byteLength-s,o));return l}return null})}readAt(t,r){return P(this,void 0,void 0,function*(){this._pending&&(yield this._pending);let{_handle:n,size:i}=this;if(n&&t+r<i){let o=Math.min(i,t+r),s=new Uint8Array(o-t);return(yield n.read(s,0,r,t)).buffer}return new Uint8Array(r)})}close(){return P(this,void 0,void 0,function*(){let t=this._handle;this._handle=null,t&&(yield t.close())})}throw(t){return P(this,void 0,void 0,function*(){return yield this.close(),{done:!0,value:t}})}return(t){return P(this,void 0,void 0,function*(){return yield this.close(),{done:!0,value:t}})}};var CA={};Ir(CA,{BaseInt64:()=>Zm,Int128:()=>Km,Int64:()=>Ha,Uint64:()=>sr});function jd(e){return e<0&&(e=4294967295+e+1),`0x${e.toString(16)}`}var qd=8,kA=[1,10,100,1e3,1e4,1e5,1e6,1e7,1e8],Zm=class{constructor(t){this.buffer=t}high(){return this.buffer[1]}low(){return this.buffer[0]}_times(t){let r=new Uint32Array([this.buffer[1]>>>16,this.buffer[1]&65535,this.buffer[0]>>>16,this.buffer[0]&65535]),n=new Uint32Array([t.buffer[1]>>>16,t.buffer[1]&65535,t.buffer[0]>>>16,t.buffer[0]&65535]),i=r[3]*n[3];this.buffer[0]=i&65535;let o=i>>>16;return i=r[2]*n[3],o+=i,i=r[3]*n[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]+=r[1]*n[3]+r[2]*n[2]+r[3]*n[1],this.buffer[1]+=r[0]*n[3]+r[1]*n[2]+r[2]*n[1]+r[3]*n[0]<<16,this}_plus(t){let r=this.buffer[0]+t.buffer[0]>>>0;this.buffer[1]+=t.buffer[1],r<this.buffer[0]>>>0&&++this.buffer[1],this.buffer[0]=r}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`${jd(this.buffer[1])} ${jd(this.buffer[0])}`}},sr=class e extends Zm{times(t){return this._times(t),this}plus(t){return this._plus(t),this}static from(t,r=new Uint32Array(2)){return e.fromString(typeof t=="string"?t:t.toString(),r)}static fromNumber(t,r=new Uint32Array(2)){return e.fromString(t.toString(),r)}static fromString(t,r=new Uint32Array(2)){let n=t.length,i=new e(r);for(let o=0;o<n;){let s=qd<n-o?qd:n-o,a=new e(new Uint32Array([Number.parseInt(t.slice(o,o+s),10),0])),c=new e(new Uint32Array([kA[s],0]));i.times(c),i.plus(a),o+=s}return i}static convertArray(t){let r=new Uint32Array(t.length*2);for(let n=-1,i=t.length;++n<i;)e.from(t[n],new Uint32Array(r.buffer,r.byteOffset+2*n*4,2));return r}static multiply(t,r){return new e(new Uint32Array(t.buffer)).times(r)}static add(t,r){return new e(new Uint32Array(t.buffer)).plus(r)}},Ha=class e extends Zm{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 r=this.buffer[1]<<0,n=t.buffer[1]<<0;return r<n||r===n&&this.buffer[0]<t.buffer[0]}static from(t,r=new Uint32Array(2)){return e.fromString(typeof t=="string"?t:t.toString(),r)}static fromNumber(t,r=new Uint32Array(2)){return e.fromString(t.toString(),r)}static fromString(t,r=new Uint32Array(2)){let n=t.startsWith("-"),i=t.length,o=new e(r);for(let s=n?1:0;s<i;){let a=qd<i-s?qd:i-s,c=new e(new Uint32Array([Number.parseInt(t.slice(s,s+a),10),0])),l=new e(new Uint32Array([kA[a],0]));o.times(l),o.plus(c),s+=a}return n?o.negate():o}static convertArray(t){let r=new Uint32Array(t.length*2);for(let n=-1,i=t.length;++n<i;)e.from(t[n],new Uint32Array(r.buffer,r.byteOffset+2*n*4,2));return r}static multiply(t,r){return new e(new Uint32Array(t.buffer)).times(r)}static add(t,r){return new e(new Uint32Array(t.buffer)).plus(r)}},Km=class e{constructor(t){this.buffer=t}high(){return new Ha(new Uint32Array(this.buffer.buffer,this.buffer.byteOffset+8,2))}low(){return new Ha(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 r=new sr(new Uint32Array([this.buffer[3],0])),n=new sr(new Uint32Array([this.buffer[2],0])),i=new sr(new Uint32Array([this.buffer[1],0])),o=new sr(new Uint32Array([this.buffer[0],0])),s=new sr(new Uint32Array([t.buffer[3],0])),a=new sr(new Uint32Array([t.buffer[2],0])),c=new sr(new Uint32Array([t.buffer[1],0])),l=new sr(new Uint32Array([t.buffer[0],0])),u=sr.multiply(o,l);this.buffer[0]=u.low();let f=new sr(new Uint32Array([u.high(),0]));return u=sr.multiply(i,l),f.plus(u),u=sr.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 sr(new Uint32Array(this.buffer.buffer,this.buffer.byteOffset+8,2)).plus(sr.multiply(n,l)).plus(sr.multiply(i,c)).plus(sr.multiply(o,a)),this.buffer[3]+=sr.multiply(r,l).plus(sr.multiply(n,c)).plus(sr.multiply(i,a)).plus(sr.multiply(o,s)).low(),this}plus(t){let r=new Uint32Array(4);return r[3]=this.buffer[3]+t.buffer[3]>>>0,r[2]=this.buffer[2]+t.buffer[2]>>>0,r[1]=this.buffer[1]+t.buffer[1]>>>0,r[0]=this.buffer[0]+t.buffer[0]>>>0,r[0]<this.buffer[0]>>>0&&++r[1],r[1]<this.buffer[1]>>>0&&++r[2],r[2]<this.buffer[2]>>>0&&++r[3],this.buffer[3]=r[3],this.buffer[2]=r[2],this.buffer[1]=r[1],this.buffer[0]=r[0],this}hex(){return`${jd(this.buffer[3])} ${jd(this.buffer[2])} ${jd(this.buffer[1])} ${jd(this.buffer[0])}`}static multiply(t,r){return new e(new Uint32Array(t.buffer)).times(r)}static add(t,r){return new e(new Uint32Array(t.buffer)).plus(r)}static from(t,r=new Uint32Array(4)){return e.fromString(typeof t=="string"?t:t.toString(),r)}static fromNumber(t,r=new Uint32Array(4)){return e.fromString(t.toString(),r)}static fromString(t,r=new Uint32Array(4)){let n=t.startsWith("-"),i=t.length,o=new e(r);for(let s=n?1:0;s<i;){let a=qd<i-s?qd:i-s,c=new e(new Uint32Array([Number.parseInt(t.slice(s,s+a),10),0,0,0])),l=new e(new Uint32Array([kA[a],0,0,0]));o.times(l),o.plus(c),s+=a}return n?o.negate():o}static convertArray(t){let r=new Uint32Array(t.length*4);for(let n=-1,i=t.length;++n<i;)e.from(t[n],new Uint32Array(r.buffer,r.byteOffset+4*4*n,4));return r}};var Qm=class extends xt{constructor(t,r,n,i,o=Ee.V5){super(),this.nodesIndex=-1,this.buffersIndex=-1,this.bytes=t,this.nodes=r,this.buffers=n,this.dictionaries=i,this.metadataVersion=o}visit(t){return super.visit(t instanceof re?t.type:t)}visitNull(t,{length:r}=this.nextFieldNode()){return Vt({type:t,length:r})}visitBool(t,{length:r,nullCount:n}=this.nextFieldNode()){return Vt({type:t,length:r,nullCount:n,nullBitmap:this.readNullBitmap(t,n),data:this.readData(t)})}visitInt(t,{length:r,nullCount:n}=this.nextFieldNode()){return Vt({type:t,length:r,nullCount:n,nullBitmap:this.readNullBitmap(t,n),data:this.readData(t)})}visitFloat(t,{length:r,nullCount:n}=this.nextFieldNode()){return Vt({type:t,length:r,nullCount:n,nullBitmap:this.readNullBitmap(t,n),data:this.readData(t)})}visitUtf8(t,{length:r,nullCount:n}=this.nextFieldNode()){return Vt({type:t,length:r,nullCount:n,nullBitmap:this.readNullBitmap(t,n),valueOffsets:this.readOffsets(t),data:this.readData(t)})}visitLargeUtf8(t,{length:r,nullCount:n}=this.nextFieldNode()){return Vt({type:t,length:r,nullCount:n,nullBitmap:this.readNullBitmap(t,n),valueOffsets:this.readOffsets(t),data:this.readData(t)})}visitBinary(t,{length:r,nullCount:n}=this.nextFieldNode()){return Vt({type:t,length:r,nullCount:n,nullBitmap:this.readNullBitmap(t,n),valueOffsets:this.readOffsets(t),data:this.readData(t)})}visitLargeBinary(t,{length:r,nullCount:n}=this.nextFieldNode()){return Vt({type:t,length:r,nullCount:n,nullBitmap:this.readNullBitmap(t,n),valueOffsets:this.readOffsets(t),data:this.readData(t)})}visitFixedSizeBinary(t,{length:r,nullCount:n}=this.nextFieldNode()){return Vt({type:t,length:r,nullCount:n,nullBitmap:this.readNullBitmap(t,n),data:this.readData(t)})}visitDate(t,{length:r,nullCount:n}=this.nextFieldNode()){return Vt({type:t,length:r,nullCount:n,nullBitmap:this.readNullBitmap(t,n),data:this.readData(t)})}visitTimestamp(t,{length:r,nullCount:n}=this.nextFieldNode()){return Vt({type:t,length:r,nullCount:n,nullBitmap:this.readNullBitmap(t,n),data:this.readData(t)})}visitTime(t,{length:r,nullCount:n}=this.nextFieldNode()){return Vt({type:t,length:r,nullCount:n,nullBitmap:this.readNullBitmap(t,n),data:this.readData(t)})}visitDecimal(t,{length:r,nullCount:n}=this.nextFieldNode()){return Vt({type:t,length:r,nullCount:n,nullBitmap:this.readNullBitmap(t,n),data:this.readData(t)})}visitList(t,{length:r,nullCount:n}=this.nextFieldNode()){return Vt({type:t,length:r,nullCount:n,nullBitmap:this.readNullBitmap(t,n),valueOffsets:this.readOffsets(t),child:this.visit(t.children[0])})}visitStruct(t,{length:r,nullCount:n}=this.nextFieldNode()){return Vt({type:t,length:r,nullCount:n,nullBitmap:this.readNullBitmap(t,n),children:this.visitMany(t.children)})}visitUnion(t,{length:r,nullCount:n}=this.nextFieldNode()){return this.metadataVersion<Ee.V5&&this.readNullBitmap(t,n),t.mode===Ue.Sparse?this.visitSparseUnion(t,{length:r,nullCount:n}):this.visitDenseUnion(t,{length:r,nullCount:n})}visitDenseUnion(t,{length:r,nullCount:n}=this.nextFieldNode()){return Vt({type:t,length:r,nullCount:n,typeIds:this.readTypeIds(t),valueOffsets:this.readOffsets(t),children:this.visitMany(t.children)})}visitSparseUnion(t,{length:r,nullCount:n}=this.nextFieldNode()){return Vt({type:t,length:r,nullCount:n,typeIds:this.readTypeIds(t),children:this.visitMany(t.children)})}visitDictionary(t,{length:r,nullCount:n}=this.nextFieldNode()){return Vt({type:t,length:r,nullCount:n,nullBitmap:this.readNullBitmap(t,n),data:this.readData(t.indices),dictionary:this.readDictionary(t)})}visitInterval(t,{length:r,nullCount:n}=this.nextFieldNode()){return Vt({type:t,length:r,nullCount:n,nullBitmap:this.readNullBitmap(t,n),data:this.readData(t)})}visitDuration(t,{length:r,nullCount:n}=this.nextFieldNode()){return Vt({type:t,length:r,nullCount:n,nullBitmap:this.readNullBitmap(t,n),data:this.readData(t)})}visitFixedSizeList(t,{length:r,nullCount:n}=this.nextFieldNode()){return Vt({type:t,length:r,nullCount:n,nullBitmap:this.readNullBitmap(t,n),child:this.visit(t.children[0])})}visitMap(t,{length:r,nullCount:n}=this.nextFieldNode()){return Vt({type:t,length:r,nullCount:n,nullBitmap:this.readNullBitmap(t,n),valueOffsets:this.readOffsets(t),child:this.visit(t.children[0])})}nextFieldNode(){return this.nodes[++this.nodesIndex]}nextBufferRange(){return this.buffers[++this.buffersIndex]}readNullBitmap(t,r,n=this.nextBufferRange()){return r>0&&this.readData(t,n)||new Uint8Array(0)}readOffsets(t,r){return this.readData(t,r)}readTypeIds(t,r){return this.readData(t,r)}readData(t,{length:r,offset:n}=this.nextBufferRange()){return this.bytes.subarray(n,n+r)}readDictionary(t){return this.dictionaries.get(t.id)}},P_=class extends Qm{constructor(t,r,n,i,o){super(new Uint8Array(0),r,n,i,o),this.sources=t}readNullBitmap(t,r,{offset:n}=this.nextBufferRange()){return r<=0?new Uint8Array(0):Yu(this.sources[n])}readOffsets(t,{offset:r}=this.nextBufferRange()){return te(Uint8Array,te(t.OffsetArrayType,this.sources[r]))}readTypeIds(t,{offset:r}=this.nextBufferRange()){return te(Uint8Array,te(t.ArrayType,this.sources[r]))}readData(t,{offset:r}=this.nextBufferRange()){let{sources:n}=this;return lt.isTimestamp(t)?te(Uint8Array,Ha.convertArray(n[r])):(lt.isInt(t)||lt.isTime(t))&&t.bitWidth===64||lt.isDuration(t)?te(Uint8Array,Ha.convertArray(n[r])):lt.isDate(t)&&t.unit===Tr.MILLISECOND?te(Uint8Array,Ha.convertArray(n[r])):lt.isDecimal(t)?te(Uint8Array,Km.convertArray(n[r])):lt.isBinary(t)||lt.isLargeBinary(t)||lt.isFixedSizeBinary(t)?jH(n[r]):lt.isBool(t)?Yu(n[r]):lt.isUtf8(t)||lt.isLargeUtf8(t)?Is(n[r].join("")):te(Uint8Array,te(t.ArrayType,n[r].map(i=>+i)))}};function jH(e){let t=e.join(""),r=new Uint8Array(t.length/2);for(let n=0;n<t.length;n+=2)r[n>>1]=Number.parseInt(t.slice(n,n+2),16);return r}var Yd=class extends ui{constructor(t){super(t),this._values=new Wo(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,r){return super.setValue(t,Et(r))}_flushPending(t,r){let n=this._offsets,i=this._values.reserve(r).buffer,o=0;for(let[s,a]of t)if(a===void 0)n.set(s,0);else{let c=a.length;i.set(a,o),n.set(s,c),o+=c}}};var Wd=class extends ui{constructor(t){super(t),this._values=new Wo(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,r){return super.setValue(t,Et(r))}_flushPending(t,r){let n=this._offsets,i=this._values.reserve(r).buffer,o=0;for(let[s,a]of t)if(a===void 0)n.set(s,BigInt(0));else{let c=a.length;i.set(a,o),n.set(s,BigInt(c)),o+=c}}};var $_=class extends Ge{constructor(t){super(t),this._values=new zd}setValue(t,r){this._values.set(t,+r)}};var Hu=class extends Er{};Hu.prototype._setValue=yA;var Jm=class extends Hu{};Jm.prototype._setValue=d_;var ty=class extends Hu{};ty.prototype._setValue=h_;var ey=class extends Er{};ey.prototype._setValue=xA;var z_=class extends Ge{constructor({type:t,nullValues:r,dictionaryHashFunction:n}){super({type:new Di(t.dictionary,t.indices,t.id,t.isOrdered)}),this._nulls=null,this._dictionaryOffset=0,this._keysToIndices=Object.create(null),this.indices=Zu({type:this.type.indices,nullValues:r}),this.dictionary=Zu({type:this.type.dictionary,nullValues:null}),typeof n=="function"&&(this.valueToKey=n)}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,r){let n=this.indices;return r=n.setValid(t,r),this.length=n.length,r}setValue(t,r){let n=this._keysToIndices,i=this.valueToKey(r),o=n[i];return o===void 0&&(n[i]=o=this._dictionaryOffset+this.dictionary.append(r).length-1),this.indices.setValue(t,o)}flush(){let t=this.type,r=this._dictionary,n=this.dictionary.toVector(),i=this.indices.flush().clone(t);return i.dictionary=r?r.concat(n):n,this.finished||(this._dictionaryOffset+=n.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 ry=class extends Er{};ry.prototype._setValue=mA;var V_=class extends Ge{setValue(t,r){let[n]=this.children,i=t*this.stride;for(let o=-1,s=r.length;++o<s;)n.set(i+o,r[o])}addChild(t,r="0"){if(this.numChildren>0)throw new Error("FixedSizeListBuilder can only have one child.");let n=this.children.push(t);return this.type=new jo(this.type.listSize,new re(r,t.type,!0)),n}};var Ku=class extends Er{setValue(t,r){this._values.set(t,r)}},j_=class extends Ku{setValue(t,r){super.setValue(t,jm(r))}},q_=class extends Ku{},Y_=class extends Ku{};var Qu=class extends Er{};Qu.prototype._setValue=_A;var ny=class extends Qu{};ny.prototype._setValue=v_;var iy=class extends Qu{};iy.prototype._setValue=S_;var Za=class extends Er{};Za.prototype._setValue=wA;var oy=class extends Za{};oy.prototype._setValue=I_;var sy=class extends Za{};sy.prototype._setValue=T_;var ay=class extends Za{};ay.prototype._setValue=A_;var cy=class extends Za{};cy.prototype._setValue=M_;var io=class extends Er{setValue(t,r){this._values.set(t,r)}},W_=class extends io{},G_=class extends io{},X_=class extends io{},H_=class extends io{},Z_=class extends io{},K_=class extends io{},Q_=class extends io{},J_=class extends io{};var t1=class extends ui{constructor(t){super(t),this._offsets=new Vd(t.type)}addChild(t,r="0"){if(this.numChildren>0)throw new Error("ListBuilder can only have one child.");return this.children[this.numChildren]=t,this.type=new zo(new re(r,t.type,!0)),this.numChildren-1}_flushPending(t){let r=this._offsets,[n]=this.children;for(let[i,o]of t)if(typeof o>"u")r.set(i,0);else{let s=o,a=s.length,c=r.set(i,a).buffer[i];for(let l=-1;++l<a;)n.set(c+l,s[l])}}};var e1=class extends ui{set(t,r){return super.set(t,r)}setValue(t,r){let n=r instanceof Map?r:new Map(Object.entries(r)),i=this._pending||(this._pending=new Map),o=i.get(t);o&&(this._pendingLength-=o.size),this._pendingLength+=n.size,i.set(t,n)}addChild(t,r=`${this.numChildren}`){if(this.numChildren>0)throw new Error("ListBuilder can only have one child.");return this.children[this.numChildren]=t,this.type=new qo(new re(r,t.type,!0),this.type.keysSorted),this.numChildren-1}_flushPending(t){let r=this._offsets,[n]=this.children;for(let[i,o]of t)if(o===void 0)r.set(i,0);else{let{[i]:s,[i+1]:a}=r.set(i,o.size).buffer;for(let c of o.entries())if(n.set(s,c),++s>=a)break}}};var r1=class extends Ge{setValue(t,r){}setValid(t,r){return this.length=Math.max(t+1,this.length),r}};var n1=class extends Ge{setValue(t,r){let{children:n,type:i}=this;switch(Array.isArray(r)||r.constructor){case!0:return i.children.forEach((o,s)=>n[s].set(t,r[s]));case Map:return i.children.forEach((o,s)=>n[s].set(t,r.get(o.name)));default:return i.children.forEach((o,s)=>n[s].set(t,r[o.name]))}}setValid(t,r){return super.setValid(t,r)||this.children.forEach(n=>n.setValid(t,r)),r}addChild(t,r=`${this.numChildren}`){let n=this.children.push(t);return this.type=new ze([...this.type.children,new re(r,t.type,!0)]),n}};var Ka=class extends Er{};Ka.prototype._setValue=gA;var ly=class extends Ka{};ly.prototype._setValue=p_;var uy=class extends Ka{};uy.prototype._setValue=m_;var fy=class extends Ka{};fy.prototype._setValue=y_;var dy=class extends Ka{};dy.prototype._setValue=g_;var Qa=class extends Er{};Qa.prototype._setValue=bA;var hy=class extends Qa{};hy.prototype._setValue=b_;var py=class extends Qa{};py.prototype._setValue=x_;var my=class extends Qa{};my.prototype._setValue=__;var yy=class extends Qa{};yy.prototype._setValue=w_;var Gd=class extends Ge{constructor(t){super(t),this._typeIds=new Ya(Int8Array,0,1),typeof t.valueToChildTypeId=="function"&&(this._valueToChildTypeId=t.valueToChildTypeId)}get typeIdToChildIndex(){return this.type.typeIdToChildIndex}append(t,r){return this.set(this.length,t,r)}set(t,r,n){return n===void 0&&(n=this._valueToChildTypeId(this,r,t)),this.setValue(t,r,n),this}setValue(t,r,n){this._typeIds.set(t,n);let i=this.type.typeIdToChildIndex[n],o=this.children[i];o?.set(t,r)}addChild(t,r=`${this.children.length}`){let n=this.children.push(t),{type:{children:i,mode:o,typeIds:s}}=this,a=[...i,new re(r,t.type)];return this.type=new Vo(o,[...s,n],a),n}_valueToChildTypeId(t,r,n){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.")}},i1=class extends Gd{},o1=class extends Gd{constructor(t){super(t),this._offsets=new Ya(Int32Array)}setValue(t,r,n){let i=this._typeIds.set(t,n).buffer[t],o=this.getChildAt(this.type.typeIdToChildIndex[i]),s=this._offsets.set(t,o.length).buffer[t];o?.set(s,r)}};var gy=class extends ui{constructor(t){super(t),this._values=new Wo(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,r){return super.setValue(t,Is(r))}_flushPending(t,r){}};gy.prototype._flushPending=Yd.prototype._flushPending;var by=class extends ui{constructor(t){super(t),this._values=new Wo(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,r){return super.setValue(t,Is(r))}_flushPending(t,r){}};by.prototype._flushPending=Wd.prototype._flushPending;var UA=class extends xt{visitNull(){return r1}visitBool(){return $_}visitInt(){return io}visitInt8(){return W_}visitInt16(){return G_}visitInt32(){return X_}visitInt64(){return H_}visitUint8(){return Z_}visitUint16(){return K_}visitUint32(){return Q_}visitUint64(){return J_}visitFloat(){return Ku}visitFloat16(){return j_}visitFloat32(){return q_}visitFloat64(){return Y_}visitUtf8(){return gy}visitLargeUtf8(){return by}visitBinary(){return Yd}visitLargeBinary(){return Wd}visitFixedSizeBinary(){return ry}visitDate(){return Hu}visitDateDay(){return Jm}visitDateMillisecond(){return ty}visitTimestamp(){return Ka}visitTimestampSecond(){return ly}visitTimestampMillisecond(){return uy}visitTimestampMicrosecond(){return fy}visitTimestampNanosecond(){return dy}visitTime(){return Qa}visitTimeSecond(){return hy}visitTimeMillisecond(){return py}visitTimeMicrosecond(){return my}visitTimeNanosecond(){return yy}visitDecimal(){return ey}visitList(){return t1}visitStruct(){return n1}visitUnion(){return Gd}visitDenseUnion(){return o1}visitSparseUnion(){return i1}visitDictionary(){return z_}visitInterval(){return Qu}visitIntervalDayTime(){return ny}visitIntervalYearMonth(){return iy}visitDuration(){return Za}visitDurationSecond(){return oy}visitDurationMillisecond(){return sy}visitDurationMicrosecond(){return ay}visitDurationNanosecond(){return cy}visitFixedSizeList(){return V_}visitMap(){return e1}},vC=new UA;var St=class extends xt{compareSchemas(t,r){return t===r||r instanceof t.constructor&&this.compareManyFields(t.fields,r.fields)}compareManyFields(t,r){return t===r||Array.isArray(t)&&Array.isArray(r)&&t.length===r.length&&t.every((n,i)=>this.compareFields(n,r[i]))}compareFields(t,r){return t===r||r instanceof t.constructor&&t.name===r.name&&t.nullable===r.nullable&&this.visit(t.type,r.type)}};function Pn(e,t){return t instanceof e.constructor}function Ju(e,t){return e===t||Pn(e,t)}function Ja(e,t){return e===t||Pn(e,t)&&e.bitWidth===t.bitWidth&&e.isSigned===t.isSigned}function s1(e,t){return e===t||Pn(e,t)&&e.precision===t.precision}function qH(e,t){return e===t||Pn(e,t)&&e.byteWidth===t.byteWidth}function PA(e,t){return e===t||Pn(e,t)&&e.unit===t.unit}function xy(e,t){return e===t||Pn(e,t)&&e.unit===t.unit&&e.timezone===t.timezone}function _y(e,t){return e===t||Pn(e,t)&&e.unit===t.unit&&e.bitWidth===t.bitWidth}function YH(e,t){return e===t||Pn(e,t)&&e.children.length===t.children.length&&Fs.compareManyFields(e.children,t.children)}function WH(e,t){return e===t||Pn(e,t)&&e.children.length===t.children.length&&Fs.compareManyFields(e.children,t.children)}function $A(e,t){return e===t||Pn(e,t)&&e.mode===t.mode&&e.typeIds.every((r,n)=>r===t.typeIds[n])&&Fs.compareManyFields(e.children,t.children)}function GH(e,t){return e===t||Pn(e,t)&&e.id===t.id&&e.isOrdered===t.isOrdered&&Fs.visit(e.indices,t.indices)&&Fs.visit(e.dictionary,t.dictionary)}function zA(e,t){return e===t||Pn(e,t)&&e.unit===t.unit}function wy(e,t){return e===t||Pn(e,t)&&e.unit===t.unit}function XH(e,t){return e===t||Pn(e,t)&&e.listSize===t.listSize&&e.children.length===t.children.length&&Fs.compareManyFields(e.children,t.children)}function HH(e,t){return e===t||Pn(e,t)&&e.keysSorted===t.keysSorted&&e.children.length===t.children.length&&Fs.compareManyFields(e.children,t.children)}St.prototype.visitNull=Ju;St.prototype.visitBool=Ju;St.prototype.visitInt=Ja;St.prototype.visitInt8=Ja;St.prototype.visitInt16=Ja;St.prototype.visitInt32=Ja;St.prototype.visitInt64=Ja;St.prototype.visitUint8=Ja;St.prototype.visitUint16=Ja;St.prototype.visitUint32=Ja;St.prototype.visitUint64=Ja;St.prototype.visitFloat=s1;St.prototype.visitFloat16=s1;St.prototype.visitFloat32=s1;St.prototype.visitFloat64=s1;St.prototype.visitUtf8=Ju;St.prototype.visitLargeUtf8=Ju;St.prototype.visitBinary=Ju;St.prototype.visitLargeBinary=Ju;St.prototype.visitFixedSizeBinary=qH;St.prototype.visitDate=PA;St.prototype.visitDateDay=PA;St.prototype.visitDateMillisecond=PA;St.prototype.visitTimestamp=xy;St.prototype.visitTimestampSecond=xy;St.prototype.visitTimestampMillisecond=xy;St.prototype.visitTimestampMicrosecond=xy;St.prototype.visitTimestampNanosecond=xy;St.prototype.visitTime=_y;St.prototype.visitTimeSecond=_y;St.prototype.visitTimeMillisecond=_y;St.prototype.visitTimeMicrosecond=_y;St.prototype.visitTimeNanosecond=_y;St.prototype.visitDecimal=Ju;St.prototype.visitList=YH;St.prototype.visitStruct=WH;St.prototype.visitUnion=$A;St.prototype.visitDenseUnion=$A;St.prototype.visitSparseUnion=$A;St.prototype.visitDictionary=GH;St.prototype.visitInterval=zA;St.prototype.visitIntervalDayTime=zA;St.prototype.visitIntervalYearMonth=zA;St.prototype.visitDuration=wy;St.prototype.visitDurationSecond=wy;St.prototype.visitDurationMillisecond=wy;St.prototype.visitDurationMicrosecond=wy;St.prototype.visitDurationNanosecond=wy;St.prototype.visitFixedSizeList=XH;St.prototype.visitMap=HH;var Fs=new St;function tf(e,t){return Fs.compareSchemas(e,t)}function SC(e,t){return Fs.compareFields(e,t)}function IC(e,t){return Fs.visit(e,t)}function Zu(e){let t=e.type,r=new(vC.getVisitFn(t)())(e);if(t.children&&t.children.length>0){let n=e.children||[],i={nullValues:e.nullValues},o=Array.isArray(n)?(s,a)=>n[a]||i:({name:s})=>n[s]||i;for(let[s,a]of t.children.entries()){let{type:c}=a,l=o(a,s);r.children.push(Zu(Object.assign(Object.assign({},l),{type:c})))}}return r}function a1(e,t){return ZH(e,t.map(r=>r.data.concat()))}function ZH(e,t){let r=[...e.fields],n=[],i={numBatches:t.reduce((f,d)=>Math.max(f,d.length),0)},o=0,s=0,a=-1,c=t.length,l,u=[];for(;i.numBatches-- >0;){for(s=Number.POSITIVE_INFINITY,a=-1;++a<c;)u[a]=l=t[a].shift(),s=Math.min(s,l?l.length:s);Number.isFinite(s)&&(u=KH(r,s,u,t,i),s>0&&(n[o++]=Vt({type:new ze(r),length:s,nullCount:0,children:u.slice()})))}return[e=e.assign(r),n.map(f=>new dr(e,f))]}function KH(e,t,r,n,i){var o;let s=(t+63&-64)>>3;for(let a=-1,c=n.length;++a<c;){let l=r[a],u=l?.length;if(u>=t)u===t?r[a]=l:(r[a]=l.slice(0,t),i.numBatches=Math.max(i.numBatches,n[a].unshift(l.slice(t,u-t))));else{let f=e[a];e[a]=f.clone({nullable:!0}),r[a]=(o=l?._changeLengthAndBackfillNullBitmap(t))!==null&&o!==void 0?o:Vt({type:f.type,length:t,nullCount:t,nullBitmap:new Uint8Array(s)})}}return r}var TC,fi=class e{constructor(...t){var r,n;if(t.length===0)return this.batches=[],this.schema=new Ie([]),this._offsets=[0],this;let i,o;t[0]instanceof Ie&&(i=t.shift()),t.at(-1)instanceof Uint32Array&&(o=t.pop());let s=c=>{if(c){if(c instanceof dr)return[c];if(c instanceof e)return c.batches;if(c instanceof _e){if(c.type instanceof ze)return[new dr(new Ie(c.type.children),c)]}else{if(Array.isArray(c))return c.flatMap(l=>s(l));if(typeof c[Symbol.iterator]=="function")return[...c].flatMap(l=>s(l));if(typeof c=="object"){let l=Object.keys(c),u=l.map(h=>new le([c[h]])),f=i??new Ie(l.map((h,p)=>new re(String(h),u[p].type,u[p].nullable))),[,d]=a1(f,u);return d.length===0?[new dr(c)]:d}}}return[]},a=t.flatMap(c=>s(c));if(i=(n=i??((r=a[0])===null||r===void 0?void 0:r.schema))!==null&&n!==void 0?n:new Ie([]),!(i instanceof Ie))throw new TypeError("Table constructor expects a [Schema, RecordBatch[]] pair.");for(let c of a){if(!(c instanceof dr))throw new TypeError("Table constructor expects a [Schema, RecordBatch[]] pair.");if(!tf(i,c.schema))throw new TypeError("Table and inner RecordBatch schemas must be equivalent.")}this.schema=i,this.batches=a,this._offsets=o??N_(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,r)=>t+r.length,0)}get nullCount(){return this._nullCount===-1&&(this._nullCount=O_(this.data)),this._nullCount}isValid(t){return!1}get(t){return null}set(t,r){}indexOf(t,r){return-1}[Symbol.iterator](){return this.batches.length>0?$d.visit(new le(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 ke(n,i)))}slice(t,n){let r=this.schema;[t,n]=Td({length:this.numRows},t,n);let i=xg(this.data,this._offsets,t,n);return new e(r,i.map(o=>new ke(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=Dt({type:r,length:0,nullCount:0});n.push(i._changeLengthAndBackfillNullBitmap(this.numRows))}return new jt(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 jt([Dt({type:new Yn,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]=Zg(r,a)}return new e(r,i)}select(t){let n=this.schema.fields.reduce((r,i,o)=>r.set(i.name,o),new Map);return this.selectAt(t.map(r=>n.get(r)).filter(r=>r>-1))}selectAt(t){let n=this.schema.selectAt(t),r=this.batches.map(i=>i.selectAt(t));return new e(n,r)}assign(t){let n=this.schema.fields,[r,i]=t.schema.fields.reduce((a,c,l)=>{let[u,f]=a,d=n.findIndex(h=>h.name===c.name);return~d?f[d]=l:u.push(l),a},[[],[]]),o=this.schema.assign(t.schema),s=[...n.map((a,c)=>[c,i[c]]).map(([a,c])=>c===void 0?this.getChildAt(a):t.getChildAt(c)),...r.map(a=>t.getChildAt(a))].filter(Boolean);return new e(...Zg(o,s))}};mO=Symbol.toStringTag;on[mO]=(e=>(e.schema=null,e.batches=[],e._offsets=new Uint32Array([0]),e._nullCount=-1,e[Symbol.isConcatSpreadable]=!0,e.isValid=aa(Ad),e.get=aa(je.getVisitFn(D.Struct)),e.set=_g(wn.getVisitFn(D.Struct)),e.indexOf=wg(wc.getVisitFn(D.Struct)),e.getByteLength=aa(Er.getVisitFn(D.Struct)),"Table"))(on.prototype);var gO,ke=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=Dt({nullCount:0,type:new ye(this.schema.fields),children:this.schema.fields.map(n=>Dt({type:n.type,nullCount:0}))})]=t,!(this.data instanceof se))throw new TypeError("RecordBatch constructor expects a [Schema, Data] pair.");[this.schema,this.data]=yO(this.schema,this.data.children);break}case 1:{let[n]=t,{fields:r,children:i,length:o}=Object.keys(n).reduce((c,l,u)=>(c.children[u]=n[l],c.length=Math.max(c.length,n[l].length),c.fields[u]=Ut.new({name:l,type:n[l].type,nullable:!0}),c),{length:0,fields:new Array,children:new Array}),s=new re(r),a=Dt({type:new ye(r),length:o,children:i,nullCount:0});[this.schema,this.data]=yO(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=bO(this.schema.fields,this.data.children))}get numCols(){return this.schema.fields.length}get numRows(){return this.data.length}get nullCount(){return this.data.nullCount}isValid(t){return this.data.getValid(t)}get(t){return je.visit(this.data,t)}set(t,n){return wn.visit(this.data,t,n)}indexOf(t,n){return wc.visit(this.data,t,n)}getByteLength(t){return Er.visit(this.data,t)}[Symbol.iterator](){return Kl.visit(new jt([this.data]))}toArray(){return[...this]}concat(...t){return new on(this.schema,[this,...t])}slice(t,n){let[r]=new jt([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 jt([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 jt([Dt({type:new Yn,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=Dt({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,Dt({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=Dt({type:new ye(n.fields),length:this.numRows,children:r});return new e(n,i)}};gO=Symbol.toStringTag;ke[gO]=(e=>(e._nullCount=-1,e[Symbol.isConcatSpreadable]=!0,"RecordBatch"))(ke.prototype);function yO(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:Dt({type:c.type,length:n,nullCount:n,nullBitmap:new Uint8Array(s)}))}return[e.assign(i),Dt({type:new ye(i),length:n,children:o})]}function bO(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)||[]])bO(a.children,l?.children,n);if(at.isDictionary(a)){let{id:l}=a;if(!n.has(l))c?.dictionary&&n.set(l,c.dictionary);else if(n.get(l)!==c.dictionary)throw new Error("Cannot create Schema containing two different dictionaries with the same Id")}}return n}var Rc=class extends ke{constructor(t){let n=t.fields.map(i=>Dt({type:i.type})),r=Dt({type:new ye(t.fields),nullCount:0,children:n});super(t,r)}};var mh;(function(e){e[e.BUFFER=0]="BUFFER"})(mh||(mh={}));var yh;(function(e){e[e.LZ4_FRAME=0]="LZ4_FRAME",e[e.ZSTD=1]="ZSTD"})(yh||(yh={}));var Qg=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):yh.LZ4_FRAME}method(){let t=this.bb.__offset(this.bb_pos,6);return t?this.bb.readInt8(this.bb_pos+t):mh.BUFFER}static startBodyCompression(t){t.startObject(2)}static addCodec(t,n){t.addFieldInt8(0,n,yh.LZ4_FRAME)}static addMethod(t,n){t.addFieldInt8(1,n,mh.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 su=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 au=class{constructor(){this.bb=null,this.bb_pos=0}__init(t,n){return this.bb_pos=t,this.bb=n,this}length(){return this.bb.readInt64(this.bb_pos)}nullCount(){return this.bb.readInt64(this.bb_pos+8)}static sizeOf(){return 16}static createFieldNode(t,n,r){return t.prep(8,16),t.writeInt64(BigInt(r??0)),t.writeInt64(BigInt(n??0)),t.offset()}};var Nr=class e{constructor(){this.bb=null,this.bb_pos=0}__init(t,n){return this.bb_pos=t,this.bb=n,this}static getRootAsRecordBatch(t,n){return(n||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsRecordBatch(t,n){return t.setPosition(t.position()+4),(n||new e).__init(t.readInt32(t.position())+t.position(),t)}length(){let t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt64(this.bb_pos+t):BigInt("0")}nodes(t,n){let r=this.bb.__offset(this.bb_pos,6);return r?(n||new au).__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 su).__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 Qg).__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 ds=class e{constructor(){this.bb=null,this.bb_pos=0}__init(t,n){return this.bb_pos=t,this.bb=n,this}static getRootAsDictionaryBatch(t,n){return(n||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsDictionaryBatch(t,n){return t.setPosition(t.position()+4),(n||new e).__init(t.readInt32(t.position())+t.position(),t)}id(){let t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt64(this.bb_pos+t):BigInt("0")}data(t){let n=this.bb.__offset(this.bb_pos,6);return n?(t||new Nr).__init(this.bb.__indirect(this.bb_pos+n),this.bb):null}isDelta(){let t=this.bb.__offset(this.bb_pos,8);return t?!!this.bb.readInt8(this.bb_pos+t):!1}static startDictionaryBatch(t){t.startObject(3)}static addId(t,n){t.addFieldInt64(0,n,BigInt("0"))}static addData(t,n){t.addFieldOffset(1,n,0)}static addIsDelta(t,n){t.addFieldInt8(2,+n,0)}static endDictionaryBatch(t){return t.endObject()}};var cu;(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"})(cu||(cu={}));var ki=class e{constructor(){this.bb=null,this.bb_pos=0}__init(t,n){return this.bb_pos=t,this.bb=n,this}static getRootAsMessage(t,n){return(n||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsMessage(t,n){return t.setPosition(t.position()+4),(n||new e).__init(t.readInt32(t.position())+t.position(),t)}version(){let t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt16(this.bb_pos+t):la.V1}headerType(){let t=this.bb.__offset(this.bb_pos,6);return t?this.bb.readUint8(this.bb_pos+t):cu.NONE}header(t){let n=this.bb.__offset(this.bb_pos,8);return n?this.bb.__union(t,this.bb_pos+n):null}bodyLength(){let t=this.bb.__offset(this.bb_pos,10);return t?this.bb.readInt64(this.bb_pos+t):BigInt("0")}customMetadata(t,n){let r=this.bb.__offset(this.bb_pos,12);return r?(n||new en).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+r)+t*4),this.bb):null}customMetadataLength(){let t=this.bb.__offset(this.bb_pos,12);return t?this.bb.__vector_len(this.bb_pos+t):0}static startMessage(t){t.startObject(5)}static addVersion(t,n){t.addFieldInt16(0,n,la.V1)}static addHeaderType(t,n){t.addFieldInt8(1,n,cu.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 ov=class extends ut{visit(t,n){return t==null||n==null?void 0:super.visit(t,n)}visitNull(t,n){return Bd.startNull(n),Bd.endNull(n)}visitInt(t,n){return Ri.startInt(n),Ri.addBitWidth(n,t.bitWidth),Ri.addIsSigned(n,t.isSigned),Ri.endInt(n)}visitFloat(t,n){return ma.startFloatingPoint(n),ma.addPrecision(n,t.precision),ma.endFloatingPoint(n)}visitBinary(t,n){return Od.startBinary(n),Od.endBinary(n)}visitBool(t,n){return Dd.startBool(n),Dd.endBool(n)}visitUtf8(t,n){return $d.startUtf8(n),$d.endUtf8(n)}visitDecimal(t,n){return eo.startDecimal(n),eo.addScale(n,t.scale),eo.addPrecision(n,t.precision),eo.addBitWidth(n,t.bitWidth),eo.endDecimal(n)}visitDate(t,n){return fa.startDate(n),fa.addUnit(n,t.unit),fa.endDate(n)}visitTime(t,n){return ns.startTime(n),ns.addUnit(n,t.unit),ns.addBitWidth(n,t.bitWidth),ns.endTime(n)}visitTimestamp(t,n){let r=t.timezone&&n.createString(t.timezone)||void 0;return rs.startTimestamp(n),rs.addUnit(n,t.unit),r!==void 0&&rs.addTimezone(n,r),rs.endTimestamp(n)}visitInterval(t,n){return ya.startInterval(n),ya.addUnit(n,t.unit),ya.endInterval(n)}visitDuration(t,n){return da.startDuration(n),da.addUnit(n,t.unit),da.endDuration(n)}visitList(t,n){return Cd.startList(n),Cd.endList(n)}visitStruct(t,n){return Pd.startStruct_(n),Pd.endStruct_(n)}visitUnion(t,n){Di.startTypeIdsVector(n,t.typeIds.length);let r=Di.createTypeIdsVector(n,t.typeIds);return Di.startUnion(n),Di.addMode(n,t.mode),Di.addTypeIds(n,r),Di.endUnion(n)}visitDictionary(t,n){let r=this.visit(t.indices,n);return to.startDictionaryEncoding(n),to.addId(n,BigInt(t.id)),to.addIsOrdered(n,t.isOrdered),r!==void 0&&to.addIndexType(n,r),to.endDictionaryEncoding(n)}visitFixedSizeBinary(t,n){return ha.startFixedSizeBinary(n),ha.addByteWidth(n,t.byteWidth),ha.endFixedSizeBinary(n)}visitFixedSizeList(t,n){return pa.startFixedSizeList(n),pa.addListSize(n,t.listSize),pa.endFixedSizeList(n)}visitMap(t,n){return ga.startMap(n),ga.addKeysSorted(n,t.keysSorted),ga.endMap(n)}},Kg=new ov;function vO(e,t=new Map){return new re(sz(e,t),Jg(e.metadata),t)}function sv(e){return new vn(e.count,IO(e.columns),TO(e.columns))}function SO(e){return new hr(sv(e.data),e.id,e.isDelta)}function sz(e,t){return(e.fields||[]).filter(Boolean).map(n=>Ut.fromJSON(n,t))}function xO(e,t){return(e.children||[]).filter(Boolean).map(n=>Ut.fromJSON(n,t))}function IO(e){return(e||[]).reduce((t,n)=>[...t,new Qr(n.count,az(n.VALIDITY)),...IO(n.children)],[])}function TO(e,t=[]){for(let n=-1,r=(e||[]).length;++n<r;){let i=e[n];i.VALIDITY&&t.push(new dr(t.length,i.VALIDITY.length)),i.TYPE_ID&&t.push(new dr(t.length,i.TYPE_ID.length)),i.OFFSET&&t.push(new dr(t.length,i.OFFSET.length)),i.DATA&&t.push(new dr(t.length,i.DATA.length)),t=TO(i.children,t)}return t}function az(e){return(e||[]).reduce((t,n)=>t+ +(n===0),0)}function EO(e,t){let n,r,i,o,s,a;return!t||!(o=e.dictionary)?(s=wO(e,xO(e,t)),i=new Ut(e.name,s,e.nullable,Jg(e.metadata))):t.has(n=o.id)?(r=(r=o.indexType)?_O(r):new Hi,a=new Ir(t.get(n),r,n,o.isOrdered),i=new Ut(e.name,a,e.nullable,Jg(e.metadata))):(r=(r=o.indexType)?_O(r):new Hi,t.set(n,s=wO(e,xO(e,t))),a=new Ir(s,r,n,o.isOrdered),i=new Ut(e.name,a,e.nullable,Jg(e.metadata))),i||null}function Jg(e=[]){return new Map(e.map(({key:t,value:n})=>[t,n]))}function _O(e){return new Pe(e.isSigned,e.bitWidth)}function wO(e,t){let n=e.type.name;switch(n){case"NONE":return new Yn;case"null":return new Yn;case"binary":return new Yo;case"utf8":return new Go;case"bool":return new Wo;case"list":return new Ii((t||[])[0]);case"struct":return new ye(t||[]);case"struct_":return new ye(t||[])}switch(n){case"int":{let r=e.type;return new Pe(r.isSigned,r.bitWidth)}case"floatingpoint":{let r=e.type;return new ur(xe[r.precision])}case"decimal":{let r=e.type;return new Xo(r.scale,r.precision,r.bitWidth)}case"date":{let r=e.type;return new Ho(_n[r.unit])}case"time":{let r=e.type;return new Si(pt[r.unit],r.bitWidth)}case"timestamp":{let r=e.type;return new Zo(pt[r.unit],r.timezone)}case"interval":{let r=e.type;return new Qo(Vn[r.unit])}case"duration":{let r=e.type;return new Ko(pt[r.unit])}case"union":{let r=e.type,[i,...o]=(r.mode+"").toLowerCase(),s=i.toUpperCase()+o.join("");return new Ti(me[s],r.typeIds||[],t||[])}case"fixedsizebinary":{let r=e.type;return new Jo(r.byteWidth)}case"fixedsizelist":{let r=e.type;return new Ei(r.listSize,(t||[])[0])}case"map":{let r=e.type;return new Mi((t||[])[0],r.keysSorted)}}throw new Error(`Unrecognized type: "${n}"`)}var cz=Sc,lz=Mr,pr=class e{static fromJSON(t,n){let r=new e(0,Ie.V5,n);return r._createHeader=uz(t,n),r}static decode(t){t=new lz(Ot(t));let n=ki.getRootAsMessage(t),r=n.bodyLength(),i=n.version(),o=n.headerType(),s=new e(r,i,o);return s._createHeader=fz(n,o),s}static encode(t){let n=new cz,r=-1;return t.isSchema()?r=re.encode(n,t.header()):t.isRecordBatch()?r=vn.encode(n,t.header()):t.isDictionaryBatch()&&(r=hr.encode(n,t.header())),ki.startMessage(n),ki.addVersion(n,Ie.V5),ki.addHeader(n,r),ki.addHeaderType(n,t.headerType),ki.addBodyLength(n,BigInt(t.bodyLength)),ki.finishMessageBuffer(n,ki.endMessage(n)),n.asUint8Array()}static from(t,n=0){if(t instanceof re)return new e(0,Ie.V5,Qt.Schema,t);if(t instanceof vn)return new e(n,Ie.V5,Qt.RecordBatch,t);if(t instanceof hr)return new e(n,Ie.V5,Qt.DictionaryBatch,t);throw new Error(`Unrecognized Message header: ${t}`)}get type(){return this.headerType}get version(){return this._version}get headerType(){return this._headerType}get bodyLength(){return this._bodyLength}header(){return this._createHeader()}isSchema(){return this.headerType===Qt.Schema}isRecordBatch(){return this.headerType===Qt.RecordBatch}isDictionaryBatch(){return this.headerType===Qt.DictionaryBatch}constructor(t,n,r,i){this._version=n,this._headerType=r,this.body=new Uint8Array(0),i&&(this._createHeader=()=>i),this._bodyLength=lr(t)}},vn=class{get nodes(){return this._nodes}get length(){return this._length}get buffers(){return this._buffers}constructor(t,n,r){this._nodes=n,this._buffers=r,this._length=lr(t)}},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=lr(n)}},dr=class{constructor(t,n){this.offset=lr(t),this.length=lr(n)}},Qr=class{constructor(t,n){this.length=lr(t),this.nullCount=lr(n)}};function uz(e,t){return()=>{switch(t){case Qt.Schema:return re.fromJSON(e);case Qt.RecordBatch:return vn.fromJSON(e);case Qt.DictionaryBatch:return hr.fromJSON(e)}throw new Error(`Unrecognized Message type: { name: ${Qt[t]}, type: ${t} }`)}}function fz(e,t){return()=>{switch(t){case Qt.Schema:return re.decode(e.header(new fr),new Map,e.version());case Qt.RecordBatch:return vn.decode(e.header(new Nr),e.version());case Qt.DictionaryBatch:return hr.decode(e.header(new ds),e.version())}throw new Error(`Unrecognized Message type: { name: ${Qt[t]}, type: ${t} }`)}}Ut.encode=vz;Ut.decode=_z;Ut.fromJSON=EO;re.encode=wz;re.decode=dz;re.fromJSON=vO;vn.encode=Sz;vn.decode=hz;vn.fromJSON=sv;hr.encode=Iz;hr.decode=pz;hr.fromJSON=SO;Qr.encode=Tz;Qr.decode=yz;dr.encode=Ez;dr.decode=mz;function dz(e,t=new Map,n=Ie.V5){let r=xz(e,t);return new re(r,t0(e),t,n)}function hz(e,t=Ie.V5){if(e.compression()!==null)throw new Error("Record batch compression not implemented");return new vn(e.length(),gz(e),bz(e,t))}function pz(e,t=Ie.V5){return new hr(vn.decode(e.data(),t),e.id(),e.isDelta())}function mz(e){return new dr(e.offset(),e.length())}function yz(e){return new Qr(e.length(),e.nullCount())}function gz(e){let t=[];for(let n,r=-1,i=-1,o=e.nodesLength();++r<o;)(n=e.nodes(r))&&(t[++i]=Qr.decode(n));return t}function bz(e,t){let n=[];for(let r,i=-1,o=-1,s=e.buffersLength();++i<s;)(r=e.buffers(i))&&(t<Ie.V4&&(r.bb_pos+=8*(i+1)),n[++o]=dr.decode(r));return n}function xz(e,t){let n=[];for(let r,i=-1,o=-1,s=e.fieldsLength();++i<s;)(r=e.fields(i))&&(n[++o]=Ut.decode(r,t));return n}function MO(e,t){let n=[];for(let r,i=-1,o=-1,s=e.childrenLength();++i<s;)(r=e.children(i))&&(n[++o]=Ut.decode(r,t));return n}function _z(e,t){let n,r,i,o,s,a;return!t||!(a=e.dictionary())?(i=NO(e,MO(e,t)),r=new Ut(e.name(),i,e.nullable(),t0(e))):t.has(n=lr(a.id()))?(o=(o=a.indexType())?AO(o):new Hi,s=new Ir(t.get(n),o,n,a.isOrdered()),r=new Ut(e.name(),s,e.nullable(),t0(e))):(o=(o=a.indexType())?AO(o):new Hi,t.set(n,i=NO(e,MO(e,t))),s=new Ir(i,o,n,a.isOrdered()),r=new Ut(e.name(),s,e.nullable(),t0(e))),r||null}function t0(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 AO(e){return new Pe(e.isSigned(),e.bitWidth())}function NO(e,t){let n=e.typeType();switch(n){case ge.NONE:return new Yn;case ge.Null:return new Yn;case ge.Binary:return new Yo;case ge.Utf8:return new Go;case ge.Bool:return new Wo;case ge.List:return new Ii((t||[])[0]);case ge.Struct_:return new ye(t||[])}switch(n){case ge.Int:{let r=e.type(new Ri);return new Pe(r.isSigned(),r.bitWidth())}case ge.FloatingPoint:{let r=e.type(new ma);return new ur(r.precision())}case ge.Decimal:{let r=e.type(new eo);return new Xo(r.scale(),r.precision(),r.bitWidth())}case ge.Date:{let r=e.type(new fa);return new Ho(r.unit())}case ge.Time:{let r=e.type(new ns);return new Si(r.unit(),r.bitWidth())}case ge.Timestamp:{let r=e.type(new rs);return new Zo(r.unit(),r.timezone())}case ge.Interval:{let r=e.type(new ya);return new Qo(r.unit())}case ge.Duration:{let r=e.type(new da);return new Ko(r.unit())}case ge.Union:{let r=e.type(new Di);return new Ti(r.mode(),r.typeIdsArray()||[],t||[])}case ge.FixedSizeBinary:{let r=e.type(new ha);return new Jo(r.byteWidth())}case ge.FixedSizeList:{let r=e.type(new pa);return new Ei(r.listSize(),(t||[])[0])}case ge.Map:{let r=e.type(new ga);return new Mi((t||[])[0],r.keysSorted())}}throw new Error(`Unrecognized type: "${ge[n]}" (${n})`)}function wz(e,t){let n=t.fields.map(o=>Ut.encode(e,o));fr.startFieldsVector(e,n.length);let r=fr.createFieldsVector(e,n),i=t.metadata&&t.metadata.size>0?fr.createCustomMetadataVector(e,[...t.metadata].map(([o,s])=>{let a=e.createString(`${o}`),c=e.createString(`${s}`);return en.startKeyValue(e),en.addKey(e,a),en.addValue(e,c),en.endKeyValue(e)})):-1;return fr.startSchema(e),fr.addFields(e,r),fr.addEndianness(e,Mz?ua.Little:ua.Big),i!==-1&&fr.addCustomMetadata(e,i),fr.endSchema(e)}function vz(e,t){let n=-1,r=-1,i=-1,o=t.type,s=t.typeId;at.isDictionary(o)?(s=o.dictionary.typeId,i=Kg.visit(o,e),r=Kg.visit(o.dictionary,e)):r=Kg.visit(o,e);let a=(o.children||[]).map(u=>Ut.encode(e,u)),c=kn.createChildrenVector(e,a),l=t.metadata&&t.metadata.size>0?kn.createCustomMetadataVector(e,[...t.metadata].map(([u,f])=>{let d=e.createString(`${u}`),h=e.createString(`${f}`);return en.startKeyValue(e),en.addKey(e,d),en.addValue(e,h),en.endKeyValue(e)})):-1;return t.name&&(n=e.createString(t.name)),kn.startField(e),kn.addType(e,r),kn.addTypeType(e,s),kn.addChildren(e,c),kn.addNullable(e,!!t.nullable),n!==-1&&kn.addName(e,n),i!==-1&&kn.addDictionary(e,i),l!==-1&&kn.addCustomMetadata(e,l),kn.endField(e)}function Sz(e,t){let n=t.nodes||[],r=t.buffers||[];Nr.startNodesVector(e,n.length);for(let s of n.slice().reverse())Qr.encode(e,s);let i=e.endVector();Nr.startBuffersVector(e,r.length);for(let s of r.slice().reverse())dr.encode(e,s);let o=e.endVector();return Nr.startRecordBatch(e),Nr.addLength(e,BigInt(t.length)),Nr.addNodes(e,i),Nr.addBuffers(e,o),Nr.endRecordBatch(e)}function Iz(e,t){let n=vn.encode(e,t.data);return ds.startDictionaryBatch(e),ds.addId(e,BigInt(t.id)),ds.addIsDelta(e,t.isDelta),ds.addData(e,n),ds.endDictionaryBatch(e)}function Tz(e,t){return au.createFieldNode(e,BigInt(t.length),BigInt(t.nullCount))}function Ez(e,t){return su.createBuffer(e,BigInt(t.offset),BigInt(t.length))}var Mz=(()=>{let e=new ArrayBuffer(2);return new DataView(e).setInt16(0,256,!0),new Int16Array(e)[0]===256})();var cv=e=>`Expected ${Qt[e]} Message in stream, but was null or length 0.`,lv=e=>`Header pointer of flatbuffer-encoded ${Qt[e]} Message is null or length 0.`,RO=(e,t)=>`Expected to read ${e} metadata bytes, but only read ${t}.`,OO=(e,t)=>`Expected to read ${e} bytes for message body, but only read ${t}.`,lu=class{constructor(t){this.source=t instanceof ro?t:new ro(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(cv(t));return n.value}readMessageBody(t){if(t<=0)return new Uint8Array(0);let n=Ot(this.source.read(t));if(n.byteLength<t)throw new Error(OO(t,n.byteLength));return n.byteOffset%8===0&&n.byteOffset+n.byteLength<=n.buffer.byteLength?n:n.slice()}readSchema(t=!1){let n=Qt.Schema,r=this.readMessage(n),i=r?.header();if(t&&!i)throw new Error(lv(n));return i}readMetadataLength(){let t=this.source.read(e0),n=t&&new Mr(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(RO(t,n.byteLength));return{done:!1,value:pr.decode(n)}}},gh=class{constructor(t,n){this.source=t instanceof Hr?t:Ly(t)?new ba(t,n):new Hr(t)}[Symbol.asyncIterator](){return this}next(){return Z(this,void 0,void 0,function*(){let t;return(t=yield this.readMetadataLength()).done?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(cv(t));return n.value})}readMessageBody(t){return Z(this,void 0,void 0,function*(){if(t<=0)return new Uint8Array(0);let n=Ot(yield this.source.read(t));if(n.byteLength<t)throw new Error(OO(t,n.byteLength));return n.byteOffset%8===0&&n.byteOffset+n.byteLength<=n.buffer.byteLength?n:n.slice()})}readSchema(t=!1){return Z(this,void 0,void 0,function*(){let n=Qt.Schema,r=yield this.readMessage(n),i=r?.header();if(t&&!i)throw new Error(lv(n));return i})}readMetadataLength(){return Z(this,void 0,void 0,function*(){let t=yield this.source.read(e0),n=t&&new Mr(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(RO(t,n.byteLength));return{done:!1,value:pr.decode(n)}})}},bh=class extends lu{constructor(t){super(new Uint8Array(0)),this._schema=!1,this._body=[],this._batchIndex=0,this._dictionaryIndex=0,this._json=t instanceof zd?t:new zd(t)}next(){let{_json:t}=this;if(!this._schema)return this._schema=!0,{done:!1,value:pr.fromJSON(t.schema,Qt.Schema)};if(this._dictionaryIndex<t.dictionaries.length){let n=t.dictionaries[this._dictionaryIndex++];return this._body=n.data.columns,{done:!1,value:pr.fromJSON(n,Qt.DictionaryBatch)}}if(this._batchIndex<t.batches.length){let n=t.batches[this._batchIndex++];return this._body=n.columns,{done:!1,value:pr.fromJSON(n,Qt.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(cv(t));return n.value}readSchema(){let t=Qt.Schema,n=this.readMessage(t),r=n?.header();if(!n||!r)throw new Error(lv(t));return r}},e0=4,av="ARROW1",uu=new Uint8Array(av.length);for(let e=0;e<av.length;e+=1)uu[e]=av.codePointAt(e);function n0(e,t=0){for(let n=-1,r=uu.length;++n<r;)if(uu[n]!==e[t+n])return!1;return!0}var fu=uu.length,uv=fu+e0,DO=fu*2+e0;var nn=class e extends Ic{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 vr(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:ky(t)?Nz(t):Ly(t)?Dz(t):vr(t)?Z(this,void 0,void 0,function*(){return yield e.from(yield t)}):Cy(t)||wd(t)||Py(t)||Yr(t)?Oz(new Hr(t)):Rz(new ro(t))}static readAll(t){return t instanceof e?t.isSync()?kO(t):FO(t):ky(t)||ArrayBuffer.isView(t)||xi(t)||Fy(t)?kO(t):FO(t)}},oo=class extends nn{constructor(t){super(t),this._impl=t}readAll(){return[...this]}[Symbol.iterator](){return this._impl[Symbol.iterator]()}[Symbol.asyncIterator](){return wr(this,arguments,function*(){yield Ct(yield*jl(bi(this[Symbol.iterator]())))})}},xa=class extends nn{constructor(t){super(t),this._impl=t}readAll(){var t,n,r,i;return Z(this,void 0,void 0,function*(){let o=new Array;try{for(var s=!0,a=bi(this),c;c=yield a.next(),t=c.done,!t;s=!0){i=c.value,s=!1;let l=i;o.push(l)}}catch(l){n={error:l}}finally{try{!s&&!t&&(r=a.return)&&(yield r.call(a))}finally{if(n)throw n.error}}return o})}[Symbol.iterator](){throw new Error("AsyncRecordBatchStreamReader is not Iterable")}[Symbol.asyncIterator](){return this._impl[Symbol.asyncIterator]()}},_a=class extends oo{constructor(t){super(t),this._impl=t}},xh=class extends xa{constructor(t){super(t),this._impl=t}},r0=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=Dt({type:new ye(this.schema.fields),length:t.length,children:r});return new ke(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 jt(l)):new jt(l)).memoize()}return a.memoize()}_loadVectors(t,n,r){return new Yd(n,t.nodes,t.buffers,this.dictionaries,this.schema.metadataVersion).visitMany(r)}},du=class extends r0{constructor(t,n){super(n),this._reader=ky(t)?new bh(this._handle=t):new lu(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=LO(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 Rc(this.schema)}):this.return()}_readNextMessageAndValidate(t){return this._reader.readMessage(t)}},hu=class extends r0{constructor(t,n){super(n),this._reader=new gh(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=LO(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 Rc(this.schema)}):yield this.return()})}_readNextMessageAndValidate(t){return Z(this,void 0,void 0,function*(){return yield this._reader.readMessage(t)})}},i0=class extends du{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 qd?t:new qd(t),n)}isSync(){return!0}isFile(){return!0}open(t){if(!this.closed&&!this._footer){this.schema=(this._footer=this._readFooter()).schema;for(let n of this._footer.dictionaryBatches())n&&this._readDictionaryBatch(this._dictionaryIndex++)}return super.open(t)}readRecordBatch(t){var n;if(this.closed)return null;this._footer||this.open();let r=(n=this._footer)===null||n===void 0?void 0:n.getRecordBatch(t);if(r&&this._handle.seek(r.offset)){let i=this._reader.readMessage(Qt.RecordBatch);if(i?.isRecordBatch()){let o=i.header(),s=this._reader.readMessageBody(i.bodyLength);return this._loadRecordBatch(o,s)}}return null}_readDictionaryBatch(t){var n;let r=(n=this._footer)===null||n===void 0?void 0:n.getDictionaryBatch(t);if(r&&this._handle.seek(r.offset)){let i=this._reader.readMessage(Qt.DictionaryBatch);if(i?.isDictionaryBatch()){let o=i.header(),s=this._reader.readMessageBody(i.bodyLength),a=this._loadDictionaryBatch(o,s);this.dictionaries.set(o.id,a)}}}_readFooter(){let{_handle:t}=this,n=t.size-uv,r=t.readInt32(n),i=t.readAt(n-r,r);return is.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}},fv=class extends hu{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 ba?t:new ba(t,r),i)}isFile(){return!0}isAsync(){return!0}open(t){let n=Object.create(null,{open:{get:()=>super.open}});return Z(this,void 0,void 0,function*(){if(!this.closed&&!this._footer){this.schema=(this._footer=yield this._readFooter()).schema;for(let r of this._footer.dictionaryBatches())r&&(yield this._readDictionaryBatch(this._dictionaryIndex++))}return yield n.open.call(this,t)})}readRecordBatch(t){var n;return Z(this,void 0,void 0,function*(){if(this.closed)return null;this._footer||(yield this.open());let r=(n=this._footer)===null||n===void 0?void 0:n.getRecordBatch(t);if(r&&(yield this._handle.seek(r.offset))){let i=yield this._reader.readMessage(Qt.RecordBatch);if(i?.isRecordBatch()){let o=i.header(),s=yield this._reader.readMessageBody(i.bodyLength);return this._loadRecordBatch(o,s)}}return null})}_readDictionaryBatch(t){var n;return Z(this,void 0,void 0,function*(){let r=(n=this._footer)===null||n===void 0?void 0:n.getDictionaryBatch(t);if(r&&(yield this._handle.seek(r.offset))){let i=yield this._reader.readMessage(Qt.DictionaryBatch);if(i?.isDictionaryBatch()){let o=i.header(),s=yield this._reader.readMessageBody(i.bodyLength),a=this._loadDictionaryBatch(o,s);this.dictionaries.set(o.id,a)}}})}_readFooter(){return Z(this,void 0,void 0,function*(){let{_handle:t}=this;t._pending&&(yield t._pending);let n=t.size-uv,r=yield t.readInt32(n),i=yield t.readAt(n-r,r);return is.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})}},dv=class extends du{constructor(t,n){super(t,n)}_loadVectors(t,n,r){return new Ag(n,t.nodes,t.buffers,this.dictionaries,this.schema.metadataVersion).visitMany(r)}};function LO(e,t){return t&&typeof t.autoDestroy=="boolean"?t.autoDestroy:e.autoDestroy}function*kO(e){let t=nn.from(e);try{if(!t.open({autoDestroy:!1}).closed)do yield t;while(!t.reset().open().closed)}finally{t.cancel()}}function FO(e){return wr(this,arguments,function*(){let n=yield Ct(nn.from(e));try{if(!(yield Ct(n.open({autoDestroy:!1}))).closed)do yield yield Ct(n);while(!(yield Ct(n.reset().open())).closed)}finally{yield Ct(n.cancel())}})}function Nz(e){return new oo(new dv(e))}function Rz(e){let t=e.peek(fu+7&-8);return t&&t.byteLength>=4?n0(t)?new _a(new i0(e.read())):new oo(new du(e)):new oo(new du(function*(){}()))}function Oz(e){return Z(this,void 0,void 0,function*(){let t=yield e.peek(fu+7&-8);return t&&t.byteLength>=4?n0(t)?new _a(new i0(yield e.read())):new xa(new hu(e)):new xa(new hu(function(){return wr(this,arguments,function*(){})}()))})}function Dz(e){return Z(this,void 0,void 0,function*(){let{size:t}=yield e.stat(),n=new ba(e,t);return t>=DO&&n0(yield n.readAt(0,fu+7&-8))?new xh(new fv(n)):new xa(new hu(n))})}var Fe=class e extends ut{static assemble(...t){let n=i=>i.flatMap(o=>Array.isArray(o)?n(o):o instanceof ke?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 jt)return this.visitMany(t.data),this;let{type:n}=t;if(!at.isDictionary(n)){let{length:r}=t;if(r>2147483647)throw new RangeError("Cannot write arrays larger than 2^31 - 1 in length");if(at.isUnion(n))this.nodes.push(new Qr(r,0));else{let{nullCount:i}=t;at.isNull(n)||Fi.call(this,i<=0?new Uint8Array(0):xc(t.offset,r,t.nullBitmap)),this.nodes.push(new Qr(r,i))}}return super.visit(t)}visitNull(t){return this}visitDictionary(t){return this.visit(t.clone(t.type.indices))}get nodes(){return this._nodes}get buffers(){return this._buffers}get byteLength(){return this._byteLength}get bufferRegions(){return this._bufferRegions}};function Fi(e){let t=e.byteLength+7&-8;return this.buffers.push(e),this.bufferRegions.push(new dr(this._byteLength,t)),this._byteLength+=t,this}function kz(e){var t;let{type:n,length:r,typeIds:i,valueOffsets:o}=e;if(Fi.call(this,i),n.mode===me.Sparse)return hv.call(this,e);if(n.mode===me.Dense){if(e.offset<=0)return Fi.call(this,o),hv.call(this,e);{let s=new Int32Array(r),a=Object.create(null),c=Object.create(null);for(let l,u,f=-1;++f<r;)(l=i[f])!==void 0&&((u=a[l])===void 0&&(u=a[l]=o[f]),s[f]=o[f]-u,c[l]=((t=c[l])!==null&&t!==void 0?t:0)+1);Fi.call(this,s),this.visitMany(e.children.map((l,u)=>{let f=n.typeIds[u],d=a[f],h=c[f];return l.slice(d,Math.min(r,h))}))}}return this}function Fz(e){let t;return e.nullCount>=e.length?Fi.call(this,new Uint8Array(0)):(t=e.values)instanceof Uint8Array?Fi.call(this,xc(e.offset,e.length,t)):Fi.call(this,_c(e.values))}function hs(e){return Fi.call(this,e.values.subarray(0,e.length*e.stride))}function CO(e){let{length:t,values:n,valueOffsets:r}=e,{[0]:i,[t]:o}=r,s=Math.min(o-i,n.byteLength-i);return Fi.call(this,Uy(-i,t+1,r)),Fi.call(this,n.subarray(i,i+s)),this}function pv(e){let{length:t,valueOffsets:n}=e;if(n){let{[0]:r,[t]:i}=n;return Fi.call(this,Uy(-r,t+1,n)),this.visit(e.children[0].slice(r,i-r))}return this.visit(e.children[0])}function hv(e){return this.visitMany(e.type.children.map((t,n)=>e.children[n]).filter(Boolean))[0]}Fe.prototype.visitBool=Fz;Fe.prototype.visitInt=hs;Fe.prototype.visitFloat=hs;Fe.prototype.visitUtf8=CO;Fe.prototype.visitBinary=CO;Fe.prototype.visitFixedSizeBinary=hs;Fe.prototype.visitDate=hs;Fe.prototype.visitTimestamp=hs;Fe.prototype.visitTime=hs;Fe.prototype.visitDecimal=hs;Fe.prototype.visitList=pv;Fe.prototype.visitStruct=hv;Fe.prototype.visitUnion=kz;Fe.prototype.visitInterval=hs;Fe.prototype.visitDuration=hs;Fe.prototype.visitFixedSizeList=pv;Fe.prototype.visitMap=pv;var Oc=class extends Ic{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 no,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 vr(t)?t.then(n=>this.writeAll(n)):Yr(t)?yv(this,t):mv(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 no?this._sink=t:(this._sink=new no,t&&eR(t)?this.toDOMStream({type:"bytes"}).pipeTo(t):t&&nR(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||!Nc(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 on&&!(n=t.schema))return this.finish()&&void 0;if(t instanceof ke&&!(n=t.schema))return this.finish()&&void 0}else throw new Error("RecordBatchWriter is closed");if(n&&!Nc(n,this._schema)){if(this._started&&this._autoDestroy)return this.close();this.reset(this._sink,n)}t instanceof ke?t instanceof Rc||this._writeRecordBatch(t):t instanceof on?this.writeAll(t.batches):xi(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===Qt.RecordBatch?this._recordBatchBlocks.push(new os(a,t.bodyLength,this._position)):t.headerType===Qt.DictionaryBatch&&this._dictionaryBlocks.push(new os(a,t.bodyLength,this._position)),this._writeLegacyIpcFormat||this._write(Int32Array.of(-1)),this._write(Int32Array.of(a-s)),o>0&&this._write(i),this._writePadding(c)}_write(t){if(this._started){let n=Ot(t);n&&n.byteLength>0&&(this._sink.write(n),this._position+=n.byteLength)}return this}_writeSchema(t){return this._writeMessage(pr.from(t))}_writeFooter(t){return this._writeLegacyIpcFormat?this._write(Int32Array.of(0)):this._write(Int32Array.of(-1,0))}_writeMagic(){return this._write(uu)}_writePadding(t){return t>0?this._write(new Uint8Array(t)):this}_writeRecordBatch(t){let{byteLength:n,nodes:r,bufferRegions:i,buffers:o}=Fe.assemble(t),s=new vn(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}=Fe.assemble(new jt([t])),c=new vn(t.length,o,s),l=new hr(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}},Dc=class e extends Oc{static writeAll(t,n){let r=new e(n);return vr(t)?t.then(i=>r.writeAll(i)):Yr(t)?yv(r,t):mv(r,t)}},kc=class e extends Oc{static writeAll(t){let n=new e;return vr(t)?t.then(r=>n.writeAll(r)):Yr(t)?yv(n,t):mv(n,t)}constructor(){super(),this._autoDestroy=!0}_writeSchema(t){return this._writeMagic()._writePadding(2)}_writeFooter(t){let n=is.encode(new is(t,Ie.V5,this._recordBatchBlocks,this._dictionaryBlocks));return super._writeFooter(t)._write(n)._write(Int32Array.of(n.byteLength))._writeMagic()}};function mv(e,t){let n=t;t instanceof on&&(n=t.batches,e.reset(void 0,t.schema));for(let r of n)e.write(r);return e.finish()}function yv(e,t){var n,r,i,o,s,a,c;return Z(this,void 0,void 0,function*(){try{for(n=!0,r=bi(t);i=yield r.next(),o=i.done,!o;n=!0){c=i.value,n=!1;let l=c;e.write(l)}}catch(l){s={error:l}}finally{try{!n&&!o&&(a=r.return)&&(yield a.call(r))}finally{if(s)throw s.error}}return e.finish()})}function BO(e,t){if(Yr(e))return Cz(e,t);if(xi(e))return Lz(e,t);throw new Error("toDOMStream() must be called with an Iterable or AsyncIterable")}function Lz(e,t){let n=null,r=t?.type==="bytes"||!1,i=t?.highWaterMark||Math.pow(2,24);return new ReadableStream(Object.assign(Object.assign({},t),{start(s){o(s,n||(n=e[Symbol.iterator]()))},pull(s){n?o(s,n):s.close()},cancel(){(n?.return&&n.return()||!0)&&(n=null)}}),Object.assign({highWaterMark:r?i:void 0},t));function o(s,a){let c,l=null,u=s.desiredSize||null;for(;!(l=a.next(r?u:null)).done;)if(ArrayBuffer.isView(l.value)&&(c=Ot(l.value))&&(u!=null&&r&&(u=u-c.byteLength+1),l.value=c),s.enqueue(l.value),u!=null&&--u<=0)return;s.close()}}function Cz(e,t){let n=null,r=t?.type==="bytes"||!1,i=t?.highWaterMark||Math.pow(2,24);return new ReadableStream(Object.assign(Object.assign({},t),{start(s){return Z(this,void 0,void 0,function*(){yield o(s,n||(n=e[Symbol.asyncIterator]()))})},pull(s){return Z(this,void 0,void 0,function*(){n?yield o(s,n):s.close()})},cancel(){return Z(this,void 0,void 0,function*(){(n?.return&&(yield n.return())||!0)&&(n=null)})}}),Object.assign({highWaterMark:r?i:void 0},t));function o(s,a){return Z(this,void 0,void 0,function*(){let c,l=null,u=s.desiredSize||null;for(;!(l=yield a.next(r?u:null)).done;)if(ArrayBuffer.isView(l.value)&&(c=Ot(l.value))&&(u!=null&&r&&(u=u-c.byteLength+1),l.value=c),s.enqueue(l.value),u!=null&&--u<=0)return;s.close()})}}function $O(e){return new gv(e)}var gv=class{constructor(t){this._numChunks=0,this._finished=!1,this._bufferedSize=0;let{["readableStrategy"]:n,["writableStrategy"]:r,["queueingStrategy"]:i="count"}=t,o=J4(t,["readableStrategy","writableStrategy","queueingStrategy"]);this._controller=null,this._builder=Ec(o),this._getSize=i!=="bytes"?PO:UO;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"?PO:UO}),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)}},PO=e=>{var t;return(t=e?.length)!==null&&t!==void 0?t:0},UO=e=>{var t;return(t=e?.byteLength)!==null&&t!==void 0?t:0};function o0(e,t){let n=new no,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 nn.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 s0(e,t){let n=new this(e),r=new Hr(n),i=new ReadableStream({cancel(){return Z(this,void 0,void 0,function*(){yield r.cancel()})},pull(s){return Z(this,void 0,void 0,function*(){yield o(s)})},start(s){return Z(this,void 0,void 0,function*(){yield o(s)})}},Object.assign({highWaterMark:Math.pow(2,14)},t));return{writable:new WritableStream(n,e),readable:i};function o(s){return Z(this,void 0,void 0,function*(){let a=null,c=s.desiredSize;for(;a=yield r.read(c||null);)if(s.enqueue(a),c!=null&&(c-=a.byteLength)<=0)return;s.close()})}}function Fc(e){let t=nn.from(e);return vr(t)?t.then(n=>Fc(n)):t.isAsync()?t.readAll().then(n=>new on(n)):new on(t.readAll())}function a0(e,t="stream"){return(t==="stream"?Dc:kc).writeAll(e).toUint8Array(!0)}var Uz=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},Aw),tv),Yw),Nw),Sw),Vw),Ew),{compareSchemas:Nc,compareFields:hO,compareTypes:pO});xn.toDOMStream=BO;_e.throughDOM=$O;nn.throughDOM=o0;_a.throughDOM=o0;oo.throughDOM=o0;Oc.throughDOM=s0;kc.throughDOM=s0;Dc.throughDOM=s0;function c0(e="ws://localhost:3000/"){let t=[],n=!1,r=null,i,o={open(){n=!0,c()},close(){for(n=!1,r=null,i=null;t.length;)t.shift().reject("Socket closed")},error(l){if(r){let{reject:u}=r;r=null,c(),u(l)}else console.error("WebSocket error: ",l)},message({data:l}){if(r){let{query:u,resolve:f,reject:d}=r;if(r=null,c(),typeof l=="string"){let h=JSON.parse(l);h.error?d(h.error):f(h)}else if(u.type==="exec")f();else if(u.type==="arrow")f(Fc(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?`${qO(t)}.`:""}${r}`}else return t?qO(t):"NULL"}};function qO(e){return e.split(".").map(n=>`"${n}"`).join(".")}function jO(e,t){return e instanceof mr&&e.column===t}function Vt(e){return typeof e=="string"?wa(e):e}function Lc(e){return typeof e=="string"?VO(e):e}function VO(e){return new mr(e)}function wa(e,t){return arguments.length===1&&(t=e,e=null),new mr(e,t)}function so(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 ps=e=>typeof e?.addEventListener=="function";function l0(e){return e instanceof va}var va=class{constructor(t,n,r){this._expr=Array.isArray(t)?t:[t],this._deps=n||[],this.annotate(r);let i=this._expr.filter(o=>ps(o));i.length>0?(this._params=Array.from(new Set(i)),this._params.forEach(o=>{o.addEventListener("value",()=>$z(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=>ps(t)&&!l0(t)?so(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 $z(e,t){if(t?.size)return Promise.allSettled(Array.from(t,n=>n(e)))}function bv(e,t){let n=[e[0]],r=new Set,i=t.length;for(let o=0,s=0;o<i;){let a=t[o];ps(a)?n[++s]=a:(Array.isArray(a?.columns)&&a.columns.forEach(l=>r.add(l)),n[s]+=typeof a=="string"?a:so(a));let c=e[++o];ps(n[s])?n[++s]=c:n[s]+=c}return{spans:n,cols:Array.from(r)}}function j(e,...t){let{spans:n,cols:r}=bv(e,t);return new va(n,r)}function xv(e){let t=Vt(e);return j`${t} DESC NULLS LAST`.annotate({label:t?.label,desc:!0})}var Rr=e=>({value:e,toString:()=>so(e)});function _h(e){e(this.op,this),this.children?.forEach(t=>t.visit(e))}function YO(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(")")),j(r,...n).annotate({op:e,children:n,visit:_h})}var Wn=(...e)=>YO("AND",e.flat()),Cc=(...e)=>YO("OR",e.flat()),zz=e=>t=>j`(${e} ${Vt(t)})`.annotate({op:e,a:t,visit:_h}),_v=zz("NOT"),GO=e=>t=>j`(${Vt(t)} ${e})`.annotate({op:e,a:t,visit:_h}),Bc=GO("IS NULL"),ms=GO("IS NOT NULL"),Sa=e=>(t,n)=>j`(${Vt(t)} ${e} ${Vt(n)})`.annotate({op:e,a:t,b:n,visit:_h}),ys=Sa("="),wh=Sa("<>"),gs=Sa("<"),Pc=Sa(">"),bs=Sa("<="),wv=Sa(">="),vv=Sa("IS DISTINCT FROM"),vh=Sa("IS NOT DISTINCT FROM");function WO(e,t,n,r){t=Vt(t);let i=e.startsWith("NOT ")?"NOT ":"";return(n?r?j`${i}(${n[0]} <= ${t} AND ${t} < ${n[1]})`:j`(${t} ${e} ${n[0]} AND ${n[1]})`:j``).annotate({op:e,visit:_h,field:t,range:n})}var Te=(e,t,n)=>WO("BETWEEN",e,t,n),Sv=(e,t,n)=>WO("NOT BETWEEN",e,t,n);function Uc(e,t){return Array.from({length:e},()=>t)}function Sn(e,t){return(...n)=>{let r=n.map(Vt),i=t?`::${t}`:"";return(r.length?j([`${e}(`,...Uc(r.length-1,", "),`)${i}`],...r):j`${e}()${i}`).annotate({func:e,args:r})}}var Iv=Sn("REGEXP_MATCHES"),Tv=Sn("CONTAINS"),Ev=Sn("PREFIX"),Mv=Sn("SUFFIX"),qz=Sn("LOWER"),jz=Sn("UPPER"),Vz=Sn("LENGTH"),Yz=Sn("ISNAN"),Gz=Sn("ISFINITE"),Wz=Sn("ISINF");var Sh=class e extends va{constructor(t,n,r,i,o="",s="",a=""){let c;if(i&&!(o||s||a))c=i?j`${n} OVER "${i}"`:j`${n} OVER ()`;else{let d=o&&s?" ":"",h=(o||s)&&a?" ":"";c=j`${n} OVER (${i?`"${i}" `:""}${o}${d}${s}${h}${a})`}r&&(c=j`(${c})::${r}`);let{_expr:u,_deps:f}=c;super(u,f,{window:t,func:n,type:r,name:i,group:o,order:s,frame:a})}get basis(){return this.column}get label(){let{func:t}=this;return t.label??t.toString()}over(t){let{window:n,func:r,type:i,group:o,order:s,frame:a}=this;return new e(n,r,i,t,o,s,a)}partitionby(...t){let n=t.flat().filter(u=>u).map(Vt),r=j(["PARTITION BY ",Uc(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=j(["ORDER BY ",Uc(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=XO("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=XO("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 XO(e,t){if(ps(t)){let n=j`${t}`;return n.toString=()=>`${e} ${HO(t.value)}`,n}return`${e} ${HO(t)}`}function HO(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 Li(e,t){return(...n)=>{let r=Sn(e)(...n);return new Sh(e,r,t)}}var Av=Li("ROW_NUMBER","INTEGER"),Nv=Li("RANK","INTEGER"),Rv=Li("DENSE_RANK","INTEGER"),Ov=Li("PERCENT_RANK"),Dv=Li("CUME_DIST"),kv=Li("NTILE"),Fv=Li("LAG"),Lv=Li("LEAD"),Cv=Li("FIRST_VALUE"),Bv=Li("LAST_VALUE"),Pv=Li("NTH_VALUE");function $v(e,...t){return j(e,...t).annotate({aggregate:!0})}var Uv=class e extends va{constructor(t,n,r,i,o){n=(n||[]).map(Vt);let{strings:s,exprs:a}=Xz(t,n,r,i,o),{spans:c,cols:l}=bv(s,a);super(c,l,{aggregate:t,args:n,type:r,isDistinct:i,filter:o})}get basis(){return this.column}get label(){let{aggregate:t,args:n,isDistinct:r}=this,i=r?"DISTINCT"+(n.length?" ":""):"",o=n.length?`(${i}${n.map(Hz).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 Sh(t,o,r)}partitionby(...t){return this.window().partitionby(...t)}orderby(...t){return this.window().orderby(...t)}rows(t,n){return this.window().rows(t,n)}range(t,n){return this.window().range(t,n)}};function Xz(e,t,n,r,i){let o=`)${n?`::${n}`:""}`,s=[`${e}(${r?"DISTINCT ":""}`],a=[];return t.length?(s=s.concat([...Uc(t.length-1,", "),`${o}${i?" FILTER (WHERE ":""}`,...i?[")"]:[]]),a=[...t,...i?[i]:[]]):s[0]+="*"+o,{exprs:a,strings:s}}function Hz(e){let t=so(e);return t&&t.startsWith('"')&&t.endsWith('"')?t.slice(1,-1):t}function Ht(e,t){return(...n)=>new Uv(e,n,t)}var Or=Ht("COUNT","INTEGER"),zv=Ht("AVG"),Zz=Ht("AVG"),qv=Ht("MAD"),Kr=Ht("MAX"),Jr=Ht("MIN"),Dr=Ht("SUM","DOUBLE"),jv=Ht("PRODUCT"),Vv=Ht("MEDIAN"),Yv=Ht("QUANTILE"),Gv=Ht("MODE"),Wv=Ht("VARIANCE"),Xv=Ht("STDDEV"),Hv=Ht("SKEWNESS"),Zv=Ht("KURTOSIS"),Qv=Ht("ENTROPY"),Kv=Ht("VAR_POP"),Jv=Ht("STDDEV_POP"),t2=Ht("CORR"),e2=Ht("COVAR_POP"),n2=Ht("REGR_INTERCEPT"),r2=Ht("REGR_SLOPE"),i2=Ht("REGR_COUNT"),Qz=Ht("REGR_R2"),o2=Ht("REGR_SYY"),s2=Ht("REGR_SXX"),Kz=Ht("REGR_SXY"),a2=Ht("REGR_AVGX"),Jz=Ht("REGR_AVGY"),tq=Ht("FIRST"),c2=Ht("LAST"),pu=Ht("ARG_MIN"),mu=Ht("ARG_MAX"),l2=Ht("STRING_AGG"),u2=Ht("ARRAY_AGG");function Ih(e,t){let n=Vt(e),r=j`CAST(${n} AS ${t})`;return Object.defineProperty(r,"label",{enumerable:!0,get(){return e.label}}),Object.defineProperty(r,"aggregate",{enumerable:!0,get(){return e.aggregate||!1}}),r}var yu=e=>Ih(e,"DOUBLE"),f2=e=>Ih(e,"INTEGER");var Th=e=>{let t=Vt(e);return j`(1000 * (epoch(${t}) - second(${t})) + millisecond(${t}))::DOUBLE`},d2=e=>{let t=Vt(e);return j`MAKE_DATE(2012, MONTH(${t}), 1)`.annotate({label:"month"})},h2=e=>{let t=Vt(e);return j`MAKE_DATE(2012, MONTH(${t}), DAY(${t}))`.annotate({label:"date"})},p2=e=>{let t=Vt(e);return j`MAKE_DATE(2012, 1, DAY(${t}))`.annotate({label:"date"})};var Eh=Sn("ST_AsGeoJSON"),ZO=Sn("ST_X"),QO=Sn("ST_Y"),Mh=Sn("ST_CENTROID"),m2=e=>ZO(Mh(e)),y2=e=>QO(Mh(e));var yt=class e{static select(...t){return new e().select(...t)}static from(...t){return new e().from(...t)}static with(...t){return new e().with(...t)}static union(...t){return new $c("UNION",t.flat())}static unionAll(...t){return new $c("UNION ALL",t.flat())}static intersect(...t){return new $c("INTERSECT",t.flat())}static except(...t){return new $c("EXCEPT",t.flat())}constructor(){this.query={with:[],select:[],from:[],where:[],groupby:[],having:[],window:[],qualify:[],orderby:[]}}clone(){let t=new e;return t.query={...this.query},t}with(...t){let{query:n}=this;if(t.length===0)return n.with;{let r=[],i=(o,s)=>{let a=s.clone();a.cteFor=this,r.push({as:o,query:a})};return t.flat().forEach(o=>{if(o!=null)if(o.as&&o.query)i(o.as,o.query);else for(let s in o)i(s,o[s])}),n.with=n.with.concat(r),this}}select(...t){let{query:n}=this;if(t.length===0)return n.select;{let r=[];for(let i of t.flat())if(i!=null)if(typeof i=="string")r.push({as:i,expr:Vt(i)});else if(i instanceof mr)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:u0(o),expr:Vt(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:Lc(i)});else if(i instanceof mr)r.push({as:i.table,from:i});else if(f0(i)||l0(i))r.push({from:i});else if(Array.isArray(i))r.push({as:u0(i[0]),from:Lc(i[1])});else for(let o in i)r.push({as:u0(o),from:Lc(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:u0(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(f0(s))o.push(s);else if(i[s.table]){let a=i[s.table];o.push(a)}}),o}toString(){let{select:t,distinct:n,from:r,sample:i,where:o,groupby:s,having:a,window:c,qualify:l,orderby:u,limit:f,offset:d,with:h}=this.query,p=[];if(h.length){let b=h.map(({as:m,query:g})=>`"${m}" AS (${g})`);p.push(`WITH ${b.join(", ")}`)}let y=t.map(({as:b,expr:m})=>jO(m,b)&&!m.table?`${m}`:`${m} AS "${b}"`);if(p.push(`SELECT${n?" DISTINCT":""} ${y.join(", ")}`),r.length){let b=r.map(({as:m,from:g})=>{let x=f0(g)?`(${g})`:`${g}`;return!m||m===g.table?x:`${x} AS "${m}"`});p.push(`FROM ${b.join(", ")}`)}if(o.length){let b=o.map(String).filter(m=>m).join(" AND ");b&&p.push(`WHERE ${b}`)}if(i){let{rows:b,perc:m,method:g,seed:x}=i,_=b?`${b} ROWS`:`${m} PERCENT`,v=g?` (${g}${x!=null?`, ${x}`:""})`:"";p.push(`USING SAMPLE ${_}${v}`)}if(s.length&&p.push(`GROUP BY ${s.join(", ")}`),a.length){let b=a.map(String).filter(m=>m).join(" AND ");b&&p.push(`HAVING ${b}`)}if(c.length){let b=c.map(({as:m,expr:g})=>`"${m}" AS (${g})`);p.push(`WINDOW ${b.join(", ")}`)}if(l.length){let b=l.map(String).filter(m=>m).join(" AND ");b&&p.push(`QUALIFY ${b}`)}return u.length&&p.push(`ORDER BY ${u.join(", ")}`),Number.isFinite(f)&&p.push(`LIMIT ${f}`),Number.isFinite(d)&&p.push(`OFFSET ${d}`),p.join(" ")}},$c=class e{constructor(t,n){this.op=t,this.queries=n.map(r=>r.clone()),this.query={orderby:[]}}clone(){let t=new e(this.op,this.queries);return t.query={...this.query},t}orderby(...t){let{query:n}=this;return t.length===0?n.orderby:(n.orderby=n.orderby.concat(t.flat().filter(r=>r).map(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 f0(e){return e instanceof yt||e instanceof $c}function u0(e){return eq(e)?e.slice(1,-1):e}function eq(e){return e[0]==='"'&&e[e.length-1]==='"'}function Ia(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 g2(e){return`INSTALL ${e}; LOAD ${e}`}function KO(e,{columns:t=Object.keys(e?.[0]||{})}={}){let n=[];if(Array.isArray(t)?(n=t,t=n.reduce((i,o)=>(i[o]=o,i),{})):t&&(n=Object.keys(t)),!n.length)throw new Error("Can not create table from empty column set.");let r=[];for(let i of e){let o=n.map(s=>`${so(i[s])} AS "${t[s]}"`);r.push(`(SELECT ${o.join(", ")})`)}return r.join(" UNION ALL ")}function d0(e,t,n,r={},i={}){let{select:o=["*"],where:s,view:a,temp:c,replace:l,...u}=r,f=nq({...i,...u}),d=`${e}('${n}'${f?", "+f:""})`,h=s?` WHERE ${s}`:"",p=`SELECT ${o.join(", ")} FROM ${d}${h}`;return Ia(t,p,{view:a,temp:c,replace:l})}function x2(e,t,n){return d0("read_csv",e,t,n,{auto_detect:!0,sample_size:-1})}function _2(e,t,n){return d0("read_json",e,t,n,{auto_detect:!0,json_format:"auto"})}function w2(e,t,n){return d0("read_parquet",e,t,n)}function v2(e,t,n={}){let{options:r,...i}=n;if(r){let o=Array.isArray(r)?r.join(", "):typeof r=="string"?r:Object.entries(r).map(([s,a])=>`${s}=${a}`).join(", ");i.open_options=o.toUpperCase()}return d0("st_read",e,t,i)}function S2(e,t,n={}){let{select:r=["*"],...i}=n,o=KO(t),s=r.length===1&&r[0]==="*"?o:`SELECT ${r} FROM ${o}`;return Ia(e,s,i)}function nq(e){return Object.entries(e).map(([t,n])=>`${t}=${b2(n)}`).join(", ")}function b2(e){switch(typeof e){case"boolean":return String(e);case"string":return`'${e}'`;case"undefined":case"object":return e==null?"NULL":Array.isArray(e)?"["+e.map(t=>b2(t)).join(", ")+"]":"{"+Object.entries(e).map(([t,n])=>`'${t}': ${b2(n)}`).join(", ")+"}";default:return e}}function JO(e){switch(e){case"BIGINT":case"HUGEINT":case"INTEGER":case"SMALLINT":case"TINYINT":case"UBIGINT":case"UINTEGER":case"USMALLINT":case"UTINYINT":case"DOUBLE":case"FLOAT":case"REAL":case"DECIMAL":return"number";case"DATE":case"TIMESTAMP":case"TIMESTAMPTZ":case"TIMESTAMP WITH TIME ZONE":case"TIME":case"TIMESTAMP_NS":return"date";case"BOOLEAN":return"boolean";case"VARCHAR":case"UUID":return"string";case"LIST":return"array";case"BLOB":case"STRUCT":case"MAP":return"object";default:throw new Error(`Unsupported type: ${e}`)}}var rq="count",iq="nulls",oq="max",sq="min",aq="distinct";var cq={[rq]:Or,[aq]:e=>Or(e).distinct(),[oq]:Kr,[sq]:Jr,[iq]:e=>Or().where(Bc(e))};function tD({table:e,column:t},n){return yt.from(e).select(n.map(r=>[r,cq[r](t)]))}var eD=()=>Object.create(null),h0=class{constructor(t){this.mc=t,this.clear()}clear(){this.tables=eD()}tableInfo(t){let n=this.tables;if(n[t])return n[t];let r=lq(this.mc,t).catch(i=>{throw n[t]=null,i});return n[t]=r}async fieldInfo({table:t,column:n,stats:r}){let o=(await this.tableInfo(t))[n];if(o==null)return;if(!r?.length)return o;let s=await this.mc.query(tD(o,r),{persist:!0}),a={...o,...Array.from(s)[0]};for(let c in a){let l=a[c];typeof l=="bigint"&&(a[c]=Number(l))}return a}async queryFields(t){let n=await uq(this,t);return(await Promise.all(n.map(i=>this.fieldInfo(i)))).filter(i=>i)}};async function lq(e,t){let n=await e.query(`DESCRIBE ${Lc(t)}`,{type:"json",cache:!1}),r=eD();for(let i of n)r[i.column_name]={table:t,column:i.column_name,sqlType:i.column_type,type:JO(i.column_type),nullable:i.null==="YES"};return r}async function uq(e,t){return t.length===1&&t[0].column==="*"?Object.values(await e.tableInfo(t[0].table)):t}function rD(e){let t=2166136261;for(let n=0,r=e.length;n<r;++n){let i=e.charCodeAt(n),o=i&65280;o&&(t=nD(t^o>>8)),t=nD(t^i&255)}return fq(t)}function nD(e){return e+(e<<1)+(e<<4)+(e<<7)+(e<<8)+(e<<24)}function fq(e){return e+=e<<13,e^=e>>>7,e+=e<<3,e^=e>>>17,e+=e<<5,e&4294967295}var sD=e=>e,p0=class{constructor(t,{selection:n,temp:r=!0}){this.mc=t,this.selection=n,this.temp=r,this.reset()}reset(){this.enabled=!1,this.clients=null,this.indices=null,this.activeView=null}clear(){this.indices&&(this.mc.cancel(Array.from(this.indices.values(),t=>t.result)),this.indices=null)}index(t,n){if(this.clients!==t){let l=Array.from(t,oD),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=dq(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=oD(l),f=l.query(o.predicate(l)).select({...i.columns,...u.count}).groupby(Object.keys(i.columns)),[d]=f.subqueries;if(d){let g=Object.values(i.columns).map(x=>x.columns[0]);mq(d,g)}let h=f.orderby();f.query.orderby=[];let p=f.toString(),b=`cube_index_${(rD(p)>>>0).toString(16)}`,m=a.exec(Ia(b,p,{temp:c}));s.set(l,{table:b,result:m,order:h,...u})}}async update(){let{clients:t,selection:n,activeView:r}=this,i=r.predicate(n.active.predicate);return Promise.all(Array.from(t).map(o=>this.updateClient(o,i)))}async updateClient(t,n){let r=this.indices.get(t);if(!r)return;n||(n=this.activeView.predicate(this.selection.active.predicate));let{table:i,dims:o,aggr:s,order:a=[]}=r,c=yt.select(o,s).from(i).groupby(o).where(n).orderby(a);return this.mc.updateClient(t,c)}};function dq(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=>hq(l,s));if(c.some(l=>l==null))return null;c.length===1?(a=l=>l?Te("active0",l.range.map(c[0])):[],r={active0:c[0](e.predicate.field)}):(a=l=>l?Wn(l.children.map(({range:u},f)=>Te(`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=sD,r=Object.fromEntries(r.map(c=>[c.toString(),c]));else return null;return{source:t,columns:r,predicate:a}}function hq(e,t){let{type:n,domain:r,range:i}=e,o,s;switch(n){case"linear":o=sD,s=Vt;break;case"log":o=Math.log,s=a=>j`LN(${Vt(a)})`;break;case"symlog":o=a=>Math.sign(a)*Math.log1p(Math.abs(a)),s=a=>(a=Vt(a),j`SIGN(${a}) * LN(1 + ABS(${a}))`);break;case"sqrt":o=Math.sqrt,s=a=>j`SQRT(${Vt(a)})`;break;case"utc":case"time":o=a=>+a,s=a=>a instanceof Date?+a:Th(Vt(a));break}return o?pq(r,i,t,o,s):null}function pq(e,t,n,r,i){let o=r(Math.min(e[0],e[1])),s=r(Math.max(e[0],e[1])),a=Math.abs(r(t[1])-r(t[0]))/(s-o)/n,c=n===1?"":`${n}::INTEGER * `;return l=>j`${c}FLOOR(${a}::DOUBLE * (${i(l)} - ${o}::DOUBLE))::INTEGER`}var iD={from:NaN};function oD(e){if(!e.filterIndexable)return iD;let t=e.query(),n=I2(t);if(!n||!t.groupby)return iD;let r=new Set(t.groupby().map(a=>a.column)),i=[],o=[],s;for(let{as:a,expr:{aggregate:c}}of t.select())switch(c?.toUpperCase?.()){case"COUNT":case"SUM":i.push({[a]:j`SUM("${a}")::DOUBLE`});break;case"AVG":s="_count_",i.push({[a]:j`(SUM("${a}" * ${s}) / SUM(${s}))::DOUBLE`});break;case"MAX":i.push({[a]:j`MAX("${a}")`});break;case"MIN":i.push({[a]:j`MIN("${a}")`});break;default:if(r.has(a))o.push(a);else return null}return{aggr:i,dims:o,count:s?{[s]:j`COUNT(*)`}:{},from:n}}function I2(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=I2(t[0]);for(let r=1;r<t.length;++r){let i=I2(t[r]);if(i!==void 0&&i!==n)return NaN}return n}function mq(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 m0=class{constructor(t,n,r=!0){this.mc=t,this.selection=n,this.clients=new Set,this.indexer=r?new p0(this.mc,{...r,selection:n}):null;let{value:i,activate:o}=this.handlers={value:()=>this.update(),activate:s=>this.indexer?.index(this.clients,s)};n.addEventListener("value",i),n.addEventListener("activate",o)}finalize(){let{value:t,activate:n}=this.handlers;this.selection.removeEventListener("value",t),this.selection.removeEventListener("activate",n)}reset(){this.indexer?.reset()}add(t){return(this.clients=new Set(this.clients)).add(t),this}remove(t){return this.clients.has(t)&&(this.clients=new Set(this.clients)).delete(t),this}update(){let{mc:t,indexer:n,clients:r,selection:i}=this;return n?.index(r)?n.update():yq(t,r,i)}};function yq(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 y0(){let e,t,n=new Promise((r,i)=>{e=r,t=i});return n.fulfill=r=>(e(r),n),n.reject=r=>(t(r),n),n}function gq(e){return(typeof requestAnimationFrame<"u"?requestAnimationFrame:typeof setImmediate<"u"?setImmediate:setTimeout)(e)}function aD(e,t,n){let r=[],i=0;function o(){let s=bq(r,t);r=[],i=0;for(let a of s)_q(a,e,n),Sq(a,t)}return{add(s,a){s.request.type==="arrow"?(i=i||gq(()=>o()),r.push({entry:s,priority:a,index:r.length})):e(s,a)}}}function bq(e,t){let n=[],r=new Map;for(let i of e){let{entry:{request:o}}=i,s=xq(o.query,t);if(!r.has(s)){let a=[];n.push(a),r.set(s,a)}r.get(s).push(i)}return n}function xq(e,t){let n=`${e}`;if(e instanceof yt&&!t.get(n)){if(e.orderby().length||e.where().length||e.qualify().length||e.having().length)return n;let r=e.clone().$select("*"),i=e.groupby();if(i.length){let o={};e.select().forEach(({as:s,expr:a})=>o[s]=a),r.$groupby(i.map(s=>s instanceof mr&&o[s.column]||s))}return`${r}`}else return n}function _q(e,t,n){if(wq(e))t({request:{type:"arrow",cache:!1,record:!1,query:vq(e,n)},result:e.result=y0()});else for(let{entry:r,priority:i}of e)t(r,i)}function wq(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 vq(e,t){let n=e.maps=[],r=new Map;for(let s of e){let{query:a}=s.entry.request,c=[];n.push(c);for(let{as:l,expr:u}of a.select()){let f=`${u}`;r.has(f)||r.set(f,[`col${r.size}`,u]);let[d]=r.get(f);c.push([d,l])}t(`${a}`)}let i=e[0].entry.request.query.clone(),o=i.groupby();if(o.length){let s={};e.maps[0].forEach(([a,c])=>s[c]=a),i.$groupby(o.map(a=>a instanceof mr&&s[a.column]||a))}return i.$select(Array.from(r.values()))}async function Sq(e,t){let{maps:n,result:r}=e;if(!n)return;let i;try{i=await r}catch(o){for(let{entry:s}of e)s.result.reject(o);return}e.forEach(({entry:o},s)=>{let{request:a,result:c}=o,l=Iq(i,n[s]);a.cache&&t.set(String(a.query),l),c.fulfill(l)})}function Iq(e,t){if(t){let n={};for(let[r,i]of t)n[i]=e.getChild(r);return new e.constructor(n)}else return e}var Tq=typeof requestIdleCallback<"u"?requestIdleCallback:setTimeout,cD=()=>({get:()=>{},set:(e,t)=>t,clear:()=>{}});function lD({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&&Tq(r),o},clear(){n=new Map}}}function uD(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};function fD(){let e=uD(3),t,n,r,i=[],o=null,s;function a(){if(o||e.isEmpty())return;let{request:f,result:d}=e.next();o=u(f,d),o.finally(()=>{o=null,a()})}function c(f,d=ao.Normal){e.insert(f,d),a()}function l(f){i.length&&f&&i.forEach(d=>d.add(f))}async function u(f,d){try{let{query:h,type:p,cache:y=!1,record:b=!0,options:m}=f,g=h?`${h}`:null;if(b&&l(g),y){let v=n.get(g);if(v){r.debug("Cache"),d.fulfill(v);return}}let x=performance.now(),_=await t.query({type:p,sql:g,...m});y&&n.set(g,_),r.debug(`Request: ${(performance.now()-x).toFixed(1)}`),d.fulfill(_)}catch(h){d.reject(h)}}return{cache(f){return f!==void 0?n=f===!0?lD():f||cD():n},logger(f){return f?r=f:r},connector(f){return f?t=f:t},consolidate(f){f&&!s?s=aD(c,n,l):!f&&s&&(s=null)},request(f,d=ao.Normal){let h=y0(),p={request:f,result:h};return s?s.add(p,d):c(p,d),h},cancel(f){let d=new Set(f);e.remove(({result:h})=>d.has(h))},clear(){e.remove(({result:f})=>(f.reject("Cleared"),!0))},record(){let f=[],d={add(h){f.push(h)},reset(){f=[]},snapshot(){return f.slice()},stop(){return i=i.filter(h=>h!==d),f}};return i.push(d),d}}}function dD(){return{debug(){},info(){},log(){},warn(){},error(){}}}var g0;function ti(e){return e?g0=e:g0==null&&(g0=new Ah),g0}var Ah=class{constructor(t=c0(),n={}){let{logger:r=console,manager:i=fD()}=n;this.catalog=new h0(this),this.manager=i,this.logger(r),this.configure(n),this.databaseConnector(t),this.clear()}logger(t){return arguments.length&&(this._logger=t||dD(),this.manager.logger(this._logger)),this._logger}configure({cache:t=!0,consolidate:n=!0,indexes:r=!0}){this.manager.cache(t),this.manager.consolidate(n),this.indexes=r}clear({clients:t=!0,cache:n=!0,catalog:r=!1}={}){this.manager.clear(),t&&(this.clients?.forEach(i=>this.disconnect(i)),this.filterGroups?.forEach(i=>i.finalize()),this.clients=new Set,this.filterGroups=new Map),n&&this.manager.cache().clear(),r&&this.catalog.clear()}databaseConnector(t){return this.manager.connector(t)}cancel(t){this.manager.cancel(t)}exec(t,{priority:n=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{catalog:n,clients:r,filterGroups:i,indexes:o}=this;if(r.has(t))throw new Error("Client already connected.");r.add(t),t.coordinator=this;let s=t.fields();s?.length&&t.fieldInfo(await n.queryFields(s));let a=t.filterBy;if(a)if(i.has(a))i.get(a).add(t);else{let c=new m0(this,a,o);i.set(a,c.add(t))}t.requestQuery()}disconnect(t){let{clients:n,filterGroups:r}=this;n.has(t)&&(n.delete(t),r.get(t.filterBy)?.remove(t),t.coordinator=null)}};var b0=class{constructor(){this._callbacks=new Map}addEventListener(t,n){this._callbacks.has(t)||this._callbacks.set(t,{callbacks:new Set,pending:null,queue:new T2}),this._callbacks.get(t).callbacks.add(n)}removeEventListener(t,n){let r=this._callbacks.get(t);r&&r.callbacks.delete(n)}willEmit(t,n){return n}emitQueueFilter(){return null}cancel(t){this._callbacks.get(t)?.queue.clear()}emit(t,n){let r=this._callbacks.get(t)||{};if(r.pending)r.queue.enqueue(n,this.emitQueueFilter(t,n));else{let i=this.willEmit(t,n),{callbacks:o,queue:s}=r;if(o?.size){let a=Promise.allSettled(Array.from(o,c=>c(i))).then(()=>{r.pending=null,s.isEmpty()||this.emit(t,s.dequeue())});r.pending=a}}}},T2=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 Nh(e,t){return e===t?!1:e instanceof Date&&t instanceof Date?+e!=+t:Array.isArray(e)&&Array.isArray(t)?Eq(e,t):!0}function Eq(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 yr(e){return e instanceof Ta}var Ta=class e extends b0{constructor(t){super(),this._value=t}static value(t){return new e(t)}static array(t){if(t.some(n=>yr(n))){let n=new e,r=()=>n.update(t.map(i=>yr(i)?i.value:i));return r(),t.forEach(i=>yr(i)?i.addEventListener("value",r):0),n}return new e(t)}get value(){return this._value}update(t,{force:n}={}){return Nh(this._value,t)||n?this.emit("value",t):this.cancel("value"),this}willEmit(t,n){return t==="value"&&(this._value=n),n}};function ei(e){return e instanceof xs}var xs=class e extends Ta{static intersect({cross:t=!1}={}){return new e(new zc({cross:t}))}static union({cross:t=!1}={}){return new e(new zc({cross:t,union:!0}))}static single({cross:t=!1}={}){return new e(new zc({cross:t,single:!0}))}static crossfilter(){return new e(new zc({cross:!0}))}constructor(t=new zc){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)}},zc=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?Cc(o):o}queueFilter(t){if(this.cross){let n=t.active?.source;return r=>r.active?.source!==n}}};function hD(e="http://localhost:3000/"){return{async query(t){let n=fetch(e,{method:"POST",mode:"cors",cache:"no-cache",credentials:"omit",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)});return t.type==="exec"?n:t.type==="arrow"?Fc(n):(await n).json()}}}var Mq=Object.create,pD=Object.defineProperty,Aq=Object.getOwnPropertyDescriptor,Nq=Object.getOwnPropertyNames,Rq=Object.getPrototypeOf,Oq=Object.prototype.hasOwnProperty,Dq=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),kq=(e,t,n,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of Nq(t))!Oq.call(e,i)&&i!==n&&pD(e,i,{get:()=>t[i],enumerable:!(r=Aq(t,i))||r.enumerable});return e},Fq=(e,t,n)=>(n=e!=null?Mq(Rq(e)):{},kq(t||!e||!e.__esModule?pD(n,"default",{value:e,enumerable:!0}):n,e)),Lq=Dq((e,t)=>{t.exports=Worker}),Cq=(e=>(e[e.UNDEFINED=0]="UNDEFINED",e[e.AUTOMATIC=1]="AUTOMATIC",e[e.READ_ONLY=2]="READ_ONLY",e[e.READ_WRITE=3]="READ_WRITE",e))(Cq||{}),Bq=(e=>(e[e.IDENTIFIER=0]="IDENTIFIER",e[e.NUMERIC_CONSTANT=1]="NUMERIC_CONSTANT",e[e.STRING_CONSTANT=2]="STRING_CONSTANT",e[e.OPERATOR=3]="OPERATOR",e[e.KEYWORD=4]="KEYWORD",e[e.COMMENT=5]="COMMENT",e))(Bq||{}),Pq=(e=>(e[e.NONE=0]="NONE",e[e.DEBUG=1]="DEBUG",e[e.INFO=2]="INFO",e[e.WARNING=3]="WARNING",e[e.ERROR=4]="ERROR",e))(Pq||{}),Uq=(e=>(e[e.NONE=0]="NONE",e[e.CONNECT=1]="CONNECT",e[e.DISCONNECT=2]="DISCONNECT",e[e.OPEN=3]="OPEN",e[e.QUERY=4]="QUERY",e[e.INSTANTIATE=5]="INSTANTIATE",e))(Uq||{}),$q=(e=>(e[e.NONE=0]="NONE",e[e.OK=1]="OK",e[e.ERROR=2]="ERROR",e[e.START=3]="START",e[e.RUN=4]="RUN",e[e.CAPTURE=5]="CAPTURE",e))($q||{}),zq=(e=>(e[e.NONE=0]="NONE",e[e.WEB_WORKER=1]="WEB_WORKER",e[e.NODE_WORKER=2]="NODE_WORKER",e[e.BINDINGS=3]="BINDINGS",e[e.ASYNC_DUCKDB=4]="ASYNC_DUCKDB",e))(zq||{}),mD=class{log(e){}},yD=class{constructor(e=2){this.level=e}log(e){e.level>=this.level&&console.log(e)}};var qq=(e=>(e[e.SUCCESS=0]="SUCCESS",e))(qq||{}),jq=class{constructor(e,t){this._bindings=e,this._conn=t}get bindings(){return this._bindings}async close(){return this._bindings.disconnect(this._conn)}useUnsafe(e){return e(this._bindings,this._conn)}async query(e){this._bindings.logger.log({timestamp:new Date,level:2,origin:4,topic:4,event:4,value:e});let t=await this._bindings.runQuery(this._conn,e),n=nn.from(t);return console.assert(n.isSync(),"Reader is not sync"),console.assert(n.isFile(),"Reader is not file"),new on(n)}async send(e){this._bindings.logger.log({timestamp:new Date,level:2,origin:4,topic:4,event:4,value:e});let t=await this._bindings.startPendingQuery(this._conn,e);for(;t==null;)t=await this._bindings.pollPendingQuery(this._conn);let n=new gD(this._bindings,this._conn,t),r=await nn.from(n);return console.assert(r.isAsync()),console.assert(r.isStream()),r}async cancelSent(){return await this._bindings.cancelPendingQuery(this._conn)}async getTableNames(e){return await this._bindings.getTableNames(this._conn,e)}async prepare(e){let t=await this._bindings.createPrepared(this._conn,e);return new Vq(this._bindings,this._conn,t)}async insertArrowTable(e,t){let n=a0(e,"stream");await this.insertArrowFromIPCStream(n,t)}async insertArrowFromIPCStream(e,t){await this._bindings.insertArrowFromIPCStream(this._conn,e,t)}async insertCSVFromPath(e,t){await this._bindings.insertCSVFromPath(this._conn,e,t)}async insertJSONFromPath(e,t){await this._bindings.insertJSONFromPath(this._conn,e,t)}},gD=class{constructor(e,t,n){this.db=e,this.conn=t,this.header=n,this._first=!0,this._depleted=!1,this._inFlight=null}async next(){if(this._first)return this._first=!1,{done:!1,value:this.header};if(this._depleted)return{done:!0,value:null};let e;return this._inFlight!=null?(e=await this._inFlight,this._inFlight=null):e=await this.db.fetchQueryResults(this.conn),this._depleted=e.length==0,this._depleted||(this._inFlight=this.db.fetchQueryResults(this.conn)),{done:this._depleted,value:e}}[Symbol.asyncIterator](){return this}},Vq=class{constructor(e,t,n){this.bindings=e,this.connectionId=t,this.statementId=n}async close(){await this.bindings.closePrepared(this.connectionId,this.statementId)}async query(...e){let t=await this.bindings.runPrepared(this.connectionId,this.statementId,e),n=nn.from(t);return console.assert(n.isSync()),console.assert(n.isFile()),new on(n)}async send(...e){let t=await this.bindings.sendPrepared(this.connectionId,this.statementId,e),n=new gD(this.bindings,this.connectionId,t),r=await nn.from(n);return console.assert(r.isAsync()),console.assert(r.isStream()),r}},Yq=(e=>(e.CANCEL_PENDING_QUERY="CANCEL_PENDING_QUERY",e.CLOSE_PREPARED="CLOSE_PREPARED",e.COLLECT_FILE_STATISTICS="COLLECT_FILE_STATISTICS",e.CONNECT="CONNECT",e.COPY_FILE_TO_BUFFER="COPY_FILE_TO_BUFFER",e.COPY_FILE_TO_PATH="COPY_FILE_TO_PATH",e.CREATE_PREPARED="CREATE_PREPARED",e.DISCONNECT="DISCONNECT",e.DROP_FILE="DROP_FILE",e.DROP_FILES="DROP_FILES",e.EXPORT_FILE_STATISTICS="EXPORT_FILE_STATISTICS",e.FETCH_QUERY_RESULTS="FETCH_QUERY_RESULTS",e.FLUSH_FILES="FLUSH_FILES",e.GET_FEATURE_FLAGS="GET_FEATURE_FLAGS",e.GET_TABLE_NAMES="GET_TABLE_NAMES",e.GET_VERSION="GET_VERSION",e.GLOB_FILE_INFOS="GLOB_FILE_INFOS",e.INSERT_ARROW_FROM_IPC_STREAM="INSERT_ARROW_FROM_IPC_STREAM",e.INSERT_CSV_FROM_PATH="IMPORT_CSV_FROM_PATH",e.INSERT_JSON_FROM_PATH="IMPORT_JSON_FROM_PATH",e.INSTANTIATE="INSTANTIATE",e.OPEN="OPEN",e.PING="PING",e.POLL_PENDING_QUERY="POLL_PENDING_QUERY",e.REGISTER_FILE_BUFFER="REGISTER_FILE_BUFFER",e.REGISTER_FILE_HANDLE="REGISTER_FILE_HANDLE",e.REGISTER_FILE_URL="REGISTER_FILE_URL",e.RESET="RESET",e.RUN_PREPARED="RUN_PREPARED",e.RUN_QUERY="RUN_QUERY",e.SEND_PREPARED="SEND_PREPARED",e.START_PENDING_QUERY="START_PENDING_QUERY",e.TOKENIZE="TOKENIZE",e))(Yq||{}),Gq=(e=>(e.CONNECTION_INFO="CONNECTION_INFO",e.ERROR="ERROR",e.FEATURE_FLAGS="FEATURE_FLAGS",e.FILE_BUFFER="FILE_BUFFER",e.FILE_INFOS="FILE_INFOS",e.FILE_SIZE="FILE_SIZE",e.FILE_STATISTICS="FILE_STATISTICS",e.INSTANTIATE_PROGRESS="INSTANTIATE_PROGRESS",e.LOG="LOG",e.OK="OK",e.PREPARED_STATEMENT_ID="PREPARED_STATEMENT_ID",e.QUERY_PLAN="QUERY_PLAN",e.QUERY_RESULT="QUERY_RESULT",e.QUERY_RESULT_CHUNK="QUERY_RESULT_CHUNK",e.QUERY_RESULT_HEADER="QUERY_RESULT_HEADER",e.QUERY_RESULT_HEADER_OR_NULL="QUERY_RESULT_HEADER_OR_NULL",e.REGISTERED_FILE="REGISTERED_FILE",e.SCRIPT_TOKENS="SCRIPT_TOKENS",e.SUCCESS="SUCCESS",e.TABLE_NAMES="TABLE_NAMES",e.VERSION_STRING="VERSION_STRING",e))(Gq||{}),Kt=class{constructor(e,t){this.promiseResolver=()=>{},this.promiseRejecter=()=>{},this.type=e,this.data=t,this.promise=new Promise((n,r)=>{this.promiseResolver=n,this.promiseRejecter=r})}};function x0(e){switch(e.typeId){case D.Binary:return{sqlType:"binary"};case D.Bool:return{sqlType:"bool"};case D.Date:return{sqlType:"date"};case D.DateDay:return{sqlType:"date32[d]"};case D.DateMillisecond:return{sqlType:"date64[ms]"};case D.Decimal:{let t=e;return{sqlType:"decimal",precision:t.precision,scale:t.scale}}case D.Float:return{sqlType:"float"};case D.Float16:return{sqlType:"float16"};case D.Float32:return{sqlType:"float32"};case D.Float64:return{sqlType:"float64"};case D.Int:return{sqlType:"int32"};case D.Int16:return{sqlType:"int16"};case D.Int32:return{sqlType:"int32"};case D.Int64:return{sqlType:"int64"};case D.Uint16:return{sqlType:"uint16"};case D.Uint32:return{sqlType:"uint32"};case D.Uint64:return{sqlType:"uint64"};case D.Uint8:return{sqlType:"uint8"};case D.IntervalDayTime:return{sqlType:"interval[dt]"};case D.IntervalYearMonth:return{sqlType:"interval[m]"};case D.List:return{sqlType:"list",valueType:x0(e.valueType)};case D.FixedSizeBinary:return{sqlType:"fixedsizebinary",byteWidth:e.byteWidth};case D.Null:return{sqlType:"null"};case D.Utf8:return{sqlType:"utf8"};case D.Struct:return{sqlType:"struct",fields:e.children.map(t=>O2(t.name,t.type))};case D.Map:{let t=e;return{sqlType:"map",keyType:x0(t.keyType),valueType:x0(t.valueType)}}case D.Time:return{sqlType:"time[s]"};case D.TimeMicrosecond:return{sqlType:"time[us]"};case D.TimeMillisecond:return{sqlType:"time[ms]"};case D.TimeNanosecond:return{sqlType:"time[ns]"};case D.TimeSecond:return{sqlType:"time[s]"};case D.Timestamp:return{sqlType:"timestamp",timezone:e.timezone||void 0};case D.TimestampSecond:return{sqlType:"timestamp[s]",timezone:e.timezone||void 0};case D.TimestampMicrosecond:return{sqlType:"timestamp[us]",timezone:e.timezone||void 0};case D.TimestampNanosecond:return{sqlType:"timestamp[ns]",timezone:e.timezone||void 0};case D.TimestampMillisecond:return{sqlType:"timestamp[ms]",timezone:e.timezone||void 0}}throw new Error("unsupported arrow type: ".concat(e.toString()))}function O2(e,t){let n=x0(t);return n.name=e,n}var Wq=new TextEncoder,bD=class{constructor(e,t=null){this._onInstantiationProgress=[],this._worker=null,this._workerShutdownPromise=null,this._workerShutdownResolver=()=>{},this._nextMessageId=0,this._pendingRequests=new Map,this._logger=e,this._onMessageHandler=this.onMessage.bind(this),this._onErrorHandler=this.onError.bind(this),this._onCloseHandler=this.onClose.bind(this),t!=null&&this.attach(t)}get logger(){return this._logger}attach(e){this._worker=e,this._worker.addEventListener("message",this._onMessageHandler),this._worker.addEventListener("error",this._onErrorHandler),this._worker.addEventListener("close",this._onCloseHandler),this._workerShutdownPromise=new Promise((t,n)=>{this._workerShutdownResolver=t})}detach(){this._worker&&(this._worker.removeEventListener("message",this._onMessageHandler),this._worker.removeEventListener("error",this._onErrorHandler),this._worker.removeEventListener("close",this._onCloseHandler),this._worker=null,this._workerShutdownResolver(null),this._workerShutdownPromise=null,this._workerShutdownResolver=()=>{})}async terminate(){this._worker&&(this._worker.terminate(),this._worker=null,this._workerShutdownPromise=null,this._workerShutdownResolver=()=>{})}async postTask(e,t=[]){if(!this._worker){console.error("cannot send a message since the worker is not set!");return}let n=this._nextMessageId++;return this._pendingRequests.set(n,e),this._worker.postMessage({messageId:n,type:e.type,data:e.data},t),await e.promise}onMessage(e){var t;let n=e.data;switch(n.type){case"LOG":{this._logger.log(n.data);return}case"INSTANTIATE_PROGRESS":{for(let i of this._onInstantiationProgress)i(n.data);return}}let r=this._pendingRequests.get(n.requestId);if(!r){console.warn("unassociated response: [".concat(n.requestId,", ").concat(n.type.toString(),"]"));return}if(this._pendingRequests.delete(n.requestId),n.type=="ERROR"){let i=new Error(n.data.message);i.name=n.data.name,(t=Object.getOwnPropertyDescriptor(i,"stack"))!=null&&t.writable&&(i.stack=n.data.stack),r.promiseRejecter(i);return}switch(r.type){case"CLOSE_PREPARED":case"COLLECT_FILE_STATISTICS":case"COPY_FILE_TO_PATH":case"DISCONNECT":case"DROP_FILE":case"DROP_FILES":case"FLUSH_FILES":case"INSERT_ARROW_FROM_IPC_STREAM":case"IMPORT_CSV_FROM_PATH":case"IMPORT_JSON_FROM_PATH":case"OPEN":case"PING":case"REGISTER_FILE_BUFFER":case"REGISTER_FILE_HANDLE":case"REGISTER_FILE_URL":case"RESET":if(n.type=="OK"){r.promiseResolver(n.data);return}break;case"INSTANTIATE":if(this._onInstantiationProgress=[],n.type=="OK"){r.promiseResolver(n.data);return}break;case"GLOB_FILE_INFOS":if(n.type=="FILE_INFOS"){r.promiseResolver(n.data);return}break;case"GET_VERSION":if(n.type=="VERSION_STRING"){r.promiseResolver(n.data);return}break;case"GET_FEATURE_FLAGS":if(n.type=="FEATURE_FLAGS"){r.promiseResolver(n.data);return}break;case"GET_TABLE_NAMES":if(n.type=="TABLE_NAMES"){r.promiseResolver(n.data);return}break;case"TOKENIZE":if(n.type=="SCRIPT_TOKENS"){r.promiseResolver(n.data);return}break;case"COPY_FILE_TO_BUFFER":if(n.type=="FILE_BUFFER"){r.promiseResolver(n.data);return}break;case"EXPORT_FILE_STATISTICS":if(n.type=="FILE_STATISTICS"){r.promiseResolver(n.data);return}break;case"CONNECT":if(n.type=="CONNECTION_INFO"){r.promiseResolver(n.data);return}break;case"RUN_PREPARED":case"RUN_QUERY":if(n.type=="QUERY_RESULT"){r.promiseResolver(n.data);return}break;case"SEND_PREPARED":if(n.type=="QUERY_RESULT_HEADER"){r.promiseResolver(n.data);return}break;case"START_PENDING_QUERY":if(n.type=="QUERY_RESULT_HEADER_OR_NULL"){r.promiseResolver(n.data);return}break;case"POLL_PENDING_QUERY":if(n.type=="QUERY_RESULT_HEADER_OR_NULL"){r.promiseResolver(n.data);return}break;case"CANCEL_PENDING_QUERY":if(this._onInstantiationProgress=[],n.type=="SUCCESS"){r.promiseResolver(n.data);return}break;case"FETCH_QUERY_RESULTS":if(n.type=="QUERY_RESULT_CHUNK"){r.promiseResolver(n.data);return}break;case"CREATE_PREPARED":if(n.type=="PREPARED_STATEMENT_ID"){r.promiseResolver(n.data);return}break}r.promiseRejecter(new Error("unexpected response type: ".concat(n.type.toString())))}onError(e){console.error(e),console.error("error in duckdb worker: ".concat(e.message)),this._pendingRequests.clear()}onClose(){if(this._workerShutdownResolver(null),this._pendingRequests.size!=0){console.warn("worker terminated with ".concat(this._pendingRequests.size," pending requests"));return}this._pendingRequests.clear()}async reset(){let e=new Kt("RESET",null);return await this.postTask(e)}async ping(){let e=new Kt("PING",null);await this.postTask(e)}async dropFile(e){let t=new Kt("DROP_FILE",e);return await this.postTask(t)}async dropFiles(){let e=new Kt("DROP_FILES",null);return await this.postTask(e)}async flushFiles(){let e=new Kt("FLUSH_FILES",null);return await this.postTask(e)}async instantiate(e,t=null,n=r=>{}){this._onInstantiationProgress.push(n);let r=new Kt("INSTANTIATE",[e,t]);return await this.postTask(r)}async getVersion(){let e=new Kt("GET_VERSION",null);return await this.postTask(e)}async getFeatureFlags(){let e=new Kt("GET_FEATURE_FLAGS",null);return await this.postTask(e)}async open(e){let t=new Kt("OPEN",e);await this.postTask(t)}async tokenize(e){let t=new Kt("TOKENIZE",e);return await this.postTask(t)}async connectInternal(){let e=new Kt("CONNECT",null);return await this.postTask(e)}async connect(){let e=await this.connectInternal();return new jq(this,e)}async disconnect(e){let t=new Kt("DISCONNECT",e);await this.postTask(t)}async runQuery(e,t){let n=new Kt("RUN_QUERY",[e,t]);return await this.postTask(n)}async startPendingQuery(e,t){let n=new Kt("START_PENDING_QUERY",[e,t]);return await this.postTask(n)}async pollPendingQuery(e){let t=new Kt("POLL_PENDING_QUERY",e);return await this.postTask(t)}async cancelPendingQuery(e){let t=new Kt("CANCEL_PENDING_QUERY",e);return await this.postTask(t)}async fetchQueryResults(e){let t=new Kt("FETCH_QUERY_RESULTS",e);return await this.postTask(t)}async getTableNames(e,t){let n=new Kt("GET_TABLE_NAMES",[e,t]);return await this.postTask(n)}async createPrepared(e,t){let n=new Kt("CREATE_PREPARED",[e,t]);return await this.postTask(n)}async closePrepared(e,t){let n=new Kt("CLOSE_PREPARED",[e,t]);await this.postTask(n)}async runPrepared(e,t,n){let r=new Kt("RUN_PREPARED",[e,t,n]);return await this.postTask(r)}async sendPrepared(e,t,n){let r=new Kt("SEND_PREPARED",[e,t,n]);return await this.postTask(r)}async globFiles(e){let t=new Kt("GLOB_FILE_INFOS",e);return await this.postTask(t)}async registerFileText(e,t){let n=Wq.encode(t);await this.registerFileBuffer(e,n)}async registerFileURL(e,t,n,r){t===void 0&&(t=e);let i=new Kt("REGISTER_FILE_URL",[e,t,n,r]);await this.postTask(i)}async registerEmptyFileBuffer(e){let t=new Kt("REGISTER_FILE_BUFFER",[e,new Uint8Array]);await this.postTask(t)}async registerFileBuffer(e,t){let n=new Kt("REGISTER_FILE_BUFFER",[e,t]);await this.postTask(n,[t.buffer])}async registerFileHandle(e,t,n,r){let i=new Kt("REGISTER_FILE_HANDLE",[e,t,n,r]);await this.postTask(i,[])}async collectFileStatistics(e,t){let n=new Kt("COLLECT_FILE_STATISTICS",[e,t]);await this.postTask(n,[])}async exportFileStatistics(e){let t=new Kt("EXPORT_FILE_STATISTICS",e);return await this.postTask(t,[])}async copyFileToBuffer(e){let t=new Kt("COPY_FILE_TO_BUFFER",e);return await this.postTask(t)}async copyFileToPath(e,t){let n=new Kt("COPY_FILE_TO_PATH",[e,t]);await this.postTask(n)}async insertArrowFromIPCStream(e,t,n){if(t.length==0)return;let r=new Kt("INSERT_ARROW_FROM_IPC_STREAM",[e,t,n]);await this.postTask(r,[t.buffer])}async insertCSVFromPath(e,t,n){if(n.columns!==void 0){let i=[];for(let o in n.columns){let s=n.columns[o];i.push(O2(o,s))}n.columnsFlat=i,delete n.columns}let r=new Kt("IMPORT_CSV_FROM_PATH",[e,t,n]);await this.postTask(r)}async insertJSONFromPath(e,t,n){if(n.columns!==void 0){let i=[];for(let o in n.columns){let s=n.columns[o];i.push(O2(o,s))}n.columnsFlat=i,delete n.columns}let r=new Kt("IMPORT_JSON_FROM_PATH",[e,t,n]);await this.postTask(r)}};var Xq=async()=>WebAssembly.validate(new Uint8Array([0,97,115,109,1,0,0,0,1,4,1,96,0,0,3,2,1,0,5,3,1,0,1,10,14,1,12,0,65,0,65,0,65,0,252,10,0,0,11])),Hq=async()=>WebAssembly.validate(new Uint8Array([0,97,115,109,1,0,0,0,1,4,1,96,0,0,3,2,1,0,10,8,1,6,0,6,64,25,11,11])),Zq=async()=>WebAssembly.validate(new Uint8Array([0,97,115,109,1,0,0,0,1,5,1,96,0,1,123,3,2,1,0,10,10,1,8,0,65,0,253,15,253,98,11])),Qq=()=>(async e=>{try{return typeof MessageChannel<"u"&&new MessageChannel().port1.postMessage(new SharedArrayBuffer(1)),WebAssembly.validate(e)}catch{return!1}})(new Uint8Array([0,97,115,109,1,0,0,0,1,4,1,96,0,0,3,2,1,0,5,4,1,3,1,1,10,11,1,9,0,65,0,254,16,2,0,26,11])),D2={name:"@duckdb/duckdb-wasm",version:"1.28.1-dev99.0",description:"DuckDB powered by WebAssembly",license:"MIT",repository:{type:"git",url:"https://github.com/duckdb/duckdb-wasm.git"},keywords:["sql","duckdb","relational","database","data","query","wasm","analytics","olap","arrow","parquet","json","csv"],dependencies:{"apache-arrow":"^14.0.1"},devDependencies:{"@types/emscripten":"^1.39.10","@types/jasmine":"^5.1.4","@typescript-eslint/eslint-plugin":"^6.18.0","@typescript-eslint/parser":"^6.18.0",esbuild:"^0.19.10",eslint:"^8.56.0","eslint-plugin-jasmine":"^4.1.3","eslint-plugin-react":"^7.33.2","fast-glob":"^3.3.2",jasmine:"^5.1.0","jasmine-core":"^5.1.1","jasmine-spec-reporter":"^7.0.0","js-sha256":"^0.10.1",karma:"^6.4.2","karma-chrome-launcher":"^3.2.0","karma-coverage":"^2.2.1","karma-firefox-launcher":"^2.1.2","karma-jasmine":"^5.1.0","karma-jasmine-html-reporter":"^2.1.0","karma-sourcemap-loader":"^0.4.0","karma-spec-reporter":"^0.0.36","make-dir":"^4.0.0",nyc:"^15.1.0",prettier:"^3.2.2",puppeteer:"^21.7.0",rimraf:"^5.0.5",s3rver:"^3.7.1",typedoc:"^0.25.7",typescript:"^5.3.3","wasm-feature-detect":"^1.6.1","web-worker":"^1.2.0"},scripts:{"build:debug":"node bundle.mjs debug && tsc --emitDeclarationOnly","build:release":"node bundle.mjs release && tsc --emitDeclarationOnly",docs:"typedoc",report:"node ./coverage.mjs","test:node":"node --enable-source-maps ../../node_modules/jasmine/bin/jasmine ./dist/tests-node.cjs","test:node:debug":"node --inspect-brk --enable-source-maps ../../node_modules/jasmine/bin/jasmine ./dist/tests-node.cjs","test:node:coverage":"nyc -r json --report-dir ./coverage/node node ../../node_modules/jasmine/bin/jasmine ./dist/tests-node.cjs","test:firefox":"karma start ./karma/tests-firefox.cjs","test:chrome":"karma start ./karma/tests-chrome.cjs","test:chrome:eh":"karma start ./karma/tests-chrome-eh.cjs","test:chrome:coverage":"karma start ./karma/tests-chrome-coverage.cjs","test:browser":"karma start ./karma/tests-all.cjs","test:browser:debug":"karma start ./karma/tests-debug.cjs",test:"npm run test:chrome && npm run test:node","test:coverage":"npm run test:chrome:coverage && npm run test:node:coverage && npm run report",lint:"eslint src test"},files:["dist","!dist/types/test"],main:"dist/duckdb-browser.cjs",module:"dist/duckdb-browser.mjs",types:"dist/duckdb-browser.d.ts",jsdelivr:"dist/duckdb-browser.cjs",unpkg:"dist/duckdb-browser.mjs",sideEffects:!1,browser:{fs:!1,path:!1,perf_hooks:!1,os:!1,worker_threads:!1},exports:{"./dist/duckdb-mvp.wasm":"./dist/duckdb-mvp.wasm","./dist/duckdb-eh.wasm":"./dist/duckdb-eh.wasm","./dist/duckdb-coi.wasm":"./dist/duckdb-coi.wasm","./dist/duckdb-browser":"./dist/duckdb-browser.mjs","./dist/duckdb-browser.cjs":"./dist/duckdb-browser.cjs","./dist/duckdb-browser.mjs":"./dist/duckdb-browser.mjs","./dist/duckdb-browser-blocking":"./dist/duckdb-browser-blocking.mjs","./dist/duckdb-browser-blocking.mjs":"./dist/duckdb-browser-blocking.mjs","./dist/duckdb-browser-blocking.cjs":"./dist/duckdb-browser-blocking.cjs","./dist/duckdb-browser-coi.pthread.worker.js":"./dist/duckdb-browser-coi.pthread.worker.js","./dist/duckdb-browser-coi.worker.js":"./dist/duckdb-browser-coi.worker.js","./dist/duckdb-browser-eh.worker.js":"./dist/duckdb-browser-eh.worker.js","./dist/duckdb-browser-mvp.worker.js":"./dist/duckdb-browser-mvp.worker.js","./dist/duckdb-node":"./dist/duckdb-node.cjs","./dist/duckdb-node.cjs":"./dist/duckdb-node.cjs","./dist/duckdb-node-blocking":"./dist/duckdb-node-blocking.cjs","./dist/duckdb-node-blocking.cjs":"./dist/duckdb-node-blocking.cjs","./dist/duckdb-node-eh.worker.cjs":"./dist/duckdb-node-eh.worker.cjs","./dist/duckdb-node-mvp.worker.cjs":"./dist/duckdb-node-mvp.worker.cjs","./blocking":{browser:{types:"./dist/duckdb-browser-blocking.d.ts",import:"./dist/duckdb-browser-blocking.mjs",require:"./dist/duckdb-browser-blocking.cjs"},node:{types:"./dist/duckdb-node-blocking.d.ts",require:"./dist/duckdb-node-blocking.cjs",import:"./dist/duckdb-node-blocking.cjs"},types:"./dist/duckdb-browser-blocking.d.ts",import:"./dist/duckdb-browser-blocking.mjs",require:"./dist/duckdb-browser-blocking.cjs"},".":{browser:{types:"./dist/duckdb-browser.d.ts",import:"./dist/duckdb-browser.mjs",require:"./dist/duckdb-browser.cjs"},node:{types:"./dist/duckdb-node.d.ts",import:"./dist/duckdb-node.cjs",require:"./dist/duckdb-node.cjs"},types:"./dist/duckdb-browser.d.ts",import:"./dist/duckdb-browser.mjs",require:"./dist/duckdb-browser.cjs"}}},Kq=D2.name,Jq=D2.version,k2=D2.version.split("."),xdt=k2[0],_dt=k2[1],wdt=k2[2],tj=()=>typeof navigator>"u";function xD(){let e="https://cdn.jsdelivr.net/npm/".concat(Kq,"@").concat(Jq,"/dist/");return{mvp:{mainModule:"".concat(e,"duckdb-mvp.wasm"),mainWorker:"".concat(e,"duckdb-browser-mvp.worker.js")},eh:{mainModule:"".concat(e,"duckdb-eh.wasm"),mainWorker:"".concat(e,"duckdb-browser-eh.worker.js")}}}var E2=null,M2=null,A2=null,N2=null,R2=null;async function ej(){return E2==null&&(E2=typeof BigInt64Array<"u"),M2==null&&(M2=await Hq()),A2==null&&(A2=await Qq()),N2==null&&(N2=await Zq()),R2==null&&(R2=await Xq()),{bigInt64Array:E2,crossOriginIsolated:tj()||globalThis.crossOriginIsolated||!1,wasmExceptions:M2,wasmSIMD:N2,wasmThreads:A2,wasmBulkMemory:R2}}async function _D(e){let t=await ej();if(t.wasmExceptions){if(t.wasmSIMD&&t.wasmThreads&&t.crossOriginIsolated&&e.coi)return{mainModule:e.coi.mainModule,mainWorker:e.coi.mainWorker,pthreadWorker:e.coi.pthreadWorker};if(e.eh)return{mainModule:e.eh.mainModule,mainWorker:e.eh.mainWorker,pthreadWorker:null}}return{mainModule:e.mvp.mainModule,mainWorker:e.mvp.mainWorker,pthreadWorker:null}}var vdt=Fq(Lq());function nj(){let e=new TextDecoder;return t=>(typeof SharedArrayBuffer<"u"&&t.buffer instanceof SharedArrayBuffer&&(t=new Uint8Array(t)),e.decode(t))}var Sdt=nj(),rj=(e=>(e[e.BUFFER=0]="BUFFER",e[e.NODE_FS=1]="NODE_FS",e[e.BROWSER_FILEREADER=2]="BROWSER_FILEREADER",e[e.BROWSER_FSACCESS=3]="BROWSER_FSACCESS",e[e.HTTP=4]="HTTP",e[e.S3=5]="S3",e))(rj||{});function wD(e={}){let{duckdb:t,connection:n,...r}=e,i=t,o=n,s;function a(){return s||(s=(i?Promise.resolve(i):oj(r).then(u=>i=u)).then(u=>u.connect()).then(u=>o=u)),s}async function c(){return i||await a(),i}async function l(){return o||await a(),o}return{getDuckDB:c,getConnection:l,query:async u=>{let{type:f,sql:d}=u,p=await(await l()).query(d);return f==="exec"?void 0:f==="arrow"?p:Array.from(p)}}}async function oj({log:e=!1}={}){let t=xD(),n=await _D(t),r=URL.createObjectURL(new Blob([`importScripts("${n.mainWorker}");`],{type:"text/javascript"})),i=new Worker(r),o=e?new yD:new mD,s=new bD(o,i);return await s.instantiate(n.mainModule,n.pthreadWorker),URL.revokeObjectURL(r),s}function F2(){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 G4={};_r(G4,{Fixed:()=>qc,Param:()=>Ta,Query:()=>yt,Selection:()=>xs,agg:()=>$v,align:()=>aA,and:()=>Wn,area:()=>wN,areaX:()=>vN,areaY:()=>SN,argmax:()=>mu,argmin:()=>pu,arrayAgg:()=>u2,arrow:()=>h4,aspectRatio:()=>cA,avg:()=>zv,axis:()=>lA,axisFx:()=>b4,axisFy:()=>x4,axisX:()=>y4,axisY:()=>g4,barX:()=>MN,barY:()=>AN,bin:()=>pw,cast:()=>Ih,castDouble:()=>yu,castInteger:()=>f2,cell:()=>NN,cellX:()=>RN,cellY:()=>ON,centroid:()=>Mh,centroidX:()=>m2,centroidY:()=>y2,circle:()=>PN,colorClamp:()=>O6,colorDomain:()=>N6,colorInterpolate:()=>L6,colorLabel:()=>P6,colorLegend:()=>j4,colorN:()=>D6,colorNice:()=>k6,colorPivot:()=>C6,colorRange:()=>R6,colorReverse:()=>U6,colorScale:()=>A6,colorScheme:()=>F6,colorSymmetric:()=>B6,colorTickFormat:()=>z6,colorZero:()=>$6,column:()=>wa,contour:()=>n4,coordinator:()=>ti,corr:()=>t2,count:()=>Or,covarPop:()=>e2,create:()=>Ia,cume_dist:()=>Dv,dateDay:()=>p2,dateMonth:()=>d2,dateMonthDay:()=>h2,delaunayLink:()=>u4,delaunayMesh:()=>f4,denseLine:()=>e4,dense_rank:()=>Rv,density:()=>t4,densityX:()=>KN,densityY:()=>JN,dot:()=>LN,dotX:()=>CN,dotY:()=>BN,entropy:()=>Qv,eq:()=>ys,facetGrid:()=>E3,facetLabel:()=>M3,facetMargin:()=>w3,facetMarginBottom:()=>S3,facetMarginLeft:()=>I3,facetMarginRight:()=>T3,facetMarginTop:()=>v3,first_value:()=>Cv,frame:()=>m4,from:()=>U9,fxAlign:()=>L3,fxAriaDescription:()=>J3,fxAriaLabel:()=>K3,fxAxis:()=>U3,fxDomain:()=>A3,fxFontVariant:()=>Q3,fxGrid:()=>G3,fxInset:()=>O3,fxInsetLeft:()=>D3,fxInsetRight:()=>k3,fxLabel:()=>X3,fxLabelAnchor:()=>H3,fxLabelOffset:()=>Z3,fxLine:()=>W3,fxNice:()=>R3,fxPadding:()=>C3,fxPaddingInner:()=>B3,fxPaddingOuter:()=>P3,fxRange:()=>N3,fxReverse:()=>t6,fxRound:()=>F3,fxTickFormat:()=>V3,fxTickPadding:()=>j3,fxTickRotate:()=>Y3,fxTickSize:()=>z3,fxTickSpacing:()=>q3,fxTicks:()=>$3,fyAlign:()=>c6,fyAriaDescription:()=>E6,fyAriaLabel:()=>T6,fyAxis:()=>d6,fyDomain:()=>e6,fyFontVariant:()=>I6,fyGrid:()=>x6,fyInset:()=>i6,fyInsetBottom:()=>s6,fyInsetTop:()=>o6,fyLabel:()=>w6,fyLabelAnchor:()=>v6,fyLabelOffset:()=>S6,fyLine:()=>_6,fyNice:()=>r6,fyPadding:()=>l6,fyPaddingInner:()=>u6,fyPaddingOuter:()=>f6,fyRange:()=>n6,fyReverse:()=>M6,fyRound:()=>a6,fyTickFormat:()=>g6,fyTickPadding:()=>y6,fyTickRotate:()=>b6,fyTickSize:()=>p6,fyTickSpacing:()=>m6,fyTicks:()=>h6,geo:()=>I4,geojson:()=>Eh,graticule:()=>E4,grid:()=>fA,gridFx:()=>v4,gridFy:()=>S4,gridX:()=>_4,gridY:()=>w4,gt:()=>Pc,gte:()=>wv,hconcat:()=>D9,height:()=>nA,hexagon:()=>UN,hexbin:()=>o4,hexgrid:()=>s4,highlight:()=>M4,hspace:()=>L9,hull:()=>d4,image:()=>QN,inset:()=>uA,intervalX:()=>k4,intervalXY:()=>L4,intervalY:()=>F4,isBetween:()=>Te,isDistinct:()=>vv,isNotBetween:()=>Sv,isNotDistinct:()=>vh,isNotNull:()=>ms,isNull:()=>Bc,kurtosis:()=>Zv,label:()=>dA,lag:()=>Fv,last:()=>c2,last_value:()=>Bv,lead:()=>Lv,lengthClamp:()=>sN,lengthDomain:()=>iN,lengthNice:()=>aN,lengthRange:()=>oN,lengthScale:()=>rN,lengthZero:()=>cN,line:()=>IN,lineX:()=>TN,lineY:()=>EN,link:()=>p4,literal:()=>Rr,loadCSV:()=>x2,loadExtension:()=>g2,loadJSON:()=>_2,loadObjects:()=>S2,loadParquet:()=>w2,loadSpatial:()=>v2,lt:()=>gs,lte:()=>bs,mad:()=>qv,margin:()=>KM,marginBottom:()=>sA,marginLeft:()=>rA,marginRight:()=>iA,marginTop:()=>oA,margins:()=>QM,max:()=>Kr,median:()=>Vv,menu:()=>E9,min:()=>Jr,mode:()=>Gv,name:()=>HM,nearestX:()=>O4,nearestY:()=>D4,neq:()=>wh,not:()=>_v,nth_value:()=>Pv,ntile:()=>kv,opacityClamp:()=>Y6,opacityDomain:()=>j6,opacityLabel:()=>W6,opacityLegend:()=>V4,opacityNice:()=>G6,opacityRange:()=>V6,opacityReverse:()=>X6,opacityScale:()=>q6,opacityTickFormat:()=>Z6,opacityZero:()=>H6,or:()=>Cc,padding:()=>hA,pan:()=>C4,panX:()=>B4,panY:()=>P4,panZoom:()=>U4,panZoomX:()=>$4,panZoomY:()=>z4,percent_rank:()=>Ov,plot:()=>j9,product:()=>jv,projectionClip:()=>xN,projectionDomain:()=>hN,projectionInset:()=>pN,projectionInsetBottom:()=>bN,projectionInsetLeft:()=>mN,projectionInsetRight:()=>yN,projectionInsetTop:()=>gN,projectionParallels:()=>uN,projectionPrecision:()=>fN,projectionRotate:()=>dN,projectionType:()=>lN,quantile:()=>Yv,rClamp:()=>tN,rDomain:()=>K6,rNice:()=>eN,rRange:()=>J6,rScale:()=>Q6,rZero:()=>nN,rank:()=>Nv,raster:()=>r4,rasterTile:()=>i4,rect:()=>DN,rectX:()=>kN,rectY:()=>FN,regressionY:()=>a4,round:()=>pA,row_number:()=>Av,ruleX:()=>jN,ruleY:()=>VN,search:()=>M9,skewness:()=>Hv,slider:()=>A9,sphere:()=>T4,spike:()=>ZN,sql:()=>j,stddev:()=>Xv,stddevPop:()=>Jv,stringAgg:()=>l2,style:()=>tA,sum:()=>Dr,symbolLegend:()=>Y4,table:()=>N9,text:()=>$N,textX:()=>zN,textY:()=>qN,tickX:()=>YN,tickY:()=>GN,toggle:()=>yd,toggleColor:()=>R4,toggleX:()=>A4,toggleY:()=>N4,varPop:()=>Kv,variance:()=>Wv,vconcat:()=>O9,vector:()=>WN,vectorX:()=>XN,vectorY:()=>HN,voronoi:()=>c4,voronoiMesh:()=>l4,vspace:()=>F9,width:()=>eA,xAlign:()=>IA,xAriaDescription:()=>qA,xAriaLabel:()=>zA,xAxis:()=>AA,xClamp:()=>vA,xDomain:()=>yA,xFontVariant:()=>$A,xGrid:()=>LA,xInset:()=>xA,xInsetLeft:()=>_A,xInsetRight:()=>wA,xLabel:()=>BA,xLabelAnchor:()=>PA,xLabelOffset:()=>UA,xLine:()=>CA,xNice:()=>bA,xPadding:()=>TA,xPaddingInner:()=>EA,xPaddingOuter:()=>MA,xRange:()=>gA,xReverse:()=>jA,xRound:()=>SA,xScale:()=>mA,xTickFormat:()=>kA,xTickPadding:()=>DA,xTickRotate:()=>FA,xTickSize:()=>RA,xTickSpacing:()=>OA,xTicks:()=>NA,xZero:()=>VA,xyDomain:()=>JM,yAlign:()=>t3,yAriaDescription:()=>b3,yAriaLabel:()=>g3,yAxis:()=>i3,yClamp:()=>KA,yDomain:()=>GA,yFontVariant:()=>y3,yGrid:()=>f3,yInset:()=>HA,yInsetBottom:()=>QA,yInsetTop:()=>ZA,yLabel:()=>h3,yLabelAnchor:()=>p3,yLabelOffset:()=>m3,yLine:()=>d3,yNice:()=>XA,yPadding:()=>e3,yPaddingInner:()=>n3,yPaddingOuter:()=>r3,yRange:()=>WA,yReverse:()=>x3,yRound:()=>JA,yScale:()=>YA,yTickFormat:()=>l3,yTickPadding:()=>c3,yTickRotate:()=>u3,yTickSize:()=>s3,yTickSpacing:()=>a3,yTicks:()=>o3,yZero:()=>_3});var qc=Symbol("Fixed"),ni=Symbol("Transient"),Rh=Symbol("Transform");var rw={};_r(rw,{Area:()=>kl,Arrow:()=>qm,BarX:()=>jm,BarY:()=>Vm,Cell:()=>Fl,Contour:()=>Jm,Density:()=>ny,Dot:()=>Ll,Frame:()=>Fm,Geo:()=>ry,Hexgrid:()=>iy,Image:()=>oy,Line:()=>Cl,Link:()=>$m,Mark:()=>wt,Raster:()=>Km,Rect:()=>Pl,RuleX:()=>Nm,RuleY:()=>Rm,Text:()=>Rl,TickX:()=>Xm,TickY:()=>Hm,Tip:()=>Lm,Vector:()=>Dl,area:()=>Um,areaX:()=>sc,areaY:()=>ea,arrow:()=>y7,auto:()=>M7,autoSpec:()=>tM,axisFx:()=>v_,axisFy:()=>w_,axisX:()=>Dm,axisY:()=>Om,barX:()=>$o,barY:()=>zo,bin:()=>ta,binX:()=>Po,binY:()=>Uo,bollinger:()=>uc,bollingerX:()=>k7,bollingerY:()=>F7,boxX:()=>L7,boxY:()=>C7,cell:()=>ac,cellX:()=>b7,cellY:()=>x7,centroid:()=>DP,circle:()=>v7,cluster:()=>OP,column:()=>pn,contour:()=>Y7,crosshair:()=>X7,crosshairX:()=>H7,crosshairY:()=>Z7,delaunayLink:()=>J7,delaunayMesh:()=>tP,density:()=>oP,differenceY:()=>cP,dodgeX:()=>GP,dodgeY:()=>WP,dot:()=>yi,dotX:()=>_7,dotY:()=>w7,filter:()=>N5,find:()=>P5,formatIsoDate:()=>lE,formatMonth:()=>j5,formatWeekday:()=>V5,frame:()=>Pf,geo:()=>G_,geoCentroid:()=>kP,graticule:()=>uP,gridFx:()=>E_,gridFy:()=>I_,gridX:()=>T_,gridY:()=>S_,group:()=>wm,groupX:()=>Ka,groupY:()=>Ja,groupZ:()=>_m,hexagon:()=>S7,hexbin:()=>fP,hexgrid:()=>dP,hull:()=>eP,identity:()=>W,image:()=>pP,indexOf:()=>Me,initializer:()=>Se,interpolateNearest:()=>aM,interpolateNone:()=>Y_,interpolatorBarycentric:()=>sM,interpolatorRandomWalk:()=>cM,legend:()=>PB,line:()=>Bl,lineX:()=>cc,lineY:()=>lc,linearRegressionX:()=>gP,linearRegressionY:()=>bP,link:()=>C_,map:()=>br,mapX:()=>Qf,mapY:()=>Kf,marks:()=>Je,normalize:()=>ew,normalizeX:()=>QP,normalizeY:()=>KP,plot:()=>Bm,pointer:()=>kf,pointerX:()=>Ff,pointerY:()=>El,raster:()=>z7,rect:()=>Gm,rectX:()=>Xf,rectY:()=>Hf,reverse:()=>R5,ruleX:()=>qr,ruleY:()=>jr,scale:()=>Co,select:()=>t9,selectFirst:()=>NM,selectLast:()=>RM,selectMaxX:()=>r9,selectMaxY:()=>i9,selectMinX:()=>e9,selectMinY:()=>n9,shiftX:()=>JP,shuffle:()=>O5,sort:()=>U1,sphere:()=>lP,spike:()=>bB,stackX:()=>QE,stackX1:()=>a7,stackX2:()=>c7,stackY:()=>KE,stackY1:()=>l7,stackY2:()=>u7,text:()=>Bo,textX:()=>p_,textY:()=>m_,tickX:()=>q_,tickY:()=>j_,tip:()=>N_,transform:()=>mn,tree:()=>SM,treeLink:()=>Q_,treeNode:()=>sy,valueof:()=>mt,vector:()=>$E,vectorX:()=>b_,vectorY:()=>x_,voronoi:()=>nP,voronoiMesh:()=>rP,window:()=>Jf,windowX:()=>A7,windowY:()=>N7});function Gt(e,t){return e==null||t==null?NaN:e<t?-1:e>t?1:e>=t?0:NaN}function Xn(e,t){return e==null||t==null?NaN:t<e?-1:t>e?1:t>=e?0:NaN}function _s(e){let t,n,r;e.length!==2?(t=Gt,n=(a,c)=>Gt(e(a),c),r=(a,c)=>e(a)-c):(t=e===Gt||e===Xn?e:sj,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 sj(){return 0}function Oh(e){return e===null?NaN:+e}function*vD(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 SD=_s(Gt),ID=SD.right,aj=SD.left,cj=_s(Oh).center,ws=ID;var Dh=TD(ED),L2=TD(lj);function TD(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?(gu(a,l,i,o,s),gu(a,i,l,o,s),gu(a,l,i,o,s),bu(c,i,l,o,s),bu(c,l,i,o,s),bu(c,i,l,o,s)):a?(gu(a,i,l,o,s),gu(a,l,i,o,s),gu(a,i,l,o,s)):c&&(bu(c,i,l,o,s),bu(c,l,i,o,s),bu(c,i,l,o,s)),t}}function gu(e,t,n,r,i){for(let o=0,s=r*i;o<s;)e(t,n,o,o+=r,1)}function bu(e,t,n,r,i){for(let o=0,s=r*i;o<r;++o)e(t,n,o,o+s,r)}function lj(e){let t=ED(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 ED(e){let t=Math.floor(e);if(t===e)return uj(e);let n=e-t,r=2*e+1;return(i,o,s,a,c)=>{if(!((a-=c)>=s))return;let l=t*o[s],u=c*t,f=u+c;for(let d=s,h=s+u;d<h;d+=c)l+=o[Math.min(a,d)];for(let d=s,h=a;d<=h;d+=c)l+=o[Math.min(a,d+u)],i[d]=(l+n*(o[Math.max(s,d-f)]+o[Math.min(a,d+f)]))/r,l-=o[Math.max(s,d-u)]}}function uj(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 fj(e){return e.length|0}function dj(e){return!(e>0)}function hj(e){return typeof e!="object"||"length"in e?e:Array.from(e)}function pj(e){return t=>e(...t)}function _0(...e){let t=typeof e[e.length-1]=="function"&&pj(e.pop());e=e.map(hj);let n=e.map(fj),r=e.length-1,i=new Array(r+1).fill(0),o=[];if(r<0||n.some(dj))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 w0(e,t){var n=0,r=0;return Float64Array.from(e,t===void 0?i=>n+=+i||0:i=>n+=+t(i,r++,e)||0)}function Ea(e,t){let n=0,r,i=0,o=0;if(t===void 0)for(let s of e)s!=null&&(s=+s)>=s&&(r=s-i,i+=r/++n,o+=r*(s-i));else{let s=-1;for(let a of e)(a=t(a,++s,e))!=null&&(a=+a)>=a&&(r=a-i,i+=r/++n,o+=r*(a-i))}if(n>1)return o/(n-1)}function ri(e,t){let n=Ea(e,t);return n&&Math.sqrt(n)}function ae(e,t){let n,r;if(t===void 0)for(let i of e)i!=null&&(n===void 0?i>=i&&(n=r=i):(n>i&&(n=i),r<i&&(r=i)));else{let i=-1;for(let o of e)(o=t(o,++i,e))!=null&&(n===void 0?o>=o&&(n=r=o):(n>o&&(n=o),r<o&&(r=o)))}return[n,r]}var In=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 Hn=class extends Map{constructor(t,n=ND){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(C2(this,t))}has(t){return super.has(C2(this,t))}set(t,n){return super.set(MD(this,t),n)}delete(t){return super.delete(AD(this,t))}},kr=class extends Set{constructor(t,n=ND){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(C2(this,t))}add(t){return super.add(MD(this,t))}delete(t){return super.delete(AD(this,t))}};function C2({_intern:e,_key:t},n){let r=t(n);return e.has(r)?e.get(r):n}function MD({_intern:e,_key:t},n){let r=t(n);return e.has(r)?e.get(r):(e.set(r,n),n)}function AD({_intern:e,_key:t},n){let r=t(n);return e.has(r)&&(n=e.get(r),e.delete(r)),n}function ND(e){return e!==null&&typeof e=="object"?e.valueOf():e}function kh(e){return e}function sn(e,...t){return P2(e,kh,kh,t)}function Ci(e,t,...n){return P2(e,kh,t,n)}function B2(e,t,...n){return P2(e,Array.from,t,n)}function P2(e,t,n,r){return function i(o,s){if(s>=r.length)return n(o);let a=new Hn,c=r[s++],l=-1;for(let u of o){let f=c(u,++l,o),d=a.get(f);d?d.push(u):a.set(f,[u])}for(let[u,f]of a)a.set(u,i(f,s));return t(a)}(e,0)}function U2(e,t){return Array.from(t,n=>e[n])}function lo(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=jc(s[i],s[o]);if(a)return a}})):(n=e.map(n),r.sort((i,o)=>jc(n[i],n[o]))),U2(e,r)}return e.sort(Fh(n))}function Fh(e=Gt){if(e===Gt)return jc;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 jc(e,t){return(e==null||!(e>=e))-(t==null||!(t>=t))||(e<t?-1:e>t?1:0)}function xu(e,t,n){return(t.length!==2?lo(Ci(e,t,n),([r,i],[o,s])=>Gt(i,s)||Gt(r,o)):lo(sn(e,n),([r,i],[o,s])=>t(i,s)||Gt(r,o))).map(([r])=>r)}var mj=Math.sqrt(50),yj=Math.sqrt(10),gj=Math.sqrt(2);function v0(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>=mj?10:o>=yj?5:o>=gj?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?v0(e,t,n*2):[a,c,l]}function Tn(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?v0(t,e,n):v0(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 vs(e,t,n){return t=+t,e=+e,n=+n,v0(e,t,n)[2]}function _u(e,t,n){t=+t,e=+e,n=+n;let r=t<e,i=r?vs(t,e,n):vs(e,t,n);return(r?-1:1)*(i<0?1/-i:i)}function wu(e,t,n){let r;for(;;){let i=vs(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 Ma(e){return Math.max(1,Math.ceil(Math.log(co(e))/Math.LN2)+1)}function $t(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 S0(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 I0(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 T0(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?jc:Fh(i);r>n;){if(r-n>600){let c=r-n+1,l=t-n+1,u=Math.log(c),f=.5*Math.exp(2*u/3),d=.5*Math.sqrt(u*f*(c-f)/c)*(l-c/2<0?-1:1),h=Math.max(n,Math.floor(t-l*f/c+d)),p=Math.min(r,Math.floor(t+(c-l)*f/c+d));T0(e,t,h,p,i)}let o=e[t],s=n,a=r;for(Lh(e,n,t),i(e[r],o)>0&&Lh(e,n,r);s<a;){for(Lh(e,s,a),++s,--a;i(e[s],o)<0;)++s;for(;i(e[a],o)>0;)--a}i(e[n],o)===0?Lh(e,n,a):(++a,Lh(e,a,r)),a<=t&&(n=a+1),t<=a&&(r=a-1)}return e}function Lh(e,t,n){let r=e[t];e[t]=e[n],e[n]=r}function Vc(e,t=Gt){let n,r=!1;if(t.length===1){let i;for(let o of e){let s=t(o);(r?Gt(s,i)>0:Gt(s,s)===0)&&(n=o,i=s,r=!0)}}else for(let i of e)(r?t(i,n)>0:t(i,i)===0)&&(n=i,r=!0);return n}function Zn(e,t,n){if(e=Float64Array.from(vD(e,n)),!(!(r=e.length)||isNaN(t=+t))){if(t<=0||r<2)return ce(e);if(t>=1)return $t(e);var r,i=(r-1)*t,o=Math.floor(i),s=$t(T0(e,o).subarray(0,o+1)),a=ce(e.subarray(o+1));return s+(a-s)*(i-o)}}function $2(e,t,n=Oh){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 E0(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 Ch(e,t,n){let r=co(e),i=ri(e);return r&&i?Math.ceil((n-t)*Math.cbrt(r)/(3.49*i)):1}function Ss(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 Bi(e,t){return Zn(e,.5,t)}function*xj(e){for(let t of e)yield*t}function vu(e){return Array.from(xj(e))}function Su(e,t){let n=new Hn;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 M0(e,t=_j){let n=[],r,i=!1;for(let o of e)i&&n.push(t(r,o)),r=o,i=!0;return n}function _j(e,t){return[e,t]}function Ue(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 Bh(e,t=Gt){if(typeof e[Symbol.iterator]!="function")throw new TypeError("values is not iterable");let n=Array.from(e),r=new Float64Array(n.length);t.length!==2&&(n=n.map(t),t=Gt);let i=(a,c)=>t(n[a],n[c]),o,s;return e=Uint32Array.from(n,(a,c)=>c),e.sort(t===Gt?(a,c)=>jc(n[a],n[c]):Fh(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 A0(e,t=Gt){let n,r=!1;if(t.length===1){let i;for(let o of e){let s=t(o);(r?Gt(s,i)<0:Gt(s,s)===0)&&(n=o,i=s,r=!0)}}else for(let i of e)(r?t(i,n)<0:t(i,i)===0)&&(n=i,r=!0);return n}function En(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 Aa(e){if(typeof e[Symbol.iterator]!="function")throw new TypeError("values is not iterable");return Array.from(e).reverse()}function RD(e){return e}var z2=1,q2=2,j2=3,N0=4,OD=1e-6;function wj(e){return"translate("+e+",0)"}function vj(e){return"translate(0,"+e+")"}function Sj(e){return t=>+e(t)}function Ij(e,t){return t=Math.max(0,e.bandwidth()-t*2)/2,e.round()&&(t=Math.round(t)),n=>+e(n)+t}function Tj(){return!this.__axis}function Ej(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===z2||e===N0?-1:1,u=e===N0||e===q2?"x":"y",f=e===z2||e===j2?wj:vj;function d(h){var p=r??(t.ticks?t.ticks.apply(t,n):t.domain()),y=i??(t.tickFormat?t.tickFormat.apply(t,n):RD),b=Math.max(o,0)+a,m=t.range(),g=+m[0]+c,x=+m[m.length-1]+c,_=(t.bandwidth?Ij:Sj)(t.copy(),c),v=h.selection?h.selection():h,w=v.selectAll(".domain").data([null]),T=v.selectAll(".tick").data(p,t).order(),A=T.exit(),R=T.enter().append("g").attr("class","tick"),I=T.select("line"),E=T.select("text");w=w.merge(w.enter().insert("path",".tick").attr("class","domain").attr("stroke","currentColor")),T=T.merge(R),I=I.merge(R.append("line").attr("stroke","currentColor").attr(u+"2",l*o)),E=E.merge(R.append("text").attr("fill","currentColor").attr(u,l*b).attr("dy",e===z2?"0em":e===j2?"0.71em":"0.32em")),h!==v&&(w=w.transition(h),T=T.transition(h),I=I.transition(h),E=E.transition(h),A=A.transition(h).attr("opacity",OD).attr("transform",function(O){return isFinite(O=_(O))?f(O+c):this.getAttribute("transform")}),R.attr("opacity",OD).attr("transform",function(O){var k=this.parentNode.__axis;return f((k&&isFinite(k=k(O))?k:_(O))+c)})),A.remove(),w.attr("d",e===N0||e===q2?s?"M"+l*s+","+g+"H"+c+"V"+x+"H"+l*s:"M"+c+","+g+"V"+x:s?"M"+g+","+l*s+"V"+c+"H"+x+"V"+l*s:"M"+g+","+c+"H"+x),T.attr("opacity",1).attr("transform",function(O){return f(_(O)+c)}),I.attr(u+"2",l*o),E.attr(u,l*b).text(y),v.filter(Tj).attr("fill","none").attr("font-size",10).attr("font-family","sans-serif").attr("text-anchor",e===q2?"start":e===N0?"end":"middle"),v.each(function(){this.__axis=_})}return d.scale=function(h){return arguments.length?(t=h,d):t},d.ticks=function(){return n=Array.from(arguments),d},d.tickArguments=function(h){return arguments.length?(n=h==null?[]:Array.from(h),d):n.slice()},d.tickValues=function(h){return arguments.length?(r=h==null?null:Array.from(h),d):r&&r.slice()},d.tickFormat=function(h){return arguments.length?(i=h,d):i},d.tickSize=function(h){return arguments.length?(o=s=+h,d):o},d.tickSizeInner=function(h){return arguments.length?(o=+h,d):o},d.tickSizeOuter=function(h){return arguments.length?(s=+h,d):s},d.tickPadding=function(h){return arguments.length?(a=+h,d):a},d.offset=function(h){return arguments.length?(c=+h,d):c},d}function V2(e){return Ej(j2,e)}var Mj={value:()=>{}};function kD(){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 R0(n)}function R0(e){this._=e}function Aj(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}})}R0.prototype=kD.prototype={constructor:R0,on:function(e,t){var n=this._,r=Aj(e+"",n),i,o=-1,s=r.length;if(arguments.length<2){for(;++o<s;)if((i=(e=r[o]).type)&&(i=Nj(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]=DD(n[i],e.name,t);else if(t==null)for(i in n)n[i]=DD(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 R0(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 Nj(e,t){for(var n=0,r=e.length,i;n<r;++n)if((i=e[n]).name===t)return i.value}function DD(e,t,n){for(var r=0,i=e.length;r<i;++r)if(e[r].name===t){e[r]=Mj,e=e.slice(0,r).concat(e.slice(r+1));break}return n!=null&&e.push({name:t,value:n}),e}var Yc=kD;var O0="http://www.w3.org/1999/xhtml",ii={svg:"http://www.w3.org/2000/svg",xhtml:O0,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};function Is(e){var t=e+="",n=t.indexOf(":");return n>=0&&(t=e.slice(0,n))!=="xmlns"&&(e=e.slice(n+1)),ii.hasOwnProperty(t)?{space:ii[t],local:e}:e}function Rj(e){return function(){var t=this.ownerDocument,n=this.namespaceURI;return n===O0&&t.documentElement.namespaceURI===O0?t.createElement(e):t.createElementNS(n,e)}}function Oj(e){return function(){return this.ownerDocument.createElementNS(e.space,e.local)}}function Ts(e){var t=Is(e);return(t.local?Oj:Rj)(t)}function Dj(){}function Gc(e){return e==null?Dj:function(){return this.querySelector(e)}}function FD(e){typeof e!="function"&&(e=Gc(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 Le(r,this._parents)}function Y2(e){return e==null?[]:Array.isArray(e)?e:Array.from(e)}function kj(){return[]}function Ph(e){return e==null?kj:function(){return this.querySelectorAll(e)}}function Fj(e){return function(){return Y2(e.apply(this,arguments))}}function LD(e){typeof e=="function"?e=Fj(e):e=Ph(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 Le(r,i)}function Uh(e){return function(){return this.matches(e)}}function D0(e){return function(t){return t.matches(e)}}var Lj=Array.prototype.find;function Cj(e){return function(){return Lj.call(this.children,e)}}function Bj(){return this.firstElementChild}function CD(e){return this.select(e==null?Bj:Cj(typeof e=="function"?e:D0(e)))}var Pj=Array.prototype.filter;function Uj(){return Array.from(this.children)}function $j(e){return function(){return Pj.call(this.children,e)}}function BD(e){return this.selectAll(e==null?Uj:$j(typeof e=="function"?e:D0(e)))}function PD(e){typeof e!="function"&&(e=Uh(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 Le(r,this._parents)}function k0(e){return new Array(e.length)}function UD(){return new Le(this._enter||this._groups.map(k0),this._parents)}function $h(e,t){this.ownerDocument=e.ownerDocument,this.namespaceURI=e.namespaceURI,this._next=null,this._parent=e,this.__data__=t}$h.prototype={constructor:$h,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 $D(e){return function(){return e}}function zj(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 $h(e,o[s]);for(;s<c;++s)(a=t[s])&&(i[s]=a)}function qj(e,t,n,r,i,o,s){var a,c,l=new Map,u=t.length,f=o.length,d=new Array(u),h;for(a=0;a<u;++a)(c=t[a])&&(d[a]=h=s.call(c,c.__data__,a,t)+"",l.has(h)?i[a]=c:l.set(h,c));for(a=0;a<f;++a)h=s.call(e,o[a],a,o)+"",(c=l.get(h))?(r[a]=c,c.__data__=o[a],l.delete(h)):n[a]=new $h(e,o[a]);for(a=0;a<u;++a)(c=t[a])&&l.get(d[a])===c&&(i[a]=c)}function jj(e){return e.__data__}function zD(e,t){if(!arguments.length)return Array.from(this,jj);var n=t?qj:zj,r=this._parents,i=this._groups;typeof e!="function"&&(e=$D(e));for(var o=i.length,s=new Array(o),a=new Array(o),c=new Array(o),l=0;l<o;++l){var u=r[l],f=i[l],d=f.length,h=Vj(e.call(u,u&&u.__data__,l,r)),p=h.length,y=a[l]=new Array(p),b=s[l]=new Array(p),m=c[l]=new Array(d);n(u,f,y,b,m,h,t);for(var g=0,x=0,_,v;g<p;++g)if(_=y[g]){for(g>=x&&(x=g+1);!(v=b[x])&&++x<p;);_._next=v||null}}return s=new Le(s,r),s._enter=a,s._exit=c,s}function Vj(e){return typeof e=="object"&&"length"in e?e:Array.from(e)}function qD(){return new Le(this._exit||this._groups.map(k0),this._parents)}function jD(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 VD(e){for(var t=e.selection?e.selection():e,n=this._groups,r=t._groups,i=n.length,o=r.length,s=Math.min(i,o),a=new Array(i),c=0;c<s;++c)for(var l=n[c],u=r[c],f=l.length,d=a[c]=new Array(f),h,p=0;p<f;++p)(h=l[p]||u[p])&&(d[p]=h);for(;c<i;++c)a[c]=n[c];return new Le(a,this._parents)}function YD(){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 GD(e){e||(e=Yj);function t(f,d){return f&&d?e(f.__data__,d.__data__):!f-!d}for(var n=this._groups,r=n.length,i=new Array(r),o=0;o<r;++o){for(var s=n[o],a=s.length,c=i[o]=new Array(a),l,u=0;u<a;++u)(l=s[u])&&(c[u]=l);c.sort(t)}return new Le(i,this._parents).order()}function Yj(e,t){return e<t?-1:e>t?1:e>=t?0:NaN}function WD(){var e=arguments[0];return arguments[0]=this,e.apply(null,arguments),this}function XD(){return Array.from(this)}function HD(){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 ZD(){let e=0;for(let t of this)++e;return e}function QD(){return!this.node()}function KD(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 Gj(e){return function(){this.removeAttribute(e)}}function Wj(e){return function(){this.removeAttributeNS(e.space,e.local)}}function Xj(e,t){return function(){this.setAttribute(e,t)}}function Hj(e,t){return function(){this.setAttributeNS(e.space,e.local,t)}}function Zj(e,t){return function(){var n=t.apply(this,arguments);n==null?this.removeAttribute(e):this.setAttribute(e,n)}}function Qj(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 JD(e,t){var n=Is(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?Wj:Gj:typeof t=="function"?n.local?Qj:Zj:n.local?Hj:Xj)(n,t))}function F0(e){return e.ownerDocument&&e.ownerDocument.defaultView||e.document&&e||e.defaultView}function Kj(e){return function(){this.style.removeProperty(e)}}function Jj(e,t,n){return function(){this.style.setProperty(e,t,n)}}function tV(e,t,n){return function(){var r=t.apply(this,arguments);r==null?this.style.removeProperty(e):this.style.setProperty(e,r,n)}}function t8(e,t,n){return arguments.length>1?this.each((t==null?Kj:typeof t=="function"?tV:Jj)(e,t,n??"")):Na(this.node(),e)}function Na(e,t){return e.style.getPropertyValue(t)||F0(e).getComputedStyle(e,null).getPropertyValue(t)}function eV(e){return function(){delete this[e]}}function nV(e,t){return function(){this[e]=t}}function rV(e,t){return function(){var n=t.apply(this,arguments);n==null?delete this[e]:this[e]=n}}function e8(e,t){return arguments.length>1?this.each((t==null?eV:typeof t=="function"?rV:nV)(e,t)):this.node()[e]}function n8(e){return e.trim().split(/^|\s+/)}function G2(e){return e.classList||new r8(e)}function r8(e){this._node=e,this._names=n8(e.getAttribute("class")||"")}r8.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 i8(e,t){for(var n=G2(e),r=-1,i=t.length;++r<i;)n.add(t[r])}function o8(e,t){for(var n=G2(e),r=-1,i=t.length;++r<i;)n.remove(t[r])}function iV(e){return function(){i8(this,e)}}function oV(e){return function(){o8(this,e)}}function sV(e,t){return function(){(t.apply(this,arguments)?i8:o8)(this,e)}}function s8(e,t){var n=n8(e+"");if(arguments.length<2){for(var r=G2(this.node()),i=-1,o=n.length;++i<o;)if(!r.contains(n[i]))return!1;return!0}return this.each((typeof t=="function"?sV:t?iV:oV)(n,t))}function aV(){this.textContent=""}function cV(e){return function(){this.textContent=e}}function lV(e){return function(){var t=e.apply(this,arguments);this.textContent=t??""}}function a8(e){return arguments.length?this.each(e==null?aV:(typeof e=="function"?lV:cV)(e)):this.node().textContent}function uV(){this.innerHTML=""}function fV(e){return function(){this.innerHTML=e}}function dV(e){return function(){var t=e.apply(this,arguments);this.innerHTML=t??""}}function c8(e){return arguments.length?this.each(e==null?uV:(typeof e=="function"?dV:fV)(e)):this.node().innerHTML}function hV(){this.nextSibling&&this.parentNode.appendChild(this)}function l8(){return this.each(hV)}function pV(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function u8(){return this.each(pV)}function f8(e){var t=typeof e=="function"?e:Ts(e);return this.select(function(){return this.appendChild(t.apply(this,arguments))})}function mV(){return null}function d8(e,t){var n=typeof e=="function"?e:Ts(e),r=t==null?mV:typeof t=="function"?t:Gc(t);return this.select(function(){return this.insertBefore(n.apply(this,arguments),r.apply(this,arguments)||null)})}function yV(){var e=this.parentNode;e&&e.removeChild(this)}function h8(){return this.each(yV)}function gV(){var e=this.cloneNode(!1),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function bV(){var e=this.cloneNode(!0),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function p8(e){return this.select(e?bV:gV)}function m8(e){return arguments.length?this.property("__data__",e):this.node().__data__}function xV(e){return function(t){e.call(this,t,this.__data__)}}function _V(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 wV(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 vV(e,t,n){return function(){var r=this.__on,i,o=xV(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 y8(e,t,n){var r=_V(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?vV:wV,i=0;i<o;++i)this.each(a(r[i],t,n));return this}function g8(e,t,n){var r=F0(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 SV(e,t){return function(){return g8(this,e,t)}}function IV(e,t){return function(){return g8(this,e,t.apply(this,arguments))}}function b8(e,t){return this.each((typeof t=="function"?IV:SV)(e,t))}function*x8(){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 W2=[null];function Le(e,t){this._groups=e,this._parents=t}function _8(){return new Le([[document.documentElement]],W2)}function TV(){return this}Le.prototype=_8.prototype={constructor:Le,select:FD,selectAll:LD,selectChild:CD,selectChildren:BD,filter:PD,data:zD,enter:UD,exit:qD,join:jD,merge:VD,selection:TV,order:YD,sort:GD,call:WD,nodes:XD,node:HD,size:ZD,empty:QD,each:KD,attr:JD,style:t8,property:e8,classed:s8,text:a8,html:c8,raise:l8,lower:u8,append:f8,insert:d8,remove:h8,clone:p8,datum:m8,on:y8,dispatch:b8,[Symbol.iterator]:x8};var Es=_8;function zt(e){return typeof e=="string"?new Le([[document.querySelector(e)]],[document.documentElement]):new Le([[e]],W2)}function w8(e){let t;for(;t=e.sourceEvent;)e=t;return e}function Fn(e,t){if(e=w8(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 L0={capture:!0,passive:!1};function C0(e){e.preventDefault(),e.stopImmediatePropagation()}function zh(e){var t=e.document.documentElement,n=zt(e).on("dragstart.drag",C0,L0);"onselectstart"in t?n.on("selectstart.drag",C0,L0):(t.__noselect=t.style.MozUserSelect,t.style.MozUserSelect="none")}function qh(e,t){var n=e.document.documentElement,r=zt(e).on("dragstart.drag",null);t&&(r.on("click.drag",C0,L0),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 Ms(e,t,n){e.prototype=t.prototype=n,n.constructor=e}function Ra(e,t){var n=Object.create(e.prototype);for(var r in t)n[r]=t[r];return n}function fo(){}var Oa=.7,Hc=1/Oa,Iu="\\s*([+-]?\\d+)\\s*",jh="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",uo="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",EV=/^#([0-9a-f]{3,8})$/,MV=new RegExp(`^rgb\\(${Iu},${Iu},${Iu}\\)$`),AV=new RegExp(`^rgb\\(${uo},${uo},${uo}\\)$`),NV=new RegExp(`^rgba\\(${Iu},${Iu},${Iu},${jh}\\)$`),RV=new RegExp(`^rgba\\(${uo},${uo},${uo},${jh}\\)$`),OV=new RegExp(`^hsl\\(${jh},${uo},${uo}\\)$`),DV=new RegExp(`^hsla\\(${jh},${uo},${uo},${jh}\\)$`),v8={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};Ms(fo,Fr,{copy(e){return Object.assign(new this.constructor,this,e)},displayable(){return this.rgb().displayable()},hex:S8,formatHex:S8,formatHex8:kV,formatHsl:FV,formatRgb:I8,toString:I8});function S8(){return this.rgb().formatHex()}function kV(){return this.rgb().formatHex8()}function FV(){return R8(this).formatHsl()}function I8(){return this.rgb().formatRgb()}function Fr(e){var t,n;return e=(e+"").trim().toLowerCase(),(t=EV.exec(e))?(n=t[1].length,t=parseInt(t[1],16),n===6?T8(t):n===3?new Ye(t>>8&15|t>>4&240,t>>4&15|t&240,(t&15)<<4|t&15,1):n===8?B0(t>>24&255,t>>16&255,t>>8&255,(t&255)/255):n===4?B0(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=MV.exec(e))?new Ye(t[1],t[2],t[3],1):(t=AV.exec(e))?new Ye(t[1]*255/100,t[2]*255/100,t[3]*255/100,1):(t=NV.exec(e))?B0(t[1],t[2],t[3],t[4]):(t=RV.exec(e))?B0(t[1]*255/100,t[2]*255/100,t[3]*255/100,t[4]):(t=OV.exec(e))?A8(t[1],t[2]/100,t[3]/100,1):(t=DV.exec(e))?A8(t[1],t[2]/100,t[3]/100,t[4]):v8.hasOwnProperty(e)?T8(v8[e]):e==="transparent"?new Ye(NaN,NaN,NaN,0):null}function T8(e){return new Ye(e>>16&255,e>>8&255,e&255,1)}function B0(e,t,n,r){return r<=0&&(e=t=n=NaN),new Ye(e,t,n,r)}function Vh(e){return e instanceof fo||(e=Fr(e)),e?(e=e.rgb(),new Ye(e.r,e.g,e.b,e.opacity)):new Ye}function an(e,t,n,r){return arguments.length===1?Vh(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}Ms(Ye,an,Ra(fo,{brighter(e){return e=e==null?Hc:Math.pow(Hc,e),new Ye(this.r*e,this.g*e,this.b*e,this.opacity)},darker(e){return e=e==null?Oa:Math.pow(Oa,e),new Ye(this.r*e,this.g*e,this.b*e,this.opacity)},rgb(){return this},clamp(){return new Ye(Xc(this.r),Xc(this.g),Xc(this.b),U0(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:E8,formatHex:E8,formatHex8:LV,formatRgb:M8,toString:M8}));function E8(){return`#${Wc(this.r)}${Wc(this.g)}${Wc(this.b)}`}function LV(){return`#${Wc(this.r)}${Wc(this.g)}${Wc(this.b)}${Wc((isNaN(this.opacity)?1:this.opacity)*255)}`}function M8(){let e=U0(this.opacity);return`${e===1?"rgb(":"rgba("}${Xc(this.r)}, ${Xc(this.g)}, ${Xc(this.b)}${e===1?")":`, ${e})`}`}function U0(e){return isNaN(e)?1:Math.max(0,Math.min(1,e))}function Xc(e){return Math.max(0,Math.min(255,Math.round(e)||0))}function Wc(e){return e=Xc(e),(e<16?"0":"")+e.toString(16)}function A8(e,t,n,r){return r<=0?e=t=n=NaN:n<=0||n>=1?e=t=NaN:t<=0&&(e=NaN),new Pi(e,t,n,r)}function R8(e){if(e instanceof Pi)return new Pi(e.h,e.s,e.l,e.opacity);if(e instanceof fo||(e=Fr(e)),!e)return new Pi;if(e instanceof Pi)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 Pi(s,a,c,e.opacity)}function Yh(e,t,n,r){return arguments.length===1?R8(e):new Pi(e,t,n,r??1)}function Pi(e,t,n,r){this.h=+e,this.s=+t,this.l=+n,this.opacity=+r}Ms(Pi,Yh,Ra(fo,{brighter(e){return e=e==null?Hc:Math.pow(Hc,e),new Pi(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=e==null?Oa:Math.pow(Oa,e),new Pi(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(X2(e>=240?e-240:e+120,i,r),X2(e,i,r),X2(e<120?e+240:e-120,i,r),this.opacity)},clamp(){return new Pi(N8(this.h),P0(this.s),P0(this.l),U0(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=U0(this.opacity);return`${e===1?"hsl(":"hsla("}${N8(this.h)}, ${P0(this.s)*100}%, ${P0(this.l)*100}%${e===1?")":`, ${e})`}`}}));function N8(e){return e=(e||0)%360,e<0?e+360:e}function P0(e){return Math.max(0,Math.min(1,e||0))}function X2(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 $0=Math.PI/180,z0=180/Math.PI;var q0=18,O8=.96422,D8=1,k8=.82521,F8=4/29,Tu=6/29,L8=3*Tu*Tu,CV=Tu*Tu*Tu;function C8(e){if(e instanceof ho)return new ho(e.l,e.a,e.b,e.opacity);if(e instanceof As)return B8(e);e instanceof Ye||(e=Vh(e));var t=K2(e.r),n=K2(e.g),r=K2(e.b),i=H2((.2225045*t+.7168786*n+.0606169*r)/D8),o,s;return t===n&&n===r?o=s=i:(o=H2((.4360747*t+.3850649*n+.1430804*r)/O8),s=H2((.0139322*t+.0971045*n+.7141733*r)/k8)),new ho(116*i-16,500*(o-i),200*(i-s),e.opacity)}function Eu(e,t,n,r){return arguments.length===1?C8(e):new ho(e,t,n,r??1)}function ho(e,t,n,r){this.l=+e,this.a=+t,this.b=+n,this.opacity=+r}Ms(ho,Eu,Ra(fo,{brighter(e){return new ho(this.l+q0*(e??1),this.a,this.b,this.opacity)},darker(e){return new ho(this.l-q0*(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=O8*Z2(t),e=D8*Z2(e),n=k8*Z2(n),new Ye(Q2(3.1338561*t-1.6168667*e-.4906146*n),Q2(-.9787684*t+1.9161415*e+.033454*n),Q2(.0719453*t-.2289914*e+1.4052427*n),this.opacity)}}));function H2(e){return e>CV?Math.pow(e,1/3):e/L8+F8}function Z2(e){return e>Tu?e*e*e:L8*(e-F8)}function Q2(e){return 255*(e<=.0031308?12.92*e:1.055*Math.pow(e,1/2.4)-.055)}function K2(e){return(e/=255)<=.04045?e/12.92:Math.pow((e+.055)/1.055,2.4)}function BV(e){if(e instanceof As)return new As(e.h,e.c,e.l,e.opacity);if(e instanceof ho||(e=C8(e)),e.a===0&&e.b===0)return new As(NaN,0<e.l&&e.l<100?0:NaN,e.l,e.opacity);var t=Math.atan2(e.b,e.a)*z0;return new As(t<0?t+360:t,Math.sqrt(e.a*e.a+e.b*e.b),e.l,e.opacity)}function Gh(e,t,n,r){return arguments.length===1?BV(e):new As(e,t,n,r??1)}function As(e,t,n,r){this.h=+e,this.c=+t,this.l=+n,this.opacity=+r}function B8(e){if(isNaN(e.h))return new ho(e.l,0,0,e.opacity);var t=e.h*$0;return new ho(e.l,Math.cos(t)*e.c,Math.sin(t)*e.c,e.opacity)}Ms(As,Gh,Ra(fo,{brighter(e){return new As(this.h,this.c,this.l+q0*(e??1),this.opacity)},darker(e){return new As(this.h,this.c,this.l-q0*(e??1),this.opacity)},rgb(){return B8(this).rgb()}}));var z8=-.14861,J2=1.78277,tS=-.29227,j0=-.90649,Wh=1.97294,P8=Wh*j0,U8=Wh*J2,$8=J2*tS-j0*z8;function PV(e){if(e instanceof Zc)return new Zc(e.h,e.s,e.l,e.opacity);e instanceof Ye||(e=Vh(e));var t=e.r/255,n=e.g/255,r=e.b/255,i=($8*r+P8*t-U8*n)/($8+P8-U8),o=r-i,s=(Wh*(n-i)-tS*o)/j0,a=Math.sqrt(s*s+o*o)/(Wh*i*(1-i)),c=a?Math.atan2(s,o)*z0-120:NaN;return new Zc(c<0?c+360:c,a,i,e.opacity)}function Qn(e,t,n,r){return arguments.length===1?PV(e):new Zc(e,t,n,r??1)}function Zc(e,t,n,r){this.h=+e,this.s=+t,this.l=+n,this.opacity=+r}Ms(Zc,Qn,Ra(fo,{brighter(e){return e=e==null?Hc:Math.pow(Hc,e),new Zc(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=e==null?Oa:Math.pow(Oa,e),new Zc(this.h,this.s,this.l*e,this.opacity)},rgb(){var e=isNaN(this.h)?0:(this.h+120)*$0,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*(z8*r+J2*i)),255*(t+n*(tS*r+j0*i)),255*(t+n*(Wh*r)),this.opacity)}}));function eS(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 q8(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 eS((n-r/t)*t,s,i,o,a)}}function j8(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 eS((n-r/t)*t,i,o,s,a)}}var Mu=e=>()=>e;function V8(e,t){return function(n){return e+n*t}}function UV(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?V8(e,n>180||n<-180?n-360*Math.round(n/360):n):Mu(isNaN(e)?t:e)}function Y8(e){return(e=+e)==1?Ee:function(t,n){return n-t?UV(t,n,e):Mu(isNaN(t)?n:t)}}function Ee(e,t){var n=t-e;return n?V8(e,n):Mu(isNaN(e)?t:e)}var oi=function e(t){var n=Y8(t);function r(i,o){var s=n((i=an(i)).r,(o=an(o)).r),a=n(i.g,o.g),c=n(i.b,o.b),l=Ee(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 G8(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=an(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 nS=G8(q8),$V=G8(j8);function W8(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 X8(e){return ArrayBuffer.isView(e)&&!(e instanceof DataView)}function H8(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]=Lr(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 Z8(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 Q8(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]=Lr(e[i],t[i]):r[i]=t[i];return function(o){for(i in n)r[i]=n[i](o);return r}}var iS=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,rS=new RegExp(iS.source,"g");function zV(e){return function(){return e}}function qV(e){return function(t){return e(t)+""}}function Xh(e,t){var n=iS.lastIndex=rS.lastIndex=0,r,i,o,s=-1,a=[],c=[];for(e=e+"",t=t+"";(r=iS.exec(e))&&(i=rS.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=rS.lastIndex;return n<t.length&&(o=t.slice(n),a[s]?a[s]+=o:a[++s]=o),a.length<2?c[0]?qV(c[0].x):zV(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 Lr(e,t){var n=typeof t,r;return t==null||n==="boolean"?Mu(t):(n==="number"?we:n==="string"?(r=Fr(t))?(t=r,oi):Xh:t instanceof Fr?oi:t instanceof Date?Z8:X8(t)?W8:Array.isArray(t)?H8:typeof t.valueOf!="function"&&typeof t.toString!="function"||isNaN(t)?Q8:we)(e,t)}function Qc(e,t){return e=+e,t=+t,function(n){return Math.round(e*(1-n)+t*n)}}var K8=180/Math.PI,V0={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1};function oS(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)*K8,skewX:Math.atan(c)*K8,scaleX:s,scaleY:a}}var Y0;function J8(e){let t=new(typeof DOMMatrix=="function"?DOMMatrix:WebKitCSSMatrix)(e+"");return t.isIdentity?V0:oS(t.a,t.b,t.c,t.d,t.e,t.f)}function tk(e){return e==null?V0:(Y0||(Y0=document.createElementNS("http://www.w3.org/2000/svg","g")),Y0.setAttribute("transform",e),(e=Y0.transform.baseVal.consolidate())?(e=e.matrix,oS(e.a,e.b,e.c,e.d,e.e,e.f)):V0)}function ek(e,t,n,r){function i(l){return l.length?l.pop()+" ":""}function o(l,u,f,d,h,p){if(l!==f||u!==d){var y=h.push("translate(",null,t,null,n);p.push({i:y-4,x:we(l,f)},{i:y-2,x:we(u,d)})}else(f||d)&&h.push("translate("+f+t+d+n)}function s(l,u,f,d){l!==u?(l-u>180?u+=360:u-l>180&&(l+=360),d.push({i:f.push(i(f)+"rotate(",null,r)-2,x:we(l,u)})):u&&f.push(i(f)+"rotate("+u+r)}function a(l,u,f,d){l!==u?d.push({i:f.push(i(f)+"skewX(",null,r)-2,x:we(l,u)}):u&&f.push(i(f)+"skewX("+u+r)}function c(l,u,f,d,h,p){if(l!==f||u!==d){var y=h.push(i(h)+"scale(",null,",",null,")");p.push({i:y-4,x:we(l,f)},{i:y-2,x:we(u,d)})}else(f!==1||d!==1)&&h.push(i(h)+"scale("+f+","+d+")")}return function(l,u){var f=[],d=[];return l=e(l),u=e(u),o(l.translateX,l.translateY,u.translateX,u.translateY,f,d),s(l.rotate,u.rotate,f,d),a(l.skewX,u.skewX,f,d),c(l.scaleX,l.scaleY,u.scaleX,u.scaleY,f,d),l=u=null,function(h){for(var p=-1,y=d.length,b;++p<y;)f[(b=d[p]).i]=b.x(h);return f.join("")}}}var sS=ek(J8,"px, ","px)","deg)"),aS=ek(tk,", ",")",")");var jV=1e-12;function nk(e){return((e=Math.exp(e))+1/e)/2}function VV(e){return((e=Math.exp(e))-1/e)/2}function YV(e){return((e=Math.exp(2*e))-1)/(e+1)}var cS=function e(t,n,r){function i(o,s){var a=o[0],c=o[1],l=o[2],u=s[0],f=s[1],d=s[2],h=u-a,p=f-c,y=h*h+p*p,b,m;if(y<jV)m=Math.log(d/l)/t,b=function(T){return[a+T*h,c+T*p,l*Math.exp(t*T*m)]};else{var g=Math.sqrt(y),x=(d*d-l*l+r*y)/(2*l*n*g),_=(d*d-l*l-r*y)/(2*d*n*g),v=Math.log(Math.sqrt(x*x+1)-x),w=Math.log(Math.sqrt(_*_+1)-_);m=(w-v)/t,b=function(T){var A=T*m,R=nk(v),I=l/(n*g)*(R*YV(t*A+v)-VV(v));return[a+I*h,c+I*p,l*R/nk(t*A+v)]}}return b.duration=m*1e3*t/Math.SQRT2,b}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 rk(e){return function(t,n){var r=e((t=Yh(t)).h,(n=Yh(n)).h),i=Ee(t.s,n.s),o=Ee(t.l,n.l),s=Ee(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 lS=rk(Au),GV=rk(Ee);function G0(e,t){var n=Ee((e=Eu(e)).l,(t=Eu(t)).l),r=Ee(e.a,t.a),i=Ee(e.b,t.b),o=Ee(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 ik(e){return function(t,n){var r=e((t=Gh(t)).h,(n=Gh(n)).h),i=Ee(t.c,n.c),o=Ee(t.l,n.l),s=Ee(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 uS=ik(Au),WV=ik(Ee);function ok(e){return function t(n){n=+n;function r(i,o){var s=e((i=Qn(i)).h,(o=Qn(o)).h),a=Ee(i.s,o.s),c=Ee(i.l,o.l),l=Ee(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 XV=ok(Au),Nu=ok(Ee);function po(e,t){t===void 0&&(t=e,e=Lr);for(var n=0,r=t.length-1,i=t[0],o=new Array(r<0?0:r);n<r;)o[n]=e(i,i=t[++n]);return function(s){var a=Math.max(0,Math.min(r-1,Math.floor(s*=r)));return o[a](s-a)}}function Ln(e,t){for(var n=new Array(t),r=0;r<t;++r)n[r]=e(r/(t-1));return n}var Ru=0,Zh=0,Hh=0,ak=1e3,W0,Qh,X0=0,Kc=0,H0=0,Kh=typeof performance=="object"&&performance.now?performance:Date,ck=typeof window=="object"&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(e){setTimeout(e,17)};function tp(){return Kc||(ck(HV),Kc=Kh.now()+H0)}function HV(){Kc=0}function Jh(){this._call=this._time=this._next=null}Jh.prototype=Z0.prototype={constructor:Jh,restart:function(e,t,n){if(typeof e!="function")throw new TypeError("callback is not a function");n=(n==null?tp():+n)+(t==null?0:+t),!this._next&&Qh!==this&&(Qh?Qh._next=this:W0=this,Qh=this),this._call=e,this._time=n,fS()},stop:function(){this._call&&(this._call=null,this._time=1/0,fS())}};function Z0(e,t,n){var r=new Jh;return r.restart(e,t,n),r}function lk(){tp(),++Ru;for(var e=W0,t;e;)(t=Kc-e._time)>=0&&e._call.call(void 0,t),e=e._next;--Ru}function sk(){Kc=(X0=Kh.now())+H0,Ru=Zh=0;try{lk()}finally{Ru=0,QV(),Kc=0}}function ZV(){var e=Kh.now(),t=e-X0;t>ak&&(H0-=t,X0=e)}function QV(){for(var e,t=W0,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:W0=n);Qh=e,fS(r)}function fS(e){if(!Ru){Zh&&(Zh=clearTimeout(Zh));var t=e-Kc;t>24?(e<1/0&&(Zh=setTimeout(sk,e-Kh.now()-H0)),Hh&&(Hh=clearInterval(Hh))):(Hh||(X0=Kh.now(),Hh=setInterval(ZV,ak)),Ru=1,ck(sk))}}function Q0(e,t,n){var r=new Jh;return t=t==null?0:+t,r.restart(i=>{r.stop(),e(i+t)},t,n),r}var KV=Yc("start","end","cancel","interrupt"),JV=[],dk=0,uk=1,J0=2,K0=3,fk=4,tb=5,ep=6;function Da(e,t,n,r,i,o){var s=e.__transition;if(!s)e.__transition={};else if(n in s)return;tY(e,n,{name:t,index:r,group:i,on:KV,tween:JV,time:o.time,delay:o.delay,duration:o.duration,ease:o.ease,timer:null,state:dk})}function np(e,t){var n=rn(e,t);if(n.state>dk)throw new Error("too late; already scheduled");return n}function Mn(e,t){var n=rn(e,t);if(n.state>K0)throw new Error("too late; already running");return n}function rn(e,t){var n=e.__transition;if(!n||!(n=n[t]))throw new Error("transition not found");return n}function tY(e,t,n){var r=e.__transition,i;r[t]=n,n.timer=Z0(o,0,n.time);function o(l){n.state=uk,n.timer.restart(s,n.delay,n.time),n.delay<=l&&s(l-n.delay)}function s(l){var u,f,d,h;if(n.state!==uk)return c();for(u in r)if(h=r[u],h.name===n.name){if(h.state===K0)return Q0(s);h.state===fk?(h.state=ep,h.timer.stop(),h.on.call("interrupt",e,e.__data__,h.index,h.group),delete r[u]):+u<t&&(h.state=ep,h.timer.stop(),h.on.call("cancel",e,e.__data__,h.index,h.group),delete r[u])}if(Q0(function(){n.state===K0&&(n.state=fk,n.timer.restart(a,n.delay,n.time),a(l))}),n.state=J0,n.on.call("start",e,e.__data__,n.index,n.group),n.state===J0){for(n.state=K0,i=new Array(d=n.tween.length),u=0,f=-1;u<d;++u)(h=n.tween[u].value.call(e,e.__data__,n.index,n.group))&&(i[++f]=h);i.length=f+1}}function a(l){for(var u=l<n.duration?n.ease.call(null,l/n.duration):(n.timer.restart(c),n.state=tb,1),f=-1,d=i.length;++f<d;)i[f].call(e,u);n.state===tb&&(n.on.call("end",e,e.__data__,n.index,n.group),c())}function c(){n.state=ep,n.timer.stop(),delete r[t];for(var l in r)return;delete e.__transition}}function mo(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>J0&&r.state<tb,r.state=ep,r.timer.stop(),r.on.call(i?"interrupt":"cancel",e,e.__data__,r.index,r.group),delete n[s]}o&&delete e.__transition}}function hk(e){return this.each(function(){mo(this,e)})}function eY(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 nY(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 pk(e,t){var n=this._id;if(e+="",arguments.length<2){for(var r=rn(this.node(),n).tween,i=0,o=r.length,s;i<o;++i)if((s=r[i]).name===e)return s.value;return null}return this.each((t==null?eY:nY)(n,e,t))}function Ou(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 rn(i,r).value[t]}}function eb(e,t){var n;return(typeof t=="number"?we:t instanceof Fr?oi:(n=Fr(t))?(t=n,oi):Xh)(e,t)}function rY(e){return function(){this.removeAttribute(e)}}function iY(e){return function(){this.removeAttributeNS(e.space,e.local)}}function oY(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 sY(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 aY(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 cY(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 mk(e,t){var n=Is(e),r=n==="transform"?aS:eb;return this.attrTween(e,typeof t=="function"?(n.local?cY:aY)(n,r,Ou(this,"attr."+e,t)):t==null?(n.local?iY:rY)(n):(n.local?sY:oY)(n,r,t))}function lY(e,t){return function(n){this.setAttribute(e,t.call(this,n))}}function uY(e,t){return function(n){this.setAttributeNS(e.space,e.local,t.call(this,n))}}function fY(e,t){var n,r;function i(){var o=t.apply(this,arguments);return o!==r&&(n=(r=o)&&uY(e,o)),n}return i._value=t,i}function dY(e,t){var n,r;function i(){var o=t.apply(this,arguments);return o!==r&&(n=(r=o)&&lY(e,o)),n}return i._value=t,i}function yk(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=Is(e);return this.tween(n,(r.local?fY:dY)(r,t))}function hY(e,t){return function(){np(this,e).delay=+t.apply(this,arguments)}}function pY(e,t){return t=+t,function(){np(this,e).delay=t}}function gk(e){var t=this._id;return arguments.length?this.each((typeof e=="function"?hY:pY)(t,e)):rn(this.node(),t).delay}function mY(e,t){return function(){Mn(this,e).duration=+t.apply(this,arguments)}}function yY(e,t){return t=+t,function(){Mn(this,e).duration=t}}function bk(e){var t=this._id;return arguments.length?this.each((typeof e=="function"?mY:yY)(t,e)):rn(this.node(),t).duration}function gY(e,t){if(typeof t!="function")throw new Error;return function(){Mn(this,e).ease=t}}function xk(e){var t=this._id;return arguments.length?this.each(gY(t,e)):rn(this.node(),t).ease}function bY(e,t){return function(){var n=t.apply(this,arguments);if(typeof n!="function")throw new Error;Mn(this,e).ease=n}}function _k(e){if(typeof e!="function")throw new Error;return this.each(bY(this._id,e))}function wk(e){typeof e!="function"&&(e=Uh(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 vk(e){if(e._id!==this._id)throw new Error;for(var t=this._groups,n=e._groups,r=t.length,i=n.length,o=Math.min(r,i),s=new Array(r),a=0;a<o;++a)for(var c=t[a],l=n[a],u=c.length,f=s[a]=new Array(u),d,h=0;h<u;++h)(d=c[h]||l[h])&&(f[h]=d);for(;a<r;++a)s[a]=t[a];return new Kn(s,this._parents,this._name,this._id)}function xY(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 _Y(e,t,n){var r,i,o=xY(t)?np:Mn;return function(){var s=o(this,e),a=s.on;a!==r&&(i=(r=a).copy()).on(t,n),s.on=i}}function Sk(e,t){var n=this._id;return arguments.length<2?rn(this.node(),n).on.on(e):this.each(_Y(n,e,t))}function wY(e){return function(){var t=this.parentNode;for(var n in this.__transition)if(+n!==e)return;t&&t.removeChild(this)}}function Ik(){return this.on("end.remove",wY(this._id))}function Tk(e){var t=this._name,n=this._id;typeof e!="function"&&(e=Gc(e));for(var r=this._groups,i=r.length,o=new Array(i),s=0;s<i;++s)for(var a=r[s],c=a.length,l=o[s]=new Array(c),u,f,d=0;d<c;++d)(u=a[d])&&(f=e.call(u,u.__data__,d,a))&&("__data__"in u&&(f.__data__=u.__data__),l[d]=f,Da(l[d],t,n,d,l,rn(u,n)));return new Kn(o,this._parents,t,n)}function Ek(e){var t=this._name,n=this._id;typeof e!="function"&&(e=Ph(e));for(var r=this._groups,i=r.length,o=[],s=[],a=0;a<i;++a)for(var c=r[a],l=c.length,u,f=0;f<l;++f)if(u=c[f]){for(var d=e.call(u,u.__data__,f,c),h,p=rn(u,n),y=0,b=d.length;y<b;++y)(h=d[y])&&Da(h,t,n,y,d,p);o.push(d),s.push(u)}return new Kn(o,s,t,n)}var vY=Es.prototype.constructor;function Mk(){return new vY(this._groups,this._parents)}function SY(e,t){var n,r,i;return function(){var o=Na(this,e),s=(this.style.removeProperty(e),Na(this,e));return o===s?null:o===n&&s===r?i:i=t(n=o,r=s)}}function Ak(e){return function(){this.style.removeProperty(e)}}function IY(e,t,n){var r,i=n+"",o;return function(){var s=Na(this,e);return s===i?null:s===r?o:o=t(r=s,n)}}function TY(e,t,n){var r,i,o;return function(){var s=Na(this,e),a=n(this),c=a+"";return a==null&&(c=a=(this.style.removeProperty(e),Na(this,e))),s===c?null:s===r&&c===i?o:(i=c,o=t(r=s,a))}}function EY(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=Ak(t)):void 0;(l!==n||i!==u)&&(r=(n=l).copy()).on(s,i=u),c.on=r}}function Nk(e,t,n){var r=(e+="")=="transform"?sS:eb;return t==null?this.styleTween(e,SY(e,r)).on("end.style."+e,Ak(e)):typeof t=="function"?this.styleTween(e,TY(e,r,Ou(this,"style."+e,t))).each(EY(this._id,e)):this.styleTween(e,IY(e,r,t),n).on("end.style."+e,null)}function MY(e,t,n){return function(r){this.style.setProperty(e,t.call(this,r),n)}}function AY(e,t,n){var r,i;function o(){var s=t.apply(this,arguments);return s!==i&&(r=(i=s)&&MY(e,s,n)),r}return o._value=t,o}function Rk(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,AY(e,t,n??""))}function NY(e){return function(){this.textContent=e}}function RY(e){return function(){var t=e(this);this.textContent=t??""}}function Ok(e){return this.tween("text",typeof e=="function"?RY(Ou(this,"text",e)):NY(e==null?"":e+""))}function OY(e){return function(t){this.textContent=e.call(this,t)}}function DY(e){var t,n;function r(){var i=e.apply(this,arguments);return i!==n&&(t=(n=i)&&OY(i)),t}return r._value=e,r}function Dk(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,DY(e))}function kk(){for(var e=this._name,t=this._id,n=nb(),r=this._groups,i=r.length,o=0;o<i;++o)for(var s=r[o],a=s.length,c,l=0;l<a;++l)if(c=s[l]){var u=rn(c,t);Da(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 Fk(){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 kY=0;function Kn(e,t,n,r){this._groups=e,this._parents=t,this._name=n,this._id=r}function Lk(e){return Es().transition(e)}function nb(){return++kY}var Ns=Es.prototype;Kn.prototype=Lk.prototype={constructor:Kn,select:Tk,selectAll:Ek,selectChild:Ns.selectChild,selectChildren:Ns.selectChildren,filter:wk,merge:vk,selection:Mk,transition:kk,call:Ns.call,nodes:Ns.nodes,node:Ns.node,size:Ns.size,empty:Ns.empty,each:Ns.each,on:Sk,attr:mk,attrTween:yk,style:Nk,styleTween:Rk,text:Ok,textTween:Dk,remove:Ik,tween:pk,delay:gk,duration:bk,ease:xk,easeVarying:_k,end:Fk,[Symbol.iterator]:Ns[Symbol.iterator]};function rb(e){return((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2}var FY={time:null,delay:0,duration:250,ease:rb};function LY(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 Ck(e){var t,n;e instanceof Kn?(t=e._id,e=e._name):(t=nb(),(n=FY).time=tp(),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||LY(c,t));return new Kn(r,this._parents,e,t)}Es.prototype.interrupt=hk;Es.prototype.transition=Ck;var ib=e=>()=>e;function dS(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 Bk(e){e.stopImmediatePropagation()}function ob(e){e.preventDefault(),e.stopImmediatePropagation()}var Pk={name:"drag"},hS={name:"space"},Du={name:"handle"},ku={name:"center"},{abs:Uk,max:Cn,min:Bn}=Math;function $k(e){return[+e[0],+e[1]]}function mS(e){return[$k(e[0]),$k(e[1])]}var sb={name:"x",handles:["w","e"].map(rp),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]]}},ab={name:"y",handles:["n","s"].map(rp),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]]}},CY={name:"xy",handles:["n","w","e","s","nw","ne","sw","se"].map(rp),input:function(e){return e==null?null:mS(e)},output:function(e){return e}},Rs={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"},zk={e:"w",w:"e",nw:"ne",ne:"nw",se:"sw",sw:"se"},qk={n:"s",s:"n",nw:"sw",ne:"se",se:"ne",sw:"nw"},BY={overlay:1,selection:1,n:null,e:1,s:null,w:-1,nw:-1,ne:1,se:1,sw:-1},PY={overlay:1,selection:1,n:-1,e:null,s:1,w:null,nw:-1,ne:-1,se:1,sw:1};function rp(e){return{type:e}}function UY(e){return!e.ctrlKey&&!e.button}function $Y(){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 zY(){return navigator.maxTouchPoints||"ontouchstart"in this}function pS(e){for(;!e.__brush;)if(!(e=e.parentNode))return;return e.__brush}function qY(e){return e[0][0]===e[1][0]||e[0][1]===e[1][1]}function yS(){return xS(sb)}function gS(){return xS(ab)}function bS(){return xS(CY)}function xS(e){var t=$Y,n=UY,r=zY,i=!0,o=Yc("start","brush","end"),s=6,a;function c(b){var m=b.property("__brush",y).selectAll(".overlay").data([rp("overlay")]);m.enter().append("rect").attr("class","overlay").attr("pointer-events","all").attr("cursor",Rs.overlay).merge(m).each(function(){var x=pS(this).extent;zt(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])}),b.selectAll(".selection").data([rp("selection")]).enter().append("rect").attr("class","selection").attr("cursor",Rs.selection).attr("fill","#777").attr("fill-opacity",.3).attr("stroke","#fff").attr("shape-rendering","crispEdges");var g=b.selectAll(".handle").data(e.handles,function(x){return x.type});g.exit().remove(),g.enter().append("rect").attr("class",function(x){return"handle handle--"+x.type}).attr("cursor",function(x){return Rs[x.type]}),b.each(l).attr("fill","none").attr("pointer-events","all").on("mousedown.brush",d).filter(r).on("touchstart.brush",d).on("touchmove.brush",h).on("touchend.brush touchcancel.brush",p).style("touch-action","none").style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}c.move=function(b,m,g){b.tween?b.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,_=x.__brush,v=u(x,arguments),w=_.selection,T=e.input(typeof m=="function"?m.apply(this,arguments):m,_.extent),A=Lr(w,T);function R(I){_.selection=I===1&&T===null?null:A(I),l.call(x),v.brush()}return w!==null&&T!==null?R:R(1)}):b.each(function(){var x=this,_=arguments,v=x.__brush,w=e.input(typeof m=="function"?m.apply(x,_):m,v.extent),T=u(x,_).beforestart();mo(x),v.selection=w===null?null:w,l.call(x),T.start(g).brush(g).end(g)})},c.clear=function(b,m){c.move(b,null,m)};function l(){var b=zt(this),m=pS(this).selection;m?(b.selectAll(".selection").style("display",null).attr("x",m[0][0]).attr("y",m[0][1]).attr("width",m[1][0]-m[0][0]).attr("height",m[1][1]-m[0][1]),b.selectAll(".handle").style("display",null).attr("x",function(g){return g.type[g.type.length-1]==="e"?m[1][0]-s/2:m[0][0]-s/2}).attr("y",function(g){return g.type[0]==="s"?m[1][1]-s/2:m[0][1]-s/2}).attr("width",function(g){return g.type==="n"||g.type==="s"?m[1][0]-m[0][0]+s:s}).attr("height",function(g){return g.type==="e"||g.type==="w"?m[1][1]-m[0][1]+s:s})):b.selectAll(".selection,.handle").style("display","none").attr("x",null).attr("y",null).attr("width",null).attr("height",null)}function u(b,m,g){var x=b.__brush.emitter;return x&&(!g||!x.clean)?x:new f(b,m,g)}function f(b,m,g){this.that=b,this.args=m,this.state=b.__brush,this.active=0,this.clean=g}f.prototype={beforestart:function(){return++this.active===1&&(this.state.emitter=this,this.starting=!0),this},start:function(b,m){return this.starting?(this.starting=!1,this.emit("start",b,m)):this.emit("brush",b),this},brush:function(b,m){return this.emit("brush",b,m),this},end:function(b,m){return--this.active===0&&(delete this.state.emitter,this.emit("end",b,m)),this},emit:function(b,m,g){var x=zt(this.that).datum();o.call(b,this.that,new dS(b,{sourceEvent:m,target:c,selection:e.output(this.state.selection),mode:g,dispatch:o}),x)}};function d(b){if(a&&!b.touches||!n.apply(this,arguments))return;var m=this,g=b.target.__data__.type,x=(i&&b.metaKey?g="overlay":g)==="selection"?Pk:i&&b.altKey?ku:Du,_=e===ab?null:BY[g],v=e===sb?null:PY[g],w=pS(m),T=w.extent,A=w.selection,R=T[0][0],I,E,O=T[0][1],k,S,M=T[1][0],N,F,B=T[1][1],C,P,U=0,$=0,X,tt=_&&v&&i&&b.shiftKey,nt,st,Y=Array.from(b.touches||[b],et=>{let oe=et.identifier;return et=Fn(et,m),et.point0=et.slice(),et.identifier=oe,et});mo(m);var rt=u(m,arguments,!0).beforestart();if(g==="overlay"){A&&(X=!0);let et=[Y[0],Y[1]||Y[0]];w.selection=A=[[I=e===ab?R:Bn(et[0][0],et[1][0]),k=e===sb?O:Bn(et[0][1],et[1][1])],[N=e===ab?M:Cn(et[0][0],et[1][0]),C=e===sb?B:Cn(et[0][1],et[1][1])]],Y.length>1&&Lt(b)}else I=A[0][0],k=A[0][1],N=A[1][0],C=A[1][1];E=I,S=k,F=N,P=C;var q=zt(m).attr("pointer-events","none"),H=q.selectAll(".overlay").attr("cursor",Rs[g]);if(b.touches)rt.moved=z,rt.ended=dt;else{var ot=zt(b.view).on("mousemove.brush",z,!0).on("mouseup.brush",dt,!0);i&&ot.on("keydown.brush",Wt,!0).on("keyup.brush",Xt,!0),zh(b.view)}l.call(m),rt.start(b,x.name);function z(et){for(let oe of et.changedTouches||[et])for(let xr of Y)xr.identifier===oe.identifier&&(xr.cur=Fn(oe,m));if(tt&&!nt&&!st&&Y.length===1){let oe=Y[0];Uk(oe.cur[0]-oe[0])>Uk(oe.cur[1]-oe[1])?st=!0:nt=!0}for(let oe of Y)oe.cur&&(oe[0]=oe.cur[0],oe[1]=oe.cur[1]);X=!0,ob(et),Lt(et)}function Lt(et){let oe=Y[0],xr=oe.point0;var Gi;switch(U=oe[0]-xr[0],$=oe[1]-xr[1],x){case hS:case Pk:{_&&(U=Cn(R-I,Bn(M-N,U)),E=I+U,F=N+U),v&&($=Cn(O-k,Bn(B-C,$)),S=k+$,P=C+$);break}case Du:{Y[1]?(_&&(E=Cn(R,Bn(M,Y[0][0])),F=Cn(R,Bn(M,Y[1][0])),_=1),v&&(S=Cn(O,Bn(B,Y[0][1])),P=Cn(O,Bn(B,Y[1][1])),v=1)):(_<0?(U=Cn(R-I,Bn(M-I,U)),E=I+U,F=N):_>0&&(U=Cn(R-N,Bn(M-N,U)),E=I,F=N+U),v<0?($=Cn(O-k,Bn(B-k,$)),S=k+$,P=C):v>0&&($=Cn(O-C,Bn(B-C,$)),S=k,P=C+$));break}case ku:{_&&(E=Cn(R,Bn(M,I-U*_)),F=Cn(R,Bn(M,N+U*_))),v&&(S=Cn(O,Bn(B,k-$*v)),P=Cn(O,Bn(B,C+$*v)));break}}F<E&&(_*=-1,Gi=I,I=N,N=Gi,Gi=E,E=F,F=Gi,g in zk&&H.attr("cursor",Rs[g=zk[g]])),P<S&&(v*=-1,Gi=k,k=C,C=Gi,Gi=S,S=P,P=Gi,g in qk&&H.attr("cursor",Rs[g=qk[g]])),w.selection&&(A=w.selection),nt&&(E=A[0][0],F=A[1][0]),st&&(S=A[0][1],P=A[1][1]),(A[0][0]!==E||A[0][1]!==S||A[1][0]!==F||A[1][1]!==P)&&(w.selection=[[E,S],[F,P]],l.call(m),rt.brush(et,x.name))}function dt(et){if(Bk(et),et.touches){if(et.touches.length)return;a&&clearTimeout(a),a=setTimeout(function(){a=null},500)}else qh(et.view,X),ot.on("keydown.brush keyup.brush mousemove.brush mouseup.brush",null);q.attr("pointer-events","all"),H.attr("cursor",Rs.overlay),w.selection&&(A=w.selection),qY(A)&&(w.selection=null,l.call(m)),rt.end(et,x.name)}function Wt(et){switch(et.keyCode){case 16:{tt=_&&v;break}case 18:{x===Du&&(_&&(N=F-U*_,I=E+U*_),v&&(C=P-$*v,k=S+$*v),x=ku,Lt(et));break}case 32:{(x===Du||x===ku)&&(_<0?N=F-U:_>0&&(I=E-U),v<0?C=P-$:v>0&&(k=S-$),x=hS,H.attr("cursor",Rs.selection),Lt(et));break}default:return}ob(et)}function Xt(et){switch(et.keyCode){case 16:{tt&&(nt=st=tt=!1,Lt(et));break}case 18:{x===ku&&(_<0?N=F:_>0&&(I=E),v<0?C=P:v>0&&(k=S),x=Du,Lt(et));break}case 32:{x===hS&&(et.altKey?(_&&(N=F-U*_,I=E+U*_),v&&(C=P-$*v,k=S+$*v),x=ku):(_<0?N=F:_>0&&(I=E),v<0?C=P:v>0&&(k=S),x=Du),H.attr("cursor",Rs[g]),Lt(et));break}default:return}ob(et)}}function h(b){u(this,arguments).moved(b)}function p(b){u(this,arguments).ended(b)}function y(){var b=this.__brush||{selection:null};return b.extent=mS(t.apply(this,arguments)),b.dim=e,b}return c.extent=function(b){return arguments.length?(t=typeof b=="function"?b:ib(mS(b)),c):t},c.filter=function(b){return arguments.length?(n=typeof b=="function"?b:ib(!!b),c):n},c.touchable=function(b){return arguments.length?(r=typeof b=="function"?b:ib(!!b),c):r},c.handleSize=function(b){return arguments.length?(s=+b,c):s},c.keyModifiers=function(b){return arguments.length?(i=!!b,c):i},c.on=function(){var b=o.on.apply(o,arguments);return b===o?c:b},c}var _S=Math.PI,wS=2*_S,Jc=1e-6,jY=wS-Jc;function jk(e){this._+=e[0];for(let t=1,n=e.length;t<n;++t)this._+=arguments[t]+e[t]}function VY(e){let t=Math.floor(e);if(!(t>=0))throw new Error(`invalid digits: ${e}`);if(t>15)return jk;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 ka=class{constructor(t){this._x0=this._y0=this._x1=this._y1=null,this._="",this._append=t==null?jk:VY(t)}moveTo(t,n){this._append`M${this._x0=this._x1=+t},${this._y0=this._y1=+n}`}closePath(){this._x1!==null&&(this._x1=this._x0,this._y1=this._y0,this._append`Z`)}lineTo(t,n){this._append`L${this._x1=+t},${this._y1=+n}`}quadraticCurveTo(t,n,r,i){this._append`Q${+t},${+n},${this._x1=+r},${this._y1=+i}`}bezierCurveTo(t,n,r,i,o,s){this._append`C${+t},${+n},${+r},${+i},${this._x1=+o},${this._y1=+s}`}arcTo(t,n,r,i,o){if(t=+t,n=+n,r=+r,i=+i,o=+o,o<0)throw new Error(`negative radius: ${o}`);let s=this._x1,a=this._y1,c=r-t,l=i-n,u=s-t,f=a-n,d=u*u+f*f;if(this._x1===null)this._append`M${this._x1=t},${this._y1=n}`;else if(d>Jc)if(!(Math.abs(f*c-l*u)>Jc)||!o)this._append`L${this._x1=t},${this._y1=n}`;else{let h=r-s,p=i-a,y=c*c+l*l,b=h*h+p*p,m=Math.sqrt(y),g=Math.sqrt(d),x=o*Math.tan((_S-Math.acos((y+d-b)/(2*m*g)))/2),_=x/g,v=x/m;Math.abs(_-1)>Jc&&this._append`L${t+_*u},${n+_*f}`,this._append`A${o},${o},0,0,${+(f*h>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,d=s?i-o:o-i;this._x1===null?this._append`M${l},${u}`:(Math.abs(this._x1-l)>Jc||Math.abs(this._y1-u)>Jc)&&this._append`L${l},${u}`,r&&(d<0&&(d=d%wS+wS),d>jY?this._append`A${r},${r},0,1,${f},${t-a},${n-c}A${r},${r},0,1,${f},${this._x1=l},${this._y1=u}`:d>Jc&&this._append`A${r},${r},0,${+(d>=_S)},${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 Vk(){return new ka}Vk.prototype=ka.prototype;function Jn(e=3){return new ka(+e)}var YY=Array.prototype,cb=YY.slice;function Yk(e,t){return e-t}function Gk(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 yo=e=>()=>e;function Wk(e,t){for(var n=-1,r=t.length,i;++n<r;)if(i=GY(e,t[n]))return i;return 0}function GY(e,t){for(var n=t[0],r=t[1],i=-1,o=0,s=e.length,a=s-1;o<s;a=o++){var c=e[o],l=c[0],u=c[1],f=e[a],d=f[0],h=f[1];if(WY(c,f,t))return 0;u>r!=h>r&&n<(d-l)*(r-u)/(h-u)+l&&(i=-i)}return i}function WY(e,t,n){var r;return XY(e,t,n)&&HY(e[r=+(e[0]===t[0])],n[r],t[r])}function XY(e,t,n){return(t[0]-e[0])*(n[1]-e[1])===(n[0]-e[0])*(t[1]-e[1])}function HY(e,t,n){return e<=t&&t<=n||n<=t&&t<=e}function Xk(){}var Os=[[],[[[1,1.5],[.5,1]]],[[[1.5,1],[1,1.5]]],[[[1.5,1],[.5,1]]],[[[1,.5],[1.5,1]]],[[[1,1.5],[.5,1]],[[1,.5],[1.5,1]]],[[[1,.5],[1,1.5]]],[[[1,.5],[.5,1]]],[[[.5,1],[1,.5]]],[[[1,1.5],[1,.5]]],[[[.5,1],[1,.5]],[[1.5,1],[1,1.5]]],[[[1.5,1],[1,.5]]],[[[.5,1],[1.5,1]]],[[[1,1.5],[1.5,1]]],[[[.5,1],[1,1.5]]],[]];function Fa(){var e=1,t=1,n=Ma,r=c;function i(l){var u=n(l);if(Array.isArray(u))u=u.slice().sort(Yk);else{let f=ae(l,ZY);for(u=Tn(...wu(f[0],f[1],u),u);u[u.length-1]>=f[1];)u.pop();for(;u[1]<f[0];)u.shift()}return u.map(f=>o(l,f))}function o(l,u){let f=u==null?NaN:+u;if(isNaN(f))throw new Error(`invalid value: ${u}`);var d=[],h=[];return s(l,f,function(p){r(p,l,f),Gk(p)>0?d.push([p]):h.push(p)}),h.forEach(function(p){for(var y=0,b=d.length,m;y<b;++y)if(Wk((m=d[y])[0],p)!==-1){m.push(p);return}}),{type:"MultiPolygon",value:u,coordinates:d}}function s(l,u,f){var d=new Array,h=new Array,p,y,b,m,g,x;for(p=y=-1,m=tl(l[0],u),Os[m<<1].forEach(_);++p<e-1;)b=m,m=tl(l[p+1],u),Os[b|m<<1].forEach(_);for(Os[m<<0].forEach(_);++y<t-1;){for(p=-1,m=tl(l[y*e+e],u),g=tl(l[y*e],u),Os[m<<1|g<<2].forEach(_);++p<e-1;)b=m,m=tl(l[y*e+e+p+1],u),x=g,g=tl(l[y*e+p+1],u),Os[b|m<<1|g<<2|x<<3].forEach(_);Os[m|g<<3].forEach(_)}for(p=-1,g=l[y*e]>=u,Os[g<<2].forEach(_);++p<e-1;)x=g,g=tl(l[y*e+p+1],u),Os[g<<2|x<<3].forEach(_);Os[g<<3].forEach(_);function _(v){var w=[v[0][0]+p,v[0][1]+y],T=[v[1][0]+p,v[1][1]+y],A=a(w),R=a(T),I,E;(I=h[A])?(E=d[R])?(delete h[I.end],delete d[E.start],I===E?(I.ring.push(T),f(I.ring)):d[I.start]=h[E.end]={start:I.start,end:E.end,ring:I.ring.concat(E.ring)}):(delete h[I.end],I.ring.push(T),h[I.end=R]=I):(I=d[R])?(E=h[A])?(delete d[I.start],delete h[E.end],I===E?(I.ring.push(T),f(I.ring)):d[E.start]=h[I.end]={start:E.start,end:I.end,ring:E.ring.concat(I.ring)}):(delete d[I.start],I.ring.unshift(w),d[I.start=A]=I):d[A]=h[R]={start:A,end:R,ring:[w,T]}}}function a(l){return l[0]*2+l[1]*(e+1)*4}function c(l,u,f){l.forEach(function(d){var h=d[0],p=d[1],y=h|0,b=p|0,m=vS(u[b*e+y]);h>0&&h<e&&y===h&&(d[0]=Hk(h,vS(u[b*e+y-1]),m,f)),p>0&&p<t&&b===p&&(d[1]=Hk(p,vS(u[(b-1)*e+y]),m,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)?yo(cb.call(l)):yo(l),i):n},i.smooth=function(l){return arguments.length?(r=l?c:Xk,i):r===c},i}function ZY(e){return isFinite(e)?e:NaN}function tl(e,t){return e==null?!1:+e>=t}function vS(e){return e==null||isNaN(e=+e)?-1/0:e}function Hk(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 QY(e){return e[0]}function KY(e){return e[1]}function JY(){return 1}function SS(){var e=QY,t=KY,n=JY,r=960,i=500,o=20,s=2,a=o*3,c=r+a*2>>s,l=i+a*2>>s,u=yo(20);function f(g){var x=new Float32Array(c*l),_=Math.pow(2,-s),v=-1;for(let k of g){var w=(e(k,++v,g)+a)*_,T=(t(k,v,g)+a)*_,A=+n(k,v,g);if(A&&w>=0&&w<c&&T>=0&&T<l){var R=Math.floor(w),I=Math.floor(T),E=w-R-.5,O=T-I-.5;x[R+I*c]+=(1-E)*(1-O)*A,x[R+1+I*c]+=E*(1-O)*A,x[R+1+(I+1)*c]+=E*O*A,x[R+(I+1)*c]+=(1-E)*O*A}}return Dh({data:x,width:c,height:l},o*_),x}function d(g){var x=f(g),_=u(x),v=Math.pow(2,2*s);return Array.isArray(_)||(_=Tn(Number.MIN_VALUE,$t(x)/v,_)),Fa().size([c,l]).thresholds(_.map(w=>w*v))(x).map((w,T)=>(w.value=+_[T],h(w)))}d.contours=function(g){var x=f(g),_=Fa().size([c,l]),v=Math.pow(2,2*s),w=T=>{T=+T;var A=h(_.contour(x,T*v));return A.value=T,A};return Object.defineProperty(w,"max",{get:()=>$t(x)/v}),w};function h(g){return g.coordinates.forEach(p),g}function p(g){g.forEach(y)}function y(g){g.forEach(b)}function b(g){g[0]=g[0]*Math.pow(2,s)-a,g[1]=g[1]*Math.pow(2,s)-a}function m(){return a=o*3,c=r+a*2>>s,l=i+a*2>>s,d}return d.x=function(g){return arguments.length?(e=typeof g=="function"?g:yo(+g),d):e},d.y=function(g){return arguments.length?(t=typeof g=="function"?g:yo(+g),d):t},d.weight=function(g){return arguments.length?(n=typeof g=="function"?g:yo(+g),d):n},d.size=function(g){if(!arguments.length)return[r,i];var x=+g[0],_=+g[1];if(!(x>=0&&_>=0))throw new Error("invalid size");return r=x,i=_,m()},d.cellSize=function(g){if(!arguments.length)return 1<<s;if(!((g=+g)>=1))throw new Error("invalid cell size");return s=Math.floor(Math.log(g)/Math.LN2),m()},d.thresholds=function(g){return arguments.length?(u=typeof g=="function"?g:Array.isArray(g)?yo(cb.call(g)):yo(g),d):u},d.bandwidth=function(g){if(!arguments.length)return Math.sqrt(o*(o+1));if(!((g=+g)>=0))throw new Error("invalid bandwidth");return o=(Math.sqrt(4*g*g+1)-1)/2,m()},d}var Jt=11102230246251565e-32,Ge=134217729,ip=(3+8*Jt)*Jt;function el(e,t,n,r,i){let o,s,a,c,l=t[0],u=r[0],f=0,d=0;u>l==u>-l?(o=l,l=t[++f]):(o=u,u=r[++d]);let h=0;if(f<e&&d<n)for(u>l==u>-l?(s=l+o,a=o-(s-l),l=t[++f]):(s=u+o,a=o-(s-u),u=r[++d]),o=s,a!==0&&(i[h++]=a);f<e&&d<n;)u>l==u>-l?(s=o+l,c=s-o,a=o-(s-c)+(l-c),l=t[++f]):(s=o+u,c=s-o,a=o-(s-c)+(u-c),u=r[++d]),o=s,a!==0&&(i[h++]=a);for(;f<e;)s=o+l,c=s-o,a=o-(s-c)+(l-c),l=t[++f],o=s,a!==0&&(i[h++]=a);for(;d<n;)s=o+u,c=s-o,a=o-(s-c)+(u-c),u=r[++d],o=s,a!==0&&(i[h++]=a);return(o!==0||h===0)&&(i[h++]=o),h}function op(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 tG=(3+16*Jt)*Jt,eG=(2+12*Jt)*Jt,nG=(9+64*Jt)*Jt*Jt,Fu=V(4),Zk=V(8),Qk=V(12),Kk=V(16),tr=V(4);function rG(e,t,n,r,i,o,s){let a,c,l,u,f,d,h,p,y,b,m,g,x,_,v,w,T,A,R=e-i,I=n-i,E=t-o,O=r-o;_=R*O,d=Ge*R,h=d-(d-R),p=R-h,d=Ge*O,y=d-(d-O),b=O-y,v=p*b-(_-h*y-p*y-h*b),w=E*I,d=Ge*E,h=d-(d-E),p=E-h,d=Ge*I,y=d-(d-I),b=I-y,T=p*b-(w-h*y-p*y-h*b),m=v-T,f=v-m,Fu[0]=v-(m+f)+(f-T),g=_+m,f=g-_,x=_-(g-f)+(m-f),m=x-w,f=x-m,Fu[1]=x-(m+f)+(f-w),A=g+m,f=A-g,Fu[2]=g-(A-f)+(m-f),Fu[3]=A;let k=op(4,Fu),S=eG*s;if(k>=S||-k>=S||(f=e-R,a=e-(R+f)+(f-i),f=n-I,l=n-(I+f)+(f-i),f=t-E,c=t-(E+f)+(f-o),f=r-O,u=r-(O+f)+(f-o),a===0&&c===0&&l===0&&u===0)||(S=nG*s+ip*Math.abs(k),k+=R*u+O*a-(E*l+I*c),k>=S||-k>=S))return k;_=a*O,d=Ge*a,h=d-(d-a),p=a-h,d=Ge*O,y=d-(d-O),b=O-y,v=p*b-(_-h*y-p*y-h*b),w=c*I,d=Ge*c,h=d-(d-c),p=c-h,d=Ge*I,y=d-(d-I),b=I-y,T=p*b-(w-h*y-p*y-h*b),m=v-T,f=v-m,tr[0]=v-(m+f)+(f-T),g=_+m,f=g-_,x=_-(g-f)+(m-f),m=x-w,f=x-m,tr[1]=x-(m+f)+(f-w),A=g+m,f=A-g,tr[2]=g-(A-f)+(m-f),tr[3]=A;let M=el(4,Fu,4,tr,Zk);_=R*u,d=Ge*R,h=d-(d-R),p=R-h,d=Ge*u,y=d-(d-u),b=u-y,v=p*b-(_-h*y-p*y-h*b),w=E*l,d=Ge*E,h=d-(d-E),p=E-h,d=Ge*l,y=d-(d-l),b=l-y,T=p*b-(w-h*y-p*y-h*b),m=v-T,f=v-m,tr[0]=v-(m+f)+(f-T),g=_+m,f=g-_,x=_-(g-f)+(m-f),m=x-w,f=x-m,tr[1]=x-(m+f)+(f-w),A=g+m,f=A-g,tr[2]=g-(A-f)+(m-f),tr[3]=A;let N=el(M,Zk,4,tr,Qk);_=a*u,d=Ge*a,h=d-(d-a),p=a-h,d=Ge*u,y=d-(d-u),b=u-y,v=p*b-(_-h*y-p*y-h*b),w=c*l,d=Ge*c,h=d-(d-c),p=c-h,d=Ge*l,y=d-(d-l),b=l-y,T=p*b-(w-h*y-p*y-h*b),m=v-T,f=v-m,tr[0]=v-(m+f)+(f-T),g=_+m,f=g-_,x=_-(g-f)+(m-f),m=x-w,f=x-m,tr[1]=x-(m+f)+(f-w),A=g+m,f=A-g,tr[2]=g-(A-f)+(m-f),tr[3]=A;let F=el(N,Qk,4,tr,Kk);return Kk[F-1]}function Lu(e,t,n,r,i,o){let s=(t-o)*(n-i),a=(e-i)*(r-o),c=s-a;if(s===0||a===0||s>0!=a>0)return c;let l=Math.abs(s+a);return Math.abs(c)>=tG*l?c:-rG(e,t,n,r,i,o,l)}var Z1t=(7+56*Jt)*Jt,Q1t=(3+28*Jt)*Jt,K1t=(26+288*Jt)*Jt*Jt,J1t=V(4),t_t=V(4),e_t=V(4),n_t=V(4),r_t=V(4),i_t=V(4),o_t=V(4),s_t=V(4),a_t=V(4),c_t=V(8),l_t=V(8),u_t=V(8),f_t=V(4),d_t=V(8),h_t=V(8),p_t=V(8),m_t=V(12),y_t=V(192),g_t=V(192);var __t=(10+96*Jt)*Jt,w_t=(4+48*Jt)*Jt,v_t=(44+576*Jt)*Jt*Jt,S_t=V(4),I_t=V(4),T_t=V(4),E_t=V(4),M_t=V(4),A_t=V(4),N_t=V(4),R_t=V(4),O_t=V(8),D_t=V(8),k_t=V(8),F_t=V(8),L_t=V(8),C_t=V(8),B_t=V(8),P_t=V(8),U_t=V(8),$_t=V(4),z_t=V(4),q_t=V(4),j_t=V(8),V_t=V(16),Y_t=V(16),G_t=V(16),W_t=V(32),X_t=V(32),H_t=V(48),Z_t=V(64),Q_t=V(1152),K_t=V(1152);var nwt=(16+224*Jt)*Jt,rwt=(5+72*Jt)*Jt,iwt=(71+1408*Jt)*Jt*Jt,owt=V(4),swt=V(4),awt=V(4),cwt=V(4),lwt=V(4),uwt=V(4),fwt=V(4),dwt=V(4),hwt=V(4),pwt=V(4),mwt=V(24),ywt=V(24),gwt=V(24),bwt=V(24),xwt=V(24),_wt=V(24),wwt=V(24),vwt=V(24),Swt=V(24),Iwt=V(24),Twt=V(1152),Ewt=V(1152),Mwt=V(1152),Awt=V(1152),Nwt=V(1152),Rwt=V(2304),Owt=V(2304),Dwt=V(3456),kwt=V(5760),Fwt=V(8),Lwt=V(8),Cwt=V(8),Bwt=V(16),Pwt=V(24),Uwt=V(48),$wt=V(48),zwt=V(96),qwt=V(192),jwt=V(384),Vwt=V(384),Ywt=V(384),Gwt=V(768);var Wwt=V(96),Xwt=V(96),Hwt=V(96),Zwt=V(1152);var tF=Math.pow(2,-52),lb=new Uint32Array(512),Bu=class e{static from(t,n=lG,r=uG){let i=t.length,o=new Float64Array(i*2);for(let s=0;s<i;s++){let a=t[s];o[2*s]=n(a),o[2*s+1]=r(a)}return new e(o)}constructor(t){let n=t.length>>1;if(n>0&&typeof t[0]!="number")throw new Error("Expected coords to contain numbers.");this.coords=t;let r=Math.max(2*n-5,0);this._triangles=new Uint32Array(r*3),this._halfedges=new Int32Array(r*3),this._hashSize=Math.ceil(Math.sqrt(n)),this._hullPrev=new Uint32Array(n),this._hullNext=new Uint32Array(n),this._hullTri=new Uint32Array(n),this._hullHash=new Int32Array(this._hashSize).fill(-1),this._ids=new Uint32Array(n),this._dists=new Float64Array(n),this.update()}update(){let{coords:t,_hullPrev:n,_hullNext:r,_hullTri:i,_hullHash:o}=this,s=t.length>>1,a=1/0,c=1/0,l=-1/0,u=-1/0;for(let I=0;I<s;I++){let E=t[2*I],O=t[2*I+1];E<a&&(a=E),O<c&&(c=O),E>l&&(l=E),O>u&&(u=O),this._ids[I]=I}let f=(a+l)/2,d=(c+u)/2,h=1/0,p,y,b;for(let I=0;I<s;I++){let E=IS(f,d,t[2*I],t[2*I+1]);E<h&&(p=I,h=E)}let m=t[2*p],g=t[2*p+1];h=1/0;for(let I=0;I<s;I++){if(I===p)continue;let E=IS(m,g,t[2*I],t[2*I+1]);E<h&&E>0&&(y=I,h=E)}let x=t[2*y],_=t[2*y+1],v=1/0;for(let I=0;I<s;I++){if(I===p||I===y)continue;let E=aG(m,g,x,_,t[2*I],t[2*I+1]);E<v&&(b=I,v=E)}let w=t[2*b],T=t[2*b+1];if(v===1/0){for(let O=0;O<s;O++)this._dists[O]=t[2*O]-t[0]||t[2*O+1]-t[1];Cu(this._ids,this._dists,0,s-1);let I=new Uint32Array(s),E=0;for(let O=0,k=-1/0;O<s;O++){let S=this._ids[O];this._dists[S]>k&&(I[E++]=S,k=this._dists[S])}this.hull=I.subarray(0,E),this.triangles=new Uint32Array(0),this.halfedges=new Uint32Array(0);return}if(Lu(m,g,x,_,w,T)<0){let I=y,E=x,O=_;y=b,x=w,_=T,b=I,w=E,T=O}let A=cG(m,g,x,_,w,T);this._cx=A.x,this._cy=A.y;for(let I=0;I<s;I++)this._dists[I]=IS(t[2*I],t[2*I+1],A.x,A.y);Cu(this._ids,this._dists,0,s-1),this._hullStart=p;let R=3;r[p]=n[b]=y,r[y]=n[p]=b,r[b]=n[y]=p,i[p]=0,i[y]=1,i[b]=2,o.fill(-1),o[this._hashKey(m,g)]=p,o[this._hashKey(x,_)]=y,o[this._hashKey(w,T)]=b,this.trianglesLen=0,this._addTriangle(p,y,b,-1,-1,-1);for(let I=0,E,O;I<this._ids.length;I++){let k=this._ids[I],S=t[2*k],M=t[2*k+1];if(I>0&&Math.abs(S-E)<=tF&&Math.abs(M-O)<=tF||(E=S,O=M,k===p||k===y||k===b))continue;let N=0;for(let U=0,$=this._hashKey(S,M);U<this._hashSize&&(N=o[($+U)%this._hashSize],!(N!==-1&&N!==r[N]));U++);N=n[N];let F=N,B;for(;B=r[F],Lu(S,M,t[2*F],t[2*F+1],t[2*B],t[2*B+1])>=0;)if(F=B,F===N){F=-1;break}if(F===-1)continue;let C=this._addTriangle(F,k,r[F],-1,-1,i[F]);i[k]=this._legalize(C+2),i[F]=C,R++;let P=r[F];for(;B=r[P],Lu(S,M,t[2*P],t[2*P+1],t[2*B],t[2*B+1])<0;)C=this._addTriangle(P,k,B,i[k],-1,i[P]),i[k]=this._legalize(C+2),r[P]=P,R--,P=B;if(F===N)for(;B=n[F],Lu(S,M,t[2*B],t[2*B+1],t[2*F],t[2*F+1])<0;)C=this._addTriangle(B,k,F,-1,i[F],i[B]),this._legalize(C+2),i[B]=C,r[F]=F,R--,F=B;this._hullStart=n[k]=F,r[F]=n[P]=k,r[k]=P,o[this._hashKey(S,M)]=k,o[this._hashKey(t[2*F],t[2*F+1])]=F}this.hull=new Uint32Array(R);for(let I=0,E=this._hullStart;I<R;I++)this.hull[I]=E,E=r[E];this.triangles=this._triangles.subarray(0,this.trianglesLen),this.halfedges=this._halfedges.subarray(0,this.trianglesLen)}_hashKey(t,n){return Math.floor(oG(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=lb[--o];continue}let l=a-a%3,u=c+(t+1)%3,f=l+(a+2)%3,d=n[s],h=n[t],p=n[u],y=n[f];if(sG(i[2*d],i[2*d+1],i[2*h],i[2*h+1],i[2*p],i[2*p+1],i[2*y],i[2*y+1])){n[t]=y,n[a]=d;let m=r[f];if(m===-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,m),this._link(a,r[s]),this._link(s,f);let g=l+(a+1)%3;o<lb.length&&(lb[o++]=g)}else{if(o===0)break;t=lb[--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 oG(e,t){let n=e/(Math.abs(e)+Math.abs(t));return(t>0?3-n:1+n)/4}function IS(e,t,n,r){let i=e-n,o=t-r;return i*i+o*o}function sG(e,t,n,r,i,o,s,a){let c=e-s,l=t-a,u=n-s,f=r-a,d=i-s,h=o-a,p=c*c+l*l,y=u*u+f*f,b=d*d+h*h;return c*(f*b-y*h)-l*(u*b-y*d)+p*(u*h-f*d)<0}function aG(e,t,n,r,i,o){let s=n-e,a=r-t,c=i-e,l=o-t,u=s*s+a*a,f=c*c+l*l,d=.5/(s*l-a*c),h=(l*u-a*f)*d,p=(s*f-c*u)*d;return h*h+p*p}function cG(e,t,n,r,i,o){let s=n-e,a=r-t,c=i-e,l=o-t,u=s*s+a*a,f=c*c+l*l,d=.5/(s*l-a*c),h=e+(l*u-a*f)*d,p=t+(s*f-c*u)*d;return{x:h,y:p}}function Cu(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;sp(e,i,o),t[e[n]]>t[e[r]]&&sp(e,n,r),t[e[o]]>t[e[r]]&&sp(e,o,r),t[e[n]]>t[e[o]]&&sp(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;sp(e,o,s)}e[n+1]=e[s],e[s]=a,r-o+1>=s-n?(Cu(e,t,o,r),Cu(e,t,n,s-1)):(Cu(e,t,n,s-1),Cu(e,t,o,r))}}function sp(e,t,n){let r=e[t];e[t]=e[n],e[n]=r}function lG(e){return e[0]}function uG(e){return e[1]}var si=class{constructor(){this._x0=this._y0=this._x1=this._y1=null,this._=""}moveTo(t,n){this._+=`M${this._x0=this._x1=+t},${this._y0=this._y1=+n}`}closePath(){this._x1!==null&&(this._x1=this._x0,this._y1=this._y0,this._+="Z")}lineTo(t,n){this._+=`L${this._x1=+t},${this._y1=+n}`}arc(t,n,r){t=+t,n=+n,r=+r;let i=t+r,o=n;if(r<0)throw new Error("negative radius");this._x1===null?this._+=`M${i},${o}`:(Math.abs(this._x1-i)>1e-6||Math.abs(this._y1-o)>1e-6)&&(this._+="L"+i+","+o),r&&(this._+=`A${r},${r},0,1,1,${t-r},${n}A${r},${r},0,1,1,${this._x1=i},${this._y1=o}`)}rect(t,n,r,i){this._+=`M${this._x0=this._x1=+t},${this._y0=this._y1=+n}h${+r}v${+i}h${-r}Z`}value(){return this._||null}};var La=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 ap=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 y=0,b=0,m=r.length,g,x;y<m;y+=3,b+=2){let _=r[y]*2,v=r[y+1]*2,w=r[y+2]*2,T=t[_],A=t[_+1],R=t[v],I=t[v+1],E=t[w],O=t[w+1],k=R-T,S=I-A,M=E-T,N=O-A,F=(k*N-S*M)*2;if(Math.abs(F)<1e-9){if(o===void 0){o=s=0;for(let C of n)o+=t[C*2],s+=t[C*2+1];o/=n.length,s/=n.length}let B=1e9*Math.sign((o-T)*N-(s-A)*M);g=(T+E)/2-B*N,x=(A+O)/2+B*M}else{let B=1/F,C=k*k+S*S,P=M*M+N*N;g=T+(N*C-S*P)*B,x=A+(k*P-M*C)*B}a[b]=g,a[b+1]=x}let c=n[n.length-1],l,u=c*4,f,d=t[2*c],h,p=t[2*c+1];i.fill(0);for(let y=0;y<n.length;++y)c=n[y],l=u,f=d,h=p,u=c*4,d=t[2*c],p=t[2*c+1],i[l+2]=i[u]=h-p,i[l+3]=i[u+1]=d-f}render(t){let n=t==null?t=new si:void 0,{delaunay:{halfedges:r,inedges:i,hull:o},circumcenters:s,vectors:a}=this;if(o.length<=1)return null;for(let u=0,f=r.length;u<f;++u){let d=r[u];if(d<u)continue;let h=Math.floor(u/3)*2,p=Math.floor(d/3)*2,y=s[h],b=s[h+1],m=s[p],g=s[p+1];this._renderSegment(y,b,m,g,t)}let c,l=o[o.length-1];for(let u=0;u<o.length;++u){c=l,l=o[u];let f=Math.floor(i[l]/3)*2,d=s[f],h=s[f+1],p=c*4,y=this._project(d,h,a[p+2],a[p+3]);y&&this._renderSegment(d,h,y[0],y[1],t)}return n&&n.value()}renderBounds(t){let n=t==null?t=new si:void 0;return t.rect(this.xmin,this.ymin,this.xmax-this.xmin,this.ymax-this.ymin),n&&n.value()}renderCell(t,n){let r=n==null?n=new si:void 0,i=this._clip(t);if(i===null||!i.length)return;n.moveTo(i[0],i[1]);let o=i.length;for(;i[0]===i[o-2]&&i[1]===i[o-1]&&o>1;)o-=2;for(let s=2;s<o;s+=2)(i[s]!==i[s-2]||i[s+1]!==i[s-1])&&n.lineTo(i[s],i[s+1]);return n.closePath(),r&&r.value()}*cellPolygons(){let{delaunay:{points:t}}=this;for(let n=0,r=t.length/2;n<r;++n){let i=this.cellPolygon(n);i&&(i.index=n,yield i)}}cellPolygon(t){let n=new La;return this.renderCell(t,n),n.value()}_renderSegment(t,n,r,i,o){let s,a=this._regioncode(t,n),c=this._regioncode(r,i);a===0&&c===0?(o.moveTo(t,n),o.lineTo(r,i)):(s=this._clipSegment(t,n,r,i,a,c))&&(o.moveTo(s[0],s[1]),o.lineTo(s[2],s[3]))}contains(t,n,r){return n=+n,n!==n||(r=+r,r!==r)?!1:this.delaunay._step(t,n,r)===t}*neighbors(t){let n=this._clip(t);if(n)for(let r of this.delaunay.neighbors(t)){let i=this._clip(r);if(i){t:for(let o=0,s=n.length;o<s;o+=2)for(let a=0,c=i.length;a<c;a+=2)if(n[o]===i[a]&&n[o+1]===i[a+1]&&n[(o+2)%s]===i[(a+c-2)%c]&&n[(o+3)%s]===i[(a+c-1)%c]){yield r;break t}}}}_cell(t){let{circumcenters:n,delaunay:{inedges:r,halfedges:i,triangles:o}}=this,s=r[t];if(s===-1)return null;let a=[],c=s;do{let l=Math.floor(c/3);if(a.push(n[l*2],n[l*2+1]),c=c%3===2?c-2:c+1,o[c]!==t)break;c=i[c]}while(c!==s&&c!==-1);return a}_clip(t){if(t===0&&this.delaunay.hull.length===1)return[this.xmax,this.ymin,this.xmax,this.ymax,this.xmin,this.ymax,this.xmin,this.ymin];let n=this._cell(t);if(n===null)return null;let{vectors:r}=this,i=t*4;return this._simplify(r[i]||r[i+1]?this._clipInfinite(t,n,r[i],r[i+1],r[i+2],r[i+3]):this._clipFinite(t,n))}_clipFinite(t,n){let r=n.length,i=null,o,s,a=n[r-2],c=n[r-1],l,u=this._regioncode(a,c),f,d=0;for(let h=0;h<r;h+=2)if(o=a,s=c,a=n[h],c=n[h+1],l=u,u=this._regioncode(a,c),l===0&&u===0)f=d,d=0,i?i.push(a,c):i=[a,c];else{let p,y,b,m,g;if(l===0){if((p=this._clipSegment(o,s,a,c,l,u))===null)continue;[y,b,m,g]=p}else{if((p=this._clipSegment(a,c,o,s,u,l))===null)continue;[m,g,y,b]=p,f=d,d=this._edgecode(y,b),f&&d&&this._edge(t,f,d,i,i.length),i?i.push(y,b):i=[y,b]}f=d,d=this._edgecode(m,g),f&&d&&this._edge(t,f,d,i,i.length),i?i.push(m,g):i=[m,g]}if(i)f=d,d=this._edgecode(i[0],i[1]),f&&d&&this._edge(t,f,d,i,i.length);else if(this.contains(t,(this.xmin+this.xmax)/2,(this.ymin+this.ymax)/2))return[this.xmax,this.ymin,this.xmax,this.ymax,this.xmin,this.ymax,this.xmin,this.ymin];return i}_clipSegment(t,n,r,i,o,s){let a=o<s;for(a&&([t,n,r,i,o,s]=[r,i,t,n,s,o]);;){if(o===0&&s===0)return a?[r,i,t,n]:[t,n,r,i];if(o&s)return null;let c,l,u=o||s;u&8?(c=t+(r-t)*(this.ymax-n)/(i-n),l=this.ymax):u&4?(c=t+(r-t)*(this.ymin-n)/(i-n),l=this.ymin):u&2?(l=n+(i-n)*(this.xmax-t)/(r-t),c=this.xmax):(l=n+(i-n)*(this.xmin-t)/(r-t),c=this.xmin),o?(t=c,n=l,o=this._regioncode(t,n)):(r=c,i=l,s=this._regioncode(r,i))}}_clipInfinite(t,n,r,i,o,s){let a=Array.from(n),c;if((c=this._project(a[0],a[1],r,i))&&a.unshift(c[0],c[1]),(c=this._project(a[a.length-2],a[a.length-1],o,s))&&a.push(c[0],c[1]),a=this._clipFinite(t,a))for(let l=0,u=a.length,f,d=this._edgecode(a[u-2],a[u-1]);l<u;l+=2)f=d,d=this._edgecode(a[l],a[l+1]),f&&d&&(l=this._edge(t,f,d,a,l),u=a.length);else this.contains(t,(this.xmin+this.xmax)/2,(this.ymin+this.ymax)/2)&&(a=[this.xmin,this.ymin,this.xmax,this.ymin,this.xmax,this.ymax,this.xmin,this.ymax]);return a}_edge(t,n,r,i,o){for(;n!==r;){let s,a;switch(n){case 5:n=4;continue;case 4:n=6,s=this.xmax,a=this.ymin;break;case 6:n=2;continue;case 2:n=10,s=this.xmax,a=this.ymax;break;case 10:n=8;continue;case 8:n=9,s=this.xmin,a=this.ymax;break;case 9:n=1;continue;case 1:n=5,s=this.xmin,a=this.ymin;break}(i[o]!==s||i[o+1]!==a)&&this.contains(t,s,a)&&(i.splice(o,0,s,a),o+=2)}return o}_project(t,n,r,i){let o=1/0,s,a,c;if(i<0){if(n<=this.ymin)return null;(s=(this.ymin-n)/i)<o&&(c=this.ymin,a=t+(o=s)*r)}else if(i>0){if(n>=this.ymax)return null;(s=(this.ymax-n)/i)<o&&(c=this.ymax,a=t+(o=s)*r)}if(r>0){if(t>=this.xmax)return null;(s=(this.xmax-t)/r)<o&&(a=this.xmax,c=n+(o=s)*i)}else if(r<0){if(t<=this.xmin)return null;(s=(this.xmin-t)/r)<o&&(a=this.xmin,c=n+(o=s)*i)}return[a,c]}_edgecode(t,n){return(t===this.xmin?1:t===this.xmax?2:0)|(n===this.ymin?4:n===this.ymax?8:0)}_regioncode(t,n){return(t<this.xmin?1:t>this.xmax?2:0)|(n<this.ymin?4:n>this.ymax?8:0)}_simplify(t){if(t&&t.length>4){for(let n=0;n<t.length;n+=2){let r=(n+2)%t.length,i=(n+4)%t.length;(t[n]===t[r]&&t[r]===t[i]||t[n+1]===t[r+1]&&t[r+1]===t[i+1])&&(t.splice(r,2),n-=2)}t.length||(t=null)}return t}};var fG=2*Math.PI,Pu=Math.pow;function dG(e){return e[0]}function hG(e){return e[1]}function pG(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 mG(e,t,n){return[e+Math.sin(e+t)*n,t+Math.cos(e-t)*n]}var ai=class e{static from(t,n=dG,r=hG,i){return new e("length"in t?yG(t,n,r,i):Float64Array.from(gG(t,n,r,i)))}constructor(t){this._delaunator=new Bu(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&&pG(t)){this.collinear=Int32Array.from({length:n.length/2},(d,h)=>h).sort((d,h)=>n[2*d]-n[2*h]||n[2*d+1]-n[2*h+1]);let c=this.collinear[0],l=this.collinear[this.collinear.length-1],u=[n[2*c],n[2*c+1],n[2*l],n[2*l+1]],f=1e-8*Math.hypot(u[3]-u[1],u[2]-u[0]);for(let d=0,h=n.length/2;d<h;++d){let p=mG(n[2*d],n[2*d+1],f);n[2*d]=p[0],n[2*d+1]=p[1]}this._delaunator=new Bu(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 ap(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=Pu(n-l[t*2],2)+Pu(r-l[t*2+1],2),d=i[t],h=d;do{let p=c[h],y=Pu(n-l[p*2],2)+Pu(r-l[p*2+1],2);if(y<f&&(f=y,u=p),h=h%3===2?h-2:h+1,c[h]!==t)break;if(h=a[h],h===-1){if(h=o[(s[t]+1)%o.length],h!==p&&Pu(n-l[h*2],2)+Pu(r-l[h*2+1],2)<f)return h;break}}while(h!==d);return u}render(t){let n=t==null?t=new si:void 0,{points:r,halfedges:i,triangles:o}=this;for(let s=0,a=i.length;s<a;++s){let c=i[s];if(c<s)continue;let l=o[s]*2,u=o[c]*2;t.moveTo(r[l],r[l+1]),t.lineTo(r[u],r[u+1])}return this.renderHull(t),n&&n.value()}renderPoints(t,n){n===void 0&&(!t||typeof t.moveTo!="function")&&(n=t,t=null),n=n==null?2:+n;let r=t==null?t=new si:void 0,{points:i}=this;for(let o=0,s=i.length;o<s;o+=2){let a=i[o],c=i[o+1];t.moveTo(a+n,c),t.arc(a,c,n,0,fG)}return r&&r.value()}renderHull(t){let n=t==null?t=new si:void 0,{hull:r,points:i}=this,o=r[0]*2,s=r.length;t.moveTo(i[o],i[o+1]);for(let a=1;a<s;++a){let c=2*r[a];t.lineTo(i[c],i[c+1])}return t.closePath(),n&&n.value()}hullPolygon(){let t=new La;return this.renderHull(t),t.value()}renderTriangle(t,n){let r=n==null?n=new si:void 0,{points:i,triangles:o}=this,s=o[t*=3]*2,a=o[t+1]*2,c=o[t+2]*2;return n.moveTo(i[s],i[s+1]),n.lineTo(i[a],i[a+1]),n.lineTo(i[c],i[c+1]),n.closePath(),r&&r.value()}*trianglePolygons(){let{triangles:t}=this;for(let n=0,r=t.length/3;n<r;++n)yield this.trianglePolygon(n)}trianglePolygon(t){let n=new La;return this.renderTriangle(t,n),n.value()}};function yG(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*gG(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 eF(e){return Math.abs(e=Math.round(e))>=1e21?e.toLocaleString("en").replace(/,/g,""):e.toString(10)}function nl(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 go(e){return e=nl(Math.abs(e)),e?e[1]:NaN}function nF(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 rF(e){return function(t){return t.replace(/[0-9]/g,function(n){return e[+n]})}}var bG=/^(?:(.)?([<>=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i;function bo(e){if(!(t=bG.exec(e)))throw new Error("invalid format: "+e);var t;return new ub({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]})}bo.prototype=ub.prototype;function ub(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+""}ub.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 iF(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 TS;function oF(e,t){var n=nl(e,t);if(!n)return e+"";var r=n[0],i=n[1],o=i-(TS=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")+nl(e,Math.max(0,t+o-1))[0]}function ES(e,t){var n=nl(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 MS={"%":(e,t)=>(e*100).toFixed(t),b:e=>Math.round(e).toString(2),c:e=>e+"",d:eF,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)=>ES(e*100,t),r:ES,s:oF,X:e=>Math.round(e).toString(16).toUpperCase(),x:e=>Math.round(e).toString(16)};function AS(e){return e}var sF=Array.prototype.map,aF=["y","z","a","f","p","n","\xB5","m","","k","M","G","T","P","E","Z","Y"];function cF(e){var t=e.grouping===void 0||e.thousands===void 0?AS:nF(sF.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?AS:rF(sF.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=bo(f);var d=f.fill,h=f.align,p=f.sign,y=f.symbol,b=f.zero,m=f.width,g=f.comma,x=f.precision,_=f.trim,v=f.type;v==="n"?(g=!0,v="g"):MS[v]||(x===void 0&&(x=12),_=!0,v="g"),(b||d==="0"&&h==="=")&&(b=!0,d="0",h="=");var w=y==="$"?n:y==="#"&&/[boxX]/.test(v)?"0"+v.toLowerCase():"",T=y==="$"?r:/[%p]/.test(v)?s:"",A=MS[v],R=/[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 I(E){var O=w,k=T,S,M,N;if(v==="c")k=A(E)+k,E="";else{E=+E;var F=E<0||1/E<0;if(E=isNaN(E)?c:A(Math.abs(E),x),_&&(E=iF(E)),F&&+E==0&&p!=="+"&&(F=!1),O=(F?p==="("?p:a:p==="-"||p==="("?"":p)+O,k=(v==="s"?aF[8+TS/3]:"")+k+(F&&p==="("?")":""),R){for(S=-1,M=E.length;++S<M;)if(N=E.charCodeAt(S),48>N||N>57){k=(N===46?i+E.slice(S+1):E.slice(S))+k,E=E.slice(0,S);break}}}g&&!b&&(E=t(E,1/0));var B=O.length+E.length+k.length,C=B<m?new Array(m-B+1).join(d):"";switch(g&&b&&(E=t(C+E,C.length?m-k.length:1/0),C=""),h){case"<":E=O+E+k+C;break;case"=":E=O+C+E+k;break;case"^":E=C.slice(0,B=C.length>>1)+O+E+k+C.slice(B);break;default:E=C+O+E+k;break}return o(E)}return I.toString=function(){return f+""},I}function u(f,d){var h=l((f=bo(f),f.type="f",f)),p=Math.max(-8,Math.min(8,Math.floor(go(d)/3)))*3,y=Math.pow(10,-p),b=aF[8+p/3];return function(m){return h(y*m)+b}}return{format:l,formatPrefix:u}}var fb,ci,db;NS({thousands:",",grouping:[3],currency:["$",""]});function NS(e){return fb=cF(e),ci=fb.format,db=fb.formatPrefix,fb}function RS(e){return Math.max(0,-go(Math.abs(e)))}function OS(e,t){return Math.max(0,Math.max(-8,Math.min(8,Math.floor(go(t)/3)))*3-go(Math.abs(e)))}function DS(e,t){return e=Math.abs(e),t=Math.abs(t)-e,Math.max(0,go(t)-go(e))+1}var J=1e-6,rl=1e-12,At=Math.PI,de=At/2,kS=At/4,cn=At*2,Ce=180/At,qt=At/180,Bt=Math.abs,li=Math.atan,We=Math.atan2,K=Math.cos,cp=Math.ceil,hb=Math.exp;var pb=Math.hypot,il=Math.log,mb=Math.pow,Q=Math.sin,Pn=Math.sign||function(e){return e>0?1:e<0?-1:0},he=Math.sqrt,Uu=Math.tan;function yb(e){return e>1?0:e<-1?At:Math.acos(e)}function ve(e){return e>1?de:e<-1?-de:Math.asin(e)}function Xe(){}function gb(e,t){e&&uF.hasOwnProperty(e.type)&&uF[e.type](e,t)}var lF={Feature:function(e,t){gb(e.geometry,t)},FeatureCollection:function(e,t){for(var n=e.features,r=-1,i=n.length;++r<i;)gb(n[r].geometry,t)}},uF={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){FS(e.coordinates,t,0)},MultiLineString:function(e,t){for(var n=e.coordinates,r=-1,i=n.length;++r<i;)FS(n[r],t,0)},Polygon:function(e,t){fF(e.coordinates,t)},MultiPolygon:function(e,t){for(var n=e.coordinates,r=-1,i=n.length;++r<i;)fF(n[r],t)},GeometryCollection:function(e,t){for(var n=e.geometries,r=-1,i=n.length;++r<i;)gb(n[r],t)}};function FS(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 fF(e,t){var n=-1,r=e.length;for(t.polygonStart();++n<r;)FS(e[n],t,1);t.polygonEnd()}function Cr(e,t){e&&lF.hasOwnProperty(e.type)?lF[e.type](e,t):gb(e,t)}function lp(e){return[We(e[1],e[0]),ve(e[2])]}function xo(e){var t=e[0],n=e[1],r=K(n);return[r*K(t),r*Q(t),Q(n)]}function up(e,t){return e[0]*t[0]+e[1]*t[1]+e[2]*t[2]}function $u(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 bb(e,t){e[0]+=t[0],e[1]+=t[1],e[2]+=t[2]}function fp(e,t){return[e[0]*t,e[1]*t,e[2]*t]}function dp(e){var t=he(e[0]*e[0]+e[1]*e[1]+e[2]*e[2]);e[0]/=t,e[1]/=t,e[2]/=t}var hp,xb,_b,wb,vb,Sb,Ib,Tb,LS,CS,BS,pF,mF,er,nr,rr,Ui={sphere:Xe,point:PS,lineStart:dF,lineEnd:hF,polygonStart:function(){Ui.lineStart=wG,Ui.lineEnd=vG},polygonEnd:function(){Ui.lineStart=dF,Ui.lineEnd=hF}};function PS(e,t){e*=qt,t*=qt;var n=K(t);pp(n*K(e),n*Q(e),Q(t))}function pp(e,t,n){++hp,_b+=(e-_b)/hp,wb+=(t-wb)/hp,vb+=(n-vb)/hp}function dF(){Ui.point=xG}function xG(e,t){e*=qt,t*=qt;var n=K(t);er=n*K(e),nr=n*Q(e),rr=Q(t),Ui.point=_G,pp(er,nr,rr)}function _G(e,t){e*=qt,t*=qt;var n=K(t),r=n*K(e),i=n*Q(e),o=Q(t),s=We(he((s=nr*o-rr*i)*s+(s=rr*r-er*o)*s+(s=er*i-nr*r)*s),er*r+nr*i+rr*o);xb+=s,Sb+=s*(er+(er=r)),Ib+=s*(nr+(nr=i)),Tb+=s*(rr+(rr=o)),pp(er,nr,rr)}function hF(){Ui.point=PS}function wG(){Ui.point=SG}function vG(){yF(pF,mF),Ui.point=PS}function SG(e,t){pF=e,mF=t,e*=qt,t*=qt,Ui.point=yF;var n=K(t);er=n*K(e),nr=n*Q(e),rr=Q(t),pp(er,nr,rr)}function yF(e,t){e*=qt,t*=qt;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=pb(s,a,c),u=ve(l),f=l&&-u/l;LS.add(f*s),CS.add(f*a),BS.add(f*c),xb+=u,Sb+=u*(er+(er=r)),Ib+=u*(nr+(nr=i)),Tb+=u*(rr+(rr=o)),pp(er,nr,rr)}function US(e){hp=xb=_b=wb=vb=Sb=Ib=Tb=0,LS=new In,CS=new In,BS=new In,Cr(e,Ui);var t=+LS,n=+CS,r=+BS,i=pb(t,n,r);return i<rl&&(t=Sb,n=Ib,r=Tb,xb<J&&(t=_b,n=wb,r=vb),i=pb(t,n,r),i<rl)?[NaN,NaN]:[We(n,t)*Ce,ve(r/i)*Ce]}function mp(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 $S(e,t){return Bt(e)>At&&(e-=Math.round(e/cn)*cn),[e,t]}$S.invert=$S;function zS(e,t,n){return(e%=cn)?t||n?mp(bF(e),xF(t,n)):bF(e):t||n?xF(t,n):$S}function gF(e){return function(t,n){return t+=e,Bt(t)>At&&(t-=Math.round(t/cn)*cn),[t,n]}}function bF(e){var t=gF(e);return t.invert=gF(-e),t}function xF(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,d=Q(c),h=d*n+u*r;return[We(f*i-h*o,u*n-d*r),ve(h*i+f*o)]}return s.invert=function(a,c){var l=K(c),u=K(a)*l,f=Q(a)*l,d=Q(c),h=d*i-f*o;return[We(f*i+d*o,u*n+h*r),ve(h*n-u*r)]},s}function _F(e){e=zS(e[0]*qt,e[1]*qt,e.length>2?e[2]*qt:0);function t(n){return n=e(n[0]*qt,n[1]*qt),n[0]*=Ce,n[1]*=Ce,n}return t.invert=function(n){return n=e.invert(n[0]*qt,n[1]*qt),n[0]*=Ce,n[1]*=Ce,n},t}function vF(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=wF(s,i),o=wF(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=lp([s,-a*K(u),-a*Q(u)]),e.point(l[0],l[1])}}function wF(e,t){t=xo(t),t[0]-=e,dp(t);var n=yb(-t[1]);return((-t[2]<0?-n:n)+cn-J)%cn}function Eb(){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 zu(e,t){return Bt(e[0]-t[0])<J&&Bt(e[1]-t[1])<J}function Mb(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 Ab(e,t,n,r,i){var o=[],s=[],a,c;if(e.forEach(function(p){if(!((y=p.length-1)<=0)){var y,b=p[0],m=p[y],g;if(zu(b,m)){if(!b[2]&&!m[2]){for(i.lineStart(),a=0;a<y;++a)i.point((b=p[a])[0],b[1]);i.lineEnd();return}m[0]+=2*J}o.push(g=new Mb(b,p,null,!0)),s.push(g.o=new Mb(b,null,g,!1)),o.push(g=new Mb(m,p,null,!1)),s.push(g.o=new Mb(m,null,g,!0))}}),!!o.length){for(s.sort(t),SF(o),SF(s),a=0,c=s.length;a<c;++a)s[a].e=n=!n;for(var l=o[0],u,f;;){for(var d=l,h=!0;d.v;)if((d=d.n)===l)return;u=d.z,i.lineStart();do{if(d.v=d.o.v=!0,d.e){if(h)for(a=0,c=u.length;a<c;++a)i.point((f=u[a])[0],f[1]);else r(d.x,d.n.x,1,i);d=d.n}else{if(h)for(u=d.p.z,a=u.length-1;a>=0;--a)i.point((f=u[a])[0],f[1]);else r(d.x,d.p.x,-1,i);d=d.p}d=d.o,u=d.z,h=!h}while(!d.v);i.lineEnd()}}}function SF(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 qS(e){return Bt(e[0])<=At?e[0]:Pn(e[0])*((Bt(e[0])+At)%cn-At)}function IF(e,t){var n=qS(t),r=t[1],i=Q(r),o=[Q(n),-K(n),0],s=0,a=0,c=new In;i===1?r=de+J:i===-1&&(r=-de-J);for(var l=0,u=e.length;l<u;++l)if(d=(f=e[l]).length)for(var f,d,h=f[d-1],p=qS(h),y=h[1]/2+kS,b=Q(y),m=K(y),g=0;g<d;++g,p=_,b=w,m=T,h=x){var x=f[g],_=qS(x),v=x[1]/2+kS,w=Q(v),T=K(v),A=_-p,R=A>=0?1:-1,I=R*A,E=I>At,O=b*w;if(c.add(We(O*R*Q(I),m*T+O*K(I))),s+=E?A+R*cn:A,E^p>=n^_>=n){var k=$u(xo(h),xo(x));dp(k);var S=$u(o,k);dp(S);var M=(E^A>=0?-1:1)*ve(S[2]);(r>M||r===M&&(k[0]||k[1]))&&(a+=E^A>=0?1:-1)}}return(s<-J||s<J&&c<-rl)^a&1}function Nb(e,t,n,r){return function(i){var o=t(i),s=Eb(),a=t(s),c=!1,l,u,f,d={point:h,lineStart:y,lineEnd:b,polygonStart:function(){d.point=m,d.lineStart=g,d.lineEnd=x,u=[],l=[]},polygonEnd:function(){d.point=h,d.lineStart=y,d.lineEnd=b,u=vu(u);var _=IF(l,r);u.length?(c||(i.polygonStart(),c=!0),Ab(u,TG,_,n,i)):_&&(c||(i.polygonStart(),c=!0),i.lineStart(),n(null,null,1,i),i.lineEnd()),c&&(i.polygonEnd(),c=!1),u=l=null},sphere:function(){i.polygonStart(),i.lineStart(),n(null,null,1,i),i.lineEnd(),i.polygonEnd()}};function h(_,v){e(_,v)&&i.point(_,v)}function p(_,v){o.point(_,v)}function y(){d.point=p,o.lineStart()}function b(){d.point=h,o.lineEnd()}function m(_,v){f.push([_,v]),a.point(_,v)}function g(){a.lineStart(),f=[]}function x(){m(f[0][0],f[0][1]),a.lineEnd();var _=a.clean(),v=s.result(),w,T=v.length,A,R,I;if(f.pop(),l.push(f),f=null,!!T){if(_&1){if(R=v[0],(A=R.length-1)>0){for(c||(i.polygonStart(),c=!0),i.lineStart(),w=0;w<A;++w)i.point((I=R[w])[0],I[1]);i.lineEnd()}return}T>1&&_&2&&v.push(v.pop().concat(v.shift())),u.push(v.filter(IG))}}return d}}function IG(e){return e.length>1}function TG(e,t){return((e=e.x)[0]<0?e[1]-de-J:de-e[1])-((t=t.x)[0]<0?t[1]-de-J:de-t[1])}var jS=Nb(function(){return!0},EG,AG,[-At,-de]);function EG(e){var t=NaN,n=NaN,r=NaN,i;return{lineStart:function(){e.lineStart(),i=1},point:function(o,s){var a=o>0?At:-At,c=Bt(o-t);Bt(c-At)<J?(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>=At&&(Bt(t-r)<J&&(t-=r*J),Bt(o-a)<J&&(o-=a*J),n=MG(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 MG(e,t,n,r){var i,o,s=Q(e-n);return Bt(s)>J?li((Q(t)*(o=K(r))*Q(n)-Q(r)*(i=K(t))*Q(e))/(i*o*s)):(t+r)/2}function AG(e,t,n,r){var i;if(e==null)i=n*de,r.point(-At,i),r.point(0,i),r.point(At,i),r.point(At,0),r.point(At,-i),r.point(0,-i),r.point(-At,-i),r.point(-At,0),r.point(-At,i);else if(Bt(e[0]-t[0])>J){var o=e[0]<t[0]?At:-At;i=n*o/2,r.point(-o,i),r.point(0,i),r.point(o,i)}else r.point(t[0],t[1])}function TF(e){var t=K(e),n=6*qt,r=t>0,i=Bt(t)>J;function o(u,f,d,h){vF(h,e,n,d,u,f)}function s(u,f){return K(u)*K(f)>t}function a(u){var f,d,h,p,y;return{lineStart:function(){p=h=!1,y=1},point:function(b,m){var g=[b,m],x,_=s(b,m),v=r?_?0:l(b,m):_?l(b+(b<0?At:-At),m):0;if(!f&&(p=h=_)&&u.lineStart(),_!==h&&(x=c(f,g),(!x||zu(f,x)||zu(g,x))&&(g[2]=1)),_!==h)y=0,_?(u.lineStart(),x=c(g,f),u.point(x[0],x[1])):(x=c(f,g),u.point(x[0],x[1],2),u.lineEnd()),f=x;else if(i&&f&&r^_){var w;!(v&d)&&(w=c(g,f,!0))&&(y=0,r?(u.lineStart(),u.point(w[0][0],w[0][1]),u.point(w[1][0],w[1][1]),u.lineEnd()):(u.point(w[1][0],w[1][1]),u.lineEnd(),u.lineStart(),u.point(w[0][0],w[0][1],3)))}_&&(!f||!zu(f,g))&&u.point(g[0],g[1]),f=g,h=_,d=v},lineEnd:function(){h&&u.lineEnd(),f=null},clean:function(){return y|(p&&h)<<1}}}function c(u,f,d){var h=xo(u),p=xo(f),y=[1,0,0],b=$u(h,p),m=up(b,b),g=b[0],x=m-g*g;if(!x)return!d&&u;var _=t*m/x,v=-t*g/x,w=$u(y,b),T=fp(y,_),A=fp(b,v);bb(T,A);var R=w,I=up(T,R),E=up(R,R),O=I*I-E*(up(T,T)-1);if(!(O<0)){var k=he(O),S=fp(R,(-I-k)/E);if(bb(S,T),S=lp(S),!d)return S;var M=u[0],N=f[0],F=u[1],B=f[1],C;N<M&&(C=M,M=N,N=C);var P=N-M,U=Bt(P-At)<J,$=U||P<J;if(!U&&B<F&&(C=F,F=B,B=C),$?U?F+B>0^S[1]<(Bt(S[0]-M)<J?F:B):F<=S[1]&&S[1]<=B:P>At^(M<=S[0]&&S[0]<=N)){var X=fp(R,(-I+k)/E);return bb(X,T),[S,lp(X)]}}}function l(u,f){var d=r?e:At-e,h=0;return u<-d?h|=1:u>d&&(h|=2),f<-d?h|=4:f>d&&(h|=8),h}return Nb(s,a,o,r?[0,-e]:[-At,e-At])}function EF(e,t,n,r,i,o){var s=e[0],a=e[1],c=t[0],l=t[1],u=0,f=1,d=c-s,h=l-a,p;if(p=n-s,!(!d&&p>0)){if(p/=d,d<0){if(p<u)return;p<f&&(f=p)}else if(d>0){if(p>f)return;p>u&&(u=p)}if(p=i-s,!(!d&&p<0)){if(p/=d,d<0){if(p>f)return;p>u&&(u=p)}else if(d>0){if(p<u)return;p<f&&(f=p)}if(p=r-a,!(!h&&p>0)){if(p/=h,h<0){if(p<u)return;p<f&&(f=p)}else if(h>0){if(p>f)return;p>u&&(u=p)}if(p=o-a,!(!h&&p<0)){if(p/=h,h<0){if(p>f)return;p>u&&(u=p)}else if(h>0){if(p<u)return;p<f&&(f=p)}return u>0&&(e[0]=s+u*d,e[1]=a+u*h),f<1&&(t[0]=s+f*d,t[1]=a+f*h),!0}}}}}var yp=1e9,Rb=-yp;function qu(e,t,n,r){function i(l,u){return e<=l&&l<=n&&t<=u&&u<=r}function o(l,u,f,d){var h=0,p=0;if(l==null||(h=s(l,f))!==(p=s(u,f))||c(l,u)<0^f>0)do d.point(h===0||h===3?e:n,h>1?r:t);while((h=(h+f+4)%4)!==p);else d.point(u[0],u[1])}function s(l,u){return Bt(l[0]-e)<J?u>0?0:3:Bt(l[0]-n)<J?u>0?2:1:Bt(l[1]-t)<J?u>0?1:0:u>0?3:2}function a(l,u){return c(l.x,u.x)}function c(l,u){var f=s(l,1),d=s(u,1);return f!==d?f-d:f===0?u[1]-l[1]:f===1?l[0]-u[0]:f===2?l[1]-u[1]:u[0]-l[0]}return function(l){var u=l,f=Eb(),d,h,p,y,b,m,g,x,_,v,w,T={point:A,lineStart:O,lineEnd:k,polygonStart:I,polygonEnd:E};function A(M,N){i(M,N)&&u.point(M,N)}function R(){for(var M=0,N=0,F=h.length;N<F;++N)for(var B=h[N],C=1,P=B.length,U=B[0],$,X,tt=U[0],nt=U[1];C<P;++C)$=tt,X=nt,U=B[C],tt=U[0],nt=U[1],X<=r?nt>r&&(tt-$)*(r-X)>(nt-X)*(e-$)&&++M:nt<=r&&(tt-$)*(r-X)<(nt-X)*(e-$)&&--M;return M}function I(){u=f,d=[],h=[],w=!0}function E(){var M=R(),N=w&&M,F=(d=vu(d)).length;(N||F)&&(l.polygonStart(),N&&(l.lineStart(),o(null,null,1,l),l.lineEnd()),F&&Ab(d,a,M,o,l),l.polygonEnd()),u=l,d=h=p=null}function O(){T.point=S,h&&h.push(p=[]),v=!0,_=!1,g=x=NaN}function k(){d&&(S(y,b),m&&_&&f.rejoin(),d.push(f.result())),T.point=A,_&&u.lineEnd()}function S(M,N){var F=i(M,N);if(h&&p.push([M,N]),v)y=M,b=N,m=F,v=!1,F&&(u.lineStart(),u.point(M,N));else if(F&&_)u.point(M,N);else{var B=[g=Math.max(Rb,Math.min(yp,g)),x=Math.max(Rb,Math.min(yp,x))],C=[M=Math.max(Rb,Math.min(yp,M)),N=Math.max(Rb,Math.min(yp,N))];EF(B,C,e,t,n,r)?(_||(u.lineStart(),u.point(B[0],B[1])),u.point(C[0],C[1]),F||u.lineEnd(),w=!1):F&&(u.lineStart(),u.point(M,N),w=!1)}g=M,x=N,_=F}return T}}function MF(e,t,n){var r=Ue(e,t-J,n).concat(t);return function(i){return r.map(function(o){return[i,o]})}}function AF(e,t,n){var r=Ue(e,t-J,n).concat(t);return function(i){return r.map(function(o){return[o,i]})}}function VS(){var e,t,n,r,i,o,s,a,c=10,l=c,u=90,f=360,d,h,p,y,b=2.5;function m(){return{type:"MultiLineString",coordinates:g()}}function g(){return Ue(cp(r/u)*u,n,u).map(p).concat(Ue(cp(a/f)*f,s,f).map(y)).concat(Ue(cp(t/c)*c,e,c).filter(function(x){return Bt(x%u)>J}).map(d)).concat(Ue(cp(o/l)*l,i,l).filter(function(x){return Bt(x%f)>J}).map(h))}return m.lines=function(){return g().map(function(x){return{type:"LineString",coordinates:x}})},m.outline=function(){return{type:"Polygon",coordinates:[p(r).concat(y(s).slice(1),p(n).reverse().slice(1),y(a).reverse().slice(1))]}},m.extent=function(x){return arguments.length?m.extentMajor(x).extentMinor(x):m.extentMinor()},m.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),m.precision(b)):[[r,a],[n,s]]},m.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),m.precision(b)):[[t,o],[e,i]]},m.step=function(x){return arguments.length?m.stepMajor(x).stepMinor(x):m.stepMinor()},m.stepMajor=function(x){return arguments.length?(u=+x[0],f=+x[1],m):[u,f]},m.stepMinor=function(x){return arguments.length?(c=+x[0],l=+x[1],m):[c,l]},m.precision=function(x){return arguments.length?(b=+x,d=MF(o,i,90),h=AF(t,e,b),p=MF(a,s,90),y=AF(r,n,b),m):b},m.extentMajor([[-180,-90+J],[180,90-J]]).extentMinor([[-180,-80-J],[180,80+J]])}function YS(){return VS()()}var gp=e=>e;var GS=new In,WS=new In,NF,RF,XS,HS,Ca={point:Xe,lineStart:Xe,lineEnd:Xe,polygonStart:function(){Ca.lineStart=NG,Ca.lineEnd=OG},polygonEnd:function(){Ca.lineStart=Ca.lineEnd=Ca.point=Xe,GS.add(Bt(WS)),WS=new In},result:function(){var e=GS/2;return GS=new In,e}};function NG(){Ca.point=RG}function RG(e,t){Ca.point=OF,NF=XS=e,RF=HS=t}function OF(e,t){WS.add(HS*e-XS*t),XS=e,HS=t}function OG(){OF(NF,RF)}var ZS=Ca;var ju=1/0,Ob=ju,bp=-ju,Db=bp,DG={point:kG,lineStart:Xe,lineEnd:Xe,polygonStart:Xe,polygonEnd:Xe,result:function(){var e=[[ju,Ob],[bp,Db]];return bp=Db=-(Ob=ju=1/0),e}};function kG(e,t){e<ju&&(ju=e),e>bp&&(bp=e),t<Ob&&(Ob=t),t>Db&&(Db=t)}var Vu=DG;var QS=0,KS=0,xp=0,kb=0,Fb=0,Yu=0,JS=0,tI=0,_p=0,FF,LF,_o,wo,$i={point:ol,lineStart:DF,lineEnd:kF,polygonStart:function(){$i.lineStart=CG,$i.lineEnd=BG},polygonEnd:function(){$i.point=ol,$i.lineStart=DF,$i.lineEnd=kF},result:function(){var e=_p?[JS/_p,tI/_p]:Yu?[kb/Yu,Fb/Yu]:xp?[QS/xp,KS/xp]:[NaN,NaN];return QS=KS=xp=kb=Fb=Yu=JS=tI=_p=0,e}};function ol(e,t){QS+=e,KS+=t,++xp}function DF(){$i.point=FG}function FG(e,t){$i.point=LG,ol(_o=e,wo=t)}function LG(e,t){var n=e-_o,r=t-wo,i=he(n*n+r*r);kb+=i*(_o+e)/2,Fb+=i*(wo+t)/2,Yu+=i,ol(_o=e,wo=t)}function kF(){$i.point=ol}function CG(){$i.point=PG}function BG(){CF(FF,LF)}function PG(e,t){$i.point=CF,ol(FF=_o=e,LF=wo=t)}function CF(e,t){var n=e-_o,r=t-wo,i=he(n*n+r*r);kb+=i*(_o+e)/2,Fb+=i*(wo+t)/2,Yu+=i,i=wo*e-_o*t,JS+=i*(_o+e),tI+=i*(wo+t),_p+=i*3,ol(_o=e,wo=t)}var eI=$i;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 rI=new In,nI,BF,PF,wp,vp,Cb={point:Xe,lineStart:function(){Cb.point=UG},lineEnd:function(){nI&&UF(BF,PF),Cb.point=Xe},polygonStart:function(){nI=!0},polygonEnd:function(){nI=null},result:function(){var e=+rI;return rI=new In,e}};function UG(e,t){Cb.point=UF,BF=wp=e,PF=vp=t}function UF(e,t){wp-=e,vp-=t,rI.add(he(wp*wp+vp*vp)),wp=e,vp=t}var iI=Cb;var $F,Bb,zF,qF,Gu=class{constructor(t){this._append=t==null?jF:$G(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!==zF||this._append!==Bb){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`,zF=r,Bb=this._append,qF=this._,this._=i}this._+=qF;break}}}result(){let t=this._;return this._="",t.length?t:null}};function jF(e){let t=1;this._+=e[0];for(let n=e.length;t<n;++t)this._+=arguments[t]+e[t]}function $G(e){let t=Math.floor(e);if(!(t>=0))throw new RangeError(`invalid digits: ${e}`);if(t>15)return jF;if(t!==$F){let n=10**t;$F=t,Bb=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 Bb}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)),Cr(a,i(o))),o.result()}return s.area=function(a){return Cr(a,i(ZS)),ZS.result()},s.measure=function(a){return Cr(a,i(iI)),iI.result()},s.bounds=function(a){return Cr(a,i(Vu)),Vu.result()},s.centroid=function(a){return Cr(a,i(eI)),eI.result()},s.projection=function(a){return arguments.length?(i=a==null?(e=null,gp):(e=a).stream,s):e},s.context=function(a){return arguments.length?(o=a==null?(t=null,new Gu(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 Gu(n)),s},s.projection(e).digits(n).context(t)}function sl(e){return{stream:Wu(e)}}function Wu(e){return function(t){var n=new oI;for(var r in e)n[r]=e[r];return n.stream=t,n}}function oI(){}oI.prototype={constructor:oI,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 sI(e,t,n){var r=e.clipExtent&&e.clipExtent();return e.scale(150).translate([0,0]),r!=null&&e.clipExtent(null),Cr(n,e.stream(Vu)),t(Vu.result()),r!=null&&e.clipExtent(r),e}function Sp(e,t,n){return sI(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 Pb(e,t,n){return Sp(e,[[0,0],t],n)}function Ub(e,t,n){return sI(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 $b(e,t,n){return sI(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 VF=16,zG=K(30*qt);function aI(e,t){return+t?jG(e,t):qG(e)}function qG(e){return Wu({point:function(t,n){t=e(t,n),this.stream.point(t[0],t[1])}})}function jG(e,t){function n(r,i,o,s,a,c,l,u,f,d,h,p,y,b){var m=l-r,g=u-i,x=m*m+g*g;if(x>4*t&&y--){var _=s+d,v=a+h,w=c+p,T=he(_*_+v*v+w*w),A=ve(w/=T),R=Bt(Bt(w)-1)<J||Bt(o-f)<J?(o+f)/2:We(v,_),I=e(R,A),E=I[0],O=I[1],k=E-r,S=O-i,M=g*k-m*S;(M*M/x>t||Bt((m*k+g*S)/x-.5)>.3||s*d+a*h+c*p<zG)&&(n(r,i,o,s,a,c,E,O,R,_/=T,v/=T,w,y,b),b.point(E,O),n(E,O,R,_,v,w,l,u,f,d,h,p,y,b))}}return function(r){var i,o,s,a,c,l,u,f,d,h,p,y,b={point:m,lineStart:g,lineEnd:_,polygonStart:function(){r.polygonStart(),b.lineStart=v},polygonEnd:function(){r.polygonEnd(),b.lineStart=g}};function m(A,R){A=e(A,R),r.point(A[0],A[1])}function g(){f=NaN,b.point=x,r.lineStart()}function x(A,R){var I=xo([A,R]),E=e(A,R);n(f,d,u,h,p,y,f=E[0],d=E[1],u=A,h=I[0],p=I[1],y=I[2],VF,r),r.point(f,d)}function _(){b.point=m,r.lineEnd()}function v(){g(),b.point=w,b.lineEnd=T}function w(A,R){x(i=A,R),o=f,s=d,a=h,c=p,l=y,b.point=x}function T(){n(f,d,u,h,p,y,o,s,i,a,c,l,VF,r),b.lineEnd=_,_()}return b}}var VG=Wu({point:function(e,t){this.stream.point(e*qt,t*qt)}});function YG(e){return Wu({point:function(t,n){var r=e(t,n);return this.stream.point(r[0],r[1])}})}function GG(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 YF(e,t,n,r,i,o){if(!o)return GG(e,t,n,r,i);var s=K(o),a=Q(o),c=s*e,l=a*e,u=s/e,f=a/e,d=(a*n-s*t)/e,h=(a*t+s*n)/e;function p(y,b){return y*=r,b*=i,[c*y-l*b+t,n-l*y-c*b]}return p.invert=function(y,b){return[r*(u*y-f*b+d),i*(h-f*y-u*b)]},p}function Nn(e){return cI(function(){return e})()}function cI(e){var t,n=150,r=480,i=250,o=0,s=0,a=0,c=0,l=0,u,f=0,d=1,h=1,p=null,y=jS,b=null,m,g,x,_=gp,v=.5,w,T,A,R,I;function E(M){return A(M[0]*qt,M[1]*qt)}function O(M){return M=A.invert(M[0],M[1]),M&&[M[0]*Ce,M[1]*Ce]}E.stream=function(M){return R&&I===M?R:R=VG(YG(u)(y(w(_(I=M)))))},E.preclip=function(M){return arguments.length?(y=M,p=void 0,S()):y},E.postclip=function(M){return arguments.length?(_=M,b=m=g=x=null,S()):_},E.clipAngle=function(M){return arguments.length?(y=+M?TF(p=M*qt):(p=null,jS),S()):p*Ce},E.clipExtent=function(M){return arguments.length?(_=M==null?(b=m=g=x=null,gp):qu(b=+M[0][0],m=+M[0][1],g=+M[1][0],x=+M[1][1]),S()):b==null?null:[[b,m],[g,x]]},E.scale=function(M){return arguments.length?(n=+M,k()):n},E.translate=function(M){return arguments.length?(r=+M[0],i=+M[1],k()):[r,i]},E.center=function(M){return arguments.length?(o=M[0]%360*qt,s=M[1]%360*qt,k()):[o*Ce,s*Ce]},E.rotate=function(M){return arguments.length?(a=M[0]%360*qt,c=M[1]%360*qt,l=M.length>2?M[2]%360*qt:0,k()):[a*Ce,c*Ce,l*Ce]},E.angle=function(M){return arguments.length?(f=M%360*qt,k()):f*Ce},E.reflectX=function(M){return arguments.length?(d=M?-1:1,k()):d<0},E.reflectY=function(M){return arguments.length?(h=M?-1:1,k()):h<0},E.precision=function(M){return arguments.length?(w=aI(T,v=M*M),S()):he(v)},E.fitExtent=function(M,N){return Sp(E,M,N)},E.fitSize=function(M,N){return Pb(E,M,N)},E.fitWidth=function(M,N){return Ub(E,M,N)},E.fitHeight=function(M,N){return $b(E,M,N)};function k(){var M=YF(n,0,0,d,h,f).apply(null,t(o,s)),N=YF(n,r-M[0],i-M[1],d,h,f);return u=zS(a,c,l),T=mp(t,N),A=mp(u,T),w=aI(T,v),S()}function S(){return R=I=null,E}return function(){return t=e.apply(this,arguments),E.invert=t.invert&&O,k()}}function Xu(e){var t=0,n=At/3,r=cI(e),i=r(t,n);return i.parallels=function(o){return arguments.length?r(t=o[0]*qt,n=o[1]*qt):[t*Ce,n*Ce]},i}function GF(e){var t=K(e);function n(r,i){return[r*t,Q(i)/t]}return n.invert=function(r,i){return[r/t,ve(i*t)]},n}function WF(e,t){var n=Q(e),r=(n+Q(t))/2;if(Bt(r)<J)return GF(e);var i=1+n*(2*r-n),o=he(i)/r;function s(a,c){var l=he(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=We(a,Bt(l))*Pn(l);return l*r<0&&(u-=At*Pn(a)*Pn(l)),[u/r,ve((i-(a*a+l*l)*r*r)/(2*r))]},s}function Ba(){return Xu(WF).scale(155.424).center([0,33.6442])}function Ip(){return Ba().parallels([29.5,45.5]).scale(1070).translate([480,250]).rotate([96,0]).center([-.6,38.7])}function WG(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 lI(){var e,t,n=Ip(),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(d,h){c=[d,h]}};function u(d){var h=d[0],p=d[1];return c=null,r.point(h,p),c||(o.point(h,p),c)||(a.point(h,p),c)}u.invert=function(d){var h=n.scale(),p=n.translate(),y=(d[0]-p[0])/h,b=(d[1]-p[1])/h;return(b>=.12&&b<.234&&y>=-.425&&y<-.214?i:b>=.166&&b<.234&&y>=-.214&&y<-.115?s:n).invert(d)},u.stream=function(d){return e&&t===d?e:e=WG([n.stream(t=d),i.stream(d),s.stream(d)])},u.precision=function(d){return arguments.length?(n.precision(d),i.precision(d),s.precision(d),f()):n.precision()},u.scale=function(d){return arguments.length?(n.scale(d),i.scale(d*.35),s.scale(d),u.translate(n.translate())):n.scale()},u.translate=function(d){if(!arguments.length)return n.translate();var h=n.scale(),p=+d[0],y=+d[1];return r=n.translate(d).clipExtent([[p-.455*h,y-.238*h],[p+.455*h,y+.238*h]]).stream(l),o=i.translate([p-.307*h,y+.201*h]).clipExtent([[p-.425*h+J,y+.12*h+J],[p-.214*h-J,y+.234*h-J]]).stream(l),a=s.translate([p-.205*h,y+.212*h]).clipExtent([[p-.214*h+J,y+.166*h+J],[p-.115*h-J,y+.234*h-J]]).stream(l),f()},u.fitExtent=function(d,h){return Sp(u,d,h)},u.fitSize=function(d,h){return Pb(u,d,h)},u.fitWidth=function(d,h){return Ub(u,d,h)},u.fitHeight=function(d,h){return $b(u,d,h)};function f(){return e=t=null,u}return u.scale(1070)}function zb(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 vo(e){return function(t,n){var r=he(t*t+n*n),i=e(r),o=Q(i),s=K(i);return[We(t*o,r*s),ve(r&&n*o/r)]}}var uI=zb(function(e){return he(2/(1+e))});uI.invert=vo(function(e){return 2*ve(e/2)});function fI(){return Nn(uI).scale(124.75).clipAngle(180-.001)}var dI=zb(function(e){return(e=yb(e))&&e/Q(e)});dI.invert=vo(function(e){return e});function hI(){return Nn(dI).scale(79.4188).clipAngle(180-.001)}function Hu(e,t){return[e,il(Uu((de+t)/2))]}Hu.invert=function(e,t){return[e,2*li(hb(t))-de]};function pI(){return mI(Hu).scale(961/cn)}function mI(e){var t=Nn(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=At*r(),d=t(_F(t.rotate()).invert([0,0]));return o(s==null?[[d[0]-f,d[1]-f],[d[0]+f,d[1]+f]]:e===Hu?[[Math.max(d[0]-f,s),a],[Math.min(d[0]+f,c),l]]:[[s,Math.max(d[1]-f,a)],[c,Math.min(d[1]+f,l)]])}return u()}function qb(e){return Uu((de+e)/2)}function XF(e,t){var n=K(e),r=e===t?Q(e):il(n/K(t))/il(qb(t)/qb(e)),i=n*mb(qb(e),r)/r;if(!r)return Hu;function o(s,a){i>0?a<-de+J&&(a=-de+J):a>de-J&&(a=de-J);var c=i/mb(qb(a),r);return[c*Q(r*s),i-c*K(r*s)]}return o.invert=function(s,a){var c=i-a,l=Pn(r)*he(s*s+c*c),u=We(s,Bt(c))*Pn(c);return c*r<0&&(u-=At*Pn(s)*Pn(c)),[u/r,2*li(mb(i/l,1/r))-de]},o}function yI(){return Xu(XF).scale(109.5).parallels([30,30])}function Zu(e,t){return[e,t]}Zu.invert=Zu;function gI(){return Nn(Zu).scale(152.63)}function HF(e,t){var n=K(e),r=e===t?Q(e):(n-K(t))/(t-e),i=n/r+e;if(Bt(r)<J)return Zu;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=We(s,Bt(c))*Pn(c);return c*r<0&&(l-=At*Pn(s)*Pn(c)),[l/r,i-Pn(r)*he(s*s+c*c)]},o}function bI(){return Xu(HF).scale(131.154).center([0,13.9389])}var Tp=1.340264,Ep=-.081106,Mp=893e-6,Ap=.003796,jb=he(3)/2,XG=12;function xI(e,t){var n=ve(jb*Q(t)),r=n*n,i=r*r*r;return[e*K(n)/(jb*(Tp+3*Ep*r+i*(7*Mp+9*Ap*r))),n*(Tp+Ep*r+i*(Mp+Ap*r))]}xI.invert=function(e,t){for(var n=t,r=n*n,i=r*r*r,o=0,s,a,c;o<XG&&(a=n*(Tp+Ep*r+i*(Mp+Ap*r))-t,c=Tp+3*Ep*r+i*(7*Mp+9*Ap*r),n-=s=a/c,r=n*n,i=r*r*r,!(Bt(s)<rl));++o);return[jb*e*(Tp+3*Ep*r+i*(7*Mp+9*Ap*r))/K(n),ve(Q(n)/jb)]};function _I(){return Nn(xI).scale(177.158)}function wI(e,t){var n=K(t),r=K(e)*n;return[n*Q(e)/r,Q(t)/r]}wI.invert=vo(li);function vI(){return Nn(wI).scale(144.049).clipAngle(60)}function SI(e,t){return[K(t)*Q(e),Q(t)]}SI.invert=vo(ve);function II(){return Nn(SI).scale(249.5).clipAngle(90+J)}function TI(e,t){var n=K(t),r=1+K(e)*n;return[n*Q(e)/r,Q(t)/r]}TI.invert=vo(function(e){return 2*li(e)});function EI(){return Nn(TI).scale(250).clipAngle(142)}function MI(e,t){return[il(Uu((de+t)/2)),-e]}MI.invert=function(e,t){return[-t,2*li(hb(e))-de]};function AI(){var e=mI(MI),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 HG(e,t){return e.parent===t.parent?1:2}function ZG(e){return e.reduce(QG,0)/e.length}function QG(e,t){return e+t.x}function KG(e){return 1+e.reduce(JG,0)}function JG(e,t){return Math.max(e,t.y)}function tW(e){for(var t;t=e.children;)e=t[0];return e}function eW(e){for(var t;t=e.children;)e=t[t.length-1];return e}function Vb(){var e=HG,t=1,n=1,r=!1;function i(o){var s,a=0;o.eachAfter(function(d){var h=d.children;h?(d.x=ZG(h),d.y=KG(h)):(d.x=s?a+=e(d,s):0,d.y=0,s=d)});var c=tW(o),l=eW(o),u=c.x-e(c,l)/2,f=l.x+e(l,c)/2;return o.eachAfter(r?function(d){d.x=(d.x-o.x)*t,d.y=(o.y-d.y)*n}:function(d){d.x=(d.x-u)/(f-u)*t,d.y=(1-(o.y?d.y/o.y:1))*n})}return i.separation=function(o){return arguments.length?(e=o,i):e},i.size=function(o){return arguments.length?(r=!1,t=+o[0],n=+o[1],i):r?null:[t,n]},i.nodeSize=function(o){return arguments.length?(r=!0,t=+o[0],n=+o[1],i):r?[t,n]:null},i}function nW(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 ZF(){return this.eachAfter(nW)}function QF(e,t){let n=-1;for(let r of this)e.call(t,r,++n,this);return this}function KF(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 JF(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 tL(e,t){let n=-1;for(let r of this)if(e.call(t,r,++n,this))return r}function eL(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 nL(e){return this.eachBefore(function(t){t.children&&t.children.sort(e)})}function rL(e){for(var t=this,n=rW(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 rW(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 iL(){for(var e=this,t=[e];e=e.parent;)t.push(e);return t}function oL(){return Array.from(this)}function sL(){var e=[];return this.eachBefore(function(t){t.children||e.push(t)}),e}function aL(){var e=this,t=[];return e.each(function(n){n!==e&&t.push({source:n.parent,target:n})}),t}function*cL(){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 NI(e,t){e instanceof Map?(e=[void 0,e],t===void 0&&(t=sW)):t===void 0&&(t=oW);for(var n=new Pa(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 Pa(s[a])),o.parent=r,o.depth=r.depth+1;return n.eachBefore(RI)}function iW(){return NI(this).eachBefore(aW)}function oW(e){return e.children}function sW(e){return Array.isArray(e)?e[1]:null}function aW(e){e.data.value!==void 0&&(e.value=e.data.value),e.data=e.data.data}function RI(e){var t=0;do e.height=t;while((e=e.parent)&&e.height<++t)}function Pa(e){this.data=e,this.depth=this.height=0,this.parent=null}Pa.prototype=NI.prototype={constructor:Pa,count:ZF,each:QF,eachAfter:JF,eachBefore:KF,find:tL,sum:eL,sort:nL,path:rL,ancestors:iL,descendants:oL,leaves:sL,links:aL,copy:iW,[Symbol.iterator]:cL};function Yb(e){return e==null?null:cW(e)}function cW(e){if(typeof e!="function")throw new Error;return e}var lW={depth:-1},lL={},OI={};function uW(e){return e.id}function fW(e){return e.parentId}function Gb(){var e=uW,t=fW,n;function r(i){var o=Array.from(i),s=e,a=t,c,l,u,f,d,h,p,y,b=new Map;if(n!=null){let m=o.map((_,v)=>dW(n(_,v,i))),g=m.map(uL),x=new Set(m).add("");for(let _ of g)x.has(_)||(x.add(_),m.push(_),g.push(uL(_)),o.push(OI));s=(_,v)=>m[v],a=(_,v)=>g[v]}for(u=0,c=o.length;u<c;++u)l=o[u],h=o[u]=new Pa(l),(p=s(l,u,i))!=null&&(p+="")&&(y=h.id=p,b.set(y,b.has(y)?lL:h)),(p=a(l,u,i))!=null&&(p+="")&&(h.parent=p);for(u=0;u<c;++u)if(h=o[u],p=h.parent){if(d=b.get(p),!d)throw new Error("missing: "+p);if(d===lL)throw new Error("ambiguous: "+p);d.children?d.children.push(h):d.children=[h],h.parent=d}else{if(f)throw new Error("multiple roots");f=h}if(!f)throw new Error("no root");if(n!=null){for(;f.data===OI&&f.children.length===1;)f=f.children[0],--c;for(let m=o.length-1;m>=0&&(h=o[m],h.data===OI);--m)h.data=null}if(f.parent=lW,f.eachBefore(function(m){m.depth=m.parent.depth+1,--c}).eachBefore(RI),f.parent=null,c>0)throw new Error("cycle");return f}return r.id=function(i){return arguments.length?(e=Yb(i),r):e},r.parentId=function(i){return arguments.length?(t=Yb(i),r):t},r.path=function(i){return arguments.length?(n=Yb(i),r):n},r}function dW(e){e=`${e}`;let t=e.length;return DI(e,t-1)&&!DI(e,t-2)&&(e=e.slice(0,-1)),e[0]==="/"?e:`/${e}`}function uL(e){let t=e.length;if(t<2)return"";for(;--t>1&&!DI(e,t););return e.slice(0,t)}function DI(e,t){if(e[t]==="/"){let n=0;for(;t>0&&e[--t]==="\\";)++n;if(!(n&1))return!0}return!1}function hW(e,t){return e.parent===t.parent?1:2}function kI(e){var t=e.children;return t?t[0]:e.t}function FI(e){var t=e.children;return t?t[t.length-1]:e.t}function pW(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 mW(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 yW(e,t,n){return e.a.parent===t.parent?e.a:n}function Wb(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}Wb.prototype=Object.create(Pa.prototype);function gW(e){for(var t=new Wb(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 Wb(o[s],s)),i.parent=n;return(t.parent=new Wb(null,0)).children=[t],t}function al(){var e=hW,t=1,n=1,r=null;function i(l){var u=gW(l);if(u.eachAfter(o),u.parent.m=-u.z,u.eachBefore(s),r)l.eachBefore(c);else{var f=l,d=l,h=l;l.eachBefore(function(g){g.x<f.x&&(f=g),g.x>d.x&&(d=g),g.depth>h.depth&&(h=g)});var p=f===d?1:e(f,d)/2,y=p-f.x,b=t/(d.x+p+y),m=n/(h.depth||1);l.eachBefore(function(g){g.x=(g.x+y)*b,g.y=g.depth*m})}return l}function o(l){var u=l.children,f=l.parent.children,d=l.i?f[l.i-1]:null;if(u){mW(l);var h=(u[0].z+u[u.length-1].z)/2;d?(l.z=d.z+e(l._,d._),l.m=l.z-h):l.z=h}else d&&(l.z=d.z+e(l._,d._));l.parent.A=a(l,d,l.parent.A||f[0])}function s(l){l._.x=l.z+l.parent.m,l.m+=l.parent.m}function a(l,u,f){if(u){for(var d=l,h=l,p=u,y=d.parent.children[0],b=d.m,m=h.m,g=p.m,x=y.m,_;p=FI(p),d=kI(d),p&&d;)y=kI(y),h=FI(h),h.a=l,_=p.z+g-d.z-b+e(p._,d._),_>0&&(pW(yW(p,l,f),l,_),b+=_,m+=_),g+=p.m,b+=d.m,x+=y.m,m+=h.m;p&&!FI(h)&&(h.t=p,h.m+=g-m),d&&!kI(y)&&(y.t=d,y.m+=b-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 fL=23283064365386963e-26;function cl(e=Math.random()){let t=(0<=e&&e<1?e/fL:Math.abs(e))|0;return()=>(t=1664525*t+1013904223|0,fL*(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 Np(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 Rp=Symbol("implicit");function ll(){var e=new Hn,t=[],n=[],r=Rp;function i(o){let s=e.get(o);if(s===void 0){if(r!==Rp)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 Hn;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 ll(t,n).unknown(r)},He.apply(i,arguments),i}function Ua(){var e=ll().unknown(void 0),t=e.domain,n=e.range,r=0,i=1,o,s,a=!1,c=0,l=0,u=.5;delete e.unknown;function f(){var d=t().length,h=i<r,p=h?i:r,y=h?r:i;o=(y-p)/Math.max(1,d-c+l*2),a&&(o=Math.floor(o)),p+=(y-p-o*(d-c))*u,s=o*(1-c),a&&(p=Math.round(p),s=Math.round(s));var b=Ue(d).map(function(m){return p+o*m});return n(h?b.reverse():b)}return e.domain=function(d){return arguments.length?(t(d),f()):t()},e.range=function(d){return arguments.length?([r,i]=d,r=+r,i=+i,f()):[r,i]},e.rangeRound=function(d){return[r,i]=d,r=+r,i=+i,a=!0,f()},e.bandwidth=function(){return s},e.step=function(){return o},e.round=function(d){return arguments.length?(a=!!d,f()):a},e.padding=function(d){return arguments.length?(c=Math.min(1,l=+d),f()):c},e.paddingInner=function(d){return arguments.length?(c=Math.min(1,d),f()):c},e.paddingOuter=function(d){return arguments.length?(l=+d,f()):l},e.align=function(d){return arguments.length?(u=Math.max(0,Math.min(1,d)),f()):u},e.copy=function(){return Ua(t(),[r,i]).round(a).paddingInner(c).paddingOuter(l).align(u)},He.apply(f(),arguments)}function dL(e){var t=e.copy;return e.padding=e.paddingOuter,delete e.paddingInner,delete e.paddingOuter,e.copy=function(){return dL(t())},e}function LI(){return dL(Ua.apply(null,arguments).paddingInner(1))}function CI(e){return function(){return e}}function Qu(e){return+e}var hL=[0,1];function gr(e){return e}function BI(e,t){return(t-=e=+e)?function(n){return(n-e)/t}:CI(isNaN(t)?NaN:.5)}function bW(e,t){var n;return e>t&&(n=e,e=t,t=n),function(r){return Math.max(e,Math.min(t,r))}}function xW(e,t,n){var r=e[0],i=e[1],o=t[0],s=t[1];return i<r?(r=BI(i,r),o=n(s,o)):(r=BI(r,i),o=n(o,s)),function(a){return o(r(a))}}function _W(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]=BI(e[s],e[s+1]),o[s]=n(t[s],t[s+1]);return function(a){var c=ws(e,a,1,r)-1;return o[c](i[c](a))}}function So(e,t){return t.domain(e.domain()).range(e.range()).interpolate(e.interpolate()).clamp(e.clamp()).unknown(e.unknown())}function ul(){var e=hL,t=hL,n=Lr,r,i,o,s=gr,a,c,l;function u(){var d=Math.min(e.length,t.length);return s!==gr&&(s=bW(e[0],e[d-1])),a=d>2?_W:xW,c=l=null,f}function f(d){return d==null||isNaN(d=+d)?o:(c||(c=a(e.map(r),t,n)))(r(s(d)))}return f.invert=function(d){return s(i((l||(l=a(t,e.map(r),we)))(d)))},f.domain=function(d){return arguments.length?(e=Array.from(d,Qu),u()):e.slice()},f.range=function(d){return arguments.length?(t=Array.from(d),u()):t.slice()},f.rangeRound=function(d){return t=Array.from(d),n=Qc,u()},f.clamp=function(d){return arguments.length?(s=d?!0:gr,u()):s!==gr},f.interpolate=function(d){return arguments.length?(n=d,u()):n},f.unknown=function(d){return arguments.length?(o=d,f):o},function(d,h){return r=d,i=h,u()}}function Op(){return ul()(gr,gr)}function PI(e,t,n,r){var i=_u(e,t,n),o;switch(r=bo(r??",f"),r.type){case"s":{var s=Math.max(Math.abs(e),Math.abs(t));return r.precision==null&&!isNaN(o=OS(i,s))&&(r.precision=o),db(r,s)}case"":case"e":case"g":case"p":case"r":{r.precision==null&&!isNaN(o=DS(i,Math.max(Math.abs(e),Math.abs(t))))&&(r.precision=o-(r.type==="e"));break}case"f":case"%":{r.precision==null&&!isNaN(o=RS(i))&&(r.precision=o-(r.type==="%")*2);break}}return ci(r)}function Ds(e){var t=e.domain;return e.ticks=function(n){var r=t();return Tn(r[0],r[r.length-1],n??10)},e.tickFormat=function(n,r){var i=t();return PI(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=vs(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 ks(){var e=Op();return e.copy=function(){return So(e,ks())},He.apply(e,arguments),Ds(e)}function Dp(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,Qu),n):e.slice()},n.unknown=function(r){return arguments.length?(t=r,n):t},n.copy=function(){return Dp(e).unknown(t)},e=arguments.length?Array.from(e,Qu):[0,1],Ds(n)}function kp(e,t){e=e.slice();var n=0,r=e.length-1,i=e[n],o=e[r],s;return o<i&&(s=n,n=r,r=s,s=i,i=o,o=s),e[n]=t.floor(i),e[r]=t.ceil(o),e}function pL(e){return Math.log(e)}function mL(e){return Math.exp(e)}function wW(e){return-Math.log(-e)}function vW(e){return-Math.exp(-e)}function SW(e){return isFinite(e)?+("1e"+e):e<0?0:e}function IW(e){return e===10?SW:e===Math.E?Math.exp:t=>Math.pow(e,t)}function TW(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 yL(e){return(t,n)=>-e(-t,n)}function UI(e){let t=e(pL,mL),n=t.domain,r=10,i,o;function s(){return i=TW(r),o=IW(r),n()[0]<0?(i=yL(i),o=yL(o),e(wW,vW)):e(pL,mL),t}return t.base=function(a){return arguments.length?(r=+a,s()):r},t.domain=function(a){return arguments.length?(n(a),s()):n()},t.ticks=a=>{let c=n(),l=c[0],u=c[c.length-1],f=u<l;f&&([l,u]=[u,l]);let d=i(l),h=i(u),p,y,b=a==null?10:+a,m=[];if(!(r%1)&&h-d<b){if(d=Math.floor(d),h=Math.ceil(h),l>0){for(;d<=h;++d)for(p=1;p<r;++p)if(y=d<0?p/o(-d):p*o(d),!(y<l)){if(y>u)break;m.push(y)}}else for(;d<=h;++d)for(p=r-1;p>=1;--p)if(y=d>0?p/o(-d):p*o(d),!(y<l)){if(y>u)break;m.push(y)}m.length*2<b&&(m=Tn(l,u,b))}else m=Tn(d,h,Math.min(h-d,b)).map(o);return f?m.reverse():m},t.tickFormat=(a,c)=>{if(a==null&&(a=10),c==null&&(c=r===10?"s":","),typeof c!="function"&&(!(r%1)&&(c=bo(c)).precision==null&&(c.trim=!0),c=ci(c)),a===1/0)return c;let l=Math.max(1,r*a/t.ticks().length);return u=>{let f=u/o(Math.round(i(u)));return f*r<r-.5&&(f*=r),f<=l?c(u):""}},t.nice=()=>n(kp(n(),{floor:a=>o(Math.floor(i(a))),ceil:a=>o(Math.ceil(i(a)))})),t}function Fp(){let e=UI(ul()).domain([1,10]);return e.copy=()=>So(e,Fp()).base(e.base()),He.apply(e,arguments),e}function gL(e){return function(t){return Math.sign(t)*Math.log1p(Math.abs(t/e))}}function bL(e){return function(t){return Math.sign(t)*Math.expm1(Math.abs(t))*e}}function $I(e){var t=1,n=e(gL(t),bL(t));return n.constant=function(r){return arguments.length?e(gL(t=+r),bL(t)):t},Ds(n)}function Lp(){var e=$I(ul());return e.copy=function(){return So(e,Lp()).constant(e.constant())},He.apply(e,arguments)}function xL(e){return function(t){return t<0?-Math.pow(-t,e):Math.pow(t,e)}}function EW(e){return e<0?-Math.sqrt(-e):Math.sqrt(e)}function MW(e){return e<0?-e*e:e*e}function zI(e){var t=e(gr,gr),n=1;function r(){return n===1?e(gr,gr):n===.5?e(EW,MW):e(xL(n),xL(1/n))}return t.exponent=function(i){return arguments.length?(n=+i,r()):n},Ds(t)}function Cp(){var e=zI(ul());return e.copy=function(){return So(e,Cp()).exponent(e.exponent())},He.apply(e,arguments),e}function Bp(){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]=$2(e,s/a);return o}function o(s){return s==null||isNaN(s=+s)?r:t[ws(n,s)]}return o.invertExtent=function(s){var a=t.indexOf(s);return a<0?[NaN,NaN]:[a>0?n[a-1]:e[0],a<n.length?n[a]:e[e.length-1]]},o.domain=function(s){if(!arguments.length)return e.slice();e=[];for(let a of s)a!=null&&!isNaN(a=+a)&&e.push(a);return e.sort(Gt),i()},o.range=function(s){return arguments.length?(t=Array.from(s),i()):t.slice()},o.unknown=function(s){return arguments.length?(r=s,o):r},o.quantiles=function(){return n.slice()},o.copy=function(){return Bp().domain(e).range(t).unknown(r)},He.apply(o,arguments)}function Pp(){var e=[.5],t=[0,1],n,r=1;function i(o){return o!=null&&o<=o?t[ws(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 Pp().domain(e).range(t).unknown(n)},He.apply(i,arguments)}var qI=new Date,jI=new Date;function pe(e,t,n,r){function i(o){return e(o=arguments.length===0?new Date:new Date(+o)),o}return i.floor=o=>(e(o=new Date(+o)),o),i.ceil=o=>(e(o=new Date(o-1)),t(o,1),e(o),o),i.round=o=>{let s=i(o),a=i.ceil(o);return o-s<a-o?s:a},i.offset=(o,s)=>(t(o=new Date(+o),s==null?1:Math.floor(s)),o),i.range=(o,s,a)=>{let c=[];if(o=i.ceil(o),a=a==null?1:Math.floor(a),!(o<s)||!(a>0))return c;let l;do c.push(l=new Date(+o)),t(o,a),e(o);while(l<o&&o<s);return c},i.filter=o=>pe(s=>{if(s>=s)for(;e(s),!o(s);)s.setTime(s-1)},(s,a)=>{if(s>=s)if(a<0)for(;++a<=0;)for(;t(s,-1),!o(s););else for(;--a>=0;)for(;t(s,1),!o(s););}),n&&(i.count=(o,s)=>(qI.setTime(+o),jI.setTime(+s),e(qI),e(jI),Math.floor(n(qI,jI))),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 Up=pe(()=>{},(e,t)=>{e.setTime(+e+t)},(e,t)=>t-e);Up.every=e=>(e=Math.floor(e),!isFinite(e)||!(e>0)?null:e>1?pe(t=>{t.setTime(Math.floor(t/e)*e)},(t,n)=>{t.setTime(+t+n*e)},(t,n)=>(n-t)/e):Up);var sMt=Up.range;var ln=pe(e=>{e.setTime(e-e.getMilliseconds())},(e,t)=>{e.setTime(+e+t*1e3)},(e,t)=>(t-e)/1e3,e=>e.getUTCSeconds()),_L=ln.range;var Fs=pe(e=>{e.setTime(e-e.getMilliseconds()-e.getSeconds()*1e3)},(e,t)=>{e.setTime(+e+t*6e4)},(e,t)=>(t-e)/6e4,e=>e.getMinutes()),AW=Fs.range,Ls=pe(e=>{e.setUTCSeconds(0,0)},(e,t)=>{e.setTime(+e+t*6e4)},(e,t)=>(t-e)/6e4,e=>e.getUTCMinutes()),NW=Ls.range;var Cs=pe(e=>{e.setTime(e-e.getMilliseconds()-e.getSeconds()*1e3-e.getMinutes()*6e4)},(e,t)=>{e.setTime(+e+t*36e5)},(e,t)=>(t-e)/36e5,e=>e.getHours()),RW=Cs.range,Bs=pe(e=>{e.setUTCMinutes(0,0,0)},(e,t)=>{e.setTime(+e+t*36e5)},(e,t)=>(t-e)/36e5,e=>e.getUTCHours()),OW=Bs.range;var ui=pe(e=>e.setHours(0,0,0,0),(e,t)=>e.setDate(e.getDate()+t),(e,t)=>(t-e-(t.getTimezoneOffset()-e.getTimezoneOffset())*6e4)/864e5,e=>e.getDate()-1),DW=ui.range,hl=pe(e=>{e.setUTCHours(0,0,0,0)},(e,t)=>{e.setUTCDate(e.getUTCDate()+t)},(e,t)=>(t-e)/864e5,e=>e.getUTCDate()-1),kW=hl.range,pl=pe(e=>{e.setUTCHours(0,0,0,0)},(e,t)=>{e.setUTCDate(e.getUTCDate()+t)},(e,t)=>(t-e)/864e5,e=>Math.floor(e/864e5)),FW=pl.range;function ml(e){return pe(t=>{t.setDate(t.getDate()-(t.getDay()+7-e)%7),t.setHours(0,0,0,0)},(t,n)=>{t.setDate(t.getDate()+n*7)},(t,n)=>(n-t-(n.getTimezoneOffset()-t.getTimezoneOffset())*6e4)/6048e5)}var Br=ml(0),$a=ml(1),Xb=ml(2),Hb=ml(3),To=ml(4),Zb=ml(5),Qb=ml(6),vL=Br.range,LW=$a.range,CW=Xb.range,BW=Hb.range,PW=To.range,UW=Zb.range,$W=Qb.range;function yl(e){return pe(t=>{t.setUTCDate(t.getUTCDate()-(t.getUTCDay()+7-e)%7),t.setUTCHours(0,0,0,0)},(t,n)=>{t.setUTCDate(t.getUTCDate()+n*7)},(t,n)=>(n-t)/6048e5)}var Pr=yl(0),za=yl(1),Kb=yl(2),Jb=yl(3),Eo=yl(4),tx=yl(5),ex=yl(6),SL=Pr.range,zW=za.range,qW=Kb.range,jW=Jb.range,VW=Eo.range,YW=tx.range,GW=ex.range;var Ps=pe(e=>{e.setDate(1),e.setHours(0,0,0,0)},(e,t)=>{e.setMonth(e.getMonth()+t)},(e,t)=>t.getMonth()-e.getMonth()+(t.getFullYear()-e.getFullYear())*12,e=>e.getMonth()),WW=Ps.range,Us=pe(e=>{e.setUTCDate(1),e.setUTCHours(0,0,0,0)},(e,t)=>{e.setUTCMonth(e.getUTCMonth()+t)},(e,t)=>t.getUTCMonth()-e.getUTCMonth()+(t.getUTCFullYear()-e.getUTCFullYear())*12,e=>e.getUTCMonth()),XW=Us.range;var Un=pe(e=>{e.setMonth(0,1),e.setHours(0,0,0,0)},(e,t)=>{e.setFullYear(e.getFullYear()+t)},(e,t)=>t.getFullYear()-e.getFullYear(),e=>e.getFullYear());Un.every=e=>!isFinite(e=Math.floor(e))||!(e>0)?null:pe(t=>{t.setFullYear(Math.floor(t.getFullYear()/e)*e),t.setMonth(0,1),t.setHours(0,0,0,0)},(t,n)=>{t.setFullYear(t.getFullYear()+n*e)});var HW=Un.range,$n=pe(e=>{e.setUTCMonth(0,1),e.setUTCHours(0,0,0,0)},(e,t)=>{e.setUTCFullYear(e.getUTCFullYear()+t)},(e,t)=>t.getUTCFullYear()-e.getUTCFullYear(),e=>e.getUTCFullYear());$n.every=e=>!isFinite(e=Math.floor(e))||!(e>0)?null:pe(t=>{t.setUTCFullYear(Math.floor(t.getUTCFullYear()/e)*e),t.setUTCMonth(0,1),t.setUTCHours(0,0,0,0)},(t,n)=>{t.setUTCFullYear(t.getUTCFullYear()+n*e)});var ZW=$n.range;function TL(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 d=u<l;d&&([l,u]=[u,l]);let h=f&&typeof f.range=="function"?f:c(l,u,f),p=h?h.range(l,+u+1):[];return d?p.reverse():p}function c(l,u,f){let d=Math.abs(u-l)/f,h=_s(([,,b])=>b).right(s,d);if(h===s.length)return e.every(_u(l/31536e6,u/31536e6,f));if(h===0)return Up.every(Math.max(_u(l,u,f),1));let[p,y]=s[d/s[h-1][2]<s[h][2]/d?h-1:h];return p.every(y)}return[a,c]}var[VI,zp]=TL($n,Us,Pr,pl,Bs,Ls),[YI,GI]=TL(Un,Ps,Br,ui,Cs,Fs);function WI(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 XI(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 qp(e,t,n){return{y:e,m:t,d:n,H:0,M:0,S:0,L:0}}function HI(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=jp(i),u=Vp(i),f=jp(o),d=Vp(o),h=jp(s),p=Vp(s),y=jp(a),b=Vp(a),m=jp(c),g=Vp(c),x={a:F,A:B,b:C,B:P,c:null,d:OL,e:OL,f:_X,g:RX,G:DX,H:gX,I:bX,j:xX,L:CL,m:wX,M:vX,p:U,q:$,Q:FL,s:LL,S:SX,u:IX,U:TX,V:EX,w:MX,W:AX,x:null,X:null,y:NX,Y:OX,Z:kX,"%":kL},_={a:X,A:tt,b:nt,B:st,c:null,d:DL,e:DL,f:BX,g:WX,G:HX,H:FX,I:LX,j:CX,L:PL,m:PX,M:UX,p:Y,q:rt,Q:FL,s:LL,S:$X,u:zX,U:qX,V:jX,w:VX,W:YX,x:null,X:null,y:GX,Y:XX,Z:ZX,"%":kL},v={a:I,A:E,b:O,B:k,c:S,d:NL,e:NL,f:hX,g:AL,G:ML,H:RL,I:RL,j:lX,L:dX,m:cX,M:uX,p:R,q:aX,Q:mX,s:yX,S:fX,u:nX,U:rX,V:iX,w:eX,W:oX,x:M,X:N,y:AL,Y:ML,Z:sX,"%":pX};x.x=w(n,x),x.X=w(r,x),x.c=w(t,x),_.x=w(n,_),_.X=w(r,_),_.c=w(t,_);function w(q,H){return function(ot){var z=[],Lt=-1,dt=0,Wt=q.length,Xt,et,oe;for(ot instanceof Date||(ot=new Date(+ot));++Lt<Wt;)q.charCodeAt(Lt)===37&&(z.push(q.slice(dt,Lt)),(et=EL[Xt=q.charAt(++Lt)])!=null?Xt=q.charAt(++Lt):et=Xt==="e"?" ":"0",(oe=H[Xt])&&(Xt=oe(ot,et)),z.push(Xt),dt=Lt+1);return z.push(q.slice(dt,Lt)),z.join("")}}function T(q,H){return function(ot){var z=qp(1900,void 0,1),Lt=A(z,q,ot+="",0),dt,Wt;if(Lt!=ot.length)return null;if("Q"in z)return new Date(z.Q);if("s"in z)return new Date(z.s*1e3+("L"in z?z.L:0));if(H&&!("Z"in z)&&(z.Z=0),"p"in z&&(z.H=z.H%12+z.p*12),z.m===void 0&&(z.m="q"in z?z.q:0),"V"in z){if(z.V<1||z.V>53)return null;"w"in z||(z.w=1),"Z"in z?(dt=XI(qp(z.y,0,1)),Wt=dt.getUTCDay(),dt=Wt>4||Wt===0?za.ceil(dt):za(dt),dt=hl.offset(dt,(z.V-1)*7),z.y=dt.getUTCFullYear(),z.m=dt.getUTCMonth(),z.d=dt.getUTCDate()+(z.w+6)%7):(dt=WI(qp(z.y,0,1)),Wt=dt.getDay(),dt=Wt>4||Wt===0?$a.ceil(dt):$a(dt),dt=ui.offset(dt,(z.V-1)*7),z.y=dt.getFullYear(),z.m=dt.getMonth(),z.d=dt.getDate()+(z.w+6)%7)}else("W"in z||"U"in z)&&("w"in z||(z.w="u"in z?z.u%7:"W"in z?1:0),Wt="Z"in z?XI(qp(z.y,0,1)).getUTCDay():WI(qp(z.y,0,1)).getDay(),z.m=0,z.d="W"in z?(z.w+6)%7+z.W*7-(Wt+5)%7:z.w+z.U*7-(Wt+6)%7);return"Z"in z?(z.H+=z.Z/100|0,z.M+=z.Z%100,XI(z)):WI(z)}}function A(q,H,ot,z){for(var Lt=0,dt=H.length,Wt=ot.length,Xt,et;Lt<dt;){if(z>=Wt)return-1;if(Xt=H.charCodeAt(Lt++),Xt===37){if(Xt=H.charAt(Lt++),et=v[Xt in EL?H.charAt(Lt++):Xt],!et||(z=et(q,ot,z))<0)return-1}else if(Xt!=ot.charCodeAt(z++))return-1}return z}function R(q,H,ot){var z=l.exec(H.slice(ot));return z?(q.p=u.get(z[0].toLowerCase()),ot+z[0].length):-1}function I(q,H,ot){var z=h.exec(H.slice(ot));return z?(q.w=p.get(z[0].toLowerCase()),ot+z[0].length):-1}function E(q,H,ot){var z=f.exec(H.slice(ot));return z?(q.w=d.get(z[0].toLowerCase()),ot+z[0].length):-1}function O(q,H,ot){var z=m.exec(H.slice(ot));return z?(q.m=g.get(z[0].toLowerCase()),ot+z[0].length):-1}function k(q,H,ot){var z=y.exec(H.slice(ot));return z?(q.m=b.get(z[0].toLowerCase()),ot+z[0].length):-1}function S(q,H,ot){return A(q,t,H,ot)}function M(q,H,ot){return A(q,n,H,ot)}function N(q,H,ot){return A(q,r,H,ot)}function F(q){return s[q.getDay()]}function B(q){return o[q.getDay()]}function C(q){return c[q.getMonth()]}function P(q){return a[q.getMonth()]}function U(q){return i[+(q.getHours()>=12)]}function $(q){return 1+~~(q.getMonth()/3)}function X(q){return s[q.getUTCDay()]}function tt(q){return o[q.getUTCDay()]}function nt(q){return c[q.getUTCMonth()]}function st(q){return a[q.getUTCMonth()]}function Y(q){return i[+(q.getUTCHours()>=12)]}function rt(q){return 1+~~(q.getUTCMonth()/3)}return{format:function(q){var H=w(q+="",x);return H.toString=function(){return q},H},parse:function(q){var H=T(q+="",!1);return H.toString=function(){return q},H},utcFormat:function(q){var H=w(q+="",_);return H.toString=function(){return q},H},utcParse:function(q){var H=T(q+="",!0);return H.toString=function(){return q},H}}}var EL={"-":"",_:" ",0:"0"},un=/^\s*\d+/,KW=/^%/,JW=/[\\^$*+?|[\]().{}]/g;function te(e,t,n){var r=e<0?"-":"",i=(r?-e:e)+"",o=i.length;return r+(o<n?new Array(n-o+1).join(t)+i:i)}function tX(e){return e.replace(JW,"\\$&")}function jp(e){return new RegExp("^(?:"+e.map(tX).join("|")+")","i")}function Vp(e){return new Map(e.map((t,n)=>[t.toLowerCase(),n]))}function eX(e,t,n){var r=un.exec(t.slice(n,n+1));return r?(e.w=+r[0],n+r[0].length):-1}function nX(e,t,n){var r=un.exec(t.slice(n,n+1));return r?(e.u=+r[0],n+r[0].length):-1}function rX(e,t,n){var r=un.exec(t.slice(n,n+2));return r?(e.U=+r[0],n+r[0].length):-1}function iX(e,t,n){var r=un.exec(t.slice(n,n+2));return r?(e.V=+r[0],n+r[0].length):-1}function oX(e,t,n){var r=un.exec(t.slice(n,n+2));return r?(e.W=+r[0],n+r[0].length):-1}function ML(e,t,n){var r=un.exec(t.slice(n,n+4));return r?(e.y=+r[0],n+r[0].length):-1}function AL(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 sX(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 aX(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 cX(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 NL(e,t,n){var r=un.exec(t.slice(n,n+2));return r?(e.d=+r[0],n+r[0].length):-1}function lX(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 RL(e,t,n){var r=un.exec(t.slice(n,n+2));return r?(e.H=+r[0],n+r[0].length):-1}function uX(e,t,n){var r=un.exec(t.slice(n,n+2));return r?(e.M=+r[0],n+r[0].length):-1}function fX(e,t,n){var r=un.exec(t.slice(n,n+2));return r?(e.S=+r[0],n+r[0].length):-1}function dX(e,t,n){var r=un.exec(t.slice(n,n+3));return r?(e.L=+r[0],n+r[0].length):-1}function hX(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 pX(e,t,n){var r=KW.exec(t.slice(n,n+1));return r?n+r[0].length:-1}function mX(e,t,n){var r=un.exec(t.slice(n));return r?(e.Q=+r[0],n+r[0].length):-1}function yX(e,t,n){var r=un.exec(t.slice(n));return r?(e.s=+r[0],n+r[0].length):-1}function OL(e,t){return te(e.getDate(),t,2)}function gX(e,t){return te(e.getHours(),t,2)}function bX(e,t){return te(e.getHours()%12||12,t,2)}function xX(e,t){return te(1+ui.count(Un(e),e),t,3)}function CL(e,t){return te(e.getMilliseconds(),t,3)}function _X(e,t){return CL(e,t)+"000"}function wX(e,t){return te(e.getMonth()+1,t,2)}function vX(e,t){return te(e.getMinutes(),t,2)}function SX(e,t){return te(e.getSeconds(),t,2)}function IX(e){var t=e.getDay();return t===0?7:t}function TX(e,t){return te(Br.count(Un(e)-1,e),t,2)}function BL(e){var t=e.getDay();return t>=4||t===0?To(e):To.ceil(e)}function EX(e,t){return e=BL(e),te(To.count(Un(e),e)+(Un(e).getDay()===4),t,2)}function MX(e){return e.getDay()}function AX(e,t){return te($a.count(Un(e)-1,e),t,2)}function NX(e,t){return te(e.getFullYear()%100,t,2)}function RX(e,t){return e=BL(e),te(e.getFullYear()%100,t,2)}function OX(e,t){return te(e.getFullYear()%1e4,t,4)}function DX(e,t){var n=e.getDay();return e=n>=4||n===0?To(e):To.ceil(e),te(e.getFullYear()%1e4,t,4)}function kX(e){var t=e.getTimezoneOffset();return(t>0?"-":(t*=-1,"+"))+te(t/60|0,"0",2)+te(t%60,"0",2)}function DL(e,t){return te(e.getUTCDate(),t,2)}function FX(e,t){return te(e.getUTCHours(),t,2)}function LX(e,t){return te(e.getUTCHours()%12||12,t,2)}function CX(e,t){return te(1+hl.count($n(e),e),t,3)}function PL(e,t){return te(e.getUTCMilliseconds(),t,3)}function BX(e,t){return PL(e,t)+"000"}function PX(e,t){return te(e.getUTCMonth()+1,t,2)}function UX(e,t){return te(e.getUTCMinutes(),t,2)}function $X(e,t){return te(e.getUTCSeconds(),t,2)}function zX(e){var t=e.getUTCDay();return t===0?7:t}function qX(e,t){return te(Pr.count($n(e)-1,e),t,2)}function UL(e){var t=e.getUTCDay();return t>=4||t===0?Eo(e):Eo.ceil(e)}function jX(e,t){return e=UL(e),te(Eo.count($n(e),e)+($n(e).getUTCDay()===4),t,2)}function VX(e){return e.getUTCDay()}function YX(e,t){return te(za.count($n(e)-1,e),t,2)}function GX(e,t){return te(e.getUTCFullYear()%100,t,2)}function WX(e,t){return e=UL(e),te(e.getUTCFullYear()%100,t,2)}function XX(e,t){return te(e.getUTCFullYear()%1e4,t,4)}function HX(e,t){var n=e.getUTCDay();return e=n>=4||n===0?Eo(e):Eo.ceil(e),te(e.getUTCFullYear()%1e4,t,4)}function ZX(){return"+0000"}function kL(){return"%"}function FL(e){return+e}function LL(e){return Math.floor(+e/1e3)}var Ku,Ju,$L,Mo,zL;ZI({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 ZI(e){return Ku=HI(e),Ju=Ku.format,$L=Ku.parse,Mo=Ku.utcFormat,zL=Ku.utcParse,Ku}function QX(e){return new Date(e)}function KX(e){return e instanceof Date?+e:+new Date(+e)}function nx(e,t,n,r,i,o,s,a,c,l){var u=Op(),f=u.invert,d=u.domain,h=l(".%L"),p=l(":%S"),y=l("%I:%M"),b=l("%I %p"),m=l("%a %d"),g=l("%b %d"),x=l("%B"),_=l("%Y");function v(w){return(c(w)<w?h:a(w)<w?p:s(w)<w?y:o(w)<w?b:r(w)<w?i(w)<w?m:g:n(w)<w?x:_)(w)}return u.invert=function(w){return new Date(f(w))},u.domain=function(w){return arguments.length?d(Array.from(w,KX)):d().map(QX)},u.ticks=function(w){var T=d();return e(T[0],T[T.length-1],w??10)},u.tickFormat=function(w,T){return T==null?v:l(T)},u.nice=function(w){var T=d();return(!w||typeof w.range!="function")&&(w=t(T[0],T[T.length-1],w??10)),w?d(kp(T,w)):u},u.copy=function(){return So(u,nx(e,t,n,r,i,o,s,a,c,l))},u}function rx(){return He.apply(nx(YI,GI,Un,Ps,Br,ui,Cs,Fs,ln,Ju).domain([new Date(2e3,0,1),new Date(2e3,0,2)]),arguments)}function ix(){return He.apply(nx(VI,zp,$n,Us,Pr,hl,Bs,Ls,ln,Mo).domain([Date.UTC(2e3,0,1),Date.UTC(2e3,0,2)]),arguments)}function Yp(e,t){return t.domain(e.domain()).interpolator(e.interpolator()).clamp(e.clamp()).unknown(e.unknown())}function ox(){var e=0,t=.5,n=1,r=1,i,o,s,a,c,l=gr,u,f=!1,d;function h(y){return isNaN(y=+y)?d:(y=.5+((y=+u(y))-o)*(r*y<r*o?a:c),l(f?Math.max(0,Math.min(1,y)):y))}h.domain=function(y){return arguments.length?([e,t,n]=y,i=u(e=+e),o=u(t=+t),s=u(n=+n),a=i===o?0:.5/(o-i),c=o===s?0:.5/(s-o),r=o<i?-1:1,h):[e,t,n]},h.clamp=function(y){return arguments.length?(f=!!y,h):f},h.interpolator=function(y){return arguments.length?(l=y,h):l};function p(y){return function(b){var m,g,x;return arguments.length?([m,g,x]=b,l=po(y,[m,g,x]),h):[l(0),l(.5),l(1)]}}return h.range=p(Lr),h.rangeRound=p(Qc),h.unknown=function(y){return arguments.length?(d=y,h):d},function(y){return u=y,i=y(e),o=y(t),s=y(n),a=i===o?0:.5/(o-i),c=o===s?0:.5/(s-o),r=o<i?-1:1,h}}function Gp(){var e=Ds(ox()(gr));return e.copy=function(){return Yp(e,Gp())},Np.apply(e,arguments)}function sx(){var e=UI(ox()).domain([.1,1,10]);return e.copy=function(){return Yp(e,sx()).base(e.base())},Np.apply(e,arguments)}function ax(){var e=$I(ox());return e.copy=function(){return Yp(e,ax()).constant(e.constant())},Np.apply(e,arguments)}function cx(){var e=zI(ox());return e.copy=function(){return Yp(e,cx()).exponent(e.exponent())},Np.apply(e,arguments)}function G(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 QI=G("1f77b4ff7f0e2ca02cd627289467bd8c564be377c27f7f7fbcbd2217becf");var KI=G("7fc97fbeaed4fdc086ffff99386cb0f0027fbf5b17666666");var JI=G("1b9e77d95f027570b3e7298a66a61ee6ab02a6761d666666");var tT=G("a6cee31f78b4b2df8a33a02cfb9a99e31a1cfdbf6fff7f00cab2d66a3d9affff99b15928");var eT=G("fbb4aeb3cde3ccebc5decbe4fed9a6ffffcce5d8bdfddaecf2f2f2");var nT=G("b3e2cdfdcdaccbd5e8f4cae4e6f5c9fff2aef1e2cccccccc");var rT=G("e41a1c377eb84daf4a984ea3ff7f00ffff33a65628f781bf999999");var iT=G("66c2a5fc8d628da0cbe78ac3a6d854ffd92fe5c494b3b3b3");var oT=G("8dd3c7ffffb3bebadafb807280b1d3fdb462b3de69fccde5d9d9d9bc80bdccebc5ffed6f");var sT=G("4e79a7f28e2ce1575976b7b259a14fedc949af7aa1ff9da79c755fbab0ab");var ht=e=>nS(e[e.length-1]);var lx=new Array(3).concat("d8b365f5f5f55ab4ac","a6611adfc27d80cdc1018571","a6611adfc27df5f5f580cdc1018571","8c510ad8b365f6e8c3c7eae55ab4ac01665e","8c510ad8b365f6e8c3f5f5f5c7eae55ab4ac01665e","8c510abf812ddfc27df6e8c3c7eae580cdc135978f01665e","8c510abf812ddfc27df6e8c3f5f5f5c7eae580cdc135978f01665e","5430058c510abf812ddfc27df6e8c3c7eae580cdc135978f01665e003c30","5430058c510abf812ddfc27df6e8c3f5f5f5c7eae580cdc135978f01665e003c30").map(G),ux=ht(lx);var fx=new Array(3).concat("af8dc3f7f7f77fbf7b","7b3294c2a5cfa6dba0008837","7b3294c2a5cff7f7f7a6dba0008837","762a83af8dc3e7d4e8d9f0d37fbf7b1b7837","762a83af8dc3e7d4e8f7f7f7d9f0d37fbf7b1b7837","762a839970abc2a5cfe7d4e8d9f0d3a6dba05aae611b7837","762a839970abc2a5cfe7d4e8f7f7f7d9f0d3a6dba05aae611b7837","40004b762a839970abc2a5cfe7d4e8d9f0d3a6dba05aae611b783700441b","40004b762a839970abc2a5cfe7d4e8f7f7f7d9f0d3a6dba05aae611b783700441b").map(G),dx=ht(fx);var hx=new Array(3).concat("e9a3c9f7f7f7a1d76a","d01c8bf1b6dab8e1864dac26","d01c8bf1b6daf7f7f7b8e1864dac26","c51b7de9a3c9fde0efe6f5d0a1d76a4d9221","c51b7de9a3c9fde0eff7f7f7e6f5d0a1d76a4d9221","c51b7dde77aef1b6dafde0efe6f5d0b8e1867fbc414d9221","c51b7dde77aef1b6dafde0eff7f7f7e6f5d0b8e1867fbc414d9221","8e0152c51b7dde77aef1b6dafde0efe6f5d0b8e1867fbc414d9221276419","8e0152c51b7dde77aef1b6dafde0eff7f7f7e6f5d0b8e1867fbc414d9221276419").map(G),px=ht(hx);var mx=new Array(3).concat("998ec3f7f7f7f1a340","5e3c99b2abd2fdb863e66101","5e3c99b2abd2f7f7f7fdb863e66101","542788998ec3d8daebfee0b6f1a340b35806","542788998ec3d8daebf7f7f7fee0b6f1a340b35806","5427888073acb2abd2d8daebfee0b6fdb863e08214b35806","5427888073acb2abd2d8daebf7f7f7fee0b6fdb863e08214b35806","2d004b5427888073acb2abd2d8daebfee0b6fdb863e08214b358067f3b08","2d004b5427888073acb2abd2d8daebf7f7f7fee0b6fdb863e08214b358067f3b08").map(G),yx=ht(mx);var Wp=new Array(3).concat("ef8a62f7f7f767a9cf","ca0020f4a58292c5de0571b0","ca0020f4a582f7f7f792c5de0571b0","b2182bef8a62fddbc7d1e5f067a9cf2166ac","b2182bef8a62fddbc7f7f7f7d1e5f067a9cf2166ac","b2182bd6604df4a582fddbc7d1e5f092c5de4393c32166ac","b2182bd6604df4a582fddbc7f7f7f7d1e5f092c5de4393c32166ac","67001fb2182bd6604df4a582fddbc7d1e5f092c5de4393c32166ac053061","67001fb2182bd6604df4a582fddbc7f7f7f7d1e5f092c5de4393c32166ac053061").map(G),tf=ht(Wp);var gx=new Array(3).concat("ef8a62ffffff999999","ca0020f4a582bababa404040","ca0020f4a582ffffffbababa404040","b2182bef8a62fddbc7e0e0e09999994d4d4d","b2182bef8a62fddbc7ffffffe0e0e09999994d4d4d","b2182bd6604df4a582fddbc7e0e0e0bababa8787874d4d4d","b2182bd6604df4a582fddbc7ffffffe0e0e0bababa8787874d4d4d","67001fb2182bd6604df4a582fddbc7e0e0e0bababa8787874d4d4d1a1a1a","67001fb2182bd6604df4a582fddbc7ffffffe0e0e0bababa8787874d4d4d1a1a1a").map(G),bx=ht(gx);var Xp=new Array(3).concat("fc8d59ffffbf91bfdb","d7191cfdae61abd9e92c7bb6","d7191cfdae61ffffbfabd9e92c7bb6","d73027fc8d59fee090e0f3f891bfdb4575b4","d73027fc8d59fee090ffffbfe0f3f891bfdb4575b4","d73027f46d43fdae61fee090e0f3f8abd9e974add14575b4","d73027f46d43fdae61fee090ffffbfe0f3f8abd9e974add14575b4","a50026d73027f46d43fdae61fee090e0f3f8abd9e974add14575b4313695","a50026d73027f46d43fdae61fee090ffffbfe0f3f8abd9e974add14575b4313695").map(G),ef=ht(Xp);var xx=new Array(3).concat("fc8d59ffffbf91cf60","d7191cfdae61a6d96a1a9641","d7191cfdae61ffffbfa6d96a1a9641","d73027fc8d59fee08bd9ef8b91cf601a9850","d73027fc8d59fee08bffffbfd9ef8b91cf601a9850","d73027f46d43fdae61fee08bd9ef8ba6d96a66bd631a9850","d73027f46d43fdae61fee08bffffbfd9ef8ba6d96a66bd631a9850","a50026d73027f46d43fdae61fee08bd9ef8ba6d96a66bd631a9850006837","a50026d73027f46d43fdae61fee08bffffbfd9ef8ba6d96a66bd631a9850006837").map(G),_x=ht(xx);var wx=new Array(3).concat("fc8d59ffffbf99d594","d7191cfdae61abdda42b83ba","d7191cfdae61ffffbfabdda42b83ba","d53e4ffc8d59fee08be6f59899d5943288bd","d53e4ffc8d59fee08bffffbfe6f59899d5943288bd","d53e4ff46d43fdae61fee08be6f598abdda466c2a53288bd","d53e4ff46d43fdae61fee08bffffbfe6f598abdda466c2a53288bd","9e0142d53e4ff46d43fdae61fee08be6f598abdda466c2a53288bd5e4fa2","9e0142d53e4ff46d43fdae61fee08bffffbfe6f598abdda466c2a53288bd5e4fa2").map(G),vx=ht(wx);var Sx=new Array(3).concat("e5f5f999d8c92ca25f","edf8fbb2e2e266c2a4238b45","edf8fbb2e2e266c2a42ca25f006d2c","edf8fbccece699d8c966c2a42ca25f006d2c","edf8fbccece699d8c966c2a441ae76238b45005824","f7fcfde5f5f9ccece699d8c966c2a441ae76238b45005824","f7fcfde5f5f9ccece699d8c966c2a441ae76238b45006d2c00441b").map(G),Ix=ht(Sx);var Tx=new Array(3).concat("e0ecf49ebcda8856a7","edf8fbb3cde38c96c688419d","edf8fbb3cde38c96c68856a7810f7c","edf8fbbfd3e69ebcda8c96c68856a7810f7c","edf8fbbfd3e69ebcda8c96c68c6bb188419d6e016b","f7fcfde0ecf4bfd3e69ebcda8c96c68c6bb188419d6e016b","f7fcfde0ecf4bfd3e69ebcda8c96c68c6bb188419d810f7c4d004b").map(G),Ex=ht(Tx);var Mx=new Array(3).concat("e0f3dba8ddb543a2ca","f0f9e8bae4bc7bccc42b8cbe","f0f9e8bae4bc7bccc443a2ca0868ac","f0f9e8ccebc5a8ddb57bccc443a2ca0868ac","f0f9e8ccebc5a8ddb57bccc44eb3d32b8cbe08589e","f7fcf0e0f3dbccebc5a8ddb57bccc44eb3d32b8cbe08589e","f7fcf0e0f3dbccebc5a8ddb57bccc44eb3d32b8cbe0868ac084081").map(G),Ax=ht(Mx);var Nx=new Array(3).concat("fee8c8fdbb84e34a33","fef0d9fdcc8afc8d59d7301f","fef0d9fdcc8afc8d59e34a33b30000","fef0d9fdd49efdbb84fc8d59e34a33b30000","fef0d9fdd49efdbb84fc8d59ef6548d7301f990000","fff7ecfee8c8fdd49efdbb84fc8d59ef6548d7301f990000","fff7ecfee8c8fdd49efdbb84fc8d59ef6548d7301fb300007f0000").map(G),Rx=ht(Nx);var Ox=new Array(3).concat("ece2f0a6bddb1c9099","f6eff7bdc9e167a9cf02818a","f6eff7bdc9e167a9cf1c9099016c59","f6eff7d0d1e6a6bddb67a9cf1c9099016c59","f6eff7d0d1e6a6bddb67a9cf3690c002818a016450","fff7fbece2f0d0d1e6a6bddb67a9cf3690c002818a016450","fff7fbece2f0d0d1e6a6bddb67a9cf3690c002818a016c59014636").map(G),Dx=ht(Ox);var kx=new Array(3).concat("ece7f2a6bddb2b8cbe","f1eef6bdc9e174a9cf0570b0","f1eef6bdc9e174a9cf2b8cbe045a8d","f1eef6d0d1e6a6bddb74a9cf2b8cbe045a8d","f1eef6d0d1e6a6bddb74a9cf3690c00570b0034e7b","fff7fbece7f2d0d1e6a6bddb74a9cf3690c00570b0034e7b","fff7fbece7f2d0d1e6a6bddb74a9cf3690c00570b0045a8d023858").map(G),Fx=ht(kx);var Lx=new Array(3).concat("e7e1efc994c7dd1c77","f1eef6d7b5d8df65b0ce1256","f1eef6d7b5d8df65b0dd1c77980043","f1eef6d4b9dac994c7df65b0dd1c77980043","f1eef6d4b9dac994c7df65b0e7298ace125691003f","f7f4f9e7e1efd4b9dac994c7df65b0e7298ace125691003f","f7f4f9e7e1efd4b9dac994c7df65b0e7298ace125698004367001f").map(G),Cx=ht(Lx);var Bx=new Array(3).concat("fde0ddfa9fb5c51b8a","feebe2fbb4b9f768a1ae017e","feebe2fbb4b9f768a1c51b8a7a0177","feebe2fcc5c0fa9fb5f768a1c51b8a7a0177","feebe2fcc5c0fa9fb5f768a1dd3497ae017e7a0177","fff7f3fde0ddfcc5c0fa9fb5f768a1dd3497ae017e7a0177","fff7f3fde0ddfcc5c0fa9fb5f768a1dd3497ae017e7a017749006a").map(G),Px=ht(Bx);var Ux=new Array(3).concat("edf8b17fcdbb2c7fb8","ffffcca1dab441b6c4225ea8","ffffcca1dab441b6c42c7fb8253494","ffffccc7e9b47fcdbb41b6c42c7fb8253494","ffffccc7e9b47fcdbb41b6c41d91c0225ea80c2c84","ffffd9edf8b1c7e9b47fcdbb41b6c41d91c0225ea80c2c84","ffffd9edf8b1c7e9b47fcdbb41b6c41d91c0225ea8253494081d58").map(G),$x=ht(Ux);var zx=new Array(3).concat("f7fcb9addd8e31a354","ffffccc2e69978c679238443","ffffccc2e69978c67931a354006837","ffffccd9f0a3addd8e78c67931a354006837","ffffccd9f0a3addd8e78c67941ab5d238443005a32","ffffe5f7fcb9d9f0a3addd8e78c67941ab5d238443005a32","ffffe5f7fcb9d9f0a3addd8e78c67941ab5d238443006837004529").map(G),qx=ht(zx);var jx=new Array(3).concat("fff7bcfec44fd95f0e","ffffd4fed98efe9929cc4c02","ffffd4fed98efe9929d95f0e993404","ffffd4fee391fec44ffe9929d95f0e993404","ffffd4fee391fec44ffe9929ec7014cc4c028c2d04","ffffe5fff7bcfee391fec44ffe9929ec7014cc4c028c2d04","ffffe5fff7bcfee391fec44ffe9929ec7014cc4c02993404662506").map(G),Vx=ht(jx);var Yx=new Array(3).concat("ffeda0feb24cf03b20","ffffb2fecc5cfd8d3ce31a1c","ffffb2fecc5cfd8d3cf03b20bd0026","ffffb2fed976feb24cfd8d3cf03b20bd0026","ffffb2fed976feb24cfd8d3cfc4e2ae31a1cb10026","ffffccffeda0fed976feb24cfd8d3cfc4e2ae31a1cb10026","ffffccffeda0fed976feb24cfd8d3cfc4e2ae31a1cbd0026800026").map(G),Gx=ht(Yx);var Wx=new Array(3).concat("deebf79ecae13182bd","eff3ffbdd7e76baed62171b5","eff3ffbdd7e76baed63182bd08519c","eff3ffc6dbef9ecae16baed63182bd08519c","eff3ffc6dbef9ecae16baed64292c62171b5084594","f7fbffdeebf7c6dbef9ecae16baed64292c62171b5084594","f7fbffdeebf7c6dbef9ecae16baed64292c62171b508519c08306b").map(G),Xx=ht(Wx);var Hx=new Array(3).concat("e5f5e0a1d99b31a354","edf8e9bae4b374c476238b45","edf8e9bae4b374c47631a354006d2c","edf8e9c7e9c0a1d99b74c47631a354006d2c","edf8e9c7e9c0a1d99b74c47641ab5d238b45005a32","f7fcf5e5f5e0c7e9c0a1d99b74c47641ab5d238b45005a32","f7fcf5e5f5e0c7e9c0a1d99b74c47641ab5d238b45006d2c00441b").map(G),Zx=ht(Hx);var Qx=new Array(3).concat("f0f0f0bdbdbd636363","f7f7f7cccccc969696525252","f7f7f7cccccc969696636363252525","f7f7f7d9d9d9bdbdbd969696636363252525","f7f7f7d9d9d9bdbdbd969696737373525252252525","fffffff0f0f0d9d9d9bdbdbd969696737373525252252525","fffffff0f0f0d9d9d9bdbdbd969696737373525252252525000000").map(G),Kx=ht(Qx);var Jx=new Array(3).concat("efedf5bcbddc756bb1","f2f0f7cbc9e29e9ac86a51a3","f2f0f7cbc9e29e9ac8756bb154278f","f2f0f7dadaebbcbddc9e9ac8756bb154278f","f2f0f7dadaebbcbddc9e9ac8807dba6a51a34a1486","fcfbfdefedf5dadaebbcbddc9e9ac8807dba6a51a34a1486","fcfbfdefedf5dadaebbcbddc9e9ac8807dba6a51a354278f3f007d").map(G),t1=ht(Jx);var e1=new Array(3).concat("fee0d2fc9272de2d26","fee5d9fcae91fb6a4acb181d","fee5d9fcae91fb6a4ade2d26a50f15","fee5d9fcbba1fc9272fb6a4ade2d26a50f15","fee5d9fcbba1fc9272fb6a4aef3b2ccb181d99000d","fff5f0fee0d2fcbba1fc9272fb6a4aef3b2ccb181d99000d","fff5f0fee0d2fcbba1fc9272fb6a4aef3b2ccb181da50f1567000d").map(G),n1=ht(e1);var r1=new Array(3).concat("fee6cefdae6be6550d","feeddefdbe85fd8d3cd94701","feeddefdbe85fd8d3ce6550da63603","feeddefdd0a2fdae6bfd8d3ce6550da63603","feeddefdd0a2fdae6bfd8d3cf16913d948018c2d04","fff5ebfee6cefdd0a2fdae6bfd8d3cf16913d948018c2d04","fff5ebfee6cefdd0a2fdae6bfd8d3cf16913d94801a636037f2704").map(G),i1=ht(r1);function o1(e){return e=Math.max(0,Math.min(1,e)),"rgb("+Math.max(0,Math.min(255,Math.round(-4.54-e*(35.34-e*(2381.73-e*(6402.7-e*(7024.72-e*2710.57)))))))+", "+Math.max(0,Math.min(255,Math.round(32.49+e*(170.73+e*(52.82-e*(131.46-e*(176.58-e*67.37)))))))+", "+Math.max(0,Math.min(255,Math.round(81.24+e*(442.36-e*(2482.43-e*(6167.24-e*(6614.94-e*2475.67)))))))+")"}var s1=Nu(Qn(300,.5,0),Qn(-240,.5,1));var c1=Nu(Qn(-100,.75,.35),Qn(80,1.5,.8)),l1=Nu(Qn(260,.75,.35),Qn(80,1.5,.8)),a1=Qn();function u1(e){(e<0||e>1)&&(e-=Math.floor(e));var t=Math.abs(e-.5);return a1.h=360*e-100,a1.s=1.5-1.5*t,a1.l=.8-.9*t,a1+""}var f1=an(),JX=Math.PI/3,tH=Math.PI*2/3;function d1(e){var t;return e=(.5-e)*Math.PI,f1.r=255*(t=Math.sin(e))*t,f1.g=255*(t=Math.sin(e+JX))*t,f1.b=255*(t=Math.sin(e+tH))*t,f1+""}function h1(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 p1(e){var t=e.length;return function(n){return e[Math.max(0,Math.min(t-1,Math.floor(n*t)))]}}var m1=p1(G("44015444025645045745055946075a46085c460a5d460b5e470d60470e6147106347116447136548146748166848176948186a481a6c481b6d481c6e481d6f481f70482071482173482374482475482576482677482878482979472a7a472c7a472d7b472e7c472f7d46307e46327e46337f463480453581453781453882443983443a83443b84433d84433e85423f854240864241864142874144874045884046883f47883f48893e49893e4a893e4c8a3d4d8a3d4e8a3c4f8a3c508b3b518b3b528b3a538b3a548c39558c39568c38588c38598c375a8c375b8d365c8d365d8d355e8d355f8d34608d34618d33628d33638d32648e32658e31668e31678e31688e30698e306a8e2f6b8e2f6c8e2e6d8e2e6e8e2e6f8e2d708e2d718e2c718e2c728e2c738e2b748e2b758e2a768e2a778e2a788e29798e297a8e297b8e287c8e287d8e277e8e277f8e27808e26818e26828e26828e25838e25848e25858e24868e24878e23888e23898e238a8d228b8d228c8d228d8d218e8d218f8d21908d21918c20928c20928c20938c1f948c1f958b1f968b1f978b1f988b1f998a1f9a8a1e9b8a1e9c891e9d891f9e891f9f881fa0881fa1881fa1871fa28720a38620a48621a58521a68522a78522a88423a98324aa8325ab8225ac8226ad8127ad8128ae8029af7f2ab07f2cb17e2db27d2eb37c2fb47c31b57b32b67a34b67935b77937b87838b9773aba763bbb753dbc743fbc7340bd7242be7144bf7046c06f48c16e4ac16d4cc26c4ec36b50c46a52c56954c56856c66758c7655ac8645cc8635ec96260ca6063cb5f65cb5e67cc5c69cd5b6ccd5a6ece5870cf5773d05675d05477d1537ad1517cd2507fd34e81d34d84d44b86d54989d5488bd6468ed64590d74393d74195d84098d83e9bd93c9dd93ba0da39a2da37a5db36a8db34aadc32addc30b0dd2fb2dd2db5de2bb8de29bade28bddf26c0df25c2df23c5e021c8e020cae11fcde11dd0e11cd2e21bd5e21ad8e219dae319dde318dfe318e2e418e5e419e7e419eae51aece51befe51cf1e51df4e61ef6e620f8e621fbe723fde725")),y1=p1(G("00000401000501010601010802010902020b02020d03030f03031204041405041606051806051a07061c08071e0907200a08220b09240c09260d0a290e0b2b100b2d110c2f120d31130d34140e36150e38160f3b180f3d19103f1a10421c10441d11471e114920114b21114e22115024125325125527125829115a2a115c2c115f2d11612f116331116533106734106936106b38106c390f6e3b0f703d0f713f0f72400f74420f75440f764510774710784910784a10794c117a4e117b4f127b51127c52137c54137d56147d57157e59157e5a167e5c167f5d177f5f187f601880621980641a80651a80671b80681c816a1c816b1d816d1d816e1e81701f81721f817320817521817621817822817922827b23827c23827e24828025828125818326818426818627818827818928818b29818c29818e2a81902a81912b81932b80942c80962c80982d80992d809b2e7f9c2e7f9e2f7fa02f7fa1307ea3307ea5317ea6317da8327daa337dab337cad347cae347bb0357bb2357bb3367ab5367ab73779b83779ba3878bc3978bd3977bf3a77c03a76c23b75c43c75c53c74c73d73c83e73ca3e72cc3f71cd4071cf4070d0416fd2426fd3436ed5446dd6456cd8456cd9466bdb476adc4869de4968df4a68e04c67e24d66e34e65e44f64e55064e75263e85362e95462ea5661eb5760ec5860ed5a5fee5b5eef5d5ef05f5ef1605df2625df2645cf3655cf4675cf4695cf56b5cf66c5cf66e5cf7705cf7725cf8745cf8765cf9785df9795df97b5dfa7d5efa7f5efa815ffb835ffb8560fb8761fc8961fc8a62fc8c63fc8e64fc9065fd9266fd9467fd9668fd9869fd9a6afd9b6bfe9d6cfe9f6dfea16efea36ffea571fea772fea973feaa74feac76feae77feb078feb27afeb47bfeb67cfeb77efeb97ffebb81febd82febf84fec185fec287fec488fec68afec88cfeca8dfecc8ffecd90fecf92fed194fed395fed597fed799fed89afdda9cfddc9efddea0fde0a1fde2a3fde3a5fde5a7fde7a9fde9aafdebacfcecaefceeb0fcf0b2fcf2b4fcf4b6fcf6b8fcf7b9fcf9bbfcfbbdfcfdbf")),g1=p1(G("00000401000501010601010802010a02020c02020e03021004031204031405041706041907051b08051d09061f0a07220b07240c08260d08290e092b10092d110a30120a32140b34150b37160b39180c3c190c3e1b0c411c0c431e0c451f0c48210c4a230c4c240c4f260c51280b53290b552b0b572d0b592f0a5b310a5c320a5e340a5f3609613809623909633b09643d09653e0966400a67420a68440a68450a69470b6a490b6a4a0c6b4c0c6b4d0d6c4f0d6c510e6c520e6d540f6d550f6d57106e59106e5a116e5c126e5d126e5f136e61136e62146e64156e65156e67166e69166e6a176e6c186e6d186e6f196e71196e721a6e741a6e751b6e771c6d781c6d7a1d6d7c1d6d7d1e6d7f1e6c801f6c82206c84206b85216b87216b88226a8a226a8c23698d23698f24699025689225689326679526679727669827669a28659b29649d29649f2a63a02a63a22b62a32c61a52c60a62d60a82e5fa92e5eab2f5ead305dae305cb0315bb1325ab3325ab43359b63458b73557b93556ba3655bc3754bd3853bf3952c03a51c13a50c33b4fc43c4ec63d4dc73e4cc83f4bca404acb4149cc4248ce4347cf4446d04545d24644d34743d44842d54a41d74b3fd84c3ed94d3dda4e3cdb503bdd513ade5238df5337e05536e15635e25734e35933e45a31e55c30e65d2fe75e2ee8602de9612bea632aeb6429eb6628ec6726ed6925ee6a24ef6c23ef6e21f06f20f1711ff1731df2741cf3761bf37819f47918f57b17f57d15f67e14f68013f78212f78410f8850ff8870ef8890cf98b0bf98c0af98e09fa9008fa9207fa9407fb9606fb9706fb9906fb9b06fb9d07fc9f07fca108fca309fca50afca60cfca80dfcaa0ffcac11fcae12fcb014fcb216fcb418fbb61afbb81dfbba1ffbbc21fbbe23fac026fac228fac42afac62df9c72ff9c932f9cb35f8cd37f8cf3af7d13df7d340f6d543f6d746f5d949f5db4cf4dd4ff4df53f4e156f3e35af3e55df2e661f2e865f2ea69f1ec6df1ed71f1ef75f1f179f2f27df2f482f3f586f3f68af4f88ef5f992f6fa96f8fb9af9fc9dfafda1fcffa4")),b1=p1(G("0d088710078813078916078a19068c1b068d1d068e20068f2206902406912605912805922a05932c05942e05952f059631059733059735049837049938049a3a049a3c049b3e049c3f049c41049d43039e44039e46039f48039f4903a04b03a14c02a14e02a25002a25102a35302a35502a45601a45801a45901a55b01a55c01a65e01a66001a66100a76300a76400a76600a76700a86900a86a00a86c00a86e00a86f00a87100a87201a87401a87501a87701a87801a87a02a87b02a87d03a87e03a88004a88104a78305a78405a78606a68707a68808a68a09a58b0aa58d0ba58e0ca48f0da4910ea3920fa39410a29511a19613a19814a099159f9a169f9c179e9d189d9e199da01a9ca11b9ba21d9aa31e9aa51f99a62098a72197a82296aa2395ab2494ac2694ad2793ae2892b02991b12a90b22b8fb32c8eb42e8db52f8cb6308bb7318ab83289ba3388bb3488bc3587bd3786be3885bf3984c03a83c13b82c23c81c33d80c43e7fc5407ec6417dc7427cc8437bc9447aca457acb4679cc4778cc4977cd4a76ce4b75cf4c74d04d73d14e72d24f71d35171d45270d5536fd5546ed6556dd7566cd8576bd9586ada5a6ada5b69db5c68dc5d67dd5e66de5f65de6164df6263e06363e16462e26561e26660e3685fe4695ee56a5de56b5de66c5ce76e5be76f5ae87059e97158e97257ea7457eb7556eb7655ec7754ed7953ed7a52ee7b51ef7c51ef7e50f07f4ff0804ef1814df1834cf2844bf3854bf3874af48849f48948f58b47f58c46f68d45f68f44f79044f79143f79342f89441f89540f9973ff9983ef99a3efa9b3dfa9c3cfa9e3bfb9f3afba139fba238fca338fca537fca636fca835fca934fdab33fdac33fdae32fdaf31fdb130fdb22ffdb42ffdb52efeb72dfeb82cfeba2cfebb2bfebd2afebe2afec029fdc229fdc328fdc527fdc627fdc827fdca26fdcb26fccd25fcce25fcd025fcd225fbd324fbd524fbd724fad824fada24f9dc24f9dd25f8df25f8e125f7e225f7e425f6e626f6e826f5e926f5eb27f4ed27f3ee27f3f027f2f227f1f426f1f525f0f724f0f921"));function Ze(e){return function(){return e}}var aT=Math.cos;var nf=Math.min,Hp=Math.sin,ee=Math.sqrt,cT=1e-12,gl=Math.PI,ANt=gl/2,rf=2*gl;function x1(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 ka(t)}var DNt=Array.prototype.slice;function _1(e){return typeof e=="object"&&"length"in e?e:Array.from(e)}function qL(e){this._context=e}qL.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 $s(e){return new qL(e)}function w1(e){return e[0]}function v1(e){return e[1]}function Zp(e,t){var n=Ze(!0),r=null,i=$s,o=null,s=x1(a);e=typeof e=="function"?e:e===void 0?w1:Ze(e),t=typeof t=="function"?t:t===void 0?v1:Ze(t);function a(c){var l,u=(c=_1(c)).length,f,d=!1,h;for(r==null&&(o=i(h=s())),l=0;l<=u;++l)!(l<u&&n(f=c[l],l,c))===d&&((d=!d)?o.lineStart():o.lineEnd()),d&&o.point(+e(f,l,c),+t(f,l,c));if(h)return o=null,h+""||null}return a.x=function(c){return arguments.length?(e=typeof c=="function"?c:Ze(+c),a):e},a.y=function(c){return arguments.length?(t=typeof c=="function"?c:Ze(+c),a):t},a.defined=function(c){return arguments.length?(n=typeof c=="function"?c:Ze(!!c),a):n},a.curve=function(c){return arguments.length?(i=c,r!=null&&(o=i(r)),a):i},a.context=function(c){return arguments.length?(c==null?r=o=null:o=i(r=c),a):r},a}function of(e,t,n){var r=null,i=Ze(!0),o=null,s=$s,a=null,c=x1(l);e=typeof e=="function"?e:e===void 0?w1:Ze(+e),t=typeof t=="function"?t:t===void 0?Ze(0):Ze(+t),n=typeof n=="function"?n:n===void 0?v1:Ze(+n);function l(f){var d,h,p,y=(f=_1(f)).length,b,m=!1,g,x=new Array(y),_=new Array(y);for(o==null&&(a=s(g=c())),d=0;d<=y;++d){if(!(d<y&&i(b=f[d],d,f))===m)if(m=!m)h=d,a.areaStart(),a.lineStart();else{for(a.lineEnd(),a.lineStart(),p=d-1;p>=h;--p)a.point(x[p],_[p]);a.lineEnd(),a.areaEnd()}m&&(x[d]=+e(b,d,f),_[d]=+t(b,d,f),a.point(r?+r(b,d,f):x[d],n?+n(b,d,f):_[d]))}if(g)return a=null,g+""||null}function u(){return Zp().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 S1=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 lT(e){return new S1(e,!0)}function uT(e){return new S1(e,!1)}var eH=ee(3),Qp={draw(e,t){let n=ee(t+nf(t/28,.75))*.59436,r=n/2,i=r*eH;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 zs={draw(e,t){let n=ee(t/gl);e.moveTo(n,0),e.arc(0,0,n,0,rf)}};var Kp={draw(e,t){let n=ee(t/5)/2;e.moveTo(-3*n,-n),e.lineTo(-n,-n),e.lineTo(-n,-3*n),e.lineTo(n,-3*n),e.lineTo(n,-n),e.lineTo(3*n,-n),e.lineTo(3*n,n),e.lineTo(n,n),e.lineTo(n,3*n),e.lineTo(-n,3*n),e.lineTo(-n,n),e.lineTo(-3*n,n),e.closePath()}};var jL=ee(1/3),nH=jL*2,Jp={draw(e,t){let n=ee(t/nH),r=n*jL;e.moveTo(0,-n),e.lineTo(r,0),e.lineTo(0,n),e.lineTo(-r,0),e.closePath()}};var tm={draw(e,t){let n=ee(t)*.62625;e.moveTo(0,-n),e.lineTo(n,0),e.lineTo(0,n),e.lineTo(-n,0),e.closePath()}};var em={draw(e,t){let n=ee(t-nf(t/7,2))*.87559;e.moveTo(-n,0),e.lineTo(n,0),e.moveTo(0,n),e.lineTo(0,-n)}};var nm={draw(e,t){let n=ee(t),r=-n/2;e.rect(r,r,n,n)}};var rm={draw(e,t){let n=ee(t)*.4431;e.moveTo(n,n),e.lineTo(n,-n),e.lineTo(-n,-n),e.lineTo(-n,n),e.closePath()}};var rH=.8908130915292852,VL=Hp(gl/10)/Hp(7*gl/10),iH=Hp(rf/10)*VL,oH=-aT(rf/10)*VL,im={draw(e,t){let n=ee(t*rH),r=iH*n,i=oH*n;e.moveTo(0,-n),e.lineTo(r,i);for(let o=1;o<5;++o){let s=rf*o/5,a=aT(s),c=Hp(s);e.lineTo(c*n,-a*n),e.lineTo(a*r-c*i,c*r+a*i)}e.closePath()}};var fT=ee(3),om={draw(e,t){let n=-ee(t/(fT*3));e.moveTo(0,n*2),e.lineTo(-fT*n,-n),e.lineTo(fT*n,-n),e.closePath()}};var sH=ee(3),sm={draw(e,t){let n=ee(t)*.6824,r=n/2,i=n*sH/2;e.moveTo(0,-n),e.lineTo(i,r),e.lineTo(-i,r),e.closePath()}};var fi=-.5,di=ee(3)/2,dT=1/ee(12),aH=(dT/2+1)*3,am={draw(e,t){let n=ee(t/aH),r=n/2,i=n*dT,o=r,s=n*dT+n,a=-o,c=s;e.moveTo(r,i),e.lineTo(o,s),e.lineTo(a,c),e.lineTo(fi*r-di*i,di*r+fi*i),e.lineTo(fi*o-di*s,di*o+fi*s),e.lineTo(fi*a-di*c,di*a+fi*c),e.lineTo(fi*r+di*i,fi*i-di*r),e.lineTo(fi*o+di*s,fi*s-di*o),e.lineTo(fi*a+di*c,fi*c-di*a),e.closePath()}};var sf={draw(e,t){let n=ee(t-nf(t/6,1.7))*.6189;e.moveTo(-n,-n),e.lineTo(n,n),e.moveTo(-n,n),e.lineTo(n,-n)}};var I1=[zs,Kp,Jp,nm,im,om,am],hT=[zs,em,sf,sm,Qp,rm,tm];function hi(){}function af(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 cm(e){this._context=e}cm.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:af(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:af(this,e,t);break}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t}};function pT(e){return new cm(e)}function YL(e){this._context=e}YL.prototype={areaStart:hi,areaEnd:hi,lineStart:function(){this._x0=this._x1=this._x2=this._x3=this._x4=this._y0=this._y1=this._y2=this._y3=this._y4=NaN,this._point=0},lineEnd:function(){switch(this._point){case 1:{this._context.moveTo(this._x2,this._y2),this._context.closePath();break}case 2:{this._context.moveTo((this._x2+2*this._x3)/3,(this._y2+2*this._y3)/3),this._context.lineTo((this._x3+2*this._x2)/3,(this._y3+2*this._y2)/3),this._context.closePath();break}case 3:{this.point(this._x2,this._y2),this.point(this._x3,this._y3),this.point(this._x4,this._y4);break}}},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._x2=e,this._y2=t;break;case 1:this._point=2,this._x3=e,this._y3=t;break;case 2:this._point=3,this._x4=e,this._y4=t,this._context.moveTo((this._x0+4*this._x1+e)/6,(this._y0+4*this._y1+t)/6);break;default:af(this,e,t);break}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t}};function mT(e){return new YL(e)}function GL(e){this._context=e}GL.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:af(this,e,t);break}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t}};function yT(e){return new GL(e)}function WL(e,t){this._basis=new cm(e),this._beta=t}WL.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 gT=function e(t){function n(r){return t===1?new cm(r):new WL(r,t)}return n.beta=function(r){return e(+r)},n}(.85);function cf(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 T1(e,t){this._context=e,this._k=(1-t)/6}T1.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:cf(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:cf(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 bT=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:hi,areaEnd:hi,lineStart:function(){this._x0=this._x1=this._x2=this._x3=this._x4=this._x5=this._y0=this._y1=this._y2=this._y3=this._y4=this._y5=NaN,this._point=0},lineEnd:function(){switch(this._point){case 1:{this._context.moveTo(this._x3,this._y3),this._context.closePath();break}case 2:{this._context.lineTo(this._x3,this._y3),this._context.closePath();break}case 3:{this.point(this._x3,this._y3),this.point(this._x4,this._y4),this.point(this._x5,this._y5);break}}},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._x3=e,this._y3=t;break;case 1:this._point=2,this._context.moveTo(this._x4=e,this._y4=t);break;case 2:this._point=3,this._x5=e,this._y5=t;break;default:cf(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 xT=function e(t){function n(r){return new E1(r,t)}return n.tension=function(r){return e(+r)},n}(0);function M1(e,t){this._context=e,this._k=(1-t)/6}M1.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:cf(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 _T=function e(t){function n(r){return new M1(r,t)}return n.tension=function(r){return e(+r)},n}(0);function lm(e,t,n){var r=e._x1,i=e._y1,o=e._x2,s=e._y2;if(e._l01_a>cT){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>cT){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 XL(e,t){this._context=e,this._alpha=t}XL.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:lm(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 wT=function e(t){function n(r){return t?new XL(r,t):new T1(r,0)}return n.alpha=function(r){return e(+r)},n}(.5);function HL(e,t){this._context=e,this._alpha=t}HL.prototype={areaStart:hi,areaEnd:hi,lineStart:function(){this._x0=this._x1=this._x2=this._x3=this._x4=this._x5=this._y0=this._y1=this._y2=this._y3=this._y4=this._y5=NaN,this._l01_a=this._l12_a=this._l23_a=this._l01_2a=this._l12_2a=this._l23_2a=this._point=0},lineEnd:function(){switch(this._point){case 1:{this._context.moveTo(this._x3,this._y3),this._context.closePath();break}case 2:{this._context.lineTo(this._x3,this._y3),this._context.closePath();break}case 3:{this.point(this._x3,this._y3),this.point(this._x4,this._y4),this.point(this._x5,this._y5);break}}},point:function(e,t){if(e=+e,t=+t,this._point){var n=this._x2-e,r=this._y2-t;this._l23_a=Math.sqrt(this._l23_2a=Math.pow(n*n+r*r,this._alpha))}switch(this._point){case 0:this._point=1,this._x3=e,this._y3=t;break;case 1:this._point=2,this._context.moveTo(this._x4=e,this._y4=t);break;case 2:this._point=3,this._x5=e,this._y5=t;break;default:lm(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 vT=function e(t){function n(r){return t?new HL(r,t):new E1(r,0)}return n.alpha=function(r){return e(+r)},n}(.5);function ZL(e,t){this._context=e,this._alpha=t}ZL.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:lm(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 ST=function e(t){function n(r){return t?new ZL(r,t):new M1(r,0)}return n.alpha=function(r){return e(+r)},n}(.5);function QL(e){this._context=e}QL.prototype={areaStart:hi,areaEnd:hi,lineStart:function(){this._point=0},lineEnd:function(){this._point&&this._context.closePath()},point:function(e,t){e=+e,t=+t,this._point?this._context.lineTo(e,t):(this._point=1,this._context.moveTo(e,t))}};function IT(e){return new QL(e)}function KL(e){return e<0?-1:1}function JL(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(KL(o)+KL(s))*Math.min(Math.abs(o),Math.abs(s),.5*Math.abs(a))||0}function t5(e,t){var n=e._x1-e._x0;return n?(3*(e._y1-e._y0)/n-t)/2:t}function TT(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 A1(e){this._context=e}A1.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:TT(this,this._t0,t5(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,TT(this,t5(this,n=JL(this,e,t)),n);break;default:TT(this,this._t0,n=JL(this,e,t));break}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t,this._t0=n}}};function e5(e){this._context=new n5(e)}(e5.prototype=Object.create(A1.prototype)).point=function(e,t){A1.prototype.point.call(this,t,e)};function n5(e){this._context=e}n5.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 ET(e){return new A1(e)}function MT(e){return new e5(e)}function i5(e){this._context=e}i5.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=r5(e),i=r5(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 r5(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 AT(e){return new i5(e)}function N1(e,t){this._context=e,this._t=t}N1.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 NT(e){return new N1(e,.5)}function RT(e){return new N1(e,0)}function OT(e){return new N1(e,1)}var um=e=>()=>e;function DT(e,{sourceEvent:t,target:n,transform:r,dispatch:i}){Object.defineProperties(this,{type:{value:e,enumerable:!0,configurable:!0},sourceEvent:{value:t,enumerable:!0,configurable:!0},target:{value:n,enumerable:!0,configurable:!0},transform:{value:r,enumerable:!0,configurable:!0},_:{value:i}})}function Ur(e,t,n){this.k=e,this.x=t,this.y=n}Ur.prototype={constructor:Ur,scale:function(e){return e===1?this:new Ur(this.k*e,this.x,this.y)},translate:function(e,t){return e===0&t===0?this:new Ur(this.k,this.x+this.k*e,this.y+this.k*t)},apply:function(e){return[e[0]*this.k+this.x,e[1]*this.k+this.y]},applyX:function(e){return e*this.k+this.x},applyY:function(e){return e*this.k+this.y},invert:function(e){return[(e[0]-this.x)/this.k,(e[1]-this.y)/this.k]},invertX:function(e){return(e-this.x)/this.k},invertY:function(e){return(e-this.y)/this.k},rescaleX:function(e){return e.copy().domain(e.range().map(this.invertX,this).map(e.invert,e))},rescaleY:function(e){return e.copy().domain(e.range().map(this.invertY,this).map(e.invert,e))},toString:function(){return"translate("+this.x+","+this.y+") scale("+this.k+")"}};var fm=new Ur(1,0,0);kT.prototype=Ur.prototype;function kT(e){for(;!e.__zoom;)if(!(e=e.parentNode))return fm;return e.__zoom}function R1(e){e.stopImmediatePropagation()}function lf(e){e.preventDefault(),e.stopImmediatePropagation()}function cH(e){return(!e.ctrlKey||e.type==="wheel")&&!e.button}function lH(){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 o5(){return this.__zoom||fm}function uH(e){return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*(e.ctrlKey?10:1)}function fH(){return navigator.maxTouchPoints||"ontouchstart"in this}function dH(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 FT(){var e=cH,t=lH,n=dH,r=uH,i=fH,o=[0,1/0],s=[[-1/0,-1/0],[1/0,1/0]],a=250,c=cS,l=Yc("start","zoom","end"),u,f,d,h=500,p=150,y=0,b=10;function m(S){S.property("__zoom",o5).on("wheel.zoom",A,{passive:!1}).on("mousedown.zoom",R).on("dblclick.zoom",I).filter(i).on("touchstart.zoom",E).on("touchmove.zoom",O).on("touchend.zoom touchcancel.zoom",k).style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}m.transform=function(S,M,N,F){var B=S.selection?S.selection():S;B.property("__zoom",o5),S!==B?v(S,M,N,F):B.interrupt().each(function(){w(this,arguments).event(F).start().zoom(null,typeof M=="function"?M.apply(this,arguments):M).end()})},m.scaleBy=function(S,M,N,F){m.scaleTo(S,function(){var B=this.__zoom.k,C=typeof M=="function"?M.apply(this,arguments):M;return B*C},N,F)},m.scaleTo=function(S,M,N,F){m.transform(S,function(){var B=t.apply(this,arguments),C=this.__zoom,P=N==null?_(B):typeof N=="function"?N.apply(this,arguments):N,U=C.invert(P),$=typeof M=="function"?M.apply(this,arguments):M;return n(x(g(C,$),P,U),B,s)},N,F)},m.translateBy=function(S,M,N,F){m.transform(S,function(){return n(this.__zoom.translate(typeof M=="function"?M.apply(this,arguments):M,typeof N=="function"?N.apply(this,arguments):N),t.apply(this,arguments),s)},null,F)},m.translateTo=function(S,M,N,F,B){m.transform(S,function(){var C=t.apply(this,arguments),P=this.__zoom,U=F==null?_(C):typeof F=="function"?F.apply(this,arguments):F;return n(fm.translate(U[0],U[1]).scale(P.k).translate(typeof M=="function"?-M.apply(this,arguments):-M,typeof N=="function"?-N.apply(this,arguments):-N),C,s)},F,B)};function g(S,M){return M=Math.max(o[0],Math.min(o[1],M)),M===S.k?S:new Ur(M,S.x,S.y)}function x(S,M,N){var F=M[0]-N[0]*S.k,B=M[1]-N[1]*S.k;return F===S.x&&B===S.y?S:new Ur(S.k,F,B)}function _(S){return[(+S[0][0]+ +S[1][0])/2,(+S[0][1]+ +S[1][1])/2]}function v(S,M,N,F){S.on("start.zoom",function(){w(this,arguments).event(F).start()}).on("interrupt.zoom end.zoom",function(){w(this,arguments).event(F).end()}).tween("zoom",function(){var B=this,C=arguments,P=w(B,C).event(F),U=t.apply(B,C),$=N==null?_(U):typeof N=="function"?N.apply(B,C):N,X=Math.max(U[1][0]-U[0][0],U[1][1]-U[0][1]),tt=B.__zoom,nt=typeof M=="function"?M.apply(B,C):M,st=c(tt.invert($).concat(X/tt.k),nt.invert($).concat(X/nt.k));return function(Y){if(Y===1)Y=nt;else{var rt=st(Y),q=X/rt[2];Y=new Ur(q,$[0]-rt[0]*q,$[1]-rt[1]*q)}P.zoom(null,Y)}})}function w(S,M,N){return!N&&S.__zooming||new T(S,M)}function T(S,M){this.that=S,this.args=M,this.active=0,this.sourceEvent=null,this.extent=t.apply(S,M),this.taps=0}T.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,M){return this.mouse&&S!=="mouse"&&(this.mouse[1]=M.invert(this.mouse[0])),this.touch0&&S!=="touch"&&(this.touch0[1]=M.invert(this.touch0[0])),this.touch1&&S!=="touch"&&(this.touch1[1]=M.invert(this.touch1[0])),this.that.__zoom=M,this.emit("zoom"),this},end:function(){return--this.active===0&&(delete this.that.__zooming,this.emit("end")),this},emit:function(S){var M=zt(this.that).datum();l.call(S,this.that,new DT(S,{sourceEvent:this.sourceEvent,target:m,type:S,transform:this.that.__zoom,dispatch:l}),M)}};function A(S,...M){if(!e.apply(this,arguments))return;var N=w(this,M).event(S),F=this.__zoom,B=Math.max(o[0],Math.min(o[1],F.k*Math.pow(2,r.apply(this,arguments)))),C=Fn(S);if(N.wheel)(N.mouse[0][0]!==C[0]||N.mouse[0][1]!==C[1])&&(N.mouse[1]=F.invert(N.mouse[0]=C)),clearTimeout(N.wheel);else{if(F.k===B)return;N.mouse=[C,F.invert(C)],mo(this),N.start()}lf(S),N.wheel=setTimeout(P,p),N.zoom("mouse",n(x(g(F,B),N.mouse[0],N.mouse[1]),N.extent,s));function P(){N.wheel=null,N.end()}}function R(S,...M){if(d||!e.apply(this,arguments))return;var N=S.currentTarget,F=w(this,M,!0).event(S),B=zt(S.view).on("mousemove.zoom",$,!0).on("mouseup.zoom",X,!0),C=Fn(S,N),P=S.clientX,U=S.clientY;zh(S.view),R1(S),F.mouse=[C,this.__zoom.invert(C)],mo(this),F.start();function $(tt){if(lf(tt),!F.moved){var nt=tt.clientX-P,st=tt.clientY-U;F.moved=nt*nt+st*st>y}F.event(tt).zoom("mouse",n(x(F.that.__zoom,F.mouse[0]=Fn(tt,N),F.mouse[1]),F.extent,s))}function X(tt){B.on("mousemove.zoom mouseup.zoom",null),qh(tt.view,F.moved),lf(tt),F.event(tt).end()}}function I(S,...M){if(e.apply(this,arguments)){var N=this.__zoom,F=Fn(S.changedTouches?S.changedTouches[0]:S,this),B=N.invert(F),C=N.k*(S.shiftKey?.5:2),P=n(x(g(N,C),F,B),t.apply(this,M),s);lf(S),a>0?zt(this).transition().duration(a).call(v,P,F,S):zt(this).call(m.transform,P,F,S)}}function E(S,...M){if(e.apply(this,arguments)){var N=S.touches,F=N.length,B=w(this,M,S.changedTouches.length===F).event(S),C,P,U,$;for(R1(S),P=0;P<F;++P)U=N[P],$=Fn(U,this),$=[$,this.__zoom.invert($),U.identifier],B.touch0?!B.touch1&&B.touch0[2]!==$[2]&&(B.touch1=$,B.taps=0):(B.touch0=$,C=!0,B.taps=1+!!u);u&&(u=clearTimeout(u)),C&&(B.taps<2&&(f=$[0],u=setTimeout(function(){u=null},h)),mo(this),B.start())}}function O(S,...M){if(this.__zooming){var N=w(this,M).event(S),F=S.changedTouches,B=F.length,C,P,U,$;for(lf(S),C=0;C<B;++C)P=F[C],U=Fn(P,this),N.touch0&&N.touch0[2]===P.identifier?N.touch0[0]=U:N.touch1&&N.touch1[2]===P.identifier&&(N.touch1[0]=U);if(P=N.that.__zoom,N.touch1){var X=N.touch0[0],tt=N.touch0[1],nt=N.touch1[0],st=N.touch1[1],Y=(Y=nt[0]-X[0])*Y+(Y=nt[1]-X[1])*Y,rt=(rt=st[0]-tt[0])*rt+(rt=st[1]-tt[1])*rt;P=g(P,Math.sqrt(Y/rt)),U=[(X[0]+nt[0])/2,(X[1]+nt[1])/2],$=[(tt[0]+st[0])/2,(tt[1]+st[1])/2]}else if(N.touch0)U=N.touch0[0],$=N.touch0[1];else return;N.zoom("touch",n(x(P,U,$),N.extent,s))}}function k(S,...M){if(this.__zooming){var N=w(this,M).event(S),F=S.changedTouches,B=F.length,C,P;for(R1(S),d&&clearTimeout(d),d=setTimeout(function(){d=null},h),C=0;C<B;++C)P=F[C],N.touch0&&N.touch0[2]===P.identifier?delete N.touch0:N.touch1&&N.touch1[2]===P.identifier&&delete N.touch1;if(N.touch1&&!N.touch0&&(N.touch0=N.touch1,delete N.touch1),N.touch0)N.touch0[1]=this.__zoom.invert(N.touch0[0]);else if(N.end(),N.taps===2&&(P=Fn(P,this),Math.hypot(f[0]-P[0],f[1]-P[1])<b)){var U=zt(this).on("dblclick.zoom");U&&U.apply(this,arguments)}}}return m.wheelDelta=function(S){return arguments.length?(r=typeof S=="function"?S:um(+S),m):r},m.filter=function(S){return arguments.length?(e=typeof S=="function"?S:um(!!S),m):e},m.touchable=function(S){return arguments.length?(i=typeof S=="function"?S:um(!!S),m):i},m.extent=function(S){return arguments.length?(t=typeof S=="function"?S:um([[+S[0][0],+S[0][1]],[+S[1][0],+S[1][1]]]),m):t},m.scaleExtent=function(S){return arguments.length?(o[0]=+S[0],o[1]=+S[1],m):[o[0],o[1]]},m.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],m):[[s[0][0],s[0][1]],[s[1][0],s[1][1]]]},m.constrain=function(S){return arguments.length?(n=S,m):n},m.duration=function(S){return arguments.length?(a=+S,m):a},m.interpolate=function(S){return arguments.length?(c=S,m):c},m.on=function(){var S=l.on.apply(l,arguments);return S===l?m:S},m.clickDistance=function(S){return arguments.length?(y=(S=+S)*S,m):Math.sqrt(y)},m.tapDistance=function(S){return arguments.length?(b=+S,m):b},m}function $e(e){return e!=null&&!Number.isNaN(e)}function fn(e,t){return+$e(t)-+$e(e)||Gt(e,t)}function bl(e,t){return+$e(t)-+$e(e)||Xn(e,t)}function dm(e){return e!=null&&`${e}`!=""}function uf(e){return isFinite(e)?e:NaN}function ir(e){return e>0&&isFinite(e)?e:NaN}function qa(e){return e<0&&isFinite(e)?e:NaN}function ff(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`${hH(e.getUTCFullYear(),4)}-${qs(e.getUTCMonth()+1,2)}-${qs(e.getUTCDate(),2)}${n||r||i||o?`T${qs(n,2)}:${qs(r,2)}${i||o?`:${qs(i,2)}${o?`.${qs(o,3)}`:""}`:""}Z`:""}`}function hH(e){return e<0?`-${qs(-e,6)}`:e>9999?`+${qs(e,6)}`:qs(e,4)}function qs(e,t){return`${e}`.padStart(t,"0")}var pH=/^(?:[-+]\d{2})?\d{4}(?:-\d{2}(?:-\d{2})?)?(?:T\d{2}:\d{2}(?::\d{2}(?:\.\d{3})?)?(?:Z|[-+]\d{2}:?\d{2})?)?$/;function hm(e,t){return pH.test(e+="")?new Date(e):typeof t=="function"?t(e):t}var hf=1e3,Va=hf*60,Ya=Va*60,No=Ya*24,Ao=No*7,xl=No*30,ja=No*365,LT=[["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",hf],["5 seconds",5*hf],["15 seconds",15*hf],["30 seconds",30*hf],["minute",Va],["5 minutes",5*Va],["15 minutes",15*Va],["30 minutes",30*Va],["hour",Ya],["3 hours",3*Ya],["6 hours",6*Ya],["12 hours",12*Ya],["day",No],["2 days",2*No],["week",Ao],["2 weeks",2*Ao],["month",xl],["3 months",3*xl],["6 months",6*xl],["year",ja],["2 years",2*ja],["5 years",5*ja],["10 years",10*ja],["20 years",20*ja],["50 years",50*ja],["100 years",100*ja]],CT=new Map([["second",hf],["minute",Va],["hour",Ya],["day",No],["monday",Ao],["tuesday",Ao],["wednesday",Ao],["thursday",Ao],["friday",Ao],["saturday",Ao],["sunday",Ao],["week",Ao],["month",xl],["year",ja]]),a5=new Map([["second",ln],["minute",Fs],["hour",Cs],["day",ui],["monday",$a],["tuesday",Xb],["wednesday",Hb],["thursday",To],["friday",Zb],["saturday",Qb],["sunday",Br],["week",Br],["month",Ps],["year",Un]]),BT=new Map([["second",ln],["minute",Ls],["hour",Bs],["day",pl],["monday",za],["tuesday",Kb],["wednesday",Jb],["thursday",Eo],["friday",tx],["saturday",ex],["sunday",Pr],["week",Pr],["month",Us],["year",$n]]),pf=Symbol("intervalDuration"),D1=Symbol("intervalType");for(let[e,t]of a5)t[pf]=CT.get(e),t[D1]="time";for(let[e,t]of BT)t[pf]=CT.get(e),t[D1]="utc";var pm=[["year",$n,"utc"],["month",Us,"utc"],["day",pl,"utc",6*xl],["hour",Bs,"utc",3*No],["minute",Ls,"utc",6*Ya],["second",ln,"utc",30*Va]],O1=[["year",Un,"time"],["month",Ps,"time"],["day",ui,"time",6*xl],["hour",Cs,"time",3*No],["minute",Fs,"time",6*Ya],["second",ln,"time",30*Va]],mH=[pm[0],O1[0],pm[1],O1[1],pm[2],O1[2],...pm.slice(3)];function k1(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=BT.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 PT(e){return c5(k1(e),"time")}function mm(e){return c5(k1(e),"utc")}function c5([e,t],n){let r=(n==="time"?a5:BT).get(e);return t>1&&(r=r.every(t),r[pf]=CT.get(e)*t,r[D1]=n),r}function UT(e,t){if(!(t>1))return;let n=e[pf];if(!LT.some(([,i])=>i===n)||n%No===0&&No<n&&n<xl)return;let[r]=LT[_s(([,i])=>Math.log(i)).center(LT,Math.log(n*t))];return(e[D1]==="time"?PT:mm)(r)}function s5(e,t,n){let r=t==="time"?Ju:Mo;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=yH(n);switch(e){case"millisecond":return df(r(".%L"),r(":%M:%S"),i);case"second":return df(r(":%S"),r("%-I:%M"),i);case"minute":return df(r("%-I:%M"),r("%p"),i);case"hour":return df(r("%-I %p"),r("%b %-d"),i);case"day":return df(r("%-d"),r("%b"),i);case"month":return df(r("%b"),r("%Y"),i);case"year":return r("%Y")}throw new Error("unable to format time ticks")}function yH(e){return e==="left"||e==="right"?(t,n)=>`
10
+ ]`}concat(...t){let r=this.schema,n=this.data.concat(t.flatMap(({data:i})=>i));return new e(r,n.map(i=>new dr(r,i)))}slice(t,r){let n=this.schema;[t,r]=qm({length:this.numRows},t,r);let i=F_(this.data,this._offsets,t,r);return new e(n,i.map(o=>new dr(n,o)))}getChild(t){return this.getChildAt(this.schema.fields.findIndex(r=>r.name===t))}getChildAt(t){if(t>-1&&t<this.schema.fields.length){let r=this.data.map(n=>n.children[t]);if(r.length===0){let{type:n}=this.schema.fields[t],i=Vt({type:n,length:0,nullCount:0});r.push(i._changeLengthAndBackfillNullBitmap(this.numRows))}return new le(r)}return null}setChild(t,r){var n;return this.setChildAt((n=this.schema.fields)===null||n===void 0?void 0:n.findIndex(i=>i.name===t),r)}setChildAt(t,r){let n=this.schema,i=[...this.batches];if(t>-1&&t<this.numCols){r||(r=new le([Vt({type:new Un,length:this.numRows})]));let o=n.fields.slice(),s=o[t].clone({type:r.type}),a=this.schema.fields.map((c,l)=>this.getChildAt(l));[o[t],a[t]]=[s,r],[n,i]=a1(n,a)}return new e(n,i)}select(t){let r=this.schema.fields.reduce((n,i,o)=>n.set(i.name,o),new Map);return this.selectAt(t.map(n=>r.get(n)).filter(n=>n>-1))}selectAt(t){let r=this.schema.selectAt(t),n=this.batches.map(i=>i.selectAt(t));return new e(r,n)}assign(t){let r=this.schema.fields,[n,i]=t.schema.fields.reduce((a,c,l)=>{let[u,f]=a,d=r.findIndex(h=>h.name===c.name);return~d?f[d]=l:u.push(l),a},[[],[]]),o=this.schema.assign(t.schema),s=[...r.map((a,c)=>[c,i[c]]).map(([a,c])=>c===void 0?this.getChildAt(a):t.getChildAt(c)),...n.map(a=>t.getChildAt(a))].filter(Boolean);return new e(...a1(o,s))}};TC=Symbol.toStringTag;fi[TC]=(e=>(e.schema=null,e.batches=[],e._offsets=new Uint32Array([0]),e._nullCount=-1,e[Symbol.isConcatSpreadable]=!0,e.isValid=Pd(Gm),e.get=Pd(Mr.getVisitFn(F.Struct)),e.set=L_(sn.getVisitFn(F.Struct)),e.indexOf=R_(Wu.getVisitFn(F.Struct)),"Table"))(fi.prototype);var MC,dr=class e{constructor(...t){switch(t.length){case 2:{if([this.schema]=t,!(this.schema instanceof Ie))throw new TypeError("RecordBatch constructor expects a [Schema, Data] pair.");if([,this.data=Vt({nullCount:0,type:new ze(this.schema.fields),children:this.schema.fields.map(r=>Vt({type:r.type,nullCount:0}))})]=t,!(this.data instanceof _e))throw new TypeError("RecordBatch constructor expects a [Schema, Data] pair.");[this.schema,this.data]=AC(this.schema,this.data.children);break}case 1:{let[r]=t,{fields:n,children:i,length:o}=Object.keys(r).reduce((c,l,u)=>(c.children[u]=r[l],c.length=Math.max(c.length,r[l].length),c.fields[u]=re.new({name:l,type:r[l].type,nullable:!0}),c),{length:0,fields:new Array,children:new Array}),s=new Ie(n),a=Vt({type:new ze(n),length:o,children:i,nullCount:0});[this.schema,this.data]=AC(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=EC(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 Mr.visit(this.data,t)}set(t,r){return sn.visit(this.data,t,r)}indexOf(t,r){return Wu.visit(this.data,t,r)}[Symbol.iterator](){return $d.visit(new le([this.data]))}toArray(){return[...this]}concat(...t){return new fi(this.schema,[this,...t])}slice(t,r){let[n]=new le([this.data]).slice(t,r).data;return new e(this.schema,n)}getChild(t){var r;return this.getChildAt((r=this.schema.fields)===null||r===void 0?void 0:r.findIndex(n=>n.name===t))}getChildAt(t){return t>-1&&t<this.schema.fields.length?new le([this.data.children[t]]):null}setChild(t,r){var n;return this.setChildAt((n=this.schema.fields)===null||n===void 0?void 0:n.findIndex(i=>i.name===t),r)}setChildAt(t,r){let n=this.schema,i=this.data;if(t>-1&&t<this.numCols){r||(r=new le([Vt({type:new Un,length:this.numRows})]));let o=n.fields.slice(),s=i.children.slice(),a=o[t].clone({type:r.type});[o[t],s[t]]=[a,r.data[0]],n=new Ie(o,new Map(this.schema.metadata)),i=Vt({type:new ze(o),children:s})}return new e(n,i)}select(t){let r=this.schema.select(t),n=new ze(r.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(r,Vt({type:n,length:this.numRows,children:i}))}selectAt(t){let r=this.schema.selectAt(t),n=t.map(o=>this.data.children[o]).filter(Boolean),i=Vt({type:new ze(r.fields),length:this.numRows,children:n});return new e(r,i)}};MC=Symbol.toStringTag;dr[MC]=(e=>(e._nullCount=-1,e[Symbol.isConcatSpreadable]=!0,"RecordBatch"))(dr.prototype);function AC(e,t,r=t.reduce((n,i)=>Math.max(n,i.length),0)){var n;let i=[...e.fields],o=[...t],s=(r+63&-64)>>3;for(let[a,c]of e.fields.entries()){let l=t[a];(!l||l.length!==r)&&(i[a]=c.clone({nullable:!0}),o[a]=(n=l?._changeLengthAndBackfillNullBitmap(r))!==null&&n!==void 0?n:Vt({type:c.type,length:r,nullCount:r,nullBitmap:new Uint8Array(s)}))}return[e.assign(i),Vt({type:new ze(i),length:r,children:o})]}function EC(e,t,r=new Map){var n,i;if(((n=e?.length)!==null&&n!==void 0?n: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)||[]])EC(a.children,l?.children,r);if(lt.isDictionary(a)){let{id:l}=a;if(!r.has(l))c?.dictionary&&r.set(l,c.dictionary);else if(r.get(l)!==c.dictionary)throw new Error("Cannot create Schema containing two different dictionaries with the same Id")}}return r}var ef=class extends dr{constructor(t){let r=t.fields.map(i=>Vt({type:i.type})),n=Vt({type:new ze(t.fields),nullCount:0,children:r});super(t,n)}};var Go=class e{constructor(){this.bb=null,this.bb_pos=0}__init(t,r){return this.bb_pos=t,this.bb=r,this}static getRootAsMessage(t,r){return(r||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsMessage(t,r){return t.setPosition(t.position()+4),(r||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):Ee.V1}headerType(){let t=this.bb.__offset(this.bb_pos,6);return t?this.bb.readUint8(this.bb_pos+t):oe.NONE}header(t){let r=this.bb.__offset(this.bb_pos,8);return r?this.bb.__union(t,this.bb_pos+r):null}bodyLength(){let t=this.bb.__offset(this.bb_pos,10);return t?this.bb.readInt64(this.bb_pos+t):BigInt("0")}customMetadata(t,r){let n=this.bb.__offset(this.bb_pos,12);return n?(r||new zr).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+n)+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,r){t.addFieldInt16(0,r,Ee.V1)}static addHeaderType(t,r){t.addFieldInt8(1,r,oe.NONE)}static addHeader(t,r){t.addFieldOffset(2,r,0)}static addBodyLength(t,r){t.addFieldInt64(3,r,BigInt("0"))}static addCustomMetadata(t,r){t.addFieldOffset(4,r,0)}static createCustomMetadataVector(t,r){t.startVector(4,r.length,4);for(let n=r.length-1;n>=0;n--)t.addOffset(r[n]);return t.endVector()}static startCustomMetadataVector(t,r){t.startVector(4,r,4)}static endMessage(t){return t.endObject()}static finishMessageBuffer(t,r){t.finish(r)}static finishSizePrefixedMessageBuffer(t,r){t.finish(r,void 0,!0)}static createMessage(t,r,n,i,o,s){return e.startMessage(t),e.addVersion(t,r),e.addHeaderType(t,n),e.addHeader(t,i),e.addBodyLength(t,o),e.addCustomMetadata(t,s),e.endMessage(t)}};var VA=class extends xt{visit(t,r){return t==null||r==null?void 0:super.visit(t,r)}visitNull(t,r){return Um.startNull(r),Um.endNull(r)}visitInt(t,r){return Ro.startInt(r),Ro.addBitWidth(r,t.bitWidth),Ro.addIsSigned(r,t.isSigned),Ro.endInt(r)}visitFloat(t,r){return wl.startFloatingPoint(r),wl.addPrecision(r,t.precision),wl.endFloatingPoint(r)}visitBinary(t,r){return Fm.startBinary(r),Fm.endBinary(r)}visitLargeBinary(t,r){return Rm.startLargeBinary(r),Rm.endLargeBinary(r)}visitBool(t,r){return Lm.startBool(r),Lm.endBool(r)}visitUtf8(t,r){return $m.startUtf8(r),$m.endUtf8(r)}visitLargeUtf8(t,r){return km.startLargeUtf8(r),km.endLargeUtf8(r)}visitDecimal(t,r){return Es.startDecimal(r),Es.addScale(r,t.scale),Es.addPrecision(r,t.precision),Es.addBitWidth(r,t.bitWidth),Es.endDecimal(r)}visitDate(t,r){return gl.startDate(r),gl.addUnit(r,t.unit),gl.endDate(r)}visitTime(t,r){return Oa.startTime(r),Oa.addUnit(r,t.unit),Oa.addBitWidth(r,t.bitWidth),Oa.endTime(r)}visitTimestamp(t,r){let n=t.timezone&&r.createString(t.timezone)||void 0;return Na.startTimestamp(r),Na.addUnit(r,t.unit),n!==void 0&&Na.addTimezone(r,n),Na.endTimestamp(r)}visitInterval(t,r){return vl.startInterval(r),vl.addUnit(r,t.unit),vl.endInterval(r)}visitDuration(t,r){return bl.startDuration(r),bl.addUnit(r,t.unit),bl.endDuration(r)}visitList(t,r){return Cm.startList(r),Cm.endList(r)}visitStruct(t,r){return Pm.startStruct_(r),Pm.endStruct_(r)}visitUnion(t,r){ko.startTypeIdsVector(r,t.typeIds.length);let n=ko.createTypeIdsVector(r,t.typeIds);return ko.startUnion(r),ko.addMode(r,t.mode),ko.addTypeIds(r,n),ko.endUnion(r)}visitDictionary(t,r){let n=this.visit(t.indices,r);return Ms.startDictionaryEncoding(r),Ms.addId(r,BigInt(t.id)),Ms.addIsOrdered(r,t.isOrdered),n!==void 0&&Ms.addIndexType(r,n),Ms.endDictionaryEncoding(r)}visitFixedSizeBinary(t,r){return xl.startFixedSizeBinary(r),xl.addByteWidth(r,t.byteWidth),xl.endFixedSizeBinary(r)}visitFixedSizeList(t,r){return _l.startFixedSizeList(r),_l.addListSize(r,t.listSize),_l.endFixedSizeList(r)}visitMap(t,r){return Sl.startMap(r),Sl.addKeysSorted(r,t.keysSorted),Sl.endMap(r)}},c1=new VA;function NC(e,t=new Map){return new Ie(JH(e,t),l1(e.metadata),t)}function jA(e){return new an(e.count,LC(e.columns),RC(e.columns))}function FC(e){return new hi(jA(e.data),e.id,e.isDelta)}function JH(e,t){return(e.fields||[]).filter(Boolean).map(r=>re.fromJSON(r,t))}function DC(e,t){return(e.children||[]).filter(Boolean).map(r=>re.fromJSON(r,t))}function LC(e){return(e||[]).reduce((t,r)=>[...t,new oo(r.count,tZ(r.VALIDITY)),...LC(r.children)],[])}function RC(e,t=[]){for(let r=-1,n=(e||[]).length;++r<n;){let i=e[r];i.VALIDITY&&t.push(new di(t.length,i.VALIDITY.length)),i.TYPE_ID&&t.push(new di(t.length,i.TYPE_ID.length)),i.OFFSET&&t.push(new di(t.length,i.OFFSET.length)),i.DATA&&t.push(new di(t.length,i.DATA.length)),t=RC(i.children,t)}return t}function tZ(e){return(e||[]).reduce((t,r)=>t+ +(r===0),0)}function kC(e,t){let r,n,i,o,s,a;return!t||!(o=e.dictionary)?(s=OC(e,DC(e,t)),i=new re(e.name,s,e.nullable,l1(e.metadata))):t.has(r=o.id)?(n=(n=o.indexType)?BC(n):new Ds,a=new Di(t.get(r),n,r,o.isOrdered),i=new re(e.name,a,e.nullable,l1(e.metadata))):(n=(n=o.indexType)?BC(n):new Ds,t.set(r,s=OC(e,DC(e,t))),a=new Di(s,n,r,o.isOrdered),i=new re(e.name,a,e.nullable,l1(e.metadata))),i||null}function l1(e=[]){return new Map(e.map(({key:t,value:r})=>[t,r]))}function BC(e){return new br(e.isSigned,e.bitWidth)}function OC(e,t){let r=e.type.name;switch(r){case"NONE":return new Un;case"null":return new Un;case"binary":return new Fa;case"largebinary":return new La;case"utf8":return new Ra;case"largeutf8":return new ka;case"bool":return new Ca;case"list":return new zo((t||[])[0]);case"struct":return new ze(t||[]);case"struct_":return new ze(t||[])}switch(r){case"int":{let n=e.type;return new br(n.isSigned,n.bitWidth)}case"floatingpoint":{let n=e.type;return new li(Le[n.precision])}case"decimal":{let n=e.type;return new Ua(n.scale,n.precision,n.bitWidth)}case"date":{let n=e.type;return new Pa(Tr[n.unit])}case"time":{let n=e.type;return new $o(ft[n.unit],n.bitWidth)}case"timestamp":{let n=e.type;return new $a(ft[n.unit],n.timezone)}case"interval":{let n=e.type;return new za(Wr[n.unit])}case"duration":{let n=e.type;return new Va(ft[n.unit])}case"union":{let n=e.type,[i,...o]=(n.mode+"").toLowerCase(),s=i.toUpperCase()+o.join("");return new Vo(Ue[s],n.typeIds||[],t||[])}case"fixedsizebinary":{let n=e.type;return new ja(n.byteWidth)}case"fixedsizelist":{let n=e.type;return new jo(n.listSize,(t||[])[0])}case"map":{let n=e.type;return new qo((t||[])[0],n.keysSorted)}}throw new Error(`Unrecognized type: "${r}"`)}var eZ=Lo,rZ=Ar,pi=class e{static fromJSON(t,r){let n=new e(0,Ee.V5,r);return n._createHeader=nZ(t,r),n}static decode(t){t=new rZ(Et(t));let r=Go.getRootAsMessage(t),n=r.bodyLength(),i=r.version(),o=r.headerType(),s=new e(n,i,o);return s._createHeader=iZ(r,o),s}static encode(t){let r=new eZ,n=-1;return t.isSchema()?n=Ie.encode(r,t.header()):t.isRecordBatch()?n=an.encode(r,t.header()):t.isDictionaryBatch()&&(n=hi.encode(r,t.header())),Go.startMessage(r),Go.addVersion(r,Ee.V5),Go.addHeader(r,n),Go.addHeaderType(r,t.headerType),Go.addBodyLength(r,BigInt(t.bodyLength)),Go.finishMessageBuffer(r,Go.endMessage(r)),r.asUint8Array()}static from(t,r=0){if(t instanceof Ie)return new e(0,Ee.V5,oe.Schema,t);if(t instanceof an)return new e(r,Ee.V5,oe.RecordBatch,t);if(t instanceof hi)return new e(r,Ee.V5,oe.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===oe.Schema}isRecordBatch(){return this.headerType===oe.RecordBatch}isDictionaryBatch(){return this.headerType===oe.DictionaryBatch}constructor(t,r,n,i){this._version=r,this._headerType=n,this.body=new Uint8Array(0),i&&(this._createHeader=()=>i),this._bodyLength=or(t)}},an=class{get nodes(){return this._nodes}get length(){return this._length}get buffers(){return this._buffers}constructor(t,r,n){this._nodes=r,this._buffers=n,this._length=or(t)}},hi=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,r,n=!1){this._data=t,this._isDelta=n,this._id=or(r)}},di=class{constructor(t,r){this.offset=or(t),this.length=or(r)}},oo=class{constructor(t,r){this.length=or(t),this.nullCount=or(r)}};function nZ(e,t){return()=>{switch(t){case oe.Schema:return Ie.fromJSON(e);case oe.RecordBatch:return an.fromJSON(e);case oe.DictionaryBatch:return hi.fromJSON(e)}throw new Error(`Unrecognized Message type: { name: ${oe[t]}, type: ${t} }`)}}function iZ(e,t){return()=>{switch(t){case oe.Schema:return Ie.decode(e.header(new ci),new Map,e.version());case oe.RecordBatch:return an.decode(e.header(new Ei),e.version());case oe.DictionaryBatch:return hi.decode(e.header(new Ba),e.version())}throw new Error(`Unrecognized Message type: { name: ${oe[t]}, type: ${t} }`)}}re.encode=mZ;re.decode=hZ;re.fromJSON=kC;Ie.encode=pZ;Ie.decode=oZ;Ie.fromJSON=NC;an.encode=yZ;an.decode=sZ;an.fromJSON=jA;hi.encode=gZ;hi.decode=aZ;hi.fromJSON=FC;oo.encode=bZ;oo.decode=lZ;di.encode=xZ;di.decode=cZ;function oZ(e,t=new Map,r=Ee.V5){let n=dZ(e,t);return new Ie(n,u1(e),t,r)}function sZ(e,t=Ee.V5){if(e.compression()!==null)throw new Error("Record batch compression not implemented");return new an(e.length(),uZ(e),fZ(e,t))}function aZ(e,t=Ee.V5){return new hi(an.decode(e.data(),t),e.id(),e.isDelta())}function cZ(e){return new di(e.offset(),e.length())}function lZ(e){return new oo(e.length(),e.nullCount())}function uZ(e){let t=[];for(let r,n=-1,i=-1,o=e.nodesLength();++n<o;)(r=e.nodes(n))&&(t[++i]=oo.decode(r));return t}function fZ(e,t){let r=[];for(let n,i=-1,o=-1,s=e.buffersLength();++i<s;)(n=e.buffers(i))&&(t<Ee.V4&&(n.bb_pos+=8*(i+1)),r[++o]=di.decode(n));return r}function dZ(e,t){let r=[];for(let n,i=-1,o=-1,s=e.fieldsLength();++i<s;)(n=e.fields(i))&&(r[++o]=re.decode(n,t));return r}function CC(e,t){let r=[];for(let n,i=-1,o=-1,s=e.childrenLength();++i<s;)(n=e.children(i))&&(r[++o]=re.decode(n,t));return r}function hZ(e,t){let r,n,i,o,s,a;return!t||!(a=e.dictionary())?(i=PC(e,CC(e,t)),n=new re(e.name(),i,e.nullable(),u1(e))):t.has(r=or(a.id()))?(o=(o=a.indexType())?UC(o):new Ds,s=new Di(t.get(r),o,r,a.isOrdered()),n=new re(e.name(),s,e.nullable(),u1(e))):(o=(o=a.indexType())?UC(o):new Ds,t.set(r,i=PC(e,CC(e,t))),s=new Di(i,o,r,a.isOrdered()),n=new re(e.name(),s,e.nullable(),u1(e))),n||null}function u1(e){let t=new Map;if(e)for(let r,n,i=-1,o=Math.trunc(e.customMetadataLength());++i<o;)(r=e.customMetadata(i))&&(n=r.key())!=null&&t.set(n,r.value());return t}function UC(e){return new br(e.isSigned(),e.bitWidth())}function PC(e,t){let r=e.typeType();switch(r){case Re.NONE:return new Un;case Re.Null:return new Un;case Re.Binary:return new Fa;case Re.LargeBinary:return new La;case Re.Utf8:return new Ra;case Re.LargeUtf8:return new ka;case Re.Bool:return new Ca;case Re.List:return new zo((t||[])[0]);case Re.Struct_:return new ze(t||[])}switch(r){case Re.Int:{let n=e.type(new Ro);return new br(n.isSigned(),n.bitWidth())}case Re.FloatingPoint:{let n=e.type(new wl);return new li(n.precision())}case Re.Decimal:{let n=e.type(new Es);return new Ua(n.scale(),n.precision(),n.bitWidth())}case Re.Date:{let n=e.type(new gl);return new Pa(n.unit())}case Re.Time:{let n=e.type(new Oa);return new $o(n.unit(),n.bitWidth())}case Re.Timestamp:{let n=e.type(new Na);return new $a(n.unit(),n.timezone())}case Re.Interval:{let n=e.type(new vl);return new za(n.unit())}case Re.Duration:{let n=e.type(new bl);return new Va(n.unit())}case Re.Union:{let n=e.type(new ko);return new Vo(n.mode(),n.typeIdsArray()||[],t||[])}case Re.FixedSizeBinary:{let n=e.type(new xl);return new ja(n.byteWidth())}case Re.FixedSizeList:{let n=e.type(new _l);return new jo(n.listSize(),(t||[])[0])}case Re.Map:{let n=e.type(new Sl);return new qo((t||[])[0],n.keysSorted())}}throw new Error(`Unrecognized type: "${Re[r]}" (${r})`)}function pZ(e,t){let r=t.fields.map(o=>re.encode(e,o));ci.startFieldsVector(e,r.length);let n=ci.createFieldsVector(e,r),i=t.metadata&&t.metadata.size>0?ci.createCustomMetadataVector(e,[...t.metadata].map(([o,s])=>{let a=e.createString(`${o}`),c=e.createString(`${s}`);return zr.startKeyValue(e),zr.addKey(e,a),zr.addValue(e,c),zr.endKeyValue(e)})):-1;return ci.startSchema(e),ci.addFields(e,n),ci.addEndianness(e,_Z?yl.Little:yl.Big),i!==-1&&ci.addCustomMetadata(e,i),ci.endSchema(e)}function mZ(e,t){let r=-1,n=-1,i=-1,o=t.type,s=t.typeId;lt.isDictionary(o)?(s=o.dictionary.typeId,i=c1.visit(o,e),n=c1.visit(o.dictionary,e)):n=c1.visit(o,e);let a=(o.children||[]).map(u=>re.encode(e,u)),c=Tn.createChildrenVector(e,a),l=t.metadata&&t.metadata.size>0?Tn.createCustomMetadataVector(e,[...t.metadata].map(([u,f])=>{let d=e.createString(`${u}`),h=e.createString(`${f}`);return zr.startKeyValue(e),zr.addKey(e,d),zr.addValue(e,h),zr.endKeyValue(e)})):-1;return t.name&&(r=e.createString(t.name)),Tn.startField(e),Tn.addType(e,n),Tn.addTypeType(e,s),Tn.addChildren(e,c),Tn.addNullable(e,!!t.nullable),r!==-1&&Tn.addName(e,r),i!==-1&&Tn.addDictionary(e,i),l!==-1&&Tn.addCustomMetadata(e,l),Tn.endField(e)}function yZ(e,t){let r=t.nodes||[],n=t.buffers||[];Ei.startNodesVector(e,r.length);for(let s of r.slice().reverse())oo.encode(e,s);let i=e.endVector();Ei.startBuffersVector(e,n.length);for(let s of n.slice().reverse())di.encode(e,s);let o=e.endVector();return Ei.startRecordBatch(e),Ei.addLength(e,BigInt(t.length)),Ei.addNodes(e,i),Ei.addBuffers(e,o),Ei.endRecordBatch(e)}function gZ(e,t){let r=an.encode(e,t.data);return Ba.startDictionaryBatch(e),Ba.addId(e,BigInt(t.id)),Ba.addIsDelta(e,t.isDelta),Ba.addData(e,r),Ba.endDictionaryBatch(e)}function bZ(e,t){return Od.createFieldNode(e,BigInt(t.length),BigInt(t.nullCount))}function xZ(e,t){return Bd.createBuffer(e,BigInt(t.offset),BigInt(t.length))}var _Z=(()=>{let e=new ArrayBuffer(2);return new DataView(e).setInt16(0,256,!0),new Int16Array(e)[0]===256})();var YA=e=>`Expected ${oe[e]} Message in stream, but was null or length 0.`,WA=e=>`Header pointer of flatbuffer-encoded ${oe[e]} Message is null or length 0.`,$C=(e,t)=>`Expected to read ${e} metadata bytes, but only read ${t}.`,zC=(e,t)=>`Expected to read ${e} bytes for message body, but only read ${t}.`,Xd=class{constructor(t){this.source=t instanceof Ns?t:new Ns(t)}[Symbol.iterator](){return this}next(){let t;return(t=this.readMetadataLength()).done?Ve:t.value===-1&&(t=this.readMetadataLength()).done?Ve:(t=this.readMetadata(t.value)).done?Ve:t}throw(t){return this.source.throw(t)}return(t){return this.source.return(t)}readMessage(t){let r;if((r=this.next()).done)return null;if(t!=null&&r.value.headerType!==t)throw new Error(YA(t));return r.value}readMessageBody(t){if(t<=0)return new Uint8Array(0);let r=Et(this.source.read(t));if(r.byteLength<t)throw new Error(zC(t,r.byteLength));return r.byteOffset%8===0&&r.byteOffset+r.byteLength<=r.buffer.byteLength?r:r.slice()}readSchema(t=!1){let r=oe.Schema,n=this.readMessage(r),i=n?.header();if(t&&!i)throw new Error(WA(r));return i}readMetadataLength(){let t=this.source.read(f1),r=t&&new Ar(t),n=r?.readInt32(0)||0;return{done:n===0,value:n}}readMetadata(t){let r=this.source.read(t);if(!r)return Ve;if(r.byteLength<t)throw new Error($C(t,r.byteLength));return{done:!1,value:pi.decode(r)}}},vy=class{constructor(t,r){this.source=t instanceof no?t:qx(t)?new Ml(t,r):new no(t)}[Symbol.asyncIterator](){return this}next(){return P(this,void 0,void 0,function*(){let t;return(t=yield this.readMetadataLength()).done?Ve:t.value===-1&&(t=yield this.readMetadataLength()).done?Ve:(t=yield this.readMetadata(t.value)).done?Ve:t})}throw(t){return P(this,void 0,void 0,function*(){return yield this.source.throw(t)})}return(t){return P(this,void 0,void 0,function*(){return yield this.source.return(t)})}readMessage(t){return P(this,void 0,void 0,function*(){let r;if((r=yield this.next()).done)return null;if(t!=null&&r.value.headerType!==t)throw new Error(YA(t));return r.value})}readMessageBody(t){return P(this,void 0,void 0,function*(){if(t<=0)return new Uint8Array(0);let r=Et(yield this.source.read(t));if(r.byteLength<t)throw new Error(zC(t,r.byteLength));return r.byteOffset%8===0&&r.byteOffset+r.byteLength<=r.buffer.byteLength?r:r.slice()})}readSchema(t=!1){return P(this,void 0,void 0,function*(){let r=oe.Schema,n=yield this.readMessage(r),i=n?.header();if(t&&!i)throw new Error(WA(r));return i})}readMetadataLength(){return P(this,void 0,void 0,function*(){let t=yield this.source.read(f1),r=t&&new Ar(t),n=r?.readInt32(0)||0;return{done:n===0,value:n}})}readMetadata(t){return P(this,void 0,void 0,function*(){let r=yield this.source.read(t);if(!r)return Ve;if(r.byteLength<t)throw new Error($C(t,r.byteLength));return{done:!1,value:pi.decode(r)}})}},Sy=class extends Xd{constructor(t){super(new Uint8Array(0)),this._schema=!1,this._body=[],this._batchIndex=0,this._dictionaryIndex=0,this._json=t instanceof Xm?t:new Xm(t)}next(){let{_json:t}=this;if(!this._schema)return this._schema=!0,{done:!1,value:pi.fromJSON(t.schema,oe.Schema)};if(this._dictionaryIndex<t.dictionaries.length){let r=t.dictionaries[this._dictionaryIndex++];return this._body=r.data.columns,{done:!1,value:pi.fromJSON(r,oe.DictionaryBatch)}}if(this._batchIndex<t.batches.length){let r=t.batches[this._batchIndex++];return this._body=r.columns,{done:!1,value:pi.fromJSON(r,oe.RecordBatch)}}return this._body=[],Ve}readMessageBody(t){return r(this._body);function r(n){return(n||[]).reduce((i,o)=>[...i,...o.VALIDITY&&[o.VALIDITY]||[],...o.TYPE_ID&&[o.TYPE_ID]||[],...o.OFFSET&&[o.OFFSET]||[],...o.DATA&&[o.DATA]||[],...r(o.children)],[])}}readMessage(t){let r;if((r=this.next()).done)return null;if(t!=null&&r.value.headerType!==t)throw new Error(YA(t));return r.value}readSchema(){let t=oe.Schema,r=this.readMessage(t),n=r?.header();if(!r||!n)throw new Error(WA(t));return n}},f1=4,qA="ARROW1",Hd=new Uint8Array(qA.length);for(let e=0;e<qA.length;e+=1)Hd[e]=qA.codePointAt(e);function d1(e,t=0){for(let r=-1,n=Hd.length;++r<n;)if(Hd[r]!==e[t+r])return!1;return!0}var Zd=Hd.length,GA=Zd+f1,VC=Zd*2+f1;var Ni=class e extends Xu{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 r=this._impl.open(t);return Ai(r)?r.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 on.toDOMStream(this.isSync()?{[Symbol.iterator]:()=>this}:{[Symbol.asyncIterator]:()=>this})}toNodeStream(){return on.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,r){throw new Error('"throughDOM" not available in this environment')}static from(t){return t instanceof e?t:Vx(t)?vZ(t):qx(t)?TZ(t):Ai(t)?P(this,void 0,void 0,function*(){return yield e.from(yield t)}):Yx(t)||Mm(t)||Gx(t)||to(t)?IZ(new no(t)):SZ(new Ns(t))}static readAll(t){return t instanceof e?t.isSync()?jC(t):qC(t):Vx(t)||ArrayBuffer.isView(t)||Oo(t)||jx(t)?jC(t):qC(t)}},tc=class extends Ni{constructor(t){super(t),this._impl=t}readAll(){return[...this]}[Symbol.iterator](){return this._impl[Symbol.iterator]()}[Symbol.asyncIterator](){return $e(this,arguments,function*(){yield H(yield*Ji(fr(this[Symbol.iterator]())))})}},rf=class extends Ni{constructor(t){super(t),this._impl=t}readAll(){var t,r,n,i;return P(this,void 0,void 0,function*(){let o=new Array;try{for(var s=!0,a=fr(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){r={error:l}}finally{try{!s&&!t&&(n=a.return)&&(yield n.call(a))}finally{if(r)throw r.error}}return o})}[Symbol.iterator](){throw new Error("AsyncRecordBatchStreamReader is not Iterable")}[Symbol.asyncIterator](){return this._impl[Symbol.asyncIterator]()}},nf=class extends tc{constructor(t){super(t),this._impl=t}},h1=class extends rf{constructor(t){super(t),this._impl=t}},p1=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,r){let n=this._loadVectors(t,r,this.schema.fields),i=Vt({type:new ze(this.schema.fields),length:t.length,children:n});return new dr(this.schema,i)}_loadDictionaryBatch(t,r){let{id:n,isDelta:i}=t,{dictionaries:o,schema:s}=this,a=o.get(n);if(i||!a){let c=s.dictionaries.get(n),l=this._loadVectors(t.data,r,[c]);return(a&&i?a.concat(new le(l)):new le(l)).memoize()}return a.memoize()}_loadVectors(t,r,n){return new Qm(r,t.nodes,t.buffers,this.dictionaries,this.schema.metadataVersion).visitMany(n)}},Kd=class extends p1{constructor(t,r){super(r),this._reader=Vx(t)?new Sy(this._handle=t):new Xd(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=YC(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):Ve}return(t){return!this.closed&&this.autoDestroy&&(this.closed=!0)?this.reset()._reader.return(t):Ve}next(){if(this.closed)return Ve;let t,{_reader:r}=this;for(;t=this._readNextMessageAndValidate();)if(t.isSchema())this.reset(t.header());else if(t.isRecordBatch()){this._recordBatchIndex++;let n=t.header(),i=r.readMessageBody(t.bodyLength);return{done:!1,value:this._loadRecordBatch(n,i)}}else if(t.isDictionaryBatch()){this._dictionaryIndex++;let n=t.header(),i=r.readMessageBody(t.bodyLength),o=this._loadDictionaryBatch(n,i);this.dictionaries.set(n.id,o)}return this.schema&&this._recordBatchIndex===0?(this._recordBatchIndex++,{done:!1,value:new ef(this.schema)}):this.return()}_readNextMessageAndValidate(t){return this._reader.readMessage(t)}},Qd=class extends p1{constructor(t,r){super(r),this._reader=new vy(this._handle=t)}isAsync(){return!0}isStream(){return!0}[Symbol.asyncIterator](){return this}cancel(){return P(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 P(this,void 0,void 0,function*(){return this.closed||(this.autoDestroy=YC(this,t),this.schema||(this.schema=yield this._reader.readSchema())||(yield this.cancel())),this})}throw(t){return P(this,void 0,void 0,function*(){return!this.closed&&this.autoDestroy&&(this.closed=!0)?yield this.reset()._reader.throw(t):Ve})}return(t){return P(this,void 0,void 0,function*(){return!this.closed&&this.autoDestroy&&(this.closed=!0)?yield this.reset()._reader.return(t):Ve})}next(){return P(this,void 0,void 0,function*(){if(this.closed)return Ve;let t,{_reader:r}=this;for(;t=yield this._readNextMessageAndValidate();)if(t.isSchema())yield this.reset(t.header());else if(t.isRecordBatch()){this._recordBatchIndex++;let n=t.header(),i=yield r.readMessageBody(t.bodyLength);return{done:!1,value:this._loadRecordBatch(n,i)}}else if(t.isDictionaryBatch()){this._dictionaryIndex++;let n=t.header(),i=yield r.readMessageBody(t.bodyLength),o=this._loadDictionaryBatch(n,i);this.dictionaries.set(n.id,o)}return this.schema&&this._recordBatchIndex===0?(this._recordBatchIndex++,{done:!1,value:new ef(this.schema)}):yield this.return()})}_readNextMessageAndValidate(t){return P(this,void 0,void 0,function*(){return yield this._reader.readMessage(t)})}},m1=class extends Kd{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,r){super(t instanceof Hm?t:new Hm(t),r)}isSync(){return!0}isFile(){return!0}open(t){if(!this.closed&&!this._footer){this.schema=(this._footer=this._readFooter()).schema;for(let r of this._footer.dictionaryBatches())r&&this._readDictionaryBatch(this._dictionaryIndex++)}return super.open(t)}readRecordBatch(t){var r;if(this.closed)return null;this._footer||this.open();let n=(r=this._footer)===null||r===void 0?void 0:r.getRecordBatch(t);if(n&&this._handle.seek(n.offset)){let i=this._reader.readMessage(oe.RecordBatch);if(i?.isRecordBatch()){let o=i.header(),s=this._reader.readMessageBody(i.bodyLength);return this._loadRecordBatch(o,s)}}return null}_readDictionaryBatch(t){var r;let n=(r=this._footer)===null||r===void 0?void 0:r.getDictionaryBatch(t);if(n&&this._handle.seek(n.offset)){let i=this._reader.readMessage(oe.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,r=t.size-GA,n=t.readInt32(r),i=t.readAt(r-n,n);return Wa.decode(i)}_readNextMessageAndValidate(t){var r;if(this._footer||this.open(),this._footer&&this._recordBatchIndex<this.numRecordBatches){let n=(r=this._footer)===null||r===void 0?void 0:r.getRecordBatch(this._recordBatchIndex);if(n&&this._handle.seek(n.offset))return this._reader.readMessage(t)}return null}},XA=class extends Qd{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,...r){let n=typeof r[0]!="number"?r.shift():void 0,i=r[0]instanceof Map?r.shift():void 0;super(t instanceof Ml?t:new Ml(t,n),i)}isFile(){return!0}isAsync(){return!0}open(t){let r=Object.create(null,{open:{get:()=>super.open}});return P(this,void 0,void 0,function*(){if(!this.closed&&!this._footer){this.schema=(this._footer=yield this._readFooter()).schema;for(let n of this._footer.dictionaryBatches())n&&(yield this._readDictionaryBatch(this._dictionaryIndex++))}return yield r.open.call(this,t)})}readRecordBatch(t){var r;return P(this,void 0,void 0,function*(){if(this.closed)return null;this._footer||(yield this.open());let n=(r=this._footer)===null||r===void 0?void 0:r.getRecordBatch(t);if(n&&(yield this._handle.seek(n.offset))){let i=yield this._reader.readMessage(oe.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 r;return P(this,void 0,void 0,function*(){let n=(r=this._footer)===null||r===void 0?void 0:r.getDictionaryBatch(t);if(n&&(yield this._handle.seek(n.offset))){let i=yield this._reader.readMessage(oe.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 P(this,void 0,void 0,function*(){let{_handle:t}=this;t._pending&&(yield t._pending);let r=t.size-GA,n=yield t.readInt32(r),i=yield t.readAt(r-n,n);return Wa.decode(i)})}_readNextMessageAndValidate(t){return P(this,void 0,void 0,function*(){if(this._footer||(yield this.open()),this._footer&&this._recordBatchIndex<this.numRecordBatches){let r=this._footer.getRecordBatch(this._recordBatchIndex);if(r&&(yield this._handle.seek(r.offset)))return yield this._reader.readMessage(t)}return null})}},HA=class extends Kd{constructor(t,r){super(t,r)}_loadVectors(t,r,n){return new P_(r,t.nodes,t.buffers,this.dictionaries,this.schema.metadataVersion).visitMany(n)}};function YC(e,t){return t&&typeof t.autoDestroy=="boolean"?t.autoDestroy:e.autoDestroy}function*jC(e){let t=Ni.from(e);try{if(!t.open({autoDestroy:!1}).closed)do yield t;while(!t.reset().open().closed)}finally{t.cancel()}}function qC(e){return $e(this,arguments,function*(){let r=yield H(Ni.from(e));try{if(!(yield H(r.open({autoDestroy:!1}))).closed)do yield yield H(r);while(!(yield H(r.reset().open())).closed)}finally{yield H(r.cancel())}})}function vZ(e){return new tc(new HA(e))}function SZ(e){let t=e.peek(Zd+7&-8);return t&&t.byteLength>=4?d1(t)?new nf(new m1(e.read())):new tc(new Kd(e)):new tc(new Kd(function*(){}()))}function IZ(e){return P(this,void 0,void 0,function*(){let t=yield e.peek(Zd+7&-8);return t&&t.byteLength>=4?d1(t)?new nf(new m1(yield e.read())):new rf(new Qd(e)):new rf(new Qd(function(){return $e(this,arguments,function*(){})}()))})}function TZ(e){return P(this,void 0,void 0,function*(){let{size:t}=yield e.stat(),r=new Ml(e,t);return t>=VC&&d1(yield r.readAt(0,Zd+7&-8))?new h1(new XA(r)):new rf(new Qd(r))})}var Je=class e extends xt{static assemble(...t){let r=i=>i.flatMap(o=>Array.isArray(o)?r(o):o instanceof dr?o.data.children:o.data),n=new e;return n.visitMany(r(t)),n}constructor(){super(),this._byteLength=0,this._nodes=[],this._buffers=[],this._bufferRegions=[]}visit(t){if(t instanceof le)return this.visitMany(t.data),this;let{type:r}=t;if(!lt.isDictionary(r)){let{length:n}=t;if(n>2147483647)throw new RangeError("Cannot write arrays larger than 2^31 - 1 in length");if(lt.isUnion(r))this.nodes.push(new oo(n,0));else{let{nullCount:i}=t;lt.isNull(r)||Xo.call(this,i<=0?new Uint8Array(0):qu(t.offset,n,t.nullBitmap)),this.nodes.push(new oo(n,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 Xo(e){let t=e.byteLength+7&-8;return this.buffers.push(e),this.bufferRegions.push(new di(this._byteLength,t)),this._byteLength+=t,this}function AZ(e){var t;let{type:r,length:n,typeIds:i,valueOffsets:o}=e;if(Xo.call(this,i),r.mode===Ue.Sparse)return ZA.call(this,e);if(r.mode===Ue.Dense){if(e.offset<=0)return Xo.call(this,o),ZA.call(this,e);{let s=new Int32Array(n),a=Object.create(null),c=Object.create(null);for(let l,u,f=-1;++f<n;)(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);Xo.call(this,s),this.visitMany(e.children.map((l,u)=>{let f=r.typeIds[u],d=a[f],h=c[f];return l.slice(d,Math.min(n,h))}))}}return this}function MZ(e){let t;return e.nullCount>=e.length?Xo.call(this,new Uint8Array(0)):(t=e.values)instanceof Uint8Array?Xo.call(this,qu(e.offset,e.length,t)):Xo.call(this,Yu(e.values))}function ec(e){return Xo.call(this,e.values.subarray(0,e.length*e.stride))}function y1(e){let{length:t,values:r,valueOffsets:n}=e,i=or(n[0]),o=or(n[t]),s=Math.min(o-i,r.byteLength-i);return Xo.call(this,Hx(-i,t+1,n)),Xo.call(this,r.subarray(i,i+s)),this}function KA(e){let{length:t,valueOffsets:r}=e;if(r){let{[0]:n,[t]:i}=r;return Xo.call(this,Hx(-n,t+1,r)),this.visit(e.children[0].slice(n,i-n))}return this.visit(e.children[0])}function ZA(e){return this.visitMany(e.type.children.map((t,r)=>e.children[r]).filter(Boolean))[0]}Je.prototype.visitBool=MZ;Je.prototype.visitInt=ec;Je.prototype.visitFloat=ec;Je.prototype.visitUtf8=y1;Je.prototype.visitLargeUtf8=y1;Je.prototype.visitBinary=y1;Je.prototype.visitLargeBinary=y1;Je.prototype.visitFixedSizeBinary=ec;Je.prototype.visitDate=ec;Je.prototype.visitTimestamp=ec;Je.prototype.visitTime=ec;Je.prototype.visitDecimal=ec;Je.prototype.visitList=KA;Je.prototype.visitStruct=ZA;Je.prototype.visitUnion=AZ;Je.prototype.visitInterval=ec;Je.prototype.visitDuration=ec;Je.prototype.visitFixedSizeList=KA;Je.prototype.visitMap=KA;var of=class extends Xu{static throughNode(t){throw new Error('"throughNode" not available in this environment')}static throughDOM(t,r){throw new Error('"throughDOM" not available in this environment')}constructor(t){super(),this._position=0,this._started=!1,this._sink=new Os,this._schema=null,this._dictionaryBlocks=[],this._recordBatchBlocks=[],this._dictionaryDeltaOffsets=new Map,Cn(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 Ai(t)?t.then(r=>this.writeAll(r)):to(t)?JA(this,t):QA(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,r=null){return t===this._sink||t instanceof Os?this._sink=t:(this._sink=new Os,t&&ok(t)?this.toDOMStream({type:"bytes"}).pipeTo(t):t&&sk(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,(!r||!tf(r,this._schema))&&(r==null?(this._position=0,this._schema=null):(this._started=!0,this._schema=r,this._writeSchema(r))),this}write(t){let r=null;if(this._sink){if(t==null)return this.finish()&&void 0;if(t instanceof fi&&!(r=t.schema))return this.finish()&&void 0;if(t instanceof dr&&!(r=t.schema))return this.finish()&&void 0}else throw new Error("RecordBatchWriter is closed");if(r&&!tf(r,this._schema)){if(this._started&&this._autoDestroy)return this.close();this.reset(this._sink,r)}t instanceof dr?t instanceof ef||this._writeRecordBatch(t):t instanceof fi?this.writeAll(t.batches):Oo(t)&&this.writeAll(t)}_writeMessage(t,r=8){let n=r-1,i=pi.encode(t),o=i.byteLength,s=this._writeLegacyIpcFormat?4:8,a=o+s+n&~n,c=a-o-s;return t.headerType===oe.RecordBatch?this._recordBatchBlocks.push(new Ga(a,t.bodyLength,this._position)):t.headerType===oe.DictionaryBatch&&this._dictionaryBlocks.push(new Ga(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 r=Et(t);r&&r.byteLength>0&&(this._sink.write(r),this._position+=r.byteLength)}return this}_writeSchema(t){return this._writeMessage(pi.from(t))}_writeFooter(t){return this._writeLegacyIpcFormat?this._write(Int32Array.of(0)):this._write(Int32Array.of(-1,0))}_writeMagic(){return this._write(Hd)}_writePadding(t){return t>0?this._write(new Uint8Array(t)):this}_writeRecordBatch(t){let{byteLength:r,nodes:n,bufferRegions:i,buffers:o}=Je.assemble(t),s=new an(t.numRows,n,i),a=pi.from(s,r);return this._writeDictionaries(t)._writeMessage(a)._writeBodyBuffers(o)}_writeDictionaryBatch(t,r,n=!1){this._dictionaryDeltaOffsets.set(r,t.length+(this._dictionaryDeltaOffsets.get(r)||0));let{byteLength:i,nodes:o,bufferRegions:s,buffers:a}=Je.assemble(new le([t])),c=new an(t.length,o,s),l=new hi(c,r,n),u=pi.from(l,i);return this._writeMessage(u)._writeBodyBuffers(a)}_writeBodyBuffers(t){let r,n,i;for(let o=-1,s=t.length;++o<s;)(r=t[o])&&(n=r.byteLength)>0&&(this._write(r),(i=(n+7&-8)-n)>0&&this._writePadding(i));return this}_writeDictionaries(t){for(let[r,n]of t.dictionaries){let i=this._dictionaryDeltaOffsets.get(r)||0;if(i===0||(n=n?.slice(i)).length>0)for(let o of n.data)this._writeDictionaryBatch(o,r,i>0),i+=o.length}return this}},Iy=class e extends of{static writeAll(t,r){let n=new e(r);return Ai(t)?t.then(i=>n.writeAll(i)):to(t)?JA(n,t):QA(n,t)}},Ty=class e extends of{static writeAll(t){let r=new e;return Ai(t)?t.then(n=>r.writeAll(n)):to(t)?JA(r,t):QA(r,t)}constructor(){super(),this._autoDestroy=!0}_writeSchema(t){return this._writeMagic()._writePadding(2)}_writeFooter(t){let r=Wa.encode(new Wa(t,Ee.V5,this._recordBatchBlocks,this._dictionaryBlocks));return super._writeFooter(t)._write(r)._write(Int32Array.of(r.byteLength))._writeMagic()}};function QA(e,t){let r=t;t instanceof fi&&(r=t.batches,e.reset(void 0,t.schema));for(let n of r)e.write(n);return e.finish()}function JA(e,t){var r,n,i,o,s,a,c;return P(this,void 0,void 0,function*(){try{for(r=!0,n=fr(t);i=yield n.next(),o=i.done,!o;r=!0){c=i.value,r=!1;let l=c;e.write(l)}}catch(l){s={error:l}}finally{try{!r&&!o&&(a=n.return)&&(yield a.call(n))}finally{if(s)throw s.error}}return e.finish()})}function WC(e,t){if(to(e))return DZ(e,t);if(Oo(e))return EZ(e,t);throw new Error("toDOMStream() must be called with an Iterable or AsyncIterable")}function EZ(e,t){let r=null,n=t?.type==="bytes"||!1,i=t?.highWaterMark||Math.pow(2,24);return new ReadableStream(Object.assign(Object.assign({},t),{start(s){o(s,r||(r=e[Symbol.iterator]()))},pull(s){r?o(s,r):s.close()},cancel(){(r?.return&&r.return()||!0)&&(r=null)}}),Object.assign({highWaterMark:n?i:void 0},t));function o(s,a){let c,l=null,u=s.desiredSize||null;for(;!(l=a.next(n?u:null)).done;)if(ArrayBuffer.isView(l.value)&&(c=Et(l.value))&&(u!=null&&n&&(u=u-c.byteLength+1),l.value=c),s.enqueue(l.value),u!=null&&--u<=0)return;s.close()}}function DZ(e,t){let r=null,n=t?.type==="bytes"||!1,i=t?.highWaterMark||Math.pow(2,24);return new ReadableStream(Object.assign(Object.assign({},t),{start(s){return P(this,void 0,void 0,function*(){yield o(s,r||(r=e[Symbol.asyncIterator]()))})},pull(s){return P(this,void 0,void 0,function*(){r?yield o(s,r):s.close()})},cancel(){return P(this,void 0,void 0,function*(){(r?.return&&(yield r.return())||!0)&&(r=null)})}}),Object.assign({highWaterMark:n?i:void 0},t));function o(s,a){return P(this,void 0,void 0,function*(){let c,l=null,u=s.desiredSize||null;for(;!(l=yield a.next(n?u:null)).done;)if(ArrayBuffer.isView(l.value)&&(c=Et(l.value))&&(u!=null&&n&&(u=u-c.byteLength+1),l.value=c),s.enqueue(l.value),u!=null&&--u<=0)return;s.close()})}}function HC(e){return new tM(e)}var tM=class{constructor(t){this._numChunks=0,this._finished=!1,this._bufferedSize=0;let{["readableStrategy"]:r,["writableStrategy"]:n,["queueingStrategy"]:i="count"}=t,o=zx(t,["readableStrategy","writableStrategy","queueingStrategy"]);this._controller=null,this._builder=Zu(o),this._getSize=i!=="bytes"?GC:XC;let{["highWaterMark"]:s=i==="bytes"?Math.pow(2,14):1e3}=Object.assign({},r),{["highWaterMark"]:a=i==="bytes"?Math.pow(2,14):1e3}=Object.assign({},n);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"?GC:XC}),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 r=this._bufferedSize;return this._bufferedSize=this._getSize(this._builder.append(t)),this._bufferedSize-r}_maybeFlush(t,r){r!=null&&(this._bufferedSize>=r.desiredSize&&++this._numChunks&&this._enqueue(r,t.toVector()),t.finished&&((t.length>0||this._numChunks===0)&&++this._numChunks&&this._enqueue(r,t.toVector()),!this._finished&&(this._finished=!0)&&this._enqueue(r,null)))}_enqueue(t,r){this._bufferedSize=0,this._controller=null,r==null?t.close():t.enqueue(r)}},GC=e=>{var t;return(t=e?.length)!==null&&t!==void 0?t:0},XC=e=>{var t;return(t=e?.byteLength)!==null&&t!==void 0?t:0};function g1(e,t){let r=new Os,n=null,i=new ReadableStream({cancel(){return P(this,void 0,void 0,function*(){yield r.close()})},start(a){return P(this,void 0,void 0,function*(){yield s(a,n||(n=yield o()))})},pull(a){return P(this,void 0,void 0,function*(){n?yield s(a,n):a.close()})}});return{writable:new WritableStream(r,Object.assign({highWaterMark:Math.pow(2,14)},e)),readable:i};function o(){return P(this,void 0,void 0,function*(){return yield(yield Ni.from(r)).open(t)})}function s(a,c){return P(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 b1(e,t){let r=new this(e),n=new no(r),i=new ReadableStream({cancel(){return P(this,void 0,void 0,function*(){yield n.cancel()})},pull(s){return P(this,void 0,void 0,function*(){yield o(s)})},start(s){return P(this,void 0,void 0,function*(){yield o(s)})}},Object.assign({highWaterMark:Math.pow(2,14)},t));return{writable:new WritableStream(r,e),readable:i};function o(s){return P(this,void 0,void 0,function*(){let a=null,c=s.desiredSize;for(;a=yield n.read(c||null);)if(s.enqueue(a),c!=null&&(c-=a.byteLength)<=0)return;s.close()})}}function sf(e){let t=Ni.from(e);return Ai(t)?t.then(r=>sf(r)):t.isAsync()?t.readAll().then(r=>new fi(r)):new fi(t.readAll())}var OZ=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},fA),CA),EA),dA),sA),MA),lA),{compareSchemas:tf,compareFields:SC,compareTypes:IC});on.toDOMStream=WC;Ge.throughDOM=HC;Ni.throughDOM=g1;nf.throughDOM=g1;tc.throughDOM=g1;of.throughDOM=b1;Ty.throughDOM=b1;Iy.throughDOM=b1;function x1(e="ws://localhost:3000/"){let t=[],r=!1,n=null,i,o={open(){r=!0,c()},close(){for(r=!1,n=null,i=null;t.length;)t.shift().reject("Socket closed")},error(l){if(n){let{reject:u}=n;n=null,c(),u(l)}else console.error("WebSocket error: ",l)},message({data:l}){if(n){let{query:u,resolve:f,reject:d}=n;if(n=null,c(),typeof l=="string"){let h=JSON.parse(l);h.error?d(h.error):f(h)}else if(u.type==="exec")f();else if(u.type==="arrow")f(sf(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}),r&&!n&&c()}function c(){t.length&&(n=t.shift(),i.send(JSON.stringify(n.query)))}return{get connected(){return r},query(l){return new Promise((u,f)=>a(l,u,f))}}}var mi=class{constructor(t,r){t&&(this.table=String(t)),r&&(this.column=r)}get columns(){return this.column?[this.column]:[]}toString(){let{table:t,column:r}=this;if(r){let n=r.startsWith("*")?r:`"${r}"`;return`${t?`${ZC(t)}.`:""}${n}`}else return t?ZC(t):"NULL"}};function ZC(e){return e.split(".").map(r=>`"${r}"`).join(".")}function KC(e,t){return e instanceof mi&&e.column===t}function se(e){return typeof e=="string"?El(e):e}function af(e){return typeof e=="string"?QC(e):e}function QC(e){return new mi(e)}function El(e,t){return arguments.length===1&&(t=e,e=null),new mi(e,t)}function Ls(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 r=e.getUTCFullYear(),n=e.getUTCMonth(),i=e.getUTCDate();return t===Date.UTC(r,n,i)?`MAKE_DATE(${r}, ${n+1}, ${i})`:`EPOCH_MS(${t})`}else return e instanceof RegExp?`'${e.source}'`:String(e)}}var rc=e=>typeof e?.addEventListener=="function";function _1(e){return e instanceof Dl}var Dl=class{constructor(t,r,n){this._expr=Array.isArray(t)?t:[t],this._deps=r||[],this.annotate(n);let i=this._expr.filter(o=>rc(o));i.length>0?(this._params=Array.from(new Set(i)),this._params.forEach(o=>{o.addEventListener("value",()=>NZ(this,this.map?.get("value")))})):this.addEventListener=void 0}get value(){return this}get columns(){let{_params:t,_deps:r}=this;if(t){let n=new Set(t.flatMap(i=>{let o=i.value?.columns;return Array.isArray(o)?o:[]}));if(n.size){let i=new Set(r);return n.forEach(o=>i.add(o)),Array.from(i)}}return r}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=>rc(t)&&!_1(t)?Ls(t.value):t).join("")}addEventListener(t,r){let n=this.map||(this.map=new Map);(n.get(t)||(n.set(t,new Set),n.get(t))).add(r)}};function NZ(e,t){if(t?.size)return Promise.allSettled(Array.from(t,r=>r(e)))}function eM(e,t){let r=[e[0]],n=new Set,i=t.length;for(let o=0,s=0;o<i;){let a=t[o];rc(a)?r[++s]=a:(Array.isArray(a?.columns)&&a.columns.forEach(l=>n.add(l)),r[s]+=typeof a=="string"?a:Ls(a));let c=e[++o];rc(r[s])?r[++s]=c:r[s]+=c}return{spans:r,cols:Array.from(n)}}function W(e,...t){let{spans:r,cols:n}=eM(e,t);return new Dl(r,n)}function rM(e){let t=se(e);return W`${t} DESC NULLS LAST`.annotate({label:t?.label,desc:!0})}var Fi=e=>({value:e,toString:()=>Ls(e)});function Ay(e){e(this.op,this),this.children?.forEach(t=>t.visit(e))}function JC(e,t){let r=t.filter(i=>i!=null).map(se),n=r.map((i,o)=>o?` ${e} `:"");return r.length===1?n.push(""):r.length>1&&(n[0]="(",n.push(")")),W(n,...r).annotate({op:e,children:r,visit:Ay})}var $n=(...e)=>JC("AND",e.flat()),cf=(...e)=>JC("OR",e.flat()),FZ=e=>t=>W`(${e} ${se(t)})`.annotate({op:e,a:t,visit:Ay}),nM=FZ("NOT"),tU=e=>t=>W`(${se(t)} ${e})`.annotate({op:e,a:t,visit:Ay}),lf=tU("IS NULL"),nc=tU("IS NOT NULL"),Bl=e=>(t,r)=>W`(${se(t)} ${e} ${se(r)})`.annotate({op:e,a:t,b:r,visit:Ay}),ic=Bl("="),uf=Bl("<>"),oc=Bl("<"),My=Bl(">"),sc=Bl("<="),iM=Bl(">="),oM=Bl("IS DISTINCT FROM"),Ey=Bl("IS NOT DISTINCT FROM");function eU(e,t,r,n){t=se(t);let i=e.startsWith("NOT ")?"NOT ":"";return(r?n?W`${i}(${r[0]} <= ${t} AND ${t} < ${r[1]})`:W`(${t} ${e} ${r[0]} AND ${r[1]})`:W``).annotate({op:e,visit:Ay,field:t,range:r})}var tr=(e,t,r)=>eU("BETWEEN",e,t,r),sM=(e,t,r)=>eU("NOT BETWEEN",e,t,r);function ff(e,t){return Array.from({length:e},()=>t)}function cn(e,t){return(...r)=>{let n=r.map(se),i=t?`::${t}`:"";return(n.length?W([`${e}(`,...ff(n.length-1,", "),`)${i}`],...n):W`${e}()${i}`).annotate({func:e,args:n})}}var aM=cn("REGEXP_MATCHES"),cM=cn("CONTAINS"),lM=cn("PREFIX"),uM=cn("SUFFIX"),LZ=cn("LOWER"),RZ=cn("UPPER"),kZ=cn("LENGTH"),CZ=cn("ISNAN"),UZ=cn("ISFINITE"),PZ=cn("ISINF");var Dy=class e extends Dl{constructor(t,r,n,i,o="",s="",a=""){let c;if(i&&!(o||s||a))c=i?W`${r} OVER "${i}"`:W`${r} OVER ()`;else{let d=o&&s?" ":"",h=(o||s)&&a?" ":"";c=W`${r} OVER (${i?`"${i}" `:""}${o}${d}${s}${h}${a})`}n&&(c=W`(${c})::${n}`);let{_expr:u,_deps:f}=c;super(u,f,{window:t,func:r,type:n,name:i,group:o,order:s,frame:a})}get basis(){return this.column}get label(){let{func:t}=this;return t.label??t.toString()}over(t){let{window:r,func:n,type:i,group:o,order:s,frame:a}=this;return new e(r,n,i,t,o,s,a)}partitionby(...t){let r=t.flat().filter(u=>u).map(se),n=W(["PARTITION BY ",ff(r.length-1,", "),""],...r),{window:i,func:o,type:s,name:a,order:c,frame:l}=this;return new e(i,o,s,a,n,c,l)}orderby(...t){let r=t.flat().filter(u=>u).map(se),n=W(["ORDER BY ",ff(r.length-1,", "),""],...r),{window:i,func:o,type:s,name:a,group:c,frame:l}=this;return new e(i,o,s,a,c,n,l)}rows(t){let r=rU("ROWS",t),{window:n,func:i,type:o,name:s,group:a,order:c}=this;return new e(n,i,o,s,a,c,r)}range(t){let r=rU("RANGE",t),{window:n,func:i,type:o,name:s,group:a,order:c}=this;return new e(n,i,o,s,a,c,r)}};function rU(e,t){if(rc(t)){let r=W`${t}`;return r.toString=()=>`${e} ${nU(t.value)}`,r}return`${e} ${nU(t)}`}function nU(e){let[t,r]=e,n=t===0?"CURRENT ROW":Number.isFinite(t)?`${Math.abs(t)} PRECEDING`:"UNBOUNDED PRECEDING",i=r===0?"CURRENT ROW":Number.isFinite(r)?`${Math.abs(r)} FOLLOWING`:"UNBOUNDED FOLLOWING";return`BETWEEN ${n} AND ${i}`}function Ho(e,t){return(...r)=>{let n=cn(e)(...r);return new Dy(e,n,t)}}var fM=Ho("ROW_NUMBER","INTEGER"),dM=Ho("RANK","INTEGER"),hM=Ho("DENSE_RANK","INTEGER"),pM=Ho("PERCENT_RANK"),mM=Ho("CUME_DIST"),yM=Ho("NTILE"),gM=Ho("LAG"),bM=Ho("LEAD"),xM=Ho("FIRST_VALUE"),_M=Ho("LAST_VALUE"),wM=Ho("NTH_VALUE");function SM(e,...t){return W(e,...t).annotate({aggregate:!0})}var vM=class e extends Dl{constructor(t,r,n,i,o){r=(r||[]).map(se);let{strings:s,exprs:a}=$Z(t,r,n,i,o),{spans:c,cols:l}=eM(s,a);super(c,l,{aggregate:t,args:r,type:n,isDistinct:i,filter:o})}get basis(){return this.column}get label(){let{aggregate:t,args:r,isDistinct:n}=this,i=n?"DISTINCT"+(r.length?" ":""):"",o=r.length?`(${i}${r.map(zZ).join(", ")})`:"";return`${t.toLowerCase()}${o}`}distinct(){let{aggregate:t,args:r,type:n,filter:i}=this;return new e(t,r,n,!0,i)}where(t){let{aggregate:r,args:n,type:i,isDistinct:o}=this;return new e(r,n,i,o,t)}window(){let{aggregate:t,args:r,type:n,isDistinct:i}=this,o=new e(t,r,null,i);return new Dy(t,o,n)}partitionby(...t){return this.window().partitionby(...t)}orderby(...t){return this.window().orderby(...t)}rows(t,r){return this.window().rows(t,r)}range(t,r){return this.window().range(t,r)}};function $Z(e,t,r,n,i){let o=`)${r?`::${r}`:""}`,s=[`${e}(${n?"DISTINCT ":""}`],a=[];return t.length?(s=s.concat([...ff(t.length-1,", "),`${o}${i?" FILTER (WHERE ":""}`,...i?[")"]:[]]),a=[...t,...i?[i]:[]]):s[0]+="*"+o,{exprs:a,strings:s}}function zZ(e){let t=Ls(e);return t&&t.startsWith('"')&&t.endsWith('"')?t.slice(1,-1):t}function me(e,t){return(...r)=>new vM(e,r,t)}var Li=me("COUNT","INTEGER"),IM=me("AVG"),VZ=me("AVG"),TM=me("MAD"),so=me("MAX"),ao=me("MIN"),Ri=me("SUM","DOUBLE"),AM=me("PRODUCT"),MM=me("MEDIAN"),EM=me("QUANTILE"),DM=me("MODE"),BM=me("VARIANCE"),OM=me("STDDEV"),NM=me("SKEWNESS"),FM=me("KURTOSIS"),LM=me("ENTROPY"),RM=me("VAR_POP"),kM=me("STDDEV_POP"),CM=me("CORR"),UM=me("COVAR_POP"),PM=me("REGR_INTERCEPT"),$M=me("REGR_SLOPE"),zM=me("REGR_COUNT"),jZ=me("REGR_R2"),VM=me("REGR_SYY"),jM=me("REGR_SXX"),qZ=me("REGR_SXY"),qM=me("REGR_AVGX"),YZ=me("REGR_AVGY"),YM=me("FIRST"),WM=me("LAST"),Jd=me("ARG_MIN"),th=me("ARG_MAX"),GM=me("STRING_AGG"),XM=me("ARRAY_AGG");function By(e,t){let r=se(e),n=W`CAST(${r} AS ${t})`;return Object.defineProperty(n,"label",{enumerable:!0,get(){return e.label}}),Object.defineProperty(n,"aggregate",{enumerable:!0,get(){return e.aggregate||!1}}),n}var eh=e=>By(e,"DOUBLE"),HM=e=>By(e,"INTEGER");var ZM=e=>W`epoch_ms(${se(e)})`,KM=e=>{let t=se(e);return W`MAKE_DATE(2012, MONTH(${t}), 1)`.annotate({label:"month"})},QM=e=>{let t=se(e);return W`MAKE_DATE(2012, MONTH(${t}), DAY(${t}))`.annotate({label:"date"})},JM=e=>{let t=se(e);return W`MAKE_DATE(2012, 1, DAY(${t}))`.annotate({label:"date"})};var Oy=cn("ST_AsGeoJSON"),iU=cn("ST_X"),oU=cn("ST_Y"),Ny=cn("ST_CENTROID"),tE=e=>iU(Ny(e)),eE=e=>oU(Ny(e));var Mt=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 df("UNION",t.flat())}static unionAll(...t){return new df("UNION ALL",t.flat())}static intersect(...t){return new df("INTERSECT",t.flat())}static except(...t){return new df("EXCEPT",t.flat())}constructor(){this.query={with:[],select:[],from:[],where:[],groupby:[],having:[],window:[],qualify:[],orderby:[]}}clone(){let t=new e;return t.query={...this.query},t}with(...t){let{query:r}=this;if(t.length===0)return r.with;{let n=[],i=(o,s)=>{let a=s.clone();a.cteFor=this,n.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])}),r.with=r.with.concat(n),this}}select(...t){let{query:r}=this;if(t.length===0)return r.select;{let n=[];for(let i of t.flat())if(i!=null)if(typeof i=="string")n.push({as:i,expr:se(i)});else if(i instanceof mi)n.push({as:i.column,expr:i});else if(Array.isArray(i))n.push({as:i[0],expr:i[1]});else for(let o in i)n.push({as:w1(o),expr:se(i[o])});return r.select=r.select.concat(n),this}}$select(...t){return this.query.select=[],this.select(...t)}distinct(t=!0){return this.query.distinct=!!t,this}from(...t){let{query:r}=this;if(t.length===0)return r.from;{let n=[];return t.flat().forEach(i=>{if(i!=null)if(typeof i=="string")n.push({as:i,from:af(i)});else if(i instanceof mi)n.push({as:i.table,from:i});else if(v1(i)||_1(i))n.push({from:i});else if(Array.isArray(i))n.push({as:w1(i[0]),from:af(i[1])});else for(let o in i)n.push({as:w1(o),from:af(i[o])})}),r.from=r.from.concat(n),this}}$from(...t){return this.query.from=[],this.from(...t)}sample(t,r){let{query:n}=this;if(arguments.length===0)return n.sample;{let i=t;return typeof t=="number"&&(i=t>0&&t<1?{perc:100*t,method:r}:{rows:Math.round(t),method:r}),n.sample=i,this}}where(...t){let{query:r}=this;return t.length===0?r.where:(r.where=r.where.concat(t.flat().filter(n=>n)),this)}$where(...t){return this.query.where=[],this.where(...t)}groupby(...t){let{query:r}=this;return t.length===0?r.groupby:(r.groupby=r.groupby.concat(t.flat().filter(n=>n).map(se)),this)}$groupby(...t){return this.query.groupby=[],this.groupby(...t)}having(...t){let{query:r}=this;return t.length===0?r.having:(r.having=r.having.concat(t.flat().filter(n=>n)),this)}window(...t){let{query:r}=this;if(t.length===0)return r.window;{let n=[];return t.flat().forEach(i=>{if(i!=null)for(let o in i)n.push({as:w1(o),expr:i[o]})}),r.window=r.window.concat(n),this}}qualify(...t){let{query:r}=this;return t.length===0?r.qualify:(r.qualify=r.qualify.concat(t.flat().filter(n=>n)),this)}orderby(...t){let{query:r}=this;return t.length===0?r.orderby:(r.orderby=r.orderby.concat(t.flat().filter(n=>n).map(se)),this)}limit(t){let{query:r}=this;return arguments.length===0?r.limit:(r.limit=Number.isFinite(t)?t:void 0,this)}offset(t){let{query:r}=this;return arguments.length===0?r.offset:(r.offset=Number.isFinite(t)?t:void 0,this)}get subqueries(){let{query:t,cteFor:r}=this,i=(r?.query||t).with?.reduce((s,{as:a,query:c})=>(s[a]=c,s),{}),o=[];return t.from.forEach(({from:s})=>{if(v1(s))o.push(s);else if(i[s.table]){let a=i[s.table];o.push(a)}}),o}toString(){let{select:t,distinct:r,from:n,sample:i,where:o,groupby:s,having:a,window:c,qualify:l,orderby:u,limit:f,offset:d,with:h}=this.query,p=[];if(h.length){let g=h.map(({as:m,query:b})=>`"${m}" AS (${b})`);p.push(`WITH ${g.join(", ")}`)}let y=t.map(({as:g,expr:m})=>KC(m,g)&&!m.table?`${m}`:`${m} AS "${g}"`);if(p.push(`SELECT${r?" DISTINCT":""} ${y.join(", ")}`),n.length){let g=n.map(({as:m,from:b})=>{let x=v1(b)?`(${b})`:`${b}`;return!m||m===b.table?x:`${x} AS "${m}"`});p.push(`FROM ${g.join(", ")}`)}if(o.length){let g=o.map(String).filter(m=>m).join(" AND ");g&&p.push(`WHERE ${g}`)}if(i){let{rows:g,perc:m,method:b,seed:x}=i,_=g?`${g} ROWS`:`${m} PERCENT`,v=b?` (${b}${x!=null?`, ${x}`:""})`:"";p.push(`USING SAMPLE ${_}${v}`)}if(s.length&&p.push(`GROUP BY ${s.join(", ")}`),a.length){let g=a.map(String).filter(m=>m).join(" AND ");g&&p.push(`HAVING ${g}`)}if(c.length){let g=c.map(({as:m,expr:b})=>`"${m}" AS (${b})`);p.push(`WINDOW ${g.join(", ")}`)}if(l.length){let g=l.map(String).filter(m=>m).join(" AND ");g&&p.push(`QUALIFY ${g}`)}return u.length&&p.push(`ORDER BY ${u.join(", ")}`),Number.isFinite(f)&&p.push(`LIMIT ${f}`),Number.isFinite(d)&&p.push(`OFFSET ${d}`),p.join(" ")}},df=class e{constructor(t,r){this.op=t,this.queries=r.map(n=>n.clone()),this.query={orderby:[]}}clone(){let t=new e(this.op,this.queries);return t.query={...this.query},t}orderby(...t){let{query:r}=this;return t.length===0?r.orderby:(r.orderby=r.orderby.concat(t.flat().filter(n=>n).map(se)),this)}limit(t){let{query:r}=this;return arguments.length===0?r.limit:(r.limit=Number.isFinite(t)?t:void 0,this)}offset(t){let{query:r}=this;return arguments.length===0?r.offset:(r.offset=Number.isFinite(t)?t:void 0,this)}get subqueries(){let{queries:t,cteFor:r}=this;return r&&t.forEach(n=>n.cteFor=r),t}toString(){let{op:t,queries:r,query:{orderby:n,limit:i,offset:o}}=this,s=[r.join(` ${t} `)];return n.length&&s.push(`ORDER BY ${n.join(", ")}`),Number.isFinite(i)&&s.push(`LIMIT ${i}`),Number.isFinite(o)&&s.push(`OFFSET ${o}`),s.join(" ")}};function v1(e){return e instanceof Mt||e instanceof df}function w1(e){return WZ(e)?e.slice(1,-1):e}function WZ(e){return e[0]==='"'&&e[e.length-1]==='"'}var S1=e=>e;function GZ(){return{apply:S1,invert:S1,sqlApply:se,sqlInvert:S1}}function XZ({base:e}={}){if(e==null||e===Math.E)return{apply:Math.log,invert:Math.exp,sqlApply:t=>W`LN(${se(t)})`,sqlInvert:t=>W`EXP(${t})`};if(e===10)return{apply:Math.log10,invert:t=>Math.pow(10,t),sqlApply:t=>W`LOG(${se(t)})`,sqlInvert:t=>W`POW(10, ${t})`};{let t=+e;return{apply:r=>Math.log(r)/Math.log(t),invert:r=>Math.pow(t,r),sqlApply:r=>W`LN(${se(r)}) / LN(${t})`,sqlInvert:r=>W`POW(${t}, ${r})`}}}function HZ({constant:e=1}={}){let t=+e;return{apply:r=>Math.sign(r)*Math.log1p(Math.abs(r)),invert:r=>Math.sign(r)*Math.exp(Math.abs(r)-t),sqlApply:r=>(r=se(r),W`SIGN(${r}) * LN(${t} + ABS(${r}))`),sqlInvert:r=>W`SIGN(${r}) * (EXP(ABS(${r})) - ${t})`}}function ZZ(){return{apply:e=>Math.sign(e)*Math.sqrt(Math.abs(e)),invert:e=>Math.sign(e)*e*e,sqlApply:e=>(e=se(e),W`SIGN(${e}) * SQRT(ABS(${e}))`),sqlInvert:e=>W`SIGN(${e}) * (${e}) ** 2`}}function KZ({exponent:e=1}={}){let t=+e;return{apply:r=>Math.sign(r)*Math.pow(Math.abs(r),t),invert:r=>Math.sign(r)*Math.pow(Math.abs(r),1/t),sqlApply:r=>(r=se(r),W`SIGN(${r}) * POW(ABS(${r}), ${t})`),sqlInvert:r=>W`SIGN(${r}) * POW(ABS(${r}), 1/${t})`}}function sU(){return{apply:e=>+e,invert:e=>new Date(e),sqlApply:e=>e instanceof Date?+e:ZM(se(e)),sqlInvert:S1}}var QZ={linear:GZ,log:XZ,symlog:HZ,sqrt:ZZ,pow:KZ,time:sU,utc:sU};function Fy(e){let t=QZ[e.type];return t?{...e,...t(e)}:null}function Ol(e,t,{replace:r=!1,temp:n=!0,view:i=!1}={}){return"CREATE"+(r?" OR REPLACE ":" ")+(n?"TEMP ":"")+(i?"VIEW":"TABLE")+(r?" ":" IF NOT EXISTS ")+e+" AS "+t}function rE(e){return`INSTALL ${e}; LOAD ${e}`}function aU(e,{columns:t=Object.keys(e?.[0]||{})}={}){let r=[];if(Array.isArray(t)?(r=t,t=r.reduce((i,o)=>(i[o]=o,i),{})):t&&(r=Object.keys(t)),!r.length)throw new Error("Can not create table from empty column set.");let n=[];for(let i of e){let o=r.map(s=>`${Ls(i[s])} AS "${t[s]}"`);n.push(`(SELECT ${o.join(", ")})`)}return n.join(" UNION ALL ")}function I1(e,t,r,n={},i={}){let{select:o=["*"],where:s,view:a,temp:c,replace:l,...u}=n,f=JZ({...i,...u}),d=`${e}('${r}'${f?", "+f:""})`,h=s?` WHERE ${s}`:"",p=`SELECT ${o.join(", ")} FROM ${d}${h}`;return Ol(t,p,{view:a,temp:c,replace:l})}function iE(e,t,r){return I1("read_csv",e,t,r,{auto_detect:!0,sample_size:-1})}function oE(e,t,r){return I1("read_json",e,t,r,{auto_detect:!0,json_format:"auto"})}function sE(e,t,r){return I1("read_parquet",e,t,r)}function aE(e,t,r={}){let{options:n,...i}=r;if(n){let o=Array.isArray(n)?n.join(", "):typeof n=="string"?n:Object.entries(n).map(([s,a])=>`${s}=${a}`).join(", ");i.open_options=o.toUpperCase()}return I1("st_read",e,t,i)}function cE(e,t,r={}){let{select:n=["*"],...i}=r,o=aU(t),s=n.length===1&&n[0]==="*"?o:`SELECT ${n} FROM ${o}`;return Ol(e,s,i)}function JZ(e){return Object.entries(e).map(([t,r])=>`${t}=${nE(r)}`).join(", ")}function nE(e){switch(typeof e){case"boolean":return String(e);case"string":return`'${e}'`;case"undefined":case"object":return e==null?"NULL":Array.isArray(e)?"["+e.map(t=>nE(t)).join(", ")+"]":"{"+Object.entries(e).map(([t,r])=>`'${t}': ${nE(r)}`).join(", ")+"}";default:return e}}function cU(e){switch(e){case"BIGINT":case"HUGEINT":case"INTEGER":case"SMALLINT":case"TINYINT":case"UBIGINT":case"UINTEGER":case"USMALLINT":case"UTINYINT":case"DOUBLE":case"FLOAT":case"REAL":case"DECIMAL":return"number";case"DATE":case"TIMESTAMP":case"TIMESTAMPTZ":case"TIMESTAMP WITH TIME ZONE":case"TIME":case"TIMESTAMP_NS":return"date";case"BOOLEAN":return"boolean";case"VARCHAR":case"UUID":return"string";case"LIST":return"array";case"BLOB":case"STRUCT":case"MAP":return"object";default:throw new Error(`Unsupported type: ${e}`)}}var tK="count",eK="nulls",rK="max",nK="min",iK="distinct";var oK={[tK]:Li,[iK]:e=>Li(e).distinct(),[rK]:so,[nK]:ao,[eK]:e=>Li().where(lf(e))};function lU({table:e,column:t},r){return Mt.from(e).select(r.map(n=>[n,oK[n](t)]))}var uU=()=>Object.create(null),T1=class{constructor(t){this.mc=t,this.clear()}clear(){this.tables=uU()}tableInfo(t){let r=this.tables;if(r[t])return r[t];let n=sK(this.mc,t).catch(i=>{throw r[t]=null,i});return r[t]=n}async fieldInfo({table:t,column:r,stats:n}){let o=(await this.tableInfo(t))[r];if(o==null)return;if(!n?.length)return o;let s=await this.mc.query(lU(o,n),{persist:!0}),a={...o,...Array.from(s)[0]};for(let c in a){let l=a[c];typeof l=="bigint"&&(a[c]=Number(l))}return a}async queryFields(t){let r=await aK(this,t);return(await Promise.all(r.map(i=>this.fieldInfo(i)))).filter(i=>i)}};async function sK(e,t){let r=await e.query(`DESCRIBE ${af(t)}`,{type:"json",cache:!1}),n=uU();for(let i of r)n[i.column_name]={table:t,column:i.column_name,sqlType:i.column_type,type:cU(i.column_type),nullable:i.null==="YES"};return n}async function aK(e,t){return t.length===1&&t[0].column==="*"?Object.values(await e.tableInfo(t[0].table)):t}function dU(e){let t=2166136261;for(let r=0,n=e.length;r<n;++r){let i=e.charCodeAt(r),o=i&65280;o&&(t=fU(t^o>>8)),t=fU(t^i&255)}return cK(t)}function fU(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 A1=class{constructor(t,{selection:r,temp:n=!0}){this.mc=t,this.selection=r,this.temp=n,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,r){if(this.clients!==t){let l=Array.from(t,pU),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;r=r||this.selection.active;let{source:n}=r;if(n&&n===this.activeView?.source)return!0;if(this.clear(),!n)return!1;let i=this.activeView=lK(r);if(!i)return!1;this.mc.logger().warn("DATA CUBE INDEX CONSTRUCTION");let o=this.selection.remove(n),s=this.indices=new Map,{mc:a,temp:c}=this;for(let l of t){if(o.skip(l,r))continue;let u=pU(l),f=l.query(o.predicate(l)).select({...i.columns,...u.count}).groupby(Object.keys(i.columns)),[d]=f.subqueries;if(d){let b=Object.values(i.columns).map(x=>x.columns[0]);fK(d,b)}let h=f.orderby();f.query.orderby=[];let p=f.toString(),g=`cube_index_${(dU(p)>>>0).toString(16)}`,m=a.exec(Ol(g,p,{temp:c}));s.set(l,{table:g,result:m,order:h,...u})}}async update(){let{clients:t,selection:r,activeView:n}=this,i=n.predicate(r.active.predicate);return Promise.all(Array.from(t).map(o=>this.updateClient(o,i)))}async updateClient(t,r){let n=this.indices.get(t);if(!n)return;r||(r=this.activeView.predicate(this.selection.active.predicate));let{table:i,dims:o,aggr:s,order:a=[]}=n,c=Mt.select(o,s).from(i).groupby(o).where(r).orderby(a);return this.mc.updateClient(t,c)}};function lK(e){let{source:t,schema:r}=e,n=e.predicate?.columns;if(!r||!n)return null;let{type:i,scales:o,pixelSize:s=1}=r,a;if(i==="interval"&&o){let c=o.map(l=>uK(l,s));if(c.some(l=>l==null))return null;c.length===1?(a=l=>l?tr("active0",l.range.map(c[0])):[],n={active0:c[0](e.predicate.field)}):(a=l=>l?$n(l.children.map(({range:u},f)=>tr(`active${f}`,u.map(c[f])))):[],n=Object.fromEntries(e.predicate.children.map((l,u)=>[`active${u}`,c[u](l.field)])))}else if(i==="point")a=c=>c,n=Object.fromEntries(n.map(c=>[c.toString(),c]));else return null;return{source:t,columns:n,predicate:a}}function uK(e,t){let{apply:r,sqlApply:n}=Fy(e);if(r){let{domain:i,range:o}=e,s=r(Math.min(...i)),a=r(Math.max(...i)),c=Math.abs(o[1]-o[0])/(a-s)/t,l=t===1?"":`${t}::INTEGER * `;return u=>W`${l}FLOOR(${c}::DOUBLE * (${n(u)} - ${s}::DOUBLE))::INTEGER`}}var hU={from:NaN};function pU(e){if(!e.filterIndexable)return hU;let t=e.query(),r=lE(t);if(!r||!t.groupby)return hU;let n=new Set(t.groupby().map(a=>a.column)),i=[],o=[],s;for(let{as:a,expr:{aggregate:c}}of t.select())switch(c?.toUpperCase?.()){case"COUNT":case"SUM":i.push({[a]:W`SUM("${a}")::DOUBLE`});break;case"AVG":s="_count_",i.push({[a]:W`(SUM("${a}" * ${s}) / SUM(${s}))::DOUBLE`});break;case"MAX":i.push({[a]:W`MAX("${a}")`});break;case"MIN":i.push({[a]:W`MIN("${a}")`});break;default:if(n.has(a))o.push(a);else return null}return{aggr:i,dims:o,count:s?{[s]:W`COUNT(*)`}:{},from:r}}function lE(e){let t=e.subqueries;if(e.select){let n=e.from();if(!n.length)return;if(t.length===0)return n[0].from.table}let r=lE(t[0]);for(let n=1;n<t.length;++n){let i=lE(t[n]);if(i!==void 0&&i!==r)return NaN}return r}function fK(e,t){let r=new Set,n=i=>{r.has(i)||(r.add(i),i.select&&i.from().length&&i.select(t),i.subqueries.forEach(n))};n(e)}var M1=class{constructor(t,r,n=!0){this.mc=t,this.selection=r,this.clients=new Set,this.indexer=n?new A1(this.mc,{...n,selection:r}):null;let{value:i,activate:o}=this.handlers={value:()=>this.update(),activate:s=>this.indexer?.index(this.clients,s)};r.addEventListener("value",i),r.addEventListener("activate",o)}finalize(){let{value:t,activate:r}=this.handlers;this.selection.removeEventListener("value",t),this.selection.removeEventListener("activate",r)}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:r,clients:n,selection:i}=this;return r?.index(n)?r.update():dK(t,n,i)}};function dK(e,t,r){return Promise.all(Array.from(t).map(n=>{let i=r.predicate(n);if(i!=null)return e.updateClient(n,n.query(i))}))}function E1(){let e,t,r=new Promise((n,i)=>{e=n,t=i});return r.fulfill=n=>(e(n),r),r.reject=n=>(t(n),r),r}function hK(e){return(typeof requestAnimationFrame<"u"?requestAnimationFrame:typeof setImmediate<"u"?setImmediate:setTimeout)(e)}function mU(e,t,r){let n=[],i=0;function o(){let s=pK(n,t);n=[],i=0;for(let a of s)yK(a,e,r),xK(a,t)}return{add(s,a){s.request.type==="arrow"?(i=i||hK(()=>o()),n.push({entry:s,priority:a,index:n.length})):e(s,a)}}}function pK(e,t){let r=[],n=new Map;for(let i of e){let{entry:{request:o}}=i,s=mK(o.query,t);if(!n.has(s)){let a=[];r.push(a),n.set(s,a)}n.get(s).push(i)}return r}function mK(e,t){let r=`${e}`;if(e instanceof Mt&&!t.get(r)){if(e.orderby().length||e.where().length||e.qualify().length||e.having().length)return r;let n=e.clone().$select("*"),i=e.groupby();if(i.length){let o={};e.select().forEach(({as:s,expr:a})=>o[s]=a),n.$groupby(i.map(s=>s instanceof mi&&o[s.column]||s))}return`${n}`}else return r}function yK(e,t,r){if(gK(e))t({request:{type:"arrow",cache:!1,record:!1,query:bK(e,r)},result:e.result=E1()});else for(let{entry:n,priority:i}of e)t(n,i)}function gK(e){if(e.length>1){let t=`${e[0].entry.request.query}`;for(let r=1;r<e.length;++r)if(t!==`${e[r].entry.request.query}`)return!0}return!1}function bK(e,t){let r=e.maps=[],n=new Map;for(let s of e){let{query:a}=s.entry.request,c=[];r.push(c);for(let{as:l,expr:u}of a.select()){let f=`${u}`;n.has(f)||n.set(f,[`col${n.size}`,u]);let[d]=n.get(f);c.push([d,l])}t(`${a}`)}let i=e[0].entry.request.query.clone(),o=i.groupby();if(o.length){let s={};e.maps[0].forEach(([a,c])=>s[c]=a),i.$groupby(o.map(a=>a instanceof mi&&s[a.column]||a))}return i.$select(Array.from(n.values()))}async function xK(e,t){let{maps:r,result:n}=e;if(!r)return;let i;try{i=await n}catch(o){for(let{entry:s}of e)s.result.reject(o);return}e.forEach(({entry:o},s)=>{let{request:a,result:c}=o,l=_K(i,r[s]);a.cache&&t.set(String(a.query),l),c.fulfill(l)})}function _K(e,t){if(t){let r={};for(let[n,i]of t)r[i]=e.getChild(n);return new e.constructor(r)}else return e}var wK=typeof requestIdleCallback<"u"?requestIdleCallback:setTimeout,yU=()=>({get:()=>{},set:(e,t)=>t,clear:()=>{}});function gU({max:e=1e3,ttl:t=3*60*60*1e3}={}){let r=new Map;function n(){let i=performance.now()-t,o=null,s=1/0;for(let[a,c]of r){let{last:l}=c;l<s&&(o=a,s=l),i>l&&r.delete(a)}o&&r.delete(o)}return{get(i){let o=r.get(i);if(o)return o.last=performance.now(),o.value},set(i,o){return r.set(i,{last:performance.now(),value:o}),r.size>e&&wK(n),o},clear(){r=new Map}}}function bU(e){let t=Array.from({length:e},()=>({head:null,tail:null}));return{isEmpty(){return t.every(r=>!r.head)},insert(r,n){let i=t[n];if(!i)throw new Error(`Invalid queue priority rank: ${n}`);let o={item:r,next:null};i.head===null?i.head=i.tail=o:i.tail=i.tail.next=o},remove(r){for(let n of t){let{head:i,tail:o}=n;for(let s=null,a=i;a;s=a,a=a.next)r(a.item)&&(a===i?i=a.next:s.next=a.next,a===o&&(o=s||i));n.head=i,n.tail=o}},next(){for(let r of t){let{head:n}=r;if(n!==null)return r.head=n.next,r.tail===n&&(r.tail=null),n.item}}}}var Rs={High:0,Normal:1,Low:2};function xU(){let e=bU(3),t,r,n,i=[],o=null,s;function a(){if(o||e.isEmpty())return;let{request:f,result:d}=e.next();o=u(f,d),o.finally(()=>{o=null,a()})}function c(f,d=Rs.Normal){e.insert(f,d),a()}function l(f){i.length&&f&&i.forEach(d=>d.add(f))}async function u(f,d){try{let{query:h,type:p,cache:y=!1,record:g=!0,options:m}=f,b=h?`${h}`:null;if(g&&l(b),y){let v=r.get(b);if(v){n.debug("Cache"),d.fulfill(v);return}}let x=performance.now(),_=await t.query({type:p,sql:b,...m});y&&r.set(b,_),n.debug(`Request: ${(performance.now()-x).toFixed(1)}`),d.fulfill(_)}catch(h){d.reject(h)}}return{cache(f){return f!==void 0?r=f===!0?gU():f||yU():r},logger(f){return f?n=f:n},connector(f){return f?t=f:t},consolidate(f){f&&!s?s=mU(c,r,l):!f&&s&&(s=null)},request(f,d=Rs.Normal){let h=E1(),p={request:f,result:h};return s?s.add(p,d):c(p,d),h},cancel(f){let d=new Set(f);e.remove(({result:h})=>d.has(h))},clear(){e.remove(({result:f})=>(f.reject("Cleared"),!0))},record(){let f=[],d={add(h){f.push(h)},reset(){f=[]},snapshot(){return f.slice()},stop(){return i=i.filter(h=>h!==d),f}};return i.push(d),d}}}function _U(){return{debug(){},info(){},log(){},warn(){},error(){}}}var D1;function co(e){return e?D1=e:D1==null&&(D1=new Ly),D1}var Ly=class{constructor(t=x1(),r={}){let{logger:n=console,manager:i=xU()}=r;this.catalog=new T1(this),this.manager=i,this.logger(n),this.configure(r),this.databaseConnector(t),this.clear()}logger(t){return arguments.length&&(this._logger=t||_U(),this.manager.logger(this._logger)),this._logger}configure({cache:t=!0,consolidate:r=!0,indexes:n=!0}){this.manager.cache(t),this.manager.consolidate(r),this.indexes=n}clear({clients:t=!0,cache:r=!0,catalog:n=!1}={}){this.manager.clear(),t&&(this.clients?.forEach(i=>this.disconnect(i)),this.filterGroups?.forEach(i=>i.finalize()),this.clients=new Set,this.filterGroups=new Map),r&&this.manager.cache().clear(),n&&this.catalog.clear()}databaseConnector(t){return this.manager.connector(t)}cancel(t){this.manager.cancel(t)}exec(t,{priority:r=Rs.Normal}={}){return t=Array.isArray(t)?t.join(`;
11
+ `):t,this.manager.request({type:"exec",query:t},r)}query(t,{type:r="arrow",cache:n=!0,priority:i=Rs.Normal,...o}={}){return this.manager.request({type:r,query:t,cache:n,options:o},i)}prefetch(t,r={}){return this.query(t,{...r,cache:!0,priority:Rs.Low})}createBundle(t,r,n=Rs.Low){let i={name:t,queries:r};return this.manager.request({type:"create-bundle",options:i},n)}loadBundle(t,r=Rs.High){let n={name:t};return this.manager.request({type:"load-bundle",options:n},r)}updateClient(t,r,n=Rs.Normal){return t.queryPending(),this.query(r,{priority:n}).then(i=>t.queryResult(i).update(),i=>{t.queryError(i),this._logger.error(i)})}requestQuery(t,r){return this.filterGroups.get(t.filterBy)?.reset(),r?this.updateClient(t,r):t.update()}async connect(t){let{catalog:r,clients:n,filterGroups:i,indexes:o}=this;if(n.has(t))throw new Error("Client already connected.");n.add(t),t.coordinator=this;let s=t.fields();s?.length&&t.fieldInfo(await r.queryFields(s));let a=t.filterBy;if(a)if(i.has(a))i.get(a).add(t);else{let c=new M1(this,a,o);i.set(a,c.add(t))}t.requestQuery()}disconnect(t){let{clients:r,filterGroups:n}=this;r.has(t)&&(r.delete(t),n.get(t.filterBy)?.remove(t),t.coordinator=null)}};var B1=class{constructor(){this._callbacks=new Map}addEventListener(t,r){this._callbacks.has(t)||this._callbacks.set(t,{callbacks:new Set,pending:null,queue:new uE}),this._callbacks.get(t).callbacks.add(r)}removeEventListener(t,r){let n=this._callbacks.get(t);n&&n.callbacks.delete(r)}willEmit(t,r){return r}emitQueueFilter(){return null}cancel(t){this._callbacks.get(t)?.queue.clear()}emit(t,r){let n=this._callbacks.get(t)||{};if(n.pending)n.queue.enqueue(r,this.emitQueueFilter(t,r));else{let i=this.willEmit(t,r),{callbacks:o,queue:s}=n;if(o?.size){let a=Promise.allSettled(Array.from(o,c=>c(i))).then(()=>{n.pending=null,s.isEmpty()||this.emit(t,s.dequeue())});n.pending=a}}}},uE=class{constructor(){this.clear()}clear(){this.next=null}isEmpty(){return!this.next}enqueue(t,r){let n={value:t};if(r&&this.next){let i=this;for(;i.next;)r(i.next.value)?i=i.next:i.next=i.next.next;i.next=n}else this.next=n}dequeue(){let{next:t}=this;return this.next=t?.next,t?.value}};function Ry(e,t){return e===t?!1:e instanceof Date&&t instanceof Date?+e!=+t:Array.isArray(e)&&Array.isArray(t)?vK(e,t):!0}function vK(e,t){if(e.length!==t.length)return!0;for(let r=0;r<e.length;++r)if(e[r]!==t[r])return!0;return!1}function yi(e){return e instanceof Nl}var Nl=class e extends B1{constructor(t){super(),this._value=t}static value(t){return new e(t)}static array(t){if(t.some(r=>yi(r))){let r=new e,n=()=>r.update(t.map(i=>yi(i)?i.value:i));return n(),t.forEach(i=>yi(i)?i.addEventListener("value",n):0),r}return new e(t)}get value(){return this._value}update(t,{force:r}={}){return Ry(this._value,t)||r?this.emit("value",t):this.cancel("value"),this}willEmit(t,r){return t==="value"&&(this._value=r),r}};function lo(e){return e instanceof ac}var ac=class e extends Nl{static intersect({cross:t=!1}={}){return new e(new hf({cross:t}))}static union({cross:t=!1}={}){return new e(new hf({cross:t,union:!0}))}static single({cross:t=!1}={}){return new e(new hf({cross:t,single:!0}))}static crossfilter(){return new e(new hf({cross:!0}))}constructor(t=new hf){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 r=this.clone();return r._value=r._resolved=r._resolver.resolve(this._resolved,{source:t}),r._value.active={source:t},r}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,r){return t==="value"?(this._value=r,this.value):r}emitQueueFilter(t,r){return t==="value"?this._resolver.queueFilter(r):null}skip(t,r){return this._resolver.skip(t,r)}predicate(t,r=!1){let{clauses:n}=this,i=r?null:n.active;return this._resolver.predicate(n,i,t)}},hf=class{constructor({union:t,cross:r,single:n}={}){this.union=!!t,this.cross=!!r,this.single=!!n}resolve(t,r,n=!1){let{source:i,predicate:o}=r,s=t.filter(c=>i!==c.source),a=this.single?[]:s;return this.single&&n&&s.forEach(c=>c.source?.reset?.()),o&&a.push(r),a}skip(t,r){return this.cross&&r?.clients?.has(t)}predicate(t,r,n){let{union:i}=this;if(this.skip(n,r))return;let o=t.filter(s=>!this.skip(n,s)).map(s=>s.predicate);return i&&o.length>1?cf(o):o}queueFilter(t){if(this.cross){let r=t.active?.source;return n=>n.active?.source!==r}}};function wU(e="http://localhost:3000/"){return{async query(t){let r=fetch(e,{method:"POST",mode:"cors",cache:"no-cache",credentials:"omit",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)});return t.type==="exec"?r:t.type==="arrow"?sf(r):(await r).json()}}}var yE={};Ir(yE,{compareArrayLike:()=>mE,joinUint8Arrays:()=>ki,memcpy:()=>rh,rebaseValueOffsets:()=>C1,toArrayBufferView:()=>ee,toArrayBufferViewAsyncIterator:()=>Qo,toArrayBufferViewIterator:()=>ks,toBigInt64Array:()=>DK,toBigUint64Array:()=>NK,toFloat32Array:()=>FK,toFloat32ArrayAsyncIterator:()=>HK,toFloat32ArrayIterator:()=>zK,toFloat64Array:()=>LK,toFloat64ArrayAsyncIterator:()=>ZK,toFloat64ArrayIterator:()=>VK,toInt16Array:()=>EK,toInt16ArrayAsyncIterator:()=>YK,toInt16ArrayIterator:()=>CK,toInt32Array:()=>pf,toInt32ArrayAsyncIterator:()=>WK,toInt32ArrayIterator:()=>UK,toInt8Array:()=>MK,toInt8ArrayAsyncIterator:()=>qK,toInt8ArrayIterator:()=>kK,toUint16Array:()=>BK,toUint16ArrayAsyncIterator:()=>GK,toUint16ArrayIterator:()=>PK,toUint32Array:()=>OK,toUint32ArrayAsyncIterator:()=>XK,toUint32ArrayIterator:()=>$K,toUint8Array:()=>Xt,toUint8ArrayAsyncIterator:()=>pE,toUint8ArrayIterator:()=>hE,toUint8ClampedArray:()=>RK,toUint8ClampedArrayAsyncIterator:()=>KK,toUint8ClampedArrayIterator:()=>jK});var SK=new TextDecoder("utf-8"),ky=e=>SK.decode(e),IK=new TextEncoder,Fl=e=>IK.encode(e);var TK=e=>typeof e=="number",vU=e=>typeof e=="boolean",Vr=e=>typeof e=="function",zn=e=>e!=null&&Object(e)===e,Zo=e=>zn(e)&&Vr(e.then);var Ko=e=>zn(e)&&Vr(e[Symbol.iterator]),uo=e=>zn(e)&&Vr(e[Symbol.asyncIterator]),O1=e=>zn(e)&&zn(e.schema);var N1=e=>zn(e)&&"done"in e&&"value"in e;var F1=e=>zn(e)&&Vr(e.stat)&&TK(e.fd);var L1=e=>zn(e)&&Cy(e.body),R1=e=>"_getDOMStream"in e&&"_getNodeStream"in e,SU=e=>zn(e)&&Vr(e.abort)&&Vr(e.getWriter)&&!R1(e),Cy=e=>zn(e)&&Vr(e.cancel)&&Vr(e.getReader)&&!R1(e),IU=e=>zn(e)&&Vr(e.end)&&Vr(e.write)&&vU(e.writable)&&!R1(e),k1=e=>zn(e)&&Vr(e.read)&&Vr(e.pipe)&&vU(e.readable)&&!R1(e),TU=e=>zn(e)&&Vr(e.clear)&&Vr(e.bytes)&&Vr(e.position)&&Vr(e.setPosition)&&Vr(e.capacity)&&Vr(e.getBufferIdentifier)&&Vr(e.createLong);var dE=typeof SharedArrayBuffer<"u"?SharedArrayBuffer:ArrayBuffer;function AK(e){let t=e[0]?[e[0]]:[],r,n,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:r,byteLength:i}=s,{byteOffset:n,byteLength:o}=a,r+i<n||n+o<r){a&&(t[++l]=a);continue}t[l]=new Uint8Array(s.buffer,r,n-r+o)}return t}function rh(e,t,r=0,n=t.byteLength){let i=e.byteLength,o=new Uint8Array(e.buffer,e.byteOffset,i),s=new Uint8Array(t.buffer,t.byteOffset,Math.min(n,i));return o.set(s,r),e}function ki(e,t){let r=AK(e),n=r.reduce((u,f)=>u+f.byteLength,0),i,o,s,a=0,c=-1,l=Math.min(t||Number.POSITIVE_INFINITY,n);for(let u=r.length;++c<u;){if(i=r[c],o=i.subarray(0,Math.min(i.length,l-a)),l<=a+o.length){o.length<i.length?r[c]=i.subarray(o.length):o.length===i.length&&c++,s?rh(s,o,a):s=o;break}rh(s||(s=new Uint8Array(l)),o,a),a+=o.length}return[s||new Uint8Array(0),r.slice(c),n-(s?s.byteLength:0)]}function ee(e,t){let r=N1(t)?t.value:t;return r instanceof e?e===Uint8Array?new e(r.buffer,r.byteOffset,r.byteLength):r:r?(typeof r=="string"&&(r=Fl(r)),r instanceof ArrayBuffer?new e(r):r instanceof dE?new e(r):TU(r)?ee(e,r.bytes()):ArrayBuffer.isView(r)?r.byteLength<=0?new e(0):new e(r.buffer,r.byteOffset,r.byteLength/e.BYTES_PER_ELEMENT):e.from(r)):new e(0)}var MK=e=>ee(Int8Array,e),EK=e=>ee(Int16Array,e),pf=e=>ee(Int32Array,e),DK=e=>ee(BigInt64Array,e),Xt=e=>ee(Uint8Array,e),BK=e=>ee(Uint16Array,e),OK=e=>ee(Uint32Array,e),NK=e=>ee(BigUint64Array,e),FK=e=>ee(Float32Array,e),LK=e=>ee(Float64Array,e),RK=e=>ee(Uint8ClampedArray,e),fE=e=>(e.next(),e);function*ks(e,t){let r=function*(i){yield i},n=typeof t=="string"||ArrayBuffer.isView(t)||t instanceof ArrayBuffer||t instanceof dE?r(t):Ko(t)?t:r(t);return yield*fE(function*(i){let o=null;do o=i.next(yield ee(e,o));while(!o.done)}(n[Symbol.iterator]())),new e}var kK=e=>ks(Int8Array,e),CK=e=>ks(Int16Array,e),UK=e=>ks(Int32Array,e),hE=e=>ks(Uint8Array,e),PK=e=>ks(Uint16Array,e),$K=e=>ks(Uint32Array,e),zK=e=>ks(Float32Array,e),VK=e=>ks(Float64Array,e),jK=e=>ks(Uint8ClampedArray,e);function Qo(e,t){return $e(this,arguments,function*(){if(Zo(t))return yield H(yield H(yield*Ji(fr(Qo(e,yield H(t))))));let n=function(s){return $e(this,arguments,function*(){yield yield H(yield H(s))})},i=function(s){return $e(this,arguments,function*(){yield H(yield*Ji(fr(fE(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 dE?n(t):Ko(t)?i(t):uo(t)?t:n(t);return yield H(yield*Ji(fr(fE(function(s){return $e(this,arguments,function*(){let a=null;do a=yield H(s.next(yield yield H(ee(e,a))));while(!a.done)})}(o[Symbol.asyncIterator]()))))),yield H(new e)})}var qK=e=>Qo(Int8Array,e),YK=e=>Qo(Int16Array,e),WK=e=>Qo(Int32Array,e),pE=e=>Qo(Uint8Array,e),GK=e=>Qo(Uint16Array,e),XK=e=>Qo(Uint32Array,e),HK=e=>Qo(Float32Array,e),ZK=e=>Qo(Float64Array,e),KK=e=>Qo(Uint8ClampedArray,e);function C1(e,t,r){if(e!==0){r=r.slice(0,t);for(let n=-1,i=r.length;++n<i;)r[n]+=e}return r.subarray(0,t)}function mE(e,t){let r=0,n=e.length;if(n!==t.length)return!1;if(n>0)do if(e[r]!==t[r])return!1;while(++r<n);return!0}var ln={fromIterable(e){return U1(QK(e))},fromAsyncIterable(e){return U1(JK(e))},fromDOMStream(e){return U1(tQ(e))},fromNodeStream(e){return U1(eQ(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')}},U1=e=>(e.next(),e);function*QK(e){let t,r=!1,n=[],i,o,s,a=0;function c(){return o==="peek"?ki(n,s)[0]:([i,n,a]=ki(n,s),i)}({cmd:o,size:s}=yield null);let l=hE(e)[Symbol.iterator]();try{do if({done:t,value:i}=Number.isNaN(s-a)?l.next():l.next(s-a),!t&&i.byteLength>0&&(n.push(i),a+=i.byteLength),t||s<=a)do({cmd:o,size:s}=yield c());while(s<a);while(!t)}catch(u){(r=!0)&&typeof l.throw=="function"&&l.throw(u)}finally{r===!1&&typeof l.return=="function"&&l.return(null)}return null}function JK(e){return $e(this,arguments,function*(){let r,n=!1,i=[],o,s,a,c=0;function l(){return s==="peek"?ki(i,a)[0]:([o,i,c]=ki(i,a),o)}({cmd:s,size:a}=yield yield H(null));let u=pE(e)[Symbol.asyncIterator]();try{do if({done:r,value:o}=Number.isNaN(a-c)?yield H(u.next()):yield H(u.next(a-c)),!r&&o.byteLength>0&&(i.push(o),c+=o.byteLength),r||a<=c)do({cmd:s,size:a}=yield yield H(l()));while(a<c);while(!r)}catch(f){(n=!0)&&typeof u.throw=="function"&&(yield H(u.throw(f)))}finally{n===!1&&typeof u.return=="function"&&(yield H(u.return(new Uint8Array(0))))}return yield H(null)})}function tQ(e){return $e(this,arguments,function*(){let r=!1,n=!1,i=[],o,s,a,c=0;function l(){return s==="peek"?ki(i,a)[0]:([o,i,c]=ki(i,a),o)}({cmd:s,size:a}=yield yield H(null));let u=new bE(e);try{do if({done:r,value:o}=Number.isNaN(a-c)?yield H(u.read()):yield H(u.read(a-c)),!r&&o.byteLength>0&&(i.push(Xt(o)),c+=o.byteLength),r||a<=c)do({cmd:s,size:a}=yield yield H(l()));while(a<c);while(!r)}catch(f){(n=!0)&&(yield H(u.cancel(f)))}finally{n===!1?yield H(u.cancel()):e.locked&&u.releaseLock()}return yield H(null)})}var bE=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 P(this,void 0,void 0,function*(){let{reader:r,source:n}=this;r&&(yield r.cancel(t).catch(()=>{})),n&&n.locked&&this.releaseLock()})}read(t){return P(this,void 0,void 0,function*(){if(t===0)return{done:this.reader==null,value:new Uint8Array(0)};let r=yield this.reader.read();return!r.done&&(r.value=Xt(r)),r})}},gE=(e,t)=>{let r=i=>n([t,i]),n;return[t,r,new Promise(i=>(n=i)&&e.once(t,r))]};function eQ(e){return $e(this,arguments,function*(){let r=[],n="error",i=!1,o=null,s,a,c=0,l=[],u;function f(){return s==="peek"?ki(l,a)[0]:([u,l,c]=ki(l,a),u)}if({cmd:s,size:a}=yield yield H(null),e.isTTY)return yield yield H(new Uint8Array(0)),yield H(null);try{r[0]=gE(e,"end"),r[1]=gE(e,"error");do{if(r[2]=gE(e,"readable"),[n,o]=yield H(Promise.race(r.map(h=>h[2]))),n==="error")break;if((i=n==="end")||(Number.isFinite(a-c)?(u=Xt(e.read(a-c)),u.byteLength<a-c&&(u=Xt(e.read()))):u=Xt(e.read()),u.byteLength>0&&(l.push(u),c+=u.byteLength)),i||a<=c)do({cmd:s,size:a}=yield yield H(f()));while(a<c)}while(!i)}finally{yield H(d(r,n==="error"?o:null))}return yield H(null);function d(h,p){return u=l=null,new Promise((y,g)=>{for(let[m,b]of h)e.off(m,b);try{let m=e.destroy;m&&m.call(e,p),p=void 0}catch(m){p=m||p}finally{p!=null?g(p):y()}})}})}var er;(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"})(er||(er={}));var je;(function(e){e[e.Sparse=0]="Sparse",e[e.Dense=1]="Dense"})(je||(je={}));var Xe;(function(e){e[e.HALF=0]="HALF",e[e.SINGLE=1]="SINGLE",e[e.DOUBLE=2]="DOUBLE"})(Xe||(Xe={}));var un;(function(e){e[e.DAY=0]="DAY",e[e.MILLISECOND=1]="MILLISECOND"})(un||(un={}));var It;(function(e){e[e.SECOND=0]="SECOND",e[e.MILLISECOND=1]="MILLISECOND",e[e.MICROSECOND=2]="MICROSECOND",e[e.NANOSECOND=3]="NANOSECOND"})(It||(It={}));var Vn;(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"})(Vn||(Vn={}));var ge;(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"})(ge||(ge={}));var N;(function(e){e[e.NONE=0]="NONE",e[e.Null=1]="Null",e[e.Int=2]="Int",e[e.Float=3]="Float",e[e.Binary=4]="Binary",e[e.Utf8=5]="Utf8",e[e.Bool=6]="Bool",e[e.Decimal=7]="Decimal",e[e.Date=8]="Date",e[e.Time=9]="Time",e[e.Timestamp=10]="Timestamp",e[e.Interval=11]="Interval",e[e.List=12]="List",e[e.Struct=13]="Struct",e[e.Union=14]="Union",e[e.FixedSizeBinary=15]="FixedSizeBinary",e[e.FixedSizeList=16]="FixedSizeList",e[e.Map=17]="Map",e[e.Duration=18]="Duration",e[e.Dictionary=-1]="Dictionary",e[e.Int8=-2]="Int8",e[e.Int16=-3]="Int16",e[e.Int32=-4]="Int32",e[e.Int64=-5]="Int64",e[e.Uint8=-6]="Uint8",e[e.Uint16=-7]="Uint16",e[e.Uint32=-8]="Uint32",e[e.Uint64=-9]="Uint64",e[e.Float16=-10]="Float16",e[e.Float32=-11]="Float32",e[e.Float64=-12]="Float64",e[e.DateDay=-13]="DateDay",e[e.DateMillisecond=-14]="DateMillisecond",e[e.TimestampSecond=-15]="TimestampSecond",e[e.TimestampMillisecond=-16]="TimestampMillisecond",e[e.TimestampMicrosecond=-17]="TimestampMicrosecond",e[e.TimestampNanosecond=-18]="TimestampNanosecond",e[e.TimeSecond=-19]="TimeSecond",e[e.TimeMillisecond=-20]="TimeMillisecond",e[e.TimeMicrosecond=-21]="TimeMicrosecond",e[e.TimeNanosecond=-22]="TimeNanosecond",e[e.DenseUnion=-23]="DenseUnion",e[e.SparseUnion=-24]="SparseUnion",e[e.IntervalDayTime=-25]="IntervalDayTime",e[e.IntervalYearMonth=-26]="IntervalYearMonth",e[e.DurationSecond=-27]="DurationSecond",e[e.DurationMillisecond=-28]="DurationMillisecond",e[e.DurationMicrosecond=-29]="DurationMicrosecond",e[e.DurationNanosecond=-30]="DurationNanosecond"})(N||(N={}));var fo;(function(e){e[e.OFFSET=0]="OFFSET",e[e.DATA=1]="DATA",e[e.VALIDITY=2]="VALIDITY",e[e.TYPE=3]="TYPE"})(fo||(fo={}));var CE={};Ir(CE,{clampIndex:()=>WQ,clampRange:()=>zy,createElementComparator:()=>kl});var xE={};Ir(xE,{valueToString:()=>Jo});function Jo(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=>Jo(t))}]`:`[${e}]`:ArrayBuffer.isView(e)?`[${e}]`:JSON.stringify(e,(t,r)=>typeof r=="bigint"?`${r}`:r)}var wE={};Ir(wE,{BN:()=>Py,bigNumToBigInt:()=>EU,bigNumToString:()=>oh,isArrowBigNumSymbol:()=>AU});var AU=Symbol.for("isArrowBigNum");function ts(e,...t){return t.length===0?Object.setPrototypeOf(ee(this.TypedArray,e),this.constructor.prototype):Object.setPrototypeOf(new this.TypedArray(e,...t),this.constructor.prototype)}ts.prototype[AU]=!0;ts.prototype.toJSON=function(){return`"${oh(this)}"`};ts.prototype.valueOf=function(){return MU(this)};ts.prototype.toString=function(){return oh(this)};ts.prototype[Symbol.toPrimitive]=function(e="default"){switch(e){case"number":return MU(this);case"string":return oh(this);case"default":return EU(this)}return oh(this)};function nh(...e){return ts.apply(this,e)}function ih(...e){return ts.apply(this,e)}function Uy(...e){return ts.apply(this,e)}Object.setPrototypeOf(nh.prototype,Object.create(Int32Array.prototype));Object.setPrototypeOf(ih.prototype,Object.create(Uint32Array.prototype));Object.setPrototypeOf(Uy.prototype,Object.create(Uint32Array.prototype));Object.assign(nh.prototype,ts.prototype,{constructor:nh,signed:!0,TypedArray:Int32Array,BigIntArray:BigInt64Array});Object.assign(ih.prototype,ts.prototype,{constructor:ih,signed:!1,TypedArray:Uint32Array,BigIntArray:BigUint64Array});Object.assign(Uy.prototype,ts.prototype,{constructor:Uy,signed:!0,TypedArray:Uint32Array,BigIntArray:BigUint64Array});function MU(e){let{buffer:t,byteOffset:r,length:n,signed:i}=e,o=new BigUint64Array(t,r,n),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 oh=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 n=1;for(let o=0;o<t.length;o++){let s=t[o],a=~s+n;t[o]=a,n&=s===0?1:0}return`-${_E(t)}`},EU=e=>e.byteLength===8?new e.BigIntArray(e.buffer,e.byteOffset,1)[0]:oh(e);function _E(e){let t="",r=new Uint32Array(2),n=new Uint16Array(e.buffer,e.byteOffset,e.byteLength/2),i=new Uint32Array((n=new Uint16Array(n).reverse()).buffer),o=-1,s=n.length-1;do{for(r[0]=n[o=0];o<s;)n[o++]=r[1]=r[0]/10,r[0]=(r[0]-r[1]*10<<16)+n[o];n[o]=r[1]=r[0]/10,r[0]=r[0]-r[1]*10,t=`${r[0]}${t}`}while(i[0]||i[1]||i[2]||i[3]);return t??"0"}var Py=class e{static new(t,r){switch(r){case!0:return new nh(t);case!1:return new ih(t)}switch(t.constructor){case Int8Array:case Int16Array:case Int32Array:case BigInt64Array:return new nh(t)}return t.byteLength===16?new Uy(t):new ih(t)}static signed(t){return new nh(t)}static unsigned(t){return new ih(t)}static decimal(t){return new Uy(t)}constructor(t,r){return e.new(t,r)}};function gi(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 DU,BU,OU,NU,FU,LU,RU,kU,CU,UU,PU,$U,zU,VU,jU,qU,YU,WU,GU,XU,ht=class e{static isNull(t){return t?.typeId===N.Null}static isInt(t){return t?.typeId===N.Int}static isFloat(t){return t?.typeId===N.Float}static isBinary(t){return t?.typeId===N.Binary}static isUtf8(t){return t?.typeId===N.Utf8}static isBool(t){return t?.typeId===N.Bool}static isDecimal(t){return t?.typeId===N.Decimal}static isDate(t){return t?.typeId===N.Date}static isTime(t){return t?.typeId===N.Time}static isTimestamp(t){return t?.typeId===N.Timestamp}static isInterval(t){return t?.typeId===N.Interval}static isDuration(t){return t?.typeId===N.Duration}static isList(t){return t?.typeId===N.List}static isStruct(t){return t?.typeId===N.Struct}static isUnion(t){return t?.typeId===N.Union}static isFixedSizeBinary(t){return t?.typeId===N.FixedSizeBinary}static isFixedSizeList(t){return t?.typeId===N.FixedSizeList}static isMap(t){return t?.typeId===N.Map}static isDictionary(t){return t?.typeId===N.Dictionary}static isDenseUnion(t){return e.isUnion(t)&&t.mode===je.Dense}static isSparseUnion(t){return e.isUnion(t)&&t.mode===je.Sparse}get typeId(){return N.NONE}};DU=Symbol.toStringTag;ht[DU]=(e=>(e.children=null,e.ArrayType=Array,e[Symbol.toStringTag]="DataType"))(ht.prototype);var jn=class extends ht{toString(){return"Null"}get typeId(){return N.Null}};BU=Symbol.toStringTag;jn[BU]=(e=>e[Symbol.toStringTag]="Null")(jn.prototype);var xr=class extends ht{constructor(t,r){super(),this.isSigned=t,this.bitWidth=r}get typeId(){return N.Int}get ArrayType(){switch(this.bitWidth){case 8:return this.isSigned?Int8Array:Uint8Array;case 16:return this.isSigned?Int16Array:Uint16Array;case 32:return this.isSigned?Int32Array:Uint32Array;case 64:return this.isSigned?BigInt64Array:BigUint64Array}throw new Error(`Unrecognized ${this[Symbol.toStringTag]} type`)}toString(){return`${this.isSigned?"I":"Ui"}nt${this.bitWidth}`}};OU=Symbol.toStringTag;xr[OU]=(e=>(e.isSigned=null,e.bitWidth=null,e[Symbol.toStringTag]="Int"))(xr.prototype);var P1=class extends xr{constructor(){super(!0,8)}get ArrayType(){return Int8Array}},$1=class extends xr{constructor(){super(!0,16)}get ArrayType(){return Int16Array}},Cs=class extends xr{constructor(){super(!0,32)}get ArrayType(){return Int32Array}},z1=class extends xr{constructor(){super(!0,64)}get ArrayType(){return BigInt64Array}},V1=class extends xr{constructor(){super(!1,8)}get ArrayType(){return Uint8Array}},j1=class extends xr{constructor(){super(!1,16)}get ArrayType(){return Uint16Array}},q1=class extends xr{constructor(){super(!1,32)}get ArrayType(){return Uint32Array}},Y1=class extends xr{constructor(){super(!1,64)}get ArrayType(){return BigUint64Array}};Object.defineProperty(P1.prototype,"ArrayType",{value:Int8Array});Object.defineProperty($1.prototype,"ArrayType",{value:Int16Array});Object.defineProperty(Cs.prototype,"ArrayType",{value:Int32Array});Object.defineProperty(z1.prototype,"ArrayType",{value:BigInt64Array});Object.defineProperty(V1.prototype,"ArrayType",{value:Uint8Array});Object.defineProperty(j1.prototype,"ArrayType",{value:Uint16Array});Object.defineProperty(q1.prototype,"ArrayType",{value:Uint32Array});Object.defineProperty(Y1.prototype,"ArrayType",{value:BigUint64Array});var bi=class extends ht{constructor(t){super(),this.precision=t}get typeId(){return N.Float}get ArrayType(){switch(this.precision){case Xe.HALF:return Uint16Array;case Xe.SINGLE:return Float32Array;case Xe.DOUBLE:return Float64Array}throw new Error(`Unrecognized ${this[Symbol.toStringTag]} type`)}toString(){return`Float${this.precision<<5||16}`}};NU=Symbol.toStringTag;bi[NU]=(e=>(e.precision=null,e[Symbol.toStringTag]="Float"))(bi.prototype);var W1=class extends bi{constructor(){super(Xe.HALF)}},G1=class extends bi{constructor(){super(Xe.SINGLE)}},X1=class extends bi{constructor(){super(Xe.DOUBLE)}};Object.defineProperty(W1.prototype,"ArrayType",{value:Uint16Array});Object.defineProperty(G1.prototype,"ArrayType",{value:Float32Array});Object.defineProperty(X1.prototype,"ArrayType",{value:Float64Array});var cc=class extends ht{constructor(){super()}get typeId(){return N.Binary}toString(){return"Binary"}};FU=Symbol.toStringTag;cc[FU]=(e=>(e.ArrayType=Uint8Array,e[Symbol.toStringTag]="Binary"))(cc.prototype);var lc=class extends ht{constructor(){super()}get typeId(){return N.Utf8}toString(){return"Utf8"}};LU=Symbol.toStringTag;lc[LU]=(e=>(e.ArrayType=Uint8Array,e[Symbol.toStringTag]="Utf8"))(lc.prototype);var uc=class extends ht{constructor(){super()}get typeId(){return N.Bool}toString(){return"Bool"}};RU=Symbol.toStringTag;uc[RU]=(e=>(e.ArrayType=Uint8Array,e[Symbol.toStringTag]="Bool"))(uc.prototype);var fc=class extends ht{constructor(t,r,n=128){super(),this.scale=t,this.precision=r,this.bitWidth=n}get typeId(){return N.Decimal}toString(){return`Decimal[${this.precision}e${this.scale>0?"+":""}${this.scale}]`}};kU=Symbol.toStringTag;fc[kU]=(e=>(e.scale=null,e.precision=null,e.ArrayType=Uint32Array,e[Symbol.toStringTag]="Decimal"))(fc.prototype);var dc=class extends ht{constructor(t){super(),this.unit=t}get typeId(){return N.Date}toString(){return`Date${(this.unit+1)*32}<${un[this.unit]}>`}};CU=Symbol.toStringTag;dc[CU]=(e=>(e.unit=null,e.ArrayType=Int32Array,e[Symbol.toStringTag]="Date"))(dc.prototype);var es=class extends ht{constructor(t,r){super(),this.unit=t,this.bitWidth=r}get typeId(){return N.Time}toString(){return`Time${this.bitWidth}<${It[this.unit]}>`}get ArrayType(){switch(this.bitWidth){case 32:return Int32Array;case 64:return BigInt64Array}throw new Error(`Unrecognized ${this[Symbol.toStringTag]} type`)}};UU=Symbol.toStringTag;es[UU]=(e=>(e.unit=null,e.bitWidth=null,e[Symbol.toStringTag]="Time"))(es.prototype);var hc=class extends ht{constructor(t,r){super(),this.unit=t,this.timezone=r}get typeId(){return N.Timestamp}toString(){return`Timestamp<${It[this.unit]}${this.timezone?`, ${this.timezone}`:""}>`}};PU=Symbol.toStringTag;hc[PU]=(e=>(e.unit=null,e.timezone=null,e.ArrayType=Int32Array,e[Symbol.toStringTag]="Timestamp"))(hc.prototype);var pc=class extends ht{constructor(t){super(),this.unit=t}get typeId(){return N.Interval}toString(){return`Interval<${Vn[this.unit]}>`}};$U=Symbol.toStringTag;pc[$U]=(e=>(e.unit=null,e.ArrayType=Int32Array,e[Symbol.toStringTag]="Interval"))(pc.prototype);var mc=class extends ht{constructor(t){super(),this.unit=t}get typeId(){return N.Duration}toString(){return`Duration<${It[this.unit]}>`}};zU=Symbol.toStringTag;mc[zU]=(e=>(e.unit=null,e.ArrayType=BigInt64Array,e[Symbol.toStringTag]="Duration"))(mc.prototype);var rs=class extends ht{constructor(t){super(),this.children=[t]}get typeId(){return N.List}toString(){return`List<${this.valueType}>`}get valueType(){return this.children[0].type}get valueField(){return this.children[0]}get ArrayType(){return this.valueType.ArrayType}};VU=Symbol.toStringTag;rs[VU]=(e=>(e.children=null,e[Symbol.toStringTag]="List"))(rs.prototype);var qe=class extends ht{constructor(t){super(),this.children=t}get typeId(){return N.Struct}toString(){return`Struct<{${this.children.map(t=>`${t.name}:${t.type}`).join(", ")}}>`}};jU=Symbol.toStringTag;qe[jU]=(e=>(e.children=null,e[Symbol.toStringTag]="Struct"))(qe.prototype);var ns=class extends ht{constructor(t,r,n){super(),this.mode=t,this.children=n,this.typeIds=r=Int32Array.from(r),this.typeIdToChildIndex=r.reduce((i,o,s)=>(i[o]=s)&&i||i,Object.create(null))}get typeId(){return N.Union}toString(){return`${this[Symbol.toStringTag]}<${this.children.map(t=>`${t.type}`).join(" | ")}>`}};qU=Symbol.toStringTag;ns[qU]=(e=>(e.mode=null,e.typeIds=null,e.children=null,e.typeIdToChildIndex=null,e.ArrayType=Int8Array,e[Symbol.toStringTag]="Union"))(ns.prototype);var yc=class extends ht{constructor(t){super(),this.byteWidth=t}get typeId(){return N.FixedSizeBinary}toString(){return`FixedSizeBinary[${this.byteWidth}]`}};YU=Symbol.toStringTag;yc[YU]=(e=>(e.byteWidth=null,e.ArrayType=Uint8Array,e[Symbol.toStringTag]="FixedSizeBinary"))(yc.prototype);var is=class extends ht{constructor(t,r){super(),this.listSize=t,this.children=[r]}get typeId(){return N.FixedSizeList}get valueType(){return this.children[0].type}get valueField(){return this.children[0]}get ArrayType(){return this.valueType.ArrayType}toString(){return`FixedSizeList[${this.listSize}]<${this.valueType}>`}};WU=Symbol.toStringTag;is[WU]=(e=>(e.children=null,e.listSize=null,e[Symbol.toStringTag]="FixedSizeList"))(is.prototype);var os=class extends ht{constructor(t,r=!1){var n,i,o;if(super(),this.children=[t],this.keysSorted=r,t&&(t.name="entries",!((n=t?.type)===null||n===void 0)&&n.children)){let s=(i=t?.type)===null||i===void 0?void 0:i.children[0];s&&(s.name="key");let a=(o=t?.type)===null||o===void 0?void 0:o.children[1];a&&(a.name="value")}}get typeId(){return N.Map}get keyType(){return this.children[0].type.children[0].type}get valueType(){return this.children[0].type.children[1].type}get childType(){return this.children[0].type}toString(){return`Map<{${this.children[0].type.children.map(t=>`${t.name}:${t.type}`).join(", ")}}>`}};GU=Symbol.toStringTag;os[GU]=(e=>(e.children=null,e.keysSorted=null,e[Symbol.toStringTag]="Map_"))(os.prototype);var rQ=(e=>()=>++e)(-1),Ci=class extends ht{constructor(t,r,n,i){super(),this.indices=r,this.dictionary=t,this.isOrdered=i||!1,this.id=n==null?rQ():gi(n)}get typeId(){return N.Dictionary}get children(){return this.dictionary.children}get valueType(){return this.dictionary}get ArrayType(){return this.dictionary.ArrayType}toString(){return`Dictionary<${this.indices}, ${this.dictionary}>`}};XU=Symbol.toStringTag;Ci[XU]=(e=>(e.id=null,e.indices=null,e.isOrdered=null,e.dictionary=null,e[Symbol.toStringTag]="Dictionary"))(Ci.prototype);function Ui(e){let t=e;switch(e.typeId){case N.Decimal:return e.bitWidth/32;case N.Timestamp:return 2;case N.Date:return 1+t.unit;case N.Interval:return 1+t.unit;case N.FixedSizeList:return t.listSize;case N.FixedSizeBinary:return t.byteWidth;default:return 1}}var mt=class{visitMany(t,...r){return t.map((n,i)=>this.visit(n,...r.map(o=>o[i])))}visit(...t){return this.getVisitFn(t[0],!1).apply(this,t)}getVisitFn(t,r=!0){return nQ(this,t,r)}getVisitFnByTypeId(t,r=!0){return sh(this,t,r)}visitNull(t,...r){return null}visitBool(t,...r){return null}visitInt(t,...r){return null}visitFloat(t,...r){return null}visitUtf8(t,...r){return null}visitBinary(t,...r){return null}visitFixedSizeBinary(t,...r){return null}visitDate(t,...r){return null}visitTimestamp(t,...r){return null}visitTime(t,...r){return null}visitDecimal(t,...r){return null}visitList(t,...r){return null}visitStruct(t,...r){return null}visitUnion(t,...r){return null}visitDictionary(t,...r){return null}visitInterval(t,...r){return null}visitDuration(t,...r){return null}visitFixedSizeList(t,...r){return null}visitMap(t,...r){return null}};function nQ(e,t,r=!0){return typeof t=="number"?sh(e,t,r):typeof t=="string"&&t in N?sh(e,N[t],r):t&&t instanceof ht?sh(e,HU(t),r):t?.type&&t.type instanceof ht?sh(e,HU(t.type),r):sh(e,N.NONE,r)}function sh(e,t,r=!0){let n=null;switch(t){case N.Null:n=e.visitNull;break;case N.Bool:n=e.visitBool;break;case N.Int:n=e.visitInt;break;case N.Int8:n=e.visitInt8||e.visitInt;break;case N.Int16:n=e.visitInt16||e.visitInt;break;case N.Int32:n=e.visitInt32||e.visitInt;break;case N.Int64:n=e.visitInt64||e.visitInt;break;case N.Uint8:n=e.visitUint8||e.visitInt;break;case N.Uint16:n=e.visitUint16||e.visitInt;break;case N.Uint32:n=e.visitUint32||e.visitInt;break;case N.Uint64:n=e.visitUint64||e.visitInt;break;case N.Float:n=e.visitFloat;break;case N.Float16:n=e.visitFloat16||e.visitFloat;break;case N.Float32:n=e.visitFloat32||e.visitFloat;break;case N.Float64:n=e.visitFloat64||e.visitFloat;break;case N.Utf8:n=e.visitUtf8;break;case N.Binary:n=e.visitBinary;break;case N.FixedSizeBinary:n=e.visitFixedSizeBinary;break;case N.Date:n=e.visitDate;break;case N.DateDay:n=e.visitDateDay||e.visitDate;break;case N.DateMillisecond:n=e.visitDateMillisecond||e.visitDate;break;case N.Timestamp:n=e.visitTimestamp;break;case N.TimestampSecond:n=e.visitTimestampSecond||e.visitTimestamp;break;case N.TimestampMillisecond:n=e.visitTimestampMillisecond||e.visitTimestamp;break;case N.TimestampMicrosecond:n=e.visitTimestampMicrosecond||e.visitTimestamp;break;case N.TimestampNanosecond:n=e.visitTimestampNanosecond||e.visitTimestamp;break;case N.Time:n=e.visitTime;break;case N.TimeSecond:n=e.visitTimeSecond||e.visitTime;break;case N.TimeMillisecond:n=e.visitTimeMillisecond||e.visitTime;break;case N.TimeMicrosecond:n=e.visitTimeMicrosecond||e.visitTime;break;case N.TimeNanosecond:n=e.visitTimeNanosecond||e.visitTime;break;case N.Decimal:n=e.visitDecimal;break;case N.List:n=e.visitList;break;case N.Struct:n=e.visitStruct;break;case N.Union:n=e.visitUnion;break;case N.DenseUnion:n=e.visitDenseUnion||e.visitUnion;break;case N.SparseUnion:n=e.visitSparseUnion||e.visitUnion;break;case N.Dictionary:n=e.visitDictionary;break;case N.Interval:n=e.visitInterval;break;case N.IntervalDayTime:n=e.visitIntervalDayTime||e.visitInterval;break;case N.IntervalYearMonth:n=e.visitIntervalYearMonth||e.visitInterval;break;case N.Duration:n=e.visitDuration;break;case N.DurationSecond:n=e.visitDurationSecond||e.visitDuration;break;case N.DurationMillisecond:n=e.visitDurationMillisecond||e.visitDuration;break;case N.DurationMicrosecond:n=e.visitDurationMicrosecond||e.visitDuration;break;case N.DurationNanosecond:n=e.visitDurationNanosecond||e.visitDuration;break;case N.FixedSizeList:n=e.visitFixedSizeList;break;case N.Map:n=e.visitMap;break}if(typeof n=="function")return n;if(!r)return()=>null;throw new Error(`Unrecognized type '${N[t]}'`)}function HU(e){switch(e.typeId){case N.Null:return N.Null;case N.Int:{let{bitWidth:t,isSigned:r}=e;switch(t){case 8:return r?N.Int8:N.Uint8;case 16:return r?N.Int16:N.Uint16;case 32:return r?N.Int32:N.Uint32;case 64:return r?N.Int64:N.Uint64}return N.Int}case N.Float:switch(e.precision){case Xe.HALF:return N.Float16;case Xe.SINGLE:return N.Float32;case Xe.DOUBLE:return N.Float64}return N.Float;case N.Binary:return N.Binary;case N.Utf8:return N.Utf8;case N.Bool:return N.Bool;case N.Decimal:return N.Decimal;case N.Time:switch(e.unit){case It.SECOND:return N.TimeSecond;case It.MILLISECOND:return N.TimeMillisecond;case It.MICROSECOND:return N.TimeMicrosecond;case It.NANOSECOND:return N.TimeNanosecond}return N.Time;case N.Timestamp:switch(e.unit){case It.SECOND:return N.TimestampSecond;case It.MILLISECOND:return N.TimestampMillisecond;case It.MICROSECOND:return N.TimestampMicrosecond;case It.NANOSECOND:return N.TimestampNanosecond}return N.Timestamp;case N.Date:switch(e.unit){case un.DAY:return N.DateDay;case un.MILLISECOND:return N.DateMillisecond}return N.Date;case N.Interval:switch(e.unit){case Vn.DAY_TIME:return N.IntervalDayTime;case Vn.YEAR_MONTH:return N.IntervalYearMonth}return N.Interval;case N.Duration:switch(e.unit){case It.SECOND:return N.DurationSecond;case It.MILLISECOND:return N.DurationMillisecond;case It.MICROSECOND:return N.DurationMicrosecond;case It.NANOSECOND:return N.DurationNanosecond}return N.Duration;case N.Map:return N.Map;case N.List:return N.List;case N.Struct:return N.Struct;case N.Union:switch(e.mode){case je.Dense:return N.DenseUnion;case je.Sparse:return N.SparseUnion}return N.Union;case N.FixedSizeBinary:return N.FixedSizeBinary;case N.FixedSizeList:return N.FixedSizeList;case N.Dictionary:return N.Dictionary}throw new Error(`Unrecognized type '${N[e.typeId]}'`)}mt.prototype.visitInt8=null;mt.prototype.visitInt16=null;mt.prototype.visitInt32=null;mt.prototype.visitInt64=null;mt.prototype.visitUint8=null;mt.prototype.visitUint16=null;mt.prototype.visitUint32=null;mt.prototype.visitUint64=null;mt.prototype.visitFloat16=null;mt.prototype.visitFloat32=null;mt.prototype.visitFloat64=null;mt.prototype.visitDateDay=null;mt.prototype.visitDateMillisecond=null;mt.prototype.visitTimestampSecond=null;mt.prototype.visitTimestampMillisecond=null;mt.prototype.visitTimestampMicrosecond=null;mt.prototype.visitTimestampNanosecond=null;mt.prototype.visitTimeSecond=null;mt.prototype.visitTimeMillisecond=null;mt.prototype.visitTimeMicrosecond=null;mt.prototype.visitTimeNanosecond=null;mt.prototype.visitDenseUnion=null;mt.prototype.visitSparseUnion=null;mt.prototype.visitIntervalDayTime=null;mt.prototype.visitIntervalYearMonth=null;mt.prototype.visitDuration=null;mt.prototype.visitDurationSecond=null;mt.prototype.visitDurationMillisecond=null;mt.prototype.visitDurationMicrosecond=null;mt.prototype.visitDurationNanosecond=null;var vE={};Ir(vE,{float64ToUint16:()=>$y,uint16ToFloat64:()=>H1});var ZU=new Float64Array(1),ah=new Uint32Array(ZU.buffer);function H1(e){let t=(e&31744)>>10,r=(e&1023)/1024,n=Math.pow(-1,(e&32768)>>15);switch(t){case 31:return n*(r?Number.NaN:1/0);case 0:return n*(r?6103515625e-14*r:0)}return n*Math.pow(2,t-15)*(1+r)}function $y(e){if(e!==e)return 32256;ZU[0]=e;let t=(ah[1]&2147483648)>>16&65535,r=ah[1]&2146435072,n=0;return r>=1089470464?ah[0]>0?r=31744:(r=(r&2080374784)>>16,n=(ah[1]&1048575)>>10):r<=1056964608?(n=1048576+(ah[1]&1048575),n=1048576+(n<<(r>>20)-998)>>21,r=0):(r=r-1056964608>>10,n=(ah[1]&1048575)+512>>10),t|r|n&65535}var kt=class extends mt{};function qt(e){return(t,r,n)=>{if(t.setValid(r,n!=null))return e(t,r,n)}}var iQ=(e,t,r)=>{e[t]=Math.trunc(r/864e5)},SE=(e,t,r)=>{e[t]=Math.trunc(r%4294967296),e[t+1]=Math.trunc(r/4294967296)},oQ=(e,t,r)=>{e[t]=Math.trunc(r*1e3%4294967296),e[t+1]=Math.trunc(r*1e3/4294967296)},sQ=(e,t,r)=>{e[t]=Math.trunc(r*1e6%4294967296),e[t+1]=Math.trunc(r*1e6/4294967296)},KU=(e,t,r,n)=>{if(r+1<t.length){let{[r]:i,[r+1]:o}=t;e.set(n.subarray(0,o-i),i)}},aQ=({offset:e,values:t},r,n)=>{let i=e+r;n?t[i>>3]|=1<<i%8:t[i>>3]&=~(1<<i%8)},gc=({values:e},t,r)=>{e[t]=r},IE=({values:e},t,r)=>{e[t]=r},QU=({values:e},t,r)=>{e[t]=$y(r)},cQ=(e,t,r)=>{switch(e.type.precision){case Xe.HALF:return QU(e,t,r);case Xe.SINGLE:case Xe.DOUBLE:return IE(e,t,r)}},Z1=({values:e},t,r)=>{iQ(e,t,r.valueOf())},K1=({values:e},t,r)=>{SE(e,t*2,r.valueOf())},TE=({stride:e,values:t},r,n)=>{t.set(n.subarray(0,e),e*r)},lQ=({values:e,valueOffsets:t},r,n)=>KU(e,t,r,n),uQ=({values:e,valueOffsets:t},r,n)=>{KU(e,t,r,Fl(n))},AE=(e,t,r)=>{e.type.unit===un.DAY?Z1(e,t,r):K1(e,t,r)},Q1=({values:e},t,r)=>SE(e,t*2,r/1e3),J1=({values:e},t,r)=>SE(e,t*2,r),tw=({values:e},t,r)=>oQ(e,t*2,r),ew=({values:e},t,r)=>sQ(e,t*2,r),ME=(e,t,r)=>{switch(e.type.unit){case It.SECOND:return Q1(e,t,r);case It.MILLISECOND:return J1(e,t,r);case It.MICROSECOND:return tw(e,t,r);case It.NANOSECOND:return ew(e,t,r)}},rw=({values:e},t,r)=>{e[t]=r},nw=({values:e},t,r)=>{e[t]=r},iw=({values:e},t,r)=>{e[t]=r},ow=({values:e},t,r)=>{e[t]=r},EE=(e,t,r)=>{switch(e.type.unit){case It.SECOND:return rw(e,t,r);case It.MILLISECOND:return nw(e,t,r);case It.MICROSECOND:return iw(e,t,r);case It.NANOSECOND:return ow(e,t,r)}},DE=({values:e,stride:t},r,n)=>{e.set(n.subarray(0,t),t*r)},fQ=(e,t,r)=>{let n=e.children[0],i=e.valueOffsets,o=fn.getVisitFn(n);if(Array.isArray(r))for(let s=-1,a=i[t],c=i[t+1];a<c;)o(n,a++,r[++s]);else for(let s=-1,a=i[t],c=i[t+1];a<c;)o(n,a++,r.get(++s))},dQ=(e,t,r)=>{let n=e.children[0],{valueOffsets:i}=e,o=fn.getVisitFn(n),{[t]:s,[t+1]:a}=i,c=r instanceof Map?r.entries():Object.entries(r);for(let l of c)if(o(n,s,l),++s>=a)break},hQ=(e,t)=>(r,n,i,o)=>n&&r(n,e,t[o]),pQ=(e,t)=>(r,n,i,o)=>n&&r(n,e,t.get(o)),mQ=(e,t)=>(r,n,i,o)=>n&&r(n,e,t.get(i.name)),yQ=(e,t)=>(r,n,i,o)=>n&&r(n,e,t[i.name]),gQ=(e,t,r)=>{let n=e.type.children.map(o=>fn.getVisitFn(o.type)),i=r instanceof Map?mQ(t,r):r instanceof ue?pQ(t,r):Array.isArray(r)?hQ(t,r):yQ(t,r);e.type.children.forEach((o,s)=>i(n[s],e.children[s],o,s))},bQ=(e,t,r)=>{e.type.mode===je.Dense?JU(e,t,r):t5(e,t,r)},JU=(e,t,r)=>{let n=e.type.typeIdToChildIndex[e.typeIds[t]],i=e.children[n];fn.visit(i,e.valueOffsets[t],r)},t5=(e,t,r)=>{let n=e.type.typeIdToChildIndex[e.typeIds[t]],i=e.children[n];fn.visit(i,t,r)},xQ=(e,t,r)=>{var n;(n=e.dictionary)===null||n===void 0||n.set(e.values[t],r)},BE=(e,t,r)=>{e.type.unit===Vn.DAY_TIME?sw(e,t,r):aw(e,t,r)},sw=({values:e},t,r)=>{e.set(r.subarray(0,2),2*t)},aw=({values:e},t,r)=>{e[t]=r[0]*12+r[1]%12},cw=({values:e},t,r)=>{e[t]=r},lw=({values:e},t,r)=>{e[t]=r},uw=({values:e},t,r)=>{e[t]=r},fw=({values:e},t,r)=>{e[t]=r},OE=(e,t,r)=>{switch(e.type.unit){case It.SECOND:return cw(e,t,r);case It.MILLISECOND:return lw(e,t,r);case It.MICROSECOND:return uw(e,t,r);case It.NANOSECOND:return fw(e,t,r)}},_Q=(e,t,r)=>{let{stride:n}=e,i=e.children[0],o=fn.getVisitFn(i);if(Array.isArray(r))for(let s=-1,a=t*n;++s<n;)o(i,a+s,r[s]);else for(let s=-1,a=t*n;++s<n;)o(i,a+s,r.get(s))};kt.prototype.visitBool=qt(aQ);kt.prototype.visitInt=qt(gc);kt.prototype.visitInt8=qt(gc);kt.prototype.visitInt16=qt(gc);kt.prototype.visitInt32=qt(gc);kt.prototype.visitInt64=qt(gc);kt.prototype.visitUint8=qt(gc);kt.prototype.visitUint16=qt(gc);kt.prototype.visitUint32=qt(gc);kt.prototype.visitUint64=qt(gc);kt.prototype.visitFloat=qt(cQ);kt.prototype.visitFloat16=qt(QU);kt.prototype.visitFloat32=qt(IE);kt.prototype.visitFloat64=qt(IE);kt.prototype.visitUtf8=qt(uQ);kt.prototype.visitBinary=qt(lQ);kt.prototype.visitFixedSizeBinary=qt(TE);kt.prototype.visitDate=qt(AE);kt.prototype.visitDateDay=qt(Z1);kt.prototype.visitDateMillisecond=qt(K1);kt.prototype.visitTimestamp=qt(ME);kt.prototype.visitTimestampSecond=qt(Q1);kt.prototype.visitTimestampMillisecond=qt(J1);kt.prototype.visitTimestampMicrosecond=qt(tw);kt.prototype.visitTimestampNanosecond=qt(ew);kt.prototype.visitTime=qt(EE);kt.prototype.visitTimeSecond=qt(rw);kt.prototype.visitTimeMillisecond=qt(nw);kt.prototype.visitTimeMicrosecond=qt(iw);kt.prototype.visitTimeNanosecond=qt(ow);kt.prototype.visitDecimal=qt(DE);kt.prototype.visitList=qt(fQ);kt.prototype.visitStruct=qt(gQ);kt.prototype.visitUnion=qt(bQ);kt.prototype.visitDenseUnion=qt(JU);kt.prototype.visitSparseUnion=qt(t5);kt.prototype.visitDictionary=qt(xQ);kt.prototype.visitInterval=qt(BE);kt.prototype.visitIntervalDayTime=qt(sw);kt.prototype.visitIntervalYearMonth=qt(aw);kt.prototype.visitDuration=qt(OE);kt.prototype.visitDurationSecond=qt(cw);kt.prototype.visitDurationMillisecond=qt(lw);kt.prototype.visitDurationMicrosecond=qt(uw);kt.prototype.visitDurationNanosecond=qt(fw);kt.prototype.visitFixedSizeList=qt(_Q);kt.prototype.visitMap=qt(dQ);var fn=new kt;var ss=Symbol.for("parent"),ch=Symbol.for("rowIndex"),Ll=class{constructor(t,r){return this[ss]=t,this[ch]=r,new Proxy(this,new FE)}toArray(){return Object.values(this.toJSON())}toJSON(){let t=this[ch],r=this[ss],n=r.type.children,i={};for(let o=-1,s=n.length;++o<s;)i[n[o].name]=Dr.visit(r.children[o],t);return i}toString(){return`{${[...this].map(([t,r])=>`${Jo(t)}: ${Jo(r)}`).join(", ")}}`}[Symbol.for("nodejs.util.inspect.custom")](){return this.toString()}[Symbol.iterator](){return new NE(this[ss],this[ch])}},NE=class{constructor(t,r){this.childIndex=0,this.children=t.children,this.rowIndex=r,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,Dr.visit(this.children[t],this.rowIndex)]}):{done:!0,value:null}}};Object.defineProperties(Ll.prototype,{[Symbol.toStringTag]:{enumerable:!1,configurable:!1,value:"Row"},[ss]:{writable:!0,enumerable:!1,configurable:!1,value:null},[ch]:{writable:!0,enumerable:!1,configurable:!1,value:-1}});var FE=class{isExtensible(){return!1}deleteProperty(){return!1}preventExtensions(){return!0}ownKeys(t){return t[ss].type.children.map(r=>r.name)}has(t,r){return t[ss].type.children.findIndex(n=>n.name===r)!==-1}getOwnPropertyDescriptor(t,r){if(t[ss].type.children.findIndex(n=>n.name===r)!==-1)return{writable:!0,enumerable:!0,configurable:!0}}get(t,r){if(Reflect.has(t,r))return t[r];let n=t[ss].type.children.findIndex(i=>i.name===r);if(n!==-1){let i=Dr.visit(t[ss].children[n],t[ch]);return Reflect.set(t,r,i),i}}set(t,r,n){let i=t[ss].type.children.findIndex(o=>o.name===r);return i!==-1?(fn.visit(t[ss].children[i],t[ch],n),Reflect.set(t,r,n)):Reflect.has(t,r)||typeof r=="symbol"?Reflect.set(t,r,n):!1}};var Dt=class extends mt{};function $t(e){return(t,r)=>t.getValid(r)?e(t,r):null}var wQ=(e,t)=>864e5*e[t],LE=(e,t)=>4294967296*e[t+1]+(e[t]>>>0),vQ=(e,t)=>4294967296*(e[t+1]/1e3)+(e[t]>>>0)/1e3,SQ=(e,t)=>4294967296*(e[t+1]/1e6)+(e[t]>>>0)/1e6,e5=e=>new Date(e),IQ=(e,t)=>e5(wQ(e,t)),TQ=(e,t)=>e5(LE(e,t)),AQ=(e,t)=>null,r5=(e,t,r)=>{if(r+1>=t.length)return null;let n=t[r],i=t[r+1];return e.subarray(n,i)},MQ=({offset:e,values:t},r)=>{let n=e+r;return(t[n>>3]&1<<n%8)!==0},n5=({values:e},t)=>IQ(e,t),i5=({values:e},t)=>TQ(e,t*2),Rl=({stride:e,values:t},r)=>t[e*r],EQ=({stride:e,values:t},r)=>H1(t[e*r]),o5=({values:e},t)=>e[t],DQ=({stride:e,values:t},r)=>t.subarray(e*r,e*(r+1)),BQ=({values:e,valueOffsets:t},r)=>r5(e,t,r),OQ=({values:e,valueOffsets:t},r)=>{let n=r5(e,t,r);return n!==null?ky(n):null},NQ=({values:e},t)=>e[t],FQ=({type:e,values:t},r)=>e.precision!==Xe.HALF?t[r]:H1(t[r]),LQ=(e,t)=>e.type.unit===un.DAY?n5(e,t):i5(e,t),s5=({values:e},t)=>1e3*LE(e,t*2),a5=({values:e},t)=>LE(e,t*2),c5=({values:e},t)=>vQ(e,t*2),l5=({values:e},t)=>SQ(e,t*2),RQ=(e,t)=>{switch(e.type.unit){case It.SECOND:return s5(e,t);case It.MILLISECOND:return a5(e,t);case It.MICROSECOND:return c5(e,t);case It.NANOSECOND:return l5(e,t)}},u5=({values:e},t)=>e[t],f5=({values:e},t)=>e[t],d5=({values:e},t)=>e[t],h5=({values:e},t)=>e[t],kQ=(e,t)=>{switch(e.type.unit){case It.SECOND:return u5(e,t);case It.MILLISECOND:return f5(e,t);case It.MICROSECOND:return d5(e,t);case It.NANOSECOND:return h5(e,t)}},CQ=({values:e,stride:t},r)=>Py.decimal(e.subarray(t*r,t*(r+1))),UQ=(e,t)=>{let{valueOffsets:r,stride:n,children:i}=e,{[t*n]:o,[t*n+1]:s}=r,c=i[0].slice(o,s-o);return new ue([c])},PQ=(e,t)=>{let{valueOffsets:r,children:n}=e,{[t]:i,[t+1]:o}=r,s=n[0];return new Us(s.slice(i,o-i))},$Q=(e,t)=>new Ll(e,t),zQ=(e,t)=>e.type.mode===je.Dense?p5(e,t):m5(e,t),p5=(e,t)=>{let r=e.type.typeIdToChildIndex[e.typeIds[t]],n=e.children[r];return Dr.visit(n,e.valueOffsets[t])},m5=(e,t)=>{let r=e.type.typeIdToChildIndex[e.typeIds[t]],n=e.children[r];return Dr.visit(n,t)},VQ=(e,t)=>{var r;return(r=e.dictionary)===null||r===void 0?void 0:r.get(e.values[t])},jQ=(e,t)=>e.type.unit===Vn.DAY_TIME?y5(e,t):g5(e,t),y5=({values:e},t)=>e.subarray(2*t,2*(t+1)),g5=({values:e},t)=>{let r=e[t],n=new Int32Array(2);return n[0]=Math.trunc(r/12),n[1]=Math.trunc(r%12),n},b5=({values:e},t)=>e[t],x5=({values:e},t)=>e[t],_5=({values:e},t)=>e[t],w5=({values:e},t)=>e[t],qQ=(e,t)=>{switch(e.type.unit){case It.SECOND:return b5(e,t);case It.MILLISECOND:return x5(e,t);case It.MICROSECOND:return _5(e,t);case It.NANOSECOND:return w5(e,t)}},YQ=(e,t)=>{let{stride:r,children:n}=e,o=n[0].slice(t*r,r);return new ue([o])};Dt.prototype.visitNull=$t(AQ);Dt.prototype.visitBool=$t(MQ);Dt.prototype.visitInt=$t(NQ);Dt.prototype.visitInt8=$t(Rl);Dt.prototype.visitInt16=$t(Rl);Dt.prototype.visitInt32=$t(Rl);Dt.prototype.visitInt64=$t(o5);Dt.prototype.visitUint8=$t(Rl);Dt.prototype.visitUint16=$t(Rl);Dt.prototype.visitUint32=$t(Rl);Dt.prototype.visitUint64=$t(o5);Dt.prototype.visitFloat=$t(FQ);Dt.prototype.visitFloat16=$t(EQ);Dt.prototype.visitFloat32=$t(Rl);Dt.prototype.visitFloat64=$t(Rl);Dt.prototype.visitUtf8=$t(OQ);Dt.prototype.visitBinary=$t(BQ);Dt.prototype.visitFixedSizeBinary=$t(DQ);Dt.prototype.visitDate=$t(LQ);Dt.prototype.visitDateDay=$t(n5);Dt.prototype.visitDateMillisecond=$t(i5);Dt.prototype.visitTimestamp=$t(RQ);Dt.prototype.visitTimestampSecond=$t(s5);Dt.prototype.visitTimestampMillisecond=$t(a5);Dt.prototype.visitTimestampMicrosecond=$t(c5);Dt.prototype.visitTimestampNanosecond=$t(l5);Dt.prototype.visitTime=$t(kQ);Dt.prototype.visitTimeSecond=$t(u5);Dt.prototype.visitTimeMillisecond=$t(f5);Dt.prototype.visitTimeMicrosecond=$t(d5);Dt.prototype.visitTimeNanosecond=$t(h5);Dt.prototype.visitDecimal=$t(CQ);Dt.prototype.visitList=$t(UQ);Dt.prototype.visitStruct=$t($Q);Dt.prototype.visitUnion=$t(zQ);Dt.prototype.visitDenseUnion=$t(p5);Dt.prototype.visitSparseUnion=$t(m5);Dt.prototype.visitDictionary=$t(VQ);Dt.prototype.visitInterval=$t(jQ);Dt.prototype.visitIntervalDayTime=$t(y5);Dt.prototype.visitIntervalYearMonth=$t(g5);Dt.prototype.visitDuration=$t(qQ);Dt.prototype.visitDurationSecond=$t(b5);Dt.prototype.visitDurationMillisecond=$t(x5);Dt.prototype.visitDurationMicrosecond=$t(_5);Dt.prototype.visitDurationNanosecond=$t(w5);Dt.prototype.visitFixedSizeList=$t(YQ);Dt.prototype.visitMap=$t(PQ);var Dr=new Dt;var ho=Symbol.for("keys"),lh=Symbol.for("vals"),Us=class{constructor(t){return this[ho]=new ue([t.children[0]]).memoize(),this[lh]=t.children[1],new Proxy(this,new kE)}[Symbol.iterator](){return new RE(this[ho],this[lh])}get size(){return this[ho].length}toArray(){return Object.values(this.toJSON())}toJSON(){let t=this[ho],r=this[lh],n={};for(let i=-1,o=t.length;++i<o;)n[t.get(i)]=Dr.visit(r,i);return n}toString(){return`{${[...this].map(([t,r])=>`${Jo(t)}: ${Jo(r)}`).join(", ")}}`}[Symbol.for("nodejs.util.inspect.custom")](){return this.toString()}},RE=class{constructor(t,r){this.keys=t,this.vals=r,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),Dr.visit(this.vals,t)]})}},kE=class{isExtensible(){return!1}deleteProperty(){return!1}preventExtensions(){return!0}ownKeys(t){return t[ho].toArray().map(String)}has(t,r){return t[ho].includes(r)}getOwnPropertyDescriptor(t,r){if(t[ho].indexOf(r)!==-1)return{writable:!0,enumerable:!0,configurable:!0}}get(t,r){if(Reflect.has(t,r))return t[r];let n=t[ho].indexOf(r);if(n!==-1){let i=Dr.visit(Reflect.get(t,lh),n);return Reflect.set(t,r,i),i}}set(t,r,n){let i=t[ho].indexOf(r);return i!==-1?(fn.visit(Reflect.get(t,lh),i,n),Reflect.set(t,r,n)):Reflect.has(t,r)?Reflect.set(t,r,n):!1}};Object.defineProperties(Us.prototype,{[Symbol.toStringTag]:{enumerable:!1,configurable:!1,value:"Row"},[ho]:{writable:!0,enumerable:!1,configurable:!1,value:null},[lh]:{writable:!0,enumerable:!1,configurable:!1,value:null}});function WQ(e,t,r){let n=e.length,i=t>-1?t:n+t%n;return r?r(e,i):i}var v5;function zy(e,t,r,n){let{length:i=0}=e,o=typeof t!="number"?0:t,s=typeof r!="number"?i:r;return o<0&&(o=(o%i+i)%i),s<0&&(s=(s%i+i)%i),s<o&&(v5=o,o=s,s=v5),s>i&&(s=i),n?n(e,o,s):[o,s]}var S5=e=>e!==e;function kl(e){if(typeof e!=="object"||e===null)return S5(e)?S5:r=>r===e;if(e instanceof Date){let r=e.valueOf();return n=>n instanceof Date?n.valueOf()===r:!1}return ArrayBuffer.isView(e)?r=>r?mE(e,r):!1:e instanceof Map?XQ(e):Array.isArray(e)?GQ(e):e instanceof ue?HQ(e):ZQ(e,!0)}function GQ(e){let t=[];for(let r=-1,n=e.length;++r<n;)t[r]=kl(e[r]);return dw(t)}function XQ(e){let t=-1,r=[];for(let n of e.values())r[++t]=kl(n);return dw(r)}function HQ(e){let t=[];for(let r=-1,n=e.length;++r<n;)t[r]=kl(e.get(r));return dw(t)}function ZQ(e,t=!1){let r=Object.keys(e);if(!t&&r.length===0)return()=>!1;let n=[];for(let i=-1,o=r.length;++i<o;)n[i]=kl(e[r[i]]);return dw(n,r)}function dw(e,t){return r=>{if(!r||typeof r!="object")return!1;switch(r.constructor){case Array:return KQ(e,r);case Map:return I5(e,r,r.keys());case Us:case Ll:case Object:case void 0:return I5(e,r,t||Object.keys(r))}return r instanceof ue?QQ(e,r):!1}}function KQ(e,t){let r=e.length;if(t.length!==r)return!1;for(let n=-1;++n<r;)if(!e[n](t[n]))return!1;return!0}function QQ(e,t){let r=e.length;if(t.length!==r)return!1;for(let n=-1;++n<r;)if(!e[n](t.get(n)))return!1;return!0}function I5(e,t,r){let n=r[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=n.next(),u=i.next();for(;s<a&&!l.done&&!u.done&&!c.done&&!(l.value!==u.value||!e[s](c.value));++s,l=n.next(),u=i.next(),c=o.next());return s===a&&l.done&&u.done&&c.done?!0:(n.return&&n.return(),i.return&&i.return(),o.return&&o.return(),!1)}var UE={};Ir(UE,{BitIterator:()=>mf,getBit:()=>T5,getBool:()=>pw,packBools:()=>gf,popcnt_array:()=>A5,popcnt_bit_range:()=>Vy,popcnt_uint32:()=>hw,setBool:()=>JQ,truncateBitmap:()=>yf});function pw(e,t,r,n){return(r&1<<n)!==0}function T5(e,t,r,n){return(r&1<<n)>>n}function JQ(e,t,r){return r?!!(e[t>>3]|=1<<t%8)||!0:!(e[t>>3]&=~(1<<t%8))&&!1}function yf(e,t,r){let n=r.byteLength+7&-8;if(e>0||r.byteLength<n){let i=new Uint8Array(n);return i.set(e%8===0?r.subarray(e>>3):gf(new mf(r,e,t,null,pw)).subarray(0,n)),i}return r}function gf(e){let t=[],r=0,n=0,i=0;for(let s of e)s&&(i|=1<<n),++n===8&&(t[r++]=i,i=n=0);(r===0||n>0)&&(t[r++]=i);let o=new Uint8Array(t.length+7&-8);return o.set(t),o}var mf=class{constructor(t,r,n,i,o){this.bytes=t,this.length=n,this.context=i,this.get=o,this.bit=r%8,this.byteIndex=r>>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 Vy(e,t,r){if(r-t<=0)return 0;if(r-t<8){let o=0;for(let s of new mf(e,t,r-t,e,T5))o+=s;return o}let n=r>>3<<3,i=t+(t%8===0?0:8-t%8);return Vy(e,t,i)+Vy(e,n,r)+A5(e,i>>3,n-i>>3)}function A5(e,t,r){let n=0,i=Math.trunc(t),o=new DataView(e.buffer,e.byteOffset,e.byteLength),s=r===void 0?e.byteLength:i+r;for(;s-i>=4;)n+=hw(o.getUint32(i)),i+=4;for(;s-i>=2;)n+=hw(o.getUint16(i)),i+=2;for(;s-i>=1;)n+=hw(o.getUint8(i)),i+=1;return n}function hw(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 tJ=-1,De=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 ht.isSparseUnion(t)?this.children.some(r=>r.nullable):ht.isDenseUnion(t)?this.children.some(r=>r.nullable):this.nullBitmap&&this.nullBitmap.byteLength>0}return!0}get byteLength(){let t=0,{valueOffsets:r,values:n,nullBitmap:i,typeIds:o}=this;return r&&(t+=r.byteLength),n&&(t+=n.byteLength),i&&(t+=i.byteLength),o&&(t+=o.byteLength),this.children.reduce((s,a)=>s+a.byteLength,t)}get nullCount(){if(ht.isUnion(this.type))return this.children.reduce((n,i)=>n+i.nullCount,0);let t=this._nullCount,r;return t<=tJ&&(r=this.nullBitmap)&&(this._nullCount=t=this.length-Vy(r,this.offset,this.offset+this.length)),t}constructor(t,r,n,i,o,s=[],a){this.type=t,this.children=s,this.dictionary=a,this.offset=Math.floor(Math.max(r||0,0)),this.length=Math.floor(Math.max(n||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=Ui(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:r}=this;if(ht.isUnion(r)){let n=r,i=this.children[n.typeIdToChildIndex[this.typeIds[t]]],o=n.mode===je.Dense?this.valueOffsets[t]:t;return i.getValid(o)}if(this.nullable&&this.nullCount>0){let n=this.offset+t;return(this.nullBitmap[n>>3]&1<<n%8)!==0}return!0}setValid(t,r){let n,{type:i}=this;if(ht.isUnion(i)){let o=i,s=this.children[o.typeIdToChildIndex[this.typeIds[t]]],a=o.mode===je.Dense?this.valueOffsets[t]:t;n=s.getValid(a),s.setValid(a,r)}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(yf(s,a,this.nullBitmap),0),Object.assign(this,{nullBitmap:o,_nullCount:-1}));let f=o[u];n=(f&l)!==0,r?o[u]=f|l:o[u]=f&~l}return n!==!!r&&(this._nullCount=this.nullCount+(r?-1:1)),r}clone(t=this.type,r=this.offset,n=this.length,i=this._nullCount,o=this,s=this.children){return new e(t,r,n,i,o,s,this.dictionary)}slice(t,r){let{stride:n,typeId:i,children:o}=this,s=+(this._nullCount===0)-1,a=i===16?n:1,c=this._sliceBuffers(t,r,n,i);return this.clone(this.type,this.offset+t,r,s,c,o.length===0||this.valueOffsets?o:this._sliceChildren(o,a*t,a*r))}_changeLengthAndBackfillNullBitmap(t){if(this.typeId===N.Null)return this.clone(this.type,0,t,0);let{length:r,nullCount:n}=this,i=new Uint8Array((t+63&-64)>>3).fill(255,0,r>>3);i[r>>3]=(1<<r-(r&-8))-1,n>0&&i.set(yf(this.offset,r,this.nullBitmap),0);let o=this.buffers;return o[fo.VALIDITY]=i,this.clone(this.type,0,t,n+(t-r),o)}_sliceBuffers(t,r,n,i){let o,{buffers:s}=this;return(o=s[fo.TYPE])&&(s[fo.TYPE]=o.subarray(t,t+r)),(o=s[fo.OFFSET])&&(s[fo.OFFSET]=o.subarray(t,t+r+1))||(o=s[fo.DATA])&&(s[fo.DATA]=i===6?o:o.subarray(n*t,n*(t+r))),s}_sliceChildren(t,r,n){return t.map(i=>i.slice(r,n))}};De.prototype.children=Object.freeze([]);var PE=class e extends mt{visit(t){return this.getVisitFn(t.type).call(this,t)}visitNull(t){let{["type"]:r,["offset"]:n=0,["length"]:i=0}=t;return new De(r,n,i,i)}visitBool(t){let{["type"]:r,["offset"]:n=0}=t,i=Xt(t.nullBitmap),o=ee(r.ArrayType,t.data),{["length"]:s=o.length>>3,["nullCount"]:a=t.nullBitmap?-1:0}=t;return new De(r,n,s,a,[void 0,o,i])}visitInt(t){let{["type"]:r,["offset"]:n=0}=t,i=Xt(t.nullBitmap),o=ee(r.ArrayType,t.data),{["length"]:s=o.length,["nullCount"]:a=t.nullBitmap?-1:0}=t;return new De(r,n,s,a,[void 0,o,i])}visitFloat(t){let{["type"]:r,["offset"]:n=0}=t,i=Xt(t.nullBitmap),o=ee(r.ArrayType,t.data),{["length"]:s=o.length,["nullCount"]:a=t.nullBitmap?-1:0}=t;return new De(r,n,s,a,[void 0,o,i])}visitUtf8(t){let{["type"]:r,["offset"]:n=0}=t,i=Xt(t.data),o=Xt(t.nullBitmap),s=pf(t.valueOffsets),{["length"]:a=s.length-1,["nullCount"]:c=t.nullBitmap?-1:0}=t;return new De(r,n,a,c,[s,i,o])}visitBinary(t){let{["type"]:r,["offset"]:n=0}=t,i=Xt(t.data),o=Xt(t.nullBitmap),s=pf(t.valueOffsets),{["length"]:a=s.length-1,["nullCount"]:c=t.nullBitmap?-1:0}=t;return new De(r,n,a,c,[s,i,o])}visitFixedSizeBinary(t){let{["type"]:r,["offset"]:n=0}=t,i=Xt(t.nullBitmap),o=ee(r.ArrayType,t.data),{["length"]:s=o.length/Ui(r),["nullCount"]:a=t.nullBitmap?-1:0}=t;return new De(r,n,s,a,[void 0,o,i])}visitDate(t){let{["type"]:r,["offset"]:n=0}=t,i=Xt(t.nullBitmap),o=ee(r.ArrayType,t.data),{["length"]:s=o.length/Ui(r),["nullCount"]:a=t.nullBitmap?-1:0}=t;return new De(r,n,s,a,[void 0,o,i])}visitTimestamp(t){let{["type"]:r,["offset"]:n=0}=t,i=Xt(t.nullBitmap),o=ee(r.ArrayType,t.data),{["length"]:s=o.length/Ui(r),["nullCount"]:a=t.nullBitmap?-1:0}=t;return new De(r,n,s,a,[void 0,o,i])}visitTime(t){let{["type"]:r,["offset"]:n=0}=t,i=Xt(t.nullBitmap),o=ee(r.ArrayType,t.data),{["length"]:s=o.length/Ui(r),["nullCount"]:a=t.nullBitmap?-1:0}=t;return new De(r,n,s,a,[void 0,o,i])}visitDecimal(t){let{["type"]:r,["offset"]:n=0}=t,i=Xt(t.nullBitmap),o=ee(r.ArrayType,t.data),{["length"]:s=o.length/Ui(r),["nullCount"]:a=t.nullBitmap?-1:0}=t;return new De(r,n,s,a,[void 0,o,i])}visitList(t){let{["type"]:r,["offset"]:n=0,["child"]:i}=t,o=Xt(t.nullBitmap),s=pf(t.valueOffsets),{["length"]:a=s.length-1,["nullCount"]:c=t.nullBitmap?-1:0}=t;return new De(r,n,a,c,[s,void 0,o],[i])}visitStruct(t){let{["type"]:r,["offset"]:n=0,["children"]:i=[]}=t,o=Xt(t.nullBitmap),{length:s=i.reduce((c,{length:l})=>Math.max(c,l),0),nullCount:a=t.nullBitmap?-1:0}=t;return new De(r,n,s,a,[void 0,void 0,o],i)}visitUnion(t){let{["type"]:r,["offset"]:n=0,["children"]:i=[]}=t,o=ee(r.ArrayType,t.typeIds),{["length"]:s=o.length,["nullCount"]:a=-1}=t;if(ht.isSparseUnion(r))return new De(r,n,s,a,[void 0,void 0,void 0,o],i);let c=pf(t.valueOffsets);return new De(r,n,s,a,[c,void 0,void 0,o],i)}visitDictionary(t){let{["type"]:r,["offset"]:n=0}=t,i=Xt(t.nullBitmap),o=ee(r.indices.ArrayType,t.data),{["dictionary"]:s=new ue([new e().visit({type:r.dictionary})])}=t,{["length"]:a=o.length,["nullCount"]:c=t.nullBitmap?-1:0}=t;return new De(r,n,a,c,[void 0,o,i],[],s)}visitInterval(t){let{["type"]:r,["offset"]:n=0}=t,i=Xt(t.nullBitmap),o=ee(r.ArrayType,t.data),{["length"]:s=o.length/Ui(r),["nullCount"]:a=t.nullBitmap?-1:0}=t;return new De(r,n,s,a,[void 0,o,i])}visitDuration(t){let{["type"]:r,["offset"]:n=0}=t,i=Xt(t.nullBitmap),o=ee(r.ArrayType,t.data),{["length"]:s=o.length,["nullCount"]:a=t.nullBitmap?-1:0}=t;return new De(r,n,s,a,[void 0,o,i])}visitFixedSizeList(t){let{["type"]:r,["offset"]:n=0,["child"]:i=new e().visit({type:r.valueType})}=t,o=Xt(t.nullBitmap),{["length"]:s=i.length/Ui(r),["nullCount"]:a=t.nullBitmap?-1:0}=t;return new De(r,n,s,a,[void 0,void 0,o],[i])}visitMap(t){let{["type"]:r,["offset"]:n=0,["child"]:i=new e().visit({type:r.childType})}=t,o=Xt(t.nullBitmap),s=pf(t.valueOffsets),{["length"]:a=s.length-1,["nullCount"]:c=t.nullBitmap?-1:0}=t;return new De(r,n,a,c,[s,void 0,o],[i])}},eJ=new PE;function Ht(e){return eJ.visit(e)}var jy=class{constructor(t=0,r){this.numChunks=t,this.getChunkIterator=r,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 mw(e){return e.reduce((t,r)=>t+r.nullCount,0)}function yw(e){return e.reduce((t,r,n)=>(t[n+1]=t[n]+r.length,t),new Uint32Array(e.length+1))}function gw(e,t,r,n){let i=[];for(let o=-1,s=e.length;++o<s;){let a=e[o],c=t[o],{length:l}=a;if(c>=n)break;if(r>=c+l)continue;if(c>=r&&c+l<=n){i.push(a);continue}let u=Math.max(0,r-c),f=Math.min(n-c,l);i.push(a.slice(u,f-u))}return i.length===0&&i.push(e[0].slice(0,0)),i}function $E(e,t,r,n){let i=0,o=0,s=t.length-1;do{if(i>=s-1)return r<t[s]?n(e,i,r-t[i]):null;o=i+Math.trunc((s-i)*.5),r<t[o]?s=o:i=o}while(i<s)}function qy(e,t){return e.getValid(t)}function Cl(e){function t(r,n,i){return e(r[n],i)}return function(r){let n=this.data;return $E(n,this._offsets,r,t)}}function bw(e){let t;function r(n,i,o){return e(n[i],o,t)}return function(n,i){let o=this.data;t=i;let s=$E(o,this._offsets,n,r);return t=void 0,s}}function xw(e){let t;function r(n,i,o){let s=o,a=0,c=0;for(let l=i-1,u=n.length;++l<u;){let f=n[l];if(~(a=e(f,t,s)))return c+a;s=0,c+=f.length}return-1}return function(n,i){t=n;let o=this.data,s=typeof i!="number"?r(o,0,0):$E(o,this._offsets,i,r);return t=void 0,s}}var Bt=class extends mt{};function rJ(e,t){return t===null&&e.length>0?0:-1}function nJ(e,t){let{nullBitmap:r}=e;if(!r||e.nullCount<=0)return-1;let n=0;for(let i of new mf(r,e.offset+(t||0),e.length,r,pw)){if(!i)return n;++n}return-1}function Zt(e,t,r){if(t===void 0)return-1;if(t===null)switch(e.typeId){case N.Union:break;case N.Dictionary:break;default:return nJ(e,r)}let n=Dr.getVisitFn(e),i=kl(t);for(let o=(r||0)-1,s=e.length;++o<s;)if(i(n(e,o)))return o;return-1}function M5(e,t,r){let n=Dr.getVisitFn(e),i=kl(t);for(let o=(r||0)-1,s=e.length;++o<s;)if(i(n(e,o)))return o;return-1}Bt.prototype.visitNull=rJ;Bt.prototype.visitBool=Zt;Bt.prototype.visitInt=Zt;Bt.prototype.visitInt8=Zt;Bt.prototype.visitInt16=Zt;Bt.prototype.visitInt32=Zt;Bt.prototype.visitInt64=Zt;Bt.prototype.visitUint8=Zt;Bt.prototype.visitUint16=Zt;Bt.prototype.visitUint32=Zt;Bt.prototype.visitUint64=Zt;Bt.prototype.visitFloat=Zt;Bt.prototype.visitFloat16=Zt;Bt.prototype.visitFloat32=Zt;Bt.prototype.visitFloat64=Zt;Bt.prototype.visitUtf8=Zt;Bt.prototype.visitBinary=Zt;Bt.prototype.visitFixedSizeBinary=Zt;Bt.prototype.visitDate=Zt;Bt.prototype.visitDateDay=Zt;Bt.prototype.visitDateMillisecond=Zt;Bt.prototype.visitTimestamp=Zt;Bt.prototype.visitTimestampSecond=Zt;Bt.prototype.visitTimestampMillisecond=Zt;Bt.prototype.visitTimestampMicrosecond=Zt;Bt.prototype.visitTimestampNanosecond=Zt;Bt.prototype.visitTime=Zt;Bt.prototype.visitTimeSecond=Zt;Bt.prototype.visitTimeMillisecond=Zt;Bt.prototype.visitTimeMicrosecond=Zt;Bt.prototype.visitTimeNanosecond=Zt;Bt.prototype.visitDecimal=Zt;Bt.prototype.visitList=Zt;Bt.prototype.visitStruct=Zt;Bt.prototype.visitUnion=Zt;Bt.prototype.visitDenseUnion=M5;Bt.prototype.visitSparseUnion=M5;Bt.prototype.visitDictionary=Zt;Bt.prototype.visitInterval=Zt;Bt.prototype.visitIntervalDayTime=Zt;Bt.prototype.visitIntervalYearMonth=Zt;Bt.prototype.visitDuration=Zt;Bt.prototype.visitDurationSecond=Zt;Bt.prototype.visitDurationMillisecond=Zt;Bt.prototype.visitDurationMicrosecond=Zt;Bt.prototype.visitDurationNanosecond=Zt;Bt.prototype.visitFixedSizeList=Zt;Bt.prototype.visitMap=Zt;var bf=new Bt;var Ot=class extends mt{};function zt(e){let{type:t}=e;if(e.nullCount===0&&e.stride===1&&(t.typeId===N.Timestamp||t instanceof xr&&t.bitWidth!==64||t instanceof es&&t.bitWidth!==64||t instanceof bi&&t.precision!==Xe.HALF))return new jy(e.data.length,n=>{let i=e.data[n];return i.values.subarray(0,i.length)[Symbol.iterator]()});let r=0;return new jy(e.data.length,n=>{let o=e.data[n].length,s=e.slice(r,r+o);return r+=o,new zE(s)})}var zE=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}};Ot.prototype.visitNull=zt;Ot.prototype.visitBool=zt;Ot.prototype.visitInt=zt;Ot.prototype.visitInt8=zt;Ot.prototype.visitInt16=zt;Ot.prototype.visitInt32=zt;Ot.prototype.visitInt64=zt;Ot.prototype.visitUint8=zt;Ot.prototype.visitUint16=zt;Ot.prototype.visitUint32=zt;Ot.prototype.visitUint64=zt;Ot.prototype.visitFloat=zt;Ot.prototype.visitFloat16=zt;Ot.prototype.visitFloat32=zt;Ot.prototype.visitFloat64=zt;Ot.prototype.visitUtf8=zt;Ot.prototype.visitBinary=zt;Ot.prototype.visitFixedSizeBinary=zt;Ot.prototype.visitDate=zt;Ot.prototype.visitDateDay=zt;Ot.prototype.visitDateMillisecond=zt;Ot.prototype.visitTimestamp=zt;Ot.prototype.visitTimestampSecond=zt;Ot.prototype.visitTimestampMillisecond=zt;Ot.prototype.visitTimestampMicrosecond=zt;Ot.prototype.visitTimestampNanosecond=zt;Ot.prototype.visitTime=zt;Ot.prototype.visitTimeSecond=zt;Ot.prototype.visitTimeMillisecond=zt;Ot.prototype.visitTimeMicrosecond=zt;Ot.prototype.visitTimeNanosecond=zt;Ot.prototype.visitDecimal=zt;Ot.prototype.visitList=zt;Ot.prototype.visitStruct=zt;Ot.prototype.visitUnion=zt;Ot.prototype.visitDenseUnion=zt;Ot.prototype.visitSparseUnion=zt;Ot.prototype.visitDictionary=zt;Ot.prototype.visitInterval=zt;Ot.prototype.visitIntervalDayTime=zt;Ot.prototype.visitIntervalYearMonth=zt;Ot.prototype.visitDuration=zt;Ot.prototype.visitDurationSecond=zt;Ot.prototype.visitDurationMillisecond=zt;Ot.prototype.visitDurationMicrosecond=zt;Ot.prototype.visitDurationNanosecond=zt;Ot.prototype.visitFixedSizeList=zt;Ot.prototype.visitMap=zt;var uh=new Ot;var iJ=(e,t)=>e+t,Ps=class extends mt{visitNull(t,r){return 0}visitInt(t,r){return t.type.bitWidth/8}visitFloat(t,r){return t.type.ArrayType.BYTES_PER_ELEMENT}visitBool(t,r){return 1/8}visitDecimal(t,r){return t.type.bitWidth/8}visitDate(t,r){return(t.type.unit+1)*4}visitTime(t,r){return t.type.bitWidth/8}visitTimestamp(t,r){return t.type.unit===It.SECOND?4:8}visitInterval(t,r){return(t.type.unit+1)*4}visitDuration(t,r){return 8}visitStruct(t,r){return t.children.reduce((n,i)=>n+Pi.visit(i,r),0)}visitFixedSizeBinary(t,r){return t.type.byteWidth}visitMap(t,r){return 8+t.children.reduce((n,i)=>n+Pi.visit(i,r),0)}visitDictionary(t,r){var n;return t.type.indices.bitWidth/8+(((n=t.dictionary)===null||n===void 0?void 0:n.getByteLength(t.values[r]))||0)}},oJ=({valueOffsets:e},t)=>8+(e[t+1]-e[t]),sJ=({valueOffsets:e},t)=>8+(e[t+1]-e[t]),aJ=({valueOffsets:e,stride:t,children:r},n)=>{let i=r[0],{[n*t]:o}=e,{[n*t+1]:s}=e,a=Pi.getVisitFn(i.type),c=i.slice(o,s-o),l=8;for(let u=-1,f=s-o;++u<f;)l+=a(c,u);return l},cJ=({stride:e,children:t},r)=>{let n=t[0],i=n.slice(r*e,e),o=Pi.getVisitFn(n.type),s=0;for(let a=-1,c=i.length;++a<c;)s+=o(i,a);return s},lJ=(e,t)=>e.type.mode===je.Dense?E5(e,t):D5(e,t),E5=({type:e,children:t,typeIds:r,valueOffsets:n},i)=>{let o=e.typeIdToChildIndex[r[i]];return 8+Pi.visit(t[o],n[i])},D5=({children:e},t)=>4+Pi.visitMany(e,e.map(()=>t)).reduce(iJ,0);Ps.prototype.visitUtf8=oJ;Ps.prototype.visitBinary=sJ;Ps.prototype.visitList=aJ;Ps.prototype.visitFixedSizeList=cJ;Ps.prototype.visitUnion=lJ;Ps.prototype.visitDenseUnion=E5;Ps.prototype.visitSparseUnion=D5;var Pi=new Ps;var B5,O5={},N5={},ue=class e{constructor(t){var r,n,i;let o=t[0]instanceof e?t.flatMap(a=>a.data):t;if(o.length===0||o.some(a=>!(a instanceof De)))throw new TypeError("Vector constructor expects an Array of Data instances.");let s=(r=o[0])===null||r===void 0?void 0:r.type;switch(o.length){case 0:this._offsets=[0];break;case 1:{let{get:a,set:c,indexOf:l,byteLength:u}=O5[s.typeId],f=o[0];this.isValid=d=>qy(f,d),this.get=d=>a(f,d),this.set=(d,h)=>c(f,d,h),this.indexOf=d=>l(f,d),this.getByteLength=d=>u(f,d),this._offsets=[0,f.length];break}default:Object.setPrototypeOf(this,N5[s.typeId]),this._offsets=yw(o);break}this.data=o,this.type=s,this.stride=Ui(s),this.numChildren=(i=(n=s.children)===null||n===void 0?void 0:n.length)!==null&&i!==void 0?i:0,this.length=this._offsets.at(-1)}get byteLength(){return this.data.reduce((t,r)=>t+r.byteLength,0)}get nullCount(){return mw(this.data)}get ArrayType(){return this.type.ArrayType}get[Symbol.toStringTag](){return`${this.VectorName}<${this.type[Symbol.toStringTag]}>`}get VectorName(){return`${N[this.type.typeId]}Vector`}isValid(t){return!1}get(t){return null}set(t,r){}indexOf(t,r){return-1}includes(t,r){return this.indexOf(t,r)>-1}getByteLength(t){return 0}[Symbol.iterator](){return uh.visit(this)}concat(...t){return new e(this.data.concat(t.flatMap(r=>r.data).flat(Number.POSITIVE_INFINITY)))}slice(t,r){return new e(zy(this,t,r,({data:n,_offsets:i},o,s)=>gw(n,i,o,s)))}toJSON(){return[...this]}toArray(){let{type:t,data:r,length:n,stride:i,ArrayType:o}=this;switch(t.typeId){case N.Int:case N.Float:case N.Decimal:case N.Time:case N.Timestamp:switch(r.length){case 0:return new o;case 1:return r[0].values.subarray(0,n*i);default:return r.reduce((s,{values:a,length:c})=>(s.array.set(a.subarray(0,c*i),s.offset),s.offset+=c*i,s),{array:new o(n*i),offset:0}).array}}return[...this]}toString(){return`[${[...this].join(",")}]`}getChild(t){var r;return this.getChildAt((r=this.type.children)===null||r===void 0?void 0:r.findIndex(n=>n.name===t))}getChildAt(t){return t>-1&&t<this.numChildren?new e(this.data.map(({children:r})=>r[t])):null}get isMemoized(){return ht.isDictionary(this.type)?this.data[0].dictionary.isMemoized:!1}memoize(){if(ht.isDictionary(this.type)){let t=new _w(this.data[0].dictionary),r=this.data.map(n=>{let i=n.clone();return i.dictionary=t,i});return new e(r)}return new _w(this)}unmemoize(){if(ht.isDictionary(this.type)&&this.isMemoized){let t=this.data[0].dictionary.unmemoize(),r=this.data.map(n=>{let i=n.clone();return i.dictionary=t,i});return new e(r)}return this}};B5=Symbol.toStringTag;ue[B5]=(e=>{e.type=ht.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(N).map(r=>N[r]).filter(r=>typeof r=="number"&&r!==N.NONE);for(let r of t){let n=Dr.getVisitFnByTypeId(r),i=fn.getVisitFnByTypeId(r),o=bf.getVisitFnByTypeId(r),s=Pi.getVisitFnByTypeId(r);O5[r]={get:n,set:i,indexOf:o,byteLength:s},N5[r]=Object.create(e,{isValid:{value:Cl(qy)},get:{value:Cl(Dr.getVisitFnByTypeId(r))},set:{value:bw(fn.getVisitFnByTypeId(r))},indexOf:{value:xw(bf.getVisitFnByTypeId(r))},getByteLength:{value:Cl(Pi.getVisitFnByTypeId(r))}})}return"Vector"})(ue.prototype);var _w=class e extends ue{constructor(t){super(t.data);let r=this.get,n=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=r.call(this,s);return o[s]=c,c}}),Object.defineProperty(this,"set",{value(s,a){n.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 ue(this.data)}),Object.defineProperty(this,"memoize",{value:()=>this})}};function F5(e){if(!e||e.length<=0)return function(i){return!0};let t="",r=e.filter(n=>n===n);return r.length>0&&(t=`
12
+ switch (x) {${r.map(n=>`
13
+ case ${uJ(n)}:`).join("")}
14
+ return false;
15
+ }`),e.length!==r.length&&(t=`if (x !== x) return false;
16
+ ${t}`),new Function("x",`${t}
17
+ return true;`)}function uJ(e){return typeof e!="bigint"?Jo(e):`${Jo(e)}n`}var VE=(e,t)=>(Math.ceil(e)*t+63&-64||64)/t,fJ=(e,t=0)=>e.length>=t?e.subarray(0,t):rh(new e.constructor(t),e,0),Ul=class{constructor(t,r=1){this.buffer=t,this.stride=r,this.BYTES_PER_ELEMENT=t.BYTES_PER_ELEMENT,this.ArrayType=t.constructor,this._resize(this.length=Math.ceil(t.length/r))}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,r){return this}append(t){return this.set(this.length,t)}reserve(t){if(t>0){this.length+=t;let r=this.stride,n=this.length*r,i=this.buffer.length;n>=i&&this._resize(i===0?VE(n*1,this.BYTES_PER_ELEMENT):VE(n*2,this.BYTES_PER_ELEMENT))}return this}flush(t=this.length){t=VE(t*this.stride,this.BYTES_PER_ELEMENT);let r=fJ(this.buffer,t);return this.clear(),r}clear(){return this.length=0,this._resize(0),this}_resize(t){return this.buffer=rh(new this.ArrayType(t),this.buffer)}};Ul.prototype.offset=0;var bc=class extends Ul{last(){return this.get(this.length-1)}get(t){return this.buffer[t]}set(t,r){return this.reserve(t-this.length+1),this.buffer[t*this.stride]=r,this}},fh=class extends bc{constructor(t=new Uint8Array(0)){super(t,1/8),this.numValid=0}get numInvalid(){return this.length-this.numValid}get(t){return this.buffer[t>>3]>>t%8&1}set(t,r){let{buffer:n}=this.reserve(t-this.length+1),i=t>>3,o=t%8,s=n[i]>>o&1;return r?s===0&&(n[i]|=1<<o,++this.numValid):s===1&&(n[i]&=~(1<<o),--this.numValid),this}clear(){return this.numValid=0,super.clear()}},dh=class extends bc{constructor(t=new Int32Array(1)){super(t,1)}append(t){return this.set(this.length-1,t)}set(t,r){let n=this.length-1,i=this.reserve(t-n+1).buffer;return n<t++&&i.fill(i[n],n,t),i[t]=i[t-1]+r,this}flush(t=this.length-1){return t>this.length&&this.set(t-1,0),super.flush(t+1)}};var He=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:r}){this.length=0,this.finished=!1,this.type=t,this.children=[],this.nullValues=r,this.stride=Ui(t),this._nulls=new fh,r&&r.length>0&&(this._isValid=F5(r))}toVector(){return new ue([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:r,_values:n,_nulls:i,_typeIds:o,children:s}=this;return r&&(t+=r.byteLength),n&&(t+=n.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((r,n)=>r+n.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,r){return this.setValid(t,this.isValid(r))&&this.setValue(t,r),this}setValue(t,r){this._setValue(this,t,r)}setValid(t,r){return this.length=this._nulls.set(t,+r).length,r}addChild(t,r=`${this.numChildren}`){throw new Error(`Cannot append children to non-nested type "${this.type}"`)}getChildAt(t){return this.children[t]||null}flush(){let t,r,n,i,{type:o,length:s,nullCount:a,_typeIds:c,_offsets:l,_values:u,_nulls:f}=this;(r=c?.flush(s))?i=l?.flush(s):(i=l?.flush(s))?t=u?.flush(l.last()):t=u?.flush(s),a>0&&(n=f?.flush(s));let d=this.children.map(h=>h.flush());return this.clear(),Ht({type:o,length:s,nullCount:a,children:d,child:d[0],data:t,typeIds:r,nullBitmap:n,valueOffsets:i})}finish(){this.finished=!0;for(let t of this.children)t.finish();return this}clear(){var t,r,n,i;this.length=0,(t=this._nulls)===null||t===void 0||t.clear(),(r=this._values)===null||r===void 0||r.clear(),(n=this._offsets)===null||n===void 0||n.clear(),(i=this._typeIds)===null||i===void 0||i.clear();for(let o of this.children)o.clear();return this}};He.prototype.length=1;He.prototype.stride=1;He.prototype.children=null;He.prototype.finished=!1;He.prototype.nullValues=null;He.prototype._isValid=()=>!0;var Br=class extends He{constructor(t){super(t),this._values=new bc(new this.ArrayType(0),this.stride)}setValue(t,r){let n=this._values;return n.reserve(t-n.length+1),super.setValue(t,r)}},$s=class extends He{constructor(t){super(t),this._pendingLength=0,this._offsets=new dh}setValue(t,r){let n=this._pending||(this._pending=new Map),i=n.get(t);i&&(this._pendingLength-=i.length),this._pendingLength+=r instanceof Us?r[ho].length:r.length,n.set(t,r)}setValid(t,r){return super.setValid(t,r)?!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,r=this._pendingLength;return this._pendingLength=0,this._pending=void 0,t&&t.size>0&&this._flushPending(t,r),this}};var xf=class{constructor(){this.bb=null,this.bb_pos=0}__init(t,r){return this.bb_pos=t,this.bb=r,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,r,n,i){return t.prep(8,24),t.writeInt64(BigInt(i??0)),t.pad(4),t.writeInt32(n),t.writeInt64(BigInt(r??0)),t.offset()}};var jr=class e{constructor(){this.bb=null,this.bb_pos=0}__init(t,r){return this.bb_pos=t,this.bb=r,this}static getRootAsKeyValue(t,r){return(r||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsKeyValue(t,r){return t.setPosition(t.position()+4),(r||new e).__init(t.readInt32(t.position())+t.position(),t)}key(t){let r=this.bb.__offset(this.bb_pos,4);return r?this.bb.__string(this.bb_pos+r,t):null}value(t){let r=this.bb.__offset(this.bb_pos,6);return r?this.bb.__string(this.bb_pos+r,t):null}static startKeyValue(t){t.startObject(2)}static addKey(t,r){t.addFieldOffset(0,r,0)}static addValue(t,r){t.addFieldOffset(1,r,0)}static endKeyValue(t){return t.endObject()}static createKeyValue(t,r,n){return e.startKeyValue(t),e.addKey(t,r),e.addValue(t,n),e.endKeyValue(t)}};var Pl;(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"})(Pl||(Pl={}));var $l;(function(e){e[e.Little=0]="Little",e[e.Big=1]="Big"})($l||($l={}));var Yy;(function(e){e[e.DenseArray=0]="DenseArray"})(Yy||(Yy={}));var as=class e{constructor(){this.bb=null,this.bb_pos=0}__init(t,r){return this.bb_pos=t,this.bb=r,this}static getRootAsInt(t,r){return(r||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsInt(t,r){return t.setPosition(t.position()+4),(r||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,r){t.addFieldInt32(0,r,0)}static addIsSigned(t,r){t.addFieldInt8(1,+r,0)}static endInt(t){return t.endObject()}static createInt(t,r,n){return e.startInt(t),e.addBitWidth(t,r),e.addIsSigned(t,n),e.endInt(t)}};var zs=class e{constructor(){this.bb=null,this.bb_pos=0}__init(t,r){return this.bb_pos=t,this.bb=r,this}static getRootAsDictionaryEncoding(t,r){return(r||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsDictionaryEncoding(t,r){return t.setPosition(t.position()+4),(r||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 r=this.bb.__offset(this.bb_pos,6);return r?(t||new as).__init(this.bb.__indirect(this.bb_pos+r),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):Yy.DenseArray}static startDictionaryEncoding(t){t.startObject(4)}static addId(t,r){t.addFieldInt64(0,r,BigInt("0"))}static addIndexType(t,r){t.addFieldOffset(1,r,0)}static addIsOrdered(t,r){t.addFieldInt8(2,+r,0)}static addDictionaryKind(t,r){t.addFieldInt16(3,r,Yy.DenseArray)}static endDictionaryEncoding(t){return t.endObject()}};var Wy=class e{constructor(){this.bb=null,this.bb_pos=0}__init(t,r){return this.bb_pos=t,this.bb=r,this}static getRootAsBinary(t,r){return(r||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsBinary(t,r){return t.setPosition(t.position()+4),(r||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 Gy=class e{constructor(){this.bb=null,this.bb_pos=0}__init(t,r){return this.bb_pos=t,this.bb=r,this}static getRootAsBool(t,r){return(r||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsBool(t,r){return t.setPosition(t.position()+4),(r||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 Xy;(function(e){e[e.DAY=0]="DAY",e[e.MILLISECOND=1]="MILLISECOND"})(Xy||(Xy={}));var zl=class e{constructor(){this.bb=null,this.bb_pos=0}__init(t,r){return this.bb_pos=t,this.bb=r,this}static getRootAsDate(t,r){return(r||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsDate(t,r){return t.setPosition(t.position()+4),(r||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):Xy.MILLISECOND}static startDate(t){t.startObject(1)}static addUnit(t,r){t.addFieldInt16(0,r,Xy.MILLISECOND)}static endDate(t){return t.endObject()}static createDate(t,r){return e.startDate(t),e.addUnit(t,r),e.endDate(t)}};var Vs=class e{constructor(){this.bb=null,this.bb_pos=0}__init(t,r){return this.bb_pos=t,this.bb=r,this}static getRootAsDecimal(t,r){return(r||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsDecimal(t,r){return t.setPosition(t.position()+4),(r||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,r){t.addFieldInt32(0,r,0)}static addScale(t,r){t.addFieldInt32(1,r,0)}static addBitWidth(t,r){t.addFieldInt32(2,r,128)}static endDecimal(t){return t.endObject()}static createDecimal(t,r,n,i){return e.startDecimal(t),e.addPrecision(t,r),e.addScale(t,n),e.addBitWidth(t,i),e.endDecimal(t)}};var cs;(function(e){e[e.SECOND=0]="SECOND",e[e.MILLISECOND=1]="MILLISECOND",e[e.MICROSECOND=2]="MICROSECOND",e[e.NANOSECOND=3]="NANOSECOND"})(cs||(cs={}));var Vl=class e{constructor(){this.bb=null,this.bb_pos=0}__init(t,r){return this.bb_pos=t,this.bb=r,this}static getRootAsDuration(t,r){return(r||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsDuration(t,r){return t.setPosition(t.position()+4),(r||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):cs.MILLISECOND}static startDuration(t){t.startObject(1)}static addUnit(t,r){t.addFieldInt16(0,r,cs.MILLISECOND)}static endDuration(t){return t.endObject()}static createDuration(t,r){return e.startDuration(t),e.addUnit(t,r),e.endDuration(t)}};var jl=class e{constructor(){this.bb=null,this.bb_pos=0}__init(t,r){return this.bb_pos=t,this.bb=r,this}static getRootAsFixedSizeBinary(t,r){return(r||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsFixedSizeBinary(t,r){return t.setPosition(t.position()+4),(r||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,r){t.addFieldInt32(0,r,0)}static endFixedSizeBinary(t){return t.endObject()}static createFixedSizeBinary(t,r){return e.startFixedSizeBinary(t),e.addByteWidth(t,r),e.endFixedSizeBinary(t)}};var ql=class e{constructor(){this.bb=null,this.bb_pos=0}__init(t,r){return this.bb_pos=t,this.bb=r,this}static getRootAsFixedSizeList(t,r){return(r||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsFixedSizeList(t,r){return t.setPosition(t.position()+4),(r||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,r){t.addFieldInt32(0,r,0)}static endFixedSizeList(t){return t.endObject()}static createFixedSizeList(t,r){return e.startFixedSizeList(t),e.addListSize(t,r),e.endFixedSizeList(t)}};var Hy;(function(e){e[e.HALF=0]="HALF",e[e.SINGLE=1]="SINGLE",e[e.DOUBLE=2]="DOUBLE"})(Hy||(Hy={}));var Yl=class e{constructor(){this.bb=null,this.bb_pos=0}__init(t,r){return this.bb_pos=t,this.bb=r,this}static getRootAsFloatingPoint(t,r){return(r||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsFloatingPoint(t,r){return t.setPosition(t.position()+4),(r||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):Hy.HALF}static startFloatingPoint(t){t.startObject(1)}static addPrecision(t,r){t.addFieldInt16(0,r,Hy.HALF)}static endFloatingPoint(t){return t.endObject()}static createFloatingPoint(t,r){return e.startFloatingPoint(t),e.addPrecision(t,r),e.endFloatingPoint(t)}};var Zy;(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"})(Zy||(Zy={}));var Wl=class e{constructor(){this.bb=null,this.bb_pos=0}__init(t,r){return this.bb_pos=t,this.bb=r,this}static getRootAsInterval(t,r){return(r||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsInterval(t,r){return t.setPosition(t.position()+4),(r||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):Zy.YEAR_MONTH}static startInterval(t){t.startObject(1)}static addUnit(t,r){t.addFieldInt16(0,r,Zy.YEAR_MONTH)}static endInterval(t){return t.endObject()}static createInterval(t,r){return e.startInterval(t),e.addUnit(t,r),e.endInterval(t)}};var Ky=class e{constructor(){this.bb=null,this.bb_pos=0}__init(t,r){return this.bb_pos=t,this.bb=r,this}static getRootAsList(t,r){return(r||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsList(t,r){return t.setPosition(t.position()+4),(r||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 Gl=class e{constructor(){this.bb=null,this.bb_pos=0}__init(t,r){return this.bb_pos=t,this.bb=r,this}static getRootAsMap(t,r){return(r||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsMap(t,r){return t.setPosition(t.position()+4),(r||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,r){t.addFieldInt8(0,+r,0)}static endMap(t){return t.endObject()}static createMap(t,r){return e.startMap(t),e.addKeysSorted(t,r),e.endMap(t)}};var Qy=class e{constructor(){this.bb=null,this.bb_pos=0}__init(t,r){return this.bb_pos=t,this.bb=r,this}static getRootAsNull(t,r){return(r||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsNull(t,r){return t.setPosition(t.position()+4),(r||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 Jy=class e{constructor(){this.bb=null,this.bb_pos=0}__init(t,r){return this.bb_pos=t,this.bb=r,this}static getRootAsStruct_(t,r){return(r||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsStruct_(t,r){return t.setPosition(t.position()+4),(r||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 xc=class e{constructor(){this.bb=null,this.bb_pos=0}__init(t,r){return this.bb_pos=t,this.bb=r,this}static getRootAsTime(t,r){return(r||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsTime(t,r){return t.setPosition(t.position()+4),(r||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):cs.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,r){t.addFieldInt16(0,r,cs.MILLISECOND)}static addBitWidth(t,r){t.addFieldInt32(1,r,32)}static endTime(t){return t.endObject()}static createTime(t,r,n){return e.startTime(t),e.addUnit(t,r),e.addBitWidth(t,n),e.endTime(t)}};var _c=class e{constructor(){this.bb=null,this.bb_pos=0}__init(t,r){return this.bb_pos=t,this.bb=r,this}static getRootAsTimestamp(t,r){return(r||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsTimestamp(t,r){return t.setPosition(t.position()+4),(r||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):cs.SECOND}timezone(t){let r=this.bb.__offset(this.bb_pos,6);return r?this.bb.__string(this.bb_pos+r,t):null}static startTimestamp(t){t.startObject(2)}static addUnit(t,r){t.addFieldInt16(0,r,cs.SECOND)}static addTimezone(t,r){t.addFieldOffset(1,r,0)}static endTimestamp(t){return t.endObject()}static createTimestamp(t,r,n){return e.startTimestamp(t),e.addUnit(t,r),e.addTimezone(t,n),e.endTimestamp(t)}};var tg;(function(e){e[e.Sparse=0]="Sparse",e[e.Dense=1]="Dense"})(tg||(tg={}));var ls=class e{constructor(){this.bb=null,this.bb_pos=0}__init(t,r){return this.bb_pos=t,this.bb=r,this}static getRootAsUnion(t,r){return(r||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsUnion(t,r){return t.setPosition(t.position()+4),(r||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):tg.Sparse}typeIds(t){let r=this.bb.__offset(this.bb_pos,6);return r?this.bb.readInt32(this.bb.__vector(this.bb_pos+r)+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,r){t.addFieldInt16(0,r,tg.Sparse)}static addTypeIds(t,r){t.addFieldOffset(1,r,0)}static createTypeIdsVector(t,r){t.startVector(4,r.length,4);for(let n=r.length-1;n>=0;n--)t.addInt32(r[n]);return t.endVector()}static startTypeIdsVector(t,r){t.startVector(4,r,4)}static endUnion(t){return t.endObject()}static createUnion(t,r,n){return e.startUnion(t),e.addMode(t,r),e.addTypeIds(t,n),e.endUnion(t)}};var eg=class e{constructor(){this.bb=null,this.bb_pos=0}__init(t,r){return this.bb_pos=t,this.bb=r,this}static getRootAsUtf8(t,r){return(r||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsUtf8(t,r){return t.setPosition(t.position()+4),(r||new e).__init(t.readInt32(t.position())+t.position(),t)}static startUtf8(t){t.startObject(0)}static endUtf8(t){return t.endObject()}static createUtf8(t){return e.startUtf8(t),e.endUtf8(t)}};var Ye;(function(e){e[e.NONE=0]="NONE",e[e.Null=1]="Null",e[e.Int=2]="Int",e[e.FloatingPoint=3]="FloatingPoint",e[e.Binary=4]="Binary",e[e.Utf8=5]="Utf8",e[e.Bool=6]="Bool",e[e.Decimal=7]="Decimal",e[e.Date=8]="Date",e[e.Time=9]="Time",e[e.Timestamp=10]="Timestamp",e[e.Interval=11]="Interval",e[e.List=12]="List",e[e.Struct_=13]="Struct_",e[e.Union=14]="Union",e[e.FixedSizeBinary=15]="FixedSizeBinary",e[e.FixedSizeList=16]="FixedSizeList",e[e.Map=17]="Map",e[e.Duration=18]="Duration",e[e.LargeBinary=19]="LargeBinary",e[e.LargeUtf8=20]="LargeUtf8",e[e.LargeList=21]="LargeList",e[e.RunEndEncoded=22]="RunEndEncoded"})(Ye||(Ye={}));var An=class e{constructor(){this.bb=null,this.bb_pos=0}__init(t,r){return this.bb_pos=t,this.bb=r,this}static getRootAsField(t,r){return(r||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsField(t,r){return t.setPosition(t.position()+4),(r||new e).__init(t.readInt32(t.position())+t.position(),t)}name(t){let r=this.bb.__offset(this.bb_pos,4);return r?this.bb.__string(this.bb_pos+r,t):null}nullable(){let t=this.bb.__offset(this.bb_pos,6);return t?!!this.bb.readInt8(this.bb_pos+t):!1}typeType(){let t=this.bb.__offset(this.bb_pos,8);return t?this.bb.readUint8(this.bb_pos+t):Ye.NONE}type(t){let r=this.bb.__offset(this.bb_pos,10);return r?this.bb.__union(t,this.bb_pos+r):null}dictionary(t){let r=this.bb.__offset(this.bb_pos,12);return r?(t||new zs).__init(this.bb.__indirect(this.bb_pos+r),this.bb):null}children(t,r){let n=this.bb.__offset(this.bb_pos,14);return n?(r||new e).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+n)+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,r){let n=this.bb.__offset(this.bb_pos,16);return n?(r||new jr).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+n)+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,r){t.addFieldOffset(0,r,0)}static addNullable(t,r){t.addFieldInt8(1,+r,0)}static addTypeType(t,r){t.addFieldInt8(2,r,Ye.NONE)}static addType(t,r){t.addFieldOffset(3,r,0)}static addDictionary(t,r){t.addFieldOffset(4,r,0)}static addChildren(t,r){t.addFieldOffset(5,r,0)}static createChildrenVector(t,r){t.startVector(4,r.length,4);for(let n=r.length-1;n>=0;n--)t.addOffset(r[n]);return t.endVector()}static startChildrenVector(t,r){t.startVector(4,r,4)}static addCustomMetadata(t,r){t.addFieldOffset(6,r,0)}static createCustomMetadataVector(t,r){t.startVector(4,r.length,4);for(let n=r.length-1;n>=0;n--)t.addOffset(r[n]);return t.endVector()}static startCustomMetadataVector(t,r){t.startVector(4,r,4)}static endField(t){return t.endObject()}};var xi=class e{constructor(){this.bb=null,this.bb_pos=0}__init(t,r){return this.bb_pos=t,this.bb=r,this}static getRootAsSchema(t,r){return(r||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsSchema(t,r){return t.setPosition(t.position()+4),(r||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):$l.Little}fields(t,r){let n=this.bb.__offset(this.bb_pos,6);return n?(r||new An).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+n)+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,r){let n=this.bb.__offset(this.bb_pos,8);return n?(r||new jr).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+n)+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 r=this.bb.__offset(this.bb_pos,10);return r?this.bb.readInt64(this.bb.__vector(this.bb_pos+r)+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,r){t.addFieldInt16(0,r,$l.Little)}static addFields(t,r){t.addFieldOffset(1,r,0)}static createFieldsVector(t,r){t.startVector(4,r.length,4);for(let n=r.length-1;n>=0;n--)t.addOffset(r[n]);return t.endVector()}static startFieldsVector(t,r){t.startVector(4,r,4)}static addCustomMetadata(t,r){t.addFieldOffset(2,r,0)}static createCustomMetadataVector(t,r){t.startVector(4,r.length,4);for(let n=r.length-1;n>=0;n--)t.addOffset(r[n]);return t.endVector()}static startCustomMetadataVector(t,r){t.startVector(4,r,4)}static addFeatures(t,r){t.addFieldOffset(3,r,0)}static createFeaturesVector(t,r){t.startVector(8,r.length,8);for(let n=r.length-1;n>=0;n--)t.addInt64(r[n]);return t.endVector()}static startFeaturesVector(t,r){t.startVector(8,r,8)}static endSchema(t){return t.endObject()}static finishSchemaBuffer(t,r){t.finish(r)}static finishSizePrefixedSchemaBuffer(t,r){t.finish(r,void 0,!0)}static createSchema(t,r,n,i,o){return e.startSchema(t),e.addEndianness(t,r),e.addFields(t,n),e.addCustomMetadata(t,i),e.addFeatures(t,o),e.endSchema(t)}};var $i=class e{constructor(){this.bb=null,this.bb_pos=0}__init(t,r){return this.bb_pos=t,this.bb=r,this}static getRootAsFooter(t,r){return(r||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsFooter(t,r){return t.setPosition(t.position()+4),(r||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):Pl.V1}schema(t){let r=this.bb.__offset(this.bb_pos,6);return r?(t||new xi).__init(this.bb.__indirect(this.bb_pos+r),this.bb):null}dictionaries(t,r){let n=this.bb.__offset(this.bb_pos,8);return n?(r||new xf).__init(this.bb.__vector(this.bb_pos+n)+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,r){let n=this.bb.__offset(this.bb_pos,10);return n?(r||new xf).__init(this.bb.__vector(this.bb_pos+n)+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,r){let n=this.bb.__offset(this.bb_pos,12);return n?(r||new jr).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+n)+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,r){t.addFieldInt16(0,r,Pl.V1)}static addSchema(t,r){t.addFieldOffset(1,r,0)}static addDictionaries(t,r){t.addFieldOffset(2,r,0)}static startDictionariesVector(t,r){t.startVector(24,r,8)}static addRecordBatches(t,r){t.addFieldOffset(3,r,0)}static startRecordBatchesVector(t,r){t.startVector(24,r,8)}static addCustomMetadata(t,r){t.addFieldOffset(4,r,0)}static createCustomMetadataVector(t,r){t.startVector(4,r.length,4);for(let n=r.length-1;n>=0;n--)t.addOffset(r[n]);return t.endVector()}static startCustomMetadataVector(t,r){t.startVector(4,r,4)}static endFooter(t){return t.endObject()}static finishFooterBuffer(t,r){t.finish(r)}static finishSizePrefixedFooterBuffer(t,r){t.finish(r,void 0,!0)}};var Te=class e{constructor(t=[],r,n,i=er.V5){this.fields=t||[],this.metadata=r||new Map,n||(n=jE(t)),this.dictionaries=n,this.metadataVersion=i}get[Symbol.toStringTag](){return"Schema"}get names(){return this.fields.map(t=>t.name)}toString(){return`Schema<{ ${this.fields.map((t,r)=>`${r}: ${t}`).join(", ")} }>`}select(t){let r=new Set(t),n=this.fields.filter(i=>r.has(i.name));return new e(n,this.metadata)}selectAt(t){let r=t.map(n=>this.fields[n]).filter(Boolean);return new e(r,this.metadata)}assign(...t){let r=t[0]instanceof e?t[0]:Array.isArray(t[0])?new e(t[0]):new e(t),n=[...this.fields],i=ww(ww(new Map,this.metadata),r.metadata),o=r.fields.filter(a=>{let c=n.findIndex(l=>l.name===a.name);return~c?(n[c]=a.clone({metadata:ww(ww(new Map,n[c].metadata),a.metadata)}))&&!1:!0}),s=jE(o,new Map);return new e([...n,...o],i,new Map([...this.dictionaries,...s]))}};Te.prototype.fields=null;Te.prototype.metadata=null;Te.prototype.dictionaries=null;var ne=class e{static new(...t){let[r,n,i,o]=t;return t[0]&&typeof t[0]=="object"&&({name:r}=t[0],n===void 0&&(n=t[0].type),i===void 0&&(i=t[0].nullable),o===void 0&&(o=t[0].metadata)),new e(`${r}`,n,i,o)}constructor(t,r,n=!1,i){this.name=t,this.type=r,this.nullable=n,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[r,n,i,o]=t;return!t[0]||typeof t[0]!="object"?[r=this.name,n=this.type,i=this.nullable,o=this.metadata]=t:{name:r=this.name,type:n=this.type,nullable:i=this.nullable,metadata:o=this.metadata}=t[0],e.new(r,n,i,o)}};ne.prototype.type=null;ne.prototype.name=null;ne.prototype.nullable=null;ne.prototype.metadata=null;function ww(e,t){return new Map([...e||new Map,...t||new Map])}function jE(e,t=new Map){for(let r=-1,n=e.length;++r<n;){let o=e[r].type;if(ht.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&&jE(o.children,t)}return t}var dJ=Lo,hJ=Ar,wc=class{static decode(t){t=new hJ(Xt(t));let r=$i.getRootAsFooter(t),n=Te.decode(r.schema(),new Map,r.version());return new qE(n,r)}static encode(t){let r=new dJ,n=Te.encode(r,t.schema);$i.startRecordBatchesVector(r,t.numRecordBatches);for(let s of[...t.recordBatches()].slice().reverse())vc.encode(r,s);let i=r.endVector();$i.startDictionariesVector(r,t.numDictionaries);for(let s of[...t.dictionaryBatches()].slice().reverse())vc.encode(r,s);let o=r.endVector();return $i.startFooter(r),$i.addSchema(r,n),$i.addVersion(r,er.V5),$i.addRecordBatches(r,i),$i.addDictionaries(r,o),$i.finishFooterBuffer(r,$i.endFooter(r)),r.asUint8Array()}get numRecordBatches(){return this._recordBatches.length}get numDictionaries(){return this._dictionaryBatches.length}constructor(t,r=er.V5,n,i){this.schema=t,this.version=r,n&&(this._recordBatches=n),i&&(this._dictionaryBatches=i)}*recordBatches(){for(let t,r=-1,n=this.numRecordBatches;++r<n;)(t=this.getRecordBatch(r))&&(yield t)}*dictionaryBatches(){for(let t,r=-1,n=this.numDictionaries;++r<n;)(t=this.getDictionaryBatch(r))&&(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 qE=class extends wc{get numRecordBatches(){return this._footer.recordBatchesLength()}get numDictionaries(){return this._footer.dictionariesLength()}constructor(t,r){super(t,r.version()),this._footer=r}getRecordBatch(t){if(t>=0&&t<this.numRecordBatches){let r=this._footer.recordBatches(t);if(r)return vc.decode(r)}return null}getDictionaryBatch(t){if(t>=0&&t<this.numDictionaries){let r=this._footer.dictionaries(t);if(r)return vc.decode(r)}return null}},vc=class e{static decode(t){return new e(t.metaDataLength(),t.bodyLength(),t.offset())}static encode(t,r){let{metaDataLength:n}=r,i=BigInt(r.offset),o=BigInt(r.bodyLength);return xf.createBlock(t,i,n,o)}constructor(t,r,n){this.metaDataLength=t,this.offset=gi(n),this.bodyLength=gi(r)}};var We=Object.freeze({done:!0,value:void 0}),rg=class{constructor(t){this._json=t}get schema(){return this._json.schema}get batches(){return this._json.batches||[]}get dictionaries(){return this._json.dictionaries||[]}},_f=class{tee(){return this._getDOMStream().tee()}pipe(t,r){return this._getNodeStream().pipe(t,r)}pipeTo(t,r){return this._getDOMStream().pipeTo(t,r)}pipeThrough(t,r){return this._getDOMStream().pipeThrough(t,r)}_getDOMStream(){return this._DOMStream||(this._DOMStream=this.toDOMStream())}_getNodeStream(){return this._nodeStream||(this._nodeStream=this.toNodeStream())}},vw=class extends _f{constructor(){super(),this._values=[],this.resolvers=[],this._closedPromise=new Promise(t=>this._closedPromiseResolve=t)}get closed(){return this._closedPromise}cancel(t){return P(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(We);this._closedPromiseResolve(),this._closedPromiseResolve=void 0}}[Symbol.asyncIterator](){return this}toDOMStream(t){return ln.toDOMStream(this._closedPromiseResolve||this._error?this:this._values,t)}toNodeStream(t){return ln.toNodeStream(this._closedPromiseResolve||this._error?this:this._values,t)}throw(t){return P(this,void 0,void 0,function*(){return yield this.abort(t),We})}return(t){return P(this,void 0,void 0,function*(){return yield this.close(),We})}read(t){return P(this,void 0,void 0,function*(){return(yield this.next(t,"read")).value})}peek(t){return P(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((r,n)=>{this.resolvers.push({resolve:r,reject:n})}):Promise.resolve(We)}_ensureOpen(){if(this._closedPromiseResolve)return!0;throw new Error("AsyncQueue is closed")}};var js=class extends vw{write(t){if((t=Xt(t)).byteLength>0)return super.write(t)}toString(t=!1){return t?ky(this.toUint8Array(!0)):this.toUint8Array(!1).then(ky)}toUint8Array(t=!1){return t?ki(this._values)[0]:P(this,void 0,void 0,function*(){var r,n,i,o;let s=[],a=0;try{for(var c=!0,l=fr(this),u;u=yield l.next(),r=u.done,!r;c=!0){o=u.value,c=!1;let f=o;s.push(f),a+=f.byteLength}}catch(f){n={error:f}}finally{try{!c&&!r&&(i=l.return)&&(yield i.call(l))}finally{if(n)throw n.error}}return ki(s,a)[0]})}},qs=class{constructor(t){t&&(this.source=new YE(ln.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)}},po=class e{constructor(t){t instanceof e?this.source=t.source:t instanceof js?this.source=new Sc(ln.fromAsyncIterable(t)):k1(t)?this.source=new Sc(ln.fromNodeStream(t)):Cy(t)?this.source=new Sc(ln.fromDOMStream(t)):L1(t)?this.source=new Sc(ln.fromDOMStream(t.body)):Ko(t)?this.source=new Sc(ln.fromIterable(t)):Zo(t)?this.source=new Sc(ln.fromAsyncIterable(t)):uo(t)&&(this.source=new Sc(ln.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)}},YE=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,r="read"){return this.source.next({cmd:r,size:t})}throw(t){return Object.create(this.source.throw&&this.source.throw(t)||We)}return(t){return Object.create(this.source.return&&this.source.return(t)||We)}},Sc=class{constructor(t){this.source=t,this._closedPromise=new Promise(r=>this._closedPromiseResolve=r)}cancel(t){return P(this,void 0,void 0,function*(){yield this.return(t)})}get closed(){return this._closedPromise}read(t){return P(this,void 0,void 0,function*(){return(yield this.next(t,"read")).value})}peek(t){return P(this,void 0,void 0,function*(){return(yield this.next(t,"peek")).value})}next(t,r="read"){return P(this,void 0,void 0,function*(){return yield this.source.next({cmd:r,size:t})})}throw(t){return P(this,void 0,void 0,function*(){let r=this.source.throw&&(yield this.source.throw(t))||We;return this._closedPromiseResolve&&this._closedPromiseResolve(),this._closedPromiseResolve=void 0,Object.create(r)})}return(t){return P(this,void 0,void 0,function*(){let r=this.source.return&&(yield this.source.return(t))||We;return this._closedPromiseResolve&&this._closedPromiseResolve(),this._closedPromiseResolve=void 0,Object.create(r)})}};var ng=class extends qs{constructor(t,r){super(),this.position=0,this.buffer=Xt(t),this.size=r===void 0?this.buffer.byteLength:r}readInt32(t){let{buffer:r,byteOffset:n}=this.readAt(t,4);return new DataView(r,n).getInt32(0,!0)}seek(t){return this.position=Math.min(t,this.size),t<this.size}read(t){let{buffer:r,size:n,position:i}=this;return r&&i<n?(typeof t!="number"&&(t=Number.POSITIVE_INFINITY),this.position=Math.min(n,i+Math.min(n-i,t)),r.subarray(i,this.position)):null}readAt(t,r){let n=this.buffer,i=Math.min(this.size,t+r);return n?n.subarray(t,i):new Uint8Array(r)}close(){this.buffer&&(this.buffer=null)}throw(t){return this.close(),{done:!0,value:t}}return(t){return this.close(),{done:!0,value:t}}},Xl=class extends po{constructor(t,r){super(),this.position=0,this._handle=t,typeof r=="number"?this.size=r:this._pending=P(this,void 0,void 0,function*(){this.size=(yield t.stat()).size,delete this._pending})}readInt32(t){return P(this,void 0,void 0,function*(){let{buffer:r,byteOffset:n}=yield this.readAt(t,4);return new DataView(r,n).getInt32(0,!0)})}seek(t){return P(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 P(this,void 0,void 0,function*(){this._pending&&(yield this._pending);let{_handle:r,size:n,position:i}=this;if(r&&i<n){typeof t!="number"&&(t=Number.POSITIVE_INFINITY);let o=i,s=0,a=0,c=Math.min(n,o+Math.min(n-o,t)),l=new Uint8Array(Math.max(0,(this.position=c)-o));for(;(o+=a)<c&&(s+=a)<l.byteLength;)({bytesRead:a}=yield r.read(l,s,l.byteLength-s,o));return l}return null})}readAt(t,r){return P(this,void 0,void 0,function*(){this._pending&&(yield this._pending);let{_handle:n,size:i}=this;if(n&&t+r<i){let o=Math.min(i,t+r),s=new Uint8Array(o-t);return(yield n.read(s,0,r,t)).buffer}return new Uint8Array(r)})}close(){return P(this,void 0,void 0,function*(){let t=this._handle;this._handle=null,t&&(yield t.close())})}throw(t){return P(this,void 0,void 0,function*(){return yield this.close(),{done:!0,value:t}})}return(t){return P(this,void 0,void 0,function*(){return yield this.close(),{done:!0,value:t}})}};var GE={};Ir(GE,{BaseInt64:()=>ig,Int128:()=>og,Int64:()=>Ic,Uint64:()=>ar});function hh(e){return e<0&&(e=4294967295+e+1),`0x${e.toString(16)}`}var ph=8,WE=[1,10,100,1e3,1e4,1e5,1e6,1e7,1e8],ig=class{constructor(t){this.buffer=t}high(){return this.buffer[1]}low(){return this.buffer[0]}_times(t){let r=new Uint32Array([this.buffer[1]>>>16,this.buffer[1]&65535,this.buffer[0]>>>16,this.buffer[0]&65535]),n=new Uint32Array([t.buffer[1]>>>16,t.buffer[1]&65535,t.buffer[0]>>>16,t.buffer[0]&65535]),i=r[3]*n[3];this.buffer[0]=i&65535;let o=i>>>16;return i=r[2]*n[3],o+=i,i=r[3]*n[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]+=r[1]*n[3]+r[2]*n[2]+r[3]*n[1],this.buffer[1]+=r[0]*n[3]+r[1]*n[2]+r[2]*n[1]+r[3]*n[0]<<16,this}_plus(t){let r=this.buffer[0]+t.buffer[0]>>>0;this.buffer[1]+=t.buffer[1],r<this.buffer[0]>>>0&&++this.buffer[1],this.buffer[0]=r}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`${hh(this.buffer[1])} ${hh(this.buffer[0])}`}},ar=class e extends ig{times(t){return this._times(t),this}plus(t){return this._plus(t),this}static from(t,r=new Uint32Array(2)){return e.fromString(typeof t=="string"?t:t.toString(),r)}static fromNumber(t,r=new Uint32Array(2)){return e.fromString(t.toString(),r)}static fromString(t,r=new Uint32Array(2)){let n=t.length,i=new e(r);for(let o=0;o<n;){let s=ph<n-o?ph:n-o,a=new e(new Uint32Array([Number.parseInt(t.slice(o,o+s),10),0])),c=new e(new Uint32Array([WE[s],0]));i.times(c),i.plus(a),o+=s}return i}static convertArray(t){let r=new Uint32Array(t.length*2);for(let n=-1,i=t.length;++n<i;)e.from(t[n],new Uint32Array(r.buffer,r.byteOffset+2*n*4,2));return r}static multiply(t,r){return new e(new Uint32Array(t.buffer)).times(r)}static add(t,r){return new e(new Uint32Array(t.buffer)).plus(r)}},Ic=class e extends ig{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 r=this.buffer[1]<<0,n=t.buffer[1]<<0;return r<n||r===n&&this.buffer[0]<t.buffer[0]}static from(t,r=new Uint32Array(2)){return e.fromString(typeof t=="string"?t:t.toString(),r)}static fromNumber(t,r=new Uint32Array(2)){return e.fromString(t.toString(),r)}static fromString(t,r=new Uint32Array(2)){let n=t.startsWith("-"),i=t.length,o=new e(r);for(let s=n?1:0;s<i;){let a=ph<i-s?ph:i-s,c=new e(new Uint32Array([Number.parseInt(t.slice(s,s+a),10),0])),l=new e(new Uint32Array([WE[a],0]));o.times(l),o.plus(c),s+=a}return n?o.negate():o}static convertArray(t){let r=new Uint32Array(t.length*2);for(let n=-1,i=t.length;++n<i;)e.from(t[n],new Uint32Array(r.buffer,r.byteOffset+2*n*4,2));return r}static multiply(t,r){return new e(new Uint32Array(t.buffer)).times(r)}static add(t,r){return new e(new Uint32Array(t.buffer)).plus(r)}},og=class e{constructor(t){this.buffer=t}high(){return new Ic(new Uint32Array(this.buffer.buffer,this.buffer.byteOffset+8,2))}low(){return new Ic(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 r=new ar(new Uint32Array([this.buffer[3],0])),n=new ar(new Uint32Array([this.buffer[2],0])),i=new ar(new Uint32Array([this.buffer[1],0])),o=new ar(new Uint32Array([this.buffer[0],0])),s=new ar(new Uint32Array([t.buffer[3],0])),a=new ar(new Uint32Array([t.buffer[2],0])),c=new ar(new Uint32Array([t.buffer[1],0])),l=new ar(new Uint32Array([t.buffer[0],0])),u=ar.multiply(o,l);this.buffer[0]=u.low();let f=new ar(new Uint32Array([u.high(),0]));return u=ar.multiply(i,l),f.plus(u),u=ar.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 ar(new Uint32Array(this.buffer.buffer,this.buffer.byteOffset+8,2)).plus(ar.multiply(n,l)).plus(ar.multiply(i,c)).plus(ar.multiply(o,a)),this.buffer[3]+=ar.multiply(r,l).plus(ar.multiply(n,c)).plus(ar.multiply(i,a)).plus(ar.multiply(o,s)).low(),this}plus(t){let r=new Uint32Array(4);return r[3]=this.buffer[3]+t.buffer[3]>>>0,r[2]=this.buffer[2]+t.buffer[2]>>>0,r[1]=this.buffer[1]+t.buffer[1]>>>0,r[0]=this.buffer[0]+t.buffer[0]>>>0,r[0]<this.buffer[0]>>>0&&++r[1],r[1]<this.buffer[1]>>>0&&++r[2],r[2]<this.buffer[2]>>>0&&++r[3],this.buffer[3]=r[3],this.buffer[2]=r[2],this.buffer[1]=r[1],this.buffer[0]=r[0],this}hex(){return`${hh(this.buffer[3])} ${hh(this.buffer[2])} ${hh(this.buffer[1])} ${hh(this.buffer[0])}`}static multiply(t,r){return new e(new Uint32Array(t.buffer)).times(r)}static add(t,r){return new e(new Uint32Array(t.buffer)).plus(r)}static from(t,r=new Uint32Array(4)){return e.fromString(typeof t=="string"?t:t.toString(),r)}static fromNumber(t,r=new Uint32Array(4)){return e.fromString(t.toString(),r)}static fromString(t,r=new Uint32Array(4)){let n=t.startsWith("-"),i=t.length,o=new e(r);for(let s=n?1:0;s<i;){let a=ph<i-s?ph:i-s,c=new e(new Uint32Array([Number.parseInt(t.slice(s,s+a),10),0,0,0])),l=new e(new Uint32Array([WE[a],0,0,0]));o.times(l),o.plus(c),s+=a}return n?o.negate():o}static convertArray(t){let r=new Uint32Array(t.length*4);for(let n=-1,i=t.length;++n<i;)e.from(t[n],new Uint32Array(r.buffer,r.byteOffset+4*4*n,4));return r}};var sg=class extends mt{constructor(t,r,n,i,o=er.V5){super(),this.nodesIndex=-1,this.buffersIndex=-1,this.bytes=t,this.nodes=r,this.buffers=n,this.dictionaries=i,this.metadataVersion=o}visit(t){return super.visit(t instanceof ne?t.type:t)}visitNull(t,{length:r}=this.nextFieldNode()){return Ht({type:t,length:r})}visitBool(t,{length:r,nullCount:n}=this.nextFieldNode()){return Ht({type:t,length:r,nullCount:n,nullBitmap:this.readNullBitmap(t,n),data:this.readData(t)})}visitInt(t,{length:r,nullCount:n}=this.nextFieldNode()){return Ht({type:t,length:r,nullCount:n,nullBitmap:this.readNullBitmap(t,n),data:this.readData(t)})}visitFloat(t,{length:r,nullCount:n}=this.nextFieldNode()){return Ht({type:t,length:r,nullCount:n,nullBitmap:this.readNullBitmap(t,n),data:this.readData(t)})}visitUtf8(t,{length:r,nullCount:n}=this.nextFieldNode()){return Ht({type:t,length:r,nullCount:n,nullBitmap:this.readNullBitmap(t,n),valueOffsets:this.readOffsets(t),data:this.readData(t)})}visitBinary(t,{length:r,nullCount:n}=this.nextFieldNode()){return Ht({type:t,length:r,nullCount:n,nullBitmap:this.readNullBitmap(t,n),valueOffsets:this.readOffsets(t),data:this.readData(t)})}visitFixedSizeBinary(t,{length:r,nullCount:n}=this.nextFieldNode()){return Ht({type:t,length:r,nullCount:n,nullBitmap:this.readNullBitmap(t,n),data:this.readData(t)})}visitDate(t,{length:r,nullCount:n}=this.nextFieldNode()){return Ht({type:t,length:r,nullCount:n,nullBitmap:this.readNullBitmap(t,n),data:this.readData(t)})}visitTimestamp(t,{length:r,nullCount:n}=this.nextFieldNode()){return Ht({type:t,length:r,nullCount:n,nullBitmap:this.readNullBitmap(t,n),data:this.readData(t)})}visitTime(t,{length:r,nullCount:n}=this.nextFieldNode()){return Ht({type:t,length:r,nullCount:n,nullBitmap:this.readNullBitmap(t,n),data:this.readData(t)})}visitDecimal(t,{length:r,nullCount:n}=this.nextFieldNode()){return Ht({type:t,length:r,nullCount:n,nullBitmap:this.readNullBitmap(t,n),data:this.readData(t)})}visitList(t,{length:r,nullCount:n}=this.nextFieldNode()){return Ht({type:t,length:r,nullCount:n,nullBitmap:this.readNullBitmap(t,n),valueOffsets:this.readOffsets(t),child:this.visit(t.children[0])})}visitStruct(t,{length:r,nullCount:n}=this.nextFieldNode()){return Ht({type:t,length:r,nullCount:n,nullBitmap:this.readNullBitmap(t,n),children:this.visitMany(t.children)})}visitUnion(t,{length:r,nullCount:n}=this.nextFieldNode()){return this.metadataVersion<er.V5&&this.readNullBitmap(t,n),t.mode===je.Sparse?this.visitSparseUnion(t,{length:r,nullCount:n}):this.visitDenseUnion(t,{length:r,nullCount:n})}visitDenseUnion(t,{length:r,nullCount:n}=this.nextFieldNode()){return Ht({type:t,length:r,nullCount:n,typeIds:this.readTypeIds(t),valueOffsets:this.readOffsets(t),children:this.visitMany(t.children)})}visitSparseUnion(t,{length:r,nullCount:n}=this.nextFieldNode()){return Ht({type:t,length:r,nullCount:n,typeIds:this.readTypeIds(t),children:this.visitMany(t.children)})}visitDictionary(t,{length:r,nullCount:n}=this.nextFieldNode()){return Ht({type:t,length:r,nullCount:n,nullBitmap:this.readNullBitmap(t,n),data:this.readData(t.indices),dictionary:this.readDictionary(t)})}visitInterval(t,{length:r,nullCount:n}=this.nextFieldNode()){return Ht({type:t,length:r,nullCount:n,nullBitmap:this.readNullBitmap(t,n),data:this.readData(t)})}visitDuration(t,{length:r,nullCount:n}=this.nextFieldNode()){return Ht({type:t,length:r,nullCount:n,nullBitmap:this.readNullBitmap(t,n),data:this.readData(t)})}visitFixedSizeList(t,{length:r,nullCount:n}=this.nextFieldNode()){return Ht({type:t,length:r,nullCount:n,nullBitmap:this.readNullBitmap(t,n),child:this.visit(t.children[0])})}visitMap(t,{length:r,nullCount:n}=this.nextFieldNode()){return Ht({type:t,length:r,nullCount:n,nullBitmap:this.readNullBitmap(t,n),valueOffsets:this.readOffsets(t),child:this.visit(t.children[0])})}nextFieldNode(){return this.nodes[++this.nodesIndex]}nextBufferRange(){return this.buffers[++this.buffersIndex]}readNullBitmap(t,r,n=this.nextBufferRange()){return r>0&&this.readData(t,n)||new Uint8Array(0)}readOffsets(t,r){return this.readData(t,r)}readTypeIds(t,r){return this.readData(t,r)}readData(t,{length:r,offset:n}=this.nextBufferRange()){return this.bytes.subarray(n,n+r)}readDictionary(t){return this.dictionaries.get(t.id)}},Sw=class extends sg{constructor(t,r,n,i,o){super(new Uint8Array(0),r,n,i,o),this.sources=t}readNullBitmap(t,r,{offset:n}=this.nextBufferRange()){return r<=0?new Uint8Array(0):gf(this.sources[n])}readOffsets(t,{offset:r}=this.nextBufferRange()){return ee(Uint8Array,ee(Int32Array,this.sources[r]))}readTypeIds(t,{offset:r}=this.nextBufferRange()){return ee(Uint8Array,ee(t.ArrayType,this.sources[r]))}readData(t,{offset:r}=this.nextBufferRange()){let{sources:n}=this;return ht.isTimestamp(t)?ee(Uint8Array,Ic.convertArray(n[r])):(ht.isInt(t)||ht.isTime(t))&&t.bitWidth===64||ht.isDuration(t)?ee(Uint8Array,Ic.convertArray(n[r])):ht.isDate(t)&&t.unit===un.MILLISECOND?ee(Uint8Array,Ic.convertArray(n[r])):ht.isDecimal(t)?ee(Uint8Array,og.convertArray(n[r])):ht.isBinary(t)||ht.isFixedSizeBinary(t)?pJ(n[r]):ht.isBool(t)?gf(n[r]):ht.isUtf8(t)?Fl(n[r].join("")):ee(Uint8Array,ee(t.ArrayType,n[r].map(i=>+i)))}};function pJ(e){let t=e.join(""),r=new Uint8Array(t.length/2);for(let n=0;n<t.length;n+=2)r[n>>1]=Number.parseInt(t.slice(n,n+2),16);return r}var mh=class extends $s{constructor(t){super(t),this._values=new Ul(new Uint8Array(0))}get byteLength(){let t=this._pendingLength+this.length*4;return this._offsets&&(t+=this._offsets.byteLength),this._values&&(t+=this._values.byteLength),this._nulls&&(t+=this._nulls.byteLength),t}setValue(t,r){return super.setValue(t,Xt(r))}_flushPending(t,r){let n=this._offsets,i=this._values.reserve(r).buffer,o=0;for(let[s,a]of t)if(a===void 0)n.set(s,0);else{let c=a.length;i.set(a,o),n.set(s,c),o+=c}}};var Iw=class extends He{constructor(t){super(t),this._values=new fh}setValue(t,r){this._values.set(t,+r)}};var wf=class extends Br{};wf.prototype._setValue=AE;var ag=class extends wf{};ag.prototype._setValue=Z1;var cg=class extends wf{};cg.prototype._setValue=K1;var lg=class extends Br{};lg.prototype._setValue=DE;var Tw=class extends He{constructor({type:t,nullValues:r,dictionaryHashFunction:n}){super({type:new Ci(t.dictionary,t.indices,t.id,t.isOrdered)}),this._nulls=null,this._dictionaryOffset=0,this._keysToIndices=Object.create(null),this.indices=vf({type:this.type.indices,nullValues:r}),this.dictionary=vf({type:this.type.dictionary,nullValues:null}),typeof n=="function"&&(this.valueToKey=n)}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,r){let n=this.indices;return r=n.setValid(t,r),this.length=n.length,r}setValue(t,r){let n=this._keysToIndices,i=this.valueToKey(r),o=n[i];return o===void 0&&(n[i]=o=this._dictionaryOffset+this.dictionary.append(r).length-1),this.indices.setValue(t,o)}flush(){let t=this.type,r=this._dictionary,n=this.dictionary.toVector(),i=this.indices.flush().clone(t);return i.dictionary=r?r.concat(n):n,this.finished||(this._dictionaryOffset+=n.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 ug=class extends Br{};ug.prototype._setValue=TE;var Aw=class extends He{setValue(t,r){let[n]=this.children,i=t*this.stride;for(let o=-1,s=r.length;++o<s;)n.set(i+o,r[o])}addChild(t,r="0"){if(this.numChildren>0)throw new Error("FixedSizeListBuilder can only have one child.");let n=this.children.push(t);return this.type=new is(this.type.listSize,new ne(r,t.type,!0)),n}};var Sf=class extends Br{setValue(t,r){this._values.set(t,r)}},Mw=class extends Sf{setValue(t,r){super.setValue(t,$y(r))}},Ew=class extends Sf{},Dw=class extends Sf{};var If=class extends Br{};If.prototype._setValue=BE;var fg=class extends If{};fg.prototype._setValue=sw;var dg=class extends If{};dg.prototype._setValue=aw;var Tc=class extends Br{};Tc.prototype._setValue=OE;var hg=class extends Tc{};hg.prototype._setValue=cw;var pg=class extends Tc{};pg.prototype._setValue=lw;var mg=class extends Tc{};mg.prototype._setValue=uw;var yg=class extends Tc{};yg.prototype._setValue=fw;var mo=class extends Br{setValue(t,r){this._values.set(t,r)}},Bw=class extends mo{},Ow=class extends mo{},Nw=class extends mo{},Fw=class extends mo{},Lw=class extends mo{},Rw=class extends mo{},kw=class extends mo{},Cw=class extends mo{};var Uw=class extends $s{constructor(t){super(t),this._offsets=new dh}addChild(t,r="0"){if(this.numChildren>0)throw new Error("ListBuilder can only have one child.");return this.children[this.numChildren]=t,this.type=new rs(new ne(r,t.type,!0)),this.numChildren-1}_flushPending(t){let r=this._offsets,[n]=this.children;for(let[i,o]of t)if(typeof o>"u")r.set(i,0);else{let s=o,a=s.length,c=r.set(i,a).buffer[i];for(let l=-1;++l<a;)n.set(c+l,s[l])}}};var Pw=class extends $s{set(t,r){return super.set(t,r)}setValue(t,r){let n=r instanceof Map?r:new Map(Object.entries(r)),i=this._pending||(this._pending=new Map),o=i.get(t);o&&(this._pendingLength-=o.size),this._pendingLength+=n.size,i.set(t,n)}addChild(t,r=`${this.numChildren}`){if(this.numChildren>0)throw new Error("ListBuilder can only have one child.");return this.children[this.numChildren]=t,this.type=new os(new ne(r,t.type,!0),this.type.keysSorted),this.numChildren-1}_flushPending(t){let r=this._offsets,[n]=this.children;for(let[i,o]of t)if(o===void 0)r.set(i,0);else{let{[i]:s,[i+1]:a}=r.set(i,o.size).buffer;for(let c of o.entries())if(n.set(s,c),++s>=a)break}}};var $w=class extends He{setValue(t,r){}setValid(t,r){return this.length=Math.max(t+1,this.length),r}};var zw=class extends He{setValue(t,r){let{children:n,type:i}=this;switch(Array.isArray(r)||r.constructor){case!0:return i.children.forEach((o,s)=>n[s].set(t,r[s]));case Map:return i.children.forEach((o,s)=>n[s].set(t,r.get(o.name)));default:return i.children.forEach((o,s)=>n[s].set(t,r[o.name]))}}setValid(t,r){return super.setValid(t,r)||this.children.forEach(n=>n.setValid(t,r)),r}addChild(t,r=`${this.numChildren}`){let n=this.children.push(t);return this.type=new qe([...this.type.children,new ne(r,t.type,!0)]),n}};var Ac=class extends Br{};Ac.prototype._setValue=ME;var gg=class extends Ac{};gg.prototype._setValue=Q1;var bg=class extends Ac{};bg.prototype._setValue=J1;var xg=class extends Ac{};xg.prototype._setValue=tw;var _g=class extends Ac{};_g.prototype._setValue=ew;var Mc=class extends Br{};Mc.prototype._setValue=EE;var wg=class extends Mc{};wg.prototype._setValue=rw;var vg=class extends Mc{};vg.prototype._setValue=nw;var Sg=class extends Mc{};Sg.prototype._setValue=iw;var Ig=class extends Mc{};Ig.prototype._setValue=ow;var yh=class extends He{constructor(t){super(t),this._typeIds=new bc(new Int8Array(0),1),typeof t.valueToChildTypeId=="function"&&(this._valueToChildTypeId=t.valueToChildTypeId)}get typeIdToChildIndex(){return this.type.typeIdToChildIndex}append(t,r){return this.set(this.length,t,r)}set(t,r,n){return n===void 0&&(n=this._valueToChildTypeId(this,r,t)),this.setValue(t,r,n),this}setValue(t,r,n){this._typeIds.set(t,n);let i=this.type.typeIdToChildIndex[n],o=this.children[i];o?.set(t,r)}addChild(t,r=`${this.children.length}`){let n=this.children.push(t),{type:{children:i,mode:o,typeIds:s}}=this,a=[...i,new ne(r,t.type)];return this.type=new ns(o,[...s,n],a),n}_valueToChildTypeId(t,r,n){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.")}},Vw=class extends yh{},jw=class extends yh{constructor(t){super(t),this._offsets=new bc(new Int32Array(0))}setValue(t,r,n){let i=this._typeIds.set(t,n).buffer[t],o=this.getChildAt(this.type.typeIdToChildIndex[i]),s=this._offsets.set(t,o.length).buffer[t];o?.set(s,r)}};var Tg=class extends $s{constructor(t){super(t),this._values=new Ul(new Uint8Array(0))}get byteLength(){let t=this._pendingLength+this.length*4;return this._offsets&&(t+=this._offsets.byteLength),this._values&&(t+=this._values.byteLength),this._nulls&&(t+=this._nulls.byteLength),t}setValue(t,r){return super.setValue(t,Fl(r))}_flushPending(t,r){}};Tg.prototype._flushPending=mh.prototype._flushPending;var XE=class extends mt{visitNull(){return $w}visitBool(){return Iw}visitInt(){return mo}visitInt8(){return Bw}visitInt16(){return Ow}visitInt32(){return Nw}visitInt64(){return Fw}visitUint8(){return Lw}visitUint16(){return Rw}visitUint32(){return kw}visitUint64(){return Cw}visitFloat(){return Sf}visitFloat16(){return Mw}visitFloat32(){return Ew}visitFloat64(){return Dw}visitUtf8(){return Tg}visitBinary(){return mh}visitFixedSizeBinary(){return ug}visitDate(){return wf}visitDateDay(){return ag}visitDateMillisecond(){return cg}visitTimestamp(){return Ac}visitTimestampSecond(){return gg}visitTimestampMillisecond(){return bg}visitTimestampMicrosecond(){return xg}visitTimestampNanosecond(){return _g}visitTime(){return Mc}visitTimeSecond(){return wg}visitTimeMillisecond(){return vg}visitTimeMicrosecond(){return Sg}visitTimeNanosecond(){return Ig}visitDecimal(){return lg}visitList(){return Uw}visitStruct(){return zw}visitUnion(){return yh}visitDenseUnion(){return jw}visitSparseUnion(){return Vw}visitDictionary(){return Tw}visitInterval(){return If}visitIntervalDayTime(){return fg}visitIntervalYearMonth(){return dg}visitDuration(){return Tc}visitDurationSecond(){return hg}visitDurationMillisecond(){return pg}visitDurationMicrosecond(){return mg}visistDurationNanosecond(){return yg}visitFixedSizeList(){return Aw}visitMap(){return Pw}},L5=new XE;var Nt=class extends mt{compareSchemas(t,r){return t===r||r instanceof t.constructor&&this.compareManyFields(t.fields,r.fields)}compareManyFields(t,r){return t===r||Array.isArray(t)&&Array.isArray(r)&&t.length===r.length&&t.every((n,i)=>this.compareFields(n,r[i]))}compareFields(t,r){return t===r||r instanceof t.constructor&&t.name===r.name&&t.nullable===r.nullable&&this.visit(t.type,r.type)}};function qn(e,t){return t instanceof e.constructor}function Ag(e,t){return e===t||qn(e,t)}function Ec(e,t){return e===t||qn(e,t)&&e.bitWidth===t.bitWidth&&e.isSigned===t.isSigned}function qw(e,t){return e===t||qn(e,t)&&e.precision===t.precision}function mJ(e,t){return e===t||qn(e,t)&&e.byteWidth===t.byteWidth}function HE(e,t){return e===t||qn(e,t)&&e.unit===t.unit}function Mg(e,t){return e===t||qn(e,t)&&e.unit===t.unit&&e.timezone===t.timezone}function Eg(e,t){return e===t||qn(e,t)&&e.unit===t.unit&&e.bitWidth===t.bitWidth}function yJ(e,t){return e===t||qn(e,t)&&e.children.length===t.children.length&&Ys.compareManyFields(e.children,t.children)}function gJ(e,t){return e===t||qn(e,t)&&e.children.length===t.children.length&&Ys.compareManyFields(e.children,t.children)}function ZE(e,t){return e===t||qn(e,t)&&e.mode===t.mode&&e.typeIds.every((r,n)=>r===t.typeIds[n])&&Ys.compareManyFields(e.children,t.children)}function bJ(e,t){return e===t||qn(e,t)&&e.id===t.id&&e.isOrdered===t.isOrdered&&Ys.visit(e.indices,t.indices)&&Ys.visit(e.dictionary,t.dictionary)}function KE(e,t){return e===t||qn(e,t)&&e.unit===t.unit}function Dg(e,t){return e===t||qn(e,t)&&e.unit===t.unit}function xJ(e,t){return e===t||qn(e,t)&&e.listSize===t.listSize&&e.children.length===t.children.length&&Ys.compareManyFields(e.children,t.children)}function _J(e,t){return e===t||qn(e,t)&&e.keysSorted===t.keysSorted&&e.children.length===t.children.length&&Ys.compareManyFields(e.children,t.children)}Nt.prototype.visitNull=Ag;Nt.prototype.visitBool=Ag;Nt.prototype.visitInt=Ec;Nt.prototype.visitInt8=Ec;Nt.prototype.visitInt16=Ec;Nt.prototype.visitInt32=Ec;Nt.prototype.visitInt64=Ec;Nt.prototype.visitUint8=Ec;Nt.prototype.visitUint16=Ec;Nt.prototype.visitUint32=Ec;Nt.prototype.visitUint64=Ec;Nt.prototype.visitFloat=qw;Nt.prototype.visitFloat16=qw;Nt.prototype.visitFloat32=qw;Nt.prototype.visitFloat64=qw;Nt.prototype.visitUtf8=Ag;Nt.prototype.visitBinary=Ag;Nt.prototype.visitFixedSizeBinary=mJ;Nt.prototype.visitDate=HE;Nt.prototype.visitDateDay=HE;Nt.prototype.visitDateMillisecond=HE;Nt.prototype.visitTimestamp=Mg;Nt.prototype.visitTimestampSecond=Mg;Nt.prototype.visitTimestampMillisecond=Mg;Nt.prototype.visitTimestampMicrosecond=Mg;Nt.prototype.visitTimestampNanosecond=Mg;Nt.prototype.visitTime=Eg;Nt.prototype.visitTimeSecond=Eg;Nt.prototype.visitTimeMillisecond=Eg;Nt.prototype.visitTimeMicrosecond=Eg;Nt.prototype.visitTimeNanosecond=Eg;Nt.prototype.visitDecimal=Ag;Nt.prototype.visitList=yJ;Nt.prototype.visitStruct=gJ;Nt.prototype.visitUnion=ZE;Nt.prototype.visitDenseUnion=ZE;Nt.prototype.visitSparseUnion=ZE;Nt.prototype.visitDictionary=bJ;Nt.prototype.visitInterval=KE;Nt.prototype.visitIntervalDayTime=KE;Nt.prototype.visitIntervalYearMonth=KE;Nt.prototype.visitDuration=Dg;Nt.prototype.visitDurationSecond=Dg;Nt.prototype.visitDurationMillisecond=Dg;Nt.prototype.visitDurationMicrosecond=Dg;Nt.prototype.visitDurationNanosecond=Dg;Nt.prototype.visitFixedSizeList=xJ;Nt.prototype.visitMap=_J;var Ys=new Nt;function Tf(e,t){return Ys.compareSchemas(e,t)}function R5(e,t){return Ys.compareFields(e,t)}function k5(e,t){return Ys.visit(e,t)}function vf(e){let t=e.type,r=new(L5.getVisitFn(t)())(e);if(t.children&&t.children.length>0){let n=e.children||[],i={nullValues:e.nullValues},o=Array.isArray(n)?(s,a)=>n[a]||i:({name:s})=>n[s]||i;for(let[s,a]of t.children.entries()){let{type:c}=a,l=o(a,s);r.children.push(vf(Object.assign(Object.assign({},l),{type:c})))}}return r}function Yw(e,t){return wJ(e,t.map(r=>r.data.concat()))}function wJ(e,t){let r=[...e.fields],n=[],i={numBatches:t.reduce((f,d)=>Math.max(f,d.length),0)},o=0,s=0,a=-1,c=t.length,l,u=[];for(;i.numBatches-- >0;){for(s=Number.POSITIVE_INFINITY,a=-1;++a<c;)u[a]=l=t[a].shift(),s=Math.min(s,l?l.length:s);Number.isFinite(s)&&(u=vJ(r,s,u,t,i),s>0&&(n[o++]=Ht({type:new qe(r),length:s,nullCount:0,children:u.slice()})))}return[e=e.assign(r),n.map(f=>new hr(e,f))]}function vJ(e,t,r,n,i){var o;let s=(t+63&-64)>>3;for(let a=-1,c=n.length;++a<c;){let l=r[a],u=l?.length;if(u>=t)u===t?r[a]=l:(r[a]=l.slice(0,t),i.numBatches=Math.max(i.numBatches,n[a].unshift(l.slice(t,u-t))));else{let f=e[a];e[a]=f.clone({nullable:!0}),r[a]=(o=l?._changeLengthAndBackfillNullBitmap(t))!==null&&o!==void 0?o:Ht({type:f.type,length:t,nullCount:t,nullBitmap:new Uint8Array(s)})}}return r}var C5,Yn=class e{constructor(...t){var r,n;if(t.length===0)return this.batches=[],this.schema=new Te([]),this._offsets=[0],this;let i,o;t[0]instanceof Te&&(i=t.shift()),t.at(-1)instanceof Uint32Array&&(o=t.pop());let s=c=>{if(c){if(c instanceof hr)return[c];if(c instanceof e)return c.batches;if(c instanceof De){if(c.type instanceof qe)return[new hr(new Te(c.type.children),c)]}else{if(Array.isArray(c))return c.flatMap(l=>s(l));if(typeof c[Symbol.iterator]=="function")return[...c].flatMap(l=>s(l));if(typeof c=="object"){let l=Object.keys(c),u=l.map(h=>new ue([c[h]])),f=new Te(l.map((h,p)=>new ne(String(h),u[p].type))),[,d]=Yw(f,u);return d.length===0?[new hr(c)]:d}}}return[]},a=t.flatMap(c=>s(c));if(i=(n=i??((r=a[0])===null||r===void 0?void 0:r.schema))!==null&&n!==void 0?n:new Te([]),!(i instanceof Te))throw new TypeError("Table constructor expects a [Schema, RecordBatch[]] pair.");for(let c of a){if(!(c instanceof hr))throw new TypeError("Table constructor expects a [Schema, RecordBatch[]] pair.");if(!Tf(i,c.schema))throw new TypeError("Table and inner RecordBatch schemas must be equivalent.")}this.schema=i,this.batches=a,this._offsets=o??yw(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,r)=>t+r.length,0)}get nullCount(){return this._nullCount===-1&&(this._nullCount=mw(this.data)),this._nullCount}isValid(t){return!1}get(t){return null}set(t,r){}indexOf(t,r){return-1}getByteLength(t){return 0}[Symbol.iterator](){return this.batches.length>0?uh.visit(new ue(this.data)):new Array(0)[Symbol.iterator]()}toArray(){return[...this]}toString(){return`[
18
+ ${this.toArray().join(`,
19
+ `)}
20
+ ]`}concat(...t){let r=this.schema,n=this.data.concat(t.flatMap(({data:i})=>i));return new e(r,n.map(i=>new hr(r,i)))}slice(t,r){let n=this.schema;[t,r]=zy({length:this.numRows},t,r);let i=gw(this.data,this._offsets,t,r);return new e(n,i.map(o=>new hr(n,o)))}getChild(t){return this.getChildAt(this.schema.fields.findIndex(r=>r.name===t))}getChildAt(t){if(t>-1&&t<this.schema.fields.length){let r=this.data.map(n=>n.children[t]);if(r.length===0){let{type:n}=this.schema.fields[t],i=Ht({type:n,length:0,nullCount:0});r.push(i._changeLengthAndBackfillNullBitmap(this.numRows))}return new ue(r)}return null}setChild(t,r){var n;return this.setChildAt((n=this.schema.fields)===null||n===void 0?void 0:n.findIndex(i=>i.name===t),r)}setChildAt(t,r){let n=this.schema,i=[...this.batches];if(t>-1&&t<this.numCols){r||(r=new ue([Ht({type:new jn,length:this.numRows})]));let o=n.fields.slice(),s=o[t].clone({type:r.type}),a=this.schema.fields.map((c,l)=>this.getChildAt(l));[o[t],a[t]]=[s,r],[n,i]=Yw(n,a)}return new e(n,i)}select(t){let r=this.schema.fields.reduce((n,i,o)=>n.set(i.name,o),new Map);return this.selectAt(t.map(n=>r.get(n)).filter(n=>n>-1))}selectAt(t){let r=this.schema.selectAt(t),n=this.batches.map(i=>i.selectAt(t));return new e(r,n)}assign(t){let r=this.schema.fields,[n,i]=t.schema.fields.reduce((a,c,l)=>{let[u,f]=a,d=r.findIndex(h=>h.name===c.name);return~d?f[d]=l:u.push(l),a},[[],[]]),o=this.schema.assign(t.schema),s=[...r.map((a,c)=>[c,i[c]]).map(([a,c])=>c===void 0?this.getChildAt(a):t.getChildAt(c)),...n.map(a=>t.getChildAt(a))].filter(Boolean);return new e(...Yw(o,s))}};C5=Symbol.toStringTag;Yn[C5]=(e=>(e.schema=null,e.batches=[],e._offsets=new Uint32Array([0]),e._nullCount=-1,e[Symbol.isConcatSpreadable]=!0,e.isValid=Cl(qy),e.get=Cl(Dr.getVisitFn(N.Struct)),e.set=bw(fn.getVisitFn(N.Struct)),e.indexOf=xw(bf.getVisitFn(N.Struct)),e.getByteLength=Cl(Pi.getVisitFn(N.Struct)),"Table"))(Yn.prototype);var P5,hr=class e{constructor(...t){switch(t.length){case 2:{if([this.schema]=t,!(this.schema instanceof Te))throw new TypeError("RecordBatch constructor expects a [Schema, Data] pair.");if([,this.data=Ht({nullCount:0,type:new qe(this.schema.fields),children:this.schema.fields.map(r=>Ht({type:r.type,nullCount:0}))})]=t,!(this.data instanceof De))throw new TypeError("RecordBatch constructor expects a [Schema, Data] pair.");[this.schema,this.data]=U5(this.schema,this.data.children);break}case 1:{let[r]=t,{fields:n,children:i,length:o}=Object.keys(r).reduce((c,l,u)=>(c.children[u]=r[l],c.length=Math.max(c.length,r[l].length),c.fields[u]=ne.new({name:l,type:r[l].type,nullable:!0}),c),{length:0,fields:new Array,children:new Array}),s=new Te(n),a=Ht({type:new qe(n),length:o,children:i,nullCount:0});[this.schema,this.data]=U5(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=$5(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 Dr.visit(this.data,t)}set(t,r){return fn.visit(this.data,t,r)}indexOf(t,r){return bf.visit(this.data,t,r)}getByteLength(t){return Pi.visit(this.data,t)}[Symbol.iterator](){return uh.visit(new ue([this.data]))}toArray(){return[...this]}concat(...t){return new Yn(this.schema,[this,...t])}slice(t,r){let[n]=new ue([this.data]).slice(t,r).data;return new e(this.schema,n)}getChild(t){var r;return this.getChildAt((r=this.schema.fields)===null||r===void 0?void 0:r.findIndex(n=>n.name===t))}getChildAt(t){return t>-1&&t<this.schema.fields.length?new ue([this.data.children[t]]):null}setChild(t,r){var n;return this.setChildAt((n=this.schema.fields)===null||n===void 0?void 0:n.findIndex(i=>i.name===t),r)}setChildAt(t,r){let n=this.schema,i=this.data;if(t>-1&&t<this.numCols){r||(r=new ue([Ht({type:new jn,length:this.numRows})]));let o=n.fields.slice(),s=i.children.slice(),a=o[t].clone({type:r.type});[o[t],s[t]]=[a,r.data[0]],n=new Te(o,new Map(this.schema.metadata)),i=Ht({type:new qe(o),children:s})}return new e(n,i)}select(t){let r=this.schema.select(t),n=new qe(r.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(r,Ht({type:n,length:this.numRows,children:i}))}selectAt(t){let r=this.schema.selectAt(t),n=t.map(o=>this.data.children[o]).filter(Boolean),i=Ht({type:new qe(r.fields),length:this.numRows,children:n});return new e(r,i)}};P5=Symbol.toStringTag;hr[P5]=(e=>(e._nullCount=-1,e[Symbol.isConcatSpreadable]=!0,"RecordBatch"))(hr.prototype);function U5(e,t,r=t.reduce((n,i)=>Math.max(n,i.length),0)){var n;let i=[...e.fields],o=[...t],s=(r+63&-64)>>3;for(let[a,c]of e.fields.entries()){let l=t[a];(!l||l.length!==r)&&(i[a]=c.clone({nullable:!0}),o[a]=(n=l?._changeLengthAndBackfillNullBitmap(r))!==null&&n!==void 0?n:Ht({type:c.type,length:r,nullCount:r,nullBitmap:new Uint8Array(s)}))}return[e.assign(i),Ht({type:new qe(i),length:r,children:o})]}function $5(e,t,r=new Map){var n,i;if(((n=e?.length)!==null&&n!==void 0?n: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)||[]])$5(a.children,l?.children,r);if(ht.isDictionary(a)){let{id:l}=a;if(!r.has(l))c?.dictionary&&r.set(l,c.dictionary);else if(r.get(l)!==c.dictionary)throw new Error("Cannot create Schema containing two different dictionaries with the same Id")}}return r}var Af=class extends hr{constructor(t){let r=t.fields.map(i=>Ht({type:i.type})),n=Ht({type:new qe(t.fields),nullCount:0,children:r});super(t,n)}};var Bg;(function(e){e[e.BUFFER=0]="BUFFER"})(Bg||(Bg={}));var Og;(function(e){e[e.LZ4_FRAME=0]="LZ4_FRAME",e[e.ZSTD=1]="ZSTD"})(Og||(Og={}));var Ww=class e{constructor(){this.bb=null,this.bb_pos=0}__init(t,r){return this.bb_pos=t,this.bb=r,this}static getRootAsBodyCompression(t,r){return(r||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsBodyCompression(t,r){return t.setPosition(t.position()+4),(r||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):Og.LZ4_FRAME}method(){let t=this.bb.__offset(this.bb_pos,6);return t?this.bb.readInt8(this.bb_pos+t):Bg.BUFFER}static startBodyCompression(t){t.startObject(2)}static addCodec(t,r){t.addFieldInt8(0,r,Og.LZ4_FRAME)}static addMethod(t,r){t.addFieldInt8(1,r,Bg.BUFFER)}static endBodyCompression(t){return t.endObject()}static createBodyCompression(t,r,n){return e.startBodyCompression(t),e.addCodec(t,r),e.addMethod(t,n),e.endBodyCompression(t)}};var gh=class{constructor(){this.bb=null,this.bb_pos=0}__init(t,r){return this.bb_pos=t,this.bb=r,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,r,n){return t.prep(8,16),t.writeInt64(BigInt(n??0)),t.writeInt64(BigInt(r??0)),t.offset()}};var bh=class{constructor(){this.bb=null,this.bb_pos=0}__init(t,r){return this.bb_pos=t,this.bb=r,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,r,n){return t.prep(8,16),t.writeInt64(BigInt(n??0)),t.writeInt64(BigInt(r??0)),t.offset()}};var zi=class e{constructor(){this.bb=null,this.bb_pos=0}__init(t,r){return this.bb_pos=t,this.bb=r,this}static getRootAsRecordBatch(t,r){return(r||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsRecordBatch(t,r){return t.setPosition(t.position()+4),(r||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,r){let n=this.bb.__offset(this.bb_pos,6);return n?(r||new bh).__init(this.bb.__vector(this.bb_pos+n)+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,r){let n=this.bb.__offset(this.bb_pos,8);return n?(r||new gh).__init(this.bb.__vector(this.bb_pos+n)+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 r=this.bb.__offset(this.bb_pos,10);return r?(t||new Ww).__init(this.bb.__indirect(this.bb_pos+r),this.bb):null}static startRecordBatch(t){t.startObject(4)}static addLength(t,r){t.addFieldInt64(0,r,BigInt("0"))}static addNodes(t,r){t.addFieldOffset(1,r,0)}static startNodesVector(t,r){t.startVector(16,r,8)}static addBuffers(t,r){t.addFieldOffset(2,r,0)}static startBuffersVector(t,r){t.startVector(16,r,8)}static addCompression(t,r){t.addFieldOffset(3,r,0)}static endRecordBatch(t){return t.endObject()}};var Dc=class e{constructor(){this.bb=null,this.bb_pos=0}__init(t,r){return this.bb_pos=t,this.bb=r,this}static getRootAsDictionaryBatch(t,r){return(r||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsDictionaryBatch(t,r){return t.setPosition(t.position()+4),(r||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 r=this.bb.__offset(this.bb_pos,6);return r?(t||new zi).__init(this.bb.__indirect(this.bb_pos+r),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,r){t.addFieldInt64(0,r,BigInt("0"))}static addData(t,r){t.addFieldOffset(1,r,0)}static addIsDelta(t,r){t.addFieldInt8(2,+r,0)}static endDictionaryBatch(t){return t.endObject()}};var xh;(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"})(xh||(xh={}));var us=class e{constructor(){this.bb=null,this.bb_pos=0}__init(t,r){return this.bb_pos=t,this.bb=r,this}static getRootAsMessage(t,r){return(r||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsMessage(t,r){return t.setPosition(t.position()+4),(r||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):Pl.V1}headerType(){let t=this.bb.__offset(this.bb_pos,6);return t?this.bb.readUint8(this.bb_pos+t):xh.NONE}header(t){let r=this.bb.__offset(this.bb_pos,8);return r?this.bb.__union(t,this.bb_pos+r):null}bodyLength(){let t=this.bb.__offset(this.bb_pos,10);return t?this.bb.readInt64(this.bb_pos+t):BigInt("0")}customMetadata(t,r){let n=this.bb.__offset(this.bb_pos,12);return n?(r||new jr).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+n)+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,r){t.addFieldInt16(0,r,Pl.V1)}static addHeaderType(t,r){t.addFieldInt8(1,r,xh.NONE)}static addHeader(t,r){t.addFieldOffset(2,r,0)}static addBodyLength(t,r){t.addFieldInt64(3,r,BigInt("0"))}static addCustomMetadata(t,r){t.addFieldOffset(4,r,0)}static createCustomMetadataVector(t,r){t.startVector(4,r.length,4);for(let n=r.length-1;n>=0;n--)t.addOffset(r[n]);return t.endVector()}static startCustomMetadataVector(t,r){t.startVector(4,r,4)}static endMessage(t){return t.endObject()}static finishMessageBuffer(t,r){t.finish(r)}static finishSizePrefixedMessageBuffer(t,r){t.finish(r,void 0,!0)}static createMessage(t,r,n,i,o,s){return e.startMessage(t),e.addVersion(t,r),e.addHeaderType(t,n),e.addHeader(t,i),e.addBodyLength(t,o),e.addCustomMetadata(t,s),e.endMessage(t)}};var QE=class extends mt{visit(t,r){return t==null||r==null?void 0:super.visit(t,r)}visitNull(t,r){return Qy.startNull(r),Qy.endNull(r)}visitInt(t,r){return as.startInt(r),as.addBitWidth(r,t.bitWidth),as.addIsSigned(r,t.isSigned),as.endInt(r)}visitFloat(t,r){return Yl.startFloatingPoint(r),Yl.addPrecision(r,t.precision),Yl.endFloatingPoint(r)}visitBinary(t,r){return Wy.startBinary(r),Wy.endBinary(r)}visitBool(t,r){return Gy.startBool(r),Gy.endBool(r)}visitUtf8(t,r){return eg.startUtf8(r),eg.endUtf8(r)}visitDecimal(t,r){return Vs.startDecimal(r),Vs.addScale(r,t.scale),Vs.addPrecision(r,t.precision),Vs.addBitWidth(r,t.bitWidth),Vs.endDecimal(r)}visitDate(t,r){return zl.startDate(r),zl.addUnit(r,t.unit),zl.endDate(r)}visitTime(t,r){return xc.startTime(r),xc.addUnit(r,t.unit),xc.addBitWidth(r,t.bitWidth),xc.endTime(r)}visitTimestamp(t,r){let n=t.timezone&&r.createString(t.timezone)||void 0;return _c.startTimestamp(r),_c.addUnit(r,t.unit),n!==void 0&&_c.addTimezone(r,n),_c.endTimestamp(r)}visitInterval(t,r){return Wl.startInterval(r),Wl.addUnit(r,t.unit),Wl.endInterval(r)}visitDuration(t,r){return Vl.startDuration(r),Vl.addUnit(r,t.unit),Vl.endDuration(r)}visitList(t,r){return Ky.startList(r),Ky.endList(r)}visitStruct(t,r){return Jy.startStruct_(r),Jy.endStruct_(r)}visitUnion(t,r){ls.startTypeIdsVector(r,t.typeIds.length);let n=ls.createTypeIdsVector(r,t.typeIds);return ls.startUnion(r),ls.addMode(r,t.mode),ls.addTypeIds(r,n),ls.endUnion(r)}visitDictionary(t,r){let n=this.visit(t.indices,r);return zs.startDictionaryEncoding(r),zs.addId(r,BigInt(t.id)),zs.addIsOrdered(r,t.isOrdered),n!==void 0&&zs.addIndexType(r,n),zs.endDictionaryEncoding(r)}visitFixedSizeBinary(t,r){return jl.startFixedSizeBinary(r),jl.addByteWidth(r,t.byteWidth),jl.endFixedSizeBinary(r)}visitFixedSizeList(t,r){return ql.startFixedSizeList(r),ql.addListSize(r,t.listSize),ql.endFixedSizeList(r)}visitMap(t,r){return Gl.startMap(r),Gl.addKeysSorted(r,t.keysSorted),Gl.endMap(r)}},Gw=new QE;function q5(e,t=new Map){return new Te(IJ(e,t),Xw(e.metadata),t)}function JE(e){return new dn(e.count,W5(e.columns),G5(e.columns))}function Y5(e){return new wi(JE(e.data),e.id,e.isDelta)}function IJ(e,t){return(e.fields||[]).filter(Boolean).map(r=>ne.fromJSON(r,t))}function z5(e,t){return(e.children||[]).filter(Boolean).map(r=>ne.fromJSON(r,t))}function W5(e){return(e||[]).reduce((t,r)=>[...t,new yo(r.count,TJ(r.VALIDITY)),...W5(r.children)],[])}function G5(e,t=[]){for(let r=-1,n=(e||[]).length;++r<n;){let i=e[r];i.VALIDITY&&t.push(new _i(t.length,i.VALIDITY.length)),i.TYPE_ID&&t.push(new _i(t.length,i.TYPE_ID.length)),i.OFFSET&&t.push(new _i(t.length,i.OFFSET.length)),i.DATA&&t.push(new _i(t.length,i.DATA.length)),t=G5(i.children,t)}return t}function TJ(e){return(e||[]).reduce((t,r)=>t+ +(r===0),0)}function X5(e,t){let r,n,i,o,s,a;return!t||!(o=e.dictionary)?(s=j5(e,z5(e,t)),i=new ne(e.name,s,e.nullable,Xw(e.metadata))):t.has(r=o.id)?(n=(n=o.indexType)?V5(n):new Cs,a=new Ci(t.get(r),n,r,o.isOrdered),i=new ne(e.name,a,e.nullable,Xw(e.metadata))):(n=(n=o.indexType)?V5(n):new Cs,t.set(r,s=j5(e,z5(e,t))),a=new Ci(s,n,r,o.isOrdered),i=new ne(e.name,a,e.nullable,Xw(e.metadata))),i||null}function Xw(e=[]){return new Map(e.map(({key:t,value:r})=>[t,r]))}function V5(e){return new xr(e.isSigned,e.bitWidth)}function j5(e,t){let r=e.type.name;switch(r){case"NONE":return new jn;case"null":return new jn;case"binary":return new cc;case"utf8":return new lc;case"bool":return new uc;case"list":return new rs((t||[])[0]);case"struct":return new qe(t||[]);case"struct_":return new qe(t||[])}switch(r){case"int":{let n=e.type;return new xr(n.isSigned,n.bitWidth)}case"floatingpoint":{let n=e.type;return new bi(Xe[n.precision])}case"decimal":{let n=e.type;return new fc(n.scale,n.precision,n.bitWidth)}case"date":{let n=e.type;return new dc(un[n.unit])}case"time":{let n=e.type;return new es(It[n.unit],n.bitWidth)}case"timestamp":{let n=e.type;return new hc(It[n.unit],n.timezone)}case"interval":{let n=e.type;return new pc(Vn[n.unit])}case"duration":{let n=e.type;return new mc(It[n.unit])}case"union":{let n=e.type,[i,...o]=(n.mode+"").toLowerCase(),s=i.toUpperCase()+o.join("");return new ns(je[s],n.typeIds||[],t||[])}case"fixedsizebinary":{let n=e.type;return new yc(n.byteWidth)}case"fixedsizelist":{let n=e.type;return new is(n.listSize,(t||[])[0])}case"map":{let n=e.type;return new os((t||[])[0],n.keysSorted)}}throw new Error(`Unrecognized type: "${r}"`)}var AJ=Lo,MJ=Ar,vi=class e{static fromJSON(t,r){let n=new e(0,er.V5,r);return n._createHeader=EJ(t,r),n}static decode(t){t=new MJ(Xt(t));let r=us.getRootAsMessage(t),n=r.bodyLength(),i=r.version(),o=r.headerType(),s=new e(n,i,o);return s._createHeader=DJ(r,o),s}static encode(t){let r=new AJ,n=-1;return t.isSchema()?n=Te.encode(r,t.header()):t.isRecordBatch()?n=dn.encode(r,t.header()):t.isDictionaryBatch()&&(n=wi.encode(r,t.header())),us.startMessage(r),us.addVersion(r,er.V5),us.addHeader(r,n),us.addHeaderType(r,t.headerType),us.addBodyLength(r,BigInt(t.bodyLength)),us.finishMessageBuffer(r,us.endMessage(r)),r.asUint8Array()}static from(t,r=0){if(t instanceof Te)return new e(0,er.V5,ge.Schema,t);if(t instanceof dn)return new e(r,er.V5,ge.RecordBatch,t);if(t instanceof wi)return new e(r,er.V5,ge.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===ge.Schema}isRecordBatch(){return this.headerType===ge.RecordBatch}isDictionaryBatch(){return this.headerType===ge.DictionaryBatch}constructor(t,r,n,i){this._version=r,this._headerType=n,this.body=new Uint8Array(0),i&&(this._createHeader=()=>i),this._bodyLength=gi(t)}},dn=class{get nodes(){return this._nodes}get length(){return this._length}get buffers(){return this._buffers}constructor(t,r,n){this._nodes=r,this._buffers=n,this._length=gi(t)}},wi=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,r,n=!1){this._data=t,this._isDelta=n,this._id=gi(r)}},_i=class{constructor(t,r){this.offset=gi(t),this.length=gi(r)}},yo=class{constructor(t,r){this.length=gi(t),this.nullCount=gi(r)}};function EJ(e,t){return()=>{switch(t){case ge.Schema:return Te.fromJSON(e);case ge.RecordBatch:return dn.fromJSON(e);case ge.DictionaryBatch:return wi.fromJSON(e)}throw new Error(`Unrecognized Message type: { name: ${ge[t]}, type: ${t} }`)}}function DJ(e,t){return()=>{switch(t){case ge.Schema:return Te.decode(e.header(new xi),new Map,e.version());case ge.RecordBatch:return dn.decode(e.header(new zi),e.version());case ge.DictionaryBatch:return wi.decode(e.header(new Dc),e.version())}throw new Error(`Unrecognized Message type: { name: ${ge[t]}, type: ${t} }`)}}ne.encode=$J;ne.decode=UJ;ne.fromJSON=X5;Te.encode=PJ;Te.decode=BJ;Te.fromJSON=q5;dn.encode=zJ;dn.decode=OJ;dn.fromJSON=JE;wi.encode=VJ;wi.decode=NJ;wi.fromJSON=Y5;yo.encode=jJ;yo.decode=LJ;_i.encode=qJ;_i.decode=FJ;function BJ(e,t=new Map,r=er.V5){let n=CJ(e,t);return new Te(n,Hw(e),t,r)}function OJ(e,t=er.V5){if(e.compression()!==null)throw new Error("Record batch compression not implemented");return new dn(e.length(),RJ(e),kJ(e,t))}function NJ(e,t=er.V5){return new wi(dn.decode(e.data(),t),e.id(),e.isDelta())}function FJ(e){return new _i(e.offset(),e.length())}function LJ(e){return new yo(e.length(),e.nullCount())}function RJ(e){let t=[];for(let r,n=-1,i=-1,o=e.nodesLength();++n<o;)(r=e.nodes(n))&&(t[++i]=yo.decode(r));return t}function kJ(e,t){let r=[];for(let n,i=-1,o=-1,s=e.buffersLength();++i<s;)(n=e.buffers(i))&&(t<er.V4&&(n.bb_pos+=8*(i+1)),r[++o]=_i.decode(n));return r}function CJ(e,t){let r=[];for(let n,i=-1,o=-1,s=e.fieldsLength();++i<s;)(n=e.fields(i))&&(r[++o]=ne.decode(n,t));return r}function H5(e,t){let r=[];for(let n,i=-1,o=-1,s=e.childrenLength();++i<s;)(n=e.children(i))&&(r[++o]=ne.decode(n,t));return r}function UJ(e,t){let r,n,i,o,s,a;return!t||!(a=e.dictionary())?(i=K5(e,H5(e,t)),n=new ne(e.name(),i,e.nullable(),Hw(e))):t.has(r=gi(a.id()))?(o=(o=a.indexType())?Z5(o):new Cs,s=new Ci(t.get(r),o,r,a.isOrdered()),n=new ne(e.name(),s,e.nullable(),Hw(e))):(o=(o=a.indexType())?Z5(o):new Cs,t.set(r,i=K5(e,H5(e,t))),s=new Ci(i,o,r,a.isOrdered()),n=new ne(e.name(),s,e.nullable(),Hw(e))),n||null}function Hw(e){let t=new Map;if(e)for(let r,n,i=-1,o=Math.trunc(e.customMetadataLength());++i<o;)(r=e.customMetadata(i))&&(n=r.key())!=null&&t.set(n,r.value());return t}function Z5(e){return new xr(e.isSigned(),e.bitWidth())}function K5(e,t){let r=e.typeType();switch(r){case Ye.NONE:return new jn;case Ye.Null:return new jn;case Ye.Binary:return new cc;case Ye.Utf8:return new lc;case Ye.Bool:return new uc;case Ye.List:return new rs((t||[])[0]);case Ye.Struct_:return new qe(t||[])}switch(r){case Ye.Int:{let n=e.type(new as);return new xr(n.isSigned(),n.bitWidth())}case Ye.FloatingPoint:{let n=e.type(new Yl);return new bi(n.precision())}case Ye.Decimal:{let n=e.type(new Vs);return new fc(n.scale(),n.precision(),n.bitWidth())}case Ye.Date:{let n=e.type(new zl);return new dc(n.unit())}case Ye.Time:{let n=e.type(new xc);return new es(n.unit(),n.bitWidth())}case Ye.Timestamp:{let n=e.type(new _c);return new hc(n.unit(),n.timezone())}case Ye.Interval:{let n=e.type(new Wl);return new pc(n.unit())}case Ye.Duration:{let n=e.type(new Vl);return new mc(n.unit())}case Ye.Union:{let n=e.type(new ls);return new ns(n.mode(),n.typeIdsArray()||[],t||[])}case Ye.FixedSizeBinary:{let n=e.type(new jl);return new yc(n.byteWidth())}case Ye.FixedSizeList:{let n=e.type(new ql);return new is(n.listSize(),(t||[])[0])}case Ye.Map:{let n=e.type(new Gl);return new os((t||[])[0],n.keysSorted())}}throw new Error(`Unrecognized type: "${Ye[r]}" (${r})`)}function PJ(e,t){let r=t.fields.map(o=>ne.encode(e,o));xi.startFieldsVector(e,r.length);let n=xi.createFieldsVector(e,r),i=t.metadata&&t.metadata.size>0?xi.createCustomMetadataVector(e,[...t.metadata].map(([o,s])=>{let a=e.createString(`${o}`),c=e.createString(`${s}`);return jr.startKeyValue(e),jr.addKey(e,a),jr.addValue(e,c),jr.endKeyValue(e)})):-1;return xi.startSchema(e),xi.addFields(e,n),xi.addEndianness(e,YJ?$l.Little:$l.Big),i!==-1&&xi.addCustomMetadata(e,i),xi.endSchema(e)}function $J(e,t){let r=-1,n=-1,i=-1,o=t.type,s=t.typeId;ht.isDictionary(o)?(s=o.dictionary.typeId,i=Gw.visit(o,e),n=Gw.visit(o.dictionary,e)):n=Gw.visit(o,e);let a=(o.children||[]).map(u=>ne.encode(e,u)),c=An.createChildrenVector(e,a),l=t.metadata&&t.metadata.size>0?An.createCustomMetadataVector(e,[...t.metadata].map(([u,f])=>{let d=e.createString(`${u}`),h=e.createString(`${f}`);return jr.startKeyValue(e),jr.addKey(e,d),jr.addValue(e,h),jr.endKeyValue(e)})):-1;return t.name&&(r=e.createString(t.name)),An.startField(e),An.addType(e,n),An.addTypeType(e,s),An.addChildren(e,c),An.addNullable(e,!!t.nullable),r!==-1&&An.addName(e,r),i!==-1&&An.addDictionary(e,i),l!==-1&&An.addCustomMetadata(e,l),An.endField(e)}function zJ(e,t){let r=t.nodes||[],n=t.buffers||[];zi.startNodesVector(e,r.length);for(let s of r.slice().reverse())yo.encode(e,s);let i=e.endVector();zi.startBuffersVector(e,n.length);for(let s of n.slice().reverse())_i.encode(e,s);let o=e.endVector();return zi.startRecordBatch(e),zi.addLength(e,BigInt(t.length)),zi.addNodes(e,i),zi.addBuffers(e,o),zi.endRecordBatch(e)}function VJ(e,t){let r=dn.encode(e,t.data);return Dc.startDictionaryBatch(e),Dc.addId(e,BigInt(t.id)),Dc.addIsDelta(e,t.isDelta),Dc.addData(e,r),Dc.endDictionaryBatch(e)}function jJ(e,t){return bh.createFieldNode(e,BigInt(t.length),BigInt(t.nullCount))}function qJ(e,t){return gh.createBuffer(e,BigInt(t.offset),BigInt(t.length))}var YJ=(()=>{let e=new ArrayBuffer(2);return new DataView(e).setInt16(0,256,!0),new Int16Array(e)[0]===256})();var eD=e=>`Expected ${ge[e]} Message in stream, but was null or length 0.`,rD=e=>`Header pointer of flatbuffer-encoded ${ge[e]} Message is null or length 0.`,Q5=(e,t)=>`Expected to read ${e} metadata bytes, but only read ${t}.`,J5=(e,t)=>`Expected to read ${e} bytes for message body, but only read ${t}.`,_h=class{constructor(t){this.source=t instanceof qs?t:new qs(t)}[Symbol.iterator](){return this}next(){let t;return(t=this.readMetadataLength()).done?We:t.value===-1&&(t=this.readMetadataLength()).done?We:(t=this.readMetadata(t.value)).done?We:t}throw(t){return this.source.throw(t)}return(t){return this.source.return(t)}readMessage(t){let r;if((r=this.next()).done)return null;if(t!=null&&r.value.headerType!==t)throw new Error(eD(t));return r.value}readMessageBody(t){if(t<=0)return new Uint8Array(0);let r=Xt(this.source.read(t));if(r.byteLength<t)throw new Error(J5(t,r.byteLength));return r.byteOffset%8===0&&r.byteOffset+r.byteLength<=r.buffer.byteLength?r:r.slice()}readSchema(t=!1){let r=ge.Schema,n=this.readMessage(r),i=n?.header();if(t&&!i)throw new Error(rD(r));return i}readMetadataLength(){let t=this.source.read(Zw),r=t&&new Ar(t),n=r?.readInt32(0)||0;return{done:n===0,value:n}}readMetadata(t){let r=this.source.read(t);if(!r)return We;if(r.byteLength<t)throw new Error(Q5(t,r.byteLength));return{done:!1,value:vi.decode(r)}}},Ng=class{constructor(t,r){this.source=t instanceof po?t:F1(t)?new Xl(t,r):new po(t)}[Symbol.asyncIterator](){return this}next(){return P(this,void 0,void 0,function*(){let t;return(t=yield this.readMetadataLength()).done?We:t.value===-1&&(t=yield this.readMetadataLength()).done?We:(t=yield this.readMetadata(t.value)).done?We:t})}throw(t){return P(this,void 0,void 0,function*(){return yield this.source.throw(t)})}return(t){return P(this,void 0,void 0,function*(){return yield this.source.return(t)})}readMessage(t){return P(this,void 0,void 0,function*(){let r;if((r=yield this.next()).done)return null;if(t!=null&&r.value.headerType!==t)throw new Error(eD(t));return r.value})}readMessageBody(t){return P(this,void 0,void 0,function*(){if(t<=0)return new Uint8Array(0);let r=Xt(yield this.source.read(t));if(r.byteLength<t)throw new Error(J5(t,r.byteLength));return r.byteOffset%8===0&&r.byteOffset+r.byteLength<=r.buffer.byteLength?r:r.slice()})}readSchema(t=!1){return P(this,void 0,void 0,function*(){let r=ge.Schema,n=yield this.readMessage(r),i=n?.header();if(t&&!i)throw new Error(rD(r));return i})}readMetadataLength(){return P(this,void 0,void 0,function*(){let t=yield this.source.read(Zw),r=t&&new Ar(t),n=r?.readInt32(0)||0;return{done:n===0,value:n}})}readMetadata(t){return P(this,void 0,void 0,function*(){let r=yield this.source.read(t);if(!r)return We;if(r.byteLength<t)throw new Error(Q5(t,r.byteLength));return{done:!1,value:vi.decode(r)}})}},Fg=class extends _h{constructor(t){super(new Uint8Array(0)),this._schema=!1,this._body=[],this._batchIndex=0,this._dictionaryIndex=0,this._json=t instanceof rg?t:new rg(t)}next(){let{_json:t}=this;if(!this._schema)return this._schema=!0,{done:!1,value:vi.fromJSON(t.schema,ge.Schema)};if(this._dictionaryIndex<t.dictionaries.length){let r=t.dictionaries[this._dictionaryIndex++];return this._body=r.data.columns,{done:!1,value:vi.fromJSON(r,ge.DictionaryBatch)}}if(this._batchIndex<t.batches.length){let r=t.batches[this._batchIndex++];return this._body=r.columns,{done:!1,value:vi.fromJSON(r,ge.RecordBatch)}}return this._body=[],We}readMessageBody(t){return r(this._body);function r(n){return(n||[]).reduce((i,o)=>[...i,...o.VALIDITY&&[o.VALIDITY]||[],...o.TYPE_ID&&[o.TYPE_ID]||[],...o.OFFSET&&[o.OFFSET]||[],...o.DATA&&[o.DATA]||[],...r(o.children)],[])}}readMessage(t){let r;if((r=this.next()).done)return null;if(t!=null&&r.value.headerType!==t)throw new Error(eD(t));return r.value}readSchema(){let t=ge.Schema,r=this.readMessage(t),n=r?.header();if(!r||!n)throw new Error(rD(t));return n}},Zw=4,tD="ARROW1",wh=new Uint8Array(tD.length);for(let e=0;e<tD.length;e+=1)wh[e]=tD.codePointAt(e);function Kw(e,t=0){for(let r=-1,n=wh.length;++r<n;)if(wh[r]!==e[t+r])return!1;return!0}var vh=wh.length,nD=vh+Zw,tP=vh*2+Zw;var hn=class e extends _f{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 r=this._impl.open(t);return Zo(r)?r.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 ln.toDOMStream(this.isSync()?{[Symbol.iterator]:()=>this}:{[Symbol.asyncIterator]:()=>this})}toNodeStream(){return ln.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,r){throw new Error('"throughDOM" not available in this environment')}static from(t){return t instanceof e?t:O1(t)?GJ(t):F1(t)?ZJ(t):Zo(t)?P(this,void 0,void 0,function*(){return yield e.from(yield t)}):L1(t)||Cy(t)||k1(t)||uo(t)?HJ(new po(t)):XJ(new qs(t))}static readAll(t){return t instanceof e?t.isSync()?eP(t):rP(t):O1(t)||ArrayBuffer.isView(t)||Ko(t)||N1(t)?eP(t):rP(t)}},Ws=class extends hn{constructor(t){super(t),this._impl=t}readAll(){return[...this]}[Symbol.iterator](){return this._impl[Symbol.iterator]()}[Symbol.asyncIterator](){return $e(this,arguments,function*(){yield H(yield*Ji(fr(this[Symbol.iterator]())))})}},Hl=class extends hn{constructor(t){super(t),this._impl=t}readAll(){var t,r,n,i;return P(this,void 0,void 0,function*(){let o=new Array;try{for(var s=!0,a=fr(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){r={error:l}}finally{try{!s&&!t&&(n=a.return)&&(yield n.call(a))}finally{if(r)throw r.error}}return o})}[Symbol.iterator](){throw new Error("AsyncRecordBatchStreamReader is not Iterable")}[Symbol.asyncIterator](){return this._impl[Symbol.asyncIterator]()}},Zl=class extends Ws{constructor(t){super(t),this._impl=t}},Lg=class extends Hl{constructor(t){super(t),this._impl=t}},Qw=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,r){let n=this._loadVectors(t,r,this.schema.fields),i=Ht({type:new qe(this.schema.fields),length:t.length,children:n});return new hr(this.schema,i)}_loadDictionaryBatch(t,r){let{id:n,isDelta:i}=t,{dictionaries:o,schema:s}=this,a=o.get(n);if(i||!a){let c=s.dictionaries.get(n),l=this._loadVectors(t.data,r,[c]);return(a&&i?a.concat(new ue(l)):new ue(l)).memoize()}return a.memoize()}_loadVectors(t,r,n){return new sg(r,t.nodes,t.buffers,this.dictionaries,this.schema.metadataVersion).visitMany(n)}},Sh=class extends Qw{constructor(t,r){super(r),this._reader=O1(t)?new Fg(this._handle=t):new _h(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=nP(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):We}return(t){return!this.closed&&this.autoDestroy&&(this.closed=!0)?this.reset()._reader.return(t):We}next(){if(this.closed)return We;let t,{_reader:r}=this;for(;t=this._readNextMessageAndValidate();)if(t.isSchema())this.reset(t.header());else if(t.isRecordBatch()){this._recordBatchIndex++;let n=t.header(),i=r.readMessageBody(t.bodyLength);return{done:!1,value:this._loadRecordBatch(n,i)}}else if(t.isDictionaryBatch()){this._dictionaryIndex++;let n=t.header(),i=r.readMessageBody(t.bodyLength),o=this._loadDictionaryBatch(n,i);this.dictionaries.set(n.id,o)}return this.schema&&this._recordBatchIndex===0?(this._recordBatchIndex++,{done:!1,value:new Af(this.schema)}):this.return()}_readNextMessageAndValidate(t){return this._reader.readMessage(t)}},Ih=class extends Qw{constructor(t,r){super(r),this._reader=new Ng(this._handle=t)}isAsync(){return!0}isStream(){return!0}[Symbol.asyncIterator](){return this}cancel(){return P(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 P(this,void 0,void 0,function*(){return this.closed||(this.autoDestroy=nP(this,t),this.schema||(this.schema=yield this._reader.readSchema())||(yield this.cancel())),this})}throw(t){return P(this,void 0,void 0,function*(){return!this.closed&&this.autoDestroy&&(this.closed=!0)?yield this.reset()._reader.throw(t):We})}return(t){return P(this,void 0,void 0,function*(){return!this.closed&&this.autoDestroy&&(this.closed=!0)?yield this.reset()._reader.return(t):We})}next(){return P(this,void 0,void 0,function*(){if(this.closed)return We;let t,{_reader:r}=this;for(;t=yield this._readNextMessageAndValidate();)if(t.isSchema())yield this.reset(t.header());else if(t.isRecordBatch()){this._recordBatchIndex++;let n=t.header(),i=yield r.readMessageBody(t.bodyLength);return{done:!1,value:this._loadRecordBatch(n,i)}}else if(t.isDictionaryBatch()){this._dictionaryIndex++;let n=t.header(),i=yield r.readMessageBody(t.bodyLength),o=this._loadDictionaryBatch(n,i);this.dictionaries.set(n.id,o)}return this.schema&&this._recordBatchIndex===0?(this._recordBatchIndex++,{done:!1,value:new Af(this.schema)}):yield this.return()})}_readNextMessageAndValidate(t){return P(this,void 0,void 0,function*(){return yield this._reader.readMessage(t)})}},Jw=class extends Sh{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,r){super(t instanceof ng?t:new ng(t),r)}isSync(){return!0}isFile(){return!0}open(t){if(!this.closed&&!this._footer){this.schema=(this._footer=this._readFooter()).schema;for(let r of this._footer.dictionaryBatches())r&&this._readDictionaryBatch(this._dictionaryIndex++)}return super.open(t)}readRecordBatch(t){var r;if(this.closed)return null;this._footer||this.open();let n=(r=this._footer)===null||r===void 0?void 0:r.getRecordBatch(t);if(n&&this._handle.seek(n.offset)){let i=this._reader.readMessage(ge.RecordBatch);if(i?.isRecordBatch()){let o=i.header(),s=this._reader.readMessageBody(i.bodyLength);return this._loadRecordBatch(o,s)}}return null}_readDictionaryBatch(t){var r;let n=(r=this._footer)===null||r===void 0?void 0:r.getDictionaryBatch(t);if(n&&this._handle.seek(n.offset)){let i=this._reader.readMessage(ge.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,r=t.size-nD,n=t.readInt32(r),i=t.readAt(r-n,n);return wc.decode(i)}_readNextMessageAndValidate(t){var r;if(this._footer||this.open(),this._footer&&this._recordBatchIndex<this.numRecordBatches){let n=(r=this._footer)===null||r===void 0?void 0:r.getRecordBatch(this._recordBatchIndex);if(n&&this._handle.seek(n.offset))return this._reader.readMessage(t)}return null}},iD=class extends Ih{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,...r){let n=typeof r[0]!="number"?r.shift():void 0,i=r[0]instanceof Map?r.shift():void 0;super(t instanceof Xl?t:new Xl(t,n),i)}isFile(){return!0}isAsync(){return!0}open(t){let r=Object.create(null,{open:{get:()=>super.open}});return P(this,void 0,void 0,function*(){if(!this.closed&&!this._footer){this.schema=(this._footer=yield this._readFooter()).schema;for(let n of this._footer.dictionaryBatches())n&&(yield this._readDictionaryBatch(this._dictionaryIndex++))}return yield r.open.call(this,t)})}readRecordBatch(t){var r;return P(this,void 0,void 0,function*(){if(this.closed)return null;this._footer||(yield this.open());let n=(r=this._footer)===null||r===void 0?void 0:r.getRecordBatch(t);if(n&&(yield this._handle.seek(n.offset))){let i=yield this._reader.readMessage(ge.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 r;return P(this,void 0,void 0,function*(){let n=(r=this._footer)===null||r===void 0?void 0:r.getDictionaryBatch(t);if(n&&(yield this._handle.seek(n.offset))){let i=yield this._reader.readMessage(ge.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 P(this,void 0,void 0,function*(){let{_handle:t}=this;t._pending&&(yield t._pending);let r=t.size-nD,n=yield t.readInt32(r),i=yield t.readAt(r-n,n);return wc.decode(i)})}_readNextMessageAndValidate(t){return P(this,void 0,void 0,function*(){if(this._footer||(yield this.open()),this._footer&&this._recordBatchIndex<this.numRecordBatches){let r=this._footer.getRecordBatch(this._recordBatchIndex);if(r&&(yield this._handle.seek(r.offset)))return yield this._reader.readMessage(t)}return null})}},oD=class extends Sh{constructor(t,r){super(t,r)}_loadVectors(t,r,n){return new Sw(r,t.nodes,t.buffers,this.dictionaries,this.schema.metadataVersion).visitMany(n)}};function nP(e,t){return t&&typeof t.autoDestroy=="boolean"?t.autoDestroy:e.autoDestroy}function*eP(e){let t=hn.from(e);try{if(!t.open({autoDestroy:!1}).closed)do yield t;while(!t.reset().open().closed)}finally{t.cancel()}}function rP(e){return $e(this,arguments,function*(){let r=yield H(hn.from(e));try{if(!(yield H(r.open({autoDestroy:!1}))).closed)do yield yield H(r);while(!(yield H(r.reset().open())).closed)}finally{yield H(r.cancel())}})}function GJ(e){return new Ws(new oD(e))}function XJ(e){let t=e.peek(vh+7&-8);return t&&t.byteLength>=4?Kw(t)?new Zl(new Jw(e.read())):new Ws(new Sh(e)):new Ws(new Sh(function*(){}()))}function HJ(e){return P(this,void 0,void 0,function*(){let t=yield e.peek(vh+7&-8);return t&&t.byteLength>=4?Kw(t)?new Zl(new Jw(yield e.read())):new Hl(new Ih(e)):new Hl(new Ih(function(){return $e(this,arguments,function*(){})}()))})}function ZJ(e){return P(this,void 0,void 0,function*(){let{size:t}=yield e.stat(),r=new Xl(e,t);return t>=tP&&Kw(yield r.readAt(0,vh+7&-8))?new Lg(new iD(r)):new Hl(new Ih(r))})}var pr=class e extends mt{static assemble(...t){let r=i=>i.flatMap(o=>Array.isArray(o)?r(o):o instanceof hr?o.data.children:o.data),n=new e;return n.visitMany(r(t)),n}constructor(){super(),this._byteLength=0,this._nodes=[],this._buffers=[],this._bufferRegions=[]}visit(t){if(t instanceof ue)return this.visitMany(t.data),this;let{type:r}=t;if(!ht.isDictionary(r)){let{length:n}=t;if(n>2147483647)throw new RangeError("Cannot write arrays larger than 2^31 - 1 in length");if(ht.isUnion(r))this.nodes.push(new yo(n,0));else{let{nullCount:i}=t;ht.isNull(r)||fs.call(this,i<=0?new Uint8Array(0):yf(t.offset,n,t.nullBitmap)),this.nodes.push(new yo(n,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 fs(e){let t=e.byteLength+7&-8;return this.buffers.push(e),this.bufferRegions.push(new _i(this._byteLength,t)),this._byteLength+=t,this}function KJ(e){var t;let{type:r,length:n,typeIds:i,valueOffsets:o}=e;if(fs.call(this,i),r.mode===je.Sparse)return sD.call(this,e);if(r.mode===je.Dense){if(e.offset<=0)return fs.call(this,o),sD.call(this,e);{let s=new Int32Array(n),a=Object.create(null),c=Object.create(null);for(let l,u,f=-1;++f<n;)(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);fs.call(this,s),this.visitMany(e.children.map((l,u)=>{let f=r.typeIds[u],d=a[f],h=c[f];return l.slice(d,Math.min(n,h))}))}}return this}function QJ(e){let t;return e.nullCount>=e.length?fs.call(this,new Uint8Array(0)):(t=e.values)instanceof Uint8Array?fs.call(this,yf(e.offset,e.length,t)):fs.call(this,gf(e.values))}function Bc(e){return fs.call(this,e.values.subarray(0,e.length*e.stride))}function iP(e){let{length:t,values:r,valueOffsets:n}=e,{[0]:i,[t]:o}=n,s=Math.min(o-i,r.byteLength-i);return fs.call(this,C1(-i,t+1,n)),fs.call(this,r.subarray(i,i+s)),this}function aD(e){let{length:t,valueOffsets:r}=e;if(r){let{[0]:n,[t]:i}=r;return fs.call(this,C1(-n,t+1,r)),this.visit(e.children[0].slice(n,i-n))}return this.visit(e.children[0])}function sD(e){return this.visitMany(e.type.children.map((t,r)=>e.children[r]).filter(Boolean))[0]}pr.prototype.visitBool=QJ;pr.prototype.visitInt=Bc;pr.prototype.visitFloat=Bc;pr.prototype.visitUtf8=iP;pr.prototype.visitBinary=iP;pr.prototype.visitFixedSizeBinary=Bc;pr.prototype.visitDate=Bc;pr.prototype.visitTimestamp=Bc;pr.prototype.visitTime=Bc;pr.prototype.visitDecimal=Bc;pr.prototype.visitList=aD;pr.prototype.visitStruct=sD;pr.prototype.visitUnion=KJ;pr.prototype.visitInterval=Bc;pr.prototype.visitDuration=Bc;pr.prototype.visitFixedSizeList=aD;pr.prototype.visitMap=aD;var Mf=class extends _f{static throughNode(t){throw new Error('"throughNode" not available in this environment')}static throughDOM(t,r){throw new Error('"throughDOM" not available in this environment')}constructor(t){super(),this._position=0,this._started=!1,this._sink=new js,this._schema=null,this._dictionaryBlocks=[],this._recordBatchBlocks=[],this._dictionaryDeltaOffsets=new Map,zn(t)||(t={autoDestroy:!0,writeLegacyIpcFormat:!1}),this._autoDestroy=typeof t.autoDestroy=="boolean"?t.autoDestroy:!0,this._writeLegacyIpcFormat=typeof t.writeLegacyIpcFormat=="boolean"?t.writeLegacyIpcFormat:!1}toString(t=!1){return this._sink.toString(t)}toUint8Array(t=!1){return this._sink.toUint8Array(t)}writeAll(t){return Zo(t)?t.then(r=>this.writeAll(r)):uo(t)?lD(this,t):cD(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,r=null){return t===this._sink||t instanceof js?this._sink=t:(this._sink=new js,t&&SU(t)?this.toDOMStream({type:"bytes"}).pipeTo(t):t&&IU(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,(!r||!Tf(r,this._schema))&&(r==null?(this._position=0,this._schema=null):(this._started=!0,this._schema=r,this._writeSchema(r))),this}write(t){let r=null;if(this._sink){if(t==null)return this.finish()&&void 0;if(t instanceof Yn&&!(r=t.schema))return this.finish()&&void 0;if(t instanceof hr&&!(r=t.schema))return this.finish()&&void 0}else throw new Error("RecordBatchWriter is closed");if(r&&!Tf(r,this._schema)){if(this._started&&this._autoDestroy)return this.close();this.reset(this._sink,r)}t instanceof hr?t instanceof Af||this._writeRecordBatch(t):t instanceof Yn?this.writeAll(t.batches):Ko(t)&&this.writeAll(t)}_writeMessage(t,r=8){let n=r-1,i=vi.encode(t),o=i.byteLength,s=this._writeLegacyIpcFormat?4:8,a=o+s+n&~n,c=a-o-s;return t.headerType===ge.RecordBatch?this._recordBatchBlocks.push(new vc(a,t.bodyLength,this._position)):t.headerType===ge.DictionaryBatch&&this._dictionaryBlocks.push(new vc(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 r=Xt(t);r&&r.byteLength>0&&(this._sink.write(r),this._position+=r.byteLength)}return this}_writeSchema(t){return this._writeMessage(vi.from(t))}_writeFooter(t){return this._writeLegacyIpcFormat?this._write(Int32Array.of(0)):this._write(Int32Array.of(-1,0))}_writeMagic(){return this._write(wh)}_writePadding(t){return t>0?this._write(new Uint8Array(t)):this}_writeRecordBatch(t){let{byteLength:r,nodes:n,bufferRegions:i,buffers:o}=pr.assemble(t),s=new dn(t.numRows,n,i),a=vi.from(s,r);return this._writeDictionaries(t)._writeMessage(a)._writeBodyBuffers(o)}_writeDictionaryBatch(t,r,n=!1){this._dictionaryDeltaOffsets.set(r,t.length+(this._dictionaryDeltaOffsets.get(r)||0));let{byteLength:i,nodes:o,bufferRegions:s,buffers:a}=pr.assemble(new ue([t])),c=new dn(t.length,o,s),l=new wi(c,r,n),u=vi.from(l,i);return this._writeMessage(u)._writeBodyBuffers(a)}_writeBodyBuffers(t){let r,n,i;for(let o=-1,s=t.length;++o<s;)(r=t[o])&&(n=r.byteLength)>0&&(this._write(r),(i=(n+7&-8)-n)>0&&this._writePadding(i));return this}_writeDictionaries(t){for(let[r,n]of t.dictionaries){let i=this._dictionaryDeltaOffsets.get(r)||0;if(i===0||(n=n?.slice(i)).length>0)for(let o of n.data)this._writeDictionaryBatch(o,r,i>0),i+=o.length}return this}},Ef=class e extends Mf{static writeAll(t,r){let n=new e(r);return Zo(t)?t.then(i=>n.writeAll(i)):uo(t)?lD(n,t):cD(n,t)}},Df=class e extends Mf{static writeAll(t){let r=new e;return Zo(t)?t.then(n=>r.writeAll(n)):uo(t)?lD(r,t):cD(r,t)}constructor(){super(),this._autoDestroy=!0}_writeSchema(t){return this._writeMagic()._writePadding(2)}_writeFooter(t){let r=wc.encode(new wc(t,er.V5,this._recordBatchBlocks,this._dictionaryBlocks));return super._writeFooter(t)._write(r)._write(Int32Array.of(r.byteLength))._writeMagic()}};function cD(e,t){let r=t;t instanceof Yn&&(r=t.batches,e.reset(void 0,t.schema));for(let n of r)e.write(n);return e.finish()}function lD(e,t){var r,n,i,o,s,a,c;return P(this,void 0,void 0,function*(){try{for(r=!0,n=fr(t);i=yield n.next(),o=i.done,!o;r=!0){c=i.value,r=!1;let l=c;e.write(l)}}catch(l){s={error:l}}finally{try{!r&&!o&&(a=n.return)&&(yield a.call(n))}finally{if(s)throw s.error}}return e.finish()})}function oP(e,t){if(uo(e))return ttt(e,t);if(Ko(e))return JJ(e,t);throw new Error("toDOMStream() must be called with an Iterable or AsyncIterable")}function JJ(e,t){let r=null,n=t?.type==="bytes"||!1,i=t?.highWaterMark||Math.pow(2,24);return new ReadableStream(Object.assign(Object.assign({},t),{start(s){o(s,r||(r=e[Symbol.iterator]()))},pull(s){r?o(s,r):s.close()},cancel(){(r?.return&&r.return()||!0)&&(r=null)}}),Object.assign({highWaterMark:n?i:void 0},t));function o(s,a){let c,l=null,u=s.desiredSize||null;for(;!(l=a.next(n?u:null)).done;)if(ArrayBuffer.isView(l.value)&&(c=Xt(l.value))&&(u!=null&&n&&(u=u-c.byteLength+1),l.value=c),s.enqueue(l.value),u!=null&&--u<=0)return;s.close()}}function ttt(e,t){let r=null,n=t?.type==="bytes"||!1,i=t?.highWaterMark||Math.pow(2,24);return new ReadableStream(Object.assign(Object.assign({},t),{start(s){return P(this,void 0,void 0,function*(){yield o(s,r||(r=e[Symbol.asyncIterator]()))})},pull(s){return P(this,void 0,void 0,function*(){r?yield o(s,r):s.close()})},cancel(){return P(this,void 0,void 0,function*(){(r?.return&&(yield r.return())||!0)&&(r=null)})}}),Object.assign({highWaterMark:n?i:void 0},t));function o(s,a){return P(this,void 0,void 0,function*(){let c,l=null,u=s.desiredSize||null;for(;!(l=yield a.next(n?u:null)).done;)if(ArrayBuffer.isView(l.value)&&(c=Xt(l.value))&&(u!=null&&n&&(u=u-c.byteLength+1),l.value=c),s.enqueue(l.value),u!=null&&--u<=0)return;s.close()})}}function cP(e){return new uD(e)}var uD=class{constructor(t){this._numChunks=0,this._finished=!1,this._bufferedSize=0;let{["readableStrategy"]:r,["writableStrategy"]:n,["queueingStrategy"]:i="count"}=t,o=zx(t,["readableStrategy","writableStrategy","queueingStrategy"]);this._controller=null,this._builder=vf(o),this._getSize=i!=="bytes"?sP:aP;let{["highWaterMark"]:s=i==="bytes"?Math.pow(2,14):1e3}=Object.assign({},r),{["highWaterMark"]:a=i==="bytes"?Math.pow(2,14):1e3}=Object.assign({},n);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"?sP:aP}),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 r=this._bufferedSize;return this._bufferedSize=this._getSize(this._builder.append(t)),this._bufferedSize-r}_maybeFlush(t,r){r!=null&&(this._bufferedSize>=r.desiredSize&&++this._numChunks&&this._enqueue(r,t.toVector()),t.finished&&((t.length>0||this._numChunks===0)&&++this._numChunks&&this._enqueue(r,t.toVector()),!this._finished&&(this._finished=!0)&&this._enqueue(r,null)))}_enqueue(t,r){this._bufferedSize=0,this._controller=null,r==null?t.close():t.enqueue(r)}},sP=e=>{var t;return(t=e?.length)!==null&&t!==void 0?t:0},aP=e=>{var t;return(t=e?.byteLength)!==null&&t!==void 0?t:0};function tv(e,t){let r=new js,n=null,i=new ReadableStream({cancel(){return P(this,void 0,void 0,function*(){yield r.close()})},start(a){return P(this,void 0,void 0,function*(){yield s(a,n||(n=yield o()))})},pull(a){return P(this,void 0,void 0,function*(){n?yield s(a,n):a.close()})}});return{writable:new WritableStream(r,Object.assign({highWaterMark:Math.pow(2,14)},e)),readable:i};function o(){return P(this,void 0,void 0,function*(){return yield(yield hn.from(r)).open(t)})}function s(a,c){return P(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 ev(e,t){let r=new this(e),n=new po(r),i=new ReadableStream({cancel(){return P(this,void 0,void 0,function*(){yield n.cancel()})},pull(s){return P(this,void 0,void 0,function*(){yield o(s)})},start(s){return P(this,void 0,void 0,function*(){yield o(s)})}},Object.assign({highWaterMark:Math.pow(2,14)},t));return{writable:new WritableStream(r,e),readable:i};function o(s){return P(this,void 0,void 0,function*(){let a=null,c=s.desiredSize;for(;a=yield n.read(c||null);)if(s.enqueue(a),c!=null&&(c-=a.byteLength)<=0)return;s.close()})}}function rv(e,t="stream"){return(t==="stream"?Ef:Df).writeAll(e).toUint8Array(!0)}var itt=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},wE),GE),UE),vE),yE),CE),xE),{compareSchemas:Tf,compareFields:R5,compareTypes:k5});ln.toDOMStream=oP;He.throughDOM=cP;hn.throughDOM=tv;Zl.throughDOM=tv;Ws.throughDOM=tv;Mf.throughDOM=ev;Df.throughDOM=ev;Ef.throughDOM=ev;var ott=Object.create,uP=Object.defineProperty,stt=Object.getOwnPropertyDescriptor,att=Object.getOwnPropertyNames,ctt=Object.getPrototypeOf,ltt=Object.prototype.hasOwnProperty,utt=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),ftt=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of att(t))!ltt.call(e,i)&&i!==r&&uP(e,i,{get:()=>t[i],enumerable:!(n=stt(t,i))||n.enumerable});return e},dtt=(e,t,r)=>(r=e!=null?ott(ctt(e)):{},ftt(t||!e||!e.__esModule?uP(r,"default",{value:e,enumerable:!0}):r,e)),htt=utt((e,t)=>{t.exports=Worker}),ptt=(e=>(e[e.UNDEFINED=0]="UNDEFINED",e[e.AUTOMATIC=1]="AUTOMATIC",e[e.READ_ONLY=2]="READ_ONLY",e[e.READ_WRITE=3]="READ_WRITE",e))(ptt||{}),mtt=(e=>(e[e.IDENTIFIER=0]="IDENTIFIER",e[e.NUMERIC_CONSTANT=1]="NUMERIC_CONSTANT",e[e.STRING_CONSTANT=2]="STRING_CONSTANT",e[e.OPERATOR=3]="OPERATOR",e[e.KEYWORD=4]="KEYWORD",e[e.COMMENT=5]="COMMENT",e))(mtt||{}),ytt=(e=>(e[e.NONE=0]="NONE",e[e.DEBUG=1]="DEBUG",e[e.INFO=2]="INFO",e[e.WARNING=3]="WARNING",e[e.ERROR=4]="ERROR",e))(ytt||{}),gtt=(e=>(e[e.NONE=0]="NONE",e[e.CONNECT=1]="CONNECT",e[e.DISCONNECT=2]="DISCONNECT",e[e.OPEN=3]="OPEN",e[e.QUERY=4]="QUERY",e[e.INSTANTIATE=5]="INSTANTIATE",e))(gtt||{}),btt=(e=>(e[e.NONE=0]="NONE",e[e.OK=1]="OK",e[e.ERROR=2]="ERROR",e[e.START=3]="START",e[e.RUN=4]="RUN",e[e.CAPTURE=5]="CAPTURE",e))(btt||{}),xtt=(e=>(e[e.NONE=0]="NONE",e[e.WEB_WORKER=1]="WEB_WORKER",e[e.NODE_WORKER=2]="NODE_WORKER",e[e.BINDINGS=3]="BINDINGS",e[e.ASYNC_DUCKDB=4]="ASYNC_DUCKDB",e))(xtt||{}),fP=class{log(e){}},dP=class{constructor(e=2){this.level=e}log(e){e.level>=this.level&&console.log(e)}};var _tt=(e=>(e[e.SUCCESS=0]="SUCCESS",e))(_tt||{}),wtt=class{constructor(e,t){this._bindings=e,this._conn=t}get bindings(){return this._bindings}async close(){return this._bindings.disconnect(this._conn)}useUnsafe(e){return e(this._bindings,this._conn)}async query(e){this._bindings.logger.log({timestamp:new Date,level:2,origin:4,topic:4,event:4,value:e});let t=await this._bindings.runQuery(this._conn,e),r=hn.from(t);return console.assert(r.isSync(),"Reader is not sync"),console.assert(r.isFile(),"Reader is not file"),new Yn(r)}async send(e){this._bindings.logger.log({timestamp:new Date,level:2,origin:4,topic:4,event:4,value:e});let t=await this._bindings.startPendingQuery(this._conn,e);for(;t==null;)t=await this._bindings.pollPendingQuery(this._conn);let r=new hP(this._bindings,this._conn,t),n=await hn.from(r);return console.assert(n.isAsync()),console.assert(n.isStream()),n}async cancelSent(){return await this._bindings.cancelPendingQuery(this._conn)}async getTableNames(e){return await this._bindings.getTableNames(this._conn,e)}async prepare(e){let t=await this._bindings.createPrepared(this._conn,e);return new vtt(this._bindings,this._conn,t)}async insertArrowTable(e,t){let r=rv(e,"stream");await this.insertArrowFromIPCStream(r,t)}async insertArrowFromIPCStream(e,t){await this._bindings.insertArrowFromIPCStream(this._conn,e,t)}async insertCSVFromPath(e,t){await this._bindings.insertCSVFromPath(this._conn,e,t)}async insertJSONFromPath(e,t){await this._bindings.insertJSONFromPath(this._conn,e,t)}},hP=class{constructor(e,t,r){this.db=e,this.conn=t,this.header=r,this._first=!0,this._depleted=!1,this._inFlight=null}async next(){if(this._first)return this._first=!1,{done:!1,value:this.header};if(this._depleted)return{done:!0,value:null};let e;return this._inFlight!=null?(e=await this._inFlight,this._inFlight=null):e=await this.db.fetchQueryResults(this.conn),this._depleted=e.length==0,this._depleted||(this._inFlight=this.db.fetchQueryResults(this.conn)),{done:this._depleted,value:e}}[Symbol.asyncIterator](){return this}},vtt=class{constructor(e,t,r){this.bindings=e,this.connectionId=t,this.statementId=r}async close(){await this.bindings.closePrepared(this.connectionId,this.statementId)}async query(...e){let t=await this.bindings.runPrepared(this.connectionId,this.statementId,e),r=hn.from(t);return console.assert(r.isSync()),console.assert(r.isFile()),new Yn(r)}async send(...e){let t=await this.bindings.sendPrepared(this.connectionId,this.statementId,e),r=new hP(this.bindings,this.connectionId,t),n=await hn.from(r);return console.assert(n.isAsync()),console.assert(n.isStream()),n}},Stt=(e=>(e.CANCEL_PENDING_QUERY="CANCEL_PENDING_QUERY",e.CLOSE_PREPARED="CLOSE_PREPARED",e.COLLECT_FILE_STATISTICS="COLLECT_FILE_STATISTICS",e.CONNECT="CONNECT",e.COPY_FILE_TO_BUFFER="COPY_FILE_TO_BUFFER",e.COPY_FILE_TO_PATH="COPY_FILE_TO_PATH",e.CREATE_PREPARED="CREATE_PREPARED",e.DISCONNECT="DISCONNECT",e.DROP_FILE="DROP_FILE",e.DROP_FILES="DROP_FILES",e.EXPORT_FILE_STATISTICS="EXPORT_FILE_STATISTICS",e.FETCH_QUERY_RESULTS="FETCH_QUERY_RESULTS",e.FLUSH_FILES="FLUSH_FILES",e.GET_FEATURE_FLAGS="GET_FEATURE_FLAGS",e.GET_TABLE_NAMES="GET_TABLE_NAMES",e.GET_VERSION="GET_VERSION",e.GLOB_FILE_INFOS="GLOB_FILE_INFOS",e.INSERT_ARROW_FROM_IPC_STREAM="INSERT_ARROW_FROM_IPC_STREAM",e.INSERT_CSV_FROM_PATH="IMPORT_CSV_FROM_PATH",e.INSERT_JSON_FROM_PATH="IMPORT_JSON_FROM_PATH",e.INSTANTIATE="INSTANTIATE",e.OPEN="OPEN",e.PING="PING",e.POLL_PENDING_QUERY="POLL_PENDING_QUERY",e.REGISTER_FILE_BUFFER="REGISTER_FILE_BUFFER",e.REGISTER_FILE_HANDLE="REGISTER_FILE_HANDLE",e.REGISTER_FILE_URL="REGISTER_FILE_URL",e.RESET="RESET",e.RUN_PREPARED="RUN_PREPARED",e.RUN_QUERY="RUN_QUERY",e.SEND_PREPARED="SEND_PREPARED",e.START_PENDING_QUERY="START_PENDING_QUERY",e.TOKENIZE="TOKENIZE",e))(Stt||{}),Itt=(e=>(e.CONNECTION_INFO="CONNECTION_INFO",e.ERROR="ERROR",e.FEATURE_FLAGS="FEATURE_FLAGS",e.FILE_BUFFER="FILE_BUFFER",e.FILE_INFOS="FILE_INFOS",e.FILE_SIZE="FILE_SIZE",e.FILE_STATISTICS="FILE_STATISTICS",e.INSTANTIATE_PROGRESS="INSTANTIATE_PROGRESS",e.LOG="LOG",e.OK="OK",e.PREPARED_STATEMENT_ID="PREPARED_STATEMENT_ID",e.QUERY_PLAN="QUERY_PLAN",e.QUERY_RESULT="QUERY_RESULT",e.QUERY_RESULT_CHUNK="QUERY_RESULT_CHUNK",e.QUERY_RESULT_HEADER="QUERY_RESULT_HEADER",e.QUERY_RESULT_HEADER_OR_NULL="QUERY_RESULT_HEADER_OR_NULL",e.REGISTERED_FILE="REGISTERED_FILE",e.SCRIPT_TOKENS="SCRIPT_TOKENS",e.SUCCESS="SUCCESS",e.TABLE_NAMES="TABLE_NAMES",e.VERSION_STRING="VERSION_STRING",e))(Itt||{}),be=class{constructor(e,t){this.promiseResolver=()=>{},this.promiseRejecter=()=>{},this.type=e,this.data=t,this.promise=new Promise((r,n)=>{this.promiseResolver=r,this.promiseRejecter=n})}};function nv(e){switch(e.typeId){case N.Binary:return{sqlType:"binary"};case N.Bool:return{sqlType:"bool"};case N.Date:return{sqlType:"date"};case N.DateDay:return{sqlType:"date32[d]"};case N.DateMillisecond:return{sqlType:"date64[ms]"};case N.Decimal:{let t=e;return{sqlType:"decimal",precision:t.precision,scale:t.scale}}case N.Float:return{sqlType:"float"};case N.Float16:return{sqlType:"float16"};case N.Float32:return{sqlType:"float32"};case N.Float64:return{sqlType:"float64"};case N.Int:return{sqlType:"int32"};case N.Int16:return{sqlType:"int16"};case N.Int32:return{sqlType:"int32"};case N.Int64:return{sqlType:"int64"};case N.Uint16:return{sqlType:"uint16"};case N.Uint32:return{sqlType:"uint32"};case N.Uint64:return{sqlType:"uint64"};case N.Uint8:return{sqlType:"uint8"};case N.IntervalDayTime:return{sqlType:"interval[dt]"};case N.IntervalYearMonth:return{sqlType:"interval[m]"};case N.List:return{sqlType:"list",valueType:nv(e.valueType)};case N.FixedSizeBinary:return{sqlType:"fixedsizebinary",byteWidth:e.byteWidth};case N.Null:return{sqlType:"null"};case N.Utf8:return{sqlType:"utf8"};case N.Struct:return{sqlType:"struct",fields:e.children.map(t=>yD(t.name,t.type))};case N.Map:{let t=e;return{sqlType:"map",keyType:nv(t.keyType),valueType:nv(t.valueType)}}case N.Time:return{sqlType:"time[s]"};case N.TimeMicrosecond:return{sqlType:"time[us]"};case N.TimeMillisecond:return{sqlType:"time[ms]"};case N.TimeNanosecond:return{sqlType:"time[ns]"};case N.TimeSecond:return{sqlType:"time[s]"};case N.Timestamp:return{sqlType:"timestamp",timezone:e.timezone||void 0};case N.TimestampSecond:return{sqlType:"timestamp[s]",timezone:e.timezone||void 0};case N.TimestampMicrosecond:return{sqlType:"timestamp[us]",timezone:e.timezone||void 0};case N.TimestampNanosecond:return{sqlType:"timestamp[ns]",timezone:e.timezone||void 0};case N.TimestampMillisecond:return{sqlType:"timestamp[ms]",timezone:e.timezone||void 0}}throw new Error("unsupported arrow type: ".concat(e.toString()))}function yD(e,t){let r=nv(t);return r.name=e,r}var Ttt=new TextEncoder,pP=class{constructor(e,t=null){this._onInstantiationProgress=[],this._worker=null,this._workerShutdownPromise=null,this._workerShutdownResolver=()=>{},this._nextMessageId=0,this._pendingRequests=new Map,this._logger=e,this._onMessageHandler=this.onMessage.bind(this),this._onErrorHandler=this.onError.bind(this),this._onCloseHandler=this.onClose.bind(this),t!=null&&this.attach(t)}get logger(){return this._logger}attach(e){this._worker=e,this._worker.addEventListener("message",this._onMessageHandler),this._worker.addEventListener("error",this._onErrorHandler),this._worker.addEventListener("close",this._onCloseHandler),this._workerShutdownPromise=new Promise((t,r)=>{this._workerShutdownResolver=t})}detach(){this._worker&&(this._worker.removeEventListener("message",this._onMessageHandler),this._worker.removeEventListener("error",this._onErrorHandler),this._worker.removeEventListener("close",this._onCloseHandler),this._worker=null,this._workerShutdownResolver(null),this._workerShutdownPromise=null,this._workerShutdownResolver=()=>{})}async terminate(){this._worker&&(this._worker.terminate(),this._worker=null,this._workerShutdownPromise=null,this._workerShutdownResolver=()=>{})}async postTask(e,t=[]){if(!this._worker){console.error("cannot send a message since the worker is not set!");return}let r=this._nextMessageId++;return this._pendingRequests.set(r,e),this._worker.postMessage({messageId:r,type:e.type,data:e.data},t),await e.promise}onMessage(e){var t;let r=e.data;switch(r.type){case"LOG":{this._logger.log(r.data);return}case"INSTANTIATE_PROGRESS":{for(let i of this._onInstantiationProgress)i(r.data);return}}let n=this._pendingRequests.get(r.requestId);if(!n){console.warn("unassociated response: [".concat(r.requestId,", ").concat(r.type.toString(),"]"));return}if(this._pendingRequests.delete(r.requestId),r.type=="ERROR"){let i=new Error(r.data.message);i.name=r.data.name,(t=Object.getOwnPropertyDescriptor(i,"stack"))!=null&&t.writable&&(i.stack=r.data.stack),n.promiseRejecter(i);return}switch(n.type){case"CLOSE_PREPARED":case"COLLECT_FILE_STATISTICS":case"COPY_FILE_TO_PATH":case"DISCONNECT":case"DROP_FILE":case"DROP_FILES":case"FLUSH_FILES":case"INSERT_ARROW_FROM_IPC_STREAM":case"IMPORT_CSV_FROM_PATH":case"IMPORT_JSON_FROM_PATH":case"OPEN":case"PING":case"REGISTER_FILE_BUFFER":case"REGISTER_FILE_HANDLE":case"REGISTER_FILE_URL":case"RESET":if(r.type=="OK"){n.promiseResolver(r.data);return}break;case"INSTANTIATE":if(this._onInstantiationProgress=[],r.type=="OK"){n.promiseResolver(r.data);return}break;case"GLOB_FILE_INFOS":if(r.type=="FILE_INFOS"){n.promiseResolver(r.data);return}break;case"GET_VERSION":if(r.type=="VERSION_STRING"){n.promiseResolver(r.data);return}break;case"GET_FEATURE_FLAGS":if(r.type=="FEATURE_FLAGS"){n.promiseResolver(r.data);return}break;case"GET_TABLE_NAMES":if(r.type=="TABLE_NAMES"){n.promiseResolver(r.data);return}break;case"TOKENIZE":if(r.type=="SCRIPT_TOKENS"){n.promiseResolver(r.data);return}break;case"COPY_FILE_TO_BUFFER":if(r.type=="FILE_BUFFER"){n.promiseResolver(r.data);return}break;case"EXPORT_FILE_STATISTICS":if(r.type=="FILE_STATISTICS"){n.promiseResolver(r.data);return}break;case"CONNECT":if(r.type=="CONNECTION_INFO"){n.promiseResolver(r.data);return}break;case"RUN_PREPARED":case"RUN_QUERY":if(r.type=="QUERY_RESULT"){n.promiseResolver(r.data);return}break;case"SEND_PREPARED":if(r.type=="QUERY_RESULT_HEADER"){n.promiseResolver(r.data);return}break;case"START_PENDING_QUERY":if(r.type=="QUERY_RESULT_HEADER_OR_NULL"){n.promiseResolver(r.data);return}break;case"POLL_PENDING_QUERY":if(r.type=="QUERY_RESULT_HEADER_OR_NULL"){n.promiseResolver(r.data);return}break;case"CANCEL_PENDING_QUERY":if(this._onInstantiationProgress=[],r.type=="SUCCESS"){n.promiseResolver(r.data);return}break;case"FETCH_QUERY_RESULTS":if(r.type=="QUERY_RESULT_CHUNK"){n.promiseResolver(r.data);return}break;case"CREATE_PREPARED":if(r.type=="PREPARED_STATEMENT_ID"){n.promiseResolver(r.data);return}break}n.promiseRejecter(new Error("unexpected response type: ".concat(r.type.toString())))}onError(e){console.error(e),console.error("error in duckdb worker: ".concat(e.message)),this._pendingRequests.clear()}onClose(){if(this._workerShutdownResolver(null),this._pendingRequests.size!=0){console.warn("worker terminated with ".concat(this._pendingRequests.size," pending requests"));return}this._pendingRequests.clear()}async reset(){let e=new be("RESET",null);return await this.postTask(e)}async ping(){let e=new be("PING",null);await this.postTask(e)}async dropFile(e){let t=new be("DROP_FILE",e);return await this.postTask(t)}async dropFiles(){let e=new be("DROP_FILES",null);return await this.postTask(e)}async flushFiles(){let e=new be("FLUSH_FILES",null);return await this.postTask(e)}async instantiate(e,t=null,r=n=>{}){this._onInstantiationProgress.push(r);let n=new be("INSTANTIATE",[e,t]);return await this.postTask(n)}async getVersion(){let e=new be("GET_VERSION",null);return await this.postTask(e)}async getFeatureFlags(){let e=new be("GET_FEATURE_FLAGS",null);return await this.postTask(e)}async open(e){let t=new be("OPEN",e);await this.postTask(t)}async tokenize(e){let t=new be("TOKENIZE",e);return await this.postTask(t)}async connectInternal(){let e=new be("CONNECT",null);return await this.postTask(e)}async connect(){let e=await this.connectInternal();return new wtt(this,e)}async disconnect(e){let t=new be("DISCONNECT",e);await this.postTask(t)}async runQuery(e,t){let r=new be("RUN_QUERY",[e,t]);return await this.postTask(r)}async startPendingQuery(e,t){let r=new be("START_PENDING_QUERY",[e,t]);return await this.postTask(r)}async pollPendingQuery(e){let t=new be("POLL_PENDING_QUERY",e);return await this.postTask(t)}async cancelPendingQuery(e){let t=new be("CANCEL_PENDING_QUERY",e);return await this.postTask(t)}async fetchQueryResults(e){let t=new be("FETCH_QUERY_RESULTS",e);return await this.postTask(t)}async getTableNames(e,t){let r=new be("GET_TABLE_NAMES",[e,t]);return await this.postTask(r)}async createPrepared(e,t){let r=new be("CREATE_PREPARED",[e,t]);return await this.postTask(r)}async closePrepared(e,t){let r=new be("CLOSE_PREPARED",[e,t]);await this.postTask(r)}async runPrepared(e,t,r){let n=new be("RUN_PREPARED",[e,t,r]);return await this.postTask(n)}async sendPrepared(e,t,r){let n=new be("SEND_PREPARED",[e,t,r]);return await this.postTask(n)}async globFiles(e){let t=new be("GLOB_FILE_INFOS",e);return await this.postTask(t)}async registerFileText(e,t){let r=Ttt.encode(t);await this.registerFileBuffer(e,r)}async registerFileURL(e,t,r,n){t===void 0&&(t=e);let i=new be("REGISTER_FILE_URL",[e,t,r,n]);await this.postTask(i)}async registerEmptyFileBuffer(e){let t=new be("REGISTER_FILE_BUFFER",[e,new Uint8Array]);await this.postTask(t)}async registerFileBuffer(e,t){let r=new be("REGISTER_FILE_BUFFER",[e,t]);await this.postTask(r,[t.buffer])}async registerFileHandle(e,t,r,n){let i=new be("REGISTER_FILE_HANDLE",[e,t,r,n]);await this.postTask(i,[])}async collectFileStatistics(e,t){let r=new be("COLLECT_FILE_STATISTICS",[e,t]);await this.postTask(r,[])}async exportFileStatistics(e){let t=new be("EXPORT_FILE_STATISTICS",e);return await this.postTask(t,[])}async copyFileToBuffer(e){let t=new be("COPY_FILE_TO_BUFFER",e);return await this.postTask(t)}async copyFileToPath(e,t){let r=new be("COPY_FILE_TO_PATH",[e,t]);await this.postTask(r)}async insertArrowFromIPCStream(e,t,r){if(t.length==0)return;let n=new be("INSERT_ARROW_FROM_IPC_STREAM",[e,t,r]);await this.postTask(n,[t.buffer])}async insertCSVFromPath(e,t,r){if(r.columns!==void 0){let i=[];for(let o in r.columns){let s=r.columns[o];i.push(yD(o,s))}r.columnsFlat=i,delete r.columns}let n=new be("IMPORT_CSV_FROM_PATH",[e,t,r]);await this.postTask(n)}async insertJSONFromPath(e,t,r){if(r.columns!==void 0){let i=[];for(let o in r.columns){let s=r.columns[o];i.push(yD(o,s))}r.columnsFlat=i,delete r.columns}let n=new be("IMPORT_JSON_FROM_PATH",[e,t,r]);await this.postTask(n)}};var Att=async()=>WebAssembly.validate(new Uint8Array([0,97,115,109,1,0,0,0,1,4,1,96,0,0,3,2,1,0,5,3,1,0,1,10,14,1,12,0,65,0,65,0,65,0,252,10,0,0,11])),Mtt=async()=>WebAssembly.validate(new Uint8Array([0,97,115,109,1,0,0,0,1,4,1,96,0,0,3,2,1,0,10,8,1,6,0,6,64,25,11,11])),Ett=async()=>WebAssembly.validate(new Uint8Array([0,97,115,109,1,0,0,0,1,5,1,96,0,1,123,3,2,1,0,10,10,1,8,0,65,0,253,15,253,98,11])),Dtt=()=>(async e=>{try{return typeof MessageChannel<"u"&&new MessageChannel().port1.postMessage(new SharedArrayBuffer(1)),WebAssembly.validate(e)}catch{return!1}})(new Uint8Array([0,97,115,109,1,0,0,0,1,4,1,96,0,0,3,2,1,0,5,4,1,3,1,1,10,11,1,9,0,65,0,254,16,2,0,26,11])),gD={name:"@duckdb/duckdb-wasm",version:"1.28.1-dev106.0",description:"DuckDB powered by WebAssembly",license:"MIT",repository:{type:"git",url:"https://github.com/duckdb/duckdb-wasm.git"},keywords:["sql","duckdb","relational","database","data","query","wasm","analytics","olap","arrow","parquet","json","csv"],dependencies:{"apache-arrow":"^14.0.1"},devDependencies:{"@types/emscripten":"^1.39.10","@types/jasmine":"^5.1.4","@typescript-eslint/eslint-plugin":"^6.18.0","@typescript-eslint/parser":"^6.18.0",esbuild:"^0.20.0",eslint:"^8.56.0","eslint-plugin-jasmine":"^4.1.3","eslint-plugin-react":"^7.33.2","fast-glob":"^3.3.2",jasmine:"^5.1.0","jasmine-core":"^5.1.1","jasmine-spec-reporter":"^7.0.0","js-sha256":"^0.11.0",karma:"^6.4.2","karma-chrome-launcher":"^3.2.0","karma-coverage":"^2.2.1","karma-firefox-launcher":"^2.1.2","karma-jasmine":"^5.1.0","karma-jasmine-html-reporter":"^2.1.0","karma-sourcemap-loader":"^0.4.0","karma-spec-reporter":"^0.0.36","make-dir":"^4.0.0",nyc:"^15.1.0",prettier:"^3.2.4",puppeteer:"^21.7.0",rimraf:"^5.0.5",s3rver:"^3.7.1",typedoc:"^0.25.7",typescript:"^5.3.3","wasm-feature-detect":"^1.6.1","web-worker":"^1.2.0"},scripts:{"build:debug":"node bundle.mjs debug && tsc --emitDeclarationOnly","build:release":"node bundle.mjs release && tsc --emitDeclarationOnly",docs:"typedoc",report:"node ./coverage.mjs","test:node":"node --enable-source-maps ../../node_modules/jasmine/bin/jasmine ./dist/tests-node.cjs","test:node:debug":"node --inspect-brk --enable-source-maps ../../node_modules/jasmine/bin/jasmine ./dist/tests-node.cjs","test:node:coverage":"nyc -r json --report-dir ./coverage/node node ../../node_modules/jasmine/bin/jasmine ./dist/tests-node.cjs","test:firefox":"karma start ./karma/tests-firefox.cjs","test:chrome":"karma start ./karma/tests-chrome.cjs","test:chrome:eh":"karma start ./karma/tests-chrome-eh.cjs","test:chrome:coverage":"karma start ./karma/tests-chrome-coverage.cjs","test:browser":"karma start ./karma/tests-all.cjs","test:browser:debug":"karma start ./karma/tests-debug.cjs",test:"npm run test:chrome && npm run test:node","test:coverage":"npm run test:chrome:coverage && npm run test:node:coverage && npm run report",lint:"eslint src test"},files:["dist","!dist/types/test"],main:"dist/duckdb-browser.cjs",module:"dist/duckdb-browser.mjs",types:"dist/duckdb-browser.d.ts",jsdelivr:"dist/duckdb-browser.cjs",unpkg:"dist/duckdb-browser.mjs",sideEffects:!1,browser:{fs:!1,path:!1,perf_hooks:!1,os:!1,worker_threads:!1},exports:{"./dist/duckdb-mvp.wasm":"./dist/duckdb-mvp.wasm","./dist/duckdb-eh.wasm":"./dist/duckdb-eh.wasm","./dist/duckdb-coi.wasm":"./dist/duckdb-coi.wasm","./dist/duckdb-browser":"./dist/duckdb-browser.mjs","./dist/duckdb-browser.cjs":"./dist/duckdb-browser.cjs","./dist/duckdb-browser.mjs":"./dist/duckdb-browser.mjs","./dist/duckdb-browser-blocking":"./dist/duckdb-browser-blocking.mjs","./dist/duckdb-browser-blocking.mjs":"./dist/duckdb-browser-blocking.mjs","./dist/duckdb-browser-blocking.cjs":"./dist/duckdb-browser-blocking.cjs","./dist/duckdb-browser-coi.pthread.worker.js":"./dist/duckdb-browser-coi.pthread.worker.js","./dist/duckdb-browser-coi.worker.js":"./dist/duckdb-browser-coi.worker.js","./dist/duckdb-browser-eh.worker.js":"./dist/duckdb-browser-eh.worker.js","./dist/duckdb-browser-mvp.worker.js":"./dist/duckdb-browser-mvp.worker.js","./dist/duckdb-node":"./dist/duckdb-node.cjs","./dist/duckdb-node.cjs":"./dist/duckdb-node.cjs","./dist/duckdb-node-blocking":"./dist/duckdb-node-blocking.cjs","./dist/duckdb-node-blocking.cjs":"./dist/duckdb-node-blocking.cjs","./dist/duckdb-node-eh.worker.cjs":"./dist/duckdb-node-eh.worker.cjs","./dist/duckdb-node-mvp.worker.cjs":"./dist/duckdb-node-mvp.worker.cjs","./blocking":{browser:{types:"./dist/duckdb-browser-blocking.d.ts",import:"./dist/duckdb-browser-blocking.mjs",require:"./dist/duckdb-browser-blocking.cjs"},node:{types:"./dist/duckdb-node-blocking.d.ts",require:"./dist/duckdb-node-blocking.cjs",import:"./dist/duckdb-node-blocking.cjs"},types:"./dist/duckdb-browser-blocking.d.ts",import:"./dist/duckdb-browser-blocking.mjs",require:"./dist/duckdb-browser-blocking.cjs"},".":{browser:{types:"./dist/duckdb-browser.d.ts",import:"./dist/duckdb-browser.mjs",require:"./dist/duckdb-browser.cjs"},node:{types:"./dist/duckdb-node.d.ts",import:"./dist/duckdb-node.cjs",require:"./dist/duckdb-node.cjs"},types:"./dist/duckdb-browser.d.ts",import:"./dist/duckdb-browser.mjs",require:"./dist/duckdb-browser.cjs"}}},Btt=gD.name,Ott=gD.version,bD=gD.version.split("."),fBt=bD[0],dBt=bD[1],hBt=bD[2],Ntt=()=>typeof navigator>"u";function mP(){let e="https://cdn.jsdelivr.net/npm/".concat(Btt,"@").concat(Ott,"/dist/");return{mvp:{mainModule:"".concat(e,"duckdb-mvp.wasm"),mainWorker:"".concat(e,"duckdb-browser-mvp.worker.js")},eh:{mainModule:"".concat(e,"duckdb-eh.wasm"),mainWorker:"".concat(e,"duckdb-browser-eh.worker.js")}}}var fD=null,dD=null,hD=null,pD=null,mD=null;async function Ftt(){return fD==null&&(fD=typeof BigInt64Array<"u"),dD==null&&(dD=await Mtt()),hD==null&&(hD=await Dtt()),pD==null&&(pD=await Ett()),mD==null&&(mD=await Att()),{bigInt64Array:fD,crossOriginIsolated:Ntt()||globalThis.crossOriginIsolated||!1,wasmExceptions:dD,wasmSIMD:pD,wasmThreads:hD,wasmBulkMemory:mD}}async function yP(e){let t=await Ftt();if(t.wasmExceptions){if(t.wasmSIMD&&t.wasmThreads&&t.crossOriginIsolated&&e.coi)return{mainModule:e.coi.mainModule,mainWorker:e.coi.mainWorker,pthreadWorker:e.coi.pthreadWorker};if(e.eh)return{mainModule:e.eh.mainModule,mainWorker:e.eh.mainWorker,pthreadWorker:null}}return{mainModule:e.mvp.mainModule,mainWorker:e.mvp.mainWorker,pthreadWorker:null}}var pBt=dtt(htt());function Ltt(){let e=new TextDecoder;return t=>(typeof SharedArrayBuffer<"u"&&t.buffer instanceof SharedArrayBuffer&&(t=new Uint8Array(t)),e.decode(t))}var mBt=Ltt(),Rtt=(e=>(e[e.BUFFER=0]="BUFFER",e[e.NODE_FS=1]="NODE_FS",e[e.BROWSER_FILEREADER=2]="BROWSER_FILEREADER",e[e.BROWSER_FSACCESS=3]="BROWSER_FSACCESS",e[e.HTTP=4]="HTTP",e[e.S3=5]="S3",e))(Rtt||{});function gP(e={}){let{duckdb:t,connection:r,...n}=e,i=t,o=r,s;function a(){return s||(s=(i?Promise.resolve(i):Ctt(n).then(u=>i=u)).then(u=>u.connect()).then(u=>o=u)),s}async function c(){return i||await a(),i}async function l(){return o||await a(),o}return{getDuckDB:c,getConnection:l,query:async u=>{let{type:f,sql:d}=u,p=await(await l()).query(d);return f==="exec"?void 0:f==="arrow"?p:Array.from(p)}}}async function Ctt({log:e=!1}={}){let t=mP(),r=await yP(t),n=URL.createObjectURL(new Blob([`importScripts("${r.mainWorker}");`],{type:"text/javascript"})),i=new Worker(n),o=e?new dP:new fP,s=new pP(o,i);return await s.instantiate(r.mainModule,r.pthreadWorker),URL.revokeObjectURL(n),s}function xD(){let e=new Set,t,r=new Promise(n=>t=n);return{pending(n){e.add(n)},ready(n){return e.delete(n),e.size===0},resolve(){r=new Promise(n=>{t(),t=n})},get promise(){return r}}}var K8={};Ir(K8,{Fixed:()=>Gs,Param:()=>Nl,Query:()=>Mt,Selection:()=>ac,agg:()=>SM,align:()=>GF,and:()=>$n,area:()=>T4,areaX:()=>A4,areaY:()=>M4,argmax:()=>th,argmin:()=>Jd,arrayAgg:()=>XM,arrow:()=>b8,aspectRatio:()=>XF,avg:()=>IM,axis:()=>HF,axisFx:()=>S8,axisFy:()=>I8,axisX:()=>w8,axisY:()=>v8,barX:()=>O4,barY:()=>N4,bin:()=>KT,cast:()=>By,castDouble:()=>eh,castInteger:()=>HM,cell:()=>F4,cellX:()=>L4,cellY:()=>R4,centroid:()=>Ny,centroidX:()=>tE,centroidY:()=>eE,circle:()=>V4,colorBase:()=>LR,colorClamp:()=>SR,colorConstant:()=>kR,colorDomain:()=>wR,colorExponent:()=>RR,colorInterpolate:()=>MR,colorLabel:()=>BR,colorLegend:()=>X8,colorN:()=>IR,colorNice:()=>TR,colorPivot:()=>ER,colorRange:()=>vR,colorReverse:()=>OR,colorScale:()=>_R,colorScheme:()=>AR,colorSymmetric:()=>DR,colorTickFormat:()=>FR,colorZero:()=>NR,column:()=>El,contour:()=>s8,coordinator:()=>co,corr:()=>CM,count:()=>Li,covarPop:()=>UM,create:()=>Ol,cume_dist:()=>mM,dateDay:()=>JM,dateMonth:()=>KM,dateMonthDay:()=>QM,delaunayLink:()=>m8,delaunayMesh:()=>y8,denseLine:()=>o8,dense_rank:()=>hM,density:()=>i8,densityX:()=>r8,densityY:()=>n8,dot:()=>P4,dotX:()=>$4,dotY:()=>z4,entropy:()=>LM,eq:()=>ic,facetGrid:()=>bL,facetLabel:()=>xL,facetMargin:()=>hL,facetMarginBottom:()=>mL,facetMarginLeft:()=>yL,facetMarginRight:()=>gL,facetMarginTop:()=>pL,first:()=>YM,first_value:()=>xM,frame:()=>_8,from:()=>qG,fxAlign:()=>ML,fxAriaDescription:()=>YL,fxAriaLabel:()=>qL,fxAxis:()=>OL,fxDomain:()=>_L,fxFontVariant:()=>jL,fxGrid:()=>UL,fxInset:()=>SL,fxInsetLeft:()=>IL,fxInsetRight:()=>TL,fxLabel:()=>$L,fxLabelAnchor:()=>zL,fxLabelOffset:()=>VL,fxLine:()=>PL,fxNice:()=>vL,fxPadding:()=>EL,fxPaddingInner:()=>DL,fxPaddingOuter:()=>BL,fxRange:()=>wL,fxReverse:()=>WL,fxRound:()=>AL,fxTickFormat:()=>kL,fxTickPadding:()=>RL,fxTickRotate:()=>CL,fxTickSize:()=>FL,fxTickSpacing:()=>LL,fxTicks:()=>NL,fyAlign:()=>tR,fyAriaDescription:()=>bR,fyAriaLabel:()=>gR,fyAxis:()=>iR,fyDomain:()=>GL,fyFontVariant:()=>yR,fyGrid:()=>fR,fyInset:()=>ZL,fyInsetBottom:()=>QL,fyInsetTop:()=>KL,fyLabel:()=>hR,fyLabelAnchor:()=>pR,fyLabelOffset:()=>mR,fyLine:()=>dR,fyNice:()=>HL,fyPadding:()=>eR,fyPaddingInner:()=>rR,fyPaddingOuter:()=>nR,fyRange:()=>XL,fyReverse:()=>xR,fyRound:()=>JL,fyTickFormat:()=>lR,fyTickPadding:()=>cR,fyTickRotate:()=>uR,fyTickSize:()=>sR,fyTickSpacing:()=>aR,fyTicks:()=>oR,geo:()=>D8,geojson:()=>Oy,graticule:()=>O8,grid:()=>KF,gridFx:()=>M8,gridFy:()=>E8,gridX:()=>T8,gridY:()=>A8,gt:()=>My,gte:()=>iM,hconcat:()=>CG,heatmap:()=>a8,height:()=>VF,hexagon:()=>j4,hexbin:()=>u8,hexgrid:()=>f8,highlight:()=>N8,hspace:()=>$G,hull:()=>g8,image:()=>e8,inset:()=>ZF,intervalX:()=>U8,intervalXY:()=>$8,intervalY:()=>P8,isBetween:()=>tr,isDistinct:()=>oM,isNotBetween:()=>sM,isNotDistinct:()=>Ey,isNotNull:()=>nc,isNull:()=>lf,kurtosis:()=>FM,label:()=>QF,lag:()=>gM,last:()=>WM,last_value:()=>_M,lead:()=>bM,lengthBase:()=>u4,lengthClamp:()=>a4,lengthConstant:()=>d4,lengthDomain:()=>o4,lengthExponent:()=>f4,lengthNice:()=>c4,lengthRange:()=>s4,lengthScale:()=>i4,lengthZero:()=>l4,line:()=>E4,lineX:()=>D4,lineY:()=>B4,link:()=>x8,literal:()=>Fi,loadCSV:()=>iE,loadExtension:()=>rE,loadJSON:()=>oE,loadObjects:()=>cE,loadParquet:()=>sE,loadSpatial:()=>aE,lt:()=>oc,lte:()=>sc,mad:()=>TM,margin:()=>UF,marginBottom:()=>WF,marginLeft:()=>jF,marginRight:()=>qF,marginTop:()=>YF,margins:()=>CF,max:()=>so,median:()=>MM,menu:()=>OG,min:()=>ao,mode:()=>DM,name:()=>RF,nearestX:()=>k8,nearestY:()=>C8,neq:()=>uf,not:()=>nM,nth_value:()=>wM,ntile:()=>yM,opacityBase:()=>WR,opacityClamp:()=>$R,opacityConstant:()=>XR,opacityDomain:()=>UR,opacityExponent:()=>GR,opacityLabel:()=>VR,opacityLegend:()=>H8,opacityNice:()=>zR,opacityRange:()=>PR,opacityReverse:()=>jR,opacityScale:()=>CR,opacityTickFormat:()=>YR,opacityZero:()=>qR,or:()=>cf,padding:()=>JF,pan:()=>z8,panX:()=>V8,panY:()=>j8,panZoom:()=>q8,panZoomX:()=>Y8,panZoomY:()=>W8,percent_rank:()=>pM,plot:()=>XG,product:()=>AM,projectionClip:()=>S4,projectionDomain:()=>g4,projectionInset:()=>b4,projectionInsetBottom:()=>v4,projectionInsetLeft:()=>x4,projectionInsetRight:()=>_4,projectionInsetTop:()=>w4,projectionParallels:()=>p4,projectionPrecision:()=>m4,projectionRotate:()=>y4,projectionType:()=>h4,quantile:()=>EM,rBase:()=>e4,rClamp:()=>QR,rConstant:()=>n4,rDomain:()=>ZR,rExponent:()=>r4,rNice:()=>JR,rRange:()=>KR,rScale:()=>HR,rZero:()=>t4,rank:()=>dM,raster:()=>c8,rasterTile:()=>l8,rect:()=>k4,rectX:()=>C4,rectY:()=>U4,regressionY:()=>d8,round:()=>t6,row_number:()=>fM,ruleX:()=>G4,ruleY:()=>X4,search:()=>NG,skewness:()=>NM,slider:()=>FG,sphere:()=>B8,spike:()=>t8,sql:()=>W,stddev:()=>OM,stddevPop:()=>kM,stringAgg:()=>GM,style:()=>$F,sum:()=>Ri,symbolLegend:()=>Z8,table:()=>LG,text:()=>q4,textX:()=>Y4,textY:()=>W4,tickX:()=>H4,tickY:()=>Z4,toggle:()=>vm,toggleColor:()=>R8,toggleX:()=>F8,toggleY:()=>L8,varPop:()=>RM,variance:()=>BM,vconcat:()=>kG,vector:()=>K4,vectorX:()=>Q4,vectorY:()=>J4,voronoi:()=>h8,voronoiMesh:()=>p8,vspace:()=>PG,width:()=>zF,xAlign:()=>u6,xAriaDescription:()=>E6,xAriaLabel:()=>M6,xAxis:()=>p6,xBase:()=>O6,xClamp:()=>c6,xConstant:()=>F6,xDomain:()=>r6,xExponent:()=>N6,xFontVariant:()=>A6,xGrid:()=>w6,xInset:()=>o6,xInsetLeft:()=>s6,xInsetRight:()=>a6,xLabel:()=>S6,xLabelAnchor:()=>I6,xLabelOffset:()=>T6,xLine:()=>v6,xNice:()=>i6,xPadding:()=>f6,xPaddingInner:()=>d6,xPaddingOuter:()=>h6,xRange:()=>n6,xReverse:()=>D6,xRound:()=>l6,xScale:()=>e6,xTickFormat:()=>x6,xTickPadding:()=>b6,xTickRotate:()=>_6,xTickSize:()=>y6,xTickSpacing:()=>g6,xTicks:()=>m6,xZero:()=>B6,xyDomain:()=>PF,yAlign:()=>j6,yAriaDescription:()=>aL,yAriaLabel:()=>sL,yAxis:()=>G6,yBase:()=>uL,yClamp:()=>z6,yConstant:()=>dL,yDomain:()=>R6,yExponent:()=>fL,yFontVariant:()=>oL,yGrid:()=>tL,yInset:()=>U6,yInsetBottom:()=>$6,yInsetTop:()=>P6,yLabel:()=>rL,yLabelAnchor:()=>nL,yLabelOffset:()=>iL,yLine:()=>eL,yNice:()=>C6,yPadding:()=>q6,yPaddingInner:()=>Y6,yPaddingOuter:()=>W6,yRange:()=>k6,yReverse:()=>cL,yRound:()=>V6,yScale:()=>L6,yTickFormat:()=>Q6,yTickPadding:()=>K6,yTickRotate:()=>J6,yTickSize:()=>H6,yTickSpacing:()=>Z6,yTicks:()=>X6,yZero:()=>lL});var Gs=Symbol("Fixed"),pn=Symbol("Transient"),Rg=Symbol("Transform");var zT={};Ir(zT,{Area:()=>xd,Arrow:()=>Gb,BarX:()=>Xb,BarY:()=>Hb,Cell:()=>_d,Contour:()=>ix,Density:()=>ax,Dot:()=>wd,Frame:()=>Pb,Geo:()=>cx,Hexgrid:()=>lx,Image:()=>ux,Line:()=>vd,Link:()=>Yb,Mark:()=>Ft,Raster:()=>nx,Rect:()=>Id,RuleX:()=>Lb,RuleY:()=>Rb,Text:()=>yd,TickX:()=>Jb,TickY:()=>tx,Tip:()=>$b,Vector:()=>bd,area:()=>qb,areaX:()=>Ou,areaY:()=>dl,arrow:()=>dY,auto:()=>SY,autoSpec:()=>P3,axisFx:()=>sT,axisFy:()=>oT,axisX:()=>Cb,axisY:()=>kb,barX:()=>Ta,barY:()=>Aa,bin:()=>fl,binX:()=>Sa,binY:()=>Ia,bollinger:()=>Ru,bollingerX:()=>DY,bollingerY:()=>BY,boxX:()=>OY,boxY:()=>NY,cell:()=>Nu,cellX:()=>pY,cellY:()=>mY,centroid:()=>EW,circle:()=>bY,cluster:()=>MW,column:()=>tn,contour:()=>zY,crosshair:()=>qY,crosshairX:()=>YY,crosshairY:()=>WY,delaunayLink:()=>HY,delaunayMesh:()=>ZY,density:()=>eW,differenceY:()=>iW,dodgeX:()=>VW,dodgeY:()=>jW,dot:()=>Do,dotX:()=>yY,dotY:()=>gY,filter:()=>TV,find:()=>LV,formatIsoDate:()=>XN,formatMonth:()=>PV,formatWeekday:()=>$V,frame:()=>Wp,geo:()=>BT,geoCentroid:()=>DW,graticule:()=>sW,gridFx:()=>uT,gridFy:()=>cT,gridX:()=>lT,gridY:()=>aT,group:()=>Ab,groupX:()=>Su,groupY:()=>Iu,groupZ:()=>Tb,hexagon:()=>xY,hexbin:()=>aW,hexgrid:()=>cW,hull:()=>KY,identity:()=>K,image:()=>uW,indexOf:()=>nr,initializer:()=>Qe,interpolateNearest:()=>W3,interpolateNone:()=>DT,interpolatorBarycentric:()=>Y3,interpolatorRandomWalk:()=>G3,legend:()=>Lq,line:()=>Sd,lineX:()=>Fu,lineY:()=>Lu,linearRegressionX:()=>hW,linearRegressionY:()=>pW,link:()=>_T,map:()=>Ii,mapX:()=>om,mapY:()=>sm,marks:()=>Pr,normalize:()=>PT,normalizeX:()=>GW,normalizeY:()=>XW,plot:()=>Vb,pointer:()=>zp,pointerX:()=>Vp,pointerY:()=>dd,raster:()=>CY,rect:()=>Kb,rectX:()=>rm,rectY:()=>nm,reverse:()=>AV,ruleX:()=>Zi,ruleY:()=>Ki,scale:()=>Pp,select:()=>ZW,selectFirst:()=>pF,selectLast:()=>mF,selectMaxX:()=>JW,selectMaxY:()=>tG,selectMinX:()=>KW,selectMinY:()=>QW,shiftX:()=>HW,shuffle:()=>MV,sort:()=>SI,sphere:()=>oW,spike:()=>pq,stackX:()=>k3,stackX1:()=>nY,stackX2:()=>iY,stackY:()=>C3,stackY1:()=>oY,stackY2:()=>sY,text:()=>va,textX:()=>QI,textY:()=>JI,tickX:()=>AT,tickY:()=>MT,tip:()=>hT,transform:()=>en,tree:()=>cF,treeLink:()=>RT,treeNode:()=>fx,valueof:()=>Tt,vector:()=>T3,vectorX:()=>rT,vectorY:()=>nT,voronoi:()=>QY,voronoiMesh:()=>JY,window:()=>am,windowX:()=>IY,windowY:()=>TY});function ie(e,t){return e==null||t==null?NaN:e<t?-1:e>t?1:e>=t?0:NaN}function Wn(e,t){return e==null||t==null?NaN:t<e?-1:t>e?1:t>=e?0:NaN}function Oc(e){let t,r,n;e.length!==2?(t=ie,r=(a,c)=>ie(e(a),c),n=(a,c)=>e(a)-c):(t=e===ie||e===Wn?e:Utt,r=e,n=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;r(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;r(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&&n(a[f-1],c)>-n(a[f],c)?f-1:f}return{left:i,center:s,right:o}}function Utt(){return 0}function kg(e){return e===null?NaN:+e}function*bP(e,t){if(t===void 0)for(let r of e)r!=null&&(r=+r)>=r&&(yield r);else{let r=-1;for(let n of e)(n=t(n,++r,e))!=null&&(n=+n)>=n&&(yield n)}}var xP=Oc(ie),_P=xP.right,Ptt=xP.left,$tt=Oc(kg).center,Nc=_P;var Cg=wP(vP),_D=wP(ztt);function wP(e){return function(t,r,n=r){if(!((r=+r)>=0))throw new RangeError("invalid rx");if(!((n=+n)>=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||!r&&!n)return t;let a=r&&e(r),c=n&&e(n),l=i.slice();return a&&c?(Th(a,l,i,o,s),Th(a,i,l,o,s),Th(a,l,i,o,s),Ah(c,i,l,o,s),Ah(c,l,i,o,s),Ah(c,i,l,o,s)):a?(Th(a,i,l,o,s),Th(a,l,i,o,s),Th(a,i,l,o,s)):c&&(Ah(c,i,l,o,s),Ah(c,l,i,o,s),Ah(c,i,l,o,s)),t}}function Th(e,t,r,n,i){for(let o=0,s=n*i;o<s;)e(t,r,o,o+=n,1)}function Ah(e,t,r,n,i){for(let o=0,s=n*i;o<n;++o)e(t,r,o,o+s,n)}function ztt(e){let t=vP(e);return(r,n,i,o,s)=>{i<<=2,o<<=2,s<<=2,t(r,n,i+0,o+0,s),t(r,n,i+1,o+1,s),t(r,n,i+2,o+2,s),t(r,n,i+3,o+3,s)}}function vP(e){let t=Math.floor(e);if(t===e)return Vtt(e);let r=e-t,n=2*e+1;return(i,o,s,a,c)=>{if(!((a-=c)>=s))return;let l=t*o[s],u=c*t,f=u+c;for(let d=s,h=s+u;d<h;d+=c)l+=o[Math.min(a,d)];for(let d=s,h=a;d<=h;d+=c)l+=o[Math.min(a,d+u)],i[d]=(l+r*(o[Math.max(s,d-f)]+o[Math.min(a,d+f)]))/n,l-=o[Math.max(s,d-u)]}}function Vtt(e){let t=2*e+1;return(r,n,i,o,s)=>{if(!((o-=s)>=i))return;let a=e*n[i],c=s*e;for(let l=i,u=i+c;l<u;l+=s)a+=n[Math.min(o,l)];for(let l=i,u=o;l<=u;l+=s)a+=n[Math.min(o,l+c)],r[l]=a/t,a-=n[Math.max(i,l-c)]}}function Xs(e,t){let r=0;if(t===void 0)for(let n of e)n!=null&&(n=+n)>=n&&++r;else{let n=-1;for(let i of e)(i=t(i,++n,e))!=null&&(i=+i)>=i&&++r}return r}function jtt(e){return e.length|0}function qtt(e){return!(e>0)}function Ytt(e){return typeof e!="object"||"length"in e?e:Array.from(e)}function Wtt(e){return t=>e(...t)}function iv(...e){let t=typeof e[e.length-1]=="function"&&Wtt(e.pop());e=e.map(Ytt);let r=e.map(jtt),n=e.length-1,i=new Array(n+1).fill(0),o=[];if(n<0||r.some(qtt))return o;for(;;){o.push(i.map((a,c)=>e[c][a]));let s=n;for(;++i[s]===r[s];){if(s===0)return t?o.map(t):o;i[s--]=0}}}function ov(e,t){var r=0,n=0;return Float64Array.from(e,t===void 0?i=>r+=+i||0:i=>r+=+t(i,n++,e)||0)}function Kl(e,t){let r=0,n,i=0,o=0;if(t===void 0)for(let s of e)s!=null&&(s=+s)>=s&&(n=s-i,i+=n/++r,o+=n*(s-i));else{let s=-1;for(let a of e)(a=t(a,++s,e))!=null&&(a=+a)>=a&&(n=a-i,i+=n/++r,o+=n*(a-i))}if(r>1)return o/(r-1)}function go(e,t){let r=Kl(e,t);return r&&Math.sqrt(r)}function Be(e,t){let r,n;if(t===void 0)for(let i of e)i!=null&&(r===void 0?i>=i&&(r=n=i):(r>i&&(r=i),n<i&&(n=i)));else{let i=-1;for(let o of e)(o=t(o,++i,e))!=null&&(r===void 0?o>=o&&(r=n=o):(r>o&&(r=o),n<o&&(n=o)))}return[r,n]}var mn=class{constructor(){this._partials=new Float64Array(32),this._n=0}add(t){let r=this._partials,n=0;for(let i=0;i<this._n&&i<32;i++){let o=r[i],s=t+o,a=Math.abs(t)<Math.abs(o)?t-(s-o):o-(s-t);a&&(r[n++]=a),t=s}return r[n]=t,this._n=n+1,this}valueOf(){let t=this._partials,r=this._n,n,i,o,s=0;if(r>0){for(s=t[--r];r>0&&(n=s,i=t[--r],s=n+i,o=i-(s-n),!o););r>0&&(o<0&&t[r-1]<0||o>0&&t[r-1]>0)&&(i=o*2,n=s+i,i==n-s&&(s=n))}return s}};var Gn=class extends Map{constructor(t,r=TP){if(super(),Object.defineProperties(this,{_intern:{value:new Map},_key:{value:r}}),t!=null)for(let[n,i]of t)this.set(n,i)}get(t){return super.get(wD(this,t))}has(t){return super.has(wD(this,t))}set(t,r){return super.set(SP(this,t),r)}delete(t){return super.delete(IP(this,t))}},Xn=class extends Set{constructor(t,r=TP){if(super(),Object.defineProperties(this,{_intern:{value:new Map},_key:{value:r}}),t!=null)for(let n of t)this.add(n)}has(t){return super.has(wD(this,t))}add(t){return super.add(SP(this,t))}delete(t){return super.delete(IP(this,t))}};function wD({_intern:e,_key:t},r){let n=t(r);return e.has(n)?e.get(n):r}function SP({_intern:e,_key:t},r){let n=t(r);return e.has(n)?e.get(n):(e.set(n,r),r)}function IP({_intern:e,_key:t},r){let n=t(r);return e.has(n)&&(r=e.get(n),e.delete(n)),r}function TP(e){return e!==null&&typeof e=="object"?e.valueOf():e}function Ug(e){return e}function Gr(e,...t){return SD(e,Ug,Ug,t)}function ds(e,t,...r){return SD(e,Ug,t,r)}function vD(e,t,...r){return SD(e,Array.from,t,r)}function SD(e,t,r,n){return function i(o,s){if(s>=n.length)return r(o);let a=new Gn,c=n[s++],l=-1;for(let u of o){let f=c(u,++l,o),d=a.get(f);d?d.push(u):a.set(f,[u])}for(let[u,f]of a)a.set(u,i(f,s));return t(a)}(e,0)}function ID(e,t){return Array.from(t,r=>e[r])}function Hs(e,...t){if(typeof e[Symbol.iterator]!="function")throw new TypeError("values is not iterable");e=Array.from(e);let[r]=t;if(r&&r.length!==2||t.length>1){let n=Uint32Array.from(e,(i,o)=>o);return t.length>1?(t=t.map(i=>e.map(i)),n.sort((i,o)=>{for(let s of t){let a=Bf(s[i],s[o]);if(a)return a}})):(r=e.map(r),n.sort((i,o)=>Bf(r[i],r[o]))),ID(e,n)}return e.sort(Pg(r))}function Pg(e=ie){if(e===ie)return Bf;if(typeof e!="function")throw new TypeError("compare is not a function");return(t,r)=>{let n=e(t,r);return n||n===0?n:(e(r,r)===0)-(e(t,t)===0)}}function Bf(e,t){return(e==null||!(e>=e))-(t==null||!(t>=t))||(e<t?-1:e>t?1:0)}function Mh(e,t,r){return(t.length!==2?Hs(ds(e,t,r),([n,i],[o,s])=>ie(i,s)||ie(n,o)):Hs(Gr(e,r),([n,i],[o,s])=>t(i,s)||ie(n,o))).map(([n])=>n)}var Gtt=Math.sqrt(50),Xtt=Math.sqrt(10),Htt=Math.sqrt(2);function sv(e,t,r){let n=(t-e)/Math.max(0,r),i=Math.floor(Math.log10(n)),o=n/Math.pow(10,i),s=o>=Gtt?10:o>=Xtt?5:o>=Htt?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<=r&&r<2?sv(e,t,r*2):[a,c,l]}function yn(e,t,r){if(t=+t,e=+e,r=+r,!(r>0))return[];if(e===t)return[e];let n=t<e,[i,o,s]=n?sv(t,e,r):sv(e,t,r);if(!(o>=i))return[];let a=o-i+1,c=new Array(a);if(n)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 Fc(e,t,r){return t=+t,e=+e,r=+r,sv(e,t,r)[2]}function Eh(e,t,r){t=+t,e=+e,r=+r;let n=t<e,i=n?Fc(t,e,r):Fc(e,t,r);return(n?-1:1)*(i<0?1/-i:i)}function Dh(e,t,r){let n;for(;;){let i=Fc(e,t,r);if(i===n||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),n=i}}function Ql(e){return Math.max(1,Math.ceil(Math.log(Xs(e))/Math.LN2)+1)}function de(e,t){let r;if(t===void 0)for(let n of e)n!=null&&(r<n||r===void 0&&n>=n)&&(r=n);else{let n=-1;for(let i of e)(i=t(i,++n,e))!=null&&(r<i||r===void 0&&i>=i)&&(r=i)}return r}function av(e,t){let r,n=-1,i=-1;if(t===void 0)for(let o of e)++i,o!=null&&(r<o||r===void 0&&o>=o)&&(r=o,n=i);else for(let o of e)(o=t(o,++i,e))!=null&&(r<o||r===void 0&&o>=o)&&(r=o,n=i);return n}function Oe(e,t){let r;if(t===void 0)for(let n of e)n!=null&&(r>n||r===void 0&&n>=n)&&(r=n);else{let n=-1;for(let i of e)(i=t(i,++n,e))!=null&&(r>i||r===void 0&&i>=i)&&(r=i)}return r}function cv(e,t){let r,n=-1,i=-1;if(t===void 0)for(let o of e)++i,o!=null&&(r>o||r===void 0&&o>=o)&&(r=o,n=i);else for(let o of e)(o=t(o,++i,e))!=null&&(r>o||r===void 0&&o>=o)&&(r=o,n=i);return n}function lv(e,t,r=0,n=1/0,i){if(t=Math.floor(t),r=Math.floor(Math.max(0,r)),n=Math.floor(Math.min(e.length-1,n)),!(r<=t&&t<=n))return e;for(i=i===void 0?Bf:Pg(i);n>r;){if(n-r>600){let c=n-r+1,l=t-r+1,u=Math.log(c),f=.5*Math.exp(2*u/3),d=.5*Math.sqrt(u*f*(c-f)/c)*(l-c/2<0?-1:1),h=Math.max(r,Math.floor(t-l*f/c+d)),p=Math.min(n,Math.floor(t+(c-l)*f/c+d));lv(e,t,h,p,i)}let o=e[t],s=r,a=n;for($g(e,r,t),i(e[n],o)>0&&$g(e,r,n);s<a;){for($g(e,s,a),++s,--a;i(e[s],o)<0;)++s;for(;i(e[a],o)>0;)--a}i(e[r],o)===0?$g(e,r,a):(++a,$g(e,a,n)),a<=t&&(r=a+1),t<=a&&(n=a-1)}return e}function $g(e,t,r){let n=e[t];e[t]=e[r],e[r]=n}function Of(e,t=ie){let r,n=!1;if(t.length===1){let i;for(let o of e){let s=t(o);(n?ie(s,i)>0:ie(s,s)===0)&&(r=o,i=s,n=!0)}}else for(let i of e)(n?t(i,r)>0:t(i,i)===0)&&(r=i,n=!0);return r}function Hn(e,t,r){if(e=Float64Array.from(bP(e,r)),!(!(n=e.length)||isNaN(t=+t))){if(t<=0||n<2)return Oe(e);if(t>=1)return de(e);var n,i=(n-1)*t,o=Math.floor(i),s=de(lv(e,o).subarray(0,o+1)),a=Oe(e.subarray(o+1));return s+(a-s)*(i-o)}}function TD(e,t,r=kg){if(!(!(n=e.length)||isNaN(t=+t))){if(t<=0||n<2)return+r(e[0],0,e);if(t>=1)return+r(e[n-1],n-1,e);var n,i=(n-1)*t,o=Math.floor(i),s=+r(e[o],o,e),a=+r(e[o+1],o+1,e);return s+(a-s)*(i-o)}}function uv(e,t,r){let n=Xs(e),i=Hn(e,.75)-Hn(e,.25);return n&&i?Math.ceil((r-t)/(2*i*Math.pow(n,-1/3))):1}function zg(e,t,r){let n=Xs(e),i=go(e);return n&&i?Math.ceil((r-t)*Math.cbrt(n)/(3.49*i)):1}function Lc(e,t){let r=0,n=0;if(t===void 0)for(let i of e)i!=null&&(i=+i)>=i&&(++r,n+=i);else{let i=-1;for(let o of e)(o=t(o,++i,e))!=null&&(o=+o)>=o&&(++r,n+=o)}if(r)return n/r}function hs(e,t){return Hn(e,.5,t)}function*Ktt(e){for(let t of e)yield*t}function Bh(e){return Array.from(Ktt(e))}function Oh(e,t){let r=new Gn;if(t===void 0)for(let o of e)o!=null&&o>=o&&r.set(o,(r.get(o)||0)+1);else{let o=-1;for(let s of e)(s=t(s,++o,e))!=null&&s>=s&&r.set(s,(r.get(s)||0)+1)}let n,i=0;for(let[o,s]of r)s>i&&(i=s,n=o);return n}function fv(e,t=Qtt){let r=[],n,i=!1;for(let o of e)i&&r.push(t(n,o)),n=o,i=!0;return r}function Qtt(e,t){return[e,t]}function _r(e,t,r){e=+e,t=+t,r=(i=arguments.length)<2?(t=e,e=0,1):i<3?1:+r;for(var n=-1,i=Math.max(0,Math.ceil((t-e)/r))|0,o=new Array(i);++n<i;)o[n]=e+n*r;return o}function Vg(e,t=ie){if(typeof e[Symbol.iterator]!="function")throw new TypeError("values is not iterable");let r=Array.from(e),n=new Float64Array(r.length);t.length!==2&&(r=r.map(t),t=ie);let i=(a,c)=>t(r[a],r[c]),o,s;return e=Uint32Array.from(r,(a,c)=>c),e.sort(t===ie?(a,c)=>Bf(r[a],r[c]):Pg(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),n[a]=s):n[a]=NaN}),n}function dv(e,t=ie){let r,n=!1;if(t.length===1){let i;for(let o of e){let s=t(o);(n?ie(s,i)<0:ie(s,s)===0)&&(r=o,i=s,n=!0)}}else for(let i of e)(n?t(i,r)<0:t(i,i)===0)&&(r=i,n=!0);return r}function gn(e,t){let r=0;if(t===void 0)for(let n of e)(n=+n)&&(r+=n);else{let n=-1;for(let i of e)(i=+t(i,++n,e))&&(r+=i)}return r}function Jl(e){if(typeof e[Symbol.iterator]!="function")throw new TypeError("values is not iterable");return Array.from(e).reverse()}function AP(e){return e}var AD=1,MD=2,ED=3,hv=4,MP=1e-6;function Jtt(e){return"translate("+e+",0)"}function tet(e){return"translate(0,"+e+")"}function eet(e){return t=>+e(t)}function ret(e,t){return t=Math.max(0,e.bandwidth()-t*2)/2,e.round()&&(t=Math.round(t)),r=>+e(r)+t}function net(){return!this.__axis}function iet(e,t){var r=[],n=null,i=null,o=6,s=6,a=3,c=typeof window<"u"&&window.devicePixelRatio>1?0:.5,l=e===AD||e===hv?-1:1,u=e===hv||e===MD?"x":"y",f=e===AD||e===ED?Jtt:tet;function d(h){var p=n??(t.ticks?t.ticks.apply(t,r):t.domain()),y=i??(t.tickFormat?t.tickFormat.apply(t,r):AP),g=Math.max(o,0)+a,m=t.range(),b=+m[0]+c,x=+m[m.length-1]+c,_=(t.bandwidth?ret:eet)(t.copy(),c),v=h.selection?h.selection():h,w=v.selectAll(".domain").data([null]),I=v.selectAll(".tick").data(p,t).order(),D=I.exit(),A=I.enter().append("g").attr("class","tick"),B=I.select("line"),M=I.select("text");w=w.merge(w.enter().insert("path",".tick").attr("class","domain").attr("stroke","currentColor")),I=I.merge(A),B=B.merge(A.append("line").attr("stroke","currentColor").attr(u+"2",l*o)),M=M.merge(A.append("text").attr("fill","currentColor").attr(u,l*g).attr("dy",e===AD?"0em":e===ED?"0.71em":"0.32em")),h!==v&&(w=w.transition(h),I=I.transition(h),B=B.transition(h),M=M.transition(h),D=D.transition(h).attr("opacity",MP).attr("transform",function(O){return isFinite(O=_(O))?f(O+c):this.getAttribute("transform")}),A.attr("opacity",MP).attr("transform",function(O){var R=this.parentNode.__axis;return f((R&&isFinite(R=R(O))?R:_(O))+c)})),D.remove(),w.attr("d",e===hv||e===MD?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),I.attr("opacity",1).attr("transform",function(O){return f(_(O)+c)}),B.attr(u+"2",l*o),M.attr(u,l*g).text(y),v.filter(net).attr("fill","none").attr("font-size",10).attr("font-family","sans-serif").attr("text-anchor",e===MD?"start":e===hv?"end":"middle"),v.each(function(){this.__axis=_})}return d.scale=function(h){return arguments.length?(t=h,d):t},d.ticks=function(){return r=Array.from(arguments),d},d.tickArguments=function(h){return arguments.length?(r=h==null?[]:Array.from(h),d):r.slice()},d.tickValues=function(h){return arguments.length?(n=h==null?null:Array.from(h),d):n&&n.slice()},d.tickFormat=function(h){return arguments.length?(i=h,d):i},d.tickSize=function(h){return arguments.length?(o=s=+h,d):o},d.tickSizeInner=function(h){return arguments.length?(o=+h,d):o},d.tickSizeOuter=function(h){return arguments.length?(s=+h,d):s},d.tickPadding=function(h){return arguments.length?(a=+h,d):a},d.offset=function(h){return arguments.length?(c=+h,d):c},d}function DD(e){return iet(ED,e)}var oet={value:()=>{}};function DP(){for(var e=0,t=arguments.length,r={},n;e<t;++e){if(!(n=arguments[e]+"")||n in r||/[\s.]/.test(n))throw new Error("illegal type: "+n);r[n]=[]}return new pv(r)}function pv(e){this._=e}function set(e,t){return e.trim().split(/^|\s+/).map(function(r){var n="",i=r.indexOf(".");if(i>=0&&(n=r.slice(i+1),r=r.slice(0,i)),r&&!t.hasOwnProperty(r))throw new Error("unknown type: "+r);return{type:r,name:n}})}pv.prototype=DP.prototype={constructor:pv,on:function(e,t){var r=this._,n=set(e+"",r),i,o=-1,s=n.length;if(arguments.length<2){for(;++o<s;)if((i=(e=n[o]).type)&&(i=aet(r[i],e.name)))return i;return}if(t!=null&&typeof t!="function")throw new Error("invalid callback: "+t);for(;++o<s;)if(i=(e=n[o]).type)r[i]=EP(r[i],e.name,t);else if(t==null)for(i in r)r[i]=EP(r[i],e.name,null);return this},copy:function(){var e={},t=this._;for(var r in t)e[r]=t[r].slice();return new pv(e)},call:function(e,t){if((i=arguments.length-2)>0)for(var r=new Array(i),n=0,i,o;n<i;++n)r[n]=arguments[n+2];if(!this._.hasOwnProperty(e))throw new Error("unknown type: "+e);for(o=this._[e],n=0,i=o.length;n<i;++n)o[n].value.apply(t,r)},apply:function(e,t,r){if(!this._.hasOwnProperty(e))throw new Error("unknown type: "+e);for(var n=this._[e],i=0,o=n.length;i<o;++i)n[i].value.apply(t,r)}};function aet(e,t){for(var r=0,n=e.length,i;r<n;++r)if((i=e[r]).name===t)return i.value}function EP(e,t,r){for(var n=0,i=e.length;n<i;++n)if(e[n].name===t){e[n]=oet,e=e.slice(0,n).concat(e.slice(n+1));break}return r!=null&&e.push({name:t,value:r}),e}var Nf=DP;var mv="http://www.w3.org/1999/xhtml",bo={svg:"http://www.w3.org/2000/svg",xhtml:mv,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};function Rc(e){var t=e+="",r=t.indexOf(":");return r>=0&&(t=e.slice(0,r))!=="xmlns"&&(e=e.slice(r+1)),bo.hasOwnProperty(t)?{space:bo[t],local:e}:e}function cet(e){return function(){var t=this.ownerDocument,r=this.namespaceURI;return r===mv&&t.documentElement.namespaceURI===mv?t.createElement(e):t.createElementNS(r,e)}}function uet(e){return function(){return this.ownerDocument.createElementNS(e.space,e.local)}}function kc(e){var t=Rc(e);return(t.local?uet:cet)(t)}function fet(){}function Ff(e){return e==null?fet:function(){return this.querySelector(e)}}function BP(e){typeof e!="function"&&(e=Ff(e));for(var t=this._groups,r=t.length,n=new Array(r),i=0;i<r;++i)for(var o=t[i],s=o.length,a=n[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 mr(n,this._parents)}function BD(e){return e==null?[]:Array.isArray(e)?e:Array.from(e)}function det(){return[]}function jg(e){return e==null?det:function(){return this.querySelectorAll(e)}}function het(e){return function(){return BD(e.apply(this,arguments))}}function OP(e){typeof e=="function"?e=het(e):e=jg(e);for(var t=this._groups,r=t.length,n=[],i=[],o=0;o<r;++o)for(var s=t[o],a=s.length,c,l=0;l<a;++l)(c=s[l])&&(n.push(e.call(c,c.__data__,l,s)),i.push(c));return new mr(n,i)}function qg(e){return function(){return this.matches(e)}}function yv(e){return function(t){return t.matches(e)}}var pet=Array.prototype.find;function met(e){return function(){return pet.call(this.children,e)}}function yet(){return this.firstElementChild}function NP(e){return this.select(e==null?yet:met(typeof e=="function"?e:yv(e)))}var get=Array.prototype.filter;function bet(){return Array.from(this.children)}function xet(e){return function(){return get.call(this.children,e)}}function FP(e){return this.selectAll(e==null?bet:xet(typeof e=="function"?e:yv(e)))}function LP(e){typeof e!="function"&&(e=qg(e));for(var t=this._groups,r=t.length,n=new Array(r),i=0;i<r;++i)for(var o=t[i],s=o.length,a=n[i]=[],c,l=0;l<s;++l)(c=o[l])&&e.call(c,c.__data__,l,o)&&a.push(c);return new mr(n,this._parents)}function gv(e){return new Array(e.length)}function RP(){return new mr(this._enter||this._groups.map(gv),this._parents)}function Yg(e,t){this.ownerDocument=e.ownerDocument,this.namespaceURI=e.namespaceURI,this._next=null,this._parent=e,this.__data__=t}Yg.prototype={constructor:Yg,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 kP(e){return function(){return e}}function _et(e,t,r,n,i,o){for(var s=0,a,c=t.length,l=o.length;s<l;++s)(a=t[s])?(a.__data__=o[s],n[s]=a):r[s]=new Yg(e,o[s]);for(;s<c;++s)(a=t[s])&&(i[s]=a)}function wet(e,t,r,n,i,o,s){var a,c,l=new Map,u=t.length,f=o.length,d=new Array(u),h;for(a=0;a<u;++a)(c=t[a])&&(d[a]=h=s.call(c,c.__data__,a,t)+"",l.has(h)?i[a]=c:l.set(h,c));for(a=0;a<f;++a)h=s.call(e,o[a],a,o)+"",(c=l.get(h))?(n[a]=c,c.__data__=o[a],l.delete(h)):r[a]=new Yg(e,o[a]);for(a=0;a<u;++a)(c=t[a])&&l.get(d[a])===c&&(i[a]=c)}function vet(e){return e.__data__}function CP(e,t){if(!arguments.length)return Array.from(this,vet);var r=t?wet:_et,n=this._parents,i=this._groups;typeof e!="function"&&(e=kP(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=n[l],f=i[l],d=f.length,h=Iet(e.call(u,u&&u.__data__,l,n)),p=h.length,y=a[l]=new Array(p),g=s[l]=new Array(p),m=c[l]=new Array(d);r(u,f,y,g,m,h,t);for(var b=0,x=0,_,v;b<p;++b)if(_=y[b]){for(b>=x&&(x=b+1);!(v=g[x])&&++x<p;);_._next=v||null}}return s=new mr(s,n),s._enter=a,s._exit=c,s}function Iet(e){return typeof e=="object"&&"length"in e?e:Array.from(e)}function UP(){return new mr(this._exit||this._groups.map(gv),this._parents)}function PP(e,t,r){var n=this.enter(),i=this,o=this.exit();return typeof e=="function"?(n=e(n),n&&(n=n.selection())):n=n.append(e+""),t!=null&&(i=t(i),i&&(i=i.selection())),r==null?o.remove():r(o),n&&i?n.merge(i).order():i}function $P(e){for(var t=e.selection?e.selection():e,r=this._groups,n=t._groups,i=r.length,o=n.length,s=Math.min(i,o),a=new Array(i),c=0;c<s;++c)for(var l=r[c],u=n[c],f=l.length,d=a[c]=new Array(f),h,p=0;p<f;++p)(h=l[p]||u[p])&&(d[p]=h);for(;c<i;++c)a[c]=r[c];return new mr(a,this._parents)}function zP(){for(var e=this._groups,t=-1,r=e.length;++t<r;)for(var n=e[t],i=n.length-1,o=n[i],s;--i>=0;)(s=n[i])&&(o&&s.compareDocumentPosition(o)^4&&o.parentNode.insertBefore(s,o),o=s);return this}function VP(e){e||(e=Tet);function t(f,d){return f&&d?e(f.__data__,d.__data__):!f-!d}for(var r=this._groups,n=r.length,i=new Array(n),o=0;o<n;++o){for(var s=r[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 mr(i,this._parents).order()}function Tet(e,t){return e<t?-1:e>t?1:e>=t?0:NaN}function jP(){var e=arguments[0];return arguments[0]=this,e.apply(null,arguments),this}function qP(){return Array.from(this)}function YP(){for(var e=this._groups,t=0,r=e.length;t<r;++t)for(var n=e[t],i=0,o=n.length;i<o;++i){var s=n[i];if(s)return s}return null}function WP(){let e=0;for(let t of this)++e;return e}function GP(){return!this.node()}function XP(e){for(var t=this._groups,r=0,n=t.length;r<n;++r)for(var i=t[r],o=0,s=i.length,a;o<s;++o)(a=i[o])&&e.call(a,a.__data__,o,i);return this}function Aet(e){return function(){this.removeAttribute(e)}}function Met(e){return function(){this.removeAttributeNS(e.space,e.local)}}function Eet(e,t){return function(){this.setAttribute(e,t)}}function Det(e,t){return function(){this.setAttributeNS(e.space,e.local,t)}}function Bet(e,t){return function(){var r=t.apply(this,arguments);r==null?this.removeAttribute(e):this.setAttribute(e,r)}}function Oet(e,t){return function(){var r=t.apply(this,arguments);r==null?this.removeAttributeNS(e.space,e.local):this.setAttributeNS(e.space,e.local,r)}}function HP(e,t){var r=Rc(e);if(arguments.length<2){var n=this.node();return r.local?n.getAttributeNS(r.space,r.local):n.getAttribute(r)}return this.each((t==null?r.local?Met:Aet:typeof t=="function"?r.local?Oet:Bet:r.local?Det:Eet)(r,t))}function bv(e){return e.ownerDocument&&e.ownerDocument.defaultView||e.document&&e||e.defaultView}function Net(e){return function(){this.style.removeProperty(e)}}function Fet(e,t,r){return function(){this.style.setProperty(e,t,r)}}function Let(e,t,r){return function(){var n=t.apply(this,arguments);n==null?this.style.removeProperty(e):this.style.setProperty(e,n,r)}}function ZP(e,t,r){return arguments.length>1?this.each((t==null?Net:typeof t=="function"?Let:Fet)(e,t,r??"")):tu(this.node(),e)}function tu(e,t){return e.style.getPropertyValue(t)||bv(e).getComputedStyle(e,null).getPropertyValue(t)}function Ret(e){return function(){delete this[e]}}function ket(e,t){return function(){this[e]=t}}function Cet(e,t){return function(){var r=t.apply(this,arguments);r==null?delete this[e]:this[e]=r}}function KP(e,t){return arguments.length>1?this.each((t==null?Ret:typeof t=="function"?Cet:ket)(e,t)):this.node()[e]}function QP(e){return e.trim().split(/^|\s+/)}function OD(e){return e.classList||new JP(e)}function JP(e){this._node=e,this._names=QP(e.getAttribute("class")||"")}JP.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 t7(e,t){for(var r=OD(e),n=-1,i=t.length;++n<i;)r.add(t[n])}function e7(e,t){for(var r=OD(e),n=-1,i=t.length;++n<i;)r.remove(t[n])}function Uet(e){return function(){t7(this,e)}}function Pet(e){return function(){e7(this,e)}}function $et(e,t){return function(){(t.apply(this,arguments)?t7:e7)(this,e)}}function r7(e,t){var r=QP(e+"");if(arguments.length<2){for(var n=OD(this.node()),i=-1,o=r.length;++i<o;)if(!n.contains(r[i]))return!1;return!0}return this.each((typeof t=="function"?$et:t?Uet:Pet)(r,t))}function zet(){this.textContent=""}function Vet(e){return function(){this.textContent=e}}function jet(e){return function(){var t=e.apply(this,arguments);this.textContent=t??""}}function n7(e){return arguments.length?this.each(e==null?zet:(typeof e=="function"?jet:Vet)(e)):this.node().textContent}function qet(){this.innerHTML=""}function Yet(e){return function(){this.innerHTML=e}}function Wet(e){return function(){var t=e.apply(this,arguments);this.innerHTML=t??""}}function i7(e){return arguments.length?this.each(e==null?qet:(typeof e=="function"?Wet:Yet)(e)):this.node().innerHTML}function Get(){this.nextSibling&&this.parentNode.appendChild(this)}function o7(){return this.each(Get)}function Xet(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function s7(){return this.each(Xet)}function a7(e){var t=typeof e=="function"?e:kc(e);return this.select(function(){return this.appendChild(t.apply(this,arguments))})}function Het(){return null}function c7(e,t){var r=typeof e=="function"?e:kc(e),n=t==null?Het:typeof t=="function"?t:Ff(t);return this.select(function(){return this.insertBefore(r.apply(this,arguments),n.apply(this,arguments)||null)})}function Zet(){var e=this.parentNode;e&&e.removeChild(this)}function l7(){return this.each(Zet)}function Ket(){var e=this.cloneNode(!1),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function Qet(){var e=this.cloneNode(!0),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function u7(e){return this.select(e?Qet:Ket)}function f7(e){return arguments.length?this.property("__data__",e):this.node().__data__}function Jet(e){return function(t){e.call(this,t,this.__data__)}}function trt(e){return e.trim().split(/^|\s+/).map(function(t){var r="",n=t.indexOf(".");return n>=0&&(r=t.slice(n+1),t=t.slice(0,n)),{type:t,name:r}})}function ert(e){return function(){var t=this.__on;if(t){for(var r=0,n=-1,i=t.length,o;r<i;++r)o=t[r],(!e.type||o.type===e.type)&&o.name===e.name?this.removeEventListener(o.type,o.listener,o.options):t[++n]=o;++n?t.length=n:delete this.__on}}}function rrt(e,t,r){return function(){var n=this.__on,i,o=Jet(t);if(n){for(var s=0,a=n.length;s<a;++s)if((i=n[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=r),i.value=t;return}}this.addEventListener(e.type,o,r),i={type:e.type,name:e.name,value:t,listener:o,options:r},n?n.push(i):this.__on=[i]}}function d7(e,t,r){var n=trt(e+""),i,o=n.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=n[i]).type===u.type&&s.name===u.name)return u.value}return}for(a=t?rrt:ert,i=0;i<o;++i)this.each(a(n[i],t,r));return this}function h7(e,t,r){var n=bv(e),i=n.CustomEvent;typeof i=="function"?i=new i(t,r):(i=n.document.createEvent("Event"),r?(i.initEvent(t,r.bubbles,r.cancelable),i.detail=r.detail):i.initEvent(t,!1,!1)),e.dispatchEvent(i)}function nrt(e,t){return function(){return h7(this,e,t)}}function irt(e,t){return function(){return h7(this,e,t.apply(this,arguments))}}function p7(e,t){return this.each((typeof t=="function"?irt:nrt)(e,t))}function*m7(){for(var e=this._groups,t=0,r=e.length;t<r;++t)for(var n=e[t],i=0,o=n.length,s;i<o;++i)(s=n[i])&&(yield s)}var ND=[null];function mr(e,t){this._groups=e,this._parents=t}function y7(){return new mr([[document.documentElement]],ND)}function ort(){return this}mr.prototype=y7.prototype={constructor:mr,select:BP,selectAll:OP,selectChild:NP,selectChildren:FP,filter:LP,data:CP,enter:RP,exit:UP,join:PP,merge:$P,selection:ort,order:zP,sort:VP,call:jP,nodes:qP,node:YP,size:WP,empty:GP,each:XP,attr:HP,style:ZP,property:KP,classed:r7,text:n7,html:i7,raise:o7,lower:s7,append:a7,insert:c7,remove:l7,clone:u7,datum:f7,on:d7,dispatch:p7,[Symbol.iterator]:m7};var Cc=y7;function ae(e){return typeof e=="string"?new mr([[document.querySelector(e)]],[document.documentElement]):new mr([[e]],ND)}function g7(e){let t;for(;t=e.sourceEvent;)e=t;return e}function Mn(e,t){if(e=g7(e),t===void 0&&(t=e.currentTarget),t){var r=t.ownerSVGElement||t;if(r.createSVGPoint){var n=r.createSVGPoint();return n.x=e.clientX,n.y=e.clientY,n=n.matrixTransform(t.getScreenCTM().inverse()),[n.x,n.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 xv={capture:!0,passive:!1};function _v(e){e.preventDefault(),e.stopImmediatePropagation()}function Wg(e){var t=e.document.documentElement,r=ae(e).on("dragstart.drag",_v,xv);"onselectstart"in t?r.on("selectstart.drag",_v,xv):(t.__noselect=t.style.MozUserSelect,t.style.MozUserSelect="none")}function Gg(e,t){var r=e.document.documentElement,n=ae(e).on("dragstart.drag",null);t&&(n.on("click.drag",_v,xv),setTimeout(function(){n.on("click.drag",null)},0)),"onselectstart"in r?n.on("selectstart.drag",null):(r.style.MozUserSelect=r.__noselect,delete r.__noselect)}function Uc(e,t,r){e.prototype=t.prototype=r,r.constructor=e}function eu(e,t){var r=Object.create(e.prototype);for(var n in t)r[n]=t[n];return r}function Ks(){}var ru=.7,kf=1/ru,Nh="\\s*([+-]?\\d+)\\s*",Xg="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",Zs="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",srt=/^#([0-9a-f]{3,8})$/,art=new RegExp(`^rgb\\(${Nh},${Nh},${Nh}\\)$`),crt=new RegExp(`^rgb\\(${Zs},${Zs},${Zs}\\)$`),lrt=new RegExp(`^rgba\\(${Nh},${Nh},${Nh},${Xg}\\)$`),urt=new RegExp(`^rgba\\(${Zs},${Zs},${Zs},${Xg}\\)$`),frt=new RegExp(`^hsl\\(${Xg},${Zs},${Zs}\\)$`),drt=new RegExp(`^hsla\\(${Xg},${Zs},${Zs},${Xg}\\)$`),b7={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};Uc(Ks,Vi,{copy(e){return Object.assign(new this.constructor,this,e)},displayable(){return this.rgb().displayable()},hex:x7,formatHex:x7,formatHex8:hrt,formatHsl:prt,formatRgb:_7,toString:_7});function x7(){return this.rgb().formatHex()}function hrt(){return this.rgb().formatHex8()}function prt(){return A7(this).formatHsl()}function _7(){return this.rgb().formatRgb()}function Vi(e){var t,r;return e=(e+"").trim().toLowerCase(),(t=srt.exec(e))?(r=t[1].length,t=parseInt(t[1],16),r===6?w7(t):r===3?new Or(t>>8&15|t>>4&240,t>>4&15|t&240,(t&15)<<4|t&15,1):r===8?wv(t>>24&255,t>>16&255,t>>8&255,(t&255)/255):r===4?wv(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=art.exec(e))?new Or(t[1],t[2],t[3],1):(t=crt.exec(e))?new Or(t[1]*255/100,t[2]*255/100,t[3]*255/100,1):(t=lrt.exec(e))?wv(t[1],t[2],t[3],t[4]):(t=urt.exec(e))?wv(t[1]*255/100,t[2]*255/100,t[3]*255/100,t[4]):(t=frt.exec(e))?I7(t[1],t[2]/100,t[3]/100,1):(t=drt.exec(e))?I7(t[1],t[2]/100,t[3]/100,t[4]):b7.hasOwnProperty(e)?w7(b7[e]):e==="transparent"?new Or(NaN,NaN,NaN,0):null}function w7(e){return new Or(e>>16&255,e>>8&255,e&255,1)}function wv(e,t,r,n){return n<=0&&(e=t=r=NaN),new Or(e,t,r,n)}function Hg(e){return e instanceof Ks||(e=Vi(e)),e?(e=e.rgb(),new Or(e.r,e.g,e.b,e.opacity)):new Or}function qr(e,t,r,n){return arguments.length===1?Hg(e):new Or(e,t,r,n??1)}function Or(e,t,r,n){this.r=+e,this.g=+t,this.b=+r,this.opacity=+n}Uc(Or,qr,eu(Ks,{brighter(e){return e=e==null?kf:Math.pow(kf,e),new Or(this.r*e,this.g*e,this.b*e,this.opacity)},darker(e){return e=e==null?ru:Math.pow(ru,e),new Or(this.r*e,this.g*e,this.b*e,this.opacity)},rgb(){return this},clamp(){return new Or(Rf(this.r),Rf(this.g),Rf(this.b),Sv(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:v7,formatHex:v7,formatHex8:mrt,formatRgb:S7,toString:S7}));function v7(){return`#${Lf(this.r)}${Lf(this.g)}${Lf(this.b)}`}function mrt(){return`#${Lf(this.r)}${Lf(this.g)}${Lf(this.b)}${Lf((isNaN(this.opacity)?1:this.opacity)*255)}`}function S7(){let e=Sv(this.opacity);return`${e===1?"rgb(":"rgba("}${Rf(this.r)}, ${Rf(this.g)}, ${Rf(this.b)}${e===1?")":`, ${e})`}`}function Sv(e){return isNaN(e)?1:Math.max(0,Math.min(1,e))}function Rf(e){return Math.max(0,Math.min(255,Math.round(e)||0))}function Lf(e){return e=Rf(e),(e<16?"0":"")+e.toString(16)}function I7(e,t,r,n){return n<=0?e=t=r=NaN:r<=0||r>=1?e=t=NaN:t<=0&&(e=NaN),new ps(e,t,r,n)}function A7(e){if(e instanceof ps)return new ps(e.h,e.s,e.l,e.opacity);if(e instanceof Ks||(e=Vi(e)),!e)return new ps;if(e instanceof ps)return e;e=e.rgb();var t=e.r/255,r=e.g/255,n=e.b/255,i=Math.min(t,r,n),o=Math.max(t,r,n),s=NaN,a=o-i,c=(o+i)/2;return a?(t===o?s=(r-n)/a+(r<n)*6:r===o?s=(n-t)/a+2:s=(t-r)/a+4,a/=c<.5?o+i:2-o-i,s*=60):a=c>0&&c<1?0:s,new ps(s,a,c,e.opacity)}function Zg(e,t,r,n){return arguments.length===1?A7(e):new ps(e,t,r,n??1)}function ps(e,t,r,n){this.h=+e,this.s=+t,this.l=+r,this.opacity=+n}Uc(ps,Zg,eu(Ks,{brighter(e){return e=e==null?kf:Math.pow(kf,e),new ps(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=e==null?ru:Math.pow(ru,e),new ps(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,r=this.l,n=r+(r<.5?r:1-r)*t,i=2*r-n;return new Or(FD(e>=240?e-240:e+120,i,n),FD(e,i,n),FD(e<120?e+240:e-120,i,n),this.opacity)},clamp(){return new ps(T7(this.h),vv(this.s),vv(this.l),Sv(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=Sv(this.opacity);return`${e===1?"hsl(":"hsla("}${T7(this.h)}, ${vv(this.s)*100}%, ${vv(this.l)*100}%${e===1?")":`, ${e})`}`}}));function T7(e){return e=(e||0)%360,e<0?e+360:e}function vv(e){return Math.max(0,Math.min(1,e||0))}function FD(e,t,r){return(e<60?t+(r-t)*e/60:e<180?r:e<240?t+(r-t)*(240-e)/60:t)*255}var Iv=Math.PI/180,Tv=180/Math.PI;var Av=18,M7=.96422,E7=1,D7=.82521,B7=4/29,Fh=6/29,O7=3*Fh*Fh,yrt=Fh*Fh*Fh;function N7(e){if(e instanceof Qs)return new Qs(e.l,e.a,e.b,e.opacity);if(e instanceof Pc)return F7(e);e instanceof Or||(e=Hg(e));var t=CD(e.r),r=CD(e.g),n=CD(e.b),i=LD((.2225045*t+.7168786*r+.0606169*n)/E7),o,s;return t===r&&r===n?o=s=i:(o=LD((.4360747*t+.3850649*r+.1430804*n)/M7),s=LD((.0139322*t+.0971045*r+.7141733*n)/D7)),new Qs(116*i-16,500*(o-i),200*(i-s),e.opacity)}function Lh(e,t,r,n){return arguments.length===1?N7(e):new Qs(e,t,r,n??1)}function Qs(e,t,r,n){this.l=+e,this.a=+t,this.b=+r,this.opacity=+n}Uc(Qs,Lh,eu(Ks,{brighter(e){return new Qs(this.l+Av*(e??1),this.a,this.b,this.opacity)},darker(e){return new Qs(this.l-Av*(e??1),this.a,this.b,this.opacity)},rgb(){var e=(this.l+16)/116,t=isNaN(this.a)?e:e+this.a/500,r=isNaN(this.b)?e:e-this.b/200;return t=M7*RD(t),e=E7*RD(e),r=D7*RD(r),new Or(kD(3.1338561*t-1.6168667*e-.4906146*r),kD(-.9787684*t+1.9161415*e+.033454*r),kD(.0719453*t-.2289914*e+1.4052427*r),this.opacity)}}));function LD(e){return e>yrt?Math.pow(e,1/3):e/O7+B7}function RD(e){return e>Fh?e*e*e:O7*(e-B7)}function kD(e){return 255*(e<=.0031308?12.92*e:1.055*Math.pow(e,1/2.4)-.055)}function CD(e){return(e/=255)<=.04045?e/12.92:Math.pow((e+.055)/1.055,2.4)}function grt(e){if(e instanceof Pc)return new Pc(e.h,e.c,e.l,e.opacity);if(e instanceof Qs||(e=N7(e)),e.a===0&&e.b===0)return new Pc(NaN,0<e.l&&e.l<100?0:NaN,e.l,e.opacity);var t=Math.atan2(e.b,e.a)*Tv;return new Pc(t<0?t+360:t,Math.sqrt(e.a*e.a+e.b*e.b),e.l,e.opacity)}function Kg(e,t,r,n){return arguments.length===1?grt(e):new Pc(e,t,r,n??1)}function Pc(e,t,r,n){this.h=+e,this.c=+t,this.l=+r,this.opacity=+n}function F7(e){if(isNaN(e.h))return new Qs(e.l,0,0,e.opacity);var t=e.h*Iv;return new Qs(e.l,Math.cos(t)*e.c,Math.sin(t)*e.c,e.opacity)}Uc(Pc,Kg,eu(Ks,{brighter(e){return new Pc(this.h,this.c,this.l+Av*(e??1),this.opacity)},darker(e){return new Pc(this.h,this.c,this.l-Av*(e??1),this.opacity)},rgb(){return F7(this).rgb()}}));var C7=-.14861,UD=1.78277,PD=-.29227,Mv=-.90649,Qg=1.97294,L7=Qg*Mv,R7=Qg*UD,k7=UD*PD-Mv*C7;function brt(e){if(e instanceof Cf)return new Cf(e.h,e.s,e.l,e.opacity);e instanceof Or||(e=Hg(e));var t=e.r/255,r=e.g/255,n=e.b/255,i=(k7*n+L7*t-R7*r)/(k7+L7-R7),o=n-i,s=(Qg*(r-i)-PD*o)/Mv,a=Math.sqrt(s*s+o*o)/(Qg*i*(1-i)),c=a?Math.atan2(s,o)*Tv-120:NaN;return new Cf(c<0?c+360:c,a,i,e.opacity)}function Zn(e,t,r,n){return arguments.length===1?brt(e):new Cf(e,t,r,n??1)}function Cf(e,t,r,n){this.h=+e,this.s=+t,this.l=+r,this.opacity=+n}Uc(Cf,Zn,eu(Ks,{brighter(e){return e=e==null?kf:Math.pow(kf,e),new Cf(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=e==null?ru:Math.pow(ru,e),new Cf(this.h,this.s,this.l*e,this.opacity)},rgb(){var e=isNaN(this.h)?0:(this.h+120)*Iv,t=+this.l,r=isNaN(this.s)?0:this.s*t*(1-t),n=Math.cos(e),i=Math.sin(e);return new Or(255*(t+r*(C7*n+UD*i)),255*(t+r*(PD*n+Mv*i)),255*(t+r*(Qg*n)),this.opacity)}}));function $D(e,t,r,n,i){var o=e*e,s=o*e;return((1-3*e+3*o-s)*t+(4-6*o+3*s)*r+(1+3*e+3*o-3*s)*n+s*i)/6}function U7(e){var t=e.length-1;return function(r){var n=r<=0?r=0:r>=1?(r=1,t-1):Math.floor(r*t),i=e[n],o=e[n+1],s=n>0?e[n-1]:2*i-o,a=n<t-1?e[n+2]:2*o-i;return $D((r-n/t)*t,s,i,o,a)}}function P7(e){var t=e.length;return function(r){var n=Math.floor(((r%=1)<0?++r:r)*t),i=e[(n+t-1)%t],o=e[n%t],s=e[(n+1)%t],a=e[(n+2)%t];return $D((r-n/t)*t,i,o,s,a)}}var Rh=e=>()=>e;function $7(e,t){return function(r){return e+r*t}}function xrt(e,t,r){return e=Math.pow(e,r),t=Math.pow(t,r)-e,r=1/r,function(n){return Math.pow(e+n*t,r)}}function kh(e,t){var r=t-e;return r?$7(e,r>180||r<-180?r-360*Math.round(r/360):r):Rh(isNaN(e)?t:e)}function z7(e){return(e=+e)==1?rr:function(t,r){return r-t?xrt(t,r,e):Rh(isNaN(t)?r:t)}}function rr(e,t){var r=t-e;return r?$7(e,r):Rh(isNaN(e)?t:e)}var xo=function e(t){var r=z7(t);function n(i,o){var s=r((i=qr(i)).r,(o=qr(o)).r),a=r(i.g,o.g),c=r(i.b,o.b),l=rr(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 n.gamma=e,n}(1);function V7(e){return function(t){var r=t.length,n=new Array(r),i=new Array(r),o=new Array(r),s,a;for(s=0;s<r;++s)a=qr(t[s]),n[s]=a.r||0,i[s]=a.g||0,o[s]=a.b||0;return n=e(n),i=e(i),o=e(o),a.opacity=1,function(c){return a.r=n(c),a.g=i(c),a.b=o(c),a+""}}}var zD=V7(U7),_rt=V7(P7);function j7(e,t){t||(t=[]);var r=e?Math.min(t.length,e.length):0,n=t.slice(),i;return function(o){for(i=0;i<r;++i)n[i]=e[i]*(1-o)+t[i]*o;return n}}function q7(e){return ArrayBuffer.isView(e)&&!(e instanceof DataView)}function Y7(e,t){var r=t?t.length:0,n=e?Math.min(r,e.length):0,i=new Array(n),o=new Array(r),s;for(s=0;s<n;++s)i[s]=ji(e[s],t[s]);for(;s<r;++s)o[s]=t[s];return function(a){for(s=0;s<n;++s)o[s]=i[s](a);return o}}function W7(e,t){var r=new Date;return e=+e,t=+t,function(n){return r.setTime(e*(1-n)+t*n),r}}function Ze(e,t){return e=+e,t=+t,function(r){return e*(1-r)+t*r}}function G7(e,t){var r={},n={},i;(e===null||typeof e!="object")&&(e={}),(t===null||typeof t!="object")&&(t={});for(i in t)i in e?r[i]=ji(e[i],t[i]):n[i]=t[i];return function(o){for(i in r)n[i]=r[i](o);return n}}var jD=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,VD=new RegExp(jD.source,"g");function wrt(e){return function(){return e}}function vrt(e){return function(t){return e(t)+""}}function Jg(e,t){var r=jD.lastIndex=VD.lastIndex=0,n,i,o,s=-1,a=[],c=[];for(e=e+"",t=t+"";(n=jD.exec(e))&&(i=VD.exec(t));)(o=i.index)>r&&(o=t.slice(r,o),a[s]?a[s]+=o:a[++s]=o),(n=n[0])===(i=i[0])?a[s]?a[s]+=i:a[++s]=i:(a[++s]=null,c.push({i:s,x:Ze(n,i)})),r=VD.lastIndex;return r<t.length&&(o=t.slice(r),a[s]?a[s]+=o:a[++s]=o),a.length<2?c[0]?vrt(c[0].x):wrt(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 ji(e,t){var r=typeof t,n;return t==null||r==="boolean"?Rh(t):(r==="number"?Ze:r==="string"?(n=Vi(t))?(t=n,xo):Jg:t instanceof Vi?xo:t instanceof Date?W7:q7(t)?j7:Array.isArray(t)?Y7:typeof t.valueOf!="function"&&typeof t.toString!="function"||isNaN(t)?G7:Ze)(e,t)}function Uf(e,t){return e=+e,t=+t,function(r){return Math.round(e*(1-r)+t*r)}}var X7=180/Math.PI,Ev={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1};function qD(e,t,r,n,i,o){var s,a,c;return(s=Math.sqrt(e*e+t*t))&&(e/=s,t/=s),(c=e*r+t*n)&&(r-=e*c,n-=t*c),(a=Math.sqrt(r*r+n*n))&&(r/=a,n/=a,c/=a),e*n<t*r&&(e=-e,t=-t,c=-c,s=-s),{translateX:i,translateY:o,rotate:Math.atan2(t,e)*X7,skewX:Math.atan(c)*X7,scaleX:s,scaleY:a}}var Dv;function H7(e){let t=new(typeof DOMMatrix=="function"?DOMMatrix:WebKitCSSMatrix)(e+"");return t.isIdentity?Ev:qD(t.a,t.b,t.c,t.d,t.e,t.f)}function Z7(e){return e==null?Ev:(Dv||(Dv=document.createElementNS("http://www.w3.org/2000/svg","g")),Dv.setAttribute("transform",e),(e=Dv.transform.baseVal.consolidate())?(e=e.matrix,qD(e.a,e.b,e.c,e.d,e.e,e.f)):Ev)}function K7(e,t,r,n){function i(l){return l.length?l.pop()+" ":""}function o(l,u,f,d,h,p){if(l!==f||u!==d){var y=h.push("translate(",null,t,null,r);p.push({i:y-4,x:Ze(l,f)},{i:y-2,x:Ze(u,d)})}else(f||d)&&h.push("translate("+f+t+d+r)}function s(l,u,f,d){l!==u?(l-u>180?u+=360:u-l>180&&(l+=360),d.push({i:f.push(i(f)+"rotate(",null,n)-2,x:Ze(l,u)})):u&&f.push(i(f)+"rotate("+u+n)}function a(l,u,f,d){l!==u?d.push({i:f.push(i(f)+"skewX(",null,n)-2,x:Ze(l,u)}):u&&f.push(i(f)+"skewX("+u+n)}function c(l,u,f,d,h,p){if(l!==f||u!==d){var y=h.push(i(h)+"scale(",null,",",null,")");p.push({i:y-4,x:Ze(l,f)},{i:y-2,x:Ze(u,d)})}else(f!==1||d!==1)&&h.push(i(h)+"scale("+f+","+d+")")}return function(l,u){var f=[],d=[];return l=e(l),u=e(u),o(l.translateX,l.translateY,u.translateX,u.translateY,f,d),s(l.rotate,u.rotate,f,d),a(l.skewX,u.skewX,f,d),c(l.scaleX,l.scaleY,u.scaleX,u.scaleY,f,d),l=u=null,function(h){for(var p=-1,y=d.length,g;++p<y;)f[(g=d[p]).i]=g.x(h);return f.join("")}}}var YD=K7(H7,"px, ","px)","deg)"),WD=K7(Z7,", ",")",")");var Srt=1e-12;function Q7(e){return((e=Math.exp(e))+1/e)/2}function Irt(e){return((e=Math.exp(e))-1/e)/2}function Trt(e){return((e=Math.exp(2*e))-1)/(e+1)}var GD=function e(t,r,n){function i(o,s){var a=o[0],c=o[1],l=o[2],u=s[0],f=s[1],d=s[2],h=u-a,p=f-c,y=h*h+p*p,g,m;if(y<Srt)m=Math.log(d/l)/t,g=function(I){return[a+I*h,c+I*p,l*Math.exp(t*I*m)]};else{var b=Math.sqrt(y),x=(d*d-l*l+n*y)/(2*l*r*b),_=(d*d-l*l-n*y)/(2*d*r*b),v=Math.log(Math.sqrt(x*x+1)-x),w=Math.log(Math.sqrt(_*_+1)-_);m=(w-v)/t,g=function(I){var D=I*m,A=Q7(v),B=l/(r*b)*(A*Trt(t*D+v)-Irt(v));return[a+B*h,c+B*p,l*A/Q7(t*D+v)]}}return g.duration=m*1e3*t/Math.SQRT2,g}return i.rho=function(o){var s=Math.max(.001,+o),a=s*s,c=a*a;return e(s,a,c)},i}(Math.SQRT2,2,4);function J7(e){return function(t,r){var n=e((t=Zg(t)).h,(r=Zg(r)).h),i=rr(t.s,r.s),o=rr(t.l,r.l),s=rr(t.opacity,r.opacity);return function(a){return t.h=n(a),t.s=i(a),t.l=o(a),t.opacity=s(a),t+""}}}var XD=J7(kh),Art=J7(rr);function Bv(e,t){var r=rr((e=Lh(e)).l,(t=Lh(t)).l),n=rr(e.a,t.a),i=rr(e.b,t.b),o=rr(e.opacity,t.opacity);return function(s){return e.l=r(s),e.a=n(s),e.b=i(s),e.opacity=o(s),e+""}}function t9(e){return function(t,r){var n=e((t=Kg(t)).h,(r=Kg(r)).h),i=rr(t.c,r.c),o=rr(t.l,r.l),s=rr(t.opacity,r.opacity);return function(a){return t.h=n(a),t.c=i(a),t.l=o(a),t.opacity=s(a),t+""}}}var HD=t9(kh),Mrt=t9(rr);function e9(e){return function t(r){r=+r;function n(i,o){var s=e((i=Zn(i)).h,(o=Zn(o)).h),a=rr(i.s,o.s),c=rr(i.l,o.l),l=rr(i.opacity,o.opacity);return function(u){return i.h=s(u),i.s=a(u),i.l=c(Math.pow(u,r)),i.opacity=l(u),i+""}}return n.gamma=t,n}(1)}var Ert=e9(kh),Ch=e9(rr);function Js(e,t){t===void 0&&(t=e,e=ji);for(var r=0,n=t.length-1,i=t[0],o=new Array(n<0?0:n);r<n;)o[r]=e(i,i=t[++r]);return function(s){var a=Math.max(0,Math.min(n-1,Math.floor(s*=n)));return o[a](s-a)}}function En(e,t){for(var r=new Array(t),n=0;n<t;++n)r[n]=e(n/(t-1));return r}var Uh=0,e0=0,t0=0,n9=1e3,Ov,r0,Nv=0,Pf=0,Fv=0,n0=typeof performance=="object"&&performance.now?performance:Date,i9=typeof window=="object"&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(e){setTimeout(e,17)};function o0(){return Pf||(i9(Drt),Pf=n0.now()+Fv)}function Drt(){Pf=0}function i0(){this._call=this._time=this._next=null}i0.prototype=Lv.prototype={constructor:i0,restart:function(e,t,r){if(typeof e!="function")throw new TypeError("callback is not a function");r=(r==null?o0():+r)+(t==null?0:+t),!this._next&&r0!==this&&(r0?r0._next=this:Ov=this,r0=this),this._call=e,this._time=r,ZD()},stop:function(){this._call&&(this._call=null,this._time=1/0,ZD())}};function Lv(e,t,r){var n=new i0;return n.restart(e,t,r),n}function o9(){o0(),++Uh;for(var e=Ov,t;e;)(t=Pf-e._time)>=0&&e._call.call(void 0,t),e=e._next;--Uh}function r9(){Pf=(Nv=n0.now())+Fv,Uh=e0=0;try{o9()}finally{Uh=0,Ort(),Pf=0}}function Brt(){var e=n0.now(),t=e-Nv;t>n9&&(Fv-=t,Nv=e)}function Ort(){for(var e,t=Ov,r,n=1/0;t;)t._call?(n>t._time&&(n=t._time),e=t,t=t._next):(r=t._next,t._next=null,t=e?e._next=r:Ov=r);r0=e,ZD(n)}function ZD(e){if(!Uh){e0&&(e0=clearTimeout(e0));var t=e-Pf;t>24?(e<1/0&&(e0=setTimeout(r9,e-n0.now()-Fv)),t0&&(t0=clearInterval(t0))):(t0||(Nv=n0.now(),t0=setInterval(Brt,n9)),Uh=1,i9(r9))}}function Rv(e,t,r){var n=new i0;return t=t==null?0:+t,n.restart(i=>{n.stop(),e(i+t)},t,r),n}var Nrt=Nf("start","end","cancel","interrupt"),Frt=[],c9=0,s9=1,Cv=2,kv=3,a9=4,Uv=5,s0=6;function nu(e,t,r,n,i,o){var s=e.__transition;if(!s)e.__transition={};else if(r in s)return;Lrt(e,r,{name:t,index:n,group:i,on:Nrt,tween:Frt,time:o.time,delay:o.delay,duration:o.duration,ease:o.ease,timer:null,state:c9})}function a0(e,t){var r=Yr(e,t);if(r.state>c9)throw new Error("too late; already scheduled");return r}function bn(e,t){var r=Yr(e,t);if(r.state>kv)throw new Error("too late; already running");return r}function Yr(e,t){var r=e.__transition;if(!r||!(r=r[t]))throw new Error("transition not found");return r}function Lrt(e,t,r){var n=e.__transition,i;n[t]=r,r.timer=Lv(o,0,r.time);function o(l){r.state=s9,r.timer.restart(s,r.delay,r.time),r.delay<=l&&s(l-r.delay)}function s(l){var u,f,d,h;if(r.state!==s9)return c();for(u in n)if(h=n[u],h.name===r.name){if(h.state===kv)return Rv(s);h.state===a9?(h.state=s0,h.timer.stop(),h.on.call("interrupt",e,e.__data__,h.index,h.group),delete n[u]):+u<t&&(h.state=s0,h.timer.stop(),h.on.call("cancel",e,e.__data__,h.index,h.group),delete n[u])}if(Rv(function(){r.state===kv&&(r.state=a9,r.timer.restart(a,r.delay,r.time),a(l))}),r.state=Cv,r.on.call("start",e,e.__data__,r.index,r.group),r.state===Cv){for(r.state=kv,i=new Array(d=r.tween.length),u=0,f=-1;u<d;++u)(h=r.tween[u].value.call(e,e.__data__,r.index,r.group))&&(i[++f]=h);i.length=f+1}}function a(l){for(var u=l<r.duration?r.ease.call(null,l/r.duration):(r.timer.restart(c),r.state=Uv,1),f=-1,d=i.length;++f<d;)i[f].call(e,u);r.state===Uv&&(r.on.call("end",e,e.__data__,r.index,r.group),c())}function c(){r.state=s0,r.timer.stop(),delete n[t];for(var l in n)return;delete e.__transition}}function ta(e,t){var r=e.__transition,n,i,o=!0,s;if(r){t=t==null?null:t+"";for(s in r){if((n=r[s]).name!==t){o=!1;continue}i=n.state>Cv&&n.state<Uv,n.state=s0,n.timer.stop(),n.on.call(i?"interrupt":"cancel",e,e.__data__,n.index,n.group),delete r[s]}o&&delete e.__transition}}function l9(e){return this.each(function(){ta(this,e)})}function Rrt(e,t){var r,n;return function(){var i=bn(this,e),o=i.tween;if(o!==r){n=r=o;for(var s=0,a=n.length;s<a;++s)if(n[s].name===t){n=n.slice(),n.splice(s,1);break}}i.tween=n}}function krt(e,t,r){var n,i;if(typeof r!="function")throw new Error;return function(){var o=bn(this,e),s=o.tween;if(s!==n){i=(n=s).slice();for(var a={name:t,value:r},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 u9(e,t){var r=this._id;if(e+="",arguments.length<2){for(var n=Yr(this.node(),r).tween,i=0,o=n.length,s;i<o;++i)if((s=n[i]).name===e)return s.value;return null}return this.each((t==null?Rrt:krt)(r,e,t))}function Ph(e,t,r){var n=e._id;return e.each(function(){var i=bn(this,n);(i.value||(i.value={}))[t]=r.apply(this,arguments)}),function(i){return Yr(i,n).value[t]}}function Pv(e,t){var r;return(typeof t=="number"?Ze:t instanceof Vi?xo:(r=Vi(t))?(t=r,xo):Jg)(e,t)}function Crt(e){return function(){this.removeAttribute(e)}}function Urt(e){return function(){this.removeAttributeNS(e.space,e.local)}}function Prt(e,t,r){var n,i=r+"",o;return function(){var s=this.getAttribute(e);return s===i?null:s===n?o:o=t(n=s,r)}}function $rt(e,t,r){var n,i=r+"",o;return function(){var s=this.getAttributeNS(e.space,e.local);return s===i?null:s===n?o:o=t(n=s,r)}}function zrt(e,t,r){var n,i,o;return function(){var s,a=r(this),c;return a==null?void this.removeAttribute(e):(s=this.getAttribute(e),c=a+"",s===c?null:s===n&&c===i?o:(i=c,o=t(n=s,a)))}}function Vrt(e,t,r){var n,i,o;return function(){var s,a=r(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===n&&c===i?o:(i=c,o=t(n=s,a)))}}function f9(e,t){var r=Rc(e),n=r==="transform"?WD:Pv;return this.attrTween(e,typeof t=="function"?(r.local?Vrt:zrt)(r,n,Ph(this,"attr."+e,t)):t==null?(r.local?Urt:Crt)(r):(r.local?$rt:Prt)(r,n,t))}function jrt(e,t){return function(r){this.setAttribute(e,t.call(this,r))}}function qrt(e,t){return function(r){this.setAttributeNS(e.space,e.local,t.call(this,r))}}function Yrt(e,t){var r,n;function i(){var o=t.apply(this,arguments);return o!==n&&(r=(n=o)&&qrt(e,o)),r}return i._value=t,i}function Wrt(e,t){var r,n;function i(){var o=t.apply(this,arguments);return o!==n&&(r=(n=o)&&jrt(e,o)),r}return i._value=t,i}function d9(e,t){var r="attr."+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;var n=Rc(e);return this.tween(r,(n.local?Yrt:Wrt)(n,t))}function Grt(e,t){return function(){a0(this,e).delay=+t.apply(this,arguments)}}function Xrt(e,t){return t=+t,function(){a0(this,e).delay=t}}function h9(e){var t=this._id;return arguments.length?this.each((typeof e=="function"?Grt:Xrt)(t,e)):Yr(this.node(),t).delay}function Hrt(e,t){return function(){bn(this,e).duration=+t.apply(this,arguments)}}function Zrt(e,t){return t=+t,function(){bn(this,e).duration=t}}function p9(e){var t=this._id;return arguments.length?this.each((typeof e=="function"?Hrt:Zrt)(t,e)):Yr(this.node(),t).duration}function Krt(e,t){if(typeof t!="function")throw new Error;return function(){bn(this,e).ease=t}}function m9(e){var t=this._id;return arguments.length?this.each(Krt(t,e)):Yr(this.node(),t).ease}function Qrt(e,t){return function(){var r=t.apply(this,arguments);if(typeof r!="function")throw new Error;bn(this,e).ease=r}}function y9(e){if(typeof e!="function")throw new Error;return this.each(Qrt(this._id,e))}function g9(e){typeof e!="function"&&(e=qg(e));for(var t=this._groups,r=t.length,n=new Array(r),i=0;i<r;++i)for(var o=t[i],s=o.length,a=n[i]=[],c,l=0;l<s;++l)(c=o[l])&&e.call(c,c.__data__,l,o)&&a.push(c);return new Kn(n,this._parents,this._name,this._id)}function b9(e){if(e._id!==this._id)throw new Error;for(var t=this._groups,r=e._groups,n=t.length,i=r.length,o=Math.min(n,i),s=new Array(n),a=0;a<o;++a)for(var c=t[a],l=r[a],u=c.length,f=s[a]=new Array(u),d,h=0;h<u;++h)(d=c[h]||l[h])&&(f[h]=d);for(;a<n;++a)s[a]=t[a];return new Kn(s,this._parents,this._name,this._id)}function Jrt(e){return(e+"").trim().split(/^|\s+/).every(function(t){var r=t.indexOf(".");return r>=0&&(t=t.slice(0,r)),!t||t==="start"})}function tnt(e,t,r){var n,i,o=Jrt(t)?a0:bn;return function(){var s=o(this,e),a=s.on;a!==n&&(i=(n=a).copy()).on(t,r),s.on=i}}function x9(e,t){var r=this._id;return arguments.length<2?Yr(this.node(),r).on.on(e):this.each(tnt(r,e,t))}function ent(e){return function(){var t=this.parentNode;for(var r in this.__transition)if(+r!==e)return;t&&t.removeChild(this)}}function _9(){return this.on("end.remove",ent(this._id))}function w9(e){var t=this._name,r=this._id;typeof e!="function"&&(e=Ff(e));for(var n=this._groups,i=n.length,o=new Array(i),s=0;s<i;++s)for(var a=n[s],c=a.length,l=o[s]=new Array(c),u,f,d=0;d<c;++d)(u=a[d])&&(f=e.call(u,u.__data__,d,a))&&("__data__"in u&&(f.__data__=u.__data__),l[d]=f,nu(l[d],t,r,d,l,Yr(u,r)));return new Kn(o,this._parents,t,r)}function v9(e){var t=this._name,r=this._id;typeof e!="function"&&(e=jg(e));for(var n=this._groups,i=n.length,o=[],s=[],a=0;a<i;++a)for(var c=n[a],l=c.length,u,f=0;f<l;++f)if(u=c[f]){for(var d=e.call(u,u.__data__,f,c),h,p=Yr(u,r),y=0,g=d.length;y<g;++y)(h=d[y])&&nu(h,t,r,y,d,p);o.push(d),s.push(u)}return new Kn(o,s,t,r)}var rnt=Cc.prototype.constructor;function S9(){return new rnt(this._groups,this._parents)}function nnt(e,t){var r,n,i;return function(){var o=tu(this,e),s=(this.style.removeProperty(e),tu(this,e));return o===s?null:o===r&&s===n?i:i=t(r=o,n=s)}}function I9(e){return function(){this.style.removeProperty(e)}}function int(e,t,r){var n,i=r+"",o;return function(){var s=tu(this,e);return s===i?null:s===n?o:o=t(n=s,r)}}function ont(e,t,r){var n,i,o;return function(){var s=tu(this,e),a=r(this),c=a+"";return a==null&&(c=a=(this.style.removeProperty(e),tu(this,e))),s===c?null:s===n&&c===i?o:(i=c,o=t(n=s,a))}}function snt(e,t){var r,n,i,o="style."+t,s="end."+o,a;return function(){var c=bn(this,e),l=c.on,u=c.value[o]==null?a||(a=I9(t)):void 0;(l!==r||i!==u)&&(n=(r=l).copy()).on(s,i=u),c.on=n}}function T9(e,t,r){var n=(e+="")=="transform"?YD:Pv;return t==null?this.styleTween(e,nnt(e,n)).on("end.style."+e,I9(e)):typeof t=="function"?this.styleTween(e,ont(e,n,Ph(this,"style."+e,t))).each(snt(this._id,e)):this.styleTween(e,int(e,n,t),r).on("end.style."+e,null)}function ant(e,t,r){return function(n){this.style.setProperty(e,t.call(this,n),r)}}function cnt(e,t,r){var n,i;function o(){var s=t.apply(this,arguments);return s!==i&&(n=(i=s)&&ant(e,s,r)),n}return o._value=t,o}function A9(e,t,r){var n="style."+(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;return this.tween(n,cnt(e,t,r??""))}function lnt(e){return function(){this.textContent=e}}function unt(e){return function(){var t=e(this);this.textContent=t??""}}function M9(e){return this.tween("text",typeof e=="function"?unt(Ph(this,"text",e)):lnt(e==null?"":e+""))}function fnt(e){return function(t){this.textContent=e.call(this,t)}}function dnt(e){var t,r;function n(){var i=e.apply(this,arguments);return i!==r&&(t=(r=i)&&fnt(i)),t}return n._value=e,n}function E9(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,dnt(e))}function D9(){for(var e=this._name,t=this._id,r=$v(),n=this._groups,i=n.length,o=0;o<i;++o)for(var s=n[o],a=s.length,c,l=0;l<a;++l)if(c=s[l]){var u=Yr(c,t);nu(c,e,r,l,s,{time:u.time+u.delay+u.duration,delay:0,duration:u.duration,ease:u.ease})}return new Kn(n,this._parents,e,r)}function B9(){var e,t,r=this,n=r._id,i=r.size();return new Promise(function(o,s){var a={value:s},c={value:function(){--i===0&&o()}};r.each(function(){var l=bn(this,n),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 hnt=0;function Kn(e,t,r,n){this._groups=e,this._parents=t,this._name=r,this._id=n}function O9(e){return Cc().transition(e)}function $v(){return++hnt}var $c=Cc.prototype;Kn.prototype=O9.prototype={constructor:Kn,select:w9,selectAll:v9,selectChild:$c.selectChild,selectChildren:$c.selectChildren,filter:g9,merge:b9,selection:S9,transition:D9,call:$c.call,nodes:$c.nodes,node:$c.node,size:$c.size,empty:$c.empty,each:$c.each,on:x9,attr:f9,attrTween:d9,style:T9,styleTween:A9,text:M9,textTween:E9,remove:_9,tween:u9,delay:h9,duration:p9,ease:m9,easeVarying:y9,end:B9,[Symbol.iterator]:$c[Symbol.iterator]};function zv(e){return((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2}var pnt={time:null,delay:0,duration:250,ease:zv};function mnt(e,t){for(var r;!(r=e.__transition)||!(r=r[t]);)if(!(e=e.parentNode))throw new Error(`transition ${t} not found`);return r}function N9(e){var t,r;e instanceof Kn?(t=e._id,e=e._name):(t=$v(),(r=pnt).time=o0(),e=e==null?null:e+"");for(var n=this._groups,i=n.length,o=0;o<i;++o)for(var s=n[o],a=s.length,c,l=0;l<a;++l)(c=s[l])&&nu(c,e,t,l,s,r||mnt(c,t));return new Kn(n,this._parents,e,t)}Cc.prototype.interrupt=l9;Cc.prototype.transition=N9;var Vv=e=>()=>e;function KD(e,{sourceEvent:t,target:r,selection:n,mode:i,dispatch:o}){Object.defineProperties(this,{type:{value:e,enumerable:!0,configurable:!0},sourceEvent:{value:t,enumerable:!0,configurable:!0},target:{value:r,enumerable:!0,configurable:!0},selection:{value:n,enumerable:!0,configurable:!0},mode:{value:i,enumerable:!0,configurable:!0},_:{value:o}})}function F9(e){e.stopImmediatePropagation()}function jv(e){e.preventDefault(),e.stopImmediatePropagation()}var L9={name:"drag"},QD={name:"space"},$h={name:"handle"},zh={name:"center"},{abs:R9,max:Dn,min:Bn}=Math;function k9(e){return[+e[0],+e[1]]}function tB(e){return[k9(e[0]),k9(e[1])]}var qv={name:"x",handles:["w","e"].map(c0),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]]}},Yv={name:"y",handles:["n","s"].map(c0),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]]}},ynt={name:"xy",handles:["n","w","e","s","nw","ne","sw","se"].map(c0),input:function(e){return e==null?null:tB(e)},output:function(e){return e}},zc={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"},C9={e:"w",w:"e",nw:"ne",ne:"nw",se:"sw",sw:"se"},U9={n:"s",s:"n",nw:"sw",ne:"se",se:"ne",sw:"nw"},gnt={overlay:1,selection:1,n:null,e:1,s:null,w:-1,nw:-1,ne:1,se:1,sw:-1},bnt={overlay:1,selection:1,n:-1,e:null,s:1,w:null,nw:-1,ne:-1,se:1,sw:1};function c0(e){return{type:e}}function xnt(e){return!e.ctrlKey&&!e.button}function _nt(){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 wnt(){return navigator.maxTouchPoints||"ontouchstart"in this}function JD(e){for(;!e.__brush;)if(!(e=e.parentNode))return;return e.__brush}function vnt(e){return e[0][0]===e[1][0]||e[0][1]===e[1][1]}function eB(){return iB(qv)}function rB(){return iB(Yv)}function nB(){return iB(ynt)}function iB(e){var t=_nt,r=xnt,n=wnt,i=!0,o=Nf("start","brush","end"),s=6,a;function c(g){var m=g.property("__brush",y).selectAll(".overlay").data([c0("overlay")]);m.enter().append("rect").attr("class","overlay").attr("pointer-events","all").attr("cursor",zc.overlay).merge(m).each(function(){var x=JD(this).extent;ae(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])}),g.selectAll(".selection").data([c0("selection")]).enter().append("rect").attr("class","selection").attr("cursor",zc.selection).attr("fill","#777").attr("fill-opacity",.3).attr("stroke","#fff").attr("shape-rendering","crispEdges");var b=g.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 zc[x.type]}),g.each(l).attr("fill","none").attr("pointer-events","all").on("mousedown.brush",d).filter(n).on("touchstart.brush",d).on("touchmove.brush",h).on("touchend.brush touchcancel.brush",p).style("touch-action","none").style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}c.move=function(g,m,b){g.tween?g.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,_=x.__brush,v=u(x,arguments),w=_.selection,I=e.input(typeof m=="function"?m.apply(this,arguments):m,_.extent),D=ji(w,I);function A(B){_.selection=B===1&&I===null?null:D(B),l.call(x),v.brush()}return w!==null&&I!==null?A:A(1)}):g.each(function(){var x=this,_=arguments,v=x.__brush,w=e.input(typeof m=="function"?m.apply(x,_):m,v.extent),I=u(x,_).beforestart();ta(x),v.selection=w===null?null:w,l.call(x),I.start(b).brush(b).end(b)})},c.clear=function(g,m){c.move(g,null,m)};function l(){var g=ae(this),m=JD(this).selection;m?(g.selectAll(".selection").style("display",null).attr("x",m[0][0]).attr("y",m[0][1]).attr("width",m[1][0]-m[0][0]).attr("height",m[1][1]-m[0][1]),g.selectAll(".handle").style("display",null).attr("x",function(b){return b.type[b.type.length-1]==="e"?m[1][0]-s/2:m[0][0]-s/2}).attr("y",function(b){return b.type[0]==="s"?m[1][1]-s/2:m[0][1]-s/2}).attr("width",function(b){return b.type==="n"||b.type==="s"?m[1][0]-m[0][0]+s:s}).attr("height",function(b){return b.type==="e"||b.type==="w"?m[1][1]-m[0][1]+s:s})):g.selectAll(".selection,.handle").style("display","none").attr("x",null).attr("y",null).attr("width",null).attr("height",null)}function u(g,m,b){var x=g.__brush.emitter;return x&&(!b||!x.clean)?x:new f(g,m,b)}function f(g,m,b){this.that=g,this.args=m,this.state=g.__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(g,m){return this.starting?(this.starting=!1,this.emit("start",g,m)):this.emit("brush",g),this},brush:function(g,m){return this.emit("brush",g,m),this},end:function(g,m){return--this.active===0&&(delete this.state.emitter,this.emit("end",g,m)),this},emit:function(g,m,b){var x=ae(this.that).datum();o.call(g,this.that,new KD(g,{sourceEvent:m,target:c,selection:e.output(this.state.selection),mode:b,dispatch:o}),x)}};function d(g){if(a&&!g.touches||!r.apply(this,arguments))return;var m=this,b=g.target.__data__.type,x=(i&&g.metaKey?b="overlay":b)==="selection"?L9:i&&g.altKey?zh:$h,_=e===Yv?null:gnt[b],v=e===qv?null:bnt[b],w=JD(m),I=w.extent,D=w.selection,A=I[0][0],B,M,O=I[0][1],R,S,T=I[1][0],E,C,U=I[1][1],k,$,z=0,V=0,Q,nt=_&&v&&i&&g.shiftKey,st,ut,X=Array.from(g.touches||[g],ot=>{let Me=ot.identifier;return ot=Mn(ot,m),ot.point0=ot.slice(),ot.identifier=Me,ot});ta(m);var at=u(m,arguments,!0).beforestart();if(b==="overlay"){D&&(Q=!0);let ot=[X[0],X[1]||X[0]];w.selection=D=[[B=e===Yv?A:Bn(ot[0][0],ot[1][0]),R=e===qv?O:Bn(ot[0][1],ot[1][1])],[E=e===Yv?T:Dn(ot[0][0],ot[1][0]),k=e===qv?U:Dn(ot[0][1],ot[1][1])]],X.length>1&&Qt(g)}else B=D[0][0],R=D[0][1],E=D[1][0],k=D[1][1];M=B,S=R,C=E,$=k;var q=ae(m).attr("pointer-events","none"),J=q.selectAll(".overlay").attr("cursor",zc[b]);if(g.touches)at.moved=j,at.ended=gt;else{var ct=ae(g.view).on("mousemove.brush",j,!0).on("mouseup.brush",gt,!0);i&&ct.on("keydown.brush",he,!0).on("keyup.brush",pe,!0),Wg(g.view)}l.call(m),at.start(g,x.name);function j(ot){for(let Me of ot.changedTouches||[ot])for(let Ti of X)Ti.identifier===Me.identifier&&(Ti.cur=Mn(Me,m));if(nt&&!st&&!ut&&X.length===1){let Me=X[0];R9(Me.cur[0]-Me[0])>R9(Me.cur[1]-Me[1])?ut=!0:st=!0}for(let Me of X)Me.cur&&(Me[0]=Me.cur[0],Me[1]=Me.cur[1]);Q=!0,jv(ot),Qt(ot)}function Qt(ot){let Me=X[0],Ti=Me.point0;var vs;switch(z=Me[0]-Ti[0],V=Me[1]-Ti[1],x){case QD:case L9:{_&&(z=Dn(A-B,Bn(T-E,z)),M=B+z,C=E+z),v&&(V=Dn(O-R,Bn(U-k,V)),S=R+V,$=k+V);break}case $h:{X[1]?(_&&(M=Dn(A,Bn(T,X[0][0])),C=Dn(A,Bn(T,X[1][0])),_=1),v&&(S=Dn(O,Bn(U,X[0][1])),$=Dn(O,Bn(U,X[1][1])),v=1)):(_<0?(z=Dn(A-B,Bn(T-B,z)),M=B+z,C=E):_>0&&(z=Dn(A-E,Bn(T-E,z)),M=B,C=E+z),v<0?(V=Dn(O-R,Bn(U-R,V)),S=R+V,$=k):v>0&&(V=Dn(O-k,Bn(U-k,V)),S=R,$=k+V));break}case zh:{_&&(M=Dn(A,Bn(T,B-z*_)),C=Dn(A,Bn(T,E+z*_))),v&&(S=Dn(O,Bn(U,R-V*v)),$=Dn(O,Bn(U,k+V*v)));break}}C<M&&(_*=-1,vs=B,B=E,E=vs,vs=M,M=C,C=vs,b in C9&&J.attr("cursor",zc[b=C9[b]])),$<S&&(v*=-1,vs=R,R=k,k=vs,vs=S,S=$,$=vs,b in U9&&J.attr("cursor",zc[b=U9[b]])),w.selection&&(D=w.selection),st&&(M=D[0][0],C=D[1][0]),ut&&(S=D[0][1],$=D[1][1]),(D[0][0]!==M||D[0][1]!==S||D[1][0]!==C||D[1][1]!==$)&&(w.selection=[[M,S],[C,$]],l.call(m),at.brush(ot,x.name))}function gt(ot){if(F9(ot),ot.touches){if(ot.touches.length)return;a&&clearTimeout(a),a=setTimeout(function(){a=null},500)}else Gg(ot.view,Q),ct.on("keydown.brush keyup.brush mousemove.brush mouseup.brush",null);q.attr("pointer-events","all"),J.attr("cursor",zc.overlay),w.selection&&(D=w.selection),vnt(D)&&(w.selection=null,l.call(m)),at.end(ot,x.name)}function he(ot){switch(ot.keyCode){case 16:{nt=_&&v;break}case 18:{x===$h&&(_&&(E=C-z*_,B=M+z*_),v&&(k=$-V*v,R=S+V*v),x=zh,Qt(ot));break}case 32:{(x===$h||x===zh)&&(_<0?E=C-z:_>0&&(B=M-z),v<0?k=$-V:v>0&&(R=S-V),x=QD,J.attr("cursor",zc.selection),Qt(ot));break}default:return}jv(ot)}function pe(ot){switch(ot.keyCode){case 16:{nt&&(st=ut=nt=!1,Qt(ot));break}case 18:{x===zh&&(_<0?E=C:_>0&&(B=M),v<0?k=$:v>0&&(R=S),x=$h,Qt(ot));break}case 32:{x===QD&&(ot.altKey?(_&&(E=C-z*_,B=M+z*_),v&&(k=$-V*v,R=S+V*v),x=zh):(_<0?E=C:_>0&&(B=M),v<0?k=$:v>0&&(R=S),x=$h),J.attr("cursor",zc[b]),Qt(ot));break}default:return}jv(ot)}}function h(g){u(this,arguments).moved(g)}function p(g){u(this,arguments).ended(g)}function y(){var g=this.__brush||{selection:null};return g.extent=tB(t.apply(this,arguments)),g.dim=e,g}return c.extent=function(g){return arguments.length?(t=typeof g=="function"?g:Vv(tB(g)),c):t},c.filter=function(g){return arguments.length?(r=typeof g=="function"?g:Vv(!!g),c):r},c.touchable=function(g){return arguments.length?(n=typeof g=="function"?g:Vv(!!g),c):n},c.handleSize=function(g){return arguments.length?(s=+g,c):s},c.keyModifiers=function(g){return arguments.length?(i=!!g,c):i},c.on=function(){var g=o.on.apply(o,arguments);return g===o?c:g},c}var oB=Math.PI,sB=2*oB,$f=1e-6,Snt=sB-$f;function P9(e){this._+=e[0];for(let t=1,r=e.length;t<r;++t)this._+=arguments[t]+e[t]}function Int(e){let t=Math.floor(e);if(!(t>=0))throw new Error(`invalid digits: ${e}`);if(t>15)return P9;let r=10**t;return function(n){this._+=n[0];for(let i=1,o=n.length;i<o;++i)this._+=Math.round(arguments[i]*r)/r+n[i]}}var iu=class{constructor(t){this._x0=this._y0=this._x1=this._y1=null,this._="",this._append=t==null?P9:Int(t)}moveTo(t,r){this._append`M${this._x0=this._x1=+t},${this._y0=this._y1=+r}`}closePath(){this._x1!==null&&(this._x1=this._x0,this._y1=this._y0,this._append`Z`)}lineTo(t,r){this._append`L${this._x1=+t},${this._y1=+r}`}quadraticCurveTo(t,r,n,i){this._append`Q${+t},${+r},${this._x1=+n},${this._y1=+i}`}bezierCurveTo(t,r,n,i,o,s){this._append`C${+t},${+r},${+n},${+i},${this._x1=+o},${this._y1=+s}`}arcTo(t,r,n,i,o){if(t=+t,r=+r,n=+n,i=+i,o=+o,o<0)throw new Error(`negative radius: ${o}`);let s=this._x1,a=this._y1,c=n-t,l=i-r,u=s-t,f=a-r,d=u*u+f*f;if(this._x1===null)this._append`M${this._x1=t},${this._y1=r}`;else if(d>$f)if(!(Math.abs(f*c-l*u)>$f)||!o)this._append`L${this._x1=t},${this._y1=r}`;else{let h=n-s,p=i-a,y=c*c+l*l,g=h*h+p*p,m=Math.sqrt(y),b=Math.sqrt(d),x=o*Math.tan((oB-Math.acos((y+d-g)/(2*m*b)))/2),_=x/b,v=x/m;Math.abs(_-1)>$f&&this._append`L${t+_*u},${r+_*f}`,this._append`A${o},${o},0,0,${+(f*h>u*p)},${this._x1=t+v*c},${this._y1=r+v*l}`}}arc(t,r,n,i,o,s){if(t=+t,r=+r,n=+n,s=!!s,n<0)throw new Error(`negative radius: ${n}`);let a=n*Math.cos(i),c=n*Math.sin(i),l=t+a,u=r+c,f=1^s,d=s?i-o:o-i;this._x1===null?this._append`M${l},${u}`:(Math.abs(this._x1-l)>$f||Math.abs(this._y1-u)>$f)&&this._append`L${l},${u}`,n&&(d<0&&(d=d%sB+sB),d>Snt?this._append`A${n},${n},0,1,${f},${t-a},${r-c}A${n},${n},0,1,${f},${this._x1=l},${this._y1=u}`:d>$f&&this._append`A${n},${n},0,${+(d>=oB)},${f},${this._x1=t+n*Math.cos(o)},${this._y1=r+n*Math.sin(o)}`)}rect(t,r,n,i){this._append`M${this._x0=this._x1=+t},${this._y0=this._y1=+r}h${n=+n}v${+i}h${-n}Z`}toString(){return this._}};function $9(){return new iu}$9.prototype=iu.prototype;function Qn(e=3){return new iu(+e)}var Tnt=Array.prototype,Wv=Tnt.slice;function z9(e,t){return e-t}function V9(e){for(var t=0,r=e.length,n=e[r-1][1]*e[0][0]-e[r-1][0]*e[0][1];++t<r;)n+=e[t-1][1]*e[t][0]-e[t-1][0]*e[t][1];return n}var ea=e=>()=>e;function j9(e,t){for(var r=-1,n=t.length,i;++r<n;)if(i=Ant(e,t[r]))return i;return 0}function Ant(e,t){for(var r=t[0],n=t[1],i=-1,o=0,s=e.length,a=s-1;o<s;a=o++){var c=e[o],l=c[0],u=c[1],f=e[a],d=f[0],h=f[1];if(Mnt(c,f,t))return 0;u>n!=h>n&&r<(d-l)*(n-u)/(h-u)+l&&(i=-i)}return i}function Mnt(e,t,r){var n;return Ent(e,t,r)&&Dnt(e[n=+(e[0]===t[0])],r[n],t[n])}function Ent(e,t,r){return(t[0]-e[0])*(r[1]-e[1])===(r[0]-e[0])*(t[1]-e[1])}function Dnt(e,t,r){return e<=t&&t<=r||r<=t&&t<=e}function q9(){}var Vc=[[],[[[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 ou(){var e=1,t=1,r=Ql,n=c;function i(l){var u=r(l);if(Array.isArray(u))u=u.slice().sort(z9);else{let f=Be(l,Bnt);for(u=yn(...Dh(f[0],f[1],u),u);u[u.length-1]>=f[1];)u.pop();for(;u[1]<f[0];)u.shift()}return u.map(f=>o(l,f))}function o(l,u){let f=u==null?NaN:+u;if(isNaN(f))throw new Error(`invalid value: ${u}`);var d=[],h=[];return s(l,f,function(p){n(p,l,f),V9(p)>0?d.push([p]):h.push(p)}),h.forEach(function(p){for(var y=0,g=d.length,m;y<g;++y)if(j9((m=d[y])[0],p)!==-1){m.push(p);return}}),{type:"MultiPolygon",value:u,coordinates:d}}function s(l,u,f){var d=new Array,h=new Array,p,y,g,m,b,x;for(p=y=-1,m=zf(l[0],u),Vc[m<<1].forEach(_);++p<e-1;)g=m,m=zf(l[p+1],u),Vc[g|m<<1].forEach(_);for(Vc[m<<0].forEach(_);++y<t-1;){for(p=-1,m=zf(l[y*e+e],u),b=zf(l[y*e],u),Vc[m<<1|b<<2].forEach(_);++p<e-1;)g=m,m=zf(l[y*e+e+p+1],u),x=b,b=zf(l[y*e+p+1],u),Vc[g|m<<1|b<<2|x<<3].forEach(_);Vc[m|b<<3].forEach(_)}for(p=-1,b=l[y*e]>=u,Vc[b<<2].forEach(_);++p<e-1;)x=b,b=zf(l[y*e+p+1],u),Vc[b<<2|x<<3].forEach(_);Vc[b<<3].forEach(_);function _(v){var w=[v[0][0]+p,v[0][1]+y],I=[v[1][0]+p,v[1][1]+y],D=a(w),A=a(I),B,M;(B=h[D])?(M=d[A])?(delete h[B.end],delete d[M.start],B===M?(B.ring.push(I),f(B.ring)):d[B.start]=h[M.end]={start:B.start,end:M.end,ring:B.ring.concat(M.ring)}):(delete h[B.end],B.ring.push(I),h[B.end=A]=B):(B=d[A])?(M=h[D])?(delete d[B.start],delete h[M.end],B===M?(B.ring.push(I),f(B.ring)):d[M.start]=h[B.end]={start:M.start,end:B.end,ring:M.ring.concat(B.ring)}):(delete d[B.start],B.ring.unshift(w),d[B.start=D]=B):d[D]=h[A]={start:D,end:A,ring:[w,I]}}}function a(l){return l[0]*2+l[1]*(e+1)*4}function c(l,u,f){l.forEach(function(d){var h=d[0],p=d[1],y=h|0,g=p|0,m=aB(u[g*e+y]);h>0&&h<e&&y===h&&(d[0]=Y9(h,aB(u[g*e+y-1]),m,f)),p>0&&p<t&&g===p&&(d[1]=Y9(p,aB(u[(g-1)*e+y]),m,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?(r=typeof l=="function"?l:Array.isArray(l)?ea(Wv.call(l)):ea(l),i):r},i.smooth=function(l){return arguments.length?(n=l?c:q9,i):n===c},i}function Bnt(e){return isFinite(e)?e:NaN}function zf(e,t){return e==null?!1:+e>=t}function aB(e){return e==null||isNaN(e=+e)?-1/0:e}function Y9(e,t,r,n){let i=n-t,o=r-t,s=isFinite(i)||isFinite(o)?i/o:Math.sign(i)/Math.sign(o);return isNaN(s)?e:e+s-.5}function Ont(e){return e[0]}function Nnt(e){return e[1]}function Fnt(){return 1}function cB(){var e=Ont,t=Nnt,r=Fnt,n=960,i=500,o=20,s=2,a=o*3,c=n+a*2>>s,l=i+a*2>>s,u=ea(20);function f(b){var x=new Float32Array(c*l),_=Math.pow(2,-s),v=-1;for(let R of b){var w=(e(R,++v,b)+a)*_,I=(t(R,v,b)+a)*_,D=+r(R,v,b);if(D&&w>=0&&w<c&&I>=0&&I<l){var A=Math.floor(w),B=Math.floor(I),M=w-A-.5,O=I-B-.5;x[A+B*c]+=(1-M)*(1-O)*D,x[A+1+B*c]+=M*(1-O)*D,x[A+1+(B+1)*c]+=M*O*D,x[A+(B+1)*c]+=(1-M)*O*D}}return Cg({data:x,width:c,height:l},o*_),x}function d(b){var x=f(b),_=u(x),v=Math.pow(2,2*s);return Array.isArray(_)||(_=yn(Number.MIN_VALUE,de(x)/v,_)),ou().size([c,l]).thresholds(_.map(w=>w*v))(x).map((w,I)=>(w.value=+_[I],h(w)))}d.contours=function(b){var x=f(b),_=ou().size([c,l]),v=Math.pow(2,2*s),w=I=>{I=+I;var D=h(_.contour(x,I*v));return D.value=I,D};return Object.defineProperty(w,"max",{get:()=>de(x)/v}),w};function h(b){return b.coordinates.forEach(p),b}function p(b){b.forEach(y)}function y(b){b.forEach(g)}function g(b){b[0]=b[0]*Math.pow(2,s)-a,b[1]=b[1]*Math.pow(2,s)-a}function m(){return a=o*3,c=n+a*2>>s,l=i+a*2>>s,d}return d.x=function(b){return arguments.length?(e=typeof b=="function"?b:ea(+b),d):e},d.y=function(b){return arguments.length?(t=typeof b=="function"?b:ea(+b),d):t},d.weight=function(b){return arguments.length?(r=typeof b=="function"?b:ea(+b),d):r},d.size=function(b){if(!arguments.length)return[n,i];var x=+b[0],_=+b[1];if(!(x>=0&&_>=0))throw new Error("invalid size");return n=x,i=_,m()},d.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),m()},d.thresholds=function(b){return arguments.length?(u=typeof b=="function"?b:Array.isArray(b)?ea(Wv.call(b)):ea(b),d):u},d.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,m()},d}var xe=11102230246251565e-32,Nr=134217729,l0=(3+8*xe)*xe;function Vf(e,t,r,n,i){let o,s,a,c,l=t[0],u=n[0],f=0,d=0;u>l==u>-l?(o=l,l=t[++f]):(o=u,u=n[++d]);let h=0;if(f<e&&d<r)for(u>l==u>-l?(s=l+o,a=o-(s-l),l=t[++f]):(s=u+o,a=o-(s-u),u=n[++d]),o=s,a!==0&&(i[h++]=a);f<e&&d<r;)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=n[++d]),o=s,a!==0&&(i[h++]=a);for(;f<e;)s=o+l,c=s-o,a=o-(s-c)+(l-c),l=t[++f],o=s,a!==0&&(i[h++]=a);for(;d<r;)s=o+u,c=s-o,a=o-(s-c)+(u-c),u=n[++d],o=s,a!==0&&(i[h++]=a);return(o!==0||h===0)&&(i[h++]=o),h}function u0(e,t){let r=t[0];for(let n=1;n<e;n++)r+=t[n];return r}function G(e){return new Float64Array(e)}var Lnt=(3+16*xe)*xe,Rnt=(2+12*xe)*xe,knt=(9+64*xe)*xe*xe,Vh=G(4),W9=G(8),G9=G(12),X9=G(16),Jn=G(4);function Cnt(e,t,r,n,i,o,s){let a,c,l,u,f,d,h,p,y,g,m,b,x,_,v,w,I,D,A=e-i,B=r-i,M=t-o,O=n-o;_=A*O,d=Nr*A,h=d-(d-A),p=A-h,d=Nr*O,y=d-(d-O),g=O-y,v=p*g-(_-h*y-p*y-h*g),w=M*B,d=Nr*M,h=d-(d-M),p=M-h,d=Nr*B,y=d-(d-B),g=B-y,I=p*g-(w-h*y-p*y-h*g),m=v-I,f=v-m,Vh[0]=v-(m+f)+(f-I),b=_+m,f=b-_,x=_-(b-f)+(m-f),m=x-w,f=x-m,Vh[1]=x-(m+f)+(f-w),D=b+m,f=D-b,Vh[2]=b-(D-f)+(m-f),Vh[3]=D;let R=u0(4,Vh),S=Rnt*s;if(R>=S||-R>=S||(f=e-A,a=e-(A+f)+(f-i),f=r-B,l=r-(B+f)+(f-i),f=t-M,c=t-(M+f)+(f-o),f=n-O,u=n-(O+f)+(f-o),a===0&&c===0&&l===0&&u===0)||(S=knt*s+l0*Math.abs(R),R+=A*u+O*a-(M*l+B*c),R>=S||-R>=S))return R;_=a*O,d=Nr*a,h=d-(d-a),p=a-h,d=Nr*O,y=d-(d-O),g=O-y,v=p*g-(_-h*y-p*y-h*g),w=c*B,d=Nr*c,h=d-(d-c),p=c-h,d=Nr*B,y=d-(d-B),g=B-y,I=p*g-(w-h*y-p*y-h*g),m=v-I,f=v-m,Jn[0]=v-(m+f)+(f-I),b=_+m,f=b-_,x=_-(b-f)+(m-f),m=x-w,f=x-m,Jn[1]=x-(m+f)+(f-w),D=b+m,f=D-b,Jn[2]=b-(D-f)+(m-f),Jn[3]=D;let T=Vf(4,Vh,4,Jn,W9);_=A*u,d=Nr*A,h=d-(d-A),p=A-h,d=Nr*u,y=d-(d-u),g=u-y,v=p*g-(_-h*y-p*y-h*g),w=M*l,d=Nr*M,h=d-(d-M),p=M-h,d=Nr*l,y=d-(d-l),g=l-y,I=p*g-(w-h*y-p*y-h*g),m=v-I,f=v-m,Jn[0]=v-(m+f)+(f-I),b=_+m,f=b-_,x=_-(b-f)+(m-f),m=x-w,f=x-m,Jn[1]=x-(m+f)+(f-w),D=b+m,f=D-b,Jn[2]=b-(D-f)+(m-f),Jn[3]=D;let E=Vf(T,W9,4,Jn,G9);_=a*u,d=Nr*a,h=d-(d-a),p=a-h,d=Nr*u,y=d-(d-u),g=u-y,v=p*g-(_-h*y-p*y-h*g),w=c*l,d=Nr*c,h=d-(d-c),p=c-h,d=Nr*l,y=d-(d-l),g=l-y,I=p*g-(w-h*y-p*y-h*g),m=v-I,f=v-m,Jn[0]=v-(m+f)+(f-I),b=_+m,f=b-_,x=_-(b-f)+(m-f),m=x-w,f=x-m,Jn[1]=x-(m+f)+(f-w),D=b+m,f=D-b,Jn[2]=b-(D-f)+(m-f),Jn[3]=D;let C=Vf(E,G9,4,Jn,X9);return X9[C-1]}function jh(e,t,r,n,i,o){let s=(t-o)*(r-i),a=(e-i)*(n-o),c=s-a,l=Math.abs(s+a);return Math.abs(c)>=Lnt*l?c:-Cnt(e,t,r,n,i,o,l)}var V8t=(7+56*xe)*xe,j8t=(3+28*xe)*xe,q8t=(26+288*xe)*xe*xe,Y8t=G(4),W8t=G(4),G8t=G(4),X8t=G(4),H8t=G(4),Z8t=G(4),K8t=G(4),Q8t=G(4),J8t=G(4),tkt=G(8),ekt=G(8),rkt=G(8),nkt=G(4),ikt=G(8),okt=G(8),skt=G(8),akt=G(12),ckt=G(192),lkt=G(192);var dkt=(10+96*xe)*xe,hkt=(4+48*xe)*xe,pkt=(44+576*xe)*xe*xe,mkt=G(4),ykt=G(4),gkt=G(4),bkt=G(4),xkt=G(4),_kt=G(4),wkt=G(4),vkt=G(4),Skt=G(8),Ikt=G(8),Tkt=G(8),Akt=G(8),Mkt=G(8),Ekt=G(8),Dkt=G(8),Bkt=G(8),Okt=G(8),Nkt=G(4),Fkt=G(4),Lkt=G(4),Rkt=G(8),kkt=G(16),Ckt=G(16),Ukt=G(16),Pkt=G(32),$kt=G(32),zkt=G(48),Vkt=G(64),jkt=G(1152),qkt=G(1152);var Xkt=(16+224*xe)*xe,Hkt=(5+72*xe)*xe,Zkt=(71+1408*xe)*xe*xe,Kkt=G(4),Qkt=G(4),Jkt=G(4),tCt=G(4),eCt=G(4),rCt=G(4),nCt=G(4),iCt=G(4),oCt=G(4),sCt=G(4),aCt=G(24),cCt=G(24),lCt=G(24),uCt=G(24),fCt=G(24),dCt=G(24),hCt=G(24),pCt=G(24),mCt=G(24),yCt=G(24),gCt=G(1152),bCt=G(1152),xCt=G(1152),_Ct=G(1152),wCt=G(1152),vCt=G(2304),SCt=G(2304),ICt=G(3456),TCt=G(5760),ACt=G(8),MCt=G(8),ECt=G(8),DCt=G(16),BCt=G(24),OCt=G(48),NCt=G(48),FCt=G(96),LCt=G(192),RCt=G(384),kCt=G(384),CCt=G(384),UCt=G(768);var PCt=G(96),$Ct=G(96),zCt=G(96),VCt=G(1152);var Z9=Math.pow(2,-52),Gv=new Uint32Array(512),Yh=class e{static from(t,r=jnt,n=qnt){let i=t.length,o=new Float64Array(i*2);for(let s=0;s<i;s++){let a=t[s];o[2*s]=r(a),o[2*s+1]=n(a)}return new e(o)}constructor(t){let r=t.length>>1;if(r>0&&typeof t[0]!="number")throw new Error("Expected coords to contain numbers.");this.coords=t;let n=Math.max(2*r-5,0);this._triangles=new Uint32Array(n*3),this._halfedges=new Int32Array(n*3),this._hashSize=Math.ceil(Math.sqrt(r)),this._hullPrev=new Uint32Array(r),this._hullNext=new Uint32Array(r),this._hullTri=new Uint32Array(r),this._hullHash=new Int32Array(this._hashSize),this._ids=new Uint32Array(r),this._dists=new Float64Array(r),this.update()}update(){let{coords:t,_hullPrev:r,_hullNext:n,_hullTri:i,_hullHash:o}=this,s=t.length>>1,a=1/0,c=1/0,l=-1/0,u=-1/0;for(let A=0;A<s;A++){let B=t[2*A],M=t[2*A+1];B<a&&(a=B),M<c&&(c=M),B>l&&(l=B),M>u&&(u=M),this._ids[A]=A}let f=(a+l)/2,d=(c+u)/2,h,p,y;for(let A=0,B=1/0;A<s;A++){let M=lB(f,d,t[2*A],t[2*A+1]);M<B&&(h=A,B=M)}let g=t[2*h],m=t[2*h+1];for(let A=0,B=1/0;A<s;A++){if(A===h)continue;let M=lB(g,m,t[2*A],t[2*A+1]);M<B&&M>0&&(p=A,B=M)}let b=t[2*p],x=t[2*p+1],_=1/0;for(let A=0;A<s;A++){if(A===h||A===p)continue;let B=znt(g,m,b,x,t[2*A],t[2*A+1]);B<_&&(y=A,_=B)}let v=t[2*y],w=t[2*y+1];if(_===1/0){for(let M=0;M<s;M++)this._dists[M]=t[2*M]-t[0]||t[2*M+1]-t[1];qh(this._ids,this._dists,0,s-1);let A=new Uint32Array(s),B=0;for(let M=0,O=-1/0;M<s;M++){let R=this._ids[M],S=this._dists[R];S>O&&(A[B++]=R,O=S)}this.hull=A.subarray(0,B),this.triangles=new Uint32Array(0),this.halfedges=new Uint32Array(0);return}if(jh(g,m,b,x,v,w)<0){let A=p,B=b,M=x;p=y,b=v,x=w,y=A,v=B,w=M}let I=Vnt(g,m,b,x,v,w);this._cx=I.x,this._cy=I.y;for(let A=0;A<s;A++)this._dists[A]=lB(t[2*A],t[2*A+1],I.x,I.y);qh(this._ids,this._dists,0,s-1),this._hullStart=h;let D=3;n[h]=r[y]=p,n[p]=r[h]=y,n[y]=r[p]=h,i[h]=0,i[p]=1,i[y]=2,o.fill(-1),o[this._hashKey(g,m)]=h,o[this._hashKey(b,x)]=p,o[this._hashKey(v,w)]=y,this.trianglesLen=0,this._addTriangle(h,p,y,-1,-1,-1);for(let A=0,B,M;A<this._ids.length;A++){let O=this._ids[A],R=t[2*O],S=t[2*O+1];if(A>0&&Math.abs(R-B)<=Z9&&Math.abs(S-M)<=Z9||(B=R,M=S,O===h||O===p||O===y))continue;let T=0;for(let $=0,z=this._hashKey(R,S);$<this._hashSize&&(T=o[(z+$)%this._hashSize],!(T!==-1&&T!==n[T]));$++);T=r[T];let E=T,C;for(;C=n[E],jh(R,S,t[2*E],t[2*E+1],t[2*C],t[2*C+1])>=0;)if(E=C,E===T){E=-1;break}if(E===-1)continue;let U=this._addTriangle(E,O,n[E],-1,-1,i[E]);i[O]=this._legalize(U+2),i[E]=U,D++;let k=n[E];for(;C=n[k],jh(R,S,t[2*k],t[2*k+1],t[2*C],t[2*C+1])<0;)U=this._addTriangle(k,O,C,i[O],-1,i[k]),i[O]=this._legalize(U+2),n[k]=k,D--,k=C;if(E===T)for(;C=r[E],jh(R,S,t[2*C],t[2*C+1],t[2*E],t[2*E+1])<0;)U=this._addTriangle(C,O,E,-1,i[E],i[C]),this._legalize(U+2),i[C]=U,n[E]=E,D--,E=C;this._hullStart=r[O]=E,n[E]=r[k]=O,n[O]=k,o[this._hashKey(R,S)]=O,o[this._hashKey(t[2*E],t[2*E+1])]=E}this.hull=new Uint32Array(D);for(let A=0,B=this._hullStart;A<D;A++)this.hull[A]=B,B=n[B];this.triangles=this._triangles.subarray(0,this.trianglesLen),this.halfedges=this._halfedges.subarray(0,this.trianglesLen)}_hashKey(t,r){return Math.floor(Pnt(t-this._cx,r-this._cy)*this._hashSize)%this._hashSize}_legalize(t){let{_triangles:r,_halfedges:n,coords:i}=this,o=0,s=0;for(;;){let a=n[t],c=t-t%3;if(s=c+(t+2)%3,a===-1){if(o===0)break;t=Gv[--o];continue}let l=a-a%3,u=c+(t+1)%3,f=l+(a+2)%3,d=r[s],h=r[t],p=r[u],y=r[f];if($nt(i[2*d],i[2*d+1],i[2*h],i[2*h+1],i[2*p],i[2*p+1],i[2*y],i[2*y+1])){r[t]=y,r[a]=d;let m=n[f];if(m===-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,m),this._link(a,n[s]),this._link(s,f);let b=l+(a+1)%3;o<Gv.length&&(Gv[o++]=b)}else{if(o===0)break;t=Gv[--o]}}return s}_link(t,r){this._halfedges[t]=r,r!==-1&&(this._halfedges[r]=t)}_addTriangle(t,r,n,i,o,s){let a=this.trianglesLen;return this._triangles[a]=t,this._triangles[a+1]=r,this._triangles[a+2]=n,this._link(a,i),this._link(a+1,o),this._link(a+2,s),this.trianglesLen+=3,a}};function Pnt(e,t){let r=e/(Math.abs(e)+Math.abs(t));return(t>0?3-r:1+r)/4}function lB(e,t,r,n){let i=e-r,o=t-n;return i*i+o*o}function $nt(e,t,r,n,i,o,s,a){let c=e-s,l=t-a,u=r-s,f=n-a,d=i-s,h=o-a,p=c*c+l*l,y=u*u+f*f,g=d*d+h*h;return c*(f*g-y*h)-l*(u*g-y*d)+p*(u*h-f*d)<0}function znt(e,t,r,n,i,o){let s=r-e,a=n-t,c=i-e,l=o-t,u=s*s+a*a,f=c*c+l*l,d=.5/(s*l-a*c),h=(l*u-a*f)*d,p=(s*f-c*u)*d;return h*h+p*p}function Vnt(e,t,r,n,i,o){let s=r-e,a=n-t,c=i-e,l=o-t,u=s*s+a*a,f=c*c+l*l,d=.5/(s*l-a*c),h=e+(l*u-a*f)*d,p=t+(s*f-c*u)*d;return{x:h,y:p}}function qh(e,t,r,n){if(n-r<=20)for(let i=r+1;i<=n;i++){let o=e[i],s=t[o],a=i-1;for(;a>=r&&t[e[a]]>s;)e[a+1]=e[a--];e[a+1]=o}else{let i=r+n>>1,o=r+1,s=n;f0(e,i,o),t[e[r]]>t[e[n]]&&f0(e,r,n),t[e[o]]>t[e[n]]&&f0(e,o,n),t[e[r]]>t[e[o]]&&f0(e,r,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;f0(e,o,s)}e[r+1]=e[s],e[s]=a,n-o+1>=s-r?(qh(e,t,o,n),qh(e,t,r,s-1)):(qh(e,t,r,s-1),qh(e,t,o,n))}}function f0(e,t,r){let n=e[t];e[t]=e[r],e[r]=n}function jnt(e){return e[0]}function qnt(e){return e[1]}var _o=class{constructor(){this._x0=this._y0=this._x1=this._y1=null,this._=""}moveTo(t,r){this._+=`M${this._x0=this._x1=+t},${this._y0=this._y1=+r}`}closePath(){this._x1!==null&&(this._x1=this._x0,this._y1=this._y0,this._+="Z")}lineTo(t,r){this._+=`L${this._x1=+t},${this._y1=+r}`}arc(t,r,n){t=+t,r=+r,n=+n;let i=t+n,o=r;if(n<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),n&&(this._+=`A${n},${n},0,1,1,${t-n},${r}A${n},${n},0,1,1,${this._x1=i},${this._y1=o}`)}rect(t,r,n,i){this._+=`M${this._x0=this._x1=+t},${this._y0=this._y1=+r}h${+n}v${+i}h${-n}Z`}value(){return this._||null}};var su=class{constructor(){this._=[]}moveTo(t,r){this._.push([t,r])}closePath(){this._.push(this._[0].slice())}lineTo(t,r){this._.push([t,r])}value(){return this._.length?this._:null}};var d0=class{constructor(t,[r,n,i,o]=[0,0,960,500]){if(!((i=+i)>=(r=+r))||!((o=+o)>=(n=+n)))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=r,this.ymax=o,this.ymin=n,this._init()}update(){return this.delaunay.update(),this._init(),this}_init(){let{delaunay:{points:t,hull:r,triangles:n},vectors:i}=this,o,s,a=this.circumcenters=this._circumcenters.subarray(0,n.length/3*2);for(let y=0,g=0,m=n.length,b,x;y<m;y+=3,g+=2){let _=n[y]*2,v=n[y+1]*2,w=n[y+2]*2,I=t[_],D=t[_+1],A=t[v],B=t[v+1],M=t[w],O=t[w+1],R=A-I,S=B-D,T=M-I,E=O-D,C=(R*E-S*T)*2;if(Math.abs(C)<1e-9){if(o===void 0){o=s=0;for(let k of r)o+=t[k*2],s+=t[k*2+1];o/=r.length,s/=r.length}let U=1e9*Math.sign((o-I)*E-(s-D)*T);b=(I+M)/2-U*E,x=(D+O)/2+U*T}else{let U=1/C,k=R*R+S*S,$=T*T+E*E;b=I+(E*k-S*$)*U,x=D+(R*$-T*k)*U}a[g]=b,a[g+1]=x}let c=r[r.length-1],l,u=c*4,f,d=t[2*c],h,p=t[2*c+1];i.fill(0);for(let y=0;y<r.length;++y)c=r[y],l=u,f=d,h=p,u=c*4,d=t[2*c],p=t[2*c+1],i[l+2]=i[u]=h-p,i[l+3]=i[u+1]=d-f}render(t){let r=t==null?t=new _o:void 0,{delaunay:{halfedges:n,inedges:i,hull:o},circumcenters:s,vectors:a}=this;if(o.length<=1)return null;for(let u=0,f=n.length;u<f;++u){let d=n[u];if(d<u)continue;let h=Math.floor(u/3)*2,p=Math.floor(d/3)*2,y=s[h],g=s[h+1],m=s[p],b=s[p+1];this._renderSegment(y,g,m,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,d=s[f],h=s[f+1],p=c*4,y=this._project(d,h,a[p+2],a[p+3]);y&&this._renderSegment(d,h,y[0],y[1],t)}return r&&r.value()}renderBounds(t){let r=t==null?t=new _o:void 0;return t.rect(this.xmin,this.ymin,this.xmax-this.xmin,this.ymax-this.ymin),r&&r.value()}renderCell(t,r){let n=r==null?r=new _o:void 0,i=this._clip(t);if(i===null||!i.length)return;r.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])&&r.lineTo(i[s],i[s+1]);return r.closePath(),n&&n.value()}*cellPolygons(){let{delaunay:{points:t}}=this;for(let r=0,n=t.length/2;r<n;++r){let i=this.cellPolygon(r);i&&(i.index=r,yield i)}}cellPolygon(t){let r=new su;return this.renderCell(t,r),r.value()}_renderSegment(t,r,n,i,o){let s,a=this._regioncode(t,r),c=this._regioncode(n,i);a===0&&c===0?(o.moveTo(t,r),o.lineTo(n,i)):(s=this._clipSegment(t,r,n,i,a,c))&&(o.moveTo(s[0],s[1]),o.lineTo(s[2],s[3]))}contains(t,r,n){return r=+r,r!==r||(n=+n,n!==n)?!1:this.delaunay._step(t,r,n)===t}*neighbors(t){let r=this._clip(t);if(r)for(let n of this.delaunay.neighbors(t)){let i=this._clip(n);if(i){t:for(let o=0,s=r.length;o<s;o+=2)for(let a=0,c=i.length;a<c;a+=2)if(r[o]===i[a]&&r[o+1]===i[a+1]&&r[(o+2)%s]===i[(a+c-2)%c]&&r[(o+3)%s]===i[(a+c-1)%c]){yield n;break t}}}}_cell(t){let{circumcenters:r,delaunay:{inedges:n,halfedges:i,triangles:o}}=this,s=n[t];if(s===-1)return null;let a=[],c=s;do{let l=Math.floor(c/3);if(a.push(r[l*2],r[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 r=this._cell(t);if(r===null)return null;let{vectors:n}=this,i=t*4;return this._simplify(n[i]||n[i+1]?this._clipInfinite(t,r,n[i],n[i+1],n[i+2],n[i+3]):this._clipFinite(t,r))}_clipFinite(t,r){let n=r.length,i=null,o,s,a=r[n-2],c=r[n-1],l,u=this._regioncode(a,c),f,d=0;for(let h=0;h<n;h+=2)if(o=a,s=c,a=r[h],c=r[h+1],l=u,u=this._regioncode(a,c),l===0&&u===0)f=d,d=0,i?i.push(a,c):i=[a,c];else{let p,y,g,m,b;if(l===0){if((p=this._clipSegment(o,s,a,c,l,u))===null)continue;[y,g,m,b]=p}else{if((p=this._clipSegment(a,c,o,s,u,l))===null)continue;[m,b,y,g]=p,f=d,d=this._edgecode(y,g),f&&d&&this._edge(t,f,d,i,i.length),i?i.push(y,g):i=[y,g]}f=d,d=this._edgecode(m,b),f&&d&&this._edge(t,f,d,i,i.length),i?i.push(m,b):i=[m,b]}if(i)f=d,d=this._edgecode(i[0],i[1]),f&&d&&this._edge(t,f,d,i,i.length);else if(this.contains(t,(this.xmin+this.xmax)/2,(this.ymin+this.ymax)/2))return[this.xmax,this.ymin,this.xmax,this.ymax,this.xmin,this.ymax,this.xmin,this.ymin];return i}_clipSegment(t,r,n,i,o,s){let a=o<s;for(a&&([t,r,n,i,o,s]=[n,i,t,r,s,o]);;){if(o===0&&s===0)return a?[n,i,t,r]:[t,r,n,i];if(o&s)return null;let c,l,u=o||s;u&8?(c=t+(n-t)*(this.ymax-r)/(i-r),l=this.ymax):u&4?(c=t+(n-t)*(this.ymin-r)/(i-r),l=this.ymin):u&2?(l=r+(i-r)*(this.xmax-t)/(n-t),c=this.xmax):(l=r+(i-r)*(this.xmin-t)/(n-t),c=this.xmin),o?(t=c,r=l,o=this._regioncode(t,r)):(n=c,i=l,s=this._regioncode(n,i))}}_clipInfinite(t,r,n,i,o,s){let a=Array.from(r),c;if((c=this._project(a[0],a[1],n,i))&&a.unshift(c[0],c[1]),(c=this._project(a[a.length-2],a[a.length-1],o,s))&&a.push(c[0],c[1]),a=this._clipFinite(t,a))for(let l=0,u=a.length,f,d=this._edgecode(a[u-2],a[u-1]);l<u;l+=2)f=d,d=this._edgecode(a[l],a[l+1]),f&&d&&(l=this._edge(t,f,d,a,l),u=a.length);else this.contains(t,(this.xmin+this.xmax)/2,(this.ymin+this.ymax)/2)&&(a=[this.xmin,this.ymin,this.xmax,this.ymin,this.xmax,this.ymax,this.xmin,this.ymax]);return a}_edge(t,r,n,i,o){for(;r!==n;){let s,a;switch(r){case 5:r=4;continue;case 4:r=6,s=this.xmax,a=this.ymin;break;case 6:r=2;continue;case 2:r=10,s=this.xmax,a=this.ymax;break;case 10:r=8;continue;case 8:r=9,s=this.xmin,a=this.ymax;break;case 9:r=1;continue;case 1:r=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,r,n,i){let o=1/0,s,a,c;if(i<0){if(r<=this.ymin)return null;(s=(this.ymin-r)/i)<o&&(c=this.ymin,a=t+(o=s)*n)}else if(i>0){if(r>=this.ymax)return null;(s=(this.ymax-r)/i)<o&&(c=this.ymax,a=t+(o=s)*n)}if(n>0){if(t>=this.xmax)return null;(s=(this.xmax-t)/n)<o&&(a=this.xmax,c=r+(o=s)*i)}else if(n<0){if(t<=this.xmin)return null;(s=(this.xmin-t)/n)<o&&(a=this.xmin,c=r+(o=s)*i)}return[a,c]}_edgecode(t,r){return(t===this.xmin?1:t===this.xmax?2:0)|(r===this.ymin?4:r===this.ymax?8:0)}_regioncode(t,r){return(t<this.xmin?1:t>this.xmax?2:0)|(r<this.ymin?4:r>this.ymax?8:0)}_simplify(t){if(t&&t.length>4){for(let r=0;r<t.length;r+=2){let n=(r+2)%t.length,i=(r+4)%t.length;(t[r]===t[n]&&t[n]===t[i]||t[r+1]===t[n+1]&&t[n+1]===t[i+1])&&(t.splice(n,2),r-=2)}t.length||(t=null)}return t}};var Ynt=2*Math.PI,Wh=Math.pow;function Wnt(e){return e[0]}function Gnt(e){return e[1]}function Xnt(e){let{triangles:t,coords:r}=e;for(let n=0;n<t.length;n+=3){let i=2*t[n],o=2*t[n+1],s=2*t[n+2];if((r[s]-r[i])*(r[o+1]-r[i+1])-(r[o]-r[i])*(r[s+1]-r[i+1])>1e-10)return!1}return!0}function Hnt(e,t,r){return[e+Math.sin(e+t)*r,t+Math.cos(e-t)*r]}var On=class e{static from(t,r=Wnt,n=Gnt,i){return new e("length"in t?Znt(t,r,n,i):Float64Array.from(Knt(t,r,n,i)))}constructor(t){this._delaunator=new Yh(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,r=this.points;if(t.hull&&t.hull.length>2&&Xnt(t)){this.collinear=Int32Array.from({length:r.length/2},(d,h)=>h).sort((d,h)=>r[2*d]-r[2*h]||r[2*d+1]-r[2*h+1]);let c=this.collinear[0],l=this.collinear[this.collinear.length-1],u=[r[2*c],r[2*c+1],r[2*l],r[2*l+1]],f=1e-8*Math.hypot(u[3]-u[1],u[2]-u[0]);for(let d=0,h=r.length/2;d<h;++d){let p=Hnt(r[2*d],r[2*d+1],f);r[2*d]=p[0],r[2*d+1]=p[1]}this._delaunator=new Yh(r)}else delete this.collinear;let n=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=n.length;c<l;++c){let u=o[c%3===2?c-2:c+1];(n[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 d0(this,t)}*neighbors(t){let{inedges:r,hull:n,_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=r[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=n[(i[t]+1)%n.length];f!==u&&(yield f);return}}while(l!==c)}find(t,r,n=0){if(t=+t,t!==t||(r=+r,r!==r))return-1;let i=n,o;for(;(o=this._step(n,t,r))>=0&&o!==n&&o!==i;)n=o;return o}_step(t,r,n){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=Wh(r-l[t*2],2)+Wh(n-l[t*2+1],2),d=i[t],h=d;do{let p=c[h],y=Wh(r-l[p*2],2)+Wh(n-l[p*2+1],2);if(y<f&&(f=y,u=p),h=h%3===2?h-2:h+1,c[h]!==t)break;if(h=a[h],h===-1){if(h=o[(s[t]+1)%o.length],h!==p&&Wh(r-l[h*2],2)+Wh(n-l[h*2+1],2)<f)return h;break}}while(h!==d);return u}render(t){let r=t==null?t=new _o:void 0,{points:n,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(n[l],n[l+1]),t.lineTo(n[u],n[u+1])}return this.renderHull(t),r&&r.value()}renderPoints(t,r){r===void 0&&(!t||typeof t.moveTo!="function")&&(r=t,t=null),r=r==null?2:+r;let n=t==null?t=new _o: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+r,c),t.arc(a,c,r,0,Ynt)}return n&&n.value()}renderHull(t){let r=t==null?t=new _o:void 0,{hull:n,points:i}=this,o=n[0]*2,s=n.length;t.moveTo(i[o],i[o+1]);for(let a=1;a<s;++a){let c=2*n[a];t.lineTo(i[c],i[c+1])}return t.closePath(),r&&r.value()}hullPolygon(){let t=new su;return this.renderHull(t),t.value()}renderTriangle(t,r){let n=r==null?r=new _o:void 0,{points:i,triangles:o}=this,s=o[t*=3]*2,a=o[t+1]*2,c=o[t+2]*2;return r.moveTo(i[s],i[s+1]),r.lineTo(i[a],i[a+1]),r.lineTo(i[c],i[c+1]),r.closePath(),n&&n.value()}*trianglePolygons(){let{triangles:t}=this;for(let r=0,n=t.length/3;r<n;++r)yield this.trianglePolygon(r)}trianglePolygon(t){let r=new su;return this.renderTriangle(t,r),r.value()}};function Znt(e,t,r,n){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(n,a,s,e),o[s*2+1]=r.call(n,a,s,e)}return o}function*Knt(e,t,r,n){let i=0;for(let o of e)yield t.call(n,o,i,e),yield r.call(n,o,i,e),++i}function K9(e){return Math.abs(e=Math.round(e))>=1e21?e.toLocaleString("en").replace(/,/g,""):e.toString(10)}function jf(e,t){if((r=(e=t?e.toExponential(t-1):e.toExponential()).indexOf("e"))<0)return null;var r,n=e.slice(0,r);return[n.length>1?n[0]+n.slice(2):n,+e.slice(r+1)]}function ra(e){return e=jf(Math.abs(e)),e?e[1]:NaN}function Q9(e,t){return function(r,n){for(var i=r.length,o=[],s=0,a=e[0],c=0;i>0&&a>0&&(c+a+1>n&&(a=Math.max(1,n-c)),o.push(r.substring(i-=a,i+a)),!((c+=a+1)>n));)a=e[s=(s+1)%e.length];return o.reverse().join(t)}}function J9(e){return function(t){return t.replace(/[0-9]/g,function(r){return e[+r]})}}var Qnt=/^(?:(.)?([<>=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i;function na(e){if(!(t=Qnt.exec(e)))throw new Error("invalid format: "+e);var t;return new Xv({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]})}na.prototype=Xv.prototype;function Xv(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+""}Xv.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 t$(e){t:for(var t=e.length,r=1,n=-1,i;r<t;++r)switch(e[r]){case".":n=i=r;break;case"0":n===0&&(n=r),i=r;break;default:if(!+e[r])break t;n>0&&(n=0);break}return n>0?e.slice(0,n)+e.slice(i+1):e}var uB;function e$(e,t){var r=jf(e,t);if(!r)return e+"";var n=r[0],i=r[1],o=i-(uB=Math.max(-8,Math.min(8,Math.floor(i/3)))*3)+1,s=n.length;return o===s?n:o>s?n+new Array(o-s+1).join("0"):o>0?n.slice(0,o)+"."+n.slice(o):"0."+new Array(1-o).join("0")+jf(e,Math.max(0,t+o-1))[0]}function fB(e,t){var r=jf(e,t);if(!r)return e+"";var n=r[0],i=r[1];return i<0?"0."+new Array(-i).join("0")+n:n.length>i+1?n.slice(0,i+1)+"."+n.slice(i+1):n+new Array(i-n.length+2).join("0")}var dB={"%":(e,t)=>(e*100).toFixed(t),b:e=>Math.round(e).toString(2),c:e=>e+"",d:K9,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)=>fB(e*100,t),r:fB,s:e$,X:e=>Math.round(e).toString(16).toUpperCase(),x:e=>Math.round(e).toString(16)};function hB(e){return e}var r$=Array.prototype.map,n$=["y","z","a","f","p","n","\xB5","m","","k","M","G","T","P","E","Z","Y"];function i$(e){var t=e.grouping===void 0||e.thousands===void 0?hB:Q9(r$.call(e.grouping,Number),e.thousands+""),r=e.currency===void 0?"":e.currency[0]+"",n=e.currency===void 0?"":e.currency[1]+"",i=e.decimal===void 0?".":e.decimal+"",o=e.numerals===void 0?hB:J9(r$.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=na(f);var d=f.fill,h=f.align,p=f.sign,y=f.symbol,g=f.zero,m=f.width,b=f.comma,x=f.precision,_=f.trim,v=f.type;v==="n"?(b=!0,v="g"):dB[v]||(x===void 0&&(x=12),_=!0,v="g"),(g||d==="0"&&h==="=")&&(g=!0,d="0",h="=");var w=y==="$"?r:y==="#"&&/[boxX]/.test(v)?"0"+v.toLowerCase():"",I=y==="$"?n:/[%p]/.test(v)?s:"",D=dB[v],A=/[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 B(M){var O=w,R=I,S,T,E;if(v==="c")R=D(M)+R,M="";else{M=+M;var C=M<0||1/M<0;if(M=isNaN(M)?c:D(Math.abs(M),x),_&&(M=t$(M)),C&&+M==0&&p!=="+"&&(C=!1),O=(C?p==="("?p:a:p==="-"||p==="("?"":p)+O,R=(v==="s"?n$[8+uB/3]:"")+R+(C&&p==="("?")":""),A){for(S=-1,T=M.length;++S<T;)if(E=M.charCodeAt(S),48>E||E>57){R=(E===46?i+M.slice(S+1):M.slice(S))+R,M=M.slice(0,S);break}}}b&&!g&&(M=t(M,1/0));var U=O.length+M.length+R.length,k=U<m?new Array(m-U+1).join(d):"";switch(b&&g&&(M=t(k+M,k.length?m-R.length:1/0),k=""),h){case"<":M=O+M+R+k;break;case"=":M=O+k+M+R;break;case"^":M=k.slice(0,U=k.length>>1)+O+M+R+k.slice(U);break;default:M=k+O+M+R;break}return o(M)}return B.toString=function(){return f+""},B}function u(f,d){var h=l((f=na(f),f.type="f",f)),p=Math.max(-8,Math.min(8,Math.floor(ra(d)/3)))*3,y=Math.pow(10,-p),g=n$[8+p/3];return function(m){return h(y*m)+g}}return{format:l,formatPrefix:u}}var Hv,wo,Zv;pB({thousands:",",grouping:[3],currency:["$",""]});function pB(e){return Hv=i$(e),wo=Hv.format,Zv=Hv.formatPrefix,Hv}function mB(e){return Math.max(0,-ra(Math.abs(e)))}function yB(e,t){return Math.max(0,Math.max(-8,Math.min(8,Math.floor(ra(t)/3)))*3-ra(Math.abs(e)))}function gB(e,t){return e=Math.abs(e),t=Math.abs(t)-e,Math.max(0,ra(t)-ra(e))+1}var rt=1e-6,qf=1e-12,Yt=Math.PI,ke=Yt/2,bB=Yt/4,Xr=Yt*2,yr=180/Yt,ce=Yt/180,Jt=Math.abs,vo=Math.atan,Fr=Math.atan2,et=Math.cos,h0=Math.ceil,Kv=Math.exp;var Qv=Math.hypot,Yf=Math.log,Jv=Math.pow,tt=Math.sin,Nn=Math.sign||function(e){return e>0?1:e<0?-1:0},Ce=Math.sqrt,Gh=Math.tan;function tS(e){return e>1?0:e<-1?Yt:Math.acos(e)}function Ke(e){return e>1?ke:e<-1?-ke:Math.asin(e)}function Lr(){}function eS(e,t){e&&s$.hasOwnProperty(e.type)&&s$[e.type](e,t)}var o$={Feature:function(e,t){eS(e.geometry,t)},FeatureCollection:function(e,t){for(var r=e.features,n=-1,i=r.length;++n<i;)eS(r[n].geometry,t)}},s$={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 r=e.coordinates,n=-1,i=r.length;++n<i;)e=r[n],t.point(e[0],e[1],e[2])},LineString:function(e,t){xB(e.coordinates,t,0)},MultiLineString:function(e,t){for(var r=e.coordinates,n=-1,i=r.length;++n<i;)xB(r[n],t,0)},Polygon:function(e,t){a$(e.coordinates,t)},MultiPolygon:function(e,t){for(var r=e.coordinates,n=-1,i=r.length;++n<i;)a$(r[n],t)},GeometryCollection:function(e,t){for(var r=e.geometries,n=-1,i=r.length;++n<i;)eS(r[n],t)}};function xB(e,t,r){var n=-1,i=e.length-r,o;for(t.lineStart();++n<i;)o=e[n],t.point(o[0],o[1],o[2]);t.lineEnd()}function a$(e,t){var r=-1,n=e.length;for(t.polygonStart();++r<n;)xB(e[r],t,1);t.polygonEnd()}function qi(e,t){e&&o$.hasOwnProperty(e.type)?o$[e.type](e,t):eS(e,t)}function p0(e){return[Fr(e[1],e[0]),Ke(e[2])]}function ia(e){var t=e[0],r=e[1],n=et(r);return[n*et(t),n*tt(t),tt(r)]}function m0(e,t){return e[0]*t[0]+e[1]*t[1]+e[2]*t[2]}function Xh(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 rS(e,t){e[0]+=t[0],e[1]+=t[1],e[2]+=t[2]}function y0(e,t){return[e[0]*t,e[1]*t,e[2]*t]}function g0(e){var t=Ce(e[0]*e[0]+e[1]*e[1]+e[2]*e[2]);e[0]/=t,e[1]/=t,e[2]/=t}var b0,nS,iS,oS,sS,aS,cS,lS,_B,wB,vB,u$,f$,ti,ei,ri,ms={sphere:Lr,point:SB,lineStart:c$,lineEnd:l$,polygonStart:function(){ms.lineStart=eit,ms.lineEnd=rit},polygonEnd:function(){ms.lineStart=c$,ms.lineEnd=l$}};function SB(e,t){e*=ce,t*=ce;var r=et(t);x0(r*et(e),r*tt(e),tt(t))}function x0(e,t,r){++b0,iS+=(e-iS)/b0,oS+=(t-oS)/b0,sS+=(r-sS)/b0}function c$(){ms.point=Jnt}function Jnt(e,t){e*=ce,t*=ce;var r=et(t);ti=r*et(e),ei=r*tt(e),ri=tt(t),ms.point=tit,x0(ti,ei,ri)}function tit(e,t){e*=ce,t*=ce;var r=et(t),n=r*et(e),i=r*tt(e),o=tt(t),s=Fr(Ce((s=ei*o-ri*i)*s+(s=ri*n-ti*o)*s+(s=ti*i-ei*n)*s),ti*n+ei*i+ri*o);nS+=s,aS+=s*(ti+(ti=n)),cS+=s*(ei+(ei=i)),lS+=s*(ri+(ri=o)),x0(ti,ei,ri)}function l$(){ms.point=SB}function eit(){ms.point=nit}function rit(){d$(u$,f$),ms.point=SB}function nit(e,t){u$=e,f$=t,e*=ce,t*=ce,ms.point=d$;var r=et(t);ti=r*et(e),ei=r*tt(e),ri=tt(t),x0(ti,ei,ri)}function d$(e,t){e*=ce,t*=ce;var r=et(t),n=r*et(e),i=r*tt(e),o=tt(t),s=ei*o-ri*i,a=ri*n-ti*o,c=ti*i-ei*n,l=Qv(s,a,c),u=Ke(l),f=l&&-u/l;_B.add(f*s),wB.add(f*a),vB.add(f*c),nS+=u,aS+=u*(ti+(ti=n)),cS+=u*(ei+(ei=i)),lS+=u*(ri+(ri=o)),x0(ti,ei,ri)}function IB(e){b0=nS=iS=oS=sS=aS=cS=lS=0,_B=new mn,wB=new mn,vB=new mn,qi(e,ms);var t=+_B,r=+wB,n=+vB,i=Qv(t,r,n);return i<qf&&(t=aS,r=cS,n=lS,nS<rt&&(t=iS,r=oS,n=sS),i=Qv(t,r,n),i<qf)?[NaN,NaN]:[Fr(r,t)*yr,Ke(n/i)*yr]}function _0(e,t){function r(n,i){return n=e(n,i),t(n[0],n[1])}return e.invert&&t.invert&&(r.invert=function(n,i){return n=t.invert(n,i),n&&e.invert(n[0],n[1])}),r}function TB(e,t){return Jt(e)>Yt&&(e-=Math.round(e/Xr)*Xr),[e,t]}TB.invert=TB;function AB(e,t,r){return(e%=Xr)?t||r?_0(p$(e),m$(t,r)):p$(e):t||r?m$(t,r):TB}function h$(e){return function(t,r){return t+=e,Jt(t)>Yt&&(t-=Math.round(t/Xr)*Xr),[t,r]}}function p$(e){var t=h$(e);return t.invert=h$(-e),t}function m$(e,t){var r=et(e),n=tt(e),i=et(t),o=tt(t);function s(a,c){var l=et(c),u=et(a)*l,f=tt(a)*l,d=tt(c),h=d*r+u*n;return[Fr(f*i-h*o,u*r-d*n),Ke(h*i+f*o)]}return s.invert=function(a,c){var l=et(c),u=et(a)*l,f=tt(a)*l,d=tt(c),h=d*i-f*o;return[Fr(f*i+d*o,u*r+h*n),Ke(h*r-u*n)]},s}function y$(e){e=AB(e[0]*ce,e[1]*ce,e.length>2?e[2]*ce:0);function t(r){return r=e(r[0]*ce,r[1]*ce),r[0]*=yr,r[1]*=yr,r}return t.invert=function(r){return r=e.invert(r[0]*ce,r[1]*ce),r[0]*=yr,r[1]*=yr,r},t}function b$(e,t,r,n,i,o){if(r){var s=et(t),a=tt(t),c=n*r;i==null?(i=t+n*Xr,o=t-c/2):(i=g$(s,i),o=g$(s,o),(n>0?i<o:i>o)&&(i+=n*Xr));for(var l,u=i;n>0?u>o:u<o;u-=c)l=p0([s,-a*et(u),-a*tt(u)]),e.point(l[0],l[1])}}function g$(e,t){t=ia(t),t[0]-=e,g0(t);var r=tS(-t[1]);return((-t[2]<0?-r:r)+Xr-rt)%Xr}function uS(){var e=[],t;return{point:function(r,n,i){t.push([r,n,i])},lineStart:function(){e.push(t=[])},lineEnd:Lr,rejoin:function(){e.length>1&&e.push(e.pop().concat(e.shift()))},result:function(){var r=e;return e=[],t=null,r}}}function Hh(e,t){return Jt(e[0]-t[0])<rt&&Jt(e[1]-t[1])<rt}function fS(e,t,r,n){this.x=e,this.z=t,this.o=r,this.e=n,this.v=!1,this.n=this.p=null}function dS(e,t,r,n,i){var o=[],s=[],a,c;if(e.forEach(function(p){if(!((y=p.length-1)<=0)){var y,g=p[0],m=p[y],b;if(Hh(g,m)){if(!g[2]&&!m[2]){for(i.lineStart(),a=0;a<y;++a)i.point((g=p[a])[0],g[1]);i.lineEnd();return}m[0]+=2*rt}o.push(b=new fS(g,p,null,!0)),s.push(b.o=new fS(g,null,b,!1)),o.push(b=new fS(m,p,null,!1)),s.push(b.o=new fS(m,null,b,!0))}}),!!o.length){for(s.sort(t),x$(o),x$(s),a=0,c=s.length;a<c;++a)s[a].e=r=!r;for(var l=o[0],u,f;;){for(var d=l,h=!0;d.v;)if((d=d.n)===l)return;u=d.z,i.lineStart();do{if(d.v=d.o.v=!0,d.e){if(h)for(a=0,c=u.length;a<c;++a)i.point((f=u[a])[0],f[1]);else n(d.x,d.n.x,1,i);d=d.n}else{if(h)for(u=d.p.z,a=u.length-1;a>=0;--a)i.point((f=u[a])[0],f[1]);else n(d.x,d.p.x,-1,i);d=d.p}d=d.o,u=d.z,h=!h}while(!d.v);i.lineEnd()}}}function x$(e){if(t=e.length){for(var t,r=0,n=e[0],i;++r<t;)n.n=i=e[r],i.p=n,n=i;n.n=i=e[0],i.p=n}}function MB(e){return Jt(e[0])<=Yt?e[0]:Nn(e[0])*((Jt(e[0])+Yt)%Xr-Yt)}function _$(e,t){var r=MB(t),n=t[1],i=tt(n),o=[tt(r),-et(r),0],s=0,a=0,c=new mn;i===1?n=ke+rt:i===-1&&(n=-ke-rt);for(var l=0,u=e.length;l<u;++l)if(d=(f=e[l]).length)for(var f,d,h=f[d-1],p=MB(h),y=h[1]/2+bB,g=tt(y),m=et(y),b=0;b<d;++b,p=_,g=w,m=I,h=x){var x=f[b],_=MB(x),v=x[1]/2+bB,w=tt(v),I=et(v),D=_-p,A=D>=0?1:-1,B=A*D,M=B>Yt,O=g*w;if(c.add(Fr(O*A*tt(B),m*I+O*et(B))),s+=M?D+A*Xr:D,M^p>=r^_>=r){var R=Xh(ia(h),ia(x));g0(R);var S=Xh(o,R);g0(S);var T=(M^D>=0?-1:1)*Ke(S[2]);(n>T||n===T&&(R[0]||R[1]))&&(a+=M^D>=0?1:-1)}}return(s<-rt||s<rt&&c<-qf)^a&1}function hS(e,t,r,n){return function(i){var o=t(i),s=uS(),a=t(s),c=!1,l,u,f,d={point:h,lineStart:y,lineEnd:g,polygonStart:function(){d.point=m,d.lineStart=b,d.lineEnd=x,u=[],l=[]},polygonEnd:function(){d.point=h,d.lineStart=y,d.lineEnd=g,u=Bh(u);var _=_$(l,n);u.length?(c||(i.polygonStart(),c=!0),dS(u,oit,_,r,i)):_&&(c||(i.polygonStart(),c=!0),i.lineStart(),r(null,null,1,i),i.lineEnd()),c&&(i.polygonEnd(),c=!1),u=l=null},sphere:function(){i.polygonStart(),i.lineStart(),r(null,null,1,i),i.lineEnd(),i.polygonEnd()}};function h(_,v){e(_,v)&&i.point(_,v)}function p(_,v){o.point(_,v)}function y(){d.point=p,o.lineStart()}function g(){d.point=h,o.lineEnd()}function m(_,v){f.push([_,v]),a.point(_,v)}function b(){a.lineStart(),f=[]}function x(){m(f[0][0],f[0][1]),a.lineEnd();var _=a.clean(),v=s.result(),w,I=v.length,D,A,B;if(f.pop(),l.push(f),f=null,!!I){if(_&1){if(A=v[0],(D=A.length-1)>0){for(c||(i.polygonStart(),c=!0),i.lineStart(),w=0;w<D;++w)i.point((B=A[w])[0],B[1]);i.lineEnd()}return}I>1&&_&2&&v.push(v.pop().concat(v.shift())),u.push(v.filter(iit))}}return d}}function iit(e){return e.length>1}function oit(e,t){return((e=e.x)[0]<0?e[1]-ke-rt:ke-e[1])-((t=t.x)[0]<0?t[1]-ke-rt:ke-t[1])}var EB=hS(function(){return!0},sit,cit,[-Yt,-ke]);function sit(e){var t=NaN,r=NaN,n=NaN,i;return{lineStart:function(){e.lineStart(),i=1},point:function(o,s){var a=o>0?Yt:-Yt,c=Jt(o-t);Jt(c-Yt)<rt?(e.point(t,r=(r+s)/2>0?ke:-ke),e.point(n,r),e.lineEnd(),e.lineStart(),e.point(a,r),e.point(o,r),i=0):n!==a&&c>=Yt&&(Jt(t-n)<rt&&(t-=n*rt),Jt(o-a)<rt&&(o-=a*rt),r=ait(t,r,o,s),e.point(n,r),e.lineEnd(),e.lineStart(),e.point(a,r),i=0),e.point(t=o,r=s),n=a},lineEnd:function(){e.lineEnd(),t=r=NaN},clean:function(){return 2-i}}}function ait(e,t,r,n){var i,o,s=tt(e-r);return Jt(s)>rt?vo((tt(t)*(o=et(n))*tt(r)-tt(n)*(i=et(t))*tt(e))/(i*o*s)):(t+n)/2}function cit(e,t,r,n){var i;if(e==null)i=r*ke,n.point(-Yt,i),n.point(0,i),n.point(Yt,i),n.point(Yt,0),n.point(Yt,-i),n.point(0,-i),n.point(-Yt,-i),n.point(-Yt,0),n.point(-Yt,i);else if(Jt(e[0]-t[0])>rt){var o=e[0]<t[0]?Yt:-Yt;i=r*o/2,n.point(-o,i),n.point(0,i),n.point(o,i)}else n.point(t[0],t[1])}function w$(e){var t=et(e),r=6*ce,n=t>0,i=Jt(t)>rt;function o(u,f,d,h){b$(h,e,r,d,u,f)}function s(u,f){return et(u)*et(f)>t}function a(u){var f,d,h,p,y;return{lineStart:function(){p=h=!1,y=1},point:function(g,m){var b=[g,m],x,_=s(g,m),v=n?_?0:l(g,m):_?l(g+(g<0?Yt:-Yt),m):0;if(!f&&(p=h=_)&&u.lineStart(),_!==h&&(x=c(f,b),(!x||Hh(f,x)||Hh(b,x))&&(b[2]=1)),_!==h)y=0,_?(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&&n^_){var w;!(v&d)&&(w=c(b,f,!0))&&(y=0,n?(u.lineStart(),u.point(w[0][0],w[0][1]),u.point(w[1][0],w[1][1]),u.lineEnd()):(u.point(w[1][0],w[1][1]),u.lineEnd(),u.lineStart(),u.point(w[0][0],w[0][1],3)))}_&&(!f||!Hh(f,b))&&u.point(b[0],b[1]),f=b,h=_,d=v},lineEnd:function(){h&&u.lineEnd(),f=null},clean:function(){return y|(p&&h)<<1}}}function c(u,f,d){var h=ia(u),p=ia(f),y=[1,0,0],g=Xh(h,p),m=m0(g,g),b=g[0],x=m-b*b;if(!x)return!d&&u;var _=t*m/x,v=-t*b/x,w=Xh(y,g),I=y0(y,_),D=y0(g,v);rS(I,D);var A=w,B=m0(I,A),M=m0(A,A),O=B*B-M*(m0(I,I)-1);if(!(O<0)){var R=Ce(O),S=y0(A,(-B-R)/M);if(rS(S,I),S=p0(S),!d)return S;var T=u[0],E=f[0],C=u[1],U=f[1],k;E<T&&(k=T,T=E,E=k);var $=E-T,z=Jt($-Yt)<rt,V=z||$<rt;if(!z&&U<C&&(k=C,C=U,U=k),V?z?C+U>0^S[1]<(Jt(S[0]-T)<rt?C:U):C<=S[1]&&S[1]<=U:$>Yt^(T<=S[0]&&S[0]<=E)){var Q=y0(A,(-B+R)/M);return rS(Q,I),[S,p0(Q)]}}}function l(u,f){var d=n?e:Yt-e,h=0;return u<-d?h|=1:u>d&&(h|=2),f<-d?h|=4:f>d&&(h|=8),h}return hS(s,a,o,n?[0,-e]:[-Yt,e-Yt])}function v$(e,t,r,n,i,o){var s=e[0],a=e[1],c=t[0],l=t[1],u=0,f=1,d=c-s,h=l-a,p;if(p=r-s,!(!d&&p>0)){if(p/=d,d<0){if(p<u)return;p<f&&(f=p)}else if(d>0){if(p>f)return;p>u&&(u=p)}if(p=i-s,!(!d&&p<0)){if(p/=d,d<0){if(p>f)return;p>u&&(u=p)}else if(d>0){if(p<u)return;p<f&&(f=p)}if(p=n-a,!(!h&&p>0)){if(p/=h,h<0){if(p<u)return;p<f&&(f=p)}else if(h>0){if(p>f)return;p>u&&(u=p)}if(p=o-a,!(!h&&p<0)){if(p/=h,h<0){if(p>f)return;p>u&&(u=p)}else if(h>0){if(p<u)return;p<f&&(f=p)}return u>0&&(e[0]=s+u*d,e[1]=a+u*h),f<1&&(t[0]=s+f*d,t[1]=a+f*h),!0}}}}}var w0=1e9,pS=-w0;function Zh(e,t,r,n){function i(l,u){return e<=l&&l<=r&&t<=u&&u<=n}function o(l,u,f,d){var h=0,p=0;if(l==null||(h=s(l,f))!==(p=s(u,f))||c(l,u)<0^f>0)do d.point(h===0||h===3?e:r,h>1?n:t);while((h=(h+f+4)%4)!==p);else d.point(u[0],u[1])}function s(l,u){return Jt(l[0]-e)<rt?u>0?0:3:Jt(l[0]-r)<rt?u>0?2:1:Jt(l[1]-t)<rt?u>0?1:0:u>0?3:2}function a(l,u){return c(l.x,u.x)}function c(l,u){var f=s(l,1),d=s(u,1);return f!==d?f-d:f===0?u[1]-l[1]:f===1?l[0]-u[0]:f===2?l[1]-u[1]:u[0]-l[0]}return function(l){var u=l,f=uS(),d,h,p,y,g,m,b,x,_,v,w,I={point:D,lineStart:O,lineEnd:R,polygonStart:B,polygonEnd:M};function D(T,E){i(T,E)&&u.point(T,E)}function A(){for(var T=0,E=0,C=h.length;E<C;++E)for(var U=h[E],k=1,$=U.length,z=U[0],V,Q,nt=z[0],st=z[1];k<$;++k)V=nt,Q=st,z=U[k],nt=z[0],st=z[1],Q<=n?st>n&&(nt-V)*(n-Q)>(st-Q)*(e-V)&&++T:st<=n&&(nt-V)*(n-Q)<(st-Q)*(e-V)&&--T;return T}function B(){u=f,d=[],h=[],w=!0}function M(){var T=A(),E=w&&T,C=(d=Bh(d)).length;(E||C)&&(l.polygonStart(),E&&(l.lineStart(),o(null,null,1,l),l.lineEnd()),C&&dS(d,a,T,o,l),l.polygonEnd()),u=l,d=h=p=null}function O(){I.point=S,h&&h.push(p=[]),v=!0,_=!1,b=x=NaN}function R(){d&&(S(y,g),m&&_&&f.rejoin(),d.push(f.result())),I.point=D,_&&u.lineEnd()}function S(T,E){var C=i(T,E);if(h&&p.push([T,E]),v)y=T,g=E,m=C,v=!1,C&&(u.lineStart(),u.point(T,E));else if(C&&_)u.point(T,E);else{var U=[b=Math.max(pS,Math.min(w0,b)),x=Math.max(pS,Math.min(w0,x))],k=[T=Math.max(pS,Math.min(w0,T)),E=Math.max(pS,Math.min(w0,E))];v$(U,k,e,t,r,n)?(_||(u.lineStart(),u.point(U[0],U[1])),u.point(k[0],k[1]),C||u.lineEnd(),w=!1):C&&(u.lineStart(),u.point(T,E),w=!1)}b=T,x=E,_=C}return I}}function S$(e,t,r){var n=_r(e,t-rt,r).concat(t);return function(i){return n.map(function(o){return[i,o]})}}function I$(e,t,r){var n=_r(e,t-rt,r).concat(t);return function(i){return n.map(function(o){return[o,i]})}}function DB(){var e,t,r,n,i,o,s,a,c=10,l=c,u=90,f=360,d,h,p,y,g=2.5;function m(){return{type:"MultiLineString",coordinates:b()}}function b(){return _r(h0(n/u)*u,r,u).map(p).concat(_r(h0(a/f)*f,s,f).map(y)).concat(_r(h0(t/c)*c,e,c).filter(function(x){return Jt(x%u)>rt}).map(d)).concat(_r(h0(o/l)*l,i,l).filter(function(x){return Jt(x%f)>rt}).map(h))}return m.lines=function(){return b().map(function(x){return{type:"LineString",coordinates:x}})},m.outline=function(){return{type:"Polygon",coordinates:[p(n).concat(y(s).slice(1),p(r).reverse().slice(1),y(a).reverse().slice(1))]}},m.extent=function(x){return arguments.length?m.extentMajor(x).extentMinor(x):m.extentMinor()},m.extentMajor=function(x){return arguments.length?(n=+x[0][0],r=+x[1][0],a=+x[0][1],s=+x[1][1],n>r&&(x=n,n=r,r=x),a>s&&(x=a,a=s,s=x),m.precision(g)):[[n,a],[r,s]]},m.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),m.precision(g)):[[t,o],[e,i]]},m.step=function(x){return arguments.length?m.stepMajor(x).stepMinor(x):m.stepMinor()},m.stepMajor=function(x){return arguments.length?(u=+x[0],f=+x[1],m):[u,f]},m.stepMinor=function(x){return arguments.length?(c=+x[0],l=+x[1],m):[c,l]},m.precision=function(x){return arguments.length?(g=+x,d=S$(o,i,90),h=I$(t,e,g),p=S$(a,s,90),y=I$(n,r,g),m):g},m.extentMajor([[-180,-90+rt],[180,90-rt]]).extentMinor([[-180,-80-rt],[180,80+rt]])}function BB(){return DB()()}var v0=e=>e;var OB=new mn,NB=new mn,T$,A$,FB,LB,au={point:Lr,lineStart:Lr,lineEnd:Lr,polygonStart:function(){au.lineStart=lit,au.lineEnd=fit},polygonEnd:function(){au.lineStart=au.lineEnd=au.point=Lr,OB.add(Jt(NB)),NB=new mn},result:function(){var e=OB/2;return OB=new mn,e}};function lit(){au.point=uit}function uit(e,t){au.point=M$,T$=FB=e,A$=LB=t}function M$(e,t){NB.add(LB*e-FB*t),FB=e,LB=t}function fit(){M$(T$,A$)}var RB=au;var Kh=1/0,mS=Kh,S0=-Kh,yS=S0,dit={point:hit,lineStart:Lr,lineEnd:Lr,polygonStart:Lr,polygonEnd:Lr,result:function(){var e=[[Kh,mS],[S0,yS]];return S0=yS=-(mS=Kh=1/0),e}};function hit(e,t){e<Kh&&(Kh=e),e>S0&&(S0=e),t<mS&&(mS=t),t>yS&&(yS=t)}var Qh=dit;var kB=0,CB=0,I0=0,gS=0,bS=0,Jh=0,UB=0,PB=0,T0=0,B$,O$,oa,sa,ys={point:Wf,lineStart:E$,lineEnd:D$,polygonStart:function(){ys.lineStart=yit,ys.lineEnd=git},polygonEnd:function(){ys.point=Wf,ys.lineStart=E$,ys.lineEnd=D$},result:function(){var e=T0?[UB/T0,PB/T0]:Jh?[gS/Jh,bS/Jh]:I0?[kB/I0,CB/I0]:[NaN,NaN];return kB=CB=I0=gS=bS=Jh=UB=PB=T0=0,e}};function Wf(e,t){kB+=e,CB+=t,++I0}function E$(){ys.point=pit}function pit(e,t){ys.point=mit,Wf(oa=e,sa=t)}function mit(e,t){var r=e-oa,n=t-sa,i=Ce(r*r+n*n);gS+=i*(oa+e)/2,bS+=i*(sa+t)/2,Jh+=i,Wf(oa=e,sa=t)}function D$(){ys.point=Wf}function yit(){ys.point=bit}function git(){N$(B$,O$)}function bit(e,t){ys.point=N$,Wf(B$=oa=e,O$=sa=t)}function N$(e,t){var r=e-oa,n=t-sa,i=Ce(r*r+n*n);gS+=i*(oa+e)/2,bS+=i*(sa+t)/2,Jh+=i,i=sa*e-oa*t,UB+=i*(oa+e),PB+=i*(sa+t),T0+=i*3,Wf(oa=e,sa=t)}var $B=ys;function xS(e){this._context=e}xS.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,Xr);break}}},result:Lr};var VB=new mn,zB,F$,L$,A0,M0,_S={point:Lr,lineStart:function(){_S.point=xit},lineEnd:function(){zB&&R$(F$,L$),_S.point=Lr},polygonStart:function(){zB=!0},polygonEnd:function(){zB=null},result:function(){var e=+VB;return VB=new mn,e}};function xit(e,t){_S.point=R$,F$=A0=e,L$=M0=t}function R$(e,t){A0-=e,M0-=t,VB.add(Ce(A0*A0+M0*M0)),A0=e,M0=t}var jB=_S;var k$,wS,C$,U$,tp=class{constructor(t){this._append=t==null?P$:_it(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,r){switch(this._point){case 0:{this._append`M${t},${r}`,this._point=1;break}case 1:{this._append`L${t},${r}`;break}default:{if(this._append`M${t},${r}`,this._radius!==C$||this._append!==wS){let n=this._radius,i=this._;this._="",this._append`m0,${n}a${n},${n} 0 1,1 0,${-2*n}a${n},${n} 0 1,1 0,${2*n}z`,C$=n,wS=this._append,U$=this._,this._=i}this._+=U$;break}}}result(){let t=this._;return this._="",t.length?t:null}};function P$(e){let t=1;this._+=e[0];for(let r=e.length;t<r;++t)this._+=arguments[t]+e[t]}function _it(e){let t=Math.floor(e);if(!(t>=0))throw new RangeError(`invalid digits: ${e}`);if(t>15)return P$;if(t!==k$){let r=10**t;k$=t,wS=function(i){let o=1;this._+=i[0];for(let s=i.length;o<s;++o)this._+=Math.round(arguments[o]*r)/r+i[o]}}return wS}function xn(e,t){let r=3,n=4.5,i,o;function s(a){return a&&(typeof n=="function"&&o.pointRadius(+n.apply(this,arguments)),qi(a,i(o))),o.result()}return s.area=function(a){return qi(a,i(RB)),RB.result()},s.measure=function(a){return qi(a,i(jB)),jB.result()},s.bounds=function(a){return qi(a,i(Qh)),Qh.result()},s.centroid=function(a){return qi(a,i($B)),$B.result()},s.projection=function(a){return arguments.length?(i=a==null?(e=null,v0):(e=a).stream,s):e},s.context=function(a){return arguments.length?(o=a==null?(t=null,new tp(r)):new xS(t=a),typeof n!="function"&&o.pointRadius(n),s):t},s.pointRadius=function(a){return arguments.length?(n=typeof a=="function"?a:(o.pointRadius(+a),+a),s):n},s.digits=function(a){if(!arguments.length)return r;if(a==null)r=null;else{let c=Math.floor(a);if(!(c>=0))throw new RangeError(`invalid digits: ${a}`);r=c}return t===null&&(o=new tp(r)),s},s.projection(e).digits(r).context(t)}function Gf(e){return{stream:ep(e)}}function ep(e){return function(t){var r=new qB;for(var n in e)r[n]=e[n];return r.stream=t,r}}function qB(){}qB.prototype={constructor:qB,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 YB(e,t,r){var n=e.clipExtent&&e.clipExtent();return e.scale(150).translate([0,0]),n!=null&&e.clipExtent(null),qi(r,e.stream(Qh)),t(Qh.result()),n!=null&&e.clipExtent(n),e}function E0(e,t,r){return YB(e,function(n){var i=t[1][0]-t[0][0],o=t[1][1]-t[0][1],s=Math.min(i/(n[1][0]-n[0][0]),o/(n[1][1]-n[0][1])),a=+t[0][0]+(i-s*(n[1][0]+n[0][0]))/2,c=+t[0][1]+(o-s*(n[1][1]+n[0][1]))/2;e.scale(150*s).translate([a,c])},r)}function vS(e,t,r){return E0(e,[[0,0],t],r)}function SS(e,t,r){return YB(e,function(n){var i=+t,o=i/(n[1][0]-n[0][0]),s=(i-o*(n[1][0]+n[0][0]))/2,a=-o*n[0][1];e.scale(150*o).translate([s,a])},r)}function IS(e,t,r){return YB(e,function(n){var i=+t,o=i/(n[1][1]-n[0][1]),s=-o*n[0][0],a=(i-o*(n[1][1]+n[0][1]))/2;e.scale(150*o).translate([s,a])},r)}var $$=16,wit=et(30*ce);function WB(e,t){return+t?Sit(e,t):vit(e)}function vit(e){return ep({point:function(t,r){t=e(t,r),this.stream.point(t[0],t[1])}})}function Sit(e,t){function r(n,i,o,s,a,c,l,u,f,d,h,p,y,g){var m=l-n,b=u-i,x=m*m+b*b;if(x>4*t&&y--){var _=s+d,v=a+h,w=c+p,I=Ce(_*_+v*v+w*w),D=Ke(w/=I),A=Jt(Jt(w)-1)<rt||Jt(o-f)<rt?(o+f)/2:Fr(v,_),B=e(A,D),M=B[0],O=B[1],R=M-n,S=O-i,T=b*R-m*S;(T*T/x>t||Jt((m*R+b*S)/x-.5)>.3||s*d+a*h+c*p<wit)&&(r(n,i,o,s,a,c,M,O,A,_/=I,v/=I,w,y,g),g.point(M,O),r(M,O,A,_,v,w,l,u,f,d,h,p,y,g))}}return function(n){var i,o,s,a,c,l,u,f,d,h,p,y,g={point:m,lineStart:b,lineEnd:_,polygonStart:function(){n.polygonStart(),g.lineStart=v},polygonEnd:function(){n.polygonEnd(),g.lineStart=b}};function m(D,A){D=e(D,A),n.point(D[0],D[1])}function b(){f=NaN,g.point=x,n.lineStart()}function x(D,A){var B=ia([D,A]),M=e(D,A);r(f,d,u,h,p,y,f=M[0],d=M[1],u=D,h=B[0],p=B[1],y=B[2],$$,n),n.point(f,d)}function _(){g.point=m,n.lineEnd()}function v(){b(),g.point=w,g.lineEnd=I}function w(D,A){x(i=D,A),o=f,s=d,a=h,c=p,l=y,g.point=x}function I(){r(f,d,u,h,p,y,o,s,i,a,c,l,$$,n),g.lineEnd=_,_()}return g}}var Iit=ep({point:function(e,t){this.stream.point(e*ce,t*ce)}});function Tit(e){return ep({point:function(t,r){var n=e(t,r);return this.stream.point(n[0],n[1])}})}function Ait(e,t,r,n,i){function o(s,a){return s*=n,a*=i,[t+e*s,r-e*a]}return o.invert=function(s,a){return[(s-t)/e*n,(r-a)/e*i]},o}function z$(e,t,r,n,i,o){if(!o)return Ait(e,t,r,n,i);var s=et(o),a=tt(o),c=s*e,l=a*e,u=s/e,f=a/e,d=(a*r-s*t)/e,h=(a*t+s*r)/e;function p(y,g){return y*=n,g*=i,[c*y-l*g+t,r-l*y-c*g]}return p.invert=function(y,g){return[n*(u*y-f*g+d),i*(h-f*y-u*g)]},p}function _n(e){return GB(function(){return e})()}function GB(e){var t,r=150,n=480,i=250,o=0,s=0,a=0,c=0,l=0,u,f=0,d=1,h=1,p=null,y=EB,g=null,m,b,x,_=v0,v=.5,w,I,D,A,B;function M(T){return D(T[0]*ce,T[1]*ce)}function O(T){return T=D.invert(T[0],T[1]),T&&[T[0]*yr,T[1]*yr]}M.stream=function(T){return A&&B===T?A:A=Iit(Tit(u)(y(w(_(B=T)))))},M.preclip=function(T){return arguments.length?(y=T,p=void 0,S()):y},M.postclip=function(T){return arguments.length?(_=T,g=m=b=x=null,S()):_},M.clipAngle=function(T){return arguments.length?(y=+T?w$(p=T*ce):(p=null,EB),S()):p*yr},M.clipExtent=function(T){return arguments.length?(_=T==null?(g=m=b=x=null,v0):Zh(g=+T[0][0],m=+T[0][1],b=+T[1][0],x=+T[1][1]),S()):g==null?null:[[g,m],[b,x]]},M.scale=function(T){return arguments.length?(r=+T,R()):r},M.translate=function(T){return arguments.length?(n=+T[0],i=+T[1],R()):[n,i]},M.center=function(T){return arguments.length?(o=T[0]%360*ce,s=T[1]%360*ce,R()):[o*yr,s*yr]},M.rotate=function(T){return arguments.length?(a=T[0]%360*ce,c=T[1]%360*ce,l=T.length>2?T[2]%360*ce:0,R()):[a*yr,c*yr,l*yr]},M.angle=function(T){return arguments.length?(f=T%360*ce,R()):f*yr},M.reflectX=function(T){return arguments.length?(d=T?-1:1,R()):d<0},M.reflectY=function(T){return arguments.length?(h=T?-1:1,R()):h<0},M.precision=function(T){return arguments.length?(w=WB(I,v=T*T),S()):Ce(v)},M.fitExtent=function(T,E){return E0(M,T,E)},M.fitSize=function(T,E){return vS(M,T,E)},M.fitWidth=function(T,E){return SS(M,T,E)},M.fitHeight=function(T,E){return IS(M,T,E)};function R(){var T=z$(r,0,0,d,h,f).apply(null,t(o,s)),E=z$(r,n-T[0],i-T[1],d,h,f);return u=AB(a,c,l),I=_0(t,E),D=_0(u,I),w=WB(I,v),S()}function S(){return A=B=null,M}return function(){return t=e.apply(this,arguments),M.invert=t.invert&&O,R()}}function rp(e){var t=0,r=Yt/3,n=GB(e),i=n(t,r);return i.parallels=function(o){return arguments.length?n(t=o[0]*ce,r=o[1]*ce):[t*yr,r*yr]},i}function V$(e){var t=et(e);function r(n,i){return[n*t,tt(i)/t]}return r.invert=function(n,i){return[n/t,Ke(i*t)]},r}function j$(e,t){var r=tt(e),n=(r+tt(t))/2;if(Jt(n)<rt)return V$(e);var i=1+r*(2*n-r),o=Ce(i)/n;function s(a,c){var l=Ce(i-2*n*tt(c))/n;return[l*tt(a*=n),o-l*et(a)]}return s.invert=function(a,c){var l=o-c,u=Fr(a,Jt(l))*Nn(l);return l*n<0&&(u-=Yt*Nn(a)*Nn(l)),[u/n,Ke((i-(a*a+l*l)*n*n)/(2*n))]},s}function cu(){return rp(j$).scale(155.424).center([0,33.6442])}function D0(){return cu().parallels([29.5,45.5]).scale(1070).translate([480,250]).rotate([96,0]).center([-.6,38.7])}function Mit(e){var t=e.length;return{point:function(r,n){for(var i=-1;++i<t;)e[i].point(r,n)},sphere:function(){for(var r=-1;++r<t;)e[r].sphere()},lineStart:function(){for(var r=-1;++r<t;)e[r].lineStart()},lineEnd:function(){for(var r=-1;++r<t;)e[r].lineEnd()},polygonStart:function(){for(var r=-1;++r<t;)e[r].polygonStart()},polygonEnd:function(){for(var r=-1;++r<t;)e[r].polygonEnd()}}}function XB(){var e,t,r=D0(),n,i=cu().rotate([154,0]).center([-2,58.5]).parallels([55,65]),o,s=cu().rotate([157,0]).center([-3,19.9]).parallels([8,18]),a,c,l={point:function(d,h){c=[d,h]}};function u(d){var h=d[0],p=d[1];return c=null,n.point(h,p),c||(o.point(h,p),c)||(a.point(h,p),c)}u.invert=function(d){var h=r.scale(),p=r.translate(),y=(d[0]-p[0])/h,g=(d[1]-p[1])/h;return(g>=.12&&g<.234&&y>=-.425&&y<-.214?i:g>=.166&&g<.234&&y>=-.214&&y<-.115?s:r).invert(d)},u.stream=function(d){return e&&t===d?e:e=Mit([r.stream(t=d),i.stream(d),s.stream(d)])},u.precision=function(d){return arguments.length?(r.precision(d),i.precision(d),s.precision(d),f()):r.precision()},u.scale=function(d){return arguments.length?(r.scale(d),i.scale(d*.35),s.scale(d),u.translate(r.translate())):r.scale()},u.translate=function(d){if(!arguments.length)return r.translate();var h=r.scale(),p=+d[0],y=+d[1];return n=r.translate(d).clipExtent([[p-.455*h,y-.238*h],[p+.455*h,y+.238*h]]).stream(l),o=i.translate([p-.307*h,y+.201*h]).clipExtent([[p-.425*h+rt,y+.12*h+rt],[p-.214*h-rt,y+.234*h-rt]]).stream(l),a=s.translate([p-.205*h,y+.212*h]).clipExtent([[p-.214*h+rt,y+.166*h+rt],[p-.115*h-rt,y+.234*h-rt]]).stream(l),f()},u.fitExtent=function(d,h){return E0(u,d,h)},u.fitSize=function(d,h){return vS(u,d,h)},u.fitWidth=function(d,h){return SS(u,d,h)},u.fitHeight=function(d,h){return IS(u,d,h)};function f(){return e=t=null,u}return u.scale(1070)}function TS(e){return function(t,r){var n=et(t),i=et(r),o=e(n*i);return o===1/0?[2,0]:[o*i*tt(t),o*tt(r)]}}function aa(e){return function(t,r){var n=Ce(t*t+r*r),i=e(n),o=tt(i),s=et(i);return[Fr(t*o,n*s),Ke(n&&r*o/n)]}}var HB=TS(function(e){return Ce(2/(1+e))});HB.invert=aa(function(e){return 2*Ke(e/2)});function ZB(){return _n(HB).scale(124.75).clipAngle(180-.001)}var KB=TS(function(e){return(e=tS(e))&&e/tt(e)});KB.invert=aa(function(e){return e});function QB(){return _n(KB).scale(79.4188).clipAngle(180-.001)}function np(e,t){return[e,Yf(Gh((ke+t)/2))]}np.invert=function(e,t){return[e,2*vo(Kv(t))-ke]};function JB(){return tO(np).scale(961/Xr)}function tO(e){var t=_n(e),r=t.center,n=t.scale,i=t.translate,o=t.clipExtent,s=null,a,c,l;t.scale=function(f){return arguments.length?(n(f),u()):n()},t.translate=function(f){return arguments.length?(i(f),u()):i()},t.center=function(f){return arguments.length?(r(f),u()):r()},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=Yt*n(),d=t(y$(t.rotate()).invert([0,0]));return o(s==null?[[d[0]-f,d[1]-f],[d[0]+f,d[1]+f]]:e===np?[[Math.max(d[0]-f,s),a],[Math.min(d[0]+f,c),l]]:[[s,Math.max(d[1]-f,a)],[c,Math.min(d[1]+f,l)]])}return u()}function AS(e){return Gh((ke+e)/2)}function q$(e,t){var r=et(e),n=e===t?tt(e):Yf(r/et(t))/Yf(AS(t)/AS(e)),i=r*Jv(AS(e),n)/n;if(!n)return np;function o(s,a){i>0?a<-ke+rt&&(a=-ke+rt):a>ke-rt&&(a=ke-rt);var c=i/Jv(AS(a),n);return[c*tt(n*s),i-c*et(n*s)]}return o.invert=function(s,a){var c=i-a,l=Nn(n)*Ce(s*s+c*c),u=Fr(s,Jt(c))*Nn(c);return c*n<0&&(u-=Yt*Nn(s)*Nn(c)),[u/n,2*vo(Jv(i/l,1/n))-ke]},o}function eO(){return rp(q$).scale(109.5).parallels([30,30])}function ip(e,t){return[e,t]}ip.invert=ip;function rO(){return _n(ip).scale(152.63)}function Y$(e,t){var r=et(e),n=e===t?tt(e):(r-et(t))/(t-e),i=r/n+e;if(Jt(n)<rt)return ip;function o(s,a){var c=i-a,l=n*s;return[c*tt(l),i-c*et(l)]}return o.invert=function(s,a){var c=i-a,l=Fr(s,Jt(c))*Nn(c);return c*n<0&&(l-=Yt*Nn(s)*Nn(c)),[l/n,i-Nn(n)*Ce(s*s+c*c)]},o}function nO(){return rp(Y$).scale(131.154).center([0,13.9389])}var B0=1.340264,O0=-.081106,N0=893e-6,F0=.003796,MS=Ce(3)/2,Eit=12;function iO(e,t){var r=Ke(MS*tt(t)),n=r*r,i=n*n*n;return[e*et(r)/(MS*(B0+3*O0*n+i*(7*N0+9*F0*n))),r*(B0+O0*n+i*(N0+F0*n))]}iO.invert=function(e,t){for(var r=t,n=r*r,i=n*n*n,o=0,s,a,c;o<Eit&&(a=r*(B0+O0*n+i*(N0+F0*n))-t,c=B0+3*O0*n+i*(7*N0+9*F0*n),r-=s=a/c,n=r*r,i=n*n*n,!(Jt(s)<qf));++o);return[MS*e*(B0+3*O0*n+i*(7*N0+9*F0*n))/et(r),Ke(tt(r)/MS)]};function oO(){return _n(iO).scale(177.158)}function sO(e,t){var r=et(t),n=et(e)*r;return[r*tt(e)/n,tt(t)/n]}sO.invert=aa(vo);function aO(){return _n(sO).scale(144.049).clipAngle(60)}function cO(e,t){return[et(t)*tt(e),tt(t)]}cO.invert=aa(Ke);function lO(){return _n(cO).scale(249.5).clipAngle(90+rt)}function uO(e,t){var r=et(t),n=1+et(e)*r;return[r*tt(e)/n,tt(t)/n]}uO.invert=aa(function(e){return 2*vo(e)});function fO(){return _n(uO).scale(250).clipAngle(142)}function dO(e,t){return[Yf(Gh((ke+t)/2)),-e]}dO.invert=function(e,t){return[-t,2*vo(Kv(e))-ke]};function hO(){var e=tO(dO),t=e.center,r=e.rotate;return e.center=function(n){return arguments.length?t([-n[1],n[0]]):(n=t(),[n[1],-n[0]])},e.rotate=function(n){return arguments.length?r([n[0],n[1],n.length>2?n[2]+90:90]):(n=r(),[n[0],n[1],n[2]-90])},r([0,0,90]).scale(159.155)}function Dit(e,t){return e.parent===t.parent?1:2}function Bit(e){return e.reduce(Oit,0)/e.length}function Oit(e,t){return e+t.x}function Nit(e){return 1+e.reduce(Fit,0)}function Fit(e,t){return Math.max(e,t.y)}function Lit(e){for(var t;t=e.children;)e=t[0];return e}function Rit(e){for(var t;t=e.children;)e=t[t.length-1];return e}function ES(){var e=Dit,t=1,r=1,n=!1;function i(o){var s,a=0;o.eachAfter(function(d){var h=d.children;h?(d.x=Bit(h),d.y=Nit(h)):(d.x=s?a+=e(d,s):0,d.y=0,s=d)});var c=Lit(o),l=Rit(o),u=c.x-e(c,l)/2,f=l.x+e(l,c)/2;return o.eachAfter(n?function(d){d.x=(d.x-o.x)*t,d.y=(o.y-d.y)*r}:function(d){d.x=(d.x-u)/(f-u)*t,d.y=(1-(o.y?d.y/o.y:1))*r})}return i.separation=function(o){return arguments.length?(e=o,i):e},i.size=function(o){return arguments.length?(n=!1,t=+o[0],r=+o[1],i):n?null:[t,r]},i.nodeSize=function(o){return arguments.length?(n=!0,t=+o[0],r=+o[1],i):n?[t,r]:null},i}function kit(e){var t=0,r=e.children,n=r&&r.length;if(!n)t=1;else for(;--n>=0;)t+=r[n].value;e.value=t}function W$(){return this.eachAfter(kit)}function G$(e,t){let r=-1;for(let n of this)e.call(t,n,++r,this);return this}function X$(e,t){for(var r=this,n=[r],i,o,s=-1;r=n.pop();)if(e.call(t,r,++s,this),i=r.children)for(o=i.length-1;o>=0;--o)n.push(i[o]);return this}function H$(e,t){for(var r=this,n=[r],i=[],o,s,a,c=-1;r=n.pop();)if(i.push(r),o=r.children)for(s=0,a=o.length;s<a;++s)n.push(o[s]);for(;r=i.pop();)e.call(t,r,++c,this);return this}function Z$(e,t){let r=-1;for(let n of this)if(e.call(t,n,++r,this))return n}function K$(e){return this.eachAfter(function(t){for(var r=+e(t.data)||0,n=t.children,i=n&&n.length;--i>=0;)r+=n[i].value;t.value=r})}function Q$(e){return this.eachBefore(function(t){t.children&&t.children.sort(e)})}function J$(e){for(var t=this,r=Cit(t,e),n=[t];t!==r;)t=t.parent,n.push(t);for(var i=n.length;e!==r;)n.splice(i,0,e),e=e.parent;return n}function Cit(e,t){if(e===t)return e;var r=e.ancestors(),n=t.ancestors(),i=null;for(e=r.pop(),t=n.pop();e===t;)i=e,e=r.pop(),t=n.pop();return i}function tz(){for(var e=this,t=[e];e=e.parent;)t.push(e);return t}function ez(){return Array.from(this)}function rz(){var e=[];return this.eachBefore(function(t){t.children||e.push(t)}),e}function nz(){var e=this,t=[];return e.each(function(r){r!==e&&t.push({source:r.parent,target:r})}),t}function*iz(){var e=this,t,r=[e],n,i,o;do for(t=r.reverse(),r=[];e=t.pop();)if(yield e,n=e.children)for(i=0,o=n.length;i<o;++i)r.push(n[i]);while(r.length)}function pO(e,t){e instanceof Map?(e=[void 0,e],t===void 0&&(t=$it)):t===void 0&&(t=Pit);for(var r=new lu(e),n,i=[r],o,s,a,c;n=i.pop();)if((s=t(n.data))&&(c=(s=Array.from(s)).length))for(n.children=s,a=c-1;a>=0;--a)i.push(o=s[a]=new lu(s[a])),o.parent=n,o.depth=n.depth+1;return r.eachBefore(mO)}function Uit(){return pO(this).eachBefore(zit)}function Pit(e){return e.children}function $it(e){return Array.isArray(e)?e[1]:null}function zit(e){e.data.value!==void 0&&(e.value=e.data.value),e.data=e.data.data}function mO(e){var t=0;do e.height=t;while((e=e.parent)&&e.height<++t)}function lu(e){this.data=e,this.depth=this.height=0,this.parent=null}lu.prototype=pO.prototype={constructor:lu,count:W$,each:G$,eachAfter:H$,eachBefore:X$,find:Z$,sum:K$,sort:Q$,path:J$,ancestors:tz,descendants:ez,leaves:rz,links:nz,copy:Uit,[Symbol.iterator]:iz};function DS(e){return e==null?null:Vit(e)}function Vit(e){if(typeof e!="function")throw new Error;return e}var jit={depth:-1},oz={},yO={};function qit(e){return e.id}function Yit(e){return e.parentId}function BS(){var e=qit,t=Yit,r;function n(i){var o=Array.from(i),s=e,a=t,c,l,u,f,d,h,p,y,g=new Map;if(r!=null){let m=o.map((_,v)=>Wit(r(_,v,i))),b=m.map(sz),x=new Set(m).add("");for(let _ of b)x.has(_)||(x.add(_),m.push(_),b.push(sz(_)),o.push(yO));s=(_,v)=>m[v],a=(_,v)=>b[v]}for(u=0,c=o.length;u<c;++u)l=o[u],h=o[u]=new lu(l),(p=s(l,u,i))!=null&&(p+="")&&(y=h.id=p,g.set(y,g.has(y)?oz:h)),(p=a(l,u,i))!=null&&(p+="")&&(h.parent=p);for(u=0;u<c;++u)if(h=o[u],p=h.parent){if(d=g.get(p),!d)throw new Error("missing: "+p);if(d===oz)throw new Error("ambiguous: "+p);d.children?d.children.push(h):d.children=[h],h.parent=d}else{if(f)throw new Error("multiple roots");f=h}if(!f)throw new Error("no root");if(r!=null){for(;f.data===yO&&f.children.length===1;)f=f.children[0],--c;for(let m=o.length-1;m>=0&&(h=o[m],h.data===yO);--m)h.data=null}if(f.parent=jit,f.eachBefore(function(m){m.depth=m.parent.depth+1,--c}).eachBefore(mO),f.parent=null,c>0)throw new Error("cycle");return f}return n.id=function(i){return arguments.length?(e=DS(i),n):e},n.parentId=function(i){return arguments.length?(t=DS(i),n):t},n.path=function(i){return arguments.length?(r=DS(i),n):r},n}function Wit(e){e=`${e}`;let t=e.length;return gO(e,t-1)&&!gO(e,t-2)&&(e=e.slice(0,-1)),e[0]==="/"?e:`/${e}`}function sz(e){let t=e.length;if(t<2)return"";for(;--t>1&&!gO(e,t););return e.slice(0,t)}function gO(e,t){if(e[t]==="/"){let r=0;for(;t>0&&e[--t]==="\\";)++r;if(!(r&1))return!0}return!1}function Git(e,t){return e.parent===t.parent?1:2}function bO(e){var t=e.children;return t?t[0]:e.t}function xO(e){var t=e.children;return t?t[t.length-1]:e.t}function Xit(e,t,r){var n=r/(t.i-e.i);t.c-=n,t.s+=r,e.c+=n,t.z+=r,t.m+=r}function Hit(e){for(var t=0,r=0,n=e.children,i=n.length,o;--i>=0;)o=n[i],o.z+=t,o.m+=t,t+=o.s+(r+=o.c)}function Zit(e,t,r){return e.a.parent===t.parent?e.a:r}function OS(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}OS.prototype=Object.create(lu.prototype);function Kit(e){for(var t=new OS(e,0),r,n=[t],i,o,s,a;r=n.pop();)if(o=r._.children)for(r.children=new Array(a=o.length),s=a-1;s>=0;--s)n.push(i=r.children[s]=new OS(o[s],s)),i.parent=r;return(t.parent=new OS(null,0)).children=[t],t}function Xf(){var e=Git,t=1,r=1,n=null;function i(l){var u=Kit(l);if(u.eachAfter(o),u.parent.m=-u.z,u.eachBefore(s),n)l.eachBefore(c);else{var f=l,d=l,h=l;l.eachBefore(function(b){b.x<f.x&&(f=b),b.x>d.x&&(d=b),b.depth>h.depth&&(h=b)});var p=f===d?1:e(f,d)/2,y=p-f.x,g=t/(d.x+p+y),m=r/(h.depth||1);l.eachBefore(function(b){b.x=(b.x+y)*g,b.y=b.depth*m})}return l}function o(l){var u=l.children,f=l.parent.children,d=l.i?f[l.i-1]:null;if(u){Hit(l);var h=(u[0].z+u[u.length-1].z)/2;d?(l.z=d.z+e(l._,d._),l.m=l.z-h):l.z=h}else d&&(l.z=d.z+e(l._,d._));l.parent.A=a(l,d,l.parent.A||f[0])}function s(l){l._.x=l.z+l.parent.m,l.m+=l.parent.m}function a(l,u,f){if(u){for(var d=l,h=l,p=u,y=d.parent.children[0],g=d.m,m=h.m,b=p.m,x=y.m,_;p=xO(p),d=bO(d),p&&d;)y=bO(y),h=xO(h),h.a=l,_=p.z+b-d.z-g+e(p._,d._),_>0&&(Xit(Zit(p,l,f),l,_),g+=_,m+=_),b+=p.m,g+=d.m,x+=y.m,m+=h.m;p&&!xO(h)&&(h.t=p,h.m+=b-m),d&&!bO(y)&&(y.t=d,y.m+=g-x,f=l)}return f}function c(l){l.x*=t,l.y=l.depth*r}return i.separation=function(l){return arguments.length?(e=l,i):e},i.size=function(l){return arguments.length?(n=!1,t=+l[0],r=+l[1],i):n?null:[t,r]},i.nodeSize=function(l){return arguments.length?(n=!0,t=+l[0],r=+l[1],i):n?[t,r]:null},i}var az=23283064365386963e-26;function ca(e=Math.random()){let t=(0<=e&&e<1?e/az:Math.abs(e))|0;return()=>(t=1664525*t+1013904223|0,az*(t>>>0))}function Rr(e,t){switch(arguments.length){case 0:break;case 1:this.range(e);break;default:this.range(t).domain(e);break}return this}function L0(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 R0=Symbol("implicit");function Hf(){var e=new Gn,t=[],r=[],n=R0;function i(o){let s=e.get(o);if(s===void 0){if(n!==R0)return n;e.set(o,s=t.push(o)-1)}return r[s%r.length]}return i.domain=function(o){if(!arguments.length)return t.slice();t=[],e=new Gn;for(let s of o)e.has(s)||e.set(s,t.push(s)-1);return i},i.range=function(o){return arguments.length?(r=Array.from(o),i):r.slice()},i.unknown=function(o){return arguments.length?(n=o,i):n},i.copy=function(){return Hf(t,r).unknown(n)},Rr.apply(i,arguments),i}function uu(){var e=Hf().unknown(void 0),t=e.domain,r=e.range,n=0,i=1,o,s,a=!1,c=0,l=0,u=.5;delete e.unknown;function f(){var d=t().length,h=i<n,p=h?i:n,y=h?n:i;o=(y-p)/Math.max(1,d-c+l*2),a&&(o=Math.floor(o)),p+=(y-p-o*(d-c))*u,s=o*(1-c),a&&(p=Math.round(p),s=Math.round(s));var g=_r(d).map(function(m){return p+o*m});return r(h?g.reverse():g)}return e.domain=function(d){return arguments.length?(t(d),f()):t()},e.range=function(d){return arguments.length?([n,i]=d,n=+n,i=+i,f()):[n,i]},e.rangeRound=function(d){return[n,i]=d,n=+n,i=+i,a=!0,f()},e.bandwidth=function(){return s},e.step=function(){return o},e.round=function(d){return arguments.length?(a=!!d,f()):a},e.padding=function(d){return arguments.length?(c=Math.min(1,l=+d),f()):c},e.paddingInner=function(d){return arguments.length?(c=Math.min(1,d),f()):c},e.paddingOuter=function(d){return arguments.length?(l=+d,f()):l},e.align=function(d){return arguments.length?(u=Math.max(0,Math.min(1,d)),f()):u},e.copy=function(){return uu(t(),[n,i]).round(a).paddingInner(c).paddingOuter(l).align(u)},Rr.apply(f(),arguments)}function cz(e){var t=e.copy;return e.padding=e.paddingOuter,delete e.paddingInner,delete e.paddingOuter,e.copy=function(){return cz(t())},e}function _O(){return cz(uu.apply(null,arguments).paddingInner(1))}function wO(e){return function(){return e}}function op(e){return+e}var lz=[0,1];function Si(e){return e}function vO(e,t){return(t-=e=+e)?function(r){return(r-e)/t}:wO(isNaN(t)?NaN:.5)}function Qit(e,t){var r;return e>t&&(r=e,e=t,t=r),function(n){return Math.max(e,Math.min(t,n))}}function Jit(e,t,r){var n=e[0],i=e[1],o=t[0],s=t[1];return i<n?(n=vO(i,n),o=r(s,o)):(n=vO(n,i),o=r(o,s)),function(a){return o(n(a))}}function tot(e,t,r){var n=Math.min(e.length,t.length)-1,i=new Array(n),o=new Array(n),s=-1;for(e[n]<e[0]&&(e=e.slice().reverse(),t=t.slice().reverse());++s<n;)i[s]=vO(e[s],e[s+1]),o[s]=r(t[s],t[s+1]);return function(a){var c=Nc(e,a,1,n)-1;return o[c](i[c](a))}}function la(e,t){return t.domain(e.domain()).range(e.range()).interpolate(e.interpolate()).clamp(e.clamp()).unknown(e.unknown())}function Zf(){var e=lz,t=lz,r=ji,n,i,o,s=Si,a,c,l;function u(){var d=Math.min(e.length,t.length);return s!==Si&&(s=Qit(e[0],e[d-1])),a=d>2?tot:Jit,c=l=null,f}function f(d){return d==null||isNaN(d=+d)?o:(c||(c=a(e.map(n),t,r)))(n(s(d)))}return f.invert=function(d){return s(i((l||(l=a(t,e.map(n),Ze)))(d)))},f.domain=function(d){return arguments.length?(e=Array.from(d,op),u()):e.slice()},f.range=function(d){return arguments.length?(t=Array.from(d),u()):t.slice()},f.rangeRound=function(d){return t=Array.from(d),r=Uf,u()},f.clamp=function(d){return arguments.length?(s=d?!0:Si,u()):s!==Si},f.interpolate=function(d){return arguments.length?(r=d,u()):r},f.unknown=function(d){return arguments.length?(o=d,f):o},function(d,h){return n=d,i=h,u()}}function k0(){return Zf()(Si,Si)}function SO(e,t,r,n){var i=Eh(e,t,r),o;switch(n=na(n??",f"),n.type){case"s":{var s=Math.max(Math.abs(e),Math.abs(t));return n.precision==null&&!isNaN(o=yB(i,s))&&(n.precision=o),Zv(n,s)}case"":case"e":case"g":case"p":case"r":{n.precision==null&&!isNaN(o=gB(i,Math.max(Math.abs(e),Math.abs(t))))&&(n.precision=o-(n.type==="e"));break}case"f":case"%":{n.precision==null&&!isNaN(o=mB(i))&&(n.precision=o-(n.type==="%")*2);break}}return wo(n)}function jc(e){var t=e.domain;return e.ticks=function(r){var n=t();return yn(n[0],n[n.length-1],r??10)},e.tickFormat=function(r,n){var i=t();return SO(i[0],i[i.length-1],r??10,n)},e.nice=function(r){r==null&&(r=10);var n=t(),i=0,o=n.length-1,s=n[i],a=n[o],c,l,u=10;for(a<s&&(l=s,s=a,a=l,l=i,i=o,o=l);u-- >0;){if(l=Fc(s,a,r),l===c)return n[i]=s,n[o]=a,t(n);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 qc(){var e=k0();return e.copy=function(){return la(e,qc())},Rr.apply(e,arguments),jc(e)}function C0(e){var t;function r(n){return n==null||isNaN(n=+n)?t:n}return r.invert=r,r.domain=r.range=function(n){return arguments.length?(e=Array.from(n,op),r):e.slice()},r.unknown=function(n){return arguments.length?(t=n,r):t},r.copy=function(){return C0(e).unknown(t)},e=arguments.length?Array.from(e,op):[0,1],jc(r)}function U0(e,t){e=e.slice();var r=0,n=e.length-1,i=e[r],o=e[n],s;return o<i&&(s=r,r=n,n=s,s=i,i=o,o=s),e[r]=t.floor(i),e[n]=t.ceil(o),e}function uz(e){return Math.log(e)}function fz(e){return Math.exp(e)}function eot(e){return-Math.log(-e)}function rot(e){return-Math.exp(-e)}function not(e){return isFinite(e)?+("1e"+e):e<0?0:e}function iot(e){return e===10?not:e===Math.E?Math.exp:t=>Math.pow(e,t)}function oot(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 dz(e){return(t,r)=>-e(-t,r)}function IO(e){let t=e(uz,fz),r=t.domain,n=10,i,o;function s(){return i=oot(n),o=iot(n),r()[0]<0?(i=dz(i),o=dz(o),e(eot,rot)):e(uz,fz),t}return t.base=function(a){return arguments.length?(n=+a,s()):n},t.domain=function(a){return arguments.length?(r(a),s()):r()},t.ticks=a=>{let c=r(),l=c[0],u=c[c.length-1],f=u<l;f&&([l,u]=[u,l]);let d=i(l),h=i(u),p,y,g=a==null?10:+a,m=[];if(!(n%1)&&h-d<g){if(d=Math.floor(d),h=Math.ceil(h),l>0){for(;d<=h;++d)for(p=1;p<n;++p)if(y=d<0?p/o(-d):p*o(d),!(y<l)){if(y>u)break;m.push(y)}}else for(;d<=h;++d)for(p=n-1;p>=1;--p)if(y=d>0?p/o(-d):p*o(d),!(y<l)){if(y>u)break;m.push(y)}m.length*2<g&&(m=yn(l,u,g))}else m=yn(d,h,Math.min(h-d,g)).map(o);return f?m.reverse():m},t.tickFormat=(a,c)=>{if(a==null&&(a=10),c==null&&(c=n===10?"s":","),typeof c!="function"&&(!(n%1)&&(c=na(c)).precision==null&&(c.trim=!0),c=wo(c)),a===1/0)return c;let l=Math.max(1,n*a/t.ticks().length);return u=>{let f=u/o(Math.round(i(u)));return f*n<n-.5&&(f*=n),f<=l?c(u):""}},t.nice=()=>r(U0(r(),{floor:a=>o(Math.floor(i(a))),ceil:a=>o(Math.ceil(i(a)))})),t}function P0(){let e=IO(Zf()).domain([1,10]);return e.copy=()=>la(e,P0()).base(e.base()),Rr.apply(e,arguments),e}function hz(e){return function(t){return Math.sign(t)*Math.log1p(Math.abs(t/e))}}function pz(e){return function(t){return Math.sign(t)*Math.expm1(Math.abs(t))*e}}function TO(e){var t=1,r=e(hz(t),pz(t));return r.constant=function(n){return arguments.length?e(hz(t=+n),pz(t)):t},jc(r)}function $0(){var e=TO(Zf());return e.copy=function(){return la(e,$0()).constant(e.constant())},Rr.apply(e,arguments)}function mz(e){return function(t){return t<0?-Math.pow(-t,e):Math.pow(t,e)}}function sot(e){return e<0?-Math.sqrt(-e):Math.sqrt(e)}function aot(e){return e<0?-e*e:e*e}function AO(e){var t=e(Si,Si),r=1;function n(){return r===1?e(Si,Si):r===.5?e(sot,aot):e(mz(r),mz(1/r))}return t.exponent=function(i){return arguments.length?(r=+i,n()):r},jc(t)}function z0(){var e=AO(Zf());return e.copy=function(){return la(e,z0()).exponent(e.exponent())},Rr.apply(e,arguments),e}function V0(){var e=[],t=[],r=[],n;function i(){var s=0,a=Math.max(1,t.length);for(r=new Array(a-1);++s<a;)r[s-1]=TD(e,s/a);return o}function o(s){return s==null||isNaN(s=+s)?n:t[Nc(r,s)]}return o.invertExtent=function(s){var a=t.indexOf(s);return a<0?[NaN,NaN]:[a>0?r[a-1]:e[0],a<r.length?r[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(ie),i()},o.range=function(s){return arguments.length?(t=Array.from(s),i()):t.slice()},o.unknown=function(s){return arguments.length?(n=s,o):n},o.quantiles=function(){return r.slice()},o.copy=function(){return V0().domain(e).range(t).unknown(n)},Rr.apply(o,arguments)}function j0(){var e=[.5],t=[0,1],r,n=1;function i(o){return o!=null&&o<=o?t[Nc(e,o,0,n)]:r}return i.domain=function(o){return arguments.length?(e=Array.from(o),n=Math.min(e.length,t.length-1),i):e.slice()},i.range=function(o){return arguments.length?(t=Array.from(o),n=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?(r=o,i):r},i.copy=function(){return j0().domain(e).range(t).unknown(r)},Rr.apply(i,arguments)}var MO=new Date,EO=new Date;function Pe(e,t,r,n){function i(o){return e(o=arguments.length===0?new Date:new Date(+o)),o}return i.floor=o=>(e(o=new Date(+o)),o),i.ceil=o=>(e(o=new Date(o-1)),t(o,1),e(o),o),i.round=o=>{let s=i(o),a=i.ceil(o);return o-s<a-o?s:a},i.offset=(o,s)=>(t(o=new Date(+o),s==null?1:Math.floor(s)),o),i.range=(o,s,a)=>{let c=[];if(o=i.ceil(o),a=a==null?1:Math.floor(a),!(o<s)||!(a>0))return c;let l;do c.push(l=new Date(+o)),t(o,a),e(o);while(l<o&&o<s);return c},i.filter=o=>Pe(s=>{if(s>=s)for(;e(s),!o(s);)s.setTime(s-1)},(s,a)=>{if(s>=s)if(a<0)for(;++a<=0;)for(;t(s,-1),!o(s););else for(;--a>=0;)for(;t(s,1),!o(s););}),r&&(i.count=(o,s)=>(MO.setTime(+o),EO.setTime(+s),e(MO),e(EO),Math.floor(r(MO,EO))),i.every=o=>(o=Math.floor(o),!isFinite(o)||!(o>0)?null:o>1?i.filter(n?s=>n(s)%o===0:s=>i.count(0,s)%o===0):i)),i}var q0=Pe(()=>{},(e,t)=>{e.setTime(+e+t)},(e,t)=>t-e);q0.every=e=>(e=Math.floor(e),!isFinite(e)||!(e>0)?null:e>1?Pe(t=>{t.setTime(Math.floor(t/e)*e)},(t,r)=>{t.setTime(+t+r*e)},(t,r)=>(r-t)/e):q0);var Q$t=q0.range;var Hr=Pe(e=>{e.setTime(e-e.getMilliseconds())},(e,t)=>{e.setTime(+e+t*1e3)},(e,t)=>(t-e)/1e3,e=>e.getUTCSeconds()),yz=Hr.range;var Yc=Pe(e=>{e.setTime(e-e.getMilliseconds()-e.getSeconds()*1e3)},(e,t)=>{e.setTime(+e+t*6e4)},(e,t)=>(t-e)/6e4,e=>e.getMinutes()),cot=Yc.range,Wc=Pe(e=>{e.setUTCSeconds(0,0)},(e,t)=>{e.setTime(+e+t*6e4)},(e,t)=>(t-e)/6e4,e=>e.getUTCMinutes()),lot=Wc.range;var Gc=Pe(e=>{e.setTime(e-e.getMilliseconds()-e.getSeconds()*1e3-e.getMinutes()*6e4)},(e,t)=>{e.setTime(+e+t*36e5)},(e,t)=>(t-e)/36e5,e=>e.getHours()),uot=Gc.range,Xc=Pe(e=>{e.setUTCMinutes(0,0,0)},(e,t)=>{e.setTime(+e+t*36e5)},(e,t)=>(t-e)/36e5,e=>e.getUTCHours()),fot=Xc.range;var So=Pe(e=>e.setHours(0,0,0,0),(e,t)=>e.setDate(e.getDate()+t),(e,t)=>(t-e-(t.getTimezoneOffset()-e.getTimezoneOffset())*6e4)/864e5,e=>e.getDate()-1),dot=So.range,Jf=Pe(e=>{e.setUTCHours(0,0,0,0)},(e,t)=>{e.setUTCDate(e.getUTCDate()+t)},(e,t)=>(t-e)/864e5,e=>e.getUTCDate()-1),hot=Jf.range,td=Pe(e=>{e.setUTCHours(0,0,0,0)},(e,t)=>{e.setUTCDate(e.getUTCDate()+t)},(e,t)=>(t-e)/864e5,e=>Math.floor(e/864e5)),pot=td.range;function ed(e){return Pe(t=>{t.setDate(t.getDate()-(t.getDay()+7-e)%7),t.setHours(0,0,0,0)},(t,r)=>{t.setDate(t.getDate()+r*7)},(t,r)=>(r-t-(r.getTimezoneOffset()-t.getTimezoneOffset())*6e4)/6048e5)}var Yi=ed(0),fu=ed(1),NS=ed(2),FS=ed(3),fa=ed(4),LS=ed(5),RS=ed(6),bz=Yi.range,mot=fu.range,yot=NS.range,got=FS.range,bot=fa.range,xot=LS.range,_ot=RS.range;function rd(e){return Pe(t=>{t.setUTCDate(t.getUTCDate()-(t.getUTCDay()+7-e)%7),t.setUTCHours(0,0,0,0)},(t,r)=>{t.setUTCDate(t.getUTCDate()+r*7)},(t,r)=>(r-t)/6048e5)}var Wi=rd(0),du=rd(1),kS=rd(2),CS=rd(3),da=rd(4),US=rd(5),PS=rd(6),xz=Wi.range,wot=du.range,vot=kS.range,Sot=CS.range,Iot=da.range,Tot=US.range,Aot=PS.range;var Hc=Pe(e=>{e.setDate(1),e.setHours(0,0,0,0)},(e,t)=>{e.setMonth(e.getMonth()+t)},(e,t)=>t.getMonth()-e.getMonth()+(t.getFullYear()-e.getFullYear())*12,e=>e.getMonth()),Mot=Hc.range,Zc=Pe(e=>{e.setUTCDate(1),e.setUTCHours(0,0,0,0)},(e,t)=>{e.setUTCMonth(e.getUTCMonth()+t)},(e,t)=>t.getUTCMonth()-e.getUTCMonth()+(t.getUTCFullYear()-e.getUTCFullYear())*12,e=>e.getUTCMonth()),Eot=Zc.range;var Fn=Pe(e=>{e.setMonth(0,1),e.setHours(0,0,0,0)},(e,t)=>{e.setFullYear(e.getFullYear()+t)},(e,t)=>t.getFullYear()-e.getFullYear(),e=>e.getFullYear());Fn.every=e=>!isFinite(e=Math.floor(e))||!(e>0)?null:Pe(t=>{t.setFullYear(Math.floor(t.getFullYear()/e)*e),t.setMonth(0,1),t.setHours(0,0,0,0)},(t,r)=>{t.setFullYear(t.getFullYear()+r*e)});var Dot=Fn.range,Ln=Pe(e=>{e.setUTCMonth(0,1),e.setUTCHours(0,0,0,0)},(e,t)=>{e.setUTCFullYear(e.getUTCFullYear()+t)},(e,t)=>t.getUTCFullYear()-e.getUTCFullYear(),e=>e.getUTCFullYear());Ln.every=e=>!isFinite(e=Math.floor(e))||!(e>0)?null:Pe(t=>{t.setUTCFullYear(Math.floor(t.getUTCFullYear()/e)*e),t.setUTCMonth(0,1),t.setUTCHours(0,0,0,0)},(t,r)=>{t.setUTCFullYear(t.getUTCFullYear()+r*e)});var Bot=Ln.range;function wz(e,t,r,n,i,o){let s=[[Hr,1,1e3],[Hr,5,5*1e3],[Hr,15,15*1e3],[Hr,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],[n,1,864e5],[n,2,2*864e5],[r,1,6048e5],[t,1,2592e6],[t,3,3*2592e6],[e,1,31536e6]];function a(l,u,f){let d=u<l;d&&([l,u]=[u,l]);let h=f&&typeof f.range=="function"?f:c(l,u,f),p=h?h.range(l,+u+1):[];return d?p.reverse():p}function c(l,u,f){let d=Math.abs(u-l)/f,h=Oc(([,,g])=>g).right(s,d);if(h===s.length)return e.every(Eh(l/31536e6,u/31536e6,f));if(h===0)return q0.every(Math.max(Eh(l,u,f),1));let[p,y]=s[d/s[h-1][2]<s[h][2]/d?h-1:h];return p.every(y)}return[a,c]}var[DO,W0]=wz(Ln,Zc,Wi,td,Xc,Wc),[BO,OO]=wz(Fn,Hc,Yi,So,Gc,Yc);function NO(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 FO(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 G0(e,t,r){return{y:e,m:t,d:r,H:0,M:0,S:0,L:0}}function LO(e){var t=e.dateTime,r=e.date,n=e.time,i=e.periods,o=e.days,s=e.shortDays,a=e.months,c=e.shortMonths,l=X0(i),u=H0(i),f=X0(o),d=H0(o),h=X0(s),p=H0(s),y=X0(a),g=H0(a),m=X0(c),b=H0(c),x={a:C,A:U,b:k,B:$,c:null,d:Mz,e:Mz,f:tst,g:ust,G:dst,H:Kot,I:Qot,j:Jot,L:Nz,m:est,M:rst,p:z,q:V,Q:Bz,s:Oz,S:nst,u:ist,U:ost,V:sst,w:ast,W:cst,x:null,X:null,y:lst,Y:fst,Z:hst,"%":Dz},_={a:Q,A:nt,b:st,B:ut,c:null,d:Ez,e:Ez,f:gst,g:Mst,G:Dst,H:pst,I:mst,j:yst,L:Lz,m:bst,M:xst,p:X,q:at,Q:Bz,s:Oz,S:_st,u:wst,U:vst,V:Sst,w:Ist,W:Tst,x:null,X:null,y:Ast,Y:Est,Z:Bst,"%":Dz},v={a:B,A:M,b:O,B:R,c:S,d:Tz,e:Tz,f:Got,g:Iz,G:Sz,H:Az,I:Az,j:jot,L:Wot,m:Vot,M:qot,p:A,q:zot,Q:Hot,s:Zot,S:Yot,u:kot,U:Cot,V:Uot,w:Rot,W:Pot,x:T,X:E,y:Iz,Y:Sz,Z:$ot,"%":Xot};x.x=w(r,x),x.X=w(n,x),x.c=w(t,x),_.x=w(r,_),_.X=w(n,_),_.c=w(t,_);function w(q,J){return function(ct){var j=[],Qt=-1,gt=0,he=q.length,pe,ot,Me;for(ct instanceof Date||(ct=new Date(+ct));++Qt<he;)q.charCodeAt(Qt)===37&&(j.push(q.slice(gt,Qt)),(ot=vz[pe=q.charAt(++Qt)])!=null?pe=q.charAt(++Qt):ot=pe==="e"?" ":"0",(Me=J[pe])&&(pe=Me(ct,ot)),j.push(pe),gt=Qt+1);return j.push(q.slice(gt,Qt)),j.join("")}}function I(q,J){return function(ct){var j=G0(1900,void 0,1),Qt=D(j,q,ct+="",0),gt,he;if(Qt!=ct.length)return null;if("Q"in j)return new Date(j.Q);if("s"in j)return new Date(j.s*1e3+("L"in j?j.L:0));if(J&&!("Z"in j)&&(j.Z=0),"p"in j&&(j.H=j.H%12+j.p*12),j.m===void 0&&(j.m="q"in j?j.q:0),"V"in j){if(j.V<1||j.V>53)return null;"w"in j||(j.w=1),"Z"in j?(gt=FO(G0(j.y,0,1)),he=gt.getUTCDay(),gt=he>4||he===0?du.ceil(gt):du(gt),gt=Jf.offset(gt,(j.V-1)*7),j.y=gt.getUTCFullYear(),j.m=gt.getUTCMonth(),j.d=gt.getUTCDate()+(j.w+6)%7):(gt=NO(G0(j.y,0,1)),he=gt.getDay(),gt=he>4||he===0?fu.ceil(gt):fu(gt),gt=So.offset(gt,(j.V-1)*7),j.y=gt.getFullYear(),j.m=gt.getMonth(),j.d=gt.getDate()+(j.w+6)%7)}else("W"in j||"U"in j)&&("w"in j||(j.w="u"in j?j.u%7:"W"in j?1:0),he="Z"in j?FO(G0(j.y,0,1)).getUTCDay():NO(G0(j.y,0,1)).getDay(),j.m=0,j.d="W"in j?(j.w+6)%7+j.W*7-(he+5)%7:j.w+j.U*7-(he+6)%7);return"Z"in j?(j.H+=j.Z/100|0,j.M+=j.Z%100,FO(j)):NO(j)}}function D(q,J,ct,j){for(var Qt=0,gt=J.length,he=ct.length,pe,ot;Qt<gt;){if(j>=he)return-1;if(pe=J.charCodeAt(Qt++),pe===37){if(pe=J.charAt(Qt++),ot=v[pe in vz?J.charAt(Qt++):pe],!ot||(j=ot(q,ct,j))<0)return-1}else if(pe!=ct.charCodeAt(j++))return-1}return j}function A(q,J,ct){var j=l.exec(J.slice(ct));return j?(q.p=u.get(j[0].toLowerCase()),ct+j[0].length):-1}function B(q,J,ct){var j=h.exec(J.slice(ct));return j?(q.w=p.get(j[0].toLowerCase()),ct+j[0].length):-1}function M(q,J,ct){var j=f.exec(J.slice(ct));return j?(q.w=d.get(j[0].toLowerCase()),ct+j[0].length):-1}function O(q,J,ct){var j=m.exec(J.slice(ct));return j?(q.m=b.get(j[0].toLowerCase()),ct+j[0].length):-1}function R(q,J,ct){var j=y.exec(J.slice(ct));return j?(q.m=g.get(j[0].toLowerCase()),ct+j[0].length):-1}function S(q,J,ct){return D(q,t,J,ct)}function T(q,J,ct){return D(q,r,J,ct)}function E(q,J,ct){return D(q,n,J,ct)}function C(q){return s[q.getDay()]}function U(q){return o[q.getDay()]}function k(q){return c[q.getMonth()]}function $(q){return a[q.getMonth()]}function z(q){return i[+(q.getHours()>=12)]}function V(q){return 1+~~(q.getMonth()/3)}function Q(q){return s[q.getUTCDay()]}function nt(q){return o[q.getUTCDay()]}function st(q){return c[q.getUTCMonth()]}function ut(q){return a[q.getUTCMonth()]}function X(q){return i[+(q.getUTCHours()>=12)]}function at(q){return 1+~~(q.getUTCMonth()/3)}return{format:function(q){var J=w(q+="",x);return J.toString=function(){return q},J},parse:function(q){var J=I(q+="",!1);return J.toString=function(){return q},J},utcFormat:function(q){var J=w(q+="",_);return J.toString=function(){return q},J},utcParse:function(q){var J=I(q+="",!0);return J.toString=function(){return q},J}}}var vz={"-":"",_:" ",0:"0"},Zr=/^\s*\d+/,Not=/^%/,Fot=/[\\^$*+?|[\]().{}]/g;function we(e,t,r){var n=e<0?"-":"",i=(n?-e:e)+"",o=i.length;return n+(o<r?new Array(r-o+1).join(t)+i:i)}function Lot(e){return e.replace(Fot,"\\$&")}function X0(e){return new RegExp("^(?:"+e.map(Lot).join("|")+")","i")}function H0(e){return new Map(e.map((t,r)=>[t.toLowerCase(),r]))}function Rot(e,t,r){var n=Zr.exec(t.slice(r,r+1));return n?(e.w=+n[0],r+n[0].length):-1}function kot(e,t,r){var n=Zr.exec(t.slice(r,r+1));return n?(e.u=+n[0],r+n[0].length):-1}function Cot(e,t,r){var n=Zr.exec(t.slice(r,r+2));return n?(e.U=+n[0],r+n[0].length):-1}function Uot(e,t,r){var n=Zr.exec(t.slice(r,r+2));return n?(e.V=+n[0],r+n[0].length):-1}function Pot(e,t,r){var n=Zr.exec(t.slice(r,r+2));return n?(e.W=+n[0],r+n[0].length):-1}function Sz(e,t,r){var n=Zr.exec(t.slice(r,r+4));return n?(e.y=+n[0],r+n[0].length):-1}function Iz(e,t,r){var n=Zr.exec(t.slice(r,r+2));return n?(e.y=+n[0]+(+n[0]>68?1900:2e3),r+n[0].length):-1}function $ot(e,t,r){var n=/^(Z)|([+-]\d\d)(?::?(\d\d))?/.exec(t.slice(r,r+6));return n?(e.Z=n[1]?0:-(n[2]+(n[3]||"00")),r+n[0].length):-1}function zot(e,t,r){var n=Zr.exec(t.slice(r,r+1));return n?(e.q=n[0]*3-3,r+n[0].length):-1}function Vot(e,t,r){var n=Zr.exec(t.slice(r,r+2));return n?(e.m=n[0]-1,r+n[0].length):-1}function Tz(e,t,r){var n=Zr.exec(t.slice(r,r+2));return n?(e.d=+n[0],r+n[0].length):-1}function jot(e,t,r){var n=Zr.exec(t.slice(r,r+3));return n?(e.m=0,e.d=+n[0],r+n[0].length):-1}function Az(e,t,r){var n=Zr.exec(t.slice(r,r+2));return n?(e.H=+n[0],r+n[0].length):-1}function qot(e,t,r){var n=Zr.exec(t.slice(r,r+2));return n?(e.M=+n[0],r+n[0].length):-1}function Yot(e,t,r){var n=Zr.exec(t.slice(r,r+2));return n?(e.S=+n[0],r+n[0].length):-1}function Wot(e,t,r){var n=Zr.exec(t.slice(r,r+3));return n?(e.L=+n[0],r+n[0].length):-1}function Got(e,t,r){var n=Zr.exec(t.slice(r,r+6));return n?(e.L=Math.floor(n[0]/1e3),r+n[0].length):-1}function Xot(e,t,r){var n=Not.exec(t.slice(r,r+1));return n?r+n[0].length:-1}function Hot(e,t,r){var n=Zr.exec(t.slice(r));return n?(e.Q=+n[0],r+n[0].length):-1}function Zot(e,t,r){var n=Zr.exec(t.slice(r));return n?(e.s=+n[0],r+n[0].length):-1}function Mz(e,t){return we(e.getDate(),t,2)}function Kot(e,t){return we(e.getHours(),t,2)}function Qot(e,t){return we(e.getHours()%12||12,t,2)}function Jot(e,t){return we(1+So.count(Fn(e),e),t,3)}function Nz(e,t){return we(e.getMilliseconds(),t,3)}function tst(e,t){return Nz(e,t)+"000"}function est(e,t){return we(e.getMonth()+1,t,2)}function rst(e,t){return we(e.getMinutes(),t,2)}function nst(e,t){return we(e.getSeconds(),t,2)}function ist(e){var t=e.getDay();return t===0?7:t}function ost(e,t){return we(Yi.count(Fn(e)-1,e),t,2)}function Fz(e){var t=e.getDay();return t>=4||t===0?fa(e):fa.ceil(e)}function sst(e,t){return e=Fz(e),we(fa.count(Fn(e),e)+(Fn(e).getDay()===4),t,2)}function ast(e){return e.getDay()}function cst(e,t){return we(fu.count(Fn(e)-1,e),t,2)}function lst(e,t){return we(e.getFullYear()%100,t,2)}function ust(e,t){return e=Fz(e),we(e.getFullYear()%100,t,2)}function fst(e,t){return we(e.getFullYear()%1e4,t,4)}function dst(e,t){var r=e.getDay();return e=r>=4||r===0?fa(e):fa.ceil(e),we(e.getFullYear()%1e4,t,4)}function hst(e){var t=e.getTimezoneOffset();return(t>0?"-":(t*=-1,"+"))+we(t/60|0,"0",2)+we(t%60,"0",2)}function Ez(e,t){return we(e.getUTCDate(),t,2)}function pst(e,t){return we(e.getUTCHours(),t,2)}function mst(e,t){return we(e.getUTCHours()%12||12,t,2)}function yst(e,t){return we(1+Jf.count(Ln(e),e),t,3)}function Lz(e,t){return we(e.getUTCMilliseconds(),t,3)}function gst(e,t){return Lz(e,t)+"000"}function bst(e,t){return we(e.getUTCMonth()+1,t,2)}function xst(e,t){return we(e.getUTCMinutes(),t,2)}function _st(e,t){return we(e.getUTCSeconds(),t,2)}function wst(e){var t=e.getUTCDay();return t===0?7:t}function vst(e,t){return we(Wi.count(Ln(e)-1,e),t,2)}function Rz(e){var t=e.getUTCDay();return t>=4||t===0?da(e):da.ceil(e)}function Sst(e,t){return e=Rz(e),we(da.count(Ln(e),e)+(Ln(e).getUTCDay()===4),t,2)}function Ist(e){return e.getUTCDay()}function Tst(e,t){return we(du.count(Ln(e)-1,e),t,2)}function Ast(e,t){return we(e.getUTCFullYear()%100,t,2)}function Mst(e,t){return e=Rz(e),we(e.getUTCFullYear()%100,t,2)}function Est(e,t){return we(e.getUTCFullYear()%1e4,t,4)}function Dst(e,t){var r=e.getUTCDay();return e=r>=4||r===0?da(e):da.ceil(e),we(e.getUTCFullYear()%1e4,t,4)}function Bst(){return"+0000"}function Dz(){return"%"}function Bz(e){return+e}function Oz(e){return Math.floor(+e/1e3)}var sp,ap,kz,ha,Cz;RO({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 RO(e){return sp=LO(e),ap=sp.format,kz=sp.parse,ha=sp.utcFormat,Cz=sp.utcParse,sp}function Ost(e){return new Date(e)}function Nst(e){return e instanceof Date?+e:+new Date(+e)}function $S(e,t,r,n,i,o,s,a,c,l){var u=k0(),f=u.invert,d=u.domain,h=l(".%L"),p=l(":%S"),y=l("%I:%M"),g=l("%I %p"),m=l("%a %d"),b=l("%b %d"),x=l("%B"),_=l("%Y");function v(w){return(c(w)<w?h:a(w)<w?p:s(w)<w?y:o(w)<w?g:n(w)<w?i(w)<w?m:b:r(w)<w?x:_)(w)}return u.invert=function(w){return new Date(f(w))},u.domain=function(w){return arguments.length?d(Array.from(w,Nst)):d().map(Ost)},u.ticks=function(w){var I=d();return e(I[0],I[I.length-1],w??10)},u.tickFormat=function(w,I){return I==null?v:l(I)},u.nice=function(w){var I=d();return(!w||typeof w.range!="function")&&(w=t(I[0],I[I.length-1],w??10)),w?d(U0(I,w)):u},u.copy=function(){return la(u,$S(e,t,r,n,i,o,s,a,c,l))},u}function zS(){return Rr.apply($S(BO,OO,Fn,Hc,Yi,So,Gc,Yc,Hr,ap).domain([new Date(2e3,0,1),new Date(2e3,0,2)]),arguments)}function VS(){return Rr.apply($S(DO,W0,Ln,Zc,Wi,Jf,Xc,Wc,Hr,ha).domain([Date.UTC(2e3,0,1),Date.UTC(2e3,0,2)]),arguments)}function Z0(e,t){return t.domain(e.domain()).interpolator(e.interpolator()).clamp(e.clamp()).unknown(e.unknown())}function jS(){var e=0,t=.5,r=1,n=1,i,o,s,a,c,l=Si,u,f=!1,d;function h(y){return isNaN(y=+y)?d:(y=.5+((y=+u(y))-o)*(n*y<n*o?a:c),l(f?Math.max(0,Math.min(1,y)):y))}h.domain=function(y){return arguments.length?([e,t,r]=y,i=u(e=+e),o=u(t=+t),s=u(r=+r),a=i===o?0:.5/(o-i),c=o===s?0:.5/(s-o),n=o<i?-1:1,h):[e,t,r]},h.clamp=function(y){return arguments.length?(f=!!y,h):f},h.interpolator=function(y){return arguments.length?(l=y,h):l};function p(y){return function(g){var m,b,x;return arguments.length?([m,b,x]=g,l=Js(y,[m,b,x]),h):[l(0),l(.5),l(1)]}}return h.range=p(ji),h.rangeRound=p(Uf),h.unknown=function(y){return arguments.length?(d=y,h):d},function(y){return u=y,i=y(e),o=y(t),s=y(r),a=i===o?0:.5/(o-i),c=o===s?0:.5/(s-o),n=o<i?-1:1,h}}function K0(){var e=jc(jS()(Si));return e.copy=function(){return Z0(e,K0())},L0.apply(e,arguments)}function qS(){var e=IO(jS()).domain([.1,1,10]);return e.copy=function(){return Z0(e,qS()).base(e.base())},L0.apply(e,arguments)}function YS(){var e=TO(jS());return e.copy=function(){return Z0(e,YS()).constant(e.constant())},L0.apply(e,arguments)}function WS(){var e=AO(jS());return e.copy=function(){return Z0(e,WS()).exponent(e.exponent())},L0.apply(e,arguments)}function Z(e){for(var t=e.length/6|0,r=new Array(t),n=0;n<t;)r[n]="#"+e.slice(n*6,++n*6);return r}var kO=Z("1f77b4ff7f0e2ca02cd627289467bd8c564be377c27f7f7fbcbd2217becf");var CO=Z("7fc97fbeaed4fdc086ffff99386cb0f0027fbf5b17666666");var UO=Z("1b9e77d95f027570b3e7298a66a61ee6ab02a6761d666666");var PO=Z("a6cee31f78b4b2df8a33a02cfb9a99e31a1cfdbf6fff7f00cab2d66a3d9affff99b15928");var $O=Z("fbb4aeb3cde3ccebc5decbe4fed9a6ffffcce5d8bdfddaecf2f2f2");var zO=Z("b3e2cdfdcdaccbd5e8f4cae4e6f5c9fff2aef1e2cccccccc");var VO=Z("e41a1c377eb84daf4a984ea3ff7f00ffff33a65628f781bf999999");var jO=Z("66c2a5fc8d628da0cbe78ac3a6d854ffd92fe5c494b3b3b3");var qO=Z("8dd3c7ffffb3bebadafb807280b1d3fdb462b3de69fccde5d9d9d9bc80bdccebc5ffed6f");var YO=Z("4e79a7f28e2ce1575976b7b259a14fedc949af7aa1ff9da79c755fbab0ab");var bt=e=>zD(e[e.length-1]);var GS=new Array(3).concat("d8b365f5f5f55ab4ac","a6611adfc27d80cdc1018571","a6611adfc27df5f5f580cdc1018571","8c510ad8b365f6e8c3c7eae55ab4ac01665e","8c510ad8b365f6e8c3f5f5f5c7eae55ab4ac01665e","8c510abf812ddfc27df6e8c3c7eae580cdc135978f01665e","8c510abf812ddfc27df6e8c3f5f5f5c7eae580cdc135978f01665e","5430058c510abf812ddfc27df6e8c3c7eae580cdc135978f01665e003c30","5430058c510abf812ddfc27df6e8c3f5f5f5c7eae580cdc135978f01665e003c30").map(Z),XS=bt(GS);var HS=new Array(3).concat("af8dc3f7f7f77fbf7b","7b3294c2a5cfa6dba0008837","7b3294c2a5cff7f7f7a6dba0008837","762a83af8dc3e7d4e8d9f0d37fbf7b1b7837","762a83af8dc3e7d4e8f7f7f7d9f0d37fbf7b1b7837","762a839970abc2a5cfe7d4e8d9f0d3a6dba05aae611b7837","762a839970abc2a5cfe7d4e8f7f7f7d9f0d3a6dba05aae611b7837","40004b762a839970abc2a5cfe7d4e8d9f0d3a6dba05aae611b783700441b","40004b762a839970abc2a5cfe7d4e8f7f7f7d9f0d3a6dba05aae611b783700441b").map(Z),ZS=bt(HS);var KS=new Array(3).concat("e9a3c9f7f7f7a1d76a","d01c8bf1b6dab8e1864dac26","d01c8bf1b6daf7f7f7b8e1864dac26","c51b7de9a3c9fde0efe6f5d0a1d76a4d9221","c51b7de9a3c9fde0eff7f7f7e6f5d0a1d76a4d9221","c51b7dde77aef1b6dafde0efe6f5d0b8e1867fbc414d9221","c51b7dde77aef1b6dafde0eff7f7f7e6f5d0b8e1867fbc414d9221","8e0152c51b7dde77aef1b6dafde0efe6f5d0b8e1867fbc414d9221276419","8e0152c51b7dde77aef1b6dafde0eff7f7f7e6f5d0b8e1867fbc414d9221276419").map(Z),QS=bt(KS);var JS=new Array(3).concat("998ec3f7f7f7f1a340","5e3c99b2abd2fdb863e66101","5e3c99b2abd2f7f7f7fdb863e66101","542788998ec3d8daebfee0b6f1a340b35806","542788998ec3d8daebf7f7f7fee0b6f1a340b35806","5427888073acb2abd2d8daebfee0b6fdb863e08214b35806","5427888073acb2abd2d8daebf7f7f7fee0b6fdb863e08214b35806","2d004b5427888073acb2abd2d8daebfee0b6fdb863e08214b358067f3b08","2d004b5427888073acb2abd2d8daebf7f7f7fee0b6fdb863e08214b358067f3b08").map(Z),t2=bt(JS);var Q0=new Array(3).concat("ef8a62f7f7f767a9cf","ca0020f4a58292c5de0571b0","ca0020f4a582f7f7f792c5de0571b0","b2182bef8a62fddbc7d1e5f067a9cf2166ac","b2182bef8a62fddbc7f7f7f7d1e5f067a9cf2166ac","b2182bd6604df4a582fddbc7d1e5f092c5de4393c32166ac","b2182bd6604df4a582fddbc7f7f7f7d1e5f092c5de4393c32166ac","67001fb2182bd6604df4a582fddbc7d1e5f092c5de4393c32166ac053061","67001fb2182bd6604df4a582fddbc7f7f7f7d1e5f092c5de4393c32166ac053061").map(Z),cp=bt(Q0);var e2=new Array(3).concat("ef8a62ffffff999999","ca0020f4a582bababa404040","ca0020f4a582ffffffbababa404040","b2182bef8a62fddbc7e0e0e09999994d4d4d","b2182bef8a62fddbc7ffffffe0e0e09999994d4d4d","b2182bd6604df4a582fddbc7e0e0e0bababa8787874d4d4d","b2182bd6604df4a582fddbc7ffffffe0e0e0bababa8787874d4d4d","67001fb2182bd6604df4a582fddbc7e0e0e0bababa8787874d4d4d1a1a1a","67001fb2182bd6604df4a582fddbc7ffffffe0e0e0bababa8787874d4d4d1a1a1a").map(Z),r2=bt(e2);var J0=new Array(3).concat("fc8d59ffffbf91bfdb","d7191cfdae61abd9e92c7bb6","d7191cfdae61ffffbfabd9e92c7bb6","d73027fc8d59fee090e0f3f891bfdb4575b4","d73027fc8d59fee090ffffbfe0f3f891bfdb4575b4","d73027f46d43fdae61fee090e0f3f8abd9e974add14575b4","d73027f46d43fdae61fee090ffffbfe0f3f8abd9e974add14575b4","a50026d73027f46d43fdae61fee090e0f3f8abd9e974add14575b4313695","a50026d73027f46d43fdae61fee090ffffbfe0f3f8abd9e974add14575b4313695").map(Z),lp=bt(J0);var n2=new Array(3).concat("fc8d59ffffbf91cf60","d7191cfdae61a6d96a1a9641","d7191cfdae61ffffbfa6d96a1a9641","d73027fc8d59fee08bd9ef8b91cf601a9850","d73027fc8d59fee08bffffbfd9ef8b91cf601a9850","d73027f46d43fdae61fee08bd9ef8ba6d96a66bd631a9850","d73027f46d43fdae61fee08bffffbfd9ef8ba6d96a66bd631a9850","a50026d73027f46d43fdae61fee08bd9ef8ba6d96a66bd631a9850006837","a50026d73027f46d43fdae61fee08bffffbfd9ef8ba6d96a66bd631a9850006837").map(Z),i2=bt(n2);var o2=new Array(3).concat("fc8d59ffffbf99d594","d7191cfdae61abdda42b83ba","d7191cfdae61ffffbfabdda42b83ba","d53e4ffc8d59fee08be6f59899d5943288bd","d53e4ffc8d59fee08bffffbfe6f59899d5943288bd","d53e4ff46d43fdae61fee08be6f598abdda466c2a53288bd","d53e4ff46d43fdae61fee08bffffbfe6f598abdda466c2a53288bd","9e0142d53e4ff46d43fdae61fee08be6f598abdda466c2a53288bd5e4fa2","9e0142d53e4ff46d43fdae61fee08bffffbfe6f598abdda466c2a53288bd5e4fa2").map(Z),s2=bt(o2);var a2=new Array(3).concat("e5f5f999d8c92ca25f","edf8fbb2e2e266c2a4238b45","edf8fbb2e2e266c2a42ca25f006d2c","edf8fbccece699d8c966c2a42ca25f006d2c","edf8fbccece699d8c966c2a441ae76238b45005824","f7fcfde5f5f9ccece699d8c966c2a441ae76238b45005824","f7fcfde5f5f9ccece699d8c966c2a441ae76238b45006d2c00441b").map(Z),c2=bt(a2);var l2=new Array(3).concat("e0ecf49ebcda8856a7","edf8fbb3cde38c96c688419d","edf8fbb3cde38c96c68856a7810f7c","edf8fbbfd3e69ebcda8c96c68856a7810f7c","edf8fbbfd3e69ebcda8c96c68c6bb188419d6e016b","f7fcfde0ecf4bfd3e69ebcda8c96c68c6bb188419d6e016b","f7fcfde0ecf4bfd3e69ebcda8c96c68c6bb188419d810f7c4d004b").map(Z),u2=bt(l2);var f2=new Array(3).concat("e0f3dba8ddb543a2ca","f0f9e8bae4bc7bccc42b8cbe","f0f9e8bae4bc7bccc443a2ca0868ac","f0f9e8ccebc5a8ddb57bccc443a2ca0868ac","f0f9e8ccebc5a8ddb57bccc44eb3d32b8cbe08589e","f7fcf0e0f3dbccebc5a8ddb57bccc44eb3d32b8cbe08589e","f7fcf0e0f3dbccebc5a8ddb57bccc44eb3d32b8cbe0868ac084081").map(Z),d2=bt(f2);var h2=new Array(3).concat("fee8c8fdbb84e34a33","fef0d9fdcc8afc8d59d7301f","fef0d9fdcc8afc8d59e34a33b30000","fef0d9fdd49efdbb84fc8d59e34a33b30000","fef0d9fdd49efdbb84fc8d59ef6548d7301f990000","fff7ecfee8c8fdd49efdbb84fc8d59ef6548d7301f990000","fff7ecfee8c8fdd49efdbb84fc8d59ef6548d7301fb300007f0000").map(Z),p2=bt(h2);var m2=new Array(3).concat("ece2f0a6bddb1c9099","f6eff7bdc9e167a9cf02818a","f6eff7bdc9e167a9cf1c9099016c59","f6eff7d0d1e6a6bddb67a9cf1c9099016c59","f6eff7d0d1e6a6bddb67a9cf3690c002818a016450","fff7fbece2f0d0d1e6a6bddb67a9cf3690c002818a016450","fff7fbece2f0d0d1e6a6bddb67a9cf3690c002818a016c59014636").map(Z),y2=bt(m2);var g2=new Array(3).concat("ece7f2a6bddb2b8cbe","f1eef6bdc9e174a9cf0570b0","f1eef6bdc9e174a9cf2b8cbe045a8d","f1eef6d0d1e6a6bddb74a9cf2b8cbe045a8d","f1eef6d0d1e6a6bddb74a9cf3690c00570b0034e7b","fff7fbece7f2d0d1e6a6bddb74a9cf3690c00570b0034e7b","fff7fbece7f2d0d1e6a6bddb74a9cf3690c00570b0045a8d023858").map(Z),b2=bt(g2);var x2=new Array(3).concat("e7e1efc994c7dd1c77","f1eef6d7b5d8df65b0ce1256","f1eef6d7b5d8df65b0dd1c77980043","f1eef6d4b9dac994c7df65b0dd1c77980043","f1eef6d4b9dac994c7df65b0e7298ace125691003f","f7f4f9e7e1efd4b9dac994c7df65b0e7298ace125691003f","f7f4f9e7e1efd4b9dac994c7df65b0e7298ace125698004367001f").map(Z),_2=bt(x2);var w2=new Array(3).concat("fde0ddfa9fb5c51b8a","feebe2fbb4b9f768a1ae017e","feebe2fbb4b9f768a1c51b8a7a0177","feebe2fcc5c0fa9fb5f768a1c51b8a7a0177","feebe2fcc5c0fa9fb5f768a1dd3497ae017e7a0177","fff7f3fde0ddfcc5c0fa9fb5f768a1dd3497ae017e7a0177","fff7f3fde0ddfcc5c0fa9fb5f768a1dd3497ae017e7a017749006a").map(Z),v2=bt(w2);var S2=new Array(3).concat("edf8b17fcdbb2c7fb8","ffffcca1dab441b6c4225ea8","ffffcca1dab441b6c42c7fb8253494","ffffccc7e9b47fcdbb41b6c42c7fb8253494","ffffccc7e9b47fcdbb41b6c41d91c0225ea80c2c84","ffffd9edf8b1c7e9b47fcdbb41b6c41d91c0225ea80c2c84","ffffd9edf8b1c7e9b47fcdbb41b6c41d91c0225ea8253494081d58").map(Z),I2=bt(S2);var T2=new Array(3).concat("f7fcb9addd8e31a354","ffffccc2e69978c679238443","ffffccc2e69978c67931a354006837","ffffccd9f0a3addd8e78c67931a354006837","ffffccd9f0a3addd8e78c67941ab5d238443005a32","ffffe5f7fcb9d9f0a3addd8e78c67941ab5d238443005a32","ffffe5f7fcb9d9f0a3addd8e78c67941ab5d238443006837004529").map(Z),A2=bt(T2);var M2=new Array(3).concat("fff7bcfec44fd95f0e","ffffd4fed98efe9929cc4c02","ffffd4fed98efe9929d95f0e993404","ffffd4fee391fec44ffe9929d95f0e993404","ffffd4fee391fec44ffe9929ec7014cc4c028c2d04","ffffe5fff7bcfee391fec44ffe9929ec7014cc4c028c2d04","ffffe5fff7bcfee391fec44ffe9929ec7014cc4c02993404662506").map(Z),E2=bt(M2);var D2=new Array(3).concat("ffeda0feb24cf03b20","ffffb2fecc5cfd8d3ce31a1c","ffffb2fecc5cfd8d3cf03b20bd0026","ffffb2fed976feb24cfd8d3cf03b20bd0026","ffffb2fed976feb24cfd8d3cfc4e2ae31a1cb10026","ffffccffeda0fed976feb24cfd8d3cfc4e2ae31a1cb10026","ffffccffeda0fed976feb24cfd8d3cfc4e2ae31a1cbd0026800026").map(Z),B2=bt(D2);var O2=new Array(3).concat("deebf79ecae13182bd","eff3ffbdd7e76baed62171b5","eff3ffbdd7e76baed63182bd08519c","eff3ffc6dbef9ecae16baed63182bd08519c","eff3ffc6dbef9ecae16baed64292c62171b5084594","f7fbffdeebf7c6dbef9ecae16baed64292c62171b5084594","f7fbffdeebf7c6dbef9ecae16baed64292c62171b508519c08306b").map(Z),N2=bt(O2);var F2=new Array(3).concat("e5f5e0a1d99b31a354","edf8e9bae4b374c476238b45","edf8e9bae4b374c47631a354006d2c","edf8e9c7e9c0a1d99b74c47631a354006d2c","edf8e9c7e9c0a1d99b74c47641ab5d238b45005a32","f7fcf5e5f5e0c7e9c0a1d99b74c47641ab5d238b45005a32","f7fcf5e5f5e0c7e9c0a1d99b74c47641ab5d238b45006d2c00441b").map(Z),L2=bt(F2);var R2=new Array(3).concat("f0f0f0bdbdbd636363","f7f7f7cccccc969696525252","f7f7f7cccccc969696636363252525","f7f7f7d9d9d9bdbdbd969696636363252525","f7f7f7d9d9d9bdbdbd969696737373525252252525","fffffff0f0f0d9d9d9bdbdbd969696737373525252252525","fffffff0f0f0d9d9d9bdbdbd969696737373525252252525000000").map(Z),k2=bt(R2);var C2=new Array(3).concat("efedf5bcbddc756bb1","f2f0f7cbc9e29e9ac86a51a3","f2f0f7cbc9e29e9ac8756bb154278f","f2f0f7dadaebbcbddc9e9ac8756bb154278f","f2f0f7dadaebbcbddc9e9ac8807dba6a51a34a1486","fcfbfdefedf5dadaebbcbddc9e9ac8807dba6a51a34a1486","fcfbfdefedf5dadaebbcbddc9e9ac8807dba6a51a354278f3f007d").map(Z),U2=bt(C2);var P2=new Array(3).concat("fee0d2fc9272de2d26","fee5d9fcae91fb6a4acb181d","fee5d9fcae91fb6a4ade2d26a50f15","fee5d9fcbba1fc9272fb6a4ade2d26a50f15","fee5d9fcbba1fc9272fb6a4aef3b2ccb181d99000d","fff5f0fee0d2fcbba1fc9272fb6a4aef3b2ccb181d99000d","fff5f0fee0d2fcbba1fc9272fb6a4aef3b2ccb181da50f1567000d").map(Z),$2=bt(P2);var z2=new Array(3).concat("fee6cefdae6be6550d","feeddefdbe85fd8d3cd94701","feeddefdbe85fd8d3ce6550da63603","feeddefdd0a2fdae6bfd8d3ce6550da63603","feeddefdd0a2fdae6bfd8d3cf16913d948018c2d04","fff5ebfee6cefdd0a2fdae6bfd8d3cf16913d948018c2d04","fff5ebfee6cefdd0a2fdae6bfd8d3cf16913d94801a636037f2704").map(Z),V2=bt(z2);function j2(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 q2=Ch(Zn(300,.5,0),Zn(-240,.5,1));var W2=Ch(Zn(-100,.75,.35),Zn(80,1.5,.8)),G2=Ch(Zn(260,.75,.35),Zn(80,1.5,.8)),Y2=Zn();function X2(e){(e<0||e>1)&&(e-=Math.floor(e));var t=Math.abs(e-.5);return Y2.h=360*e-100,Y2.s=1.5-1.5*t,Y2.l=.8-.9*t,Y2+""}var H2=qr(),Fst=Math.PI/3,Lst=Math.PI*2/3;function Z2(e){var t;return e=(.5-e)*Math.PI,H2.r=255*(t=Math.sin(e))*t,H2.g=255*(t=Math.sin(e+Fst))*t,H2.b=255*(t=Math.sin(e+Lst))*t,H2+""}function K2(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 Q2(e){var t=e.length;return function(r){return e[Math.max(0,Math.min(t-1,Math.floor(r*t)))]}}var J2=Q2(Z("44015444025645045745055946075a46085c460a5d460b5e470d60470e6147106347116447136548146748166848176948186a481a6c481b6d481c6e481d6f481f70482071482173482374482475482576482677482878482979472a7a472c7a472d7b472e7c472f7d46307e46327e46337f463480453581453781453882443983443a83443b84433d84433e85423f854240864241864142874144874045884046883f47883f48893e49893e4a893e4c8a3d4d8a3d4e8a3c4f8a3c508b3b518b3b528b3a538b3a548c39558c39568c38588c38598c375a8c375b8d365c8d365d8d355e8d355f8d34608d34618d33628d33638d32648e32658e31668e31678e31688e30698e306a8e2f6b8e2f6c8e2e6d8e2e6e8e2e6f8e2d708e2d718e2c718e2c728e2c738e2b748e2b758e2a768e2a778e2a788e29798e297a8e297b8e287c8e287d8e277e8e277f8e27808e26818e26828e26828e25838e25848e25858e24868e24878e23888e23898e238a8d228b8d228c8d228d8d218e8d218f8d21908d21918c20928c20928c20938c1f948c1f958b1f968b1f978b1f988b1f998a1f9a8a1e9b8a1e9c891e9d891f9e891f9f881fa0881fa1881fa1871fa28720a38620a48621a58521a68522a78522a88423a98324aa8325ab8225ac8226ad8127ad8128ae8029af7f2ab07f2cb17e2db27d2eb37c2fb47c31b57b32b67a34b67935b77937b87838b9773aba763bbb753dbc743fbc7340bd7242be7144bf7046c06f48c16e4ac16d4cc26c4ec36b50c46a52c56954c56856c66758c7655ac8645cc8635ec96260ca6063cb5f65cb5e67cc5c69cd5b6ccd5a6ece5870cf5773d05675d05477d1537ad1517cd2507fd34e81d34d84d44b86d54989d5488bd6468ed64590d74393d74195d84098d83e9bd93c9dd93ba0da39a2da37a5db36a8db34aadc32addc30b0dd2fb2dd2db5de2bb8de29bade28bddf26c0df25c2df23c5e021c8e020cae11fcde11dd0e11cd2e21bd5e21ad8e219dae319dde318dfe318e2e418e5e419e7e419eae51aece51befe51cf1e51df4e61ef6e620f8e621fbe723fde725")),tI=Q2(Z("00000401000501010601010802010902020b02020d03030f03031204041405041606051806051a07061c08071e0907200a08220b09240c09260d0a290e0b2b100b2d110c2f120d31130d34140e36150e38160f3b180f3d19103f1a10421c10441d11471e114920114b21114e22115024125325125527125829115a2a115c2c115f2d11612f116331116533106734106936106b38106c390f6e3b0f703d0f713f0f72400f74420f75440f764510774710784910784a10794c117a4e117b4f127b51127c52137c54137d56147d57157e59157e5a167e5c167f5d177f5f187f601880621980641a80651a80671b80681c816a1c816b1d816d1d816e1e81701f81721f817320817521817621817822817922827b23827c23827e24828025828125818326818426818627818827818928818b29818c29818e2a81902a81912b81932b80942c80962c80982d80992d809b2e7f9c2e7f9e2f7fa02f7fa1307ea3307ea5317ea6317da8327daa337dab337cad347cae347bb0357bb2357bb3367ab5367ab73779b83779ba3878bc3978bd3977bf3a77c03a76c23b75c43c75c53c74c73d73c83e73ca3e72cc3f71cd4071cf4070d0416fd2426fd3436ed5446dd6456cd8456cd9466bdb476adc4869de4968df4a68e04c67e24d66e34e65e44f64e55064e75263e85362e95462ea5661eb5760ec5860ed5a5fee5b5eef5d5ef05f5ef1605df2625df2645cf3655cf4675cf4695cf56b5cf66c5cf66e5cf7705cf7725cf8745cf8765cf9785df9795df97b5dfa7d5efa7f5efa815ffb835ffb8560fb8761fc8961fc8a62fc8c63fc8e64fc9065fd9266fd9467fd9668fd9869fd9a6afd9b6bfe9d6cfe9f6dfea16efea36ffea571fea772fea973feaa74feac76feae77feb078feb27afeb47bfeb67cfeb77efeb97ffebb81febd82febf84fec185fec287fec488fec68afec88cfeca8dfecc8ffecd90fecf92fed194fed395fed597fed799fed89afdda9cfddc9efddea0fde0a1fde2a3fde3a5fde5a7fde7a9fde9aafdebacfcecaefceeb0fcf0b2fcf2b4fcf4b6fcf6b8fcf7b9fcf9bbfcfbbdfcfdbf")),eI=Q2(Z("00000401000501010601010802010a02020c02020e03021004031204031405041706041907051b08051d09061f0a07220b07240c08260d08290e092b10092d110a30120a32140b34150b37160b39180c3c190c3e1b0c411c0c431e0c451f0c48210c4a230c4c240c4f260c51280b53290b552b0b572d0b592f0a5b310a5c320a5e340a5f3609613809623909633b09643d09653e0966400a67420a68440a68450a69470b6a490b6a4a0c6b4c0c6b4d0d6c4f0d6c510e6c520e6d540f6d550f6d57106e59106e5a116e5c126e5d126e5f136e61136e62146e64156e65156e67166e69166e6a176e6c186e6d186e6f196e71196e721a6e741a6e751b6e771c6d781c6d7a1d6d7c1d6d7d1e6d7f1e6c801f6c82206c84206b85216b87216b88226a8a226a8c23698d23698f24699025689225689326679526679727669827669a28659b29649d29649f2a63a02a63a22b62a32c61a52c60a62d60a82e5fa92e5eab2f5ead305dae305cb0315bb1325ab3325ab43359b63458b73557b93556ba3655bc3754bd3853bf3952c03a51c13a50c33b4fc43c4ec63d4dc73e4cc83f4bca404acb4149cc4248ce4347cf4446d04545d24644d34743d44842d54a41d74b3fd84c3ed94d3dda4e3cdb503bdd513ade5238df5337e05536e15635e25734e35933e45a31e55c30e65d2fe75e2ee8602de9612bea632aeb6429eb6628ec6726ed6925ee6a24ef6c23ef6e21f06f20f1711ff1731df2741cf3761bf37819f47918f57b17f57d15f67e14f68013f78212f78410f8850ff8870ef8890cf98b0bf98c0af98e09fa9008fa9207fa9407fb9606fb9706fb9906fb9b06fb9d07fc9f07fca108fca309fca50afca60cfca80dfcaa0ffcac11fcae12fcb014fcb216fcb418fbb61afbb81dfbba1ffbbc21fbbe23fac026fac228fac42afac62df9c72ff9c932f9cb35f8cd37f8cf3af7d13df7d340f6d543f6d746f5d949f5db4cf4dd4ff4df53f4e156f3e35af3e55df2e661f2e865f2ea69f1ec6df1ed71f1ef75f1f179f2f27df2f482f3f586f3f68af4f88ef5f992f6fa96f8fb9af9fc9dfafda1fcffa4")),rI=Q2(Z("0d088710078813078916078a19068c1b068d1d068e20068f2206902406912605912805922a05932c05942e05952f059631059733059735049837049938049a3a049a3c049b3e049c3f049c41049d43039e44039e46039f48039f4903a04b03a14c02a14e02a25002a25102a35302a35502a45601a45801a45901a55b01a55c01a65e01a66001a66100a76300a76400a76600a76700a86900a86a00a86c00a86e00a86f00a87100a87201a87401a87501a87701a87801a87a02a87b02a87d03a87e03a88004a88104a78305a78405a78606a68707a68808a68a09a58b0aa58d0ba58e0ca48f0da4910ea3920fa39410a29511a19613a19814a099159f9a169f9c179e9d189d9e199da01a9ca11b9ba21d9aa31e9aa51f99a62098a72197a82296aa2395ab2494ac2694ad2793ae2892b02991b12a90b22b8fb32c8eb42e8db52f8cb6308bb7318ab83289ba3388bb3488bc3587bd3786be3885bf3984c03a83c13b82c23c81c33d80c43e7fc5407ec6417dc7427cc8437bc9447aca457acb4679cc4778cc4977cd4a76ce4b75cf4c74d04d73d14e72d24f71d35171d45270d5536fd5546ed6556dd7566cd8576bd9586ada5a6ada5b69db5c68dc5d67dd5e66de5f65de6164df6263e06363e16462e26561e26660e3685fe4695ee56a5de56b5de66c5ce76e5be76f5ae87059e97158e97257ea7457eb7556eb7655ec7754ed7953ed7a52ee7b51ef7c51ef7e50f07f4ff0804ef1814df1834cf2844bf3854bf3874af48849f48948f58b47f58c46f68d45f68f44f79044f79143f79342f89441f89540f9973ff9983ef99a3efa9b3dfa9c3cfa9e3bfb9f3afba139fba238fca338fca537fca636fca835fca934fdab33fdac33fdae32fdaf31fdb130fdb22ffdb42ffdb52efeb72dfeb82cfeba2cfebb2bfebd2afebe2afec029fdc229fdc328fdc527fdc627fdc827fdca26fdcb26fccd25fcce25fcd025fcd225fbd324fbd524fbd724fad824fada24f9dc24f9dd25f8df25f8e125f7e225f7e425f6e626f6e826f5e926f5eb27f4ed27f3ee27f3f027f2f227f1f426f1f525f0f724f0f921"));function kr(e){return function(){return e}}var WO=Math.cos;var up=Math.min,tb=Math.sin,ve=Math.sqrt,GO=1e-12,nd=Math.PI,_Yt=nd/2,fp=2*nd;function nI(e){let t=3;return e.digits=function(r){if(!arguments.length)return t;if(r==null)t=null;else{let n=Math.floor(r);if(!(n>=0))throw new RangeError(`invalid digits: ${r}`);t=n}return e},()=>new iu(t)}var IYt=Array.prototype.slice;function iI(e){return typeof e=="object"&&"length"in e?e:Array.from(e)}function Uz(e){this._context=e}Uz.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 Kc(e){return new Uz(e)}function oI(e){return e[0]}function sI(e){return e[1]}function eb(e,t){var r=kr(!0),n=null,i=Kc,o=null,s=nI(a);e=typeof e=="function"?e:e===void 0?oI:kr(e),t=typeof t=="function"?t:t===void 0?sI:kr(t);function a(c){var l,u=(c=iI(c)).length,f,d=!1,h;for(n==null&&(o=i(h=s())),l=0;l<=u;++l)!(l<u&&r(f=c[l],l,c))===d&&((d=!d)?o.lineStart():o.lineEnd()),d&&o.point(+e(f,l,c),+t(f,l,c));if(h)return o=null,h+""||null}return a.x=function(c){return arguments.length?(e=typeof c=="function"?c:kr(+c),a):e},a.y=function(c){return arguments.length?(t=typeof c=="function"?c:kr(+c),a):t},a.defined=function(c){return arguments.length?(r=typeof c=="function"?c:kr(!!c),a):r},a.curve=function(c){return arguments.length?(i=c,n!=null&&(o=i(n)),a):i},a.context=function(c){return arguments.length?(c==null?n=o=null:o=i(n=c),a):n},a}function dp(e,t,r){var n=null,i=kr(!0),o=null,s=Kc,a=null,c=nI(l);e=typeof e=="function"?e:e===void 0?oI:kr(+e),t=typeof t=="function"?t:t===void 0?kr(0):kr(+t),r=typeof r=="function"?r:r===void 0?sI:kr(+r);function l(f){var d,h,p,y=(f=iI(f)).length,g,m=!1,b,x=new Array(y),_=new Array(y);for(o==null&&(a=s(b=c())),d=0;d<=y;++d){if(!(d<y&&i(g=f[d],d,f))===m)if(m=!m)h=d,a.areaStart(),a.lineStart();else{for(a.lineEnd(),a.lineStart(),p=d-1;p>=h;--p)a.point(x[p],_[p]);a.lineEnd(),a.areaEnd()}m&&(x[d]=+e(g,d,f),_[d]=+t(g,d,f),a.point(n?+n(g,d,f):x[d],r?+r(g,d,f):_[d]))}if(b)return a=null,b+""||null}function u(){return eb().defined(i).curve(s).context(o)}return l.x=function(f){return arguments.length?(e=typeof f=="function"?f:kr(+f),n=null,l):e},l.x0=function(f){return arguments.length?(e=typeof f=="function"?f:kr(+f),l):e},l.x1=function(f){return arguments.length?(n=f==null?null:typeof f=="function"?f:kr(+f),l):n},l.y=function(f){return arguments.length?(t=typeof f=="function"?f:kr(+f),r=null,l):t},l.y0=function(f){return arguments.length?(t=typeof f=="function"?f:kr(+f),l):t},l.y1=function(f){return arguments.length?(r=f==null?null:typeof f=="function"?f:kr(+f),l):r},l.lineX0=l.lineY0=function(){return u().x(e).y(t)},l.lineY1=function(){return u().x(e).y(r)},l.lineX1=function(){return u().x(n).y(t)},l.defined=function(f){return arguments.length?(i=typeof f=="function"?f:kr(!!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 aI=class{constructor(t,r){this._context=t,this._x=r}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,r){switch(t=+t,r=+r,this._point){case 0:{this._point=1,this._line?this._context.lineTo(t,r):this._context.moveTo(t,r);break}case 1:this._point=2;default:{this._x?this._context.bezierCurveTo(this._x0=(this._x0+t)/2,this._y0,this._x0,r,t,r):this._context.bezierCurveTo(this._x0,this._y0=(this._y0+r)/2,t,this._y0,t,r);break}}this._x0=t,this._y0=r}};function XO(e){return new aI(e,!0)}function HO(e){return new aI(e,!1)}var Rst=ve(3),rb={draw(e,t){let r=ve(t+up(t/28,.75))*.59436,n=r/2,i=n*Rst;e.moveTo(0,r),e.lineTo(0,-r),e.moveTo(-i,-n),e.lineTo(i,n),e.moveTo(-i,n),e.lineTo(i,-n)}};var Qc={draw(e,t){let r=ve(t/nd);e.moveTo(r,0),e.arc(0,0,r,0,fp)}};var nb={draw(e,t){let r=ve(t/5)/2;e.moveTo(-3*r,-r),e.lineTo(-r,-r),e.lineTo(-r,-3*r),e.lineTo(r,-3*r),e.lineTo(r,-r),e.lineTo(3*r,-r),e.lineTo(3*r,r),e.lineTo(r,r),e.lineTo(r,3*r),e.lineTo(-r,3*r),e.lineTo(-r,r),e.lineTo(-3*r,r),e.closePath()}};var Pz=ve(1/3),kst=Pz*2,ib={draw(e,t){let r=ve(t/kst),n=r*Pz;e.moveTo(0,-r),e.lineTo(n,0),e.lineTo(0,r),e.lineTo(-n,0),e.closePath()}};var ob={draw(e,t){let r=ve(t)*.62625;e.moveTo(0,-r),e.lineTo(r,0),e.lineTo(0,r),e.lineTo(-r,0),e.closePath()}};var sb={draw(e,t){let r=ve(t-up(t/7,2))*.87559;e.moveTo(-r,0),e.lineTo(r,0),e.moveTo(0,r),e.lineTo(0,-r)}};var ab={draw(e,t){let r=ve(t),n=-r/2;e.rect(n,n,r,r)}};var cb={draw(e,t){let r=ve(t)*.4431;e.moveTo(r,r),e.lineTo(r,-r),e.lineTo(-r,-r),e.lineTo(-r,r),e.closePath()}};var Cst=.8908130915292852,$z=tb(nd/10)/tb(7*nd/10),Ust=tb(fp/10)*$z,Pst=-WO(fp/10)*$z,lb={draw(e,t){let r=ve(t*Cst),n=Ust*r,i=Pst*r;e.moveTo(0,-r),e.lineTo(n,i);for(let o=1;o<5;++o){let s=fp*o/5,a=WO(s),c=tb(s);e.lineTo(c*r,-a*r),e.lineTo(a*n-c*i,c*n+a*i)}e.closePath()}};var ZO=ve(3),ub={draw(e,t){let r=-ve(t/(ZO*3));e.moveTo(0,r*2),e.lineTo(-ZO*r,-r),e.lineTo(ZO*r,-r),e.closePath()}};var $st=ve(3),fb={draw(e,t){let r=ve(t)*.6824,n=r/2,i=r*$st/2;e.moveTo(0,-r),e.lineTo(i,n),e.lineTo(-i,n),e.closePath()}};var Io=-.5,To=ve(3)/2,KO=1/ve(12),zst=(KO/2+1)*3,db={draw(e,t){let r=ve(t/zst),n=r/2,i=r*KO,o=n,s=r*KO+r,a=-o,c=s;e.moveTo(n,i),e.lineTo(o,s),e.lineTo(a,c),e.lineTo(Io*n-To*i,To*n+Io*i),e.lineTo(Io*o-To*s,To*o+Io*s),e.lineTo(Io*a-To*c,To*a+Io*c),e.lineTo(Io*n+To*i,Io*i-To*n),e.lineTo(Io*o+To*s,Io*s-To*o),e.lineTo(Io*a+To*c,Io*c-To*a),e.closePath()}};var hp={draw(e,t){let r=ve(t-up(t/6,1.7))*.6189;e.moveTo(-r,-r),e.lineTo(r,r),e.moveTo(-r,r),e.lineTo(r,-r)}};var cI=[Qc,nb,ib,ab,lb,ub,db],QO=[Qc,sb,hp,fb,rb,cb,ob];function Ao(){}function pp(e,t,r){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+r)/6)}function hb(e){this._context=e}hb.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:pp(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:pp(this,e,t);break}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t}};function JO(e){return new hb(e)}function zz(e){this._context=e}zz.prototype={areaStart:Ao,areaEnd:Ao,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:pp(this,e,t);break}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t}};function tN(e){return new zz(e)}function Vz(e){this._context=e}Vz.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 r=(this._x0+4*this._x1+e)/6,n=(this._y0+4*this._y1+t)/6;this._line?this._context.lineTo(r,n):this._context.moveTo(r,n);break;case 3:this._point=4;default:pp(this,e,t);break}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t}};function eN(e){return new Vz(e)}function jz(e,t){this._basis=new hb(e),this._beta=t}jz.prototype={lineStart:function(){this._x=[],this._y=[],this._basis.lineStart()},lineEnd:function(){var e=this._x,t=this._y,r=e.length-1;if(r>0)for(var n=e[0],i=t[0],o=e[r]-n,s=t[r]-i,a=-1,c;++a<=r;)c=a/r,this._basis.point(this._beta*e[a]+(1-this._beta)*(n+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 rN=function e(t){function r(n){return t===1?new hb(n):new jz(n,t)}return r.beta=function(n){return e(+n)},r}(.85);function mp(e,t,r){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-r),e._x2,e._y2)}function lI(e,t){this._context=e,this._k=(1-t)/6}lI.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:mp(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:mp(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 nN=function e(t){function r(n){return new lI(n,t)}return r.tension=function(n){return e(+n)},r}(0);function uI(e,t){this._context=e,this._k=(1-t)/6}uI.prototype={areaStart:Ao,areaEnd:Ao,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:mp(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 iN=function e(t){function r(n){return new uI(n,t)}return r.tension=function(n){return e(+n)},r}(0);function fI(e,t){this._context=e,this._k=(1-t)/6}fI.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:mp(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 oN=function e(t){function r(n){return new fI(n,t)}return r.tension=function(n){return e(+n)},r}(0);function pb(e,t,r){var n=e._x1,i=e._y1,o=e._x2,s=e._y2;if(e._l01_a>GO){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);n=(n*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>GO){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-r*e._l12_2a)/u}e._context.bezierCurveTo(n,i,o,s,e._x2,e._y2)}function qz(e,t){this._context=e,this._alpha=t}qz.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 r=this._x2-e,n=this._y2-t;this._l23_a=Math.sqrt(this._l23_2a=Math.pow(r*r+n*n,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:pb(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 sN=function e(t){function r(n){return t?new qz(n,t):new lI(n,0)}return r.alpha=function(n){return e(+n)},r}(.5);function Yz(e,t){this._context=e,this._alpha=t}Yz.prototype={areaStart:Ao,areaEnd:Ao,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 r=this._x2-e,n=this._y2-t;this._l23_a=Math.sqrt(this._l23_2a=Math.pow(r*r+n*n,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:pb(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 aN=function e(t){function r(n){return t?new Yz(n,t):new uI(n,0)}return r.alpha=function(n){return e(+n)},r}(.5);function Wz(e,t){this._context=e,this._alpha=t}Wz.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 r=this._x2-e,n=this._y2-t;this._l23_a=Math.sqrt(this._l23_2a=Math.pow(r*r+n*n,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:pb(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 cN=function e(t){function r(n){return t?new Wz(n,t):new fI(n,0)}return r.alpha=function(n){return e(+n)},r}(.5);function Gz(e){this._context=e}Gz.prototype={areaStart:Ao,areaEnd:Ao,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 lN(e){return new Gz(e)}function Xz(e){return e<0?-1:1}function Hz(e,t,r){var n=e._x1-e._x0,i=t-e._x1,o=(e._y1-e._y0)/(n||i<0&&-0),s=(r-e._y1)/(i||n<0&&-0),a=(o*i+s*n)/(n+i);return(Xz(o)+Xz(s))*Math.min(Math.abs(o),Math.abs(s),.5*Math.abs(a))||0}function Zz(e,t){var r=e._x1-e._x0;return r?(3*(e._y1-e._y0)/r-t)/2:t}function uN(e,t,r){var n=e._x0,i=e._y0,o=e._x1,s=e._y1,a=(o-n)/3;e._context.bezierCurveTo(n+a,i+a*t,o-a,s-a*r,o,s)}function dI(e){this._context=e}dI.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:uN(this,this._t0,Zz(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 r=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,uN(this,Zz(this,r=Hz(this,e,t)),r);break;default:uN(this,this._t0,r=Hz(this,e,t));break}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t,this._t0=r}}};function Kz(e){this._context=new Qz(e)}(Kz.prototype=Object.create(dI.prototype)).point=function(e,t){dI.prototype.point.call(this,t,e)};function Qz(e){this._context=e}Qz.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,r,n,i,o){this._context.bezierCurveTo(t,e,n,r,o,i)}};function fN(e){return new dI(e)}function dN(e){return new Kz(e)}function tV(e){this._context=e}tV.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,r=e.length;if(r)if(this._line?this._context.lineTo(e[0],t[0]):this._context.moveTo(e[0],t[0]),r===2)this._context.lineTo(e[1],t[1]);else for(var n=Jz(e),i=Jz(t),o=0,s=1;s<r;++o,++s)this._context.bezierCurveTo(n[0][o],i[0][o],n[1][o],i[1][o],e[s],t[s]);(this._line||this._line!==0&&r===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 Jz(e){var t,r=e.length-1,n,i=new Array(r),o=new Array(r),s=new Array(r);for(i[0]=0,o[0]=2,s[0]=e[0]+2*e[1],t=1;t<r-1;++t)i[t]=1,o[t]=4,s[t]=4*e[t]+2*e[t+1];for(i[r-1]=2,o[r-1]=7,s[r-1]=8*e[r-1]+e[r],t=1;t<r;++t)n=i[t]/o[t-1],o[t]-=n,s[t]-=n*s[t-1];for(i[r-1]=s[r-1]/o[r-1],t=r-2;t>=0;--t)i[t]=(s[t]-i[t+1])/o[t];for(o[r-1]=(e[r]+i[r-1])/2,t=0;t<r-1;++t)o[t]=2*e[t+1]-i[t+1];return[i,o]}function hN(e){return new tV(e)}function hI(e,t){this._context=e,this._t=t}hI.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 r=this._x*(1-this._t)+e*this._t;this._context.lineTo(r,this._y),this._context.lineTo(r,t)}break}}this._x=e,this._y=t}};function pN(e){return new hI(e,.5)}function mN(e){return new hI(e,0)}function yN(e){return new hI(e,1)}var mb=e=>()=>e;function gN(e,{sourceEvent:t,target:r,transform:n,dispatch:i}){Object.defineProperties(this,{type:{value:e,enumerable:!0,configurable:!0},sourceEvent:{value:t,enumerable:!0,configurable:!0},target:{value:r,enumerable:!0,configurable:!0},transform:{value:n,enumerable:!0,configurable:!0},_:{value:i}})}function Gi(e,t,r){this.k=e,this.x=t,this.y=r}Gi.prototype={constructor:Gi,scale:function(e){return e===1?this:new Gi(this.k*e,this.x,this.y)},translate:function(e,t){return e===0&t===0?this:new Gi(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 yb=new Gi(1,0,0);bN.prototype=Gi.prototype;function bN(e){for(;!e.__zoom;)if(!(e=e.parentNode))return yb;return e.__zoom}function pI(e){e.stopImmediatePropagation()}function yp(e){e.preventDefault(),e.stopImmediatePropagation()}function Vst(e){return(!e.ctrlKey||e.type==="wheel")&&!e.button}function jst(){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 eV(){return this.__zoom||yb}function qst(e){return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*(e.ctrlKey?10:1)}function Yst(){return navigator.maxTouchPoints||"ontouchstart"in this}function Wst(e,t,r){var n=e.invertX(t[0][0])-r[0][0],i=e.invertX(t[1][0])-r[1][0],o=e.invertY(t[0][1])-r[0][1],s=e.invertY(t[1][1])-r[1][1];return e.translate(i>n?(n+i)/2:Math.min(0,n)||Math.max(0,i),s>o?(o+s)/2:Math.min(0,o)||Math.max(0,s))}function xN(){var e=Vst,t=jst,r=Wst,n=qst,i=Yst,o=[0,1/0],s=[[-1/0,-1/0],[1/0,1/0]],a=250,c=GD,l=Nf("start","zoom","end"),u,f,d,h=500,p=150,y=0,g=10;function m(S){S.property("__zoom",eV).on("wheel.zoom",D,{passive:!1}).on("mousedown.zoom",A).on("dblclick.zoom",B).filter(i).on("touchstart.zoom",M).on("touchmove.zoom",O).on("touchend.zoom touchcancel.zoom",R).style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}m.transform=function(S,T,E,C){var U=S.selection?S.selection():S;U.property("__zoom",eV),S!==U?v(S,T,E,C):U.interrupt().each(function(){w(this,arguments).event(C).start().zoom(null,typeof T=="function"?T.apply(this,arguments):T).end()})},m.scaleBy=function(S,T,E,C){m.scaleTo(S,function(){var U=this.__zoom.k,k=typeof T=="function"?T.apply(this,arguments):T;return U*k},E,C)},m.scaleTo=function(S,T,E,C){m.transform(S,function(){var U=t.apply(this,arguments),k=this.__zoom,$=E==null?_(U):typeof E=="function"?E.apply(this,arguments):E,z=k.invert($),V=typeof T=="function"?T.apply(this,arguments):T;return r(x(b(k,V),$,z),U,s)},E,C)},m.translateBy=function(S,T,E,C){m.transform(S,function(){return r(this.__zoom.translate(typeof T=="function"?T.apply(this,arguments):T,typeof E=="function"?E.apply(this,arguments):E),t.apply(this,arguments),s)},null,C)},m.translateTo=function(S,T,E,C,U){m.transform(S,function(){var k=t.apply(this,arguments),$=this.__zoom,z=C==null?_(k):typeof C=="function"?C.apply(this,arguments):C;return r(yb.translate(z[0],z[1]).scale($.k).translate(typeof T=="function"?-T.apply(this,arguments):-T,typeof E=="function"?-E.apply(this,arguments):-E),k,s)},C,U)};function b(S,T){return T=Math.max(o[0],Math.min(o[1],T)),T===S.k?S:new Gi(T,S.x,S.y)}function x(S,T,E){var C=T[0]-E[0]*S.k,U=T[1]-E[1]*S.k;return C===S.x&&U===S.y?S:new Gi(S.k,C,U)}function _(S){return[(+S[0][0]+ +S[1][0])/2,(+S[0][1]+ +S[1][1])/2]}function v(S,T,E,C){S.on("start.zoom",function(){w(this,arguments).event(C).start()}).on("interrupt.zoom end.zoom",function(){w(this,arguments).event(C).end()}).tween("zoom",function(){var U=this,k=arguments,$=w(U,k).event(C),z=t.apply(U,k),V=E==null?_(z):typeof E=="function"?E.apply(U,k):E,Q=Math.max(z[1][0]-z[0][0],z[1][1]-z[0][1]),nt=U.__zoom,st=typeof T=="function"?T.apply(U,k):T,ut=c(nt.invert(V).concat(Q/nt.k),st.invert(V).concat(Q/st.k));return function(X){if(X===1)X=st;else{var at=ut(X),q=Q/at[2];X=new Gi(q,V[0]-at[0]*q,V[1]-at[1]*q)}$.zoom(null,X)}})}function w(S,T,E){return!E&&S.__zooming||new I(S,T)}function I(S,T){this.that=S,this.args=T,this.active=0,this.sourceEvent=null,this.extent=t.apply(S,T),this.taps=0}I.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=ae(this.that).datum();l.call(S,this.that,new gN(S,{sourceEvent:this.sourceEvent,target:m,type:S,transform:this.that.__zoom,dispatch:l}),T)}};function D(S,...T){if(!e.apply(this,arguments))return;var E=w(this,T).event(S),C=this.__zoom,U=Math.max(o[0],Math.min(o[1],C.k*Math.pow(2,n.apply(this,arguments)))),k=Mn(S);if(E.wheel)(E.mouse[0][0]!==k[0]||E.mouse[0][1]!==k[1])&&(E.mouse[1]=C.invert(E.mouse[0]=k)),clearTimeout(E.wheel);else{if(C.k===U)return;E.mouse=[k,C.invert(k)],ta(this),E.start()}yp(S),E.wheel=setTimeout($,p),E.zoom("mouse",r(x(b(C,U),E.mouse[0],E.mouse[1]),E.extent,s));function $(){E.wheel=null,E.end()}}function A(S,...T){if(d||!e.apply(this,arguments))return;var E=S.currentTarget,C=w(this,T,!0).event(S),U=ae(S.view).on("mousemove.zoom",V,!0).on("mouseup.zoom",Q,!0),k=Mn(S,E),$=S.clientX,z=S.clientY;Wg(S.view),pI(S),C.mouse=[k,this.__zoom.invert(k)],ta(this),C.start();function V(nt){if(yp(nt),!C.moved){var st=nt.clientX-$,ut=nt.clientY-z;C.moved=st*st+ut*ut>y}C.event(nt).zoom("mouse",r(x(C.that.__zoom,C.mouse[0]=Mn(nt,E),C.mouse[1]),C.extent,s))}function Q(nt){U.on("mousemove.zoom mouseup.zoom",null),Gg(nt.view,C.moved),yp(nt),C.event(nt).end()}}function B(S,...T){if(e.apply(this,arguments)){var E=this.__zoom,C=Mn(S.changedTouches?S.changedTouches[0]:S,this),U=E.invert(C),k=E.k*(S.shiftKey?.5:2),$=r(x(b(E,k),C,U),t.apply(this,T),s);yp(S),a>0?ae(this).transition().duration(a).call(v,$,C,S):ae(this).call(m.transform,$,C,S)}}function M(S,...T){if(e.apply(this,arguments)){var E=S.touches,C=E.length,U=w(this,T,S.changedTouches.length===C).event(S),k,$,z,V;for(pI(S),$=0;$<C;++$)z=E[$],V=Mn(z,this),V=[V,this.__zoom.invert(V),z.identifier],U.touch0?!U.touch1&&U.touch0[2]!==V[2]&&(U.touch1=V,U.taps=0):(U.touch0=V,k=!0,U.taps=1+!!u);u&&(u=clearTimeout(u)),k&&(U.taps<2&&(f=V[0],u=setTimeout(function(){u=null},h)),ta(this),U.start())}}function O(S,...T){if(this.__zooming){var E=w(this,T).event(S),C=S.changedTouches,U=C.length,k,$,z,V;for(yp(S),k=0;k<U;++k)$=C[k],z=Mn($,this),E.touch0&&E.touch0[2]===$.identifier?E.touch0[0]=z:E.touch1&&E.touch1[2]===$.identifier&&(E.touch1[0]=z);if($=E.that.__zoom,E.touch1){var Q=E.touch0[0],nt=E.touch0[1],st=E.touch1[0],ut=E.touch1[1],X=(X=st[0]-Q[0])*X+(X=st[1]-Q[1])*X,at=(at=ut[0]-nt[0])*at+(at=ut[1]-nt[1])*at;$=b($,Math.sqrt(X/at)),z=[(Q[0]+st[0])/2,(Q[1]+st[1])/2],V=[(nt[0]+ut[0])/2,(nt[1]+ut[1])/2]}else if(E.touch0)z=E.touch0[0],V=E.touch0[1];else return;E.zoom("touch",r(x($,z,V),E.extent,s))}}function R(S,...T){if(this.__zooming){var E=w(this,T).event(S),C=S.changedTouches,U=C.length,k,$;for(pI(S),d&&clearTimeout(d),d=setTimeout(function(){d=null},h),k=0;k<U;++k)$=C[k],E.touch0&&E.touch0[2]===$.identifier?delete E.touch0:E.touch1&&E.touch1[2]===$.identifier&&delete E.touch1;if(E.touch1&&!E.touch0&&(E.touch0=E.touch1,delete E.touch1),E.touch0)E.touch0[1]=this.__zoom.invert(E.touch0[0]);else if(E.end(),E.taps===2&&($=Mn($,this),Math.hypot(f[0]-$[0],f[1]-$[1])<g)){var z=ae(this).on("dblclick.zoom");z&&z.apply(this,arguments)}}}return m.wheelDelta=function(S){return arguments.length?(n=typeof S=="function"?S:mb(+S),m):n},m.filter=function(S){return arguments.length?(e=typeof S=="function"?S:mb(!!S),m):e},m.touchable=function(S){return arguments.length?(i=typeof S=="function"?S:mb(!!S),m):i},m.extent=function(S){return arguments.length?(t=typeof S=="function"?S:mb([[+S[0][0],+S[0][1]],[+S[1][0],+S[1][1]]]),m):t},m.scaleExtent=function(S){return arguments.length?(o[0]=+S[0],o[1]=+S[1],m):[o[0],o[1]]},m.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],m):[[s[0][0],s[0][1]],[s[1][0],s[1][1]]]},m.constrain=function(S){return arguments.length?(r=S,m):r},m.duration=function(S){return arguments.length?(a=+S,m):a},m.interpolate=function(S){return arguments.length?(c=S,m):c},m.on=function(){var S=l.on.apply(l,arguments);return S===l?m:S},m.clickDistance=function(S){return arguments.length?(y=(S=+S)*S,m):Math.sqrt(y)},m.tapDistance=function(S){return arguments.length?(g=+S,m):g},m}function wr(e){return e!=null&&!Number.isNaN(e)}function Kr(e,t){return+wr(t)-+wr(e)||ie(e,t)}function id(e,t){return+wr(t)-+wr(e)||Wn(e,t)}function gb(e){return e!=null&&`${e}`!=""}function gp(e){return isFinite(e)?e:NaN}function ni(e){return e>0&&isFinite(e)?e:NaN}function hu(e){return e<0&&isFinite(e)?e:NaN}function bp(e,t){if(e instanceof Date||(e=new Date(+e)),isNaN(e))return typeof t=="function"?t(e):t;let r=e.getUTCHours(),n=e.getUTCMinutes(),i=e.getUTCSeconds(),o=e.getUTCMilliseconds();return`${Gst(e.getUTCFullYear(),4)}-${Jc(e.getUTCMonth()+1,2)}-${Jc(e.getUTCDate(),2)}${r||n||i||o?`T${Jc(r,2)}:${Jc(n,2)}${i||o?`:${Jc(i,2)}${o?`.${Jc(o,3)}`:""}`:""}Z`:""}`}function Gst(e){return e<0?`-${Jc(-e,6)}`:e>9999?`+${Jc(e,6)}`:Jc(e,4)}function Jc(e,t){return`${e}`.padStart(t,"0")}var Xst=/^(?:[-+]\d{2})?\d{4}(?:-\d{2}(?:-\d{2})?)?(?:T\d{2}:\d{2}(?::\d{2}(?:\.\d{3})?)?(?:Z|[-+]\d{2}:?\d{2})?)?$/;function bb(e,t){return Xst.test(e+="")?new Date(e):typeof t=="function"?t(e):t}var _p=1e3,mu=_p*60,yu=mu*60,ma=yu*24,pa=ma*7,od=ma*30,pu=ma*365,_N=[["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",_p],["5 seconds",5*_p],["15 seconds",15*_p],["30 seconds",30*_p],["minute",mu],["5 minutes",5*mu],["15 minutes",15*mu],["30 minutes",30*mu],["hour",yu],["3 hours",3*yu],["6 hours",6*yu],["12 hours",12*yu],["day",ma],["2 days",2*ma],["week",pa],["2 weeks",2*pa],["month",od],["3 months",3*od],["6 months",6*od],["year",pu],["2 years",2*pu],["5 years",5*pu],["10 years",10*pu],["20 years",20*pu],["50 years",50*pu],["100 years",100*pu]],wN=new Map([["second",_p],["minute",mu],["hour",yu],["day",ma],["monday",pa],["tuesday",pa],["wednesday",pa],["thursday",pa],["friday",pa],["saturday",pa],["sunday",pa],["week",pa],["month",od],["year",pu]]),nV=new Map([["second",Hr],["minute",Yc],["hour",Gc],["day",So],["monday",fu],["tuesday",NS],["wednesday",FS],["thursday",fa],["friday",LS],["saturday",RS],["sunday",Yi],["week",Yi],["month",Hc],["year",Fn]]),vN=new Map([["second",Hr],["minute",Wc],["hour",Xc],["day",td],["monday",du],["tuesday",kS],["wednesday",CS],["thursday",da],["friday",US],["saturday",PS],["sunday",Wi],["week",Wi],["month",Zc],["year",Ln]]),wp=Symbol("intervalDuration"),yI=Symbol("intervalType");for(let[e,t]of nV)t[wp]=wN.get(e),t[yI]="time";for(let[e,t]of vN)t[wp]=wN.get(e),t[yI]="utc";var xb=[["year",Ln,"utc"],["month",Zc,"utc"],["day",td,"utc",6*od],["hour",Xc,"utc",3*ma],["minute",Wc,"utc",6*yu],["second",Hr,"utc",30*mu]],mI=[["year",Fn,"time"],["month",Hc,"time"],["day",So,"time",6*od],["hour",Gc,"time",3*ma],["minute",Yc,"time",6*yu],["second",Hr,"time",30*mu]],Hst=[xb[0],mI[0],xb[1],mI[1],xb[2],mI[2],...xb.slice(3)];function gI(e){let t=`${e}`.toLowerCase();t.endsWith("s")&&(t=t.slice(0,-1));let r=1,n=/^(?:(\d+)\s+)/.exec(t);switch(n&&(t=t.slice(n[0].length),r=+n[1]),t){case"quarter":t="month",r*=3;break;case"half":t="month",r*=6;break}let i=vN.get(t);if(!i)throw new Error(`unknown interval: ${e}`);if(r>1&&!i.every)throw new Error(`non-periodic interval: ${t}`);return[t,r]}function SN(e){return iV(gI(e),"time")}function _b(e){return iV(gI(e),"utc")}function iV([e,t],r){let n=(r==="time"?nV:vN).get(e);return t>1&&(n=n.every(t),n[wp]=wN.get(e)*t,n[yI]=r),n}function IN(e,t){if(!(t>1))return;let r=e[wp];if(!_N.some(([,i])=>i===r)||r%ma===0&&ma<r&&r<od)return;let[n]=_N[Oc(([,i])=>Math.log(i)).center(_N,Math.log(r*t))];return(e[yI]==="time"?SN:_b)(n)}function rV(e,t,r){let n=t==="time"?ap:ha;if(r==null)return n(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=Zst(r);switch(e){case"millisecond":return xp(n(".%L"),n(":%M:%S"),i);case"second":return xp(n(":%S"),n("%-I:%M"),i);case"minute":return xp(n("%-I:%M"),n("%p"),i);case"hour":return xp(n("%-I %p"),n("%b %-d"),i);case"day":return xp(n("%-d"),n("%b"),i);case"month":return xp(n("%b"),n("%Y"),i);case"year":return n("%Y")}throw new Error("unable to format time ticks")}function Zst(e){return e==="left"||e==="right"?(t,r)=>`
12
21
  ${t}
13
- ${n}`:e==="top"?(t,n)=>`${n}
14
- ${t}`:(t,n)=>`${t}
15
- ${n}`}function gH(e){return e==="time"?O1:e==="utc"?pm:mH}function l5(e,t,n){let r=$t(M0(t,(i,o)=>Math.abs(o-i)));if(r<1e3)return s5("millisecond","utc",n);for(let[i,o,s,a]of gH(e)){if(r>a||i==="hour"&&!r)break;if(t.every(c=>o.floor(c)>=c))return s5(i,s,n)}}function df(e,t,n){return(r,i,o)=>{let s=e(r,i),a=t(r,i),c=i-js(o);return i!==c&&o[c]!==void 0&&a===t(o[c],c)?s:n(s,a)}}var _l=Object.getPrototypeOf(Uint8Array),bH=Object.prototype.toString,$T=Symbol("reindex");function mt(e,t,n){let r=typeof t;return r==="string"?u5(e,zT(t),n):r==="function"?u5(e,t,n):r==="number"||t instanceof Date||r==="boolean"?Yt(e,dn(t),n):typeof t?.transform=="function"?f5(t.transform(e),n):xH(f5(t,n),e?.[$T])}function xH(e,t){return t?gm(e,t):e}function u5(e,t,n){return Yt(e,n?.prototype instanceof _l?_H(t):t,n)}function f5(e,t){return t===void 0?qe(e):e instanceof t?e:t.prototype instanceof _l&&!(e instanceof _l)?t.from(e,qT):t.from(e)}function _H(e){return(t,n)=>qT(e(t,n))}var Ga=[null],zT=e=>t=>t[e],Me={transform:or},W={transform:e=>e};var ym=()=>1,d5=()=>!0,ze=e=>e==null?e:`${e}`,Nt=e=>e==null?e:+e;var Vs=e=>e?e[0]:void 0,Wa=e=>e?e[1]:void 0,h5=e=>e?e[2]:void 0,dn=e=>()=>e;function mf(e){let t=+`${e}`.slice(1)/100;return(n,r)=>Zn(n,t,r)}function Qe(e){return e instanceof _l?e:Yt(e,qT,Float64Array)}function qT(e){return e==null?NaN:Number(e)}function p5(e){return Yt(e,jT)}function jT(e){return e instanceof Date&&!isNaN(e)?e:typeof e=="string"?hm(e):e==null||isNaN(e=+e)?void 0:new Date(e)}function Re(e,t){return e===void 0&&(e=t),e===null?[void 0,"none"]:Za(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 VT(e,t,n){if(e!=null)return Ke(e,t,n)}function Ke(e,t,n){let r=`${e}`.toLowerCase();if(!n.includes(r))throw new Error(`invalid ${t}: ${e}`);return r}function qe(e){return e==null||e instanceof Array||e instanceof _l?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 Xa(e,t=Array){return e instanceof t?e.slice():t.from(e)}function YT({x:e,x1:t,x2:n}){return e!==void 0||t!==void 0||n!==void 0}function GT({y:e,y1:t,y2:n}){return e!==void 0||t!==void 0||n!==void 0}function yf(e){return YT(e)||GT(e)||e.interval!==void 0}function hn(e){return e?.toString===bH}function Ro(e){return hn(e)&&(e.type!==void 0||e.domain!==void 0)}function $r(e){return hn(e)&&typeof e.transform!="function"}function Oo(e){return $r(e)&&e.value===void 0&&e.channel===void 0}function WT(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 Be(e,t){return e===void 0&&t===void 0?[Vs,Wa]:[e,t]}function zn({z:e,fill:t,stroke:n}={}){return e===void 0&&([e]=Re(t)),e===void 0&&([e]=Re(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 gm(e,t){return Yt(t,n=>e[n],e.constructor)}function gf(e){return e.length===1?(t,n)=>e(gm(n,t)):e}function Ys(e,t,n){return e.subarray?e.subarray(t,n):e.slice(t,n)}function Gs(e){return e!==null&&typeof e=="object"?e.valueOf():e}function F1(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:On(e)},n=>t=n]}function Rn(e){return e==null?[e]:pn(e)}function On(e,t){return typeof e=="string"?e:e&&e.label!==void 0?e.label:t}function bf(e,t){return{transform(n){let r=e.transform(n),i=t.transform(n);return Oe(r)||Oe(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 wl(e,t){let n=XT(t?.interval,t?.type);return n?Yt(e,n):e}function XT(e,t){let n=xf(e,t);return n&&(r=>$e(r)?n.floor(r):r)}function xf(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)=>Ue(Math.ceil(r*n),i*n).map(o=>o/n)}:{floor:r=>Math.floor(r/n)*n,offset:r=>r+n,range:(r,i)=>Ue(Math.ceil(r/n),i/n).map(o=>o*n)}}if(typeof e=="string")return(t==="time"?PT:mm)(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 Do(e,t){if(e=xf(e,t),e&&typeof e.range!="function")throw new Error("invalid interval: missing range method");return e}function m5(e,t){if(e=Do(e,t),e&&typeof e.ceil!="function")throw new Error("invalid interval: missing ceil method");return e}function y5(e){return Ha(e)&&typeof e?.floor=="function"&&e.floor()instanceof Date}function Ha(e){return typeof e?.range=="function"}function pi(e){return e===void 0||$r(e)?e:{value:e}}function g5(e){return e==null?null:{transform:t=>mt(t,e,Float64Array),label:On(e)}}function b5(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 L1(e){for(let t of e)if(t!=null)return typeof t!="object"||t instanceof Date}function Ae(e){for(let t of e){if(t==null)continue;let n=typeof t;return n==="string"||n==="boolean"}}function Oe(e){for(let t of e)if(t!=null)return t instanceof Date}function x5(e){for(let t of e)if(t!=null)return typeof t=="string"&&isNaN(t)&&hm(t)}function _5(e){for(let t of e)if(t!=null){if(typeof t!="string")return!1;if(t.trim())return!isNaN(t)}}function Ws(e){for(let t of e)if(t!=null)return typeof t=="number"}function C1(e,t){let n;for(let r of e)if(r!=null){if(!t(r))return!1;n=!0}return n}var wH=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 Za(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)||wH.has(e))}function w5(e){return typeof e=="number"&&(0<=e&&e<=1||isNaN(e))}function ne(e){return e==null||Xs(e)}function Xs(e){return/^\s*none\s*$/i.test(e)}function v5(e){return/^\s*round\s*$/i.test(e)}function B1(e,t){return VT(e,t,["middle","top-left","top","top-right","right","bottom-right","bottom","bottom-left","left"])}function ko(e="middle"){return B1(e,"frameAnchor")}function js(e){if(e==null)return;let t=e[0],n=e[e.length-1];return Xn(t,n)}function S5(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 vH(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 bm(e){return sr(e)?vH(e):e}var mi=Symbol("position"),zr=Symbol("color"),vl=Symbol("radius"),Sl=Symbol("length"),Il=Symbol("opacity"),_f=Symbol("symbol"),I5=Symbol("projection"),fe=new Map([["x",mi],["y",mi],["fx",mi],["fy",mi],["r",vl],["color",zr],["opacity",Il],["symbol",_f],["length",Sl],["projection",I5]]);function T5(e){return e===mi||e===I5}function E5(e){return e===mi||e===vl||e===Sl||e===Il}var HT=Math.sqrt(3),ZT=2/HT,SH={draw(e,t){let n=Math.sqrt(t/Math.PI),r=n*ZT,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()}},QT=new Map([["asterisk",Qp],["circle",zs],["cross",Kp],["diamond",Jp],["diamond2",tm],["hexagon",SH],["plus",em],["square",nm],["square2",rm],["star",im],["times",sf],["triangle",om],["triangle2",sm],["wye",am]]);function KT(e){return e&&typeof e.draw=="function"}function M5(e){return KT(e)?!0:typeof e!="string"?!1:QT.has(e.toLowerCase())}function wf(e){if(e==null||KT(e))return e;let t=QT.get(`${e}`.toLowerCase());if(t)return t;throw new Error(`invalid symbol: ${e}`)}function A5(e){if(e==null||KT(e))return[void 0,e];if(typeof e=="string"){let t=QT.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=eE(e)),t!=null&&!Oo(t)&&(r=JT(r,rE(t))),n&&(r=JT(r,nE))),s!=null&&i!=null)throw new Error("transforms cannot be applied after initializers");return{...o,...(t===null||Oo(t))&&{sort:t},transform:JT(r,s)}}function Se({filter:e,sort:t,reverse:n,initializer:r,...i}={},o){return r===void 0&&(e!=null&&(r=eE(e)),t!=null&&!Oo(t)&&(r=tE(r,rE(t))),n&&(r=tE(r,nE))),{...i,...(t===null||Oo(t))&&{sort:t},initializer:tE(r,o)}}function JT(e,t){return e==null?t===null?void 0:t:t==null?e===null?void 0:e:function(n,r,i){return{data:n,facets:r}=e.call(this,n,r,i),t.call(this,qe(n),r,i)}}function tE(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?Se:mn)(e,t)}function N5(e,t){return P1(t,eE(e))}function eE(e){return(t,n)=>{let r=mt(t,e);return{data:t,facets:n.map(i=>i.filter(o=>r[o]))}}}function R5({sort:e,...t}={}){return{...P1(t,nE),sort:Oo(e)?e:null}}function nE(e,t){return{data:e,facets:t.map(n=>n.slice().reverse())}}function O5({seed:e,sort:t,...n}={}){return{...P1(n,D5(e==null?Math.random:cl(e))),sort:Oo(t)?t:null}}function U1(e,{sort:t,...n}={}){return{...($r(e)&&e.channel!==void 0?Se:P1)(n,rE(e)),sort:Oo(t)?t:null}}function rE(e){return(typeof e=="function"&&e.length!==1?IH:D5)(e)}function IH(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 D5(e){let t,n;({channel:t,value:e,order:n}={...pi(e)});let r=t?.startsWith("-");if(r&&(t=t.slice(1)),n===void 0&&(n=r?bl:fn),typeof n!="function")switch(`${n}`.toLowerCase()){case"ascending":n=fn;break;case"descending":n=bl;break;default:throw new Error(`invalid order: ${n}`)}return(i,o,s)=>{let a;if(t===void 0)a=mt(i,e);else{if(s===void 0)throw new Error("channel sort requires an initializer");if(a=s[t],!a)return{};a=a.value}let c=(l,u)=>n(a[l],a[u]);return{data:i,facets:o.map(l=>l.slice().sort(c))}}}function _m(e,t){return $1(null,null,e,t)}function Ka(e={y:"count"},t={}){let{x:n=W}=t;if(n==null)throw new Error("missing channel: x");return $1(n,null,e,t)}function Ja(e={x:"count"},t={}){let{y:n=W}=t;if(n==null)throw new Error("missing channel: y");return $1(null,n,e,t)}function wm(e={fill:"count"},t={}){let{x:n,y:r}=t;if([n,r]=Be(n,r),n==null)throw new Error("missing channel: x");if(r==null)throw new Error("missing channel: y");return $1(n,r,e,t)}function $1(e,t,{data:n=j1,filter:r,sort:i,reverse:o,...s}={},a={}){s=oE(s,a),n=B5(n,W),i=i==null?void 0:L5("sort",i,a),r=r==null?void 0:C5("filter",r,a);let[c,l]=Rn(e),[u,f]=Rn(t),{z:d,fill:h,stroke:p,x1:y,x2:b,y1:m,y2:g,...x}=a,[_,v]=Rn(d),[w]=Re(h),[T]=Re(p),[A,R]=Rn(w),[I,E]=Rn(T);return{..."z"in a&&{z:_||d},..."fill"in a&&{fill:A||h},..."stroke"in a&&{stroke:I||p},...mn(x,(O,k,S)=>{let M=wl(mt(O,e),S?.x),N=wl(mt(O,t),S?.y),F=mt(O,d),B=mt(O,w),C=mt(O,T),P=vm(s,{z:F,fill:B,stroke:C}),U=[],$=[],X=M&&l([]),tt=N&&f([]),nt=F&&v([]),st=B&&R([]),Y=C&&E([]),rt=0;for(let q of s)q.initialize(O);i&&i.initialize(O),r&&r.initialize(O);for(let q of k){let H=[];for(let ot of s)ot.scope("facet",q);i&&i.scope("facet",q),r&&r.scope("facet",q);for(let[ot,z]of Qa(q,P))for(let[Lt,dt]of Qa(z,N))for(let[Wt,Xt]of Qa(dt,M)){let et={data:O};if(M&&(et.x=Wt),N&&(et.y=Lt),!(r&&!r.reduce(Xt,et))){H.push(rt++),$.push(n.reduceIndex(Xt,O,et)),M&&X.push(Wt),N&&tt.push(Lt),F&&nt.push(P===F?ot:F[Xt[0]]),B&&st.push(P===B?ot:B[Xt[0]]),C&&Y.push(P===C?ot:C[Xt[0]]);for(let oe of s)oe.reduce(Xt,et);i&&i.reduce(Xt,et)}}U.push(H)}return sE(U,i,o),{data:$,facets:U}}),...!Fo(s,"x")&&(c?{x:c}:{x1:y,x2:b}),...!Fo(s,"y")&&(u?{y:u}:{y1:m,y2:g}),...Object.fromEntries(s.map(({name:O,output:k})=>[O,k]))}}function Fo(e,...t){for(let{name:n}of e)if(t.includes(n))return!0;return!1}function iE(e,t,n=z1){let r=Object.entries(e);return t.title!=null&&e.title===void 0&&r.push(["title",RH]),t.href!=null&&e.href===void 0&&r.push(["href",V1]),r.filter(([,i])=>i!==void 0).map(([i,o])=>o===null?TH(i):n(i,o,t))}function z1(e,t,n,r=q1){let i;hn(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 TH(e){return{name:e,initialize(){},scope(){},reduce(){}}}function q1(e,t,n,r=vf){let i=F1(e,n),o=r(t,i),s,a;return{label:On(o===xm?null:i,o.label),initialize(c){s=i===void 0?c:mt(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 Qa(e,t){return t?lo(sn(e,n=>t[n]),Vs):[[,e]]}function vf(e,t,n=EH){if(e==null)return n(e);if(typeof e.reduceIndex=="function")return e;if(typeof e.reduce=="function"&&hn(e))return AH(e);if(typeof e=="function")return NH(e);if(/^p\d{2}$/i.test(e))return Hs(mf(e));switch(`${e}`.toLowerCase()){case"first":return V1;case"last":return OH;case"identity":return j1;case"count":return xm;case"distinct":return DH;case"sum":return t==null?xm:kH;case"proportion":return F5(t,"data");case"proportion-facet":return F5(t,"facet");case"deviation":return Hs(ri);case"min":return Hs(ce);case"min-index":return Hs(I0);case"max":return Hs($t);case"max-index":return Hs(S0);case"mean":return k5(Ss);case"median":return k5(Bi);case"variance":return Hs(Ea);case"mode":return Hs(Su)}return n(e)}function EH(e){throw new Error(`invalid reduce: ${e}`)}function oE(e,t){return iE(e,t,L5)}function L5(e,t,n){return z1(e,t,n,C5)}function C5(e,t,n){return q1(e,t,n,B5)}function B5(e,t){return vf(e,t,MH)}function MH(e){switch(`${e}`.toLowerCase()){case"x":return FH;case"y":return LH}throw new Error(`invalid group reduce: ${e}`)}function vm(e,t){for(let n in t){let r=t[n];if(r!==void 0&&!e.some(i=>i.name===n))return r}}function sE(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 AH(e){return console.warn("deprecated reduce interface; implement reduceIndex instead."),{...e,reduceIndex:e.reduce.bind(e)}}function NH(e){return{reduceIndex(t,n,r){return e(gm(n,t),r)}}}function Hs(e){return{reduceIndex(t,n){return e(t,r=>n[r])}}}function k5(e){return{reduceIndex(t,n){let r=e(t,i=>n[i]);return Oe(n)?new Date(r):r}}}var j1={reduceIndex(e,t){return gm(t,e)}},V1={reduceIndex(e,t){return t[e[0]]}},RH={reduceIndex(e,t){let r=lo(Ci(e,o=>o.length,o=>t[o]),Wa),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`,En(o,Wa)]}return i.map(([o,s])=>`${o} (${s.toLocaleString("en-US")})`).join(`
16
- `)}},OH={reduceIndex(e,t){return t[e[e.length-1]]}},xm={label:"Frequency",reduceIndex(e){return e.length}},DH={label:"Distinct",reduceIndex(e,t){let n=new kr;for(let r of e)n.add(t[r]);return n.size}},kH=Hs(En);function F5(e,t){return e==null?{scope:t,label:"Frequency",reduceIndex:(n,r,i=1)=>n.length/i}:{scope:t,reduceIndex:(n,r,i=1)=>En(n,o=>r[o])/i}}var FH={reduceIndex(e,t,{x:n}){return n}},LH={reduceIndex(e,t,{y:n}){return n}};function P5(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=On(r)},a){return o===void 0&&typeof r?.transform=="function"&&(o=r.hint),cE(a,{scale:t,type:n,value:mt(e,r),label:s,filter:i,hint:o})}function Y1(e,t){return Object.fromEntries(Object.entries(e).map(([n,r])=>[n,Sf(t,r,n)]))}function If(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 cE(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&&C1(r,Za)?null:"color";break;case"fillOpacity":case"strokeOpacity":case"opacity":t.scale=n!==!0&&C1(r,w5)?null:"opacity";break;case"symbol":n!==!0&&C1(r,M5)?(t.scale=null,t.value=Yt(r,wf)):t.scale="symbol";break;default:t.scale=fe.has(e)?e:null;break}else if(n===!1)t.scale=null;else if(n!=null&&!fe.has(n))throw new Error(`unknown scale: ${n}`);return t}function $5(e,t,n,r,i){let{order:o,reverse:s,reduce:a=!0,limit:c}=i;for(let l in i){if(!fe.has(l))continue;let{value:u,order:f=o,reverse:d=s,reduce:h=a,limit:p=c}=pi(i[l]),y=u?.startsWith("-");if(y&&(u=u.slice(1)),f=f===void 0?y!==(u==="width"||u==="height")?q5:z5:PH(f),h==null||h===!1)continue;let b=l==="fx"||l==="fy"?BH(t,r[l]):CH(n,l);if(!b)throw new Error(`missing channel for scale: ${l}`);let m=b.value,[g=0,x=1/0]=sr(p)?p:p<0?[p]:[0,p];if(u==null)b.domain=()=>{let _=Array.from(new kr(m));return d&&(_=_.reverse()),(g!==0||x!==1/0)&&(_=_.slice(g,x)),_};else{let _=u==="data"?e:u==="height"?U5(n,"y1","y2"):u==="width"?U5(n,"x1","x2"):aE(n,u,u==="y"?"y2":u==="x"?"x2":void 0),v=vf(h===!0?"max":h,_);b.domain=()=>{let w=B2(or(m),T=>v.reduceIndex(T,_),T=>m[T]);return f&&w.sort(f),d&&w.reverse(),(g!==0||x!==1/0)&&(w=w.slice(g,x)),w.map(Vs)}}}}function CH(e,t){for(let n in e){let r=e[n];if(r.scale===t)return r}}function BH(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 U5(e,t,n){let r=aE(e,t),i=aE(e,n);return Yt(i,(o,s)=>Math.abs(o-r[s]),Float64Array)}function aE(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 PH(e){if(e==null||typeof e=="function")return e;switch(`${e}`.toLowerCase()){case"ascending":return z5;case"descending":return q5}throw new Error(`invalid order: ${e}`)}function z5([e,t],[n,r]){return fn(t,r)||fn(e,n)}function q5([e,t],[n,r]){return bl(t,r)||fn(e,n)}function Sm(e,t){let n=e[t];if(n){for(;n.source;)n=n.source;return n.source===null?null:n}}function G1(e){let t,n;return(...r)=>((n?.length!==r.length||n.some((i,o)=>i!==r[o]))&&(n=r,t=e(...r)),t)}var UH=G1(e=>new Intl.NumberFormat(e)),$H=G1((e,t)=>new Intl.DateTimeFormat(e,{timeZone:"UTC",...t&&{month:t}})),zH=G1((e,t)=>new Intl.DateTimeFormat(e,{timeZone:"UTC",...t&&{weekday:t}}));function qH(e="en-US"){let t=UH(e);return n=>n!=null&&!isNaN(n)?t.format(n):void 0}function j5(e="en-US",t="short"){let n=$H(e,t);return r=>r!=null&&!isNaN(r=+new Date(Date.UTC(2e3,+r)))?n.format(r):void 0}function V5(e="en-US",t="short"){let n=zH(e,t);return r=>r!=null&&!isNaN(r=+new Date(Date.UTC(2001,0,+r)))?n.format(r):void 0}function lE(e){return ff(e,"Invalid Date")}function jH(e="en-US"){let t=qH(e);return n=>(n instanceof Date?lE:typeof n=="number"?t:ze)(n)}var zi=jH();var uE=0,fE;function Y5(){let e=uE;return uE=0,fE=void 0,e}function qn(e){e!==fE&&(fE=e,console.warn(e),++uE)}var De=(typeof window<"u"?window.devicePixelRatio>1:typeof it>"u")?0:.5,VH=0;function W1(){return`plot-clip-${++VH}`}function X1(e,{title:t,href:n,ariaLabel:r,ariaDescription:i,ariaHidden:o,target:s,fill:a,fillOpacity:c,stroke:l,strokeWidth:u,strokeOpacity:f,strokeLinejoin:d,strokeLinecap:h,strokeMiterlimit:p,strokeDasharray:y,strokeDashoffset:b,opacity:m,mixBlendMode:g,imageFilter:x,paintOrder:_,pointerEvents:v,shapeRendering:w,channels:T},{ariaLabel:A,fill:R="currentColor",fillOpacity:I,stroke:E="none",strokeOpacity:O,strokeWidth:k,strokeLinecap:S,strokeLinejoin:M,strokeMiterlimit:N,paintOrder:F}){R===null&&(a=null,c=null),E===null&&(l=null,f=null),ne(R)?!ne(E)&&(!ne(a)||T?.fill)&&(E="none"):ne(E)&&(!ne(l)||T?.stroke)&&(R="none");let[B,C]=Re(a,R),[P,U]=ie(c,I),[$,X]=Re(l,E),[tt,nt]=ie(f,O),[st,Y]=ie(m);Xs(X)||(u===void 0&&(u=k),h===void 0&&(h=S),d===void 0&&(d=M),p===void 0&&!v5(d)&&(p=N),!Xs(C)&&_===void 0&&(_=F));let[rt,q]=ie(u);return R!==null&&(e.fill=le(C,"currentColor"),e.fillOpacity=Im(U,1)),E!==null&&(e.stroke=le(X,"none"),e.strokeWidth=Im(q,1),e.strokeOpacity=Im(nt,1),e.strokeLinejoin=le(d,"miter"),e.strokeLinecap=le(h,"butt"),e.strokeMiterlimit=Im(p,4),e.strokeDasharray=le(y,"none"),e.strokeDashoffset=le(b,"0")),e.target=ze(s),e.ariaLabel=ze(A),e.ariaDescription=ze(i),e.ariaHidden=ze(o),e.opacity=Im(Y,1),e.mixBlendMode=le(g,"normal"),e.imageFilter=le(x,"none"),e.paintOrder=le(_,"normal"),e.pointerEvents=le(v,"auto"),e.shapeRendering=le(w,"auto"),{title:{value:t,optional:!0,filter:null},href:{value:n,optional:!0,filter:null},ariaLabel:{value:r,optional:!0,filter:null},fill:{value:B,scale:"auto",optional:!0},fillOpacity:{value:P,scale:"auto",optional:!0},stroke:{value:$,scale:"auto",optional:!0},strokeOpacity:{value:tt,scale:"auto",optional:!0},strokeWidth:{value:rt,optional:!0},opacity:{value:st,scale:"auto",optional:!0}}}function YH(e,t){t&&e.filter(n=>dm(t[n])).append("title").call(WH,t)}function GH(e,t){t&&e.filter(([n])=>dm(t[n])).append("title").call(XH,t)}function WH(e,t){t&&e.text(n=>zi(t[n]))}function XH(e,t){t&&e.text(([n])=>zi(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&&ft(e,"aria-label",d=>r[d]),o&&ft(e,"fill",d=>o[d]),s&&ft(e,"fill-opacity",d=>s[d]),a&&ft(e,"stroke",d=>a[d]),c&&ft(e,"stroke-opacity",d=>c[d]),l&&ft(e,"stroke-width",d=>l[d]),u&&ft(e,"opacity",d=>u[d]),f&&G5(e,d=>f[d],t),n||YH(e,i)}function Tl(e,{target:t,tip:n},{ariaLabel:r,title:i,fill:o,fillOpacity:s,stroke:a,strokeOpacity:c,strokeWidth:l,opacity:u,href:f}){r&&ft(e,"aria-label",([d])=>r[d]),o&&ft(e,"fill",([d])=>o[d]),s&&ft(e,"fill-opacity",([d])=>s[d]),a&&ft(e,"stroke",([d])=>a[d]),c&&ft(e,"stroke-opacity",([d])=>c[d]),l&&ft(e,"stroke-width",([d])=>l[d]),u&&ft(e,"opacity",([d])=>u[d]),f&&G5(e,([d])=>f[d],t),n||GH(e,i)}function HH({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 Tm(e,t,n){let r=sn(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*H1(e,t,n,r){let{z:i}=n,{z:o}=r,s=HH(r,n),a=[...t,...s];for(let c of o?Tm(e,o,i):[e]){let l,u;t:for(let f of c){for(let d of a)if(!$e(d[f])){u&&u.push(-1);continue t}if(l===void 0){u&&(yield u),l=s.map(d=>Gs(d[f])),u=[f];continue}u.push(f);for(let d=0;d<s.length;++d)if(Gs(s[d][f])!==l[d]){yield u,l=s.map(p=>Gs(p[f])),u=[f];continue t}}u&&(yield u)}}function Z1(e){return e===!0?e="frame":e===!1?e=null:e!=null&&(e=Ke(e,"clip",["frame","sphere"])),e}function ZH(e,t,n,r){let i,{clip:o=r.clip}=t;switch(o){case"frame":{let{width:s,height:a,marginLeft:c,marginRight:l,marginTop:u,marginBottom:f}=n,d=W1();i=`url(#${d})`,e=ct("svg:g",r).call(h=>h.append("svg:clipPath").attr("id",d).append("rect").attr("x",c).attr("y",u).attr("width",s-l-c).attr("height",a-u-f)).each(function(){this.appendChild(e.node()),e.node=()=>this});break}case"sphere":{let{projection:s}=r;if(!s)throw new Error('the "sphere" clip option requires a projection');let a=W1();i=`url(#${a})`,e.append("clipPath").attr("id",a).append("path").attr("d",An(s)({type:"Sphere"}));break}}ft(e,"aria-label",t.ariaLabel),ft(e,"aria-description",t.ariaDescription),ft(e,"aria-hidden",t.ariaHidden),ft(e,"clip-path",i)}function Ft(e,t,n,r){ZH(e,t,n,r),ft(e,"fill",t.fill),ft(e,"fill-opacity",t.fillOpacity),ft(e,"stroke",t.stroke),ft(e,"stroke-width",t.strokeWidth),ft(e,"stroke-opacity",t.strokeOpacity),ft(e,"stroke-linejoin",t.strokeLinejoin),ft(e,"stroke-linecap",t.strokeLinecap),ft(e,"stroke-miterlimit",t.strokeMiterlimit),ft(e,"stroke-dasharray",t.strokeDasharray),ft(e,"stroke-dashoffset",t.strokeDashoffset),ft(e,"shape-rendering",t.shapeRendering),ft(e,"filter",t.imageFilter),ft(e,"paint-order",t.paintOrder);let{pointerEvents:i=r.pointerSticky===!1?"none":void 0}=t;ft(e,"pointer-events",i)}function Rt(e,t){QH(e,"mix-blend-mode",t.mixBlendMode),ft(e,"opacity",t.opacity)}function G5(e,t,n){e.each(function(r){let i=t(r);if(i!=null){let o=this.ownerDocument.createElementNS(ii.svg,"a");o.setAttribute("fill","inherit"),o.setAttributeNS(ii.xlink,"href",i),n!=null&&o.setAttribute("target",n),this.parentNode.insertBefore(o,this).appendChild(this)}})}function ft(e,t,n){n!=null&&e.attr(t,n)}function QH(e,t,n){n!=null&&e.style(t,n)}function It(e,t,{x:n,y:r},i=De,o=De){i+=t.dx,o+=t.dy,n?.bandwidth&&(i+=n.bandwidth()/2),r?.bandwidth&&(o+=r.bandwidth()/2),(i||o)&&e.attr("transform",`translate(${i},${o})`)}function le(e,t){if((e=ze(e))!==t)return e}function Im(e,t){if((e=Nt(e))!==t)return e}var KH=/^-?([_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 Tf(e){if(e===void 0)return"plot-d6a7b5";if(e=`${e}`,!KH.test(e))throw new Error(`invalid class name: ${e}`);return e}function Ef(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 tc(e={}){let{document:t=typeof window<"u"?window.document:void 0,clip:n}=e;return{document:t,clip:Z1(n)}}function ct(e,{document:t}){return zt(Ts(e).call(t.documentElement))}var X5=Math.PI,Zs=2*X5,W5=.618;function H5({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}=Z5(e));let{width:u,height:f,marginLeft:d,marginRight:h,marginTop:p,marginBottom:y}=s,b=u-d-h-o-r,m=f-p-y-n-i;if(e=e?.({width:b,height:m,clip:l,...a}),e==null)return;l=JH(l,d,p,u-h,f-y);let g=d+o,x=p+n,_;if(c!=null){let[[v,w],[T,A]]=An(e).bounds(c),R=Math.min(b/(T-v),m/(A-w));R>0?(g-=(R*(v+T)-b)/2,x-=(R*(w+A)-m)/2,_=Object.assign(sl({point(I,E){this.stream.point(I*R+g,E*R+x)}}),{invert:([I,E])=>[(I-g)/R,(E-x)/R]})):qn("Warning: the projection could not be fit to the specified domain; using the default scale.")}return _??=g===0&&x===0?Q5():Object.assign(sl({point(v,w){this.stream.point(v+g,w+x)}}),{invert:([v,w])=>[v-g,w-x]}),{stream:v=>e.stream(_.stream(l(v))),invert:v=>e.invert(_.invert(v))}}function Z5(e){switch(`${e}`.toLowerCase()){case"albers-usa":return qi(lI,.7463,.4673);case"albers":return Q1(Ip,.7463,.4673);case"azimuthal-equal-area":return qi(fI,4,4);case"azimuthal-equidistant":return qi(hI,Zs,Zs);case"conic-conformal":return Q1(yI,Zs,Zs);case"conic-equal-area":return Q1(Ba,6.1702,2.9781);case"conic-equidistant":return Q1(bI,7.312,3.6282);case"equal-earth":return qi(_I,5.4133,2.6347);case"equirectangular":return qi(gI,Zs,X5);case"gnomonic":return qi(vI,3.4641,3.4641);case"identity":return{type:Q5};case"reflect-y":return{type:tZ};case"mercator":return qi(pI,Zs,Zs);case"orthographic":return qi(II,2,2);case"stereographic":return qi(EI,2,2);case"transverse-mercator":return qi(AI,Zs,Zs);default:throw new Error(`unknown projection type: ${e}`)}}function JH(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 qu(t,n,r,i);default:throw new Error(`unknown projection clip type: ${e}`)}}function qi(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 Q1(e,t,n){let{type:r,aspectRatio:i}=qi(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 Q5=dn({stream:e=>e,invert:e=>e}),tZ=dn(Object.assign(sl({point(e,t){this.stream.point(e,-t)}}),{invert:([e,t])=>[e,-t]}));function dE(e,t,n,r){let i=n[e],o=n[t],s=i.length,a=n[e]=new Float64Array(s).fill(NaN),c=n[t]=new Float64Array(s).fill(NaN),l,u=r.stream({point(f,d){a[l]=f,c[l]=d}});for(l=0;l<s;++l)u.point(i[l],o[l])}function K5({projection:e}={}){return e==null?!1:typeof e.stream=="function"?!0:(hn(e)&&(e=e.type),e!=null)}function J5(e){if(typeof e?.stream=="function")return W5;if(hn(e)&&(e=e.type),e!=null){if(typeof e!="function"){let{aspectRatio:t}=Z5(e);if(t)return t}return W5}}function ec(e,t,{projection:n}){let{x:r,y:i}=e,o={};return r&&(o.x=r),i&&(o.y=i),o=If(o,t),n&&r?.scale==="x"&&i?.scale==="y"&&dE("x","y",o,n),r&&(o.x=Qe(o.x)),i&&(o.y=Qe(o.y)),o}function tC(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)Cr(s,o);return[r,i]}var eZ=["#4269d0","#efb118","#ff725c","#6cc5b0","#3ca951","#ff8ab7","#a463f2","#97bbf5","#9c6b4e","#9498a0"],oC=new Map([["accent",KI],["category10",QI],["dark2",JI],["observable10",eZ],["paired",tT],["pastel1",eT],["pastel2",nT],["set1",rT],["set2",iT],["set3",oT],["tableau10",sT]]);function sC(e){return e!=null&&oC.has(`${e}`.toLowerCase())}var eC=new Map([...oC,["brbg",Qs(lx,ux)],["prgn",Qs(fx,dx)],["piyg",Qs(hx,px)],["puor",Qs(mx,yx)],["rdbu",Qs(Wp,tf)],["rdgy",Qs(gx,bx)],["rdylbu",Qs(Xp,ef)],["rdylgn",Qs(xx,_x)],["spectral",Qs(wx,vx)],["burd",nC(Wp,tf)],["buylrd",nC(Xp,ef)],["blues",gn(Wx,Xx)],["greens",gn(Hx,Zx)],["greys",gn(Qx,Kx)],["oranges",gn(r1,i1)],["purples",gn(Jx,t1)],["reds",gn(e1,n1)],["turbo",Ks(h1)],["viridis",Ks(m1)],["magma",Ks(y1)],["inferno",Ks(g1)],["plasma",Ks(b1)],["cividis",Ks(o1)],["cubehelix",Ks(s1)],["warm",Ks(c1)],["cool",Ks(l1)],["bugn",gn(Sx,Ix)],["bupu",gn(Tx,Ex)],["gnbu",gn(Mx,Ax)],["orrd",gn(Nx,Rx)],["pubu",gn(kx,Fx)],["pubugn",gn(Ox,Dx)],["purd",gn(Lx,Cx)],["rdpu",gn(Bx,Px)],["ylgn",gn(zx,qx)],["ylgnbu",gn(Ux,$x)],["ylorbr",gn(jx,Vx)],["ylorrd",gn(Yx,Gx)],["rainbow",rC(u1)],["sinebow",rC(d1)]]);function gn(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 Qs(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 nC(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 rC(e){return({length:t})=>Ln(e,Math.floor(t)+1).slice(0,-1)}function hE(e){let t=`${e}`.toLowerCase();if(!eC.has(t))throw new Error(`unknown ordinal scheme: ${t}`);return eC.get(t)}function Em(e,t){let n=hE(e),r=typeof n=="function"?n({length:t}):n;return r.length!==t?r.slice(0,t):r}function aC(e,t="greys"){let n=new Set,[r,i]=Em(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 iC=new Map([["brbg",ux],["prgn",dx],["piyg",px],["puor",yx],["rdbu",tf],["rdgy",bx],["rdylbu",ef],["rdylgn",_x],["spectral",vx],["burd",e=>tf(1-e)],["buylrd",e=>ef(1-e)],["blues",Xx],["greens",Zx],["greys",Kx],["purples",t1],["reds",n1],["oranges",i1],["turbo",h1],["viridis",m1],["magma",y1],["inferno",g1],["plasma",b1],["cividis",o1],["cubehelix",s1],["warm",c1],["cool",l1],["bugn",Ix],["bupu",Ex],["gnbu",Ax],["orrd",Rx],["pubugn",Dx],["pubu",Fx],["purd",Cx],["rdpu",Px],["ylgnbu",$x],["ylgn",qx],["ylorbr",Vx],["ylorrd",Gx],["rainbow",u1],["sinebow",d1]]);function Mf(e){let t=`${e}`.toLowerCase();if(!iC.has(t))throw new Error(`unknown quantitative scheme: ${t}`);return iC.get(t)}var nZ=new Set(["brbg","prgn","piyg","puor","rdbu","rdgy","rdylbu","rdylgn","spectral","burd","buylrd"]);function cC(e){return e!=null&&nZ.has(`${e}`.toLowerCase())}var mE=e=>t=>e(1-t),pE=[0,1],lC=new Map([["number",we],["rgb",oi],["hsl",lS],["hcl",uS],["lab",G0]]);function yE(e){let t=`${e}`.toLowerCase();if(!lC.has(t))throw new Error(`unknown interpolator: ${t}`);return lC.get(t)}function Nf(e,t,n,{type:r,nice:i,clamp:o,zero:s,domain:a=gC(e,n),unknown:c,round:l,scheme:u,interval:f,range:d=fe.get(e)===vl?sZ(n,a):fe.get(e)===Sl?aZ(n,a):fe.get(e)===Il?pE:void 0,interpolate:h=fe.get(e)===zr?u==null&&d!==void 0?oi:Mf(u!==void 0?u:r==="cyclical"?"rainbow":"turbo"):l?Qc:we,reverse:p}){if(f=Do(f,r),(r==="cyclical"||r==="sequential")&&(r="linear"),typeof h!="function"&&(h=yE(h)),p=!!p,d!==void 0){let y=(a=qe(a)).length,b=(d=qe(d)).length;if(y!==b){if(h.length===1)throw new Error("invalid piecewise interpolator");h=po(h,d),d=void 0}}if(h.length===1?(p&&(h=mE(h),p=!1),d===void 0&&(d=Float64Array.from(a,(y,b)=>b/(a.length-1)),d.length===2&&(d=pE)),t.interpolate((d===pE?dn:Mm)(h))):t.interpolate(h),s){let[y,b]=ae(a);(y>0||b<0)&&(a=Xa(a),js(a)!==Math.sign(y)?a[a.length-1]=0:a[0]=0)}return p&&(a=Aa(a)),t.domain(a).unknown(c),i&&(t.nice(rZ(i,r)),a=t.domain()),d!==void 0&&t.range(d),o&&t.clamp(o),{type:r,domain:a,range:d,scale:t,interpolate:h,interval:f}}function rZ(e,t){return e===!0?void 0:typeof e=="number"?e:m5(e,t)}function uC(e,t,n){return Nf(e,ks(),t,n)}function fC(e,t,n){return gE(e,t,{...n,exponent:.5})}function gE(e,t,{exponent:n=1,...r}){return Nf(e,Cp().exponent(n),t,{...r,type:"pow"})}function dC(e,t,{base:n=10,domain:r=cZ(t),...i}){return Nf(e,Fp().base(n),t,{...i,domain:r})}function hC(e,t,{constant:n=1,...r}){return Nf(e,Lp().constant(n),t,r)}function pC(e,t,{range:n,quantiles:r=n===void 0?5:(n=[...n]).length,n:i=r,scheme:o="rdylbu",domain:s=lZ(t),unknown:a,interpolate:c,reverse:l}){return n===void 0&&(n=c!==void 0?Ln(c,i):fe.get(e)===zr?Em(o,i):void 0),s.length>0&&(s=Bp(s,n===void 0?{length:i}:n).quantiles()),K1(e,t,{domain:s,range:n,reverse:l,unknown:a})}function mC(e,t,{range:n,n:r=n===void 0?5:(n=[...n]).length,scheme:i="rdylbu",domain:o=gC(e,t),unknown:s,interpolate:a,reverse:c}){let[l,u]=ae(o),f;return n===void 0?(f=Tn(l,u,r),f[0]<=l&&f.splice(0,1),f[f.length-1]>=u&&f.pop(),r=f.length+1,n=a!==void 0?Ln(a,r):fe.get(e)===zr?Em(i,r):void 0):(f=Ln(we(l,u),r+1).slice(1,-1),l instanceof Date&&(f=f.map(d=>new Date(d)))),js(qe(o))<0&&f.reverse(),K1(e,t,{domain:f,range:n,reverse:c,unknown:s})}function K1(e,t,{domain:n=[0],unknown:r,scheme:i="rdylbu",interpolate:o,range:s=o!==void 0?Ln(o,n.length+1):fe.get(e)===zr?Em(i,n.length+1):void 0,reverse:a}){n=qe(n);let c=js(n);if(!isNaN(c)&&!iZ(n,c))throw new Error(`the ${e} scale has a non-monotonic domain`);return a&&(s=Aa(s)),{type:"threshold",scale:Pp(c<0?Aa(n):n,s===void 0?[]:s).unknown(r),domain:n,range:s}}function iZ(e,t){for(let n=1,r=e.length,i=e[0];n<r;++n){let o=Xn(i,i=e[n]);if(o!==0&&o!==t)return!1}return!0}function yC(e){return{type:"identity",scale:E5(fe.get(e))?Dp():t=>t}}function Af(e,t=uf){return e.length?[ce(e,({value:n})=>n===void 0?n:ce(n,t)),$t(e,({value:n})=>n===void 0?n:$t(n,t))]:[0,1]}function gC(e,t){let n=fe.get(e);return(n===vl||n===Il||n===Sl?oZ:Af)(t)}function oZ(e){return[0,e.length?$t(e,({value:t})=>t===void 0?t:$t(t,uf)):1]}function sZ(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/$t(i);return o<1?i.map(s=>s*o):i}function aZ(e,t){let n=Bi(e,({value:o})=>o===void 0?NaN:Bi(o,Math.abs)),r=t.map(o=>12*o/n),i=60/$t(r);return i<1?r.map(o=>o*i):r}function cZ(e){for(let{value:t}of e)if(t!==void 0)for(let n of t){if(n>0)return Af(e,ir);if(n<0)return Af(e,qa)}return[1,10]}function lZ(e){let t=[];for(let{value:n}of e)if(n!==void 0)for(let r of n)t.push(r);return t}function Mm(e){return(t,n)=>r=>e(t+r*(n-t))}function J1(e,t,n,r,{type:i,nice:o,clamp:s,domain:a=Af(r),unknown:c,pivot:l=0,scheme:u,range:f,symmetric:d=!0,interpolate:h=fe.get(e)===zr?u==null&&f!==void 0?oi:Mf(u!==void 0?u:"rdbu"):we,reverse:p}){l=+l,a=qe(a);let[y,b]=a;if(a.length>2&&qn(`Warning: the diverging ${e} scale domain contains extra elements.`),Xn(y,b)<0&&([y,b]=[b,y],p=!p),y=Math.min(y,l),b=Math.max(b,l),typeof h!="function"&&(h=yE(h)),f!==void 0&&(h=h.length===1?Mm(h)(...f):po(h,f)),p&&(h=mE(h)),d){let m=n.apply(l),g=m-n.apply(y),x=n.apply(b)-m;g<x?y=n.invert(m-x):g>x&&(b=n.invert(m+g))}return t.domain([y,l,b]).unknown(c).interpolator(h),s&&t.clamp(s),o&&t.nice(o),{type:i,domain:[y,b],pivot:l,interpolate:h,scale:t}}function bC(e,t,n){return J1(e,Gp(),uZ,t,n)}function xC(e,t,n){return bE(e,t,{...n,exponent:.5})}function bE(e,t,{exponent:n=1,...r}){return J1(e,cx().exponent(n=+n),hZ(n),t,{...r,type:"diverging-pow"})}function _C(e,t,{base:n=10,pivot:r=1,domain:i=Af(t,r<0?qa:ir),...o}){return J1(e,sx().base(n=+n),fZ,t,{domain:i,pivot:r,...o})}function wC(e,t,{constant:n=1,...r}){return J1(e,ax().constant(n=+n),pZ(n),t,r)}var uZ={apply(e){return e},invert(e){return e}},fZ={apply:Math.log,invert:Math.exp},dZ={apply(e){return Math.sign(e)*Math.sqrt(Math.abs(e))},invert(e){return Math.sign(e)*(e*e)}};function hZ(e){return e===.5?dZ:{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 pZ(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 vC(e,t,n,r){return Nf(e,t,n,r)}function SC(e,t,n){return vC(e,rx(),t,n)}function IC(e,t,n){return vC(e,ix(),t,n)}var Rf=Symbol("ordinal");function EC(e,t,n,{type:r,interval:i,domain:o,range:s,reverse:a,hint:c}){return i=Do(i,r),o===void 0&&(o=OC(n,i,e)),(r==="categorical"||r===Rf)&&(r="ordinal"),a&&(o=Aa(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 MC(e,t,{type:n,interval:r,domain:i,range:o,scheme:s,unknown:a,...c}){r=Do(r,n),i===void 0&&(i=OC(t,r,e));let l;if(fe.get(e)===_f)l=mZ(t),o=o===void 0?yZ(l):Yt(o,wf);else if(fe.get(e)===zr&&(o===void 0&&(n==="ordinal"||n===Rf)&&(o=aC(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=Mf(s),f=o[0],d=o[1]-o[0];o=({length:h})=>Ln(p=>u(f+d*p),h)}else o=hE(s);if(a===Rp)throw new Error(`implicit unknown on ${e} scale is not supported`);return EC(e,ll().unknown(a),t,{...c,type:n,domain:i,range:o,hint:l})}function AC(e,t,{align:n=.5,padding:r=.5,...i}){return RC(LI().align(n).padding(r),t,i,e)}function NC(e,t,{align:n=.5,padding:r=.1,paddingInner:i=r,paddingOuter:o=e==="fx"||e==="fy"?0:r,...s}){return RC(Ua().align(n).paddingInner(i).paddingOuter(o),t,s,e)}function RC(e,t,n,r){let{round:i}=n;return i!==void 0&&e.round(i=!!i),e=EC(r,e,t,n),e.round=i,e}function OC(e,t,n){let r=new kr;for(let{value:i,domain:o}of e){if(o!==void 0)return o();if(i!==void 0)for(let s of i)r.add(s)}if(t!==void 0){let[i,o]=ae(r).map(t.floor,t);return t.range(i,t.offset(o))}if(r.size>1e4&&fe.get(n)===mi)throw new Error(`implicit ordinal domain of ${n} scale has more than 10,000 values`);return lo(r,fn)}function TC(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 mZ(e){return{fill:TC(e,"fill"),stroke:TC(e,"stroke")}}function yZ(e){return ne(e.fill)?hT:I1}function Am(e,{label:t,inset:n=0,insetTop:r=n,insetRight:i=n,insetBottom:o=n,insetLeft:s=n,round:a,nice:c,clamp:l,zero:u,align:f,padding:d,projection:h,facet:{label:p=t}={},...y}={}){let b={};for(let[m,g]of e){let x=y[m],_=UC(m,g,{round:fe.get(m)===mi?a:void 0,nice:c,clamp:l,zero:u,align:f,padding:d,projection:h,...x});if(_){let{label:v=m==="fx"||m==="fy"?p:t,percent:w,transform:T,inset:A,insetTop:R=A!==void 0?A:m==="y"?r:0,insetRight:I=A!==void 0?A:m==="x"?i:0,insetBottom:E=A!==void 0?A:m==="y"?o:0,insetLeft:O=A!==void 0?A:m==="x"?s:0}=x||{};if(T==null)T=void 0;else if(typeof T!="function")throw new Error("invalid scale transform; not a function");_.percent=!!w,_.label=v===void 0?gZ(g,_):v,_.transform=T,m==="x"||m==="fx"?(_.insetLeft=+O,_.insetRight=+I):(m==="y"||m==="fy")&&(_.insetTop=+R,_.insetBottom=+E),b[m]=_}}return b}function _E(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]=zC(i),n[r]=o,o.type=s,a!=null&&(o.interval=a),c!=null&&(o.label=c)}return n}function CC(e,t){let{x:n,y:r,fx:i,fy:o}=e,s=i||o?n_(t):t;i&&DC(i,s),o&&kC(o,s);let a=i||o?wE(e,t):t;n&&DC(n,a),r&&kC(r,a)}function gZ(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!Lo(t)&&t.percent&&(n=`${n} (%)`),{inferred:!0,toString:()=>n}}function e_(e){return Math.sign(js(e.domain()))*Math.sign(js(e.range()))}function n_(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 wE({fx:e,fy:t},n){let{marginTop:r,marginRight:i,marginBottom:o,marginLeft:s,width:a,height:c}=n_(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 DC(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)],Lo(e)||(e.range=PC(e)),e.scale.range(e.range)}BC(e)}function kC(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],Lo(e)?e.range.reverse():e.range=PC(e),e.scale.range(e.range)}BC(e)}function BC(e){e.round===void 0&&_Z(e)&&bZ(e)<=30&&e.scale.round(!0)}function bZ({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 PC(e){let t=e.scale.domain().length+vE(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 r_(e,t,n){return UC(e,n===void 0?void 0:[{hint:n}],{...t})}function UC(e,t=[],n={}){let r=xZ(e,t,n);if(n.type===void 0&&n.domain===void 0&&n.range===void 0&&n.interval==null&&e!=="fx"&&e!=="fy"&&Lo({type:r})){let i=t.map(({value:o})=>o).filter(o=>o!==void 0);i.some(Oe)?qn(`Warning: some data associated with the ${e} scale are dates. Dates are typically associated with a "utc" or "time" scale rather than a "${Of(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 "${Of(r)}".`):i.some(x5)?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 "${Of(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 "${Of(r)}".`):i.some(_5)&&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 "${Of(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 "${Of(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=t_(t,n,Qe);break;case"identity":switch(fe.get(e)){case mi:n=t_(t,n,Qe);break;case _f:n=t_(t,n,wZ);break}break;case"utc":case"time":n=t_(t,n,p5);break}switch(r){case"diverging":return bC(e,t,n);case"diverging-sqrt":return xC(e,t,n);case"diverging-pow":return bE(e,t,n);case"diverging-log":return _C(e,t,n);case"diverging-symlog":return wC(e,t,n);case"categorical":case"ordinal":case Rf:return MC(e,t,n);case"cyclical":case"sequential":case"linear":return uC(e,t,n);case"sqrt":return fC(e,t,n);case"threshold":return K1(e,t,n);case"quantile":return pC(e,t,n);case"quantize":return mC(e,t,n);case"pow":return gE(e,t,n);case"log":return dC(e,t,n);case"symlog":return hC(e,t,n);case"utc":return IC(e,t,n);case"time":return SC(e,t,n);case"point":return AC(e,t,n);case"band":return NC(e,t,n);case"identity":return yC(e);case void 0:return;default:throw new Error(`unknown scale type: ${r}`)}}function Of(e){return typeof e=="symbol"?e.description:e}function FC(e){return typeof e=="string"?`${e}`.toLowerCase():e}var LC={toString:()=>"projection"};function xZ(e,t,{type:n,domain:r,range:i,scheme:o,pivot:s,projection:a}){if(n=FC(n),e==="fx"||e==="fy")return"band";(e==="x"||e==="y")&&a!=null&&(n=LC);for(let l of t){let u=FC(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===LC)return;if(n!==void 0)return n;if(r===void 0&&!t.some(({value:l})=>l!==void 0))return;let c=fe.get(e);if(c===vl)return"sqrt";if(c===Il||c===Sl)return"linear";if(c===_f)return"ordinal";if((r||i||[]).length>2)return xE(c);if(r!==void 0){if(Ae(r))return xE(c);if(Oe(r))return"utc"}else{let l=t.map(({value:u})=>u).filter(u=>u!==void 0);if(l.some(Ae))return xE(c);if(l.some(Oe))return"utc"}if(c===zr){if(s!=null||cC(o))return"diverging";if(sC(o))return"categorical"}return"linear"}function xE(e){switch(e){case mi:return"point";case zr:return Rf;default:return"ordinal"}}function Lo({type:e}){return e==="ordinal"||e==="point"||e==="band"||e===Rf}function vE({type:e}){return e==="threshold"}function _Z({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 t_(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 wZ(e){return Yt(e,wf)}function Co(e={}){let t;for(let n in e)if(fe.has(n)&&Ro(e[n])){if(t!==void 0)throw new Error("ambiguous scale definition; multiple scales found");t=zC(r_(n,e[n]))}if(t===void 0)throw new Error("invalid scale definition; no scale found");return t}function $C(e){return t=>{if(!fe.has(t=`${t}`))throw new Error(`unknown scale: ${t}`);return e[t]}}function zC({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:Xa(n),...r!==void 0&&{range:Xa(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 jC(e,t,n={}){let r=.5-De,i=.5+De,o=.5+De,s=.5-De;for(let{marginTop:y,marginRight:b,marginBottom:m,marginLeft:g}of t)y>r&&(r=y),b>i&&(i=b),m>o&&(o=m),g>s&&(s=g);let{margin:a,marginTop:c=a!==void 0?a:r,marginRight:l=a!==void 0?a:i,marginBottom:u=a!==void 0?a:o,marginLeft:f=a!==void 0?a:s}=n;c=+c,l=+l,u=+u,f=+f;let{width:d=640,height:h=vZ(e,n,{width:d,marginTopDefault:r,marginRightDefault:i,marginBottomDefault:o,marginLeftDefault:s})+Math.max(0,c-r+u-o)}=n;d=+d,h=+h;let p={width:d,height:h,marginTop:c,marginRight:l,marginBottom:u,marginLeft:f};if(e.fx||e.fy){let{margin:y,marginTop:b=y!==void 0?y:c,marginRight:m=y!==void 0?y:l,marginBottom:g=y!==void 0?y:u,marginLeft:x=y!==void 0?y:f}=n.facet??{};b=+b,m=+m,g=+g,x=+x,p.facet={marginTop:b,marginRight:m,marginBottom:g,marginLeft:x}}return p}function vZ({x:e,y:t,fy:n,fx:r},{projection:i,aspectRatio:o},{width:s,marginTopDefault:a,marginRightDefault:c,marginBottomDefault:l,marginLeftDefault:u}){let f=n?n.scale.domain().length:1,d=J5(i);if(d){let p=r?r.scale.domain().length:1,y=(1.1*f-.1)/(1.1*p-.1)*d,b=Math.max(.1,Math.min(10,y));return Math.round((s-u-c)*b+a+l)}let h=t?Lo(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=qC("y",t)/(qC("x",e)*o),y=r?r.scale.bandwidth():1,b=n?n.scale.bandwidth():1,m=y*(s-u-c)-e.insetLeft-e.insetRight;return(p*m+t.insetTop+t.insetBottom)/b+a+l}return!!(t||n)*Math.max(1,Math.min(60,h*f))*20+!!r*30+60}function qC(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 YC(e,t){let{fx:n,fy:r}=Am(e,t),i=n?.scale.domain(),o=r?.scale.domain();return i&&o?_0(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 GC(e,{x:t,y:n}){return t&&=ME(t),n&&=ME(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 o_(e,{fx:t,fy:n}){let r=or(e),i=t?.value,o=n?.value;return t&&n?Ci(r,s=>(s.fx=i[s[0]],s.fy=o[s[0]],s),s=>i[s],s=>o[s]):t?Ci(r,s=>(s.fx=i[s[0]],s),s=>i[s]):Ci(r,s=>(s.fy=o[s[0]],s),s=>o[s])}function WC(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 XC(e){let t=[],n=new Uint32Array(En(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 SZ=new Map([["top",SE],["right",EE],["bottom",IE],["left",TE],["top-left",i_(SE,TE)],["top-right",i_(SE,EE)],["bottom-left",i_(IE,TE)],["bottom-right",i_(IE,EE)],["top-empty",TZ],["right-empty",AZ],["bottom-empty",EZ],["left-empty",MZ],["empty",NZ]]);function HC(e){if(e==null)return null;let t=SZ.get(`${e}`.toLowerCase());if(t)return t;throw new Error(`invalid facet anchor: ${e}`)}var VC=new WeakMap;function ME(e){let t=VC.get(e);return t||VC.set(e,t=new Hn(Yt(e,(n,r)=>[n,r]))),t}function nc(e,t){return ME(e).get(t)}function IZ(e,t,n){return t=Gs(t),n=Gs(n),e.find(r=>Object.is(Gs(r.x),t)&&Object.is(Gs(r.y),n))}function s_(e,t,n){return IZ(e,t,n)?.empty}function SE(e,{y:t},{y:n}){return t?nc(t,n)===0:!0}function IE(e,{y:t},{y:n}){return t?nc(t,n)===t.length-1:!0}function TE(e,{x:t},{x:n}){return t?nc(t,n)===0:!0}function EE(e,{x:t},{x:n}){return t?nc(t,n)===t.length-1:!0}function TZ(e,{y:t},{x:n,y:r,empty:i}){if(i)return!1;if(!t)return;let o=nc(t,r);if(o>0)return s_(e,n,t[o-1])}function EZ(e,{y:t},{x:n,y:r,empty:i}){if(i)return!1;if(!t)return;let o=nc(t,r);if(o<t.length-1)return s_(e,n,t[o+1])}function MZ(e,{x:t},{x:n,y:r,empty:i}){if(i)return!1;if(!t)return;let o=nc(t,n);if(o>0)return s_(e,t[o-1],r)}function AZ(e,{x:t},{x:n,y:r,empty:i}){if(i)return!1;if(!t)return;let o=nc(t,n);if(o<t.length-1)return s_(e,t[o+1],r)}function NZ(e,t,{empty:n}){return n}function i_(e,t){return function(){return e.apply(null,arguments)&&t.apply(null,arguments)}}function a_(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 wt=class{constructor(t,n={},r={},i){let{facet:o="auto",facetAnchor:s,fx:a,fy:c,sort:l,dx:u=0,dy:f=0,margin:d=0,marginTop:h=d,marginRight:p=d,marginBottom:y=d,marginLeft:b=d,clip:m=i?.clip,channels:g,tip:x,render:_}=r;if(this.data=t,this.sort=Oo(l)?l:null,this.initializer=Se(r).initializer,this.transform=this.initializer?r.transform:mn(r).transform,o===null||o===!1?this.facet=null:(this.facet=Ke(o===!0?"include":o,"facet",["auto","include","exclude","super"]),this.fx=t===Ga&&typeof a=="string"?[a]:a,this.fy=t===Ga&&typeof c=="string"?[c]:c),this.facetAnchor=HC(s),n=bm(n),g!==void 0&&(n={...RZ(g),...n}),i!==void 0&&(n={...X1(this,r,i),...n}),this.channels=Object.fromEntries(Object.entries(n).map(([v,w])=>{if($r(w.value)){let{value:T,label:A=w.label,scale:R=w.scale}=w.value;w={...w,label:A,scale:R,value:T}}if(t===Ga&&typeof w.value=="string"){let{value:T}=w;w={...w,value:[T]}}return[v,w]}).filter(([v,{value:w,optional:T}])=>{if(w!=null)return!0;if(T)return!1;throw new Error(`missing channel value: ${v}`)})),this.dx=+u,this.dy=+f,this.marginTop=+h,this.marginRight=+p,this.marginBottom=+y,this.marginLeft=+b,this.clip=Z1(m),this.tip=OZ(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:w}=n[v];if(!(w!=="x"&&w!=="y"))throw new Error("super-faceting cannot use x or y")}}_!=null&&(this.render=Df(_,this.render))}initialize(t,n,r){let i=qe(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=qe(i)),t!==void 0&&(t.original=o);let s=Y1(this.channels,i);return this.sort!=null&&$5(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"&&dE(i,o,n,r.projection)}}scale(t,n,r){let i=If(t,n);return r.projection&&this.project(t,i,r),i}};function Je(...e){return e.plot=wt.prototype.plot,e}function Df(e,t){if(e==null)return t===null?void 0:t;if(t==null)return e===null?void 0:e;if(typeof e!="function")throw new TypeError(`invalid render transform: ${e}`);if(typeof t!="function")throw new TypeError(`invalid render transform: ${t}`);return function(n,r,i,o,s,a){return e.call(this,n,r,i,o,s,(c,l,u,f,d)=>t.call(this,c,l,u,f,d,a))}}function RZ(e){return Object.fromEntries(Object.entries(bm(e)).map(([t,n])=>(n=typeof n=="string"?{value:n,label:t}:pi(n),n.filter===void 0&&n.scale==null&&(n={...n,filter:null}),[t,n])))}function OZ(e){return e===!0?"xy":e===!1||e==null?null:typeof e=="string"?Ke(e,"tip",["x","y","xy"]):e}function ji(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 ZC=new WeakMap;function AE(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:Df(function(u,f,d,h,p,y){p={...p,pointerSticky:!1};let b=p.ownerSVGElement,{data:m}=p.getMarkState(this),g=ZC.get(b);g||ZC.set(b,g={sticky:!1,roots:[],renders:[]});let x=g.renders.push(X)-1,{x:_,y:v,fx:w,fy:T}=f,A=w?w(u.fx)-h.marginLeft:0,R=T?T(u.fy)-h.marginTop:0;_?.bandwidth&&(A+=_.bandwidth()/2),v?.bandwidth&&(R+=v.bandwidth()/2);let I=u.fi!=null,E;if(I){let Y=g.facetStates;Y||(g.facetStates=Y=new Map),E=Y.get(this),E||Y.set(this,E=new Map)}let[O,k]=yn(this,h),{px:S,py:M}=d,N=S?Y=>S[Y]:NE(d,O),F=M?Y=>M[Y]:RE(d,k),B,C,P,U;function $(Y,rt){if(I)if(U&&(U=cancelAnimationFrame(U)),Y==null)E.delete(u.fi);else{E.set(u.fi,rt),U=requestAnimationFrame(()=>{U=null;for(let[q,H]of E)if(H<rt||H===rt&&q<u.fi){Y=null;break}X(Y)});return}X(Y)}function X(Y){if(B===Y&&P===g.sticky)return;B=Y,P=p.pointerSticky=g.sticky;let rt=B==null?[]:[B];I&&(rt.fx=u.fx,rt.fy=u.fy,rt.fi=u.fi);let q=y(rt,f,d,h,p);if(C){if(I){let H=C.parentNode,ot=C.getAttribute("transform"),z=q.getAttribute("transform");ot?q.setAttribute("transform",ot):q.removeAttribute("transform"),z?H.setAttribute("transform",z):H.removeAttribute("transform"),q.removeAttribute("aria-label"),q.removeAttribute("aria-description"),q.removeAttribute("aria-hidden")}C.replaceWith(q)}return g.roots[x]=C=q,B==null&&E?.size>1||p.dispatchValue(B==null?null:m[B]),q}function tt(Y){if(g.sticky||Y.pointerType==="mouse"&&Y.buttons===1)return;let[rt,q]=Fn(Y);rt-=A,q-=R;let H=rt<h.marginLeft||rt>h.width-h.marginRight?1:e,ot=q<h.marginTop||q>h.height-h.marginBottom?1:t,z=null,Lt=s*s;for(let dt of u){let Wt=H*(N(dt)-rt),Xt=ot*(F(dt)-q),et=Wt*Wt+Xt*Xt;et<=Lt&&(z=dt,Lt=et)}if(z!=null&&(e!==1||t!==1)){let dt=N(z)-rt,Wt=F(z)-q;Lt=dt*dt+Wt*Wt}$(z,Lt)}function nt(Y){Y.pointerType==="mouse"&&B!=null&&(g.sticky&&g.roots.some(rt=>rt?.contains(Y.target))||(g.sticky?(g.sticky=!1,g.renders.forEach(rt=>rt(null))):(g.sticky=!0,X(B)),Y.stopImmediatePropagation()))}function st(Y){Y.pointerType==="mouse"&&(g.sticky||$(null))}return b.addEventListener("pointerenter",tt),b.addEventListener("pointermove",tt),b.addEventListener("pointerdown",nt),b.addEventListener("pointerleave",st),X(null)},c)}}function kf(e){return AE(1,1,e)}function Ff(e){return AE(1,.01,e)}function El(e){return AE(.01,1,e)}function NE({x1:e,x2:t,x:n=e},r){return e&&t?i=>(e[i]+t[i])/2:n?i=>n[i]:()=>r}function RE({y1:e,y2:t,y:n=e},r){return e&&t?i=>(e[i]+t[i])/2:n?i=>n[i]:()=>r}function c_(e){return Lo(e)&&e.interval===void 0?void 0:"tabular-nums"}function QC(e,t){let{label:n=e.label,tickSize:r=6,width:i=240,height:o=44+r,marginTop:s=18,marginRight:a=0,marginBottom:c=16+r,marginLeft:l=0,style:u,ticks:f=(i-l-a)/64,tickFormat:d,fontVariant:h=c_(e),round:p=!0,opacity:y,className:b}=t,m=tc(t);b=Tf(b),y=ie(y)[1],d===null&&(d=()=>null);let g=ct("svg",m).attr("class",`${b}-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(.${b}-ramp) {
22
+ ${r}`:e==="top"?(t,r)=>`${r}
23
+ ${t}`:(t,r)=>`${t}
24
+ ${r}`}function Kst(e){return e==="time"?mI:e==="utc"?xb:Hst}function oV(e,t,r){let n=de(fv(t,(i,o)=>Math.abs(o-i)));if(n<1e3)return rV("millisecond","utc",r);for(let[i,o,s,a]of Kst(e)){if(n>a||i==="hour"&&!n)break;if(t.every(c=>o.floor(c)>=c))return rV(i,s,r)}}function xp(e,t,r){return(n,i,o)=>{let s=e(n,i),a=t(n,i),c=i-tl(o);return i!==c&&o[c]!==void 0&&a===t(o[c],c)?s:r(s,a)}}var sd=Object.getPrototypeOf(Uint8Array),Qst=Object.prototype.toString,TN=Symbol("reindex");function Tt(e,t,r){let n=typeof t;return n==="string"?sV(e,AN(t),r):n==="function"?sV(e,t,r):n==="number"||t instanceof Date||n==="boolean"?fe(e,Qr(t),r):typeof t?.transform=="function"?aV(t.transform(e),r):Jst(aV(t,r),e?.[TN])}function Jst(e,t){return t?vb(e,t):e}function sV(e,t,r){return fe(e,r?.prototype instanceof sd?tat(t):t,r)}function aV(e,t){return t===void 0?Sr(e):e instanceof t?e:t.prototype instanceof sd&&!(e instanceof sd)?t.from(e,MN):t.from(e)}function tat(e){return(t,r)=>MN(e(t,r))}var gu=[null],AN=e=>t=>t[e],nr={transform:ii},K={transform:e=>e};var wb=()=>1,cV=()=>!0,vr=e=>e==null?e:`${e}`,Wt=e=>e==null?e:+e;var el=e=>e?e[0]:void 0,bu=e=>e?e[1]:void 0,lV=e=>e?e[2]:void 0,Qr=e=>()=>e;function vp(e){let t=+`${e}`.slice(1)/100;return(r,n)=>Hn(r,t,n)}function Cr(e){return e instanceof sd?e:fe(e,MN,Float64Array)}function MN(e){return e==null?NaN:Number(e)}function uV(e){return fe(e,EN)}function EN(e){return e instanceof Date&&!isNaN(e)?e:typeof e=="string"?bb(e):e==null||isNaN(e=+e)?void 0:new Date(e)}function cr(e,t){return e===void 0&&(e=t),e===null?[void 0,"none"]:wu(e)?[void 0,e]:[e,void 0]}function Ae(e,t){return e===void 0&&(e=t),e===null||typeof e=="number"?[void 0,e]:[e,void 0]}function DN(e,t,r){if(e!=null)return Ur(e,t,r)}function Ur(e,t,r){let n=`${e}`.toLowerCase();if(!r.includes(n))throw new Error(`invalid ${t}: ${e}`);return n}function Sr(e){return e==null||e instanceof Array||e instanceof sd?e:Array.from(e)}function fe(e,t,r=Array){return e==null?e:e instanceof r?e.map(t):r.from(e,t)}function xu(e,t=Array){return e instanceof t?e.slice():t.from(e)}function BN({x:e,x1:t,x2:r}){return e!==void 0||t!==void 0||r!==void 0}function ON({y:e,y1:t,y2:r}){return e!==void 0||t!==void 0||r!==void 0}function Sp(e){return BN(e)||ON(e)||e.interval!==void 0}function Jr(e){return e?.toString===Qst}function ya(e){return Jr(e)&&(e.type!==void 0||e.domain!==void 0)}function Xi(e){return Jr(e)&&typeof e.transform!="function"}function ga(e){return Xi(e)&&e.value===void 0&&e.channel===void 0}function NN(e,t,r,n=K){return t===void 0&&r===void 0?(t=0,r=e===void 0?n:e):t===void 0?t=e===void 0?0:e:r===void 0&&(r=e===void 0?0:e),[t,r]}function gr(e,t){return e===void 0&&t===void 0?[el,bu]:[e,t]}function Rn({z:e,fill:t,stroke:r}={}){return e===void 0&&([e]=cr(t)),e===void 0&&([e]=cr(r)),e}function ii(e){let t=e.length,r=new Uint32Array(t);for(let n=0;n<t;++n)r[n]=n;return r}function vb(e,t){return fe(t,r=>e[r],e.constructor)}function Ip(e){return e.length===1?(t,r)=>e(vb(r,t)):e}function rl(e,t,r){return e.subarray?e.subarray(t,r):e.slice(t,r)}function nl(e){return e!==null&&typeof e=="object"?e.valueOf():e}function bI(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 tn(e){let t;return[{transform:()=>t,label:vn(e)},r=>t=r]}function wn(e){return e==null?[e]:tn(e)}function vn(e,t){return typeof e=="string"?e:e&&e.label!==void 0?e.label:t}function Tp(e,t){return{transform(r){let n=e.transform(r),i=t.transform(r);return lr(n)||lr(i)?fe(n,(o,s)=>new Date((+n[s]+ +i[s])/2)):fe(n,(o,s)=>(+n[s]+ +i[s])/2,Float64Array)},label:e.label}}function ad(e,t){let r=FN(t?.interval,t?.type);return r?fe(e,r):e}function FN(e,t){let r=Ap(e,t);return r&&(n=>wr(n)?r.floor(n):n)}function Ap(e,t){if(e!=null){if(typeof e=="number"){0<e&&e<1&&Number.isInteger(1/e)&&(e=-1/e);let r=Math.abs(e);return e<0?{floor:n=>Math.floor(n*r)/r,offset:n=>(n*r+1)/r,range:(n,i)=>_r(Math.ceil(n*r),i*r).map(o=>o/r)}:{floor:n=>Math.floor(n/r)*r,offset:n=>n+r,range:(n,i)=>_r(Math.ceil(n/r),i/r).map(o=>o*r)}}if(typeof e=="string")return(t==="time"?SN:_b)(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 ba(e,t){if(e=Ap(e,t),e&&typeof e.range!="function")throw new Error("invalid interval: missing range method");return e}function fV(e,t){if(e=ba(e,t),e&&typeof e.ceil!="function")throw new Error("invalid interval: missing ceil method");return e}function dV(e){return _u(e)&&typeof e?.floor=="function"&&e.floor()instanceof Date}function _u(e){return typeof e?.range=="function"}function Mo(e){return e===void 0||Xi(e)?e:{value:e}}function hV(e){return e==null?null:{transform:t=>Tt(t,e,Float64Array),label:vn(e)}}function pV(e){if(!oi(e))return!1;for(let t of e)if(t!=null)return typeof t=="object"&&"0"in t&&"1"in t}function oi(e){return e&&typeof e[Symbol.iterator]=="function"}function xI(e){for(let t of e)if(t!=null)return typeof t!="object"||t instanceof Date}function ir(e){for(let t of e){if(t==null)continue;let r=typeof t;return r==="string"||r==="boolean"}}function lr(e){for(let t of e)if(t!=null)return t instanceof Date}function mV(e){for(let t of e)if(t!=null)return typeof t=="string"&&isNaN(t)&&bb(t)}function yV(e){for(let t of e)if(t!=null){if(typeof t!="string")return!1;if(t.trim())return!isNaN(t)}}function il(e){for(let t of e)if(t!=null)return typeof t=="number"}function _I(e,t){let r;for(let n of e)if(n!=null){if(!t(n))return!1;r=!0}return r}var eat=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 wu(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)||eat.has(e))}function gV(e){return typeof e=="number"&&(0<=e&&e<=1||isNaN(e))}function Se(e){return e==null||ol(e)}function ol(e){return/^\s*none\s*$/i.test(e)}function bV(e){return/^\s*round\s*$/i.test(e)}function wI(e,t){return DN(e,t,["middle","top-left","top","top-right","right","bottom-right","bottom","bottom-left","left"])}function xa(e="middle"){return wI(e,"frameAnchor")}function tl(e){if(e==null)return;let t=e[0],r=e[e.length-1];return Wn(t,r)}function xV(e={},...t){let r=e;for(let n of t)for(let i in n)if(r[i]===void 0){let o=n[i];r===e?r={...r,[i]:o}:r[i]=o}return r}function rat(e){console.warn("named iterables are deprecated; please use an object instead");let t=new Set;return Object.fromEntries(Array.from(e,r=>{let{name:n}=r;if(n==null)throw new Error("missing name");let i=`${n}`;if(i==="__proto__")throw new Error(`illegal name: ${i}`);if(t.has(i))throw new Error(`duplicate name: ${i}`);return t.add(i),[n,r]}))}function Sb(e){return oi(e)?rat(e):e}var Eo=Symbol("position"),Hi=Symbol("color"),cd=Symbol("radius"),ld=Symbol("length"),ud=Symbol("opacity"),Mp=Symbol("symbol"),_V=Symbol("projection"),Fe=new Map([["x",Eo],["y",Eo],["fx",Eo],["fy",Eo],["r",cd],["color",Hi],["opacity",ud],["symbol",Mp],["length",ld],["projection",_V]]);function wV(e){return e===Eo||e===_V}function vV(e){return e===Eo||e===cd||e===ld||e===ud}var LN=Math.sqrt(3),RN=2/LN,nat={draw(e,t){let r=Math.sqrt(t/Math.PI),n=r*RN,i=n/2;e.moveTo(0,n),e.lineTo(r,i),e.lineTo(r,-i),e.lineTo(0,-n),e.lineTo(-r,-i),e.lineTo(-r,i),e.closePath()}},kN=new Map([["asterisk",rb],["circle",Qc],["cross",nb],["diamond",ib],["diamond2",ob],["hexagon",nat],["plus",sb],["square",ab],["square2",cb],["star",lb],["times",hp],["triangle",ub],["triangle2",fb],["wye",db]]);function CN(e){return e&&typeof e.draw=="function"}function SV(e){return CN(e)?!0:typeof e!="string"?!1:kN.has(e.toLowerCase())}function Ep(e){if(e==null||CN(e))return e;let t=kN.get(`${e}`.toLowerCase());if(t)return t;throw new Error(`invalid symbol: ${e}`)}function IV(e){if(e==null||CN(e))return[void 0,e];if(typeof e=="string"){let t=kN.get(`${e}`.toLowerCase());if(t)return[void 0,t]}return[e,void 0]}function en({filter:e,sort:t,reverse:r,transform:n,initializer:i,...o}={},s){if(n===void 0&&(e!=null&&(n=$N(e)),t!=null&&!ga(t)&&(n=UN(n,VN(t))),r&&(n=UN(n,zN))),s!=null&&i!=null)throw new Error("transforms cannot be applied after initializers");return{...o,...(t===null||ga(t))&&{sort:t},transform:UN(n,s)}}function Qe({filter:e,sort:t,reverse:r,initializer:n,...i}={},o){return n===void 0&&(e!=null&&(n=$N(e)),t!=null&&!ga(t)&&(n=PN(n,VN(t))),r&&(n=PN(n,zN))),{...i,...(t===null||ga(t))&&{sort:t},initializer:PN(n,o)}}function UN(e,t){return e==null?t===null?void 0:t:t==null?e===null?void 0:e:function(r,n,i){return{data:r,facets:n}=e.call(this,r,n,i),t.call(this,Sr(r),n,i)}}function PN(e,t){return e==null?t===null?void 0:t:t==null?e===null?void 0:e:function(r,n,i,...o){let s,a,c,l,u,f;return{data:a=r,facets:c=n,channels:s}=e.call(this,r,n,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 vI(e,t){return(e.initializer!=null?Qe:en)(e,t)}function TV(e,t){return vI(t,$N(e))}function $N(e){return(t,r)=>{let n=Tt(t,e);return{data:t,facets:r.map(i=>i.filter(o=>n[o]))}}}function AV({sort:e,...t}={}){return{...vI(t,zN),sort:ga(e)?e:null}}function zN(e,t){return{data:e,facets:t.map(r=>r.slice().reverse())}}function MV({seed:e,sort:t,...r}={}){return{...vI(r,EV(e==null?Math.random:ca(e))),sort:ga(t)?t:null}}function SI(e,{sort:t,...r}={}){return{...(Xi(e)&&e.channel!==void 0?Qe:vI)(r,VN(e)),sort:ga(t)?t:null}}function VN(e){return(typeof e=="function"&&e.length!==1?iat:EV)(e)}function iat(e){return(t,r)=>{let n=(i,o)=>e(t[i],t[o]);return{data:t,facets:r.map(i=>i.slice().sort(n))}}}function EV(e){let t,r;({channel:t,value:e,order:r}={...Mo(e)});let n=t?.startsWith("-");if(n&&(t=t.slice(1)),r===void 0&&(r=n?id:Kr),typeof r!="function")switch(`${r}`.toLowerCase()){case"ascending":r=Kr;break;case"descending":r=id;break;default:throw new Error(`invalid order: ${r}`)}return(i,o,s)=>{let a;if(t===void 0)a=Tt(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)=>r(a[l],a[u]);return{data:i,facets:o.map(l=>l.slice().sort(c))}}}function Tb(e,t){return II(null,null,e,t)}function Su(e={y:"count"},t={}){let{x:r=K}=t;if(r==null)throw new Error("missing channel: x");return II(r,null,e,t)}function Iu(e={x:"count"},t={}){let{y:r=K}=t;if(r==null)throw new Error("missing channel: y");return II(null,r,e,t)}function Ab(e={fill:"count"},t={}){let{x:r,y:n}=t;if([r,n]=gr(r,n),r==null)throw new Error("missing channel: x");if(n==null)throw new Error("missing channel: y");return II(r,n,e,t)}function II(e,t,{data:r=MI,filter:n,sort:i,reverse:o,...s}={},a={}){s=qN(s,a),r=FV(r,K),i=i==null?void 0:OV("sort",i,a),n=n==null?void 0:NV("filter",n,a);let[c,l]=wn(e),[u,f]=wn(t),{z:d,fill:h,stroke:p,x1:y,x2:g,y1:m,y2:b,...x}=a,[_,v]=wn(d),[w]=cr(h),[I]=cr(p),[D,A]=wn(w),[B,M]=wn(I);return{..."z"in a&&{z:_||d},..."fill"in a&&{fill:D||h},..."stroke"in a&&{stroke:B||p},...en(x,(O,R,S)=>{let T=ad(Tt(O,e),S?.x),E=ad(Tt(O,t),S?.y),C=Tt(O,d),U=Tt(O,w),k=Tt(O,I),$=Mb(s,{z:C,fill:U,stroke:k}),z=[],V=[],Q=T&&l([]),nt=E&&f([]),st=C&&v([]),ut=U&&A([]),X=k&&M([]),at=0;for(let q of s)q.initialize(O);i&&i.initialize(O),n&&n.initialize(O);for(let q of R){let J=[];for(let ct of s)ct.scope("facet",q);i&&i.scope("facet",q),n&&n.scope("facet",q);for(let[ct,j]of vu(q,$))for(let[Qt,gt]of vu(j,E))for(let[he,pe]of vu(gt,T)){let ot={data:O};if(T&&(ot.x=he),E&&(ot.y=Qt),!(n&&!n.reduce(pe,ot))){J.push(at++),V.push(r.reduceIndex(pe,O,ot)),T&&Q.push(he),E&&nt.push(Qt),C&&st.push($===C?ct:C[pe[0]]),U&&ut.push($===U?ct:U[pe[0]]),k&&X.push($===k?ct:k[pe[0]]);for(let Me of s)Me.reduce(pe,ot);i&&i.reduce(pe,ot)}}z.push(J)}return YN(z,i,o),{data:V,facets:z}}),...!_a(s,"x")&&(c?{x:c}:{x1:y,x2:g}),...!_a(s,"y")&&(u?{y:u}:{y1:m,y2:b}),...Object.fromEntries(s.map(({name:O,output:R})=>[O,R]))}}function _a(e,...t){for(let{name:r}of e)if(t.includes(r))return!0;return!1}function jN(e,t,r=TI){let n=Object.entries(e);return t.title!=null&&e.title===void 0&&n.push(["title",uat]),t.href!=null&&e.href===void 0&&n.push(["href",EI]),n.filter(([,i])=>i!==void 0).map(([i,o])=>o===null?oat(i):r(i,o,t))}function TI(e,t,r,n=AI){let i;Jr(t)&&"reduce"in t&&(i=t.scale,t=t.reduce);let o=n(e,t,r),[s,a]=tn(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 oat(e){return{name:e,initialize(){},scope(){},reduce(){}}}function AI(e,t,r,n=Dp){let i=bI(e,r),o=n(t,i),s,a;return{label:vn(o===Ib?null:i,o.label),initialize(c){s=i===void 0?c:Tt(c,i),o.scope==="data"&&(a=o.reduceIndex(ii(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 vu(e,t){return t?Hs(Gr(e,r=>t[r]),el):[[,e]]}function Dp(e,t,r=sat){if(e==null)return r(e);if(typeof e.reduceIndex=="function")return e;if(typeof e.reduce=="function"&&Jr(e))return cat(e);if(typeof e=="function")return lat(e);if(/^p\d{2}$/i.test(e))return sl(vp(e));switch(`${e}`.toLowerCase()){case"first":return EI;case"last":return fat;case"identity":return MI;case"count":return Ib;case"distinct":return dat;case"sum":return t==null?Ib:hat;case"proportion":return BV(t,"data");case"proportion-facet":return BV(t,"facet");case"deviation":return sl(go);case"min":return sl(Oe);case"min-index":return sl(cv);case"max":return sl(de);case"max-index":return sl(av);case"mean":return DV(Lc);case"median":return DV(hs);case"variance":return sl(Kl);case"mode":return sl(Oh)}return r(e)}function sat(e){throw new Error(`invalid reduce: ${e}`)}function qN(e,t){return jN(e,t,OV)}function OV(e,t,r){return TI(e,t,r,NV)}function NV(e,t,r){return AI(e,t,r,FV)}function FV(e,t){return Dp(e,t,aat)}function aat(e){switch(`${e}`.toLowerCase()){case"x":return pat;case"y":return mat}throw new Error(`invalid group reduce: ${e}`)}function Mb(e,t){for(let r in t){let n=t[r];if(n!==void 0&&!e.some(i=>i.name===r))return n}}function YN(e,t,r){if(t){let n=t.output.transform(),i=(o,s)=>Kr(n[o],n[s]);e.forEach(o=>o.sort(i))}r&&e.forEach(n=>n.reverse())}function cat(e){return console.warn("deprecated reduce interface; implement reduceIndex instead."),{...e,reduceIndex:e.reduce.bind(e)}}function lat(e){return{reduceIndex(t,r,n){return e(vb(r,t),n)}}}function sl(e){return{reduceIndex(t,r){return e(t,n=>r[n])}}}function DV(e){return{reduceIndex(t,r){let n=e(t,i=>r[i]);return lr(r)?new Date(n):n}}}var MI={reduceIndex(e,t){return vb(t,e)}},EI={reduceIndex(e,t){return t[e[0]]}},uat={reduceIndex(e,t){let n=Hs(ds(e,o=>o.length,o=>t[o]),bu),i=n.slice(-5).reverse();if(i.length<n.length){let o=n.slice(0,-4);i[4]=[`\u2026 ${o.length.toLocaleString("en-US")} more`,gn(o,bu)]}return i.map(([o,s])=>`${o} (${s.toLocaleString("en-US")})`).join(`
25
+ `)}},fat={reduceIndex(e,t){return t[e[e.length-1]]}},Ib={label:"Frequency",reduceIndex(e){return e.length}},dat={label:"Distinct",reduceIndex(e,t){let r=new Xn;for(let n of e)r.add(t[n]);return r.size}},hat=sl(gn);function BV(e,t){return e==null?{scope:t,label:"Frequency",reduceIndex:(r,n,i=1)=>r.length/i}:{scope:t,reduceIndex:(r,n,i=1)=>gn(r,o=>n[o])/i}}var pat={reduceIndex(e,t,{x:r}){return r}},mat={reduceIndex(e,t,{y:r}){return r}};function LV(e){if(typeof e!="function")throw new Error(`invalid test function: ${e}`);return{reduceIndex(t,r,{data:n}){return r[t.find(i=>e(n[i],i,n))]}}}function Bp(e,{scale:t,type:r,value:n,filter:i,hint:o,label:s=vn(n)},a){return o===void 0&&typeof n?.transform=="function"&&(o=n.hint),GN(a,{scale:t,type:r,value:Tt(e,n),label:s,filter:i,hint:o})}function DI(e,t){return Object.fromEntries(Object.entries(e).map(([r,n])=>[r,Bp(t,n,r)]))}function Op(e,t){let r=Object.fromEntries(Object.entries(e).map(([n,{scale:i,value:o}])=>{let s=i==null?null:t[i];return[n,s==null?o:fe(o,s)]}));return r.channels=e,r}function GN(e,t){let{scale:r,value:n}=t;if(r===!0||r==="auto")switch(e){case"fill":case"stroke":case"color":t.scale=r!==!0&&_I(n,wu)?null:"color";break;case"fillOpacity":case"strokeOpacity":case"opacity":t.scale=r!==!0&&_I(n,gV)?null:"opacity";break;case"symbol":r!==!0&&_I(n,SV)?(t.scale=null,t.value=fe(n,Ep)):t.scale="symbol";break;default:t.scale=Fe.has(e)?e:null;break}else if(r===!1)t.scale=null;else if(r!=null&&!Fe.has(r))throw new Error(`unknown scale: ${r}`);return t}function kV(e,t,r,n,i){let{order:o,reverse:s,reduce:a=!0,limit:c}=i;for(let l in i){if(!Fe.has(l))continue;let{value:u,order:f=o,reverse:d=s,reduce:h=a,limit:p=c}=Mo(i[l]),y=u?.startsWith("-");if(y&&(u=u.slice(1)),f=f===void 0?y!==(u==="width"||u==="height")?UV:CV:bat(f),h==null||h===!1)continue;let g=l==="fx"||l==="fy"?gat(t,n[l]):yat(r,l);if(!g)throw new Error(`missing channel for scale: ${l}`);let m=g.value,[b=0,x=1/0]=oi(p)?p:p<0?[p]:[0,p];if(u==null)g.domain=()=>{let _=Array.from(new Xn(m));return d&&(_=_.reverse()),(b!==0||x!==1/0)&&(_=_.slice(b,x)),_};else{let _=u==="data"?e:u==="height"?RV(r,"y1","y2"):u==="width"?RV(r,"x1","x2"):WN(r,u,u==="y"?"y2":u==="x"?"x2":void 0),v=Dp(h===!0?"max":h,_);g.domain=()=>{let w=vD(ii(m),I=>v.reduceIndex(I,_),I=>m[I]);return f&&w.sort(f),d&&w.reverse(),(b!==0||x!==1/0)&&(w=w.slice(b,x)),w.map(el)}}}}function yat(e,t){for(let r in e){let n=e[r];if(n.scale===t)return n}}function gat(e,t){let r=e.original;if(r===e)return t;let n=t.value,i=t.value=[];for(let o=0;o<r.length;++o){let s=n[r[o][0]];for(let a of e[o])i[a]=s}return t}function RV(e,t,r){let n=WN(e,t),i=WN(e,r);return fe(i,(o,s)=>Math.abs(o-n[s]),Float64Array)}function WN(e,t,r){let n=e[t];if(!n&&r!==void 0&&(n=e[r]),n)return n.value;throw new Error(`missing channel: ${t}`)}function bat(e){if(e==null||typeof e=="function")return e;switch(`${e}`.toLowerCase()){case"ascending":return CV;case"descending":return UV}throw new Error(`invalid order: ${e}`)}function CV([e,t],[r,n]){return Kr(t,n)||Kr(e,r)}function UV([e,t],[r,n]){return id(t,n)||Kr(e,r)}function Eb(e,t){let r=e[t];if(r){for(;r.source;)r=r.source;return r.source===null?null:r}}function BI(e){let t,r;return(...n)=>((r?.length!==n.length||r.some((i,o)=>i!==n[o]))&&(r=n,t=e(...n)),t)}var xat=BI(e=>new Intl.NumberFormat(e)),_at=BI((e,t)=>new Intl.DateTimeFormat(e,{timeZone:"UTC",...t&&{month:t}})),wat=BI((e,t)=>new Intl.DateTimeFormat(e,{timeZone:"UTC",...t&&{weekday:t}}));function vat(e="en-US"){let t=xat(e);return r=>r!=null&&!isNaN(r)?t.format(r):void 0}function PV(e="en-US",t="short"){let r=_at(e,t);return n=>n!=null&&!isNaN(n=+new Date(Date.UTC(2e3,+n)))?r.format(n):void 0}function $V(e="en-US",t="short"){let r=wat(e,t);return n=>n!=null&&!isNaN(n=+new Date(Date.UTC(2001,0,+n)))?r.format(n):void 0}function XN(e){return bp(e,"Invalid Date")}function Sat(e="en-US"){let t=vat(e);return r=>(r instanceof Date?XN:typeof r=="number"?t:vr)(r)}var gs=Sat();var HN=0,ZN;function zV(){let e=HN;return HN=0,ZN=void 0,e}function kn(e){e!==ZN&&(ZN=e,console.warn(e),++HN)}var ur=(typeof window<"u"?window.devicePixelRatio>1:typeof it>"u")?0:.5,Iat=0;function OI(){return`plot-clip-${++Iat}`}function NI(e,{title:t,href:r,ariaLabel:n,ariaDescription:i,ariaHidden:o,target:s,fill:a,fillOpacity:c,stroke:l,strokeWidth:u,strokeOpacity:f,strokeLinejoin:d,strokeLinecap:h,strokeMiterlimit:p,strokeDasharray:y,strokeDashoffset:g,opacity:m,mixBlendMode:b,imageFilter:x,paintOrder:_,pointerEvents:v,shapeRendering:w,channels:I},{ariaLabel:D,fill:A="currentColor",fillOpacity:B,stroke:M="none",strokeOpacity:O,strokeWidth:R,strokeLinecap:S,strokeLinejoin:T,strokeMiterlimit:E,paintOrder:C}){A===null&&(a=null,c=null),M===null&&(l=null,f=null),Se(A)?!Se(M)&&(!Se(a)||I?.fill)&&(M="none"):Se(M)&&(!Se(l)||I?.stroke)&&(A="none");let[U,k]=cr(a,A),[$,z]=Ae(c,B),[V,Q]=cr(l,M),[nt,st]=Ae(f,O),[ut,X]=Ae(m);ol(Q)||(u===void 0&&(u=R),h===void 0&&(h=S),d===void 0&&(d=T),p===void 0&&!bV(d)&&(p=E),!ol(k)&&_===void 0&&(_=C));let[at,q]=Ae(u);return A!==null&&(e.fill=Ne(k,"currentColor"),e.fillOpacity=Db(z,1)),M!==null&&(e.stroke=Ne(Q,"none"),e.strokeWidth=Db(q,1),e.strokeOpacity=Db(st,1),e.strokeLinejoin=Ne(d,"miter"),e.strokeLinecap=Ne(h,"butt"),e.strokeMiterlimit=Db(p,4),e.strokeDasharray=Ne(y,"none"),e.strokeDashoffset=Ne(g,"0")),e.target=vr(s),e.ariaLabel=vr(D),e.ariaDescription=vr(i),e.ariaHidden=vr(o),e.opacity=Db(X,1),e.mixBlendMode=Ne(b,"normal"),e.imageFilter=Ne(x,"none"),e.paintOrder=Ne(_,"normal"),e.pointerEvents=Ne(v,"auto"),e.shapeRendering=Ne(w,"auto"),{title:{value:t,optional:!0,filter:null},href:{value:r,optional:!0,filter:null},ariaLabel:{value:n,optional:!0,filter:null},fill:{value:U,scale:"auto",optional:!0},fillOpacity:{value:$,scale:"auto",optional:!0},stroke:{value:V,scale:"auto",optional:!0},strokeOpacity:{value:nt,scale:"auto",optional:!0},strokeWidth:{value:at,optional:!0},opacity:{value:ut,scale:"auto",optional:!0}}}function Tat(e,t){t&&e.filter(r=>gb(t[r])).append("title").call(Mat,t)}function Aat(e,t){t&&e.filter(([r])=>gb(t[r])).append("title").call(Eat,t)}function Mat(e,t){t&&e.text(r=>gs(t[r]))}function Eat(e,t){t&&e.text(([r])=>gs(t[r]))}function ye(e,{target:t,tip:r},{ariaLabel:n,title:i,fill:o,fillOpacity:s,stroke:a,strokeOpacity:c,strokeWidth:l,opacity:u,href:f}){n&&yt(e,"aria-label",d=>n[d]),o&&yt(e,"fill",d=>o[d]),s&&yt(e,"fill-opacity",d=>s[d]),a&&yt(e,"stroke",d=>a[d]),c&&yt(e,"stroke-opacity",d=>c[d]),l&&yt(e,"stroke-width",d=>l[d]),u&&yt(e,"opacity",d=>u[d]),f&&VV(e,d=>f[d],t),r||Tat(e,i)}function fd(e,{target:t,tip:r},{ariaLabel:n,title:i,fill:o,fillOpacity:s,stroke:a,strokeOpacity:c,strokeWidth:l,opacity:u,href:f}){n&&yt(e,"aria-label",([d])=>n[d]),o&&yt(e,"fill",([d])=>o[d]),s&&yt(e,"fill-opacity",([d])=>s[d]),a&&yt(e,"stroke",([d])=>a[d]),c&&yt(e,"stroke-opacity",([d])=>c[d]),l&&yt(e,"stroke-width",([d])=>l[d]),u&&yt(e,"opacity",([d])=>u[d]),f&&VV(e,([d])=>f[d],t),r||Aat(e,i)}function Dat({ariaLabel:e,title:t,fill:r,fillOpacity:n,stroke:i,strokeOpacity:o,strokeWidth:s,opacity:a,href:c},{tip:l}){return[e,l?void 0:t,r,n,i,o,s,a,c].filter(u=>u!==void 0)}function Bb(e,t,r){let n=Gr(e,i=>t[i]);return r===void 0&&n.size>1+e.length>>1&&kn("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."),n.values()}function*FI(e,t,r,n){let{z:i}=r,{z:o}=n,s=Dat(n,r),a=[...t,...s];for(let c of o?Bb(e,o,i):[e]){let l,u;t:for(let f of c){for(let d of a)if(!wr(d[f])){u&&u.push(-1);continue t}if(l===void 0){u&&(yield u),l=s.map(d=>nl(d[f])),u=[f];continue}u.push(f);for(let d=0;d<s.length;++d)if(nl(s[d][f])!==l[d]){yield u,l=s.map(p=>nl(p[f])),u=[f];continue t}}u&&(yield u)}}function LI(e){return e===!0?e="frame":e===!1?e=null:e!=null&&(e=Ur(e,"clip",["frame","sphere"])),e}function Bat(e,t,r,n){let i,{clip:o=n.clip}=t;switch(o){case"frame":{let{width:s,height:a,marginLeft:c,marginRight:l,marginTop:u,marginBottom:f}=r,d=OI();i=`url(#${d})`,e=pt("svg:g",n).call(h=>h.append("svg:clipPath").attr("id",d).append("rect").attr("x",c).attr("y",u).attr("width",s-l-c).attr("height",a-u-f)).each(function(){this.appendChild(e.node()),e.node=()=>this});break}case"sphere":{let{projection:s}=n;if(!s)throw new Error('the "sphere" clip option requires a projection');let a=OI();i=`url(#${a})`,e.append("clipPath").attr("id",a).append("path").attr("d",xn(s)({type:"Sphere"}));break}}yt(e,"aria-label",t.ariaLabel),yt(e,"aria-description",t.ariaDescription),yt(e,"aria-hidden",t.ariaHidden),yt(e,"clip-path",i)}function Kt(e,t,r,n){Bat(e,t,r,n),yt(e,"fill",t.fill),yt(e,"fill-opacity",t.fillOpacity),yt(e,"stroke",t.stroke),yt(e,"stroke-width",t.strokeWidth),yt(e,"stroke-opacity",t.strokeOpacity),yt(e,"stroke-linejoin",t.strokeLinejoin),yt(e,"stroke-linecap",t.strokeLinecap),yt(e,"stroke-miterlimit",t.strokeMiterlimit),yt(e,"stroke-dasharray",t.strokeDasharray),yt(e,"stroke-dashoffset",t.strokeDashoffset),yt(e,"shape-rendering",t.shapeRendering),yt(e,"filter",t.imageFilter),yt(e,"paint-order",t.paintOrder);let{pointerEvents:i=n.pointerSticky===!1?"none":void 0}=t;yt(e,"pointer-events",i)}function Gt(e,t){Oat(e,"mix-blend-mode",t.mixBlendMode),yt(e,"opacity",t.opacity)}function VV(e,t,r){e.each(function(n){let i=t(n);if(i!=null){let o=this.ownerDocument.createElementNS(bo.svg,"a");o.setAttribute("fill","inherit"),o.setAttributeNS(bo.xlink,"href",i),r!=null&&o.setAttribute("target",r),this.parentNode.insertBefore(o,this).appendChild(this)}})}function yt(e,t,r){r!=null&&e.attr(t,r)}function Oat(e,t,r){r!=null&&e.style(t,r)}function Pt(e,t,{x:r,y:n},i=ur,o=ur){i+=t.dx,o+=t.dy,r?.bandwidth&&(i+=r.bandwidth()/2),n?.bandwidth&&(o+=n.bandwidth()/2),(i||o)&&e.attr("transform",`translate(${i},${o})`)}function Ne(e,t){if((e=vr(e))!==t)return e}function Db(e,t){if((e=Wt(e))!==t)return e}var Nat=/^-?([_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 Np(e){if(e===void 0)return"plot-d6a7b5";if(e=`${e}`,!Nat.test(e))throw new Error(`invalid class name: ${e}`);return e}function Fp(e,t){if(typeof t=="string")e.property("style",t);else if(t!=null)for(let r of e)Object.assign(r.style,t)}function rn({frameAnchor:e},{width:t,height:r,marginTop:n,marginRight:i,marginBottom:o,marginLeft:s}){return[/left$/.test(e)?s:/right$/.test(e)?t-i:(s+t-i)/2,/^top/.test(e)?n:/^bottom/.test(e)?r-o:(n+r-o)/2]}function Tu(e={}){let{document:t=typeof window<"u"?window.document:void 0,clip:r}=e;return{document:t,clip:LI(r)}}function pt(e,{document:t}){return ae(kc(e).call(t.documentElement))}var qV=Math.PI,al=2*qV,jV=.618;function YV({projection:e,inset:t=0,insetTop:r=t,insetRight:n=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(Jr(e)){let v;if({type:e,domain:c,inset:v,insetTop:r=v!==void 0?v:r,insetRight:n=v!==void 0?v:n,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}=WV(e));let{width:u,height:f,marginLeft:d,marginRight:h,marginTop:p,marginBottom:y}=s,g=u-d-h-o-n,m=f-p-y-r-i;if(e=e?.({width:g,height:m,clip:l,...a}),e==null)return;l=Fat(l,d,p,u-h,f-y);let b=d+o,x=p+r,_;if(c!=null){let[[v,w],[I,D]]=xn(e).bounds(c),A=Math.min(g/(I-v),m/(D-w));A>0?(b-=(A*(v+I)-g)/2,x-=(A*(w+D)-m)/2,_=Gf({point(B,M){this.stream.point(B*A+b,M*A+x)}})):kn("Warning: the projection could not be fit to the specified domain; using the default scale.")}return _??=b===0&&x===0?GV():Gf({point(v,w){this.stream.point(v+b,w+x)}}),{stream:v=>e.stream(_.stream(l(v)))}}function WV(e){switch(`${e}`.toLowerCase()){case"albers-usa":return bs(XB,.7463,.4673);case"albers":return RI(D0,.7463,.4673);case"azimuthal-equal-area":return bs(ZB,4,4);case"azimuthal-equidistant":return bs(QB,al,al);case"conic-conformal":return RI(eO,al,al);case"conic-equal-area":return RI(cu,6.1702,2.9781);case"conic-equidistant":return RI(nO,7.312,3.6282);case"equal-earth":return bs(oO,5.4133,2.6347);case"equirectangular":return bs(rO,al,qV);case"gnomonic":return bs(aO,3.4641,3.4641);case"identity":return{type:GV};case"reflect-y":return{type:Lat};case"mercator":return bs(JB,al,al);case"orthographic":return bs(lO,2,2);case"stereographic":return bs(fO,2,2);case"transverse-mercator":return bs(hO,al,al);default:throw new Error(`unknown projection type: ${e}`)}}function Fat(e,t,r,n,i){if(e===!1||e==null||typeof e=="number")return o=>o;switch(e===!0&&(e="frame"),`${e}`.toLowerCase()){case"frame":return Zh(t,r,n,i);default:throw new Error(`unknown projection clip type: ${e}`)}}function bs(e,t,r){return{type:({width:n,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(n/t,i/r)),c.translate([n/2,i/2]),c},aspectRatio:r/t}}function RI(e,t,r){let{type:n,aspectRatio:i}=bs(e,t,r);return{type:o=>{let{parallels:s,domain:a,width:c,height:l}=o,u=n(o);return s!=null&&(u.parallels(s),a===void 0&&u.fitSize([c,l],{type:"Sphere"})),u},aspectRatio:i}}var GV=Qr({stream:e=>e}),Lat=Qr(Gf({point(e,t){this.stream.point(e,-t)}}));function KN(e,t,r,n){let i=r[e],o=r[t],s=i.length,a=r[e]=new Float64Array(s).fill(NaN),c=r[t]=new Float64Array(s).fill(NaN),l,u=n.stream({point(f,d){a[l]=f,c[l]=d}});for(l=0;l<s;++l)u.point(i[l],o[l])}function XV({projection:e}={}){return e==null?!1:typeof e.stream=="function"?!0:(Jr(e)&&(e=e.type),e!=null)}function HV(e){if(typeof e?.stream=="function")return jV;if(Jr(e)&&(e=e.type),e!=null){if(typeof e!="function"){let{aspectRatio:t}=WV(e);if(t)return t}return jV}}function Au(e,t,{projection:r}){let{x:n,y:i}=e,o={};return n&&(o.x=n),i&&(o.y=i),o=Op(o,t),r&&n?.scale==="x"&&i?.scale==="y"&&KN("x","y",o,r),n&&(o.x=Cr(o.x)),i&&(o.y=Cr(o.y)),o}function ZV(e){let t=[],r=[],n={scale:"x",value:t},i={scale:"y",value:r},o={point(s,a){t.push(s),r.push(a)},lineStart(){},lineEnd(){},polygonStart(){},polygonEnd(){},sphere(){}};for(let s of e.value)qi(s,o);return[n,i]}var Rat=["#4269d0","#efb118","#ff725c","#6cc5b0","#3ca951","#ff8ab7","#a463f2","#97bbf5","#9c6b4e","#9498a0"],ej=new Map([["accent",CO],["category10",kO],["dark2",UO],["observable10",Rat],["paired",PO],["pastel1",$O],["pastel2",zO],["set1",VO],["set2",jO],["set3",qO],["tableau10",YO]]);function rj(e){return e!=null&&ej.has(`${e}`.toLowerCase())}var KV=new Map([...ej,["brbg",cl(GS,XS)],["prgn",cl(HS,ZS)],["piyg",cl(KS,QS)],["puor",cl(JS,t2)],["rdbu",cl(Q0,cp)],["rdgy",cl(e2,r2)],["rdylbu",cl(J0,lp)],["rdylgn",cl(n2,i2)],["spectral",cl(o2,s2)],["burd",QV(Q0,cp)],["buylrd",QV(J0,lp)],["blues",nn(O2,N2)],["greens",nn(F2,L2)],["greys",nn(R2,k2)],["oranges",nn(z2,V2)],["purples",nn(C2,U2)],["reds",nn(P2,$2)],["turbo",ll(K2)],["viridis",ll(J2)],["magma",ll(tI)],["inferno",ll(eI)],["plasma",ll(rI)],["cividis",ll(j2)],["cubehelix",ll(q2)],["warm",ll(W2)],["cool",ll(G2)],["bugn",nn(a2,c2)],["bupu",nn(l2,u2)],["gnbu",nn(f2,d2)],["orrd",nn(h2,p2)],["pubu",nn(g2,b2)],["pubugn",nn(m2,y2)],["purd",nn(x2,_2)],["rdpu",nn(w2,v2)],["ylgn",nn(T2,A2)],["ylgnbu",nn(S2,I2)],["ylorbr",nn(M2,E2)],["ylorrd",nn(D2,B2)],["rainbow",JV(X2)],["sinebow",JV(Z2)]]);function nn(e,t){return({length:r})=>r===1?[e[3][1]]:r===2?[e[3][1],e[3][2]]:(r=Math.max(3,Math.floor(r)),r>9?En(t,r):e[r])}function cl(e,t){return({length:r})=>r===2?[e[3][0],e[3][2]]:(r=Math.max(3,Math.floor(r)),r>11?En(t,r):e[r])}function QV(e,t){return({length:r})=>r===2?[e[3][2],e[3][0]]:(r=Math.max(3,Math.floor(r)),r>11?En(n=>t(1-n),r):e[r].slice().reverse())}function ll(e){return({length:t})=>En(e,Math.max(2,Math.floor(t)))}function JV(e){return({length:t})=>En(e,Math.floor(t)+1).slice(0,-1)}function QN(e){let t=`${e}`.toLowerCase();if(!KV.has(t))throw new Error(`unknown ordinal scheme: ${t}`);return KV.get(t)}function Ob(e,t){let r=QN(e),n=typeof r=="function"?r({length:t}):r;return n.length!==t?n.slice(0,t):n}function nj(e,t="greys"){let r=new Set,[n,i]=Ob(t,2);for(let o of e)if(o!=null)if(o===!0)r.add(i);else if(o===!1)r.add(n);else return;return[...r]}var tj=new Map([["brbg",XS],["prgn",ZS],["piyg",QS],["puor",t2],["rdbu",cp],["rdgy",r2],["rdylbu",lp],["rdylgn",i2],["spectral",s2],["burd",e=>cp(1-e)],["buylrd",e=>lp(1-e)],["blues",N2],["greens",L2],["greys",k2],["purples",U2],["reds",$2],["oranges",V2],["turbo",K2],["viridis",J2],["magma",tI],["inferno",eI],["plasma",rI],["cividis",j2],["cubehelix",q2],["warm",W2],["cool",G2],["bugn",c2],["bupu",u2],["gnbu",d2],["orrd",p2],["pubugn",y2],["pubu",b2],["purd",_2],["rdpu",v2],["ylgnbu",I2],["ylgn",A2],["ylorbr",E2],["ylorrd",B2],["rainbow",X2],["sinebow",Z2]]);function Lp(e){let t=`${e}`.toLowerCase();if(!tj.has(t))throw new Error(`unknown quantitative scheme: ${t}`);return tj.get(t)}var kat=new Set(["brbg","prgn","piyg","puor","rdbu","rdgy","rdylbu","rdylgn","spectral","burd","buylrd"]);function ij(e){return e!=null&&kat.has(`${e}`.toLowerCase())}var t3=e=>t=>e(1-t),JN=[0,1],oj=new Map([["number",Ze],["rgb",xo],["hsl",XD],["hcl",HD],["lab",Bv]]);function e3(e){let t=`${e}`.toLowerCase();if(!oj.has(t))throw new Error(`unknown interpolator: ${t}`);return oj.get(t)}function kp(e,t,r,{type:n,nice:i,clamp:o,zero:s,domain:a=hj(e,r),unknown:c,round:l,scheme:u,interval:f,range:d=Fe.get(e)===cd?$at(r,a):Fe.get(e)===ld?zat(r,a):Fe.get(e)===ud?JN:void 0,interpolate:h=Fe.get(e)===Hi?u==null&&d!==void 0?xo:Lp(u!==void 0?u:n==="cyclical"?"rainbow":"turbo"):l?Uf:Ze,reverse:p}){if(f=ba(f,n),(n==="cyclical"||n==="sequential")&&(n="linear"),typeof h!="function"&&(h=e3(h)),p=!!p,d!==void 0){let y=(a=Sr(a)).length,g=(d=Sr(d)).length;if(y!==g){if(h.length===1)throw new Error("invalid piecewise interpolator");h=Js(h,d),d=void 0}}if(h.length===1?(p&&(h=t3(h),p=!1),d===void 0&&(d=Float64Array.from(a,(y,g)=>g/(a.length-1)),d.length===2&&(d=JN)),t.interpolate((d===JN?Qr:Nb)(h))):t.interpolate(h),s){let[y,g]=Be(a);(y>0||g<0)&&(a=xu(a),tl(a)!==Math.sign(y)?a[a.length-1]=0:a[0]=0)}return p&&(a=Jl(a)),t.domain(a).unknown(c),i&&(t.nice(Cat(i,n)),a=t.domain()),d!==void 0&&t.range(d),o&&t.clamp(o),{type:n,domain:a,range:d,scale:t,interpolate:h,interval:f}}function Cat(e,t){return e===!0?void 0:typeof e=="number"?e:fV(e,t)}function sj(e,t,r){return kp(e,qc(),t,r)}function aj(e,t,r){return r3(e,t,{...r,exponent:.5})}function r3(e,t,{exponent:r=1,...n}){return kp(e,z0().exponent(r),t,{...n,type:"pow"})}function cj(e,t,{base:r=10,domain:n=Vat(t),...i}){return kp(e,P0().base(r),t,{...i,domain:n})}function lj(e,t,{constant:r=1,...n}){return kp(e,$0().constant(r),t,n)}function uj(e,t,{range:r,quantiles:n=r===void 0?5:(r=[...r]).length,n:i=n,scheme:o="rdylbu",domain:s=jat(t),unknown:a,interpolate:c,reverse:l}){return r===void 0&&(r=c!==void 0?En(c,i):Fe.get(e)===Hi?Ob(o,i):void 0),s.length>0&&(s=V0(s,r===void 0?{length:i}:r).quantiles()),kI(e,t,{domain:s,range:r,reverse:l,unknown:a})}function fj(e,t,{range:r,n=r===void 0?5:(r=[...r]).length,scheme:i="rdylbu",domain:o=hj(e,t),unknown:s,interpolate:a,reverse:c}){let[l,u]=Be(o),f;return r===void 0?(f=yn(l,u,n),f[0]<=l&&f.splice(0,1),f[f.length-1]>=u&&f.pop(),n=f.length+1,r=a!==void 0?En(a,n):Fe.get(e)===Hi?Ob(i,n):void 0):(f=En(Ze(l,u),n+1).slice(1,-1),l instanceof Date&&(f=f.map(d=>new Date(d)))),tl(Sr(o))<0&&f.reverse(),kI(e,t,{domain:f,range:r,reverse:c,unknown:s})}function kI(e,t,{domain:r=[0],unknown:n,scheme:i="rdylbu",interpolate:o,range:s=o!==void 0?En(o,r.length+1):Fe.get(e)===Hi?Ob(i,r.length+1):void 0,reverse:a}){r=Sr(r);let c=tl(r);if(!isNaN(c)&&!Uat(r,c))throw new Error(`the ${e} scale has a non-monotonic domain`);return a&&(s=Jl(s)),{type:"threshold",scale:j0(c<0?Jl(r):r,s===void 0?[]:s).unknown(n),domain:r,range:s}}function Uat(e,t){for(let r=1,n=e.length,i=e[0];r<n;++r){let o=Wn(i,i=e[r]);if(o!==0&&o!==t)return!1}return!0}function dj(e){return{type:"identity",scale:vV(Fe.get(e))?C0():t=>t}}function Rp(e,t=gp){return e.length?[Oe(e,({value:r})=>r===void 0?r:Oe(r,t)),de(e,({value:r})=>r===void 0?r:de(r,t))]:[0,1]}function hj(e,t){let r=Fe.get(e);return(r===cd||r===ud||r===ld?Pat:Rp)(t)}function Pat(e){return[0,e.length?de(e,({value:t})=>t===void 0?t:de(t,gp)):1]}function $at(e,t){let r=e.find(({radius:s})=>s!==void 0);if(r!==void 0)return[0,r.radius];let n=Hn(e,.5,({value:s})=>s===void 0?NaN:Hn(s,.25,ni)),i=t.map(s=>3*Math.sqrt(s/n)),o=30/de(i);return o<1?i.map(s=>s*o):i}function zat(e,t){let r=hs(e,({value:o})=>o===void 0?NaN:hs(o,Math.abs)),n=t.map(o=>12*o/r),i=60/de(n);return i<1?n.map(o=>o*i):n}function Vat(e){for(let{value:t}of e)if(t!==void 0)for(let r of t){if(r>0)return Rp(e,ni);if(r<0)return Rp(e,hu)}return[1,10]}function jat(e){let t=[];for(let{value:r}of e)if(r!==void 0)for(let n of r)t.push(n);return t}function Nb(e){return(t,r)=>n=>e(t+n*(r-t))}function CI(e,t,r,n,{type:i,nice:o,clamp:s,domain:a=Rp(n),unknown:c,pivot:l=0,scheme:u,range:f,symmetric:d=!0,interpolate:h=Fe.get(e)===Hi?u==null&&f!==void 0?xo:Lp(u!==void 0?u:"rdbu"):Ze,reverse:p}){l=+l,a=Sr(a);let[y,g]=a;if(a.length>2&&kn(`Warning: the diverging ${e} scale domain contains extra elements.`),Wn(y,g)<0&&([y,g]=[g,y],p=!p),y=Math.min(y,l),g=Math.max(g,l),typeof h!="function"&&(h=e3(h)),f!==void 0&&(h=h.length===1?Nb(h)(...f):Js(h,f)),p&&(h=t3(h)),d){let m=r.apply(l),b=m-r.apply(y),x=r.apply(g)-m;b<x?y=r.invert(m-x):b>x&&(g=r.invert(m+b))}return t.domain([y,l,g]).unknown(c).interpolator(h),s&&t.clamp(s),o&&t.nice(o),{type:i,domain:[y,g],pivot:l,interpolate:h,scale:t}}function pj(e,t,r){return CI(e,K0(),qat,t,r)}function mj(e,t,r){return n3(e,t,{...r,exponent:.5})}function n3(e,t,{exponent:r=1,...n}){return CI(e,WS().exponent(r=+r),Gat(r),t,{...n,type:"diverging-pow"})}function yj(e,t,{base:r=10,pivot:n=1,domain:i=Rp(t,n<0?hu:ni),...o}){return CI(e,qS().base(r=+r),Yat,t,{domain:i,pivot:n,...o})}function gj(e,t,{constant:r=1,...n}){return CI(e,YS().constant(r=+r),Xat(r),t,n)}var qat={apply(e){return e},invert(e){return e}},Yat={apply:Math.log,invert:Math.exp},Wat={apply(e){return Math.sign(e)*Math.sqrt(Math.abs(e))},invert(e){return Math.sign(e)*(e*e)}};function Gat(e){return e===.5?Wat:{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 Xat(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 bj(e,t,r,n){return kp(e,t,r,n)}function xj(e,t,r){return bj(e,zS(),t,r)}function _j(e,t,r){return bj(e,VS(),t,r)}var Cp=Symbol("ordinal");function vj(e,t,r,{type:n,interval:i,domain:o,range:s,reverse:a,hint:c}){return i=ba(i,n),o===void 0&&(o=Mj(r,i,e)),(n==="categorical"||n===Cp)&&(n="ordinal"),a&&(o=Jl(o)),o=t.domain(o).domain(),s!==void 0&&(typeof s=="function"&&(s=s(o)),t.range(s)),{type:n,domain:o,range:s,scale:t,hint:c,interval:i}}function Sj(e,t,{type:r,interval:n,domain:i,range:o,scheme:s,unknown:a,...c}){n=ba(n,r),i===void 0&&(i=Mj(t,n,e));let l;if(Fe.get(e)===Mp)l=Hat(t),o=o===void 0?Zat(l):fe(o,Ep);else if(Fe.get(e)===Hi&&(o===void 0&&(r==="ordinal"||r===Cp)&&(o=nj(i,s),o!==void 0&&(s=void 0)),s===void 0&&o===void 0&&(s=r==="ordinal"?"turbo":"observable10"),s!==void 0))if(o!==void 0){let u=Lp(s),f=o[0],d=o[1]-o[0];o=({length:h})=>En(p=>u(f+d*p),h)}else o=QN(s);if(a===R0)throw new Error(`implicit unknown on ${e} scale is not supported`);return vj(e,Hf().unknown(a),t,{...c,type:r,domain:i,range:o,hint:l})}function Ij(e,t,{align:r=.5,padding:n=.5,...i}){return Aj(_O().align(r).padding(n),t,i,e)}function Tj(e,t,{align:r=.5,padding:n=.1,paddingInner:i=n,paddingOuter:o=e==="fx"||e==="fy"?0:n,...s}){return Aj(uu().align(r).paddingInner(i).paddingOuter(o),t,s,e)}function Aj(e,t,r,n){let{round:i}=r;return i!==void 0&&e.round(i=!!i),e=vj(n,e,t,r),e.round=i,e}function Mj(e,t,r){let n=new Xn;for(let{value:i,domain:o}of e){if(o!==void 0)return o();if(i!==void 0)for(let s of i)n.add(s)}if(t!==void 0){let[i,o]=Be(n).map(t.floor,t);return t.range(i,t.offset(o))}if(n.size>1e4&&Fe.get(r)===Eo)throw new Error(`implicit ordinal domain of ${r} scale has more than 10,000 values`);return Hs(n,Kr)}function wj(e,t){let r;for(let{hint:n}of e){let i=n?.[t];if(i!==void 0){if(r===void 0)r=i;else if(r!==i)return}}return r}function Hat(e){return{fill:wj(e,"fill"),stroke:wj(e,"stroke")}}function Zat(e){return Se(e.fill)?QO:cI}function Fb(e,{label:t,inset:r=0,insetTop:n=r,insetRight:i=r,insetBottom:o=r,insetLeft:s=r,round:a,nice:c,clamp:l,zero:u,align:f,padding:d,projection:h,facet:{label:p=t}={},...y}={}){let g={};for(let[m,b]of e){let x=y[m],_=Rj(m,b,{round:Fe.get(m)===Eo?a:void 0,nice:c,clamp:l,zero:u,align:f,padding:d,projection:h,...x});if(_){let{label:v=m==="fx"||m==="fy"?p:t,percent:w,transform:I,inset:D,insetTop:A=D!==void 0?D:m==="y"?n:0,insetRight:B=D!==void 0?D:m==="x"?i:0,insetBottom:M=D!==void 0?D:m==="y"?o:0,insetLeft:O=D!==void 0?D:m==="x"?s:0}=x||{};if(I==null)I=void 0;else if(typeof I!="function")throw new Error("invalid scale transform; not a function");_.percent=!!w,_.label=v===void 0?Kat(b,_):v,_.transform=I,m==="x"||m==="fx"?(_.insetLeft=+O,_.insetRight=+B):(m==="y"||m==="fy")&&(_.insetTop=+A,_.insetBottom=+M),g[m]=_}}return g}function o3(e){let t={},r={scales:t};for(let[n,i]of Object.entries(e)){let{scale:o,type:s,interval:a,label:c}=i;t[n]=Cj(i),r[n]=o,o.type=s,a!=null&&(o.interval=a),c!=null&&(o.label=c)}return r}function Nj(e,t){let{x:r,y:n,fx:i,fy:o}=e,s=i||o?$I(t):t;i&&Ej(i,s),o&&Dj(o,s);let a=i||o?s3(e,t):t;r&&Ej(r,a),n&&Dj(n,a)}function Kat(e=[],t){let r;for(let{label:n}of e)if(n!==void 0){if(r===void 0)r=n;else if(r!==n)return}if(r!==void 0)return!wa(t)&&t.percent&&(r=`${r} (%)`),{inferred:!0,toString:()=>r}}function PI(e){return Math.sign(tl(e.domain()))*Math.sign(tl(e.range()))}function $I(e){let{marginTop:t,marginRight:r,marginBottom:n,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(r,c),marginBottom:Math.max(n,l),marginLeft:Math.max(i,u),width:o,height:s}}function s3({fx:e,fy:t},r){let{marginTop:n,marginRight:i,marginBottom:o,marginLeft:s,width:a,height:c}=$I(r);return{marginTop:n,marginRight:i,marginBottom:o,marginLeft:s,width:e?e.scale.bandwidth()+s+i:a,height:t?t.scale.bandwidth()+n+o:c,facet:{width:a,height:c}}}function Ej(e,t){if(e.range===void 0){let{insetLeft:r,insetRight:n}=e,{width:i,marginLeft:o=0,marginRight:s=0}=t,a=o+r,c=i-s-n;e.range=[a,Math.max(a,c)],wa(e)||(e.range=Lj(e)),e.scale.range(e.range)}Fj(e)}function Dj(e,t){if(e.range===void 0){let{insetTop:r,insetBottom:n}=e,{height:i,marginTop:o=0,marginBottom:s=0}=t,a=o+r,c=i-s-n;e.range=[Math.max(a,c),a],wa(e)?e.range.reverse():e.range=Lj(e),e.scale.range(e.range)}Fj(e)}function Fj(e){e.round===void 0&&tct(e)&&Qat(e)<=30&&e.scale.round(!0)}function Qat({scale:e}){let t=e.domain().length,[r,n]=e.range(),i=e.paddingInner?e.paddingInner():1,o=e.paddingOuter?e.paddingOuter():e.padding(),s=t-i,a=Math.abs(n-r)/Math.max(1,s+o*2);return(a-Math.floor(a))*s}function Lj(e){let t=e.scale.domain().length+a3(e);if(!(t>2))return e.range;let[r,n]=e.range;return Array.from({length:t},(i,o)=>r+o/(t-1)*(n-r))}function zI(e,t,r){return Rj(e,r===void 0?void 0:[{hint:r}],{...t})}function Rj(e,t=[],r={}){let n=Jat(e,t,r);if(r.type===void 0&&r.domain===void 0&&r.range===void 0&&r.interval==null&&e!=="fx"&&e!=="fy"&&wa({type:n})){let i=t.map(({value:o})=>o).filter(o=>o!==void 0);i.some(lr)?kn(`Warning: some data associated with the ${e} scale are dates. Dates are typically associated with a "utc" or "time" scale rather than a "${Up(n)}" 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 "${Up(n)}".`):i.some(mV)?kn(`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 "${Up(n)}" 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 "${Up(n)}".`):i.some(yV)&&kn(`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 "${Up(n)}" 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 "${Up(n)}".`)}switch(r.type=n,n){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":r=UI(t,r,Cr);break;case"identity":switch(Fe.get(e)){case Eo:r=UI(t,r,Cr);break;case Mp:r=UI(t,r,ect);break}break;case"utc":case"time":r=UI(t,r,uV);break}switch(n){case"diverging":return pj(e,t,r);case"diverging-sqrt":return mj(e,t,r);case"diverging-pow":return n3(e,t,r);case"diverging-log":return yj(e,t,r);case"diverging-symlog":return gj(e,t,r);case"categorical":case"ordinal":case Cp:return Sj(e,t,r);case"cyclical":case"sequential":case"linear":return sj(e,t,r);case"sqrt":return aj(e,t,r);case"threshold":return kI(e,t,r);case"quantile":return uj(e,t,r);case"quantize":return fj(e,t,r);case"pow":return r3(e,t,r);case"log":return cj(e,t,r);case"symlog":return lj(e,t,r);case"utc":return _j(e,t,r);case"time":return xj(e,t,r);case"point":return Ij(e,t,r);case"band":return Tj(e,t,r);case"identity":return dj(e);case void 0:return;default:throw new Error(`unknown scale type: ${n}`)}}function Up(e){return typeof e=="symbol"?e.description:e}function Bj(e){return typeof e=="string"?`${e}`.toLowerCase():e}var Oj={toString:()=>"projection"};function Jat(e,t,{type:r,domain:n,range:i,scheme:o,pivot:s,projection:a}){if(r=Bj(r),e==="fx"||e==="fy")return"band";(e==="x"||e==="y")&&a!=null&&(r=Oj);for(let l of t){let u=Bj(l.type);if(u!==void 0){if(r===void 0)r=u;else if(r!==u)throw new Error(`scale incompatible with channel: ${r} !== ${u}`)}}if(r===Oj)return;if(r!==void 0)return r;if(n===void 0&&!t.some(({value:l})=>l!==void 0))return;let c=Fe.get(e);if(c===cd)return"sqrt";if(c===ud||c===ld)return"linear";if(c===Mp)return"ordinal";if((n||i||[]).length>2)return i3(c);if(n!==void 0){if(ir(n))return i3(c);if(lr(n))return"utc"}else{let l=t.map(({value:u})=>u).filter(u=>u!==void 0);if(l.some(ir))return i3(c);if(l.some(lr))return"utc"}if(c===Hi){if(s!=null||ij(o))return"diverging";if(rj(o))return"categorical"}return"linear"}function i3(e){switch(e){case Eo:return"point";case Hi:return Cp;default:return"ordinal"}}function wa({type:e}){return e==="ordinal"||e==="point"||e==="band"||e===Cp}function a3({type:e}){return e==="threshold"}function tct({type:e}){return e==="point"||e==="band"}function si(e){if(e===void 0)return!0;let t=e.domain(),r=e(t[0]);for(let n=1,i=t.length;n<i;++n)if(e(t[n])-r)return!1;return!0}function UI(e,{domain:t,...r},n){for(let i of e)i.value!==void 0&&(t===void 0&&(t=i.value?.domain),i.value=n(i.value));return{domain:t===void 0?t:n(t),...r}}function ect(e){return fe(e,Ep)}function Pp(e={}){let t;for(let r in e)if(Fe.has(r)&&ya(e[r])){if(t!==void 0)throw new Error("ambiguous scale definition; multiple scales found");t=Cj(zI(r,e[r]))}if(t===void 0)throw new Error("invalid scale definition; no scale found");return t}function kj(e){return t=>{if(!Fe.has(t=`${t}`))throw new Error(`unknown scale: ${t}`);return e[t]}}function Cj({scale:e,type:t,domain:r,range:n,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:xu(r),...n!==void 0&&{range:xu(n)},...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 Pj(e,t,r={}){let n=.5-ur,i=.5+ur,o=.5+ur,s=.5-ur;for(let{marginTop:y,marginRight:g,marginBottom:m,marginLeft:b}of t)y>n&&(n=y),g>i&&(i=g),m>o&&(o=m),b>s&&(s=b);let{margin:a,marginTop:c=a!==void 0?a:n,marginRight:l=a!==void 0?a:i,marginBottom:u=a!==void 0?a:o,marginLeft:f=a!==void 0?a:s}=r;c=+c,l=+l,u=+u,f=+f;let{width:d=640,height:h=rct(e,r,{width:d,marginTopDefault:n,marginRightDefault:i,marginBottomDefault:o,marginLeftDefault:s})+Math.max(0,c-n+u-o)}=r;d=+d,h=+h;let p={width:d,height:h,marginTop:c,marginRight:l,marginBottom:u,marginLeft:f};if(e.fx||e.fy){let{margin:y,marginTop:g=y!==void 0?y:c,marginRight:m=y!==void 0?y:l,marginBottom:b=y!==void 0?y:u,marginLeft:x=y!==void 0?y:f}=r.facet??{};g=+g,m=+m,b=+b,x=+x,p.facet={marginTop:g,marginRight:m,marginBottom:b,marginLeft:x}}return p}function rct({x:e,y:t,fy:r,fx:n},{projection:i,aspectRatio:o},{width:s,marginTopDefault:a,marginRightDefault:c,marginBottomDefault:l,marginLeftDefault:u}){let f=r?r.scale.domain().length:1,d=HV(i);if(d){let p=n?n.scale.domain().length:1,y=(1.1*f-.1)/(1.1*p-.1)*d,g=Math.max(.1,Math.min(10,y));return Math.round((s-u-c)*g+a+l)}let h=t?wa(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=Uj("y",t)/(Uj("x",e)*o),y=n?n.scale.bandwidth():1,g=r?r.scale.bandwidth():1,m=y*(s-u-c)-e.insetLeft-e.insetRight;return(p*m+t.insetTop+t.insetBottom)/g+a+l}return!!(t||r)*Math.max(1,Math.min(60,h*f))*20+!!n*30+60}function Uj(e,t){if(!t)throw new Error(`aspectRatio requires ${e} scale`);let{type:r,domain:n}=t,i;switch(r){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 n.length;default:throw new Error(`unsupported ${e} scale for aspectRatio: ${r}`)}let[o,s]=Be(n);return Math.abs(i(s)-i(o))}function zj(e,t){let{fx:r,fy:n}=Fb(e,t),i=r?.scale.domain(),o=n?.scale.domain();return i&&o?iv(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 Vj(e,{x:t,y:r}){return t&&=d3(t),r&&=d3(r),e.filter(t&&r?n=>t.has(n.x)&&r.has(n.y):t?n=>t.has(n.x):n=>r.has(n.y)).sort(t&&r?(n,i)=>t.get(n.x)-t.get(i.x)||r.get(n.y)-r.get(i.y):t?(n,i)=>t.get(n.x)-t.get(i.x):(n,i)=>r.get(n.y)-r.get(i.y))}function jI(e,{fx:t,fy:r}){let n=ii(e),i=t?.value,o=r?.value;return t&&r?ds(n,s=>(s.fx=i[s[0]],s.fy=o[s[0]],s),s=>i[s],s=>o[s]):t?ds(n,s=>(s.fx=i[s[0]],s),s=>i[s]):ds(n,s=>(s.fy=o[s[0]],s),s=>o[s])}function jj(e,t,{marginTop:r,marginLeft:n}){return e&&t?({x:i,y:o})=>`translate(${e(i)-n},${t(o)-r})`:e?({x:i})=>`translate(${e(i)-n},0)`:({y:i})=>`translate(0,${t(i)-r})`}function qj(e){let t=[],r=new Uint32Array(gn(e,n=>n.length));for(let n of e){let i=0;for(let o of e)n!==o&&(r.set(o,i),i+=o.length);t.push(r.slice(0,i))}return t}var nct=new Map([["top",c3],["right",f3],["bottom",l3],["left",u3],["top-left",VI(c3,u3)],["top-right",VI(c3,f3)],["bottom-left",VI(l3,u3)],["bottom-right",VI(l3,f3)],["top-empty",oct],["right-empty",cct],["bottom-empty",sct],["left-empty",act],["empty",lct]]);function Yj(e){if(e==null)return null;let t=nct.get(`${e}`.toLowerCase());if(t)return t;throw new Error(`invalid facet anchor: ${e}`)}var $j=new WeakMap;function d3(e){let t=$j.get(e);return t||$j.set(e,t=new Gn(fe(e,(r,n)=>[r,n]))),t}function Mu(e,t){return d3(e).get(t)}function ict(e,t,r){return t=nl(t),r=nl(r),e.find(n=>Object.is(nl(n.x),t)&&Object.is(nl(n.y),r))}function qI(e,t,r){return ict(e,t,r)?.empty}function c3(e,{y:t},{y:r}){return t?Mu(t,r)===0:!0}function l3(e,{y:t},{y:r}){return t?Mu(t,r)===t.length-1:!0}function u3(e,{x:t},{x:r}){return t?Mu(t,r)===0:!0}function f3(e,{x:t},{x:r}){return t?Mu(t,r)===t.length-1:!0}function oct(e,{y:t},{x:r,y:n,empty:i}){if(i)return!1;if(!t)return;let o=Mu(t,n);if(o>0)return qI(e,r,t[o-1])}function sct(e,{y:t},{x:r,y:n,empty:i}){if(i)return!1;if(!t)return;let o=Mu(t,n);if(o<t.length-1)return qI(e,r,t[o+1])}function act(e,{x:t},{x:r,y:n,empty:i}){if(i)return!1;if(!t)return;let o=Mu(t,r);if(o>0)return qI(e,t[o-1],n)}function cct(e,{x:t},{x:r,y:n,empty:i}){if(i)return!1;if(!t)return;let o=Mu(t,r);if(o<t.length-1)return qI(e,t[o+1],n)}function lct(e,t,{empty:r}){return r}function VI(e,t){return function(){return e.apply(null,arguments)&&t.apply(null,arguments)}}function YI(e,{channels:{fx:t,fy:r},groups:n}){return t&&r?e.map(({x:i,y:o})=>n.get(i)?.get(o)??[]):t?e.map(({x:i})=>n.get(i)??[]):e.map(({y:i})=>n.get(i)??[])}var Ft=class{constructor(t,r={},n={},i){let{facet:o="auto",facetAnchor:s,fx:a,fy:c,sort:l,dx:u=0,dy:f=0,margin:d=0,marginTop:h=d,marginRight:p=d,marginBottom:y=d,marginLeft:g=d,clip:m=i?.clip,channels:b,tip:x,render:_}=n;if(this.data=t,this.sort=ga(l)?l:null,this.initializer=Qe(n).initializer,this.transform=this.initializer?n.transform:en(n).transform,o===null||o===!1?this.facet=null:(this.facet=Ur(o===!0?"include":o,"facet",["auto","include","exclude","super"]),this.fx=t===gu&&typeof a=="string"?[a]:a,this.fy=t===gu&&typeof c=="string"?[c]:c),this.facetAnchor=Yj(s),r=Sb(r),b!==void 0&&(r={...uct(b),...r}),i!==void 0&&(r={...NI(this,n,i),...r}),this.channels=Object.fromEntries(Object.entries(r).map(([v,w])=>{if(Xi(w.value)){let{value:I,label:D=w.label,scale:A=w.scale}=w.value;w={...w,label:D,scale:A,value:I}}if(t===gu&&typeof w.value=="string"){let{value:I}=w;w={...w,value:[I]}}return[v,w]}).filter(([v,{value:w,optional:I}])=>{if(w!=null)return!0;if(I)return!1;throw new Error(`missing channel value: ${v}`)})),this.dx=+u,this.dy=+f,this.marginTop=+h,this.marginRight=+p,this.marginBottom=+y,this.marginLeft=+g,this.clip=LI(m),this.tip=fct(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:w}=r[v];if(!(w!=="x"&&w!=="y"))throw new Error("super-faceting cannot use x or y")}}_!=null&&(this.render=$p(_,this.render))}initialize(t,r,n){let i=Sr(this.data);t===void 0&&i!=null&&(t=[ii(i)]);let o=t;this.transform!=null&&({facets:t,data:i}=this.transform(i,t,n),i=Sr(i)),t!==void 0&&(t.original=o);let s=DI(this.channels,i);return this.sort!=null&&kV(i,t,s,r,this.sort),{data:i,facets:t,channels:s}}filter(t,r,n){for(let i in r){let{filter:o=wr}=r[i];if(o!==null){let s=n[i];t=t.filter(a=>o(s[a]))}}return t}project(t,r,n){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"&&KN(i,o,r,n.projection)}}scale(t,r,n){let i=Op(t,r);return n.projection&&this.project(t,i,n),i}};function Pr(...e){return e.plot=Ft.prototype.plot,e}function $p(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(r,n,i,o,s,a){return e.call(this,r,n,i,o,s,(c,l,u,f,d)=>t.call(this,c,l,u,f,d,a))}}function uct(e){return Object.fromEntries(Object.entries(Sb(e)).map(([t,r])=>(r=typeof r=="string"?{value:r,label:t}:Mo(r),r.filter===void 0&&r.scale==null&&(r={...r,filter:null}),[t,r])))}function fct(e){return e===!0?"xy":e===!1||e==null?null:typeof e=="string"?Ur(e,"tip",["x","y","xy"]):e}function xs(e,t){return e?.tip===!0?{...e,tip:t}:Jr(e?.tip)&&e.tip.pointer===void 0?{...e,tip:{...e.tip,pointer:t}}:e}var Wj=new WeakMap;function h3(e,t,{x:r,y:n,px:i,py:o,maxRadius:s=40,channels:a,render:c,...l}={}){return s=+s,i!=null&&(r??=null,a={...a,px:{value:i,scale:"x"}}),o!=null&&(n??=null,a={...a,py:{value:o,scale:"y"}}),{x:r,y:n,channels:a,...l,render:$p(function(u,f,d,h,p,y){p={...p,pointerSticky:!1};let g=p.ownerSVGElement,{data:m}=p.getMarkState(this),b=Wj.get(g);b||Wj.set(g,b={sticky:!1,roots:[],renders:[]});let x=b.renders.push(Q)-1,{x:_,y:v,fx:w,fy:I}=f,D=w?w(u.fx)-h.marginLeft:0,A=I?I(u.fy)-h.marginTop:0;_?.bandwidth&&(D+=_.bandwidth()/2),v?.bandwidth&&(A+=v.bandwidth()/2);let B=u.fi!=null,M;if(B){let X=b.facetStates;X||(b.facetStates=X=new Map),M=X.get(this),M||X.set(this,M=new Map)}let[O,R]=rn(this,h),{px:S,py:T}=d,E=S?X=>S[X]:p3(d,O),C=T?X=>T[X]:m3(d,R),U,k,$,z;function V(X,at){if(B)if(z&&(z=cancelAnimationFrame(z)),X==null)M.delete(u.fi);else{M.set(u.fi,at),z=requestAnimationFrame(()=>{z=null;for(let[q,J]of M)if(J<at||J===at&&q<u.fi){X=null;break}Q(X)});return}Q(X)}function Q(X){if(U===X&&$===b.sticky)return;U=X,$=p.pointerSticky=b.sticky;let at=U==null?[]:[U];B&&(at.fx=u.fx,at.fy=u.fy,at.fi=u.fi);let q=y(at,f,d,h,p);if(k){if(B){let J=k.parentNode,ct=k.getAttribute("transform"),j=q.getAttribute("transform");ct?q.setAttribute("transform",ct):q.removeAttribute("transform"),j?J.setAttribute("transform",j):J.removeAttribute("transform"),q.removeAttribute("aria-label"),q.removeAttribute("aria-description"),q.removeAttribute("aria-hidden")}k.replaceWith(q)}return b.roots[x]=k=q,U==null&&M?.size>1||p.dispatchValue(U==null?null:m[U]),q}function nt(X){if(b.sticky||X.pointerType==="mouse"&&X.buttons===1)return;let[at,q]=Mn(X);at-=D,q-=A;let J=at<h.marginLeft||at>h.width-h.marginRight?1:e,ct=q<h.marginTop||q>h.height-h.marginBottom?1:t,j=null,Qt=s*s;for(let gt of u){let he=J*(E(gt)-at),pe=ct*(C(gt)-q),ot=he*he+pe*pe;ot<=Qt&&(j=gt,Qt=ot)}if(j!=null&&(e!==1||t!==1)){let gt=E(j)-at,he=C(j)-q;Qt=gt*gt+he*he}V(j,Qt)}function st(X){X.pointerType==="mouse"&&U!=null&&(b.sticky&&b.roots.some(at=>at?.contains(X.target))||(b.sticky?(b.sticky=!1,b.renders.forEach(at=>at(null))):(b.sticky=!0,Q(U)),X.stopImmediatePropagation()))}function ut(X){X.pointerType==="mouse"&&(b.sticky||V(null))}return g.addEventListener("pointerenter",nt),g.addEventListener("pointermove",nt),g.addEventListener("pointerdown",st),g.addEventListener("pointerleave",ut),Q(null)},c)}}function zp(e){return h3(1,1,e)}function Vp(e){return h3(1,.01,e)}function dd(e){return h3(.01,1,e)}function p3({x1:e,x2:t,x:r=e},n){return e&&t?i=>(e[i]+t[i])/2:r?i=>r[i]:()=>n}function m3({y1:e,y2:t,y:r=e},n){return e&&t?i=>(e[i]+t[i])/2:r?i=>r[i]:()=>n}function WI(e){return wa(e)&&e.interval===void 0?void 0:"tabular-nums"}function Gj(e,t){let{label:r=e.label,tickSize:n=6,width:i=240,height:o=44+n,marginTop:s=18,marginRight:a=0,marginBottom:c=16+n,marginLeft:l=0,style:u,ticks:f=(i-l-a)/64,tickFormat:d,fontVariant:h=WI(e),round:p=!0,opacity:y,className:g}=t,m=Tu(t);g=Np(g),y=Ae(y)[1],d===null&&(d=()=>null);let b=pt("svg",m).attr("class",`${g}-ramp`).attr("font-family","system-ui, sans-serif").attr("font-size",10).attr("width",i).attr("height",o).attr("viewBox",`0 0 ${i} ${o}`).call(O=>O.append("style").text(`:where(.${g}-ramp) {
17
26
  display: block;
18
27
  height: auto;
19
28
  height: intrinsic;
20
29
  max-width: 100%;
21
30
  overflow: visible;
22
31
  }
23
- :where(.${b}-ramp text) {
32
+ :where(.${g}-ramp text) {
24
33
  white-space: pre;
25
- }`)).call(Ef,u),x=O=>O.selectAll(".tick line").attr("y1",s+c-o),_,v=p?(O,k)=>O.rangeRound(k):(O,k)=>O.range(k),{type:w,domain:T,range:A,interpolate:R,scale:I,pivot:E}=e;if(R){let O=A===void 0?R:po(R.length===1?Mm(R):R,A);_=v(I.copy(),Ln(we(l,i-a),Math.min(T.length+(E!==void 0),A===void 0?1/0:A.length)));let k=256,S=m.document.createElement("canvas");S.width=k,S.height=1;let M=S.getContext("2d");for(let N=0,F=k-1;N<k;++N)M.fillStyle=O(N/F),M.fillRect(N,0,1,1);g.append("image").attr("opacity",y).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(w==="threshold"){let O=T,k=d===void 0?S=>S:typeof d=="string"?ci(d):d;_=v(ks().domain([-1,A.length-1]),[l,i-a]),g.append("g").attr("fill-opacity",y).selectAll().data(A).enter().append("rect").attr("x",(S,M)=>_(M-1)).attr("y",s).attr("width",(S,M)=>_(M)-_(M-1)).attr("height",o-s-c).attr("fill",S=>S),f=Yt(O,(S,M)=>M),d=S=>k(O[S],S)}else _=v(Ua().domain(T),[l,i-a]),g.append("g").attr("fill-opacity",y).selectAll().data(T).enter().append("rect").attr("x",_).attr("y",s).attr("width",Math.max(0,_.bandwidth()-1)).attr("height",o-s-c).attr("fill",I),x=()=>{};return g.append("g").attr("transform",`translate(0,${o-c})`).call(V2(_).ticks(Array.isArray(f)?null:f,typeof d=="string"?d:void 0).tickFormat(typeof d=="function"?d:void 0).tickSize(r).tickValues(Array.isArray(f)?f:null)).attr("font-size",null).attr("font-family",null).attr("font-variant",le(h,"normal")).call(x).call(O=>O.select(".domain").remove()),n!==void 0&&g.append("text").attr("x",l).attr("y",s-6).attr("fill","currentColor").attr("font-weight","bold").text(n),g.node()}var Lf=Math.PI/180;function Vi(e,{marker:t,markerStart:n=t,markerMid:r=t,markerEnd:i=t}={}){e.markerStart=OE(n),e.markerMid=OE(r),e.markerEnd=OE(i)}function OE(e){if(e==null||e===!1)return null;if(e===!0)return JC;if(typeof e=="function")return e;switch(`${e}`.toLowerCase()){case"none":return null;case"arrow":return KC("auto");case"arrow-reverse":return KC("auto-start-reverse");case"dot":return DZ;case"circle":case"circle-fill":return JC;case"circle-stroke":return kZ;case"tick":return DE("auto");case"tick-x":return DE(90);case"tick-y":return DE(0)}throw new Error(`invalid marker: ${e}`)}function KC(e){return(t,n)=>ct("svg:marker",n).attr("viewBox","-5 -5 10 10").attr("markerWidth",6.67).attr("markerHeight",6.67).attr("orient",e).attr("fill","none").attr("stroke",t).attr("stroke-width",1.5).attr("stroke-linecap","round").attr("stroke-linejoin","round").call(r=>r.append("path").attr("d","M-1.5,-3l3,3l-3,3")).node()}function DZ(e,t){return ct("svg:marker",t).attr("viewBox","-5 -5 10 10").attr("markerWidth",6.67).attr("markerHeight",6.67).attr("fill",e).attr("stroke","none").call(n=>n.append("circle").attr("r",2.5)).node()}function JC(e,t){return ct("svg:marker",t).attr("viewBox","-5 -5 10 10").attr("markerWidth",6.67).attr("markerHeight",6.67).attr("fill",e).attr("stroke","var(--plot-background)").attr("stroke-width",1.5).call(n=>n.append("circle").attr("r",3)).node()}function kZ(e,t){return ct("svg:marker",t).attr("viewBox","-5 -5 10 10").attr("markerWidth",6.67).attr("markerHeight",6.67).attr("fill","var(--plot-background)").attr("stroke",e).attr("stroke-width",1.5).call(n=>n.append("circle").attr("r",3)).node()}function DE(e){return(t,n)=>ct("svg:marker",n).attr("viewBox","-3 -3 6 6").attr("markerWidth",6).attr("markerHeight",6).attr("orient",e).attr("stroke",t).call(r=>r.append("path").attr("d","M0,-3v6")).node()}var FZ=0;function Js(e,t,{stroke:n},r){return eB(e,t,n&&(i=>n[i]),r)}function tB(e,t,{stroke:n},r){return eB(e,t,n&&(([i])=>n[i]),r)}function eB(e,{markerStart:t,markerMid:n,markerEnd:r,stroke:i},o=()=>i,s){let a=new Map;function c(l){return function(u){let f=o(u),d=a.get(l);d||a.set(l,d=new Map);let h=d.get(f);if(!h){let p=this.parentNode.insertBefore(l(f,s),this),y=`plot-marker-${++FZ}`;p.setAttribute("id",y),d.set(f,h=`url(#${y})`)}return h}}t&&e.attr("marker-start",c(t)),n&&e.attr("marker-mid",c(n)),r&&e.attr("marker-end",c(r))}function Ml({inset:e,insetLeft:t,insetRight:n,...r}={}){return[t,n]=nB(e,t,n),{inset:e,insetLeft:t,insetRight:n,...r}}function Al({inset:e,insetTop:t,insetBottom:n,...r}={}){return[t,n]=nB(e,t,n),{inset:e,insetTop:t,insetBottom:n,...r}}function nB(e,t,n){return e===void 0&&t===void 0&&n===void 0?De?[1,0]:[.5,.5]:[t,n]}function rB(e,{interval:t}){return e={...pi(e)},e.interval=xf(e.interval===void 0?t:e.interval),e}function l_(e,t,n,r){let{[e]:i,[`${e}1`]:o,[`${e}2`]:s}=n,{value:a,interval:c}=rB(i,n);if(a==null||c==null&&!r)return n;let l=On(i);if(c==null){let h,p={transform:y=>h||(h=mt(y,a)),label:l};return{...n,[e]:void 0,[`${e}1`]:o===void 0?p:o,[`${e}2`]:s===void 0&&!(o===s&&r)?p:s}}let u,f;function d(h){return f!==void 0&&h===u?f:f=Yt(mt(u=h,a),p=>c.floor(p))}return t({...n,[e]:void 0,[`${e}1`]:o===void 0?{transform:d,label:l}:o,[`${e}2`]:s===void 0?{transform:h=>d(h).map(p=>c.offset(p)),label:l}:s})}function iB(e,t,n){let{[e]:r}=n,{value:i,interval:o}=rB(r,n);return i==null||o==null?n:t({...n,[e]:{label:On(r),transform:s=>{let a=Yt(mt(s,i),l=>o.floor(l)),c=a.map(l=>o.offset(l));return a.map(Oe(a)?(l,u)=>l==null||isNaN(l=+l)||(u=c[u],u==null)||isNaN(u=+u)?void 0:new Date((l+u)/2):(l,u)=>l==null||(u=c[u],u==null)?NaN:(+l+ +u)/2)}}})}function kE(e={}){return l_("x",Ml,e,!0)}function FE(e={}){return l_("y",Al,e,!0)}function u_(e={}){return l_("x",Ml,e)}function f_(e={}){return l_("y",Al,e)}function d_(e={}){return iB("x",Ml,e)}function h_(e={}){return iB("y",Al,e)}var oB={ariaLabel:"rule",fill:null,stroke:"currentColor"},Nm=class extends wt{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}},ji(n,"x"),oB),this.insetTop=Nt(a),this.insetBottom=Nt(c),Vi(this,n)}render(t,n,r,i,o){let{x:s,y:a}=n,{x:c,y1:l,y2:u}=r,{width:f,height:d,marginTop:h,marginRight:p,marginLeft:y,marginBottom:b}=i,{insetTop:m,insetBottom:g}=this;return ct("svg:g",o).call(Ft,this,i,o).call(It,this,{x:c&&s},De,0).call(x=>x.selectAll().data(t).enter().append("line").call(Rt,this).attr("x1",c?_=>c[_]:(y+f-p)/2).attr("x2",c?_=>c[_]:(y+f-p)/2).attr("y1",l&&!ar(a)?_=>l[_]+m:h+m).attr("y2",u&&!ar(a)?a.bandwidth?_=>u[_]+a.bandwidth()-g:_=>u[_]-g:d-b-g).call(Zt,this,r).call(Js,this,r,o)).node()}},Rm=class extends wt{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}},ji(n,"y"),oB),this.insetRight=Nt(a),this.insetLeft=Nt(c),Vi(this,n)}render(t,n,r,i,o){let{x:s,y:a}=n,{y:c,x1:l,x2:u}=r,{width:f,height:d,marginTop:h,marginRight:p,marginLeft:y,marginBottom:b}=i,{insetLeft:m,insetRight:g}=this;return ct("svg:g",o).call(Ft,this,i,o).call(It,this,{y:c&&a},0,De).call(x=>x.selectAll().data(t).enter().append("line").call(Rt,this).attr("x1",l&&!ar(s)?_=>l[_]+m:y+m).attr("x2",u&&!ar(s)?s.bandwidth?_=>u[_]+s.bandwidth()-g:_=>u[_]-g:f-p-g).attr("y1",c?_=>c[_]:(h+d-b)/2).attr("y2",c?_=>c[_]:(h+d-b)/2).call(Zt,this,r).call(Js,this,r,o)).node()}};function qr(e,t){let{x:n=W,y:r,y1:i,y2:o,...s}=f_(t);return[i,o]=sB(r,i,o),new Nm(e,{...s,x:n,y1:i,y2:o})}function jr(e,t){let{y:n=W,x:r,x1:i,x2:o,...s}=u_(t);return[i,o]=sB(r,i,o),new Rm(e,{...s,y:n,x1:i,x2:o})}function sB(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 rc(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 LZ={ariaLabel:"text",strokeLinejoin:"round",strokeWidth:3,paintOrder:"stroke"},fB="\xAD",Rl=class extends wt{constructor(t,n={}){let{x:r,y:i,text:o=sr(t)&&L1(t)?W:Me,frameAnchor:s,textAnchor:a=/right$/i.test(s)?"end":/left$/i.test(s)?"start":"middle",lineAnchor:c=/^top/i.test(s)?"top":/^bottom/i.test(s)?"bottom":"middle",lineHeight:l=1,lineWidth:u=1/0,textOverflow:f,monospace:d,fontFamily:h=d?"ui-monospace, monospace":void 0,fontSize:p,fontStyle:y,fontVariant:b,fontWeight:m,rotate:g}=n,[x,_]=ie(g,0),[v,w]=UZ(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:g5(x),optional:!0},text:{value:o,filter:dm,optional:!0}},n,LZ),this.rotate=_,this.textAnchor=le(a,"middle"),this.lineAnchor=Ke(c,"lineAnchor",["top","middle","bottom"]),this.lineHeight=+l,this.lineWidth=+u,this.textOverflow=CE(f),this.monospace=!!d,this.fontFamily=ze(h),this.fontSize=w,this.fontStyle=ze(y),this.fontVariant=ze(b),this.fontWeight=ze(m),this.frameAnchor=ko(s),!(this.lineWidth>=0))throw new Error(`invalid lineWidth: ${u}`);this.splitLines=PE(this),this.clipLine=UE(this)}render(t,n,r,i,o){let{x:s,y:a}=n,{x:c,y:l,rotate:u,text:f,title:d,fontSize:h}=r,{rotate:p}=this,[y,b]=yn(this,i);return ct("svg:g",o).call(Ft,this,i,o).call(BE,this,f,i).call(It,this,{x:c&&s,y:l&&a}).call(m=>m.selectAll().data(t).enter().append("text").call(Rt,this).call(CZ,this,f,d).attr("transform",rc`translate(${c?g=>c[g]:y},${l?g=>l[g]:b})${u?g=>` rotate(${u[g]})`:p?` rotate(${p})`:""}`).call(ft,"font-size",h&&(g=>h[g])).call(Zt,this,r)).node()}};function CE(e){return e==null?null:Ke(e,"textOverflow",["clip","ellipsis","clip-start","clip-end","ellipsis-start","ellipsis-middle","ellipsis-end"]).replace(/^(clip|ellipsis)$/,"$1-end")}function CZ(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(zi(n[l])??"").map(c),f=u.length,d=i==="top"?.71:i==="bottom"?1-f:(164-f*100)/200;if(f>1){let h=0;for(let p=0;p<f;++p){if(++h,!u[p])continue;let y=this.ownerDocument.createElementNS(ii.svg,"tspan");y.setAttribute("x",0),p===h-1?y.setAttribute("y",`${(d+p)*o}em`):y.setAttribute("dy",`${h*o}em`),y.textContent=u[p],this.appendChild(y),h=0}}else d&&this.setAttribute("y",`${d*o}em`),this.textContent=u[0];if(s&&!r&&u[0]!==n[l]){let h=this.ownerDocument.createElementNS(ii.svg,"title");h.textContent=n[l],this.appendChild(h)}})}function Bo(e,{x:t,y:n,...r}={}){return r.frameAnchor===void 0&&([t,n]=Be(t,n)),new Rl(e,{...r,x:t,y:n})}function p_(e,{x:t=W,...n}={}){return new Rl(e,h_({...n,x:t}))}function m_(e,{y:t=W,...n}={}){return new Rl(e,d_({...n,y:t}))}function BE(e,t,n){ft(e,"text-anchor",t.textAnchor),ft(e,"font-family",t.fontFamily),ft(e,"font-size",t.fontSize),ft(e,"font-style",t.fontStyle),ft(e,"font-variant",t.fontVariant===void 0?BZ(n):t.fontVariant),ft(e,"font-weight",t.fontWeight)}function BZ(e){return e&&(Ws(e)||Oe(e))?"tabular-nums":void 0}var PZ=new Set(["inherit","initial","revert","unset","xx-small","x-small","small","medium","large","x-large","xx-large","xxx-large","larger","smaller"]);function UZ(e){return e==null||typeof e=="number"?[void 0,e]:typeof e!="string"?[e,void 0]:(e=e.trim().toLowerCase(),PZ.has(e)||/^[+-]?\d*\.?\d+(e[+-]?\d+)?(\w*|%)$/.test(e)?[void 0,e]:[e,void 0])}function $Z(e,t,n){let r=[],i,o=0;for(let[s,a,c]of zZ(e)){if(i===void 0&&(i=s),o>i&&n(e,i,a)>t&&(r.push(e.slice(i,o)+(e[o-1]===fB?"-":"")),i=s),c){r.push(e.slice(i,a)),i=void 0;continue}o=a}return r}function*zZ(e){let t=0,n=0,r=e.length;for(;n<r;){let i=1;switch(e[n]){case fB: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]===`
34
+ }`)).call(Fp,u),x=O=>O.selectAll(".tick line").attr("y1",s+c-o),_,v=p?(O,R)=>O.rangeRound(R):(O,R)=>O.range(R),{type:w,domain:I,range:D,interpolate:A,scale:B,pivot:M}=e;if(A){let O=D===void 0?A:Js(A.length===1?Nb(A):A,D);_=v(B.copy(),En(Ze(l,i-a),Math.min(I.length+(M!==void 0),D===void 0?1/0:D.length)));let R=256,S=m.document.createElement("canvas");S.width=R,S.height=1;let T=S.getContext("2d");for(let E=0,C=R-1;E<R;++E)T.fillStyle=O(E/C),T.fillRect(E,0,1,1);b.append("image").attr("opacity",y).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(w==="threshold"){let O=I,R=d===void 0?S=>S:typeof d=="string"?wo(d):d;_=v(qc().domain([-1,D.length-1]),[l,i-a]),b.append("g").attr("fill-opacity",y).selectAll().data(D).enter().append("rect").attr("x",(S,T)=>_(T-1)).attr("y",s).attr("width",(S,T)=>_(T)-_(T-1)).attr("height",o-s-c).attr("fill",S=>S),f=fe(O,(S,T)=>T),d=S=>R(O[S],S)}else _=v(uu().domain(I),[l,i-a]),b.append("g").attr("fill-opacity",y).selectAll().data(I).enter().append("rect").attr("x",_).attr("y",s).attr("width",Math.max(0,_.bandwidth()-1)).attr("height",o-s-c).attr("fill",B),x=()=>{};return b.append("g").attr("transform",`translate(0,${o-c})`).call(DD(_).ticks(Array.isArray(f)?null:f,typeof d=="string"?d:void 0).tickFormat(typeof d=="function"?d:void 0).tickSize(n).tickValues(Array.isArray(f)?f:null)).attr("font-size",null).attr("font-family",null).attr("font-variant",Ne(h,"normal")).call(x).call(O=>O.select(".domain").remove()),r!==void 0&&b.append("text").attr("x",l).attr("y",s-6).attr("fill","currentColor").attr("font-weight","bold").text(r),b.node()}var jp=Math.PI/180;function _s(e,{marker:t,markerStart:r=t,markerMid:n=t,markerEnd:i=t}={}){e.markerStart=y3(r),e.markerMid=y3(n),e.markerEnd=y3(i)}function y3(e){if(e==null||e===!1)return null;if(e===!0)return Hj;if(typeof e=="function")return e;switch(`${e}`.toLowerCase()){case"none":return null;case"arrow":return Xj("auto");case"arrow-reverse":return Xj("auto-start-reverse");case"dot":return dct;case"circle":case"circle-fill":return Hj;case"circle-stroke":return hct;case"tick":return g3("auto");case"tick-x":return g3(90);case"tick-y":return g3(0)}throw new Error(`invalid marker: ${e}`)}function Xj(e){return(t,r)=>pt("svg:marker",r).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(n=>n.append("path").attr("d","M-1.5,-3l3,3l-3,3")).node()}function dct(e,t){return pt("svg:marker",t).attr("viewBox","-5 -5 10 10").attr("markerWidth",6.67).attr("markerHeight",6.67).attr("fill",e).attr("stroke","none").call(r=>r.append("circle").attr("r",2.5)).node()}function Hj(e,t){return pt("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(r=>r.append("circle").attr("r",3)).node()}function hct(e,t){return pt("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(r=>r.append("circle").attr("r",3)).node()}function g3(e){return(t,r)=>pt("svg:marker",r).attr("viewBox","-3 -3 6 6").attr("markerWidth",6).attr("markerHeight",6).attr("orient",e).attr("stroke",t).call(n=>n.append("path").attr("d","M0,-3v6")).node()}var pct=0;function ul(e,t,{stroke:r},n){return Kj(e,t,r&&(i=>r[i]),n)}function Zj(e,t,{stroke:r},n){return Kj(e,t,r&&(([i])=>r[i]),n)}function Kj(e,{markerStart:t,markerMid:r,markerEnd:n,stroke:i},o=()=>i,s){let a=new Map;function c(l){return function(u){let f=o(u),d=a.get(l);d||a.set(l,d=new Map);let h=d.get(f);if(!h){let p=this.parentNode.insertBefore(l(f,s),this),y=`plot-marker-${++pct}`;p.setAttribute("id",y),d.set(f,h=`url(#${y})`)}return h}}t&&e.attr("marker-start",c(t)),r&&e.attr("marker-mid",c(r)),n&&e.attr("marker-end",c(n))}function hd({inset:e,insetLeft:t,insetRight:r,...n}={}){return[t,r]=Qj(e,t,r),{inset:e,insetLeft:t,insetRight:r,...n}}function pd({inset:e,insetTop:t,insetBottom:r,...n}={}){return[t,r]=Qj(e,t,r),{inset:e,insetTop:t,insetBottom:r,...n}}function Qj(e,t,r){return e===void 0&&t===void 0&&r===void 0?ur?[1,0]:[.5,.5]:[t,r]}function Jj(e,{interval:t}){return e={...Mo(e)},e.interval=Ap(e.interval===void 0?t:e.interval),e}function GI(e,t,r,n){let{[e]:i,[`${e}1`]:o,[`${e}2`]:s}=r,{value:a,interval:c}=Jj(i,r);if(a==null||c==null&&!n)return r;let l=vn(i);if(c==null){let h,p={transform:y=>h||(h=Tt(y,a)),label:l};return{...r,[e]:void 0,[`${e}1`]:o===void 0?p:o,[`${e}2`]:s===void 0&&!(o===s&&n)?p:s}}let u,f;function d(h){return f!==void 0&&h===u?f:f=fe(Tt(u=h,a),p=>c.floor(p))}return t({...r,[e]:void 0,[`${e}1`]:o===void 0?{transform:d,label:l}:o,[`${e}2`]:s===void 0?{transform:h=>d(h).map(p=>c.offset(p)),label:l}:s})}function tq(e,t,r){let{[e]:n}=r,{value:i,interval:o}=Jj(n,r);return i==null||o==null?r:t({...r,[e]:{label:vn(n),transform:s=>{let a=fe(Tt(s,i),l=>o.floor(l)),c=a.map(l=>o.offset(l));return a.map(lr(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 b3(e={}){return GI("x",hd,e,!0)}function x3(e={}){return GI("y",pd,e,!0)}function XI(e={}){return GI("x",hd,e)}function HI(e={}){return GI("y",pd,e)}function ZI(e={}){return tq("x",hd,e)}function KI(e={}){return tq("y",pd,e)}var eq={ariaLabel:"rule",fill:null,stroke:"currentColor"},Lb=class extends Ft{constructor(t,r={}){let{x:n,y1:i,y2:o,inset:s=0,insetTop:a=s,insetBottom:c=s}=r;super(t,{x:{value:n,scale:"x",optional:!0},y1:{value:i,scale:"y",optional:!0},y2:{value:o,scale:"y",optional:!0}},xs(r,"x"),eq),this.insetTop=Wt(a),this.insetBottom=Wt(c),_s(this,r)}render(t,r,n,i,o){let{x:s,y:a}=r,{x:c,y1:l,y2:u}=n,{width:f,height:d,marginTop:h,marginRight:p,marginLeft:y,marginBottom:g}=i,{insetTop:m,insetBottom:b}=this;return pt("svg:g",o).call(Kt,this,i,o).call(Pt,this,{x:c&&s},ur,0).call(x=>x.selectAll().data(t).enter().append("line").call(Gt,this).attr("x1",c?_=>c[_]:(y+f-p)/2).attr("x2",c?_=>c[_]:(y+f-p)/2).attr("y1",l&&!si(a)?_=>l[_]+m:h+m).attr("y2",u&&!si(a)?a.bandwidth?_=>u[_]+a.bandwidth()-b:_=>u[_]-b:d-g-b).call(ye,this,n).call(ul,this,n,o)).node()}},Rb=class extends Ft{constructor(t,r={}){let{x1:n,x2:i,y:o,inset:s=0,insetRight:a=s,insetLeft:c=s}=r;super(t,{y:{value:o,scale:"y",optional:!0},x1:{value:n,scale:"x",optional:!0},x2:{value:i,scale:"x",optional:!0}},xs(r,"y"),eq),this.insetRight=Wt(a),this.insetLeft=Wt(c),_s(this,r)}render(t,r,n,i,o){let{x:s,y:a}=r,{y:c,x1:l,x2:u}=n,{width:f,height:d,marginTop:h,marginRight:p,marginLeft:y,marginBottom:g}=i,{insetLeft:m,insetRight:b}=this;return pt("svg:g",o).call(Kt,this,i,o).call(Pt,this,{y:c&&a},0,ur).call(x=>x.selectAll().data(t).enter().append("line").call(Gt,this).attr("x1",l&&!si(s)?_=>l[_]+m:y+m).attr("x2",u&&!si(s)?s.bandwidth?_=>u[_]+s.bandwidth()-b:_=>u[_]-b:f-p-b).attr("y1",c?_=>c[_]:(h+d-g)/2).attr("y2",c?_=>c[_]:(h+d-g)/2).call(ye,this,n).call(ul,this,n,o)).node()}};function Zi(e,t){let{x:r=K,y:n,y1:i,y2:o,...s}=HI(t);return[i,o]=rq(n,i,o),new Lb(e,{...s,x:r,y1:i,y2:o})}function Ki(e,t){let{y:r=K,x:n,x1:i,x2:o,...s}=XI(t);return[i,o]=rq(n,i,o),new Rb(e,{...s,y:r,x1:i,x2:o})}function rq(e,t,r){if(e==null){if(t===void 0){if(r!==void 0)return[0,r]}else if(r===void 0)return[0,t]}else{if(t===void 0)return r===void 0?[0,e]:[e,r];if(r===void 0)return[e,t]}return[t,r]}function Eu(e,...t){let r=t.length;for(let n=0,i=!0;n<r;++n)typeof t[n]!="function"&&(i&&(e=e.slice(),i=!1),e.splice(n,2,e[n]+t[n]+e[n+1]),t.splice(n,1),--n,--r);return n=>{let i=e[0];for(let o=0;o<r;++o)i+=t[o](n)+e[o+1];return i}}var mct={ariaLabel:"text",strokeLinejoin:"round",strokeWidth:3,paintOrder:"stroke"},aq="\xAD",yd=class extends Ft{constructor(t,r={}){let{x:n,y:i,text:o=oi(t)&&xI(t)?K:nr,frameAnchor:s,textAnchor:a=/right$/i.test(s)?"end":/left$/i.test(s)?"start":"middle",lineAnchor:c=/^top/i.test(s)?"top":/^bottom/i.test(s)?"bottom":"middle",lineHeight:l=1,lineWidth:u=1/0,textOverflow:f,monospace:d,fontFamily:h=d?"ui-monospace, monospace":void 0,fontSize:p,fontStyle:y,fontVariant:g,fontWeight:m,rotate:b}=r,[x,_]=Ae(b,0),[v,w]=xct(p);if(super(t,{x:{value:n,scale:"x",optional:!0},y:{value:i,scale:"y",optional:!0},fontSize:{value:v,optional:!0},rotate:{value:hV(x),optional:!0},text:{value:o,filter:gb,optional:!0}},r,mct),this.rotate=_,this.textAnchor=Ne(a,"middle"),this.lineAnchor=Ur(c,"lineAnchor",["top","middle","bottom"]),this.lineHeight=+l,this.lineWidth=+u,this.textOverflow=w3(f),this.monospace=!!d,this.fontFamily=vr(h),this.fontSize=w,this.fontStyle=vr(y),this.fontVariant=vr(g),this.fontWeight=vr(m),this.frameAnchor=xa(s),!(this.lineWidth>=0))throw new Error(`invalid lineWidth: ${u}`);this.splitLines=S3(this),this.clipLine=I3(this)}render(t,r,n,i,o){let{x:s,y:a}=r,{x:c,y:l,rotate:u,text:f,title:d,fontSize:h}=n,{rotate:p}=this,[y,g]=rn(this,i);return pt("svg:g",o).call(Kt,this,i,o).call(v3,this,f,i).call(Pt,this,{x:c&&s,y:l&&a}).call(m=>m.selectAll().data(t).enter().append("text").call(Gt,this).call(yct,this,f,d).attr("transform",Eu`translate(${c?b=>c[b]:y},${l?b=>l[b]:g})${u?b=>` rotate(${u[b]})`:p?` rotate(${p})`:""}`).call(yt,"font-size",h&&(b=>h[b])).call(ye,this,n)).node()}};function w3(e){return e==null?null:Ur(e,"textOverflow",["clip","ellipsis","clip-start","clip-end","ellipsis-start","ellipsis-middle","ellipsis-end"]).replace(/^(clip|ellipsis)$/,"$1-end")}function yct(e,t,r,n){if(!r)return;let{lineAnchor:i,lineHeight:o,textOverflow:s,splitLines:a,clipLine:c}=t;e.each(function(l){let u=a(gs(r[l])??"").map(c),f=u.length,d=i==="top"?.71:i==="bottom"?1-f:(164-f*100)/200;if(f>1){let h=0;for(let p=0;p<f;++p){if(++h,!u[p])continue;let y=this.ownerDocument.createElementNS(bo.svg,"tspan");y.setAttribute("x",0),p===h-1?y.setAttribute("y",`${(d+p)*o}em`):y.setAttribute("dy",`${h*o}em`),y.textContent=u[p],this.appendChild(y),h=0}}else d&&this.setAttribute("y",`${d*o}em`),this.textContent=u[0];if(s&&!n&&u[0]!==r[l]){let h=this.ownerDocument.createElementNS(bo.svg,"title");h.textContent=r[l],this.appendChild(h)}})}function va(e,{x:t,y:r,...n}={}){return n.frameAnchor===void 0&&([t,r]=gr(t,r)),new yd(e,{...n,x:t,y:r})}function QI(e,{x:t=K,...r}={}){return new yd(e,KI({...r,x:t}))}function JI(e,{y:t=K,...r}={}){return new yd(e,ZI({...r,y:t}))}function v3(e,t,r){yt(e,"text-anchor",t.textAnchor),yt(e,"font-family",t.fontFamily),yt(e,"font-size",t.fontSize),yt(e,"font-style",t.fontStyle),yt(e,"font-variant",t.fontVariant===void 0?gct(r):t.fontVariant),yt(e,"font-weight",t.fontWeight)}function gct(e){return e&&(il(e)||lr(e))?"tabular-nums":void 0}var bct=new Set(["inherit","initial","revert","unset","xx-small","x-small","small","medium","large","x-large","xx-large","xxx-large","larger","smaller"]);function xct(e){return e==null||typeof e=="number"?[void 0,e]:typeof e!="string"?[e,void 0]:(e=e.trim().toLowerCase(),bct.has(e)||/^[+-]?\d*\.?\d+(e[+-]?\d+)?(\w*|%)$/.test(e)?[void 0,e]:[e,void 0])}function _ct(e,t,r){let n=[],i,o=0;for(let[s,a,c]of wct(e)){if(i===void 0&&(i=s),o>i&&r(e,i,a)>t&&(n.push(e.slice(i,o)+(e[o-1]===aq?"-":"")),i=s),c){n.push(e.slice(i,a)),i=void 0;continue}o=a}return n}function*wct(e){let t=0,r=0,n=e.length;for(;r<n;){let i=1;switch(e[r]){case aq:case"-":++r,yield[t,r,!1],t=r;break;case" ":for(yield[t,r,!1];e[++r]===" ";);t=r;break;case"\r":e[r+1]===`
26
35
  `&&++i;case`
27
- `:yield[t,n,!0],n+=i,t=n;break;default:++n;break}}yield[t,n,!0]}var aB={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 y_(e,t=0,n=e.length){let r=0;for(let i=t;i<n;i=Cf(e,i))r+=aB[e[i]]??(hB(e,i)?120:aB.e);return r}function g_(e,t=0,n=e.length){let r=0;for(let i=t;i<n;i=Cf(e,i))r+=hB(e,i)?126:63;return r}function PE({monospace:e,lineWidth:t,textOverflow:n}){if(n!=null||t==1/0)return o=>o.split(/\r\n?|\n/g);let r=e?g_:y_,i=t*100;return o=>$Z(o,i,r)}function UE({monospace:e,lineWidth:t,textOverflow:n}){if(n==null||t==1/0)return o=>o;let r=e?g_:y_,i=t*100;switch(n){case"clip-start":return o=>lB(o,i,r,"");case"clip-end":return o=>cB(o,i,r,"");case"ellipsis-start":return o=>lB(o,i,r,Nl);case"ellipsis-middle":return o=>qZ(o,i,r,Nl);case"ellipsis-end":return o=>cB(o,i,r,Nl)}}var Nl="\u2026";function Ol(e,t,n,r){let i=[],o=0;for(let s=0,a=0,c=e.length;s<c;s=a){a=Cf(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 cB(e,t,n,r){e=e.trim();let i=n(r),[o]=Ol(e,t,n,i);return o<0?e:e.slice(0,o).trimEnd()+r}function qZ(e,t,n,r){e=e.trim();let i=n(e);if(i<=t)return e;let o=n(r)/2,[s,a]=Ol(e,t/2,n,o),[c]=Ol(e,i-t/2-a+o,n,-o);return c<0?r:e.slice(0,s).trimEnd()+r+e.slice(Cf(e,c)).trimStart()}function lB(e,t,n,r){e=e.trim();let i=n(e);if(i<=t)return e;let o=n(r),[s]=Ol(e,i-t+o,n,-o);return s<0?r:r+e.slice(Cf(e,s)).trimStart()}var LE=/[\p{Combining_Mark}\p{Emoji_Modifier}]+/uy,uB=/\p{Extended_Pictographic}/uy;function Cf(e,t){return t+=jZ(e,t)?2:1,YZ(e,t)&&(t=LE.lastIndex),VZ(e,t)?Cf(e,t+1):t}function dB(e,t){return e.charCodeAt(t)<128}function jZ(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 VZ(e,t){return e.charCodeAt(t)===8205}function YZ(e,t){return dB(e,t)?!1:(LE.lastIndex=t,LE.test(e))}function hB(e,t){return dB(e,t)?!1:(uB.lastIndex=t,uB.test(e))}var pB={ariaLabel:"vector",fill:"none",stroke:"currentColor",strokeWidth:1.5,strokeLinejoin:"round",strokeLinecap:"round"},mB=3.5,GZ=mB*5,yB={draw(e,t,n){let r=t*n/GZ;e.moveTo(0,0),e.lineTo(0,-t),e.moveTo(-r,r-t),e.lineTo(0,-t),e.lineTo(r,r-t)}},gB={draw(e,t,n){e.moveTo(-n,0),e.lineTo(0,-t),e.lineTo(n,0)}},WZ=new Map([["arrow",yB],["spike",gB]]);function XZ(e){return e&&typeof e.draw=="function"}function HZ(e){if(XZ(e))return e;let t=WZ.get(`${e}`.toLowerCase());if(t)return t;throw new Error(`invalid shape: ${e}`)}var Dl=class extends wt{constructor(t,n={}){let{x:r,y:i,r:o=mB,length:s,rotate:a,shape:c=yB,anchor:l="middle",frameAnchor:u}=n,[f,d]=ie(s,12),[h,p]=ie(a,0);super(t,{x:{value:r,scale:"x",optional:!0},y:{value:i,scale:"y",optional:!0},length:{value:f,scale:"length",optional:!0},rotate:{value:h,optional:!0}},n,pB),this.r=+o,this.length=d,this.rotate=p,this.shape=HZ(c),this.anchor=Ke(l,"anchor",["start","middle","end"]),this.frameAnchor=ko(u)}render(t,n,r,i,o){let{x:s,y:a}=n,{x:c,y:l,length:u,rotate:f}=r,{length:d,rotate:h,anchor:p,shape:y,r:b}=this,[m,g]=yn(this,i);return ct("svg:g",o).call(Ft,this,i,o).call(It,this,{x:c&&s,y:l&&a}).call(x=>x.selectAll().data(t).enter().append("path").call(Rt,this).attr("transform",rc`translate(${c?_=>c[_]:m},${l?_=>l[_]:g})${f?_=>` rotate(${f[_]})`:h?` rotate(${h})`:""}${p==="start"?"":p==="end"?u?_=>` translate(0,${u[_]})`:` translate(0,${d})`:u?_=>` translate(0,${u[_]/2})`:` translate(0,${d/2})`}`).attr("d",u?_=>{let v=Jn();return y.draw(v,u[_],b),v}:(()=>{let _=Jn();return y.draw(_,d,b),_})()).call(Zt,this,r)).node()}};function $E(e,t={}){let{x:n,y:r,...i}=t;return t.frameAnchor===void 0&&([n,r]=Be(n,r)),new Dl(e,{...i,x:n,y:r})}function b_(e,t={}){let{x:n=W,...r}=t;return new Dl(e,{...r,x:n})}function x_(e,t={}){let{y:n=W,...r}=t;return new Dl(e,{...r,y:n})}function bB(e,t={}){let{shape:n=gB,stroke:r=pB.stroke,strokeWidth:i=1,fill:o=r,fillOpacity:s=.3,anchor:a="start",...c}=t;return $E(e,{...c,shape:n,stroke:r,strokeWidth:i,fill:o,fillOpacity:s,anchor:a})}function ic(e,t){return arguments.length<2&&!sr(e)&&(t=e,e=null),t===void 0&&(t={}),[e,t]}function __({anchor:e}={},t){return e===void 0?t[0]:Ke(e,"anchor",t)}function xB(e){return __(e,["left","right"])}function _B(e){return __(e,["right","left"])}function wB(e){return __(e,["bottom","top"])}function vB(e){return __(e,["top","bottom"])}function Om(){let[e,t]=ic(...arguments);return SB("y",xB(t),e,t)}function w_(){let[e,t]=ic(...arguments);return SB("fy",_B(t),e,t)}function Dm(){let[e,t]=ic(...arguments);return IB("x",wB(t),e,t)}function v_(){let[e,t]=ic(...arguments);return IB("fx",vB(t),e,t)}function SB(e,t,n,{color:r="currentColor",opacity:i=1,stroke:o=r,strokeOpacity:s=i,strokeWidth:a=1,fill:c=r,fillOpacity:l=i,textAnchor:u,textStroke:f,textStrokeOpacity:d,textStrokeWidth:h,tickSize:p=e==="y"?6:0,tickPadding:y,tickRotate:b,x:m,margin:g,marginTop:x=g===void 0?20:g,marginRight:_=g===void 0?t==="right"?40:0:g,marginBottom:v=g===void 0?20:g,marginLeft:w=g===void 0?t==="left"?40:0:g,label:T,labelAnchor:A,labelArrow:R,labelOffset:I,...E}){return p=Nt(p),y=Nt(y),b=Nt(b),A!==void 0&&(A=Ke(A,"labelAnchor",["center","top","bottom"])),R=DB(R),Je(p&&!ne(o)?ZZ(e,t,n,{stroke:o,strokeOpacity:s,strokeWidth:a,tickSize:p,tickPadding:y,tickRotate:b,x:m,...E}):null,ne(c)?null:KZ(e,t,n,{fill:c,fillOpacity:l,stroke:f,strokeOpacity:d,strokeWidth:h,textAnchor:u,tickSize:p,tickPadding:y,tickRotate:b,x:m,marginTop:x,marginRight:_,marginBottom:v,marginLeft:w,...E}),!ne(c)&&T!==null?Bo([],AB({fill:c,fillOpacity:l,...E},function(O,k,S,M,N){let F=M[e],{marginTop:B,marginRight:C,marginBottom:P,marginLeft:U}=e==="y"&&N.inset||N,$=A??(F.bandwidth?"center":"top"),X=I??(t==="right"?C:U)-3;return $==="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=$,this.frameAnchor=`${$}-${t}`,this.rotate=0),this.dy=$==="top"?3-B:$==="bottom"?P-3:0,this.dx=t==="right"?X:-X,this.ariaLabel=`${e}-axis label`,{facets:[[0]],channels:{text:{value:[OB(e,F,{anchor:t,label:T,labelAnchor:$,labelArrow:R})]}}}})):null)}function IB(e,t,n,{color:r="currentColor",opacity:i=1,stroke:o=r,strokeOpacity:s=i,strokeWidth:a=1,fill:c=r,fillOpacity:l=i,textAnchor:u,textStroke:f,textStrokeOpacity:d,textStrokeWidth:h,tickSize:p=e==="x"?6:0,tickPadding:y,tickRotate:b,y:m,margin:g,marginTop:x=g===void 0?t==="top"?30:0:g,marginRight:_=g===void 0?20:g,marginBottom:v=g===void 0?t==="bottom"?30:0:g,marginLeft:w=g===void 0?20:g,label:T,labelAnchor:A,labelArrow:R,labelOffset:I,...E}){return p=Nt(p),y=Nt(y),b=Nt(b),A!==void 0&&(A=Ke(A,"labelAnchor",["center","left","right"])),R=DB(R),Je(p&&!ne(o)?QZ(e,t,n,{stroke:o,strokeOpacity:s,strokeWidth:a,tickSize:p,tickPadding:y,tickRotate:b,y:m,...E}):null,ne(c)?null:JZ(e,t,n,{fill:c,fillOpacity:l,stroke:f,strokeOpacity:d,strokeWidth:h,textAnchor:u,tickSize:p,tickPadding:y,tickRotate:b,y:m,marginTop:x,marginRight:_,marginBottom:v,marginLeft:w,...E}),!ne(c)&&T!==null?Bo([],AB({fill:c,fillOpacity:l,...E},function(O,k,S,M,N){let F=M[e],{marginTop:B,marginRight:C,marginBottom:P,marginLeft:U}=e==="x"&&N.inset||N,$=A??(F.bandwidth?"center":"right"),X=I??(t==="top"?B:P)-3;return $==="center"?(this.frameAnchor=t,this.textAnchor=void 0):(this.frameAnchor=`${t}-${$}`,this.textAnchor=$==="right"?"end":"start"),this.lineAnchor=t,this.dy=t==="top"?-X:X,this.dx=$==="right"?C-3:$==="left"?3-U:0,this.ariaLabel=`${e}-axis label`,{facets:[[0]],channels:{text:{value:[OB(e,F,{anchor:t,label:T,labelAnchor:$,labelArrow:R})]}}}})):null)}function ZZ(e,t,n,{strokeWidth:r=1,strokeLinecap:i=null,strokeLinejoin:o=null,facetAnchor:s=t+(e==="y"?"-empty":""),frameAnchor:a=t,tickSize:c,inset:l=0,insetLeft:u=l,insetRight:f=l,dx:d=0,y:h=e==="y"?void 0:null,...p}){return Bf(x_,e,t,`${e}-axis tick`,n,{strokeWidth:r,strokeLinecap:i,strokeLinejoin:o,facetAnchor:s,frameAnchor:a,y:h,...p,dx:t==="left"?+d-De+ +u:+d+De-f,anchor:"start",length:c,shape:t==="left"?rQ:iQ})}function QZ(e,t,n,{strokeWidth:r=1,strokeLinecap:i=null,strokeLinejoin:o=null,facetAnchor:s=t+(e==="x"?"-empty":""),frameAnchor:a=t,tickSize:c,inset:l=0,insetTop:u=l,insetBottom:f=l,dy:d=0,x:h=e==="x"?void 0:null,...p}){return Bf(b_,e,t,`${e}-axis tick`,n,{strokeWidth:r,strokeLinejoin:o,strokeLinecap:i,facetAnchor:s,frameAnchor:a,x:h,...p,dy:t==="bottom"?+d-De-f:+d+De+ +u,anchor:"start",length:c,shape:t==="bottom"?eQ:nQ})}function KZ(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*Lf):0),text:c,textAnchor:l=Math.abs(s)>60?"middle":t==="left"?"end":"start",lineAnchor:u=s>60?"top":s<-60?"bottom":"middle",fontVariant:f,inset:d=0,insetLeft:h=d,insetRight:p=d,dx:y=0,y:b=e==="y"?void 0:null,...m}){return Bf(m_,e,t,`${e}-axis tick label`,n,{facetAnchor:r,frameAnchor:i,text:c,textAnchor:l,lineAnchor:u,fontVariant:f,rotate:s,y:b,...m,dx:t==="left"?+y-o-a+ +h:+y+ +o+ +a-p},function(g,x,_,v,w){f===void 0&&(this.fontVariant=RB(g)),c===void 0&&(w.text=NB(g,x,_,v,t))})}function JZ(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*Lf):0),text:c,textAnchor:l=Math.abs(s)>=10?s<0^t==="bottom"?"start":"end":"middle",lineAnchor:u=Math.abs(s)>=10?"middle":t==="bottom"?"top":"bottom",fontVariant:f,inset:d=0,insetTop:h=d,insetBottom:p=d,dy:y=0,x:b=e==="x"?void 0:null,...m}){return Bf(p_,e,t,`${e}-axis tick label`,n,{facetAnchor:r,frameAnchor:i,text:c===void 0?null:c,textAnchor:l,lineAnchor:u,fontVariant:f,rotate:s,x:b,...m,dy:t==="bottom"?+y+ +o+ +a-p:+y-o-a+ +h},function(g,x,_,v,w){f===void 0&&(this.fontVariant=RB(g)),c===void 0&&(w.text=NB(g,x,_,v,t))})}function S_(){let[e,t]=ic(...arguments);return TB("y",xB(t),e,t)}function I_(){let[e,t]=ic(...arguments);return TB("fy",_B(t),e,t)}function T_(){let[e,t]=ic(...arguments);return EB("x",wB(t),e,t)}function E_(){let[e,t]=ic(...arguments);return EB("fx",vB(t),e,t)}function TB(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(jr,e,t,`${e}-grid`,n,{y:r,x1:o,x2:s,...MB(a)})}function EB(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(qr,e,t,`${e}-grid`,n,{x:r,y1:o,y2:s,...MB(a)})}function MB({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 AB({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]=Re(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,s){let a;function c(f,d,h,p,y,b){let m=f==null&&(t==="fx"||t==="fy"),{[t]:g}=p;if(!g)throw new Error(`missing scale: ${t}`);let x=g.domain(),{interval:_,ticks:v,tickFormat:w,tickSpacing:T=t==="x"?80:35}=o;if(typeof v=="string"&&kB(g)&&(_=v,v=void 0),v===void 0&&(v=Do(_,g.type)??tQ(g,T)),f==null){if(sr(v))f=qe(v);else if(Ha(v))f=zE(v,...ae(x));else if(g.interval){let R=g.interval;if(g.ticks){let[I,E]=ae(x),O=(E-I)/R[pf];R=UT(R,O/v)??R,f=zE(R,I,E)}else{f=x;let I=f.length;R=UT(R,I/v)??R,R!==g.interval&&(f=zE(R,...ae(f)))}if(R===g.interval){let I=Math.round(f.length/v);I>1&&(f=f.filter((E,O)=>O%I===0))}}else g.ticks?f=g.ticks(v):f=x;if(!g.ticks&&f.length&&f!==x){let R=new kr(x);f=f.filter(I=>R.has(I)),f.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"?d=[or(f)]:a[t]={scale:t,value:W}}s?.call(this,g,f,v,w,a);let A=Object.fromEntries(Object.entries(a).map(([R,I])=>[R,{...I,value:mt(f,I.value)}]));return m&&(d=b.filterFacets(f,A)),{data:f,facets:d,channels:A}}let l=Se(o).initializer,u=e(i,Se({...o,initializer:c},l));return i==null?(a=u.channels,u.channels={}):a={},u.ariaLabel=r,u.clip===void 0&&(u.clip=!1),u}function tQ(e,t){let[n,r]=ae(e.range());return(r-n)/t}function NB(e,t,n,r,i){return{value:km(e,t,n,r,i)}}function km(e,t,n,r,i){return typeof r=="function"?r:r===void 0&&t&&Oe(t)?l5(e.type,t,i)??zi:e.tickFormat?e.tickFormat(typeof n=="number"?n:null,r):r===void 0?zi:typeof r=="string"?(Oe(e.domain())?Mo:ci)(r):dn(r)}function zE(e,t,n){return e.range(t,e.offset(e.floor(n)))}var eQ={draw(e,t){e.moveTo(0,0),e.lineTo(0,t)}},nQ={draw(e,t){e.moveTo(0,0),e.lineTo(0,-t)}},rQ={draw(e,t){e.moveTo(0,0),e.lineTo(-t,0)}},iQ={draw(e,t){e.moveTo(0,0),e.lineTo(t,0)}};function RB(e){return e.bandwidth&&!e.interval?void 0:"tabular-nums"}function OB(e,t,{anchor:n,label:r=t.label,labelAnchor:i,labelArrow:o}={}){if(!(r==null||r.inferred&&kB(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=e_(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 DB(e="auto"){return ne(e)?!1:typeof e=="boolean"?e:Ke(e,"labelArrow",["auto","up","right","down","left"])}function kB(e){return Oe(e.domain())}function FB(e,t){if(t==null)return t;let n=e(t);if(!n)throw new Error(`scale not found: ${t}`);return n}function LB(e,{opacity:t,...n}={}){if(!Lo(e)&&!vE(e))throw new Error(`swatches legend requires ordinal or threshold color scale (not ${e.type})`);return BB(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 CB(e,{fill:t=e.hint?.fill!==void 0?e.hint.fill:"none",fillOpacity:n=1,stroke:r=e.hint?.stroke!==void 0?e.hint.stroke:ne(t)?"currentColor":"none",strokeOpacity:i=1,strokeWidth:o=1.5,r:s=4.5,...a}={},c){let[l,u]=Re(t),[f,d]=Re(r),h=FB(c,l),p=FB(c,f),y=s*s*Math.PI;return n=ie(n)[1],i=ie(i)[1],o=ie(o)[1],BB(e,a,(b,m,g,x)=>b.append("svg").attr("viewBox","-8 -8 16 16").attr("width",g).attr("height",x).attr("fill",l==="color"?_=>h.scale(_):u).attr("fill-opacity",n).attr("stroke",f==="color"?_=>p.scale(_):d).attr("stroke-opacity",i).attr("stroke-width",o).append("path").attr("d",_=>{let v=Jn();return e.scale(_).draw(v,y),v}))}function BB(e,t={},n){let{columns:r,tickFormat:i,fontVariant:o=c_(e),swatchSize:s=15,swatchWidth:a=s,swatchHeight:c=s,marginLeft:l=0,className:u,style:f,width:d}=t,h=tc(t);u=Tf(u),i=km(e.scale,e.domain,void 0,i);let p=ct("div",h).attr("class",`${u}-swatches ${u}-swatches-${r!=null?"columns":"wrap"}`),y;return r!=null?(y=`:where(.${u}-swatches-columns .${u}-swatch) {
36
+ `:yield[t,r,!0],r+=i,t=r;break;default:++r;break}}yield[t,r,!0]}var nq={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 tT(e,t=0,r=e.length){let n=0;for(let i=t;i<r;i=qp(e,i))n+=nq[e[i]]??(lq(e,i)?120:nq.e);return n}function eT(e,t=0,r=e.length){let n=0;for(let i=t;i<r;i=qp(e,i))n+=lq(e,i)?126:63;return n}function S3({monospace:e,lineWidth:t,textOverflow:r}){if(r!=null||t==1/0)return o=>o.split(/\r\n?|\n/g);let n=e?eT:tT,i=t*100;return o=>_ct(o,i,n)}function I3({monospace:e,lineWidth:t,textOverflow:r}){if(r==null||t==1/0)return o=>o;let n=e?eT:tT,i=t*100;switch(r){case"clip-start":return o=>oq(o,i,n,"");case"clip-end":return o=>iq(o,i,n,"");case"ellipsis-start":return o=>oq(o,i,n,md);case"ellipsis-middle":return o=>vct(o,i,n,md);case"ellipsis-end":return o=>iq(o,i,n,md)}}var md="\u2026";function gd(e,t,r,n){let i=[],o=0;for(let s=0,a=0,c=e.length;s<c;s=a){a=qp(e,s);let l=r(e,s,a);if(o+l>t){for(o+=n;o>t&&s>0;)a=s,s=i.pop(),o-=r(e,s,a);return[s,t-o]}o+=l,i.push(s)}return[-1,0]}function iq(e,t,r,n){e=e.trim();let i=r(n),[o]=gd(e,t,r,i);return o<0?e:e.slice(0,o).trimEnd()+n}function vct(e,t,r,n){e=e.trim();let i=r(e);if(i<=t)return e;let o=r(n)/2,[s,a]=gd(e,t/2,r,o),[c]=gd(e,i-t/2-a+o,r,-o);return c<0?n:e.slice(0,s).trimEnd()+n+e.slice(qp(e,c)).trimStart()}function oq(e,t,r,n){e=e.trim();let i=r(e);if(i<=t)return e;let o=r(n),[s]=gd(e,i-t+o,r,-o);return s<0?n:n+e.slice(qp(e,s)).trimStart()}var _3=/[\p{Combining_Mark}\p{Emoji_Modifier}]+/uy,sq=/\p{Extended_Pictographic}/uy;function qp(e,t){return t+=Sct(e,t)?2:1,Tct(e,t)&&(t=_3.lastIndex),Ict(e,t)?qp(e,t+1):t}function cq(e,t){return e.charCodeAt(t)<128}function Sct(e,t){let r=e.charCodeAt(t);if(r>=55296&&r<56320){let n=e.charCodeAt(t+1);return n>=56320&&n<57344}return!1}function Ict(e,t){return e.charCodeAt(t)===8205}function Tct(e,t){return cq(e,t)?!1:(_3.lastIndex=t,_3.test(e))}function lq(e,t){return cq(e,t)?!1:(sq.lastIndex=t,sq.test(e))}var uq={ariaLabel:"vector",fill:"none",stroke:"currentColor",strokeWidth:1.5,strokeLinejoin:"round",strokeLinecap:"round"},fq=3.5,Act=fq*5,dq={draw(e,t,r){let n=t*r/Act;e.moveTo(0,0),e.lineTo(0,-t),e.moveTo(-n,n-t),e.lineTo(0,-t),e.lineTo(n,n-t)}},hq={draw(e,t,r){e.moveTo(-r,0),e.lineTo(0,-t),e.lineTo(r,0)}},Mct=new Map([["arrow",dq],["spike",hq]]);function Ect(e){return e&&typeof e.draw=="function"}function Dct(e){if(Ect(e))return e;let t=Mct.get(`${e}`.toLowerCase());if(t)return t;throw new Error(`invalid shape: ${e}`)}var bd=class extends Ft{constructor(t,r={}){let{x:n,y:i,r:o=fq,length:s,rotate:a,shape:c=dq,anchor:l="middle",frameAnchor:u}=r,[f,d]=Ae(s,12),[h,p]=Ae(a,0);super(t,{x:{value:n,scale:"x",optional:!0},y:{value:i,scale:"y",optional:!0},length:{value:f,scale:"length",optional:!0},rotate:{value:h,optional:!0}},r,uq),this.r=+o,this.length=d,this.rotate=p,this.shape=Dct(c),this.anchor=Ur(l,"anchor",["start","middle","end"]),this.frameAnchor=xa(u)}render(t,r,n,i,o){let{x:s,y:a}=r,{x:c,y:l,length:u,rotate:f}=n,{length:d,rotate:h,anchor:p,shape:y,r:g}=this,[m,b]=rn(this,i);return pt("svg:g",o).call(Kt,this,i,o).call(Pt,this,{x:c&&s,y:l&&a}).call(x=>x.selectAll().data(t).enter().append("path").call(Gt,this).attr("transform",Eu`translate(${c?_=>c[_]:m},${l?_=>l[_]:b})${f?_=>` rotate(${f[_]})`:h?` rotate(${h})`:""}${p==="start"?"":p==="end"?u?_=>` translate(0,${u[_]})`:` translate(0,${d})`:u?_=>` translate(0,${u[_]/2})`:` translate(0,${d/2})`}`).attr("d",u?_=>{let v=Qn();return y.draw(v,u[_],g),v}:(()=>{let _=Qn();return y.draw(_,d,g),_})()).call(ye,this,n)).node()}};function T3(e,t={}){let{x:r,y:n,...i}=t;return t.frameAnchor===void 0&&([r,n]=gr(r,n)),new bd(e,{...i,x:r,y:n})}function rT(e,t={}){let{x:r=K,...n}=t;return new bd(e,{...n,x:r})}function nT(e,t={}){let{y:r=K,...n}=t;return new bd(e,{...n,y:r})}function pq(e,t={}){let{shape:r=hq,stroke:n=uq.stroke,strokeWidth:i=1,fill:o=n,fillOpacity:s=.3,anchor:a="start",...c}=t;return T3(e,{...c,shape:r,stroke:n,strokeWidth:i,fill:o,fillOpacity:s,anchor:a})}function Du(e,t){return arguments.length<2&&!oi(e)&&(t=e,e=null),t===void 0&&(t={}),[e,t]}function iT({anchor:e}={},t){return e===void 0?t[0]:Ur(e,"anchor",t)}function mq(e){return iT(e,["left","right"])}function yq(e){return iT(e,["right","left"])}function gq(e){return iT(e,["bottom","top"])}function bq(e){return iT(e,["top","bottom"])}function kb(){let[e,t]=Du(...arguments);return xq("y",mq(t),e,t)}function oT(){let[e,t]=Du(...arguments);return xq("fy",yq(t),e,t)}function Cb(){let[e,t]=Du(...arguments);return _q("x",gq(t),e,t)}function sT(){let[e,t]=Du(...arguments);return _q("fx",bq(t),e,t)}function xq(e,t,r,{color:n="currentColor",opacity:i=1,stroke:o=n,strokeOpacity:s=i,strokeWidth:a=1,fill:c=n,fillOpacity:l=i,textAnchor:u,textStroke:f,textStrokeOpacity:d,textStrokeWidth:h,tickSize:p=e==="y"?6:0,tickPadding:y,tickRotate:g,x:m,margin:b,marginTop:x=b===void 0?20:b,marginRight:_=b===void 0?t==="right"?40:0:b,marginBottom:v=b===void 0?20:b,marginLeft:w=b===void 0?t==="left"?40:0:b,label:I,labelAnchor:D,labelArrow:A,labelOffset:B,...M}){return p=Wt(p),y=Wt(y),g=Wt(g),D!==void 0&&(D=Ur(D,"labelAnchor",["center","top","bottom"])),A=Eq(A),Pr(p&&!Se(o)?Bct(e,t,r,{stroke:o,strokeOpacity:s,strokeWidth:a,tickSize:p,tickPadding:y,tickRotate:g,x:m,...M}):null,Se(c)?null:Nct(e,t,r,{fill:c,fillOpacity:l,stroke:f,strokeOpacity:d,strokeWidth:h,textAnchor:u,tickSize:p,tickPadding:y,tickRotate:g,x:m,marginTop:x,marginRight:_,marginBottom:v,marginLeft:w,...M}),!Se(c)&&I!==null?va([],Iq({fill:c,fillOpacity:l,...M},function(O,R,S,T,E){let C=T[e],{marginTop:U,marginRight:k,marginBottom:$,marginLeft:z}=e==="y"&&E.inset||E,V=D??(C.bandwidth?"center":"top"),Q=B??(t==="right"?k:z)-3;return V==="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=V,this.frameAnchor=`${V}-${t}`,this.rotate=0),this.dy=V==="top"?3-U:V==="bottom"?$-3:0,this.dx=t==="right"?Q:-Q,this.ariaLabel=`${e}-axis label`,{facets:[[0]],channels:{text:{value:[Mq(e,C,{anchor:t,label:I,labelAnchor:V,labelArrow:A})]}}}})):null)}function _q(e,t,r,{color:n="currentColor",opacity:i=1,stroke:o=n,strokeOpacity:s=i,strokeWidth:a=1,fill:c=n,fillOpacity:l=i,textAnchor:u,textStroke:f,textStrokeOpacity:d,textStrokeWidth:h,tickSize:p=e==="x"?6:0,tickPadding:y,tickRotate:g,y:m,margin:b,marginTop:x=b===void 0?t==="top"?30:0:b,marginRight:_=b===void 0?20:b,marginBottom:v=b===void 0?t==="bottom"?30:0:b,marginLeft:w=b===void 0?20:b,label:I,labelAnchor:D,labelArrow:A,labelOffset:B,...M}){return p=Wt(p),y=Wt(y),g=Wt(g),D!==void 0&&(D=Ur(D,"labelAnchor",["center","left","right"])),A=Eq(A),Pr(p&&!Se(o)?Oct(e,t,r,{stroke:o,strokeOpacity:s,strokeWidth:a,tickSize:p,tickPadding:y,tickRotate:g,y:m,...M}):null,Se(c)?null:Fct(e,t,r,{fill:c,fillOpacity:l,stroke:f,strokeOpacity:d,strokeWidth:h,textAnchor:u,tickSize:p,tickPadding:y,tickRotate:g,y:m,marginTop:x,marginRight:_,marginBottom:v,marginLeft:w,...M}),!Se(c)&&I!==null?va([],Iq({fill:c,fillOpacity:l,...M},function(O,R,S,T,E){let C=T[e],{marginTop:U,marginRight:k,marginBottom:$,marginLeft:z}=e==="x"&&E.inset||E,V=D??(C.bandwidth?"center":"right"),Q=B??(t==="top"?U:$)-3;return V==="center"?(this.frameAnchor=t,this.textAnchor=void 0):(this.frameAnchor=`${t}-${V}`,this.textAnchor=V==="right"?"end":"start"),this.lineAnchor=t,this.dy=t==="top"?-Q:Q,this.dx=V==="right"?k-3:V==="left"?3-z:0,this.ariaLabel=`${e}-axis label`,{facets:[[0]],channels:{text:{value:[Mq(e,C,{anchor:t,label:I,labelAnchor:V,labelArrow:A})]}}}})):null)}function Bct(e,t,r,{strokeWidth:n=1,strokeLinecap:i=null,strokeLinejoin:o=null,facetAnchor:s=t+(e==="y"?"-empty":""),frameAnchor:a=t,tickSize:c,inset:l=0,insetLeft:u=l,insetRight:f=l,dx:d=0,y:h=e==="y"?void 0:null,...p}){return Yp(nT,e,t,`${e}-axis tick`,r,{strokeWidth:n,strokeLinecap:i,strokeLinejoin:o,facetAnchor:s,frameAnchor:a,y:h,...p,dx:t==="left"?+d-ur+ +u:+d+ur-f,anchor:"start",length:c,shape:t==="left"?Cct:Uct})}function Oct(e,t,r,{strokeWidth:n=1,strokeLinecap:i=null,strokeLinejoin:o=null,facetAnchor:s=t+(e==="x"?"-empty":""),frameAnchor:a=t,tickSize:c,inset:l=0,insetTop:u=l,insetBottom:f=l,dy:d=0,x:h=e==="x"?void 0:null,...p}){return Yp(rT,e,t,`${e}-axis tick`,r,{strokeWidth:n,strokeLinejoin:o,strokeLinecap:i,facetAnchor:s,frameAnchor:a,x:h,...p,dy:t==="bottom"?+d-ur-f:+d+ur+ +u,anchor:"start",length:c,shape:t==="bottom"?Rct:kct})}function Nct(e,t,r,{facetAnchor:n=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*jp):0),text:c,textAnchor:l=Math.abs(s)>60?"middle":t==="left"?"end":"start",lineAnchor:u=s>60?"top":s<-60?"bottom":"middle",fontVariant:f,inset:d=0,insetLeft:h=d,insetRight:p=d,dx:y=0,y:g=e==="y"?void 0:null,...m}){return Yp(JI,e,t,`${e}-axis tick label`,r,{facetAnchor:n,frameAnchor:i,text:c,textAnchor:l,lineAnchor:u,fontVariant:f,rotate:s,y:g,...m,dx:t==="left"?+y-o-a+ +h:+y+ +o+ +a-p},function(b,x,_,v,w){f===void 0&&(this.fontVariant=Aq(b)),c===void 0&&(w.text=Tq(b,x,_,v,t))})}function Fct(e,t,r,{facetAnchor:n=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*jp):0),text:c,textAnchor:l=Math.abs(s)>=10?s<0^t==="bottom"?"start":"end":"middle",lineAnchor:u=Math.abs(s)>=10?"middle":t==="bottom"?"top":"bottom",fontVariant:f,inset:d=0,insetTop:h=d,insetBottom:p=d,dy:y=0,x:g=e==="x"?void 0:null,...m}){return Yp(QI,e,t,`${e}-axis tick label`,r,{facetAnchor:n,frameAnchor:i,text:c===void 0?null:c,textAnchor:l,lineAnchor:u,fontVariant:f,rotate:s,x:g,...m,dy:t==="bottom"?+y+ +o+ +a-p:+y-o-a+ +h},function(b,x,_,v,w){f===void 0&&(this.fontVariant=Aq(b)),c===void 0&&(w.text=Tq(b,x,_,v,t))})}function aT(){let[e,t]=Du(...arguments);return wq("y",mq(t),e,t)}function cT(){let[e,t]=Du(...arguments);return wq("fy",yq(t),e,t)}function lT(){let[e,t]=Du(...arguments);return vq("x",gq(t),e,t)}function uT(){let[e,t]=Du(...arguments);return vq("fx",bq(t),e,t)}function wq(e,t,r,{y:n=e==="y"?void 0:null,x:i=null,x1:o=t==="left"?i:null,x2:s=t==="right"?i:null,...a}){return Yp(Ki,e,t,`${e}-grid`,r,{y:n,x1:o,x2:s,...Sq(a)})}function vq(e,t,r,{x:n=e==="x"?void 0:null,y:i=null,y1:o=t==="top"?i:null,y2:s=t==="bottom"?i:null,...a}){return Yp(Zi,e,t,`${e}-grid`,r,{x:n,y1:o,y2:s,...Sq(a)})}function Sq({color:e="currentColor",opacity:t=.1,stroke:r=e,strokeOpacity:n=t,strokeWidth:i=1,...o}){return{stroke:r,strokeOpacity:n,strokeWidth:i,...o}}function Iq({fill:e,fillOpacity:t,fontFamily:r,fontSize:n,fontStyle:i,fontVariant:o,fontWeight:s,monospace:a,pointerEvents:c,shapeRendering:l,clip:u=!1},f){return[,e]=cr(e),[,t]=Ae(t),{facet:"super",x:null,y:null,fill:e,fillOpacity:t,fontFamily:r,fontSize:n,fontStyle:i,fontVariant:o,fontWeight:s,monospace:a,pointerEvents:c,shapeRendering:l,clip:u,initializer:f}}function Yp(e,t,r,n,i,o,s){let a;function c(f,d,h,p,y,g){let m=f==null&&(t==="fx"||t==="fy"),{[t]:b}=p;if(!b)throw new Error(`missing scale: ${t}`);let x=b.domain(),{interval:_,ticks:v,tickFormat:w,tickSpacing:I=t==="x"?80:35}=o;if(typeof v=="string"&&Dq(b)&&(_=v,v=void 0),v===void 0&&(v=ba(_,b.type)??Lct(b,I)),f==null){if(oi(v))f=Sr(v);else if(_u(v))f=A3(v,...Be(x));else if(b.interval){let A=b.interval;if(b.ticks){let[B,M]=Be(x),O=(M-B)/A[wp];A=IN(A,O/v)??A,f=A3(A,B,M)}else{f=x;let B=f.length;A=IN(A,B/v)??A,A!==b.interval&&(f=A3(A,...Be(f)))}if(A===b.interval){let B=Math.round(f.length/v);B>1&&(f=f.filter((M,O)=>O%B===0))}}else b.ticks?f=b.ticks(v):f=x;if(!b.ticks&&f.length&&f!==x){let A=new Xn(x);f=f.filter(B=>A.has(B)),f.length||kn(`Warning: the ${t}-axis ticks appear to not align with the scale domain, resulting in no ticks. Try different ticks?`)}t==="y"||t==="x"?d=[ii(f)]:a[t]={scale:t,value:K}}s?.call(this,b,f,v,w,a);let D=Object.fromEntries(Object.entries(a).map(([A,B])=>[A,{...B,value:Tt(f,B.value)}]));return m&&(d=g.filterFacets(f,D)),{data:f,facets:d,channels:D}}let l=Qe(o).initializer,u=e(i,Qe({...o,initializer:c},l));return i==null?(a=u.channels,u.channels={}):a={},u.ariaLabel=n,u.clip===void 0&&(u.clip=!1),u}function Lct(e,t){let[r,n]=Be(e.range());return(n-r)/t}function Tq(e,t,r,n,i){return{value:Ub(e,t,r,n,i)}}function Ub(e,t,r,n,i){return typeof n=="function"?n:n===void 0&&t&&lr(t)?oV(e.type,t,i)??gs:e.tickFormat?e.tickFormat(typeof r=="number"?r:null,n):n===void 0?gs:typeof n=="string"?(lr(e.domain())?ha:wo)(n):Qr(n)}function A3(e,t,r){return e.range(t,e.offset(e.floor(r)))}var Rct={draw(e,t){e.moveTo(0,0),e.lineTo(0,t)}},kct={draw(e,t){e.moveTo(0,0),e.lineTo(0,-t)}},Cct={draw(e,t){e.moveTo(0,0),e.lineTo(-t,0)}},Uct={draw(e,t){e.moveTo(0,0),e.lineTo(t,0)}};function Aq(e){return e.bandwidth&&!e.interval?void 0:"tabular-nums"}function Mq(e,t,{anchor:r,label:n=t.label,labelAnchor:i,labelArrow:o}={}){if(!(n==null||n.inferred&&Dq(t)&&/^(date|time|year)$/i.test(n))){if(n=String(n),o==="auto"&&(o=(!t.bandwidth||t.interval)&&!/[↑↓→←]/.test(n)),!o)return n;if(o===!0){let s=PI(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 ${n}`;case"right":return`${n} \u2192`;case"up":return r==="right"?`${n} \u2191`:`\u2191 ${n}`;case"down":return r==="right"?`${n} \u2193`:`\u2193 ${n}`}return n}}function Eq(e="auto"){return Se(e)?!1:typeof e=="boolean"?e:Ur(e,"labelArrow",["auto","up","right","down","left"])}function Dq(e){return lr(e.domain())}function Bq(e,t){if(t==null)return t;let r=e(t);if(!r)throw new Error(`scale not found: ${t}`);return r}function Oq(e,{opacity:t,...r}={}){if(!wa(e)&&!a3(e))throw new Error(`swatches legend requires ordinal or threshold color scale (not ${e.type})`);return Fq(e,r,(n,i,o,s)=>n.append("svg").attr("width",o).attr("height",s).attr("fill",i.scale).attr("fill-opacity",Ae(t)[1]).append("rect").attr("width","100%").attr("height","100%"))}function Nq(e,{fill:t=e.hint?.fill!==void 0?e.hint.fill:"none",fillOpacity:r=1,stroke:n=e.hint?.stroke!==void 0?e.hint.stroke:Se(t)?"currentColor":"none",strokeOpacity:i=1,strokeWidth:o=1.5,r:s=4.5,...a}={},c){let[l,u]=cr(t),[f,d]=cr(n),h=Bq(c,l),p=Bq(c,f),y=s*s*Math.PI;return r=Ae(r)[1],i=Ae(i)[1],o=Ae(o)[1],Fq(e,a,(g,m,b,x)=>g.append("svg").attr("viewBox","-8 -8 16 16").attr("width",b).attr("height",x).attr("fill",l==="color"?_=>h.scale(_):u).attr("fill-opacity",r).attr("stroke",f==="color"?_=>p.scale(_):d).attr("stroke-opacity",i).attr("stroke-width",o).append("path").attr("d",_=>{let v=Qn();return e.scale(_).draw(v,y),v}))}function Fq(e,t={},r){let{columns:n,tickFormat:i,fontVariant:o=WI(e),swatchSize:s=15,swatchWidth:a=s,swatchHeight:c=s,marginLeft:l=0,className:u,style:f,width:d}=t,h=Tu(t);u=Np(u),i=Ub(e.scale,e.domain,void 0,i);let p=pt("div",h).attr("class",`${u}-swatches ${u}-swatches-${n!=null?"columns":"wrap"}`),y;return n!=null?(y=`:where(.${u}-swatches-columns .${u}-swatch) {
28
37
  display: flex;
29
38
  align-items: center;
30
39
  break-inside: avoid;
@@ -37,7 +46,7 @@ ${n}`}function gH(e){return e==="time"?O1:e==="utc"?pm:mH}function l5(e,t,n){let
37
46
  white-space: nowrap;
38
47
  overflow: hidden;
39
48
  text-overflow: ellipsis;
40
- }`,p.style("columns",r).selectAll().data(e.domain).enter().append("div").attr("class",`${u}-swatch`).call(n,e,a,c).call(b=>b.append("div").attr("class",`${u}-swatch-label`).attr("title",i).text(i))):(y=`:where(.${u}-swatches-wrap) {
49
+ }`,p.style("columns",n).selectAll().data(e.domain).enter().append("div").attr("class",`${u}-swatch`).call(r,e,a,c).call(g=>g.append("div").attr("class",`${u}-swatch-label`).attr("title",i).text(i))):(y=`:where(.${u}-swatches-wrap) {
41
50
  display: flex;
42
51
  align-items: center;
43
52
  min-height: 33px;
@@ -47,7 +56,7 @@ ${n}`}function gH(e){return e==="time"?O1:e==="utc"?pm:mH}function l5(e,t,n){let
47
56
  display: inline-flex;
48
57
  align-items: center;
49
58
  margin-right: 1em;
50
- }`,p.selectAll().data(e.domain).enter().append("span").attr("class",`${u}-swatch`).call(n,e,a,c).append(function(){return this.ownerDocument.createTextNode(i.apply(this,arguments))})),p.call(b=>b.insert("style","*").text(`:where(.${u}-swatches) {
59
+ }`,p.selectAll().data(e.domain).enter().append("span").attr("class",`${u}-swatch`).call(r,e,a,c).append(function(){return this.ownerDocument.createTextNode(i.apply(this,arguments))})),p.call(g=>g.insert("style","*").text(`:where(.${u}-swatches) {
51
60
  font-family: system-ui, sans-serif;
52
61
  font-size: 10px;
53
62
  margin-bottom: 0.5em;
@@ -56,7 +65,7 @@ ${n}`}function gH(e){return e==="time"?O1:e==="utc"?pm:mH}function l5(e,t,n){let
56
65
  margin-right: 0.5em;
57
66
  overflow: visible;
58
67
  }
59
- ${y}`)).style("margin-left",l?`${+l}px`:null).style("width",d===void 0?null:`${+d}px`).style("font-variant",le(o,"normal")).call(Ef,f).node()}var M_=new Map([["symbol",CB],["color",$B],["opacity",oQ]]);function PB(e={}){for(let[t,n]of M_){let r=e[t];if(Ro(r)){let i=tc(e),o;if(t==="symbol"){let{fill:s,stroke:a=s===void 0&&Ro(e.color)?"color":void 0}=e;o={fill:s,stroke:a}}return n(r_(t,r,o),qE(i,r,e),s=>Ro(e[s])?r_(s,e[s]):null)}}throw new Error("unknown legend type; no scale found")}function UB(e,t,n={}){return(r,i)=>{if(!M_.has(r))throw new Error(`unknown legend type: ${r}`);if(r in e)return M_.get(r)(e[r],qE(t,n[r],i),o=>e[o])}}function qE({className:e,...t},{label:n,ticks:r,tickFormat:i}={},o){return S5(o,{className:e,...t},{label:n,ticks:r,tickFormat:i})}function $B(e,{legend:t=!0,...n}){if(t===!0&&(t=e.type==="ordinal"?"swatches":"ramp"),e.domain!==void 0)switch(`${t}`.toLowerCase()){case"swatches":return LB(e,n);case"ramp":return QC(e,n);default:throw new Error(`unknown legend type: ${t}`)}}function oQ({type:e,interpolate:t,...n},{legend:r=!0,color:i=an(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 $B({type:e,...n,interpolate:sQ(i)},{legend:r,...o})}function sQ(e){let{r:t,g:n,b:r}=an(e)||an(0,0,0);return i=>`rgba(${t},${n},${r},${i})`}function zB(e,t,n){let r=[];for(let[i,o]of M_){let s=n[i];if(s?.legend&&i in e){let a=o(e[i],qE(t,e[i],s),c=>e[c]);a!=null&&r.push(a)}}return r}var aQ={ariaLabel:"frame",fill:"none",stroke:"currentColor",clip:!1},cQ={ariaLabel:"frame",fill:null,stroke:"currentColor",strokeLinecap:"square",clip:!1},Fm=class extends wt{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(Ga,void 0,t,n==null?aQ:cQ),this.anchor=VT(n,"anchor",["top","right","bottom","left"]),this.insetTop=Nt(i),this.insetRight=Nt(o),this.insetBottom=Nt(s),this.insetLeft=Nt(a),this.rx=Nt(c),this.ry=Nt(l)}render(t,n,r,i,o){let{marginTop:s,marginRight:a,marginBottom:c,marginLeft:l,width:u,height:f}=i,{anchor:d,insetTop:h,insetRight:p,insetBottom:y,insetLeft:b,rx:m,ry:g}=this,x=l+b,_=u-a-p,v=s+h,w=f-c-y;return ct(d?"svg:line":"svg:rect",o).datum(0).call(Ft,this,i,o).call(Rt,this).call(Zt,this,r).call(It,this,{}).call(d==="left"?T=>T.attr("x1",x).attr("x2",x).attr("y1",v).attr("y2",w):d==="right"?T=>T.attr("x1",_).attr("x2",_).attr("y1",v).attr("y2",w):d==="top"?T=>T.attr("x1",x).attr("x2",_).attr("y1",v).attr("y2",v):d==="bottom"?T=>T.attr("x1",x).attr("x2",_).attr("y1",w).attr("y2",w):T=>T.attr("x",x).attr("y",v).attr("width",_-x).attr("height",w-v).attr("rx",m).attr("ry",g)).node()}};function Pf(e){return new Fm(e)}var jE={ariaLabel:"tip",fill:"var(--plot-background)",stroke:"currentColor"},lQ=new Set(["geometry","href","src","ariaLabel","scales"]),Lm=class extends wt{constructor(t,n={}){n.tip&&(n={...n,tip:!1}),n.title===void 0&&sr(t)&&L1(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:d=f?"ui-monospace, monospace":void 0,fontSize:h,fontStyle:p,fontVariant:y,fontWeight:b,lineHeight:m=1,lineWidth:g=20,frameAnchor:x,format:_,textAnchor:v="start",textOverflow:w,textPadding:T=8,title:A,pointerSize:R=12,pathFilter:I="drop-shadow(0 3px 4px rgba(0,0,0,0.2))"}=n;super(t,{x:{value:o!=null&&s!=null?null:r,scale:"x",optional:!0},y:{value:a!=null&&c!=null?null:i,scale:"y",optional:!0},x1:{value:o,scale:"x",optional:s==null},y1:{value:a,scale:"y",optional:c==null},x2:{value:s,scale:"x",optional:o==null},y2:{value:c,scale:"y",optional:a==null},title:{value:A,optional:!0}},n,jE),this.anchor=B1(l,"anchor"),this.preferredAnchor=B1(u,"preferredAnchor"),this.frameAnchor=ko(x),this.textAnchor=le(v,"middle"),this.textPadding=+T,this.pointerSize=+R,this.pathFilter=ze(I),this.lineHeight=+m,this.lineWidth=+g,this.textOverflow=CE(w),this.monospace=!!f,this.fontFamily=ze(d),this.fontSize=Nt(h),this.fontStyle=ze(p),this.fontVariant=ze(y),this.fontWeight=ze(b);for(let E in jE)E in this.channels&&(this[E]=jE[E]);this.splitLines=PE(this),this.clipLine=UE(this),this.format={..._}}render(t,n,r,i,o){let s=this,{x:a,y:c,fx:l,fy:u}=n,{ownerSVGElement:f,document:d}=o,{anchor:h,monospace:p,lineHeight:y,lineWidth:b}=this,{textPadding:m,pointerSize:g,pathFilter:x}=this,{marginTop:_,marginLeft:v}=i,{x1:w,y1:T,x2:A,y2:R,x:I=w??A,y:E=T??R}=r,O=l?l(t.fx)-v:0,k=u?u(t.fy)-_:0,[S,M]=yn(this,i),N=NE(r,S),F=RE(r,M),B=p?g_:y_,C=B(Nl),P,U;"title"in r?(P=r.channels,U=pQ):(P=hQ.call(this,r,n),U=mQ);let $=ct("svg:g",o).call(Ft,this,i,o).call(BE,this).call(It,this,{x:I&&a,y:E&&c}).call(nt=>nt.selectAll().data(t).enter().append("g").attr("transform",st=>`translate(${Math.round(N(st))},${Math.round(F(st))})`).call(Rt,this).call(st=>st.append("path").attr("filter",x)).call(st=>st.append("text").each(function(Y){let rt=zt(this);this.setAttribute("fill","currentColor"),this.setAttribute("fill-opacity",1),this.setAttribute("stroke","none");let q=U.call(s,Y,t,P,n,r);if(typeof q=="string")for(let H of s.splitLines(q))X(rt,{value:s.clipLine(H)});else{let H=new Set;for(let ot of q){let{label:z=""}=ot;z&&H.has(z)||(H.add(z),X(rt,ot))}}})));function X(nt,{label:st,value:Y,color:rt,opacity:q}){st??="",Y??="";let H=rt!=null||q!=null,ot,z=b*100,[Lt]=Ol(st,z,B,C);if(Lt>=0)st=st.slice(0,Lt).trimEnd()+Nl,ot=Y.trim(),Y="";else{(st||!Y&&!H)&&(Y=" "+Y);let[Wt]=Ol(Y,z-B(st),B,C);Wt>=0&&(ot=Y.trim(),Y=Y.slice(0,Wt).trimEnd()+Nl)}let dt=nt.append("tspan").attr("x",0).attr("dy",`${y}em`).text("\u200B");st&&dt.append("tspan").attr("font-weight","bold").text(st),Y&&dt.append(()=>d.createTextNode(Y)),H&&dt.append("tspan").text(" \u25A0").attr("fill",rt).attr("fill-opacity",q).style("user-select","none"),ot&&dt.append("title").text(ot)}function tt(){let{width:nt,height:st}=i.facet??i;$.selectChildren().each(function(Y){let{x:rt,width:q,height:H}=this.getBBox();q=Math.round(q),H=Math.round(H);let ot=h;if(ot===void 0){let dt=N(Y)+O,Wt=F(Y)+k,Xt=dt+q+g+m*2<nt,et=dt-q-g-m*2>0,oe=Wt+H+g+m*2<st,xr=Wt-H-g-m*2>0;ot=Xt&&et?oe&&xr?s.preferredAnchor:xr?"bottom":"top":oe&&xr?Xt?"left":"right":(Xt||et)&&(oe||xr)?`${xr?"bottom":"top"}-${Xt?"left":"right"}`:s.preferredAnchor}let z=this.firstChild,Lt=this.lastChild;if(z.setAttribute("d",dQ(ot,g,m,q,H)),rt)for(let dt of Lt.childNodes)dt.setAttribute("x",-rt);Lt.setAttribute("y",`${+uQ(ot,Lt.childNodes.length,y).toFixed(6)}em`),Lt.setAttribute("transform",`translate(${fQ(ot,g,m,q,H)})`)}),$.attr("visibility",null)}return t.length&&($.attr("visibility","hidden"),f.isConnected?Promise.resolve().then(tt):typeof requestAnimationFrame<"u"&&requestAnimationFrame(tt)),$.node()}};function N_(e,{x:t,y:n,...r}={}){return r.frameAnchor===void 0&&([t,n]=Be(t,n)),new Lm(e,{...r,x:t,y:n})}function uQ(e,t,n){return/^top(?:-|$)/.test(e)?.94-n:-.29-t*n}function fQ(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 dQ(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 hQ({channels:e},t){let n={},r=this.format;r=qB(r,e,"x"),r=qB(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=Sm(e,i);s&&(n[i]=s)}}for(let i in e){if(i in n||i in r||lQ.has(i))continue;let o=Sm(e,i);o&&(n[i]=o)}this.facet&&(t.fx&&!("fx"in r)&&(n.fx=!0),t.fy&&!("fy"in r)&&(n.fy=!0));for(let i in n){let o=this.format[i];if(typeof o=="string"){let s=n[i]?.value??t[i]?.domain()??[];this.format[i]=(Oe(s)?Mo:ci)(o)}else if(o===void 0||o===!0){let s=t[i];this.format[i]=s?.bandwidth?km(s,s.domain()):zi}}return n}function qB(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 pQ(e,t,{title:n}){return zi(n.value[e],e)}function*mQ(e,t,n,r,i){for(let o in n){if(o==="fx"||o==="fy"){yield{label:A_(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:VB(r,n,"x"),value:jB(this.format.x2,n.x1,s,e)};else if(o==="y2"&&"y1"in n)yield{label:VB(r,n,"y"),value:jB(this.format.y2,n.y1,s,e)};else{let a=s.value[e],c=s.scale;if(!$e(a)&&c==null)continue;yield{label:A_(r,n,o),value:this.format[o](a,e),color:c==="color"?i[o][e]:null,opacity:c==="opacity"?i[o][e]:null}}}}function jB(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 VB(e,t,n){let r=A_(e,t,`${n}1`,n),i=A_(e,t,`${n}2`,n);return r===i?r:`${r}\u2013${i}`}function A_(e,t,n,r=n){let i=t[n],o=e[i?.scale??n];return String(o?.label??i?.label??r)}function Bm(e={}){let{facet:t,style:n,title:r,subtitle:i,caption:o,ariaLabel:s,ariaDescription:a}=e,c=Tf(e.className),l=e.marks===void 0?[]:GB(e.marks);l.push(...vQ(l));let u=_Q(t,e),f=new Map;for(let C of l){let P=WB(C,u,e);P&&f.set(C,P)}let d=new Map;u&&Cm(d,[u],e),Cm(d,f,e);let h=GB(SQ(l,d,e));for(let C of h){let P=WB(C,u,e);P&&f.set(C,P)}l.unshift(...h);let p=YC(d,e);if(p!==void 0){let C=u?a_(p,u):void 0;for(let U of l){if(U.facet===null||U.facet==="super")continue;let $=f.get(U);$!==void 0&&($.facetsIndex=U.fx!=null||U.fy!=null?a_(p,$):C)}let P=new Set;for(let{facetsIndex:U}of f.values())U?.forEach(($,X)=>{$?.length>0&&P.add(X)});p.forEach(0<P.size&&P.size<p.length?(U,$)=>U.empty=!P.has($):U=>U.empty=!1);for(let U of l)if(U.facet==="exclude"){let $=f.get(U);$!==void 0&&($.facetsIndex=XC($.facetsIndex))}}for(let C of fe.keys())Ro(e[C])&&C!=="fx"&&C!=="fy"&&d.set(C,[]);let y=new Map;for(let C of l){if(y.has(C))throw new Error("duplicate mark; each mark must be unique");let{facetsIndex:P,channels:U}=f.get(C)??{},{data:$,facets:X,channels:tt}=C.initialize(P,U,e);GE(tt,e),y.set(C,{data:$,facets:X,channels:tt})}let b=Am(Cm(d,y,e),e),m=jC(b,l,e);CC(b,m);let g=_E(b),{fx:x,fy:_}=g,v=x||_?wE(b,m):m,w=x||_?RQ(g,m):m,T=tc(e),A=T.document,R=Ts("svg").call(A.documentElement),I=R;T.ownerSVGElement=R,T.className=c,T.projection=H5(e,v),T.filterFacets=(C,P)=>a_(p,{channels:P,groups:o_(C,P)}),T.getMarkState=C=>{let P=y.get(C),U=f.get(C);return{...P,channels:{...P.channels,...U?.channels}}},T.dispatchValue=C=>{I.value!==C&&(I.value=C,I.dispatchEvent(new Event("input",{bubbles:!0})))};let E=new Set;for(let[C,P]of y)if(C.initializer!=null){let U=C.facet==="super"?w:v,$=C.initializer(P.data,P.facets,P.channels,g,U,T);if($.data!==void 0&&(P.data=$.data),$.facets!==void 0&&(P.facets=$.facets),$.channels!==void 0){let{fx:X,fy:tt,...nt}=$.channels;xQ(nt),Object.assign(P.channels,nt);for(let st of Object.values(nt)){let{scale:Y}=st;Y!=null&&!T5(fe.get(Y))&&(ZB(st,e),E.add(Y))}(X!=null||tt!=null)&&f.set(C,!0)}}if(E.size){let C=new Map;Cm(C,y,e,X=>E.has(X)),Cm(d,y,e,X=>E.has(X));let P=NQ(Am(C,e),b),{scales:U,...$}=_E(P);Object.assign(b,P),Object.assign(g,$),Object.assign(g.scales,U)}let O,k;p!==void 0&&(O={x:x?.domain(),y:_?.domain()},p=GC(p,O),k=WC(x,_,m));for(let[C,P]of y)P.values=C.scale(P.channels,g,T);let{width:S,height:M}=m;zt(R).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",M).attr("viewBox",`0 0 ${S} ${M}`).attr("aria-label",s).attr("aria-description",a).call(C=>C.append("style").text(`:where(.${c}) {
68
+ ${y}`)).style("margin-left",l?`${+l}px`:null).style("width",d===void 0?null:`${+d}px`).style("font-variant",Ne(o,"normal")).call(Fp,f).node()}var fT=new Map([["symbol",Nq],["color",kq],["opacity",Pct]]);function Lq(e={}){for(let[t,r]of fT){let n=e[t];if(ya(n)){let i=Tu(e),o;if(t==="symbol"){let{fill:s,stroke:a=s===void 0&&ya(e.color)?"color":void 0}=e;o={fill:s,stroke:a}}return r(zI(t,n,o),M3(i,n,e),s=>ya(e[s])?zI(s,e[s]):null)}}throw new Error("unknown legend type; no scale found")}function Rq(e,t,r={}){return(n,i)=>{if(!fT.has(n))throw new Error(`unknown legend type: ${n}`);if(n in e)return fT.get(n)(e[n],M3(t,r[n],i),o=>e[o])}}function M3({className:e,...t},{label:r,ticks:n,tickFormat:i}={},o){return xV(o,{className:e,...t},{label:r,ticks:n,tickFormat:i})}function kq(e,{legend:t=!0,...r}){if(t===!0&&(t=e.type==="ordinal"?"swatches":"ramp"),e.domain!==void 0)switch(`${t}`.toLowerCase()){case"swatches":return Oq(e,r);case"ramp":return Gj(e,r);default:throw new Error(`unknown legend type: ${t}`)}}function Pct({type:e,interpolate:t,...r},{legend:n=!0,color:i=qr(0,0,0),...o}){if(!t)throw new Error(`${e} opacity scales are not supported`);if(n===!0&&(n="ramp"),`${n}`.toLowerCase()!=="ramp")throw new Error(`${n} opacity legends are not supported`);return kq({type:e,...r,interpolate:$ct(i)},{legend:n,...o})}function $ct(e){let{r:t,g:r,b:n}=qr(e)||qr(0,0,0);return i=>`rgba(${t},${r},${n},${i})`}function Cq(e,t,r){let n=[];for(let[i,o]of fT){let s=r[i];if(s?.legend&&i in e){let a=o(e[i],M3(t,e[i],s),c=>e[c]);a!=null&&n.push(a)}}return n}var zct={ariaLabel:"frame",fill:"none",stroke:"currentColor",clip:!1},Vct={ariaLabel:"frame",fill:null,stroke:"currentColor",strokeLinecap:"square",clip:!1},Pb=class extends Ft{constructor(t={}){let{anchor:r=null,inset:n=0,insetTop:i=n,insetRight:o=n,insetBottom:s=n,insetLeft:a=n,rx:c,ry:l}=t;super(gu,void 0,t,r==null?zct:Vct),this.anchor=DN(r,"anchor",["top","right","bottom","left"]),this.insetTop=Wt(i),this.insetRight=Wt(o),this.insetBottom=Wt(s),this.insetLeft=Wt(a),this.rx=Wt(c),this.ry=Wt(l)}render(t,r,n,i,o){let{marginTop:s,marginRight:a,marginBottom:c,marginLeft:l,width:u,height:f}=i,{anchor:d,insetTop:h,insetRight:p,insetBottom:y,insetLeft:g,rx:m,ry:b}=this,x=l+g,_=u-a-p,v=s+h,w=f-c-y;return pt(d?"svg:line":"svg:rect",o).datum(0).call(Kt,this,i,o).call(Gt,this).call(ye,this,n).call(Pt,this,{}).call(d==="left"?I=>I.attr("x1",x).attr("x2",x).attr("y1",v).attr("y2",w):d==="right"?I=>I.attr("x1",_).attr("x2",_).attr("y1",v).attr("y2",w):d==="top"?I=>I.attr("x1",x).attr("x2",_).attr("y1",v).attr("y2",v):d==="bottom"?I=>I.attr("x1",x).attr("x2",_).attr("y1",w).attr("y2",w):I=>I.attr("x",x).attr("y",v).attr("width",_-x).attr("height",w-v).attr("rx",m).attr("ry",b)).node()}};function Wp(e){return new Pb(e)}var E3={ariaLabel:"tip",fill:"var(--plot-background)",stroke:"currentColor"},jct=new Set(["geometry","href","src","ariaLabel","scales"]),$b=class extends Ft{constructor(t,r={}){r.tip&&(r={...r,tip:!1}),r.title===void 0&&oi(t)&&xI(t)&&(r={...r,title:K});let{x:n,y:i,x1:o,x2:s,y1:a,y2:c,anchor:l,preferredAnchor:u="bottom",monospace:f,fontFamily:d=f?"ui-monospace, monospace":void 0,fontSize:h,fontStyle:p,fontVariant:y,fontWeight:g,lineHeight:m=1,lineWidth:b=20,frameAnchor:x,format:_,textAnchor:v="start",textOverflow:w,textPadding:I=8,title:D,pointerSize:A=12,pathFilter:B="drop-shadow(0 3px 4px rgba(0,0,0,0.2))"}=r;super(t,{x:{value:o!=null&&s!=null?null:n,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:D,optional:!0}},r,E3),this.anchor=wI(l,"anchor"),this.preferredAnchor=wI(u,"preferredAnchor"),this.frameAnchor=xa(x),this.textAnchor=Ne(v,"middle"),this.textPadding=+I,this.pointerSize=+A,this.pathFilter=vr(B),this.lineHeight=+m,this.lineWidth=+b,this.textOverflow=w3(w),this.monospace=!!f,this.fontFamily=vr(d),this.fontSize=Wt(h),this.fontStyle=vr(p),this.fontVariant=vr(y),this.fontWeight=vr(g);for(let M in E3)M in this.channels&&(this[M]=E3[M]);this.splitLines=S3(this),this.clipLine=I3(this),this.format={..._}}render(t,r,n,i,o){let s=this,{x:a,y:c,fx:l,fy:u}=r,{ownerSVGElement:f,document:d}=o,{anchor:h,monospace:p,lineHeight:y,lineWidth:g}=this,{textPadding:m,pointerSize:b,pathFilter:x}=this,{marginTop:_,marginLeft:v}=i,{x1:w,y1:I,x2:D,y2:A,x:B=w??D,y:M=I??A}=n,O=l?l(t.fx)-v:0,R=u?u(t.fy)-_:0,[S,T]=rn(this,i),E=p3(n,S),C=m3(n,T),U=p?eT:tT,k=U(md),$,z;"title"in n?($=n.channels,z=Xct):($=Gct.call(this,n,r),z=Hct);let V=pt("svg:g",o).call(Kt,this,i,o).call(v3,this).call(Pt,this,{x:B&&a,y:M&&c}).call(st=>st.selectAll().data(t).enter().append("g").attr("transform",ut=>`translate(${Math.round(E(ut))},${Math.round(C(ut))})`).call(Gt,this).call(ut=>ut.append("path").attr("filter",x)).call(ut=>ut.append("text").each(function(X){let at=ae(this);this.setAttribute("fill","currentColor"),this.setAttribute("fill-opacity",1),this.setAttribute("stroke","none");let q=z.call(s,X,t,$,r,n);if(typeof q=="string")for(let J of s.splitLines(q))Q(at,{value:s.clipLine(J)});else{let J=new Set;for(let ct of q){let{label:j=""}=ct;j&&J.has(j)||(J.add(j),Q(at,ct))}}})));function Q(st,{label:ut,value:X,color:at,opacity:q}){ut??="",X??="";let J=at!=null||q!=null,ct,j=g*100,[Qt]=gd(ut,j,U,k);if(Qt>=0)ut=ut.slice(0,Qt).trimEnd()+md,ct=X.trim(),X="";else{(ut||!X&&!J)&&(X=" "+X);let[he]=gd(X,j-U(ut),U,k);he>=0&&(ct=X.trim(),X=X.slice(0,he).trimEnd()+md)}let gt=st.append("tspan").attr("x",0).attr("dy",`${y}em`).text("\u200B");ut&&gt.append("tspan").attr("font-weight","bold").text(ut),X&&gt.append(()=>d.createTextNode(X)),J&&gt.append("tspan").text(" \u25A0").attr("fill",at).attr("fill-opacity",q).style("user-select","none"),ct&&gt.append("title").text(ct)}function nt(){let{width:st,height:ut}=i.facet??i;V.selectChildren().each(function(X){let{x:at,width:q,height:J}=this.getBBox();q=Math.round(q),J=Math.round(J);let ct=h;if(ct===void 0){let gt=E(X)+O,he=C(X)+R,pe=gt+q+b+m*2<st,ot=gt-q-b-m*2>0,Me=he+J+b+m*2<ut,Ti=he-J-b-m*2>0;ct=pe&&ot?Me&&Ti?s.preferredAnchor:Ti?"bottom":"top":Me&&Ti?pe?"left":"right":(pe||ot)&&(Me||Ti)?`${Ti?"bottom":"top"}-${pe?"left":"right"}`:s.preferredAnchor}let j=this.firstChild,Qt=this.lastChild;if(j.setAttribute("d",Wct(ct,b,m,q,J)),at)for(let gt of Qt.childNodes)gt.setAttribute("x",-at);Qt.setAttribute("y",`${+qct(ct,Qt.childNodes.length,y).toFixed(6)}em`),Qt.setAttribute("transform",`translate(${Yct(ct,b,m,q,J)})`)}),V.attr("visibility",null)}return t.length&&(V.attr("visibility","hidden"),f.isConnected?Promise.resolve().then(nt):typeof requestAnimationFrame<"u"&&requestAnimationFrame(nt)),V.node()}};function hT(e,{x:t,y:r,...n}={}){return n.frameAnchor===void 0&&([t,r]=gr(t,r)),new $b(e,{...n,x:t,y:r})}function qct(e,t,r){return/^top(?:-|$)/.test(e)?.94-r:-.29-t*r}function Yct(e,t,r,n,i){switch(e){case"middle":return[-n/2,i/2];case"top-left":return[r,t+r];case"top":return[-n/2,t/2+r];case"top-right":return[-n-r,t+r];case"right":return[-t/2-n-r,i/2];case"bottom-left":return[r,-t-r];case"bottom":return[-n/2,-t/2-r];case"bottom-right":return[-n-r,-t-r];case"left":return[r+t/2,i/2]}}function Wct(e,t,r,n,i){let o=n+r*2,s=i+r*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 Gct({channels:e},t){let r={},n=this.format;n=Uq(n,e,"x"),n=Uq(n,e,"y"),this.format=n;for(let i in n){let o=n[i];if(!(o===null||o===!1))if(i==="fx"||i==="fy")r[i]=!0;else{let s=Eb(e,i);s&&(r[i]=s)}}for(let i in e){if(i in r||i in n||jct.has(i))continue;let o=Eb(e,i);o&&(r[i]=o)}this.facet&&(t.fx&&!("fx"in n)&&(r.fx=!0),t.fy&&!("fy"in n)&&(r.fy=!0));for(let i in r){let o=this.format[i];if(typeof o=="string"){let s=r[i]?.value??t[i]?.domain()??[];this.format[i]=(lr(s)?ha:wo)(o)}else if(o===void 0||o===!0){let s=t[i];this.format[i]=s?.bandwidth?Ub(s,s.domain()):gs}}return r}function Uq(e,t,r){if(!(r in e))return e;let n=`${r}1`,i=`${r}2`;if((n in e||!(n in t))&&(i in e||!(i in t)))return e;let o=Object.entries(e),s=e[r];return o.splice(o.findIndex(([a])=>a===r)+1,0,[n,s],[i,s]),Object.fromEntries(o)}function Xct(e,t,{title:r}){return gs(r.value[e],e)}function*Hct(e,t,r,n,i){for(let o in r){if(o==="fx"||o==="fy"){yield{label:dT(n,r,o),value:this.format[o](t[o],e)};continue}if(o==="x1"&&"x2"in r||o==="y1"&&"y2"in r)continue;let s=r[o];if(o==="x2"&&"x1"in r)yield{label:$q(n,r,"x"),value:Pq(this.format.x2,r.x1,s,e)};else if(o==="y2"&&"y1"in r)yield{label:$q(n,r,"y"),value:Pq(this.format.y2,r.y1,s,e)};else{let a=s.value[e],c=s.scale;if(!wr(a)&&c==null)continue;yield{label:dT(n,r,o),value:this.format[o](a,e),color:c==="color"?i[o][e]:null,opacity:c==="opacity"?i[o][e]:null}}}}function Pq(e,t,r,n){return r.hint?.length?`${e(r.value[n]-t.value[n],n)}`:`${e(t.value[n],n)}\u2013${e(r.value[n],n)}`}function $q(e,t,r){let n=dT(e,t,`${r}1`,r),i=dT(e,t,`${r}2`,r);return n===i?n:`${n}\u2013${i}`}function dT(e,t,r,n=r){let i=t[r],o=e[i?.scale??r];return String(o?.label??i?.label??n)}function Vb(e={}){let{facet:t,style:r,title:n,subtitle:i,caption:o,ariaLabel:s,ariaDescription:a}=e,c=Np(e.className),l=e.marks===void 0?[]:Vq(e.marks);l.push(...rlt(l));let u=tlt(t,e),f=new Map;for(let k of l){let $=jq(k,u,e);$&&f.set(k,$)}let d=new Map;u&&zb(d,[u],e),zb(d,f,e);let h=Vq(nlt(l,d,e));for(let k of h){let $=jq(k,u,e);$&&f.set(k,$)}l.unshift(...h);let p=zj(d,e);if(p!==void 0){let k=u?YI(p,u):void 0;for(let z of l){if(z.facet===null||z.facet==="super")continue;let V=f.get(z);V!==void 0&&(V.facetsIndex=z.fx!=null||z.fy!=null?YI(p,V):k)}let $=new Set;for(let{facetsIndex:z}of f.values())z?.forEach((V,Q)=>{V?.length>0&&$.add(Q)});p.forEach(0<$.size&&$.size<p.length?(z,V)=>z.empty=!$.has(V):z=>z.empty=!1);for(let z of l)if(z.facet==="exclude"){let V=f.get(z);V!==void 0&&(V.facetsIndex=qj(V.facetsIndex))}}for(let k of Fe.keys())ya(e[k])&&k!=="fx"&&k!=="fy"&&d.set(k,[]);let y=new Map;for(let k of l){if(y.has(k))throw new Error("duplicate mark; each mark must be unique");let{facetsIndex:$,channels:z}=f.get(k)??{},{data:V,facets:Q,channels:nt}=k.initialize($,z,e);O3(nt,e),y.set(k,{data:V,facets:Q,channels:nt})}let g=Fb(zb(d,y,e),e),m=Pj(g,l,e);Nj(g,m);let b=o3(g),{fx:x,fy:_}=b,v=x||_?s3(g,m):m,w=x||_?ult(b,m):m,I=Tu(e),D=I.document,A=kc("svg").call(D.documentElement),B=A;I.ownerSVGElement=A,I.className=c,I.projection=YV(e,v),I.filterFacets=(k,$)=>YI(p,{channels:$,groups:jI(k,$)}),I.getMarkState=k=>{let $=y.get(k),z=f.get(k);return{...$,channels:{...$.channels,...z?.channels}}},I.dispatchValue=k=>{B.value!==k&&(B.value=k,B.dispatchEvent(new Event("input",{bubbles:!0})))};let M=new Set;for(let[k,$]of y)if(k.initializer!=null){let z=k.facet==="super"?w:v,V=k.initializer($.data,$.facets,$.channels,b,z,I);if(V.data!==void 0&&($.data=V.data),V.facets!==void 0&&($.facets=V.facets),V.channels!==void 0){let{fx:Q,fy:nt,...st}=V.channels;Jct(st),Object.assign($.channels,st);for(let ut of Object.values(st)){let{scale:X}=ut;X!=null&&!wV(Fe.get(X))&&(Wq(ut,e),M.add(X))}(Q!=null||nt!=null)&&f.set(k,!0)}}if(M.size){let k=new Map;zb(k,y,e,Q=>M.has(Q)),zb(d,y,e,Q=>M.has(Q));let $=llt(Fb(k,e),g),{scales:z,...V}=o3($);Object.assign(g,$),Object.assign(b,V),Object.assign(b.scales,z)}let O,R;p!==void 0&&(O={x:x?.domain(),y:_?.domain()},p=Vj(p,O),R=jj(x,_,m));for(let[k,$]of y)$.values=k.scale($.channels,b,I);let{width:S,height:T}=m;ae(A).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(k=>k.append("style").text(`:where(.${c}) {
60
69
  --plot-background: white;
61
70
  display: block;
62
71
  height: auto;
@@ -66,4 +75,4 @@ ${y}`)).style("margin-left",l?`${+l}px`:null).style("width",d===void 0?null:`${+
66
75
  :where(.${c} text),
67
76
  :where(.${c} tspan) {
68
77
  white-space: pre;
69
- }`)).call(Ef,n);for(let C of l){let{channels:P,values:U,facets:$}=y.get(C);if(p===void 0||C.facet==="super"){let X=null;if($&&(X=$[0],X=C.filter(X,P,U),X.length===0))continue;let tt=C.render(X,g,U,w,T);if(tt==null)continue;R.appendChild(tt)}else{let X;for(let tt of p){if(!(C.facetAnchor?.(p,O,tt)??!tt.empty))continue;let nt=null;if($){let Y=f.has(C);if(nt=$[Y?tt.i:0],nt=C.filter(nt,P,U),nt.length===0)continue;!Y&&nt===$[0]&&(nt=Ys(nt)),nt.fx=tt.x,nt.fy=tt.y,nt.fi=tt.i}let st=C.render(nt,g,U,v,T);if(st!=null){(X??=zt(R).append("g")).append(()=>st).datum(tt);for(let Y of["aria-label","aria-description","aria-hidden","transform"])st.hasAttribute(Y)&&(X.attr(Y,st.getAttribute(Y)),st.removeAttribute(Y))}}X?.selectChildren().attr("transform",k)}}let N=zB(b,T,e),{figure:F=r!=null||i!=null||o!=null||N.length>0}=e;F&&(I=A.createElement("figure"),I.className=`${c}-figure`,I.style.maxWidth="initial",r!=null&&I.append(YB(A,r,"h2")),i!=null&&I.append(YB(A,i,"h3")),I.append(...N,R),o!=null&&I.append(yQ(A,o))),I.scale=$C(g.scales),I.legend=UB(b,T,e),I.projection=T.projection;let B=Y5();return B>0&&zt(R).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(`${B.toLocaleString("en-US")} warning${B===1?"":"s"}. Please check the console.`),I}function YB(e,t,n){if(t.ownerDocument)return t;let r=e.createElement(n);return r.append(t),r}function yQ(e,t){let n=e.createElement("figcaption");return n.append(t),n}function gQ({marks:e=[],...t}={}){return Bm({...t,marks:[...e,this]})}wt.prototype.plot=gQ;function GB(e){return e.flat(1/0).filter(t=>t!=null).map(bQ)}function bQ(e){return typeof e.render=="function"?e:new YE(e)}var YE=class extends wt{constructor(t){if(typeof t!="function")throw new TypeError("invalid mark; missing render function");super(),this.render=t}render(){}};function GE(e,t){for(let n in e)ZB(e[n],t);return e}function ZB(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:XT(s,i)}=t[n]??{};a!=null&&(e.value=Yt(e.value,a),e.transform=!1)}function xQ(e){for(let t in e)cE(t,e[t])}function Cm(e,t,n,r=d5){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(!K5(n)){let c=n.x?.domain===void 0,l=n.y?.domain===void 0;if(c||l){let[u,f]=tC(s);c&&VE(e,"x",u),l&&VE(e,"y",f)}}}else VE(e,a,s)}return e}function VE(e,t,n){let r=e.get(t);r!==void 0?r.push(n):e.set(t,[n])}function _Q(e,t){if(e==null)return;let{x:n,y:r}=e;if(n==null&&r==null)return;let i=qe(e.data);if(i==null)throw new Error("missing facet data");let o={};n!=null&&(o.fx=Sf(i,{value:n,scale:"fx"})),r!=null&&(o.fy=Sf(i,{value:r,scale:"fy"})),GE(o,t);let s=o_(i,o);return{channels:o,groups:s,data:e.data}}function WB(e,t,n){if(e.facet===null||e.facet==="super")return;let{fx:r,fy:i}=e;if(r!=null||i!=null){let c=qe(e.data??r??i);if(c===void 0)throw new Error(`missing facet data in ${e.ariaLabel}`);if(c===null)return;let l={};return r!=null&&(l.fx=Sf(c,{value:r,scale:"fx"})),i!=null&&(l.fy=Sf(c,{value:i,scale:"fy"})),GE(l,n),{channels:l,groups:o_(c,l)}}if(t===void 0)return;let{channels:o,groups:s,data:a}=t;if(e.facet!=="auto"||e.data===a)return{channels:o,groups:s};a.length>0&&(s.size>1||s.size===1&&o.fx&&o.fy&&[...s][0][1].size>1)&&qe(e.data)?.length===a.length&&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 wQ(e,t={}){return Se({...t,x:null,y:null},(n,r,i,o,s,a)=>a.getMarkState(e))}function vQ(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)?Ff:/^y$/i.test(i)?El:kf,r=i(wQ(n,r)),r.title=null,o===void 0&&(r.preferredAnchor=i===El?"left":"bottom");let s=N_(n.data,r);s.facet=n.facet,s.facetAnchor=n.facetAnchor,t.push(s)}}return t}function SQ(e,t,n){let{projection:r,x:i={},y:o={},fx:s={},fy:a={},axis:c,grid:l,facet:u={},facet:{axis:f=c,grid:d}=u,x:{axis:h=c,grid:p=h===null?null:l}=i,y:{axis:y=c,grid:b=y===null?null:l}=o,fx:{axis:m=f,grid:g=m===null?null:d}=s,fy:{axis:x=f,grid:_=x===null?null:d}=a}=n;(r||!Ro(i)&&!XB("x",e))&&(h=p=null),(r||!Ro(o)&&!XB("y",e))&&(y=b=null),t.has("fx")||(m=g=null),t.has("fy")||(x=_=null),h===void 0&&(h=!D_(e,"x")),y===void 0&&(y=!D_(e,"y")),m===void 0&&(m=!D_(e,"fx")),x===void 0&&(x=!D_(e,"fy")),h===!0&&(h="bottom"),y===!0&&(y="left"),m===!0&&(m=h==="top"||h===null?"bottom":"top"),x===!0&&(x=y==="right"||y===null?"left":"right");let v=[];return O_(v,_,I_,a),R_(v,x,w_,"right","left",u,a),O_(v,g,E_,s),R_(v,m,v_,"top","bottom",u,s),O_(v,b,S_,o),R_(v,y,Om,"left","right",n,o),O_(v,p,T_,i),R_(v,h,Dm,"bottom","top",n,i),v}function R_(e,t,n,r,i,o,s){if(!t)return;let a=IQ(t);s=TQ(a?r:t,o,s);let{line:c}=s;(n===Om||n===Dm)&&c&&!Xs(c)&&e.push(Pf(EQ(s))),e.push(n(s)),a&&e.push(n({...s,anchor:i,label:null}))}function O_(e,t,n,r){!t||Xs(t)||e.push(n(MQ(t,r)))}function IQ(e){return/^\s*both\s*$/i.test(e)}function TQ(e,t,{line:n=t.line,ticks:r,tickSize:i,tickSpacing:o,tickPadding:s,tickFormat:a,tickRotate:c,fontVariant:l,ariaLabel:u,ariaDescription:f,label:d=t.label,labelAnchor:h,labelArrow:p=t.labelArrow,labelOffset:y}){return{anchor:e,line:n,ticks:r,tickSize:i,tickSpacing:o,tickPadding:s,tickFormat:a,tickRotate:c,fontVariant:l,ariaLabel:u,ariaDescription:f,label:d,labelAnchor:h,labelArrow:p,labelOffset:y}}function EQ(e){let{anchor:t,line:n}=e;return{anchor:t,facetAnchor:t+"-empty",stroke:n===!0?void 0:n}}function MQ(e,{stroke:t=Za(e)?e:void 0,ticks:n=AQ(e)?e:void 0,tickSpacing:r,ariaLabel:i,ariaDescription:o}){return{stroke:t,ticks:n,tickSpacing:r,ariaLabel:i,ariaDescription:o}}function AQ(e){switch(typeof e){case"number":return!0;case"string":return!Za(e)}return sr(e)||typeof e?.range=="function"}function D_(e,t){let n=`${t}-axis `;return e.some(r=>r.ariaLabel?.startsWith(n))}function XB(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 NQ(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 RQ({fx:e,fy:t},n){let{marginTop:r,marginRight:i,marginBottom:o,marginLeft:s,width:a,height:c}=n_(n),l=e&&HB(e),u=t&&HB(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 HB(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 OQ=new Map([["basis",pT],["basis-closed",mT],["basis-open",yT],["bundle",gT],["bump-x",lT],["bump-y",uT],["cardinal",bT],["cardinal-closed",xT],["cardinal-open",_T],["catmull-rom",wT],["catmull-rom-closed",vT],["catmull-rom-open",ST],["linear",$s],["linear-closed",IT],["monotone-x",ET],["monotone-y",MT],["natural",AT],["step",NT],["step-after",OT],["step-before",RT]]);function Pm(e=$s,t){if(typeof e=="function")return e;let n=OQ.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 k_(e=oc,t){return typeof e!="function"&&`${e}`.toLowerCase()==="auto"?oc:Pm(e,t)}function oc(e){return $s(e)}function Po(e={y:"count"},t={}){[e,t]=XE(e,t);let{x:n,y:r}=t;return WE(F_(n,t,W),null,null,r,e,Ml(t))}function Uo(e={x:"count"},t={}){[e,t]=XE(e,t);let{x:n,y:r}=t;return WE(null,F_(r,t,W),n,null,e,Al(t))}function ta(e={fill:"count"},t={}){[e,t]=XE(e,t);let{x:n,y:r}=DQ(t);return WE(n,r,null,null,e,Ml(Al(t)))}function JB(e,t,n={}){if(n?.interval==null)return n;let{reduce:r=V1}=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 Uf(e={}){return JB(Po,"y",ji(e,"x"))}function $f(e={}){return JB(Uo,"x",ji(e,"y"))}function WE(e,t,n,r,{data:i=j1,filter:o=xm,sort:s,reverse:a,...c}={},l={}){e=QB(e),t=QB(t),c=kQ(c,l),i=n7(i,W),s=s==null?void 0:t7("sort",s,l),o=o==null?void 0:e7("filter",o,l),n!=null&&Fo(c,"x","x1","x2")&&(n=null),r!=null&&Fo(c,"y","y1","y2")&&(r=null);let[u,f]=Rn(e),[d,h]=Rn(e),[p,y]=Rn(t),[b,m]=Rn(t),[g,x]=n!=null?[n,"x"]:r!=null?[r,"y"]:[],[_,v]=Rn(g),{x:w,y:T,z:A,fill:R,stroke:I,x1:E,x2:O,y1:k,y2:S,domain:M,cumulative:N,thresholds:F,interval:B,...C}=l,[P,U]=Rn(A),[$]=Re(R),[X]=Re(I),[tt,nt]=Rn($),[st,Y]=Rn(X);return{..."z"in l&&{z:P||A},..."fill"in l&&{fill:tt||R},..."stroke"in l&&{stroke:st||I},...mn(C,(rt,q,H)=>{let ot=wl(mt(rt,g),H?.[x]),z=mt(rt,A),Lt=mt(rt,$),dt=mt(rt,X),Wt=vm(c,{z,fill:Lt,stroke:dt}),Xt=[],et=[],oe=ot&&v([]),xr=z&&U([]),Gi=Lt&&nt([]),V9=dt&&Y([]),W4=e&&f([]),Y9=e&&h([]),X4=t&&y([]),G9=t&&m([]),W9=CQ(e,t,rt),X9=0;for(let ql of c)ql.initialize(rt);s&&s.initialize(rt),o&&o.initialize(rt);for(let ql of q){let H4=[];for(let bd of c)bd.scope("facet",ql);s&&s.scope("facet",ql),o&&o.scope("facet",ql);for(let[bd,H9]of Qa(ql,Wt))for(let[Z9,Dy]of Qa(H9,ot))for(let[Wi,yc]of W9(Dy))if(!(o&&!o.reduce(Wi,yc))){H4.push(X9++),et.push(i.reduceIndex(Wi,rt,yc)),ot&&oe.push(Z9),z&&xr.push(Wt===z?bd:z[(Wi.length>0?Wi:Dy)[0]]),Lt&&Gi.push(Wt===Lt?bd:Lt[(Wi.length>0?Wi:Dy)[0]]),dt&&V9.push(Wt===dt?bd:dt[(Wi.length>0?Wi:Dy)[0]]),W4&&(W4.push(yc.x1),Y9.push(yc.x2)),X4&&(X4.push(yc.y1),G9.push(yc.y2));for(let Q9 of c)Q9.reduce(Wi,yc);s&&s.reduce(Wi)}Xt.push(H4)}return sE(Xt,s,a),{data:et,facets:Xt}}),...!Fo(c,"x")&&(u?{x1:u,x2:d,x:bf(u,d)}:{x:w,x1:E,x2:O}),...!Fo(c,"y")&&(p?{y1:p,y2:b,y:bf(p,b)}:{y:T,y1:k,y2:S}),..._&&{[x]:_},...Object.fromEntries(c.map(({name:rt,output:q})=>[rt,q]))}}function XE({cumulative:e,domain:t,thresholds:n,interval:r,...i},o){return[i,{cumulative:e,domain:t,thresholds:n,interval:r,...o}]}function F_(e,{cumulative:t,domain:n,thresholds:r,interval:i},o){return e={...pi(e)},e.domain===void 0&&(e.domain=n),e.cumulative===void 0&&(e.cumulative=t),e.thresholds===void 0&&(e.thresholds=r),e.interval===void 0&&(e.interval=i),e.value===void 0&&(e.value=o),e.thresholds=HE(e.thresholds,e.interval),e}function DQ(e){let{x:t,y:n}=e;return t=F_(t,e),n=F_(n,e),[t.value,n.value]=Be(t.value,n.value),{x:t,y:n}}function QB(e){if(e==null)return;let{value:t,cumulative:n,domain:r=ae,thresholds:i}=e,o=s=>{let a=mt(s,t),c;if(Oe(a)||LQ(i)){a=Yt(a,jT,Float64Array);let[u,f]=typeof r=="function"?r(a):r,d=typeof i=="function"&&!Ha(i)?i(a,u,f):i;typeof d=="number"&&(d=zp(u,f,d)),Ha(d)&&(r===ae&&(u=d.floor(u),f=d.offset(d.floor(f))),d=d.range(u,d.offset(f))),c=d}else{a=Qe(a);let[u,f]=typeof r=="function"?r(a):r,d=typeof i=="function"&&!Ha(i)?i(a,u,f):i;if(typeof d=="number")if(r===ae){let h=vs(u,f,d);if(isFinite(h))if(h>0){let p=Math.round(u/h),y=Math.round(f/h);p*h<=u||--p,y*h>f||++y;let b=y-p+1;d=new Float64Array(b);for(let m=0;m<b;++m)d[m]=(p+m)*h}else if(h<0){h=-h;let p=Math.round(u*h),y=Math.round(f*h);p/h<=u||--p,y/h>f||++y;let b=y-p+1;d=new Float64Array(b);for(let m=0;m<b;++m)d[m]=(p+m)/h}else d=[u];else d=[u]}else d=Tn(u,f,d);else Ha(d)&&(r===ae&&(u=d.floor(u),f=d.offset(d.floor(f))),d=d.range(u,d.offset(f)));c=d}let l=[];if(c.length===1)l.push([c[0],c[0]]);else for(let u=1;u<c.length;++u)l.push([c[u-1],c[u]]);return l.bin=(n<0?PQ:n>0?BQ:ZE)(l,c,a),l};return o.label=On(t),o}function HE(e,t,n=KB){if(e===void 0)return t===void 0?n:Do(t);if(typeof e=="string"){switch(e.toLowerCase()){case"freedman-diaconis":return E0;case"scott":return Ch;case"sturges":return Ma;case"auto":return KB}return mm(e)}return e}function kQ(e,t){return iE(e,t,t7)}function t7(e,t,n){return z1(e,t,n,e7)}function e7(e,t,n){return q1(e,t,n,n7)}function n7(e,t){return vf(e,t,FQ)}function FQ(e){switch(`${e}`.toLowerCase()){case"x":return UQ;case"x1":return zQ;case"x2":return qQ;case"y":return $Q;case"y1":return jQ;case"y2":return VQ}throw new Error(`invalid bin reduce: ${e}`)}function KB(e,t,n){return Math.min(200,Ch(e,t,n))}function LQ(e){return y5(e)||sr(e)&&Oe(e)}function CQ(e,t,n){let r=e?.(n),i=t?.(n);return r&&i?function*(o){let s=r.bin(o);for(let[a,[c,l]]of r.entries()){let u=i.bin(s[a]);for(let[f,[d,h]]of i.entries())yield[u[f],{data:n,x1:c,y1:d,x2:l,y2:h}]}}:r?function*(o){let s=r.bin(o);for(let[a,[c,l]]of r.entries())yield[s[a],{data:n,x1:c,x2:l}]}:function*(o){let s=i.bin(o);for(let[a,[c,l]]of i.entries())yield[s[a],{data:n,y1:c,y2:l}]}}function ZE(e,t,n){return t=Qe(t),r=>{let i=e.map(()=>[]);for(let o of r)i[ws(t,n[o])-1]?.push(o);return i}}function BQ(e,t,n){let r=ZE(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 PQ(e,t,n){let r=ZE(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 r7(e,t){let n=(+e+ +t)/2;return e instanceof Date?new Date(n):n}var UQ={reduceIndex(e,t,{x1:n,x2:r}){return r7(n,r)}},$Q={reduceIndex(e,t,{y1:n,y2:r}){return r7(n,r)}},zQ={reduceIndex(e,t,{x1:n}){return n}},qQ={reduceIndex(e,t,{x2:n}){return n}},jQ={reduceIndex(e,t,{y1:n}){return n}},VQ={reduceIndex(e,t,{y2:n}){return n}};function zf(e={}){return YT(e)?e:{...e,x:W}}function qf(e={}){return GT(e)?e:{...e,y:W}}function i7(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=Xa(e);let o=e[$T]=new Uint32Array(n+i);t=t.map(a=>Xa(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 QE(e={},t={}){arguments.length===1&&([e,t]=Yf(e));let{y1:n,y:r=n,x:i,...o}=t,[s,a,c,l]=Gf(r,i,"y","x",e,o);return{...s,y1:n,y:a,x1:c,x2:l,x:bf(c,l)}}function a7(e={},t={}){arguments.length===1&&([e,t]=Yf(e));let{y1:n,y:r=n,x:i}=t,[o,s,a]=Gf(r,i,"y","x",e,t);return{...o,y1:n,y:s,x:a}}function c7(e={},t={}){arguments.length===1&&([e,t]=Yf(e));let{y1:n,y:r=n,x:i}=t,[o,s,,a]=Gf(r,i,"y","x",e,t);return{...o,y1:n,y:s,x:a}}function KE(e={},t={}){arguments.length===1&&([e,t]=Yf(e));let{x1:n,x:r=n,y:i,...o}=t,[s,a,c,l]=Gf(r,i,"x","y",e,o);return{...s,x1:n,x:a,y1:c,y2:l,y:bf(c,l)}}function l7(e={},t={}){arguments.length===1&&([e,t]=Yf(e));let{x1:n,x:r=n,y:i}=t,[o,s,a]=Gf(r,i,"x","y",e,t);return{...o,x1:n,x:s,y:a}}function u7(e={},t={}){arguments.length===1&&([e,t]=Yf(e));let{x1:n,x:r=n,y:i}=t,[o,s,,a]=Gf(r,i,"x","y",e,t);return{...o,x1:n,x:s,y:a}}function jf({x:e,x1:t,x2:n,...r}={}){return r=ji(r,"y"),t===void 0&&n===void 0?QE({x:e,...r}):([t,n]=WT(e,t,n),{...r,x1:t,x2:n})}function Vf({y:e,y1:t,y2:n,...r}={}){return r=ji(r,"x"),t===void 0&&n===void 0?KE({y:e,...r}):([t,n]=WT(e,t,n),{...r,y1:t,y2:n})}function Yf(e){let{offset:t,order:n,reverse:r,...i}=e;return[{offset:t,order:n,reverse:r},i]}var YQ={length:!0};function Gf(e,t=ym,n,r,{offset:i,order:o,reverse:s},a){if(t===null)throw new Error(`stack requires ${r}`);let c=zn(a),[l,u]=Rn(e),[f,d]=pn(t),[h,p]=pn(t);return f.hint=h.hint=YQ,i=GQ(i),o=HQ(o,i,r),[mn(a,(y,b,m)=>{({data:y,facets:b}=i7(y,b));let g=e==null?void 0:u(wl(mt(y,e),m?.[n])),x=mt(y,t,Float64Array),_=mt(y,c),v=o&&o(y,g,x,_),w=y.length,T=d(new Float64Array(w)),A=p(new Float64Array(w)),R=[];for(let I of b){let E=g?Array.from(sn(I,O=>g[O]).values()):[I];if(v)for(let O of E)O.sort(v);for(let O of E){let k=0,S=0;s&&O.reverse();for(let M of O){let N=x[M];N<0?k=A[M]=(T[M]=k)+N:N>0?S=A[M]=(T[M]=S)+N:A[M]=T[M]=S}}R.push(E)}return i&&i(R,T,A,_),{data:y,facets:b}}),l,f,h]}function GQ(e){if(e!=null){if(typeof e=="function")return e;switch(`${e}`.toLowerCase()){case"expand":case"normalize":return WQ;case"center":case"silhouette":return XQ;case"wiggle":return d7}throw new Error(`unknown offset: ${e}`)}}function f7(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 WQ(e,t,n){for(let r of e)for(let i of r){let[o,s]=f7(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 XQ(e,t,n){for(let r of e){for(let i of r){let[o,s]=f7(i,n);for(let a of i){let c=(s+o)/2;t[a]-=c,n[a]-=c}}h7(r,t,n)}p7(e,t,n)}function d7(e,t,n,r){for(let i of e){let o=new Hn,s=0;for(let a of i){let c=-1,l=a.map(h=>Math.abs(n[h]-t[h])),u=a.map(h=>{c=r?r[h]:++c;let p=n[h]-t[h],y=o.has(c)?p-o.get(c):0;return o.set(c,p),y}),f=[0,...w0(u)];for(let h of a)t[h]+=s,n[h]+=s;let d=En(l);d&&(s-=En(l,(h,p)=>(u[p]/2+f[p])*h)/d)}h7(i,t,n)}p7(e,t,n)}function h7(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 p7(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])+$t(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 HQ(e,t,n){if(e===void 0&&t===d7)return o7(fn);if(e!=null){if(typeof e=="string"){let r=e.startsWith("-"),i=r?bl:fn;switch((r?e.slice(1):e).toLowerCase()){case"value":case n:return ZQ(i);case"z":return QQ(i);case"sum":return KQ(i);case"appearance":return JQ(i);case"inside-out":return o7(i)}return s7(zT(e))}if(typeof e=="function")return(e.length===1?s7:tK)(e);if(Array.isArray(e))return eK(e);throw new Error(`invalid order: ${e}`)}}function ZQ(e){return(t,n,r)=>(i,o)=>e(r[i],r[o])}function QQ(e){return(t,n,r,i)=>(o,s)=>e(i[o],i[s])}function KQ(e){return L_(e,(t,n,r,i)=>xu(or(t),o=>En(o,s=>r[s]),o=>i[o]))}function JQ(e){return L_(e,(t,n,r,i)=>xu(or(t),o=>n[Vc(o,s=>r[s])],o=>i[o]))}function o7(e){return L_(e,(t,n,r,i)=>{let o=or(t),s=xu(o,f=>n[Vc(f,d=>r[d])],f=>i[f]),a=Ci(o,f=>En(f,d=>r[d]),f=>i[f]),c=[],l=[],u=0;for(let f of s)u<0?(u+=a.get(f),c.push(f)):(u-=a.get(f),l.push(f));return l.reverse().concat(c)})}function s7(e){return t=>{let n=mt(t,e);return(r,i)=>fn(n[r],n[i])}}function tK(e){return t=>(n,r)=>e(t[n],t[r])}function eK(e){return L_(fn,()=>e)}function L_(e,t){return(n,r,i,o)=>{if(!o)throw new Error("missing channel: z");let s=new Hn(t(n,r,i,o).map((a,c)=>[a,c]));return(a,c)=>e(s.get(o[a]),s.get(o[c]))}}var nK={ariaLabel:"area",strokeWidth:1,strokeLinecap:"round",strokeLinejoin:"round",strokeMiterlimit:1},kl=class extends wt{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,nK),this.z=a,this.curve=Pm(c,l)}filter(t){return t}render(t,n,r,i,o){let{x1:s,y1:a,x2:c=s,y2:l=a}=r;return ct("svg:g",o).call(Ft,this,i,o).call(It,this,n,0,0).call(u=>u.selectAll().data(H1(t,[s,a,c,l],this,r)).enter().append("path").call(Rt,this).call(Tl,this,r).attr("d",of().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 Um(e,t){return t===void 0?ea(e,{x:Vs,y:Wa}):new kl(e,t)}function sc(e,t){let{y:n=Me,...r}=$f(t);return new kl(e,jf(zf({...r,y1:n,y2:void 0})))}function ea(e,t){let{x:n=Me,...r}=Uf(t);return new kl(e,Vf(qf({...r,x1:n,x2:void 0})))}var rK={ariaLabel:"link",fill:"none",stroke:"currentColor",strokeMiterlimit:1},$m=class extends wt{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,rK),this.curve=k_(a,c),Vi(this,n)}project(t,n,r){this.curve!==oc&&super.project(t,n,r)}render(t,n,r,i,o){let{x1:s,y1:a,x2:c=s,y2:l=a}=r,{curve:u}=this;return ct("svg:g",o).call(Ft,this,i,o).call(It,this,n).call(f=>f.selectAll().data(t).enter().append("path").call(Rt,this).attr("d",u===oc&&o.projection?iK(o.projection,s,a,c,l):d=>{let h=Jn(),p=u(h);return p.lineStart(),p.point(s[d],a[d]),p.point(c[d],l[d]),p.lineEnd(),h}).call(Zt,this,r).call(Js,this,r,o)).node()}};function iK(e,t,n,r,i){let o=An(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 C_(e,{x:t,x1:n,x2:r,y:i,y1:o,y2:s,...a}={}){return[n,r]=zm(t,n,r),[o,s]=zm(i,o,s),new $m(e,{...a,x1:n,x2:r,y1:o,y2:s})}function zm(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 oK={ariaLabel:"arrow",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeMiterlimit:1,strokeWidth:1.5},qm=class extends wt{constructor(t,n={}){let{x1:r,y1:i,x2:o,y2:s,bend:a=0,headAngle:c=60,headLength:l=8,inset:u=0,insetStart:f=u,insetEnd:d=u,sweep:h}=n;super(t,{x1:{value:r,scale:"x"},y1:{value:i,scale:"y"},x2:{value:o,scale:"x",optional:!0},y2:{value:s,scale:"y",optional:!0}},n,oK),this.bend=a===!0?22.5:Math.max(-90,Math.min(90,a)),this.headAngle=+c,this.headLength=+l,this.insetStart=+f,this.insetEnd=+d,this.sweep=sK(h)}render(t,n,r,i,o){let{x1:s,y1:a,x2:c=s,y2:l=a,SW:u}=r,{strokeWidth:f,bend:d,headAngle:h,headLength:p,insetStart:y,insetEnd:b}=this,m=u?_=>u[_]:dn(f===void 0?1:f),g=h*Lf/2,x=p/1.5;return ct("svg:g",o).call(Ft,this,i,o).call(It,this,n).call(_=>_.selectAll().data(t).enter().append("path").call(Rt,this).attr("d",v=>{let w=s[v],T=a[v],A=c[v],R=l[v],I=Math.hypot(A-w,R-T);if(I<=y+b)return null;let E=Math.atan2(R-T,A-w),O=Math.min(x*m(v),I/3),k=this.sweep(w,T,A,R)*d*Lf,S=Math.hypot(I/Math.tan(k),I)/2;if(y||b)if(S<1e5){let tt=Math.sign(k),[nt,st]=aK([w,T],[A,R],S,tt);if(y&&([w,T]=m7([nt,st,S],[w,T,y],-tt*Math.sign(y))),b){let[Y,rt]=m7([nt,st,S],[A,R,b],tt*Math.sign(b));E+=Math.atan2(rt-st,Y-nt)-Math.atan2(R-st,A-nt),A=Y,R=rt}}else{let tt=A-w,nt=R-T,st=Math.hypot(tt,nt);y&&(w+=tt/st*y,T+=nt/st*y),b&&(A-=tt/st*b,R-=nt/st*b)}let M=E+k,N=M+g,F=M-g,B=A-O*Math.cos(N),C=R-O*Math.sin(N),P=A-O*Math.cos(F),U=R-O*Math.sin(F),$=S<1e5?`A${S},${S} 0,0,${k>0?1:0} `:"L",X=O?`M${B},${C}L${A},${R}L${P},${U}`:"";return`M${w},${T}${$}${A},${R}${X}`}).call(Zt,this,r)).node()}};function sK(e=1){if(typeof e=="number")return dn(Math.sign(e));if(typeof e=="function")return(t,n,r,i)=>Math.sign(e(t,n,r,i));switch(Ke(e,"sweep",["+x","-x","+y","-y"])){case"+x":return(t,n,r)=>Gt(t,r);case"-x":return(t,n,r)=>Xn(t,r);case"+y":return(t,n,r,i)=>Gt(n,i);case"-y":return(t,n,r,i)=>Xn(n,i)}}function aK([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 m7([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 y7(e,{x:t,x1:n,x2:r,y:i,y1:o,y2:s,...a}={}){return[n,r]=zm(t,n,r),[o,s]=zm(i,o,s),new qm(e,{...a,x1:n,x2:r,y1:o,y2:s})}var Wf=class extends wt{constructor(t,n,r={},i){super(t,n,r,i);let{inset:o=0,insetTop:s=o,insetRight:a=o,insetBottom:c=o,insetLeft:l=o,rx:u,ry:f}=r;this.insetTop=Nt(s),this.insetRight=Nt(a),this.insetBottom=Nt(c),this.insetLeft=Nt(l),this.rx=le(u,"auto"),this.ry=le(f,"auto")}render(t,n,r,i,o){let{rx:s,ry:a}=this;return ct("svg:g",o).call(Ft,this,i,o).call(this._transform,this,n).call(c=>c.selectAll().data(t).enter().append("rect").call(Rt,this).attr("x",this._x(n,r,i)).attr("width",this._width(n,r,i)).attr("y",this._y(n,r,i)).attr("height",this._height(n,r,i)).call(ft,"rx",s).call(ft,"ry",a).call(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)}},g7={ariaLabel:"bar"},jm=class extends Wf{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,g7)}_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)}},Vm=class extends Wf{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,g7)}_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 yf(t)||(t={...t,y:Me,x2:W}),new jm(e,jf(u_(zf(t))))}function zo(e,t={}){return yf(t)||(t={...t,x:Me,y2:W}),new Vm(e,Vf(f_(qf(t))))}var cK={ariaLabel:"cell"},Fl=class extends Wf{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,cK)}_transform(t,n){t.call(It,n,{},0,0)}};function ac(e,{x:t,y:n,...r}={}){return[t,n]=Be(t,n),new Fl(e,{...r,x:t,y:n})}function b7(e,{x:t=Me,fill:n,stroke:r,...i}={}){return n===void 0&&Re(r)[0]===void 0&&(n=W),new Fl(e,{...i,x:t,fill:n,stroke:r})}function x7(e,{y:t=Me,fill:n,stroke:r,...i}={}){return n===void 0&&Re(r)[0]===void 0&&(n=W),new Fl(e,{...i,y:t,fill:n,stroke:r})}var lK={ariaLabel:"dot",fill:"none",stroke:"currentColor",strokeWidth:1.5};function Ym(e){return e.sort===void 0&&e.reverse===void 0?U1({channel:"-r"},e):e}var Ll=class extends wt{constructor(t,n={}){let{x:r,y:i,r:o,rotate:s,symbol:a=zs,frameAnchor:c}=n,[l,u]=ie(s,0),[f,d]=A5(a),[h,p]=ie(o,f==null?3:4.5);super(t,{x:{value:r,scale:"x",optional:!0},y:{value:i,scale:"y",optional:!0},r:{value:h,scale:"r",filter:ir,optional:!0},rotate:{value:l,optional:!0},symbol:{value:f,scale:"auto",optional:!0}},Ym(n),lK),this.r=p,this.rotate=u,this.symbol=d,this.frameAnchor=ko(c);let{channels:y}=this,{symbol:b}=y;if(b){let{fill:m,stroke:g}=y;b.hint={fill:m?m.value===b.value?"color":"currentColor":this.fill??"currentColor",stroke:g?g.value===b.value?"color":"currentColor":this.stroke??"none"}}}render(t,n,r,i,o){let{x:s,y:a}=n,{x:c,y:l,r:u,rotate:f,symbol:d}=r,{r:h,rotate:p,symbol:y}=this,[b,m]=yn(this,i),g=y===zs,x=u?void 0:h*h*Math.PI;return qa(h)&&(t=[]),ct("svg:g",o).call(Ft,this,i,o).call(It,this,{x:c&&s,y:l&&a}).call(_=>_.selectAll().data(t).enter().append(g?"circle":"path").call(Rt,this).call(g?v=>{v.attr("cx",c?w=>c[w]:b).attr("cy",l?w=>l[w]:m).attr("r",u?w=>u[w]:h)}:v=>{v.attr("transform",rc`translate(${c?w=>c[w]:b},${l?w=>l[w]:m})${f?w=>` rotate(${f[w]})`:p?` rotate(${p})`:""}`).attr("d",u&&d?w=>{let T=Jn();return d[w].draw(T,u[w]*u[w]*Math.PI),T}:u?w=>{let T=Jn();return y.draw(T,u[w]*u[w]*Math.PI),T}:d?w=>{let T=Jn();return d[w].draw(T,x),T}:(()=>{let w=Jn();return y.draw(w,x),w})())}).call(Zt,this,r)).node()}};function yi(e,{x:t,y:n,...r}={}){return r.frameAnchor===void 0&&([t,n]=Be(t,n)),new Ll(e,{...r,x:t,y:n})}function _7(e,{x:t=W,...n}={}){return new Ll(e,h_({...n,x:t}))}function w7(e,{y:t=W,...n}={}){return new Ll(e,d_({...n,y:t}))}function v7(e,t){return yi(e,{...t,symbol:"circle"})}function S7(e,t){return yi(e,{...t,symbol:"hexagon"})}var uK={ariaLabel:"line",fill:"none",stroke:"currentColor",strokeWidth:1.5,strokeLinecap:"round",strokeLinejoin:"round",strokeMiterlimit:1},Cl=class extends wt{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,uK),this.z=o,this.curve=k_(s,a),Vi(this,n)}filter(t){return t}project(t,n,r){this.curve!==oc&&super.project(t,n,r)}render(t,n,r,i,o){let{x:s,y:a}=r,{curve:c}=this;return ct("svg:g",o).call(Ft,this,i,o).call(It,this,n).call(l=>l.selectAll().data(H1(t,[s,a],this,r)).enter().append("path").call(Rt,this).call(Tl,this,r).call(tB,this,r,o).attr("d",c===oc&&o.projection?fK(o.projection,s,a):Zp().curve(c).defined(u=>u>=0).x(u=>s[u]).y(u=>a[u]))).node()}};function fK(e,t,n){let r=An(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 Bl(e,{x:t,y:n,...r}={}){return[t,n]=Be(t,n),new Cl(e,{...r,x:t,y:n})}function cc(e,{x:t=W,y:n=Me,...r}={}){return new Cl(e,$f({...r,x:t,y:n}))}function lc(e,{x:t=Me,y:n=W,...r}={}){return new Cl(e,Uf({...r,x:t,y:n}))}var dK={ariaLabel:"rect"},Pl=class extends wt{constructor(t,n={}){let{x1:r,y1:i,x2:o,y2:s,inset:a=0,insetTop:c=a,insetRight:l=a,insetBottom:u=a,insetLeft:f=a,rx:d,ry:h}=n;super(t,{x1:{value:r,scale:"x",type:r!=null&&o==null?"band":void 0,optional:!0},y1:{value:i,scale:"y",type:i!=null&&s==null?"band":void 0,optional:!0},x2:{value:o,scale:"x",optional:!0},y2:{value:s,scale:"y",optional:!0}},n,dK),this.insetTop=Nt(c),this.insetRight=Nt(l),this.insetBottom=Nt(u),this.insetLeft=Nt(f),this.rx=le(d,"auto"),this.ry=le(h,"auto")}render(t,n,r,i,o){let{x:s,y:a}=n,{x1:c,y1:l,x2:u,y2:f}=r,{marginTop:d,marginRight:h,marginBottom:p,marginLeft:y,width:b,height:m}=i,{projection:g}=o,{insetTop:x,insetRight:_,insetBottom:v,insetLeft:w,rx:T,ry:A}=this,R=(s?.bandwidth?s.bandwidth():0)-w-_,I=(a?.bandwidth?a.bandwidth():0)-x-v;return ct("svg:g",o).call(Ft,this,i,o).call(It,this,{},0,0).call(E=>E.selectAll().data(t).enter().append("rect").call(Rt,this).attr("x",c&&(g||!ar(s))?u?O=>Math.min(c[O],u[O])+w:O=>c[O]+w:y+w).attr("y",l&&(g||!ar(a))?f?O=>Math.min(l[O],f[O])+x:O=>l[O]+x:d+x).attr("width",c&&(g||!ar(s))?u?O=>Math.max(0,Math.abs(u[O]-c[O])+R):R:b-h-y-_-w).attr("height",l&&(g||!ar(a))?f?O=>Math.max(0,Math.abs(l[O]-f[O])+I):I:m-d-p-x-v).call(ft,"rx",T).call(ft,"ry",A).call(Zt,this,r)).node()}};function Gm(e,t){return new Pl(e,kE(FE(t)))}function Xf(e,t={}){return yf(t)||(t={...t,y:Me,x2:W,interval:1}),new Pl(e,jf(FE(zf(t))))}function Hf(e,t={}){return yf(t)||(t={...t,x:Me,y2:W,interval:1}),new Pl(e,Vf(kE(qf(t))))}function tM(e,t){t=hK(t);let{x:n,y:r,color:i,size:o}=t,s=B_(e,n),a=B_(e,r),c=B_(e,i),l=B_(e,o),{fx:u,fy:f,x:{value:d,reduce:h,zero:p,...y},y:{value:b,reduce:m,zero:g,...x},color:{value:_,color:v,reduce:w},size:{value:T,reduce:A},mark:R}=t;if(h===void 0&&(h=m==null&&d==null&&T==null&&b!=null?"count":null),m===void 0&&(m=h==null&&b==null&&T==null&&d!=null?"count":null),A===void 0&&T==null&&w==null&&h==null&&m==null&&(d==null||Ae(s))&&(b==null||Ae(a))&&(A="count"),p===void 0&&(p=P_(h)?!0:void 0),g===void 0&&(g=P_(m)?!0:void 0),d==null&&b==null)throw new Error("must specify x or y");if(h!=null&&b==null)throw new Error("reducing x requires y");if(m!=null&&d==null)throw new Error("reducing y requires x");R===void 0&&(R=T!=null||A!=null?"dot":P_(h)||P_(m)||w!=null?"bar":d!=null&&b!=null?Ae(s)||Ae(a)||h==null&&m==null&&!Wm(s)&&!Wm(a)?"dot":"line":d!=null||b!=null?"rule":null);let I,E,O;switch(R){case"dot":O=yi,E="stroke";break;case"line":O=s&&a||h!=null||m!=null?g||m!=null||s&&Wm(s)?lc:p||h!=null||a&&Wm(a)?cc:Bl:s?cc:lc,E="stroke",T7(c)&&(I=null);break;case"area":O=!(g||m!=null)&&(p||h!=null||a&&Wm(a))?sc:ea,E="fill",T7(c)&&(I=null);break;case"rule":O=s?qr:jr,E="stroke";break;case"bar":O=h!=null?Ae(a)?I7(h)&&s&&Ae(s)?ac:$o:Xf:m!=null?Ae(s)?I7(m)&&a&&Ae(a)?ac:zo:Hf:w!=null||A!=null?s&&Ae(s)&&a&&Ae(a)?ac:s&&Ae(s)?zo:a&&Ae(a)?$o:Gm:s&&Ws(s)&&!(a&&Ws(a))?$o:a&&Ws(a)&&!(s&&Ws(s))?zo:ac,E="fill";break;default:throw new Error(`invalid mark: ${R}`)}let k={fx:u,fy:f,x:s??void 0,y:a??void 0,[E]:c??v,z:I,r:l??void 0,tip:!0},S,M={[E]:w??void 0,r:A??void 0};if(h!=null&&m!=null)throw new Error("cannot reduce both x and y");return m!=null?(M.y=m,S=Ae(s)?Ka:Po):h!=null?(M.x=h,S=Ae(a)?Ja:Uo):(w!=null||A!=null)&&(s&&a?S=Ae(s)&&Ae(a)?wm:Ae(s)?Uo:Ae(a)?Po:ta:s?S=Ae(s)?Ka:Po:a&&(S=Ae(a)?Ja:Uo)),(S===ta||S===Po)&&(k.x={value:s,...y}),(S===ta||S===Uo)&&(k.y={value:a,...x}),p===void 0&&(p=s&&!(S===ta||S===Po)&&(O===$o||O===sc||O===Xf||O===jr)),g===void 0&&(g=a&&!(S===ta||S===Uo)&&(O===zo||O===ea||O===Hf||O===qr)),{fx:u??null,fy:f??null,x:{value:d??null,reduce:h??null,zero:!!p,...y},y:{value:b??null,reduce:m??null,zero:!!g,...x},color:{value:_??null,reduce:w??null,...v!==void 0&&{color:v}},size:{value:T??null,reduce:A??null},mark:R,markImpl:E7[O],markOptions:k,transformImpl:E7[S],transformOptions:M,colorMode:E}}function M7(e,t){let n=tM(e,t),{fx:r,fy:i,x:{zero:o},y:{zero:s},markOptions:a,transformOptions:c,colorMode:l}=n,u=JE[n.markImpl],f=JE[n.transformImpl],d=r!=null||i!=null?Pf({strokeOpacity:.1}):null,h=[o?qr([0]):null,s?jr([0]):null],p=u(e,f?f(c,a):a);return l==="stroke"?Je(d,h,p):Je(d,p,h)}function Wm(e){let t,n;for(let r of e){if(r==null)continue;if(t===void 0){t=r;continue}let i=Math.sign(Gt(t,r));if(i){if(n!==void 0&&i!==n)return!1;t=r,n=i}}return!0}function hK({x:e,y:t,color:n,size:r,fx:i,fy:o,mark:s}={}){return $r(e)||(e=Zf(e)),$r(t)||(t=Zf(t)),$r(n)||(n=Za(n)?{color:n}:Zf(n)),$r(r)||(r=Zf(r)),$r(i)&&({value:i}=Zf(i)),$r(o)&&({value:o}=Zf(o)),s!=null&&(s=`${s}`.toLowerCase()),{x:e,y:t,color:n,size:r,fx:i,fy:o,mark:s}}function B_(e,t){let n=mt(e,t.value);return n&&(n.label=On(t.value)),n}function Zf(e){return pK(e)?{reduce:e}:{value:e}}function P_(e){return/^(?:distinct|count|sum|proportion)$/i.test(e)}function I7(e){return/^(?:first|last|mode)$/i.test(e)}function pK(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 T7(e){return e?new kr(e).size>e.length>>1:!1}var JE={dot:yi,line:Bl,lineX:cc,lineY:lc,areaX:sc,areaY:ea,ruleX:qr,ruleY:jr,barX:$o,barY:zo,rect:Gm,rectX:Xf,rectY:Hf,cell:ac,bin:ta,binX:Po,binY:Uo,group:wm,groupX:Ka,groupY:Ja},E7=Object.fromEntries(Object.entries(JE).map(([e,t])=>[t,e]));function Qf(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),br(o,t)}function Kf(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),br(o,t)}function br(e={},t={}){let n=zn(t),r=Object.entries(e).map(([i,o])=>{let s=F1(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:mK(o)}});return{...mn(t,(i,o)=>{let s=mt(i,n),a=r.map(({input:l})=>mt(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},d)=>f.mapIndex(u,a[d],c[d]));return{data:i,facets:o}}),...Object.fromEntries(r.map(({key:i,output:o})=>[i,o]))}}function mK(e){if(e==null)throw new Error("missing map");if(typeof e.mapIndex=="function")return e;if(typeof e.map=="function"&&hn(e))return yK(e);if(typeof e=="function")return eM(gf(e));switch(`${e}`.toLowerCase()){case"cumsum":return bK;case"rank":return eM((t,n)=>Bh(t,r=>n[r]));case"quantile":return eM((t,n)=>gK(t,r=>n[r]))}throw new Error(`invalid map: ${e}`)}function yK(e){return console.warn("deprecated map interface; implement mapIndex instead."),{mapIndex:e.map.bind(e)}}function gK(e,t){let n=co(e,t)-1;return Bh(e,t).map(r=>r/n)}function eM(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 bK={mapIndex(e,t,n){let r=0;for(let i of e)n[i]=r+=t[i]}};function A7(e={},t){return arguments.length===1&&(t=e),Qf(Jf(e),t)}function N7(e={},t){return arguments.length===1&&(t=e),Kf(Jf(e),t)}function Jf(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=_K(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 wK(n)(t,xK(i,t),o)}function xK(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 _K(e){switch(`${e}`.toLowerCase()){case"centered":return"middle";case"leading":return"start";case"trailing":return"end"}throw new Error(`invalid shift: ${e}`)}function wK(e="mean"){if(typeof e=="string"){if(/^p\d{2}$/i.test(e))return U_(mf(e));switch(e.toLowerCase()){case"deviation":return U_(ri);case"max":return $_((t,n)=>$t(t,r=>n[r]));case"mean":return vK;case"median":return U_(Bi);case"min":return $_((t,n)=>ce(t,r=>n[r]));case"mode":return $_((t,n)=>Su(t,r=>n[r]));case"sum":return R7;case"variance":return U_(Ea);case"difference":return TK;case"ratio":return EK;case"first":return MK;case"last":return AK}}if(typeof e!="function")throw new Error(`invalid reduce: ${e}`);return $_(gf(e))}function U_(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(Ys(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(Ys(i,0,c+t),a);for(let c=0,l=i.length-n;c<l;++c)s[i[c+n]]=e(Ys(i,c,c+t),a)}}}function $_(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(Ys(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(Ys(i,0,a+t),o);for(let a=0,c=i.length-n;a<c;++a)s[i[a+n]]=e(Ys(i,a,a+t),o)}}}function R7(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 vK(e,t,n){if(n){let r=R7(e,t,n);return{mapIndex(i,o,s){r.mapIndex(i,o,s);for(let a=0,c=i.length-e+1;a<c;++a)s[i[a+t]]/=e}}}else return{mapIndex(r,i,o){let s=0,a=0,c=r.length;for(let l=0,u=Math.min(c,e-t-1);l<u;++l){let f=i[r[l]];f!==null&&!isNaN(f=+f)&&(s+=f,++a)}for(let l=-t,u=c-t;l<u;++l){let f=i[r[l+e-1]],d=i[r[l]];f!==null&&!isNaN(f=+f)&&(s+=f,++a),o[r[l+t]]=s/a,d!==null&&!isNaN(d=+d)&&(s-=d,--a)}}}}function SK(e,t,n,r){for(let i=n+r;n<i;++n){let o=e[t[n]];if($e(o))return o}}function IK(e,t,n,r){for(let i=n+r-1;i>=n;--i){let o=e[t[i]];if($e(o))return o}}function O7(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 D7(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 TK(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]]=D7(i,r,s,e)-O7(i,r,s,e)}}}function EK(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]]=D7(i,r,s,e)/O7(i,r,s,e)}}}function MK(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]]=SK(i,r,s,e)}}}function AK(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]]=IK(i,r,s,e)}}}var na={n:20,k:2,color:"currentColor",opacity:.2,strict:!0,anchor:"end"};function k7(e,{x:t=W,y:n,k:r=na.k,color:i=na.color,opacity:o=na.opacity,fill:s=i,fillOpacity:a=o,stroke:c=i,strokeOpacity:l,strokeWidth:u,...f}={}){return Je(ne(s)?null:sc(e,br({x1:uc({k:-r,...f}),x2:uc({k:r,...f})},{x1:t,x2:t,y:n,fill:s,fillOpacity:a,...f})),ne(c)?null:cc(e,br({x:uc(f)},{x:t,y:n,stroke:c,strokeOpacity:l,strokeWidth:u,...f})))}function F7(e,{x:t,y:n=W,k:r=na.k,color:i=na.color,opacity:o=na.opacity,fill:s=i,fillOpacity:a=o,stroke:c=i,strokeOpacity:l,strokeWidth:u,...f}={}){return Je(ne(s)?null:ea(e,br({y1:uc({k:-r,...f}),y2:uc({k:r,...f})},{x:t,y1:n,y2:n,fill:s,fillOpacity:a,...f})),ne(c)?null:lc(e,br({y:uc(f)},{x:t,y:n,stroke:c,strokeOpacity:l,strokeWidth:u,...f})))}function uc({n:e=na.n,k:t=0,strict:n=na.strict,anchor:r=na.anchor}={}){return Jf({k:e,reduce:i=>Ss(i)+t*(ri(i)||0),strict:n,anchor:r})}var NK={ariaLabel:"tick",fill:null,stroke:"currentColor"},z_=class extends wt{constructor(t,n,r){super(t,n,r,NK),Vi(this,r)}render(t,n,r,i,o){return ct("svg:g",o).call(Ft,this,i,o).call(this._transform,this,n).call(s=>s.selectAll().data(t).enter().append("line").call(Rt,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(Js,this,r,o)).node()}},Xm=class extends z_{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},De,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}},Hm=class extends z_{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,De)}_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 q_(e,{x:t=W,...n}={}){return new Xm(e,{...n,x:t})}function j_(e,{y:t=W,...n}={}){return new Hm(e,{...n,y:t})}function L7(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?Ja:_m;return Je(jr(e,u({x1:nM,x2:rM},{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})),q_(e,u({x:"p50"},{x:t,y:n,stroke:o,strokeOpacity:s,strokeWidth:a,sort:c,...l})),yi(e,br({x:B7},{x:t,y:n,z:n,stroke:o,strokeOpacity:s,...l})))}function C7(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?Ka:_m;return Je(qr(e,u({y1:nM,y2:rM},{x:n,y:t,stroke:o,strokeOpacity:s,...l})),zo(e,u({y1:"p25",y2:"p75"},{x:n,y:t,fill:r,fillOpacity:i,...l})),j_(e,u({y:"p50"},{x:n,y:t,stroke:o,strokeOpacity:s,strokeWidth:a,sort:c,...l})),yi(e,br({y:B7},{x:n,y:t,z:n,stroke:o,strokeOpacity:s,...l})))}function B7(e){let t=nM(e),n=rM(e);return e.map(r=>r<t||r>n?r:NaN)}function nM(e){let t=P7(e)*2.5-U7(e)*1.5;return ce(e,n=>n>=t?n:NaN)}function rM(e){let t=U7(e)*2.5-P7(e)*1.5;return $t(e,n=>n<=t?n:NaN)}function P7(e){return Zn(e,.25)}function U7(e){return Zn(e,.75)}var RK={ariaLabel:"raster",stroke:null,pixelSize:1};function td(e,t){let n=+e;if(isNaN(n))throw new Error(`invalid ${t}: ${e}`);return n}function $7(e,t){let n=Math.floor(e);if(isNaN(n))throw new Error(`invalid ${t}: ${e}`);return n}var Qm=class extends wt{constructor(t,n,r={},i){let{width:o,height:s,x:a,y:c,x1:l=a==null?0:void 0,y1:u=c==null?0:void 0,x2:f=a==null?o:void 0,y2:d=c==null?s:void 0,pixelSize:h=i.pixelSize,blur:p=0,interpolate:y}=r;if(o!=null&&(o=$7(o,"width")),s!=null&&(s=$7(s,"height")),l!=null&&(l=td(l,"x1")),u!=null&&(u=td(u,"y1")),f!=null&&(f=td(f,"x2")),d!=null&&(d=td(d,"y2")),a==null&&(l==null||f==null))throw new Error("missing x");if(c==null&&(u==null||d==null))throw new Error("missing y");t!=null&&o!=null&&s!=null&&(a===void 0&&l!=null&&f!=null&&(a=PK(l,f,o,s)),c===void 0&&u!=null&&d!=null&&(c=UK(u,d,o,s))),super(t,{x:{value:a,scale:"x",optional:!0},y:{value:c,scale:"y",optional:!0},x1:{value:l==null?null:[l],scale:"x",optional:!0,filter:null},y1:{value:u==null?null:[u],scale:"y",optional:!0,filter:null},x2:{value:f==null?null:[f],scale:"x",optional:!0,filter:null},y2:{value:d==null?null:[d],scale:"y",optional:!0,filter:null},...n},r,i),this.width=o,this.height=s,this.pixelSize=td(h,"pixelSize"),this.blur=td(p,"blur"),this.interpolate=a==null||c==null?null:OK(y)}},Km=class extends Qm{constructor(t,n={}){let{imageRendering:r}=n;if(t==null){let{fill:i,fillOpacity:o}=n;ie(o)[0]!==void 0&&(n=V_("fillOpacity",n)),Re(i)[0]!==void 0&&(n=V_("fill",n))}super(t,void 0,n,RK),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]??(M=>M),{x:a,y:c}=r,{document:l}=o,[u,f,d,h]=q7(r,i,o),p=d-u,y=h-f,{pixelSize:b,width:m=Math.round(Math.abs(p)/b),height:g=Math.round(Math.abs(y)/b)}=this,x=m*g,{fill:_,fillOpacity:v}=r,w=0;if(this.interpolate){let M=m/p,N=g/y,F=Yt(a,C=>(C-u)*M,Float64Array),B=Yt(c,C=>(C-f)*N,Float64Array);_&&(_=this.interpolate(t,m,g,F,B,_)),v&&(v=this.interpolate(t,m,g,F,B,v))}else this.data==null&&t&&(w=t.fi*x);let T=l.createElement("canvas");T.width=m,T.height=g;let A=T.getContext("2d"),R=A.createImageData(m,g),I=R.data,{r:E,g:O,b:k}=an(this.fill)??{r:0,g:0,b:0},S=(this.fillOpacity??1)*255;for(let M=0;M<x;++M){let N=M<<2;if(_){let F=s(_[M+w]);if(F==null){I[N+3]=0;continue}({r:E,g:O,b:k}=an(F))}v&&(S=v[M+w]*255),I[N+0]=E,I[N+1]=O,I[N+2]=k,I[N+3]=S}return this.blur>0&&L2(R,this.blur),A.putImageData(R,0,0),ct("svg:g",o).call(Ft,this,i,o).call(It,this,n).call(M=>M.append("image").attr("transform",`translate(${u},${f}) scale(${Math.sign(d-u)},${Math.sign(h-f)})`).attr("width",Math.abs(p)).attr("height",Math.abs(y)).attr("preserveAspectRatio","none").call(ft,"image-rendering",this.imageRendering).call(Rt,this).attr("xlink:href",T.toDataURL())).node()}};function iM(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&&b5(t)&&(r=Vs,i=Wa,o===void 0&&(o=h5)),[t,{...s,x:r,y:i,[e]:o}]}function z7(){let[e,t]=iM("fill",...arguments);return new Km(e,e==null||t.fill!==void 0||t.fillOpacity!==void 0?t:{...t,fill:W})}function q7({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 oM({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),q7(If(a,i),o,s)}function V_(e,t={}){let{[e]:n}=t;if(typeof n!="function")throw new Error(`invalid ${e}: not a function`);return Se({...t,[e]:void 0},function(r,i,o,s,a,c){let{x:l,y:u}=s;if(!l)throw new Error("missing scale: x");if(!u)throw new Error("missing scale: y");let[f,d,h,p]=oM(o,s,a,c),y=h-f,b=p-d,{pixelSize:m}=this,{width:g=Math.round(Math.abs(y)/m),height:x=Math.round(Math.abs(b)/m)}=t,_=new Array(g*x*(i?i.length:1)),v=y/g,w=b/x,T=0;for(let A of i??[void 0])for(let R=.5;R<x;++R)for(let I=.5;I<g;++I,++T)_[T]=n(l.invert(f+I*v),u.invert(d+R*w),A);return{data:_,facets:i,channels:{[e]:{value:_,scale:"auto"}}}})}function OK(e){if(typeof e=="function")return e;if(e==null)return Y_;switch(`${e}`.toLowerCase()){case"none":return Y_;case"nearest":return aM;case"barycentric":return sM();case"random-walk":return cM()}throw new Error(`invalid interpolate: ${e}`)}function Y_(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 sM({random:e=cl(42)}={}){return(t,n,r,i,o,s)=>{let{points:a,triangles:c,hull:l}=ai.from(t,h=>i[h],h=>o[h]),u=new s.constructor(n*r).fill(NaN),f=new Uint8Array(n*r),d=BK(s,e);for(let h=0;h<c.length;h+=3){let p=c[h],y=c[h+1],b=c[h+2],m=a[2*p],g=a[2*y],x=a[2*b],_=a[2*p+1],v=a[2*y+1],w=a[2*b+1],T=Math.min(m,g,x),A=Math.max(m,g,x),R=Math.min(_,v,w),I=Math.max(_,v,w),E=(v-w)*(m-x)+(_-w)*(x-g);if(!E)continue;let O=s[t[p]],k=s[t[y]],S=s[t[b]];for(let M=Math.floor(T);M<A;++M)for(let N=Math.floor(R);N<I;++N){if(M<0||M>=n||N<0||N>=r)continue;let F=M+.5,B=N+.5,C=((v-w)*(F-x)+(B-w)*(x-g))/E;if(C<0)continue;let P=((w-_)*(F-x)+(B-w)*(m-x))/E;if(P<0)continue;let U=1-C-P;if(U<0)continue;let $=M+n*N;u[$]=d(O,C,k,P,S,U,M,N),f[$]=1}}return DK(u,f,i,o,s,n,r,l,t,d),u}}function DK(e,t,n,r,i,o,s,a,c,l){n=Float64Array.from(a,h=>n[c[h]]),r=Float64Array.from(a,h=>r[c[h]]),i=Array.from(a,h=>i[c[h]]);let u=n.length,f=Array.from({length:u},(h,p)=>FK(p,n,r)),d=0;for(let h=0;h<s;++h){let p=h+.5;for(let y=0;y<o;++y){let b=y+o*h;if(!t[b]){let m=y+.5;for(let g=0;g<u;++g){let x=(u+d+(g%2?(g+1)/2:-g/2))%u;if(f[x](m,p)){let _=kK(n.at(x-1),r.at(x-1),n[x],r[x],m,p);e[b]=l(i.at(x-1),_,i[x],1-_,i[x],0,y,h),d=x;break}}}}}}function kK(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 Zm(e,t,n,r){return e*r-n*t}function FK(e,t,n){let r=t.length,i=t.at(e-2),o=n.at(e-2),s=t.at(e-1),a=n.at(e-1),c=t[e],l=n[e],u=t.at(e+1-r),f=n.at(e+1-r),d=s-c,h=a-l,p=i-s,y=o-a,b=c-u,m=l-f,g=Math.hypot(d,h),x=Math.hypot(p,y),_=Math.hypot(b,m);return(v,w)=>{let T=v-s,A=w-a,R=v-c,I=w-l;return Zm(T,A,R,I)>-1e-6&&Zm(T,A,d,h)*x-Zm(T,A,p,y)*g>-1e-6&&Zm(R,I,b,m)*g-Zm(R,I,d,h)*_<=0}}function aM(e,t,n,r,i,o){let s=new o.constructor(t*n),a=ai.from(e,u=>r[u],u=>i[u]),c,l;for(let u=.5,f=0;u<n;++u){l=c;for(let d=.5;d<t;++d,++f)l=a.find(d,u,l),d===.5&&(c=l),s[f]=o[e[l]]}return s}function cM({random:e=cl(42),minDistance:t=.5,maxSteps:n=2}={}){return(r,i,o,s,a,c)=>{let l=new c.constructor(i*o),u=ai.from(r,p=>s[p],p=>a[p]),f,d,h;for(let p=.5,y=0;p<o;++p){d=f;for(let b=.5;b<i;++b,++y){let m=b,g=p;h=d=u.find(m,g,d),b===.5&&(f=d);let x,_=0;for(;(x=Math.hypot(s[r[h]]-m,a[r[h]]-g))>t&&_<n;){let v=e(b,p,_)*2*Math.PI;m+=Math.cos(v)*x,g+=Math.sin(v)*x,h=u.find(m,g,h),++_}l[y]=c[r[h]]}}return l}}function LK(e,t,n,r,i,o){return t*e+r*n+o*i}function CK(e){return(t,n,r,i,o,s,a,c)=>{let l=e(a,c);return l<n?t:l<n+i?r:o}}function BK(e,t){return Ws(e)||Oe(e)?LK:CK(t)}function PK(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 UK(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 j7={ariaLabel:"contour",fill:"none",stroke:"currentColor",strokeMiterlimit:1,pixelSize:2},Jm=class extends Qm{constructor(t,{smooth:n=!0,value:r,...i}={}){let o=X1({},i,j7);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:On(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=V_("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}},$K(i),j7);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 ct("svg:g",o).call(Ft,this,i,o).call(It,this,n).call(c=>{c.selectAll().data(t).enter().append("path").call(Rt,this).attr("d",l=>a(s[l])).call(Zt,this,r)}).node()}};function $K({thresholds:e,interval:t,...n}){return e=HE(e,t,Ma),Se(n,function(r,i,o,s,a,c){let[l,u,f,d]=oM(o,s,a,c),h=f-l,p=d-u,{pixelSize:y,width:b=Math.round(Math.abs(h)/y),height:m=Math.round(Math.abs(p)/y)}=this,g=b/h,x=m/p,_=o.value.value,v=[];if(this.interpolate){let{x:I,y:E}=ec(o,s,c),O=Yt(I,N=>(N-l)*g,Float64Array),k=Yt(E,N=>(N-u)*x,Float64Array),S=[o.x,o.y,o.value],M=[O,k,_];for(let N of i){let F=this.filter(N,S,M);v.push(this.interpolate(F,b,m,O,k,_))}}else if(i){let I=b*m,E=i.length;for(let O=0;O<E;++O)v.push(_.slice(O*I,O*I+I))}else v.push(_);if(this.blur>0)for(let I of v)Dh({data:I,width:b,height:m},this.blur);let w=zK(e,_,...qK(v));if(w===null)throw new Error(`unsupported thresholds: ${e}`);let{contour:T}=Fa().size([b,m]).smooth(this.smooth),A=[],R=[];for(let I of v)R.push(Ue(A.length,A.push(...Yt(w,E=>T(I,E)))));for(let{coordinates:I}of A)for(let E of I)for(let O of E)for(let k of O)k[0]=k[0]/g+l,k[1]=k[1]/x+u;return{data:A,facets:R,channels:Y1(this.contourChannels,A)}})}function zK(e,t,n,r){if(typeof e?.range=="function")return e.range(e.floor(n),r);if(typeof e=="function"&&(e=e(t,n,r)),typeof e!="number")return qe(e);let i=Tn(...wu(n,r,e),e);for(;i[i.length-1]>=r;)i.pop();for(;i[1]<n;)i.shift();return i}function Y7(){return new Jm(...iM("value",...arguments))}function qK(e){return[ce(e,t=>ce(t,V7)),$t(e,t=>$t(t,V7))]}function V7(e){return isFinite(e)?e:NaN}function X7(e,t){return lM(kf,e,t)}function H7(e,t={}){return lM(Ff,e,t)}function Z7(e,t={}){return lM(El,e,t)}function lM(e,t,n={}){let{x:r,y:i,maxRadius:o}=n,s=e({px:r,py:i,maxRadius:o}),a=[];r!=null&&a.push(qr(t,G7("x",{...s,inset:-6},n))),i!=null&&a.push(jr(t,G7("y",{...s,inset:-6},n))),r!=null&&a.push(Bo(t,W7("x",{...s,dy:9,frameAnchor:"bottom",lineAnchor:"top"},n))),i!=null&&a.push(Bo(t,W7("y",{...s,dx:-9,frameAnchor:"left",textAnchor:"end"},n)));for(let c of a)c.ariaLabel=`crosshair ${c.ariaLabel}`;return Je(...a)}function Q7(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:jK(e,u)}}function jK(e,t){return t==null?t:function(n,r,{x:i,y:o,px:s,py:a,...c},...l){let{channels:{x:u,y:f,...d}={},...h}=t.call(this,n,r,{...c,x:s,y:a},...l);return{channels:{...d,...u&&{px:u,...e==="x"&&{x:u}},...f&&{py:f,...e==="y"&&{y:f}}},...h}}}function G7(e,t,n){let{color:r="currentColor",opacity:i=.2,ruleStroke:o=r,ruleStrokeOpacity:s=i,ruleStrokeWidth:a}=n;return{...Q7(e,t,n),stroke:o,strokeOpacity:s,strokeWidth:a}}function W7(e,t,n){let{color:r="currentColor",textFill:i=r,textFillOpacity:o,textStroke:s="var(--plot-background)",textStrokeOpacity:a,textStrokeWidth:c=5}=n;return{...Q7(e,t,VK(e,n)),fill:i,fillOpacity:o,stroke:s,strokeOpacity:a,strokeWidth:c}}function VK(e,t){return Se(t,(n,r,i)=>({channels:{text:{value:Sm(i,e)?.value}}}))}var YK={ariaLabel:"delaunay link",fill:"none",stroke:"currentColor",strokeMiterlimit:1},GK={ariaLabel:"delaunay mesh",fill:null,stroke:"currentColor",strokeOpacity:.2},WK={ariaLabel:"hull",fill:"none",stroke:"currentColor",strokeWidth:1.5,strokeMiterlimit:1},XK={ariaLabel:"voronoi",fill:"none",stroke:"currentColor",strokeMiterlimit:1},HK={ariaLabel:"voronoi mesh",fill:null,stroke:"currentColor",strokeOpacity:.2},uM=class extends wt{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,YK),this.curve=Pm(s,a),Vi(this,n)}render(t,n,r,i,o){let{x:s,y:a}=n,{x:c,y:l,z:u}=r,{curve:f}=this,[d,h]=yn(this,i),p=c?g=>c[g]:dn(d),y=l?g=>l[g]:dn(h),b=this;function m(g){let x=-1,_=[],v={};for(let S in r)v[S]=[];let w=[],T=[],A=[],R=[];function I(S,M){S=g[S],M=g[M],_.push(++x),w[x]=p(S),A[x]=y(S),T[x]=p(M),R[x]=y(M);for(let N in r)v[N].push(r[N][M])}let{halfedges:E,hull:O,triangles:k}=ai.from(g,p,y);for(let S=0;S<E.length;++S){let M=E[S];M>S&&I(k[S],k[M])}for(let S=0;S<O.length;++S)I(O[S],O[(S+1)%O.length]);zt(this).selectAll().data(_).enter().append("path").call(Rt,b).attr("d",S=>{let M=Jn(),N=f(M);return N.lineStart(),N.point(w[S],A[S]),N.point(T[S],R[S]),N.lineEnd(),M}).call(Zt,b,v).call(Js,b,v,o)}return ct("svg:g",o).call(Ft,this,i,o).call(It,this,{x:c&&s,y:l&&a}).call(u?g=>g.selectAll().data(sn(t,x=>u[x]).values()).enter().append("g").each(m):g=>g.datum(t).each(m)).node()}},ty=class extends wt{constructor(t,n={},r,i=({z:o})=>o){let{x:o,y:s}=n;super(t,{x:{value:o,scale:"x",optional:!0},y:{value:s,scale:"y",optional:!0},z:{value:i(n),optional:!0}},n,r)}render(t,n,r,i,o){let{x:s,y:a}=n,{x:c,y:l,z:u}=r,[f,d]=yn(this,i),h=c?m=>c[m]:dn(f),p=l?m=>l[m]:dn(d),y=this;function b(m){let g=ai.from(m,h,p);zt(this).append("path").datum(m[0]).call(Rt,y).attr("d",y._render(g,i)).call(Zt,y,r)}return ct("svg:g",o).call(Ft,this,i,o).call(It,this,{x:c&&s,y:l&&a}).call(u?m=>m.selectAll().data(sn(t,g=>u[g]).values()).enter().append("g").each(b):m=>m.datum(t).each(b)).node()}},fM=class extends ty{constructor(t,n={}){super(t,n,GK),this.fill="none"}_render(t){return t.render()}},dM=class extends ty{constructor(t,n={}){super(t,n,WK,zn)}_render(t){return t.renderHull()}},hM=class extends wt{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,XK)}render(t,n,r,i,o){let{x:s,y:a}=n,{x:c,y:l,z:u}=r,[f,d]=yn(this,i),h=c?m=>c[m]:dn(f),p=l?m=>l[m]:dn(d),y=this;function b(m){let g=ai.from(m,h,p),x=K7(g,i);zt(this).selectAll().data(m).enter().append("path").call(Rt,y).attr("d",(_,v)=>x.renderCell(v)).call(Zt,y,r)}return ct("svg:g",o).call(Ft,this,i,o).call(It,this,{x:c&&s,y:l&&a}).call(u?m=>m.selectAll().data(sn(t,g=>u[g]).values()).enter().append("g").each(b):m=>m.datum(t).each(b)).node()}},pM=class extends ty{constructor(t,n){super(t,n,HK),this.fill="none"}_render(t,n){return K7(t,n).render()}};function K7(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 ey(e,t,{x:n,y:r,...i}={}){return[n,r]=Be(n,r),new e(t,{...i,x:n,y:r})}function J7(e,t){return ey(uM,e,t)}function tP(e,t){return ey(fM,e,t)}function eP(e,t){return ey(dM,e,t)}function nP(e,t){return ey(hM,e,t)}function rP(e,t){return ey(pM,e,t)}var ZK={ariaLabel:"density",fill:"none",stroke:"currentColor",strokeMiterlimit:1},ny=class extends wt{constructor(t,{x:n,y:r,z:i,weight:o,fill:s,stroke:a,...c}={}){let l=iP(s)&&(s="currentColor",!0),u=iP(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}},KK({...c,fill:s,stroke:a},l,u),ZK),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 ct("svg:g",o).call(Ft,this,i,o).call(It,this,{}).call(c=>c.selectAll().data(t).enter().append("path").call(Rt,this).call(Zt,this,r).attr("d",l=>a(s[l]))).node()}};function oP(e,{x:t,y:n,...r}={}){return[t,n]=Be(t,n),new ny(e,{...r,x:t,y:n})}var QK=new Set(["x","y","z","weight"]);function KK(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,Se(e,function(s,a,c,l,u,f){let d=c.weight?Qe(c.weight.value):null,h=c.z?.value,{z:p}=this,[y,b]=yn(this,u),{width:m,height:g}=u,{x,y:_}=ec(c,l,f),v=Object.fromEntries(Object.entries(c).filter(([k])=>!QK.has(k)).map(([k,S])=>[k,{...S,value:[]}])),w=t&&[],T=n&&[],A=SS().x(x?k=>x[k]:y).y(_?k=>_[k]:b).weight(d?k=>d[k]:1).size([m,g]).bandwidth(i),R=[];for(let k of a){let S=[];R.push(S);for(let M of h?Tm(k,h,p):[k]){let N=A.contours(M);S.push([M,N])}}let I=o;if(!(I instanceof _l)){let k=0;for(let S of R)for(let[,M]of S){let N=M.max;N>k&&(k=N)}I=Float64Array.from({length:o-1},(S,M)=>k*100*(M+1)/o)}let E=[],O=[];for(let k of R){let S=[];E.push(S);for(let[M,N]of k)for(let F of I){S.push(O.length),O.push(N(F/100)),w&&w.push(F),T&&T.push(F);for(let B in v)v[B].value.push(c[B].value[M[0]])}}return w&&w.push(0),T&&T.push(0),{data:s,facets:E,channels:{...v,...w&&{fill:{value:w,scale:"color"}},...T&&{stroke:{value:T,scale:"color"}},contours:{value:O}}}})}function iP(e){return/^density$/i.test(e)}function cP(e,{x1:t,x2:n,y1:r,y2:i,x:o=t===void 0&&n===void 0?Me: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:d=u,stroke:h,strokeOpacity:p,z:y=Re(h)[0],clip:b,tip:m,render:g,...x}={}){return[t,n]=sP(o,t,n),[r,i]=sP(s,r,i),t===n&&r===i&&(r=fc(0)),{tip:m}=ji({tip:m},"x"),Je(ne(c)?null:Object.assign(Um(e,{x1:t,x2:n,y1:r,y2:i,z:y,fill:c,fillOpacity:f,render:Df(g,aP(!0)),clip:b,...x}),{ariaLabel:"positive difference"}),ne(l)?null:Object.assign(Um(e,{x1:t,x2:n,y1:r,y2:i,z:y,fill:l,fillOpacity:d,render:Df(g,aP(!1)),clip:b,...x}),{ariaLabel:"negative difference"}),Bl(e,{x:n,y:i,z:y,stroke:h,strokeOpacity:p,tip:m,clip:!0,...x}))}function sP(e,t,n){return t===void 0&&n===void 0?t=n=fc(e):t===void 0?(n=fc(n),t=e===void 0?n:fc(e)):n===void 0?(t=fc(t),n=e===void 0?t:fc(e)):(t=fc(t),n=fc(n)),[t,n]}function fc(e){let t,{value:n,label:r=On(n)}=pi(e);return{transform:i=>t||(t=mt(i,n)),label:r}}function aP(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===e_(n.y)<0?u:f).fill(l);let d=s(t,n,{...r,x2:a,y2:f},i,o),h=s(t,n,{...r,x1:c,y1:u},i,o),p=d.querySelector("g")??d,y=h.querySelector("g")??h;for(let b=0;p.firstChild;b+=2){let m=W1(),g=ct("svg:clipPath",o).attr("id",m).node();g.appendChild(p.firstChild),y.childNodes[b].setAttribute("clip-path",`url(#${m})`),y.insertBefore(g,y.childNodes[b])}return h}}var JK={ariaLabel:"geo",fill:"none",stroke:"currentColor",strokeWidth:1,strokeLinecap:"round",strokeLinejoin:"round",strokeMiterlimit:1},ry=class extends wt{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}},Ym(n),JK),this.r=i}render(t,n,r,i,o){let{geometry:s,r:a}=r,c=An(o.projection??tJ(n)),{r:l}=this;return qa(l)?t=[]:l!==void 0&&c.pointRadius(l),ct("svg:g",o).call(Ft,this,i,o).call(It,this,n).call(u=>{u.selectAll().data(t).enter().append("path").call(Rt,this).attr("d",a?f=>c.pointRadius(a[f])(s[f]):f=>c(s[f])).call(Zt,this,r)}).node()}};function tJ({x:e,y:t}){if(e||t)return e??=n=>n,t??=n=>n,sl({point(n,r){this.stream.point(e(n),t(r))}})}function G_(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 ry(e,{geometry:t,...n})}function lP({strokeWidth:e=1.5,...t}={}){return G_({type:"Sphere"},{strokeWidth:e,...t})}function uP({strokeOpacity:e=.1,...t}={}){return G_(YS(),{strokeOpacity:e,...t})}var ed=.5,nd=0;function fP(e={fill:"count"},{binWidth:t,...n}={}){let{z:r}=n;return t=t===void 0?20:Nt(t),e=oE(e,n),Fo(e,"fill")&&(n.channels={...n.channels,fill:{value:[]}}),n.symbol===void 0&&(n.symbol="hexagon"),n.r===void 0&&!Fo(e,"r")&&(n.r=t/2),Se(n,(i,o,s,a,c,l)=>{let{x:u,y:f,z:d,fill:h,stroke:p,symbol:y}=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}=ec(s,a,l)),d=d?d.value:mt(i,r),h=h?.value,p=p?.value,y=y?.value;let b=vm(e,{z:d,fill:h,stroke:p,symbol:y}),m=d&&[],g=h&&[],x=p&&[],_=y&&[],v=[],w=[],T=[],A=-1;for(let O of e)O.initialize(i);for(let O of o){let k=[];for(let S of e)S.scope("facet",O);for(let[S,M]of Qa(O,b))for(let{index:N,extent:F}of eJ(i,M,u,f,t)){k.push(++A),w.push(F.x),T.push(F.y),d&&m.push(b===d?S:d[N[0]]),h&&g.push(b===h?S:h[N[0]]),p&&x.push(b===p?S:p[N[0]]),y&&_.push(b===y?S:y[N[0]]);for(let B of e)B.reduce(N,F)}v.push(k)}let R=s.x.scale,I=s.y.scale,E={x:{value:w,source:a[R]?{value:Yt(w,a[R].invert),scale:R}:null},y:{value:T,source:a[I]?{value:Yt(T,a[I].invert),scale:I}:null},...d&&{z:{value:m}},...h&&{fill:{value:g,scale:"auto"}},...p&&{stroke:{value:x,scale:"auto"}},...y&&{symbol:{value:_,scale:"auto"}},...Object.fromEntries(e.map(({name:O,output:k})=>[O,{scale:"auto",label:k.label,radius:O==="r"?t/2:void 0,value:k.transform()}]))};return{data:i,facets:v,channels:E}})}function eJ(e,t,n,r,i){let o=i*(1.5/HT),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-nd)/o),f=Math.round(c=(c-ed)/i-(u&1)/2),d=l-u;if(Math.abs(d)*3>1){let y=c-f,b=f+(c<f?-1:1)/2,m=u+(l<u?-1:1),g=c-b,x=l-m;y*y+d*d>g*g+x*x&&(f=b+(u&1?1:-1)/2,u=m)}let h=`${f},${u}`,p=s.get(h);p===void 0&&(p={index:[],extent:{data:e,x:(f+(u&1)/2)*i+ed,y:u*o+nd}},s.set(h,p)),p.index.push(a)}return s.values()}var nJ={ariaLabel:"hexgrid",fill:"none",stroke:"currentColor",strokeOpacity:.1};function dP(e){return new iy(e)}var iy=class extends wt{constructor({binWidth:t=20,clip:n=!0,...r}={}){super(Ga,void 0,{clip:n,...r},nJ),this.binWidth=Nt(t)}render(t,n,r,i,o){let{binWidth:s}=this,{marginTop:a,marginRight:c,marginBottom:l,marginLeft:u,width:f,height:d}=i,h=u-ed,p=f-c-ed,y=a-nd,b=d-l-nd,m=s/2,g=m*ZT,x=g/2,_=m*2,v=g*1.5,w=Math.floor(h/_),T=Math.ceil(p/_),A=Math.floor((y+x)/v),R=Math.ceil((b-x)/v)+1,I=`m0,${dc(-g)}l${dc(m)},${dc(x)}v${dc(g)}l${dc(-m)},${dc(x)}`,E=I;for(let O=A;O<R;++O)for(let k=w;k<T;++k)E+=`M${dc(k*_+(O&1)*m)},${dc(O*v)}${I}`;return ct("svg:g",o).datum(0).call(Ft,this,i,o).call(It,this,{},De+ed,De+nd).call(O=>O.append("path").call(Rt,this).call(Zt,this,r).attr("d",E)).node()}};function dc(e){return Math.round(e*1e3)/1e3}var rJ={ariaLabel:"image",fill:null,stroke:null};function iJ(e){return/^\.*\//.test(e)}function oJ(e){return/^(blob|data|file|http|https):/i.test(e)}function sJ(e){return typeof e=="string"&&(iJ(e)||oJ(e))?[void 0,e]:[e,void 0]}var oy=class extends wt{constructor(t,n={}){let{x:r,y:i,r:o,width:s,height:a,rotate:c,src:l,preserveAspectRatio:u,crossOrigin:f,frameAnchor:d,imageRendering:h}=n;o==null&&(o=void 0),o===void 0&&s===void 0&&a===void 0?s=a=16:s===void 0&&a!==void 0?s=a:a===void 0&&s!==void 0&&(a=s);let[p,y]=sJ(l),[b,m]=ie(o),[g,x]=ie(s,m!==void 0?m*2:void 0),[_,v]=ie(a,m!==void 0?m*2:void 0),[w,T]=ie(c,0);super(t,{x:{value:r,scale:"x",optional:!0},y:{value:i,scale:"y",optional:!0},r:{value:b,scale:"r",filter:ir,optional:!0},width:{value:g,filter:ir,optional:!0},height:{value:_,filter:ir,optional:!0},rotate:{value:w,optional:!0},src:{value:p,optional:!0}},Ym(n),rJ),this.src=y,this.width=x,this.rotate=T,this.height=v,this.r=m,this.preserveAspectRatio=le(u,"xMidYMid"),this.crossOrigin=ze(f),this.frameAnchor=ko(d),this.imageRendering=le(h,"auto")}render(t,n,r,i,o){let{x:s,y:a}=n,{x:c,y:l,width:u,height:f,r:d,rotate:h,src:p}=r,{r:y,width:b,height:m,rotate:g}=this,[x,_]=yn(this,i);return ct("svg:g",o).call(Ft,this,i,o).call(It,this,{x:c&&s,y:l&&a}).call(v=>v.selectAll().data(t).enter().append("image").call(Rt,this).attr("x",hP(c,u,d,x,b,y)).attr("y",hP(l,f,d,_,m,y)).attr("width",u?w=>u[w]:b!==void 0?b:d?w=>d[w]*2:y*2).attr("height",f?w=>f[w]:m!==void 0?m:d?w=>d[w]*2:y*2).attr("transform",h?w=>`rotate(${h[w]})`:g?`rotate(${g})`:null).attr("transform-origin",h||g?rc`${c?w=>c[w]:x}px ${l?w=>l[w]:_}px`:null).call(ft,"href",p?w=>p[w]:this.src).call(ft,"preserveAspectRatio",this.preserveAspectRatio).call(ft,"crossorigin",this.crossOrigin).call(ft,"image-rendering",this.imageRendering).call(ft,"clip-path",d?w=>`circle(${d[w]}px)`:y!==void 0?`circle(${y}px)`:null).call(Zt,this,r)).node()}};function hP(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 pP(e,{x:t,y:n,...r}={}){return r.frameAnchor===void 0&&([t,n]=Be(t,n)),new oy(e,{...r,x:t,y:n})}function aJ(e,t,n){var r=1e-8,i=t-1,o=n-1,s=0,a,c,l,u,f,d,h,p,y,b,m;if(e<=0)return 0;if(e>=1)return 1;for(t>=1&&n>=1?(l=e<.5?e:1-e,u=Math.sqrt(-2*Math.log(l)),h=(2.30753+u*.27061)/(1+u*(.99229+u*.04481))-u,e<.5&&(h=-h),p=(h*h-3)/6,y=2/(1/(2*t-1)+1/(2*n-1)),b=h*Math.sqrt(p+y)/y-(1/(2*n-1)-1/(2*t-1))*(p+5/6-2/(3*y)),h=t/(t+n*Math.exp(2*b))):(a=Math.log(t/(t+n)),c=Math.log(n/(t+n)),u=Math.exp(t*a)/t,f=Math.exp(n*c)/n,b=u+f,e<u/b?h=Math.pow(t*b*e,1/t):h=1-Math.pow(n*b*(1-e),1/n)),m=-rd(t)-rd(n)+rd(t+n);s<10;s++){if(h===0||h===1)return h;if(d=cJ(h,t,n)-e,u=Math.exp(i*Math.log(h)+o*Math.log(1-h)+m),f=d/u,h-=u=f/(1-.5*Math.min(1,f*(i/h-o/(1-h)))),h<=0&&(h=.5*(h+u)),h>=1&&(h=.5*(h+u+1)),Math.abs(u)<r*h&&s>0)break}return h}function cJ(e,t,n){var r=e===0||e===1?0:Math.exp(rd(t+n)-rd(t)-rd(n)+t*Math.log(e)+n*Math.log(1-e));return e<0||e>1?!1:e<(t+1)/(t+n+2)?r*mP(e,t,n)/t:1-r*mP(1-e,n,t)/n}function mP(e,t,n){var r=1e-30,i=1,o=t+n,s=t+1,a=t-1,c=1,l=1-o*e/s,u,f,d,h;for(Math.abs(l)<r&&(l=r),l=1/l,h=l;i<=100&&(u=2*i,f=i*(n-i)*e/((a+u)*(t+u)),l=1+f*l,Math.abs(l)<r&&(l=r),c=1+f/c,Math.abs(c)<r&&(c=r),l=1/l,h*=l*c,f=-(t+i)*(o+i)*e/((t+u)*(s+u)),l=1+f*l,Math.abs(l)<r&&(l=r),c=1+f/c,Math.abs(c)<r&&(c=r),l=1/l,d=l*c,h*=d,!(Math.abs(d-1)<3e-7));i++);return h}function rd(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 yP(e,t){var n=aJ(2*Math.min(e,1-e),.5*t,.5);return n=Math.sqrt(t*(1-n)/n),e>.5?n:-n}var lJ={ariaLabel:"linear-regression",fill:"currentColor",fillOpacity:.1,stroke:"currentColor",strokeWidth:1.5,strokeLinecap:"round",strokeLinejoin:"round",strokeMiterlimit:1},W_=class extends wt{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,lJ),this.z=o,this.ci=+s,this.precision=+a,!(0<=this.ci&&this.ci<1))throw new Error(`invalid ci; not in [0, 1): ${s}`);if(!(this.precision>0))throw new Error(`invalid precision: ${a}`)}render(t,n,r,i,o){let{x:s,y:a,z:c}=r,{ci:l}=this;return ct("svg:g",o).call(Ft,this,i,o).call(It,this,n).call(u=>u.selectAll().data(c?Tm(t,c,this.z):[t]).enter().call(f=>f.append("path").attr("fill","none").call(Rt,this).call(Tl,this,{...r,fill:null,fillOpacity:null}).attr("d",d=>this._renderLine(d,s,a)).call(l&&!Xs(this.fill)?d=>d.select(uJ).attr("stroke","none").call(Rt,this).call(Tl,this,{...r,stroke:null,strokeOpacity:null,strokeWidth:null}).attr("d",h=>this._renderBand(h,s,a)):()=>{}))).node()}};function uJ(){return this.parentNode.insertBefore(this.ownerDocument.createElementNS(ii.svg,"path"),this)}var mM=class extends W_{constructor(t,n){super(t,n)}_renderBand(t,n,r){let{ci:i,precision:o}=this,[s,a]=ae(t,u=>r[u]),c=X_(t,r,n),l=xP(t,r,n,(1-i)/2,c);return of().y(u=>u).x0(u=>l(u,-1)).x1(u=>l(u,1))(Ue(s,a-o/2,o).concat(a))}_renderLine(t,n,r){let[i,o]=ae(t,a=>r[a]),s=X_(t,r,n);return`M${s(i)},${i}L${s(o)},${o}`}},yM=class extends W_{constructor(t,n){super(t,n)}_renderBand(t,n,r){let{ci:i,precision:o}=this,[s,a]=ae(t,u=>n[u]),c=X_(t,n,r),l=xP(t,n,r,(1-i)/2,c);return of().x(u=>u).y0(u=>l(u,-1)).y1(u=>l(u,1))(Ue(s,a-o/2,o).concat(a))}_renderLine(t,n,r){let[i,o]=ae(t,a=>n[a]),s=X_(t,n,r);return`M${i},${s(i)}L${o},${s(o)}`}};function gP(e,{y:t=Me,x:n=W,stroke:r,fill:i=ne(r)?"currentColor":r,...o}={}){return new mM(e,$f({...o,x:n,y:t,fill:i,stroke:r}))}function bP(e,{x:t=Me,y:n=W,stroke:r,fill:i=ne(r)?"currentColor":r,...o}={}){return new yM(e,Uf({...o,x:t,y:n,fill:i,stroke:r}))}function X_(e,t,n){let r=0,i=0,o=0,s=0;for(let u of e){let f=t[u],d=n[u];r+=f,i+=d,o+=f*d,s+=f*f}let a=e.length,c=(a*o-r*i)/(a*s-r*r),l=(i-c*r)/a;return u=>c*u+l}function xP(e,t,n,r,i){let o=En(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=yP(r,e.length-2);return(u,f)=>{let d=i(u),h=c*Math.sqrt(1/e.length+(u-o)**2/s);return d+f*l*h}}function sy({path:e=W,delimiter:t,frameAnchor:n,treeLayout:r=al,treeSort:i,treeSeparation:o,treeAnchor:s,treeFilter:a,...c}={}){s=K_(s),i=vP(i),a!=null&&(a=bM(a)),n===void 0&&(n=s.frameAnchor);let l=SP(t),u=RP(c,bM),[f,d]=pn(),[h,p]=pn();return{x:f,y:h,frameAnchor:n,...mn(c,(y,b)=>{let m=l(mt(y,e)),g=d([]),x=p([]),_=-1,v=[],w=[],T=Gb().path(R=>m[R]),A=r();A.nodeSize&&A.nodeSize([1,1]),A.separation&&o!==void 0&&A.separation(o??ym);for(let R of u)R[Z_]=R[AP]([]);for(let R of b){let I=[],E=T(R.filter(O=>m[O]!=null)).each(O=>O.data=y[O.data]);i!=null&&E.sort(i),A(E);for(let O of E.descendants())if(!(a!=null&&!a(O))){I.push(++_),v[_]=O.data,s.position(O,_,g,x);for(let k of u)k[Z_][_]=k[NP](O)}w.push(I)}return{data:v,facets:w}}),...Object.fromEntries(u)}}function Q_({path:e=W,delimiter:t,curve:n="bump-x",stroke:r="#555",strokeWidth:i=1.5,strokeOpacity:o=.5,treeLayout:s=al,treeSort:a,treeSeparation:c,treeAnchor:l,treeFilter:u,...f}={}){l=K_(l),a=vP(a),u!=null&&(u=wP(u)),f={curve:n,stroke:r,strokeWidth:i,strokeOpacity:o,...f};let d=SP(t),h=RP(f,wP),[p,y]=pn(),[b,m]=pn(),[g,x]=pn(),[_,v]=pn();return{x1:p,x2:b,y1:g,y2:_,...mn(f,(w,T)=>{let A=d(mt(w,e)),R=y([]),I=m([]),E=x([]),O=v([]),k=-1,S=[],M=[],N=Gb().path(B=>A[B]),F=s();F.nodeSize&&F.nodeSize([1,1]),F.separation&&c!==void 0&&F.separation(c??ym);for(let B of h)B[Z_]=B[AP]([]);for(let B of T){let C=[],P=N(B.filter(U=>A[U]!=null)).each(U=>U.data=w[U.data]);a!=null&&P.sort(a),F(P);for(let{source:U,target:$}of P.links())if(!(u!=null&&!u($,U))){C.push(++k),S[k]=$.data,l.position(U,k,R,E),l.position($,k,I,O);for(let X of h)X[Z_][k]=X[NP]($,U)}M.push(C)}return{data:S,facets:M}}),...Object.fromEntries(h)}}function K_(e="left"){switch(`${e}`.trim().toLowerCase()){case"left":return fJ;case"right":return dJ}throw new Error(`invalid tree anchor: ${e}`)}var fJ={frameAnchor:"left",dx:6,position({x:e,y:t},n,r,i){r[n]=t,i[n]=-e}},dJ={frameAnchor:"right",dx:-6,position({x:e,y:t},n,r,i){r[n]=-t,i[n]=-e}};function vP(e){return e==null||typeof e=="function"?e:`${e}`.trim().toLowerCase().startsWith("node:")?_P(bM(e)):_P(hJ(e))}function _P(e){return(t,n)=>fn(e(t),e(n))}function hJ(e){return t=>t.data?.[e]}function SP(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=>pJ(r,t))}var gM=92,IP=47;function pJ(e,t){if(t===gM)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 gM: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 IP: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 mJ(e){let t=!1;for(let n=0,r=e.length;n<r;++n){switch(e.charCodeAt(n)){case gM:if(!t){t=!0;continue}case IP:t&&(e=e.slice(0,n-1)+e.slice(n),--n,--r);break}t=!1}return e}function TP(e){return hn(e)&&typeof e.node=="function"}function yJ(e){return hn(e)&&typeof e.link=="function"}function bM(e){if(TP(e))return e.node;if(e=`${e}`.trim().toLowerCase(),!!e.startsWith("node:")){switch(e){case"node:name":return _M;case"node:path":return xM;case"node:internal":return EP;case"node:external":return MP;case"node:depth":return wM;case"node:height":return vM}throw new Error(`invalid node value: ${e}`)}}function wP(e){if(TP(e))return e.node;if(yJ(e))return e.link;if(e=`${e}`.trim().toLowerCase(),!(!e.startsWith("node:")&&!e.startsWith("parent:"))){switch(e){case"parent:name":return H_(_M);case"parent:path":return H_(xM);case"parent:depth":return H_(wM);case"parent:height":return H_(vM);case"node:name":return _M;case"node:path":return xM;case"node:internal":return EP;case"node:external":return MP;case"node:depth":return wM;case"node:height":return vM}throw new Error(`invalid link value: ${e}`)}}function xM(e){return e.id}function _M(e){return gJ(e.id)}function wM(e){return e.depth}function vM(e){return e.height}function EP(e){return!!e.children}function MP(e){return!e.children}function H_(e){return(t,n)=>n==null?void 0:e(n)}function gJ(e){let t=e.length;for(;--t>0&&!bJ(e,t););return mJ(e.slice(t+1))}function bJ(e,t){if(e[t]==="/"){let n=0;for(;t>0&&e[--t]==="\\";)++n;if(!(n&1))return!0}return!1}var AP=2,NP=3,Z_=4;function RP(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 SM(e,{fill:t,stroke:n,strokeWidth:r,strokeOpacity:i,strokeLinejoin:o,strokeLinecap:s,strokeMiterlimit:a,strokeDasharray:c,strokeDashoffset:l,marker:u,markerStart:f=u,markerEnd:d=u,dot:h=ne(f)&&ne(d),text:p="node:name",textStroke:y="var(--plot-background)",title:b="node:path",dx:m,dy:g,textAnchor:x,treeLayout:_=al,textLayout:v=_===al||_===Vb?"mirrored":"normal",tip:w,...T}={}){if(m===void 0&&(m=K_(T.treeAnchor).dx),x!==void 0)throw new Error("textAnchor is not a configurable tree option");v=Ke(v,"textLayout",["mirrored","normal"]);function A(R){return Bo(e,sy({treeLayout:_,text:p,fill:t===void 0?"currentColor":t,stroke:y,dx:m,dy:g,title:b,...R,...T}))}return Je(C_(e,Q_({treeLayout:_,markerStart:f,markerEnd:d,stroke:n!==void 0?n:t===void 0?"node:internal":t,strokeWidth:r,strokeOpacity:i,strokeLinejoin:o,strokeLinecap:s,strokeMiterlimit:a,strokeDasharray:c,strokeDashoffset:l,...T})),h?yi(e,sy({treeLayout:_,fill:t===void 0?"node:internal":t,title:b,tip:w,...T})):null,p!=null?v==="mirrored"?[A({textAnchor:"start",treeFilter:"node:external"}),A({textAnchor:"end",treeFilter:"node:internal",dx:-m})]:A():null)}function OP(e,t){return SM(e,{...t,treeLayout:Vb})}function DP({geometry:e=W,...t}={}){return Se({...t,x:null,y:null},(n,r,i,o,s,{projection:a})=>{let c=mt(n,e),l=c.length,u=new Float64Array(l),f=new Float64Array(l),d=An(a);for(let h=0;h<l;++h)[u[h],f[h]]=d.centroid(c[h]);return{data:n,facets:r,channels:{x:{value:u,scale:a==null?"x":null,source:null},y:{value:f,scale:a==null?"y":null,source:null}}}})}function kP({geometry:e=W,...t}={}){let n;return{...t,x:{transform:r=>Float64Array.from(n=mt(mt(r,e),US),([i])=>i)},y:{transform:()=>Float64Array.from(n,([,r])=>r)}}}var VP=iU(jP(),1);var EJ=({marginLeft:e})=>[1,e],MJ=({width:e,marginRight:t})=>[-1,e-t],AJ=({width:e,marginLeft:t,marginRight:n})=>[0,(t+e-n)/2],NJ=({marginTop:e})=>[1,e],RJ=({height:e,marginBottom:t})=>[-1,e-t],OJ=({height:e,marginTop:t,marginBottom:n})=>[0,(t+e-n)/2];function YP(e){return typeof e=="string"?{anchor:e}:e}function GP(e={},t={}){arguments.length===1&&([e,t]=XP(e));let{anchor:n="left",padding:r=1,r:i=t.r}=YP(e);switch(`${n}`.toLowerCase()){case"left":n=EJ;break;case"right":n=MJ;break;case"middle":n=AJ;break;default:throw new Error(`unknown dodge anchor: ${n}`)}return HP("x","y",n,Nt(r),i,t)}function WP(e={},t={}){arguments.length===1&&([e,t]=XP(e));let{anchor:n="bottom",padding:r=1,r:i=t.r}=YP(e);switch(`${n}`.toLowerCase()){case"top":n=NJ;break;case"bottom":n=RJ;break;case"middle":n=OJ;break;default:throw new Error(`unknown dodge anchor: ${n}`)}return HP("y","x",n,Nt(r),i,t)}function XP(e){let{anchor:t,padding:n,...r}=e,{r:i}=r;return[{anchor:t,padding:n,r:i},r]}function HP(e,t,n,r,i,o){if(i!=null&&typeof i!="number"){let{channels:s,sort:a,reverse:c}=o;s=bm(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 Se(o,function(s,a,c,l,u,f){let{[t]:d,r:h}=c;if(!c[t])throw new Error(`missing channel: ${t}`);({[t]:d}=ec(c,l,f));let p=h?void 0:i!==void 0?Nt(i):this.r!==void 0?this.r:3;h&&(h=mt(h.value,l[h.scale]||W,Float64Array));let[y,b]=n(u),m=y?kJ:DJ,g=new Float64Array(d.length),x=h?_=>h[_]:()=>p;for(let _ of a){let v=(0,VP.default)();_=_.filter(h?T=>uf(d[T])&&ir(h[T]):T=>uf(d[T]));let w=new Float64Array(2*_.length+2);for(let T of _){let A=x(T),R=y?A+r:0,I=d[T]-A,E=d[T]+A,O=2;v.queryInterval(I-r,E+r,([,,S])=>{let M=g[S]-R,N=d[T]-d[S],F=r+(h?h[T]+h[S]:2*p),B=Math.sqrt(F*F-N*N);w[O++]=M-B,w[O++]=M+B});let k=w.slice(0,O);y&&(k=k.filter(S=>S>=0));t:for(let S of k.sort(m)){for(let M=0;M<O;M+=2)if(w[M]+1e-6<S&&S<w[M+1]-1e-6)continue t;g[T]=S+R;break}v.insert([I,E,T])}}y||(y=1);for(let _ of a)for(let v of _)g[v]=g[v]*y+b;return{data:s,facets:a,channels:{[e]:{value:g,source:null},[t]:{value:d,source:c[t]},...h&&{r:{value:h,source:c.r}}}}})}function DJ(e,t){return Math.abs(e)-Math.abs(t)}function kJ(e,t){return e-t}function QP(e,t){return arguments.length===1&&({basis:e,...t}=e),Qf(ew(e),t)}function KP(e,t){return arguments.length===1&&({basis:e,...t}=e),Kf(ew(e),t)}function ew(e){if(e===void 0)return ZP;if(typeof e=="function")return nw(gf(e));if(/^p\d{2}$/i.test(e))return ad(mf(e));switch(`${e}`.toLowerCase()){case"deviation":return CJ;case"first":return ZP;case"last":return LJ;case"max":return BJ;case"mean":return PJ;case"median":return UJ;case"min":return $J;case"sum":return zJ;case"extent":return FJ}throw new Error(`invalid basis: ${e}`)}function nw(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 ad(e){return nw((t,n)=>e(t,r=>n[r]))}var FJ={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}},ZP=nw((e,t)=>{for(let n=0;n<e.length;++n){let r=t[e[n]];if($e(r))return r}}),LJ=nw((e,t)=>{for(let n=e.length-1;n>=0;--n){let r=t[e[n]];if($e(r))return r}}),CJ={mapIndex(e,t,n){let r=Ss(e,o=>t[o]),i=ri(e,o=>t[o]);for(let o of e)n[o]=t[o]===null?NaN:i?(t[o]-r)/i:0}},BJ=ad($t),PJ=ad(Ss),UJ=ad(Bi),$J=ad(ce),zJ=ad(En);function JP(e,t){return qJ("x",e,t)}function qJ(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]=k1(t.replace(/^[+-]/,"")),i*=l}t=xf(t),r=(l,u)=>t.offset(l,u)}let o=`${e}1`,s=`${e}2`,a=br({[o]:l=>l.map(u=>r(u,i)),[s]:l=>l},n),c=a[s].transform;return a[s].transform=()=>{let l=c(),[u,f]=ae(l);return l.domain=i<0?[u,r(f,i)]:[r(u,i),f],l},a}function t9(e,t={}){if(typeof e=="string")switch(e.toLowerCase()){case"first":return NM(t);case"last":return RM(t)}if(typeof e=="function")return hc(null,e,t);let n,r;for(n in e){if(r!==void 0)throw new Error("ambiguous selector; multiple inputs");r=jJ(e[n])}if(r===void 0)throw new Error(`invalid selector: ${e}`);return hc(n,r,t)}function jJ(e){if(typeof e=="function")return e;switch(`${e}`.toLowerCase()){case"min":return OM;case"max":return DM}throw new Error(`unknown selector: ${e}`)}function NM(e){return hc(null,VJ,e)}function RM(e){return hc(null,YJ,e)}function e9(e){return hc("x",OM,e)}function n9(e){return hc("y",OM,e)}function r9(e){return hc("x",DM,e)}function i9(e){return hc("y",DM,e)}function*VJ(e){yield e[0]}function*YJ(e){yield e[e.length-1]}function*OM(e,t){yield A0(e,n=>t[n])}function*DM(e,t){yield Vc(e,n=>t[n])}function hc(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=mt(i,r),a=mt(i,e),c=[];for(let l of o){let u=[];for(let f of s?sn(l,d=>s[d]).values():[l])for(let d of t(f,a))u.push(d);c.push(u)}return{data:i,facets:c}})}var GJ=new Map([["style","style"],["width","width"],["height","height"],["margin","margin"],["marginLeft","marginLeft"],["marginRight","marginRight"],["marginTop","marginTop"],["marginBottom","marginBottom"],["align","align"],["aspectRatio","aspectRatio"],["axis","axis"],["inset","inset"],["grid","grid"],["label","label"],["padding","padding"],["round","round"],["xScale","x.type"],["xDomain","x.domain"],["xRange","x.range"],["xNice","x.nice"],["xInset","x.inset"],["xInsetLeft","x.insetLeft"],["xInsetRight","x.insetRight"],["xClamp","x.clamp"],["xRound","x.round"],["xAlign","x.align"],["xPadding","x.padding"],["xPaddingInner","x.paddingInner"],["xPaddingOuter","x.paddingOuter"],["xAxis","x.axis"],["xTicks","x.ticks"],["xTickSize","x.tickSize"],["xTickSpacing","x.tickSpacing"],["xTickPadding","x.tickPadding"],["xTickFormat","x.tickFormat"],["xTickRotate","x.tickRotate"],["xGrid","x.grid"],["xLine","x.line"],["xLabel","x.label"],["xLabelAnchor","x.labelAnchor"],["xLabelOffset","x.labelOffset"],["xFontVariant","x.fontVariant"],["xAriaLabel","x.ariaLabel"],["xAriaDescription","x.ariaDescription"],["xReverse","x.reverse"],["xZero","x.zero"],["yScale","y.type"],["yDomain","y.domain"],["yRange","y.range"],["yNice","y.nice"],["yInset","y.inset"],["yInsetTop","y.insetTop"],["yInsetBottom","y.insetBottom"],["yClamp","y.clamp"],["yRound","y.round"],["yAlign","y.align"],["yPadding","y.padding"],["yPaddingInner","y.paddingInner"],["yPaddingOuter","y.paddingOuter"],["yAxis","y.axis"],["yTicks","y.ticks"],["yTickSize","y.tickSize"],["yTickSpacing","y.tickSpacing"],["yTickPadding","y.tickPadding"],["yTickFormat","y.tickFormat"],["yTickRotate","y.tickRotate"],["yGrid","y.grid"],["yLine","y.line"],["yLabel","y.label"],["yLabelAnchor","y.labelAnchor"],["yLabelOffset","y.labelOffset"],["yFontVariant","y.fontVariant"],["yAriaLabel","y.ariaLabel"],["yAriaDescription","y.ariaDescription"],["yReverse","y.reverse"],["yZero","y.zero"],["facetMargin","facet.margin"],["facetMarginTop","facet.marginTop"],["facetMarginBottom","facet.marginBottom"],["facetMarginLeft","facet.marginLeft"],["facetMarginRight","facet.marginRight"],["facetGrid","facet.grid"],["facetLabel","facet.label"],["fxDomain","fx.domain"],["fxRange","fx.range"],["fxNice","fx.nice"],["fxInset","fx.inset"],["fxInsetLeft","fx.insetLeft"],["fxInsetRight","fx.insetRight"],["fxRound","fx.round"],["fxAlign","fx.align"],["fxPadding","fx.padding"],["fxPaddingInner","fx.paddingInner"],["fxPaddingOuter","fx.paddingOuter"],["fxAxis","fx.axis"],["fxTicks","fx.ticks"],["fxTickSize","fx.tickSize"],["fxTickSpacing","fx.tickSpacing"],["fxTickPadding","fx.tickPadding"],["fxTickFormat","fx.tickFormat"],["fxTickRotate","fx.tickRotate"],["fxGrid","fx.grid"],["fxLine","fx.line"],["fxLabel","fx.label"],["fxLabelAnchor","fx.labelAnchor"],["fxLabelOffset","fx.labelOffset"],["fxFontVariant","fx.fontVariant"],["fxAriaLabel","fx.ariaLabel"],["fxAriaDescription","fx.ariaDescription"],["fxReverse","fx.reverse"],["fyDomain","fy.domain"],["fyRange","fy.range"],["fyNice","fy.mice"],["fyInset","fy,inset"],["fyInsetTop","fy.insetTop"],["fyInsetBottom","fy.insetBottom"],["fyRound","fy.round"],["fyAlign","fy.align"],["fyPadding","fy.padding"],["fyPaddingInner","fy.paddingInner"],["fyPaddingOuter","fy.paddingOuter"],["fyAxis","fy.axis"],["fyTicks","fy.ticks"],["fyTickSize","fy.tickSize"],["fyTickSpacing","fy.tickSpacing"],["fyTickPadding","fy.tickPadding"],["fyTickFormat","fy.tickFormat"],["fyTickRotate","fy.tickRotate"],["fyGrid","fy.grid"],["fyLine","fy.line"],["fyLabel","fy.label"],["fyLabelAnchor","fy.labelAnchor"],["fyLabelOffset","fy.labelOffset"],["fyFontVariant","fy.fontVariant"],["fyAriaLabel","fy.ariaLabel"],["fyAriaDescription","fy.ariaDescription"],["fyReverse","fy.reverse"],["colorScale","color.type"],["colorDomain","color.domain"],["colorRange","color.range"],["colorClamp","color.clamp"],["colorN","color.n"],["colorNice","color.nice"],["colorScheme","color.scheme"],["colorInterpolate","color.interpolate"],["colorPivot","color.pivot"],["colorSymmetric","color.symmetric"],["colorLabel","color.label"],["colorReverse","color.reverse"],["colorZero","color.zero"],["colorTickFormat","color.tickFormat"],["opacityScale","opacity.type"],["opacityDomain","opacity.domain"],["opacityRange","opacity.range"],["opacityClamp","opacity.clamp"],["opacityNice","opacity.nice"],["opacityLabel","opacity.label"],["opacityReverse","opacity.reverse"],["opacityZero","opacity.zero"],["opacityTickFormat","opacity.tickFormat"],["rScale","r.type"],["rDomain","r.domain"],["rRange","r.range"],["rClamp","r.clamp"],["rNice","r.nice"],["rZero","r.zero"],["lengthScale","length.type"],["lengthDomain","length.domain"],["lengthRange","length.range"],["lengthClamp","length.clamp"],["lengthNice","length.nice"],["lengthZero","length.zero"],["projectionType","projection.type"],["projectionParallels","projection.parallels"],["projectionPrecision","projection.precision"],["projectionRotate","projection.rotate"],["projectionDomain","projection.domain"],["projectionInset","projection.inset"],["projectionInsetLeft","projection.insetLeft"],["projectionInsetRight","projection.insetRight"],["projectionInsetTop","projection.insetTop"],["projectionInsetBottom","projection.insetBottom"],["projectionClip","projection.clip"]]);function WJ(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 o9(e,t,n){for(let r in e){let i=GJ.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&&WJ(t,i.split("."),o)}}var XJ=new Set(["frame","hexgrid","sphere","graticule"]);async function a9(e){let t={marks:[]},n=[],{attributes:r,marks:i}=e;o9(r,t,n);let o=[];for(let a of i)for(let{type:c,data:l,options:u}of a.plotSpecs())XJ.has(c)?t.marks.push(rw[c](u)):t.marks.push(rw[c](l,u)),o.push(a.index);ZJ(t,e);let s=Bm(t);QJ(s,o),HJ(e,s,r,n);for(let a of e.interactors)await a.init(s);return s}function HJ(e,t,n,r){r.forEach(i=>{let o=n[i];if(o===qc){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 ZJ(e,t){let{marks:n}=t;iw("x",e,n,["x","x1","x2"]),iw("y",e,n,["y","y1","y2"]),iw("fx",e,n),iw("fy",e,n)}function iw(e,t,n,r=[e]){let i=t[e]||{};if(i.axis===null||i.label!==void 0)return;let o=n.map(u=>u.channelField(r)?.field);if(o.every(u=>u==null))return;let s,a,c;for(let u=0;u<o.length;++u){let{column:f,label:d}=o[u]||{};f===void 0&&d===void 0||(s===void 0&&a===void 0?(s=f,a=d,c=KJ(n[u].data,r)||"number"):a!==d?a=void 0:s!==f&&(s=void 0))}let l=a||s;if(l!==void 0){if((c==="number"||c==="date")&&(e==="x"||e==="y")){i.percent&&(l=`${l} (%)`);let u=(e==="x"?1:-1)*(i.reverse?-1:1);e==="x"||i.labelAnchor==="center"?l=e==="x"==u<0?`\u2190 ${l}`:`${l} \u2192`:l=`${u<0?"\u2191 ":"\u2193 "}${l}`}t[e]={...i,label:l}}}function QJ(e,t){let n=e.querySelectorAll('g[aria-label="facet"]');if(n.length)for(let r of n)s9(r,t);else s9(e,t)}function s9(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 KJ(e,t){for(let n of e)for(let r=0;r<t.length;++r){let i=n[t[r]];if(i!=null)return i instanceof Date?"date":typeof i}}var JJ={width:640,marginLeft:40,marginRight:20,marginTop:20,marginBottom:30},ly=class{constructor(t){this.attributes={...JJ},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=F2()}margins(){return{left:this.getAttribute("marginLeft"),top:this.getAttribute("marginTop"),bottom:this.getAttribute("marginBottom"),right:this.getAttribute("marginRight")}}innerWidth(){let{left:t,right:n}=this.margins();return this.getAttribute("width")-t-n}innerHeight(){let{top:t,bottom:n}=this.margins();return this.getAttribute("height")-t-n}pending(t){this.synch.pending(t)}update(t){return this.synch.ready(t)&&!this.pendingRender&&(this.pendingRender=!0,requestAnimationFrame(()=>this.render())),this.synch.promise}async render(){this.pendingRender=!1;let t=await a9(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 Nh(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 cd(e){return typeof e!="string"?!1:(e=e.toLowerCase().trim(),e==="none"||e==="currentcolor"||e.startsWith("url(")&&e.endsWith(")")||e.startsWith("var(")&&e.endsWith(")")||Fr(e)!==null)}var ttt=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 c9(e){return ttt.has(e)}var ett=new Set(["asterisk","circle","cross","diamond","diamond2","hexagon","plus","square","square2","star","times","triangle","triangle2","wye"]);function l9(e){return ett.has(`${e}`.toLowerCase())}function uy(e){return typeof e?.getChild=="function"}var ntt=2,rtt=10;function ow(e){return uy(e)?itt(e):e}function itt(e){let{batches:t,numRows:n}=e;if(!n)return[];let r=Array.from({length:n},()=>({}));for(let i=0,o=0;o<t.length;++o){let s=t[o],{schema:a,numRows:c,numCols:l}=s;for(let u=0;u<l;++u){let f=s.getChildAt(u),{name:d,type:h}=a.fields[u],p=ott(h);for(let y=i,b=0;b<c;++b,++y)r[y][d]=p(f.get(b))}i+=c}return r}function ott(e){let{typeId:t}=e;return t===rtt?n=>n==null?n:new Date(n):t===ntt&&e.bitWidth>=64?n=>n==null?n:Number(n):n=>n}var u9=e=>e==="stroke"||e==="fill",stt=e=>e==="symbol",att=(e,t)=>e!=="sort"&&e!=="tip"&&t!=null&&!Array.isArray(t),kM=(e,t)=>({channel:e,field:t,as:t instanceof mr?t.column:e}),FM=(e,t)=>({channel:e,value:t}),sw=e=>Array.isArray(e),Dn=class extends cr{constructor(t,n,r,i={}){super(n?.options?.filterBy),this.type=t,this.reqs=i,this.source=n,sw(this.source)&&(this.data=this.source);let o=this.channels=[],s=this.detail=new Set,a=this.params=new Set,c=(l,u)=>{let f=typeof u;if(l==="channels")for(let d in u)s.add(d),c(d,u[d]);else if(f==="function"&&u[Rh]){let d=u(this,l);for(let h in d)c(h,d[h])}else if(f==="string")c9(l)||u9(l)&&cd(u)||stt(l)&&l9(u)?o.push(FM(l,u)):o.push(kM(l,wa(u)));else if(ps(u))if(Array.isArray(u.columns))o.push(kM(l,u)),a.add(u);else{let d=FM(l,u.value);o.push(d),u.addEventListener("value",h=>(d.value=h,this.update()))}else f==="object"&&att(l,u)?o.push(kM(l,u)):u!==void 0&&o.push(FM(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)}channel(t){return this.channels.find(n=>n.channel===t)}channelField(...t){let n=t.flat();for(let r of n){let i=this.channel(r);if(i?.field)return i}return null}fields(){if(this.hasOwnData())return null;let{source:{table:t},channels:n,reqs:r}=this,i=new Map;for(let{channel:o,field:s}of n){let a=s?.column;if(a){if(s.stats?.length||r[o]){i.has(a)||i.set(a,new Set);let c=i.get(a);r[o]?.forEach(l=>c.add(l)),s.stats?.forEach(l=>c.add(l))}}else continue}return Array.from(i,([o,s])=>({table:t,column:o,stats:Array.from(s)}))}fieldInfo(t){return this.stats=t.reduce((n,r)=>(n[r.column]=r,n),Object.create(null)),this}query(t=[]){if(this.hasOwnData())return null;let{channels:n,source:{table:r}}=this;return LM(n,r).where(t)}queryPending(){return this.plot.pending(this),this}queryResult(t){return this.data=ow(t),this}update(){return this.plot.update(this)}plotSpecs(){let{type:t,data:n,detail:r,channels:i}=this,o={},s={};for(let a of i){let c=r.has(a.channel)?s:o;c[a.channel]=gi(a)}return r.size&&(o.channels=s),[{type:t,data:n,options:o}]}};function gi(e){return Object.hasOwn(e,"value")?e.value:u9(e.channel)?{value:e.as,scale:"color"}:e.as}function LM(e,t,n=[]){let r=yt.from({source:t}),i=new Set,o=!1;for(let s of e){let{channel:a,field:c,as:l}=s;if(!n.includes(a)){if(a==="orderby")r.orderby(s.value);else if(c){if(c.aggregate)o=!0;else{if(i.has(l))continue;i.add(l)}r.select({[l]:c})}}}return o&&r.groupby(Array.from(i)),r}function Vr(e,t,n){if(!e.stats)return r;let{field:r}=e.channelField(t),{type:i}=e.stats[r.column];return n=n??r,i==="date"?Th(n):n}function fy(e,t,n,r,i=!1,o=1){let s=(r-o)/(n-t),a=s!==1?` * ${s}::DOUBLE`:"";return i?j`(${+n} - ${e}::DOUBLE)${a}`:j`(${e}::DOUBLE - ${+t})${a}`}var CM={x:["min","max"]},BM={y:["min","max"]},aw={...CM,...BM};function f9(e,t,n,r,i){let{plot:o,stats:s}=e,a=o.getAttribute(r),c=o.getAttribute(i);if(Array.isArray(a)&&!a[ni])return a;{let{field:l}=e.channelField(n),{column:u}=l,{min:f,max:d}=s[u],h=PM(t,u)||(c?ks().domain([f,d]).nice().domain():[f,d]);return a!==qc&&(h[ni]=!0),o.setAttribute(r,h,{silent:!0}),h}}function qo(e,t){return f9(e,t,"x","xDomain","xNice")}function jo(e,t){return f9(e,t,"y","yDomain","yNice")}function PM(e,t){if(!e)return;let n,r,i=(o,s)=>{if(o==="BETWEEN"&&s.field.column===t){let{range:a}=s;a&&(n==null||a[0]<n)&&(n=a[0]),a&&(r==null||a[1]>r)&&(r=a[1])}};return Array.isArray(e)?e.forEach(o=>o.visit?.(i)):e.visit&&e.visit(i),n!=null&&r!=null&&n!==r?[n,r]:void 0}var dy=class extends Dn{constructor(t,n,r){let i=t.endsWith("X")?"y":t.endsWith("Y")?"x":null,o={[i]:["count","min","max"]};super(t,n,r,o),this.dim=i}query(t=[]){let{plot:n,dim:r,source:i,stats:o}=this,{optimize:s=!0}=i.options||{},a=super.query(t);if(s&&r){let{field:c,as:l}=this.channelField(r),{column:u}=c,{count:f,max:d,min:h}=o[u],p=r==="x"?n.innerWidth():n.innerHeight(),[y,b]=PM(t,u)||[h,d],m=(b-y)/(d-h);if(f*m>p*4){let g=Vr(this,r,l),x=this.channelField(r==="x"?"y":"x").as,_=a.select().map(v=>v.as).filter(v=>v!==l&&v!==x);return ctt(a,g,l,x,y,b,p,_)}a.orderby(l)}return a}};function ctt(e,t,n,r,i,o,s,a=[]){let c=j`FLOOR(${s/(o-i)}::DOUBLE * (${t} - ${+i}::DOUBLE))::INTEGER`,l=u=>yt.from(e).select(u).groupby(c,a);return yt.union(l([{[n]:Jr(n),[r]:pu(r,n)},...a]),l([{[n]:Kr(n),[r]:mu(r,n)},...a]),l([{[n]:pu(n,r),[r]:Jr(r)},...a]),l([{[n]:mu(n,r),[r]:Kr(r)},...a])).orderby(a,n)}function bn(e,t,n,r){yr(n)?(r=r||(()=>e.requestUpdate()),n.addEventListener("value",i=>(e[t]=i,r())),e[t]=n.value):e[t]=n}function hy(e,t=!1){let n=new Float64Array(5),r=new Float64Array(4);ltt(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 ltt(e,t,n){let i=Float64Array.of(.84,1.8675,.84,-1.8675,-.34015,-.1299,-.34015,.1299),o=Math.exp(-1.783/n),s=Math.exp(-1.723/n),a=.6318/n,c=1.997/n,l=Float64Array.of(-o*Math.cos(a),o*Math.sin(a),-o*Math.cos(-a),o*Math.sin(-a),-s*Math.cos(c),s*Math.sin(c),-s*Math.cos(-c),s*Math.sin(-c)),u=n*2.5066282746310007,f=Float64Array.of(i[0],i[1],0,0,0,0,0,0),d=Float64Array.of(1,0,l[0],l[1],0,0,0,0,0,0),h,p;for(p=2;p<8;p+=2){for(f[p]=l[p]*f[p-2]-l[p+1]*f[p-1],f[p+1]=l[p]*f[p-1]+l[p+1]*f[p-2],h=p-2;h>0;h-=2)f[h]+=l[p]*f[h-2]-l[p+1]*f[h-1],f[h+1]+=l[p]*f[h-1]+l[p+1]*f[h-2];for(h=0;h<=p;h+=2)f[h]+=i[p]*d[h]-i[p+1]*d[h+1],f[h+1]+=i[p]*d[h+1]+i[p+1]*d[h];for(d[p+2]=l[p]*d[p]-l[p+1]*d[p+1],d[p+3]=l[p]*d[p+1]+l[p+1]*d[p],h=p;h>0;h-=2)d[h]+=l[p]*d[h-2]-l[p+1]*d[h-1],d[h+1]+=l[p]*d[h-1]+l[p+1]*d[h-2]}for(p=0;p<4;++p)h=p<<1,t[p]=f[h]/u,e[p+1]=d[h+2]}function d9(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);cw(e,n.subarray(u),r,1,o,s,a,f)}for(let l=0;l<r;++l){let u=c.subarray(l);cw(t,u,i,r,o,s,a,u)}return c}function cw(e,t,n,r=1,i=new Float64Array(n),o=new Float64Array(n),s=new Float64Array(5),a=i,c=utt){let l=r*2,u=r*3,f=r*4,d=r*n,h,p;for(c(i,t,n,r,e.b_causal,3,e.a,4,e.sum_causal,s,e.sigma),p=4,h=f;p<n;++p,h+=r)i[p]=e.b_causal[0]*t[h]+e.b_causal[1]*t[h-r]+e.b_causal[2]*t[h-l]+e.b_causal[3]*t[h-u]-e.a[1]*i[p-1]-e.a[2]*i[p-2]-e.a[3]*i[p-3]-e.a[4]*i[p-4];for(c(o,t,n,-r,e.b_anticausal,4,e.a,4,e.sum_anticausal,s,e.sigma),p=4,h=d-r*5;p<n;++p,h-=r)o[p]=e.b_anticausal[1]*t[h+r]+e.b_anticausal[2]*t[h+l]+e.b_anticausal[3]*t[h+u]+e.b_anticausal[4]*t[h+f]-e.a[1]*o[p-1]-e.a[2]*o[p-2]-e.a[3]*o[p-3]-e.a[4]*o[p-4];if(e.negative)for(p=0,h=0;p<n;++p,h+=r)a[h]=i[p]+o[n-p-1];else for(p=0,h=0;p<n;++p,h+=r)a[h]=Math.max(0,i[p]+o[n-p-1]);return a}function utt(e,t,n,r,i,o,s,a,c,l){let u=Math.abs(r)*n,f=r<0?u+r:0,d,h,p;for(h=0;h<a;++h)for(l[h]=h<=o?i[h]:0,p=1;p<=a&&p<=h;++p)l[h]-=s[p]*l[h-p];for(p=0;p<a;++p)for(e[p]=0,h=1;h<=p;++h)d=f+r*h,d>=0&&d<u&&(e[p]+=l[p-h]*t[d]);let y=t[f];if(y>0)for(p=0;p<a;++p)e[p]+=l[p]*y}function h9(e,t){return m9(new Float64Array(e),t)}function p9(e,t,n,r=[]){return r.length?Object.values(ftt(e*t,n,r)):[{grid:m9(new Float64Array(e*t),n)}]}function m9(e,t){if(uy(t)){let n=t.numRows;if(n===0)return e;let r=t.getChild("index").toArray(),i=t.getChild("value").toArray();for(let o=0;o<n;++o)e[r[o]]=i[o]}else for(let n of t)e[n.index]=n.value;return e}function ftt(e,t,n){let r={},i=o=>(r[o]||(r[o]={key:o,grid:new Float64Array(e)})).grid;if(uy(t)){let o=t.numRows;if(o===0)return r;let s=t.getChild("index").toArray(),a=t.getChild("value").toArray(),c=n.map(l=>t.getChild(l));for(let l=0;l<o;++l){let u=c.map(f=>f.get(l));i(u)[s[l]]=a[l]}}else for(let o of t){let s=n.map(a=>o[a]);i(s)[o.index]=o.value}return r}var Yi=class extends Dn{constructor(t,n,r){let{bandwidth:i=20,binType:o="linear",binWidth:s=2,binPad:a=1,...c}=r,l=dtt(c);super(t,n,c,aw),this.densityMap=l,bn(this,"bandwidth",i,()=>this.grids?this.convolve().update():null),bn(this,"binWidth",s),bn(this,"binType",o),bn(this,"binPad",a)}setPlot(t,n){let r=()=>{this.stats&&this.requestUpdate()};return t.addAttributeListener("domainX",r),t.addAttributeListener("domainY",r),super.setPlot(t,n)}get filterIndexable(){let t=this.plot.getAttribute("xDomain"),n=this.plot.getAttribute("yDomain");return t&&n&&!t[ni]&&!n[ni]}query(t=[]){let{plot:n,binType:r,binPad:i,channels:o,densityMap:s,source:a}=this,[c,l]=this.extentX=qo(this,t),[u,f]=this.extentY=jo(this,t),[d,h]=this.bins=this.binDimensions(this),p=Vr(this,"x"),y=Vr(this,"y"),b=!!n.getAttribute("xReverse"),m=!!n.getAttribute("yReverse"),g=y9(p,c,l,d,b,this.binPad),x=y9(y,u,f,h,m,this.binPad),_=i?[Te(p,[c,l]),Te(y,[u,f])]:[bs(c,p),gs(p,l),bs(u,y),gs(y,f)],v=yt.from(a.table).where(t.concat(_)),w=this.groupby=[],T=Or();for(let A of o)if(Object.hasOwn(A,"field")){let{as:R,channel:I,field:E}=A;E.aggregate?(T=E,s[I]=!0):I==="weight"?T=Dr(E):I!=="x"&&I!=="y"&&(v.select({[R]:E}),w.push(R))}return r==="linear"?ptt(v,g,x,T,d,w):htt(v,g,x,T,d,w)}binDimensions(){let{plot:t,binWidth:n}=this;return[Math.round(t.innerWidth()/n),Math.round(t.innerHeight()/n)]}queryResult(t){let[n,r]=this.bins;return this.grids=p9(n,r,t,this.groupby),this.convolve()}convolve(){let{bandwidth:t,bins:n,grids:r,plot:i}=this;if(t<=0)this.kde=this.grids.map(({key:o,grid:s})=>(s.key=o,s));else{let o=i.innerWidth(),s=i.innerHeight(),[a,c]=n,l=r.some(({grid:d})=>d.some(h=>h<0)),u=hy(t*(a-1)/o,l),f=hy(t*(c-1)/s,l);this.kde=this.grids.map(({key:d,grid:h})=>{let p=d9(u,f,h,n);return p.key=d,p})}return this}plotSpecs(){throw new Error("Unimplemented. Use a Grid2D mark subclass.")}};function dtt(e){let t={};for(let n in e)e[n]==="density"&&(delete e[n],t[n]=!0);return t}function y9(e,t,n,r,i,o){let s=(r-o)/(n-t),a=s!==1?` * ${s}::DOUBLE`:"";return i?j`(${n} - ${e}::DOUBLE)${a}`:j`(${e}::DOUBLE - ${t})${a}`}function htt(e,t,n,r,i,o){return e.select({index:j`FLOOR(${t})::INTEGER + FLOOR(${n})::INTEGER * ${i}`,value:r}).groupby("index",o)}function ptt(e,t,n,r,i,o){let s=r.column?`* ${r.column}`:"",a=(d,h)=>e.clone().select({xp:t,yp:n,i:d,w:h}),c=a(j`FLOOR(xp)::INTEGER + FLOOR(yp)::INTEGER * ${i}`,j`(FLOOR(xp)::INTEGER + 1 - xp) * (FLOOR(yp)::INTEGER + 1 - yp)${s}`),l=a(j`FLOOR(xp)::INTEGER + (FLOOR(yp)::INTEGER + 1) * ${i}`,j`(FLOOR(xp)::INTEGER + 1 - xp) * (yp - FLOOR(yp)::INTEGER)${s}`),u=a(j`FLOOR(xp)::INTEGER + 1 + FLOOR(yp)::INTEGER * ${i}`,j`(xp - FLOOR(xp)::INTEGER) * (FLOOR(yp)::INTEGER + 1 - yp)${s}`),f=a(j`FLOOR(xp)::INTEGER + 1 + (FLOOR(yp)::INTEGER + 1) * ${i}`,j`(xp - FLOOR(xp)::INTEGER) * (yp - FLOOR(yp)::INTEGER)${s}`);return yt.from(yt.unionAll(c,l,u,f)).select({index:"i",value:Dr("w")},o).groupby("index",o).having(Pc("value",0))}var py=class extends Yi{constructor(t,n){let{thresholds:r=10,...i}=n;super("geo",t,i),bn(this,"thresholds",r,()=>this.grids?this.contours().update():null)}convolve(){return super.convolve().contours()}contours(){let{bins:t,densityMap:n,kde:r,thresholds:i,groupby:o,plot:s}=this,a=i;if(!Array.isArray(a)){let v=$t(r.map(w=>$t(w)));a=Array.from({length:a-1},(w,T)=>v*(T+1)/a)}(n.fill||n.stroke)&&this.plot.getAttribute("colorScale")!=="log"&&this.plot.setAttribute("colorZero",!0);let[c,l]=t,[u,f]=s.getAttribute("xDomain"),[d,h]=s.getAttribute("yDomain"),p=(f-u)/c,y=(h-d)/l,b=+u,m=+d,g=v=>b+v*p,x=v=>m+v*y,_=Fa().size(t);return this.data=r.flatMap(v=>a.map(w=>{let T=mtt(_.contour(v,w),g,x);return o.forEach((A,R)=>T[A]=v.key[R]),T.density=w,T})),this}plotSpecs(){let{type:t,channels:n,densityMap:r,data:i}=this,o={};for(let s of n){let{channel:a}=s;a!=="x"&&a!=="y"&&(o[a]=gi(s))}return r.fill&&(o.fill="density"),r.stroke&&(o.stroke="density"),[{type:t,data:i,options:o}]}};function mtt(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 lw(e,t,n,r,i,o){let s=(o.length>>2)-1;for(let a=0,c=0;a<r;++a)for(let l=0,u=(r-a-1)*n;l<n;++l,c+=4){let f=s*i(e[l+u])<<2;t[c+0]=o[f+0],t[c+1]=o[f+1],t[c+2]=o[f+2],t[c+3]=o[f+3]}}function ld(e,t){let n=new Uint8ClampedArray(4*e),r=e-1;for(let i=0;i<=r;++i){let o=t(i/r),{r:s,g:a,b:c,opacity:l=1}=typeof o=="string"?an(o):o,u=i<<2;n[u+0]=s,n[u+1]=a,n[u+2]=c,n[u+3]=255*l|0}return n}function uw(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 fw(e="black"){let{r:t,g:n,b:r}=an(e);return i=>({r:t,g:n,b:r,opacity:i})}var $l=class extends Yi{constructor(t,n){super("image",t,n)}setPlot(t,n){let r=()=>{this.stats&&this.rasterize()};t.addAttributeListener("schemeColor",r),super.setPlot(t,n)}convolve(){return super.convolve().rasterize()}rasterize(){let{bins:t,kde:n,groupby:r}=this,[i,o]=t,{canvas:s,ctx:a,img:c}=ytt(this,i,o),l=gtt(this),u=r.indexOf(this.channelField("fill")?.as),f=u<0?[]:n.map(({key:d})=>d[u]);return this.data=n.map(d=>{let h=btt(this,f,d.key?.[u]);return lw(d,c.data,i,o,l,h),a.putImageData(c,0,0),{src:s.toDataURL()}}),this}plotSpecs(){let{type:t,plot:n,data:r}=this,i={src:"src",width:n.innerWidth(),height:n.innerHeight(),preserveAspectRatio:"none",imageRendering:this.channel("imageRendering")?.value,frameAnchor:"middle"};return[{type:t,data:r,options:i}]}};function ytt(e,t,n){if(!e.image||e.image.w!==t||e.image.h!==n){let r=uw(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 gtt(e){let{densityMap:t,kde:n,plot:r}=e,i=t.fill&&r.getAttribute("colorDomain");if(!i){let s=0,a=0;n.forEach(c=>{for(let l of c)l<s&&(s=l),l>a&&(a=l)}),i=s===0&&a===0?[0,1]:[s,a]}let o=r.getAttribute("colorScale");return Co({x:{type:o,domain:i,range:[0,1]}}).apply}function btt(e,t,n,r=1024){let{densityMap:i,plot:o}=e,s=o.getAttribute("colorScheme"),a=e.channel("fill"),c=cd(a?.value)?a.value:void 0;if(i.fill||s&&!c){if(s)try{return ld(r,Co({color:{scheme:s,domain:[0,1]}}).interpolate)}catch(l){console.warn(l)}}else if(t.length){let l=o.getAttribute("colorRange");c=Co({color:{domain:t,range:l,scheme:s||(l?void 0:"tableau10")}}).apply(n)}return ld(r,fw(c))}var my=class extends $l{constructor(t,n){let{normalize:r=!0,...i}=n;super(t,{bandwidth:0,...i}),bn(this,"normalize",r)}query(t=[]){let{plot:n,channels:r,normalize:i,source:o}=this,[s,a]=qo(this,t),[c,l]=jo(this,t),[u,f]=this.bins=this.binDimensions(this),d=Vr(this,"x"),h=Vr(this,"y"),p=!!n.getAttribute("xReverse"),y=!!n.getAttribute("yReverse"),b=fy(d,s,a,u,p,this.binPad),m=fy(h,c,l,f,y,this.binPad),g=yt.from(o.table).where(xtt(this,t)),x=this.groupby=[],_=[];for(let v of r)if(Object.hasOwn(v,"field")){let{channel:w,field:T}=v;w==="z"?(g.select({[w]:T}),_.push("z")):w!=="x"&&w!=="y"&&(g.select({[w]:T}),x.push(w))}return _tt(g,b,m,_,u,f,x,i)}};function xtt(e,t){if(Array.isArray(t)&&!t.length)return t;let n=e.channelField("x").field.column,r=e.channelField("y").field.column,i=s=>s.op!=="BETWEEN"||s.field.column!==n&&s.field.column!==r,o=s=>s.op==="AND"?Wn(s.children.filter(a=>i(a))):s;return Array.isArray(t)?t.filter(s=>i(s)).map(s=>o(s)):o(t)}function _tt(e,t,n,r,i,o,s=[],a=!0){e.select({x:j`FLOOR(${t})::INTEGER`,y:j`FLOOR(${n})::INTEGER`});let c=s.concat(r),l=c.length?`PARTITION BY ${c.join(", ")} `:"",u=yt.from(e).select(c,{x0:"x",y0:"y",dx:j`(lead(x) OVER sw - x)`,dy:j`(lead(y) OVER sw - y)`}).window({sw:j`${l}ORDER BY x ASC`}).qualify(Wn(j`(x0 < ${i} OR x0 + dx < ${i})`,j`(y0 < ${o} OR y0 + dy < ${o})`,j`(x0 > 0 OR x0 + dx > 0)`,j`(y0 > 0 OR y0 + dy > 0)`)),f=yt.select({x:j`GREATEST(MAX(ABS(dx)), MAX(ABS(dy)))`}).from("pairs"),d=yt.select({i:j`UNNEST(range((${f})))::INTEGER`}),h=yt.unionAll(yt.select(c,{x:j`x0 + i`,y:j`y0 + ROUND(i * dy / dx::FLOAT)::INTEGER`}).from("pairs","indices").where(j`ABS(dy) <= ABS(dx) AND i < ABS(dx)`),yt.select(c,{x:j`x0 + ROUND(SIGN(dy) * i * dx / dy::FLOAT)::INTEGER`,y:j`y0 + SIGN(dy) * i`}).from("pairs","indices").where(j`ABS(dy) > ABS(dx) AND i < ABS(dy)`),yt.select(c,{x:"x0",y:"y0"}).from("pairs").where(Bc("dx"))),p=["x"].concat(c).join(", "),y=yt.from("raster").select(c,"x","y",a?{w:j`1.0 / COUNT(*) OVER (PARTITION BY ${p})`}:null).where(Wn(Te("x",[0,i]),Te("y",[0,o])));return yt.with({pairs:u,indices:d,raster:h,points:y}).from("points").select(s,{index:j`x + y * ${i}::INTEGER`,value:a?Dr("w"):Or()}).groupby("index",s)}var ud=class extends Dn{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"?CM:BM),this.dim=a,bn(this,"bins",i),bn(this,"bandwidth",o,()=>this.grid?this.convolve().update():null)}get filterIndexable(){let t=this.dim==="x"?"xDomain":"yDomain",n=this.plot.getAttribute(t);return n&&!n[ni]}query(t=[]){if(this.hasOwnData())throw new Error("Density1DMark requires a data source");let{bins:n,channels:r,dim:i,source:{table:o}}=this,[s,a]=this.extent=(i==="x"?qo:jo)(this,t),c=Vr(this,i);return wtt(LM(r,o,[i]).where(t.concat(Te(c,[s,a]))),fy(c,s,a,n),this.channelField("weight")?"weight":null)}queryResult(t){return this.grid=h9(this.bins,t),this.convolve()}convolve(){let{bins:t,bandwidth:n,dim:r,grid:i,plot:o,extent:[s,a]}=this,c=i.some(g=>g<0),l=r==="x"?o.innerWidth():o.innerHeight(),u=hy(n*(t-1)/l,c),f=cw(u,i,t),d=this.data=[],h=r==="x"?"y":"x",p=this.channelField(r).as,y=+s,b=(a-y)/(t-1),m=1/b;for(let g=0;g<t;++g)d.push({[p]:y+g*b,[h]:f[g]*m});return this}plotSpecs(){let{type:t,data:n,channels:r,dim:i}=this,o=i==="x"?{y:"y"}:{x:"x"};for(let s of r)o[s.channel]=gi(s);return[{type:t,data:n,options:o}]}};function wtt(e,t,n){let r=n?`* ${n}`:"",i=e.clone().select({p:t,i:j`FLOOR(p)::INTEGER`,w:j`(FLOOR(p) + 1 - p)${r}`}),o=e.clone().select({p:t,i:j`FLOOR(p)::INTEGER + 1`,w:j`(p - FLOOR(p))${r}`});return yt.from(yt.unionAll(i,o)).select({index:"i",value:Dr("w")}).groupby("index").having(Pc("value",0))}var yy=class extends Yi{constructor(t,n){let{type:r="dot",binsX:i,binsY:o,...s}=n;s.binPad=s.binPad??0,super(r,t,s),bn(this,"binsX",i),bn(this,"binsY",o)}convolve(){super.convolve();let{bins:t,binPad:n,extentX:r,extentY:i}=this,[o,s]=t,[a,c]=r,[l,u]=i,f=(c-a)/(o-n),d=(u-l)/(s-n),h=n?0:.5;return this.data=vtt(this.kde,t,a,l,f,d,h),this}binDimensions(){let{plot:t,binWidth:n,binsX:r,binsY:i}=this;return[r??Math.round(t.innerWidth()/n),i??Math.round(t.innerHeight()/n)]}plotSpecs(){let{type:t,channels:n,densityMap:r,data:i}=this,o={};for(let s of n){let{channel:a}=s;o[a]=a==="x"||a==="y"?a:gi(s)}for(let s in r)r[s]&&(o[s]="density");return[{type:t,data:i,options:o}]}};function vtt(e,t,n,r,i,o,s){let a=1/(i*o),[c,l]=t,u=[];for(let f of e)for(let d=0,h=0;h<l;++h)for(let p=0;p<c;++p,++d)u.push({x:n+(p+s)*i,y:r+(h+s)*o,density:f[d]*a});return u}var Stt="geom",gy=class extends Dn{constructor(t,n={},r){!sw(t)&&!n?.geometry&&(n.geometry=Eh(Stt)),super("geo",t,n,r)}queryResult(t){super.queryResult(t);let n=this.channelField("geometry")?.as;return n&&this.data&&this.data.forEach(r=>{typeof r[n]=="string"&&(r[n]=JSON.parse(r[n]))}),this}};var by=class extends Dn{constructor(t,n){let{type:r="hexagon",binWidth:i=20,...o}=n;super(r,t,{r:i/2,clip:!0,...o},aw),this.binWidth=i}get filterIndexable(){let t=this.plot.getAttribute("xDomain"),n=this.plot.getAttribute("yDomain");return t&&n&&!t[ni]&&!n[ni]}query(t=[]){if(this.hasOwnData())return null;let{plot:n,binWidth:r,channels:i,source:o}=this,[s,a]=qo(this,t),[c,l]=jo(this,t),u=.5-n.getAttribute("marginLeft"),f=0-n.getAttribute("marginTop"),d=`${r}::DOUBLE`,h=`${r*(1.5/Math.sqrt(3))}::DOUBLE`,p=`${n.innerWidth()/(a-s)}::DOUBLE`,y=`${n.innerHeight()/(l-c)}::DOUBLE`,b,m,g=new Set,x={};for(let A of i)A.channel==="orderby"?_.orderby(A.value):A.channel==="x"?b=A:A.channel==="y"?m=A:Object.hasOwn(A,"field")&&(x[A.as]=A.field,A.field.aggregate&&A.field.columns.forEach(R=>g.add(R)));let _=yt.select({[b.as]:j`${s}::DOUBLE + ((x + 0.5 * (y & 1)) * ${d} + ${u})::DOUBLE / ${p}`,[m.as]:j`${l}::DOUBLE - (y * ${h} + ${f})::DOUBLE / ${y}`,...x}).groupby("x","y"),v=`${p} * (${b.field} - ${s}::DOUBLE)`,w=`${y} * (${l}::DOUBLE - ${m.field})`,T=yt.select({py:j`(${w} - ${f}) / ${h}`,pj:j`ROUND(py)::INTEGER`,px:j`(${v} - ${u}) / ${d} - 0.5 * (pj & 1)`,pi:j`ROUND(px)::INTEGER`,tt:j`ABS(py-pj) * 3 > 1 AND (px-pi)**2 + (py-pj)**2 > (px - pi - 0.5 * CASE WHEN px < pi THEN -1 ELSE 1 END)**2 + (py - pj - CASE WHEN py < pj THEN -1 ELSE 1 END)**2`,x:j`CASE WHEN tt THEN (pi + (CASE WHEN px < pi THEN -0.5 ELSE 0.5 END) + (CASE WHEN pj & 1 <> 0 THEN 0.5 ELSE -0.5 END))::INTEGER ELSE pi END`,y:j`CASE WHEN tt THEN (pj + CASE WHEN py < pj THEN -1 ELSE 1 END)::INTEGER ELSE pj END`}).select(Array.from(g)).from(o.table).where(ms(b.field),ms(m.field),t);return _.from(T)}};var xy=class extends Yi{constructor(t,n){let{origin:r=[0,0],dim:i="xy",...o}=n;super("image",t,o),this.origin=r,this.tileX=i.toLowerCase().includes("x"),this.tileY=i.toLowerCase().includes("y")}setPlot(t,n){let r=()=>{this.stats&&this.rasterize()};t.addAttributeListener("schemeColor",r),super.setPlot(t,n)}requestQuery(){return this.requestTiles()}query(t=[]){return this._filter=t,null}tileQuery(t){let{plot:n,binType:r,binPad:i,channels:o,densityMap:s,source:a}=this,[[c,l],[u,f]]=t,[d,h]=this.bins,p=Vr(this,"x"),y=Vr(this,"y"),b=!!n.getAttribute("xReverse"),m=!!n.getAttribute("yReverse"),g=g9(p,c,l,d,b,i),x=g9(y,u,f,h,m,i),_=i?[Te(p,[c,l]),Te(y,[u,f])]:[bs(c,p),gs(p,l),bs(u,y),gs(y,f)],v=yt.from(a.table).where(_),w=this.groupby=[],T=Or();for(let A of o)if(Object.hasOwn(A,"field")){let{channel:R,field:I}=A;I.aggregate?(T=I,s[R]=!0):R==="weight"?T=Dr(I):R!=="x"&&R!=="y"&&(v.select({[R]:I}),w.push(R))}return r==="linear"?Rtt(v,g,x,T,d,w):Ntt(v,g,x,T,d,w)}async requestTiles(){let t=ti();this.prefetch&&t.cancel(this.prefetch);let{binPad:n,tileX:r,tileY:i,origin:[o,s]}=this,[a,c]=this.bins=this.binDimensions(this),[l,u]=qo(this,this._filter),[f,d]=jo(this,this._filter),h=u-l,p=d-f,y=Math.floor((l-o)*(a-n)/h),b=Math.floor((f-s)*(c-n)/p),m=(I,E)=>[[o+I*h,o+(I+1)*h],[s+E*p,s+(E+1)*p]],g=Math.floor((l-o)/h),x=r?b9((u-o)/h):g,_=Math.floor((f-s)/p),v=i?b9((d-s)/p):_,w=[];for(let I=g;I<=x;++I)for(let E=_;E<=v;++E)w.push([I,E]);let T=w.map(([I,E])=>t.query(this.tileQuery(m(I,E)))),A=[];if(r)for(let I=_;I<=v;++I)A.push([x+1,I]),A.push([g-1,I]);if(i){let I=r?g-1:g,E=r?x+1:x;for(let O=I;O<=E;++O)A.push([O,v+1]),A.push([O,_-1])}this.prefetch=A.map(([I,E])=>t.prefetch(this.tileQuery(m(I,E))));let R=await Promise.all(T);this.grids=[{grid:Itt(a,c,y,b,w,R)}],this.convolve().update()}convolve(){return super.convolve().rasterize()}rasterize(){let{bins:t,kde:n,groupby:r}=this,[i,o]=t,{canvas:s,ctx:a,img:c}=Ett(this,i,o),l=Mtt(this),u=r.indexOf(this.channelField("fill")?.as),f=u<0?[]:n.map(({key:d})=>d[u]);return this.data=n.map(d=>{let h=Att(this,f,d.key?.[u]);return lw(d,c.data,i,o,l,h),a.putImageData(c,0,0),{src:s.toDataURL()}}),this}plotSpecs(){let{type:t,data:n,plot:r}=this,i={src:"src",width:r.innerWidth(),height:r.innerHeight(),preserveAspectRatio:"none",imageRendering:this.channel("imageRendering")?.value,frameAnchor:"middle"};return[{type:t,data:n,options:i}]}};function Itt(e,t,n,r,i,o){let s=new Float64Array(e*t);return o.forEach((a,c)=>{let[l,u]=i[c],f=l*e-n,d=u*t-r;Ttt(e,t,s,a,f,d)}),s}function Ttt(e,t,n,r,i,o){let s=r.numRows;if(s===0)return;let a=r.getChild("index").toArray(),c=r.getChild("value").toArray();for(let l=0;l<s;++l){let u=a[l],f=i+u%e,d=o+Math.floor(u/e);0<=f&&f<e&&0<=d&&d<t&&(n[f+d*e]=c[l])}}function Ett(e,t,n){if(!e.image||e.image.w!==t||e.image.h!==n){let r=uw(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 Mtt(e){let{densityMap:t,kde:n,plot:r}=e,i=t.fill&&r.getAttribute("colorDomain");if(!i){let s=0,a=0;n.forEach(c=>{for(let l of c)l<s&&(s=l),l>a&&(a=l)}),i=s===0&&a===0?[0,1]:[s,a]}let o=r.getAttribute("colorScale");return Co({x:{type:o,domain:i,range:[0,1]}}).apply}function Att(e,t,n,r=1024){let{densityMap:i,plot:o}=e,s=o.getAttribute("colorScheme"),a=e.channel("fill"),c=cd(a?.value)?a.value:void 0;if(i.fill||s&&!c){if(s)try{return ld(r,Co({color:{scheme:s,domain:[0,1]}}).interpolate)}catch(l){console.warn(l)}}else if(t.length){let l=o.getAttribute("colorRange");c=Co({color:{domain:t,range:l,scheme:s||(l?void 0:"tableau10")}}).apply(n)}return ld(r,fw(c))}function g9(e,t,n,r,i,o){let s=(r-o)/(n-t),a=s!==1?` * ${s}::DOUBLE`:"";return i?j`(${n} - ${e}::DOUBLE)${a}`:j`(${e}::DOUBLE - ${t})${a}`}function Ntt(e,t,n,r,i,o){return e.select({index:j`FLOOR(${t})::INTEGER + FLOOR(${n})::INTEGER * ${i}`,value:r}).groupby("index",o)}function Rtt(e,t,n,r,i,o){let s=r.column?`* ${r.column}`:"",a=(d,h)=>e.clone().select({xp:t,yp:n,i:d,w:h}),c=a(j`FLOOR(xp)::INTEGER + FLOOR(yp)::INTEGER * ${i}`,j`(FLOOR(xp)::INTEGER + 1 - xp) * (FLOOR(yp)::INTEGER + 1 - yp)${s}`),l=a(j`FLOOR(xp)::INTEGER + (FLOOR(yp)::INTEGER + 1) * ${i}`,j`(FLOOR(xp)::INTEGER + 1 - xp) * (yp - FLOOR(yp)::INTEGER)${s}`),u=a(j`FLOOR(xp)::INTEGER + 1 + FLOOR(yp)::INTEGER * ${i}`,j`(xp - FLOOR(xp)::INTEGER) * (FLOOR(yp)::INTEGER + 1 - yp)${s}`),f=a(j`FLOOR(xp)::INTEGER + 1 + (FLOOR(yp)::INTEGER + 1) * ${i}`,j`(xp - FLOOR(xp)::INTEGER) * (yp - FLOOR(yp)::INTEGER)${s}`);return yt.from(yt.unionAll(c,l,u,f)).select({index:"i",value:Dr("w")},o).groupby("index",o).having(wh("value",0))}function b9(e){let t=Math.floor(e);return t===e?t-1:t}function Ott(e,t,n){var r=1e-8,i=t-1,o=n-1,s=0,a,c,l,u,f,d,h,p,y,b,m;if(e<=0)return 0;if(e>=1)return 1;for(t>=1&&n>=1?(l=e<.5?e:1-e,u=Math.sqrt(-2*Math.log(l)),h=(2.30753+u*.27061)/(1+u*(.99229+u*.04481))-u,e<.5&&(h=-h),p=(h*h-3)/6,y=2/(1/(2*t-1)+1/(2*n-1)),b=h*Math.sqrt(p+y)/y-(1/(2*n-1)-1/(2*t-1))*(p+5/6-2/(3*y)),h=t/(t+n*Math.exp(2*b))):(a=Math.log(t/(t+n)),c=Math.log(n/(t+n)),u=Math.exp(t*a)/t,f=Math.exp(n*c)/n,b=u+f,e<u/b?h=Math.pow(t*b*e,1/t):h=1-Math.pow(n*b*(1-e),1/n)),m=-fd(t)-fd(n)+fd(t+n);s<10;s++){if(h===0||h===1)return h;if(d=Dtt(h,t,n)-e,u=Math.exp(i*Math.log(h)+o*Math.log(1-h)+m),f=d/u,h-=u=f/(1-.5*Math.min(1,f*(i/h-o/(1-h)))),h<=0&&(h=.5*(h+u)),h>=1&&(h=.5*(h+u+1)),Math.abs(u)<r*h&&s>0)break}return h}function Dtt(e,t,n){var r=e===0||e===1?0:Math.exp(fd(t+n)-fd(t)-fd(n)+t*Math.log(e)+n*Math.log(1-e));return e<0||e>1?!1:e<(t+1)/(t+n+2)?r*x9(e,t,n)/t:1-r*x9(1-e,n,t)/n}function x9(e,t,n){var r=1e-30,i=1,o=t+n,s=t+1,a=t-1,c=1,l=1-o*e/s,u,f,d,h;for(Math.abs(l)<r&&(l=r),l=1/l,h=l;i<=100&&(u=2*i,f=i*(n-i)*e/((a+u)*(t+u)),l=1+f*l,Math.abs(l)<r&&(l=r),c=1+f/c,Math.abs(c)<r&&(c=r),l=1/l,h*=l*c,f=-(t+i)*(o+i)*e/((t+u)*(s+u)),l=1+f*l,Math.abs(l)<r&&(l=r),c=1+f/c,Math.abs(c)<r&&(c=r),l=1/l,d=l*c,h*=d,!(Math.abs(d-1)<3e-7));i++);return h}function fd(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 _9(e,t){var n=Ott(2*Math.min(e,1-e),.5*t,.5);return n=Math.sqrt(t*(1-n)/n),e>.5?n:-n}var _y=class extends Dn{constructor(t,n){let{ci:r=.95,precision:i=4,...o}=n;super("line",t,o);let s=()=>this.modelFit?this.confidenceBand().update():null;bn(this,"ci",r,s),bn(this,"precision",i,s)}query(t=[]){let n=this.channelField("x").as,r=this.channelField("y").as,i=Array.from(new Set(["stroke","z","fx","fy"].flatMap(o=>this.channelField(o)?.as||[])));return yt.from(super.query(t)).select({intercept:n2(r,n),slope:r2(r,n),n:i2(r,n),ssy:o2(r,n),ssx:s2(r,n),xm:a2(r,n),x0:yu(Jr(n).where(ms(r))),x1:yu(Kr(n).where(ms(r)))}).select(i).groupby(i)}queryResult(t){return this.modelFit=ow(t),this.lineData=this.modelFit.flatMap(n=>ktt(n)),this.confidenceBand()}confidenceBand(){let{ci:t,modelFit:n,precision:r,plot:i}=this,o=i.innerWidth();return this.areaData=t?n.flatMap(s=>Ftt(t,r,s,o)):null,this}plotSpecs(){let{lineData:t,areaData:n,channels:r,ci:i}=this,o={x:"x",y:"y"},s={x:"x",y1:"y1",y2:"y2",fillOpacity:.1};for(let a of r)switch(a.channel){case"x":case"y":case"fill":break;case"stroke":o.stroke=s.fill=gi(a);break;case"strokeOpacity":o.strokeOpacity=gi(a);break;case"fillOpacity":s.fillOpacity=gi(a);break;default:o[a.channel]=s[a.channel]=gi(a);break}return[...i?[{type:"areaY",data:n,options:s}]:[],{type:"line",data:t,options:o}]}};function ktt(e){let{x0:t,x1:n,xm:r,intercept:i,slope:o,n:s,ssx:a,ssy:c,...l}=e;return[{x:t,y:i+t*o,...l},{x:n,y:i+n*o,...l}]}function Ftt(e,t,n,r){let{x0:i,x1:o,xm:s,intercept:a,slope:c,n:l,ssx:u,ssy:f,...d}=n,h=t*(o-i)/r,p=_9((1-e)/2,l-2)*Math.sqrt(f/(l-2));return Ue(i,o-h/2,h).concat(o).map(y=>{let b=a+y*c,m=p*Math.sqrt(1/l+(y-s)**2/u);return{x:y,y1:b-m,y2:b+m,...d}})}function w9(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 dd(e){let t={};for(let n in e)t[w9(n)]=e[n];return t}function Ltt(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 wy=class{constructor(t,{selection:n,channels:r={}}){this.mark=Ltt(t),this.selection=n;let i=Object.entries(dd(r));this.channels=i.length?i:[["opacity",.2]],this.selection.addEventListener("value",xd(()=>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 Ctt(o,s);for(let c=0;c<n.length;++c){let l=n[c],u=i[c],f=a(l.__data__);for(let d=0;d<r.length;++d){let[h,p]=r[d];l.setAttribute(h,f?u[d]:p)}}}};async function Ctt(e,t){let n=t?.predicate(e);if(!n||n.length===0)return()=>!0;let r=e.filterBy?.predicate(e,!0),i={__:Wn(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 UM(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 v9(){return UM(bS())}function S9(){return UM(yS())}function I9(){return UM(gS())}function vy(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 Vo(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 dw(){let e=this,t=e.getScreenCTM,n;e.getScreenCTM=()=>e.isConnected?n=t.call(e):n}var hd=class{constructor(t,{channel:n,selection:r,field:i,pixelSize:o=1,peers:s=!0,brush:a}){this.mark=t,this.channel=n,this.pixelSize=o||1,this.selection=r,this.peers=s,this.field=i||Vo(t,[n,n+"1",n+"2"]),this.style=a&&dd(a),this.brush=n==="y"?I9():S9(),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)),vy(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?Te(i,t):null}}init(t){let{brush:n,channel:r,style:i}=this;this.scale=t.scale(r);let o=t.scale("x").range,s=t.scale("y").range;n.extent([[ce(o),ce(s)],[$t(o),$t(s)]]);let a=zt(t).selectAll('g[aria-label="facet"]'),c=a.size()?a:zt(t);if(this.g=c.append("g").attr("class",`interval-${r}`).each(dw).call(n).call(n.moveSilent,this.value?.map(this.scale.apply)),i){let l=this.g.selectAll("rect.selection");for(let u in i)l.attr(u,i[u])}t.addEventListener("pointerenter",()=>this.activate())}};var hw=(e,t)=>e-t,Iy=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||Vo(t,["x","x1","x2"]),this.yfield=i||Vo(t,["y","y1","y2"]),this.style=a&&dd(a),this.brush=v9(),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(hw),a=[c[1],l[1]].map(u=>Sy(u,o,r)).sort(hw)}(!vy(s,n?.[0])||!vy(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?Wn(Te(i,t[0]),Te(o,t[1])):null}}init(t){let{brush:n,style:r}=this,i=this.xscale=t.scale("x"),o=this.yscale=t.scale("y"),s=i.range,a=o.range;n.extent([[ce(s),ce(a)],[$t(s),$t(a)]]);let c=zt(t).selectAll('g[aria-label="facet"]'),l=c.size()?c:zt(t);if(this.g=l.append("g").attr("class","interval-xy").each(dw).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(hw),[d,h]=this.value[1].map(o.apply).sort(hw);this.g.call(n.moveSilent,[[u,d],[f,h]])}t.addEventListener("pointerenter",()=>this.activate())}};var pd=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||Vo(t,[r])}clause(t){let{clients:n,field:r}=this,i=t?ys(r,Rr(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=zt(t).selectAll('g[aria-label="facet"]'),l=c.size()?c:zt(t),u=t.scale(i),f=!ei(o);l.on("pointerdown pointermove",function(d){let[h,p]=Fn(d,this),y=Btt(s,a,u.invert(i==="x"?h:p));o.update(f?y:n.clause(y))}),!f&&t.addEventListener("pointerenter",()=>{this.selection.activate(this.clause(0))})}};function Btt(e,t,n){let r=1/0,i;return e.forEach(o=>{let s=Math.abs(o[t]-n);s<r&&(r=s,i=o[t])}),i}var T9=(e,t)=>e-t,Ty=class{constructor(t,{x:n=new xs,y:r=new xs,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||Vo(t,["x","x1","x2"]),this.yfield=o||Vo(t,["y","y1","y2"]),this.zoom=$M(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=Ptt(t,this.xscale);this.xsel.update(this.clause(n,this.xfield,this.xscale))}if(this.pany){let n=Utt(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?Te(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(T9),c=this.yscale.range.slice().sort(T9),l=$M(n,[-1/0,1/0],a),u=$M(r,[-1/0,1/0],c),f=FT().extent([[a[0],c[0]],[a[1],c[1]]]).scaleExtent(this.zoom).translateExtent([[l[0],u[0]],[l[1],u[1]]]).on("start",()=>{this.xscale=this.svg.scale("x"),this.yscale=this.svg.scale("y")}).on("end",()=>i.__zoom=new Ur(1,0,0)).on("zoom",({transform:d})=>this.publish(d));if(zt(i).call(f),n||r){let d=!1;i.addEventListener("mouseenter",()=>{if(!d){if(d=!0,n){let{xscale:h,xfield:p}=this;o.activate(this.clause(h.domain,p,h))}if(r){let{yscale:h,yfield:p}=this;s.activate(this.clause(h.domain,p,h))}}}),i.addEventListener("mouseleave",()=>d=!1)}}};function $M(e,t,n){return e?Array.isArray(e)?e:t:n}function Ptt(e,t){return t.range.map(e.invertX,e).map(t.invert,t)}function Utt(e,t){return t.range.map(e.invertY,e).map(t.invert,t)}var zl=class{constructor(t,{selection:n,channels:r,peers:i=!0}){this.value=null,this.mark=t,this.selection=n,this.peers=i,this.channels=r.map(o=>{let s=o==="color"?["fill","stroke"]:o==="x"?["x","x1","x2"]:o==="y"?["y","y1","y2"]:[o];for(let a=0;a<s.length;++a){let c=t.channelField(s[a]);if(c)return{field:c.field?.basis||c.field,as:c.as}}throw new Error(`Missing channel: ${o}`)})}clause(t){let{channels:n,mark:r}=this,i=null;if(t){let o=t.map(s=>{let a=s.map((c,l)=>vh(n[l].field,Rr(c)));return a.length>1?Wn(a):a[0]});i=o.length>1?Cc(o):o[0]}return{source:this,schema:{type:"point"},clients:this.peers?r.plot.markSet:new Set().add(r),value:t,predicate:i}}init(t,n,r){let{mark:i,channels:o,selection:s}=this,{data:a}=i;r=r||(l=>{let u=a[l.__data__];return o.map(f=>u[f.as])}),n=n||`[data-index="${i.index}"]`;let c=new Set(t.querySelectorAll(n));t.addEventListener("pointerdown",l=>{let u=s.single?s.value:this.value,f=l.target,d=null;if($tt(c,f)){let h=r(f);l.shiftKey&&u?.length?(d=u.filter(p=>zM(p,h)),d.length===u.length&&d.push(h)):u?.length===1&&!zM(u[0],h)?d=null:d=[h]}this.value=d,ztt(u,d)&&s.update(this.clause(d))}),t.addEventListener("pointerenter",()=>{this.selection.activate(this.clause([this.channels.map(()=>0)]))})}};function $tt(e,t){return e.has(t)||e.has(t.parentNode)||e.has(t.parentNode?.parentNode)}function ztt(e,t){return e==null||t==null?e!=null||t!=null:e.length!==t.length||e.some((n,r)=>zM(n,t[r]))}function zM(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 md=class{constructor(t,n){let{as:r,...i}=n;this.channel=t,this.options={label:null,...i},this.selection=r,this.element=document.createElement("div"),this.element.setAttribute("class","legend"),this.element.value=this}setPlot(t){let{channel:n,selection:r}=this,i=qtt(t,n);this.selection&&i&&(this.handler=new zl(i,{selection:r,channels:[n]}),this.selection.addEventListener("value",()=>this.update()))}init(t){let{channel:n,options:r,handler:i}=this,s=t.scale(n).type==="ordinal"?r:{marginTop:1,tickSize:2,height:28,...r};return this.legend=t.legend(n,s),i&&(i.init(this.legend,":scope > div",a=>[a.__data__]),this.update()),this.element.replaceChildren(this.legend),this.element}update(){if(!this.legend)return;let{value:t}=this.selection,n=t&&t.length?new Set(t.map(i=>i[0])):null,r=this.legend.querySelectorAll(":scope > div");for(let i of r){let o=n?n.has(i.__data__):!0;i.style.opacity=o?1:.2}}};function qtt({marks:e},t){let n=t==="color"?["fill","stroke"]:t==="opacity"?["opacity","fillOpacity","strokeOpacity"]:null;if(n==null)return null;for(let r=e.length-1;r>-1;--r)if(e[r].channelField(n))return e[r];return null}var jtt=["rectY-x","rectX-y","rect-x","rect-y"];function Vtt(e,t){return jtt.includes(`${t}-${e}`)}function pw(e,t={steps:25}){let n=(r,i)=>Vtt(i,r.type)?{[`${i}1`]:qM(r,e,t),[`${i}2`]:qM(r,e,{...t,offset:1})}:{[i]:qM(r,e,t)};return n[Rh]=!0,n}function qM(e,t,n){return{column:t,label:t,get stats(){return["min","max"]},get columns(){return[t]},get basis(){return t},toString(){let{min:r,max:i}=e.stats[t],o=Ytt(r,i,n),s=Vt(t),a=o.min===0?s:`(${s} - ${o.min})`,c=`${(o.max-o.min)/o.steps}::DOUBLE`,l=n.offset?`${n.offset} + `:"";return`${o.min} + ${c} * (${l}FLOOR(${a} / ${c})::INTEGER)`}}}function Ytt(e,t,n){let{steps:r=25,minstep:i=0,nice:o=!0}=n;if(o!==!1){let s=t-e,a=r,c=Math.LN10,l=Math.ceil(Math.log(a)/c),u=Math.max(i,Math.pow(10,Math.round(Math.log(s)/c)-l));for(;Math.ceil(s/u)>a;)u*=10;let f=[5,2],d;for(let y=0,b=f.length;y<b;++y)d=u/f[y],d>=i&&s/d<=a&&(u=d);d=Math.log(u);let h=d>=0?0:~~(-d/c)+1,p=Math.pow(10,-h-1);d=Math.floor(e/u+p)*u,e=e<d?d-u:d,t=Math.ceil(t/u)*u,r=Math.round((t-e)/u)}return{min:e,max:t,steps:r}}var Gtt=e=>e&&typeof e=="object"&&!Array.isArray(e);var Ey=class extends cr{constructor({element:t,filterBy:n,from:r,column:i,label:o=i,format:s=u=>u,options:a,value:c,as:l}={}){super(n),this.from=r,this.column=i,this.selection=l,this.format=s,this.element=t??document.createElement("div"),this.element.setAttribute("class","input"),this.element.value=this;let u=document.createElement("label");u.innerText=o||i,this.element.appendChild(u),this.select=document.createElement("select"),a&&(this.data=a.map(f=>Gtt(f)?f:{value:f}),this.update()),c=c??this.selection?.value??this.data?.[0]?.value,this.selection?.value===void 0&&this.publish(c),this.element.appendChild(this.select),this.selection&&(this.select.addEventListener("input",()=>{this.publish(this.selectedValue()??null)}),ei(this.selection)||this.selection.addEventListener("value",f=>{f!==this.select.value&&this.selectedValue(f)}))}selectedValue(t){if(arguments.length===0){let n=this.select.selectedIndex;return this.data[n].value}else{let n=this.data?.findIndex(r=>r.value===t);n>=0?this.select.selectedIndex=n:this.select.value=String(t)}}reset(){this.select.selectedIndex=this.from?0:-1}publish(t){let{selection:n,column:r}=this;ei(n)?n.update({source:this,schema:{type:"point"},value:t,predicate:t!==""&&t!==void 0?ys(r,Rr(t)):null}):yr(n)&&n.update(t)}query(t=[]){let{from:n,column:r}=this;return n?yt.from(n).select({value:r}).distinct().where(t).orderby(r):null}queryResult(t){return this.data=[{value:"",label:"All"},...t],this}update(){let{data:t,format:n,select:r}=this;r.replaceChildren();for(let{value:i,label:o}of t){let s=document.createElement("option");s.setAttribute("value",i),s.innerText=o??n(i),this.select.appendChild(s)}return this.selection&&this.selectedValue(this.selection?.value??""),this}};var Wtt={contains:Tv,prefix:Ev,suffix:Mv,regexp:Iv},Xtt=0;var My=class extends cr{constructor({element:t,filterBy:n,from:r,column:i,label:o,type:s="contains",as:a}={}){if(super(n),this.id="search_"+ ++Xtt,this.type=s,this.from=r,this.column=i,this.selection=a,this.element=t??document.createElement("div"),this.element.setAttribute("class","input"),this.element.value=this,o){let c=document.createElement("label");c.setAttribute("for",this.id),c.innerText=o,this.element.appendChild(c)}this.searchbox=document.createElement("input"),this.searchbox.setAttribute("id",this.id),this.searchbox.setAttribute("type","text"),this.searchbox.setAttribute("placeholder","Query"),this.element.appendChild(this.searchbox),this.selection&&(this.searchbox.addEventListener("input",()=>{this.publish(this.searchbox.value||null)}),ei(this.selection)||this.selection.addEventListener("value",c=>{c!==this.searchbox.value&&(this.searchbox.value=c)}))}reset(){this.searchbox.value=""}publish(t){let{selection:n,column:r,type:i}=this;ei(n)?n.update({source:this,schema:{type:i},value:t,predicate:t?Wtt[i](r,Rr(t)):null}):yr(n)&&n.update(t)}query(t=[]){let{from:n,column:r}=this;return n?yt.from(n).select({list:r}).distinct().where(t):null}queryResult(t){return this.data=t,this}update(){let t=document.createElement("datalist"),n=`${this.id}_list`;t.setAttribute("id",n);for(let r of this.data){let i=document.createElement("option");i.setAttribute("value",r.list),t.append(i)}return this.datalist&&this.datalist.remove(),this.element.appendChild(this.datalist=t),this.searchbox.setAttribute("list",n),this}};var Htt=0;var Ay=class extends cr{constructor({element:t,filterBy:n,as:r,min:i,max:o,step:s,from:a,column:c,label:l=c,value:u=r?.value,width:f}={}){if(super(n),this.id="slider_"+ ++Htt,this.from=a,this.column=c||"value",this.selection=r,this.min=i,this.max=o,this.step=s,this.element=t||document.createElement("div"),this.element.setAttribute("class","input"),this.element.value=this,l){let d=document.createElement("label");d.setAttribute("for",this.id),d.innerText=l,this.element.appendChild(d)}this.slider=document.createElement("input"),this.slider.setAttribute("id",this.id),this.slider.setAttribute("type","range"),f!=null&&(this.slider.style.width=`${+f}px`),i!=null&&this.slider.setAttribute("min",i),o!=null&&this.slider.setAttribute("max",o),s!=null&&this.slider.setAttribute("step",s),u!=null&&(this.slider.setAttribute("value",u),this.selection?.value===void 0&&this.publish(u)),this.element.appendChild(this.slider),this.selection&&(this.slider.addEventListener("input",()=>{this.publish(+this.slider.value)}),ei(this.selection)||this.selection.addEventListener("value",d=>{d!==+this.slider.value&&(this.slider.value=d)}))}query(t=[]){let{from:n,column:r}=this;return!n||this.min!=null&&this.max!=null?null:yt.select({min:Jr(r),max:Kr(r)}).from(n).where(t)}queryResult(t){let{min:n,max:r}=Array.from(t)[0];return this.min==null&&this.slider.setAttribute("min",n),this.max==null&&this.slider.setAttribute("max",r),this.step==null&&this.slider.setAttribute("step",(r-n)/500),this}publish(t){let{selection:n,column:r}=this;ei(n)?n.update({source:this,schema:{type:"point"},value:t,predicate:ys(r,Rr(t))}):yr(this.selection)&&n.update(t)}};var VM=GM(e=>{let t=mw(e);return n=>n==null?"":typeof n=="number"?t(n):n instanceof Date?YM(n):`${n}`}),mw=GM(e=>t=>t===0?"0":t.toLocaleString(e)),Tzt=VM(),Ezt=mw();function YM(e){return ff(e,"Invalid Date")}function GM(e){let t=GM,n;return(r="en")=>r===t?n:n=e(t=r)}var Ztt=-1;var Ny=class extends cr{constructor({element:t,filterBy:n,from:r,columns:i=["*"],align:o={},format:s,width:a,maxWidth:c,height:l=500,rowBatch:u=100}={}){super(n),this.id=`table-${++Ztt}`,this.from=r,this.columns=i,this.format=s,this.align=o,this.widths=typeof a=="object"?a:{},this.offset=0,this.limit=+u,this.pending=!1,this.sortHeader=null,this.sortColumn=null,this.sortDesc=!1,this.element=t||document.createElement("div"),this.element.setAttribute("id",this.id),this.element.value=this,typeof a=="number"&&(this.element.style.width=`${a}px`),c&&(this.element.style.maxWidth=`${c}px`),this.element.style.maxHeight=`${l}px`,this.element.style.overflow="auto";let f=-1;this.element.addEventListener("scroll",d=>{let{pending:h,loaded:p}=this,{scrollHeight:y,scrollTop:b,clientHeight:m}=d.target,g=b<f;f=b,!(g||h||p)&&y-b<2*m&&(this.pending=!0,this.requestData(this.offset+this.limit))}),this.tbl=document.createElement("table"),this.element.appendChild(this.tbl),this.head=document.createElement("thead"),this.tbl.appendChild(this.head),this.body=document.createElement("tbody"),this.tbl.appendChild(this.body),this.style=document.createElement("style"),this.element.appendChild(this.style)}requestData(t=0){this.offset=t;let n=this.query(this.filterBy?.predicate(this));this.requestQuery(n),ti().prefetch(n.clone().offset(t+this.limit))}fields(){return this.columns.map(t=>wa(this.from,t))}fieldInfo(t){this.schema=t;let n=this.head;n.innerHTML="";let r=document.createElement("tr");for(let{column:i}of t){let o=document.createElement("th");o.addEventListener("click",s=>this.sort(s,i)),o.appendChild(document.createElement("span")),o.appendChild(document.createTextNode(i)),r.appendChild(o)}return n.appendChild(r),this.formats=Qtt(this.format,t),this.style.innerText=tet(this.id,Ktt(this.align,t),Jtt(this.widths,t)),this}query(t=[]){let{from:n,limit:r,offset:i,schema:o,sortColumn:s,sortDesc:a}=this;return yt.from(n).select(o.map(c=>c.column)).where(t).orderby(s?a?xv(s):s:[]).limit(r).offset(i)}queryResult(t){return this.pending||(this.loaded=!1,this.body.replaceChildren()),this.data=t,this}update(){let{body:t,formats:n,data:r,schema:i,limit:o}=this,s=i.length,a=0;for(let c of r){++a;let l=document.createElement("tr");for(let u=0;u<s;++u){let f=c[i[u].column],d=document.createElement("td");d.innerText=f==null?"":n[u](f),l.appendChild(d)}t.appendChild(l)}return a<o&&(this.loaded=!0),this.pending=!1,this}sort(t,n){n===this.sortColumn?this.sortDesc=!this.sortDesc:(this.sortColumn=n,this.sortDesc=!1);let r=t.currentTarget,i=this.sortHeader;i===r&&t.metaKey?(i.firstChild.textContent="",this.sortHeader=null,this.sortColumn=null):(i&&(i.firstChild.textContent=""),this.sortHeader=r,r.firstChild.textContent=this.sortDesc?"\u25BE":"\u25B4"),this.requestData()}};function Qtt(e={},t,n){return t.map(({column:r,type:i})=>{if(r in e)return e[r];switch(i){case"number":return mw(n);case"date":return YM;default:return VM(n)}})}function Ktt(e={},t){return t.map(({column:n,type:r})=>n in e?e[n]:r==="number"?"right":"left")}function Jtt(e={},t){return t.map(({column:n})=>e[n])}function tet(e,t,n){let r=[];return t.forEach((i,o)=>{let s=+n[o];if(i!=="left"||s){let a=i!=="left"?`text-align:${i};`:"",c=s?`width:${s}px;max-width:${s}px;`:"";r.push(`#${e} tr>:nth-child(${o+1}) {${a}${c}}`)}}),r.join(" ")}function Ry(e,...t){let n=e?.context?.coordinator??ti();for(let r of t)n.connect(r)}function yw(e,t,n){let r=new t(n);return Ry(e,r),r.element}function E9(e){return yw(this,Ey,e)}function M9(e){return yw(this,My,e)}function A9(e){return yw(this,Ay,e)}function N9(e){return yw(this,Ny,e)}function R9({direction:e="vertical",wrap:t=!1},n){let r=document.createElement("div");return r.style.display="flex",r.style.flexDirection=e==="vertical"?"column":"row",r.style.flexWrap=t?t===!0?"wrap":t:"nowrap",r.style.justifyContent="flex-start",r.style.alignItems="flex-start",n.forEach(i=>r.appendChild(i)),r.value={element:r},r}function O9(...e){return R9({direction:"vertical"},e.flat())}function D9(...e){return R9({direction:"horizontal"},e.flat())}function k9({dim:e="width",size:t=10}){let n=document.createElement("span");n.style.display="inline-block",n.style[e]=Number.isNaN(+t)?t:`${t}px`;let r={element:n};return n.value=r,n}function F9(e){return k9({dim:"height",size:e})}function L9(e){return k9({dim:"width",size:e})}var P9={};_r(P9,{align:()=>aA,aspectRatio:()=>cA,axis:()=>lA,colorClamp:()=>O6,colorDomain:()=>N6,colorInterpolate:()=>L6,colorLabel:()=>P6,colorN:()=>D6,colorNice:()=>k6,colorPivot:()=>C6,colorRange:()=>R6,colorReverse:()=>U6,colorScale:()=>A6,colorScheme:()=>F6,colorSymmetric:()=>B6,colorTickFormat:()=>z6,colorZero:()=>$6,facetGrid:()=>E3,facetLabel:()=>M3,facetMargin:()=>w3,facetMarginBottom:()=>S3,facetMarginLeft:()=>I3,facetMarginRight:()=>T3,facetMarginTop:()=>v3,fxAlign:()=>L3,fxAriaDescription:()=>J3,fxAriaLabel:()=>K3,fxAxis:()=>U3,fxDomain:()=>A3,fxFontVariant:()=>Q3,fxGrid:()=>G3,fxInset:()=>O3,fxInsetLeft:()=>D3,fxInsetRight:()=>k3,fxLabel:()=>X3,fxLabelAnchor:()=>H3,fxLabelOffset:()=>Z3,fxLine:()=>W3,fxNice:()=>R3,fxPadding:()=>C3,fxPaddingInner:()=>B3,fxPaddingOuter:()=>P3,fxRange:()=>N3,fxReverse:()=>t6,fxRound:()=>F3,fxTickFormat:()=>V3,fxTickPadding:()=>j3,fxTickRotate:()=>Y3,fxTickSize:()=>z3,fxTickSpacing:()=>q3,fxTicks:()=>$3,fyAlign:()=>c6,fyAriaDescription:()=>E6,fyAriaLabel:()=>T6,fyAxis:()=>d6,fyDomain:()=>e6,fyFontVariant:()=>I6,fyGrid:()=>x6,fyInset:()=>i6,fyInsetBottom:()=>s6,fyInsetTop:()=>o6,fyLabel:()=>w6,fyLabelAnchor:()=>v6,fyLabelOffset:()=>S6,fyLine:()=>_6,fyNice:()=>r6,fyPadding:()=>l6,fyPaddingInner:()=>u6,fyPaddingOuter:()=>f6,fyRange:()=>n6,fyReverse:()=>M6,fyRound:()=>a6,fyTickFormat:()=>g6,fyTickPadding:()=>y6,fyTickRotate:()=>b6,fyTickSize:()=>p6,fyTickSpacing:()=>m6,fyTicks:()=>h6,grid:()=>fA,height:()=>nA,inset:()=>uA,label:()=>dA,lengthClamp:()=>sN,lengthDomain:()=>iN,lengthNice:()=>aN,lengthRange:()=>oN,lengthScale:()=>rN,lengthZero:()=>cN,margin:()=>KM,marginBottom:()=>sA,marginLeft:()=>rA,marginRight:()=>iA,marginTop:()=>oA,margins:()=>QM,name:()=>HM,opacityClamp:()=>Y6,opacityDomain:()=>j6,opacityLabel:()=>W6,opacityNice:()=>G6,opacityRange:()=>V6,opacityReverse:()=>X6,opacityScale:()=>q6,opacityTickFormat:()=>Z6,opacityZero:()=>H6,padding:()=>hA,projectionClip:()=>xN,projectionDomain:()=>hN,projectionInset:()=>pN,projectionInsetBottom:()=>bN,projectionInsetLeft:()=>mN,projectionInsetRight:()=>yN,projectionInsetTop:()=>gN,projectionParallels:()=>uN,projectionPrecision:()=>fN,projectionRotate:()=>dN,projectionType:()=>lN,rClamp:()=>tN,rDomain:()=>K6,rNice:()=>eN,rRange:()=>J6,rScale:()=>Q6,rZero:()=>nN,round:()=>pA,style:()=>tA,width:()=>eA,xAlign:()=>IA,xAriaDescription:()=>qA,xAriaLabel:()=>zA,xAxis:()=>AA,xClamp:()=>vA,xDomain:()=>yA,xFontVariant:()=>$A,xGrid:()=>LA,xInset:()=>xA,xInsetLeft:()=>_A,xInsetRight:()=>wA,xLabel:()=>BA,xLabelAnchor:()=>PA,xLabelOffset:()=>UA,xLine:()=>CA,xNice:()=>bA,xPadding:()=>TA,xPaddingInner:()=>EA,xPaddingOuter:()=>MA,xRange:()=>gA,xReverse:()=>jA,xRound:()=>SA,xScale:()=>mA,xTickFormat:()=>kA,xTickPadding:()=>DA,xTickRotate:()=>FA,xTickSize:()=>RA,xTickSpacing:()=>OA,xTicks:()=>NA,xZero:()=>VA,xyDomain:()=>JM,yAlign:()=>t3,yAriaDescription:()=>b3,yAriaLabel:()=>g3,yAxis:()=>i3,yClamp:()=>KA,yDomain:()=>GA,yFontVariant:()=>y3,yGrid:()=>f3,yInset:()=>HA,yInsetBottom:()=>QA,yInsetTop:()=>ZA,yLabel:()=>h3,yLabelAnchor:()=>p3,yLabelOffset:()=>m3,yLine:()=>d3,yNice:()=>XA,yPadding:()=>e3,yPaddingInner:()=>n3,yPaddingOuter:()=>r3,yRange:()=>WA,yReverse:()=>x3,yRound:()=>JA,yScale:()=>YA,yTickFormat:()=>l3,yTickPadding:()=>c3,yTickRotate:()=>u3,yTickSize:()=>s3,yTickSpacing:()=>a3,yTicks:()=>o3,yZero:()=>_3});var Oy=class extends Map{request(t,n){if(this.has(t))n(this.get(t));else{let r=this.waiting||(this.waiting=new Map),i=r.get(t)||[];r.set(t,i.concat(n))}}set(t,n){this.has(t)&&console.warn(`Overwriting named plot "${t}".`);let{waiting:r}=this;return r?.has(t)&&(r.get(t).forEach(i=>i(n)),r.delete(t)),super.set(t,n)}},WM=new Oy;function XM(e,t,n){(e?.context?.namedPlots??WM).request(t,n)}function C9(e,t,n){(e?.context?.namedPlots??WM).set(t,n)}function HM(e){return t=>C9(this,e,t)}function B9(e,t,n){yr(n)?(n.addEventListener("value",r=>{e.setAttribute(t,r),e.update()}),n.value!==void 0&&e.setAttribute(t,n.value)):e.setAttribute(t,n)}function eet(e,t){return n=>{B9(n,e,t)}}function ZM(e){return t=>{for(let[n,r]of Object.entries(e))B9(t,n,r)}}function QM(e){let{top:t,bottom:n,left:r,right:i}=e,o={};return t!==void 0&&(o.marginTop=t),n!==void 0&&(o.marginBottom=n),r!==void 0&&(o.marginLeft=r),i!==void 0&&(o.marginRight=i),ZM(o)}function KM(e){return ZM({marginTop:e,marginBottom:e,marginLeft:e,marginRight:e})}function JM(e){return ZM({xDomain:e,yDomain:e})}var L=e=>t=>eet(e,t),tA=L("style"),eA=L("width"),nA=L("height"),rA=L("marginLeft"),iA=L("marginRight"),oA=L("marginTop"),sA=L("marginBottom"),aA=L("align"),cA=L("aspectRatio"),lA=L("axis"),uA=L("inset"),fA=L("grid"),dA=L("label"),hA=L("padding"),pA=L("round"),mA=L("xScale"),yA=L("xDomain"),gA=L("xRange"),bA=L("xNice"),xA=L("xInset"),_A=L("xInsetLeft"),wA=L("xInsetRight"),vA=L("xClamp"),SA=L("xRound"),IA=L("xAlign"),TA=L("xPadding"),EA=L("xPaddingInner"),MA=L("xPaddingOuter"),AA=L("xAxis"),NA=L("xTicks"),RA=L("xTickSize"),OA=L("xTickSpacing"),DA=L("xTickPadding"),kA=L("xTickFormat"),FA=L("xTickRotate"),LA=L("xGrid"),CA=L("xLine"),BA=L("xLabel"),PA=L("xLabelAnchor"),UA=L("xLabelOffset"),$A=L("xFontVariant"),zA=L("xAriaLabel"),qA=L("xAriaDescription"),jA=L("xReverse"),VA=L("xZero"),YA=L("yScale"),GA=L("yDomain"),WA=L("yRange"),XA=L("yNice"),HA=L("yInset"),ZA=L("yInsetTop"),QA=L("yInsetBottom"),KA=L("yClamp"),JA=L("yRound"),t3=L("yAlign"),e3=L("yPadding"),n3=L("yPaddingInner"),r3=L("yPaddingOuter"),i3=L("yAxis"),o3=L("yTicks"),s3=L("yTickSize"),a3=L("yTickSpacing"),c3=L("yTickPadding"),l3=L("yTickFormat"),u3=L("yTickRotate"),f3=L("yGrid"),d3=L("yLine"),h3=L("yLabel"),p3=L("yLabelAnchor"),m3=L("yLabelOffset"),y3=L("yFontVariant"),g3=L("yAriaLabel"),b3=L("yAriaDescription"),x3=L("yReverse"),_3=L("yZero"),w3=L("facetMargin"),v3=L("facetMarginTop"),S3=L("facetMarginBottom"),I3=L("facetMarginLeft"),T3=L("facetMarginRight"),E3=L("facetGrid"),M3=L("facetLabel"),A3=L("fxDomain"),N3=L("fxRange"),R3=L("fxNice"),O3=L("fxInset"),D3=L("fxInsetLeft"),k3=L("fxInsetRight"),F3=L("fxRound"),L3=L("fxAlign"),C3=L("fxPadding"),B3=L("fxPaddingInner"),P3=L("fxPaddingOuter"),U3=L("fxAxis"),$3=L("fxTicks"),z3=L("fxTickSize"),q3=L("fxTickSpacing"),j3=L("fxTickPadding"),V3=L("fxTickFormat"),Y3=L("fxTickRotate"),G3=L("fxGrid"),W3=L("fxLine"),X3=L("fxLabel"),H3=L("fxLabelAnchor"),Z3=L("fxLabelOffset"),Q3=L("fxFontVariant"),K3=L("fxAriaLabel"),J3=L("fxAriaDescription"),t6=L("fxReverse"),e6=L("fyDomain"),n6=L("fyRange"),r6=L("fyNice"),i6=L("fyInset"),o6=L("fyInsetTop"),s6=L("fyInsetBottom"),a6=L("fyRound"),c6=L("fyAlign"),l6=L("fyPadding"),u6=L("fyPaddingInner"),f6=L("fyPaddingOuter"),d6=L("fyAxis"),h6=L("fyTicks"),p6=L("fyTickSize"),m6=L("fyTickSpacing"),y6=L("fyTickPadding"),g6=L("fyTickFormat"),b6=L("fyTickRotate"),x6=L("fyGrid"),_6=L("fyLine"),w6=L("fyLabel"),v6=L("fyLabelAnchor"),S6=L("fyLabelOffset"),I6=L("fyFontVariant"),T6=L("fyAriaLabel"),E6=L("fyAriaDescription"),M6=L("fyReverse"),A6=L("colorScale"),N6=L("colorDomain"),R6=L("colorRange"),O6=L("colorClamp"),D6=L("colorN"),k6=L("colorNice"),F6=L("colorScheme"),L6=L("colorInterpolate"),C6=L("colorPivot"),B6=L("colorSymmetric"),P6=L("colorLabel"),U6=L("colorReverse"),$6=L("colorZero"),z6=L("colorTickFormat"),q6=L("opacityScale"),j6=L("opacityDomain"),V6=L("opacityRange"),Y6=L("opacityClamp"),G6=L("opacityNice"),W6=L("opacityLabel"),X6=L("opacityReverse"),H6=L("opacityZero"),Z6=L("opacityTickFormat"),Q6=L("rScale"),K6=L("rDomain"),J6=L("rRange"),tN=L("rClamp"),eN=L("rNice"),nN=L("rZero"),rN=L("lengthScale"),iN=L("lengthDomain"),oN=L("lengthRange"),sN=L("lengthClamp"),aN=L("lengthNice"),cN=L("lengthZero"),lN=L("projectionType"),uN=L("projectionParallels"),fN=L("projectionPrecision"),dN=L("projectionRotate"),hN=L("projectionDomain"),pN=L("projectionInset"),mN=L("projectionInsetLeft"),yN=L("projectionInsetRight"),gN=L("projectionInsetTop"),bN=L("projectionInsetBottom"),xN=L("projectionClip");function U9(e,t){return{table:e,options:t}}var $9={};_r($9,{area:()=>wN,areaX:()=>vN,areaY:()=>SN,arrow:()=>h4,axisFx:()=>b4,axisFy:()=>x4,axisX:()=>y4,axisY:()=>g4,barX:()=>MN,barY:()=>AN,cell:()=>NN,cellX:()=>RN,cellY:()=>ON,circle:()=>PN,contour:()=>n4,delaunayLink:()=>u4,delaunayMesh:()=>f4,denseLine:()=>e4,density:()=>t4,densityX:()=>KN,densityY:()=>JN,dot:()=>LN,dotX:()=>CN,dotY:()=>BN,frame:()=>m4,geo:()=>I4,graticule:()=>E4,gridFx:()=>v4,gridFy:()=>S4,gridX:()=>_4,gridY:()=>w4,hexagon:()=>UN,hexbin:()=>o4,hexgrid:()=>s4,hull:()=>d4,image:()=>QN,line:()=>IN,lineX:()=>TN,lineY:()=>EN,link:()=>p4,raster:()=>r4,rasterTile:()=>i4,rect:()=>DN,rectX:()=>kN,rectY:()=>FN,regressionY:()=>a4,ruleX:()=>jN,ruleY:()=>VN,sphere:()=>T4,spike:()=>ZN,text:()=>$N,textX:()=>zN,textY:()=>qN,tickX:()=>YN,tickY:()=>GN,vector:()=>WN,vectorX:()=>XN,vectorY:()=>HN,voronoi:()=>c4,voronoiMesh:()=>l4});var net=new Set(["frame","axisX","axisY","axisFx","axisFy","gridX","gridY","gridFx","gridFy","hexgrid","graticule","sphere"]);function St(e,t,n={}){arguments.length===2&&!Array.isArray(t)&&(n=t,t=net.has(e)?null:[{}]);let r=e.startsWith("area")||e.startsWith("line")?dy:Dn;return _N(r,e,t,n)}function _N(e,t,n,r){return i=>{i.addMark(new e(t,n,r))}}function pc(e,t,n){return r=>{r.addMark(new e(t,n))}}var wN=(...e)=>St("area",...e),vN=(...e)=>St("areaX",...e),SN=(...e)=>St("areaY",...e),IN=(...e)=>St("line",...e),TN=(...e)=>St("lineX",...e),EN=(...e)=>St("lineY",...e),MN=(...e)=>St("barX",...e),AN=(...e)=>St("barY",...e),NN=(...e)=>St("cell",...e),RN=(...e)=>St("cellX",...e),ON=(...e)=>St("cellY",...e),DN=(...e)=>St("rect",...e),kN=(...e)=>St("rectX",...e),FN=(...e)=>St("rectY",...e),LN=(...e)=>St("dot",...e),CN=(...e)=>St("dotX",...e),BN=(...e)=>St("dotY",...e),PN=(...e)=>St("circle",...e),UN=(...e)=>St("hexagon",...e),$N=(...e)=>St("text",...e),zN=(...e)=>St("textX",...e),qN=(...e)=>St("textY",...e),jN=(...e)=>St("ruleX",...e),VN=(...e)=>St("ruleY",...e),YN=(...e)=>St("tickX",...e),GN=(...e)=>St("tickY",...e),WN=(...e)=>St("vector",...e),XN=(...e)=>St("vectoX",...e),HN=(...e)=>St("vectorY",...e),ZN=(...e)=>St("spike",...e),QN=(...e)=>St("image",...e),KN=(...e)=>_N(ud,"areaX",...e),JN=(...e)=>_N(ud,"areaY",...e),t4=(...e)=>pc(yy,...e),e4=(...e)=>pc(my,...e),n4=(...e)=>pc(py,...e),r4=(...e)=>pc($l,...e),i4=(...e)=>pc(xy,...e),o4=(...e)=>pc(by,...e),s4=(...e)=>St("hexgrid",...e),a4=(...e)=>pc(_y,...e),c4=(...e)=>St("voronoi",...e),l4=(...e)=>St("voronoiMesh",...e),u4=(...e)=>St("delaunayLink",...e),f4=(...e)=>St("delaunayMesh",...e),d4=(...e)=>St("hull",...e),h4=(...e)=>St("arrow",...e),p4=(...e)=>St("link",...e),m4=(...e)=>St("frame",...e),y4=(...e)=>St("axisX",...e),g4=(...e)=>St("axisY",...e),b4=(...e)=>St("axisFx",...e),x4=(...e)=>St("axisFy",...e),_4=(...e)=>St("gridX",...e),w4=(...e)=>St("gridY",...e),v4=(...e)=>St("gridFx",...e),S4=(...e)=>St("gridFy",...e),I4=(...e)=>pc(gy,...e),T4=(...e)=>St("sphere",...e),E4=(...e)=>St("graticule",...e);var z9={};_r(z9,{highlight:()=>M4,intervalX:()=>k4,intervalXY:()=>L4,intervalY:()=>F4,nearestX:()=>O4,nearestY:()=>D4,pan:()=>C4,panX:()=>B4,panY:()=>P4,panZoom:()=>U4,panZoomX:()=>$4,panZoomY:()=>z4,toggle:()=>yd,toggleColor:()=>R4,toggleX:()=>A4,toggleY:()=>N4});function mc(e,t){return n=>{let r=n.marks[n.marks.length-1];n.addInteractor(new e(r,t))}}function M4({by:e,...t}){return mc(wy,{selection:e,channels:t})}function yd({as:e,...t}){return mc(zl,{...t,selection:e})}function A4(e){return yd({...e,channels:["x"]})}function N4(e){return yd({...e,channels:["y"]})}function R4(e){return yd({...e,channels:["color"]})}function O4({as:e,...t}){return mc(pd,{...t,selection:e,channel:"x"})}function D4({as:e,...t}){return mc(pd,{...t,selection:e,channel:"y"})}function k4({as:e,...t}){return mc(hd,{...t,selection:e,channel:"x"})}function F4({as:e,...t}){return mc(hd,{...t,selection:e,channel:"y"})}function L4({as:e,...t}){return mc(Iy,{...t,selection:e})}function gd(e){return mc(Ty,e)}function C4(e={}){return gd({...e,zoom:!1})}function B4(e={}){return gd({...e,zoom:!1,pany:!1})}function P4(e={}){return gd({...e,zoom:!1,panx:!1})}function U4(e={}){return gd(e)}function $4(e={}){return gd({...e,pany:!1})}function z4(e={}){return gd({...e,panx:!1})}var q9={};_r(q9,{colorLegend:()=>j4,opacityLegend:()=>V4,symbolLegend:()=>Y4});function q4(e,t={}){if(t.for){let{for:n,...r}=t,i=new md(e,r),o=typeof n,s=a=>a.addLegend(i,!1);return o==="string"?XM(this,n,s):n.value&&s(n.value),i.element}else return n=>n.addLegend(new md(e,t))}function j4(e){return q4.call(this,"color",e)}function V4(e){return q4.call(this,"opacity",e)}function Y4(e){return q4.call(this,"symbol",e)}function j9(...e){let t=new ly;return e.flat().forEach(n=>n(t)),Ry(this,...t.marks),t.element}function ret({coordinator:e=ti(),namedPlots:t=new Oy,extensions:n=null,...r}={}){return{...G4,...n,context:{coordinator:e,namedPlots:t,...r}}}export{Ah as Coordinator,qc as Fixed,cr as MosaicClient,Ta as Param,yt as Query,xs as Selection,$v as agg,aA as align,Wn as and,wN as area,vN as areaX,SN as areaY,mu as argmax,pu as argmin,u2 as arrayAgg,h4 as arrow,cA as aspectRatio,P9 as attributeDirectives,zv as avg,lA as axis,b4 as axisFx,x4 as axisFy,y4 as axisX,g4 as axisY,MN as barX,AN as barY,pw as bin,Ih as cast,yu as castDouble,f2 as castInteger,NN as cell,RN as cellX,ON as cellY,Mh as centroid,m2 as centroidX,y2 as centroidY,PN as circle,O6 as colorClamp,N6 as colorDomain,L6 as colorInterpolate,P6 as colorLabel,j4 as colorLegend,D6 as colorN,k6 as colorNice,C6 as colorPivot,R6 as colorRange,U6 as colorReverse,A6 as colorScale,F6 as colorScheme,B6 as colorSymmetric,z6 as colorTickFormat,$6 as colorZero,wa as column,Ry as connect,n4 as contour,ti as coordinator,t2 as corr,Or as count,e2 as covarPop,Ia as create,ret as createAPIContext,Dv as cume_dist,p2 as dateDay,d2 as dateMonth,h2 as dateMonthDay,u4 as delaunayLink,f4 as delaunayMesh,e4 as denseLine,Rv as dense_rank,t4 as density,KN as densityX,JN as densityY,LN as dot,CN as dotX,BN as dotY,Qv as entropy,ys as eq,E3 as facetGrid,M3 as facetLabel,w3 as facetMargin,S3 as facetMarginBottom,I3 as facetMarginLeft,T3 as facetMarginRight,v3 as facetMarginTop,Cv as first_value,m4 as frame,U9 as from,L3 as fxAlign,J3 as fxAriaDescription,K3 as fxAriaLabel,U3 as fxAxis,A3 as fxDomain,Q3 as fxFontVariant,G3 as fxGrid,O3 as fxInset,D3 as fxInsetLeft,k3 as fxInsetRight,X3 as fxLabel,H3 as fxLabelAnchor,Z3 as fxLabelOffset,W3 as fxLine,R3 as fxNice,C3 as fxPadding,B3 as fxPaddingInner,P3 as fxPaddingOuter,N3 as fxRange,t6 as fxReverse,F3 as fxRound,V3 as fxTickFormat,j3 as fxTickPadding,Y3 as fxTickRotate,z3 as fxTickSize,q3 as fxTickSpacing,$3 as fxTicks,c6 as fyAlign,E6 as fyAriaDescription,T6 as fyAriaLabel,d6 as fyAxis,e6 as fyDomain,I6 as fyFontVariant,x6 as fyGrid,i6 as fyInset,s6 as fyInsetBottom,o6 as fyInsetTop,w6 as fyLabel,v6 as fyLabelAnchor,S6 as fyLabelOffset,_6 as fyLine,r6 as fyNice,l6 as fyPadding,u6 as fyPaddingInner,f6 as fyPaddingOuter,n6 as fyRange,M6 as fyReverse,a6 as fyRound,g6 as fyTickFormat,y6 as fyTickPadding,b6 as fyTickRotate,p6 as fyTickSize,m6 as fyTickSpacing,h6 as fyTicks,I4 as geo,Eh as geojson,E4 as graticule,fA as grid,v4 as gridFx,S4 as gridFy,_4 as gridX,w4 as gridY,Pc as gt,wv as gte,D9 as hconcat,nA as height,UN as hexagon,o4 as hexbin,s4 as hexgrid,M4 as highlight,L9 as hspace,d4 as hull,QN as image,uA as inset,z9 as interactorDirectives,k4 as intervalX,L4 as intervalXY,F4 as intervalY,Te as isBetween,vv as isDistinct,Sv as isNotBetween,vh as isNotDistinct,ms as isNotNull,Bc as isNull,Zv as kurtosis,dA as label,Fv as lag,c2 as last,Bv as last_value,Lv as lead,q9 as legendDirectives,sN as lengthClamp,iN as lengthDomain,aN as lengthNice,oN as lengthRange,rN as lengthScale,cN as lengthZero,IN as line,TN as lineX,EN as lineY,p4 as link,Rr as literal,x2 as loadCSV,g2 as loadExtension,_2 as loadJSON,S2 as loadObjects,w2 as loadParquet,v2 as loadSpatial,gs as lt,bs as lte,qv as mad,KM as margin,sA as marginBottom,rA as marginLeft,iA as marginRight,oA as marginTop,QM as margins,$9 as markDirectives,Kr as max,Vv as median,E9 as menu,Jr as min,Gv as mode,HM as name,WM as namedPlots,O4 as nearestX,D4 as nearestY,wh as neq,_v as not,Pv as nth_value,kv as ntile,Y6 as opacityClamp,j6 as opacityDomain,W6 as opacityLabel,V4 as opacityLegend,G6 as opacityNice,V6 as opacityRange,X6 as opacityReverse,q6 as opacityScale,Z6 as opacityTickFormat,H6 as opacityZero,Cc as or,hA as padding,C4 as pan,B4 as panX,P4 as panY,U4 as panZoom,$4 as panZoomX,z4 as panZoomY,Ov as percent_rank,j9 as plot,jv as product,xN as projectionClip,hN as projectionDomain,pN as projectionInset,bN as projectionInsetBottom,mN as projectionInsetLeft,yN as projectionInsetRight,gN as projectionInsetTop,uN as projectionParallels,fN as projectionPrecision,dN as projectionRotate,lN as projectionType,Yv as quantile,tN as rClamp,K6 as rDomain,eN as rNice,J6 as rRange,Q6 as rScale,nN as rZero,Nv as rank,r4 as raster,i4 as rasterTile,DN as rect,kN as rectX,FN as rectY,a4 as regressionY,XM as requestNamedPlot,hD as restConnector,pA as round,Av as row_number,jN as ruleX,VN as ruleY,M9 as search,Hv as skewness,A9 as slider,c0 as socketConnector,T4 as sphere,ZN as spike,j as sql,Xv as stddev,Jv as stddevPop,l2 as stringAgg,tA as style,Dr as sum,Y4 as symbolLegend,N9 as table,$N as text,zN as textX,qN as textY,YN as tickX,GN as tickY,yd as toggle,R4 as toggleColor,A4 as toggleX,N4 as toggleY,Kv as varPop,Wv as variance,O9 as vconcat,WN as vector,XN as vectorX,HN as vectorY,c4 as voronoi,l4 as voronoiMesh,F9 as vspace,wD as wasmConnector,eA as width,IA as xAlign,qA as xAriaDescription,zA as xAriaLabel,AA as xAxis,vA as xClamp,yA as xDomain,$A as xFontVariant,LA as xGrid,xA as xInset,_A as xInsetLeft,wA as xInsetRight,BA as xLabel,PA as xLabelAnchor,UA as xLabelOffset,CA as xLine,bA as xNice,TA as xPadding,EA as xPaddingInner,MA as xPaddingOuter,gA as xRange,jA as xReverse,SA as xRound,mA as xScale,kA as xTickFormat,DA as xTickPadding,FA as xTickRotate,RA as xTickSize,OA as xTickSpacing,NA as xTicks,VA as xZero,JM as xyDomain,t3 as yAlign,b3 as yAriaDescription,g3 as yAriaLabel,i3 as yAxis,KA as yClamp,GA as yDomain,y3 as yFontVariant,f3 as yGrid,HA as yInset,QA as yInsetBottom,ZA as yInsetTop,h3 as yLabel,p3 as yLabelAnchor,m3 as yLabelOffset,d3 as yLine,XA as yNice,e3 as yPadding,n3 as yPaddingInner,r3 as yPaddingOuter,WA as yRange,x3 as yReverse,JA as yRound,YA as yScale,l3 as yTickFormat,c3 as yTickPadding,u3 as yTickRotate,s3 as yTickSize,a3 as yTickSpacing,o3 as yTicks,_3 as yZero};
78
+ }`)).call(Fp,r);for(let k of l){let{channels:$,values:z,facets:V}=y.get(k);if(p===void 0||k.facet==="super"){let Q=null;if(V&&(Q=V[0],Q=k.filter(Q,$,z),Q.length===0))continue;let nt=k.render(Q,b,z,w,I);if(nt==null)continue;A.appendChild(nt)}else{let Q;for(let nt of p){if(!(k.facetAnchor?.(p,O,nt)??!nt.empty))continue;let st=null;if(V){let X=f.has(k);if(st=V[X?nt.i:0],st=k.filter(st,$,z),st.length===0)continue;!X&&st===V[0]&&(st=rl(st)),st.fx=nt.x,st.fy=nt.y,st.fi=nt.i}let ut=k.render(st,b,z,v,I);if(ut!=null){(Q??=ae(A).append("g")).append(()=>ut).datum(nt);for(let X of["aria-label","aria-description","aria-hidden","transform"])ut.hasAttribute(X)&&(Q.attr(X,ut.getAttribute(X)),ut.removeAttribute(X))}}Q?.selectChildren().attr("transform",R)}}let E=Cq(g,I,e),{figure:C=n!=null||i!=null||o!=null||E.length>0}=e;C&&(B=D.createElement("figure"),B.className=`${c}-figure`,B.style.maxWidth="initial",n!=null&&B.append(zq(D,n,"h2")),i!=null&&B.append(zq(D,i,"h3")),B.append(...E,A),o!=null&&B.append(Zct(D,o))),B.scale=kj(b.scales),B.legend=Rq(g,I,e);let U=zV();return U>0&&ae(A).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(`${U.toLocaleString("en-US")} warning${U===1?"":"s"}. Please check the console.`),B}function zq(e,t,r){if(t.ownerDocument)return t;let n=e.createElement(r);return n.append(t),n}function Zct(e,t){let r=e.createElement("figcaption");return r.append(t),r}function Kct({marks:e=[],...t}={}){return Vb({...t,marks:[...e,this]})}Ft.prototype.plot=Kct;function Vq(e){return e.flat(1/0).filter(t=>t!=null).map(Qct)}function Qct(e){return typeof e.render=="function"?e:new B3(e)}var B3=class extends Ft{constructor(t){if(typeof t!="function")throw new TypeError("invalid mark; missing render function");super(),this.render=t}render(){}};function O3(e,t){for(let r in e)Wq(e[r],t);return e}function Wq(e,t){let{scale:r,transform:n=!0}=e;if(r==null||!n)return;let{type:i,percent:o,interval:s,transform:a=o?c=>c*100:FN(s,i)}=t[r]??{};a!=null&&(e.value=fe(e.value,a),e.transform=!1)}function Jct(e){for(let t in e)GN(t,e[t])}function zb(e,t,r,n=cV){for(let{channels:i}of t.values())for(let o in i){let s=i[o],{scale:a}=s;if(a!=null&&n(a))if(a==="projection"){if(!XV(r)){let c=r.x?.domain===void 0,l=r.y?.domain===void 0;if(c||l){let[u,f]=ZV(s);c&&D3(e,"x",u),l&&D3(e,"y",f)}}}else D3(e,a,s)}return e}function D3(e,t,r){let n=e.get(t);n!==void 0?n.push(r):e.set(t,[r])}function tlt(e,t){if(e==null)return;let{x:r,y:n}=e;if(r==null&&n==null)return;let i=Sr(e.data);if(i==null)throw new Error("missing facet data");let o={};r!=null&&(o.fx=Bp(i,{value:r,scale:"fx"})),n!=null&&(o.fy=Bp(i,{value:n,scale:"fy"})),O3(o,t);let s=jI(i,o);return{channels:o,groups:s,data:e.data}}function jq(e,t,r){if(e.facet===null||e.facet==="super")return;let{fx:n,fy:i}=e;if(n!=null||i!=null){let c=Sr(e.data??n??i);if(c===void 0)throw new Error(`missing facet data in ${e.ariaLabel}`);if(c===null)return;let l={};return n!=null&&(l.fx=Bp(c,{value:n,scale:"fx"})),i!=null&&(l.fy=Bp(c,{value:i,scale:"fy"})),O3(l,r),{channels:l,groups:jI(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)&&Sr(e.data)?.length===a.length&&kn(`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 elt(e,t={}){return Qe({...t,x:null,y:null},(r,n,i,o,s,a)=>a.getMarkState(e))}function rlt(e){let t=[];for(let r of e){let n=r.tip;if(n){n===!0?n={}:typeof n=="string"&&(n={pointer:n});let{pointer:i,preferredAnchor:o}=n;i=/^x$/i.test(i)?Vp:/^y$/i.test(i)?dd:zp,n=i(elt(r,n)),n.title=null,o===void 0&&(n.preferredAnchor=i===dd?"left":"bottom");let s=hT(r.data,n);s.facet=r.facet,s.facetAnchor=r.facetAnchor,t.push(s)}}return t}function nlt(e,t,r){let{projection:n,x:i={},y:o={},fx:s={},fy:a={},axis:c,grid:l,facet:u={},facet:{axis:f=c,grid:d}=u,x:{axis:h=c,grid:p=h===null?null:l}=i,y:{axis:y=c,grid:g=y===null?null:l}=o,fx:{axis:m=f,grid:b=m===null?null:d}=s,fy:{axis:x=f,grid:_=x===null?null:d}=a}=r;(n||!ya(i)&&!qq("x",e))&&(h=p=null),(n||!ya(o)&&!qq("y",e))&&(y=g=null),t.has("fx")||(m=b=null),t.has("fy")||(x=_=null),h===void 0&&(h=!yT(e,"x")),y===void 0&&(y=!yT(e,"y")),m===void 0&&(m=!yT(e,"fx")),x===void 0&&(x=!yT(e,"fy")),h===!0&&(h="bottom"),y===!0&&(y="left"),m===!0&&(m=h==="top"||h===null?"bottom":"top"),x===!0&&(x=y==="right"||y===null?"left":"right");let v=[];return mT(v,_,cT,a),pT(v,x,oT,"right","left",u,a),mT(v,b,uT,s),pT(v,m,sT,"top","bottom",u,s),mT(v,g,aT,o),pT(v,y,kb,"left","right",r,o),mT(v,p,lT,i),pT(v,h,Cb,"bottom","top",r,i),v}function pT(e,t,r,n,i,o,s){if(!t)return;let a=ilt(t);s=olt(a?n:t,o,s);let{line:c}=s;(r===kb||r===Cb)&&c&&!ol(c)&&e.push(Wp(slt(s))),e.push(r(s)),a&&e.push(r({...s,anchor:i,label:null}))}function mT(e,t,r,n){!t||ol(t)||e.push(r(alt(t,n)))}function ilt(e){return/^\s*both\s*$/i.test(e)}function olt(e,t,{line:r=t.line,ticks:n,tickSize:i,tickSpacing:o,tickPadding:s,tickFormat:a,tickRotate:c,fontVariant:l,ariaLabel:u,ariaDescription:f,label:d=t.label,labelAnchor:h,labelArrow:p=t.labelArrow,labelOffset:y}){return{anchor:e,line:r,ticks:n,tickSize:i,tickSpacing:o,tickPadding:s,tickFormat:a,tickRotate:c,fontVariant:l,ariaLabel:u,ariaDescription:f,label:d,labelAnchor:h,labelArrow:p,labelOffset:y}}function slt(e){let{anchor:t,line:r}=e;return{anchor:t,facetAnchor:t+"-empty",stroke:r===!0?void 0:r}}function alt(e,{stroke:t=wu(e)?e:void 0,ticks:r=clt(e)?e:void 0,tickSpacing:n,ariaLabel:i,ariaDescription:o}){return{stroke:t,ticks:r,tickSpacing:n,ariaLabel:i,ariaDescription:o}}function clt(e){switch(typeof e){case"number":return!0;case"string":return!wu(e)}return oi(e)||typeof e?.range=="function"}function yT(e,t){let r=`${t}-axis `;return e.some(n=>n.ariaLabel?.startsWith(r))}function qq(e,t){for(let r of t)for(let n in r.channels){let{scale:i}=r.channels[n];if(i===e||i==="projection")return!0}return!1}function llt(e,t){for(let r in e){let n=e[r],i=t[r];n.label===void 0&&i&&(n.label=i.label)}return e}function ult({fx:e,fy:t},r){let{marginTop:n,marginRight:i,marginBottom:o,marginLeft:s,width:a,height:c}=$I(r),l=e&&Yq(e),u=t&&Yq(t);return{marginTop:t?u[0]:n,marginRight:e?a-l[1]:i,marginBottom:t?c-u[1]:o,marginLeft:e?l[0]:s,inset:{marginTop:r.marginTop,marginRight:r.marginRight,marginBottom:r.marginBottom,marginLeft:r.marginLeft},width:a,height:c}}function Yq(e){let t=e.domain(),r=e(t[0]),n=e(t[t.length-1]);return n<r&&([r,n]=[n,r]),[r,n+e.bandwidth()]}var flt=new Map([["basis",JO],["basis-closed",tN],["basis-open",eN],["bundle",rN],["bump-x",XO],["bump-y",HO],["cardinal",nN],["cardinal-closed",iN],["cardinal-open",oN],["catmull-rom",sN],["catmull-rom-closed",aN],["catmull-rom-open",cN],["linear",Kc],["linear-closed",lN],["monotone-x",fN],["monotone-y",dN],["natural",hN],["step",pN],["step-after",yN],["step-before",mN]]);function jb(e=Kc,t){if(typeof e=="function")return e;let r=flt.get(`${e}`.toLowerCase());if(!r)throw new Error(`unknown curve: ${e}`);if(t!==void 0){if("beta"in r)return r.beta(t);if("tension"in r)return r.tension(t);if("alpha"in r)return r.alpha(t)}return r}function gT(e=Bu,t){return typeof e!="function"&&`${e}`.toLowerCase()==="auto"?Bu:jb(e,t)}function Bu(e){return Kc(e)}function Sa(e={y:"count"},t={}){[e,t]=F3(e,t);let{x:r,y:n}=t;return N3(bT(r,t,K),null,null,n,e,hd(t))}function Ia(e={x:"count"},t={}){[e,t]=F3(e,t);let{x:r,y:n}=t;return N3(null,bT(n,t,K),r,null,e,pd(t))}function fl(e={fill:"count"},t={}){[e,t]=F3(e,t);let{x:r,y:n}=dlt(t);return N3(r,n,null,null,e,hd(pd(t)))}function Hq(e,t,r={}){if(r?.interval==null)return r;let{reduce:n=EI}=r,i={filter:null};return r[t]!=null&&(i[t]=n),r[`${t}1`]!=null&&(i[`${t}1`]=n),r[`${t}2`]!=null&&(i[`${t}2`]=n),e(i,r)}function Gp(e={}){return Hq(Sa,"y",xs(e,"x"))}function Xp(e={}){return Hq(Ia,"x",xs(e,"y"))}function N3(e,t,r,n,{data:i=MI,filter:o=Ib,sort:s,reverse:a,...c}={},l={}){e=Gq(e),t=Gq(t),c=hlt(c,l),i=Qq(i,K),s=s==null?void 0:Zq("sort",s,l),o=o==null?void 0:Kq("filter",o,l),r!=null&&_a(c,"x","x1","x2")&&(r=null),n!=null&&_a(c,"y","y1","y2")&&(n=null);let[u,f]=wn(e),[d,h]=wn(e),[p,y]=wn(t),[g,m]=wn(t),[b,x]=r!=null?[r,"x"]:n!=null?[n,"y"]:[],[_,v]=wn(b),{x:w,y:I,z:D,fill:A,stroke:B,x1:M,x2:O,y1:R,y2:S,domain:T,cumulative:E,thresholds:C,interval:U,...k}=l,[$,z]=wn(D),[V]=cr(A),[Q]=cr(B),[nt,st]=wn(V),[ut,X]=wn(Q);return{..."z"in l&&{z:$||D},..."fill"in l&&{fill:nt||A},..."stroke"in l&&{stroke:ut||B},...en(k,(at,q,J)=>{let ct=ad(Tt(at,b),J?.[x]),j=Tt(at,D),Qt=Tt(at,V),gt=Tt(at,Q),he=Mb(c,{z:j,fill:Qt,stroke:gt}),pe=[],ot=[],Me=ct&&v([]),Ti=j&&z([]),vs=Qt&&st([]),HG=gt&&X([]),Q8=e&&f([]),ZG=e&&h([]),J8=t&&y([]),KG=t&&m([]),QG=ylt(e,t,at),JG=0;for(let Ed of c)Ed.initialize(at);s&&s.initialize(at),o&&o.initialize(at);for(let Ed of q){let tk=[];for(let Im of c)Im.scope("facet",Ed);s&&s.scope("facet",Ed),o&&o.scope("facet",Ed);for(let[Im,tX]of vu(Ed,he))for(let[eX,$x]of vu(tX,ct))for(let[Ss,zu]of QG($x))if(!(o&&!o.reduce(Ss,zu))){tk.push(JG++),ot.push(i.reduceIndex(Ss,at,zu)),ct&&Me.push(eX),j&&Ti.push(he===j?Im:j[(Ss.length>0?Ss:$x)[0]]),Qt&&vs.push(he===Qt?Im:Qt[(Ss.length>0?Ss:$x)[0]]),gt&&HG.push(he===gt?Im:gt[(Ss.length>0?Ss:$x)[0]]),Q8&&(Q8.push(zu.x1),ZG.push(zu.x2)),J8&&(J8.push(zu.y1),KG.push(zu.y2));for(let rX of c)rX.reduce(Ss,zu);s&&s.reduce(Ss)}pe.push(tk)}return YN(pe,s,a),{data:ot,facets:pe}}),...!_a(c,"x")&&(u?{x1:u,x2:d,x:Tp(u,d)}:{x:w,x1:M,x2:O}),...!_a(c,"y")&&(p?{y1:p,y2:g,y:Tp(p,g)}:{y:I,y1:R,y2:S}),..._&&{[x]:_},...Object.fromEntries(c.map(({name:at,output:q})=>[at,q]))}}function F3({cumulative:e,domain:t,thresholds:r,interval:n,...i},o){return[i,{cumulative:e,domain:t,thresholds:r,interval:n,...o}]}function bT(e,{cumulative:t,domain:r,thresholds:n,interval:i},o){return e={...Mo(e)},e.domain===void 0&&(e.domain=r),e.cumulative===void 0&&(e.cumulative=t),e.thresholds===void 0&&(e.thresholds=n),e.interval===void 0&&(e.interval=i),e.value===void 0&&(e.value=o),e.thresholds=L3(e.thresholds,e.interval),e}function dlt(e){let{x:t,y:r}=e;return t=bT(t,e),r=bT(r,e),[t.value,r.value]=gr(t.value,r.value),{x:t,y:r}}function Gq(e){if(e==null)return;let{value:t,cumulative:r,domain:n=Be,thresholds:i}=e,o=s=>{let a=Tt(s,t),c;if(lr(a)||mlt(i)){a=fe(a,EN,Float64Array);let[u,f]=typeof n=="function"?n(a):n,d=typeof i=="function"&&!_u(i)?i(a,u,f):i;typeof d=="number"&&(d=W0(u,f,d)),_u(d)&&(n===Be&&(u=d.floor(u),f=d.offset(d.floor(f))),d=d.range(u,d.offset(f))),c=d}else{a=Cr(a);let[u,f]=typeof n=="function"?n(a):n,d=typeof i=="function"&&!_u(i)?i(a,u,f):i;if(typeof d=="number")if(n===Be){let h=Fc(u,f,d);if(isFinite(h))if(h>0){let p=Math.round(u/h),y=Math.round(f/h);p*h<=u||--p,y*h>f||++y;let g=y-p+1;d=new Float64Array(g);for(let m=0;m<g;++m)d[m]=(p+m)*h}else if(h<0){h=-h;let p=Math.round(u*h),y=Math.round(f*h);p/h<=u||--p,y/h>f||++y;let g=y-p+1;d=new Float64Array(g);for(let m=0;m<g;++m)d[m]=(p+m)/h}else d=[u];else d=[u]}else d=yn(u,f,d);else _u(d)&&(n===Be&&(u=d.floor(u),f=d.offset(d.floor(f))),d=d.range(u,d.offset(f)));c=d}let l=[];if(c.length===1)l.push([c[0],c[0]]);else for(let u=1;u<c.length;++u)l.push([c[u-1],c[u]]);return l.bin=(r<0?blt:r>0?glt:R3)(l,c,a),l};return o.label=vn(t),o}function L3(e,t,r=Xq){if(e===void 0)return t===void 0?r:ba(t);if(typeof e=="string"){switch(e.toLowerCase()){case"freedman-diaconis":return uv;case"scott":return zg;case"sturges":return Ql;case"auto":return Xq}return _b(e)}return e}function hlt(e,t){return jN(e,t,Zq)}function Zq(e,t,r){return TI(e,t,r,Kq)}function Kq(e,t,r){return AI(e,t,r,Qq)}function Qq(e,t){return Dp(e,t,plt)}function plt(e){switch(`${e}`.toLowerCase()){case"x":return xlt;case"x1":return wlt;case"x2":return vlt;case"y":return _lt;case"y1":return Slt;case"y2":return Ilt}throw new Error(`invalid bin reduce: ${e}`)}function Xq(e,t,r){return Math.min(200,zg(e,t,r))}function mlt(e){return dV(e)||oi(e)&&lr(e)}function ylt(e,t,r){let n=e?.(r),i=t?.(r);return n&&i?function*(o){let s=n.bin(o);for(let[a,[c,l]]of n.entries()){let u=i.bin(s[a]);for(let[f,[d,h]]of i.entries())yield[u[f],{data:r,x1:c,y1:d,x2:l,y2:h}]}}:n?function*(o){let s=n.bin(o);for(let[a,[c,l]]of n.entries())yield[s[a],{data:r,x1:c,x2:l}]}:function*(o){let s=i.bin(o);for(let[a,[c,l]]of i.entries())yield[s[a],{data:r,y1:c,y2:l}]}}function R3(e,t,r){return t=Cr(t),n=>{let i=e.map(()=>[]);for(let o of n)i[Nc(t,r[o])-1]?.push(o);return i}}function glt(e,t,r){let n=R3(e,t,r);return i=>{let o=n(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 blt(e,t,r){let n=R3(e,t,r);return i=>{let o=n(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 Jq(e,t){let r=(+e+ +t)/2;return e instanceof Date?new Date(r):r}var xlt={reduceIndex(e,t,{x1:r,x2:n}){return Jq(r,n)}},_lt={reduceIndex(e,t,{y1:r,y2:n}){return Jq(r,n)}},wlt={reduceIndex(e,t,{x1:r}){return r}},vlt={reduceIndex(e,t,{x2:r}){return r}},Slt={reduceIndex(e,t,{y1:r}){return r}},Ilt={reduceIndex(e,t,{y2:r}){return r}};function Hp(e={}){return BN(e)?e:{...e,x:K}}function Zp(e={}){return ON(e)?e:{...e,y:K}}function tY(e,t){if(t.length===1)return{data:e,facets:t};let r=e.length,n=new Uint8Array(r),i=0;for(let a of t)for(let c of a)n[c]&&++i,n[c]=1;if(i===0)return{data:e,facets:t};e=xu(e);let o=e[TN]=new Uint32Array(r+i);t=t.map(a=>xu(a,Uint32Array));let s=r;n.fill(0);for(let a of t)for(let c=0,l=a.length;c<l;++c){let u=a[c];n[u]?(a[c]=s,e[s]=e[u],o[s]=u,++s):o[u]=u,n[u]=1}return{data:e,facets:t}}function k3(e={},t={}){arguments.length===1&&([e,t]=Jp(e));let{y1:r,y:n=r,x:i,...o}=t,[s,a,c,l]=tm(n,i,"y","x",e,o);return{...s,y1:r,y:a,x1:c,x2:l,x:Tp(c,l)}}function nY(e={},t={}){arguments.length===1&&([e,t]=Jp(e));let{y1:r,y:n=r,x:i}=t,[o,s,a]=tm(n,i,"y","x",e,t);return{...o,y1:r,y:s,x:a}}function iY(e={},t={}){arguments.length===1&&([e,t]=Jp(e));let{y1:r,y:n=r,x:i}=t,[o,s,,a]=tm(n,i,"y","x",e,t);return{...o,y1:r,y:s,x:a}}function C3(e={},t={}){arguments.length===1&&([e,t]=Jp(e));let{x1:r,x:n=r,y:i,...o}=t,[s,a,c,l]=tm(n,i,"x","y",e,o);return{...s,x1:r,x:a,y1:c,y2:l,y:Tp(c,l)}}function oY(e={},t={}){arguments.length===1&&([e,t]=Jp(e));let{x1:r,x:n=r,y:i}=t,[o,s,a]=tm(n,i,"x","y",e,t);return{...o,x1:r,x:s,y:a}}function sY(e={},t={}){arguments.length===1&&([e,t]=Jp(e));let{x1:r,x:n=r,y:i}=t,[o,s,,a]=tm(n,i,"x","y",e,t);return{...o,x1:r,x:s,y:a}}function Kp({x:e,x1:t,x2:r,...n}={}){return n=xs(n,"y"),t===void 0&&r===void 0?k3({x:e,...n}):([t,r]=NN(e,t,r),{...n,x1:t,x2:r})}function Qp({y:e,y1:t,y2:r,...n}={}){return n=xs(n,"x"),t===void 0&&r===void 0?C3({y:e,...n}):([t,r]=NN(e,t,r),{...n,y1:t,y2:r})}function Jp(e){let{offset:t,order:r,reverse:n,...i}=e;return[{offset:t,order:r,reverse:n},i]}var Tlt={length:!0};function tm(e,t=wb,r,n,{offset:i,order:o,reverse:s},a){if(t===null)throw new Error(`stack requires ${n}`);let c=Rn(a),[l,u]=wn(e),[f,d]=tn(t),[h,p]=tn(t);return f.hint=h.hint=Tlt,i=Alt(i),o=Dlt(o,i,n),[en(a,(y,g,m)=>{({data:y,facets:g}=tY(y,g));let b=e==null?void 0:u(ad(Tt(y,e),m?.[r])),x=Tt(y,t,Float64Array),_=Tt(y,c),v=o&&o(y,b,x,_),w=y.length,I=d(new Float64Array(w)),D=p(new Float64Array(w)),A=[];for(let B of g){let M=b?Array.from(Gr(B,O=>b[O]).values()):[B];if(v)for(let O of M)O.sort(v);for(let O of M){let R=0,S=0;s&&O.reverse();for(let T of O){let E=x[T];E<0?R=D[T]=(I[T]=R)+E:E>0?S=D[T]=(I[T]=S)+E:D[T]=I[T]=S}}A.push(M)}return i&&i(A,I,D,_),{data:y,facets:g}}),l,f,h]}function Alt(e){if(e!=null){if(typeof e=="function")return e;switch(`${e}`.toLowerCase()){case"expand":case"normalize":return Mlt;case"center":case"silhouette":return Elt;case"wiggle":return cY}throw new Error(`unknown offset: ${e}`)}}function aY(e,t){let r=0,n=0;for(let i of e){let o=t[i];o<r&&(r=o),o>n&&(n=o)}return[r,n]}function Mlt(e,t,r){for(let n of e)for(let i of n){let[o,s]=aY(i,r);for(let a of i){let c=1/(s-o||1);t[a]=c*(t[a]-o),r[a]=c*(r[a]-o)}}}function Elt(e,t,r){for(let n of e){for(let i of n){let[o,s]=aY(i,r);for(let a of i){let c=(s+o)/2;t[a]-=c,r[a]-=c}}lY(n,t,r)}uY(e,t,r)}function cY(e,t,r,n){for(let i of e){let o=new Gn,s=0;for(let a of i){let c=-1,l=a.map(h=>Math.abs(r[h]-t[h])),u=a.map(h=>{c=n?n[h]:++c;let p=r[h]-t[h],y=o.has(c)?p-o.get(c):0;return o.set(c,p),y}),f=[0,...ov(u)];for(let h of a)t[h]+=s,r[h]+=s;let d=gn(l);d&&(s-=gn(l,(h,p)=>(u[p]/2+f[p])*h)/d)}lY(i,t,r)}uY(e,t,r)}function lY(e,t,r){let n=Oe(e,i=>Oe(i,o=>t[o]));for(let i of e)for(let o of i)t[o]-=n,r[o]-=n}function uY(e,t,r){let n=e.length;if(n===1)return;let i=e.map(a=>a.flat()),o=i.map(a=>(Oe(a,c=>t[c])+de(a,c=>r[c]))/2),s=Oe(o);for(let a=0;a<n;a++){let c=s-o[a];for(let l of i[a])t[l]+=c,r[l]+=c}}function Dlt(e,t,r){if(e===void 0&&t===cY)return eY(Kr);if(e!=null){if(typeof e=="string"){let n=e.startsWith("-"),i=n?id:Kr;switch((n?e.slice(1):e).toLowerCase()){case"value":case r:return Blt(i);case"z":return Olt(i);case"sum":return Nlt(i);case"appearance":return Flt(i);case"inside-out":return eY(i)}return rY(AN(e))}if(typeof e=="function")return(e.length===1?rY:Llt)(e);if(Array.isArray(e))return Rlt(e);throw new Error(`invalid order: ${e}`)}}function Blt(e){return(t,r,n)=>(i,o)=>e(n[i],n[o])}function Olt(e){return(t,r,n,i)=>(o,s)=>e(i[o],i[s])}function Nlt(e){return xT(e,(t,r,n,i)=>Mh(ii(t),o=>gn(o,s=>n[s]),o=>i[o]))}function Flt(e){return xT(e,(t,r,n,i)=>Mh(ii(t),o=>r[Of(o,s=>n[s])],o=>i[o]))}function eY(e){return xT(e,(t,r,n,i)=>{let o=ii(t),s=Mh(o,f=>r[Of(f,d=>n[d])],f=>i[f]),a=ds(o,f=>gn(f,d=>n[d]),f=>i[f]),c=[],l=[],u=0;for(let f of s)u<0?(u+=a.get(f),c.push(f)):(u-=a.get(f),l.push(f));return l.reverse().concat(c)})}function rY(e){return t=>{let r=Tt(t,e);return(n,i)=>Kr(r[n],r[i])}}function Llt(e){return t=>(r,n)=>e(t[r],t[n])}function Rlt(e){return xT(Kr,()=>e)}function xT(e,t){return(r,n,i,o)=>{if(!o)throw new Error("missing channel: z");let s=new Gn(t(r,n,i,o).map((a,c)=>[a,c]));return(a,c)=>e(s.get(o[a]),s.get(o[c]))}}var klt={ariaLabel:"area",strokeWidth:1,strokeLinecap:"round",strokeLinejoin:"round",strokeMiterlimit:1},xd=class extends Ft{constructor(t,r={}){let{x1:n,y1:i,x2:o,y2:s,z:a,curve:c,tension:l}=r;super(t,{x1:{value:n,scale:"x"},y1:{value:i,scale:"y"},x2:{value:o,scale:"x",optional:!0},y2:{value:s,scale:"y",optional:!0},z:{value:Rn(r),optional:!0}},r,klt),this.z=a,this.curve=jb(c,l)}filter(t){return t}render(t,r,n,i,o){let{x1:s,y1:a,x2:c=s,y2:l=a}=n;return pt("svg:g",o).call(Kt,this,i,o).call(Pt,this,r,0,0).call(u=>u.selectAll().data(FI(t,[s,a,c,l],this,n)).enter().append("path").call(Gt,this).call(fd,this,n).attr("d",dp().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 qb(e,t){return t===void 0?dl(e,{x:el,y:bu}):new xd(e,t)}function Ou(e,t){let{y:r=nr,...n}=Xp(t);return new xd(e,Kp(Hp({...n,y1:r,y2:void 0})))}function dl(e,t){let{x:r=nr,...n}=Gp(t);return new xd(e,Qp(Zp({...n,x1:r,x2:void 0})))}var Clt={ariaLabel:"link",fill:"none",stroke:"currentColor",strokeMiterlimit:1},Yb=class extends Ft{constructor(t,r={}){let{x1:n,y1:i,x2:o,y2:s,curve:a,tension:c}=r;super(t,{x1:{value:n,scale:"x"},y1:{value:i,scale:"y"},x2:{value:o,scale:"x",optional:!0},y2:{value:s,scale:"y",optional:!0}},r,Clt),this.curve=gT(a,c),_s(this,r)}project(t,r,n){this.curve!==Bu&&super.project(t,r,n)}render(t,r,n,i,o){let{x1:s,y1:a,x2:c=s,y2:l=a}=n,{curve:u}=this;return pt("svg:g",o).call(Kt,this,i,o).call(Pt,this,r).call(f=>f.selectAll().data(t).enter().append("path").call(Gt,this).attr("d",u===Bu&&o.projection?Ult(o.projection,s,a,c,l):d=>{let h=Qn(),p=u(h);return p.lineStart(),p.point(s[d],a[d]),p.point(c[d],l[d]),p.lineEnd(),h}).call(ye,this,n).call(ul,this,n,o)).node()}};function Ult(e,t,r,n,i){let o=xn(e);return t=Cr(t),r=Cr(r),n=Cr(n),i=Cr(i),s=>o({type:"LineString",coordinates:[[t[s],r[s]],[n[s],i[s]]]})}function _T(e,{x:t,x1:r,x2:n,y:i,y1:o,y2:s,...a}={}){return[r,n]=Wb(t,r,n),[o,s]=Wb(i,o,s),new Yb(e,{...a,x1:r,x2:n,y1:o,y2:s})}function Wb(e,t,r){if(e===void 0){if(t===void 0){if(r!==void 0)return[r]}else if(r===void 0)return[t]}else{if(t===void 0)return r===void 0?[e]:[e,r];if(r===void 0)return[e,t]}return[t,r]}var Plt={ariaLabel:"arrow",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeMiterlimit:1,strokeWidth:1.5},Gb=class extends Ft{constructor(t,r={}){let{x1:n,y1:i,x2:o,y2:s,bend:a=0,headAngle:c=60,headLength:l=8,inset:u=0,insetStart:f=u,insetEnd:d=u,sweep:h}=r;super(t,{x1:{value:n,scale:"x"},y1:{value:i,scale:"y"},x2:{value:o,scale:"x",optional:!0},y2:{value:s,scale:"y",optional:!0}},r,Plt),this.bend=a===!0?22.5:Math.max(-90,Math.min(90,a)),this.headAngle=+c,this.headLength=+l,this.insetStart=+f,this.insetEnd=+d,this.sweep=$lt(h)}render(t,r,n,i,o){let{x1:s,y1:a,x2:c=s,y2:l=a,SW:u}=n,{strokeWidth:f,bend:d,headAngle:h,headLength:p,insetStart:y,insetEnd:g}=this,m=u?_=>u[_]:Qr(f===void 0?1:f),b=h*jp/2,x=p/1.5;return pt("svg:g",o).call(Kt,this,i,o).call(Pt,this,r).call(_=>_.selectAll().data(t).enter().append("path").call(Gt,this).attr("d",v=>{let w=s[v],I=a[v],D=c[v],A=l[v],B=Math.hypot(D-w,A-I);if(B<=y+g)return null;let M=Math.atan2(A-I,D-w),O=Math.min(x*m(v),B/3),R=this.sweep(w,I,D,A)*d*jp,S=Math.hypot(B/Math.tan(R),B)/2;if(y||g)if(S<1e5){let nt=Math.sign(R),[st,ut]=zlt([w,I],[D,A],S,nt);if(y&&([w,I]=fY([st,ut,S],[w,I,y],-nt*Math.sign(y))),g){let[X,at]=fY([st,ut,S],[D,A,g],nt*Math.sign(g));M+=Math.atan2(at-ut,X-st)-Math.atan2(A-ut,D-st),D=X,A=at}}else{let nt=D-w,st=A-I,ut=Math.hypot(nt,st);y&&(w+=nt/ut*y,I+=st/ut*y),g&&(D-=nt/ut*g,A-=st/ut*g)}let T=M+R,E=T+b,C=T-b,U=D-O*Math.cos(E),k=A-O*Math.sin(E),$=D-O*Math.cos(C),z=A-O*Math.sin(C),V=S<1e5?`A${S},${S} 0,0,${R>0?1:0} `:"L",Q=O?`M${U},${k}L${D},${A}L${$},${z}`:"";return`M${w},${I}${V}${D},${A}${Q}`}).call(ye,this,n)).node()}};function $lt(e=1){if(typeof e=="number")return Qr(Math.sign(e));if(typeof e=="function")return(t,r,n,i)=>Math.sign(e(t,r,n,i));switch(Ur(e,"sweep",["+x","-x","+y","-y"])){case"+x":return(t,r,n)=>ie(t,n);case"-x":return(t,r,n)=>Wn(t,n);case"+y":return(t,r,n,i)=>ie(r,i);case"-y":return(t,r,n,i)=>Wn(r,i)}}function zlt([e,t],[r,n],i,o){let s=r-e,a=n-t,c=Math.hypot(s,a),l=o*Math.sqrt(i*i-c*c/4)/c;return[(e+r)/2-a*l,(t+n)/2+s*l]}function fY([e,t,r],[n,i,o],s){let a=n-e,c=i-t,l=Math.hypot(a,c),u=(a*a+c*c-o*o+r*r)/(2*l),f=s*Math.sqrt(r*r-u*u);return[e+(a*u+c*f)/l,t+(c*u-a*f)/l]}function dY(e,{x:t,x1:r,x2:n,y:i,y1:o,y2:s,...a}={}){return[r,n]=Wb(t,r,n),[o,s]=Wb(i,o,s),new Gb(e,{...a,x1:r,x2:n,y1:o,y2:s})}var em=class extends Ft{constructor(t,r,n={},i){super(t,r,n,i);let{inset:o=0,insetTop:s=o,insetRight:a=o,insetBottom:c=o,insetLeft:l=o,rx:u,ry:f}=n;this.insetTop=Wt(s),this.insetRight=Wt(a),this.insetBottom=Wt(c),this.insetLeft=Wt(l),this.rx=Ne(u,"auto"),this.ry=Ne(f,"auto")}render(t,r,n,i,o){let{rx:s,ry:a}=this;return pt("svg:g",o).call(Kt,this,i,o).call(this._transform,this,r).call(c=>c.selectAll().data(t).enter().append("rect").call(Gt,this).attr("x",this._x(r,n,i)).attr("width",this._width(r,n,i)).attr("y",this._y(r,n,i)).attr("height",this._height(r,n,i)).call(yt,"rx",s).call(yt,"ry",a).call(ye,this,n)).node()}_x(t,{x:r},{marginLeft:n}){let{insetLeft:i}=this;return r?o=>r[o]+i:n+i}_y(t,{y:r},{marginTop:n}){let{insetTop:i}=this;return r?o=>r[o]+i:n+i}_width({x:t},{x:r},{marginRight:n,marginLeft:i,width:o}){let{insetLeft:s,insetRight:a}=this,c=r&&t?t.bandwidth():o-n-i;return Math.max(0,c-s-a)}_height({y:t},{y:r},{marginTop:n,marginBottom:i,height:o}){let{insetTop:s,insetBottom:a}=this,c=r&&t?t.bandwidth():o-n-i;return Math.max(0,c-s-a)}},hY={ariaLabel:"bar"},Xb=class extends em{constructor(t,r={}){let{x1:n,x2:i,y:o}=r;super(t,{x1:{value:n,scale:"x"},x2:{value:i,scale:"x"},y:{value:o,scale:"y",type:"band",optional:!0}},r,hY)}_transform(t,r,{x:n}){t.call(Pt,r,{x:n},0,0)}_x({x:t},{x1:r,x2:n},{marginLeft:i}){let{insetLeft:o}=this;return si(t)?i+o:s=>Math.min(r[s],n[s])+o}_width({x:t},{x1:r,x2:n},{marginRight:i,marginLeft:o,width:s}){let{insetLeft:a,insetRight:c}=this;return si(t)?s-i-o-a-c:l=>Math.max(0,Math.abs(n[l]-r[l])-a-c)}},Hb=class extends em{constructor(t,r={}){let{x:n,y1:i,y2:o}=r;super(t,{y1:{value:i,scale:"y"},y2:{value:o,scale:"y"},x:{value:n,scale:"x",type:"band",optional:!0}},r,hY)}_transform(t,r,{y:n}){t.call(Pt,r,{y:n},0,0)}_y({y:t},{y1:r,y2:n},{marginTop:i}){let{insetTop:o}=this;return si(t)?i+o:s=>Math.min(r[s],n[s])+o}_height({y:t},{y1:r,y2:n},{marginTop:i,marginBottom:o,height:s}){let{insetTop:a,insetBottom:c}=this;return si(t)?s-i-o-a-c:l=>Math.max(0,Math.abs(n[l]-r[l])-a-c)}};function Ta(e,t={}){return Sp(t)||(t={...t,y:nr,x2:K}),new Xb(e,Kp(XI(Hp(t))))}function Aa(e,t={}){return Sp(t)||(t={...t,x:nr,y2:K}),new Hb(e,Qp(HI(Zp(t))))}var Vlt={ariaLabel:"cell"},_d=class extends em{constructor(t,{x:r,y:n,...i}={}){super(t,{x:{value:r,scale:"x",type:"band",optional:!0},y:{value:n,scale:"y",type:"band",optional:!0}},i,Vlt)}_transform(t,r){t.call(Pt,r,{},0,0)}};function Nu(e,{x:t,y:r,...n}={}){return[t,r]=gr(t,r),new _d(e,{...n,x:t,y:r})}function pY(e,{x:t=nr,fill:r,stroke:n,...i}={}){return r===void 0&&cr(n)[0]===void 0&&(r=K),new _d(e,{...i,x:t,fill:r,stroke:n})}function mY(e,{y:t=nr,fill:r,stroke:n,...i}={}){return r===void 0&&cr(n)[0]===void 0&&(r=K),new _d(e,{...i,y:t,fill:r,stroke:n})}var jlt={ariaLabel:"dot",fill:"none",stroke:"currentColor",strokeWidth:1.5};function Zb(e){return e.sort===void 0&&e.reverse===void 0?SI({channel:"-r"},e):e}var wd=class extends Ft{constructor(t,r={}){let{x:n,y:i,r:o,rotate:s,symbol:a=Qc,frameAnchor:c}=r,[l,u]=Ae(s,0),[f,d]=IV(a),[h,p]=Ae(o,f==null?3:4.5);super(t,{x:{value:n,scale:"x",optional:!0},y:{value:i,scale:"y",optional:!0},r:{value:h,scale:"r",filter:ni,optional:!0},rotate:{value:l,optional:!0},symbol:{value:f,scale:"auto",optional:!0}},Zb(r),jlt),this.r=p,this.rotate=u,this.symbol=d,this.frameAnchor=xa(c);let{channels:y}=this,{symbol:g}=y;if(g){let{fill:m,stroke:b}=y;g.hint={fill:m?m.value===g.value?"color":"currentColor":this.fill??"currentColor",stroke:b?b.value===g.value?"color":"currentColor":this.stroke??"none"}}}render(t,r,n,i,o){let{x:s,y:a}=r,{x:c,y:l,r:u,rotate:f,symbol:d}=n,{r:h,rotate:p,symbol:y}=this,[g,m]=rn(this,i),b=y===Qc,x=u?void 0:h*h*Math.PI;return hu(h)&&(t=[]),pt("svg:g",o).call(Kt,this,i,o).call(Pt,this,{x:c&&s,y:l&&a}).call(_=>_.selectAll().data(t).enter().append(b?"circle":"path").call(Gt,this).call(b?v=>{v.attr("cx",c?w=>c[w]:g).attr("cy",l?w=>l[w]:m).attr("r",u?w=>u[w]:h)}:v=>{v.attr("transform",Eu`translate(${c?w=>c[w]:g},${l?w=>l[w]:m})${f?w=>` rotate(${f[w]})`:p?` rotate(${p})`:""}`).attr("d",u&&d?w=>{let I=Qn();return d[w].draw(I,u[w]*u[w]*Math.PI),I}:u?w=>{let I=Qn();return y.draw(I,u[w]*u[w]*Math.PI),I}:d?w=>{let I=Qn();return d[w].draw(I,x),I}:(()=>{let w=Qn();return y.draw(w,x),w})())}).call(ye,this,n)).node()}};function Do(e,{x:t,y:r,...n}={}){return n.frameAnchor===void 0&&([t,r]=gr(t,r)),new wd(e,{...n,x:t,y:r})}function yY(e,{x:t=K,...r}={}){return new wd(e,KI({...r,x:t}))}function gY(e,{y:t=K,...r}={}){return new wd(e,ZI({...r,y:t}))}function bY(e,t){return Do(e,{...t,symbol:"circle"})}function xY(e,t){return Do(e,{...t,symbol:"hexagon"})}var qlt={ariaLabel:"line",fill:"none",stroke:"currentColor",strokeWidth:1.5,strokeLinecap:"round",strokeLinejoin:"round",strokeMiterlimit:1},vd=class extends Ft{constructor(t,r={}){let{x:n,y:i,z:o,curve:s,tension:a}=r;super(t,{x:{value:n,scale:"x"},y:{value:i,scale:"y"},z:{value:Rn(r),optional:!0}},r,qlt),this.z=o,this.curve=gT(s,a),_s(this,r)}filter(t){return t}project(t,r,n){this.curve!==Bu&&super.project(t,r,n)}render(t,r,n,i,o){let{x:s,y:a}=n,{curve:c}=this;return pt("svg:g",o).call(Kt,this,i,o).call(Pt,this,r).call(l=>l.selectAll().data(FI(t,[s,a],this,n)).enter().append("path").call(Gt,this).call(fd,this,n).call(Zj,this,n,o).attr("d",c===Bu&&o.projection?Ylt(o.projection,s,a):eb().curve(c).defined(u=>u>=0).x(u=>s[u]).y(u=>a[u]))).node()}};function Ylt(e,t,r){let n=xn(e);return t=Cr(t),r=Cr(r),i=>{let o=[],s=[o];for(let a of i)a===-1?(o=[],s.push(o)):o.push([t[a],r[a]]);return n({type:"MultiLineString",coordinates:s})}}function Sd(e,{x:t,y:r,...n}={}){return[t,r]=gr(t,r),new vd(e,{...n,x:t,y:r})}function Fu(e,{x:t=K,y:r=nr,...n}={}){return new vd(e,Xp({...n,x:t,y:r}))}function Lu(e,{x:t=nr,y:r=K,...n}={}){return new vd(e,Gp({...n,x:t,y:r}))}var Wlt={ariaLabel:"rect"},Id=class extends Ft{constructor(t,r={}){let{x1:n,y1:i,x2:o,y2:s,inset:a=0,insetTop:c=a,insetRight:l=a,insetBottom:u=a,insetLeft:f=a,rx:d,ry:h}=r;super(t,{x1:{value:n,scale:"x",type:n!=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}},r,Wlt),this.insetTop=Wt(c),this.insetRight=Wt(l),this.insetBottom=Wt(u),this.insetLeft=Wt(f),this.rx=Ne(d,"auto"),this.ry=Ne(h,"auto")}render(t,r,n,i,o){let{x:s,y:a}=r,{x1:c,y1:l,x2:u,y2:f}=n,{marginTop:d,marginRight:h,marginBottom:p,marginLeft:y,width:g,height:m}=i,{projection:b}=o,{insetTop:x,insetRight:_,insetBottom:v,insetLeft:w,rx:I,ry:D}=this,A=(s?.bandwidth?s.bandwidth():0)-w-_,B=(a?.bandwidth?a.bandwidth():0)-x-v;return pt("svg:g",o).call(Kt,this,i,o).call(Pt,this,{},0,0).call(M=>M.selectAll().data(t).enter().append("rect").call(Gt,this).attr("x",c&&(b||!si(s))?u?O=>Math.min(c[O],u[O])+w:O=>c[O]+w:y+w).attr("y",l&&(b||!si(a))?f?O=>Math.min(l[O],f[O])+x:O=>l[O]+x:d+x).attr("width",c&&(b||!si(s))?u?O=>Math.max(0,Math.abs(u[O]-c[O])+A):A:g-h-y-_-w).attr("height",l&&(b||!si(a))?f?O=>Math.max(0,Math.abs(l[O]-f[O])+B):B:m-d-p-x-v).call(yt,"rx",I).call(yt,"ry",D).call(ye,this,n)).node()}};function Kb(e,t){return new Id(e,b3(x3(t)))}function rm(e,t={}){return Sp(t)||(t={...t,y:nr,x2:K,interval:1}),new Id(e,Kp(x3(Hp(t))))}function nm(e,t={}){return Sp(t)||(t={...t,x:nr,y2:K,interval:1}),new Id(e,Qp(b3(Zp(t))))}function P3(e,t){t=Glt(t);let{x:r,y:n,color:i,size:o}=t,s=wT(e,r),a=wT(e,n),c=wT(e,i),l=wT(e,o),{fx:u,fy:f,x:{value:d,reduce:h,zero:p,...y},y:{value:g,reduce:m,zero:b,...x},color:{value:_,color:v,reduce:w},size:{value:I,reduce:D},mark:A}=t;if(h===void 0&&(h=m==null&&d==null&&I==null&&g!=null?"count":null),m===void 0&&(m=h==null&&g==null&&I==null&&d!=null?"count":null),D===void 0&&I==null&&w==null&&h==null&&m==null&&(d==null||ir(s))&&(g==null||ir(a))&&(D="count"),p===void 0&&(p=vT(h)?!0:void 0),b===void 0&&(b=vT(m)?!0:void 0),d==null&&g==null)throw new Error("must specify x or y");if(h!=null&&g==null)throw new Error("reducing x requires y");if(m!=null&&d==null)throw new Error("reducing y requires x");A===void 0&&(A=I!=null||D!=null?"dot":vT(h)||vT(m)||w!=null?"bar":d!=null&&g!=null?ir(s)||ir(a)||h==null&&m==null&&!Qb(s)&&!Qb(a)?"dot":"line":d!=null||g!=null?"rule":null);let B,M,O;switch(A){case"dot":O=Do,M="stroke";break;case"line":O=s&&a||h!=null||m!=null?b||m!=null||s&&Qb(s)?Lu:p||h!=null||a&&Qb(a)?Fu:Sd:s?Fu:Lu,M="stroke",wY(c)&&(B=null);break;case"area":O=!(b||m!=null)&&(p||h!=null||a&&Qb(a))?Ou:dl,M="fill",wY(c)&&(B=null);break;case"rule":O=s?Zi:Ki,M="stroke";break;case"bar":O=h!=null?ir(a)?_Y(h)&&s&&ir(s)?Nu:Ta:rm:m!=null?ir(s)?_Y(m)&&a&&ir(a)?Nu:Aa:nm:w!=null||D!=null?s&&ir(s)&&a&&ir(a)?Nu:s&&ir(s)?Aa:a&&ir(a)?Ta:Kb:s&&il(s)&&!(a&&il(a))?Ta:a&&il(a)&&!(s&&il(s))?Aa:Nu,M="fill";break;default:throw new Error(`invalid mark: ${A}`)}let R={fx:u,fy:f,x:s??void 0,y:a??void 0,[M]:c??v,z:B,r:l??void 0,tip:!0},S,T={[M]:w??void 0,r:D??void 0};if(h!=null&&m!=null)throw new Error("cannot reduce both x and y");return m!=null?(T.y=m,S=ir(s)?Su:Sa):h!=null?(T.x=h,S=ir(a)?Iu:Ia):(w!=null||D!=null)&&(s&&a?S=ir(s)&&ir(a)?Ab:ir(s)?Ia:ir(a)?Sa:fl:s?S=ir(s)?Su:Sa:a&&(S=ir(a)?Iu:Ia)),(S===fl||S===Sa)&&(R.x={value:s,...y}),(S===fl||S===Ia)&&(R.y={value:a,...x}),p===void 0&&(p=s&&!(S===fl||S===Sa)&&(O===Ta||O===Ou||O===rm||O===Ki)),b===void 0&&(b=a&&!(S===fl||S===Ia)&&(O===Aa||O===dl||O===nm||O===Zi)),{fx:u??null,fy:f??null,x:{value:d??null,reduce:h??null,zero:!!p,...y},y:{value:g??null,reduce:m??null,zero:!!b,...x},color:{value:_??null,reduce:w??null,...v!==void 0&&{color:v}},size:{value:I??null,reduce:D??null},mark:A,markImpl:vY[O],markOptions:R,transformImpl:vY[S],transformOptions:T,colorMode:M}}function SY(e,t){let r=P3(e,t),{fx:n,fy:i,x:{zero:o},y:{zero:s},markOptions:a,transformOptions:c,colorMode:l}=r,u=U3[r.markImpl],f=U3[r.transformImpl],d=n!=null||i!=null?Wp({strokeOpacity:.1}):null,h=[o?Zi([0]):null,s?Ki([0]):null],p=u(e,f?f(c,a):a);return l==="stroke"?Pr(d,h,p):Pr(d,p,h)}function Qb(e){let t,r;for(let n of e){if(n==null)continue;if(t===void 0){t=n;continue}let i=Math.sign(ie(t,n));if(i){if(r!==void 0&&i!==r)return!1;t=n,r=i}}return!0}function Glt({x:e,y:t,color:r,size:n,fx:i,fy:o,mark:s}={}){return Xi(e)||(e=im(e)),Xi(t)||(t=im(t)),Xi(r)||(r=wu(r)?{color:r}:im(r)),Xi(n)||(n=im(n)),Xi(i)&&({value:i}=im(i)),Xi(o)&&({value:o}=im(o)),s!=null&&(s=`${s}`.toLowerCase()),{x:e,y:t,color:r,size:n,fx:i,fy:o,mark:s}}function wT(e,t){let r=Tt(e,t.value);return r&&(r.label=vn(t.value)),r}function im(e){return Xlt(e)?{reduce:e}:{value:e}}function vT(e){return/^(?:distinct|count|sum|proportion)$/i.test(e)}function _Y(e){return/^(?:first|last|mode)$/i.test(e)}function Xlt(e){if(e==null)return!1;if(typeof e.reduceIndex=="function"||typeof e.reduce=="function"&&Jr(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 wY(e){return e?new Xn(e).size>e.length>>1:!1}var U3={dot:Do,line:Sd,lineX:Fu,lineY:Lu,areaX:Ou,areaY:dl,ruleX:Zi,ruleY:Ki,barX:Ta,barY:Aa,rect:Kb,rectX:rm,rectY:nm,cell:Nu,bin:fl,binX:Sa,binY:Ia,group:Ab,groupX:Su,groupY:Iu},vY=Object.fromEntries(Object.entries(U3).map(([e,t])=>[t,e]));function om(e,t={}){let{x:r,x1:n,x2:i}=t;r===void 0&&n===void 0&&i===void 0&&(t={...t,x:r=K});let o={};return r!=null&&(o.x=e),n!=null&&(o.x1=e),i!=null&&(o.x2=e),Ii(o,t)}function sm(e,t={}){let{y:r,y1:n,y2:i}=t;r===void 0&&n===void 0&&i===void 0&&(t={...t,y:r=K});let o={};return r!=null&&(o.y=e),n!=null&&(o.y1=e),i!=null&&(o.y2=e),Ii(o,t)}function Ii(e={},t={}){let r=Rn(t),n=Object.entries(e).map(([i,o])=>{let s=bI(i,t);if(s==null)throw new Error(`missing channel: ${i}`);let[a,c]=tn(s);return{key:i,input:s,output:a,setOutput:c,map:Hlt(o)}});return{...en(t,(i,o)=>{let s=Tt(i,r),a=n.map(({input:l})=>Tt(i,l)),c=n.map(({setOutput:l})=>l(new Array(i.length)));for(let l of o)for(let u of s?Gr(l,f=>s[f]).values():[l])n.forEach(({map:f},d)=>f.mapIndex(u,a[d],c[d]));return{data:i,facets:o}}),...Object.fromEntries(n.map(({key:i,output:o})=>[i,o]))}}function Hlt(e){if(e==null)throw new Error("missing map");if(typeof e.mapIndex=="function")return e;if(typeof e.map=="function"&&Jr(e))return Zlt(e);if(typeof e=="function")return $3(Ip(e));switch(`${e}`.toLowerCase()){case"cumsum":return Qlt;case"rank":return $3((t,r)=>Vg(t,n=>r[n]));case"quantile":return $3((t,r)=>Klt(t,n=>r[n]))}throw new Error(`invalid map: ${e}`)}function Zlt(e){return console.warn("deprecated map interface; implement mapIndex instead."),{mapIndex:e.map.bind(e)}}function Klt(e,t){let r=Xs(e,t)-1;return Vg(e,t).map(n=>n/r)}function $3(e){return{mapIndex(t,r,n){let i=e(t,r);if(i.length!==t.length)throw new Error("map function returned a mismatched length");for(let o=0,s=t.length;o<s;++o)n[t[o]]=i[o]}}}var Qlt={mapIndex(e,t,r){let n=0;for(let i of e)r[i]=n+=t[i]}};function IY(e={},t){return arguments.length===1&&(t=e),om(am(e),t)}function TY(e={},t){return arguments.length===1&&(t=e),sm(am(e),t)}function am(e={}){typeof e=="number"&&(e={k:e});let{k:t,reduce:r,shift:n,anchor:i,strict:o}=e;if(i===void 0&&n!==void 0&&(i=tut(n),kn(`Warning: the shift option is deprecated; please use anchor "${i}" instead.`)),!((t=Math.floor(t))>0))throw new Error(`invalid k: ${t}`);return eut(r)(t,Jlt(i,t),o)}function Jlt(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 tut(e){switch(`${e}`.toLowerCase()){case"centered":return"middle";case"leading":return"start";case"trailing":return"end"}throw new Error(`invalid shift: ${e}`)}function eut(e="mean"){if(typeof e=="string"){if(/^p\d{2}$/i.test(e))return ST(vp(e));switch(e.toLowerCase()){case"deviation":return ST(go);case"max":return IT((t,r)=>de(t,n=>r[n]));case"mean":return rut;case"median":return ST(hs);case"min":return IT((t,r)=>Oe(t,n=>r[n]));case"mode":return IT((t,r)=>Oh(t,n=>r[n]));case"sum":return AY;case"variance":return ST(Kl);case"difference":return out;case"ratio":return sut;case"first":return aut;case"last":return cut}}if(typeof e!="function")throw new Error(`invalid reduce: ${e}`);return IT(Ip(e))}function ST(e){return(t,r,n)=>n?{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+r]]=c===0?e(rl(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=-r;c<0;++c)s[i[c+r]]=e(rl(i,0,c+t),a);for(let c=0,l=i.length-r;c<l;++c)s[i[c+r]]=e(rl(i,c,c+t),a)}}}function IT(e){return(t,r,n)=>n?{mapIndex(i,o,s){let a=0;for(let c=0;c<t-1;++c)a+=wr(o[i[c]]);for(let c=0,l=i.length-t+1;c<l;++c)a+=wr(o[i[c+t-1]]),a===t&&(s[i[c+r]]=e(rl(i,c,c+t),o)),a-=wr(o[i[c]])}}:{mapIndex(i,o,s){for(let a=-r;a<0;++a)s[i[a+r]]=e(rl(i,0,a+t),o);for(let a=0,c=i.length-r;a<c;++a)s[i[a+r]]=e(rl(i,a,a+t),o)}}}function AY(e,t,r){return r?{mapIndex(n,i,o){let s=0,a=0;for(let c=0;c<e-1;++c){let l=i[n[c]];l===null||isNaN(l)?++s:a+=+l}for(let c=0,l=n.length-e+1;c<l;++c){let u=i[n[c]],f=i[n[c+e-1]];f===null||isNaN(f)?++s:a+=+f,o[n[c+t]]=s===0?a:NaN,u===null||isNaN(u)?--s:a-=+u}}}:{mapIndex(n,i,o){let s=0,a=n.length;for(let c=0,l=Math.min(a,e-t-1);c<l;++c)s+=+i[n[c]]||0;for(let c=-t,l=a-t;c<l;++c)s+=+i[n[c+e-1]]||0,o[n[c+t]]=s,s-=+i[n[c]]||0}}}function rut(e,t,r){if(r){let n=AY(e,t,r);return{mapIndex(i,o,s){n.mapIndex(i,o,s);for(let a=0,c=i.length-e+1;a<c;++a)s[i[a+t]]/=e}}}else return{mapIndex(n,i,o){let s=0,a=0,c=n.length;for(let l=0,u=Math.min(c,e-t-1);l<u;++l){let f=i[n[l]];f!==null&&!isNaN(f=+f)&&(s+=f,++a)}for(let l=-t,u=c-t;l<u;++l){let f=i[n[l+e-1]],d=i[n[l]];f!==null&&!isNaN(f=+f)&&(s+=f,++a),o[n[l+t]]=s/a,d!==null&&!isNaN(d=+d)&&(s-=d,--a)}}}}function nut(e,t,r,n){for(let i=r+n;r<i;++r){let o=e[t[r]];if(wr(o))return o}}function iut(e,t,r,n){for(let i=r+n-1;i>=r;--i){let o=e[t[i]];if(wr(o))return o}}function MY(e,t,r,n){for(let i=r+n;r<i;++r){let o=e[t[r]];if(o!==null&&!isNaN(o=+o))return o}}function EY(e,t,r,n){for(let i=r+n-1;i>=r;--i){let o=e[t[i]];if(o!==null&&!isNaN(o=+o))return o}}function out(e,t,r){return r?{mapIndex(n,i,o){for(let s=0,a=n.length-e;s<a;++s){let c=i[n[s]],l=i[n[s+e-1]];o[n[s+t]]=c===null||l===null?NaN:l-c}}}:{mapIndex(n,i,o){for(let s=-t,a=n.length-e+t+1;s<a;++s)o[n[s+t]]=EY(i,n,s,e)-MY(i,n,s,e)}}}function sut(e,t,r){return r?{mapIndex(n,i,o){for(let s=0,a=n.length-e;s<a;++s){let c=i[n[s]],l=i[n[s+e-1]];o[n[s+t]]=c===null||l===null?NaN:l/c}}}:{mapIndex(n,i,o){for(let s=-t,a=n.length-e+t+1;s<a;++s)o[n[s+t]]=EY(i,n,s,e)/MY(i,n,s,e)}}}function aut(e,t,r){return r?{mapIndex(n,i,o){for(let s=0,a=n.length-e;s<a;++s)o[n[s+t]]=i[n[s]]}}:{mapIndex(n,i,o){for(let s=-t,a=n.length-e+t+1;s<a;++s)o[n[s+t]]=nut(i,n,s,e)}}}function cut(e,t,r){return r?{mapIndex(n,i,o){for(let s=0,a=n.length-e;s<a;++s)o[n[s+t]]=i[n[s+e-1]]}}:{mapIndex(n,i,o){for(let s=-t,a=n.length-e+t+1;s<a;++s)o[n[s+t]]=iut(i,n,s,e)}}}var hl={n:20,k:2,color:"currentColor",opacity:.2,strict:!0,anchor:"end"};function DY(e,{x:t=K,y:r,k:n=hl.k,color:i=hl.color,opacity:o=hl.opacity,fill:s=i,fillOpacity:a=o,stroke:c=i,strokeOpacity:l,strokeWidth:u,...f}={}){return Pr(Se(s)?null:Ou(e,Ii({x1:Ru({k:-n,...f}),x2:Ru({k:n,...f})},{x1:t,x2:t,y:r,fill:s,fillOpacity:a,...f})),Se(c)?null:Fu(e,Ii({x:Ru(f)},{x:t,y:r,stroke:c,strokeOpacity:l,strokeWidth:u,...f})))}function BY(e,{x:t,y:r=K,k:n=hl.k,color:i=hl.color,opacity:o=hl.opacity,fill:s=i,fillOpacity:a=o,stroke:c=i,strokeOpacity:l,strokeWidth:u,...f}={}){return Pr(Se(s)?null:dl(e,Ii({y1:Ru({k:-n,...f}),y2:Ru({k:n,...f})},{x:t,y1:r,y2:r,fill:s,fillOpacity:a,...f})),Se(c)?null:Lu(e,Ii({y:Ru(f)},{x:t,y:r,stroke:c,strokeOpacity:l,strokeWidth:u,...f})))}function Ru({n:e=hl.n,k:t=0,strict:r=hl.strict,anchor:n=hl.anchor}={}){return am({k:e,reduce:i=>Lc(i)+t*(go(i)||0),strict:r,anchor:n})}var lut={ariaLabel:"tick",fill:null,stroke:"currentColor"},TT=class extends Ft{constructor(t,r,n){super(t,r,n,lut),_s(this,n)}render(t,r,n,i,o){return pt("svg:g",o).call(Kt,this,i,o).call(this._transform,this,r).call(s=>s.selectAll().data(t).enter().append("line").call(Gt,this).attr("x1",this._x1(r,n,i)).attr("x2",this._x2(r,n,i)).attr("y1",this._y1(r,n,i)).attr("y2",this._y2(r,n,i)).call(ye,this,n).call(ul,this,n,o)).node()}},Jb=class extends TT{constructor(t,r={}){let{x:n,y:i,inset:o=0,insetTop:s=o,insetBottom:a=o}=r;super(t,{x:{value:n,scale:"x"},y:{value:i,scale:"y",type:"band",optional:!0}},r),this.insetTop=Wt(s),this.insetBottom=Wt(a)}_transform(t,r,{x:n}){t.call(Pt,r,{x:n},ur,0)}_x1(t,{x:r}){return n=>r[n]}_x2(t,{x:r}){return n=>r[n]}_y1({y:t},{y:r},{marginTop:n}){let{insetTop:i}=this;return r&&t?o=>r[o]+i:n+i}_y2({y:t},{y:r},{height:n,marginBottom:i}){let{insetBottom:o}=this;return r&&t?s=>r[s]+t.bandwidth()-o:n-i-o}},tx=class extends TT{constructor(t,r={}){let{x:n,y:i,inset:o=0,insetRight:s=o,insetLeft:a=o}=r;super(t,{y:{value:i,scale:"y"},x:{value:n,scale:"x",type:"band",optional:!0}},r),this.insetRight=Wt(s),this.insetLeft=Wt(a)}_transform(t,r,{y:n}){t.call(Pt,r,{y:n},0,ur)}_x1({x:t},{x:r},{marginLeft:n}){let{insetLeft:i}=this;return r&&t?o=>r[o]+i:n+i}_x2({x:t},{x:r},{width:n,marginRight:i}){let{insetRight:o}=this;return r&&t?s=>r[s]+t.bandwidth()-o:n-i-o}_y1(t,{y:r}){return n=>r[n]}_y2(t,{y:r}){return n=>r[n]}};function AT(e,{x:t=K,...r}={}){return new Jb(e,{...r,x:t})}function MT(e,{y:t=K,...r}={}){return new tx(e,{...r,y:t})}function OY(e,{x:t=K,y:r=null,fill:n="#ccc",fillOpacity:i,stroke:o="currentColor",strokeOpacity:s,strokeWidth:a=2,sort:c,...l}={}){let u=r!=null?Iu:Tb;return Pr(Ki(e,u({x1:z3,x2:V3},{x:t,y:r,stroke:o,strokeOpacity:s,...l})),Ta(e,u({x1:"p25",x2:"p75"},{x:t,y:r,fill:n,fillOpacity:i,...l})),AT(e,u({x:"p50"},{x:t,y:r,stroke:o,strokeOpacity:s,strokeWidth:a,sort:c,...l})),Do(e,Ii({x:FY},{x:t,y:r,z:r,stroke:o,strokeOpacity:s,...l})))}function NY(e,{y:t=K,x:r=null,fill:n="#ccc",fillOpacity:i,stroke:o="currentColor",strokeOpacity:s,strokeWidth:a=2,sort:c,...l}={}){let u=r!=null?Su:Tb;return Pr(Zi(e,u({y1:z3,y2:V3},{x:r,y:t,stroke:o,strokeOpacity:s,...l})),Aa(e,u({y1:"p25",y2:"p75"},{x:r,y:t,fill:n,fillOpacity:i,...l})),MT(e,u({y:"p50"},{x:r,y:t,stroke:o,strokeOpacity:s,strokeWidth:a,sort:c,...l})),Do(e,Ii({y:FY},{x:r,y:t,z:r,stroke:o,strokeOpacity:s,...l})))}function FY(e){let t=z3(e),r=V3(e);return e.map(n=>n<t||n>r?n:NaN)}function z3(e){let t=LY(e)*2.5-RY(e)*1.5;return Oe(e,r=>r>=t?r:NaN)}function V3(e){let t=RY(e)*2.5-LY(e)*1.5;return de(e,r=>r<=t?r:NaN)}function LY(e){return Hn(e,.25)}function RY(e){return Hn(e,.75)}var uut={ariaLabel:"raster",stroke:null,pixelSize:1};function cm(e,t){let r=+e;if(isNaN(r))throw new Error(`invalid ${t}: ${e}`);return r}function kY(e,t){let r=Math.floor(e);if(isNaN(r))throw new Error(`invalid ${t}: ${e}`);return r}var rx=class extends Ft{constructor(t,r,n={},i){let{width:o,height:s,x:a,y:c,x1:l=a==null?0:void 0,y1:u=c==null?0:void 0,x2:f=a==null?o:void 0,y2:d=c==null?s:void 0,pixelSize:h=i.pixelSize,blur:p=0,interpolate:y}=n;if(o!=null&&(o=kY(o,"width")),s!=null&&(s=kY(s,"height")),l!=null&&(l=cm(l,"x1")),u!=null&&(u=cm(u,"y1")),f!=null&&(f=cm(f,"x2")),d!=null&&(d=cm(d,"y2")),a==null&&(l==null||f==null))throw new Error("missing x");if(c==null&&(u==null||d==null))throw new Error("missing y");t!=null&&o!=null&&s!=null&&(a===void 0&&l!=null&&f!=null&&(a=but(l,f,o,s)),c===void 0&&u!=null&&d!=null&&(c=xut(u,d,o,s))),super(t,{x:{value:a,scale:"x",optional:!0},y:{value:c,scale:"y",optional:!0},x1:{value:l==null?null:[l],scale:"x",optional:!0,filter:null},y1:{value:u==null?null:[u],scale:"y",optional:!0,filter:null},x2:{value:f==null?null:[f],scale:"x",optional:!0,filter:null},y2:{value:d==null?null:[d],scale:"y",optional:!0,filter:null},...r},n,i),this.width=o,this.height=s,this.pixelSize=cm(h,"pixelSize"),this.blur=cm(p,"blur"),this.interpolate=a==null||c==null?null:fut(y)}},nx=class extends rx{constructor(t,r={}){let{imageRendering:n}=r;if(t==null){let{fill:i,fillOpacity:o}=r;Ae(o)[0]!==void 0&&(r=ET("fillOpacity",r)),cr(i)[0]!==void 0&&(r=ET("fill",r))}super(t,void 0,r,uut),this.imageRendering=Ne(n,"auto")}scale(t,{color:r,...n},i){return super.scale(t,n,i)}render(t,r,n,i,o){let s=r[n.channels.fill?.scale]??(T=>T),{x:a,y:c}=n,{document:l}=o,[u,f,d,h]=UY(n,i,o),p=d-u,y=h-f,{pixelSize:g,width:m=Math.round(Math.abs(p)/g),height:b=Math.round(Math.abs(y)/g)}=this,x=m*b,{fill:_,fillOpacity:v}=n,w=0;if(this.interpolate){let T=m/p,E=b/y,C=fe(a,k=>(k-u)*T,Float64Array),U=fe(c,k=>(k-f)*E,Float64Array);_&&(_=this.interpolate(t,m,b,C,U,_)),v&&(v=this.interpolate(t,m,b,C,U,v))}else this.data==null&&t&&(w=t.fi*x);let I=l.createElement("canvas");I.width=m,I.height=b;let D=I.getContext("2d"),A=D.createImageData(m,b),B=A.data,{r:M,g:O,b:R}=qr(this.fill)??{r:0,g:0,b:0},S=(this.fillOpacity??1)*255;for(let T=0;T<x;++T){let E=T<<2;if(_){let C=s(_[T+w]);if(C==null){B[E+3]=0;continue}({r:M,g:O,b:R}=qr(C))}v&&(S=v[T+w]*255),B[E+0]=M,B[E+1]=O,B[E+2]=R,B[E+3]=S}return this.blur>0&&_D(A,this.blur),D.putImageData(A,0,0),pt("svg:g",o).call(Kt,this,i,o).call(Pt,this,r).call(T=>T.append("image").attr("transform",`translate(${u},${f}) scale(${Math.sign(d-u)},${Math.sign(h-f)})`).attr("width",Math.abs(p)).attr("height",Math.abs(y)).attr("preserveAspectRatio","none").call(yt,"image-rendering",this.imageRendering).call(Gt,this).attr("xlink:href",I.toDataURL())).node()}};function j3(e,t,r){arguments.length<3&&(r=t,t=null);let{x:n,y:i,[e]:o,...s}=r;return n===void 0&&i===void 0&&pV(t)&&(n=el,i=bu,o===void 0&&(o=lV)),[t,{...s,x:n,y:i,[e]:o}]}function CY(){let[e,t]=j3("fill",...arguments);return new nx(e,e==null||t.fill!==void 0||t.fillOpacity!==void 0?t:{...t,fill:K})}function UY({x1:e,y1:t,x2:r,y2:n},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,r&&o==null?r[0]:s-l,n&&o==null?n[0]:a-u]}function q3({x1:e,y1:t,x2:r,y2:n},i,o,s){let a={};return e&&(a.x1=e),t&&(a.y1=t),r&&(a.x2=r),n&&(a.y2=n),UY(Op(a,i),o,s)}function ET(e,t={}){let{[e]:r}=t;if(typeof r!="function")throw new Error(`invalid ${e}: not a function`);return Qe({...t,[e]:void 0},function(n,i,o,s,a,c){let{x:l,y:u}=s;if(!l)throw new Error("missing scale: x");if(!u)throw new Error("missing scale: y");let[f,d,h,p]=q3(o,s,a,c),y=h-f,g=p-d,{pixelSize:m}=this,{width:b=Math.round(Math.abs(y)/m),height:x=Math.round(Math.abs(g)/m)}=t,_=new Array(b*x*(i?i.length:1)),v=y/b,w=g/x,I=0;for(let D of i??[void 0])for(let A=.5;A<x;++A)for(let B=.5;B<b;++B,++I)_[I]=r(l.invert(f+B*v),u.invert(d+A*w),D);return{data:_,facets:i,channels:{[e]:{value:_,scale:"auto"}}}})}function fut(e){if(typeof e=="function")return e;if(e==null)return DT;switch(`${e}`.toLowerCase()){case"none":return DT;case"nearest":return W3;case"barycentric":return Y3();case"random-walk":return G3()}throw new Error(`invalid interpolate: ${e}`)}function DT(e,t,r,n,i,o){let s=new Array(t*r);for(let a of e)n[a]<0||n[a]>=t||i[a]<0||i[a]>=r||(s[Math.floor(i[a])*t+Math.floor(n[a])]=o[a]);return s}function Y3({random:e=ca(42)}={}){return(t,r,n,i,o,s)=>{let{points:a,triangles:c,hull:l}=On.from(t,h=>i[h],h=>o[h]),u=new s.constructor(r*n).fill(NaN),f=new Uint8Array(r*n),d=gut(s,e);for(let h=0;h<c.length;h+=3){let p=c[h],y=c[h+1],g=c[h+2],m=a[2*p],b=a[2*y],x=a[2*g],_=a[2*p+1],v=a[2*y+1],w=a[2*g+1],I=Math.min(m,b,x),D=Math.max(m,b,x),A=Math.min(_,v,w),B=Math.max(_,v,w),M=(v-w)*(m-x)+(_-w)*(x-b);if(!M)continue;let O=s[t[p]],R=s[t[y]],S=s[t[g]];for(let T=Math.floor(I);T<D;++T)for(let E=Math.floor(A);E<B;++E){if(T<0||T>=r||E<0||E>=n)continue;let C=T+.5,U=E+.5,k=((v-w)*(C-x)+(U-w)*(x-b))/M;if(k<0)continue;let $=((w-_)*(C-x)+(U-w)*(m-x))/M;if($<0)continue;let z=1-k-$;if(z<0)continue;let V=T+r*E;u[V]=d(O,k,R,$,S,z,T,E),f[V]=1}}return dut(u,f,i,o,s,r,n,l,t,d),u}}function dut(e,t,r,n,i,o,s,a,c,l){r=Float64Array.from(a,h=>r[c[h]]),n=Float64Array.from(a,h=>n[c[h]]),i=Array.from(a,h=>i[c[h]]);let u=r.length,f=Array.from({length:u},(h,p)=>put(p,r,n)),d=0;for(let h=0;h<s;++h){let p=h+.5;for(let y=0;y<o;++y){let g=y+o*h;if(!t[g]){let m=y+.5;for(let b=0;b<u;++b){let x=(u+d+(b%2?(b+1)/2:-b/2))%u;if(f[x](m,p)){let _=hut(r.at(x-1),n.at(x-1),r[x],n[x],m,p);e[g]=l(i.at(x-1),_,i[x],1-_,i[x],0,y,h),d=x;break}}}}}}function hut(e,t,r,n,i,o){let s=r-e,a=n-t,c=s*(r-i)+a*(n-o),l=s*(i-e)+a*(o-t);return c>0&&l>0?c/(c+l):+(c>l)}function ex(e,t,r,n){return e*n-r*t}function put(e,t,r){let n=t.length,i=t.at(e-2),o=r.at(e-2),s=t.at(e-1),a=r.at(e-1),c=t[e],l=r[e],u=t.at(e+1-n),f=r.at(e+1-n),d=s-c,h=a-l,p=i-s,y=o-a,g=c-u,m=l-f,b=Math.hypot(d,h),x=Math.hypot(p,y),_=Math.hypot(g,m);return(v,w)=>{let I=v-s,D=w-a,A=v-c,B=w-l;return ex(I,D,A,B)>-1e-6&&ex(I,D,d,h)*x-ex(I,D,p,y)*b>-1e-6&&ex(A,B,g,m)*b-ex(A,B,d,h)*_<=0}}function W3(e,t,r,n,i,o){let s=new o.constructor(t*r),a=On.from(e,u=>n[u],u=>i[u]),c,l;for(let u=.5,f=0;u<r;++u){l=c;for(let d=.5;d<t;++d,++f)l=a.find(d,u,l),d===.5&&(c=l),s[f]=o[e[l]]}return s}function G3({random:e=ca(42),minDistance:t=.5,maxSteps:r=2}={}){return(n,i,o,s,a,c)=>{let l=new c.constructor(i*o),u=On.from(n,p=>s[p],p=>a[p]),f,d,h;for(let p=.5,y=0;p<o;++p){d=f;for(let g=.5;g<i;++g,++y){let m=g,b=p;h=d=u.find(m,b,d),g===.5&&(f=d);let x,_=0;for(;(x=Math.hypot(s[n[h]]-m,a[n[h]]-b))>t&&_<r;){let v=e(g,p,_)*2*Math.PI;m+=Math.cos(v)*x,b+=Math.sin(v)*x,h=u.find(m,b,h),++_}l[y]=c[n[h]]}}return l}}function mut(e,t,r,n,i,o){return t*e+n*r+o*i}function yut(e){return(t,r,n,i,o,s,a,c)=>{let l=e(a,c);return l<r?t:l<r+i?n:o}}function gut(e,t){return il(e)||lr(e)?mut:yut(t)}function but(e,t,r){return{transform(n){let i=n.length,o=new Float64Array(i),s=(t-e)/r,a=e+s/2;for(let c=0;c<i;++c)o[c]=c%r*s+a;return o}}}function xut(e,t,r,n){return{transform(i){let o=i.length,s=new Float64Array(o),a=(t-e)/n,c=e+a/2;for(let l=0;l<o;++l)s[l]=Math.floor(l/r)%n*a+c;return s}}}var PY={ariaLabel:"contour",fill:"none",stroke:"currentColor",strokeMiterlimit:1,pixelSize:2},ix=class extends rx{constructor(t,{smooth:r=!0,value:n,...i}={}){let o=NI({},i,PY);if(n===void 0){for(let a in o)if(o[a].value!=null){if(n!==void 0)throw new Error("ambiguous contour value");n=i[a],i[a]="value"}}if(n!=null){let a={transform:c=>c.map(l=>l.value),label:vn(n)};for(let c in o)i[c]==="value"&&(i[c]=a)}if(t==null){if(n==null)throw new Error("missing contour value");i=ET("value",{value:n,...i}),n=null}else{let{interpolate:a}=i;n===void 0&&(n=K),a===void 0&&(i.interpolate="nearest")}super(t,{value:{value:n,optional:!0}},_ut(i),PY);let s={geometry:{value:K}};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=!!r}filter(t,{x:r,y:n,value:i,...o},s){return super.filter(t,o,s)}render(t,r,n,i,o){let{geometry:s}=n,a=xn();return pt("svg:g",o).call(Kt,this,i,o).call(Pt,this,r).call(c=>{c.selectAll().data(t).enter().append("path").call(Gt,this).attr("d",l=>a(s[l])).call(ye,this,n)}).node()}};function _ut({thresholds:e,interval:t,...r}){return e=L3(e,t,Ql),Qe(r,function(n,i,o,s,a,c){let[l,u,f,d]=q3(o,s,a,c),h=f-l,p=d-u,{pixelSize:y,width:g=Math.round(Math.abs(h)/y),height:m=Math.round(Math.abs(p)/y)}=this,b=g/h,x=m/p,_=o.value.value,v=[];if(this.interpolate){let{x:B,y:M}=Au(o,s,c),O=fe(B,E=>(E-l)*b,Float64Array),R=fe(M,E=>(E-u)*x,Float64Array),S=[o.x,o.y,o.value],T=[O,R,_];for(let E of i){let C=this.filter(E,S,T);v.push(this.interpolate(C,g,m,O,R,_))}}else if(i){let B=g*m,M=i.length;for(let O=0;O<M;++O)v.push(_.slice(O*B,O*B+B))}else v.push(_);if(this.blur>0)for(let B of v)Cg({data:B,width:g,height:m},this.blur);let w=wut(e,_,...vut(v));if(w===null)throw new Error(`unsupported thresholds: ${e}`);let{contour:I}=ou().size([g,m]).smooth(this.smooth),D=[],A=[];for(let B of v)A.push(_r(D.length,D.push(...fe(w,M=>I(B,M)))));for(let{coordinates:B}of D)for(let M of B)for(let O of M)for(let R of O)R[0]=R[0]/b+l,R[1]=R[1]/x+u;return{data:D,facets:A,channels:DI(this.contourChannels,D)}})}function wut(e,t,r,n){if(typeof e?.range=="function")return e.range(e.floor(r),n);if(typeof e=="function"&&(e=e(t,r,n)),typeof e!="number")return Sr(e);let i=yn(...Dh(r,n,e),e);for(;i[i.length-1]>=n;)i.pop();for(;i[1]<r;)i.shift();return i}function zY(){return new ix(...j3("value",...arguments))}function vut(e){return[Oe(e,t=>Oe(t,$Y)),de(e,t=>de(t,$Y))]}function $Y(e){return isFinite(e)?e:NaN}function qY(e,t){return X3(zp,e,t)}function YY(e,t={}){return X3(Vp,e,t)}function WY(e,t={}){return X3(dd,e,t)}function X3(e,t,r={}){let{x:n,y:i,maxRadius:o}=r,s=e({px:n,py:i,maxRadius:o}),a=[];n!=null&&a.push(Zi(t,VY("x",{...s,inset:-6},r))),i!=null&&a.push(Ki(t,VY("y",{...s,inset:-6},r))),n!=null&&a.push(va(t,jY("x",{...s,dy:9,frameAnchor:"bottom",lineAnchor:"top"},r))),i!=null&&a.push(va(t,jY("y",{...s,dx:-9,frameAnchor:"left",textAnchor:"end"},r)));for(let c of a)c.ariaLabel=`crosshair ${c.ariaLabel}`;return Pr(...a)}function GY(e,{channels:t,...r},{facet:n,facetAnchor:i,fx:o,fy:s,[e]:a,channels:c,transform:l,initializer:u}){return{...r,facet:n,facetAnchor:i,fx:o,fy:s,[e]:a,channels:{...t,...c},transform:l,initializer:Sut(e,u)}}function Sut(e,t){return t==null?t:function(r,n,{x:i,y:o,px:s,py:a,...c},...l){let{channels:{x:u,y:f,...d}={},...h}=t.call(this,r,n,{...c,x:s,y:a},...l);return{channels:{...d,...u&&{px:u,...e==="x"&&{x:u}},...f&&{py:f,...e==="y"&&{y:f}}},...h}}}function VY(e,t,r){let{color:n="currentColor",opacity:i=.2,ruleStroke:o=n,ruleStrokeOpacity:s=i,ruleStrokeWidth:a}=r;return{...GY(e,t,r),stroke:o,strokeOpacity:s,strokeWidth:a}}function jY(e,t,r){let{color:n="currentColor",textFill:i=n,textFillOpacity:o,textStroke:s="var(--plot-background)",textStrokeOpacity:a,textStrokeWidth:c=5}=r;return{...GY(e,t,Iut(e,r)),fill:i,fillOpacity:o,stroke:s,strokeOpacity:a,strokeWidth:c}}function Iut(e,t){return Qe(t,(r,n,i)=>({channels:{text:{value:Eb(i,e)?.value}}}))}var Tut={ariaLabel:"delaunay link",fill:"none",stroke:"currentColor",strokeMiterlimit:1},Aut={ariaLabel:"delaunay mesh",fill:null,stroke:"currentColor",strokeOpacity:.2},Mut={ariaLabel:"hull",fill:"none",stroke:"currentColor",strokeWidth:1.5,strokeMiterlimit:1},Eut={ariaLabel:"voronoi",fill:"none",stroke:"currentColor",strokeMiterlimit:1},Dut={ariaLabel:"voronoi mesh",fill:null,stroke:"currentColor",strokeOpacity:.2},H3=class extends Ft{constructor(t,r={}){let{x:n,y:i,z:o,curve:s,tension:a}=r;super(t,{x:{value:n,scale:"x",optional:!0},y:{value:i,scale:"y",optional:!0},z:{value:o,optional:!0}},r,Tut),this.curve=jb(s,a),_s(this,r)}render(t,r,n,i,o){let{x:s,y:a}=r,{x:c,y:l,z:u}=n,{curve:f}=this,[d,h]=rn(this,i),p=c?b=>c[b]:Qr(d),y=l?b=>l[b]:Qr(h),g=this;function m(b){let x=-1,_=[],v={};for(let S in n)v[S]=[];let w=[],I=[],D=[],A=[];function B(S,T){S=b[S],T=b[T],_.push(++x),w[x]=p(S),D[x]=y(S),I[x]=p(T),A[x]=y(T);for(let E in n)v[E].push(n[E][T])}let{halfedges:M,hull:O,triangles:R}=On.from(b,p,y);for(let S=0;S<M.length;++S){let T=M[S];T>S&&B(R[S],R[T])}for(let S=0;S<O.length;++S)B(O[S],O[(S+1)%O.length]);ae(this).selectAll().data(_).enter().append("path").call(Gt,g).attr("d",S=>{let T=Qn(),E=f(T);return E.lineStart(),E.point(w[S],D[S]),E.point(I[S],A[S]),E.lineEnd(),T}).call(ye,g,v).call(ul,g,v,o)}return pt("svg:g",o).call(Kt,this,i,o).call(Pt,this,{x:c&&s,y:l&&a}).call(u?b=>b.selectAll().data(Gr(t,x=>u[x]).values()).enter().append("g").each(m):b=>b.datum(t).each(m)).node()}},ox=class extends Ft{constructor(t,r={},n,i=({z:o})=>o){let{x:o,y:s}=r;super(t,{x:{value:o,scale:"x",optional:!0},y:{value:s,scale:"y",optional:!0},z:{value:i(r),optional:!0}},r,n)}render(t,r,n,i,o){let{x:s,y:a}=r,{x:c,y:l,z:u}=n,[f,d]=rn(this,i),h=c?m=>c[m]:Qr(f),p=l?m=>l[m]:Qr(d),y=this;function g(m){let b=On.from(m,h,p);ae(this).append("path").datum(m[0]).call(Gt,y).attr("d",y._render(b,i)).call(ye,y,n)}return pt("svg:g",o).call(Kt,this,i,o).call(Pt,this,{x:c&&s,y:l&&a}).call(u?m=>m.selectAll().data(Gr(t,b=>u[b]).values()).enter().append("g").each(g):m=>m.datum(t).each(g)).node()}},Z3=class extends ox{constructor(t,r={}){super(t,r,Aut),this.fill="none"}_render(t){return t.render()}},K3=class extends ox{constructor(t,r={}){super(t,r,Mut,Rn)}_render(t){return t.renderHull()}},Q3=class extends Ft{constructor(t,r={}){let{x:n,y:i,z:o}=r;super(t,{x:{value:n,scale:"x",optional:!0},y:{value:i,scale:"y",optional:!0},z:{value:o,optional:!0}},r,Eut)}render(t,r,n,i,o){let{x:s,y:a}=r,{x:c,y:l,z:u}=n,[f,d]=rn(this,i),h=c?m=>c[m]:Qr(f),p=l?m=>l[m]:Qr(d),y=this;function g(m){let b=On.from(m,h,p),x=XY(b,i);ae(this).selectAll().data(m).enter().append("path").call(Gt,y).attr("d",(_,v)=>x.renderCell(v)).call(ye,y,n)}return pt("svg:g",o).call(Kt,this,i,o).call(Pt,this,{x:c&&s,y:l&&a}).call(u?m=>m.selectAll().data(Gr(t,b=>u[b]).values()).enter().append("g").each(g):m=>m.datum(t).each(g)).node()}},J3=class extends ox{constructor(t,r){super(t,r,Dut),this.fill="none"}_render(t,r){return XY(t,r).render()}};function XY(e,t){let{width:r,height:n,marginTop:i,marginRight:o,marginBottom:s,marginLeft:a}=t;return e.voronoi([a,i,r-o,n-s])}function sx(e,t,{x:r,y:n,...i}={}){return[r,n]=gr(r,n),new e(t,{...i,x:r,y:n})}function HY(e,t){return sx(H3,e,t)}function ZY(e,t){return sx(Z3,e,t)}function KY(e,t){return sx(K3,e,t)}function QY(e,t){return sx(Q3,e,t)}function JY(e,t){return sx(J3,e,t)}var But={ariaLabel:"density",fill:"none",stroke:"currentColor",strokeMiterlimit:1},ax=class extends Ft{constructor(t,{x:r,y:n,z:i,weight:o,fill:s,stroke:a,...c}={}){let l=tW(s)&&(s="currentColor",!0),u=tW(a)&&(a="currentColor",!0);super(t,{x:{value:r,scale:"x",optional:!0},y:{value:n,scale:"y",optional:!0},z:{value:Rn({z:i,fill:s,stroke:a}),optional:!0},weight:{value:o,optional:!0}},Nut({...c,fill:s,stroke:a},l,u),But),l&&(this.fill=void 0),u&&(this.stroke=void 0),this.z=i}filter(t){return t}render(t,r,n,i,o){let{contours:s}=n,a=xn();return pt("svg:g",o).call(Kt,this,i,o).call(Pt,this,{}).call(c=>c.selectAll().data(t).enter().append("path").call(Gt,this).call(ye,this,n).attr("d",l=>a(s[l]))).node()}};function eW(e,{x:t,y:r,...n}={}){return[t,r]=gr(t,r),new ax(e,{...n,x:t,y:r})}var Out=new Set(["x","y","z","weight"]);function Nut(e,t,r){let{bandwidth:i,thresholds:o}=e;return i=i===void 0?20:+i,o=o===void 0?20:typeof o?.[Symbol.iterator]=="function"?Cr(o):+o,Qe(e,function(s,a,c,l,u,f){let d=c.weight?Cr(c.weight.value):null,h=c.z?.value,{z:p}=this,[y,g]=rn(this,u),{width:m,height:b}=u,{x,y:_}=Au(c,l,f),v=Object.fromEntries(Object.entries(c).filter(([R])=>!Out.has(R)).map(([R,S])=>[R,{...S,value:[]}])),w=t&&[],I=r&&[],D=cB().x(x?R=>x[R]:y).y(_?R=>_[R]:g).weight(d?R=>d[R]:1).size([m,b]).bandwidth(i),A=[];for(let R of a){let S=[];A.push(S);for(let T of h?Bb(R,h,p):[R]){let E=D.contours(T);S.push([T,E])}}let B=o;if(!(B instanceof sd)){let R=0;for(let S of A)for(let[,T]of S){let E=T.max;E>R&&(R=E)}B=Float64Array.from({length:o-1},(S,T)=>R*100*(T+1)/o)}let M=[],O=[];for(let R of A){let S=[];M.push(S);for(let[T,E]of R)for(let C of B){S.push(O.length),O.push(E(C/100)),w&&w.push(C),I&&I.push(C);for(let U in v)v[U].value.push(c[U].value[T[0]])}}return w&&w.push(0),I&&I.push(0),{data:s,facets:M,channels:{...v,...w&&{fill:{value:w,scale:"color"}},...I&&{stroke:{value:I,scale:"color"}},contours:{value:O}}}})}function tW(e){return/^density$/i.test(e)}function iW(e,{x1:t,x2:r,y1:n,y2:i,x:o=t===void 0&&r===void 0?nr:void 0,y:s=n===void 0&&i===void 0?K:void 0,fill:a,positiveFill:c="#3ca951",negativeFill:l="#4269d0",fillOpacity:u=1,positiveFillOpacity:f=u,negativeFillOpacity:d=u,stroke:h,strokeOpacity:p,z:y=cr(h)[0],clip:g,tip:m,render:b,...x}={}){return[t,r]=rW(o,t,r),[n,i]=rW(s,n,i),t===r&&n===i&&(n=ku(0)),{tip:m}=xs({tip:m},"x"),Pr(Se(c)?null:Object.assign(qb(e,{x1:t,x2:r,y1:n,y2:i,z:y,fill:c,fillOpacity:f,render:$p(b,nW(!0)),clip:g,...x}),{ariaLabel:"positive difference"}),Se(l)?null:Object.assign(qb(e,{x1:t,x2:r,y1:n,y2:i,z:y,fill:l,fillOpacity:d,render:$p(b,nW(!1)),clip:g,...x}),{ariaLabel:"negative difference"}),Sd(e,{x:r,y:i,z:y,stroke:h,strokeOpacity:p,tip:m,clip:!0,...x}))}function rW(e,t,r){return t===void 0&&r===void 0?t=r=ku(e):t===void 0?(r=ku(r),t=e===void 0?r:ku(e)):r===void 0?(t=ku(t),r=e===void 0?t:ku(e)):(t=ku(t),r=ku(r)),[t,r]}function ku(e){let t,{value:r,label:n=vn(r)}=Mo(e);return{transform:i=>t||(t=Tt(i,r)),label:n}}function nW(e){return(t,r,n,i,o,s)=>{let{x1:a,x2:c}=n,{height:l}=i,u=new Float32Array(a.length),f=new Float32Array(c.length);(e===PI(r.y)<0?u:f).fill(l);let d=s(t,r,{...n,x2:a,y2:f},i,o),h=s(t,r,{...n,x1:c,y1:u},i,o),p=d.querySelector("g")??d,y=h.querySelector("g")??h;for(let g=0;p.firstChild;g+=2){let m=OI(),b=pt("svg:clipPath",o).attr("id",m).node();b.appendChild(p.firstChild),y.childNodes[g].setAttribute("clip-path",`url(#${m})`),y.insertBefore(b,y.childNodes[g])}return h}}var Fut={ariaLabel:"geo",fill:"none",stroke:"currentColor",strokeWidth:1,strokeLinecap:"round",strokeLinejoin:"round",strokeMiterlimit:1},cx=class extends Ft{constructor(t,r={}){let[n,i]=Ae(r.r,3);super(t,{geometry:{value:r.geometry,scale:"projection"},r:{value:n,scale:"r",filter:ni,optional:!0}},Zb(r),Fut),this.r=i}render(t,r,n,i,o){let{geometry:s,r:a}=n,c=xn(o.projection??Lut(r)),{r:l}=this;return hu(l)?t=[]:l!==void 0&&c.pointRadius(l),pt("svg:g",o).call(Kt,this,i,o).call(Pt,this,r).call(u=>{u.selectAll().data(t).enter().append("path").call(Gt,this).attr("d",a?f=>c.pointRadius(a[f])(s[f]):f=>c(s[f])).call(ye,this,n)}).node()}};function Lut({x:e,y:t}){if(e||t)return e??=r=>r,t??=r=>r,Gf({point(r,n){this.stream.point(e(r),t(n))}})}function BT(e,{geometry:t=K,...r}={}){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 cx(e,{geometry:t,...r})}function oW({strokeWidth:e=1.5,...t}={}){return BT({type:"Sphere"},{strokeWidth:e,...t})}function sW({strokeOpacity:e=.1,...t}={}){return BT(BB(),{strokeOpacity:e,...t})}var lm=.5,um=0;function aW(e={fill:"count"},{binWidth:t,...r}={}){let{z:n}=r;return t=t===void 0?20:Wt(t),e=qN(e,r),_a(e,"fill")&&(r.channels={...r.channels,fill:{value:[]}}),r.symbol===void 0&&(r.symbol="hexagon"),r.r===void 0&&!_a(e,"r")&&(r.r=t/2),Qe(r,(i,o,s,a,c,l)=>{let{x:u,y:f,z:d,fill:h,stroke:p,symbol:y}=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}=Au(s,a,l)),d=d?d.value:Tt(i,n),h=h?.value,p=p?.value,y=y?.value;let g=Mb(e,{z:d,fill:h,stroke:p,symbol:y}),m=d&&[],b=h&&[],x=p&&[],_=y&&[],v=[],w=[],I=[],D=-1;for(let O of e)O.initialize(i);for(let O of o){let R=[];for(let S of e)S.scope("facet",O);for(let[S,T]of vu(O,g))for(let{index:E,extent:C}of Rut(i,T,u,f,t)){R.push(++D),w.push(C.x),I.push(C.y),d&&m.push(g===d?S:d[E[0]]),h&&b.push(g===h?S:h[E[0]]),p&&x.push(g===p?S:p[E[0]]),y&&_.push(g===y?S:y[E[0]]);for(let U of e)U.reduce(E,C)}v.push(R)}let A=s.x.scale,B=s.y.scale,M={x:{value:w,source:a[A]?{value:fe(w,a[A].invert),scale:A}:null},y:{value:I,source:a[B]?{value:fe(I,a[B].invert),scale:B}:null},...d&&{z:{value:m}},...h&&{fill:{value:b,scale:"auto"}},...p&&{stroke:{value:x,scale:"auto"}},...y&&{symbol:{value:_,scale:"auto"}},...Object.fromEntries(e.map(({name:O,output:R})=>[O,{scale:"auto",label:R.label,radius:O==="r"?t/2:void 0,value:R.transform()}]))};return{data:i,facets:v,channels:M}})}function Rut(e,t,r,n,i){let o=i*(1.5/LN),s=new Map;for(let a of t){let c=r[a],l=n[a];if(isNaN(c)||isNaN(l))continue;let u=Math.round(l=(l-um)/o),f=Math.round(c=(c-lm)/i-(u&1)/2),d=l-u;if(Math.abs(d)*3>1){let y=c-f,g=f+(c<f?-1:1)/2,m=u+(l<u?-1:1),b=c-g,x=l-m;y*y+d*d>b*b+x*x&&(f=g+(u&1?1:-1)/2,u=m)}let h=`${f},${u}`,p=s.get(h);p===void 0&&(p={index:[],extent:{data:e,x:(f+(u&1)/2)*i+lm,y:u*o+um}},s.set(h,p)),p.index.push(a)}return s.values()}var kut={ariaLabel:"hexgrid",fill:"none",stroke:"currentColor",strokeOpacity:.1};function cW(e){return new lx(e)}var lx=class extends Ft{constructor({binWidth:t=20,clip:r=!0,...n}={}){super(gu,void 0,{clip:r,...n},kut),this.binWidth=Wt(t)}render(t,r,n,i,o){let{binWidth:s}=this,{marginTop:a,marginRight:c,marginBottom:l,marginLeft:u,width:f,height:d}=i,h=u-lm,p=f-c-lm,y=a-um,g=d-l-um,m=s/2,b=m*RN,x=b/2,_=m*2,v=b*1.5,w=Math.floor(h/_),I=Math.ceil(p/_),D=Math.floor((y+x)/v),A=Math.ceil((g-x)/v)+1,B=`m0,${Cu(-b)}l${Cu(m)},${Cu(x)}v${Cu(b)}l${Cu(-m)},${Cu(x)}`,M=B;for(let O=D;O<A;++O)for(let R=w;R<I;++R)M+=`M${Cu(R*_+(O&1)*m)},${Cu(O*v)}${B}`;return pt("svg:g",o).datum(0).call(Kt,this,i,o).call(Pt,this,{},ur+lm,ur+um).call(O=>O.append("path").call(Gt,this).call(ye,this,n).attr("d",M)).node()}};function Cu(e){return Math.round(e*1e3)/1e3}var Cut={ariaLabel:"image",fill:null,stroke:null};function Uut(e){return/^\.*\//.test(e)}function Put(e){return/^(blob|data|file|http|https):/i.test(e)}function $ut(e){return typeof e=="string"&&(Uut(e)||Put(e))?[void 0,e]:[e,void 0]}var ux=class extends Ft{constructor(t,r={}){let{x:n,y:i,r:o,width:s,height:a,rotate:c,src:l,preserveAspectRatio:u,crossOrigin:f,frameAnchor:d,imageRendering:h}=r;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,y]=$ut(l),[g,m]=Ae(o),[b,x]=Ae(s,m!==void 0?m*2:void 0),[_,v]=Ae(a,m!==void 0?m*2:void 0),[w,I]=Ae(c,0);super(t,{x:{value:n,scale:"x",optional:!0},y:{value:i,scale:"y",optional:!0},r:{value:g,scale:"r",filter:ni,optional:!0},width:{value:b,filter:ni,optional:!0},height:{value:_,filter:ni,optional:!0},rotate:{value:w,optional:!0},src:{value:p,optional:!0}},Zb(r),Cut),this.src=y,this.width=x,this.rotate=I,this.height=v,this.r=m,this.preserveAspectRatio=Ne(u,"xMidYMid"),this.crossOrigin=vr(f),this.frameAnchor=xa(d),this.imageRendering=Ne(h,"auto")}render(t,r,n,i,o){let{x:s,y:a}=r,{x:c,y:l,width:u,height:f,r:d,rotate:h,src:p}=n,{r:y,width:g,height:m,rotate:b}=this,[x,_]=rn(this,i);return pt("svg:g",o).call(Kt,this,i,o).call(Pt,this,{x:c&&s,y:l&&a}).call(v=>v.selectAll().data(t).enter().append("image").call(Gt,this).attr("x",lW(c,u,d,x,g,y)).attr("y",lW(l,f,d,_,m,y)).attr("width",u?w=>u[w]:g!==void 0?g:d?w=>d[w]*2:y*2).attr("height",f?w=>f[w]:m!==void 0?m:d?w=>d[w]*2:y*2).attr("transform",h?w=>`rotate(${h[w]})`:b?`rotate(${b})`:null).attr("transform-origin",h||b?Eu`${c?w=>c[w]:x}px ${l?w=>l[w]:_}px`:null).call(yt,"href",p?w=>p[w]:this.src).call(yt,"preserveAspectRatio",this.preserveAspectRatio).call(yt,"crossorigin",this.crossOrigin).call(yt,"image-rendering",this.imageRendering).call(yt,"clip-path",d?w=>`circle(${d[w]}px)`:y!==void 0?`circle(${y}px)`:null).call(ye,this,n)).node()}};function lW(e,t,r,n,i,o){return t&&e?s=>e[s]-t[s]/2:t?s=>n-t[s]/2:e&&i!==void 0?s=>e[s]-i/2:i!==void 0?n-i/2:r&&e?s=>e[s]-r[s]:r?s=>n-r[s]:e?s=>e[s]-o:n-o}function uW(e,{x:t,y:r,...n}={}){return n.frameAnchor===void 0&&([t,r]=gr(t,r)),new ux(e,{...n,x:t,y:r})}function zut(e,t,r){var n=1e-8,i=t-1,o=r-1,s=0,a,c,l,u,f,d,h,p,y,g,m;if(e<=0)return 0;if(e>=1)return 1;for(t>=1&&r>=1?(l=e<.5?e:1-e,u=Math.sqrt(-2*Math.log(l)),h=(2.30753+u*.27061)/(1+u*(.99229+u*.04481))-u,e<.5&&(h=-h),p=(h*h-3)/6,y=2/(1/(2*t-1)+1/(2*r-1)),g=h*Math.sqrt(p+y)/y-(1/(2*r-1)-1/(2*t-1))*(p+5/6-2/(3*y)),h=t/(t+r*Math.exp(2*g))):(a=Math.log(t/(t+r)),c=Math.log(r/(t+r)),u=Math.exp(t*a)/t,f=Math.exp(r*c)/r,g=u+f,e<u/g?h=Math.pow(t*g*e,1/t):h=1-Math.pow(r*g*(1-e),1/r)),m=-fm(t)-fm(r)+fm(t+r);s<10;s++){if(h===0||h===1)return h;if(d=Vut(h,t,r)-e,u=Math.exp(i*Math.log(h)+o*Math.log(1-h)+m),f=d/u,h-=u=f/(1-.5*Math.min(1,f*(i/h-o/(1-h)))),h<=0&&(h=.5*(h+u)),h>=1&&(h=.5*(h+u+1)),Math.abs(u)<n*h&&s>0)break}return h}function Vut(e,t,r){var n=e===0||e===1?0:Math.exp(fm(t+r)-fm(t)-fm(r)+t*Math.log(e)+r*Math.log(1-e));return e<0||e>1?!1:e<(t+1)/(t+r+2)?n*fW(e,t,r)/t:1-n*fW(1-e,r,t)/r}function fW(e,t,r){var n=1e-30,i=1,o=t+r,s=t+1,a=t-1,c=1,l=1-o*e/s,u,f,d,h;for(Math.abs(l)<n&&(l=n),l=1/l,h=l;i<=100&&(u=2*i,f=i*(r-i)*e/((a+u)*(t+u)),l=1+f*l,Math.abs(l)<n&&(l=n),c=1+f/c,Math.abs(c)<n&&(c=n),l=1/l,h*=l*c,f=-(t+i)*(o+i)*e/((t+u)*(s+u)),l=1+f*l,Math.abs(l)<n&&(l=n),c=1+f/c,Math.abs(c)<n&&(c=n),l=1/l,d=l*c,h*=d,!(Math.abs(d-1)<3e-7));i++);return h}function fm(e){var t=0,r=[76.18009172947146,-86.5053203294167,24.01409824083091,-1.231739572450155,.001208650973866179,-5395239384953e-18],n=1.000000000190015,i,o,s;for(s=(o=i=e)+5.5,s-=(i+.5)*Math.log(s);t<6;t++)n+=r[t]/++o;return Math.log(2.506628274631*n/i)-s}function dW(e,t){var r=zut(2*Math.min(e,1-e),.5*t,.5);return r=Math.sqrt(t*(1-r)/r),e>.5?r:-r}var jut={ariaLabel:"linear-regression",fill:"currentColor",fillOpacity:.1,stroke:"currentColor",strokeWidth:1.5,strokeLinecap:"round",strokeLinejoin:"round",strokeMiterlimit:1},OT=class extends Ft{constructor(t,r={}){let{x:n,y:i,z:o,ci:s=.95,precision:a=4}=r;if(super(t,{x:{value:n,scale:"x"},y:{value:i,scale:"y"},z:{value:Rn(r),optional:!0}},r,jut),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,r,n,i,o){let{x:s,y:a,z:c}=n,{ci:l}=this;return pt("svg:g",o).call(Kt,this,i,o).call(Pt,this,r).call(u=>u.selectAll().data(c?Bb(t,c,this.z):[t]).enter().call(f=>f.append("path").attr("fill","none").call(Gt,this).call(fd,this,{...n,fill:null,fillOpacity:null}).attr("d",d=>this._renderLine(d,s,a)).call(l&&!ol(this.fill)?d=>d.select(qut).attr("stroke","none").call(Gt,this).call(fd,this,{...n,stroke:null,strokeOpacity:null,strokeWidth:null}).attr("d",h=>this._renderBand(h,s,a)):()=>{}))).node()}};function qut(){return this.parentNode.insertBefore(this.ownerDocument.createElementNS(bo.svg,"path"),this)}var tF=class extends OT{constructor(t,r){super(t,r)}_renderBand(t,r,n){let{ci:i,precision:o}=this,[s,a]=Be(t,u=>n[u]),c=NT(t,n,r),l=mW(t,n,r,(1-i)/2,c);return dp().y(u=>u).x0(u=>l(u,-1)).x1(u=>l(u,1))(_r(s,a-o/2,o).concat(a))}_renderLine(t,r,n){let[i,o]=Be(t,a=>n[a]),s=NT(t,n,r);return`M${s(i)},${i}L${s(o)},${o}`}},eF=class extends OT{constructor(t,r){super(t,r)}_renderBand(t,r,n){let{ci:i,precision:o}=this,[s,a]=Be(t,u=>r[u]),c=NT(t,r,n),l=mW(t,r,n,(1-i)/2,c);return dp().x(u=>u).y0(u=>l(u,-1)).y1(u=>l(u,1))(_r(s,a-o/2,o).concat(a))}_renderLine(t,r,n){let[i,o]=Be(t,a=>r[a]),s=NT(t,r,n);return`M${i},${s(i)}L${o},${s(o)}`}};function hW(e,{y:t=nr,x:r=K,stroke:n,fill:i=Se(n)?"currentColor":n,...o}={}){return new tF(e,Xp({...o,x:r,y:t,fill:i,stroke:n}))}function pW(e,{x:t=nr,y:r=K,stroke:n,fill:i=Se(n)?"currentColor":n,...o}={}){return new eF(e,Gp({...o,x:t,y:r,fill:i,stroke:n}))}function NT(e,t,r){let n=0,i=0,o=0,s=0;for(let u of e){let f=t[u],d=r[u];n+=f,i+=d,o+=f*d,s+=f*f}let a=e.length,c=(a*o-n*i)/(a*s-n*n),l=(i-c*n)/a;return u=>c*u+l}function mW(e,t,r,n,i){let o=gn(e,u=>t[u])/e.length,s=0,a=0;for(let u of e)s+=(t[u]-o)**2,a+=(r[u]-i(t[u]))**2;let c=Math.sqrt(a/(e.length-2)),l=dW(n,e.length-2);return(u,f)=>{let d=i(u),h=c*Math.sqrt(1/e.length+(u-o)**2/s);return d+f*l*h}}function fx({path:e=K,delimiter:t,frameAnchor:r,treeLayout:n=Xf,treeSort:i,treeSeparation:o,treeAnchor:s,treeFilter:a,...c}={}){s=kT(s),i=bW(i),a!=null&&(a=nF(a)),r===void 0&&(r=s.frameAnchor);let l=xW(t),u=AW(c,nF),[f,d]=tn(),[h,p]=tn();return{x:f,y:h,frameAnchor:r,...en(c,(y,g)=>{let m=l(Tt(y,e)),b=d([]),x=p([]),_=-1,v=[],w=[],I=BS().path(A=>m[A]),D=n();D.nodeSize&&D.nodeSize([1,1]),D.separation&&o!==void 0&&D.separation(o??wb);for(let A of u)A[LT]=A[IW]([]);for(let A of g){let B=[],M=I(A.filter(O=>m[O]!=null)).each(O=>O.data=y[O.data]);i!=null&&M.sort(i),D(M);for(let O of M.descendants())if(!(a!=null&&!a(O))){B.push(++_),v[_]=O.data,s.position(O,_,b,x);for(let R of u)R[LT][_]=R[TW](O)}w.push(B)}return{data:v,facets:w}}),...Object.fromEntries(u)}}function RT({path:e=K,delimiter:t,curve:r="bump-x",stroke:n="#555",strokeWidth:i=1.5,strokeOpacity:o=.5,treeLayout:s=Xf,treeSort:a,treeSeparation:c,treeAnchor:l,treeFilter:u,...f}={}){l=kT(l),a=bW(a),u!=null&&(u=gW(u)),f={curve:r,stroke:n,strokeWidth:i,strokeOpacity:o,...f};let d=xW(t),h=AW(f,gW),[p,y]=tn(),[g,m]=tn(),[b,x]=tn(),[_,v]=tn();return{x1:p,x2:g,y1:b,y2:_,...en(f,(w,I)=>{let D=d(Tt(w,e)),A=y([]),B=m([]),M=x([]),O=v([]),R=-1,S=[],T=[],E=BS().path(U=>D[U]),C=s();C.nodeSize&&C.nodeSize([1,1]),C.separation&&c!==void 0&&C.separation(c??wb);for(let U of h)U[LT]=U[IW]([]);for(let U of I){let k=[],$=E(U.filter(z=>D[z]!=null)).each(z=>z.data=w[z.data]);a!=null&&$.sort(a),C($);for(let{source:z,target:V}of $.links())if(!(u!=null&&!u(V,z))){k.push(++R),S[R]=V.data,l.position(z,R,A,M),l.position(V,R,B,O);for(let Q of h)Q[LT][R]=Q[TW](V,z)}T.push(k)}return{data:S,facets:T}}),...Object.fromEntries(h)}}function kT(e="left"){switch(`${e}`.trim().toLowerCase()){case"left":return Yut;case"right":return Wut}throw new Error(`invalid tree anchor: ${e}`)}var Yut={frameAnchor:"left",dx:6,position({x:e,y:t},r,n,i){n[r]=t,i[r]=-e}},Wut={frameAnchor:"right",dx:-6,position({x:e,y:t},r,n,i){n[r]=-t,i[r]=-e}};function bW(e){return e==null||typeof e=="function"?e:`${e}`.trim().toLowerCase().startsWith("node:")?yW(nF(e)):yW(Gut(e))}function yW(e){return(t,r)=>Kr(e(t),e(r))}function Gut(e){return t=>t.data?.[e]}function xW(e="/"){if(e=`${e}`,e==="/")return r=>r;if(e.length!==1)throw new Error("delimiter must be exactly one character");let t=e.charCodeAt(0);return r=>r.map(n=>Xut(n,t))}var rF=92,_W=47;function Xut(e,t){if(t===rF)throw new Error("delimiter cannot be backslash");let r=!1;for(let n=0,i=e.length;n<i;++n){switch(e.charCodeAt(n)){case rF:if(!r){r=!0;continue}break;case t:r?(e=e.slice(0,n-1)+e.slice(n),--n,--i):e=e.slice(0,n)+"/"+e.slice(n+1);break;case _W:r?(e=e.slice(0,n)+"\\\\"+e.slice(n),n+=2,i+=2):(e=e.slice(0,n)+"\\"+e.slice(n),++n,++i);break}r=!1}return e}function Hut(e){let t=!1;for(let r=0,n=e.length;r<n;++r){switch(e.charCodeAt(r)){case rF:if(!t){t=!0;continue}case _W:t&&(e=e.slice(0,r-1)+e.slice(r),--r,--n);break}t=!1}return e}function wW(e){return Jr(e)&&typeof e.node=="function"}function Zut(e){return Jr(e)&&typeof e.link=="function"}function nF(e){if(wW(e))return e.node;if(e=`${e}`.trim().toLowerCase(),!!e.startsWith("node:")){switch(e){case"node:name":return oF;case"node:path":return iF;case"node:internal":return vW;case"node:external":return SW;case"node:depth":return sF;case"node:height":return aF}throw new Error(`invalid node value: ${e}`)}}function gW(e){if(wW(e))return e.node;if(Zut(e))return e.link;if(e=`${e}`.trim().toLowerCase(),!(!e.startsWith("node:")&&!e.startsWith("parent:"))){switch(e){case"parent:name":return FT(oF);case"parent:path":return FT(iF);case"parent:depth":return FT(sF);case"parent:height":return FT(aF);case"node:name":return oF;case"node:path":return iF;case"node:internal":return vW;case"node:external":return SW;case"node:depth":return sF;case"node:height":return aF}throw new Error(`invalid link value: ${e}`)}}function iF(e){return e.id}function oF(e){return Kut(e.id)}function sF(e){return e.depth}function aF(e){return e.height}function vW(e){return!!e.children}function SW(e){return!e.children}function FT(e){return(t,r)=>r==null?void 0:e(r)}function Kut(e){let t=e.length;for(;--t>0&&!Qut(e,t););return Hut(e.slice(t+1))}function Qut(e,t){if(e[t]==="/"){let r=0;for(;t>0&&e[--t]==="\\";)++r;if(!(r&1))return!0}return!1}var IW=2,TW=3,LT=4;function AW(e,t){let r=[];for(let n in e){let i=e[n],o=t(i);o!==void 0&&r.push([n,...tn(i),o])}return r}function cF(e,{fill:t,stroke:r,strokeWidth:n,strokeOpacity:i,strokeLinejoin:o,strokeLinecap:s,strokeMiterlimit:a,strokeDasharray:c,strokeDashoffset:l,marker:u,markerStart:f=u,markerEnd:d=u,dot:h=Se(f)&&Se(d),text:p="node:name",textStroke:y="var(--plot-background)",title:g="node:path",dx:m,dy:b,textAnchor:x,treeLayout:_=Xf,textLayout:v=_===Xf||_===ES?"mirrored":"normal",tip:w,...I}={}){if(m===void 0&&(m=kT(I.treeAnchor).dx),x!==void 0)throw new Error("textAnchor is not a configurable tree option");v=Ur(v,"textLayout",["mirrored","normal"]);function D(A){return va(e,fx({treeLayout:_,text:p,fill:t===void 0?"currentColor":t,stroke:y,dx:m,dy:b,title:g,...A,...I}))}return Pr(_T(e,RT({treeLayout:_,markerStart:f,markerEnd:d,stroke:r!==void 0?r:t===void 0?"node:internal":t,strokeWidth:n,strokeOpacity:i,strokeLinejoin:o,strokeLinecap:s,strokeMiterlimit:a,strokeDasharray:c,strokeDashoffset:l,...I})),h?Do(e,fx({treeLayout:_,fill:t===void 0?"node:internal":t,title:g,tip:w,...I})):null,p!=null?v==="mirrored"?[D({textAnchor:"start",treeFilter:"node:external"}),D({textAnchor:"end",treeFilter:"node:internal",dx:-m})]:D():null)}function MW(e,t){return cF(e,{...t,treeLayout:ES})}function EW({geometry:e=K,...t}={}){return Qe({...t,x:null,y:null},(r,n,i,o,s,{projection:a})=>{let c=Tt(r,e),l=c.length,u=new Float64Array(l),f=new Float64Array(l),d=xn(a);for(let h=0;h<l;++h)[u[h],f[h]]=d.centroid(c[h]);return{data:r,facets:n,channels:{x:{value:u,scale:a==null?"x":null,source:null},y:{value:f,scale:a==null?"y":null,source:null}}}})}function DW({geometry:e=K,...t}={}){let r;return{...t,x:{transform:n=>Float64Array.from(r=Tt(Tt(n,e),IB),([i])=>i)},y:{transform:()=>Float64Array.from(r,([,n])=>n)}}}var $W=lX(PW(),1);var sft=({marginLeft:e})=>[1,e],aft=({width:e,marginRight:t})=>[-1,e-t],cft=({width:e,marginLeft:t,marginRight:r})=>[0,(t+e-r)/2],lft=({marginTop:e})=>[1,e],uft=({height:e,marginBottom:t})=>[-1,e-t],fft=({height:e,marginTop:t,marginBottom:r})=>[0,(t+e-r)/2];function zW(e){return typeof e=="string"?{anchor:e}:e}function VW(e={},t={}){arguments.length===1&&([e,t]=qW(e));let{anchor:r="left",padding:n=1,r:i=t.r}=zW(e);switch(`${r}`.toLowerCase()){case"left":r=sft;break;case"right":r=aft;break;case"middle":r=cft;break;default:throw new Error(`unknown dodge anchor: ${r}`)}return YW("x","y",r,Wt(n),i,t)}function jW(e={},t={}){arguments.length===1&&([e,t]=qW(e));let{anchor:r="bottom",padding:n=1,r:i=t.r}=zW(e);switch(`${r}`.toLowerCase()){case"top":r=lft;break;case"bottom":r=uft;break;case"middle":r=fft;break;default:throw new Error(`unknown dodge anchor: ${r}`)}return YW("y","x",r,Wt(n),i,t)}function qW(e){let{anchor:t,padding:r,...n}=e,{r:i}=n;return[{anchor:t,padding:r,r:i},n]}function YW(e,t,r,n,i,o){if(i!=null&&typeof i!="number"){let{channels:s,sort:a,reverse:c}=o;s=Sb(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 Qe(o,function(s,a,c,l,u,f){let{[t]:d,r:h}=c;if(!c[t])throw new Error(`missing channel: ${t}`);({[t]:d}=Au(c,l,f));let p=h?void 0:i!==void 0?Wt(i):this.r!==void 0?this.r:3;h&&(h=Tt(h.value,l[h.scale]||K,Float64Array));let[y,g]=r(u),m=y?hft:dft,b=new Float64Array(d.length),x=h?_=>h[_]:()=>p;for(let _ of a){let v=(0,$W.default)();_=_.filter(h?I=>gp(d[I])&&ni(h[I]):I=>gp(d[I]));let w=new Float64Array(2*_.length+2);for(let I of _){let D=x(I),A=y?D+n:0,B=d[I]-D,M=d[I]+D,O=2;v.queryInterval(B-n,M+n,([,,S])=>{let T=b[S]-A,E=d[I]-d[S],C=n+(h?h[I]+h[S]:2*p),U=Math.sqrt(C*C-E*E);w[O++]=T-U,w[O++]=T+U});let R=w.slice(0,O);y&&(R=R.filter(S=>S>=0));t:for(let S of R.sort(m)){for(let T=0;T<O;T+=2)if(w[T]+1e-6<S&&S<w[T+1]-1e-6)continue t;b[I]=S+A;break}v.insert([B,M,I])}}y||(y=1);for(let _ of a)for(let v of _)b[v]=b[v]*y+g;return{data:s,facets:a,channels:{[e]:{value:b,source:null},[t]:{value:d,source:c[t]},...h&&{r:{value:h,source:c.r}}}}})}function dft(e,t){return Math.abs(e)-Math.abs(t)}function hft(e,t){return e-t}function GW(e,t){return arguments.length===1&&({basis:e,...t}=e),om(PT(e),t)}function XW(e,t){return arguments.length===1&&({basis:e,...t}=e),sm(PT(e),t)}function PT(e){if(e===void 0)return WW;if(typeof e=="function")return $T(Ip(e));if(/^p\d{2}$/i.test(e))return mm(vp(e));switch(`${e}`.toLowerCase()){case"deviation":return yft;case"first":return WW;case"last":return mft;case"max":return gft;case"mean":return bft;case"median":return xft;case"min":return _ft;case"sum":return wft;case"extent":return pft}throw new Error(`invalid basis: ${e}`)}function $T(e){return{mapIndex(t,r,n){let i=+e(t,r);for(let o of t)n[o]=r[o]===null?NaN:r[o]/i}}}function mm(e){return $T((t,r)=>e(t,n=>r[n]))}var pft={mapIndex(e,t,r){let[n,i]=Be(e,s=>t[s]),o=i-n;for(let s of e)r[s]=t[s]===null?NaN:(t[s]-n)/o}},WW=$T((e,t)=>{for(let r=0;r<e.length;++r){let n=t[e[r]];if(wr(n))return n}}),mft=$T((e,t)=>{for(let r=e.length-1;r>=0;--r){let n=t[e[r]];if(wr(n))return n}}),yft={mapIndex(e,t,r){let n=Lc(e,o=>t[o]),i=go(e,o=>t[o]);for(let o of e)r[o]=t[o]===null?NaN:i?(t[o]-n)/i:0}},gft=mm(de),bft=mm(Lc),xft=mm(hs),_ft=mm(Oe),wft=mm(gn);function HW(e,t){return vft("x",e,t)}function vft(e,t,r={}){let n,i=1;if(typeof t=="number")i=t,n=(l,u)=>+l+u;else{if(typeof t=="string"){let l=t.startsWith("-")?-1:1;[t,i]=gI(t.replace(/^[+-]/,"")),i*=l}t=Ap(t),n=(l,u)=>t.offset(l,u)}let o=`${e}1`,s=`${e}2`,a=Ii({[o]:l=>l.map(u=>n(u,i)),[s]:l=>l},r),c=a[s].transform;return a[s].transform=()=>{let l=c(),[u,f]=Be(l);return l.domain=i<0?[u,n(f,i)]:[n(u,i),f],l},a}function ZW(e,t={}){if(typeof e=="string")switch(e.toLowerCase()){case"first":return pF(t);case"last":return mF(t)}if(typeof e=="function")return Uu(null,e,t);let r,n;for(r in e){if(n!==void 0)throw new Error("ambiguous selector; multiple inputs");n=Sft(e[r])}if(n===void 0)throw new Error(`invalid selector: ${e}`);return Uu(r,n,t)}function Sft(e){if(typeof e=="function")return e;switch(`${e}`.toLowerCase()){case"min":return yF;case"max":return gF}throw new Error(`unknown selector: ${e}`)}function pF(e){return Uu(null,Ift,e)}function mF(e){return Uu(null,Tft,e)}function KW(e){return Uu("x",yF,e)}function QW(e){return Uu("y",yF,e)}function JW(e){return Uu("x",gF,e)}function tG(e){return Uu("y",gF,e)}function*Ift(e){yield e[0]}function*Tft(e){yield e[e.length-1]}function*yF(e,t){yield dv(e,r=>t[r])}function*gF(e,t){yield Of(e,r=>t[r])}function Uu(e,t,r){if(e!=null){if(r[e]==null)throw new Error(`missing channel: ${e}`);e=r[e]}let n=Rn(r);return en(r,(i,o)=>{let s=Tt(i,n),a=Tt(i,e),c=[];for(let l of o){let u=[];for(let f of s?Gr(l,d=>s[d]).values():[l])for(let d of t(f,a))u.push(d);c.push(u)}return{data:i,facets:c}})}var Aft=new Map([["style","style"],["width","width"],["height","height"],["margin","margin"],["marginLeft","marginLeft"],["marginRight","marginRight"],["marginTop","marginTop"],["marginBottom","marginBottom"],["align","align"],["aspectRatio","aspectRatio"],["axis","axis"],["inset","inset"],["grid","grid"],["label","label"],["padding","padding"],["round","round"],["xScale","x.type"],["xDomain","x.domain"],["xRange","x.range"],["xNice","x.nice"],["xInset","x.inset"],["xInsetLeft","x.insetLeft"],["xInsetRight","x.insetRight"],["xClamp","x.clamp"],["xRound","x.round"],["xAlign","x.align"],["xPadding","x.padding"],["xPaddingInner","x.paddingInner"],["xPaddingOuter","x.paddingOuter"],["xAxis","x.axis"],["xTicks","x.ticks"],["xTickSize","x.tickSize"],["xTickSpacing","x.tickSpacing"],["xTickPadding","x.tickPadding"],["xTickFormat","x.tickFormat"],["xTickRotate","x.tickRotate"],["xGrid","x.grid"],["xLine","x.line"],["xLabel","x.label"],["xLabelAnchor","x.labelAnchor"],["xLabelOffset","x.labelOffset"],["xFontVariant","x.fontVariant"],["xAriaLabel","x.ariaLabel"],["xAriaDescription","x.ariaDescription"],["xReverse","x.reverse"],["xZero","x.zero"],["xBase","x.base"],["xExponent","x.exponent"],["xConstant","x.constant"],["yScale","y.type"],["yDomain","y.domain"],["yRange","y.range"],["yNice","y.nice"],["yInset","y.inset"],["yInsetTop","y.insetTop"],["yInsetBottom","y.insetBottom"],["yClamp","y.clamp"],["yRound","y.round"],["yAlign","y.align"],["yPadding","y.padding"],["yPaddingInner","y.paddingInner"],["yPaddingOuter","y.paddingOuter"],["yAxis","y.axis"],["yTicks","y.ticks"],["yTickSize","y.tickSize"],["yTickSpacing","y.tickSpacing"],["yTickPadding","y.tickPadding"],["yTickFormat","y.tickFormat"],["yTickRotate","y.tickRotate"],["yGrid","y.grid"],["yLine","y.line"],["yLabel","y.label"],["yLabelAnchor","y.labelAnchor"],["yLabelOffset","y.labelOffset"],["yFontVariant","y.fontVariant"],["yAriaLabel","y.ariaLabel"],["yAriaDescription","y.ariaDescription"],["yReverse","y.reverse"],["yZero","y.zero"],["yBase","y.base"],["yExponent","y.exponent"],["yConstant","y.constant"],["facetMargin","facet.margin"],["facetMarginTop","facet.marginTop"],["facetMarginBottom","facet.marginBottom"],["facetMarginLeft","facet.marginLeft"],["facetMarginRight","facet.marginRight"],["facetGrid","facet.grid"],["facetLabel","facet.label"],["fxDomain","fx.domain"],["fxRange","fx.range"],["fxNice","fx.nice"],["fxInset","fx.inset"],["fxInsetLeft","fx.insetLeft"],["fxInsetRight","fx.insetRight"],["fxRound","fx.round"],["fxAlign","fx.align"],["fxPadding","fx.padding"],["fxPaddingInner","fx.paddingInner"],["fxPaddingOuter","fx.paddingOuter"],["fxAxis","fx.axis"],["fxTicks","fx.ticks"],["fxTickSize","fx.tickSize"],["fxTickSpacing","fx.tickSpacing"],["fxTickPadding","fx.tickPadding"],["fxTickFormat","fx.tickFormat"],["fxTickRotate","fx.tickRotate"],["fxGrid","fx.grid"],["fxLine","fx.line"],["fxLabel","fx.label"],["fxLabelAnchor","fx.labelAnchor"],["fxLabelOffset","fx.labelOffset"],["fxFontVariant","fx.fontVariant"],["fxAriaLabel","fx.ariaLabel"],["fxAriaDescription","fx.ariaDescription"],["fxReverse","fx.reverse"],["fyDomain","fy.domain"],["fyRange","fy.range"],["fyNice","fy.mice"],["fyInset","fy,inset"],["fyInsetTop","fy.insetTop"],["fyInsetBottom","fy.insetBottom"],["fyRound","fy.round"],["fyAlign","fy.align"],["fyPadding","fy.padding"],["fyPaddingInner","fy.paddingInner"],["fyPaddingOuter","fy.paddingOuter"],["fyAxis","fy.axis"],["fyTicks","fy.ticks"],["fyTickSize","fy.tickSize"],["fyTickSpacing","fy.tickSpacing"],["fyTickPadding","fy.tickPadding"],["fyTickFormat","fy.tickFormat"],["fyTickRotate","fy.tickRotate"],["fyGrid","fy.grid"],["fyLine","fy.line"],["fyLabel","fy.label"],["fyLabelAnchor","fy.labelAnchor"],["fyLabelOffset","fy.labelOffset"],["fyFontVariant","fy.fontVariant"],["fyAriaLabel","fy.ariaLabel"],["fyAriaDescription","fy.ariaDescription"],["fyReverse","fy.reverse"],["colorScale","color.type"],["colorDomain","color.domain"],["colorRange","color.range"],["colorClamp","color.clamp"],["colorN","color.n"],["colorNice","color.nice"],["colorScheme","color.scheme"],["colorInterpolate","color.interpolate"],["colorPivot","color.pivot"],["colorSymmetric","color.symmetric"],["colorLabel","color.label"],["colorReverse","color.reverse"],["colorZero","color.zero"],["colorTickFormat","color.tickFormat"],["colorBase","color.base"],["colorExponent","color.exponent"],["colorConstant","color.constant"],["opacityScale","opacity.type"],["opacityDomain","opacity.domain"],["opacityRange","opacity.range"],["opacityClamp","opacity.clamp"],["opacityNice","opacity.nice"],["opacityLabel","opacity.label"],["opacityReverse","opacity.reverse"],["opacityZero","opacity.zero"],["opacityTickFormat","opacity.tickFormat"],["opacityBase","opacity.base"],["opacityExponent","opacity.exponent"],["opacityConstant","opacity.constant"],["rScale","r.type"],["rDomain","r.domain"],["rRange","r.range"],["rClamp","r.clamp"],["rNice","r.nice"],["rZero","r.zero"],["rBase","r.base"],["rExponent","r.exponent"],["rConstant","r.constant"],["lengthScale","length.type"],["lengthDomain","length.domain"],["lengthRange","length.range"],["lengthClamp","length.clamp"],["lengthNice","length.nice"],["lengthZero","length.zero"],["lengthBase","length.base"],["lengthExponent","length.exponent"],["lengthConstant","length.constant"],["projectionType","projection.type"],["projectionParallels","projection.parallels"],["projectionPrecision","projection.precision"],["projectionRotate","projection.rotate"],["projectionDomain","projection.domain"],["projectionInset","projection.inset"],["projectionInsetLeft","projection.insetLeft"],["projectionInsetRight","projection.insetRight"],["projectionInsetTop","projection.insetTop"],["projectionInsetBottom","projection.insetBottom"],["projectionClip","projection.clip"]]);function Mft(e,t,r){for(let n=0;n<t.length;++n){let i=t[n];n===t.length-1?e[i]=r:e=e[i]||(e[i]={})}}function eG(e,t,r){for(let n in e){let i=Aft.get(n);if(i==null)throw new Error(`Unrecognized plot attribute: ${n}`);let o=e[n];typeof o=="symbol"?r.push(n):o!==void 0&&Mft(t,i.split("."),o)}}var Eft=new Set(["frame","hexgrid","sphere","graticule"]);async function nG(e){let t={marks:[]},r=[],{attributes:n,marks:i}=e;eG(n,t,r);let o=[];for(let a of i)for(let{type:c,data:l,options:u}of a.plotSpecs())Eft.has(c)?t.marks.push(zT[c](u)):t.marks.push(zT[c](l,u)),o.push(a.index);Bft(t,e);let s=Vb(t);Oft(s,o),Dft(e,s,n,r);for(let a of e.interactors)await a.init(s);return s}function Dft(e,t,r,n){n.forEach(i=>{let o=r[i];if(o===Gs){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,r[`${s}Reverse`]?a.domain.slice().reverse():a.domain)}else throw new Error(`Unrecognized symbol: ${o}`)})}function Bft(e,t){let{marks:r}=t;VT("x",e,r,["x","x1","x2"]),VT("y",e,r,["y","y1","y2"]),VT("fx",e,r),VT("fy",e,r)}function VT(e,t,r,n=[e]){let i=t[e]||{};if(i.axis===null||i.label!==void 0)return;let o=r.map(u=>u.channelField(n)?.field);if(o.every(u=>u==null))return;let s,a,c;for(let u=0;u<o.length;++u){let{column:f,label:d}=o[u]||{};f===void 0&&d===void 0||(s===void 0&&a===void 0?(s=f,a=d,c=Nft(r[u].data,n)||"number"):a!==d?a=void 0:s!==f&&(s=void 0))}let l=a||s;if(l!==void 0){if((c==="number"||c==="date")&&(e==="x"||e==="y")){i.percent&&(l=`${l} (%)`);let u=(e==="x"?1:-1)*(i.reverse?-1:1);e==="x"||i.labelAnchor==="center"?l=e==="x"==u<0?`\u2190 ${l}`:`${l} \u2192`:l=`${u<0?"\u2191 ":"\u2193 "}${l}`}t[e]={...i,label:l}}}function Oft(e,t){let r=e.querySelectorAll('g[aria-label="facet"]');if(r.length)for(let n of r)rG(n,t);else rG(e,t)}function rG(e,t){let r=-1;for(let n of e.children){let i=n.getAttribute("aria-label")||"";n.nodeName==="style"||i.includes("-axis")||i.includes("-grid")||n.setAttribute("data-index",t[++r])}}function Nft(e,t){for(let r of e)for(let n=0;n<t.length;++n){let i=r[t[n]];if(i!=null)return i instanceof Date?"date":typeof i}}var Fft={width:640,marginLeft:40,marginRight:20,marginTop:20,marginBottom:30},px=class{constructor(t){this.attributes={...Fft},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=xD()}margins(){return{left:this.getAttribute("marginLeft"),top:this.getAttribute("marginTop"),bottom:this.getAttribute("marginBottom"),right:this.getAttribute("marginRight")}}innerWidth(){let{left:t,right:r}=this.margins();return this.getAttribute("width")-t-r}innerHeight(t=400){let{top:r,bottom:n}=this.margins(),i=this.getAttribute("height");return i==null&&t!=null&&(i=t,this.setAttribute("height",i,{silent:!0})),i-r-n}pending(t){this.synch.pending(t)}update(t){return this.synch.ready(t)&&!this.pendingRender&&(this.pendingRender=!0,requestAnimationFrame(()=>this.render())),this.synch.promise}async render(){this.pendingRender=!1;let t=await nG(this),r=this.legends.flatMap(({legend:n,include:i})=>{let o=n.init(t);return i?o:[]});this.element.replaceChildren(t,...r),this.synch.resolve()}getAttribute(t){return this.attributes[t]}setAttribute(t,r,n){return Ry(this.attributes[t],r)?(r===void 0?delete this.attributes[t]:this.attributes[t]=r,n?.silent||this.listeners?.get(t)?.forEach(i=>i(t,r)),!0):!1}addAttributeListener(t,r){let n=this.listeners||(this.listeners=new Map);return n.has(t)||n.set(t,new Set),n.get(t).add(r),this}removeAttributeListener(t,r){return this.listeners?.get(t)?.delete(r)}addParams(t,r){let{params:n}=this;for(let i of r)n.has(i)?n.get(i).push(t):(n.set(i,[t]),i.addEventListener("value",()=>Promise.allSettled(n.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,r=!0){t.setPlot(this),this.legends.push({legend:t,include:r})}};function jT(e){return typeof e!="string"?!1:(e=e.toLowerCase().trim(),e==="none"||e==="currentcolor"||e.startsWith("url(")&&e.endsWith(")")||e.startsWith("var(")&&e.endsWith(")")||Vi(e)!==null)}var Lft=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 iG(e){return Lft.has(e)}var Rft=new Set(["asterisk","circle","cross","diamond","diamond2","hexagon","plus","square","square2","star","times","triangle","triangle2","wye"]);function oG(e){return Rft.has(`${e}`.toLowerCase())}function mx(e){return typeof e?.getChild=="function"}function sG(e){switch(e.typeId){case 2:case 3:case 7:return Float64Array;default:return Array}}function aG(e){let{typeId:t}=e;return t===10?r=>r==null?r:new Date(r):t===2&&e.bitWidth>=64?r=>r==null?r:Number(r):r=>r}function yx(e){let{type:t}=e,{typeId:r}=t;if(r===2&&t.bitWidth>=64){let n=e.length,i=new Float64Array(n);for(let o=0;o<n;++o){let s=e.get(o);i[o]=s==null?NaN:Number(s)}return i}return e.toArray()}function qT(e){return mx(e)?kft(e):e}function kft(e){let{batches:t,numRows:r}=e;if(!r)return[];let n=Array.from({length:r},()=>({}));for(let i=0,o=0;o<t.length;++o){let s=t[o],{schema:a,numRows:c,numCols:l}=s;for(let u=0;u<l;++u){let f=s.getChildAt(u),{name:d,type:h}=a.fields[u],p=aG(h);for(let y=i,g=0;g<c;++g,++y)n[y][d]=p(f.get(g))}i+=c}return n}var cG=e=>e==="stroke"||e==="fill",Cft=e=>e==="symbol",Uft=(e,t)=>e!=="sort"&&e!=="tip"&&t!=null&&!Array.isArray(t),bF=(e,t)=>({channel:e,field:t,as:t instanceof mi?t.column:e}),xF=(e,t)=>({channel:e,value:t}),YT=e=>Array.isArray(e),Sn=class extends ai{constructor(t,r,n,i={}){super(r?.options?.filterBy),this.type=t,this.reqs=i,this.source=r,YT(this.source)&&(this.data=this.source);let o=this.channels=[],s=this.detail=new Set,a=this.params=new Set,c=(l,u)=>{let f=typeof u;if(l==="channels")for(let d in u)s.add(d),c(d,u[d]);else if(f==="function"&&u[Rg]){let d=u(this,l);for(let h in d)c(h,d[h])}else if(f==="string")iG(l)||cG(l)&&jT(u)||Cft(l)&&oG(u)?o.push(xF(l,u)):o.push(bF(l,El(u)));else if(rc(u))if(Array.isArray(u.columns))o.push(bF(l,u)),a.add(u);else{let d=xF(l,u.value);o.push(d),u.addEventListener("value",h=>(d.value=h,this.update()))}else f==="object"&&Uft(l,u)?o.push(bF(l,u)):u!==void 0&&o.push(xF(l,u))};for(let l in n)c(l,n[l])}setPlot(t,r){this.plot=t,this.index=r,t.addParams(this,this.params),this.source?.table&&this.queryPending()}hasOwnData(){return this.source==null||YT(this.source)}channel(t){return this.channels.find(r=>r.channel===t)}channelField(...t){let r=t.flat();for(let n of r){let i=this.channel(n);if(i?.field)return i}return null}fields(){if(this.hasOwnData())return null;let{source:{table:t},channels:r,reqs:n}=this,i=new Map;for(let{channel:o,field:s}of r){let a=s?.column;if(a){if(s.stats?.length||n[o]){i.has(a)||i.set(a,new Set);let c=i.get(a);n[o]?.forEach(l=>c.add(l)),s.stats?.forEach(l=>c.add(l))}}else continue}return Array.from(i,([o,s])=>({table:t,column:o,stats:Array.from(s)}))}fieldInfo(t){return this.stats=t.reduce((r,n)=>(r[n.column]=n,r),Object.create(null)),this}query(t=[]){if(this.hasOwnData())return null;let{channels:r,source:{table:n}}=this;return _F(r,n).where(t)}queryPending(){return this.plot.pending(this),this}queryResult(t){return this.data=qT(t),this}update(){return this.plot.update(this)}plotSpecs(){let{type:t,data:r,detail:n,channels:i}=this,o={},s={};for(let a of i){let c=n.has(a.channel)?s:o;c[a.channel]=Bo(a)}return n.size&&(o.channels=s),[{type:t,data:r,options:o}]}};function Bo(e){return Object.hasOwn(e,"value")?e.value:cG(e.channel)?{value:e.as,scale:"color"}:e.as}function _F(e,t,r=[]){let n=Mt.from({source:t}),i=new Set,o=!1;for(let s of e){let{channel:a,field:c,as:l}=s;if(!r.includes(a)){if(a==="orderby")n.orderby(s.value);else if(c){if(c.aggregate)o=!0;else{if(i.has(l))continue;i.add(l)}n.select({[l]:c})}}}return o&&n.groupby(Array.from(i)),n}function Ad(e,t){let{plot:r}=e,n=r.getAttribute(`${t}Scale`);if(!n){let{field:o}=e.channelField(t,`${t}1`,`${t}2`),{type:s}=e.stats[o.column];n=s==="date"?"time":"linear"}let i={type:n};switch(n){case"log":i.base=r.getAttribute(`${t}Base`)??10;break;case"pow":i.exponent=r.getAttribute(`${t}Exponent`)??1;break;case"symlog":i.constant=r.getAttribute(`${t}Constant`)??1;break}return Fy(i)}function Qi(e,t,r,n,i=1,o){let{field:s}=e.channelField(t);o=o??s;let{type:a,apply:c,sqlApply:l}=Ad(e,t),u=!!e.plot.getAttribute(`${t}Reverse`),[f,d]=n.map(b=>c(b)),h=l(o),p=a==="time"||a==="utc"?h:o,y=d===f?0:(r-i)/(d-f),g=y!==1?` * ${y}::DOUBLE`:"";return[u?W`(${d} - ${h}::DOUBLE)${g}`:W`(${h}::DOUBLE - ${f})${g}`,p]}var wF={x:["min","max"]},vF={y:["min","max"]},WT={...wF,...vF};function lG(e,t,r,n,i){let{plot:o,stats:s}=e,a=o.getAttribute(n),c=o.getAttribute(i);if(Array.isArray(a)&&!a[pn])return a;{let{field:l}=e.channelField(r),{column:u}=l,{min:f,max:d}=s[u],h=SF(t,u)||(c?qc().domain([f,d]).nice().domain():[f,d]);return a!==Gs&&(h[pn]=!0),o.setAttribute(n,h,{silent:!0}),h}}function Ma(e,t){return lG(e,t,"x","xDomain","xNice")}function Ea(e,t){return lG(e,t,"y","yDomain","yNice")}function SF(e,t){if(!e)return;let r,n,i=(o,s)=>{if(o==="BETWEEN"&&s.field.column===t){let{range:a}=s;a&&(r==null||a[0]<r)&&(r=a[0]),a&&(n==null||a[1]>n)&&(n=a[1])}};return Array.isArray(e)?e.forEach(o=>o.visit?.(i)):e.visit&&e.visit(i),r!=null&&n!=null&&r!==n?[r,n]:void 0}var gx=class extends Sn{constructor(t,r,n){let i=t.endsWith("X")?"y":t.endsWith("Y")?"x":null,o={[i]:["min","max"]};super(t,r,n,o),this.dim=i}query(t=[]){let{plot:r,dim:n,source:i,stats:o}=this,{optimize:s=!0}=i.options||{},a=super.query(t);if(!n)return a;let c=n==="x"?"y":"x",l=this.channelField(c)?.as,{field:u,as:f}=this.channelField(n),{type:d}=o[u.column];if(s&&(d==="date"||d==="number")&&l){let{column:p}=u,{max:y,min:g}=o[p],m=n==="x"?r.innerWidth():r.innerHeight(),[b,x]=SF(t,p)||[g,y],[_]=Qi(this,n,m,[b,x],1,f),v=a.select().map(w=>w.as).filter(w=>w!==f&&w!==l);return Pft(a,_,f,l,v)}else return a.orderby(u)}};function Pft(e,t,r,n,i=[]){let o=W`FLOOR(${t})::INTEGER`,s=a=>Mt.from(e).select(a).groupby(o,i);return Mt.union(s([{[r]:ao(r),[n]:Jd(n,r)},...i]),s([{[r]:so(r),[n]:th(n,r)},...i]),s([{[r]:Jd(r,n),[n]:ao(n)},...i]),s([{[r]:th(r,n),[n]:so(n)},...i])).orderby(i,r)}function uG(e,t="density"){return mx(e)?sG(e.getChild(t).type):typeof e[0][t]=="number"?Float64Array:Array}function fG(e,t){let r=uG(t);return $ft(new r(e),t)}function $ft(e,t,r="density"){if(mx(t)){let n=t.numRows;if(n===0)return e;let i=yx(t.getChild("index")),o=yx(t.getChild(r));for(let s=0;s<n;++s)e[i[s]]=o[s]}else for(let n of t)e[n.index]=n[r];return e}function dG(e,t,r,n,i=[],o){let s=e*t,a=n.map(m=>uG(r,m)),c=n.length,l=m=>{let b={};return i.forEach((x,_)=>b[x]=m[_]),n.forEach((x,_)=>b[x]=new a[_](s)),b},u={},f=i.length?null:u[[]]=l([]),d=i.length?m=>u[m]??(u[m]=l(m)):()=>f,h=r.numRows;if(h===0)return Object.values(u);let p=yx(r.getChild("index")),y=n.map(m=>yx(r.getChild(m))),g=i.map(m=>r.getChild(m));if(o){let m=p.map(x=>x%e),b=p.map(x=>Math.floor(x/e));if(i.length)for(let x=0;x<h;++x){let _=g.map(w=>w.get(x)),v=d(_);v.index||(v.index=[]),v.index.push(x)}else f.index=p.map((x,_)=>_);Object.values(u).forEach(x=>{for(let _=0;_<c;++_)o(x.index,e,t,m,b,y[_],x[n[_]]);delete x.index})}else for(let m=0;m<h;++m){let b=g.map(_=>_.get(m)),x=d(b);for(let _=0;_<c;++_)x[n[_]][p[m]]=y[_][m]}return Object.values(u)}function bx(e,t){let r=0,n=0;return e.forEach(i=>{let o=i[t],s=o.length;for(let a=0;a<s;++a){let c=o[a];c<r&&(r=c),c>n&&(n=c)}}),r===0&&n===0?[0,1]:[r,n]}function hG(e,t){let r=new Xn;return e.forEach(n=>{let i=n[t],o=i.length;for(let s=0;s<o;++s)r.add(i[s])}),Array.from(r).sort(ie)}function In(e,t,r,n){yi(r)?(n=n||(()=>e.requestUpdate()),r.addEventListener("value",i=>(e[t]=i,n())),e[t]=r.value):e[t]=r}function xx(e,t=!1){let r=new Float64Array(5),n=new Float64Array(4);zft(r,n,e);let i=Float64Array.of(0,n[1]-r[1]*n[0],n[2]-r[2]*n[0],n[3]-r[3]*n[0],-r[4]*n[0]),o=1+r[1]+r[2]+r[3]+r[4],s=(n[0]+n[1]+n[2]+n[3])/o,a=(i[1]+i[2]+i[3]+i[4])/o;return{sigma:e,negative:t,a:r,b_causal:n,b_anticausal:i,sum_causal:s,sum_anticausal:a}}function zft(e,t,r){let i=Float64Array.of(.84,1.8675,.84,-1.8675,-.34015,-.1299,-.34015,.1299),o=Math.exp(-1.783/r),s=Math.exp(-1.723/r),a=.6318/r,c=1.997/r,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=r*2.5066282746310007,f=Float64Array.of(i[0],i[1],0,0,0,0,0,0),d=Float64Array.of(1,0,l[0],l[1],0,0,0,0,0,0),h,p;for(p=2;p<8;p+=2){for(f[p]=l[p]*f[p-2]-l[p+1]*f[p-1],f[p+1]=l[p]*f[p-1]+l[p+1]*f[p-2],h=p-2;h>0;h-=2)f[h]+=l[p]*f[h-2]-l[p+1]*f[h-1],f[h+1]+=l[p]*f[h-1]+l[p+1]*f[h-2];for(h=0;h<=p;h+=2)f[h]+=i[p]*d[h]-i[p+1]*d[h+1],f[h+1]+=i[p]*d[h+1]+i[p+1]*d[h];for(d[p+2]=l[p]*d[p]-l[p+1]*d[p+1],d[p+3]=l[p]*d[p+1]+l[p+1]*d[p],h=p;h>0;h-=2)d[h]+=l[p]*d[h-2]-l[p+1]*d[h-1],d[h+1]+=l[p]*d[h-1]+l[p+1]*d[h-2]}for(p=0;p<4;++p)h=p<<1,t[p]=f[h]/u,e[p+1]=d[h+2]}function pG(e,t,r,[n,i]){let o=new Float64Array(Math.max(n,i)),s=new Float64Array(Math.max(n,i)),a=new Float64Array(5),c=new Float64Array(r.length);for(let l=0,u=0;l<i;++l,u+=n){let f=c.subarray(u);GT(e,r.subarray(u),n,1,o,s,a,f)}for(let l=0;l<n;++l){let u=c.subarray(l);GT(t,u,i,n,o,s,a,u)}return c}function GT(e,t,r,n=1,i=new Float64Array(r),o=new Float64Array(r),s=new Float64Array(5),a=i,c=Vft){let l=n*2,u=n*3,f=n*4,d=n*r,h,p;for(c(i,t,r,n,e.b_causal,3,e.a,4,e.sum_causal,s,e.sigma),p=4,h=f;p<r;++p,h+=n)i[p]=e.b_causal[0]*t[h]+e.b_causal[1]*t[h-n]+e.b_causal[2]*t[h-l]+e.b_causal[3]*t[h-u]-e.a[1]*i[p-1]-e.a[2]*i[p-2]-e.a[3]*i[p-3]-e.a[4]*i[p-4];for(c(o,t,r,-n,e.b_anticausal,4,e.a,4,e.sum_anticausal,s,e.sigma),p=4,h=d-n*5;p<r;++p,h-=n)o[p]=e.b_anticausal[1]*t[h+n]+e.b_anticausal[2]*t[h+l]+e.b_anticausal[3]*t[h+u]+e.b_anticausal[4]*t[h+f]-e.a[1]*o[p-1]-e.a[2]*o[p-2]-e.a[3]*o[p-3]-e.a[4]*o[p-4];if(e.negative)for(p=0,h=0;p<r;++p,h+=n)a[h]=i[p]+o[r-p-1];else for(p=0,h=0;p<r;++p,h+=n)a[h]=Math.max(0,i[p]+o[r-p-1]);return a}function Vft(e,t,r,n,i,o,s,a,c,l,u,f=.5){let d=Math.abs(n)*r,h=n<0?d+n:0,p,y,g;for(y=0;y<=a;++y)for(l[y]=y<=o?i[y]:0,g=1;g<=a&&g<=y;++g)l[y]-=s[g]*l[y-g];for(g=0;g<a;++g)for(e[g]=0,y=1;y<=g;++y)p=h+n*y,p>=0&&p<d&&(e[g]+=l[g-y]*t[p]);let m=t[h],b=Math.ceil(u*10);for(y=0;y<b;++y){for(g=0;g<a;++g)e[g]+=l[g]*m;if(c-=Math.abs(l[0]),c<=f)break;for(l[a]=y+a<=o?i[y+a]:0,g=1;g<=a;++g)l[a]-=s[g]*l[a-g];for(g=0;g<a;++g)l[g]=l[g+1]}}function mG({random:e=ca(42)}={}){return(t,r,n,i,o,s,a)=>{let{points:c,triangles:l,hull:u}=On.from(t,h=>i[h],h=>o[h]),f=new Uint8Array(r*n),d=Xft(s,e);for(let h=0;h<l.length;h+=3){let p=l[h],y=l[h+1],g=l[h+2],m=c[2*p],b=c[2*y],x=c[2*g],_=c[2*p+1],v=c[2*y+1],w=c[2*g+1],I=Math.min(m,b,x),D=Math.max(m,b,x),A=Math.min(_,v,w),B=Math.max(_,v,w),M=(v-w)*(m-x)+(_-w)*(x-b);if(!M)continue;let O=s[t[p]],R=s[t[y]],S=s[t[g]];for(let T=Math.floor(I);T<D;++T)for(let E=Math.floor(A);E<B;++E){if(T<0||T>=r||E<0||E>=n)continue;let C=T+.5,U=E+.5,k=((v-w)*(C-x)+(U-w)*(x-b))/M;if(k<0)continue;let $=((w-_)*(C-x)+(U-w)*(m-x))/M;if($<0)continue;let z=1-k-$;if(z<0)continue;let V=T+r*E;a[V]=d(O,k,R,$,S,z,T,E),f[V]=1}}return jft(a,f,i,o,s,r,n,u,t,d),a}}function jft(e,t,r,n,i,o,s,a,c,l){r=Float64Array.from(a,h=>r[c[h]]),n=Float64Array.from(a,h=>n[c[h]]),i=Array.from(a,h=>i[c[h]]);let u=r.length,f=Array.from({length:u},(h,p)=>Yft(p,r,n)),d=0;for(let h=0;h<s;++h){let p=h+.5;for(let y=0;y<o;++y){let g=y+o*h;if(!t[g]){let m=y+.5;for(let b=0;b<u;++b){let x=(u+d+(b%2?(b+1)/2:-b/2))%u;if(f[x](m,p)){let _=qft(r.at(x-1),n.at(x-1),r[x],n[x],m,p);e[g]=l(i.at(x-1),_,i[x],1-_,i[x],0,y,h),d=x;break}}}}}}function qft(e,t,r,n,i,o){let s=r-e,a=n-t,c=s*(r-i)+a*(n-o),l=s*(i-e)+a*(o-t);return c>0&&l>0?c/(c+l):+(c>l)}function _x(e,t,r,n){return e*n-r*t}function Yft(e,t,r){let n=t.length,i=t.at(e-2),o=r.at(e-2),s=t.at(e-1),a=r.at(e-1),c=t[e],l=r[e],u=t.at(e+1-n),f=r.at(e+1-n),d=s-c,h=a-l,p=i-s,y=o-a,g=c-u,m=l-f,b=Math.hypot(d,h),x=Math.hypot(p,y),_=Math.hypot(g,m);return(v,w)=>{let I=v-s,D=w-a,A=v-c,B=w-l;return _x(I,D,A,B)>-1e-6&&_x(I,D,d,h)*x-_x(I,D,p,y)*b>-1e-6&&_x(A,B,g,m)*b-_x(A,B,d,h)*_<=0}}function yG(e,t,r,n,i,o,s){let a=On.from(e,u=>n[u],u=>i[u]),c,l;for(let u=.5,f=0;u<r;++u){l=c;for(let d=.5;d<t;++d,++f)l=a.find(d,u,l),d===.5&&(c=l),s[f]=o[e[l]]}return s}function gG({random:e=ca(42),minDistance:t=.5,maxSteps:r=2}={}){return(n,i,o,s,a,c,l)=>{let u=On.from(n,p=>s[p],p=>a[p]),f,d,h;for(let p=.5,y=0;p<o;++p){d=f;for(let g=.5;g<i;++g,++y){let m=g,b=p;h=d=u.find(m,b,d),g===.5&&(f=d);let x,_=0;for(;(x=Math.hypot(s[n[h]]-m,a[n[h]]-b))>t&&_<r;){let v=e(g,p,_)*2*Math.PI;m+=Math.cos(v)*x,b+=Math.sin(v)*x,h=u.find(m,b,h),++_}l[y]=c[n[h]]}}return l}}function Wft(e,t,r,n,i,o){return t*e+n*r+o*i}function Gft(e){return(t,r,n,i,o,s,a,c)=>{let l=e(a,c);return l<r?t:l<r+i?n:o}}function Xft(e,t){return Hft(e)||Zft(e)?Wft:Gft(t)}function Hft(e){for(let t of e)if(t!=null)return typeof t=="number"}function Zft(e){for(let t of e)if(t!=null)return t instanceof Date}var pl="density",ws=class extends Sn{constructor(t,r,n){let{bandwidth:i=0,interpolate:o="none",pixelSize:s=1,pad:a=1,width:c,height:l,...u}=n,f=Kft(u);super(t,r,u,WT),this.densityMap=f,In(this,"bandwidth",i,()=>this.grids?this.convolve().update():null),In(this,"pixelSize",s),In(this,"interpolate",o),In(this,"pad",a),In(this,"width",c),In(this,"height",l)}setPlot(t,r){let n=()=>{this.stats&&this.requestUpdate()};return t.addAttributeListener("domainX",n),t.addAttributeListener("domainY",n),super.setPlot(t,r)}get filterIndexable(){let t=this.plot.getAttribute("xDomain"),r=this.plot.getAttribute("yDomain");return t&&r&&!t[pn]&&!r[pn]}query(t=[]){let{interpolate:r,pad:n,channels:i,densityMap:o,source:s}=this,[a,c]=this.extentX=Ma(this,t),[l,u]=this.extentY=Ea(this,t),[f,d]=this.bins=this.binDimensions(this),[h,p]=Qi(this,"x",f,[a,c],n),[y,g]=Qi(this,"y",d,[l,u],n),m=n?[tr(p,[+a,+c]),tr(g,[+l,+u])]:[sc(+a,p),oc(p,+c),sc(+l,g),oc(g,+u)],b=Mt.from(s.table).where(t.concat(m)),x=this.groupby=[],_={};for(let w of i)if(Object.hasOwn(w,"field")){let{as:I,channel:D,field:A}=w;A.aggregate?(_[D]=A,o[D]=!0):D==="weight"?_[pl]=Ri(A):D!=="x"&&D!=="y"&&(b.select({[I]:A}),x.push(I))}let v=this.aggr=Object.keys(_);if(_.density&&v.length>1)throw new Error("Weight option can not be used with custom aggregates.");if(v.length||(v.push(pl),_.density=Li()),r==="linear"){if(v.length>1)throw new Error("Linear binning not applicable to multiple aggregates.");if(!_.density)throw new Error("Linear binning not applicable to custom aggregates.");return tdt(b,h,y,_[pl],f,x)}else return Jft(b,h,y,_,f,x)}binDimensions(){let{plot:t,pixelSize:r,width:n,height:i}=this;return[n??Math.round(t.innerWidth()/r),i??Math.round(t.innerHeight()/r)]}queryResult(t){let[r,n]=this.bins,i=Qft(this.interpolate);return this.grids=dG(r,n,t,this.aggr,this.groupby,i),this.convolve()}convolve(){let{aggr:t,bandwidth:r,bins:n,grids:i,plot:o}=this;if(this.kde=this.grids,r>0){let s=t.length===1?t[0]:t.includes(pl)?pl:null;if(!s)return console.warn("No compatible grid found for smoothing."),this;let a=o.innerWidth(),c=o.innerHeight(),[l,u]=n,f=i.some(p=>p[s].some(y=>y<0)),d=xx(r*(l-1)/a,f),h=xx(r*(u-1)/c,f);this.kde=this.grids.map(p=>{let y=pG(d,h,p[s],n);return{...p,[s]:y}})}return this}plotSpecs(){throw new Error("Unimplemented. Use a Grid2D mark subclass.")}};function Kft(e){let t={};for(let r in e)e[r]==="density"&&(delete e[r],t[r]=!0);return t}function Qft(e="none"){if(typeof e=="function")return e;switch(`${e}`.toLowerCase()){case"none":case"linear":return;case"nearest":return yG;case"barycentric":return mG();case"random-walk":return gG()}throw new Error(`invalid interpolate: ${e}`)}function Jft(e,t,r,n,i,o){return e.select({index:W`FLOOR(${t})::INTEGER + FLOOR(${r})::INTEGER * ${i}`,...n}).groupby("index",o)}function tdt(e,t,r,n,i,o){let s=n?.column?`* ${n.column}`:"",a=(d,h)=>e.clone().select({xp:t,yp:r,i:d,w:h}),c=a(W`FLOOR(xp)::INTEGER + FLOOR(yp)::INTEGER * ${i}`,W`(FLOOR(xp)::INTEGER + 1 - xp) * (FLOOR(yp)::INTEGER + 1 - yp)${s}`),l=a(W`FLOOR(xp)::INTEGER + (FLOOR(yp)::INTEGER + 1) * ${i}`,W`(FLOOR(xp)::INTEGER + 1 - xp) * (yp - FLOOR(yp)::INTEGER)${s}`),u=a(W`FLOOR(xp)::INTEGER + 1 + FLOOR(yp)::INTEGER * ${i}`,W`(xp - FLOOR(xp)::INTEGER) * (FLOOR(yp)::INTEGER + 1 - yp)${s}`),f=a(W`FLOOR(xp)::INTEGER + 1 + (FLOOR(yp)::INTEGER + 1) * ${i}`,W`(xp - FLOOR(xp)::INTEGER) * (yp - FLOOR(yp)::INTEGER)${s}`);return Mt.from(Mt.unionAll(c,l,u,f)).select({index:"i",density:Ri("w")},o).groupby("index",o).having(uf("density",0))}var wx=class extends ws{constructor(t,r){let{thresholds:n=10,...i}=r;super("geo",t,{bandwidth:20,interpolate:"linear",pixelSize:2,...i}),In(this,"thresholds",n,()=>this.grids?this.contours().update():null)}convolve(){return super.convolve().contours()}contours(){let{bins:t,densityMap:r,kde:n,thresholds:i,plot:o}=this,s=i;if(!Array.isArray(s)){let[,_]=bx(n,"density");s=Array.from({length:s-1},(v,w)=>_*(w+1)/s)}(r.fill||r.stroke)&&this.plot.getAttribute("colorScale")!=="log"&&this.plot.setAttribute("colorZero",!0);let[a,c]=t,[l,u]=o.getAttribute("xDomain"),[f,d]=o.getAttribute("yDomain"),h=(u-l)/a,p=(d-f)/c,y=+l,g=+f,m=_=>y+_*h,b=_=>g+_*p,x=ou().size(t);return this.data=n.flatMap(_=>s.map(v=>Object.assign(edt(x.contour(_.density,v),m,b),{..._,density:v}))),this}plotSpecs(){let{type:t,channels:r,densityMap:n,data:i}=this,o={};for(let s of r){let{channel:a}=s;a!=="x"&&a!=="y"&&(o[a]=Bo(s))}return n.fill&&(o.fill="density"),n.stroke&&(o.stroke="density"),[{type:t,data:i,options:o}]}};function edt(e,t,r){function n(s){s.forEach(i)}function i(s){s.forEach(o)}function o(s){s[0]=t(s[0]),s[1]=r(s[1])}return e.coordinates.forEach(n),e}function XT(e,t){if(typeof document<"u"){let r=document.createElement("canvas");return r.setAttribute("width",e),r.setAttribute("height",t),r}throw new Error("Can not create a canvas instance.")}function bG(e=1){let t=255*e|0;return(r,n,i)=>{for(let o=0,s=0;o<i;++o)for(let a=0;a<n;++a,s+=4)r[s+3]=t}}function xG(e){let{apply:t}=e;return(r,n,i,o)=>{for(let s=0,a=0;s<i;++s)for(let c=0,l=(i-s-1)*n;c<n;++c,a+=4)r[a+3]=255*t(o[c+l])|0}}function _G(e={}){let{r:t=0,g:r=0,b:n=0,opacity:i=1}=typeof e=="string"?qr(e):e,o=new Uint8ClampedArray([t,r,n,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 wG(e){let{domain:t,range:r}=e,n=Object.create(null),i=new Uint8ClampedArray(4*t.length),o=t.length-1,s=r.length;for(let a=0;a<=o;++a){let c=r[a%s],{r:l,g:u,b:f,opacity:d=1}=typeof c=="string"?qr(c):c,h=a<<2;i[h+0]=l,i[h+1]=u,i[h+2]=f,i[h+3]=255*d|0,n[t[a]]=h}return(a,c,l,u)=>{if(u.map)for(let f=0,d=0;f<l;++f)for(let h=0,p=(l-f-1)*c;h<c;++h,d+=4){let y=n[u[h+p]];a[d+0]=i[y+0],a[d+1]=i[y+1],a[d+2]=i[y+2],a[d+3]=i[y+3]}else{let f=n[u];for(let d=0,h=0;d<l;++d)for(let p=0;p<c;++p,h+=4)a[h+0]=i[f+0],a[h+1]=i[f+1],a[h+2]=i[f+2],a[h+3]=i[f+3]}}}function vG(e,t,r){let{interpolate:n}=t,i=new Uint8ClampedArray(4*e),o=e-1;for(let s=0;s<=o;++s){let a=n(s/o),{r:c,g:l,b:u,opacity:f=1}=typeof a=="string"?qr(a):a,d=s<<2;i[d+0]=c,i[d+1]=l,i[d+2]=u,i[d+3]=255*f|0}return(s,a,c,l)=>{for(let u=0,f=0;u<c;++u)for(let d=0,h=(c-u-1)*a;d<a;++d,f+=4){let p=o*r(l[d+h])<<2;s[f+0]=i[p+0],s[f+1]=i[p+1],s[f+2]=i[p+2],s[f+3]=i[p+3]}}}var Pu=class extends ws{constructor(t,r){super("image",t,r)}setPlot(t,r){let n=()=>{this.stats&&this.rasterize()};t.addAttributeListener("schemeColor",n),super.setPlot(t,r)}convolve(){return super.convolve().rasterize()}rasterize(){let{bins:t,kde:r}=this,[n,i]=t,{canvas:o,ctx:s,img:a}=odt(this,n,i),{alpha:c,alphaProp:l,color:u,colorProp:f}=IF(this);return this.data=r.map(d=>(u?.(a.data,n,i,d[f]),c?.(a.data,n,i,d[l]),s.putImageData(a,0,0),{src:o.toDataURL()})),this}plotSpecs(){let{type:t,plot:r,data:n}=this,i={src:"src",width:r.innerWidth(),height:r.innerHeight(),preserveAspectRatio:"none",imageRendering:this.channel("imageRendering")?.value,frameAnchor:"middle"};return[{type:t,data:n,options:i}]}},vx=class extends Pu{constructor(t,r){super(t,{bandwidth:20,interpolate:"linear",pixelSize:2,...r})}};function IF(e){let{aggr:t,densityMap:r,groupby:n,plot:i}=e,o=t.includes(pl),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(n.includes(c?.as))throw new Error("Raster fillOpacity must be an aggregate or constant.");let l=r.fill||t.includes("fill")?"grid":n.includes(a?.as)?"group":jT(a?.value)?a.value:o&&i.getAttribute("colorScheme")?"grid":void 0,u=r.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"?pl:null),d=c?.as??(u==="grid"?pl:null),h=l!=="grid"&&l!=="group"?_G(l):ndt(e,f),p=u!=="grid"?bG(u):rdt(e,d);return{alphaProp:d,colorProp:f,alpha:p,color:h}}function rdt(e,t){let{plot:r,kde:n}=e,i=r.getAttribute("opacityDomain"),o=i===Gs,s=i?.[pn],a=!o&&!s&&i||bx(n,t);(o||s)&&(s&&(a[pn]=!0),r.setAttribute("colorDomain",a));let c=Pp({opacity:{type:r.getAttribute("opacityScale"),domain:a,clamp:r.getAttribute("opacityClamp"),nice:r.getAttribute("opacityNice"),reverse:r.getAttribute("opacityReverse"),zero:r.getAttribute("opacityZero"),base:r.getAttribute("opacityBase"),exponent:r.getAttribute("opacityExponent"),constant:r.getAttribute("opacityConstant")}});return xG(c)}function ndt(e,t){let{plot:r,kde:n}=e,i=!n[0][t]?.map,o=i||Array.isArray(n[0][t]),s=r.getAttribute("colorDomain"),a=s===Gs,c=s?.[pn],l=!a&&!c&&s||(i?n.map(f=>f[t]).sort(ie):o?hG(n,t):bx(n,t));(a||c)&&(c&&(l[pn]=!0),r.setAttribute("colorDomain",l));let u=Pp({color:{type:r.getAttribute("colorScale"),domain:l,range:r.getAttribute("colorRange"),clamp:r.getAttribute("colorClamp"),n:r.getAttribute("colorN"),nice:r.getAttribute("colorNice"),reverse:r.getAttribute("colorReverse"),scheme:r.getAttribute("colorScheme"),interpolate:r.getAttribute("colorInterpolate"),pivot:r.getAttribute("colorPivot"),symmetric:r.getAttribute("colorSymmetric"),zero:r.getAttribute("colorZero"),base:r.getAttribute("colorBase"),exponent:r.getAttribute("colorExponent"),constant:r.getAttribute("colorConstant")}});if(o)return wG(u);{let f=Pp({x:{type:idt(u.type),domain:u.domain,reverse:u.reverse,range:[0,1],clamp:u.clamp,base:u.base,exponent:u.exponent,constant:u.constant}});return vG(1024,u,f.apply)}}function idt(e){return e.endsWith("symlog")?"symlog":e.endsWith("log")?"log":e.endsWith("pow")?"pow":e.endsWith("sqrt")?"sqrt":e==="diverging"?"linear":e}function odt(e,t,r){if(!e.image||e.image.w!==t||e.image.h!==r){let n=XT(t,r),i=n.getContext("2d",{willReadFrequently:!0}),o=i.getImageData(0,0,t,r);e.image={canvas:n,ctx:i,img:o,w:t,h:r}}return e.image}var Sx=class extends Pu{constructor(t,r){let{normalize:n=!0,...i}=r;super(t,i),In(this,"normalize",n)}query(t=[]){let{channels:r,normalize:n,source:i,binPad:o}=this,[s,a]=this.bins=this.binDimensions(this),[c]=Qi(this,"x",s,Ma(this,t),o),[l]=Qi(this,"y",a,Ea(this,t),o),u=Mt.from(i.table).where(sdt(this,t));this.aggr=["density"];let f=this.groupby=[],d=[];for(let h of r)if(Object.hasOwn(h,"field")){let{channel:p,field:y}=h;p==="z"?(u.select({[p]:y}),d.push("z")):p!=="x"&&p!=="y"&&(u.select({[p]:y}),f.push(p))}return adt(u,c,l,d,s,a,f,n)}};function sdt(e,t){if(Array.isArray(t)&&!t.length)return t;let r=e.channelField("x").field.column,n=e.channelField("y").field.column,i=s=>s.op!=="BETWEEN"||s.field.column!==r&&s.field.column!==n,o=s=>s.op==="AND"?$n(s.children.filter(a=>i(a))):s;return Array.isArray(t)?t.filter(s=>i(s)).map(s=>o(s)):o(t)}function adt(e,t,r,n,i,o,s=[],a=!0){e.select({x:W`FLOOR(${t})::INTEGER`,y:W`FLOOR(${r})::INTEGER`});let c=s.concat(n),l=c.length?`PARTITION BY ${c.join(", ")} `:"",u=Mt.from(e).select(c,{x0:"x",y0:"y",dx:W`(lead(x) OVER sw - x)`,dy:W`(lead(y) OVER sw - y)`}).window({sw:W`${l}ORDER BY x ASC`}).qualify($n(W`(x0 < ${i} OR x0 + dx < ${i})`,W`(y0 < ${o} OR y0 + dy < ${o})`,W`(x0 > 0 OR x0 + dx > 0)`,W`(y0 > 0 OR y0 + dy > 0)`)),f=Mt.select({x:W`GREATEST(MAX(ABS(dx)), MAX(ABS(dy)))`}).from("pairs"),d=Mt.select({i:W`UNNEST(range((${f})))::INTEGER`}),h=Mt.unionAll(Mt.select(c,{x:W`x0 + i`,y:W`y0 + ROUND(i * dy / dx::FLOAT)::INTEGER`}).from("pairs","indices").where(W`ABS(dy) <= ABS(dx) AND i < ABS(dx)`),Mt.select(c,{x:W`x0 + ROUND(SIGN(dy) * i * dx / dy::FLOAT)::INTEGER`,y:W`y0 + SIGN(dy) * i`}).from("pairs","indices").where(W`ABS(dy) > ABS(dx) AND i < ABS(dy)`),Mt.select(c,{x:"x0",y:"y0"}).from("pairs").where(lf("dx"))),p=["x"].concat(c).join(", "),y=Mt.from("raster").select(c,"x","y",a?{w:W`1.0 / COUNT(*) OVER (PARTITION BY ${p})`}:null).where($n(tr("x",[0,i],!0),tr("y",[0,o],!0)));return Mt.with({pairs:u,indices:d,raster:h,points:y}).from("points").select(s,{index:W`x + y * ${i}::INTEGER`,density:a?Ri("w"):Li()}).groupby("index",s)}var ym=class extends Sn{constructor(t,r,n){let{bins:i=1024,bandwidth:o=20,...s}=n,a=t.endsWith("X")?"y":"x";super(t,r,s,a==="x"?wF:vF),this.dim=a,In(this,"bins",i),In(this,"bandwidth",o,()=>this.grid?this.convolve().update():null)}get filterIndexable(){let t=this.dim==="x"?"xDomain":"yDomain",r=this.plot.getAttribute(t);return r&&!r[pn]}query(t=[]){if(this.hasOwnData())throw new Error("Density1DMark requires a data source");let{bins:r,channels:n,dim:i,source:{table:o}}=this,s=this.extent=(i==="x"?Ma:Ea)(this,t),[a,c]=Qi(this,i,r,s),l=_F(n,o,[i]).where(t.concat(tr(c,s))),u=this.channelField("weight")?"weight":null;return cdt(l,a,u)}queryResult(t){return this.grid=fG(this.bins,t),this.convolve()}convolve(){let{bins:t,bandwidth:r,dim:n,grid:i,plot:o,extent:[s,a]}=this,c=i.some(b=>b<0),l=n==="x"?o.innerWidth():o.innerHeight(),u=xx(r*(t-1)/l,c),f=GT(u,i,t),d=this.data=[],h=n==="x"?"y":"x",p=this.channelField(n).as,y=+s,g=(a-y)/(t-1),m=1/g;for(let b=0;b<t;++b)d.push({[p]:y+b*g,[h]:f[b]*m});return this}plotSpecs(){let{type:t,data:r,channels:n,dim:i}=this,o=i==="x"?{y:"y"}:{x:"x"};for(let s of n)o[s.channel]=Bo(s);return[{type:t,data:r,options:o}]}};function cdt(e,t,r){let n=r?`* ${r}`:"",i=e.clone().select({p:t,i:W`FLOOR(p)::INTEGER`,w:W`(FLOOR(p) + 1 - p)${n}`}),o=e.clone().select({p:t,i:W`FLOOR(p)::INTEGER + 1`,w:W`(p - FLOOR(p))${n}`});return Mt.from(Mt.unionAll(i,o)).select({index:"i",density:Ri("w")}).groupby("index").having(My("density",0))}var Ix=class extends ws{constructor(t,r){let{type:n="dot",...i}=r;super(n,t,{bandwidth:20,interpolate:"linear",pad:0,pixelSize:2,...i})}convolve(){super.convolve();let{bins:t,pad:r,extentX:n,extentY:i}=this,[o,s]=t,a=Ad(this,"x"),c=Ad(this,"y"),[l,u]=n.map(g=>a.apply(g)),[f,d]=i.map(g=>c.apply(g)),h=(u-l)/(o-r),p=(d-f)/(s-r),y=r?0:.5;return this.data=ldt(this.kde,t,l,f,h,p,a.invert,c.invert,y),this}plotSpecs(){let{type:t,channels:r,densityMap:n,data:i}=this,o={};for(let s of r){let{channel:a}=s;o[a]=a==="x"||a==="y"?a:Bo(s)}for(let s in n)n[s]&&(o[s]="density");return[{type:t,data:i,options:o}]}};function ldt(e,t,r,n,i,o,s,a,c){let l=1/(i*o),[u,f]=t,d=[];for(let h of e){let p=h.density;for(let y=0,g=0;g<f;++g)for(let m=0;m<u;++m,++y)d.push({...h,x:s(r+(m+c)*i),y:a(n+(g+c)*o),density:p[y]*l})}return d}var udt="geom",Tx=class extends Sn{constructor(t,r={},n){!YT(t)&&!r?.geometry&&(r.geometry=Oy(udt)),super("geo",t,r,n)}queryResult(t){super.queryResult(t);let r=this.channelField("geometry")?.as;return r&&this.data&&this.data.forEach(n=>{typeof n[r]=="string"&&(n[r]=JSON.parse(n[r]))}),this}};var Ax=class extends Sn{constructor(t,r){let{type:n="hexagon",binWidth:i=20,...o}=r;super(n,t,{r:i/2,clip:!0,...o},WT),this.binWidth=i}get filterIndexable(){let t=this.plot.getAttribute("xDomain"),r=this.plot.getAttribute("yDomain");return t&&r&&!t[pn]&&!r[pn]}query(t=[]){if(this.hasOwnData())return null;let{plot:r,binWidth:n,channels:i,source:o}=this,[s,a]=Ma(this,t),[c,l]=Ea(this,t),u=.5-r.getAttribute("marginLeft"),f=0-r.getAttribute("marginTop"),d=`${n}::DOUBLE`,h=`${n*(1.5/Math.sqrt(3))}::DOUBLE`,p=`${r.innerWidth()/(a-s)}::DOUBLE`,y=`${r.innerHeight()/(l-c)}::DOUBLE`,g,m,b=new Set,x={};for(let D of i)D.channel==="orderby"?_.orderby(D.value):D.channel==="x"?g=D:D.channel==="y"?m=D:Object.hasOwn(D,"field")&&(x[D.as]=D.field,D.field.aggregate&&D.field.columns.forEach(A=>b.add(A)));let _=Mt.select({[g.as]:W`${s}::DOUBLE + ((x + 0.5 * (y & 1)) * ${d} + ${u})::DOUBLE / ${p}`,[m.as]:W`${l}::DOUBLE - (y * ${h} + ${f})::DOUBLE / ${y}`,...x}).groupby("x","y"),v=`${p} * (${g.field} - ${s}::DOUBLE)`,w=`${y} * (${l}::DOUBLE - ${m.field})`,I=Mt.select({py:W`(${w} - ${f}) / ${h}`,pj:W`ROUND(py)::INTEGER`,px:W`(${v} - ${u}) / ${d} - 0.5 * (pj & 1)`,pi:W`ROUND(px)::INTEGER`,tt:W`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:W`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:W`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(nc(g.field),nc(m.field),t);return _.from(I)}};var Mx=class extends ws{constructor(t,r){let{origin:n=[0,0],dim:i="xy",...o}=r;super("image",t,o),this.origin=n,this.tileX=i.toLowerCase().includes("x"),this.tileY=i.toLowerCase().includes("y")}setPlot(t,r){let n=()=>{this.stats&&this.rasterize()};t.addAttributeListener("schemeColor",n),super.setPlot(t,r)}requestQuery(){return this.requestTiles()}query(t=[]){return this._filter=t,null}tileQuery(t){let{binType:r,binPad:n,channels:i,densityMap:o,source:s}=this,[[a,c],[l,u]]=t,[f,d]=this.bins,[h,p]=Qi(this,"x",f,[a,c],n),[y,g]=Qi(this,"y",d,[l,u],n),m=n?[tr(p,[+a,+c]),tr(g,[+l,+u])]:[sc(+a,p),oc(p,+c),sc(+l,g),oc(g,+u)],b=Mt.from(s.table).where(m),x=this.groupby=[],_={};for(let w of i)if(Object.hasOwn(w,"field")){let{as:I,channel:D,field:A}=w;A.aggregate?(_[D]=A,o[D]=!0):D==="weight"?_.density=Ri(A):D!=="x"&&D!=="y"&&(b.select({[I]:A}),x.push(I))}let v=this.aggr=Object.keys(_);if(_.density&&v.length>1)throw new Error("Weight option can not be used with custom aggregates.");if(v.length||(v.push("density"),_.density=Li()),r==="linear"){if(v.length>1)throw new Error("Linear binning not applicable to multiple aggregates.");if(!_.density)throw new Error("Linear binning not applicable to custom aggregates.");return mdt(b,h,y,_.density,f,x)}else return pdt(b,h,y,_,f,x)}async requestTiles(){let t=co();this.prefetch&&t.cancel(this.prefetch);let{binPad:r,tileX:n,tileY:i,origin:[o,s]}=this,[a,c]=this.bins=this.binDimensions(this),[l,u]=Ma(this,this._filter),[f,d]=Ea(this,this._filter),h=u-l,p=d-f,y=Math.floor((l-o)*(a-r)/h),g=Math.floor((f-s)*(c-r)/p),m=(B,M)=>[[o+B*h,o+(B+1)*h],[s+M*p,s+(M+1)*p]],b=Math.floor((l-o)/h),x=n?SG((u-o)/h):b,_=Math.floor((f-s)/p),v=i?SG((d-s)/p):_,w=[];for(let B=b;B<=x;++B)for(let M=_;M<=v;++M)w.push([B,M]);let I=w.map(([B,M])=>t.query(this.tileQuery(m(B,M)))),D=[];if(n)for(let B=_;B<=v;++B)D.push([x+1,B]),D.push([b-1,B]);if(i){let B=n?b-1:b,M=n?x+1:x;for(let O=B;O<=M;++O)D.push([O,v+1]),D.push([O,_-1])}this.prefetch=D.map(([B,M])=>t.prefetch(this.tileQuery(m(B,M))));let A=await Promise.all(I);this.grids=[{density:fdt(a,c,y,g,w,A)}],this.convolve().update()}convolve(){return super.convolve().rasterize()}rasterize(){let{bins:t,kde:r}=this,[n,i]=t,{canvas:o,ctx:s,img:a}=hdt(this,n,i),{alpha:c,alphaProp:l,color:u,colorProp:f}=IF(this);return this.data=r.map(d=>(u?.(a.data,n,i,d[f]),c?.(a.data,n,i,d[l]),s.putImageData(a,0,0),{src:o.toDataURL()})),this}plotSpecs(){let{type:t,data:r,plot:n}=this,i={src:"src",width:n.innerWidth(),height:n.innerHeight(),preserveAspectRatio:"none",imageRendering:this.channel("imageRendering")?.value,frameAnchor:"middle"};return[{type:t,data:r,options:i}]}};function fdt(e,t,r,n,i,o){let s=new Float64Array(e*t);return o.forEach((a,c)=>{let[l,u]=i[c],f=l*e-r,d=u*t-n;ddt(e,t,s,a,f,d)}),s}function ddt(e,t,r,n,i,o){let s=n.numRows;if(s===0)return;let a=n.getChild("index").toArray(),c=n.getChild("density").toArray();for(let l=0;l<s;++l){let u=a[l],f=i+u%e,d=o+Math.floor(u/e);0<=f&&f<e&&0<=d&&d<t&&(r[f+d*e]=c[l])}}function hdt(e,t,r){if(!e.image||e.image.w!==t||e.image.h!==r){let n=XT(t,r),i=n.getContext("2d",{willReadFrequently:!0}),o=i.getImageData(0,0,t,r);e.image={canvas:n,ctx:i,img:o,w:t,h:r}}return e.image}function pdt(e,t,r,n,i,o){return e.select({index:W`FLOOR(${t})::INTEGER + FLOOR(${r})::INTEGER * ${i}`,...n}).groupby("index",o)}function mdt(e,t,r,n,i,o){let s=n.column?`* ${n.column}`:"",a=(d,h)=>e.clone().select({xp:t,yp:r,i:d,w:h}),c=a(W`FLOOR(xp)::INTEGER + FLOOR(yp)::INTEGER * ${i}`,W`(FLOOR(xp)::INTEGER + 1 - xp) * (FLOOR(yp)::INTEGER + 1 - yp)${s}`),l=a(W`FLOOR(xp)::INTEGER + (FLOOR(yp)::INTEGER + 1) * ${i}`,W`(FLOOR(xp)::INTEGER + 1 - xp) * (yp - FLOOR(yp)::INTEGER)${s}`),u=a(W`FLOOR(xp)::INTEGER + 1 + FLOOR(yp)::INTEGER * ${i}`,W`(xp - FLOOR(xp)::INTEGER) * (FLOOR(yp)::INTEGER + 1 - yp)${s}`),f=a(W`FLOOR(xp)::INTEGER + 1 + (FLOOR(yp)::INTEGER + 1) * ${i}`,W`(xp - FLOOR(xp)::INTEGER) * (yp - FLOOR(yp)::INTEGER)${s}`);return Mt.from(Mt.unionAll(c,l,u,f)).select({index:"i",density:Ri("w")},o).groupby("index",o).having(uf("density",0))}function SG(e){let t=Math.floor(e);return t===e?t-1:t}function ydt(e,t,r){var n=1e-8,i=t-1,o=r-1,s=0,a,c,l,u,f,d,h,p,y,g,m;if(e<=0)return 0;if(e>=1)return 1;for(t>=1&&r>=1?(l=e<.5?e:1-e,u=Math.sqrt(-2*Math.log(l)),h=(2.30753+u*.27061)/(1+u*(.99229+u*.04481))-u,e<.5&&(h=-h),p=(h*h-3)/6,y=2/(1/(2*t-1)+1/(2*r-1)),g=h*Math.sqrt(p+y)/y-(1/(2*r-1)-1/(2*t-1))*(p+5/6-2/(3*y)),h=t/(t+r*Math.exp(2*g))):(a=Math.log(t/(t+r)),c=Math.log(r/(t+r)),u=Math.exp(t*a)/t,f=Math.exp(r*c)/r,g=u+f,e<u/g?h=Math.pow(t*g*e,1/t):h=1-Math.pow(r*g*(1-e),1/r)),m=-gm(t)-gm(r)+gm(t+r);s<10;s++){if(h===0||h===1)return h;if(d=gdt(h,t,r)-e,u=Math.exp(i*Math.log(h)+o*Math.log(1-h)+m),f=d/u,h-=u=f/(1-.5*Math.min(1,f*(i/h-o/(1-h)))),h<=0&&(h=.5*(h+u)),h>=1&&(h=.5*(h+u+1)),Math.abs(u)<n*h&&s>0)break}return h}function gdt(e,t,r){var n=e===0||e===1?0:Math.exp(gm(t+r)-gm(t)-gm(r)+t*Math.log(e)+r*Math.log(1-e));return e<0||e>1?!1:e<(t+1)/(t+r+2)?n*IG(e,t,r)/t:1-n*IG(1-e,r,t)/r}function IG(e,t,r){var n=1e-30,i=1,o=t+r,s=t+1,a=t-1,c=1,l=1-o*e/s,u,f,d,h;for(Math.abs(l)<n&&(l=n),l=1/l,h=l;i<=100&&(u=2*i,f=i*(r-i)*e/((a+u)*(t+u)),l=1+f*l,Math.abs(l)<n&&(l=n),c=1+f/c,Math.abs(c)<n&&(c=n),l=1/l,h*=l*c,f=-(t+i)*(o+i)*e/((t+u)*(s+u)),l=1+f*l,Math.abs(l)<n&&(l=n),c=1+f/c,Math.abs(c)<n&&(c=n),l=1/l,d=l*c,h*=d,!(Math.abs(d-1)<3e-7));i++);return h}function gm(e){var t=0,r=[76.18009172947146,-86.5053203294167,24.01409824083091,-1.231739572450155,.001208650973866179,-5395239384953e-18],n=1.000000000190015,i,o,s;for(s=(o=i=e)+5.5,s-=(i+.5)*Math.log(s);t<6;t++)n+=r[t]/++o;return Math.log(2.506628274631*n/i)-s}function TG(e,t){var r=ydt(2*Math.min(e,1-e),.5*t,.5);return r=Math.sqrt(t*(1-r)/r),e>.5?r:-r}var Ex=class extends Sn{constructor(t,r){let{ci:n=.95,precision:i=4,...o}=r;super("line",t,o);let s=()=>this.modelFit?this.confidenceBand().update():null;In(this,"ci",n,s),In(this,"precision",i,s)}query(t=[]){let r=this.channelField("x").as,n=this.channelField("y").as,i=Array.from(new Set(["stroke","z","fx","fy"].flatMap(o=>this.channelField(o)?.as||[])));return Mt.from(super.query(t)).select({intercept:PM(n,r),slope:$M(n,r),n:zM(n,r),ssy:VM(n,r),ssx:jM(n,r),xm:qM(n,r),x0:eh(ao(r).where(nc(n))),x1:eh(so(r).where(nc(n)))}).select(i).groupby(i)}queryResult(t){return this.modelFit=qT(t),this.lineData=this.modelFit.flatMap(r=>bdt(r)),this.confidenceBand()}confidenceBand(){let{ci:t,modelFit:r,precision:n,plot:i}=this,o=i.innerWidth();return this.areaData=t?r.flatMap(s=>xdt(t,n,s,o)):null,this}plotSpecs(){let{lineData:t,areaData:r,channels:n,ci:i}=this,o={x:"x",y:"y"},s={x:"x",y1:"y1",y2:"y2",fillOpacity:.1};for(let a of n)switch(a.channel){case"x":case"y":case"fill":break;case"stroke":o.stroke=s.fill=Bo(a);break;case"strokeOpacity":o.strokeOpacity=Bo(a);break;case"fillOpacity":s.fillOpacity=Bo(a);break;default:o[a.channel]=s[a.channel]=Bo(a);break}return[...i?[{type:"areaY",data:r,options:s}]:[],{type:"line",data:t,options:o}]}};function bdt(e){let{x0:t,x1:r,xm:n,intercept:i,slope:o,n:s,ssx:a,ssy:c,...l}=e;return[{x:t,y:i+t*o,...l},{x:r,y:i+r*o,...l}]}function xdt(e,t,r,n){let{x0:i,x1:o,xm:s,intercept:a,slope:c,n:l,ssx:u,ssy:f,...d}=r,h=t*(o-i)/n,p=TG((1-e)/2,l-2)*Math.sqrt(f/(l-2));return _r(i,o-h/2,h).concat(o).map(y=>{let g=a+y*c,m=p*Math.sqrt(1/l+(y-s)**2/u);return{x:y,y1:g-m,y2:g+m,...d}})}function AG(e){let t=e.toLowerCase(),r=e.length,n="";for(let i=0;i<r;++i)n+=(e[i]!==t[i]?"-":"")+t[i];return n}function bm(e){let t={};for(let r in e)t[AG(r)]=e[r];return t}function _dt(e){let{channels:t}=e,r=new Set,n=!1,i=!1;for(let o of t){let{channel:s,field:a,as:c}=o;if(s==="orderby")n=!0;else if(a)if(a.aggregate)i=!0;else{if(r.has(c))continue;r.add(c)}}return!n&&i&&r.size&&e.channels.push({channel:"orderby",value:Array.from(r)}),e}var Dx=class{constructor(t,{selection:r,channels:n={}}){this.mark=_dt(t),this.selection=r;let i=Object.entries(bm(n));this.channels=i.length?i:[["opacity",.2]],this.selection.addEventListener("value",Tm(()=>this.update()))}init(t){this.svg=t;let r=this.values=[],n=this.mark.index,i=this.nodes=t.querySelectorAll(`[data-index="${n}"] > *`),{channels:o}=this;for(let s=0;s<i.length;++s){let a=i[s];r.push(o.map(c=>a.getAttribute(c[0])))}return this.update()}async update(){let{svg:t,nodes:r,channels:n,values:i,mark:o,selection:s}=this;if(!t)return;let a=await wdt(o,s);for(let c=0;c<r.length;++c){let l=r[c],u=i[c],f=a(l.__data__);for(let d=0;d<n.length;++d){let[h,p]=n[d];l.setAttribute(h,f?u[d]:p)}}}};async function wdt(e,t){let r=t?.predicate(e);if(!r||r.length===0)return()=>!0;let n=e.filterBy?.predicate(e,!0),i={__:$n(r)},o=e.query(n),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 TF(e){let t=e.on,r=!0;function n(i){r=!1,i(),r=!0}return e.reset=(...i)=>{n(()=>e.clear(...i))},e.moveSilent=(...i)=>{n(()=>e.move(...i))},e.on=(...i)=>{if(i.length>1&&i[1]){let o=i[1];i[1]=(...s)=>r&&o(...s)}return t(...i)},e}function MG(){return TF(nB())}function EG(){return TF(eB())}function DG(){return TF(rB())}function Bx(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 Da(e,t){let r=e.channelField(t)?.field;return r?.basis||r}function Ox(e,t,r=1){return t.invert(r*Math.floor(e/r))}function HT(){let e=this,t=e.getScreenCTM,r;e.getScreenCTM=()=>e.isConnected?r=t.call(e):r}var xm=class{constructor(t,{channel:r,selection:n,field:i,pixelSize:o=1,peers:s=!0,brush:a}){this.mark=t,this.channel=r,this.pixelSize=o||1,this.selection=n,this.peers=s,this.field=i||Da(t,[r,r+"1",r+"2"]),this.style=a&&bm(a),this.brush=r==="y"?DG():EG(),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 r;t&&(r=t.map(n=>Ox(n,this.scale,this.pixelSize)).sort((n,i)=>n-i)),Bx(r,this.value)||(this.value=r,this.g.call(this.brush.moveSilent,t),this.selection.update(this.clause(r)))}clause(t){let{mark:r,pixelSize:n,field:i,scale:o}=this;return{source:this,schema:{type:"interval",pixelSize:n,scales:[o]},clients:this.peers?r.plot.markSet:new Set().add(r),value:t,predicate:t?tr(i,t):null}}init(t){let{brush:r,channel:n,style:i}=this;this.scale=t.scale(n);let o=t.scale("x").range,s=t.scale("y").range;r.extent([[Oe(o),Oe(s)],[de(o),de(s)]]);let a=ae(t).selectAll('g[aria-label="facet"]'),c=a.size()?a:ae(t);if(this.g=c.append("g").attr("class",`interval-${n}`).each(HT).call(r).call(r.moveSilent,this.value?.map(this.scale.apply)),i){let l=this.g.selectAll("rect.selection");for(let u in i)l.attr(u,i[u])}t.addEventListener("pointerenter",()=>this.activate())}};var ZT=(e,t)=>e-t,Nx=class{constructor(t,{selection:r,xfield:n,yfield:i,pixelSize:o=1,peers:s=!0,brush:a}){this.mark=t,this.pixelSize=o||1,this.selection=r,this.peers=s,this.xfield=n||Da(t,["x","x1","x2"]),this.yfield=i||Da(t,["y","y1","y2"]),this.style=a&&bm(a),this.brush=MG(),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:r,pixelSize:n,xscale:i,yscale:o}=this,s,a;if(t){let[c,l]=t;s=[c[0],l[0]].map(u=>Ox(u,i,n)).sort(ZT),a=[c[1],l[1]].map(u=>Ox(u,o,n)).sort(ZT)}(!Bx(s,r?.[0])||!Bx(a,r?.[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:r,pixelSize:n,xfield:i,yfield:o,xscale:s,yscale:a}=this;return{source:this,schema:{type:"interval",pixelSize:n,scales:[s,a]},clients:this.peers?r.plot.markSet:new Set().add(r),value:t,predicate:t?$n(tr(i,t[0]),tr(o,t[1])):null}}init(t){let{brush:r,style:n}=this,i=this.xscale=t.scale("x"),o=this.yscale=t.scale("y"),s=i.range,a=o.range;r.extent([[Oe(s),Oe(a)],[de(s),de(a)]]);let c=ae(t).selectAll('g[aria-label="facet"]'),l=c.size()?c:ae(t);if(this.g=l.append("g").attr("class","interval-xy").each(HT).call(r),n){let u=this.g.selectAll("rect.selection");for(let f in n)u.attr(f,n[f])}if(this.value){let[u,f]=this.value[0].map(i.apply).sort(ZT),[d,h]=this.value[1].map(o.apply).sort(ZT);this.g.call(r.moveSilent,[[u,d],[f,h]])}t.addEventListener("pointerenter",()=>this.activate())}};var _m=class{constructor(t,{selection:r,channel:n,field:i}){this.mark=t,this.selection=r,this.clients=new Set().add(t),this.channel=n,this.field=i||Da(t,[n])}clause(t){let{clients:r,field:n}=this,i=t?ic(n,Fi(t)):null;return{source:this,schema:{type:"point"},clients:r,value:t,predicate:i}}init(t){let r=this,{mark:n,channel:i,selection:o}=this,{data:s}=n,a=n.channelField(i).as,c=ae(t).selectAll('g[aria-label="facet"]'),l=c.size()?c:ae(t),u=t.scale(i),f=!lo(o);l.on("pointerdown pointermove",function(d){let[h,p]=Mn(d,this),y=vdt(s,a,u.invert(i==="x"?h:p));o.update(f?y:r.clause(y))}),!f&&t.addEventListener("pointerenter",()=>{this.selection.activate(this.clause(0))})}};function vdt(e,t,r){let n=1/0,i;return e.forEach(o=>{let s=Math.abs(o[t]-r);s<n&&(n=s,i=o[t])}),i}var BG=(e,t)=>e-t,Fx=class{constructor(t,{x:r=new ac,y:n=new ac,xfield:i,yfield:o,zoom:s=!0,panx:a=!0,pany:c=!0}){this.mark=t,this.xsel=r,this.ysel=n,this.xfield=i||Da(t,["x","x1","x2"]),this.yfield=o||Da(t,["y","y1","y2"]),this.zoom=AF(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 r=Sdt(t,this.xscale);this.xsel.update(this.clause(r,this.xfield,this.xscale))}if(this.pany){let r=Idt(t,this.yscale);this.ysel.update(this.clause(r,this.yfield,this.yscale))}}clause(t,r,n){return{source:this,schema:{type:"interval",scales:[n]},clients:this.mark.plot.markSet,value:t,predicate:t?tr(r,t):null}}init(t){if(this.svg=t,this.initialized)return;this.initialized=!0;let{panx:r,pany:n,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(BG),c=this.yscale.range.slice().sort(BG),l=AF(r,[-1/0,1/0],a),u=AF(n,[-1/0,1/0],c),f=xN().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 Gi(1,0,0)).on("zoom",({transform:d})=>this.publish(d));if(ae(i).call(f),r||n){let d=!1;i.addEventListener("mouseenter",()=>{if(!d){if(d=!0,r){let{xscale:h,xfield:p}=this;o.activate(this.clause(h.domain,p,h))}if(n){let{yscale:h,yfield:p}=this;s.activate(this.clause(h.domain,p,h))}}}),i.addEventListener("mouseleave",()=>d=!1)}}};function AF(e,t,r){return e?Array.isArray(e)?e:t:r}function Sdt(e,t){return t.range.map(e.invertX,e).map(t.invert,t)}function Idt(e,t){return t.range.map(e.invertY,e).map(t.invert,t)}var Md=class{constructor(t,{selection:r,channels:n,peers:i=!0}){this.value=null,this.mark=t,this.selection=r,this.peers=i,this.channels=n.map(o=>{let s=o==="color"?["fill","stroke"]:o==="x"?["x","x1","x2"]:o==="y"?["y","y1","y2"]:[o];for(let a=0;a<s.length;++a){let c=t.channelField(s[a]);if(c)return{field:c.field?.basis||c.field,as:c.as}}throw new Error(`Missing channel: ${o}`)})}clause(t){let{channels:r,mark:n}=this,i=null;if(t){let o=t.map(s=>{let a=s.map((c,l)=>Ey(r[l].field,Fi(c)));return a.length>1?$n(a):a[0]});i=o.length>1?cf(o):o[0]}return{source:this,schema:{type:"point"},clients:this.peers?n.plot.markSet:new Set().add(n),value:t,predicate:i}}init(t,r,n){let{mark:i,channels:o,selection:s}=this,{data:a}=i;n=n||(l=>{let u=a[l.__data__];return o.map(f=>u[f.as])}),r=r||`[data-index="${i.index}"]`;let c=new Set(t.querySelectorAll(r));t.addEventListener("pointerdown",l=>{let u=s.single?s.value:this.value,f=l.target,d=null;if(Tdt(c,f)){let h=n(f);l.shiftKey&&u?.length?(d=u.filter(p=>MF(p,h)),d.length===u.length&&d.push(h)):u?.length===1&&!MF(u[0],h)?d=null:d=[h]}this.value=d,Adt(u,d)&&s.update(this.clause(d))}),t.addEventListener("pointerenter",()=>{this.selection.activate(this.clause([this.channels.map(()=>0)]))})}};function Tdt(e,t){return e.has(t)||e.has(t.parentNode)||e.has(t.parentNode?.parentNode)}function Adt(e,t){return e==null||t==null?e!=null||t!=null:e.length!==t.length||e.some((r,n)=>MF(r,t[n]))}function MF(e,t){let r=e.length;if(t.length!==r)return!0;for(let n=0;n<r;++n)if(e[n]!==t[n])return!0;return!1}var wm=class{constructor(t,r){let{as:n,...i}=r;this.channel=t,this.options={label:null,...i},this.selection=n,this.element=document.createElement("div"),this.element.setAttribute("class","legend"),this.element.value=this}setPlot(t){let{channel:r,selection:n}=this,i=Mdt(t,r);this.selection&&i&&(this.handler=new Md(i,{selection:n,channels:[r]}),this.selection.addEventListener("value",()=>this.update()))}init(t){let{channel:r,options:n,handler:i}=this,s=t.scale(r).type==="ordinal"?n:{marginTop:1,tickSize:2,height:28,...n};return this.legend=t.legend(r,s),i&&(i.init(this.legend,":scope > div",a=>[a.__data__]),this.update()),this.element.replaceChildren(this.legend),this.element}update(){if(!this.legend)return;let{value:t}=this.selection,r=t&&t.length?new Set(t.map(i=>i[0])):null,n=this.legend.querySelectorAll(":scope > div");for(let i of n){let o=r?r.has(i.__data__):!0;i.style.opacity=o?1:.2}}};function Mdt({marks:e},t){let r=t==="color"?["fill","stroke"]:t==="opacity"?["opacity","fillOpacity","strokeOpacity"]:null;if(r==null)return null;for(let n=e.length-1;n>-1;--n)if(e[n].channelField(r))return e[n];return null}var Edt=new Set(["rectY-x","rectX-y","rect-x","rect-y"]);function KT(e,t={steps:25}){let r=(n,i)=>Edt.has(`${n.type}-${i}`)?{[`${i}1`]:EF(n,i,e,t),[`${i}2`]:EF(n,i,e,{...t,offset:1})}:{[i]:EF(n,i,e,t)};return r[Rg]=!0,r}function EF(e,t,r,n){return{column:r,label:r,get stats(){return["min","max"]},get columns(){return[r]},get basis(){return r},toString(){let{apply:i,sqlApply:o,sqlInvert:s}=Ad(e,t),{min:a,max:c}=e.stats[r],l=Ddt(i(a),i(c),n),u=o(r),f=l.min===0?u:`(${u} - ${l.min})`,d=`${(l.max-l.min)/l.steps}::DOUBLE`,h=n.offset?`${n.offset} + `:"",p=`${l.min} + ${d} * (${h}FLOOR(${f} / ${d}))`;return`${s(p)}`}}}function Ddt(e,t,r){let{steps:n=25,minstep:i=0,nice:o=!0}=r;if(o!==!1){let s=t-e,a=n,c=Math.LN10,l=Math.ceil(Math.log(a)/c),u=Math.max(i,Math.pow(10,Math.round(Math.log(s)/c)-l));for(;Math.ceil(s/u)>a;)u*=10;let f=[5,2],d;for(let y=0,g=f.length;y<g;++y)d=u/f[y],d>=i&&s/d<=a&&(u=d);d=Math.log(u);let h=d>=0?0:~~(-d/c)+1,p=Math.pow(10,-h-1);d=Math.floor(e/u+p)*u,e=e<d?d-u:d,t=Math.ceil(t/u)*u,n=Math.round((t-e)/u)}return{min:e,max:t,steps:n}}var Bdt=e=>e&&typeof e=="object"&&!Array.isArray(e);var Lx=class extends ai{constructor({element:t,filterBy:r,from:n,column:i,label:o=i,format:s=u=>u,options:a,value:c,as:l}={}){super(r),this.from=n,this.column=i,this.selection=l,this.format=s,this.element=t??document.createElement("div"),this.element.setAttribute("class","input"),this.element.value=this;let u=document.createElement("label");u.innerText=o||i,this.element.appendChild(u),this.select=document.createElement("select"),a&&(this.data=a.map(f=>Bdt(f)?f:{value:f}),this.update()),c=c??this.selection?.value??this.data?.[0]?.value,this.selection?.value===void 0&&this.publish(c),this.element.appendChild(this.select),this.selection&&(this.select.addEventListener("input",()=>{this.publish(this.selectedValue()??null)}),lo(this.selection)||this.selection.addEventListener("value",f=>{f!==this.select.value&&this.selectedValue(f)}))}selectedValue(t){if(arguments.length===0){let r=this.select.selectedIndex;return this.data[r].value}else{let r=this.data?.findIndex(n=>n.value===t);r>=0?this.select.selectedIndex=r:this.select.value=String(t)}}reset(){this.select.selectedIndex=this.from?0:-1}publish(t){let{selection:r,column:n}=this;lo(r)?r.update({source:this,schema:{type:"point"},value:t,predicate:t!==""&&t!==void 0?ic(n,Fi(t)):null}):yi(r)&&r.update(t)}query(t=[]){let{from:r,column:n}=this;return r?Mt.from(r).select({value:n}).distinct().where(t).orderby(n):null}queryResult(t){return this.data=[{value:"",label:"All"},...t],this}update(){let{data:t,format:r,select:n}=this;n.replaceChildren();for(let{value:i,label:o}of t){let s=document.createElement("option");s.setAttribute("value",i),s.innerText=o??r(i),this.select.appendChild(s)}return this.selection&&this.selectedValue(this.selection?.value??""),this}};var Odt={contains:cM,prefix:lM,suffix:uM,regexp:aM},Ndt=0;var Rx=class extends ai{constructor({element:t,filterBy:r,from:n,column:i,label:o,type:s="contains",as:a}={}){if(super(r),this.id="search_"+ ++Ndt,this.type=s,this.from=n,this.column=i,this.selection=a,this.element=t??document.createElement("div"),this.element.setAttribute("class","input"),this.element.value=this,o){let c=document.createElement("label");c.setAttribute("for",this.id),c.innerText=o,this.element.appendChild(c)}this.searchbox=document.createElement("input"),this.searchbox.setAttribute("id",this.id),this.searchbox.setAttribute("type","text"),this.searchbox.setAttribute("placeholder","Query"),this.element.appendChild(this.searchbox),this.selection&&(this.searchbox.addEventListener("input",()=>{this.publish(this.searchbox.value||null)}),lo(this.selection)||this.selection.addEventListener("value",c=>{c!==this.searchbox.value&&(this.searchbox.value=c)}))}reset(){this.searchbox.value=""}publish(t){let{selection:r,column:n,type:i}=this;lo(r)?r.update({source:this,schema:{type:i},value:t,predicate:t?Odt[i](n,Fi(t)):null}):yi(r)&&r.update(t)}query(t=[]){let{from:r,column:n}=this;return r?Mt.from(r).select({list:n}).distinct().where(t):null}queryResult(t){return this.data=t,this}update(){let t=document.createElement("datalist"),r=`${this.id}_list`;t.setAttribute("id",r);for(let n of this.data){let i=document.createElement("option");i.setAttribute("value",n.list),t.append(i)}return this.datalist&&this.datalist.remove(),this.element.appendChild(this.datalist=t),this.searchbox.setAttribute("list",r),this}};var Fdt=0;var kx=class extends ai{constructor({element:t,filterBy:r,as:n,min:i,max:o,step:s,from:a,column:c,label:l=c,value:u=n?.value,width:f}={}){if(super(r),this.id="slider_"+ ++Fdt,this.from=a,this.column=c||"value",this.selection=n,this.min=i,this.max=o,this.step=s,this.element=t||document.createElement("div"),this.element.setAttribute("class","input"),this.element.value=this,l){let d=document.createElement("label");d.setAttribute("for",this.id),d.innerText=l,this.element.appendChild(d)}this.slider=document.createElement("input"),this.slider.setAttribute("id",this.id),this.slider.setAttribute("type","range"),f!=null&&(this.slider.style.width=`${+f}px`),i!=null&&this.slider.setAttribute("min",i),o!=null&&this.slider.setAttribute("max",o),s!=null&&this.slider.setAttribute("step",s),u!=null&&(this.slider.setAttribute("value",u),this.selection?.value===void 0&&this.publish(u)),this.element.appendChild(this.slider),this.selection&&(this.slider.addEventListener("input",()=>{this.publish(+this.slider.value)}),lo(this.selection)||this.selection.addEventListener("value",d=>{d!==+this.slider.value&&(this.slider.value=d)}))}query(t=[]){let{from:r,column:n}=this;return!r||this.min!=null&&this.max!=null?null:Mt.select({min:ao(n),max:so(n)}).from(r).where(t)}queryResult(t){let{min:r,max:n}=Array.from(t)[0];return this.min==null&&this.slider.setAttribute("min",r),this.max==null&&this.slider.setAttribute("max",n),this.step==null&&this.slider.setAttribute("step",(n-r)/500),this}publish(t){let{selection:r,column:n}=this;lo(r)?r.update({source:this,schema:{type:"point"},value:t,predicate:ic(n,Fi(t))}):yi(this.selection)&&r.update(t)}};var BF=NF(e=>{let t=QT(e);return r=>r==null?"":typeof r=="number"?t(r):r instanceof Date?OF(r):`${r}`}),QT=NF(e=>t=>t===0?"0":t.toLocaleString(e)),Mce=BF(),Ece=QT();function OF(e){return bp(e,"Invalid Date")}function NF(e){let t=NF,r;return(n="en")=>n===t?r:r=e(t=n)}var Ldt=-1;var Cx=class extends ai{constructor({element:t,filterBy:r,from:n,columns:i=["*"],align:o={},format:s,width:a,maxWidth:c,height:l=500,rowBatch:u=100}={}){super(r),this.id=`table-${++Ldt}`,this.from=n,this.columns=i,this.format=s,this.align=o,this.widths=typeof a=="object"?a:{},this.offset=0,this.limit=+u,this.pending=!1,this.sortHeader=null,this.sortColumn=null,this.sortDesc=!1,this.element=t||document.createElement("div"),this.element.setAttribute("id",this.id),this.element.value=this,typeof a=="number"&&(this.element.style.width=`${a}px`),c&&(this.element.style.maxWidth=`${c}px`),this.element.style.maxHeight=`${l}px`,this.element.style.overflow="auto";let f=-1;this.element.addEventListener("scroll",d=>{let{pending:h,loaded:p}=this,{scrollHeight:y,scrollTop:g,clientHeight:m}=d.target,b=g<f;f=g,!(b||h||p)&&y-g<2*m&&(this.pending=!0,this.requestData(this.offset+this.limit))}),this.tbl=document.createElement("table"),this.element.appendChild(this.tbl),this.head=document.createElement("thead"),this.tbl.appendChild(this.head),this.body=document.createElement("tbody"),this.tbl.appendChild(this.body),this.style=document.createElement("style"),this.element.appendChild(this.style)}requestData(t=0){this.offset=t;let r=this.query(this.filterBy?.predicate(this));this.requestQuery(r),co().prefetch(r.clone().offset(t+this.limit))}fields(){return this.columns.map(t=>El(this.from,t))}fieldInfo(t){this.schema=t;let r=this.head;r.innerHTML="";let n=document.createElement("tr");for(let{column:i}of t){let o=document.createElement("th");o.addEventListener("click",s=>this.sort(s,i)),o.appendChild(document.createElement("span")),o.appendChild(document.createTextNode(i)),n.appendChild(o)}return r.appendChild(n),this.formats=Rdt(this.format,t),this.style.innerText=Udt(this.id,kdt(this.align,t),Cdt(this.widths,t)),this}query(t=[]){let{from:r,limit:n,offset:i,schema:o,sortColumn:s,sortDesc:a}=this;return Mt.from(r).select(o.map(c=>c.column)).where(t).orderby(s?a?rM(s):s:[]).limit(n).offset(i)}queryResult(t){return this.pending||(this.loaded=!1,this.body.replaceChildren()),this.data=t,this}update(){let{body:t,formats:r,data:n,schema:i,limit:o}=this,s=i.length,a=0;for(let c of n){++a;let l=document.createElement("tr");for(let u=0;u<s;++u){let f=c[i[u].column],d=document.createElement("td");d.innerText=f==null?"":r[u](f),l.appendChild(d)}t.appendChild(l)}return a<o&&(this.loaded=!0),this.pending=!1,this}sort(t,r){r===this.sortColumn?this.sortDesc=!this.sortDesc:(this.sortColumn=r,this.sortDesc=!1);let n=t.currentTarget,i=this.sortHeader;i===n&&t.metaKey?(i.firstChild.textContent="",this.sortHeader=null,this.sortColumn=null):(i&&(i.firstChild.textContent=""),this.sortHeader=n,n.firstChild.textContent=this.sortDesc?"\u25BE":"\u25B4"),this.requestData()}};function Rdt(e={},t,r){return t.map(({column:n,type:i})=>{if(n in e)return e[n];switch(i){case"number":return QT(r);case"date":return OF;default:return BF(r)}})}function kdt(e={},t){return t.map(({column:r,type:n})=>r in e?e[r]:n==="number"?"right":"left")}function Cdt(e={},t){return t.map(({column:r})=>e[r])}function Udt(e,t,r){let n=[];return t.forEach((i,o)=>{let s=+r[o];if(i!=="left"||s){let a=i!=="left"?`text-align:${i};`:"",c=s?`width:${s}px;max-width:${s}px;`:"";n.push(`#${e} tr>:nth-child(${o+1}) {${a}${c}}`)}}),n.join(" ")}function Ux(e,...t){let r=e?.context?.coordinator??co();for(let n of t)r.connect(n)}function JT(e,t,r){let n=new t(r);return Ux(e,n),n.element}function OG(e){return JT(this,Lx,e)}function NG(e){return JT(this,Rx,e)}function FG(e){return JT(this,kx,e)}function LG(e){return JT(this,Cx,e)}function RG({direction:e="vertical",wrap:t=!1},r){let n=document.createElement("div");return n.style.display="flex",n.style.flexDirection=e==="vertical"?"column":"row",n.style.flexWrap=t?t===!0?"wrap":t:"nowrap",n.style.justifyContent="flex-start",n.style.alignItems="flex-start",r.forEach(i=>n.appendChild(i)),n.value={element:n},n}function kG(...e){return RG({direction:"vertical"},e.flat())}function CG(...e){return RG({direction:"horizontal"},e.flat())}function UG({dim:e="width",size:t=10}){let r=document.createElement("span");r.style.display="inline-block",r.style[e]=Number.isNaN(+t)?t:`${t}px`;let n={element:r};return r.value=n,r}function PG(e){return UG({dim:"height",size:e})}function $G(e){return UG({dim:"width",size:e})}var jG={};Ir(jG,{align:()=>GF,aspectRatio:()=>XF,axis:()=>HF,colorBase:()=>LR,colorClamp:()=>SR,colorConstant:()=>kR,colorDomain:()=>wR,colorExponent:()=>RR,colorInterpolate:()=>MR,colorLabel:()=>BR,colorN:()=>IR,colorNice:()=>TR,colorPivot:()=>ER,colorRange:()=>vR,colorReverse:()=>OR,colorScale:()=>_R,colorScheme:()=>AR,colorSymmetric:()=>DR,colorTickFormat:()=>FR,colorZero:()=>NR,facetGrid:()=>bL,facetLabel:()=>xL,facetMargin:()=>hL,facetMarginBottom:()=>mL,facetMarginLeft:()=>yL,facetMarginRight:()=>gL,facetMarginTop:()=>pL,fxAlign:()=>ML,fxAriaDescription:()=>YL,fxAriaLabel:()=>qL,fxAxis:()=>OL,fxDomain:()=>_L,fxFontVariant:()=>jL,fxGrid:()=>UL,fxInset:()=>SL,fxInsetLeft:()=>IL,fxInsetRight:()=>TL,fxLabel:()=>$L,fxLabelAnchor:()=>zL,fxLabelOffset:()=>VL,fxLine:()=>PL,fxNice:()=>vL,fxPadding:()=>EL,fxPaddingInner:()=>DL,fxPaddingOuter:()=>BL,fxRange:()=>wL,fxReverse:()=>WL,fxRound:()=>AL,fxTickFormat:()=>kL,fxTickPadding:()=>RL,fxTickRotate:()=>CL,fxTickSize:()=>FL,fxTickSpacing:()=>LL,fxTicks:()=>NL,fyAlign:()=>tR,fyAriaDescription:()=>bR,fyAriaLabel:()=>gR,fyAxis:()=>iR,fyDomain:()=>GL,fyFontVariant:()=>yR,fyGrid:()=>fR,fyInset:()=>ZL,fyInsetBottom:()=>QL,fyInsetTop:()=>KL,fyLabel:()=>hR,fyLabelAnchor:()=>pR,fyLabelOffset:()=>mR,fyLine:()=>dR,fyNice:()=>HL,fyPadding:()=>eR,fyPaddingInner:()=>rR,fyPaddingOuter:()=>nR,fyRange:()=>XL,fyReverse:()=>xR,fyRound:()=>JL,fyTickFormat:()=>lR,fyTickPadding:()=>cR,fyTickRotate:()=>uR,fyTickSize:()=>sR,fyTickSpacing:()=>aR,fyTicks:()=>oR,grid:()=>KF,height:()=>VF,inset:()=>ZF,label:()=>QF,lengthBase:()=>u4,lengthClamp:()=>a4,lengthConstant:()=>d4,lengthDomain:()=>o4,lengthExponent:()=>f4,lengthNice:()=>c4,lengthRange:()=>s4,lengthScale:()=>i4,lengthZero:()=>l4,margin:()=>UF,marginBottom:()=>WF,marginLeft:()=>jF,marginRight:()=>qF,marginTop:()=>YF,margins:()=>CF,name:()=>RF,opacityBase:()=>WR,opacityClamp:()=>$R,opacityConstant:()=>XR,opacityDomain:()=>UR,opacityExponent:()=>GR,opacityLabel:()=>VR,opacityNice:()=>zR,opacityRange:()=>PR,opacityReverse:()=>jR,opacityScale:()=>CR,opacityTickFormat:()=>YR,opacityZero:()=>qR,padding:()=>JF,projectionClip:()=>S4,projectionDomain:()=>g4,projectionInset:()=>b4,projectionInsetBottom:()=>v4,projectionInsetLeft:()=>x4,projectionInsetRight:()=>_4,projectionInsetTop:()=>w4,projectionParallels:()=>p4,projectionPrecision:()=>m4,projectionRotate:()=>y4,projectionType:()=>h4,rBase:()=>e4,rClamp:()=>QR,rConstant:()=>n4,rDomain:()=>ZR,rExponent:()=>r4,rNice:()=>JR,rRange:()=>KR,rScale:()=>HR,rZero:()=>t4,round:()=>t6,style:()=>$F,width:()=>zF,xAlign:()=>u6,xAriaDescription:()=>E6,xAriaLabel:()=>M6,xAxis:()=>p6,xBase:()=>O6,xClamp:()=>c6,xConstant:()=>F6,xDomain:()=>r6,xExponent:()=>N6,xFontVariant:()=>A6,xGrid:()=>w6,xInset:()=>o6,xInsetLeft:()=>s6,xInsetRight:()=>a6,xLabel:()=>S6,xLabelAnchor:()=>I6,xLabelOffset:()=>T6,xLine:()=>v6,xNice:()=>i6,xPadding:()=>f6,xPaddingInner:()=>d6,xPaddingOuter:()=>h6,xRange:()=>n6,xReverse:()=>D6,xRound:()=>l6,xScale:()=>e6,xTickFormat:()=>x6,xTickPadding:()=>b6,xTickRotate:()=>_6,xTickSize:()=>y6,xTickSpacing:()=>g6,xTicks:()=>m6,xZero:()=>B6,xyDomain:()=>PF,yAlign:()=>j6,yAriaDescription:()=>aL,yAriaLabel:()=>sL,yAxis:()=>G6,yBase:()=>uL,yClamp:()=>z6,yConstant:()=>dL,yDomain:()=>R6,yExponent:()=>fL,yFontVariant:()=>oL,yGrid:()=>tL,yInset:()=>U6,yInsetBottom:()=>$6,yInsetTop:()=>P6,yLabel:()=>rL,yLabelAnchor:()=>nL,yLabelOffset:()=>iL,yLine:()=>eL,yNice:()=>C6,yPadding:()=>q6,yPaddingInner:()=>Y6,yPaddingOuter:()=>W6,yRange:()=>k6,yReverse:()=>cL,yRound:()=>V6,yScale:()=>L6,yTickFormat:()=>Q6,yTickPadding:()=>K6,yTickRotate:()=>J6,yTickSize:()=>H6,yTickSpacing:()=>Z6,yTicks:()=>X6,yZero:()=>lL});var Px=class extends Map{request(t,r){if(this.has(t))r(this.get(t));else{let n=this.waiting||(this.waiting=new Map),i=n.get(t)||[];n.set(t,i.concat(r))}}set(t,r){this.has(t)&&console.warn(`Overwriting named plot "${t}".`);let{waiting:n}=this;return n?.has(t)&&(n.get(t).forEach(i=>i(r)),n.delete(t)),super.set(t,r)}},FF=new Px;function LF(e,t,r){(e?.context?.namedPlots??FF).request(t,r)}function zG(e,t,r){(e?.context?.namedPlots??FF).set(t,r)}function RF(e){return t=>zG(this,e,t)}function VG(e,t,r){yi(r)?(r.addEventListener("value",n=>{e.setAttribute(t,n),e.update()}),r.value!==void 0&&e.setAttribute(t,r.value)):e.setAttribute(t,r)}function Pdt(e,t){return r=>{VG(r,e,t)}}function kF(e){return t=>{for(let[r,n]of Object.entries(e))VG(t,r,n)}}function CF(e){let{top:t,bottom:r,left:n,right:i}=e,o={};return t!==void 0&&(o.marginTop=t),r!==void 0&&(o.marginBottom=r),n!==void 0&&(o.marginLeft=n),i!==void 0&&(o.marginRight=i),kF(o)}function UF(e){return kF({marginTop:e,marginBottom:e,marginLeft:e,marginRight:e})}function PF(e){return kF({xDomain:e,yDomain:e})}var L=e=>t=>Pdt(e,t),$F=L("style"),zF=L("width"),VF=L("height"),jF=L("marginLeft"),qF=L("marginRight"),YF=L("marginTop"),WF=L("marginBottom"),GF=L("align"),XF=L("aspectRatio"),HF=L("axis"),ZF=L("inset"),KF=L("grid"),QF=L("label"),JF=L("padding"),t6=L("round"),e6=L("xScale"),r6=L("xDomain"),n6=L("xRange"),i6=L("xNice"),o6=L("xInset"),s6=L("xInsetLeft"),a6=L("xInsetRight"),c6=L("xClamp"),l6=L("xRound"),u6=L("xAlign"),f6=L("xPadding"),d6=L("xPaddingInner"),h6=L("xPaddingOuter"),p6=L("xAxis"),m6=L("xTicks"),y6=L("xTickSize"),g6=L("xTickSpacing"),b6=L("xTickPadding"),x6=L("xTickFormat"),_6=L("xTickRotate"),w6=L("xGrid"),v6=L("xLine"),S6=L("xLabel"),I6=L("xLabelAnchor"),T6=L("xLabelOffset"),A6=L("xFontVariant"),M6=L("xAriaLabel"),E6=L("xAriaDescription"),D6=L("xReverse"),B6=L("xZero"),O6=L("xBase"),N6=L("xExponent"),F6=L("xConstant"),L6=L("yScale"),R6=L("yDomain"),k6=L("yRange"),C6=L("yNice"),U6=L("yInset"),P6=L("yInsetTop"),$6=L("yInsetBottom"),z6=L("yClamp"),V6=L("yRound"),j6=L("yAlign"),q6=L("yPadding"),Y6=L("yPaddingInner"),W6=L("yPaddingOuter"),G6=L("yAxis"),X6=L("yTicks"),H6=L("yTickSize"),Z6=L("yTickSpacing"),K6=L("yTickPadding"),Q6=L("yTickFormat"),J6=L("yTickRotate"),tL=L("yGrid"),eL=L("yLine"),rL=L("yLabel"),nL=L("yLabelAnchor"),iL=L("yLabelOffset"),oL=L("yFontVariant"),sL=L("yAriaLabel"),aL=L("yAriaDescription"),cL=L("yReverse"),lL=L("yZero"),uL=L("yBase"),fL=L("yExponent"),dL=L("yConstant"),hL=L("facetMargin"),pL=L("facetMarginTop"),mL=L("facetMarginBottom"),yL=L("facetMarginLeft"),gL=L("facetMarginRight"),bL=L("facetGrid"),xL=L("facetLabel"),_L=L("fxDomain"),wL=L("fxRange"),vL=L("fxNice"),SL=L("fxInset"),IL=L("fxInsetLeft"),TL=L("fxInsetRight"),AL=L("fxRound"),ML=L("fxAlign"),EL=L("fxPadding"),DL=L("fxPaddingInner"),BL=L("fxPaddingOuter"),OL=L("fxAxis"),NL=L("fxTicks"),FL=L("fxTickSize"),LL=L("fxTickSpacing"),RL=L("fxTickPadding"),kL=L("fxTickFormat"),CL=L("fxTickRotate"),UL=L("fxGrid"),PL=L("fxLine"),$L=L("fxLabel"),zL=L("fxLabelAnchor"),VL=L("fxLabelOffset"),jL=L("fxFontVariant"),qL=L("fxAriaLabel"),YL=L("fxAriaDescription"),WL=L("fxReverse"),GL=L("fyDomain"),XL=L("fyRange"),HL=L("fyNice"),ZL=L("fyInset"),KL=L("fyInsetTop"),QL=L("fyInsetBottom"),JL=L("fyRound"),tR=L("fyAlign"),eR=L("fyPadding"),rR=L("fyPaddingInner"),nR=L("fyPaddingOuter"),iR=L("fyAxis"),oR=L("fyTicks"),sR=L("fyTickSize"),aR=L("fyTickSpacing"),cR=L("fyTickPadding"),lR=L("fyTickFormat"),uR=L("fyTickRotate"),fR=L("fyGrid"),dR=L("fyLine"),hR=L("fyLabel"),pR=L("fyLabelAnchor"),mR=L("fyLabelOffset"),yR=L("fyFontVariant"),gR=L("fyAriaLabel"),bR=L("fyAriaDescription"),xR=L("fyReverse"),_R=L("colorScale"),wR=L("colorDomain"),vR=L("colorRange"),SR=L("colorClamp"),IR=L("colorN"),TR=L("colorNice"),AR=L("colorScheme"),MR=L("colorInterpolate"),ER=L("colorPivot"),DR=L("colorSymmetric"),BR=L("colorLabel"),OR=L("colorReverse"),NR=L("colorZero"),FR=L("colorTickFormat"),LR=L("colorBase"),RR=L("colorExponent"),kR=L("colorConstant"),CR=L("opacityScale"),UR=L("opacityDomain"),PR=L("opacityRange"),$R=L("opacityClamp"),zR=L("opacityNice"),VR=L("opacityLabel"),jR=L("opacityReverse"),qR=L("opacityZero"),YR=L("opacityTickFormat"),WR=L("opacityBase"),GR=L("opacityExponent"),XR=L("opacityConstant"),HR=L("rScale"),ZR=L("rDomain"),KR=L("rRange"),QR=L("rClamp"),JR=L("rNice"),t4=L("rZero"),e4=L("rBase"),r4=L("rExponent"),n4=L("rConstant"),i4=L("lengthScale"),o4=L("lengthDomain"),s4=L("lengthRange"),a4=L("lengthClamp"),c4=L("lengthNice"),l4=L("lengthZero"),u4=L("lengthBase"),f4=L("lengthExponent"),d4=L("lengthConstant"),h4=L("projectionType"),p4=L("projectionParallels"),m4=L("projectionPrecision"),y4=L("projectionRotate"),g4=L("projectionDomain"),b4=L("projectionInset"),x4=L("projectionInsetLeft"),_4=L("projectionInsetRight"),w4=L("projectionInsetTop"),v4=L("projectionInsetBottom"),S4=L("projectionClip");function qG(e,t){return{table:e,options:t}}var YG={};Ir(YG,{area:()=>T4,areaX:()=>A4,areaY:()=>M4,arrow:()=>b8,axisFx:()=>S8,axisFy:()=>I8,axisX:()=>w8,axisY:()=>v8,barX:()=>O4,barY:()=>N4,cell:()=>F4,cellX:()=>L4,cellY:()=>R4,circle:()=>V4,contour:()=>s8,delaunayLink:()=>m8,delaunayMesh:()=>y8,denseLine:()=>o8,density:()=>i8,densityX:()=>r8,densityY:()=>n8,dot:()=>P4,dotX:()=>$4,dotY:()=>z4,frame:()=>_8,geo:()=>D8,graticule:()=>O8,gridFx:()=>M8,gridFy:()=>E8,gridX:()=>T8,gridY:()=>A8,heatmap:()=>a8,hexagon:()=>j4,hexbin:()=>u8,hexgrid:()=>f8,hull:()=>g8,image:()=>e8,line:()=>E4,lineX:()=>D4,lineY:()=>B4,link:()=>x8,raster:()=>c8,rasterTile:()=>l8,rect:()=>k4,rectX:()=>C4,rectY:()=>U4,regressionY:()=>d8,ruleX:()=>G4,ruleY:()=>X4,sphere:()=>B8,spike:()=>t8,text:()=>q4,textX:()=>Y4,textY:()=>W4,tickX:()=>H4,tickY:()=>Z4,vector:()=>K4,vectorX:()=>Q4,vectorY:()=>J4,voronoi:()=>h8,voronoiMesh:()=>p8});var $dt=new Set(["frame","axisX","axisY","axisFx","axisFy","gridX","gridY","gridFx","gridFy","hexgrid","graticule","sphere"]);function Ct(e,t,r={}){arguments.length===2&&!Array.isArray(t)&&(r=t,t=$dt.has(e)?null:[{}]);let n=e.startsWith("area")||e.startsWith("line")?gx:Sn;return I4(n,e,t,r)}function I4(e,t,r,n){return i=>{i.addMark(new e(t,r,n))}}function ml(e,t,r){return n=>{n.addMark(new e(t,r))}}var T4=(...e)=>Ct("area",...e),A4=(...e)=>Ct("areaX",...e),M4=(...e)=>Ct("areaY",...e),E4=(...e)=>Ct("line",...e),D4=(...e)=>Ct("lineX",...e),B4=(...e)=>Ct("lineY",...e),O4=(...e)=>Ct("barX",...e),N4=(...e)=>Ct("barY",...e),F4=(...e)=>Ct("cell",...e),L4=(...e)=>Ct("cellX",...e),R4=(...e)=>Ct("cellY",...e),k4=(...e)=>Ct("rect",...e),C4=(...e)=>Ct("rectX",...e),U4=(...e)=>Ct("rectY",...e),P4=(...e)=>Ct("dot",...e),$4=(...e)=>Ct("dotX",...e),z4=(...e)=>Ct("dotY",...e),V4=(...e)=>Ct("circle",...e),j4=(...e)=>Ct("hexagon",...e),q4=(...e)=>Ct("text",...e),Y4=(...e)=>Ct("textX",...e),W4=(...e)=>Ct("textY",...e),G4=(...e)=>Ct("ruleX",...e),X4=(...e)=>Ct("ruleY",...e),H4=(...e)=>Ct("tickX",...e),Z4=(...e)=>Ct("tickY",...e),K4=(...e)=>Ct("vector",...e),Q4=(...e)=>Ct("vectoX",...e),J4=(...e)=>Ct("vectorY",...e),t8=(...e)=>Ct("spike",...e),e8=(...e)=>Ct("image",...e),r8=(...e)=>I4(ym,"areaX",...e),n8=(...e)=>I4(ym,"areaY",...e),i8=(...e)=>ml(Ix,...e),o8=(...e)=>ml(Sx,...e),s8=(...e)=>ml(wx,...e),a8=(...e)=>ml(vx,...e),c8=(...e)=>ml(Pu,...e),l8=(...e)=>ml(Mx,...e),u8=(...e)=>ml(Ax,...e),f8=(...e)=>Ct("hexgrid",...e),d8=(...e)=>ml(Ex,...e),h8=(...e)=>Ct("voronoi",...e),p8=(...e)=>Ct("voronoiMesh",...e),m8=(...e)=>Ct("delaunayLink",...e),y8=(...e)=>Ct("delaunayMesh",...e),g8=(...e)=>Ct("hull",...e),b8=(...e)=>Ct("arrow",...e),x8=(...e)=>Ct("link",...e),_8=(...e)=>Ct("frame",...e),w8=(...e)=>Ct("axisX",...e),v8=(...e)=>Ct("axisY",...e),S8=(...e)=>Ct("axisFx",...e),I8=(...e)=>Ct("axisFy",...e),T8=(...e)=>Ct("gridX",...e),A8=(...e)=>Ct("gridY",...e),M8=(...e)=>Ct("gridFx",...e),E8=(...e)=>Ct("gridFy",...e),D8=(...e)=>ml(Tx,...e),B8=(...e)=>Ct("sphere",...e),O8=(...e)=>Ct("graticule",...e);var WG={};Ir(WG,{highlight:()=>N8,intervalX:()=>U8,intervalXY:()=>$8,intervalY:()=>P8,nearestX:()=>k8,nearestY:()=>C8,pan:()=>z8,panX:()=>V8,panY:()=>j8,panZoom:()=>q8,panZoomX:()=>Y8,panZoomY:()=>W8,toggle:()=>vm,toggleColor:()=>R8,toggleX:()=>F8,toggleY:()=>L8});function $u(e,t){return r=>{let n=r.marks[r.marks.length-1];r.addInteractor(new e(n,t))}}function N8({by:e,...t}){return $u(Dx,{selection:e,channels:t})}function vm({as:e,...t}){return $u(Md,{...t,selection:e})}function F8(e){return vm({...e,channels:["x"]})}function L8(e){return vm({...e,channels:["y"]})}function R8(e){return vm({...e,channels:["color"]})}function k8({as:e,...t}){return $u(_m,{...t,selection:e,channel:"x"})}function C8({as:e,...t}){return $u(_m,{...t,selection:e,channel:"y"})}function U8({as:e,...t}){return $u(xm,{...t,selection:e,channel:"x"})}function P8({as:e,...t}){return $u(xm,{...t,selection:e,channel:"y"})}function $8({as:e,...t}){return $u(Nx,{...t,selection:e})}function Sm(e){return $u(Fx,e)}function z8(e={}){return Sm({...e,zoom:!1})}function V8(e={}){return Sm({...e,zoom:!1,pany:!1})}function j8(e={}){return Sm({...e,zoom:!1,panx:!1})}function q8(e={}){return Sm(e)}function Y8(e={}){return Sm({...e,pany:!1})}function W8(e={}){return Sm({...e,panx:!1})}var GG={};Ir(GG,{colorLegend:()=>X8,opacityLegend:()=>H8,symbolLegend:()=>Z8});function G8(e,t={}){if(t.for){let{for:r,...n}=t,i=new wm(e,n),o=typeof r,s=a=>a.addLegend(i,!1);return o==="string"?LF(this,r,s):r.value&&s(r.value),i.element}else return r=>r.addLegend(new wm(e,t))}function X8(e){return G8.call(this,"color",e)}function H8(e){return G8.call(this,"opacity",e)}function Z8(e){return G8.call(this,"symbol",e)}function XG(...e){let t=new px;return e.flat().forEach(r=>r(t)),Ux(this,...t.marks),t.element}function zdt({coordinator:e=co(),namedPlots:t=new Px,extensions:r=null,...n}={}){return{...K8,...r,context:{coordinator:e,namedPlots:t,...n}}}export{Ly as Coordinator,Gs as Fixed,ai as MosaicClient,Nl as Param,Mt as Query,ac as Selection,SM as agg,GF as align,$n as and,T4 as area,A4 as areaX,M4 as areaY,th as argmax,Jd as argmin,XM as arrayAgg,b8 as arrow,XF as aspectRatio,jG as attributeDirectives,IM as avg,HF as axis,S8 as axisFx,I8 as axisFy,w8 as axisX,v8 as axisY,O4 as barX,N4 as barY,KT as bin,By as cast,eh as castDouble,HM as castInteger,F4 as cell,L4 as cellX,R4 as cellY,Ny as centroid,tE as centroidX,eE as centroidY,V4 as circle,LR as colorBase,SR as colorClamp,kR as colorConstant,wR as colorDomain,RR as colorExponent,MR as colorInterpolate,BR as colorLabel,X8 as colorLegend,IR as colorN,TR as colorNice,ER as colorPivot,vR as colorRange,OR as colorReverse,_R as colorScale,AR as colorScheme,DR as colorSymmetric,FR as colorTickFormat,NR as colorZero,El as column,Ux as connect,s8 as contour,co as coordinator,CM as corr,Li as count,UM as covarPop,Ol as create,zdt as createAPIContext,mM as cume_dist,JM as dateDay,KM as dateMonth,QM as dateMonthDay,m8 as delaunayLink,y8 as delaunayMesh,o8 as denseLine,hM as dense_rank,i8 as density,r8 as densityX,n8 as densityY,P4 as dot,$4 as dotX,z4 as dotY,LM as entropy,ic as eq,bL as facetGrid,xL as facetLabel,hL as facetMargin,mL as facetMarginBottom,yL as facetMarginLeft,gL as facetMarginRight,pL as facetMarginTop,YM as first,xM as first_value,_8 as frame,qG as from,ML as fxAlign,YL as fxAriaDescription,qL as fxAriaLabel,OL as fxAxis,_L as fxDomain,jL as fxFontVariant,UL as fxGrid,SL as fxInset,IL as fxInsetLeft,TL as fxInsetRight,$L as fxLabel,zL as fxLabelAnchor,VL as fxLabelOffset,PL as fxLine,vL as fxNice,EL as fxPadding,DL as fxPaddingInner,BL as fxPaddingOuter,wL as fxRange,WL as fxReverse,AL as fxRound,kL as fxTickFormat,RL as fxTickPadding,CL as fxTickRotate,FL as fxTickSize,LL as fxTickSpacing,NL as fxTicks,tR as fyAlign,bR as fyAriaDescription,gR as fyAriaLabel,iR as fyAxis,GL as fyDomain,yR as fyFontVariant,fR as fyGrid,ZL as fyInset,QL as fyInsetBottom,KL as fyInsetTop,hR as fyLabel,pR as fyLabelAnchor,mR as fyLabelOffset,dR as fyLine,HL as fyNice,eR as fyPadding,rR as fyPaddingInner,nR as fyPaddingOuter,XL as fyRange,xR as fyReverse,JL as fyRound,lR as fyTickFormat,cR as fyTickPadding,uR as fyTickRotate,sR as fyTickSize,aR as fyTickSpacing,oR as fyTicks,D8 as geo,Oy as geojson,O8 as graticule,KF as grid,M8 as gridFx,E8 as gridFy,T8 as gridX,A8 as gridY,My as gt,iM as gte,CG as hconcat,a8 as heatmap,VF as height,j4 as hexagon,u8 as hexbin,f8 as hexgrid,N8 as highlight,$G as hspace,g8 as hull,e8 as image,ZF as inset,WG as interactorDirectives,U8 as intervalX,$8 as intervalXY,P8 as intervalY,tr as isBetween,oM as isDistinct,sM as isNotBetween,Ey as isNotDistinct,nc as isNotNull,lf as isNull,FM as kurtosis,QF as label,gM as lag,WM as last,_M as last_value,bM as lead,GG as legendDirectives,u4 as lengthBase,a4 as lengthClamp,d4 as lengthConstant,o4 as lengthDomain,f4 as lengthExponent,c4 as lengthNice,s4 as lengthRange,i4 as lengthScale,l4 as lengthZero,E4 as line,D4 as lineX,B4 as lineY,x8 as link,Fi as literal,iE as loadCSV,rE as loadExtension,oE as loadJSON,cE as loadObjects,sE as loadParquet,aE as loadSpatial,oc as lt,sc as lte,TM as mad,UF as margin,WF as marginBottom,jF as marginLeft,qF as marginRight,YF as marginTop,CF as margins,YG as markDirectives,so as max,MM as median,OG as menu,ao as min,DM as mode,RF as name,FF as namedPlots,k8 as nearestX,C8 as nearestY,uf as neq,nM as not,wM as nth_value,yM as ntile,WR as opacityBase,$R as opacityClamp,XR as opacityConstant,UR as opacityDomain,GR as opacityExponent,VR as opacityLabel,H8 as opacityLegend,zR as opacityNice,PR as opacityRange,jR as opacityReverse,CR as opacityScale,YR as opacityTickFormat,qR as opacityZero,cf as or,JF as padding,z8 as pan,V8 as panX,j8 as panY,q8 as panZoom,Y8 as panZoomX,W8 as panZoomY,pM as percent_rank,XG as plot,AM as product,S4 as projectionClip,g4 as projectionDomain,b4 as projectionInset,v4 as projectionInsetBottom,x4 as projectionInsetLeft,_4 as projectionInsetRight,w4 as projectionInsetTop,p4 as projectionParallels,m4 as projectionPrecision,y4 as projectionRotate,h4 as projectionType,EM as quantile,e4 as rBase,QR as rClamp,n4 as rConstant,ZR as rDomain,r4 as rExponent,JR as rNice,KR as rRange,HR as rScale,t4 as rZero,dM as rank,c8 as raster,l8 as rasterTile,k4 as rect,C4 as rectX,U4 as rectY,d8 as regressionY,LF as requestNamedPlot,wU as restConnector,t6 as round,fM as row_number,G4 as ruleX,X4 as ruleY,NG as search,NM as skewness,FG as slider,x1 as socketConnector,B8 as sphere,t8 as spike,W as sql,OM as stddev,kM as stddevPop,GM as stringAgg,$F as style,Ri as sum,Z8 as symbolLegend,LG as table,q4 as text,Y4 as textX,W4 as textY,H4 as tickX,Z4 as tickY,vm as toggle,R8 as toggleColor,F8 as toggleX,L8 as toggleY,RM as varPop,BM as variance,kG as vconcat,K4 as vector,Q4 as vectorX,J4 as vectorY,h8 as voronoi,p8 as voronoiMesh,PG as vspace,gP as wasmConnector,zF as width,u6 as xAlign,E6 as xAriaDescription,M6 as xAriaLabel,p6 as xAxis,O6 as xBase,c6 as xClamp,F6 as xConstant,r6 as xDomain,N6 as xExponent,A6 as xFontVariant,w6 as xGrid,o6 as xInset,s6 as xInsetLeft,a6 as xInsetRight,S6 as xLabel,I6 as xLabelAnchor,T6 as xLabelOffset,v6 as xLine,i6 as xNice,f6 as xPadding,d6 as xPaddingInner,h6 as xPaddingOuter,n6 as xRange,D6 as xReverse,l6 as xRound,e6 as xScale,x6 as xTickFormat,b6 as xTickPadding,_6 as xTickRotate,y6 as xTickSize,g6 as xTickSpacing,m6 as xTicks,B6 as xZero,PF as xyDomain,j6 as yAlign,aL as yAriaDescription,sL as yAriaLabel,G6 as yAxis,uL as yBase,z6 as yClamp,dL as yConstant,R6 as yDomain,fL as yExponent,oL as yFontVariant,tL as yGrid,U6 as yInset,$6 as yInsetBottom,P6 as yInsetTop,rL as yLabel,nL as yLabelAnchor,iL as yLabelOffset,eL as yLine,C6 as yNice,q6 as yPadding,Y6 as yPaddingInner,W6 as yPaddingOuter,k6 as yRange,cL as yReverse,V6 as yRound,L6 as yScale,Q6 as yTickFormat,K6 as yTickPadding,J6 as yTickRotate,H6 as yTickSize,Z6 as yTickSpacing,X6 as yTicks,lL as yZero};