@uwdata/vgplot 0.5.0 → 0.6.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,30 +1,30 @@
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=`
1
+ var A$=Object.create;var bw=Object.defineProperty;var M$=Object.getOwnPropertyDescriptor;var N$=Object.getOwnPropertyNames;var R$=Object.getPrototypeOf,O$=Object.prototype.hasOwnProperty;var _R=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),vr=(e,t)=>{for(var n in t)bw(e,n,{get:t[n],enumerable:!0})},D$=(e,t,n,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of N$(t))!O$.call(e,i)&&i!==n&&bw(e,i,{get:()=>t[i],enumerable:!(r=M$(t,i))||r.enumerable});return e};var k$=(e,t,n)=>(n=e!=null?A$(R$(e)):{},D$(t||!e||!e.__esModule?bw(n,"default",{value:e,enumerable:!0}):n,e));var o9=_R((yPt,i9)=>{"use strict";function KJ(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 JJ(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 ttt(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 ett(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 ntt(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 cy(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)}i9.exports={ge:function(e,t,n,r,i){return cy(e,t,n,r,i,KJ)},gt:function(e,t,n,r,i){return cy(e,t,n,r,i,JJ)},lt:function(e,t,n,r,i){return cy(e,t,n,r,i,ttt)},le:function(e,t,n,r,i){return cy(e,t,n,r,i,ett)},eq:function(e,t,n,r,i){return cy(e,t,n,r,i,ntt)}}});var h9=_R((gPt,d9)=>{"use strict";var nw=o9(),sd=0,Ul=1,ew=2;d9.exports=itt;function NA(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 ly=NA.prototype;function AA(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 c9(e,t){var n=ad(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 s9(e,t){var n=e.intervals([]);n.push(t),c9(e,n)}function a9(e,t){var n=e.intervals([]),r=n.indexOf(t);return r<0?sd:(n.splice(r,1),c9(e,n),Ul)}ly.intervals=function(e){return e.push.apply(e,this.leftPoints),this.left&&this.left.intervals(e),this.right&&this.right.intervals(e),e};ly.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)?s9(this,e):this.left.insert(e):this.left=ad([e]);else if(e[0]>this.mid)this.right?4*(this.right.count+1)>3*(t+1)?s9(this,e):this.right.insert(e):this.right=ad([e]);else{var n=nw.ge(this.leftPoints,e,RA),r=nw.ge(this.rightPoints,e,OA);this.leftPoints.splice(n,0,e),this.rightPoints.splice(r,0,e)}};ly.remove=function(e){var t=this.count-this.leftPoints;if(e[1]<this.mid){if(!this.left)return sd;var n=this.right?this.right.count:0;if(4*n>3*(t-1))return a9(this,e);var r=this.left.remove(e);return r===ew?(this.left=null,this.count-=1,Ul):(r===Ul&&(this.count-=1),r)}else if(e[0]>this.mid){if(!this.right)return sd;var i=this.left?this.left.count:0;if(4*i>3*(t-1))return a9(this,e);var r=this.right.remove(e);return r===ew?(this.right=null,this.count-=1,Ul):(r===Ul&&(this.count-=1),r)}else{if(this.count===1)return this.leftPoints[0]===e?ew:sd;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}AA(this,s),this.count=(this.left?this.left.count:0)+(this.right?this.right.count:0)+this.leftPoints.length}else this.left?AA(this,this.left):AA(this,this.right);return Ul}for(var a=nw.ge(this.leftPoints,e,RA);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=nw.ge(this.rightPoints,e,OA);r<this.rightPoints.length&&this.rightPoints[r][1]===e[1];++r)if(this.rightPoints[r]===e)return this.rightPoints.splice(r,1),Ul}return sd}};function l9(e,t,n){for(var r=0;r<e.length&&e[r][0]<=t;++r){var i=n(e[r]);if(i)return i}}function u9(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 f9(e,t){for(var n=0;n<e.length;++n){var r=t(e[n]);if(r)return r}}ly.queryPoint=function(e,t){if(e<this.mid){if(this.left){var n=this.left.queryPoint(e,t);if(n)return n}return l9(this.leftPoints,e,t)}else if(e>this.mid){if(this.right){var n=this.right.queryPoint(e,t);if(n)return n}return u9(this.rightPoints,e,t)}else return f9(this.leftPoints,t)};ly.queryInterval=function(e,t,n){if(e<this.mid&&this.left){var r=this.left.queryInterval(e,t,n);if(r)return r}if(t>this.mid&&this.right){var r=this.right.queryInterval(e,t,n);if(r)return r}return t<this.mid?l9(this.leftPoints,t,n):e>this.mid?u9(this.rightPoints,e,n):f9(this.leftPoints,n)};function rtt(e,t){return e-t}function RA(e,t){var n=e[0]-t[0];return n||e[1]-t[1]}function OA(e,t){var n=e[1]-t[1];return n||e[0]-t[0]}function ad(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(rtt);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(RA),l.sort(OA),new NA(r,ad(i),ad(o),c,l)}function MA(e){this.root=e}var cd=MA.prototype;cd.insert=function(e){this.root?this.root.insert(e):this.root=new NA(e[0],null,null,[e],[e])};cd.remove=function(e){if(this.root){var t=this.root.remove(e);return t===ew&&(this.root=null),t!==sd}return!1};cd.queryPoint=function(e,t){if(this.root)return this.root.queryPoint(e,t)};cd.queryInterval=function(e,t,n){if(e<=t&&this.root)return this.root.queryInterval(e,t,n)};Object.defineProperty(cd,"count",{get:function(){return this.root?this.root.count:0}});Object.defineProperty(cd,"intervals",{get:function(){return this.root?this.root.intervals([]):[]}});function itt(e){return!e||e.length===0?new MA(null):new MA(ad(e))}});var wR={};function _d(e,t=!1){let n,r,i=wR;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=wR,a(u)}),i=l}return t?c:a}var ur=class{constructor(t){this._filterBy=t,this._requestUpdate=_d(()=>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 SR(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 vR(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 Sr(e,t,n){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var r=n.apply(e,t||[]),i,o=[];return i={},s("next"),s("throw"),s("return"),i[Symbol.asyncIterator]=function(){return this},i;function s(d){r[d]&&(i[d]=function(h){return new Promise(function(p,m){o.push([d,h,p,m])>1||a(d,h)})})}function a(d,h){try{c(r[d](h))}catch(p){f(o[0][3],p)}}function c(d){d.value instanceof 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 Vl(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 vR=="function"?vR(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 Iw={};vr(Iw,{compareArrayLike:()=>Sw,joinUint8Arrays:()=>Tr,memcpy:()=>Yl,rebaseValueOffsets:()=>Uy,toArrayBufferView:()=>Pt,toArrayBufferViewAsyncIterator:()=>_i,toArrayBufferViewIterator:()=>Xi,toBigInt64Array:()=>U$,toBigUint64Array:()=>j$,toFloat32Array:()=>V$,toFloat32ArrayAsyncIterator:()=>sU,toFloat32ArrayIterator:()=>K$,toFloat64Array:()=>Y$,toFloat64ArrayAsyncIterator:()=>aU,toFloat64ArrayIterator:()=>J$,toInt16Array:()=>$$,toInt16ArrayAsyncIterator:()=>nU,toInt16ArrayIterator:()=>X$,toInt32Array:()=>xc,toInt32ArrayAsyncIterator:()=>rU,toInt32ArrayIterator:()=>H$,toInt8Array:()=>P$,toInt8ArrayAsyncIterator:()=>eU,toInt8ArrayIterator:()=>W$,toUint16Array:()=>z$,toUint16ArrayAsyncIterator:()=>iU,toUint16ArrayIterator:()=>Z$,toUint32Array:()=>q$,toUint32ArrayAsyncIterator:()=>oU,toUint32ArrayIterator:()=>Q$,toUint8Array:()=>Ot,toUint8ArrayAsyncIterator:()=>vw,toUint8ArrayIterator:()=>ww,toUint8ClampedArray:()=>G$,toUint8ClampedArrayAsyncIterator:()=>cU,toUint8ClampedArrayIterator:()=>tU});var F$=new TextDecoder("utf-8"),wd=e=>F$.decode(e),L$=new TextEncoder,oa=e=>L$.encode(e);var C$=e=>typeof e=="number",IR=e=>typeof e=="boolean",tn=e=>typeof e=="function",Vn=e=>e!=null&&Object(e)===e,Ir=e=>Vn(e)&&tn(e.then);var xi=e=>Vn(e)&&tn(e[Symbol.iterator]),Gr=e=>Vn(e)&&tn(e[Symbol.asyncIterator]),Fy=e=>Vn(e)&&Vn(e.schema);var Ly=e=>Vn(e)&&"done"in e&&"value"in e;var Cy=e=>Vn(e)&&tn(e.stat)&&C$(e.fd);var By=e=>Vn(e)&&vd(e.body),Py=e=>"_getDOMStream"in e&&"_getNodeStream"in e,TR=e=>Vn(e)&&tn(e.abort)&&tn(e.getWriter)&&!Py(e),vd=e=>Vn(e)&&tn(e.cancel)&&tn(e.getReader)&&!Py(e),ER=e=>Vn(e)&&tn(e.end)&&tn(e.write)&&IR(e.writable)&&!Py(e),$y=e=>Vn(e)&&tn(e.read)&&tn(e.pipe)&&IR(e.readable)&&!Py(e),AR=e=>Vn(e)&&tn(e.clear)&&tn(e.bytes)&&tn(e.position)&&tn(e.setPosition)&&tn(e.capacity)&&tn(e.getBufferIdentifier)&&tn(e.createLong);var _w=typeof SharedArrayBuffer<"u"?SharedArrayBuffer:ArrayBuffer;function B$(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 Yl(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 Tr(e,t){let n=B$(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?Yl(s,o,a):s=o;break}Yl(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=Ly(t)?t.value:t;return n instanceof e?e===Uint8Array?new e(n.buffer,n.byteOffset,n.byteLength):n:n?(typeof n=="string"&&(n=oa(n)),n instanceof ArrayBuffer?new e(n):n instanceof _w?new e(n):AR(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 P$=e=>Pt(Int8Array,e),$$=e=>Pt(Int16Array,e),xc=e=>Pt(Int32Array,e),U$=e=>Pt(BigInt64Array,e),Ot=e=>Pt(Uint8Array,e),z$=e=>Pt(Uint16Array,e),q$=e=>Pt(Uint32Array,e),j$=e=>Pt(BigUint64Array,e),V$=e=>Pt(Float32Array,e),Y$=e=>Pt(Float64Array,e),G$=e=>Pt(Uint8ClampedArray,e),xw=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 _w?n(t):xi(t)?t:n(t);return yield*xw(function*(i){let o=null;do o=i.next(yield Pt(e,o));while(!o.done)}(r[Symbol.iterator]())),new e}var W$=e=>Xi(Int8Array,e),X$=e=>Xi(Int16Array,e),H$=e=>Xi(Int32Array,e),ww=e=>Xi(Uint8Array,e),Z$=e=>Xi(Uint16Array,e),Q$=e=>Xi(Uint32Array,e),K$=e=>Xi(Float32Array,e),J$=e=>Xi(Float64Array,e),tU=e=>Xi(Uint8ClampedArray,e);function _i(e,t){return Sr(this,arguments,function*(){if(Ir(t))return yield Ct(yield Ct(yield*Vl(bi(_i(e,yield Ct(t))))));let r=function(s){return Sr(this,arguments,function*(){yield yield Ct(yield Ct(s))})},i=function(s){return Sr(this,arguments,function*(){yield Ct(yield*Vl(bi(xw(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 _w?r(t):xi(t)?i(t):Gr(t)?t:r(t);return yield Ct(yield*Vl(bi(xw(function(s){return Sr(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),nU=e=>_i(Int16Array,e),rU=e=>_i(Int32Array,e),vw=e=>_i(Uint8Array,e),iU=e=>_i(Uint16Array,e),oU=e=>_i(Uint32Array,e),sU=e=>_i(Float32Array,e),aU=e=>_i(Float64Array,e),cU=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 Sw(e,t){let n=0,r=e.length;if(r!==t.length)return!1;if(r>0)do if(e[n]!==t[n])return!1;while(++n<r);return!0}var bn={fromIterable(e){return zy(lU(e))},fromAsyncIterable(e){return zy(uU(e))},fromDOMStream(e){return zy(fU(e))},fromNodeStream(e){return zy(dU(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')}},zy=e=>(e.next(),e);function*lU(e){let t,n=!1,r=[],i,o,s,a=0;function c(){return o==="peek"?Tr(r,s)[0]:([i,r,a]=Tr(r,s),i)}({cmd:o,size:s}=yield null);let l=ww(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 uU(e){return Sr(this,arguments,function*(){let n,r=!1,i=[],o,s,a,c=0;function l(){return s==="peek"?Tr(i,a)[0]:([o,i,c]=Tr(i,a),o)}({cmd:s,size:a}=yield yield Ct(null));let u=vw(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 fU(e){return Sr(this,arguments,function*(){let n=!1,r=!1,i=[],o,s,a,c=0;function l(){return s==="peek"?Tr(i,a)[0]:([o,i,c]=Tr(i,a),o)}({cmd:s,size:a}=yield yield Ct(null));let u=new Ew(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 Ew=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})}},Tw=(e,t)=>{let n=i=>r([t,i]),r;return[t,n,new Promise(i=>(r=i)&&e.once(t,n))]};function dU(e){return Sr(this,arguments,function*(){let n=[],r="error",i=!1,o=null,s,a,c=0,l=[],u;function f(){return s==="peek"?Tr(l,a)[0]:([u,l,c]=Tr(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]=Tw(e,"end"),n[1]=Tw(e,"error");do{if(n[2]=Tw(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((m,g)=>{for(let[y,b]of h)e.off(y,b);try{let y=e.destroy;y&&y.call(e,p),p=void 0}catch(y){p=y||p}finally{p!=null?g(p):m()}})}})}var 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 xn;(function(e){e[e.DAY=0]="DAY",e[e.MILLISECOND=1]="MILLISECOND"})(xn||(xn={}));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 Yn;(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"})(Yn||(Yn={}));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 Wr;(function(e){e[e.OFFSET=0]="OFFSET",e[e.DATA=1]="DATA",e[e.VALIDITY=2]="VALIDITY",e[e.TYPE=3]="TYPE"})(Wr||(Wr={}));var Yw={};vr(Yw,{clampIndex:()=>rz,clampRange:()=>Ed,createElementComparator:()=>ca});var Aw={};vr(Aw,{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 Nw={};vr(Nw,{BN:()=>Id,bigNumToBigInt:()=>RR,bigNumToString:()=>Xl,isArrowBigNumSymbol:()=>MR});var MR=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[MR]=!0;vi.prototype.toJSON=function(){return`"${Xl(this)}"`};vi.prototype.valueOf=function(){return NR(this)};vi.prototype.toString=function(){return Xl(this)};vi.prototype[Symbol.toPrimitive]=function(e="default"){switch(e){case"number":return NR(this);case"string":return Xl(this);case"default":return RR(this)}return Xl(this)};function Gl(...e){return vi.apply(this,e)}function Wl(...e){return vi.apply(this,e)}function Sd(...e){return vi.apply(this,e)}Object.setPrototypeOf(Gl.prototype,Object.create(Int32Array.prototype));Object.setPrototypeOf(Wl.prototype,Object.create(Uint32Array.prototype));Object.setPrototypeOf(Sd.prototype,Object.create(Uint32Array.prototype));Object.assign(Gl.prototype,vi.prototype,{constructor:Gl,signed:!0,TypedArray:Int32Array,BigIntArray:BigInt64Array});Object.assign(Wl.prototype,vi.prototype,{constructor:Wl,signed:!1,TypedArray:Uint32Array,BigIntArray:BigUint64Array});Object.assign(Sd.prototype,vi.prototype,{constructor:Sd,signed:!0,TypedArray:Uint32Array,BigIntArray:BigUint64Array});function NR(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 Xl=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)}`},RR=e=>e.byteLength===8?new e.BigIntArray(e.buffer,e.byteOffset,1)[0]:Xl(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 Id=class e{static new(t,n){switch(n){case!0:return new Gl(t);case!1:return new Wl(t)}switch(t.constructor){case Int8Array:case Int16Array:case Int32Array:case BigInt64Array:return new Gl(t)}return t.byteLength===16?new Sd(t):new Wl(t)}static signed(t){return new Gl(t)}static unsigned(t){return new Wl(t)}static decimal(t){return new Sd(t)}constructor(t,n){return e.new(t,n)}};function fr(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 OR,DR,kR,FR,LR,CR,BR,PR,$R,UR,zR,qR,jR,VR,YR,GR,WR,XR,HR,ZR,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}};OR=Symbol.toStringTag;at[OR]=(e=>(e.children=null,e.ArrayType=Array,e[Symbol.toStringTag]="DataType"))(at.prototype);var Gn=class extends at{toString(){return"Null"}get typeId(){return D.Null}};DR=Symbol.toStringTag;Gn[DR]=(e=>e[Symbol.toStringTag]="Null")(Gn.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}`}};kR=Symbol.toStringTag;Pe[kR]=(e=>(e.isSigned=null,e.bitWidth=null,e[Symbol.toStringTag]="Int"))(Pe.prototype);var qy=class extends Pe{constructor(){super(!0,8)}get ArrayType(){return Int8Array}},jy=class extends Pe{constructor(){super(!0,16)}get ArrayType(){return Int16Array}},Hi=class extends Pe{constructor(){super(!0,32)}get ArrayType(){return Int32Array}},Vy=class extends Pe{constructor(){super(!0,64)}get ArrayType(){return BigInt64Array}},Yy=class extends Pe{constructor(){super(!1,8)}get ArrayType(){return Uint8Array}},Gy=class extends Pe{constructor(){super(!1,16)}get ArrayType(){return Uint16Array}},Wy=class extends Pe{constructor(){super(!1,32)}get ArrayType(){return Uint32Array}},Xy=class extends Pe{constructor(){super(!1,64)}get ArrayType(){return BigUint64Array}};Object.defineProperty(qy.prototype,"ArrayType",{value:Int8Array});Object.defineProperty(jy.prototype,"ArrayType",{value:Int16Array});Object.defineProperty(Hi.prototype,"ArrayType",{value:Int32Array});Object.defineProperty(Vy.prototype,"ArrayType",{value:BigInt64Array});Object.defineProperty(Yy.prototype,"ArrayType",{value:Uint8Array});Object.defineProperty(Gy.prototype,"ArrayType",{value:Uint16Array});Object.defineProperty(Wy.prototype,"ArrayType",{value:Uint32Array});Object.defineProperty(Xy.prototype,"ArrayType",{value:BigUint64Array});var dr=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}`}};FR=Symbol.toStringTag;dr[FR]=(e=>(e.precision=null,e[Symbol.toStringTag]="Float"))(dr.prototype);var Hy=class extends dr{constructor(){super(xe.HALF)}},Zy=class extends dr{constructor(){super(xe.SINGLE)}},Qy=class extends dr{constructor(){super(xe.DOUBLE)}};Object.defineProperty(Hy.prototype,"ArrayType",{value:Uint16Array});Object.defineProperty(Zy.prototype,"ArrayType",{value:Float32Array});Object.defineProperty(Qy.prototype,"ArrayType",{value:Float64Array});var Yo=class extends at{constructor(){super()}get typeId(){return D.Binary}toString(){return"Binary"}};LR=Symbol.toStringTag;Yo[LR]=(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"}};CR=Symbol.toStringTag;Go[CR]=(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"}};BR=Symbol.toStringTag;Wo[BR]=(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}<${xn[this.unit]}>`}};$R=Symbol.toStringTag;Ho[$R]=(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`)}};UR=Symbol.toStringTag;Si[UR]=(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}`:""}>`}};zR=Symbol.toStringTag;Zo[zR]=(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<${Yn[this.unit]}>`}};qR=Symbol.toStringTag;Qo[qR]=(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]}>`}};jR=Symbol.toStringTag;Ko[jR]=(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}};VR=Symbol.toStringTag;Ii[VR]=(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(", ")}}>`}};YR=Symbol.toStringTag;ye[YR]=(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(" | ")}>`}};GR=Symbol.toStringTag;Ti[GR]=(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}]`}};WR=Symbol.toStringTag;Jo[WR]=(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}>`}};XR=Symbol.toStringTag;Ei[XR]=(e=>(e.children=null,e.listSize=null,e[Symbol.toStringTag]="FixedSizeList"))(Ei.prototype);var Ai=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(", ")}}>`}};HR=Symbol.toStringTag;Ai[HR]=(e=>(e.children=null,e.keysSorted=null,e[Symbol.toStringTag]="Map_"))(Ai.prototype);var hU=(e=>()=>++e)(-1),Er=class extends at{constructor(t,n,r,i){super(),this.indices=n,this.dictionary=t,this.isOrdered=i||!1,this.id=r==null?hU():fr(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}>`}};ZR=Symbol.toStringTag;Er[ZR]=(e=>(e.id=null,e.indices=null,e.isOrdered=null,e.dictionary=null,e[Symbol.toStringTag]="Dictionary"))(Er.prototype);function Ar(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 pU(this,t,n)}getVisitFnByTypeId(t,n=!0){return Hl(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 pU(e,t,n=!0){return typeof t=="number"?Hl(e,t,n):typeof t=="string"&&t in D?Hl(e,D[t],n):t&&t instanceof at?Hl(e,QR(t),n):t?.type&&t.type instanceof at?Hl(e,QR(t.type),n):Hl(e,D.NONE,n)}function Hl(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 QR(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 xn.DAY:return D.DateDay;case xn.MILLISECOND:return D.DateMillisecond}return D.Date;case D.Interval:switch(e.unit){case Yn.DAY_TIME:return D.IntervalDayTime;case Yn.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 Rw={};vr(Rw,{float64ToUint16:()=>Td,uint16ToFloat64:()=>Ky});var KR=new Float64Array(1),Zl=new Uint32Array(KR.buffer);function Ky(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 Td(e){if(e!==e)return 32256;KR[0]=e;let t=(Zl[1]&2147483648)>>16&65535,n=Zl[1]&2146435072,r=0;return n>=1089470464?Zl[0]>0?n=31744:(n=(n&2080374784)>>16,r=(Zl[1]&1048575)>>10):n<=1056964608?(r=1048576+(Zl[1]&1048575),r=1048576+(r<<(n>>20)-998)>>21,n=0):(n=n-1056964608>>10,r=(Zl[1]&1048575)+512>>10),t|n|r&65535}var vt=class extends ut{};function At(e){return(t,n,r)=>{if(t.setValid(n,r!=null))return e(t,n,r)}}var mU=(e,t,n)=>{e[t]=Math.trunc(n/864e5)},Ow=(e,t,n)=>{e[t]=Math.trunc(n%4294967296),e[t+1]=Math.trunc(n/4294967296)},yU=(e,t,n)=>{e[t]=Math.trunc(n*1e3%4294967296),e[t+1]=Math.trunc(n*1e3/4294967296)},gU=(e,t,n)=>{e[t]=Math.trunc(n*1e6%4294967296),e[t+1]=Math.trunc(n*1e6/4294967296)},JR=(e,t,n,r)=>{if(n+1<t.length){let{[n]:i,[n+1]:o}=t;e.set(r.subarray(0,o-i),i)}},bU=({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},Dw=({values:e},t,n)=>{e[t]=n},tO=({values:e},t,n)=>{e[t]=Td(n)},xU=(e,t,n)=>{switch(e.type.precision){case xe.HALF:return tO(e,t,n);case xe.SINGLE:case xe.DOUBLE:return Dw(e,t,n)}},Jy=({values:e},t,n)=>{mU(e,t,n.valueOf())},tg=({values:e},t,n)=>{Ow(e,t*2,n.valueOf())},kw=({stride:e,values:t},n,r)=>{t.set(r.subarray(0,e),e*n)},_U=({values:e,valueOffsets:t},n,r)=>JR(e,t,n,r),wU=({values:e,valueOffsets:t},n,r)=>{JR(e,t,n,oa(r))},Fw=(e,t,n)=>{e.type.unit===xn.DAY?Jy(e,t,n):tg(e,t,n)},eg=({values:e},t,n)=>Ow(e,t*2,n/1e3),ng=({values:e},t,n)=>Ow(e,t*2,n),rg=({values:e},t,n)=>yU(e,t*2,n),ig=({values:e},t,n)=>gU(e,t*2,n),Lw=(e,t,n)=>{switch(e.type.unit){case pt.SECOND:return eg(e,t,n);case pt.MILLISECOND:return ng(e,t,n);case pt.MICROSECOND:return rg(e,t,n);case pt.NANOSECOND:return ig(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},cg=({values:e},t,n)=>{e[t]=n},Cw=(e,t,n)=>{switch(e.type.unit){case pt.SECOND:return og(e,t,n);case pt.MILLISECOND:return sg(e,t,n);case pt.MICROSECOND:return ag(e,t,n);case pt.NANOSECOND:return cg(e,t,n)}},Bw=({values:e,stride:t},n,r)=>{e.set(r.subarray(0,t),t*n)},vU=(e,t,n)=>{let r=e.children[0],i=e.valueOffsets,o=_n.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))},SU=(e,t,n)=>{let r=e.children[0],{valueOffsets:i}=e,o=_n.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},IU=(e,t)=>(n,r,i,o)=>r&&n(r,e,t[o]),TU=(e,t)=>(n,r,i,o)=>r&&n(r,e,t.get(o)),EU=(e,t)=>(n,r,i,o)=>r&&n(r,e,t.get(i.name)),AU=(e,t)=>(n,r,i,o)=>r&&n(r,e,t[i.name]),MU=(e,t,n)=>{let r=e.type.children.map(o=>_n.getVisitFn(o.type)),i=n instanceof Map?EU(t,n):n instanceof Vt?TU(t,n):Array.isArray(n)?IU(t,n):AU(t,n);e.type.children.forEach((o,s)=>i(r[s],e.children[s],o,s))},NU=(e,t,n)=>{e.type.mode===me.Dense?eO(e,t,n):nO(e,t,n)},eO=(e,t,n)=>{let r=e.type.typeIdToChildIndex[e.typeIds[t]],i=e.children[r];_n.visit(i,e.valueOffsets[t],n)},nO=(e,t,n)=>{let r=e.type.typeIdToChildIndex[e.typeIds[t]],i=e.children[r];_n.visit(i,t,n)},RU=(e,t,n)=>{var r;(r=e.dictionary)===null||r===void 0||r.set(e.values[t],n)},Pw=(e,t,n)=>{e.type.unit===Yn.DAY_TIME?lg(e,t,n):ug(e,t,n)},lg=({values:e},t,n)=>{e.set(n.subarray(0,2),2*t)},ug=({values:e},t,n)=>{e[t]=n[0]*12+n[1]%12},fg=({values:e},t,n)=>{e[t]=n},dg=({values:e},t,n)=>{e[t]=n},hg=({values:e},t,n)=>{e[t]=n},pg=({values:e},t,n)=>{e[t]=n},$w=(e,t,n)=>{switch(e.type.unit){case pt.SECOND:return fg(e,t,n);case pt.MILLISECOND:return dg(e,t,n);case pt.MICROSECOND:return hg(e,t,n);case pt.NANOSECOND:return pg(e,t,n)}},OU=(e,t,n)=>{let{stride:r}=e,i=e.children[0],o=_n.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=At(bU);vt.prototype.visitInt=At(ts);vt.prototype.visitInt8=At(ts);vt.prototype.visitInt16=At(ts);vt.prototype.visitInt32=At(ts);vt.prototype.visitInt64=At(ts);vt.prototype.visitUint8=At(ts);vt.prototype.visitUint16=At(ts);vt.prototype.visitUint32=At(ts);vt.prototype.visitUint64=At(ts);vt.prototype.visitFloat=At(xU);vt.prototype.visitFloat16=At(tO);vt.prototype.visitFloat32=At(Dw);vt.prototype.visitFloat64=At(Dw);vt.prototype.visitUtf8=At(wU);vt.prototype.visitBinary=At(_U);vt.prototype.visitFixedSizeBinary=At(kw);vt.prototype.visitDate=At(Fw);vt.prototype.visitDateDay=At(Jy);vt.prototype.visitDateMillisecond=At(tg);vt.prototype.visitTimestamp=At(Lw);vt.prototype.visitTimestampSecond=At(eg);vt.prototype.visitTimestampMillisecond=At(ng);vt.prototype.visitTimestampMicrosecond=At(rg);vt.prototype.visitTimestampNanosecond=At(ig);vt.prototype.visitTime=At(Cw);vt.prototype.visitTimeSecond=At(og);vt.prototype.visitTimeMillisecond=At(sg);vt.prototype.visitTimeMicrosecond=At(ag);vt.prototype.visitTimeNanosecond=At(cg);vt.prototype.visitDecimal=At(Bw);vt.prototype.visitList=At(vU);vt.prototype.visitStruct=At(MU);vt.prototype.visitUnion=At(NU);vt.prototype.visitDenseUnion=At(eO);vt.prototype.visitSparseUnion=At(nO);vt.prototype.visitDictionary=At(RU);vt.prototype.visitInterval=At(Pw);vt.prototype.visitIntervalDayTime=At(lg);vt.prototype.visitIntervalYearMonth=At(ug);vt.prototype.visitDuration=At($w);vt.prototype.visitDurationSecond=At(fg);vt.prototype.visitDurationMillisecond=At(dg);vt.prototype.visitDurationMicrosecond=At(hg);vt.prototype.visitDurationNanosecond=At(pg);vt.prototype.visitFixedSizeList=At(OU);vt.prototype.visitMap=At(SU);var _n=new vt;var Mi=Symbol.for("parent"),Ql=Symbol.for("rowIndex"),sa=class{constructor(t,n){return this[Mi]=t,this[Ql]=n,new Proxy(this,new zw)}toArray(){return Object.values(this.toJSON())}toJSON(){let t=this[Ql],n=this[Mi],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[Mi],this[Ql])}},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(sa.prototype,{[Symbol.toStringTag]:{enumerable:!1,configurable:!1,value:"Row"},[Mi]:{writable:!0,enumerable:!1,configurable:!1,value:null},[Ql]:{writable:!0,enumerable:!1,configurable:!1,value:-1}});var zw=class{isExtensible(){return!1}deleteProperty(){return!1}preventExtensions(){return!0}ownKeys(t){return t[Mi].type.children.map(n=>n.name)}has(t,n){return t[Mi].type.children.findIndex(r=>r.name===n)!==-1}getOwnPropertyDescriptor(t,n){if(t[Mi].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[Mi].type.children.findIndex(i=>i.name===n);if(r!==-1){let i=je.visit(t[Mi].children[r],t[Ql]);return Reflect.set(t,n,i),i}}set(t,n,r){let i=t[Mi].type.children.findIndex(o=>o.name===n);return i!==-1?(_n.visit(t[Mi].children[i],t[Ql],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 DU=(e,t)=>864e5*e[t],qw=(e,t)=>4294967296*e[t+1]+(e[t]>>>0),kU=(e,t)=>4294967296*(e[t+1]/1e3)+(e[t]>>>0)/1e3,FU=(e,t)=>4294967296*(e[t+1]/1e6)+(e[t]>>>0)/1e6,rO=e=>new Date(e),LU=(e,t)=>rO(DU(e,t)),CU=(e,t)=>rO(qw(e,t)),BU=(e,t)=>null,iO=(e,t,n)=>{if(n+1>=t.length)return null;let r=t[n],i=t[n+1];return e.subarray(r,i)},PU=({offset:e,values:t},n)=>{let r=e+n;return(t[r>>3]&1<<r%8)!==0},oO=({values:e},t)=>LU(e,t),sO=({values:e},t)=>CU(e,t*2),aa=({stride:e,values:t},n)=>t[e*n],$U=({stride:e,values:t},n)=>Ky(t[e*n]),aO=({values:e},t)=>e[t],UU=({stride:e,values:t},n)=>t.subarray(e*n,e*(n+1)),zU=({values:e,valueOffsets:t},n)=>iO(e,t,n),qU=({values:e,valueOffsets:t},n)=>{let r=iO(e,t,n);return r!==null?wd(r):null},jU=({values:e},t)=>e[t],VU=({type:e,values:t},n)=>e.precision!==xe.HALF?t[n]:Ky(t[n]),YU=(e,t)=>e.type.unit===xn.DAY?oO(e,t):sO(e,t),cO=({values:e},t)=>1e3*qw(e,t*2),lO=({values:e},t)=>qw(e,t*2),uO=({values:e},t)=>kU(e,t*2),fO=({values:e},t)=>FU(e,t*2),GU=(e,t)=>{switch(e.type.unit){case pt.SECOND:return cO(e,t);case pt.MILLISECOND:return lO(e,t);case pt.MICROSECOND:return uO(e,t);case pt.NANOSECOND:return fO(e,t)}},dO=({values:e},t)=>e[t],hO=({values:e},t)=>e[t],pO=({values:e},t)=>e[t],mO=({values:e},t)=>e[t],WU=(e,t)=>{switch(e.type.unit){case pt.SECOND:return dO(e,t);case pt.MILLISECOND:return hO(e,t);case pt.MICROSECOND:return pO(e,t);case pt.NANOSECOND:return mO(e,t)}},XU=({values:e,stride:t},n)=>Id.decimal(e.subarray(t*n,t*(n+1))),HU=(e,t)=>{let{valueOffsets:n,stride:r,children:i}=e,{[t*r]:o,[t*r+1]:s}=n,c=i[0].slice(o,s-o);return new Vt([c])},ZU=(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))},QU=(e,t)=>new sa(e,t),KU=(e,t)=>e.type.mode===me.Dense?yO(e,t):gO(e,t),yO=(e,t)=>{let n=e.type.typeIdToChildIndex[e.typeIds[t]],r=e.children[n];return je.visit(r,e.valueOffsets[t])},gO=(e,t)=>{let n=e.type.typeIdToChildIndex[e.typeIds[t]],r=e.children[n];return je.visit(r,t)},JU=(e,t)=>{var n;return(n=e.dictionary)===null||n===void 0?void 0:n.get(e.values[t])},tz=(e,t)=>e.type.unit===Yn.DAY_TIME?bO(e,t):xO(e,t),bO=({values:e},t)=>e.subarray(2*t,2*(t+1)),xO=({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},_O=({values:e},t)=>e[t],wO=({values:e},t)=>e[t],vO=({values:e},t)=>e[t],SO=({values:e},t)=>e[t],ez=(e,t)=>{switch(e.type.unit){case pt.SECOND:return _O(e,t);case pt.MILLISECOND:return wO(e,t);case pt.MICROSECOND:return vO(e,t);case pt.NANOSECOND:return SO(e,t)}},nz=(e,t)=>{let{stride:n,children:r}=e,o=r[0].slice(t*n,n);return new Vt([o])};gt.prototype.visitNull=Tt(BU);gt.prototype.visitBool=Tt(PU);gt.prototype.visitInt=Tt(jU);gt.prototype.visitInt8=Tt(aa);gt.prototype.visitInt16=Tt(aa);gt.prototype.visitInt32=Tt(aa);gt.prototype.visitInt64=Tt(aO);gt.prototype.visitUint8=Tt(aa);gt.prototype.visitUint16=Tt(aa);gt.prototype.visitUint32=Tt(aa);gt.prototype.visitUint64=Tt(aO);gt.prototype.visitFloat=Tt(VU);gt.prototype.visitFloat16=Tt($U);gt.prototype.visitFloat32=Tt(aa);gt.prototype.visitFloat64=Tt(aa);gt.prototype.visitUtf8=Tt(qU);gt.prototype.visitBinary=Tt(zU);gt.prototype.visitFixedSizeBinary=Tt(UU);gt.prototype.visitDate=Tt(YU);gt.prototype.visitDateDay=Tt(oO);gt.prototype.visitDateMillisecond=Tt(sO);gt.prototype.visitTimestamp=Tt(GU);gt.prototype.visitTimestampSecond=Tt(cO);gt.prototype.visitTimestampMillisecond=Tt(lO);gt.prototype.visitTimestampMicrosecond=Tt(uO);gt.prototype.visitTimestampNanosecond=Tt(fO);gt.prototype.visitTime=Tt(WU);gt.prototype.visitTimeSecond=Tt(dO);gt.prototype.visitTimeMillisecond=Tt(hO);gt.prototype.visitTimeMicrosecond=Tt(pO);gt.prototype.visitTimeNanosecond=Tt(mO);gt.prototype.visitDecimal=Tt(XU);gt.prototype.visitList=Tt(HU);gt.prototype.visitStruct=Tt(QU);gt.prototype.visitUnion=Tt(KU);gt.prototype.visitDenseUnion=Tt(yO);gt.prototype.visitSparseUnion=Tt(gO);gt.prototype.visitDictionary=Tt(JU);gt.prototype.visitInterval=Tt(tz);gt.prototype.visitIntervalDayTime=Tt(bO);gt.prototype.visitIntervalYearMonth=Tt(xO);gt.prototype.visitDuration=Tt(ez);gt.prototype.visitDurationSecond=Tt(_O);gt.prototype.visitDurationMillisecond=Tt(wO);gt.prototype.visitDurationMicrosecond=Tt(vO);gt.prototype.visitDurationNanosecond=Tt(SO);gt.prototype.visitFixedSizeList=Tt(nz);gt.prototype.visitMap=Tt(ZU);var je=new gt;var Xr=Symbol.for("keys"),Kl=Symbol.for("vals"),Zi=class{constructor(t){return this[Xr]=new Vt([t.children[0]]).memoize(),this[Kl]=t.children[1],new Proxy(this,new Vw)}[Symbol.iterator](){return new jw(this[Xr],this[Kl])}get size(){return this[Xr].length}toArray(){return Object.values(this.toJSON())}toJSON(){let t=this[Xr],n=this[Kl],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()}},jw=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)]})}},Vw=class{isExtensible(){return!1}deleteProperty(){return!1}preventExtensions(){return!0}ownKeys(t){return t[Xr].toArray().map(String)}has(t,n){return t[Xr].includes(n)}getOwnPropertyDescriptor(t,n){if(t[Xr].indexOf(n)!==-1)return{writable:!0,enumerable:!0,configurable:!0}}get(t,n){if(Reflect.has(t,n))return t[n];let r=t[Xr].indexOf(n);if(r!==-1){let i=je.visit(Reflect.get(t,Kl),r);return Reflect.set(t,n,i),i}}set(t,n,r){let i=t[Xr].indexOf(n);return i!==-1?(_n.visit(Reflect.get(t,Kl),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"},[Xr]:{writable:!0,enumerable:!1,configurable:!1,value:null},[Kl]:{writable:!0,enumerable:!1,configurable:!1,value:null}});function rz(e,t,n){let r=e.length,i=t>-1?t:r+t%r;return n?n(e,i):i}var IO;function Ed(e,t,n,r){let{length:i=0}=e,o=typeof t!="number"?0:t,s=typeof n!="number"?i:n;return o<0&&(o=(o%i+i)%i),s<0&&(s=(s%i+i)%i),s<o&&(IO=o,o=s,s=IO),s>i&&(s=i),r?r(e,o,s):[o,s]}var TO=e=>e!==e;function ca(e){if(typeof e!=="object"||e===null)return TO(e)?TO: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?Sw(e,n):!1:e instanceof Map?oz(e):Array.isArray(e)?iz(e):e instanceof Vt?sz(e):az(e,!0)}function iz(e){let t=[];for(let n=-1,r=e.length;++n<r;)t[n]=ca(e[n]);return mg(t)}function oz(e){let t=-1,n=[];for(let r of e.values())n[++t]=ca(r);return mg(n)}function sz(e){let t=[];for(let n=-1,r=e.length;++n<r;)t[n]=ca(e.get(n));return mg(t)}function az(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]=ca(e[n[i]]);return mg(r,n)}function mg(e,t){return n=>{if(!n||typeof n!="object")return!1;switch(n.constructor){case Array:return cz(e,n);case Map:return EO(e,n,n.keys());case Zi:case sa:case Object:case void 0:return EO(e,n,t||Object.keys(n))}return n instanceof Vt?lz(e,n):!1}}function cz(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 lz(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 EO(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 Gw={};vr(Gw,{BitIterator:()=>_c,getBit:()=>AO,getBool:()=>gg,packBools:()=>vc,popcnt_array:()=>MO,popcnt_bit_range:()=>Ad,popcnt_uint32:()=>yg,setBool:()=>uz,truncateBitmap:()=>wc});function gg(e,t,n,r){return(n&1<<r)!==0}function AO(e,t,n,r){return(n&1<<r)>>r}function uz(e,t,n){return n?!!(e[t>>3]|=1<<t%8)||!0:!(e[t>>3]&=~(1<<t%8))&&!1}function wc(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):vc(new _c(n,e,t,null,gg)).subarray(0,r)),i}return n}function vc(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 _c=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 Ad(e,t,n){if(n-t<=0)return 0;if(n-t<8){let o=0;for(let s of new _c(e,t,n-t,e,AO))o+=s;return o}let r=n>>3<<3,i=t+(t%8===0?0:8-t%8);return Ad(e,t,i)+Ad(e,r,n)+MO(e,i>>3,r-i>>3)}function MO(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+=yg(o.getUint32(i)),i+=4;for(;s-i>=2;)r+=yg(o.getUint16(i)),i+=2;for(;s-i>=1;)r+=yg(o.getUint8(i)),i+=1;return r}function yg(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 fz=-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<=fz&&(n=this.nullBitmap)&&(this._nullCount=t=this.length-Ad(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=Ar(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(wc(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(wc(this.offset,n,this.nullBitmap),0);let o=this.buffers;return o[Wr.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[Wr.TYPE])&&(s[Wr.TYPE]=o.subarray(t,t+n)),(o=s[Wr.OFFSET])&&(s[Wr.OFFSET]=o.subarray(t,t+n+1))||(o=s[Wr.DATA])&&(s[Wr.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 Ww=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=xc(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=xc(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/Ar(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/Ar(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/Ar(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/Ar(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/Ar(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=xc(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=xc(t.valueOffsets);return new se(n,r,s,a,[c,void 0,void 0,o],i)}visitDictionary(t){let{["type"]:n,["offset"]:r=0}=t,i=Ot(t.nullBitmap),o=Pt(n.indices.ArrayType,t.data),{["dictionary"]:s=new Vt([new e().visit({type:n.dictionary})])}=t,{["length"]:a=o.length,["nullCount"]:c=t.nullBitmap?-1:0}=t;return new se(n,r,a,c,[void 0,o,i],[],s)}visitInterval(t){let{["type"]:n,["offset"]:r=0}=t,i=Ot(t.nullBitmap),o=Pt(n.ArrayType,t.data),{["length"]:s=o.length/Ar(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/Ar(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=xc(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])}},dz=new Ww;function Dt(e){return dz.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 bg(e){return e.reduce((t,n)=>t+n.nullCount,0)}function xg(e){return e.reduce((t,n,r)=>(t[r+1]=t[r]+n.length,t),new Uint32Array(e.length+1))}function _g(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 Xw(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 Nd(e,t){return e.getValid(t)}function la(e){function t(n,r,i){return e(n[r],i)}return function(n){let r=this.data;return Xw(r,this._offsets,n,t)}}function wg(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=Xw(o,this._offsets,r,n);return t=void 0,s}}function vg(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):Xw(o,this._offsets,i,n);return t=void 0,s}}var bt=class extends ut{};function hz(e,t){return t===null&&e.length>0?0:-1}function pz(e,t){let{nullBitmap:n}=e;if(!n||e.nullCount<=0)return-1;let r=0;for(let i of new _c(n,e.offset+(t||0),e.length,n,gg)){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 pz(e,n)}let r=je.getVisitFn(e),i=ca(t);for(let o=(n||0)-1,s=e.length;++o<s;)if(i(r(e,o)))return o;return-1}function NO(e,t,n){let r=je.getVisitFn(e),i=ca(t);for(let o=(n||0)-1,s=e.length;++o<s;)if(i(r(e,o)))return o;return-1}bt.prototype.visitNull=hz;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=NO;bt.prototype.visitSparseUnion=NO;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 Sc=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 dr&&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 Hw(s)})}var Hw=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 Jl=new xt;var mz=(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+Mr.visit(i,n),0)}visitFixedSizeBinary(t,n){return t.type.byteWidth}visitMap(t,n){return 8+t.children.reduce((r,i)=>r+Mr.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)}},yz=({valueOffsets:e},t)=>8+(e[t+1]-e[t]),gz=({valueOffsets:e},t)=>8+(e[t+1]-e[t]),bz=({valueOffsets:e,stride:t,children:n},r)=>{let i=n[0],{[r*t]:o}=e,{[r*t+1]:s}=e,a=Mr.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},xz=({stride:e,children:t},n)=>{let r=t[0],i=r.slice(n*e,e),o=Mr.getVisitFn(r.type),s=0;for(let a=-1,c=i.length;++a<c;)s+=o(i,a);return s},_z=(e,t)=>e.type.mode===me.Dense?RO(e,t):OO(e,t),RO=({type:e,children:t,typeIds:n,valueOffsets:r},i)=>{let o=e.typeIdToChildIndex[n[i]];return 8+Mr.visit(t[o],r[i])},OO=({children:e},t)=>4+Mr.visitMany(e,e.map(()=>t)).reduce(mz,0);Qi.prototype.visitUtf8=yz;Qi.prototype.visitBinary=gz;Qi.prototype.visitList=bz;Qi.prototype.visitFixedSizeList=xz;Qi.prototype.visitUnion=_z;Qi.prototype.visitDenseUnion=RO;Qi.prototype.visitSparseUnion=OO;var Mr=new Qi;var DO,kO={},FO={},Vt=class e{constructor(t){var n,r,i;let o=t[0]instanceof e?t.flatMap(a=>a.data):t;if(o.length===0||o.some(a=>!(a instanceof se)))throw new TypeError("Vector constructor expects an Array of Data instances.");let s=(n=o[0])===null||n===void 0?void 0:n.type;switch(o.length){case 0:this._offsets=[0];break;case 1:{let{get:a,set:c,indexOf:l,byteLength:u}=kO[s.typeId],f=o[0];this.isValid=d=>Nd(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,FO[s.typeId]),this._offsets=xg(o);break}this.data=o,this.type=s,this.stride=Ar(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 bg(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 Jl.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(Ed(this,t,n,({data:r,_offsets:i},o,s)=>_g(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 Sg(this.data[0].dictionary),n=this.data.map(r=>{let i=r.clone();return i.dictionary=t,i});return new e(n)}return new Sg(this)}unmemoize(){if(at.isDictionary(this.type)&&this.isMemoized){let t=this.data[0].dictionary.unmemoize(),n=this.data.map(r=>{let i=r.clone();return i.dictionary=t,i});return new e(n)}return this}};DO=Symbol.toStringTag;Vt[DO]=(e=>{e.type=at.prototype,e.data=[],e.length=0,e.stride=1,e.numChildren=0,e._offsets=new Uint32Array([0]),e[Symbol.isConcatSpreadable]=!0;let t=Object.keys(D).map(n=>D[n]).filter(n=>typeof n=="number"&&n!==D.NONE);for(let n of t){let r=je.getVisitFnByTypeId(n),i=_n.getVisitFnByTypeId(n),o=Sc.getVisitFnByTypeId(n),s=Mr.getVisitFnByTypeId(n);kO[n]={get:r,set:i,indexOf:o,byteLength:s},FO[n]=Object.create(e,{isValid:{value:la(Nd)},get:{value:la(je.getVisitFnByTypeId(n))},set:{value:wg(_n.getVisitFnByTypeId(n))},indexOf:{value:vg(Sc.getVisitFnByTypeId(n))},getByteLength:{value:la(Mr.getVisitFnByTypeId(n))}})}return"Vector"})(Vt.prototype);var Sg=class e extends Vt{constructor(t){super(t.data);let n=this.get,r=this.set,i=this.slice,o=new Array(this.length);Object.defineProperty(this,"get",{value(s){let a=o[s];if(a!==void 0)return a;let c=n.call(this,s);return o[s]=c,c}}),Object.defineProperty(this,"set",{value(s,a){r.call(this,s,a),o[s]=a}}),Object.defineProperty(this,"slice",{value:(s,a)=>new e(i.call(this,s,a))}),Object.defineProperty(this,"isMemoized",{value:!0}),Object.defineProperty(this,"unmemoize",{value:()=>new Vt(this.data)}),Object.defineProperty(this,"memoize",{value:()=>this})}};function LO(e){if(!e||e.length<=0)return function(i){return!0};let t="",n=e.filter(r=>r===r);return n.length>0&&(t=`
2
2
  switch (x) {${n.map(r=>`
3
- case ${G$(r)}:`).join("")}
3
+ case ${wz(r)}:`).join("")}
4
4
  return false;
5
5
  }`),e.length!==n.length&&(t=`if (x !== x) return false;
6
6
  ${t}`),new Function("x",`${t}
7
- return true;`)}function 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 wz(e){return typeof e!="bigint"?wi(e):`${wi(e)}n`}var Zw=(e,t)=>(Math.ceil(e)*t+63&-64||64)/t,vz=(e,t=0)=>e.length>=t?e.subarray(0,t):Yl(new e.constructor(t),e,0),ua=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?Zw(r*1,this.BYTES_PER_ELEMENT):Zw(r*2,this.BYTES_PER_ELEMENT))}return this}flush(t=this.length){t=Zw(t*this.stride,this.BYTES_PER_ELEMENT);let n=vz(this.buffer,t);return this.clear(),n}clear(){return this.length=0,this._resize(0),this}_resize(t){return this.buffer=Yl(new this.ArrayType(t),this.buffer)}};ua.prototype.offset=0;var es=class extends ua{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}},tu=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()}},eu=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=Ar(t),this._nulls=new tu,n&&n.length>0&&(this._isValid=LO(n))}toVector(){return new Vt([this.flush()])}get ArrayType(){return this.type.ArrayType}get nullCount(){return this._nulls.numInvalid}get numChildren(){return this.children.length}get byteLength(){let t=0,{_offsets:n,_values:r,_nulls:i,_typeIds:o,children:s}=this;return n&&(t+=n.byteLength),r&&(t+=r.byteLength),i&&(t+=i.byteLength),o&&(t+=o.byteLength),s.reduce((a,c)=>a+c.byteLength,t)}get reservedLength(){return this._nulls.reservedLength}get reservedByteLength(){let t=0;return this._offsets&&(t+=this._offsets.reservedByteLength),this._values&&(t+=this._values.reservedByteLength),this._nulls&&(t+=this._nulls.reservedByteLength),this._typeIds&&(t+=this._typeIds.reservedByteLength),this.children.reduce((n,r)=>n+r.reservedByteLength,t)}get valueOffsets(){return this._offsets?this._offsets.buffer:null}get values(){return this._values?this._values.buffer:null}get nullBitmap(){return this._nulls?this._nulls.buffer:null}get typeIds(){return this._typeIds?this._typeIds.buffer:null}append(t){return this.set(this.length,t)}isValid(t){return this._isValid(t)}set(t,n){return this.setValid(t,this.isValid(n))&&this.setValue(t,n),this}setValue(t,n){this._setValue(this,t,n)}setValid(t,n){return this.length=this._nulls.set(t,+n).length,n}addChild(t,n=`${this.numChildren}`){throw new Error(`Cannot append children to non-nested type "${this.type}"`)}getChildAt(t){return this.children[t]||null}flush(){let t,n,r,i,{type:o,length:s,nullCount:a,_typeIds:c,_offsets:l,_values:u,_nulls:f}=this;(n=c?.flush(s))?i=l?.flush(s):(i=l?.flush(s))?t=u?.flush(l.last()):t=u?.flush(s),a>0&&(r=f?.flush(s));let d=this.children.map(h=>h.flush());return this.clear(),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 eu}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[Xr].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 Ic=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),Ig=new Float32Array(Ji.buffer),Tg=new Float64Array(Ji.buffer),nu=new Uint16Array(new Uint8Array([1,0]).buffer)[0]===1;var Rd;(function(e){e[e.UTF8_BYTES=1]="UTF8_BYTES",e[e.UTF16_STRING=2]="UTF16_STRING"})(Rd||(Rd={}));var Nr=class e{constructor(t){this.bytes_=t,this.position_=0,this.text_decoder_=new TextDecoder}static allocate(t){return new e(new Uint8Array(t))}clear(){this.position_=0}bytes(){return this.bytes_}position(){return this.position_}setPosition(t){this.position_=t}capacity(){return this.bytes_.length}readInt8(t){return this.readUint8(t)<<24>>24}readUint8(t){return this.bytes_[t]}readInt16(t){return this.readUint16(t)<<16>>16}readUint16(t){return this.bytes_[t]|this.bytes_[t+1]<<8}readInt32(t){return this.bytes_[t]|this.bytes_[t+1]<<8|this.bytes_[t+2]<<16|this.bytes_[t+3]<<24}readUint32(t){return this.readInt32(t)>>>0}readInt64(t){return BigInt.asIntN(64,BigInt(this.readUint32(t))+(BigInt(this.readUint32(t+4))<<BigInt(32)))}readUint64(t){return BigInt.asUintN(64,BigInt(this.readUint32(t))+(BigInt(this.readUint32(t+4))<<BigInt(32)))}readFloat32(t){return Ji[0]=this.readInt32(t),Ig[0]}readFloat64(t){return Ji[nu?0:1]=this.readInt32(t),Ji[nu?1:0]=this.readInt32(t+4),Tg[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){Ig[0]=n,this.writeInt32(t,Ji[0])}writeFloat64(t,n){Tg[0]=n,this.writeInt32(t,Ji[nu?0:1]),this.writeInt32(t+4,Ji[nu?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===Rd.UTF8_BYTES?i:this.text_decoder_.decode(i)}__union_with_string(t,n){return typeof t=="string"?this.__string(n):this.__union(t,n)}__indirect(t){return t+this.readInt32(t)}__vector(t){return t+this.readInt32(t)+4}__vector_len(t){return this.readInt32(t+this.readInt32(t))}__has_identifier(t){if(t.length!=4)throw new Error("FlatBuffers: file identifier must be length "+4);for(let n=0;n<4;n++)if(t.charCodeAt(n)!=this.readInt8(this.position()+4+n))return!1;return!0}createScalarList(t,n){let r=[];for(let i=0;i<n;++i){let o=t(i);o!==null&&r.push(o)}return r}createObjList(t,n){let r=[];for(let i=0;i<n;++i){let o=t(i);o!==null&&r.push(o.unpack())}return r}};var Tc=class e{constructor(t){this.minalign=1,this.vtable=null,this.vtable_in_use=0,this.isNested=!1,this.object_start=0,this.vtables=[],this.vector_num_elems=0,this.force_defaults=!1,this.string_maps=null,this.text_encoder=new TextEncoder;let n;t?n=t:n=1024,this.bb=Nr.allocate(n),this.space=n}clear(){this.bb.clear(),this.space=this.bb.capacity(),this.minalign=1,this.vtable=null,this.vtable_in_use=0,this.isNested=!1,this.object_start=0,this.vtables=[],this.vector_num_elems=0,this.force_defaults=!1,this.string_maps=null}forceDefaults(t){this.force_defaults=t}dataBuffer(){return this.bb}asUint8Array(){return this.bb.bytes().subarray(this.bb.position(),this.bb.position()+this.offset())}prep(t,n){t>this.minalign&&(this.minalign=t);let r=~(this.bb.capacity()-this.space+n)+1&t-1;for(;this.space<r+t+n;){let i=this.bb.capacity();this.bb=e.growByteBuffer(this.bb),this.space+=this.bb.capacity()-i}this.pad(r)}pad(t){for(let n=0;n<t;n++)this.bb.writeInt8(--this.space,0)}writeInt8(t){this.bb.writeInt8(this.space-=1,t)}writeInt16(t){this.bb.writeInt16(this.space-=2,t)}writeInt32(t){this.bb.writeInt32(this.space-=4,t)}writeInt64(t){this.bb.writeInt64(this.space-=8,t)}writeFloat32(t){this.bb.writeFloat32(this.space-=4,t)}writeFloat64(t){this.bb.writeFloat64(this.space-=8,t)}addInt8(t){this.prep(1,0),this.writeInt8(t)}addInt16(t){this.prep(2,0),this.writeInt16(t)}addInt32(t){this.prep(4,0),this.writeInt32(t)}addInt64(t){this.prep(8,0),this.writeInt64(t)}addFloat32(t){this.prep(4,0),this.writeFloat32(t)}addFloat64(t){this.prep(8,0),this.writeFloat64(t)}addFieldInt8(t,n,r){(this.force_defaults||n!=r)&&(this.addInt8(n),this.slot(t))}addFieldInt16(t,n,r){(this.force_defaults||n!=r)&&(this.addInt16(n),this.slot(t))}addFieldInt32(t,n,r){(this.force_defaults||n!=r)&&(this.addInt32(n),this.slot(t))}addFieldInt64(t,n,r){(this.force_defaults||n!==r)&&(this.addInt64(n),this.slot(t))}addFieldFloat32(t,n,r){(this.force_defaults||n!=r)&&(this.addFloat32(n),this.slot(t))}addFieldFloat64(t,n,r){(this.force_defaults||n!=r)&&(this.addFloat64(n),this.slot(t))}addFieldOffset(t,n,r){(this.force_defaults||n!=r)&&(this.addOffset(n),this.slot(t))}addFieldStruct(t,n,r){n!=r&&(this.nested(n),this.slot(t))}nested(t){if(t!=this.offset())throw new TypeError("FlatBuffers: struct must be serialized inline.")}notNested(){if(this.isNested)throw new TypeError("FlatBuffers: object serialization must not be nested.")}slot(t){this.vtable!==null&&(this.vtable[t]=this.offset())}offset(){return this.bb.capacity()-this.space}static growByteBuffer(t){let n=t.capacity();if(n&3221225472)throw new Error("FlatBuffers: cannot grow buffer beyond 2 gigabytes.");let r=n<<1,i=Nr.allocate(r);return i.setPosition(r-n),i.bytes().set(t.bytes(),r-n),i}addOffset(t){this.prep(4,0),this.writeInt32(this.offset()-t+4)}startObject(t){this.notNested(),this.vtable==null&&(this.vtable=[]),this.vtable_in_use=t;for(let n=0;n<t;n++)this.vtable[n]=0;this.isNested=!0,this.object_start=this.offset()}endObject(){if(this.vtable==null||!this.isNested)throw new Error("FlatBuffers: endObject called without startObject");this.addInt32(0);let t=this.offset(),n=this.vtable_in_use-1;for(;n>=0&&this.vtable[n]==0;n--);let r=n+1;for(;n>=0;n--)this.addInt16(this.vtable[n]!=0?t-this.vtable[n]:0);let i=2;this.addInt16(t-this.object_start);let o=(r+i)*2;this.addInt16(o);let s=0,a=this.space;t:for(n=0;n<this.vtables.length;n++){let c=this.bb.capacity()-this.vtables[n];if(o==this.bb.readInt16(c)){for(let l=2;l<o;l+=2)if(this.bb.readInt16(a+l)!=this.bb.readInt16(c+l))continue t;s=this.vtables[n];break}}return s?(this.space=this.bb.capacity()-t,this.bb.writeInt32(this.space,s-t)):(this.vtables.push(this.offset()),this.bb.writeInt32(this.bb.capacity()-t,this.offset()-t)),this.isNested=!1,t}finish(t,n,r){let i=r?4:0;if(n){let o=n;if(this.prep(this.minalign,8+i),o.length!=4)throw new TypeError("FlatBuffers: file identifier must be length "+4);for(let s=3;s>=0;s--)this.writeInt8(o.charCodeAt(s))}this.prep(this.minalign,4+i),this.addOffset(t),i&&this.addInt32(this.bb.capacity()-this.space),this.bb.setPosition(this.space)}finishSizePrefixed(t,n){this.finish(t,n,!0)}requiredField(t,n){let r=this.bb.capacity()-t,i=r-this.bb.readInt32(r);if(!(n<this.bb.readInt16(i)&&this.bb.readInt16(i+n)!=0))throw new TypeError("FlatBuffers: field "+n+" must be set")}startVector(t,n,r){this.notNested(),this.vector_num_elems=n,this.prep(4,t*n),this.prep(r,t*n)}endVector(){return this.writeInt32(this.vector_num_elems),this.offset()}createSharedString(t){if(!t)return 0;if(this.string_maps||(this.string_maps=new Map),this.string_maps.has(t))return this.string_maps.get(t);let n=this.createString(t);return this.string_maps.set(t,n),n}createString(t){if(t==null)return 0;let n;t instanceof Uint8Array?n=t:n=this.text_encoder.encode(t),this.addInt8(0),this.startVector(1,n.length,1),this.bb.setPosition(this.space-=n.length);for(let r=0,i=this.space,o=this.bb.bytes();r<n.length;r++)o[i++]=n[r];return this.endVector()}createObjectOffset(t){return t===null?0:typeof t=="string"?this.createString(t):t.pack(this)}createObjectOffsetList(t){let n=[];for(let r=0;r<t.length;++r){let i=t[r];if(i!==null)n.push(this.createObjectOffset(i));else throw new TypeError("FlatBuffers: Argument for createObjectOffsetList cannot contain null.")}return n}createStructOffsetList(t,n){return n(this,t.length),this.createObjectOffsetList(t.slice().reverse()),this.endVector()}};var en=class e{constructor(){this.bb=null,this.bb_pos=0}__init(t,n){return this.bb_pos=t,this.bb=n,this}static getRootAsKeyValue(t,n){return(n||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsKeyValue(t,n){return t.setPosition(t.position()+4),(n||new e).__init(t.readInt32(t.position())+t.position(),t)}key(t){let n=this.bb.__offset(this.bb_pos,4);return n?this.bb.__string(this.bb_pos+n,t):null}value(t){let n=this.bb.__offset(this.bb_pos,6);return n?this.bb.__string(this.bb_pos+n,t):null}static startKeyValue(t){t.startObject(2)}static addKey(t,n){t.addFieldOffset(0,n,0)}static addValue(t,n){t.addFieldOffset(1,n,0)}static endKeyValue(t){return t.endObject()}static createKeyValue(t,n,r){return e.startKeyValue(t),e.addKey(t,n),e.addValue(t,r),e.endKeyValue(t)}};var fa;(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"})(fa||(fa={}));var da;(function(e){e[e.Little=0]="Little",e[e.Big=1]="Big"})(da||(da={}));var Od;(function(e){e[e.DenseArray=0]="DenseArray"})(Od||(Od={}));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):Od.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,Od.DenseArray)}static endDictionaryEncoding(t){return t.endObject()}};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 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 kd=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 Fd;(function(e){e[e.DAY=0]="DAY",e[e.MILLISECOND=1]="MILLISECOND"})(Fd||(Fd={}));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 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):Fd.MILLISECOND}static startDate(t){t.startObject(1)}static addUnit(t,n){t.addFieldInt16(0,n,Fd.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 pa=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 ma=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 ya=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 Ld;(function(e){e[e.HALF=0]="HALF",e[e.SINGLE=1]="SINGLE",e[e.DOUBLE=2]="DOUBLE"})(Ld||(Ld={}));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 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):Ld.HALF}static startFloatingPoint(t){t.startObject(1)}static addPrecision(t,n){t.addFieldInt16(0,n,Ld.HALF)}static endFloatingPoint(t){return t.endObject()}static createFloatingPoint(t,n){return e.startFloatingPoint(t),e.addPrecision(t,n),e.endFloatingPoint(t)}};var Cd;(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"})(Cd||(Cd={}));var ba=class e{constructor(){this.bb=null,this.bb_pos=0}__init(t,n){return this.bb_pos=t,this.bb=n,this}static 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):Cd.YEAR_MONTH}static startInterval(t){t.startObject(1)}static addUnit(t,n){t.addFieldInt16(0,n,Cd.YEAR_MONTH)}static endInterval(t){return t.endObject()}static createInterval(t,n){return e.startInterval(t),e.addUnit(t,n),e.endInterval(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 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 xa=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 Pd=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 $d=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 zd=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 Fn=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 hr=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):da.Little}fields(t,n){let r=this.bb.__offset(this.bb_pos,6);return r?(n||new Fn).__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,da.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 Rr=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):fa.V1}schema(t){let n=this.bb.__offset(this.bb_pos,6);return n?(t||new hr).__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 Ic).__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 Ic).__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,fa.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=Qw(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=Ag(Ag(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:Ag(Ag(new Map,r[c].metadata),a.metadata)}))&&!1:!0}),s=Qw(o,new Map);return new e([...r,...o],i,new Map([...this.dictionaries,...s]))}};re.prototype.fields=null;re.prototype.metadata=null;re.prototype.dictionaries=null;var $t=class e{static new(...t){let[n,r,i,o]=t;return t[0]&&typeof t[0]=="object"&&({name:n}=t[0],r===void 0&&(r=t[0].type),i===void 0&&(i=t[0].nullable),o===void 0&&(o=t[0].metadata)),new e(`${n}`,r,i,o)}constructor(t,n,r=!1,i){this.name=t,this.type=n,this.nullable=r,this.metadata=i||new Map}get typeId(){return this.type.typeId}get[Symbol.toStringTag](){return"Field"}toString(){return`${this.name}: ${this.type}`}clone(...t){let[n,r,i,o]=t;return!t[0]||typeof t[0]!="object"?[n=this.name,r=this.type,i=this.nullable,o=this.metadata]=t:{name:n=this.name,type:r=this.type,nullable:i=this.nullable,metadata:o=this.metadata}=t[0],e.new(n,r,i,o)}};$t.prototype.type=null;$t.prototype.name=null;$t.prototype.nullable=null;$t.prototype.metadata=null;function Ag(e,t){return new Map([...e||new Map,...t||new Map])}function Qw(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&&Qw(o.children,t)}return t}var Sz=Tc,Iz=Nr,is=class{static decode(t){t=new Iz(Ot(t));let n=Rr.getRootAsFooter(t),r=re.decode(n.schema(),new Map,n.version());return new Kw(r,n)}static encode(t){let n=new Sz,r=re.encode(n,t.schema);Rr.startRecordBatchesVector(n,t.numRecordBatches);for(let s of[...t.recordBatches()].slice().reverse())os.encode(n,s);let i=n.endVector();Rr.startDictionariesVector(n,t.numDictionaries);for(let s of[...t.dictionaryBatches()].slice().reverse())os.encode(n,s);let o=n.endVector();return Rr.startFooter(n),Rr.addSchema(n,r),Rr.addVersion(n,Ie.V5),Rr.addRecordBatches(n,i),Rr.addDictionaries(n,o),Rr.finishFooterBuffer(n,Rr.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 Kw=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 Ic.createBlock(t,i,r,o)}constructor(t,n,r){this.metaDataLength=t,this.offset=fr(r),this.bodyLength=fr(n)}};var be=Object.freeze({done:!0,value:void 0}),qd=class{constructor(t){this._json=t}get schema(){return this._json.schema}get batches(){return this._json.batches||[]}get dictionaries(){return this._json.dictionaries||[]}},Ec=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 Ec{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 bn.toDOMStream(this._closedPromiseResolve||this._error?this:this._values,t)}toNodeStream(t){return bn.toNodeStream(this._closedPromiseResolve||this._error?this:this._values,t)}throw(t){return Z(this,void 0,void 0,function*(){return yield this.abort(t),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?wd(this.toUint8Array(!0)):this.toUint8Array(!1).then(wd)}toUint8Array(t=!1){return t?Tr(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 Tr(s,a)[0]})}},ro=class{constructor(t){t&&(this.source=new Jw(bn.fromIterable(t)))}[Symbol.iterator](){return this}next(t){return this.source.next(t)}throw(t){return this.source.throw(t)}return(t){return this.source.return(t)}peek(t){return this.source.peek(t)}read(t){return this.source.read(t)}},Zr=class e{constructor(t){t instanceof e?this.source=t.source:t instanceof no?this.source=new ss(bn.fromAsyncIterable(t)):$y(t)?this.source=new ss(bn.fromNodeStream(t)):vd(t)?this.source=new ss(bn.fromDOMStream(t)):By(t)?this.source=new ss(bn.fromDOMStream(t.body)):xi(t)?this.source=new ss(bn.fromIterable(t)):Ir(t)?this.source=new ss(bn.fromAsyncIterable(t)):Gr(t)&&(this.source=new ss(bn.fromAsyncIterable(t)))}[Symbol.asyncIterator](){return this}next(t){return this.source.next(t)}throw(t){return this.source.throw(t)}return(t){return this.source.return(t)}get closed(){return this.source.closed}cancel(t){return this.source.cancel(t)}peek(t){return this.source.peek(t)}read(t){return this.source.read(t)}},Jw=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 jd=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}}},_a=class extends Zr{constructor(t,n){super(),this.position=0,this._handle=t,typeof n=="number"?this.size=n:this._pending=Z(this,void 0,void 0,function*(){this.size=(yield t.stat()).size,delete this._pending})}readInt32(t){return Z(this,void 0,void 0,function*(){let{buffer:n,byteOffset:r}=yield this.readAt(t,4);return new DataView(n,r).getInt32(0,!0)})}seek(t){return Z(this,void 0,void 0,function*(){return this._pending&&(yield this._pending),this.position=Math.min(t,this.size),t<this.size})}read(t){return Z(this,void 0,void 0,function*(){this._pending&&(yield this._pending);let{_handle:n,size:r,position:i}=this;if(n&&i<r){typeof t!="number"&&(t=Number.POSITIVE_INFINITY);let o=i,s=0,a=0,c=Math.min(r,o+Math.min(r-o,t)),l=new Uint8Array(Math.max(0,(this.position=c)-o));for(;(o+=a)<c&&(s+=a)<l.byteLength;)({bytesRead:a}=yield n.read(l,s,l.byteLength-s,o));return l}return null})}readAt(t,n){return Z(this,void 0,void 0,function*(){this._pending&&(yield this._pending);let{_handle:r,size:i}=this;if(r&&t+n<i){let o=Math.min(i,t+n),s=new Uint8Array(o-t);return(yield r.read(s,0,n,t)).buffer}return new Uint8Array(n)})}close(){return Z(this,void 0,void 0,function*(){let t=this._handle;this._handle=null,t&&(yield t.close())})}throw(t){return Z(this,void 0,void 0,function*(){return yield this.close(),{done:!0,value:t}})}return(t){return Z(this,void 0,void 0,function*(){return yield this.close(),{done:!0,value:t}})}};var ev={};vr(ev,{BaseInt64:()=>Vd,Int128:()=>Yd,Int64:()=>as,Uint64:()=>Ne});function ru(e){return e<0&&(e=4294967295+e+1),`0x${e.toString(16)}`}var iu=8,tv=[1,10,100,1e3,1e4,1e5,1e6,1e7,1e8],Vd=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`${ru(this.buffer[1])} ${ru(this.buffer[0])}`}},Ne=class e extends Vd{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=iu<r-o?iu:r-o,a=new e(new Uint32Array([Number.parseInt(t.slice(o,o+s),10),0])),c=new e(new Uint32Array([tv[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 Vd{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=iu<i-s?iu:i-s,c=new e(new Uint32Array([Number.parseInt(t.slice(s,s+a),10),0])),l=new e(new Uint32Array([tv[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)}},Yd=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`${ru(this.buffer[3])} ${ru(this.buffer[2])} ${ru(this.buffer[1])} ${ru(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=iu<i-s?iu:i-s,c=new e(new Uint32Array([Number.parseInt(t.slice(s,s+a),10),0,0,0])),l=new e(new Uint32Array([tv[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 Gd=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 $t?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)}},Ng=class extends Gd{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):vc(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===xn.MILLISECOND?Pt(Uint8Array,as.convertArray(r[n])):at.isDecimal(t)?Pt(Uint8Array,Yd.convertArray(r[n])):at.isBinary(t)||at.isFixedSizeBinary(t)?Tz(r[n]):at.isBool(t)?vc(r[n]):at.isUtf8(t)?oa(r[n].join("")):Pt(Uint8Array,Pt(t.ArrayType,r[n].map(i=>+i)))}};function Tz(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 ou=class extends Ki{constructor(t){super(t),this._values=new ua(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 Rg=class extends _e{constructor(t){super(t),this._values=new tu}setValue(t,n){this._values.set(t,+n)}};var Ac=class extends Ve{};Ac.prototype._setValue=Fw;var Wd=class extends Ac{};Wd.prototype._setValue=Jy;var Xd=class extends Ac{};Xd.prototype._setValue=tg;var Hd=class extends Ve{};Hd.prototype._setValue=Bw;var Og=class extends _e{constructor({type:t,nullValues:n,dictionaryHashFunction:r}){super({type:new Er(t.dictionary,t.indices,t.id,t.isOrdered)}),this._nulls=null,this._dictionaryOffset=0,this._keysToIndices=Object.create(null),this.indices=Mc({type:this.type.indices,nullValues:n}),this.dictionary=Mc({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 Zd=class extends Ve{};Zd.prototype._setValue=kw;var Dg=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 $t(n,t.type,!0)),r}};var Nc=class extends Ve{setValue(t,n){this._values.set(t,n)}},kg=class extends Nc{setValue(t,n){super.setValue(t,Td(n))}},Fg=class extends Nc{},Lg=class extends Nc{};var Rc=class extends Ve{};Rc.prototype._setValue=Pw;var Qd=class extends Rc{};Qd.prototype._setValue=lg;var Kd=class extends Rc{};Kd.prototype._setValue=ug;var cs=class extends Ve{};cs.prototype._setValue=$w;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 nh=class extends cs{};nh.prototype._setValue=pg;var Qr=class extends Ve{setValue(t,n){this._values.set(t,n)}},Cg=class extends Qr{},Bg=class extends Qr{},Pg=class extends Qr{},$g=class extends Qr{},Ug=class extends Qr{},zg=class extends Qr{},qg=class extends Qr{},jg=class extends Qr{};var Vg=class extends Ki{constructor(t){super(t),this._offsets=new eu}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 $t(n,t.type,!0)),this.numChildren-1}_flushPending(t){let n=this._offsets,[r]=this.children;for(let[i,o]of t)if(typeof o>"u")n.set(i,0);else{let s=o,a=s.length,c=n.set(i,a).buffer[i];for(let l=-1;++l<a;)r.set(c+l,s[l])}}};var Yg=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 Ai(new $t(n,t.type,!0),this.type.keysSorted),this.numChildren-1}_flushPending(t){let n=this._offsets,[r]=this.children;for(let[i,o]of t)if(o===void 0)n.set(i,0);else{let{[i]:s,[i+1]:a}=n.set(i,o.size).buffer;for(let c of o.entries())if(r.set(s,c),++s>=a)break}}};var Gg=class extends _e{setValue(t,n){}setValid(t,n){return this.length=Math.max(t+1,this.length),n}};var Wg=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 $t(n,t.type,!0)]),r}};var ls=class extends Ve{};ls.prototype._setValue=Lw;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 sh=class extends ls{};sh.prototype._setValue=ig;var us=class extends Ve{};us.prototype._setValue=Cw;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 uh=class extends us{};uh.prototype._setValue=cg;var su=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 $t(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.")}},Xg=class extends su{},Hg=class extends su{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 fh=class extends Ki{constructor(t){super(t),this._values=new ua(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,oa(n))}_flushPending(t,n){}};fh.prototype._flushPending=ou.prototype._flushPending;var nv=class extends ut{visitNull(){return Gg}visitBool(){return Rg}visitInt(){return Qr}visitInt8(){return Cg}visitInt16(){return Bg}visitInt32(){return Pg}visitInt64(){return $g}visitUint8(){return Ug}visitUint16(){return zg}visitUint32(){return qg}visitUint64(){return jg}visitFloat(){return Nc}visitFloat16(){return kg}visitFloat32(){return Fg}visitFloat64(){return Lg}visitUtf8(){return fh}visitBinary(){return ou}visitFixedSizeBinary(){return Zd}visitDate(){return Ac}visitDateDay(){return Wd}visitDateMillisecond(){return Xd}visitTimestamp(){return ls}visitTimestampSecond(){return rh}visitTimestampMillisecond(){return ih}visitTimestampMicrosecond(){return oh}visitTimestampNanosecond(){return sh}visitTime(){return us}visitTimeSecond(){return ah}visitTimeMillisecond(){return ch}visitTimeMicrosecond(){return lh}visitTimeNanosecond(){return uh}visitDecimal(){return Hd}visitList(){return Vg}visitStruct(){return Wg}visitUnion(){return su}visitDenseUnion(){return Hg}visitSparseUnion(){return Xg}visitDictionary(){return Og}visitInterval(){return Rc}visitIntervalDayTime(){return Qd}visitIntervalYearMonth(){return Kd}visitDuration(){return cs}visitDurationSecond(){return Jd}visitDurationMillisecond(){return th}visitDurationMicrosecond(){return eh}visistDurationNanosecond(){return nh}visitFixedSizeList(){return Dg}visitMap(){return Yg}},CO=new nv;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 Wn(e,t){return t instanceof e.constructor}function dh(e,t){return e===t||Wn(e,t)}function fs(e,t){return e===t||Wn(e,t)&&e.bitWidth===t.bitWidth&&e.isSigned===t.isSigned}function Zg(e,t){return e===t||Wn(e,t)&&e.precision===t.precision}function Ez(e,t){return e===t||Wn(e,t)&&e.byteWidth===t.byteWidth}function rv(e,t){return e===t||Wn(e,t)&&e.unit===t.unit}function hh(e,t){return e===t||Wn(e,t)&&e.unit===t.unit&&e.timezone===t.timezone}function ph(e,t){return e===t||Wn(e,t)&&e.unit===t.unit&&e.bitWidth===t.bitWidth}function Az(e,t){return e===t||Wn(e,t)&&e.children.length===t.children.length&&io.compareManyFields(e.children,t.children)}function Mz(e,t){return e===t||Wn(e,t)&&e.children.length===t.children.length&&io.compareManyFields(e.children,t.children)}function iv(e,t){return e===t||Wn(e,t)&&e.mode===t.mode&&e.typeIds.every((n,r)=>n===t.typeIds[r])&&io.compareManyFields(e.children,t.children)}function Nz(e,t){return e===t||Wn(e,t)&&e.id===t.id&&e.isOrdered===t.isOrdered&&io.visit(e.indices,t.indices)&&io.visit(e.dictionary,t.dictionary)}function ov(e,t){return e===t||Wn(e,t)&&e.unit===t.unit}function mh(e,t){return e===t||Wn(e,t)&&e.unit===t.unit}function Rz(e,t){return e===t||Wn(e,t)&&e.listSize===t.listSize&&e.children.length===t.children.length&&io.compareManyFields(e.children,t.children)}function Oz(e,t){return e===t||Wn(e,t)&&e.keysSorted===t.keysSorted&&e.children.length===t.children.length&&io.compareManyFields(e.children,t.children)}_t.prototype.visitNull=dh;_t.prototype.visitBool=dh;_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=Zg;_t.prototype.visitFloat16=Zg;_t.prototype.visitFloat32=Zg;_t.prototype.visitFloat64=Zg;_t.prototype.visitUtf8=dh;_t.prototype.visitBinary=dh;_t.prototype.visitFixedSizeBinary=Ez;_t.prototype.visitDate=rv;_t.prototype.visitDateDay=rv;_t.prototype.visitDateMillisecond=rv;_t.prototype.visitTimestamp=hh;_t.prototype.visitTimestampSecond=hh;_t.prototype.visitTimestampMillisecond=hh;_t.prototype.visitTimestampMicrosecond=hh;_t.prototype.visitTimestampNanosecond=hh;_t.prototype.visitTime=ph;_t.prototype.visitTimeSecond=ph;_t.prototype.visitTimeMillisecond=ph;_t.prototype.visitTimeMicrosecond=ph;_t.prototype.visitTimeNanosecond=ph;_t.prototype.visitDecimal=dh;_t.prototype.visitList=Az;_t.prototype.visitStruct=Mz;_t.prototype.visitUnion=iv;_t.prototype.visitDenseUnion=iv;_t.prototype.visitSparseUnion=iv;_t.prototype.visitDictionary=Nz;_t.prototype.visitInterval=ov;_t.prototype.visitIntervalDayTime=ov;_t.prototype.visitIntervalYearMonth=ov;_t.prototype.visitDuration=mh;_t.prototype.visitDurationSecond=mh;_t.prototype.visitDurationMillisecond=mh;_t.prototype.visitDurationMicrosecond=mh;_t.prototype.visitDurationNanosecond=mh;_t.prototype.visitFixedSizeList=Rz;_t.prototype.visitMap=Oz;var io=new _t;function Oc(e,t){return io.compareSchemas(e,t)}function BO(e,t){return io.compareFields(e,t)}function PO(e,t){return io.visit(e,t)}function Mc(e){let t=e.type,n=new(CO.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(Mc(Object.assign(Object.assign({},l),{type:c})))}}return n}function Qg(e,t){return Dz(e,t.map(n=>n.data.concat()))}function Dz(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=kz(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 kz(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 $O,sn=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 Vt([c[h]])),f=new re(l.map((h,p)=>new $t(String(h),u[p].type))),[,d]=Qg(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(!Oc(i,c.schema))throw new TypeError("Table and inner RecordBatch schemas must be equivalent.")}this.schema=i,this.batches=a,this._offsets=o??xg(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=bg(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?Jl.visit(new Vt(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 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]=Ed({length:this.numRows},t,n);let i=_g(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 Vt(n)}return null}setChild(t,n){var r;return this.setChildAt((r=this.schema.fields)===null||r===void 0?void 0:r.findIndex(i=>i.name===t),n)}setChildAt(t,n){let r=this.schema,i=[...this.batches];if(t>-1&&t<this.numCols){n||(n=new Vt([Dt({type:new Gn,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]=Qg(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(...Qg(o,s))}};$O=Symbol.toStringTag;sn[$O]=(e=>(e.schema=null,e.batches=[],e._offsets=new Uint32Array([0]),e._nullCount=-1,e[Symbol.isConcatSpreadable]=!0,e.isValid=la(Nd),e.get=la(je.getVisitFn(D.Struct)),e.set=wg(_n.getVisitFn(D.Struct)),e.indexOf=vg(Sc.getVisitFn(D.Struct)),e.getByteLength=la(Mr.getVisitFn(D.Struct)),"Table"))(sn.prototype);var zO,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]=UO(this.schema,this.data.children);break}case 1:{let[n]=t,{fields:r,children:i,length:o}=Object.keys(n).reduce((c,l,u)=>(c.children[u]=n[l],c.length=Math.max(c.length,n[l].length),c.fields[u]=$t.new({name:l,type:n[l].type,nullable:!0}),c),{length:0,fields:new Array,children:new Array}),s=new re(r),a=Dt({type:new ye(r),length:o,children:i,nullCount:0});[this.schema,this.data]=UO(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=qO(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 _n.visit(this.data,t,n)}indexOf(t,n){return Sc.visit(this.data,t,n)}getByteLength(t){return Mr.visit(this.data,t)}[Symbol.iterator](){return Jl.visit(new Vt([this.data]))}toArray(){return[...this]}concat(...t){return new sn(this.schema,[this,...t])}slice(t,n){let[r]=new Vt([this.data]).slice(t,n).data;return new e(this.schema,r)}getChild(t){var n;return this.getChildAt((n=this.schema.fields)===null||n===void 0?void 0:n.findIndex(r=>r.name===t))}getChildAt(t){return t>-1&&t<this.schema.fields.length?new Vt([this.data.children[t]]):null}setChild(t,n){var r;return this.setChildAt((r=this.schema.fields)===null||r===void 0?void 0:r.findIndex(i=>i.name===t),n)}setChildAt(t,n){let r=this.schema,i=this.data;if(t>-1&&t<this.numCols){n||(n=new Vt([Dt({type:new Gn,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)}};zO=Symbol.toStringTag;ke[zO]=(e=>(e._nullCount=-1,e[Symbol.isConcatSpreadable]=!0,"RecordBatch"))(ke.prototype);function UO(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 qO(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)||[]])qO(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 Dc=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 yh;(function(e){e[e.BUFFER=0]="BUFFER"})(yh||(yh={}));var gh;(function(e){e[e.LZ4_FRAME=0]="LZ4_FRAME",e[e.ZSTD=1]="ZSTD"})(gh||(gh={}));var Kg=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):gh.LZ4_FRAME}method(){let t=this.bb.__offset(this.bb_pos,6);return t?this.bb.readInt8(this.bb_pos+t):yh.BUFFER}static startBodyCompression(t){t.startObject(2)}static addCodec(t,n){t.addFieldInt8(0,n,gh.LZ4_FRAME)}static addMethod(t,n){t.addFieldInt8(1,n,yh.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 au=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 cu=class{constructor(){this.bb=null,this.bb_pos=0}__init(t,n){return this.bb_pos=t,this.bb=n,this}length(){return this.bb.readInt64(this.bb_pos)}nullCount(){return this.bb.readInt64(this.bb_pos+8)}static sizeOf(){return 16}static createFieldNode(t,n,r){return t.prep(8,16),t.writeInt64(BigInt(r??0)),t.writeInt64(BigInt(n??0)),t.offset()}};var Or=class e{constructor(){this.bb=null,this.bb_pos=0}__init(t,n){return this.bb_pos=t,this.bb=n,this}static getRootAsRecordBatch(t,n){return(n||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsRecordBatch(t,n){return t.setPosition(t.position()+4),(n||new e).__init(t.readInt32(t.position())+t.position(),t)}length(){let t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt64(this.bb_pos+t):BigInt("0")}nodes(t,n){let r=this.bb.__offset(this.bb_pos,6);return r?(n||new cu).__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 au).__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 Kg).__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 Or).__init(this.bb.__indirect(this.bb_pos+n),this.bb):null}isDelta(){let t=this.bb.__offset(this.bb_pos,8);return t?!!this.bb.readInt8(this.bb_pos+t):!1}static startDictionaryBatch(t){t.startObject(3)}static addId(t,n){t.addFieldInt64(0,n,BigInt("0"))}static addData(t,n){t.addFieldOffset(1,n,0)}static addIsDelta(t,n){t.addFieldInt8(2,+n,0)}static endDictionaryBatch(t){return t.endObject()}};var lu;(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"})(lu||(lu={}));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):fa.V1}headerType(){let t=this.bb.__offset(this.bb_pos,6);return t?this.bb.readUint8(this.bb_pos+t):lu.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,fa.V1)}static addHeaderType(t,n){t.addFieldInt8(1,n,lu.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 sv=class extends ut{visit(t,n){return t==null||n==null?void 0:super.visit(t,n)}visitNull(t,n){return Pd.startNull(n),Pd.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 ga.startFloatingPoint(n),ga.addPrecision(n,t.precision),ga.endFloatingPoint(n)}visitBinary(t,n){return Dd.startBinary(n),Dd.endBinary(n)}visitBool(t,n){return kd.startBool(n),kd.endBool(n)}visitUtf8(t,n){return zd.startUtf8(n),zd.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 ha.startDate(n),ha.addUnit(n,t.unit),ha.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 ba.startInterval(n),ba.addUnit(n,t.unit),ba.endInterval(n)}visitDuration(t,n){return pa.startDuration(n),pa.addUnit(n,t.unit),pa.endDuration(n)}visitList(t,n){return Bd.startList(n),Bd.endList(n)}visitStruct(t,n){return $d.startStruct_(n),$d.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 ma.startFixedSizeBinary(n),ma.addByteWidth(n,t.byteWidth),ma.endFixedSizeBinary(n)}visitFixedSizeList(t,n){return ya.startFixedSizeList(n),ya.addListSize(n,t.listSize),ya.endFixedSizeList(n)}visitMap(t,n){return xa.startMap(n),xa.addKeysSorted(n,t.keysSorted),xa.endMap(n)}},Jg=new sv;function GO(e,t=new Map){return new re(Lz(e,t),t0(e.metadata),t)}function av(e){return new wn(e.count,XO(e.columns),HO(e.columns))}function WO(e){return new mr(av(e.data),e.id,e.isDelta)}function Lz(e,t){return(e.fields||[]).filter(Boolean).map(n=>$t.fromJSON(n,t))}function jO(e,t){return(e.children||[]).filter(Boolean).map(n=>$t.fromJSON(n,t))}function XO(e){return(e||[]).reduce((t,n)=>[...t,new Kr(n.count,Cz(n.VALIDITY)),...XO(n.children)],[])}function HO(e,t=[]){for(let n=-1,r=(e||[]).length;++n<r;){let i=e[n];i.VALIDITY&&t.push(new pr(t.length,i.VALIDITY.length)),i.TYPE_ID&&t.push(new pr(t.length,i.TYPE_ID.length)),i.OFFSET&&t.push(new pr(t.length,i.OFFSET.length)),i.DATA&&t.push(new pr(t.length,i.DATA.length)),t=HO(i.children,t)}return t}function Cz(e){return(e||[]).reduce((t,n)=>t+ +(n===0),0)}function ZO(e,t){let n,r,i,o,s,a;return!t||!(o=e.dictionary)?(s=YO(e,jO(e,t)),i=new $t(e.name,s,e.nullable,t0(e.metadata))):t.has(n=o.id)?(r=(r=o.indexType)?VO(r):new Hi,a=new Er(t.get(n),r,n,o.isOrdered),i=new $t(e.name,a,e.nullable,t0(e.metadata))):(r=(r=o.indexType)?VO(r):new Hi,t.set(n,s=YO(e,jO(e,t))),a=new Er(s,r,n,o.isOrdered),i=new $t(e.name,a,e.nullable,t0(e.metadata))),i||null}function t0(e=[]){return new Map(e.map(({key:t,value:n})=>[t,n]))}function VO(e){return new Pe(e.isSigned,e.bitWidth)}function YO(e,t){let n=e.type.name;switch(n){case"NONE":return new Gn;case"null":return new Gn;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 dr(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(xn[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(Yn[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 Ai((t||[])[0],r.keysSorted)}}throw new Error(`Unrecognized type: "${n}"`)}var Bz=Tc,Pz=Nr,yr=class e{static fromJSON(t,n){let r=new e(0,Ie.V5,n);return r._createHeader=$z(t,n),r}static decode(t){t=new Pz(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=Uz(n,o),s}static encode(t){let n=new Bz,r=-1;return t.isSchema()?r=re.encode(n,t.header()):t.isRecordBatch()?r=wn.encode(n,t.header()):t.isDictionaryBatch()&&(r=mr.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 wn)return new e(n,Ie.V5,Qt.RecordBatch,t);if(t instanceof mr)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=fr(t)}},wn=class{get nodes(){return this._nodes}get length(){return this._length}get buffers(){return this._buffers}constructor(t,n,r){this._nodes=n,this._buffers=r,this._length=fr(t)}},mr=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=fr(n)}},pr=class{constructor(t,n){this.offset=fr(t),this.length=fr(n)}},Kr=class{constructor(t,n){this.length=fr(t),this.nullCount=fr(n)}};function $z(e,t){return()=>{switch(t){case Qt.Schema:return re.fromJSON(e);case Qt.RecordBatch:return wn.fromJSON(e);case Qt.DictionaryBatch:return mr.fromJSON(e)}throw new Error(`Unrecognized Message type: { name: ${Qt[t]}, type: ${t} }`)}}function Uz(e,t){return()=>{switch(t){case Qt.Schema:return re.decode(e.header(new hr),new Map,e.version());case Qt.RecordBatch:return wn.decode(e.header(new Or),e.version());case Qt.DictionaryBatch:return mr.decode(e.header(new ds),e.version())}throw new Error(`Unrecognized Message type: { name: ${Qt[t]}, type: ${t} }`)}}$t.encode=Qz;$t.decode=Hz;$t.fromJSON=ZO;re.encode=Zz;re.decode=zz;re.fromJSON=GO;wn.encode=Kz;wn.decode=qz;wn.fromJSON=av;mr.encode=Jz;mr.decode=jz;mr.fromJSON=WO;Kr.encode=tq;Kr.decode=Yz;pr.encode=eq;pr.decode=Vz;function zz(e,t=new Map,n=Ie.V5){let r=Xz(e,t);return new re(r,e0(e),t,n)}function qz(e,t=Ie.V5){if(e.compression()!==null)throw new Error("Record batch compression not implemented");return new wn(e.length(),Gz(e),Wz(e,t))}function jz(e,t=Ie.V5){return new mr(wn.decode(e.data(),t),e.id(),e.isDelta())}function Vz(e){return new pr(e.offset(),e.length())}function Yz(e){return new Kr(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]=Kr.decode(n));return t}function Wz(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]=pr.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]=$t.decode(r,t));return n}function QO(e,t){let n=[];for(let r,i=-1,o=-1,s=e.childrenLength();++i<s;)(r=e.children(i))&&(n[++o]=$t.decode(r,t));return n}function Hz(e,t){let n,r,i,o,s,a;return!t||!(a=e.dictionary())?(i=JO(e,QO(e,t)),r=new $t(e.name(),i,e.nullable(),e0(e))):t.has(n=fr(a.id()))?(o=(o=a.indexType())?KO(o):new Hi,s=new Er(t.get(n),o,n,a.isOrdered()),r=new $t(e.name(),s,e.nullable(),e0(e))):(o=(o=a.indexType())?KO(o):new Hi,t.set(n,i=JO(e,QO(e,t))),s=new Er(i,o,n,a.isOrdered()),r=new $t(e.name(),s,e.nullable(),e0(e))),r||null}function e0(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 KO(e){return new Pe(e.isSigned(),e.bitWidth())}function JO(e,t){let n=e.typeType();switch(n){case ge.NONE:return new Gn;case ge.Null:return new Gn;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 ga);return new dr(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 ha);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 ba);return new Qo(r.unit())}case ge.Duration:{let r=e.type(new pa);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 ma);return new Jo(r.byteWidth())}case ge.FixedSizeList:{let r=e.type(new ya);return new Ei(r.listSize(),(t||[])[0])}case ge.Map:{let r=e.type(new xa);return new Ai((t||[])[0],r.keysSorted())}}throw new Error(`Unrecognized type: "${ge[n]}" (${n})`)}function Zz(e,t){let n=t.fields.map(o=>$t.encode(e,o));hr.startFieldsVector(e,n.length);let r=hr.createFieldsVector(e,n),i=t.metadata&&t.metadata.size>0?hr.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 hr.startSchema(e),hr.addFields(e,r),hr.addEndianness(e,nq?da.Little:da.Big),i!==-1&&hr.addCustomMetadata(e,i),hr.endSchema(e)}function Qz(e,t){let n=-1,r=-1,i=-1,o=t.type,s=t.typeId;at.isDictionary(o)?(s=o.dictionary.typeId,i=Jg.visit(o,e),r=Jg.visit(o.dictionary,e)):r=Jg.visit(o,e);let a=(o.children||[]).map(u=>$t.encode(e,u)),c=Fn.createChildrenVector(e,a),l=t.metadata&&t.metadata.size>0?Fn.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)),Fn.startField(e),Fn.addType(e,r),Fn.addTypeType(e,s),Fn.addChildren(e,c),Fn.addNullable(e,!!t.nullable),n!==-1&&Fn.addName(e,n),i!==-1&&Fn.addDictionary(e,i),l!==-1&&Fn.addCustomMetadata(e,l),Fn.endField(e)}function Kz(e,t){let n=t.nodes||[],r=t.buffers||[];Or.startNodesVector(e,n.length);for(let s of n.slice().reverse())Kr.encode(e,s);let i=e.endVector();Or.startBuffersVector(e,r.length);for(let s of r.slice().reverse())pr.encode(e,s);let o=e.endVector();return Or.startRecordBatch(e),Or.addLength(e,BigInt(t.length)),Or.addNodes(e,i),Or.addBuffers(e,o),Or.endRecordBatch(e)}function Jz(e,t){let n=wn.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 tq(e,t){return cu.createFieldNode(e,BigInt(t.length),BigInt(t.nullCount))}function eq(e,t){return au.createBuffer(e,BigInt(t.offset),BigInt(t.length))}var nq=(()=>{let e=new ArrayBuffer(2);return new DataView(e).setInt16(0,256,!0),new Int16Array(e)[0]===256})();var lv=e=>`Expected ${Qt[e]} Message in stream, but was null or length 0.`,uv=e=>`Header pointer of flatbuffer-encoded ${Qt[e]} Message is null or length 0.`,tD=(e,t)=>`Expected to read ${e} metadata bytes, but only read ${t}.`,eD=(e,t)=>`Expected to read ${e} bytes for message body, but only read ${t}.`,uu=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(lv(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(eD(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(uv(n));return i}readMetadataLength(){let t=this.source.read(n0),n=t&&new Nr(t),r=n?.readInt32(0)||0;return{done:r===0,value:r}}readMetadata(t){let n=this.source.read(t);if(!n)return be;if(n.byteLength<t)throw new Error(tD(t,n.byteLength));return{done:!1,value:yr.decode(n)}}},bh=class{constructor(t,n){this.source=t instanceof Zr?t:Cy(t)?new _a(t,n):new Zr(t)}[Symbol.asyncIterator](){return this}next(){return Z(this,void 0,void 0,function*(){let t;return(t=yield this.readMetadataLength()).done?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(lv(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(eD(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(uv(n));return i})}readMetadataLength(){return Z(this,void 0,void 0,function*(){let t=yield this.source.read(n0),n=t&&new Nr(t),r=n?.readInt32(0)||0;return{done:r===0,value:r}})}readMetadata(t){return Z(this,void 0,void 0,function*(){let n=yield this.source.read(t);if(!n)return be;if(n.byteLength<t)throw new Error(tD(t,n.byteLength));return{done:!1,value:yr.decode(n)}})}},xh=class extends uu{constructor(t){super(new Uint8Array(0)),this._schema=!1,this._body=[],this._batchIndex=0,this._dictionaryIndex=0,this._json=t instanceof qd?t:new qd(t)}next(){let{_json:t}=this;if(!this._schema)return this._schema=!0,{done:!1,value:yr.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:yr.fromJSON(n,Qt.DictionaryBatch)}}if(this._batchIndex<t.batches.length){let n=t.batches[this._batchIndex++];return this._body=n.columns,{done:!1,value:yr.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(lv(t));return n.value}readSchema(){let t=Qt.Schema,n=this.readMessage(t),r=n?.header();if(!n||!r)throw new Error(uv(t));return r}},n0=4,cv="ARROW1",fu=new Uint8Array(cv.length);for(let e=0;e<cv.length;e+=1)fu[e]=cv.codePointAt(e);function r0(e,t=0){for(let n=-1,r=fu.length;++n<r;)if(fu[n]!==e[t+n])return!1;return!0}var du=fu.length,fv=du+n0,nD=du*2+n0;var nn=class e extends Ec{constructor(t){super(),this._impl=t}get closed(){return this._impl.closed}get schema(){return this._impl.schema}get autoDestroy(){return this._impl.autoDestroy}get dictionaries(){return this._impl.dictionaries}get numDictionaries(){return this._impl.numDictionaries}get numRecordBatches(){return this._impl.numRecordBatches}get footer(){return this._impl.isFile()?this._impl.footer:null}isSync(){return this._impl.isSync()}isAsync(){return this._impl.isAsync()}isFile(){return this._impl.isFile()}isStream(){return this._impl.isStream()}next(){return this._impl.next()}throw(t){return this._impl.throw(t)}return(t){return this._impl.return(t)}cancel(){return this._impl.cancel()}reset(t){return this._impl.reset(t),this._DOMStream=void 0,this._nodeStream=void 0,this}open(t){let n=this._impl.open(t);return Ir(n)?n.then(()=>this):this}readRecordBatch(t){return this._impl.isFile()?this._impl.readRecordBatch(t):null}[Symbol.iterator](){return this._impl[Symbol.iterator]()}[Symbol.asyncIterator](){return this._impl[Symbol.asyncIterator]()}toDOMStream(){return bn.toDOMStream(this.isSync()?{[Symbol.iterator]:()=>this}:{[Symbol.asyncIterator]:()=>this})}toNodeStream(){return bn.toNodeStream(this.isSync()?{[Symbol.iterator]:()=>this}:{[Symbol.asyncIterator]:()=>this},{objectMode:!0})}static throughNode(t){throw new Error('"throughNode" not available in this environment')}static throughDOM(t,n){throw new Error('"throughDOM" not available in this environment')}static from(t){return t instanceof e?t:Fy(t)?iq(t):Cy(t)?aq(t):Ir(t)?Z(this,void 0,void 0,function*(){return yield e.from(yield t)}):By(t)||vd(t)||$y(t)||Gr(t)?sq(new Zr(t)):oq(new ro(t))}static readAll(t){return t instanceof e?t.isSync()?rD(t):iD(t):Fy(t)||ArrayBuffer.isView(t)||xi(t)||Ly(t)?rD(t):iD(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 Sr(this,arguments,function*(){yield Ct(yield*Vl(bi(this[Symbol.iterator]())))})}},wa=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]()}},va=class extends oo{constructor(t){super(t),this._impl=t}},_h=class extends wa{constructor(t){super(t),this._impl=t}},i0=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 Vt(l)):new Vt(l)).memoize()}return a.memoize()}_loadVectors(t,n,r){return new Gd(n,t.nodes,t.buffers,this.dictionaries,this.schema.metadataVersion).visitMany(r)}},hu=class extends i0{constructor(t,n){super(n),this._reader=Fy(t)?new xh(this._handle=t):new uu(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=oD(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 Dc(this.schema)}):this.return()}_readNextMessageAndValidate(t){return this._reader.readMessage(t)}},pu=class extends i0{constructor(t,n){super(n),this._reader=new bh(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=oD(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 Dc(this.schema)}):yield this.return()})}_readNextMessageAndValidate(t){return Z(this,void 0,void 0,function*(){return yield this._reader.readMessage(t)})}},o0=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){super(t instanceof jd?t:new jd(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-fv,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}},dv=class extends pu{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 _a?t:new _a(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-fv,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})}},hv=class extends hu{constructor(t,n){super(t,n)}_loadVectors(t,n,r){return new Ng(n,t.nodes,t.buffers,this.dictionaries,this.schema.metadataVersion).visitMany(r)}};function oD(e,t){return t&&typeof t.autoDestroy=="boolean"?t.autoDestroy:e.autoDestroy}function*rD(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 iD(e){return Sr(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 iq(e){return new oo(new hv(e))}function oq(e){let t=e.peek(du+7&-8);return t&&t.byteLength>=4?r0(t)?new va(new o0(e.read())):new oo(new hu(e)):new oo(new hu(function*(){}()))}function sq(e){return Z(this,void 0,void 0,function*(){let t=yield e.peek(du+7&-8);return t&&t.byteLength>=4?r0(t)?new va(new o0(yield e.read())):new wa(new pu(e)):new wa(new pu(function(){return Sr(this,arguments,function*(){})}()))})}function aq(e){return Z(this,void 0,void 0,function*(){let{size:t}=yield e.stat(),n=new _a(e,t);return t>=nD&&r0(yield n.readAt(0,du+7&-8))?new _h(new dv(n)):new wa(new pu(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 Vt)return this.visitMany(t.data),this;let{type:n}=t;if(!at.isDictionary(n)){let{length:r}=t;if(r>2147483647)throw new RangeError("Cannot write arrays larger than 2^31 - 1 in length");if(at.isUnion(n))this.nodes.push(new Kr(r,0));else{let{nullCount:i}=t;at.isNull(n)||Fi.call(this,i<=0?new Uint8Array(0):wc(t.offset,r,t.nullBitmap)),this.nodes.push(new Kr(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 pr(this._byteLength,t)),this._byteLength+=t,this}function cq(e){var t;let{type:n,length:r,typeIds:i,valueOffsets:o}=e;if(Fi.call(this,i),n.mode===me.Sparse)return pv.call(this,e);if(n.mode===me.Dense){if(e.offset<=0)return Fi.call(this,o),pv.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 lq(e){let t;return e.nullCount>=e.length?Fi.call(this,new Uint8Array(0)):(t=e.values)instanceof Uint8Array?Fi.call(this,wc(e.offset,e.length,t)):Fi.call(this,vc(e.values))}function hs(e){return Fi.call(this,e.values.subarray(0,e.length*e.stride))}function sD(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 mv(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 pv(e){return this.visitMany(e.type.children.map((t,n)=>e.children[n]).filter(Boolean))[0]}Fe.prototype.visitBool=lq;Fe.prototype.visitInt=hs;Fe.prototype.visitFloat=hs;Fe.prototype.visitUtf8=sD;Fe.prototype.visitBinary=sD;Fe.prototype.visitFixedSizeBinary=hs;Fe.prototype.visitDate=hs;Fe.prototype.visitTimestamp=hs;Fe.prototype.visitTime=hs;Fe.prototype.visitDecimal=hs;Fe.prototype.visitList=mv;Fe.prototype.visitStruct=pv;Fe.prototype.visitUnion=cq;Fe.prototype.visitInterval=hs;Fe.prototype.visitDuration=hs;Fe.prototype.visitFixedSizeList=mv;Fe.prototype.visitMap=mv;var kc=class extends Ec{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,Vn(t)||(t={autoDestroy:!0,writeLegacyIpcFormat:!1}),this._autoDestroy=typeof t.autoDestroy=="boolean"?t.autoDestroy:!0,this._writeLegacyIpcFormat=typeof t.writeLegacyIpcFormat=="boolean"?t.writeLegacyIpcFormat:!1}toString(t=!1){return this._sink.toString(t)}toUint8Array(t=!1){return this._sink.toUint8Array(t)}writeAll(t){return Ir(t)?t.then(n=>this.writeAll(n)):Gr(t)?gv(this,t):yv(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&&TR(t)?this.toDOMStream({type:"bytes"}).pipeTo(t):t&&ER(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||!Oc(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 sn&&!(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&&!Oc(n,this._schema)){if(this._started&&this._autoDestroy)return this.close();this.reset(this._sink,n)}t instanceof ke?t instanceof Dc||this._writeRecordBatch(t):t instanceof sn?this.writeAll(t.batches):xi(t)&&this.writeAll(t)}_writeMessage(t,n=8){let r=n-1,i=yr.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(yr.from(t))}_writeFooter(t){return this._writeLegacyIpcFormat?this._write(Int32Array.of(0)):this._write(Int32Array.of(-1,0))}_writeMagic(){return this._write(fu)}_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 wn(t.numRows,r,i),a=yr.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 Vt([t])),c=new wn(t.length,o,s),l=new mr(c,n,r),u=yr.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}},Fc=class e extends kc{static writeAll(t,n){let r=new e(n);return Ir(t)?t.then(i=>r.writeAll(i)):Gr(t)?gv(r,t):yv(r,t)}},Lc=class e extends kc{static writeAll(t){let n=new e;return Ir(t)?t.then(r=>n.writeAll(r)):Gr(t)?gv(n,t):yv(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 yv(e,t){let n=t;t instanceof sn&&(n=t.batches,e.reset(void 0,t.schema));for(let r of n)e.write(r);return e.finish()}function gv(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 aD(e,t){if(Gr(e))return fq(e,t);if(xi(e))return uq(e,t);throw new Error("toDOMStream() must be called with an Iterable or AsyncIterable")}function uq(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 fq(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 uD(e){return new bv(e)}var bv=class{constructor(t){this._numChunks=0,this._finished=!1,this._bufferedSize=0;let{["readableStrategy"]:n,["writableStrategy"]:r,["queueingStrategy"]:i="count"}=t,o=SR(t,["readableStrategy","writableStrategy","queueingStrategy"]);this._controller=null,this._builder=Mc(o),this._getSize=i!=="bytes"?cD:lD;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"?cD:lD}),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)}},cD=e=>{var t;return(t=e?.length)!==null&&t!==void 0?t:0},lD=e=>{var t;return(t=e?.byteLength)!==null&&t!==void 0?t:0};function s0(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 a0(e,t){let n=new this(e),r=new Zr(n),i=new ReadableStream({cancel(){return Z(this,void 0,void 0,function*(){yield r.cancel()})},pull(s){return Z(this,void 0,void 0,function*(){yield o(s)})},start(s){return Z(this,void 0,void 0,function*(){yield o(s)})}},Object.assign({highWaterMark:Math.pow(2,14)},t));return{writable:new WritableStream(n,e),readable:i};function o(s){return Z(this,void 0,void 0,function*(){let a=null,c=s.desiredSize;for(;a=yield r.read(c||null);)if(s.enqueue(a),c!=null&&(c-=a.byteLength)<=0)return;s.close()})}}function Cc(e){let t=nn.from(e);return Ir(t)?t.then(n=>Cc(n)):t.isAsync()?t.readAll().then(n=>new sn(n)):new sn(t.readAll())}function c0(e,t="stream"){return(t==="stream"?Fc:Lc).writeAll(e).toUint8Array(!0)}var pq=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},Nw),ev),Gw),Rw),Iw),Yw),Aw),{compareSchemas:Oc,compareFields:BO,compareTypes:PO});bn.toDOMStream=aD;_e.throughDOM=uD;nn.throughDOM=s0;va.throughDOM=s0;oo.throughDOM=s0;kc.throughDOM=a0;Lc.throughDOM=a0;Fc.throughDOM=a0;function l0(e="ws://localhost:3000/"){let t=[],n=!1,r=null,i,o={open(){n=!0,c()},close(){for(n=!1,r=null,i=null;t.length;)t.shift().reject("Socket closed")},error(l){if(r){let{reject:u}=r;r=null,c(),u(l)}else console.error("WebSocket error: ",l)},message({data:l}){if(r){let{query:u,resolve:f,reject:d}=r;if(r=null,c(),typeof l=="string"){let h=JSON.parse(l);h.error?d(h.error):f(h)}else if(u.type==="exec")f();else if(u.type==="arrow")f(Cc(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 gr=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?`${dD(t)}.`:""}${r}`}else return t?dD(t):"NULL"}};function dD(e){return e.split(".").map(n=>`"${n}"`).join(".")}function hD(e,t){return e instanceof gr&&e.column===t}function zt(e){return typeof e=="string"?Sa(e):e}function Bc(e){return typeof e=="string"?pD(e):e}function pD(e){return new gr(e)}function Sa(e,t){return arguments.length===1&&(t=e,e=null),new gr(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 u0(e){return e instanceof Ia}var Ia=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",()=>mq(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)&&!u0(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 mq(e,t){if(t?.size)return Promise.allSettled(Array.from(t,n=>n(e)))}function xv(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}=xv(e,t);return new Ia(n,r)}function _v(e){let t=zt(e);return j`${t} DESC NULLS LAST`.annotate({label:t?.label,desc:!0})}var Dr=e=>({value:e,toString:()=>so(e)});function wh(e){e(this.op,this),this.children?.forEach(t=>t.visit(e))}function mD(e,t){let n=t.filter(i=>i!=null).map(zt),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:wh})}var Xn=(...e)=>mD("AND",e.flat()),Pc=(...e)=>mD("OR",e.flat()),yq=e=>t=>j`(${e} ${zt(t)})`.annotate({op:e,a:t,visit:wh}),wv=yq("NOT"),yD=e=>t=>j`(${zt(t)} ${e})`.annotate({op:e,a:t,visit:wh}),$c=yD("IS NULL"),ms=yD("IS NOT NULL"),Ta=e=>(t,n)=>j`(${zt(t)} ${e} ${zt(n)})`.annotate({op:e,a:t,b:n,visit:wh}),ys=Ta("="),Uc=Ta("<>"),gs=Ta("<"),vh=Ta(">"),bs=Ta("<="),vv=Ta(">="),Sv=Ta("IS DISTINCT FROM"),Sh=Ta("IS NOT DISTINCT FROM");function gD(e,t,n,r){t=zt(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:wh,field:t,range:n})}var Te=(e,t,n)=>gD("BETWEEN",e,t,n),Iv=(e,t,n)=>gD("NOT BETWEEN",e,t,n);function zc(e,t){return Array.from({length:e},()=>t)}function vn(e,t){return(...n)=>{let r=n.map(zt),i=t?`::${t}`:"";return(r.length?j([`${e}(`,...zc(r.length-1,", "),`)${i}`],...r):j`${e}()${i}`).annotate({func:e,args:r})}}var Tv=vn("REGEXP_MATCHES"),Ev=vn("CONTAINS"),Av=vn("PREFIX"),Mv=vn("SUFFIX"),gq=vn("LOWER"),bq=vn("UPPER"),xq=vn("LENGTH"),_q=vn("ISNAN"),wq=vn("ISFINITE"),vq=vn("ISINF");var Ih=class e extends Ia{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(zt),r=j(["PARTITION BY ",zc(n.length-1,", "),""],...n),{window:i,func:o,type:s,name:a,order:c,frame:l}=this;return new e(i,o,s,a,r,c,l)}orderby(...t){let n=t.flat().filter(u=>u).map(zt),r=j(["ORDER BY ",zc(n.length-1,", "),""],...n),{window:i,func:o,type:s,name:a,group:c,frame:l}=this;return new e(i,o,s,a,c,r,l)}rows(t){let n=bD("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=bD("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 bD(e,t){if(ps(t)){let n=j`${t}`;return n.toString=()=>`${e} ${xD(t.value)}`,n}return`${e} ${xD(t)}`}function xD(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=vn(e)(...n);return new Ih(e,r,t)}}var Nv=Li("ROW_NUMBER","INTEGER"),Rv=Li("RANK","INTEGER"),Ov=Li("DENSE_RANK","INTEGER"),Dv=Li("PERCENT_RANK"),kv=Li("CUME_DIST"),Fv=Li("NTILE"),Lv=Li("LAG"),Cv=Li("LEAD"),Bv=Li("FIRST_VALUE"),Pv=Li("LAST_VALUE"),$v=Li("NTH_VALUE");function zv(e,...t){return j(e,...t).annotate({aggregate:!0})}var Uv=class e extends Ia{constructor(t,n,r,i,o){n=(n||[]).map(zt);let{strings:s,exprs:a}=Sq(t,n,r,i,o),{spans:c,cols:l}=xv(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(Iq).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 Ih(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 Sq(e,t,n,r,i){let o=`)${n?`::${n}`:""}`,s=[`${e}(${r?"DISTINCT ":""}`],a=[];return t.length?(s=s.concat([...zc(t.length-1,", "),`${o}${i?" FILTER (WHERE ":""}`,...i?[")"]:[]]),a=[...t,...i?[i]:[]]):s[0]+="*"+o,{exprs:a,strings:s}}function Iq(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 kr=Ht("COUNT","INTEGER"),qv=Ht("AVG"),Tq=Ht("AVG"),jv=Ht("MAD"),Jr=Ht("MAX"),ti=Ht("MIN"),Fr=Ht("SUM","DOUBLE"),Vv=Ht("PRODUCT"),Yv=Ht("MEDIAN"),Gv=Ht("QUANTILE"),Wv=Ht("MODE"),Xv=Ht("VARIANCE"),Hv=Ht("STDDEV"),Zv=Ht("SKEWNESS"),Qv=Ht("KURTOSIS"),Kv=Ht("ENTROPY"),Jv=Ht("VAR_POP"),t2=Ht("STDDEV_POP"),e2=Ht("CORR"),n2=Ht("COVAR_POP"),r2=Ht("REGR_INTERCEPT"),i2=Ht("REGR_SLOPE"),o2=Ht("REGR_COUNT"),Eq=Ht("REGR_R2"),s2=Ht("REGR_SYY"),a2=Ht("REGR_SXX"),Aq=Ht("REGR_SXY"),c2=Ht("REGR_AVGX"),Mq=Ht("REGR_AVGY"),l2=Ht("FIRST"),u2=Ht("LAST"),mu=Ht("ARG_MIN"),yu=Ht("ARG_MAX"),f2=Ht("STRING_AGG"),d2=Ht("ARRAY_AGG");function Th(e,t){let n=zt(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 gu=e=>Th(e,"DOUBLE"),h2=e=>Th(e,"INTEGER");var p2=e=>j`epoch_ms(${zt(e)})`,m2=e=>{let t=zt(e);return j`MAKE_DATE(2012, MONTH(${t}), 1)`.annotate({label:"month"})},y2=e=>{let t=zt(e);return j`MAKE_DATE(2012, MONTH(${t}), DAY(${t}))`.annotate({label:"date"})},g2=e=>{let t=zt(e);return j`MAKE_DATE(2012, 1, DAY(${t}))`.annotate({label:"date"})};var Eh=vn("ST_AsGeoJSON"),_D=vn("ST_X"),wD=vn("ST_Y"),Ah=vn("ST_CENTROID"),b2=e=>_D(Ah(e)),x2=e=>wD(Ah(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 qc("UNION",t.flat())}static unionAll(...t){return new qc("UNION ALL",t.flat())}static intersect(...t){return new qc("INTERSECT",t.flat())}static except(...t){return new qc("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:zt(i)});else if(i instanceof gr)r.push({as:i.column,expr:i});else if(Array.isArray(i))r.push({as:i[0],expr:i[1]});else for(let o in i)r.push({as:f0(o),expr:zt(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:Bc(i)});else if(i instanceof gr)r.push({as:i.table,from:i});else if(d0(i)||u0(i))r.push({from:i});else if(Array.isArray(i))r.push({as:f0(i[0]),from:Bc(i[1])});else for(let o in i)r.push({as:f0(o),from:Bc(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(zt)),this)}$groupby(...t){return this.query.groupby=[],this.groupby(...t)}having(...t){let{query:n}=this;return t.length===0?n.having:(n.having=n.having.concat(t.flat().filter(r=>r)),this)}window(...t){let{query:n}=this;if(t.length===0)return n.window;{let r=[];return t.flat().forEach(i=>{if(i!=null)for(let o in i)r.push({as:f0(o),expr:i[o]})}),n.window=n.window.concat(r),this}}qualify(...t){let{query:n}=this;return t.length===0?n.qualify:(n.qualify=n.qualify.concat(t.flat().filter(r=>r)),this)}orderby(...t){let{query:n}=this;return t.length===0?n.orderby:(n.orderby=n.orderby.concat(t.flat().filter(r=>r).map(zt)),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(d0(s))o.push(s);else if(i[s.table]){let a=i[s.table];o.push(a)}}),o}toString(){let{select:t,distinct:n,from:r,sample:i,where:o,groupby:s,having:a,window:c,qualify:l,orderby:u,limit:f,offset:d,with:h}=this.query,p=[];if(h.length){let g=h.map(({as:y,query:b})=>`"${y}" AS (${b})`);p.push(`WITH ${g.join(", ")}`)}let m=t.map(({as:g,expr:y})=>hD(y,g)&&!y.table?`${y}`:`${y} AS "${g}"`);if(p.push(`SELECT${n?" DISTINCT":""} ${m.join(", ")}`),r.length){let g=r.map(({as:y,from:b})=>{let x=d0(b)?`(${b})`:`${b}`;return!y||y===b.table?x:`${x} AS "${y}"`});p.push(`FROM ${g.join(", ")}`)}if(o.length){let g=o.map(String).filter(y=>y).join(" AND ");g&&p.push(`WHERE ${g}`)}if(i){let{rows:g,perc:y,method:b,seed:x}=i,_=g?`${g} ROWS`:`${y} 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(y=>y).join(" AND ");g&&p.push(`HAVING ${g}`)}if(c.length){let g=c.map(({as:y,expr:b})=>`"${y}" AS (${b})`);p.push(`WINDOW ${g.join(", ")}`)}if(l.length){let g=l.map(String).filter(y=>y).join(" AND ");g&&p.push(`QUALIFY ${g}`)}return u.length&&p.push(`ORDER BY ${u.join(", ")}`),Number.isFinite(f)&&p.push(`LIMIT ${f}`),Number.isFinite(d)&&p.push(`OFFSET ${d}`),p.join(" ")}},qc=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(zt)),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 d0(e){return e instanceof yt||e instanceof qc}function f0(e){return Nq(e)?e.slice(1,-1):e}function Nq(e){return e[0]==='"'&&e[e.length-1]==='"'}var h0=e=>e;function Rq(){return{apply:h0,invert:h0,sqlApply:zt,sqlInvert:h0}}function Oq({base:e}={}){if(e==null||e===Math.E)return{apply:Math.log,invert:Math.exp,sqlApply:t=>j`LN(${zt(t)})`,sqlInvert:t=>j`EXP(${t})`};if(e===10)return{apply:Math.log10,invert:t=>Math.pow(10,t),sqlApply:t=>j`LOG(${zt(t)})`,sqlInvert:t=>j`POW(10, ${t})`};{let t=+e;return{apply:n=>Math.log(n)/Math.log(t),invert:n=>Math.pow(t,n),sqlApply:n=>j`LN(${zt(n)}) / LN(${t})`,sqlInvert:n=>j`POW(${t}, ${n})`}}}function Dq({constant:e=1}={}){let t=+e;return{apply:n=>Math.sign(n)*Math.log1p(Math.abs(n)),invert:n=>Math.sign(n)*Math.exp(Math.abs(n)-t),sqlApply:n=>(n=zt(n),j`SIGN(${n}) * LN(${t} + ABS(${n}))`),sqlInvert:n=>j`SIGN(${n}) * (EXP(ABS(${n})) - ${t})`}}function kq(){return{apply:e=>Math.sign(e)*Math.sqrt(Math.abs(e)),invert:e=>Math.sign(e)*e*e,sqlApply:e=>(e=zt(e),j`SIGN(${e}) * SQRT(ABS(${e}))`),sqlInvert:e=>j`SIGN(${e}) * (${e}) ** 2`}}function Fq({exponent:e=1}={}){let t=+e;return{apply:n=>Math.sign(n)*Math.pow(Math.abs(n),t),invert:n=>Math.sign(n)*Math.pow(Math.abs(n),1/t),sqlApply:n=>(n=zt(n),j`SIGN(${n}) * POW(ABS(${n}), ${t})`),sqlInvert:n=>j`SIGN(${n}) * POW(ABS(${n}), 1/${t})`}}function vD(){return{apply:e=>+e,invert:e=>new Date(e),sqlApply:e=>e instanceof Date?+e:p2(zt(e)),sqlInvert:h0}}var Lq={linear:Rq,log:Oq,symlog:Dq,sqrt:kq,pow:Fq,time:vD,utc:vD};function Mh(e){let t=Lq[e.type];return t?{...e,...t(e)}:null}function Ea(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 _2(e){return`INSTALL ${e}; LOAD ${e}`}function SD(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 p0(e,t,n,r={},i={}){let{select:o=["*"],where:s,view:a,temp:c,replace:l,...u}=r,f=Cq({...i,...u}),d=`${e}('${n}'${f?", "+f:""})`,h=s?` WHERE ${s}`:"",p=`SELECT ${o.join(", ")} FROM ${d}${h}`;return Ea(t,p,{view:a,temp:c,replace:l})}function v2(e,t,n){return p0("read_csv",e,t,n,{auto_detect:!0,sample_size:-1})}function S2(e,t,n){return p0("read_json",e,t,n,{auto_detect:!0,json_format:"auto"})}function I2(e,t,n){return p0("read_parquet",e,t,n)}function T2(e,t,n={}){let{options:r,...i}=n;if(r){let o=Array.isArray(r)?r.join(", "):typeof r=="string"?r:Object.entries(r).map(([s,a])=>`${s}=${a}`).join(", ");i.open_options=o.toUpperCase()}return p0("st_read",e,t,i)}function E2(e,t,n={}){let{select:r=["*"],...i}=n,o=SD(t),s=r.length===1&&r[0]==="*"?o:`SELECT ${r} FROM ${o}`;return Ea(e,s,i)}function Cq(e){return Object.entries(e).map(([t,n])=>`${t}=${w2(n)}`).join(", ")}function w2(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=>w2(t)).join(", ")+"]":"{"+Object.entries(e).map(([t,n])=>`'${t}': ${w2(n)}`).join(", ")+"}";default:return e}}function ID(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 Bq="count",Pq="nulls",$q="max",Uq="min",zq="distinct";var qq={[Bq]:kr,[zq]:e=>kr(e).distinct(),[$q]:Jr,[Uq]:ti,[Pq]:e=>kr().where($c(e))};function TD({table:e,column:t},n){return yt.from(e).select(n.map(r=>[r,qq[r](t)]))}var ED=()=>Object.create(null),m0=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=jq(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 Vq(this,t);return(await Promise.all(n.map(i=>this.fieldInfo(i)))).filter(i=>i)}};async function jq(e,t){let n=await e.query(`DESCRIBE ${Bc(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:ID(i.column_type),nullable:i.null==="YES"};return r}async function Vq(e,t){return t.length===1&&t[0].column==="*"?Object.values(await e.tableInfo(t[0].table)):t}function MD(e){let t=2166136261;for(let n=0,r=e.length;n<r;++n){let i=e.charCodeAt(n),o=i&65280;o&&(t=AD(t^o>>8)),t=AD(t^i&255)}return Yq(t)}function AD(e){return e+(e<<1)+(e<<4)+(e<<7)+(e<<8)+(e<<24)}function Yq(e){return e+=e<<13,e^=e>>>7,e+=e<<3,e^=e>>>17,e+=e<<5,e&4294967295}var y0=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,RD),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=Gq(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=RD(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]);Xq(d,b)}let h=f.orderby();f.query.orderby=[];let p=f.toString(),g=`cube_index_${(MD(p)>>>0).toString(16)}`,y=a.exec(Ea(g,p,{temp:c}));s.set(l,{table:g,result:y,order:h,...u})}}async update(){let{clients:t,selection:n,activeView:r}=this,i=r.predicate(n.active.predicate);return Promise.all(Array.from(t).map(o=>this.updateClient(o,i)))}async updateClient(t,n){let r=this.indices.get(t);if(!r)return;n||(n=this.activeView.predicate(this.selection.active.predicate));let{table:i,dims:o,aggr:s,order:a=[]}=r,c=yt.select(o,s).from(i).groupby(o).where(n).orderby(a);return this.mc.updateClient(t,c)}};function Gq(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=>Wq(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?Xn(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=c=>c,r=Object.fromEntries(r.map(c=>[c.toString(),c]));else return null;return{source:t,columns:r,predicate:a}}function Wq(e,t){let{apply:n,sqlApply:r}=Mh(e);if(n){let{domain:i,range:o}=e,s=n(Math.min(...i)),a=n(Math.max(...i)),c=Math.abs(o[1]-o[0])/(a-s)/t,l=t===1?"":`${t}::INTEGER * `;return u=>j`${l}FLOOR(${c}::DOUBLE * (${r(u)} - ${s}::DOUBLE))::INTEGER`}}var ND={from:NaN};function RD(e){if(!e.filterIndexable)return ND;let t=e.query(),n=A2(t);if(!n||!t.groupby)return ND;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 A2(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=A2(t[0]);for(let r=1;r<t.length;++r){let i=A2(t[r]);if(i!==void 0&&i!==n)return NaN}return n}function Xq(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 g0=class{constructor(t,n,r=!0){this.mc=t,this.selection=n,this.clients=new Set,this.indexer=r?new y0(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():Hq(t,r,i)}};function Hq(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 b0(){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 Zq(e){return(typeof requestAnimationFrame<"u"?requestAnimationFrame:typeof setImmediate<"u"?setImmediate:setTimeout)(e)}function OD(e,t,n){let r=[],i=0;function o(){let s=Qq(r,t);r=[],i=0;for(let a of s)Jq(a,e,n),nj(a,t)}return{add(s,a){s.request.type==="arrow"?(i=i||Zq(()=>o()),r.push({entry:s,priority:a,index:r.length})):e(s,a)}}}function Qq(e,t){let n=[],r=new Map;for(let i of e){let{entry:{request:o}}=i,s=Kq(o.query,t);if(!r.has(s)){let a=[];n.push(a),r.set(s,a)}r.get(s).push(i)}return n}function Kq(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 gr&&o[s.column]||s))}return`${r}`}else return n}function Jq(e,t,n){if(tj(e))t({request:{type:"arrow",cache:!1,record:!1,query:ej(e,n)},result:e.result=b0()});else for(let{entry:r,priority:i}of e)t(r,i)}function tj(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 ej(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 gr&&s[a.column]||a))}return i.$select(Array.from(r.values()))}async function nj(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=rj(i,n[s]);a.cache&&t.set(String(a.query),l),c.fulfill(l)})}function rj(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 ij=typeof requestIdleCallback<"u"?requestIdleCallback:setTimeout,DD=()=>({get:()=>{},set:(e,t)=>t,clear:()=>{}});function kD({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&&ij(r),o},clear(){n=new Map}}}function FD(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 LD(){let e=FD(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:m=!1,record:g=!0,options:y}=f,b=h?`${h}`:null;if(g&&l(b),m){let v=n.get(b);if(v){r.debug("Cache"),d.fulfill(v);return}}let x=performance.now(),_=await t.query({type:p,sql:b,...y});m&&n.set(b,_),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?kD():f||DD():n},logger(f){return f?r=f:r},connector(f){return f?t=f:t},consolidate(f){f&&!s?s=OD(c,n,l):!f&&s&&(s=null)},request(f,d=ao.Normal){let h=b0(),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 CD(){return{debug(){},info(){},log(){},warn(){},error(){}}}var x0;function ei(e){return e?x0=e:x0==null&&(x0=new Nh),x0}var Nh=class{constructor(t=l0(),n={}){let{logger:r=console,manager:i=LD()}=n;this.catalog=new m0(this),this.manager=i,this.logger(r),this.configure(n),this.databaseConnector(t),this.clear()}logger(t){return arguments.length&&(this._logger=t||CD(),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 g0(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 _0=class{constructor(){this._callbacks=new Map}addEventListener(t,n){this._callbacks.has(t)||this._callbacks.set(t,{callbacks:new Set,pending:null,queue:new M2}),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}}}},M2=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 Rh(e,t){return e===t?!1:e instanceof Date&&t instanceof Date?+e!=+t:Array.isArray(e)&&Array.isArray(t)?oj(e,t):!0}function oj(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 br(e){return e instanceof Aa}var Aa=class e extends _0{constructor(t){super(),this._value=t}static value(t){return new e(t)}static array(t){if(t.some(n=>br(n))){let n=new e,r=()=>n.update(t.map(i=>br(i)?i.value:i));return r(),t.forEach(i=>br(i)?i.addEventListener("value",r):0),n}return new e(t)}get value(){return this._value}update(t,{force:n}={}){return Rh(this._value,t)||n?this.emit("value",t):this.cancel("value"),this}willEmit(t,n){return t==="value"&&(this._value=n),n}};function ni(e){return e instanceof xs}var xs=class e extends Aa{static intersect({cross:t=!1}={}){return new e(new jc({cross:t}))}static union({cross:t=!1}={}){return new e(new jc({cross:t,union:!0}))}static single({cross:t=!1}={}){return new e(new jc({cross:t,single:!0}))}static crossfilter(){return new e(new jc({cross:!0}))}constructor(t=new jc){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)}},jc=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?Pc(o):o}queueFilter(t){if(this.cross){let n=t.active?.source;return r=>r.active?.source!==n}}};function BD(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"?Cc(n):(await n).json()}}}var sj=Object.create,PD=Object.defineProperty,aj=Object.getOwnPropertyDescriptor,cj=Object.getOwnPropertyNames,lj=Object.getPrototypeOf,uj=Object.prototype.hasOwnProperty,fj=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),dj=(e,t,n,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of cj(t))!uj.call(e,i)&&i!==n&&PD(e,i,{get:()=>t[i],enumerable:!(r=aj(t,i))||r.enumerable});return e},hj=(e,t,n)=>(n=e!=null?sj(lj(e)):{},dj(t||!e||!e.__esModule?PD(n,"default",{value:e,enumerable:!0}):n,e)),pj=fj((e,t)=>{t.exports=Worker}),mj=(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))(mj||{}),yj=(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))(yj||{}),gj=(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))(gj||{}),bj=(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))(bj||{}),xj=(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))(xj||{}),_j=(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))(_j||{}),$D=class{log(e){}},UD=class{constructor(e=2){this.level=e}log(e){e.level>=this.level&&console.log(e)}};var wj=(e=>(e[e.SUCCESS=0]="SUCCESS",e))(wj||{}),vj=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 sn(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 zD(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 Sj(this._bindings,this._conn,t)}async insertArrowTable(e,t){let n=c0(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)}},zD=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}},Sj=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 sn(n)}async send(...e){let t=await this.bindings.sendPrepared(this.connectionId,this.statementId,e),n=new zD(this.bindings,this.connectionId,t),r=await nn.from(n);return console.assert(r.isAsync()),console.assert(r.isStream()),r}},Ij=(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))(Ij||{}),Tj=(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))(Tj||{}),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 w0(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:w0(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=>F2(t.name,t.type))};case D.Map:{let t=e;return{sqlType:"map",keyType:w0(t.keyType),valueType:w0(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 F2(e,t){let n=w0(t);return n.name=e,n}var Ej=new TextEncoder,qD=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 vj(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=Ej.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(F2(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(F2(o,s))}n.columnsFlat=i,delete n.columns}let r=new Kt("IMPORT_JSON_FROM_PATH",[e,t,n]);await this.postTask(r)}};var Aj=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])),Mj=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])),Nj=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])),Rj=()=>(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])),L2={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"}}},Oj=L2.name,Dj=L2.version,C2=L2.version.split("."),eht=C2[0],nht=C2[1],rht=C2[2],kj=()=>typeof navigator>"u";function jD(){let e="https://cdn.jsdelivr.net/npm/".concat(Oj,"@").concat(Dj,"/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 N2=null,R2=null,O2=null,D2=null,k2=null;async function Fj(){return N2==null&&(N2=typeof BigInt64Array<"u"),R2==null&&(R2=await Mj()),O2==null&&(O2=await Rj()),D2==null&&(D2=await Nj()),k2==null&&(k2=await Aj()),{bigInt64Array:N2,crossOriginIsolated:kj()||globalThis.crossOriginIsolated||!1,wasmExceptions:R2,wasmSIMD:D2,wasmThreads:O2,wasmBulkMemory:k2}}async function VD(e){let t=await Fj();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 iht=hj(pj());function Lj(){let e=new TextDecoder;return t=>(typeof SharedArrayBuffer<"u"&&t.buffer instanceof SharedArrayBuffer&&(t=new Uint8Array(t)),e.decode(t))}var oht=Lj(),Cj=(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))(Cj||{});function YD(e={}){let{duckdb:t,connection:n,...r}=e,i=t,o=n,s;function a(){return s||(s=(i?Promise.resolve(i):Pj(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 Pj({log:e=!1}={}){let t=jD(),n=await VD(t),r=URL.createObjectURL(new Blob([`importScripts("${n.mainWorker}");`],{type:"text/javascript"})),i=new Worker(r),o=e?new UD:new $D,s=new qD(o,i);return await s.instantiate(n.mainModule,n.pthreadWorker),URL.revokeObjectURL(r),s}function B2(){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 yR={};vr(yR,{Fixed:()=>co,Param:()=>Aa,Query:()=>yt,Selection:()=>xs,agg:()=>zv,align:()=>dM,and:()=>Xn,area:()=>VN,areaX:()=>YN,areaY:()=>GN,argmax:()=>yu,argmin:()=>mu,arrayAgg:()=>d2,arrow:()=>B4,aspectRatio:()=>hM,avg:()=>qv,axis:()=>pM,axisFx:()=>q4,axisFy:()=>j4,axisX:()=>U4,axisY:()=>z4,barX:()=>ZN,barY:()=>QN,bin:()=>mw,cast:()=>Th,castDouble:()=>gu,castInteger:()=>h2,cell:()=>KN,cellX:()=>JN,cellY:()=>t4,centroid:()=>Ah,centroidX:()=>b2,centroidY:()=>x2,circle:()=>a4,colorBase:()=>J6,colorClamp:()=>q6,colorConstant:()=>eN,colorDomain:()=>U6,colorExponent:()=>tN,colorInterpolate:()=>G6,colorLabel:()=>H6,colorLegend:()=>hR,colorN:()=>j6,colorNice:()=>V6,colorPivot:()=>W6,colorRange:()=>z6,colorReverse:()=>Z6,colorScale:()=>$6,colorScheme:()=>Y6,colorSymmetric:()=>X6,colorTickFormat:()=>K6,colorZero:()=>Q6,column:()=>Sa,contour:()=>T4,coordinator:()=>ei,corr:()=>e2,count:()=>kr,covarPop:()=>n2,create:()=>Ea,cume_dist:()=>kv,dateDay:()=>g2,dateMonth:()=>m2,dateMonthDay:()=>y2,delaunayLink:()=>F4,delaunayMesh:()=>L4,denseLine:()=>I4,dense_rank:()=>Ov,density:()=>S4,densityX:()=>w4,densityY:()=>v4,dot:()=>i4,dotX:()=>o4,dotY:()=>s4,entropy:()=>Kv,eq:()=>ys,facetGrid:()=>B3,facetLabel:()=>P3,facetMargin:()=>D3,facetMarginBottom:()=>F3,facetMarginLeft:()=>L3,facetMarginRight:()=>C3,facetMarginTop:()=>k3,first:()=>l2,first_value:()=>Bv,frame:()=>$4,from:()=>p$,fxAlign:()=>G3,fxAriaDescription:()=>u6,fxAriaLabel:()=>l6,fxAxis:()=>Z3,fxDomain:()=>$3,fxFontVariant:()=>c6,fxGrid:()=>r6,fxInset:()=>q3,fxInsetLeft:()=>j3,fxInsetRight:()=>V3,fxLabel:()=>o6,fxLabelAnchor:()=>s6,fxLabelOffset:()=>a6,fxLine:()=>i6,fxNice:()=>z3,fxPadding:()=>W3,fxPaddingInner:()=>X3,fxPaddingOuter:()=>H3,fxRange:()=>U3,fxReverse:()=>f6,fxRound:()=>Y3,fxTickFormat:()=>e6,fxTickPadding:()=>t6,fxTickRotate:()=>n6,fxTickSize:()=>K3,fxTickSpacing:()=>J3,fxTicks:()=>Q3,fyAlign:()=>x6,fyAriaDescription:()=>B6,fyAriaLabel:()=>C6,fyAxis:()=>S6,fyDomain:()=>d6,fyFontVariant:()=>L6,fyGrid:()=>R6,fyInset:()=>m6,fyInsetBottom:()=>g6,fyInsetTop:()=>y6,fyLabel:()=>D6,fyLabelAnchor:()=>k6,fyLabelOffset:()=>F6,fyLine:()=>O6,fyNice:()=>p6,fyPadding:()=>_6,fyPaddingInner:()=>w6,fyPaddingOuter:()=>v6,fyRange:()=>h6,fyReverse:()=>P6,fyRound:()=>b6,fyTickFormat:()=>M6,fyTickPadding:()=>A6,fyTickRotate:()=>N6,fyTickSize:()=>T6,fyTickSpacing:()=>E6,fyTicks:()=>I6,geo:()=>X4,geojson:()=>Eh,graticule:()=>Z4,grid:()=>yM,gridFx:()=>G4,gridFy:()=>W4,gridX:()=>V4,gridY:()=>Y4,gt:()=>vh,gte:()=>vv,hconcat:()=>a$,heatmap:()=>E4,height:()=>aM,hexagon:()=>c4,hexbin:()=>N4,hexgrid:()=>R4,highlight:()=>Q4,hspace:()=>u$,hull:()=>C4,image:()=>_4,inset:()=>mM,intervalX:()=>rR,intervalXY:()=>oR,intervalY:()=>iR,isBetween:()=>Te,isDistinct:()=>Sv,isNotBetween:()=>Iv,isNotDistinct:()=>Sh,isNotNull:()=>ms,isNull:()=>$c,kurtosis:()=>Qv,label:()=>gM,lag:()=>Lv,last:()=>u2,last_value:()=>Pv,lead:()=>Cv,lengthBase:()=>NN,lengthClamp:()=>EN,lengthConstant:()=>ON,lengthDomain:()=>IN,lengthExponent:()=>RN,lengthNice:()=>AN,lengthRange:()=>TN,lengthScale:()=>SN,lengthZero:()=>MN,line:()=>WN,lineX:()=>XN,lineY:()=>HN,link:()=>P4,literal:()=>Dr,loadCSV:()=>v2,loadExtension:()=>_2,loadJSON:()=>S2,loadObjects:()=>E2,loadParquet:()=>I2,loadSpatial:()=>T2,lt:()=>gs,lte:()=>bs,mad:()=>jv,margin:()=>rM,marginBottom:()=>fM,marginLeft:()=>cM,marginRight:()=>lM,marginTop:()=>uM,margins:()=>nM,max:()=>Jr,median:()=>Yv,menu:()=>e$,min:()=>ti,mode:()=>Wv,name:()=>tM,nearestX:()=>eR,nearestY:()=>nR,neq:()=>Uc,not:()=>wv,nth_value:()=>$v,ntile:()=>Fv,opacityBase:()=>fN,opacityClamp:()=>oN,opacityConstant:()=>hN,opacityDomain:()=>rN,opacityExponent:()=>dN,opacityLabel:()=>aN,opacityLegend:()=>pR,opacityNice:()=>sN,opacityRange:()=>iN,opacityReverse:()=>cN,opacityScale:()=>nN,opacityTickFormat:()=>uN,opacityZero:()=>lN,or:()=>Pc,padding:()=>bM,pan:()=>sR,panX:()=>aR,panY:()=>cR,panZoom:()=>lR,panZoomX:()=>uR,panZoomY:()=>fR,percent_rank:()=>Dv,plot:()=>b$,product:()=>Vv,projectionClip:()=>qN,projectionDomain:()=>CN,projectionInset:()=>BN,projectionInsetBottom:()=>zN,projectionInsetLeft:()=>PN,projectionInsetRight:()=>$N,projectionInsetTop:()=>UN,projectionParallels:()=>kN,projectionPrecision:()=>FN,projectionRotate:()=>LN,projectionType:()=>DN,quantile:()=>Gv,rBase:()=>_N,rClamp:()=>gN,rConstant:()=>vN,rDomain:()=>mN,rExponent:()=>wN,rNice:()=>bN,rRange:()=>yN,rScale:()=>pN,rZero:()=>xN,rank:()=>Rv,raster:()=>A4,rasterTile:()=>M4,rect:()=>e4,rectX:()=>n4,rectY:()=>r4,regressionY:()=>O4,round:()=>xM,row_number:()=>Nv,ruleX:()=>d4,ruleY:()=>h4,search:()=>n$,skewness:()=>Zv,slider:()=>r$,sphere:()=>H4,spike:()=>x4,sql:()=>j,stddev:()=>Hv,stddevPop:()=>t2,stringAgg:()=>f2,style:()=>oM,sum:()=>Fr,symbolLegend:()=>mR,table:()=>i$,text:()=>l4,textX:()=>u4,textY:()=>f4,tickX:()=>p4,tickY:()=>m4,toggle:()=>gd,toggleColor:()=>tR,toggleX:()=>K4,toggleY:()=>J4,varPop:()=>Jv,variance:()=>Xv,vconcat:()=>s$,vector:()=>y4,vectorX:()=>g4,vectorY:()=>b4,voronoi:()=>D4,voronoiMesh:()=>k4,vspace:()=>l$,width:()=>sM,xAlign:()=>NM,xAriaDescription:()=>WM,xAriaLabel:()=>GM,xAxis:()=>kM,xBase:()=>ZM,xClamp:()=>AM,xConstant:()=>KM,xDomain:()=>wM,xExponent:()=>QM,xFontVariant:()=>YM,xGrid:()=>UM,xInset:()=>IM,xInsetLeft:()=>TM,xInsetRight:()=>EM,xLabel:()=>qM,xLabelAnchor:()=>jM,xLabelOffset:()=>VM,xLine:()=>zM,xNice:()=>SM,xPadding:()=>RM,xPaddingInner:()=>OM,xPaddingOuter:()=>DM,xRange:()=>vM,xReverse:()=>XM,xRound:()=>MM,xScale:()=>_M,xTickFormat:()=>PM,xTickPadding:()=>BM,xTickRotate:()=>$M,xTickSize:()=>LM,xTickSpacing:()=>CM,xTicks:()=>FM,xZero:()=>HM,xyDomain:()=>iM,yAlign:()=>c3,yAriaDescription:()=>E3,yAriaLabel:()=>T3,yAxis:()=>d3,yBase:()=>N3,yClamp:()=>s3,yConstant:()=>O3,yDomain:()=>t3,yExponent:()=>R3,yFontVariant:()=>I3,yGrid:()=>x3,yInset:()=>r3,yInsetBottom:()=>o3,yInsetTop:()=>i3,yLabel:()=>w3,yLabelAnchor:()=>v3,yLabelOffset:()=>S3,yLine:()=>_3,yNice:()=>n3,yPadding:()=>l3,yPaddingInner:()=>u3,yPaddingOuter:()=>f3,yRange:()=>e3,yReverse:()=>A3,yRound:()=>a3,yScale:()=>JM,yTickFormat:()=>g3,yTickPadding:()=>y3,yTickRotate:()=>b3,yTickSize:()=>p3,yTickSpacing:()=>m3,yTicks:()=>h3,yZero:()=>M3});var co=Symbol("Fixed"),Sn=Symbol("Transient"),Oh=Symbol("Transform");var ow={};vr(ow,{Area:()=>Fl,Arrow:()=>jm,BarX:()=>Vm,BarY:()=>Ym,Cell:()=>Ll,Contour:()=>ty,Density:()=>ry,Dot:()=>Cl,Frame:()=>Lm,Geo:()=>iy,Hexgrid:()=>oy,Image:()=>sy,Line:()=>Bl,Link:()=>zm,Mark:()=>wt,Raster:()=>Jm,Rect:()=>$l,RuleX:()=>Rm,RuleY:()=>Om,Text:()=>Ol,TickX:()=>Hm,TickY:()=>Zm,Tip:()=>Cm,Vector:()=>kl,area:()=>Um,areaX:()=>cc,areaY:()=>ea,arrow:()=>U7,auto:()=>Q7,autoSpec:()=>rA,axisFx:()=>I_,axisFy:()=>S_,axisX:()=>km,axisY:()=>Dm,barX:()=>Uo,barY:()=>zo,bin:()=>ta,binX:()=>Po,binY:()=>$o,bollinger:()=>dc,bollingerX:()=>rP,bollingerY:()=>iP,boxX:()=>oP,boxY:()=>sP,cell:()=>lc,cellX:()=>q7,cellY:()=>j7,centroid:()=>n9,circle:()=>G7,cluster:()=>e9,column:()=>pn,contour:()=>mP,crosshair:()=>bP,crosshairX:()=>xP,crosshairY:()=>_P,delaunayLink:()=>SP,delaunayMesh:()=>IP,density:()=>NP,differenceY:()=>DP,dodgeX:()=>y9,dodgeY:()=>g9,dot:()=>yi,dotX:()=>V7,dotY:()=>Y7,filter:()=>JC,find:()=>c5,formatIsoDate:()=>dE,formatMonth:()=>h5,formatWeekday:()=>p5,frame:()=>Uf,geo:()=>X_,geoCentroid:()=>r9,graticule:()=>FP,gridFx:()=>M_,gridFy:()=>E_,gridX:()=>A_,gridY:()=>T_,group:()=>vm,groupX:()=>tc,groupY:()=>ec,groupZ:()=>wm,hexagon:()=>W7,hexbin:()=>LP,hexgrid:()=>CP,hull:()=>TP,identity:()=>W,image:()=>PP,indexOf:()=>Ae,initializer:()=>Se,interpolateNearest:()=>uA,interpolateNone:()=>W_,interpolatorBarycentric:()=>lA,interpolatorRandomWalk:()=>fA,legend:()=>c7,line:()=>Pl,lineX:()=>uc,lineY:()=>fc,linearRegressionX:()=>zP,linearRegressionY:()=>qP,link:()=>P_,map:()=>_r,mapX:()=>Jf,mapY:()=>td,marks:()=>Je,normalize:()=>rw,normalizeX:()=>w9,normalizeY:()=>v9,plot:()=>Pm,pointer:()=>Lf,pointerX:()=>Cf,pointerY:()=>Al,raster:()=>fP,rect:()=>Wm,rectX:()=>Zf,rectY:()=>Qf,reverse:()=>t5,ruleX:()=>jr,ruleY:()=>Vr,scale:()=>kf,select:()=>I9,selectFirst:()=>DA,selectLast:()=>kA,selectMaxX:()=>A9,selectMaxY:()=>M9,selectMinX:()=>T9,selectMinY:()=>E9,shiftX:()=>S9,shuffle:()=>e5,sort:()=>z1,sphere:()=>kP,spike:()=>qB,stackX:()=>tA,stackX1:()=>O7,stackX2:()=>D7,stackY:()=>eA,stackY1:()=>k7,stackY2:()=>F7,text:()=>Bo,textX:()=>y_,textY:()=>g_,tickX:()=>V_,tickY:()=>Y_,tip:()=>O_,transform:()=>mn,tree:()=>EA,treeLink:()=>J_,treeNode:()=>ay,valueof:()=>mt,vector:()=>jE,vectorX:()=>__,vectorY:()=>w_,voronoi:()=>EP,voronoiMesh:()=>AP,window:()=>ed,windowX:()=>K7,windowY:()=>J7});function Ut(e,t){return e==null||t==null?NaN:e<t?-1:e>t?1:e>=t?0:NaN}function Hn(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=Ut,n=(a,c)=>Ut(e(a),c),r=(a,c)=>e(a)-c):(t=e===Ut||e===Hn?e:$j,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 $j(){return 0}function Dh(e){return e===null?NaN:+e}function*GD(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 WD=_s(Ut),XD=WD.right,Uj=WD.left,zj=_s(Dh).center,ws=XD;var kh=HD(ZD),P2=HD(qj);function HD(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?(bu(a,l,i,o,s),bu(a,i,l,o,s),bu(a,l,i,o,s),xu(c,i,l,o,s),xu(c,l,i,o,s),xu(c,i,l,o,s)):a?(bu(a,i,l,o,s),bu(a,l,i,o,s),bu(a,i,l,o,s)):c&&(xu(c,i,l,o,s),xu(c,l,i,o,s),xu(c,i,l,o,s)),t}}function bu(e,t,n,r,i){for(let o=0,s=r*i;o<s;)e(t,n,o,o+=r,1)}function xu(e,t,n,r,i){for(let o=0,s=r*i;o<r;++o)e(t,n,o,o+s,r)}function qj(e){let t=ZD(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 ZD(e){let t=Math.floor(e);if(t===e)return jj(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 jj(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 lo(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 Vj(e){return e.length|0}function Yj(e){return!(e>0)}function Gj(e){return typeof e!="object"||"length"in e?e:Array.from(e)}function Wj(e){return t=>e(...t)}function v0(...e){let t=typeof e[e.length-1]=="function"&&Wj(e.pop());e=e.map(Gj);let n=e.map(Vj),r=e.length-1,i=new Array(r+1).fill(0),o=[];if(r<0||n.some(Yj))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 S0(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 Ma(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=Ma(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 Zn=class extends Map{constructor(t,n=JD){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($2(this,t))}has(t){return super.has($2(this,t))}set(t,n){return super.set(QD(this,t),n)}delete(t){return super.delete(KD(this,t))}},Qn=class extends Set{constructor(t,n=JD){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($2(this,t))}add(t){return super.add(QD(this,t))}delete(t){return super.delete(KD(this,t))}};function $2({_intern:e,_key:t},n){let r=t(n);return e.has(r)?e.get(r):n}function QD({_intern:e,_key:t},n){let r=t(n);return e.has(r)?e.get(r):(e.set(r,n),n)}function KD({_intern:e,_key:t},n){let r=t(n);return e.has(r)&&(n=e.get(r),e.delete(r)),n}function JD(e){return e!==null&&typeof e=="object"?e.valueOf():e}function Fh(e){return e}function an(e,...t){return z2(e,Fh,Fh,t)}function Ci(e,t,...n){return z2(e,Fh,t,n)}function U2(e,t,...n){return z2(e,Array.from,t,n)}function z2(e,t,n,r){return function i(o,s){if(s>=r.length)return n(o);let a=new Zn,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 q2(e,t){return Array.from(t,n=>e[n])}function uo(e,...t){if(typeof e[Symbol.iterator]!="function")throw new TypeError("values is not iterable");e=Array.from(e);let[n]=t;if(n&&n.length!==2||t.length>1){let r=Uint32Array.from(e,(i,o)=>o);return t.length>1?(t=t.map(i=>e.map(i)),r.sort((i,o)=>{for(let s of t){let a=Vc(s[i],s[o]);if(a)return a}})):(n=e.map(n),r.sort((i,o)=>Vc(n[i],n[o]))),q2(e,r)}return e.sort(Lh(n))}function Lh(e=Ut){if(e===Ut)return Vc;if(typeof e!="function")throw new TypeError("compare is not a function");return(t,n)=>{let r=e(t,n);return r||r===0?r:(e(n,n)===0)-(e(t,t)===0)}}function Vc(e,t){return(e==null||!(e>=e))-(t==null||!(t>=t))||(e<t?-1:e>t?1:0)}function _u(e,t,n){return(t.length!==2?uo(Ci(e,t,n),([r,i],[o,s])=>Ut(i,s)||Ut(r,o)):uo(an(e,n),([r,i],[o,s])=>t(i,s)||Ut(r,o))).map(([r])=>r)}var Xj=Math.sqrt(50),Hj=Math.sqrt(10),Zj=Math.sqrt(2);function I0(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>=Xj?10:o>=Hj?5:o>=Zj?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?I0(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?I0(t,e,n):I0(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,I0(e,t,n)[2]}function wu(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 vu(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 Na(e){return Math.max(1,Math.ceil(Math.log(lo(e))/Math.LN2)+1)}function Gt(e,t){let n;if(t===void 0)for(let r of e)r!=null&&(n<r||n===void 0&&r>=r)&&(n=r);else{let r=-1;for(let i of e)(i=t(i,++r,e))!=null&&(n<i||n===void 0&&i>=i)&&(n=i)}return n}function T0(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 E0(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 A0(e,t,n=0,r=1/0,i){if(t=Math.floor(t),n=Math.floor(Math.max(0,n)),r=Math.floor(Math.min(e.length-1,r)),!(n<=t&&t<=r))return e;for(i=i===void 0?Vc:Lh(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));A0(e,t,h,p,i)}let o=e[t],s=n,a=r;for(Ch(e,n,t),i(e[r],o)>0&&Ch(e,n,r);s<a;){for(Ch(e,s,a),++s,--a;i(e[s],o)<0;)++s;for(;i(e[a],o)>0;)--a}i(e[n],o)===0?Ch(e,n,a):(++a,Ch(e,a,r)),a<=t&&(n=a+1),t<=a&&(r=a-1)}return e}function Ch(e,t,n){let r=e[t];e[t]=e[n],e[n]=r}function Yc(e,t=Ut){let n,r=!1;if(t.length===1){let i;for(let o of e){let s=t(o);(r?Ut(s,i)>0:Ut(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 Kn(e,t,n){if(e=Float64Array.from(GD(e,n)),!(!(r=e.length)||isNaN(t=+t))){if(t<=0||r<2)return ce(e);if(t>=1)return Gt(e);var r,i=(r-1)*t,o=Math.floor(i),s=Gt(A0(e,o).subarray(0,o+1)),a=ce(e.subarray(o+1));return s+(a-s)*(i-o)}}function j2(e,t,n=Dh){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 M0(e,t,n){let r=lo(e),i=Kn(e,.75)-Kn(e,.25);return r&&i?Math.ceil((n-t)/(2*i*Math.pow(r,-1/3))):1}function Bh(e,t,n){let r=lo(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 Kn(e,.5,t)}function*Kj(e){for(let t of e)yield*t}function Su(e){return Array.from(Kj(e))}function Iu(e,t){let n=new Zn;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 N0(e,t=Jj){let n=[],r,i=!1;for(let o of e)i&&n.push(t(r,o)),r=o,i=!0;return n}function Jj(e,t){return[e,t]}function $e(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 Ph(e,t=Ut){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=Ut);let i=(a,c)=>t(n[a],n[c]),o,s;return e=Uint32Array.from(n,(a,c)=>c),e.sort(t===Ut?(a,c)=>Vc(n[a],n[c]):Lh(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 R0(e,t=Ut){let n,r=!1;if(t.length===1){let i;for(let o of e){let s=t(o);(r?Ut(s,i)<0:Ut(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 Ra(e){if(typeof e[Symbol.iterator]!="function")throw new TypeError("values is not iterable");return Array.from(e).reverse()}function t8(e){return e}var V2=1,Y2=2,G2=3,O0=4,e8=1e-6;function tV(e){return"translate("+e+",0)"}function eV(e){return"translate(0,"+e+")"}function nV(e){return t=>+e(t)}function rV(e,t){return t=Math.max(0,e.bandwidth()-t*2)/2,e.round()&&(t=Math.round(t)),n=>+e(n)+t}function iV(){return!this.__axis}function oV(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===V2||e===O0?-1:1,u=e===O0||e===Y2?"x":"y",f=e===V2||e===G2?tV:eV;function d(h){var p=r??(t.ticks?t.ticks.apply(t,n):t.domain()),m=i??(t.tickFormat?t.tickFormat.apply(t,n):t8),g=Math.max(o,0)+a,y=t.range(),b=+y[0]+c,x=+y[y.length-1]+c,_=(t.bandwidth?rV:nV)(t.copy(),c),v=h.selection?h.selection():h,w=v.selectAll(".domain").data([null]),T=v.selectAll(".tick").data(p,t).order(),M=T.exit(),R=T.enter().append("g").attr("class","tick"),I=T.select("line"),A=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)),A=A.merge(R.append("text").attr("fill","currentColor").attr(u,l*g).attr("dy",e===V2?"0em":e===G2?"0.71em":"0.32em")),h!==v&&(w=w.transition(h),T=T.transition(h),I=I.transition(h),A=A.transition(h),M=M.transition(h).attr("opacity",e8).attr("transform",function(O){return isFinite(O=_(O))?f(O+c):this.getAttribute("transform")}),R.attr("opacity",e8).attr("transform",function(O){var F=this.parentNode.__axis;return f((F&&isFinite(F=F(O))?F:_(O))+c)})),M.remove(),w.attr("d",e===O0||e===Y2?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),T.attr("opacity",1).attr("transform",function(O){return f(_(O)+c)}),I.attr(u+"2",l*o),A.attr(u,l*g).text(m),v.filter(iV).attr("fill","none").attr("font-size",10).attr("font-family","sans-serif").attr("text-anchor",e===Y2?"start":e===O0?"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 W2(e){return oV(G2,e)}var sV={value:()=>{}};function r8(){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 D0(n)}function D0(e){this._=e}function aV(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}})}D0.prototype=r8.prototype={constructor:D0,on:function(e,t){var n=this._,r=aV(e+"",n),i,o=-1,s=r.length;if(arguments.length<2){for(;++o<s;)if((i=(e=r[o]).type)&&(i=cV(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]=n8(n[i],e.name,t);else if(t==null)for(i in n)n[i]=n8(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 D0(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 cV(e,t){for(var n=0,r=e.length,i;n<r;++n)if((i=e[n]).name===t)return i.value}function n8(e,t,n){for(var r=0,i=e.length;r<i;++r)if(e[r].name===t){e[r]=sV,e=e.slice(0,r).concat(e.slice(r+1));break}return n!=null&&e.push({name:t,value:n}),e}var Gc=r8;var k0="http://www.w3.org/1999/xhtml",ii={svg:"http://www.w3.org/2000/svg",xhtml:k0,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 lV(e){return function(){var t=this.ownerDocument,n=this.namespaceURI;return n===k0&&t.documentElement.namespaceURI===k0?t.createElement(e):t.createElementNS(n,e)}}function uV(e){return function(){return this.ownerDocument.createElementNS(e.space,e.local)}}function Ts(e){var t=Is(e);return(t.local?uV:lV)(t)}function fV(){}function Wc(e){return e==null?fV:function(){return this.querySelector(e)}}function i8(e){typeof e!="function"&&(e=Wc(e));for(var t=this._groups,n=t.length,r=new Array(n),i=0;i<n;++i)for(var o=t[i],s=o.length,a=r[i]=new Array(s),c,l,u=0;u<s;++u)(c=o[u])&&(l=e.call(c,c.__data__,u,o))&&("__data__"in c&&(l.__data__=c.__data__),a[u]=l);return new Le(r,this._parents)}function X2(e){return e==null?[]:Array.isArray(e)?e:Array.from(e)}function dV(){return[]}function $h(e){return e==null?dV:function(){return this.querySelectorAll(e)}}function hV(e){return function(){return X2(e.apply(this,arguments))}}function o8(e){typeof e=="function"?e=hV(e):e=$h(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 F0(e){return function(t){return t.matches(e)}}var pV=Array.prototype.find;function mV(e){return function(){return pV.call(this.children,e)}}function yV(){return this.firstElementChild}function s8(e){return this.select(e==null?yV:mV(typeof e=="function"?e:F0(e)))}var gV=Array.prototype.filter;function bV(){return Array.from(this.children)}function xV(e){return function(){return gV.call(this.children,e)}}function a8(e){return this.selectAll(e==null?bV:xV(typeof e=="function"?e:F0(e)))}function c8(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 L0(e){return new Array(e.length)}function l8(){return new Le(this._enter||this._groups.map(L0),this._parents)}function zh(e,t){this.ownerDocument=e.ownerDocument,this.namespaceURI=e.namespaceURI,this._next=null,this._parent=e,this.__data__=t}zh.prototype={constructor:zh,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 u8(e){return function(){return e}}function _V(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 zh(e,o[s]);for(;s<c;++s)(a=t[s])&&(i[s]=a)}function wV(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 zh(e,o[a]);for(a=0;a<u;++a)(c=t[a])&&l.get(d[a])===c&&(i[a]=c)}function vV(e){return e.__data__}function f8(e,t){if(!arguments.length)return Array.from(this,vV);var n=t?wV:_V,r=this._parents,i=this._groups;typeof e!="function"&&(e=u8(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=SV(e.call(u,u&&u.__data__,l,r)),p=h.length,m=a[l]=new Array(p),g=s[l]=new Array(p),y=c[l]=new Array(d);n(u,f,m,g,y,h,t);for(var b=0,x=0,_,v;b<p;++b)if(_=m[b]){for(b>=x&&(x=b+1);!(v=g[x])&&++x<p;);_._next=v||null}}return s=new Le(s,r),s._enter=a,s._exit=c,s}function SV(e){return typeof e=="object"&&"length"in e?e:Array.from(e)}function d8(){return new Le(this._exit||this._groups.map(L0),this._parents)}function h8(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 p8(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 m8(){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 y8(e){e||(e=IV);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 IV(e,t){return e<t?-1:e>t?1:e>=t?0:NaN}function g8(){var e=arguments[0];return arguments[0]=this,e.apply(null,arguments),this}function b8(){return Array.from(this)}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;i<o;++i){var s=r[i];if(s)return s}return null}function _8(){let e=0;for(let t of this)++e;return e}function w8(){return!this.node()}function v8(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 TV(e){return function(){this.removeAttribute(e)}}function EV(e){return function(){this.removeAttributeNS(e.space,e.local)}}function AV(e,t){return function(){this.setAttribute(e,t)}}function MV(e,t){return function(){this.setAttributeNS(e.space,e.local,t)}}function NV(e,t){return function(){var n=t.apply(this,arguments);n==null?this.removeAttribute(e):this.setAttribute(e,n)}}function RV(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 S8(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?EV:TV:typeof t=="function"?n.local?RV:NV:n.local?MV:AV)(n,t))}function C0(e){return e.ownerDocument&&e.ownerDocument.defaultView||e.document&&e||e.defaultView}function OV(e){return function(){this.style.removeProperty(e)}}function DV(e,t,n){return function(){this.style.setProperty(e,t,n)}}function kV(e,t,n){return function(){var r=t.apply(this,arguments);r==null?this.style.removeProperty(e):this.style.setProperty(e,r,n)}}function I8(e,t,n){return arguments.length>1?this.each((t==null?OV:typeof t=="function"?kV:DV)(e,t,n??"")):Oa(this.node(),e)}function Oa(e,t){return e.style.getPropertyValue(t)||C0(e).getComputedStyle(e,null).getPropertyValue(t)}function FV(e){return function(){delete this[e]}}function LV(e,t){return function(){this[e]=t}}function CV(e,t){return function(){var n=t.apply(this,arguments);n==null?delete this[e]:this[e]=n}}function T8(e,t){return arguments.length>1?this.each((t==null?FV:typeof t=="function"?CV:LV)(e,t)):this.node()[e]}function E8(e){return e.trim().split(/^|\s+/)}function H2(e){return e.classList||new A8(e)}function A8(e){this._node=e,this._names=E8(e.getAttribute("class")||"")}A8.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 M8(e,t){for(var n=H2(e),r=-1,i=t.length;++r<i;)n.add(t[r])}function N8(e,t){for(var n=H2(e),r=-1,i=t.length;++r<i;)n.remove(t[r])}function BV(e){return function(){M8(this,e)}}function PV(e){return function(){N8(this,e)}}function $V(e,t){return function(){(t.apply(this,arguments)?M8:N8)(this,e)}}function R8(e,t){var n=E8(e+"");if(arguments.length<2){for(var r=H2(this.node()),i=-1,o=n.length;++i<o;)if(!r.contains(n[i]))return!1;return!0}return this.each((typeof t=="function"?$V:t?BV:PV)(n,t))}function UV(){this.textContent=""}function zV(e){return function(){this.textContent=e}}function qV(e){return function(){var t=e.apply(this,arguments);this.textContent=t??""}}function O8(e){return arguments.length?this.each(e==null?UV:(typeof e=="function"?qV:zV)(e)):this.node().textContent}function jV(){this.innerHTML=""}function VV(e){return function(){this.innerHTML=e}}function YV(e){return function(){var t=e.apply(this,arguments);this.innerHTML=t??""}}function D8(e){return arguments.length?this.each(e==null?jV:(typeof e=="function"?YV:VV)(e)):this.node().innerHTML}function GV(){this.nextSibling&&this.parentNode.appendChild(this)}function k8(){return this.each(GV)}function WV(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function F8(){return this.each(WV)}function L8(e){var t=typeof e=="function"?e:Ts(e);return this.select(function(){return this.appendChild(t.apply(this,arguments))})}function XV(){return null}function C8(e,t){var n=typeof e=="function"?e:Ts(e),r=t==null?XV:typeof t=="function"?t:Wc(t);return this.select(function(){return this.insertBefore(n.apply(this,arguments),r.apply(this,arguments)||null)})}function HV(){var e=this.parentNode;e&&e.removeChild(this)}function B8(){return this.each(HV)}function ZV(){var e=this.cloneNode(!1),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function QV(){var e=this.cloneNode(!0),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function P8(e){return this.select(e?QV:ZV)}function $8(e){return arguments.length?this.property("__data__",e):this.node().__data__}function KV(e){return function(t){e.call(this,t,this.__data__)}}function JV(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 tY(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 eY(e,t,n){return function(){var r=this.__on,i,o=KV(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 U8(e,t,n){var r=JV(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?eY:tY,i=0;i<o;++i)this.each(a(r[i],t,n));return this}function z8(e,t,n){var r=C0(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 nY(e,t){return function(){return z8(this,e,t)}}function rY(e,t){return function(){return z8(this,e,t.apply(this,arguments))}}function q8(e,t){return this.each((typeof t=="function"?rY:nY)(e,t))}function*j8(){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 Z2=[null];function Le(e,t){this._groups=e,this._parents=t}function V8(){return new Le([[document.documentElement]],Z2)}function iY(){return this}Le.prototype=V8.prototype={constructor:Le,select:i8,selectAll:o8,selectChild:s8,selectChildren:a8,filter:c8,data:f8,enter:l8,exit:d8,join:h8,merge:p8,selection:iY,order:m8,sort:y8,call:g8,nodes:b8,node:x8,size:_8,empty:w8,each:v8,attr:S8,style:I8,property:T8,classed:R8,text:O8,html:D8,raise:k8,lower:F8,append:L8,insert:C8,remove:B8,clone:P8,datum:$8,on:U8,dispatch:q8,[Symbol.iterator]:j8};var Es=V8;function qt(e){return typeof e=="string"?new Le([[document.querySelector(e)]],[document.documentElement]):new Le([[e]],Z2)}function Y8(e){let t;for(;t=e.sourceEvent;)e=t;return e}function Ln(e,t){if(e=Y8(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 B0={capture:!0,passive:!1};function P0(e){e.preventDefault(),e.stopImmediatePropagation()}function qh(e){var t=e.document.documentElement,n=qt(e).on("dragstart.drag",P0,B0);"onselectstart"in t?n.on("selectstart.drag",P0,B0):(t.__noselect=t.style.MozUserSelect,t.style.MozUserSelect="none")}function jh(e,t){var n=e.document.documentElement,r=qt(e).on("dragstart.drag",null);t&&(r.on("click.drag",P0,B0),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 As(e,t,n){e.prototype=t.prototype=n,n.constructor=e}function Da(e,t){var n=Object.create(e.prototype);for(var r in t)n[r]=t[r];return n}function ho(){}var ka=.7,Zc=1/ka,Tu="\\s*([+-]?\\d+)\\s*",Vh="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",fo="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",oY=/^#([0-9a-f]{3,8})$/,sY=new RegExp(`^rgb\\(${Tu},${Tu},${Tu}\\)$`),aY=new RegExp(`^rgb\\(${fo},${fo},${fo}\\)$`),cY=new RegExp(`^rgba\\(${Tu},${Tu},${Tu},${Vh}\\)$`),lY=new RegExp(`^rgba\\(${fo},${fo},${fo},${Vh}\\)$`),uY=new RegExp(`^hsl\\(${Vh},${fo},${fo}\\)$`),fY=new RegExp(`^hsla\\(${Vh},${fo},${fo},${Vh}\\)$`),G8={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};As(ho,Lr,{copy(e){return Object.assign(new this.constructor,this,e)},displayable(){return this.rgb().displayable()},hex:W8,formatHex:W8,formatHex8:dY,formatHsl:hY,formatRgb:X8,toString:X8});function W8(){return this.rgb().formatHex()}function dY(){return this.rgb().formatHex8()}function hY(){return tk(this).formatHsl()}function X8(){return this.rgb().formatRgb()}function Lr(e){var t,n;return e=(e+"").trim().toLowerCase(),(t=oY.exec(e))?(n=t[1].length,t=parseInt(t[1],16),n===6?H8(t):n===3?new Ye(t>>8&15|t>>4&240,t>>4&15|t&240,(t&15)<<4|t&15,1):n===8?$0(t>>24&255,t>>16&255,t>>8&255,(t&255)/255):n===4?$0(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=sY.exec(e))?new Ye(t[1],t[2],t[3],1):(t=aY.exec(e))?new Ye(t[1]*255/100,t[2]*255/100,t[3]*255/100,1):(t=cY.exec(e))?$0(t[1],t[2],t[3],t[4]):(t=lY.exec(e))?$0(t[1]*255/100,t[2]*255/100,t[3]*255/100,t[4]):(t=uY.exec(e))?K8(t[1],t[2]/100,t[3]/100,1):(t=fY.exec(e))?K8(t[1],t[2]/100,t[3]/100,t[4]):G8.hasOwnProperty(e)?H8(G8[e]):e==="transparent"?new Ye(NaN,NaN,NaN,0):null}function H8(e){return new Ye(e>>16&255,e>>8&255,e&255,1)}function $0(e,t,n,r){return r<=0&&(e=t=n=NaN),new Ye(e,t,n,r)}function Yh(e){return e instanceof ho||(e=Lr(e)),e?(e=e.rgb(),new Ye(e.r,e.g,e.b,e.opacity)):new Ye}function rn(e,t,n,r){return arguments.length===1?Yh(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}As(Ye,rn,Da(ho,{brighter(e){return e=e==null?Zc:Math.pow(Zc,e),new Ye(this.r*e,this.g*e,this.b*e,this.opacity)},darker(e){return e=e==null?ka:Math.pow(ka,e),new Ye(this.r*e,this.g*e,this.b*e,this.opacity)},rgb(){return this},clamp(){return new Ye(Hc(this.r),Hc(this.g),Hc(this.b),z0(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:Z8,formatHex:Z8,formatHex8:pY,formatRgb:Q8,toString:Q8}));function Z8(){return`#${Xc(this.r)}${Xc(this.g)}${Xc(this.b)}`}function pY(){return`#${Xc(this.r)}${Xc(this.g)}${Xc(this.b)}${Xc((isNaN(this.opacity)?1:this.opacity)*255)}`}function Q8(){let e=z0(this.opacity);return`${e===1?"rgb(":"rgba("}${Hc(this.r)}, ${Hc(this.g)}, ${Hc(this.b)}${e===1?")":`, ${e})`}`}function z0(e){return isNaN(e)?1:Math.max(0,Math.min(1,e))}function Hc(e){return Math.max(0,Math.min(255,Math.round(e)||0))}function Xc(e){return e=Hc(e),(e<16?"0":"")+e.toString(16)}function K8(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 tk(e){if(e instanceof Pi)return new Pi(e.h,e.s,e.l,e.opacity);if(e instanceof ho||(e=Lr(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 Gh(e,t,n,r){return arguments.length===1?tk(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}As(Pi,Gh,Da(ho,{brighter(e){return e=e==null?Zc:Math.pow(Zc,e),new Pi(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=e==null?ka:Math.pow(ka,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(Q2(e>=240?e-240:e+120,i,r),Q2(e,i,r),Q2(e<120?e+240:e-120,i,r),this.opacity)},clamp(){return new Pi(J8(this.h),U0(this.s),U0(this.l),z0(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=z0(this.opacity);return`${e===1?"hsl(":"hsla("}${J8(this.h)}, ${U0(this.s)*100}%, ${U0(this.l)*100}%${e===1?")":`, ${e})`}`}}));function J8(e){return e=(e||0)%360,e<0?e+360:e}function U0(e){return Math.max(0,Math.min(1,e||0))}function Q2(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 q0=Math.PI/180,j0=180/Math.PI;var V0=18,ek=.96422,nk=1,rk=.82521,ik=4/29,Eu=6/29,ok=3*Eu*Eu,mY=Eu*Eu*Eu;function sk(e){if(e instanceof po)return new po(e.l,e.a,e.b,e.opacity);if(e instanceof Ms)return ak(e);e instanceof Ye||(e=Yh(e));var t=eS(e.r),n=eS(e.g),r=eS(e.b),i=K2((.2225045*t+.7168786*n+.0606169*r)/nk),o,s;return t===n&&n===r?o=s=i:(o=K2((.4360747*t+.3850649*n+.1430804*r)/ek),s=K2((.0139322*t+.0971045*n+.7141733*r)/rk)),new po(116*i-16,500*(o-i),200*(i-s),e.opacity)}function Au(e,t,n,r){return arguments.length===1?sk(e):new po(e,t,n,r??1)}function po(e,t,n,r){this.l=+e,this.a=+t,this.b=+n,this.opacity=+r}As(po,Au,Da(ho,{brighter(e){return new po(this.l+V0*(e??1),this.a,this.b,this.opacity)},darker(e){return new po(this.l-V0*(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=ek*J2(t),e=nk*J2(e),n=rk*J2(n),new Ye(tS(3.1338561*t-1.6168667*e-.4906146*n),tS(-.9787684*t+1.9161415*e+.033454*n),tS(.0719453*t-.2289914*e+1.4052427*n),this.opacity)}}));function K2(e){return e>mY?Math.pow(e,1/3):e/ok+ik}function J2(e){return e>Eu?e*e*e:ok*(e-ik)}function tS(e){return 255*(e<=.0031308?12.92*e:1.055*Math.pow(e,1/2.4)-.055)}function eS(e){return(e/=255)<=.04045?e/12.92:Math.pow((e+.055)/1.055,2.4)}function yY(e){if(e instanceof Ms)return new Ms(e.h,e.c,e.l,e.opacity);if(e instanceof po||(e=sk(e)),e.a===0&&e.b===0)return new Ms(NaN,0<e.l&&e.l<100?0:NaN,e.l,e.opacity);var t=Math.atan2(e.b,e.a)*j0;return new Ms(t<0?t+360:t,Math.sqrt(e.a*e.a+e.b*e.b),e.l,e.opacity)}function Wh(e,t,n,r){return arguments.length===1?yY(e):new Ms(e,t,n,r??1)}function Ms(e,t,n,r){this.h=+e,this.c=+t,this.l=+n,this.opacity=+r}function ak(e){if(isNaN(e.h))return new po(e.l,0,0,e.opacity);var t=e.h*q0;return new po(e.l,Math.cos(t)*e.c,Math.sin(t)*e.c,e.opacity)}As(Ms,Wh,Da(ho,{brighter(e){return new Ms(this.h,this.c,this.l+V0*(e??1),this.opacity)},darker(e){return new Ms(this.h,this.c,this.l-V0*(e??1),this.opacity)},rgb(){return ak(this).rgb()}}));var fk=-.14861,nS=1.78277,rS=-.29227,Y0=-.90649,Xh=1.97294,ck=Xh*Y0,lk=Xh*nS,uk=nS*rS-Y0*fk;function gY(e){if(e instanceof Qc)return new Qc(e.h,e.s,e.l,e.opacity);e instanceof Ye||(e=Yh(e));var t=e.r/255,n=e.g/255,r=e.b/255,i=(uk*r+ck*t-lk*n)/(uk+ck-lk),o=r-i,s=(Xh*(n-i)-rS*o)/Y0,a=Math.sqrt(s*s+o*o)/(Xh*i*(1-i)),c=a?Math.atan2(s,o)*j0-120:NaN;return new Qc(c<0?c+360:c,a,i,e.opacity)}function Jn(e,t,n,r){return arguments.length===1?gY(e):new Qc(e,t,n,r??1)}function Qc(e,t,n,r){this.h=+e,this.s=+t,this.l=+n,this.opacity=+r}As(Qc,Jn,Da(ho,{brighter(e){return e=e==null?Zc:Math.pow(Zc,e),new Qc(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=e==null?ka:Math.pow(ka,e),new Qc(this.h,this.s,this.l*e,this.opacity)},rgb(){var e=isNaN(this.h)?0:(this.h+120)*q0,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*(fk*r+nS*i)),255*(t+n*(rS*r+Y0*i)),255*(t+n*(Xh*r)),this.opacity)}}));function iS(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 dk(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 iS((n-r/t)*t,s,i,o,a)}}function hk(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 iS((n-r/t)*t,i,o,s,a)}}var Mu=e=>()=>e;function pk(e,t){return function(n){return e+n*t}}function bY(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 Nu(e,t){var n=t-e;return n?pk(e,n>180||n<-180?n-360*Math.round(n/360):n):Mu(isNaN(e)?t:e)}function mk(e){return(e=+e)==1?Ee:function(t,n){return n-t?bY(t,n,e):Mu(isNaN(t)?n:t)}}function Ee(e,t){var n=t-e;return n?pk(e,n):Mu(isNaN(e)?t:e)}var oi=function e(t){var n=mk(t);function r(i,o){var s=n((i=rn(i)).r,(o=rn(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 yk(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=rn(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 oS=yk(dk),xY=yk(hk);function gk(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 bk(e){return ArrayBuffer.isView(e)&&!(e instanceof DataView)}function xk(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]=Cr(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 _k(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 wk(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]=Cr(e[i],t[i]):r[i]=t[i];return function(o){for(i in n)r[i]=n[i](o);return r}}var aS=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,sS=new RegExp(aS.source,"g");function _Y(e){return function(){return e}}function wY(e){return function(t){return e(t)+""}}function Hh(e,t){var n=aS.lastIndex=sS.lastIndex=0,r,i,o,s=-1,a=[],c=[];for(e=e+"",t=t+"";(r=aS.exec(e))&&(i=sS.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=sS.lastIndex;return n<t.length&&(o=t.slice(n),a[s]?a[s]+=o:a[++s]=o),a.length<2?c[0]?wY(c[0].x):_Y(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 Cr(e,t){var n=typeof t,r;return t==null||n==="boolean"?Mu(t):(n==="number"?we:n==="string"?(r=Lr(t))?(t=r,oi):Hh:t instanceof Lr?oi:t instanceof Date?_k:bk(t)?gk:Array.isArray(t)?xk:typeof t.valueOf!="function"&&typeof t.toString!="function"||isNaN(t)?wk:we)(e,t)}function Kc(e,t){return e=+e,t=+t,function(n){return Math.round(e*(1-n)+t*n)}}var vk=180/Math.PI,G0={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1};function cS(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)*vk,skewX:Math.atan(c)*vk,scaleX:s,scaleY:a}}var W0;function Sk(e){let t=new(typeof DOMMatrix=="function"?DOMMatrix:WebKitCSSMatrix)(e+"");return t.isIdentity?G0:cS(t.a,t.b,t.c,t.d,t.e,t.f)}function Ik(e){return e==null?G0:(W0||(W0=document.createElementNS("http://www.w3.org/2000/svg","g")),W0.setAttribute("transform",e),(e=W0.transform.baseVal.consolidate())?(e=e.matrix,cS(e.a,e.b,e.c,e.d,e.e,e.f)):G0)}function Tk(e,t,n,r){function i(l){return l.length?l.pop()+" ":""}function o(l,u,f,d,h,p){if(l!==f||u!==d){var m=h.push("translate(",null,t,null,n);p.push({i:m-4,x:we(l,f)},{i:m-2,x:we(u,d)})}else(f||d)&&h.push("translate("+f+t+d+n)}function s(l,u,f,d){l!==u?(l-u>180?u+=360:u-l>180&&(l+=360),d.push({i:f.push(i(f)+"rotate(",null,r)-2,x:we(l,u)})):u&&f.push(i(f)+"rotate("+u+r)}function a(l,u,f,d){l!==u?d.push({i:f.push(i(f)+"skewX(",null,r)-2,x:we(l,u)}):u&&f.push(i(f)+"skewX("+u+r)}function c(l,u,f,d,h,p){if(l!==f||u!==d){var m=h.push(i(h)+"scale(",null,",",null,")");p.push({i:m-4,x:we(l,f)},{i:m-2,x:we(u,d)})}else(f!==1||d!==1)&&h.push(i(h)+"scale("+f+","+d+")")}return function(l,u){var f=[],d=[];return l=e(l),u=e(u),o(l.translateX,l.translateY,u.translateX,u.translateY,f,d),s(l.rotate,u.rotate,f,d),a(l.skewX,u.skewX,f,d),c(l.scaleX,l.scaleY,u.scaleX,u.scaleY,f,d),l=u=null,function(h){for(var p=-1,m=d.length,g;++p<m;)f[(g=d[p]).i]=g.x(h);return f.join("")}}}var lS=Tk(Sk,"px, ","px)","deg)"),uS=Tk(Ik,", ",")",")");var vY=1e-12;function Ek(e){return((e=Math.exp(e))+1/e)/2}function SY(e){return((e=Math.exp(e))-1/e)/2}function IY(e){return((e=Math.exp(2*e))-1)/(e+1)}var fS=function e(t,n,r){function i(o,s){var a=o[0],c=o[1],l=o[2],u=s[0],f=s[1],d=s[2],h=u-a,p=f-c,m=h*h+p*p,g,y;if(m<vY)y=Math.log(d/l)/t,g=function(T){return[a+T*h,c+T*p,l*Math.exp(t*T*y)]};else{var b=Math.sqrt(m),x=(d*d-l*l+r*m)/(2*l*n*b),_=(d*d-l*l-r*m)/(2*d*n*b),v=Math.log(Math.sqrt(x*x+1)-x),w=Math.log(Math.sqrt(_*_+1)-_);y=(w-v)/t,g=function(T){var M=T*y,R=Ek(v),I=l/(n*b)*(R*IY(t*M+v)-SY(v));return[a+I*h,c+I*p,l*R/Ek(t*M+v)]}}return g.duration=y*1e3*t/Math.SQRT2,g}return i.rho=function(o){var s=Math.max(.001,+o),a=s*s,c=a*a;return e(s,a,c)},i}(Math.SQRT2,2,4);function Ak(e){return function(t,n){var r=e((t=Gh(t)).h,(n=Gh(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 dS=Ak(Nu),TY=Ak(Ee);function X0(e,t){var n=Ee((e=Au(e)).l,(t=Au(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 Mk(e){return function(t,n){var r=e((t=Wh(t)).h,(n=Wh(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 hS=Mk(Nu),EY=Mk(Ee);function Nk(e){return function t(n){n=+n;function r(i,o){var s=e((i=Jn(i)).h,(o=Jn(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 AY=Nk(Nu),Ru=Nk(Ee);function mo(e,t){t===void 0&&(t=e,e=Cr);for(var n=0,r=t.length-1,i=t[0],o=new Array(r<0?0:r);n<r;)o[n]=e(i,i=t[++n]);return function(s){var a=Math.max(0,Math.min(r-1,Math.floor(s*=r)));return o[a](s-a)}}function Cn(e,t){for(var n=new Array(t),r=0;r<t;++r)n[r]=e(r/(t-1));return n}var Ou=0,Qh=0,Zh=0,Ok=1e3,H0,Kh,Z0=0,Jc=0,Q0=0,Jh=typeof performance=="object"&&performance.now?performance:Date,Dk=typeof window=="object"&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(e){setTimeout(e,17)};function ep(){return Jc||(Dk(MY),Jc=Jh.now()+Q0)}function MY(){Jc=0}function tp(){this._call=this._time=this._next=null}tp.prototype=K0.prototype={constructor:tp,restart:function(e,t,n){if(typeof e!="function")throw new TypeError("callback is not a function");n=(n==null?ep():+n)+(t==null?0:+t),!this._next&&Kh!==this&&(Kh?Kh._next=this:H0=this,Kh=this),this._call=e,this._time=n,pS()},stop:function(){this._call&&(this._call=null,this._time=1/0,pS())}};function K0(e,t,n){var r=new tp;return r.restart(e,t,n),r}function kk(){ep(),++Ou;for(var e=H0,t;e;)(t=Jc-e._time)>=0&&e._call.call(void 0,t),e=e._next;--Ou}function Rk(){Jc=(Z0=Jh.now())+Q0,Ou=Qh=0;try{kk()}finally{Ou=0,RY(),Jc=0}}function NY(){var e=Jh.now(),t=e-Z0;t>Ok&&(Q0-=t,Z0=e)}function RY(){for(var e,t=H0,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:H0=n);Kh=e,pS(r)}function pS(e){if(!Ou){Qh&&(Qh=clearTimeout(Qh));var t=e-Jc;t>24?(e<1/0&&(Qh=setTimeout(Rk,e-Jh.now()-Q0)),Zh&&(Zh=clearInterval(Zh))):(Zh||(Z0=Jh.now(),Zh=setInterval(NY,Ok)),Ou=1,Dk(Rk))}}function J0(e,t,n){var r=new tp;return t=t==null?0:+t,r.restart(i=>{r.stop(),e(i+t)},t,n),r}var OY=Gc("start","end","cancel","interrupt"),DY=[],Ck=0,Fk=1,eb=2,tb=3,Lk=4,nb=5,np=6;function Fa(e,t,n,r,i,o){var s=e.__transition;if(!s)e.__transition={};else if(n in s)return;kY(e,n,{name:t,index:r,group:i,on:OY,tween:DY,time:o.time,delay:o.delay,duration:o.duration,ease:o.ease,timer:null,state:Ck})}function rp(e,t){var n=on(e,t);if(n.state>Ck)throw new Error("too late; already scheduled");return n}function An(e,t){var n=on(e,t);if(n.state>tb)throw new Error("too late; already running");return n}function on(e,t){var n=e.__transition;if(!n||!(n=n[t]))throw new Error("transition not found");return n}function kY(e,t,n){var r=e.__transition,i;r[t]=n,n.timer=K0(o,0,n.time);function o(l){n.state=Fk,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!==Fk)return c();for(u in r)if(h=r[u],h.name===n.name){if(h.state===tb)return J0(s);h.state===Lk?(h.state=np,h.timer.stop(),h.on.call("interrupt",e,e.__data__,h.index,h.group),delete r[u]):+u<t&&(h.state=np,h.timer.stop(),h.on.call("cancel",e,e.__data__,h.index,h.group),delete r[u])}if(J0(function(){n.state===tb&&(n.state=Lk,n.timer.restart(a,n.delay,n.time),a(l))}),n.state=eb,n.on.call("start",e,e.__data__,n.index,n.group),n.state===eb){for(n.state=tb,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=nb,1),f=-1,d=i.length;++f<d;)i[f].call(e,u);n.state===nb&&(n.on.call("end",e,e.__data__,n.index,n.group),c())}function c(){n.state=np,n.timer.stop(),delete r[t];for(var l in r)return;delete e.__transition}}function yo(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>eb&&r.state<nb,r.state=np,r.timer.stop(),r.on.call(i?"interrupt":"cancel",e,e.__data__,r.index,r.group),delete n[s]}o&&delete e.__transition}}function Bk(e){return this.each(function(){yo(this,e)})}function FY(e,t){var n,r;return function(){var i=An(this,e),o=i.tween;if(o!==n){r=n=o;for(var s=0,a=r.length;s<a;++s)if(r[s].name===t){r=r.slice(),r.splice(s,1);break}}i.tween=r}}function LY(e,t,n){var r,i;if(typeof n!="function")throw new Error;return function(){var o=An(this,e),s=o.tween;if(s!==r){i=(r=s).slice();for(var a={name:t,value:n},c=0,l=i.length;c<l;++c)if(i[c].name===t){i[c]=a;break}c===l&&i.push(a)}o.tween=i}}function Pk(e,t){var n=this._id;if(e+="",arguments.length<2){for(var r=on(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?FY:LY)(n,e,t))}function Du(e,t,n){var r=e._id;return e.each(function(){var i=An(this,r);(i.value||(i.value={}))[t]=n.apply(this,arguments)}),function(i){return on(i,r).value[t]}}function rb(e,t){var n;return(typeof t=="number"?we:t instanceof Lr?oi:(n=Lr(t))?(t=n,oi):Hh)(e,t)}function CY(e){return function(){this.removeAttribute(e)}}function BY(e){return function(){this.removeAttributeNS(e.space,e.local)}}function PY(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 $Y(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 UY(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 zY(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 $k(e,t){var n=Is(e),r=n==="transform"?uS:rb;return this.attrTween(e,typeof t=="function"?(n.local?zY:UY)(n,r,Du(this,"attr."+e,t)):t==null?(n.local?BY:CY)(n):(n.local?$Y:PY)(n,r,t))}function qY(e,t){return function(n){this.setAttribute(e,t.call(this,n))}}function jY(e,t){return function(n){this.setAttributeNS(e.space,e.local,t.call(this,n))}}function VY(e,t){var n,r;function i(){var o=t.apply(this,arguments);return o!==r&&(n=(r=o)&&jY(e,o)),n}return i._value=t,i}function YY(e,t){var n,r;function i(){var o=t.apply(this,arguments);return o!==r&&(n=(r=o)&&qY(e,o)),n}return i._value=t,i}function Uk(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?VY:YY)(r,t))}function GY(e,t){return function(){rp(this,e).delay=+t.apply(this,arguments)}}function WY(e,t){return t=+t,function(){rp(this,e).delay=t}}function zk(e){var t=this._id;return arguments.length?this.each((typeof e=="function"?GY:WY)(t,e)):on(this.node(),t).delay}function XY(e,t){return function(){An(this,e).duration=+t.apply(this,arguments)}}function HY(e,t){return t=+t,function(){An(this,e).duration=t}}function qk(e){var t=this._id;return arguments.length?this.each((typeof e=="function"?XY:HY)(t,e)):on(this.node(),t).duration}function ZY(e,t){if(typeof t!="function")throw new Error;return function(){An(this,e).ease=t}}function jk(e){var t=this._id;return arguments.length?this.each(ZY(t,e)):on(this.node(),t).ease}function QY(e,t){return function(){var n=t.apply(this,arguments);if(typeof n!="function")throw new Error;An(this,e).ease=n}}function Vk(e){if(typeof e!="function")throw new Error;return this.each(QY(this._id,e))}function Yk(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 tr(r,this._parents,this._name,this._id)}function Gk(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 tr(s,this._parents,this._name,this._id)}function KY(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 JY(e,t,n){var r,i,o=KY(t)?rp:An;return function(){var s=o(this,e),a=s.on;a!==r&&(i=(r=a).copy()).on(t,n),s.on=i}}function Wk(e,t){var n=this._id;return arguments.length<2?on(this.node(),n).on.on(e):this.each(JY(n,e,t))}function tG(e){return function(){var t=this.parentNode;for(var n in this.__transition)if(+n!==e)return;t&&t.removeChild(this)}}function Xk(){return this.on("end.remove",tG(this._id))}function Hk(e){var t=this._name,n=this._id;typeof e!="function"&&(e=Wc(e));for(var r=this._groups,i=r.length,o=new Array(i),s=0;s<i;++s)for(var a=r[s],c=a.length,l=o[s]=new Array(c),u,f,d=0;d<c;++d)(u=a[d])&&(f=e.call(u,u.__data__,d,a))&&("__data__"in u&&(f.__data__=u.__data__),l[d]=f,Fa(l[d],t,n,d,l,on(u,n)));return new tr(o,this._parents,t,n)}function Zk(e){var t=this._name,n=this._id;typeof e!="function"&&(e=$h(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=on(u,n),m=0,g=d.length;m<g;++m)(h=d[m])&&Fa(h,t,n,m,d,p);o.push(d),s.push(u)}return new tr(o,s,t,n)}var eG=Es.prototype.constructor;function Qk(){return new eG(this._groups,this._parents)}function nG(e,t){var n,r,i;return function(){var o=Oa(this,e),s=(this.style.removeProperty(e),Oa(this,e));return o===s?null:o===n&&s===r?i:i=t(n=o,r=s)}}function Kk(e){return function(){this.style.removeProperty(e)}}function rG(e,t,n){var r,i=n+"",o;return function(){var s=Oa(this,e);return s===i?null:s===r?o:o=t(r=s,n)}}function iG(e,t,n){var r,i,o;return function(){var s=Oa(this,e),a=n(this),c=a+"";return a==null&&(c=a=(this.style.removeProperty(e),Oa(this,e))),s===c?null:s===r&&c===i?o:(i=c,o=t(r=s,a))}}function oG(e,t){var n,r,i,o="style."+t,s="end."+o,a;return function(){var c=An(this,e),l=c.on,u=c.value[o]==null?a||(a=Kk(t)):void 0;(l!==n||i!==u)&&(r=(n=l).copy()).on(s,i=u),c.on=r}}function Jk(e,t,n){var r=(e+="")=="transform"?lS:rb;return t==null?this.styleTween(e,nG(e,r)).on("end.style."+e,Kk(e)):typeof t=="function"?this.styleTween(e,iG(e,r,Du(this,"style."+e,t))).each(oG(this._id,e)):this.styleTween(e,rG(e,r,t),n).on("end.style."+e,null)}function sG(e,t,n){return function(r){this.style.setProperty(e,t.call(this,r),n)}}function aG(e,t,n){var r,i;function o(){var s=t.apply(this,arguments);return s!==i&&(r=(i=s)&&sG(e,s,n)),r}return o._value=t,o}function tF(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,aG(e,t,n??""))}function cG(e){return function(){this.textContent=e}}function lG(e){return function(){var t=e(this);this.textContent=t??""}}function eF(e){return this.tween("text",typeof e=="function"?lG(Du(this,"text",e)):cG(e==null?"":e+""))}function uG(e){return function(t){this.textContent=e.call(this,t)}}function fG(e){var t,n;function r(){var i=e.apply(this,arguments);return i!==n&&(t=(n=i)&&uG(i)),t}return r._value=e,r}function nF(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,fG(e))}function rF(){for(var e=this._name,t=this._id,n=ib(),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=on(c,t);Fa(c,e,n,l,s,{time:u.time+u.delay+u.duration,delay:0,duration:u.duration,ease:u.ease})}return new tr(r,this._parents,e,n)}function iF(){var e,t,n=this,r=n._id,i=n.size();return new Promise(function(o,s){var a={value:s},c={value:function(){--i===0&&o()}};n.each(function(){var l=An(this,r),u=l.on;u!==e&&(t=(e=u).copy(),t._.cancel.push(a),t._.interrupt.push(a),t._.end.push(c)),l.on=t}),i===0&&o()})}var dG=0;function tr(e,t,n,r){this._groups=e,this._parents=t,this._name=n,this._id=r}function oF(e){return Es().transition(e)}function ib(){return++dG}var Ns=Es.prototype;tr.prototype=oF.prototype={constructor:tr,select:Hk,selectAll:Zk,selectChild:Ns.selectChild,selectChildren:Ns.selectChildren,filter:Yk,merge:Gk,selection:Qk,transition:rF,call:Ns.call,nodes:Ns.nodes,node:Ns.node,size:Ns.size,empty:Ns.empty,each:Ns.each,on:Wk,attr:$k,attrTween:Uk,style:Jk,styleTween:tF,text:eF,textTween:nF,remove:Xk,tween:Pk,delay:zk,duration:qk,ease:jk,easeVarying:Vk,end:iF,[Symbol.iterator]:Ns[Symbol.iterator]};function ob(e){return((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2}var hG={time:null,delay:0,duration:250,ease:ob};function pG(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 sF(e){var t,n;e instanceof tr?(t=e._id,e=e._name):(t=ib(),(n=hG).time=ep(),e=e==null?null:e+"");for(var r=this._groups,i=r.length,o=0;o<i;++o)for(var s=r[o],a=s.length,c,l=0;l<a;++l)(c=s[l])&&Fa(c,e,t,l,s,n||pG(c,t));return new tr(r,this._parents,e,t)}Es.prototype.interrupt=Bk;Es.prototype.transition=sF;var sb=e=>()=>e;function mS(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 aF(e){e.stopImmediatePropagation()}function ab(e){e.preventDefault(),e.stopImmediatePropagation()}var cF={name:"drag"},yS={name:"space"},ku={name:"handle"},Fu={name:"center"},{abs:lF,max:Bn,min:Pn}=Math;function uF(e){return[+e[0],+e[1]]}function bS(e){return[uF(e[0]),uF(e[1])]}var cb={name:"x",handles:["w","e"].map(ip),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]]}},lb={name:"y",handles:["n","s"].map(ip),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]]}},mG={name:"xy",handles:["n","w","e","s","nw","ne","sw","se"].map(ip),input:function(e){return e==null?null:bS(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"},fF={e:"w",w:"e",nw:"ne",ne:"nw",se:"sw",sw:"se"},dF={n:"s",s:"n",nw:"sw",ne:"se",se:"ne",sw:"nw"},yG={overlay:1,selection:1,n:null,e:1,s:null,w:-1,nw:-1,ne:1,se:1,sw:-1},gG={overlay:1,selection:1,n:-1,e:null,s:1,w:null,nw:-1,ne:-1,se:1,sw:1};function ip(e){return{type:e}}function bG(e){return!e.ctrlKey&&!e.button}function xG(){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 _G(){return navigator.maxTouchPoints||"ontouchstart"in this}function gS(e){for(;!e.__brush;)if(!(e=e.parentNode))return;return e.__brush}function wG(e){return e[0][0]===e[1][0]||e[0][1]===e[1][1]}function xS(){return vS(cb)}function _S(){return vS(lb)}function wS(){return vS(mG)}function vS(e){var t=xG,n=bG,r=_G,i=!0,o=Gc("start","brush","end"),s=6,a;function c(g){var y=g.property("__brush",m).selectAll(".overlay").data([ip("overlay")]);y.enter().append("rect").attr("class","overlay").attr("pointer-events","all").attr("cursor",Rs.overlay).merge(y).each(function(){var x=gS(this).extent;qt(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([ip("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 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 Rs[x.type]}),g.each(l).attr("fill","none").attr("pointer-events","all").on("mousedown.brush",d).filter(r).on("touchstart.brush",d).on("touchmove.brush",h).on("touchend.brush touchcancel.brush",p).style("touch-action","none").style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}c.move=function(g,y,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,T=e.input(typeof y=="function"?y.apply(this,arguments):y,_.extent),M=Cr(w,T);function R(I){_.selection=I===1&&T===null?null:M(I),l.call(x),v.brush()}return w!==null&&T!==null?R:R(1)}):g.each(function(){var x=this,_=arguments,v=x.__brush,w=e.input(typeof y=="function"?y.apply(x,_):y,v.extent),T=u(x,_).beforestart();yo(x),v.selection=w===null?null:w,l.call(x),T.start(b).brush(b).end(b)})},c.clear=function(g,y){c.move(g,null,y)};function l(){var g=qt(this),y=gS(this).selection;y?(g.selectAll(".selection").style("display",null).attr("x",y[0][0]).attr("y",y[0][1]).attr("width",y[1][0]-y[0][0]).attr("height",y[1][1]-y[0][1]),g.selectAll(".handle").style("display",null).attr("x",function(b){return b.type[b.type.length-1]==="e"?y[1][0]-s/2:y[0][0]-s/2}).attr("y",function(b){return b.type[0]==="s"?y[1][1]-s/2:y[0][1]-s/2}).attr("width",function(b){return b.type==="n"||b.type==="s"?y[1][0]-y[0][0]+s:s}).attr("height",function(b){return b.type==="e"||b.type==="w"?y[1][1]-y[0][1]+s:s})):g.selectAll(".selection,.handle").style("display","none").attr("x",null).attr("y",null).attr("width",null).attr("height",null)}function u(g,y,b){var x=g.__brush.emitter;return x&&(!b||!x.clean)?x:new f(g,y,b)}function f(g,y,b){this.that=g,this.args=y,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,y){return this.starting?(this.starting=!1,this.emit("start",g,y)):this.emit("brush",g),this},brush:function(g,y){return this.emit("brush",g,y),this},end:function(g,y){return--this.active===0&&(delete this.state.emitter,this.emit("end",g,y)),this},emit:function(g,y,b){var x=qt(this.that).datum();o.call(g,this.that,new mS(g,{sourceEvent:y,target:c,selection:e.output(this.state.selection),mode:b,dispatch:o}),x)}};function d(g){if(a&&!g.touches||!n.apply(this,arguments))return;var y=this,b=g.target.__data__.type,x=(i&&g.metaKey?b="overlay":b)==="selection"?cF:i&&g.altKey?Fu:ku,_=e===lb?null:yG[b],v=e===cb?null:gG[b],w=gS(y),T=w.extent,M=w.selection,R=T[0][0],I,A,O=T[0][1],F,S,E=T[1][0],N,L,B=T[1][1],C,P,$=0,U=0,X,tt=_&&v&&i&&g.shiftKey,nt,st,Y=Array.from(g.touches||[g],et=>{let oe=et.identifier;return et=Ln(et,y),et.point0=et.slice(),et.identifier=oe,et});yo(y);var rt=u(y,arguments,!0).beforestart();if(b==="overlay"){M&&(X=!0);let et=[Y[0],Y[1]||Y[0]];w.selection=M=[[I=e===lb?R:Pn(et[0][0],et[1][0]),F=e===cb?O:Pn(et[0][1],et[1][1])],[N=e===lb?E:Bn(et[0][0],et[1][0]),C=e===cb?B:Bn(et[0][1],et[1][1])]],Y.length>1&&Lt(g)}else I=M[0][0],F=M[0][1],N=M[1][0],C=M[1][1];A=I,S=F,L=N,P=C;var q=qt(y).attr("pointer-events","none"),H=q.selectAll(".overlay").attr("cursor",Rs[b]);if(g.touches)rt.moved=z,rt.ended=dt;else{var ot=qt(g.view).on("mousemove.brush",z,!0).on("mouseup.brush",dt,!0);i&&ot.on("keydown.brush",Wt,!0).on("keyup.brush",Xt,!0),qh(g.view)}l.call(y),rt.start(g,x.name);function z(et){for(let oe of et.changedTouches||[et])for(let wr of Y)wr.identifier===oe.identifier&&(wr.cur=Ln(oe,y));if(tt&&!nt&&!st&&Y.length===1){let oe=Y[0];lF(oe.cur[0]-oe[0])>lF(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,ab(et),Lt(et)}function Lt(et){let oe=Y[0],wr=oe.point0;var Gi;switch($=oe[0]-wr[0],U=oe[1]-wr[1],x){case yS:case cF:{_&&($=Bn(R-I,Pn(E-N,$)),A=I+$,L=N+$),v&&(U=Bn(O-F,Pn(B-C,U)),S=F+U,P=C+U);break}case ku:{Y[1]?(_&&(A=Bn(R,Pn(E,Y[0][0])),L=Bn(R,Pn(E,Y[1][0])),_=1),v&&(S=Bn(O,Pn(B,Y[0][1])),P=Bn(O,Pn(B,Y[1][1])),v=1)):(_<0?($=Bn(R-I,Pn(E-I,$)),A=I+$,L=N):_>0&&($=Bn(R-N,Pn(E-N,$)),A=I,L=N+$),v<0?(U=Bn(O-F,Pn(B-F,U)),S=F+U,P=C):v>0&&(U=Bn(O-C,Pn(B-C,U)),S=F,P=C+U));break}case Fu:{_&&(A=Bn(R,Pn(E,I-$*_)),L=Bn(R,Pn(E,N+$*_))),v&&(S=Bn(O,Pn(B,F-U*v)),P=Bn(O,Pn(B,C+U*v)));break}}L<A&&(_*=-1,Gi=I,I=N,N=Gi,Gi=A,A=L,L=Gi,b in fF&&H.attr("cursor",Rs[b=fF[b]])),P<S&&(v*=-1,Gi=F,F=C,C=Gi,Gi=S,S=P,P=Gi,b in dF&&H.attr("cursor",Rs[b=dF[b]])),w.selection&&(M=w.selection),nt&&(A=M[0][0],L=M[1][0]),st&&(S=M[0][1],P=M[1][1]),(M[0][0]!==A||M[0][1]!==S||M[1][0]!==L||M[1][1]!==P)&&(w.selection=[[A,S],[L,P]],l.call(y),rt.brush(et,x.name))}function dt(et){if(aF(et),et.touches){if(et.touches.length)return;a&&clearTimeout(a),a=setTimeout(function(){a=null},500)}else jh(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&&(M=w.selection),wG(M)&&(w.selection=null,l.call(y)),rt.end(et,x.name)}function Wt(et){switch(et.keyCode){case 16:{tt=_&&v;break}case 18:{x===ku&&(_&&(N=L-$*_,I=A+$*_),v&&(C=P-U*v,F=S+U*v),x=Fu,Lt(et));break}case 32:{(x===ku||x===Fu)&&(_<0?N=L-$:_>0&&(I=A-$),v<0?C=P-U:v>0&&(F=S-U),x=yS,H.attr("cursor",Rs.selection),Lt(et));break}default:return}ab(et)}function Xt(et){switch(et.keyCode){case 16:{tt&&(nt=st=tt=!1,Lt(et));break}case 18:{x===Fu&&(_<0?N=L:_>0&&(I=A),v<0?C=P:v>0&&(F=S),x=ku,Lt(et));break}case 32:{x===yS&&(et.altKey?(_&&(N=L-$*_,I=A+$*_),v&&(C=P-U*v,F=S+U*v),x=Fu):(_<0?N=L:_>0&&(I=A),v<0?C=P:v>0&&(F=S),x=ku),H.attr("cursor",Rs[b]),Lt(et));break}default:return}ab(et)}}function h(g){u(this,arguments).moved(g)}function p(g){u(this,arguments).ended(g)}function m(){var g=this.__brush||{selection:null};return g.extent=bS(t.apply(this,arguments)),g.dim=e,g}return c.extent=function(g){return arguments.length?(t=typeof g=="function"?g:sb(bS(g)),c):t},c.filter=function(g){return arguments.length?(n=typeof g=="function"?g:sb(!!g),c):n},c.touchable=function(g){return arguments.length?(r=typeof g=="function"?g:sb(!!g),c):r},c.handleSize=function(g){return arguments.length?(s=+g,c):s},c.keyModifiers=function(g){return arguments.length?(i=!!g,c):i},c.on=function(){var g=o.on.apply(o,arguments);return g===o?c:g},c}var SS=Math.PI,IS=2*SS,tl=1e-6,vG=IS-tl;function hF(e){this._+=e[0];for(let t=1,n=e.length;t<n;++t)this._+=arguments[t]+e[t]}function SG(e){let t=Math.floor(e);if(!(t>=0))throw new Error(`invalid digits: ${e}`);if(t>15)return hF;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 La=class{constructor(t){this._x0=this._y0=this._x1=this._y1=null,this._="",this._append=t==null?hF:SG(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>tl)if(!(Math.abs(f*c-l*u)>tl)||!o)this._append`L${this._x1=t},${this._y1=n}`;else{let h=r-s,p=i-a,m=c*c+l*l,g=h*h+p*p,y=Math.sqrt(m),b=Math.sqrt(d),x=o*Math.tan((SS-Math.acos((m+d-g)/(2*y*b)))/2),_=x/b,v=x/y;Math.abs(_-1)>tl&&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)>tl||Math.abs(this._y1-u)>tl)&&this._append`L${l},${u}`,r&&(d<0&&(d=d%IS+IS),d>vG?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>tl&&this._append`A${r},${r},0,${+(d>=SS)},${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 pF(){return new La}pF.prototype=La.prototype;function er(e=3){return new La(+e)}var IG=Array.prototype,ub=IG.slice;function mF(e,t){return e-t}function yF(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 go=e=>()=>e;function gF(e,t){for(var n=-1,r=t.length,i;++n<r;)if(i=TG(e,t[n]))return i;return 0}function TG(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(EG(c,f,t))return 0;u>r!=h>r&&n<(d-l)*(r-u)/(h-u)+l&&(i=-i)}return i}function EG(e,t,n){var r;return AG(e,t,n)&&MG(e[r=+(e[0]===t[0])],n[r],t[r])}function AG(e,t,n){return(t[0]-e[0])*(n[1]-e[1])===(n[0]-e[0])*(t[1]-e[1])}function MG(e,t,n){return e<=t&&t<=n||n<=t&&t<=e}function bF(){}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 Ca(){var e=1,t=1,n=Na,r=c;function i(l){var u=n(l);if(Array.isArray(u))u=u.slice().sort(mF);else{let f=ae(l,NG);for(u=Tn(...vu(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),yF(p)>0?d.push([p]):h.push(p)}),h.forEach(function(p){for(var m=0,g=d.length,y;m<g;++m)if(gF((y=d[m])[0],p)!==-1){y.push(p);return}}),{type:"MultiPolygon",value:u,coordinates:d}}function s(l,u,f){var d=new Array,h=new Array,p,m,g,y,b,x;for(p=m=-1,y=el(l[0],u),Os[y<<1].forEach(_);++p<e-1;)g=y,y=el(l[p+1],u),Os[g|y<<1].forEach(_);for(Os[y<<0].forEach(_);++m<t-1;){for(p=-1,y=el(l[m*e+e],u),b=el(l[m*e],u),Os[y<<1|b<<2].forEach(_);++p<e-1;)g=y,y=el(l[m*e+e+p+1],u),x=b,b=el(l[m*e+p+1],u),Os[g|y<<1|b<<2|x<<3].forEach(_);Os[y|b<<3].forEach(_)}for(p=-1,b=l[m*e]>=u,Os[b<<2].forEach(_);++p<e-1;)x=b,b=el(l[m*e+p+1],u),Os[b<<2|x<<3].forEach(_);Os[b<<3].forEach(_);function _(v){var w=[v[0][0]+p,v[0][1]+m],T=[v[1][0]+p,v[1][1]+m],M=a(w),R=a(T),I,A;(I=h[M])?(A=d[R])?(delete h[I.end],delete d[A.start],I===A?(I.ring.push(T),f(I.ring)):d[I.start]=h[A.end]={start:I.start,end:A.end,ring:I.ring.concat(A.ring)}):(delete h[I.end],I.ring.push(T),h[I.end=R]=I):(I=d[R])?(A=h[M])?(delete d[I.start],delete h[A.end],I===A?(I.ring.push(T),f(I.ring)):d[A.start]=h[I.end]={start:A.start,end:I.end,ring:A.ring.concat(I.ring)}):(delete d[I.start],I.ring.unshift(w),d[I.start=M]=I):d[M]=h[R]={start:M,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],m=h|0,g=p|0,y=TS(u[g*e+m]);h>0&&h<e&&m===h&&(d[0]=xF(h,TS(u[g*e+m-1]),y,f)),p>0&&p<t&&g===p&&(d[1]=xF(p,TS(u[(g-1)*e+m]),y,f))})}return i.contour=o,i.size=function(l){if(!arguments.length)return[e,t];var u=Math.floor(l[0]),f=Math.floor(l[1]);if(!(u>=0&&f>=0))throw new Error("invalid size");return e=u,t=f,i},i.thresholds=function(l){return arguments.length?(n=typeof l=="function"?l:Array.isArray(l)?go(ub.call(l)):go(l),i):n},i.smooth=function(l){return arguments.length?(r=l?c:bF,i):r===c},i}function NG(e){return isFinite(e)?e:NaN}function el(e,t){return e==null?!1:+e>=t}function TS(e){return e==null||isNaN(e=+e)?-1/0:e}function xF(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 RG(e){return e[0]}function OG(e){return e[1]}function DG(){return 1}function ES(){var e=RG,t=OG,n=DG,r=960,i=500,o=20,s=2,a=o*3,c=r+a*2>>s,l=i+a*2>>s,u=go(20);function f(b){var x=new Float32Array(c*l),_=Math.pow(2,-s),v=-1;for(let F of b){var w=(e(F,++v,b)+a)*_,T=(t(F,v,b)+a)*_,M=+n(F,v,b);if(M&&w>=0&&w<c&&T>=0&&T<l){var R=Math.floor(w),I=Math.floor(T),A=w-R-.5,O=T-I-.5;x[R+I*c]+=(1-A)*(1-O)*M,x[R+1+I*c]+=A*(1-O)*M,x[R+1+(I+1)*c]+=A*O*M,x[R+(I+1)*c]+=(1-A)*O*M}}return kh({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(_)||(_=Tn(Number.MIN_VALUE,Gt(x)/v,_)),Ca().size([c,l]).thresholds(_.map(w=>w*v))(x).map((w,T)=>(w.value=+_[T],h(w)))}d.contours=function(b){var x=f(b),_=Ca().size([c,l]),v=Math.pow(2,2*s),w=T=>{T=+T;var M=h(_.contour(x,T*v));return M.value=T,M};return Object.defineProperty(w,"max",{get:()=>Gt(x)/v}),w};function h(b){return b.coordinates.forEach(p),b}function p(b){b.forEach(m)}function m(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 y(){return a=o*3,c=r+a*2>>s,l=i+a*2>>s,d}return d.x=function(b){return arguments.length?(e=typeof b=="function"?b:go(+b),d):e},d.y=function(b){return arguments.length?(t=typeof b=="function"?b:go(+b),d):t},d.weight=function(b){return arguments.length?(n=typeof b=="function"?b:go(+b),d):n},d.size=function(b){if(!arguments.length)return[r,i];var x=+b[0],_=+b[1];if(!(x>=0&&_>=0))throw new Error("invalid size");return r=x,i=_,y()},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),y()},d.thresholds=function(b){return arguments.length?(u=typeof b=="function"?b:Array.isArray(b)?go(ub.call(b)):go(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,y()},d}var Jt=11102230246251565e-32,Ge=134217729,op=(3+8*Jt)*Jt;function nl(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 sp(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 kG=(3+16*Jt)*Jt,FG=(2+12*Jt)*Jt,LG=(9+64*Jt)*Jt*Jt,Lu=V(4),_F=V(8),wF=V(12),vF=V(16),nr=V(4);function CG(e,t,n,r,i,o,s){let a,c,l,u,f,d,h,p,m,g,y,b,x,_,v,w,T,M,R=e-i,I=n-i,A=t-o,O=r-o;_=R*O,d=Ge*R,h=d-(d-R),p=R-h,d=Ge*O,m=d-(d-O),g=O-m,v=p*g-(_-h*m-p*m-h*g),w=A*I,d=Ge*A,h=d-(d-A),p=A-h,d=Ge*I,m=d-(d-I),g=I-m,T=p*g-(w-h*m-p*m-h*g),y=v-T,f=v-y,Lu[0]=v-(y+f)+(f-T),b=_+y,f=b-_,x=_-(b-f)+(y-f),y=x-w,f=x-y,Lu[1]=x-(y+f)+(f-w),M=b+y,f=M-b,Lu[2]=b-(M-f)+(y-f),Lu[3]=M;let F=sp(4,Lu),S=FG*s;if(F>=S||-F>=S||(f=e-R,a=e-(R+f)+(f-i),f=n-I,l=n-(I+f)+(f-i),f=t-A,c=t-(A+f)+(f-o),f=r-O,u=r-(O+f)+(f-o),a===0&&c===0&&l===0&&u===0)||(S=LG*s+op*Math.abs(F),F+=R*u+O*a-(A*l+I*c),F>=S||-F>=S))return F;_=a*O,d=Ge*a,h=d-(d-a),p=a-h,d=Ge*O,m=d-(d-O),g=O-m,v=p*g-(_-h*m-p*m-h*g),w=c*I,d=Ge*c,h=d-(d-c),p=c-h,d=Ge*I,m=d-(d-I),g=I-m,T=p*g-(w-h*m-p*m-h*g),y=v-T,f=v-y,nr[0]=v-(y+f)+(f-T),b=_+y,f=b-_,x=_-(b-f)+(y-f),y=x-w,f=x-y,nr[1]=x-(y+f)+(f-w),M=b+y,f=M-b,nr[2]=b-(M-f)+(y-f),nr[3]=M;let E=nl(4,Lu,4,nr,_F);_=R*u,d=Ge*R,h=d-(d-R),p=R-h,d=Ge*u,m=d-(d-u),g=u-m,v=p*g-(_-h*m-p*m-h*g),w=A*l,d=Ge*A,h=d-(d-A),p=A-h,d=Ge*l,m=d-(d-l),g=l-m,T=p*g-(w-h*m-p*m-h*g),y=v-T,f=v-y,nr[0]=v-(y+f)+(f-T),b=_+y,f=b-_,x=_-(b-f)+(y-f),y=x-w,f=x-y,nr[1]=x-(y+f)+(f-w),M=b+y,f=M-b,nr[2]=b-(M-f)+(y-f),nr[3]=M;let N=nl(E,_F,4,nr,wF);_=a*u,d=Ge*a,h=d-(d-a),p=a-h,d=Ge*u,m=d-(d-u),g=u-m,v=p*g-(_-h*m-p*m-h*g),w=c*l,d=Ge*c,h=d-(d-c),p=c-h,d=Ge*l,m=d-(d-l),g=l-m,T=p*g-(w-h*m-p*m-h*g),y=v-T,f=v-y,nr[0]=v-(y+f)+(f-T),b=_+y,f=b-_,x=_-(b-f)+(y-f),y=x-w,f=x-y,nr[1]=x-(y+f)+(f-w),M=b+y,f=M-b,nr[2]=b-(M-f)+(y-f),nr[3]=M;let L=nl(N,wF,4,nr,vF);return vF[L-1]}function Cu(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)>=kG*l?c:-CG(e,t,n,r,i,o,l)}var D_t=(7+56*Jt)*Jt,k_t=(3+28*Jt)*Jt,F_t=(26+288*Jt)*Jt*Jt,L_t=V(4),C_t=V(4),B_t=V(4),P_t=V(4),$_t=V(4),U_t=V(4),z_t=V(4),q_t=V(4),j_t=V(4),V_t=V(8),Y_t=V(8),G_t=V(8),W_t=V(4),X_t=V(8),H_t=V(8),Z_t=V(8),Q_t=V(12),K_t=V(192),J_t=V(192);var nwt=(10+96*Jt)*Jt,rwt=(4+48*Jt)*Jt,iwt=(44+576*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(8),pwt=V(8),mwt=V(8),ywt=V(8),gwt=V(8),bwt=V(8),xwt=V(8),_wt=V(8),wwt=V(8),vwt=V(4),Swt=V(4),Iwt=V(4),Twt=V(8),Ewt=V(16),Awt=V(16),Mwt=V(16),Nwt=V(32),Rwt=V(32),Owt=V(48),Dwt=V(64),kwt=V(1152),Fwt=V(1152);var Pwt=(16+224*Jt)*Jt,$wt=(5+72*Jt)*Jt,Uwt=(71+1408*Jt)*Jt*Jt,zwt=V(4),qwt=V(4),jwt=V(4),Vwt=V(4),Ywt=V(4),Gwt=V(4),Wwt=V(4),Xwt=V(4),Hwt=V(4),Zwt=V(4),Qwt=V(24),Kwt=V(24),Jwt=V(24),tvt=V(24),evt=V(24),nvt=V(24),rvt=V(24),ivt=V(24),ovt=V(24),svt=V(24),avt=V(1152),cvt=V(1152),lvt=V(1152),uvt=V(1152),fvt=V(1152),dvt=V(2304),hvt=V(2304),pvt=V(3456),mvt=V(5760),yvt=V(8),gvt=V(8),bvt=V(8),xvt=V(16),_vt=V(24),wvt=V(48),vvt=V(48),Svt=V(96),Ivt=V(192),Tvt=V(384),Evt=V(384),Avt=V(384),Mvt=V(768);var Nvt=V(96),Rvt=V(96),Ovt=V(96),Dvt=V(1152);var IF=Math.pow(2,-52),fb=new Uint32Array(512),Pu=class e{static from(t,n=qG,r=jG){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 A=t[2*I],O=t[2*I+1];A<a&&(a=A),O<c&&(c=O),A>l&&(l=A),O>u&&(u=O),this._ids[I]=I}let f=(a+l)/2,d=(c+u)/2,h=1/0,p,m,g;for(let I=0;I<s;I++){let A=AS(f,d,t[2*I],t[2*I+1]);A<h&&(p=I,h=A)}let y=t[2*p],b=t[2*p+1];h=1/0;for(let I=0;I<s;I++){if(I===p)continue;let A=AS(y,b,t[2*I],t[2*I+1]);A<h&&A>0&&(m=I,h=A)}let x=t[2*m],_=t[2*m+1],v=1/0;for(let I=0;I<s;I++){if(I===p||I===m)continue;let A=UG(y,b,x,_,t[2*I],t[2*I+1]);A<v&&(g=I,v=A)}let w=t[2*g],T=t[2*g+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];Bu(this._ids,this._dists,0,s-1);let I=new Uint32Array(s),A=0;for(let O=0,F=-1/0;O<s;O++){let S=this._ids[O];this._dists[S]>F&&(I[A++]=S,F=this._dists[S])}this.hull=I.subarray(0,A),this.triangles=new Uint32Array(0),this.halfedges=new Uint32Array(0);return}if(Cu(y,b,x,_,w,T)<0){let I=m,A=x,O=_;m=g,x=w,_=T,g=I,w=A,T=O}let M=zG(y,b,x,_,w,T);this._cx=M.x,this._cy=M.y;for(let I=0;I<s;I++)this._dists[I]=AS(t[2*I],t[2*I+1],M.x,M.y);Bu(this._ids,this._dists,0,s-1),this._hullStart=p;let R=3;r[p]=n[g]=m,r[m]=n[p]=g,r[g]=n[m]=p,i[p]=0,i[m]=1,i[g]=2,o.fill(-1),o[this._hashKey(y,b)]=p,o[this._hashKey(x,_)]=m,o[this._hashKey(w,T)]=g,this.trianglesLen=0,this._addTriangle(p,m,g,-1,-1,-1);for(let I=0,A,O;I<this._ids.length;I++){let F=this._ids[I],S=t[2*F],E=t[2*F+1];if(I>0&&Math.abs(S-A)<=IF&&Math.abs(E-O)<=IF||(A=S,O=E,F===p||F===m||F===g))continue;let N=0;for(let $=0,U=this._hashKey(S,E);$<this._hashSize&&(N=o[(U+$)%this._hashSize],!(N!==-1&&N!==r[N]));$++);N=n[N];let L=N,B;for(;B=r[L],Cu(S,E,t[2*L],t[2*L+1],t[2*B],t[2*B+1])>=0;)if(L=B,L===N){L=-1;break}if(L===-1)continue;let C=this._addTriangle(L,F,r[L],-1,-1,i[L]);i[F]=this._legalize(C+2),i[L]=C,R++;let P=r[L];for(;B=r[P],Cu(S,E,t[2*P],t[2*P+1],t[2*B],t[2*B+1])<0;)C=this._addTriangle(P,F,B,i[F],-1,i[P]),i[F]=this._legalize(C+2),r[P]=P,R--,P=B;if(L===N)for(;B=n[L],Cu(S,E,t[2*B],t[2*B+1],t[2*L],t[2*L+1])<0;)C=this._addTriangle(B,F,L,-1,i[L],i[B]),this._legalize(C+2),i[B]=C,r[L]=L,R--,L=B;this._hullStart=n[F]=L,r[L]=n[P]=F,r[F]=P,o[this._hashKey(S,E)]=F,o[this._hashKey(t[2*L],t[2*L+1])]=L}this.hull=new Uint32Array(R);for(let I=0,A=this._hullStart;I<R;I++)this.hull[I]=A,A=r[A];this.triangles=this._triangles.subarray(0,this.trianglesLen),this.halfedges=this._halfedges.subarray(0,this.trianglesLen)}_hashKey(t,n){return Math.floor(PG(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=fb[--o];continue}let l=a-a%3,u=c+(t+1)%3,f=l+(a+2)%3,d=n[s],h=n[t],p=n[u],m=n[f];if($G(i[2*d],i[2*d+1],i[2*h],i[2*h+1],i[2*p],i[2*p+1],i[2*m],i[2*m+1])){n[t]=m,n[a]=d;let y=r[f];if(y===-1){let 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,y),this._link(a,r[s]),this._link(s,f);let b=l+(a+1)%3;o<fb.length&&(fb[o++]=b)}else{if(o===0)break;t=fb[--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 PG(e,t){let n=e/(Math.abs(e)+Math.abs(t));return(t>0?3-n:1+n)/4}function AS(e,t,n,r){let i=e-n,o=t-r;return i*i+o*o}function $G(e,t,n,r,i,o,s,a){let c=e-s,l=t-a,u=n-s,f=r-a,d=i-s,h=o-a,p=c*c+l*l,m=u*u+f*f,g=d*d+h*h;return c*(f*g-m*h)-l*(u*g-m*d)+p*(u*h-f*d)<0}function UG(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 zG(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 Bu(e,t,n,r){if(r-n<=20)for(let i=n+1;i<=r;i++){let o=e[i],s=t[o],a=i-1;for(;a>=n&&t[e[a]]>s;)e[a+1]=e[a--];e[a+1]=o}else{let i=n+r>>1,o=n+1,s=r;ap(e,i,o),t[e[n]]>t[e[r]]&&ap(e,n,r),t[e[o]]>t[e[r]]&&ap(e,o,r),t[e[n]]>t[e[o]]&&ap(e,n,o);let a=e[o],c=t[a];for(;;){do o++;while(t[e[o]]<c);do s--;while(t[e[s]]>c);if(s<o)break;ap(e,o,s)}e[n+1]=e[s],e[s]=a,r-o+1>=s-n?(Bu(e,t,o,r),Bu(e,t,n,s-1)):(Bu(e,t,n,s-1),Bu(e,t,o,r))}}function ap(e,t,n){let r=e[t];e[t]=e[n],e[n]=r}function qG(e){return e[0]}function jG(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 Ba=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 cp=class{constructor(t,[n,r,i,o]=[0,0,960,500]){if(!((i=+i)>=(n=+n))||!((o=+o)>=(r=+r)))throw new Error("invalid bounds");this.delaunay=t,this._circumcenters=new Float64Array(t.points.length*2),this.vectors=new Float64Array(t.points.length*2),this.xmax=i,this.xmin=n,this.ymax=o,this.ymin=r,this._init()}update(){return this.delaunay.update(),this._init(),this}_init(){let{delaunay:{points:t,hull:n,triangles:r},vectors:i}=this,o,s,a=this.circumcenters=this._circumcenters.subarray(0,r.length/3*2);for(let m=0,g=0,y=r.length,b,x;m<y;m+=3,g+=2){let _=r[m]*2,v=r[m+1]*2,w=r[m+2]*2,T=t[_],M=t[_+1],R=t[v],I=t[v+1],A=t[w],O=t[w+1],F=R-T,S=I-M,E=A-T,N=O-M,L=(F*N-S*E)*2;if(Math.abs(L)<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-M)*E);b=(T+A)/2-B*N,x=(M+O)/2+B*E}else{let B=1/L,C=F*F+S*S,P=E*E+N*N;b=T+(N*C-S*P)*B,x=M+(F*P-E*C)*B}a[g]=b,a[g+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 m=0;m<n.length;++m)c=n[m],l=u,f=d,h=p,u=c*4,d=t[2*c],p=t[2*c+1],i[l+2]=i[u]=h-p,i[l+3]=i[u+1]=d-f}render(t){let n=t==null?t=new si:void 0,{delaunay:{halfedges:r,inedges:i,hull:o},circumcenters:s,vectors:a}=this;if(o.length<=1)return null;for(let u=0,f=r.length;u<f;++u){let d=r[u];if(d<u)continue;let h=Math.floor(u/3)*2,p=Math.floor(d/3)*2,m=s[h],g=s[h+1],y=s[p],b=s[p+1];this._renderSegment(m,g,y,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,m=this._project(d,h,a[p+2],a[p+3]);m&&this._renderSegment(d,h,m[0],m[1],t)}return n&&n.value()}renderBounds(t){let n=t==null?t=new si:void 0;return t.rect(this.xmin,this.ymin,this.xmax-this.xmin,this.ymax-this.ymin),n&&n.value()}renderCell(t,n){let r=n==null?n=new si:void 0,i=this._clip(t);if(i===null||!i.length)return;n.moveTo(i[0],i[1]);let o=i.length;for(;i[0]===i[o-2]&&i[1]===i[o-1]&&o>1;)o-=2;for(let s=2;s<o;s+=2)(i[s]!==i[s-2]||i[s+1]!==i[s-1])&&n.lineTo(i[s],i[s+1]);return n.closePath(),r&&r.value()}*cellPolygons(){let{delaunay:{points:t}}=this;for(let n=0,r=t.length/2;n<r;++n){let i=this.cellPolygon(n);i&&(i.index=n,yield i)}}cellPolygon(t){let n=new Ba;return this.renderCell(t,n),n.value()}_renderSegment(t,n,r,i,o){let s,a=this._regioncode(t,n),c=this._regioncode(r,i);a===0&&c===0?(o.moveTo(t,n),o.lineTo(r,i)):(s=this._clipSegment(t,n,r,i,a,c))&&(o.moveTo(s[0],s[1]),o.lineTo(s[2],s[3]))}contains(t,n,r){return n=+n,n!==n||(r=+r,r!==r)?!1:this.delaunay._step(t,n,r)===t}*neighbors(t){let n=this._clip(t);if(n)for(let r of this.delaunay.neighbors(t)){let i=this._clip(r);if(i){t:for(let o=0,s=n.length;o<s;o+=2)for(let a=0,c=i.length;a<c;a+=2)if(n[o]===i[a]&&n[o+1]===i[a+1]&&n[(o+2)%s]===i[(a+c-2)%c]&&n[(o+3)%s]===i[(a+c-1)%c]){yield r;break t}}}}_cell(t){let{circumcenters:n,delaunay:{inedges:r,halfedges:i,triangles:o}}=this,s=r[t];if(s===-1)return null;let a=[],c=s;do{let l=Math.floor(c/3);if(a.push(n[l*2],n[l*2+1]),c=c%3===2?c-2:c+1,o[c]!==t)break;c=i[c]}while(c!==s&&c!==-1);return a}_clip(t){if(t===0&&this.delaunay.hull.length===1)return[this.xmax,this.ymin,this.xmax,this.ymax,this.xmin,this.ymax,this.xmin,this.ymin];let n=this._cell(t);if(n===null)return null;let{vectors:r}=this,i=t*4;return this._simplify(r[i]||r[i+1]?this._clipInfinite(t,n,r[i],r[i+1],r[i+2],r[i+3]):this._clipFinite(t,n))}_clipFinite(t,n){let r=n.length,i=null,o,s,a=n[r-2],c=n[r-1],l,u=this._regioncode(a,c),f,d=0;for(let h=0;h<r;h+=2)if(o=a,s=c,a=n[h],c=n[h+1],l=u,u=this._regioncode(a,c),l===0&&u===0)f=d,d=0,i?i.push(a,c):i=[a,c];else{let p,m,g,y,b;if(l===0){if((p=this._clipSegment(o,s,a,c,l,u))===null)continue;[m,g,y,b]=p}else{if((p=this._clipSegment(a,c,o,s,u,l))===null)continue;[y,b,m,g]=p,f=d,d=this._edgecode(m,g),f&&d&&this._edge(t,f,d,i,i.length),i?i.push(m,g):i=[m,g]}f=d,d=this._edgecode(y,b),f&&d&&this._edge(t,f,d,i,i.length),i?i.push(y,b):i=[y,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,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 VG=2*Math.PI,$u=Math.pow;function YG(e){return e[0]}function GG(e){return e[1]}function WG(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 XG(e,t,n){return[e+Math.sin(e+t)*n,t+Math.cos(e-t)*n]}var ai=class e{static from(t,n=YG,r=GG,i){return new e("length"in t?HG(t,n,r,i):Float64Array.from(ZG(t,n,r,i)))}constructor(t){this._delaunator=new Pu(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&&WG(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=XG(n[2*d],n[2*d+1],f);n[2*d]=p[0],n[2*d+1]=p[1]}this._delaunator=new Pu(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 cp(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=$u(n-l[t*2],2)+$u(r-l[t*2+1],2),d=i[t],h=d;do{let p=c[h],m=$u(n-l[p*2],2)+$u(r-l[p*2+1],2);if(m<f&&(f=m,u=p),h=h%3===2?h-2:h+1,c[h]!==t)break;if(h=a[h],h===-1){if(h=o[(s[t]+1)%o.length],h!==p&&$u(n-l[h*2],2)+$u(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,VG)}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 Ba;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 Ba;return this.renderTriangle(t,n),n.value()}};function HG(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*ZG(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 TF(e){return Math.abs(e=Math.round(e))>=1e21?e.toLocaleString("en").replace(/,/g,""):e.toString(10)}function rl(e,t){if((n=(e=t?e.toExponential(t-1):e.toExponential()).indexOf("e"))<0)return null;var n,r=e.slice(0,n);return[r.length>1?r[0]+r.slice(2):r,+e.slice(n+1)]}function bo(e){return e=rl(Math.abs(e)),e?e[1]:NaN}function EF(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 AF(e){return function(t){return t.replace(/[0-9]/g,function(n){return e[+n]})}}var QG=/^(?:(.)?([<>=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i;function xo(e){if(!(t=QG.exec(e)))throw new Error("invalid format: "+e);var t;return new db({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]})}xo.prototype=db.prototype;function db(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+""}db.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 MF(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 MS;function NF(e,t){var n=rl(e,t);if(!n)return e+"";var r=n[0],i=n[1],o=i-(MS=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")+rl(e,Math.max(0,t+o-1))[0]}function NS(e,t){var n=rl(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 RS={"%":(e,t)=>(e*100).toFixed(t),b:e=>Math.round(e).toString(2),c:e=>e+"",d:TF,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)=>NS(e*100,t),r:NS,s:NF,X:e=>Math.round(e).toString(16).toUpperCase(),x:e=>Math.round(e).toString(16)};function OS(e){return e}var RF=Array.prototype.map,OF=["y","z","a","f","p","n","\xB5","m","","k","M","G","T","P","E","Z","Y"];function DF(e){var t=e.grouping===void 0||e.thousands===void 0?OS:EF(RF.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?OS:AF(RF.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=xo(f);var d=f.fill,h=f.align,p=f.sign,m=f.symbol,g=f.zero,y=f.width,b=f.comma,x=f.precision,_=f.trim,v=f.type;v==="n"?(b=!0,v="g"):RS[v]||(x===void 0&&(x=12),_=!0,v="g"),(g||d==="0"&&h==="=")&&(g=!0,d="0",h="=");var w=m==="$"?n:m==="#"&&/[boxX]/.test(v)?"0"+v.toLowerCase():"",T=m==="$"?r:/[%p]/.test(v)?s:"",M=RS[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(A){var O=w,F=T,S,E,N;if(v==="c")F=M(A)+F,A="";else{A=+A;var L=A<0||1/A<0;if(A=isNaN(A)?c:M(Math.abs(A),x),_&&(A=MF(A)),L&&+A==0&&p!=="+"&&(L=!1),O=(L?p==="("?p:a:p==="-"||p==="("?"":p)+O,F=(v==="s"?OF[8+MS/3]:"")+F+(L&&p==="("?")":""),R){for(S=-1,E=A.length;++S<E;)if(N=A.charCodeAt(S),48>N||N>57){F=(N===46?i+A.slice(S+1):A.slice(S))+F,A=A.slice(0,S);break}}}b&&!g&&(A=t(A,1/0));var B=O.length+A.length+F.length,C=B<y?new Array(y-B+1).join(d):"";switch(b&&g&&(A=t(C+A,C.length?y-F.length:1/0),C=""),h){case"<":A=O+A+F+C;break;case"=":A=O+C+A+F;break;case"^":A=C.slice(0,B=C.length>>1)+O+A+F+C.slice(B);break;default:A=C+O+A+F;break}return o(A)}return I.toString=function(){return f+""},I}function u(f,d){var h=l((f=xo(f),f.type="f",f)),p=Math.max(-8,Math.min(8,Math.floor(bo(d)/3)))*3,m=Math.pow(10,-p),g=OF[8+p/3];return function(y){return h(m*y)+g}}return{format:l,formatPrefix:u}}var hb,ci,pb;DS({thousands:",",grouping:[3],currency:["$",""]});function DS(e){return hb=DF(e),ci=hb.format,pb=hb.formatPrefix,hb}function kS(e){return Math.max(0,-bo(Math.abs(e)))}function FS(e,t){return Math.max(0,Math.max(-8,Math.min(8,Math.floor(bo(t)/3)))*3-bo(Math.abs(e)))}function LS(e,t){return e=Math.abs(e),t=Math.abs(t)-e,Math.max(0,bo(t)-bo(e))+1}var J=1e-6,il=1e-12,Mt=Math.PI,de=Mt/2,CS=Mt/4,cn=Mt*2,Ce=180/Mt,jt=Mt/180,Bt=Math.abs,li=Math.atan,We=Math.atan2,K=Math.cos,lp=Math.ceil,mb=Math.exp;var yb=Math.hypot,ol=Math.log,gb=Math.pow,Q=Math.sin,$n=Math.sign||function(e){return e>0?1:e<0?-1:0},he=Math.sqrt,Uu=Math.tan;function bb(e){return e>1?0:e<-1?Mt:Math.acos(e)}function ve(e){return e>1?de:e<-1?-de:Math.asin(e)}function Xe(){}function xb(e,t){e&&FF.hasOwnProperty(e.type)&&FF[e.type](e,t)}var kF={Feature:function(e,t){xb(e.geometry,t)},FeatureCollection:function(e,t){for(var n=e.features,r=-1,i=n.length;++r<i;)xb(n[r].geometry,t)}},FF={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){BS(e.coordinates,t,0)},MultiLineString:function(e,t){for(var n=e.coordinates,r=-1,i=n.length;++r<i;)BS(n[r],t,0)},Polygon:function(e,t){LF(e.coordinates,t)},MultiPolygon:function(e,t){for(var n=e.coordinates,r=-1,i=n.length;++r<i;)LF(n[r],t)},GeometryCollection:function(e,t){for(var n=e.geometries,r=-1,i=n.length;++r<i;)xb(n[r],t)}};function BS(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 LF(e,t){var n=-1,r=e.length;for(t.polygonStart();++n<r;)BS(e[n],t,1);t.polygonEnd()}function Br(e,t){e&&kF.hasOwnProperty(e.type)?kF[e.type](e,t):xb(e,t)}function up(e){return[We(e[1],e[0]),ve(e[2])]}function _o(e){var t=e[0],n=e[1],r=K(n);return[r*K(t),r*Q(t),Q(n)]}function fp(e,t){return e[0]*t[0]+e[1]*t[1]+e[2]*t[2]}function zu(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 _b(e,t){e[0]+=t[0],e[1]+=t[1],e[2]+=t[2]}function dp(e,t){return[e[0]*t,e[1]*t,e[2]*t]}function hp(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 pp,wb,vb,Sb,Ib,Tb,Eb,Ab,PS,$S,US,PF,$F,rr,ir,or,$i={sphere:Xe,point:zS,lineStart:CF,lineEnd:BF,polygonStart:function(){$i.lineStart=tW,$i.lineEnd=eW},polygonEnd:function(){$i.lineStart=CF,$i.lineEnd=BF}};function zS(e,t){e*=jt,t*=jt;var n=K(t);mp(n*K(e),n*Q(e),Q(t))}function mp(e,t,n){++pp,vb+=(e-vb)/pp,Sb+=(t-Sb)/pp,Ib+=(n-Ib)/pp}function CF(){$i.point=KG}function KG(e,t){e*=jt,t*=jt;var n=K(t);rr=n*K(e),ir=n*Q(e),or=Q(t),$i.point=JG,mp(rr,ir,or)}function JG(e,t){e*=jt,t*=jt;var n=K(t),r=n*K(e),i=n*Q(e),o=Q(t),s=We(he((s=ir*o-or*i)*s+(s=or*r-rr*o)*s+(s=rr*i-ir*r)*s),rr*r+ir*i+or*o);wb+=s,Tb+=s*(rr+(rr=r)),Eb+=s*(ir+(ir=i)),Ab+=s*(or+(or=o)),mp(rr,ir,or)}function BF(){$i.point=zS}function tW(){$i.point=nW}function eW(){UF(PF,$F),$i.point=zS}function nW(e,t){PF=e,$F=t,e*=jt,t*=jt,$i.point=UF;var n=K(t);rr=n*K(e),ir=n*Q(e),or=Q(t),mp(rr,ir,or)}function UF(e,t){e*=jt,t*=jt;var n=K(t),r=n*K(e),i=n*Q(e),o=Q(t),s=ir*o-or*i,a=or*r-rr*o,c=rr*i-ir*r,l=yb(s,a,c),u=ve(l),f=l&&-u/l;PS.add(f*s),$S.add(f*a),US.add(f*c),wb+=u,Tb+=u*(rr+(rr=r)),Eb+=u*(ir+(ir=i)),Ab+=u*(or+(or=o)),mp(rr,ir,or)}function qS(e){pp=wb=vb=Sb=Ib=Tb=Eb=Ab=0,PS=new In,$S=new In,US=new In,Br(e,$i);var t=+PS,n=+$S,r=+US,i=yb(t,n,r);return i<il&&(t=Tb,n=Eb,r=Ab,wb<J&&(t=vb,n=Sb,r=Ib),i=yb(t,n,r),i<il)?[NaN,NaN]:[We(n,t)*Ce,ve(r/i)*Ce]}function yp(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 jS(e,t){return Bt(e)>Mt&&(e-=Math.round(e/cn)*cn),[e,t]}jS.invert=jS;function VS(e,t,n){return(e%=cn)?t||n?yp(qF(e),jF(t,n)):qF(e):t||n?jF(t,n):jS}function zF(e){return function(t,n){return t+=e,Bt(t)>Mt&&(t-=Math.round(t/cn)*cn),[t,n]}}function qF(e){var t=zF(e);return t.invert=zF(-e),t}function jF(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 VF(e){e=VS(e[0]*jt,e[1]*jt,e.length>2?e[2]*jt:0);function t(n){return n=e(n[0]*jt,n[1]*jt),n[0]*=Ce,n[1]*=Ce,n}return t.invert=function(n){return n=e.invert(n[0]*jt,n[1]*jt),n[0]*=Ce,n[1]*=Ce,n},t}function GF(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=YF(s,i),o=YF(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=up([s,-a*K(u),-a*Q(u)]),e.point(l[0],l[1])}}function YF(e,t){t=_o(t),t[0]-=e,hp(t);var n=bb(-t[1]);return((-t[2]<0?-n:n)+cn-J)%cn}function Mb(){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 qu(e,t){return Bt(e[0]-t[0])<J&&Bt(e[1]-t[1])<J}function Nb(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 Rb(e,t,n,r,i){var o=[],s=[],a,c;if(e.forEach(function(p){if(!((m=p.length-1)<=0)){var m,g=p[0],y=p[m],b;if(qu(g,y)){if(!g[2]&&!y[2]){for(i.lineStart(),a=0;a<m;++a)i.point((g=p[a])[0],g[1]);i.lineEnd();return}y[0]+=2*J}o.push(b=new Nb(g,p,null,!0)),s.push(b.o=new Nb(g,null,b,!1)),o.push(b=new Nb(y,p,null,!1)),s.push(b.o=new Nb(y,null,b,!0))}}),!!o.length){for(s.sort(t),WF(o),WF(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 WF(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 YS(e){return Bt(e[0])<=Mt?e[0]:$n(e[0])*((Bt(e[0])+Mt)%cn-Mt)}function XF(e,t){var n=YS(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=YS(h),m=h[1]/2+CS,g=Q(m),y=K(m),b=0;b<d;++b,p=_,g=w,y=T,h=x){var x=f[b],_=YS(x),v=x[1]/2+CS,w=Q(v),T=K(v),M=_-p,R=M>=0?1:-1,I=R*M,A=I>Mt,O=g*w;if(c.add(We(O*R*Q(I),y*T+O*K(I))),s+=A?M+R*cn:M,A^p>=n^_>=n){var F=zu(_o(h),_o(x));hp(F);var S=zu(o,F);hp(S);var E=(A^M>=0?-1:1)*ve(S[2]);(r>E||r===E&&(F[0]||F[1]))&&(a+=A^M>=0?1:-1)}}return(s<-J||s<J&&c<-il)^a&1}function Ob(e,t,n,r){return function(i){var o=t(i),s=Mb(),a=t(s),c=!1,l,u,f,d={point:h,lineStart:m,lineEnd:g,polygonStart:function(){d.point=y,d.lineStart=b,d.lineEnd=x,u=[],l=[]},polygonEnd:function(){d.point=h,d.lineStart=m,d.lineEnd=g,u=Su(u);var _=XF(l,r);u.length?(c||(i.polygonStart(),c=!0),Rb(u,iW,_,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 m(){d.point=p,o.lineStart()}function g(){d.point=h,o.lineEnd()}function y(_,v){f.push([_,v]),a.point(_,v)}function b(){a.lineStart(),f=[]}function x(){y(f[0][0],f[0][1]),a.lineEnd();var _=a.clean(),v=s.result(),w,T=v.length,M,R,I;if(f.pop(),l.push(f),f=null,!!T){if(_&1){if(R=v[0],(M=R.length-1)>0){for(c||(i.polygonStart(),c=!0),i.lineStart(),w=0;w<M;++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(rW))}}return d}}function rW(e){return e.length>1}function iW(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 GS=Ob(function(){return!0},oW,aW,[-Mt,-de]);function oW(e){var t=NaN,n=NaN,r=NaN,i;return{lineStart:function(){e.lineStart(),i=1},point:function(o,s){var a=o>0?Mt:-Mt,c=Bt(o-t);Bt(c-Mt)<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>=Mt&&(Bt(t-r)<J&&(t-=r*J),Bt(o-a)<J&&(o-=a*J),n=sW(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 sW(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 aW(e,t,n,r){var i;if(e==null)i=n*de,r.point(-Mt,i),r.point(0,i),r.point(Mt,i),r.point(Mt,0),r.point(Mt,-i),r.point(0,-i),r.point(-Mt,-i),r.point(-Mt,0),r.point(-Mt,i);else if(Bt(e[0]-t[0])>J){var o=e[0]<t[0]?Mt:-Mt;i=n*o/2,r.point(-o,i),r.point(0,i),r.point(o,i)}else r.point(t[0],t[1])}function HF(e){var t=K(e),n=6*jt,r=t>0,i=Bt(t)>J;function o(u,f,d,h){GF(h,e,n,d,u,f)}function s(u,f){return K(u)*K(f)>t}function a(u){var f,d,h,p,m;return{lineStart:function(){p=h=!1,m=1},point:function(g,y){var b=[g,y],x,_=s(g,y),v=r?_?0:l(g,y):_?l(g+(g<0?Mt:-Mt),y):0;if(!f&&(p=h=_)&&u.lineStart(),_!==h&&(x=c(f,b),(!x||qu(f,x)||qu(b,x))&&(b[2]=1)),_!==h)m=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&&r^_){var w;!(v&d)&&(w=c(b,f,!0))&&(m=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||!qu(f,b))&&u.point(b[0],b[1]),f=b,h=_,d=v},lineEnd:function(){h&&u.lineEnd(),f=null},clean:function(){return m|(p&&h)<<1}}}function c(u,f,d){var h=_o(u),p=_o(f),m=[1,0,0],g=zu(h,p),y=fp(g,g),b=g[0],x=y-b*b;if(!x)return!d&&u;var _=t*y/x,v=-t*b/x,w=zu(m,g),T=dp(m,_),M=dp(g,v);_b(T,M);var R=w,I=fp(T,R),A=fp(R,R),O=I*I-A*(fp(T,T)-1);if(!(O<0)){var F=he(O),S=dp(R,(-I-F)/A);if(_b(S,T),S=up(S),!d)return S;var E=u[0],N=f[0],L=u[1],B=f[1],C;N<E&&(C=E,E=N,N=C);var P=N-E,$=Bt(P-Mt)<J,U=$||P<J;if(!$&&B<L&&(C=L,L=B,B=C),U?$?L+B>0^S[1]<(Bt(S[0]-E)<J?L:B):L<=S[1]&&S[1]<=B:P>Mt^(E<=S[0]&&S[0]<=N)){var X=dp(R,(-I+F)/A);return _b(X,T),[S,up(X)]}}}function l(u,f){var d=r?e:Mt-e,h=0;return u<-d?h|=1:u>d&&(h|=2),f<-d?h|=4:f>d&&(h|=8),h}return Ob(s,a,o,r?[0,-e]:[-Mt,e-Mt])}function ZF(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 gp=1e9,Db=-gp;function ju(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=Mb(),d,h,p,m,g,y,b,x,_,v,w,T={point:M,lineStart:O,lineEnd:F,polygonStart:I,polygonEnd:A};function M(E,N){i(E,N)&&u.point(E,N)}function R(){for(var E=0,N=0,L=h.length;N<L;++N)for(var B=h[N],C=1,P=B.length,$=B[0],U,X,tt=$[0],nt=$[1];C<P;++C)U=tt,X=nt,$=B[C],tt=$[0],nt=$[1],X<=r?nt>r&&(tt-U)*(r-X)>(nt-X)*(e-U)&&++E:nt<=r&&(tt-U)*(r-X)<(nt-X)*(e-U)&&--E;return E}function I(){u=f,d=[],h=[],w=!0}function A(){var E=R(),N=w&&E,L=(d=Su(d)).length;(N||L)&&(l.polygonStart(),N&&(l.lineStart(),o(null,null,1,l),l.lineEnd()),L&&Rb(d,a,E,o,l),l.polygonEnd()),u=l,d=h=p=null}function O(){T.point=S,h&&h.push(p=[]),v=!0,_=!1,b=x=NaN}function F(){d&&(S(m,g),y&&_&&f.rejoin(),d.push(f.result())),T.point=M,_&&u.lineEnd()}function S(E,N){var L=i(E,N);if(h&&p.push([E,N]),v)m=E,g=N,y=L,v=!1,L&&(u.lineStart(),u.point(E,N));else if(L&&_)u.point(E,N);else{var B=[b=Math.max(Db,Math.min(gp,b)),x=Math.max(Db,Math.min(gp,x))],C=[E=Math.max(Db,Math.min(gp,E)),N=Math.max(Db,Math.min(gp,N))];ZF(B,C,e,t,n,r)?(_||(u.lineStart(),u.point(B[0],B[1])),u.point(C[0],C[1]),L||u.lineEnd(),w=!1):L&&(u.lineStart(),u.point(E,N),w=!1)}b=E,x=N,_=L}return T}}function QF(e,t,n){var r=$e(e,t-J,n).concat(t);return function(i){return r.map(function(o){return[i,o]})}}function KF(e,t,n){var r=$e(e,t-J,n).concat(t);return function(i){return r.map(function(o){return[o,i]})}}function WS(){var e,t,n,r,i,o,s,a,c=10,l=c,u=90,f=360,d,h,p,m,g=2.5;function y(){return{type:"MultiLineString",coordinates:b()}}function b(){return $e(lp(r/u)*u,n,u).map(p).concat($e(lp(a/f)*f,s,f).map(m)).concat($e(lp(t/c)*c,e,c).filter(function(x){return Bt(x%u)>J}).map(d)).concat($e(lp(o/l)*l,i,l).filter(function(x){return Bt(x%f)>J}).map(h))}return y.lines=function(){return b().map(function(x){return{type:"LineString",coordinates:x}})},y.outline=function(){return{type:"Polygon",coordinates:[p(r).concat(m(s).slice(1),p(n).reverse().slice(1),m(a).reverse().slice(1))]}},y.extent=function(x){return arguments.length?y.extentMajor(x).extentMinor(x):y.extentMinor()},y.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),y.precision(g)):[[r,a],[n,s]]},y.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),y.precision(g)):[[t,o],[e,i]]},y.step=function(x){return arguments.length?y.stepMajor(x).stepMinor(x):y.stepMinor()},y.stepMajor=function(x){return arguments.length?(u=+x[0],f=+x[1],y):[u,f]},y.stepMinor=function(x){return arguments.length?(c=+x[0],l=+x[1],y):[c,l]},y.precision=function(x){return arguments.length?(g=+x,d=QF(o,i,90),h=KF(t,e,g),p=QF(a,s,90),m=KF(r,n,g),y):g},y.extentMajor([[-180,-90+J],[180,90-J]]).extentMinor([[-180,-80-J],[180,80+J]])}function XS(){return WS()()}var bp=e=>e;var HS=new In,ZS=new In,JF,tL,QS,KS,Pa={point:Xe,lineStart:Xe,lineEnd:Xe,polygonStart:function(){Pa.lineStart=cW,Pa.lineEnd=uW},polygonEnd:function(){Pa.lineStart=Pa.lineEnd=Pa.point=Xe,HS.add(Bt(ZS)),ZS=new In},result:function(){var e=HS/2;return HS=new In,e}};function cW(){Pa.point=lW}function lW(e,t){Pa.point=eL,JF=QS=e,tL=KS=t}function eL(e,t){ZS.add(KS*e-QS*t),QS=e,KS=t}function uW(){eL(JF,tL)}var JS=Pa;var Vu=1/0,kb=Vu,xp=-Vu,Fb=xp,fW={point:dW,lineStart:Xe,lineEnd:Xe,polygonStart:Xe,polygonEnd:Xe,result:function(){var e=[[Vu,kb],[xp,Fb]];return xp=Fb=-(kb=Vu=1/0),e}};function dW(e,t){e<Vu&&(Vu=e),e>xp&&(xp=e),t<kb&&(kb=t),t>Fb&&(Fb=t)}var Yu=fW;var tI=0,eI=0,_p=0,Lb=0,Cb=0,Gu=0,nI=0,rI=0,wp=0,iL,oL,wo,vo,Ui={point:sl,lineStart:nL,lineEnd:rL,polygonStart:function(){Ui.lineStart=mW,Ui.lineEnd=yW},polygonEnd:function(){Ui.point=sl,Ui.lineStart=nL,Ui.lineEnd=rL},result:function(){var e=wp?[nI/wp,rI/wp]:Gu?[Lb/Gu,Cb/Gu]:_p?[tI/_p,eI/_p]:[NaN,NaN];return tI=eI=_p=Lb=Cb=Gu=nI=rI=wp=0,e}};function sl(e,t){tI+=e,eI+=t,++_p}function nL(){Ui.point=hW}function hW(e,t){Ui.point=pW,sl(wo=e,vo=t)}function pW(e,t){var n=e-wo,r=t-vo,i=he(n*n+r*r);Lb+=i*(wo+e)/2,Cb+=i*(vo+t)/2,Gu+=i,sl(wo=e,vo=t)}function rL(){Ui.point=sl}function mW(){Ui.point=gW}function yW(){sL(iL,oL)}function gW(e,t){Ui.point=sL,sl(iL=wo=e,oL=vo=t)}function sL(e,t){var n=e-wo,r=t-vo,i=he(n*n+r*r);Lb+=i*(wo+e)/2,Cb+=i*(vo+t)/2,Gu+=i,i=vo*e-wo*t,nI+=i*(wo+e),rI+=i*(vo+t),wp+=i*3,sl(wo=e,vo=t)}var iI=Ui;function Bb(e){this._context=e}Bb.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 sI=new In,oI,aL,cL,vp,Sp,Pb={point:Xe,lineStart:function(){Pb.point=bW},lineEnd:function(){oI&&lL(aL,cL),Pb.point=Xe},polygonStart:function(){oI=!0},polygonEnd:function(){oI=null},result:function(){var e=+sI;return sI=new In,e}};function bW(e,t){Pb.point=lL,aL=vp=e,cL=Sp=t}function lL(e,t){vp-=e,Sp-=t,sI.add(he(vp*vp+Sp*Sp)),vp=e,Sp=t}var aI=Pb;var uL,$b,fL,dL,Wu=class{constructor(t){this._append=t==null?hL:xW(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!==fL||this._append!==$b){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`,fL=r,$b=this._append,dL=this._,this._=i}this._+=dL;break}}}result(){let t=this._;return this._="",t.length?t:null}};function hL(e){let t=1;this._+=e[0];for(let n=e.length;t<n;++t)this._+=arguments[t]+e[t]}function xW(e){let t=Math.floor(e);if(!(t>=0))throw new RangeError(`invalid digits: ${e}`);if(t>15)return hL;if(t!==uL){let n=10**t;uL=t,$b=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 $b}function Mn(e,t){let n=3,r=4.5,i,o;function s(a){return a&&(typeof r=="function"&&o.pointRadius(+r.apply(this,arguments)),Br(a,i(o))),o.result()}return s.area=function(a){return Br(a,i(JS)),JS.result()},s.measure=function(a){return Br(a,i(aI)),aI.result()},s.bounds=function(a){return Br(a,i(Yu)),Yu.result()},s.centroid=function(a){return Br(a,i(iI)),iI.result()},s.projection=function(a){return arguments.length?(i=a==null?(e=null,bp):(e=a).stream,s):e},s.context=function(a){return arguments.length?(o=a==null?(t=null,new Wu(n)):new Bb(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 Wu(n)),s},s.projection(e).digits(n).context(t)}function al(e){return{stream:Xu(e)}}function Xu(e){return function(t){var n=new cI;for(var r in e)n[r]=e[r];return n.stream=t,n}}function cI(){}cI.prototype={constructor:cI,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 lI(e,t,n){var r=e.clipExtent&&e.clipExtent();return e.scale(150).translate([0,0]),r!=null&&e.clipExtent(null),Br(n,e.stream(Yu)),t(Yu.result()),r!=null&&e.clipExtent(r),e}function Ip(e,t,n){return lI(e,function(r){var i=t[1][0]-t[0][0],o=t[1][1]-t[0][1],s=Math.min(i/(r[1][0]-r[0][0]),o/(r[1][1]-r[0][1])),a=+t[0][0]+(i-s*(r[1][0]+r[0][0]))/2,c=+t[0][1]+(o-s*(r[1][1]+r[0][1]))/2;e.scale(150*s).translate([a,c])},n)}function Ub(e,t,n){return Ip(e,[[0,0],t],n)}function zb(e,t,n){return lI(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 qb(e,t,n){return lI(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 pL=16,_W=K(30*jt);function uI(e,t){return+t?vW(e,t):wW(e)}function wW(e){return Xu({point:function(t,n){t=e(t,n),this.stream.point(t[0],t[1])}})}function vW(e,t){function n(r,i,o,s,a,c,l,u,f,d,h,p,m,g){var y=l-r,b=u-i,x=y*y+b*b;if(x>4*t&&m--){var _=s+d,v=a+h,w=c+p,T=he(_*_+v*v+w*w),M=ve(w/=T),R=Bt(Bt(w)-1)<J||Bt(o-f)<J?(o+f)/2:We(v,_),I=e(R,M),A=I[0],O=I[1],F=A-r,S=O-i,E=b*F-y*S;(E*E/x>t||Bt((y*F+b*S)/x-.5)>.3||s*d+a*h+c*p<_W)&&(n(r,i,o,s,a,c,A,O,R,_/=T,v/=T,w,m,g),g.point(A,O),n(A,O,R,_,v,w,l,u,f,d,h,p,m,g))}}return function(r){var i,o,s,a,c,l,u,f,d,h,p,m,g={point:y,lineStart:b,lineEnd:_,polygonStart:function(){r.polygonStart(),g.lineStart=v},polygonEnd:function(){r.polygonEnd(),g.lineStart=b}};function y(M,R){M=e(M,R),r.point(M[0],M[1])}function b(){f=NaN,g.point=x,r.lineStart()}function x(M,R){var I=_o([M,R]),A=e(M,R);n(f,d,u,h,p,m,f=A[0],d=A[1],u=M,h=I[0],p=I[1],m=I[2],pL,r),r.point(f,d)}function _(){g.point=y,r.lineEnd()}function v(){b(),g.point=w,g.lineEnd=T}function w(M,R){x(i=M,R),o=f,s=d,a=h,c=p,l=m,g.point=x}function T(){n(f,d,u,h,p,m,o,s,i,a,c,l,pL,r),g.lineEnd=_,_()}return g}}var SW=Xu({point:function(e,t){this.stream.point(e*jt,t*jt)}});function IW(e){return Xu({point:function(t,n){var r=e(t,n);return this.stream.point(r[0],r[1])}})}function TW(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 mL(e,t,n,r,i,o){if(!o)return TW(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(m,g){return m*=r,g*=i,[c*m-l*g+t,n-l*m-c*g]}return p.invert=function(m,g){return[r*(u*m-f*g+d),i*(h-f*m-u*g)]},p}function Nn(e){return fI(function(){return e})()}function fI(e){var t,n=150,r=480,i=250,o=0,s=0,a=0,c=0,l=0,u,f=0,d=1,h=1,p=null,m=GS,g=null,y,b,x,_=bp,v=.5,w,T,M,R,I;function A(E){return M(E[0]*jt,E[1]*jt)}function O(E){return E=M.invert(E[0],E[1]),E&&[E[0]*Ce,E[1]*Ce]}A.stream=function(E){return R&&I===E?R:R=SW(IW(u)(m(w(_(I=E)))))},A.preclip=function(E){return arguments.length?(m=E,p=void 0,S()):m},A.postclip=function(E){return arguments.length?(_=E,g=y=b=x=null,S()):_},A.clipAngle=function(E){return arguments.length?(m=+E?HF(p=E*jt):(p=null,GS),S()):p*Ce},A.clipExtent=function(E){return arguments.length?(_=E==null?(g=y=b=x=null,bp):ju(g=+E[0][0],y=+E[0][1],b=+E[1][0],x=+E[1][1]),S()):g==null?null:[[g,y],[b,x]]},A.scale=function(E){return arguments.length?(n=+E,F()):n},A.translate=function(E){return arguments.length?(r=+E[0],i=+E[1],F()):[r,i]},A.center=function(E){return arguments.length?(o=E[0]%360*jt,s=E[1]%360*jt,F()):[o*Ce,s*Ce]},A.rotate=function(E){return arguments.length?(a=E[0]%360*jt,c=E[1]%360*jt,l=E.length>2?E[2]%360*jt:0,F()):[a*Ce,c*Ce,l*Ce]},A.angle=function(E){return arguments.length?(f=E%360*jt,F()):f*Ce},A.reflectX=function(E){return arguments.length?(d=E?-1:1,F()):d<0},A.reflectY=function(E){return arguments.length?(h=E?-1:1,F()):h<0},A.precision=function(E){return arguments.length?(w=uI(T,v=E*E),S()):he(v)},A.fitExtent=function(E,N){return Ip(A,E,N)},A.fitSize=function(E,N){return Ub(A,E,N)},A.fitWidth=function(E,N){return zb(A,E,N)},A.fitHeight=function(E,N){return qb(A,E,N)};function F(){var E=mL(n,0,0,d,h,f).apply(null,t(o,s)),N=mL(n,r-E[0],i-E[1],d,h,f);return u=VS(a,c,l),T=yp(t,N),M=yp(u,T),w=uI(T,v),S()}function S(){return R=I=null,A}return function(){return t=e.apply(this,arguments),A.invert=t.invert&&O,F()}}function Hu(e){var t=0,n=Mt/3,r=fI(e),i=r(t,n);return i.parallels=function(o){return arguments.length?r(t=o[0]*jt,n=o[1]*jt):[t*Ce,n*Ce]},i}function yL(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 gL(e,t){var n=Q(e),r=(n+Q(t))/2;if(Bt(r)<J)return yL(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))*$n(l);return l*r<0&&(u-=Mt*$n(a)*$n(l)),[u/r,ve((i-(a*a+l*l)*r*r)/(2*r))]},s}function $a(){return Hu(gL).scale(155.424).center([0,33.6442])}function Tp(){return $a().parallels([29.5,45.5]).scale(1070).translate([480,250]).rotate([96,0]).center([-.6,38.7])}function EW(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 dI(){var e,t,n=Tp(),r,i=$a().rotate([154,0]).center([-2,58.5]).parallels([55,65]),o,s=$a().rotate([157,0]).center([-3,19.9]).parallels([8,18]),a,c,l={point:function(d,h){c=[d,h]}};function u(d){var h=d[0],p=d[1];return c=null,r.point(h,p),c||(o.point(h,p),c)||(a.point(h,p),c)}u.invert=function(d){var h=n.scale(),p=n.translate(),m=(d[0]-p[0])/h,g=(d[1]-p[1])/h;return(g>=.12&&g<.234&&m>=-.425&&m<-.214?i:g>=.166&&g<.234&&m>=-.214&&m<-.115?s:n).invert(d)},u.stream=function(d){return e&&t===d?e:e=EW([n.stream(t=d),i.stream(d),s.stream(d)])},u.precision=function(d){return arguments.length?(n.precision(d),i.precision(d),s.precision(d),f()):n.precision()},u.scale=function(d){return arguments.length?(n.scale(d),i.scale(d*.35),s.scale(d),u.translate(n.translate())):n.scale()},u.translate=function(d){if(!arguments.length)return n.translate();var h=n.scale(),p=+d[0],m=+d[1];return r=n.translate(d).clipExtent([[p-.455*h,m-.238*h],[p+.455*h,m+.238*h]]).stream(l),o=i.translate([p-.307*h,m+.201*h]).clipExtent([[p-.425*h+J,m+.12*h+J],[p-.214*h-J,m+.234*h-J]]).stream(l),a=s.translate([p-.205*h,m+.212*h]).clipExtent([[p-.214*h+J,m+.166*h+J],[p-.115*h-J,m+.234*h-J]]).stream(l),f()},u.fitExtent=function(d,h){return Ip(u,d,h)},u.fitSize=function(d,h){return Ub(u,d,h)},u.fitWidth=function(d,h){return zb(u,d,h)},u.fitHeight=function(d,h){return qb(u,d,h)};function f(){return e=t=null,u}return u.scale(1070)}function jb(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 So(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 hI=jb(function(e){return he(2/(1+e))});hI.invert=So(function(e){return 2*ve(e/2)});function pI(){return Nn(hI).scale(124.75).clipAngle(180-.001)}var mI=jb(function(e){return(e=bb(e))&&e/Q(e)});mI.invert=So(function(e){return e});function yI(){return Nn(mI).scale(79.4188).clipAngle(180-.001)}function Zu(e,t){return[e,ol(Uu((de+t)/2))]}Zu.invert=function(e,t){return[e,2*li(mb(t))-de]};function gI(){return bI(Zu).scale(961/cn)}function bI(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=Mt*r(),d=t(VF(t.rotate()).invert([0,0]));return o(s==null?[[d[0]-f,d[1]-f],[d[0]+f,d[1]+f]]:e===Zu?[[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 Vb(e){return Uu((de+e)/2)}function bL(e,t){var n=K(e),r=e===t?Q(e):ol(n/K(t))/ol(Vb(t)/Vb(e)),i=n*gb(Vb(e),r)/r;if(!r)return Zu;function o(s,a){i>0?a<-de+J&&(a=-de+J):a>de-J&&(a=de-J);var c=i/gb(Vb(a),r);return[c*Q(r*s),i-c*K(r*s)]}return o.invert=function(s,a){var c=i-a,l=$n(r)*he(s*s+c*c),u=We(s,Bt(c))*$n(c);return c*r<0&&(u-=Mt*$n(s)*$n(c)),[u/r,2*li(gb(i/l,1/r))-de]},o}function xI(){return Hu(bL).scale(109.5).parallels([30,30])}function Qu(e,t){return[e,t]}Qu.invert=Qu;function _I(){return Nn(Qu).scale(152.63)}function xL(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 Qu;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))*$n(c);return c*r<0&&(l-=Mt*$n(s)*$n(c)),[l/r,i-$n(r)*he(s*s+c*c)]},o}function wI(){return Hu(xL).scale(131.154).center([0,13.9389])}var Ep=1.340264,Ap=-.081106,Mp=893e-6,Np=.003796,Yb=he(3)/2,AW=12;function vI(e,t){var n=ve(Yb*Q(t)),r=n*n,i=r*r*r;return[e*K(n)/(Yb*(Ep+3*Ap*r+i*(7*Mp+9*Np*r))),n*(Ep+Ap*r+i*(Mp+Np*r))]}vI.invert=function(e,t){for(var n=t,r=n*n,i=r*r*r,o=0,s,a,c;o<AW&&(a=n*(Ep+Ap*r+i*(Mp+Np*r))-t,c=Ep+3*Ap*r+i*(7*Mp+9*Np*r),n-=s=a/c,r=n*n,i=r*r*r,!(Bt(s)<il));++o);return[Yb*e*(Ep+3*Ap*r+i*(7*Mp+9*Np*r))/K(n),ve(Q(n)/Yb)]};function SI(){return Nn(vI).scale(177.158)}function II(e,t){var n=K(t),r=K(e)*n;return[n*Q(e)/r,Q(t)/r]}II.invert=So(li);function TI(){return Nn(II).scale(144.049).clipAngle(60)}function EI(e,t){return[K(t)*Q(e),Q(t)]}EI.invert=So(ve);function AI(){return Nn(EI).scale(249.5).clipAngle(90+J)}function MI(e,t){var n=K(t),r=1+K(e)*n;return[n*Q(e)/r,Q(t)/r]}MI.invert=So(function(e){return 2*li(e)});function NI(){return Nn(MI).scale(250).clipAngle(142)}function RI(e,t){return[ol(Uu((de+t)/2)),-e]}RI.invert=function(e,t){return[-t,2*li(mb(e))-de]};function OI(){var e=bI(RI),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 MW(e,t){return e.parent===t.parent?1:2}function NW(e){return e.reduce(RW,0)/e.length}function RW(e,t){return e+t.x}function OW(e){return 1+e.reduce(DW,0)}function DW(e,t){return Math.max(e,t.y)}function kW(e){for(var t;t=e.children;)e=t[0];return e}function FW(e){for(var t;t=e.children;)e=t[t.length-1];return e}function Gb(){var e=MW,t=1,n=1,r=!1;function i(o){var s,a=0;o.eachAfter(function(d){var h=d.children;h?(d.x=NW(h),d.y=OW(h)):(d.x=s?a+=e(d,s):0,d.y=0,s=d)});var c=kW(o),l=FW(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 LW(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 _L(){return this.eachAfter(LW)}function wL(e,t){let n=-1;for(let r of this)e.call(t,r,++n,this);return this}function vL(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 SL(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 IL(e,t){let n=-1;for(let r of this)if(e.call(t,r,++n,this))return r}function TL(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 EL(e){return this.eachBefore(function(t){t.children&&t.children.sort(e)})}function AL(e){for(var t=this,n=CW(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 CW(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 ML(){for(var e=this,t=[e];e=e.parent;)t.push(e);return t}function NL(){return Array.from(this)}function RL(){var e=[];return this.eachBefore(function(t){t.children||e.push(t)}),e}function OL(){var e=this,t=[];return e.each(function(n){n!==e&&t.push({source:n.parent,target:n})}),t}function*DL(){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 DI(e,t){e instanceof Map?(e=[void 0,e],t===void 0&&(t=$W)):t===void 0&&(t=PW);for(var n=new Ua(e),r,i=[n],o,s,a,c;r=i.pop();)if((s=t(r.data))&&(c=(s=Array.from(s)).length))for(r.children=s,a=c-1;a>=0;--a)i.push(o=s[a]=new Ua(s[a])),o.parent=r,o.depth=r.depth+1;return n.eachBefore(kI)}function BW(){return DI(this).eachBefore(UW)}function PW(e){return e.children}function $W(e){return Array.isArray(e)?e[1]:null}function UW(e){e.data.value!==void 0&&(e.value=e.data.value),e.data=e.data.data}function kI(e){var t=0;do e.height=t;while((e=e.parent)&&e.height<++t)}function Ua(e){this.data=e,this.depth=this.height=0,this.parent=null}Ua.prototype=DI.prototype={constructor:Ua,count:_L,each:wL,eachAfter:SL,eachBefore:vL,find:IL,sum:TL,sort:EL,path:AL,ancestors:ML,descendants:NL,leaves:RL,links:OL,copy:BW,[Symbol.iterator]:DL};function Wb(e){return e==null?null:zW(e)}function zW(e){if(typeof e!="function")throw new Error;return e}var qW={depth:-1},kL={},FI={};function jW(e){return e.id}function VW(e){return e.parentId}function Xb(){var e=jW,t=VW,n;function r(i){var o=Array.from(i),s=e,a=t,c,l,u,f,d,h,p,m,g=new Map;if(n!=null){let y=o.map((_,v)=>YW(n(_,v,i))),b=y.map(FL),x=new Set(y).add("");for(let _ of b)x.has(_)||(x.add(_),y.push(_),b.push(FL(_)),o.push(FI));s=(_,v)=>y[v],a=(_,v)=>b[v]}for(u=0,c=o.length;u<c;++u)l=o[u],h=o[u]=new Ua(l),(p=s(l,u,i))!=null&&(p+="")&&(m=h.id=p,g.set(m,g.has(m)?kL: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===kL)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===FI&&f.children.length===1;)f=f.children[0],--c;for(let y=o.length-1;y>=0&&(h=o[y],h.data===FI);--y)h.data=null}if(f.parent=qW,f.eachBefore(function(y){y.depth=y.parent.depth+1,--c}).eachBefore(kI),f.parent=null,c>0)throw new Error("cycle");return f}return r.id=function(i){return arguments.length?(e=Wb(i),r):e},r.parentId=function(i){return arguments.length?(t=Wb(i),r):t},r.path=function(i){return arguments.length?(n=Wb(i),r):n},r}function YW(e){e=`${e}`;let t=e.length;return LI(e,t-1)&&!LI(e,t-2)&&(e=e.slice(0,-1)),e[0]==="/"?e:`/${e}`}function FL(e){let t=e.length;if(t<2)return"";for(;--t>1&&!LI(e,t););return e.slice(0,t)}function LI(e,t){if(e[t]==="/"){let n=0;for(;t>0&&e[--t]==="\\";)++n;if(!(n&1))return!0}return!1}function GW(e,t){return e.parent===t.parent?1:2}function CI(e){var t=e.children;return t?t[0]:e.t}function BI(e){var t=e.children;return t?t[t.length-1]:e.t}function WW(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 XW(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 HW(e,t,n){return e.a.parent===t.parent?e.a:n}function Hb(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}Hb.prototype=Object.create(Ua.prototype);function ZW(e){for(var t=new Hb(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 Hb(o[s],s)),i.parent=n;return(t.parent=new Hb(null,0)).children=[t],t}function cl(){var e=GW,t=1,n=1,r=null;function i(l){var u=ZW(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(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,m=p-f.x,g=t/(d.x+p+m),y=n/(h.depth||1);l.eachBefore(function(b){b.x=(b.x+m)*g,b.y=b.depth*y})}return l}function o(l){var u=l.children,f=l.parent.children,d=l.i?f[l.i-1]:null;if(u){XW(l);var h=(u[0].z+u[u.length-1].z)/2;d?(l.z=d.z+e(l._,d._),l.m=l.z-h):l.z=h}else d&&(l.z=d.z+e(l._,d._));l.parent.A=a(l,d,l.parent.A||f[0])}function s(l){l._.x=l.z+l.parent.m,l.m+=l.parent.m}function a(l,u,f){if(u){for(var d=l,h=l,p=u,m=d.parent.children[0],g=d.m,y=h.m,b=p.m,x=m.m,_;p=BI(p),d=CI(d),p&&d;)m=CI(m),h=BI(h),h.a=l,_=p.z+b-d.z-g+e(p._,d._),_>0&&(WW(HW(p,l,f),l,_),g+=_,y+=_),b+=p.m,g+=d.m,x+=m.m,y+=h.m;p&&!BI(h)&&(h.t=p,h.m+=b-y),d&&!CI(m)&&(m.t=d,m.m+=g-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 LL=23283064365386963e-26;function ll(e=Math.random()){let t=(0<=e&&e<1?e/LL:Math.abs(e))|0;return()=>(t=1664525*t+1013904223|0,LL*(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 Rp(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 Op=Symbol("implicit");function ul(){var e=new Zn,t=[],n=[],r=Op;function i(o){let s=e.get(o);if(s===void 0){if(r!==Op)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 Zn;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 ul(t,n).unknown(r)},He.apply(i,arguments),i}function za(){var e=ul().unknown(void 0),t=e.domain,n=e.range,r=0,i=1,o,s,a=!1,c=0,l=0,u=.5;delete e.unknown;function f(){var d=t().length,h=i<r,p=h?i:r,m=h?r:i;o=(m-p)/Math.max(1,d-c+l*2),a&&(o=Math.floor(o)),p+=(m-p-o*(d-c))*u,s=o*(1-c),a&&(p=Math.round(p),s=Math.round(s));var g=$e(d).map(function(y){return p+o*y});return n(h?g.reverse():g)}return e.domain=function(d){return arguments.length?(t(d),f()):t()},e.range=function(d){return arguments.length?([r,i]=d,r=+r,i=+i,f()):[r,i]},e.rangeRound=function(d){return[r,i]=d,r=+r,i=+i,a=!0,f()},e.bandwidth=function(){return s},e.step=function(){return o},e.round=function(d){return arguments.length?(a=!!d,f()):a},e.padding=function(d){return arguments.length?(c=Math.min(1,l=+d),f()):c},e.paddingInner=function(d){return arguments.length?(c=Math.min(1,d),f()):c},e.paddingOuter=function(d){return arguments.length?(l=+d,f()):l},e.align=function(d){return arguments.length?(u=Math.max(0,Math.min(1,d)),f()):u},e.copy=function(){return za(t(),[r,i]).round(a).paddingInner(c).paddingOuter(l).align(u)},He.apply(f(),arguments)}function CL(e){var t=e.copy;return e.padding=e.paddingOuter,delete e.paddingInner,delete e.paddingOuter,e.copy=function(){return CL(t())},e}function PI(){return CL(za.apply(null,arguments).paddingInner(1))}function $I(e){return function(){return e}}function Ku(e){return+e}var BL=[0,1];function xr(e){return e}function UI(e,t){return(t-=e=+e)?function(n){return(n-e)/t}:$I(isNaN(t)?NaN:.5)}function QW(e,t){var n;return e>t&&(n=e,e=t,t=n),function(r){return Math.max(e,Math.min(t,r))}}function KW(e,t,n){var r=e[0],i=e[1],o=t[0],s=t[1];return i<r?(r=UI(i,r),o=n(s,o)):(r=UI(r,i),o=n(o,s)),function(a){return o(r(a))}}function JW(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]=UI(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 Io(e,t){return t.domain(e.domain()).range(e.range()).interpolate(e.interpolate()).clamp(e.clamp()).unknown(e.unknown())}function fl(){var e=BL,t=BL,n=Cr,r,i,o,s=xr,a,c,l;function u(){var d=Math.min(e.length,t.length);return s!==xr&&(s=QW(e[0],e[d-1])),a=d>2?JW:KW,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,Ku),u()):e.slice()},f.range=function(d){return arguments.length?(t=Array.from(d),u()):t.slice()},f.rangeRound=function(d){return t=Array.from(d),n=Kc,u()},f.clamp=function(d){return arguments.length?(s=d?!0:xr,u()):s!==xr},f.interpolate=function(d){return arguments.length?(n=d,u()):n},f.unknown=function(d){return arguments.length?(o=d,f):o},function(d,h){return r=d,i=h,u()}}function Dp(){return fl()(xr,xr)}function zI(e,t,n,r){var i=wu(e,t,n),o;switch(r=xo(r??",f"),r.type){case"s":{var s=Math.max(Math.abs(e),Math.abs(t));return r.precision==null&&!isNaN(o=FS(i,s))&&(r.precision=o),pb(r,s)}case"":case"e":case"g":case"p":case"r":{r.precision==null&&!isNaN(o=LS(i,Math.max(Math.abs(e),Math.abs(t))))&&(r.precision=o-(r.type==="e"));break}case"f":case"%":{r.precision==null&&!isNaN(o=kS(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 zI(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=Dp();return e.copy=function(){return Io(e,ks())},He.apply(e,arguments),Ds(e)}function kp(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,Ku),n):e.slice()},n.unknown=function(r){return arguments.length?(t=r,n):t},n.copy=function(){return kp(e).unknown(t)},e=arguments.length?Array.from(e,Ku):[0,1],Ds(n)}function Fp(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 $L(e){return Math.exp(e)}function tX(e){return-Math.log(-e)}function eX(e){return-Math.exp(-e)}function nX(e){return isFinite(e)?+("1e"+e):e<0?0:e}function rX(e){return e===10?nX:e===Math.E?Math.exp:t=>Math.pow(e,t)}function iX(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 UL(e){return(t,n)=>-e(-t,n)}function qI(e){let t=e(PL,$L),n=t.domain,r=10,i,o;function s(){return i=iX(r),o=rX(r),n()[0]<0?(i=UL(i),o=UL(o),e(tX,eX)):e(PL,$L),t}return t.base=function(a){return arguments.length?(r=+a,s()):r},t.domain=function(a){return arguments.length?(n(a),s()):n()},t.ticks=a=>{let c=n(),l=c[0],u=c[c.length-1],f=u<l;f&&([l,u]=[u,l]);let d=i(l),h=i(u),p,m,g=a==null?10:+a,y=[];if(!(r%1)&&h-d<g){if(d=Math.floor(d),h=Math.ceil(h),l>0){for(;d<=h;++d)for(p=1;p<r;++p)if(m=d<0?p/o(-d):p*o(d),!(m<l)){if(m>u)break;y.push(m)}}else for(;d<=h;++d)for(p=r-1;p>=1;--p)if(m=d>0?p/o(-d):p*o(d),!(m<l)){if(m>u)break;y.push(m)}y.length*2<g&&(y=Tn(l,u,g))}else y=Tn(d,h,Math.min(h-d,g)).map(o);return f?y.reverse():y},t.tickFormat=(a,c)=>{if(a==null&&(a=10),c==null&&(c=r===10?"s":","),typeof c!="function"&&(!(r%1)&&(c=xo(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(Fp(n(),{floor:a=>o(Math.floor(i(a))),ceil:a=>o(Math.ceil(i(a)))})),t}function Lp(){let e=qI(fl()).domain([1,10]);return e.copy=()=>Io(e,Lp()).base(e.base()),He.apply(e,arguments),e}function zL(e){return function(t){return Math.sign(t)*Math.log1p(Math.abs(t/e))}}function qL(e){return function(t){return Math.sign(t)*Math.expm1(Math.abs(t))*e}}function jI(e){var t=1,n=e(zL(t),qL(t));return n.constant=function(r){return arguments.length?e(zL(t=+r),qL(t)):t},Ds(n)}function Cp(){var e=jI(fl());return e.copy=function(){return Io(e,Cp()).constant(e.constant())},He.apply(e,arguments)}function jL(e){return function(t){return t<0?-Math.pow(-t,e):Math.pow(t,e)}}function oX(e){return e<0?-Math.sqrt(-e):Math.sqrt(e)}function sX(e){return e<0?-e*e:e*e}function VI(e){var t=e(xr,xr),n=1;function r(){return n===1?e(xr,xr):n===.5?e(oX,sX):e(jL(n),jL(1/n))}return t.exponent=function(i){return arguments.length?(n=+i,r()):n},Ds(t)}function Bp(){var e=VI(fl());return e.copy=function(){return Io(e,Bp()).exponent(e.exponent())},He.apply(e,arguments),e}function Pp(){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]=j2(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(Ut),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 Pp().domain(e).range(t).unknown(r)},He.apply(o,arguments)}function $p(){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 $p().domain(e).range(t).unknown(n)},He.apply(i,arguments)}var YI=new Date,GI=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)=>(YI.setTime(+o),GI.setTime(+s),e(YI),e(GI),Math.floor(n(YI,GI))),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 qAt=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()),VL=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()),aX=Fs.range,Ls=pe(e=>{e.setUTCSeconds(0,0)},(e,t)=>{e.setTime(+e+t*6e4)},(e,t)=>(t-e)/6e4,e=>e.getUTCMinutes()),cX=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()),lX=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()),uX=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),fX=ui.range,pl=pe(e=>{e.setUTCHours(0,0,0,0)},(e,t)=>{e.setUTCDate(e.getUTCDate()+t)},(e,t)=>(t-e)/864e5,e=>e.getUTCDate()-1),dX=pl.range,ml=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)),hX=ml.range;function yl(e){return pe(t=>{t.setDate(t.getDate()-(t.getDay()+7-e)%7),t.setHours(0,0,0,0)},(t,n)=>{t.setDate(t.getDate()+n*7)},(t,n)=>(n-t-(n.getTimezoneOffset()-t.getTimezoneOffset())*6e4)/6048e5)}var Pr=yl(0),qa=yl(1),Zb=yl(2),Qb=yl(3),Eo=yl(4),Kb=yl(5),Jb=yl(6),GL=Pr.range,pX=qa.range,mX=Zb.range,yX=Qb.range,gX=Eo.range,bX=Kb.range,xX=Jb.range;function gl(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 $r=gl(0),ja=gl(1),tx=gl(2),ex=gl(3),Ao=gl(4),nx=gl(5),rx=gl(6),WL=$r.range,_X=ja.range,wX=tx.range,vX=ex.range,SX=Ao.range,IX=nx.range,TX=rx.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()),EX=Ps.range,$s=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()),AX=$s.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 MX=Un.range,zn=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());zn.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 NX=zn.range;function HL(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(([,,g])=>g).right(s,d);if(h===s.length)return e.every(wu(l/31536e6,u/31536e6,f));if(h===0)return Up.every(Math.max(wu(l,u,f),1));let[p,m]=s[d/s[h-1][2]<s[h][2]/d?h-1:h];return p.every(m)}return[a,c]}var[WI,qp]=HL(zn,$s,$r,ml,Bs,Ls),[XI,HI]=HL(Un,Ps,Pr,ui,Cs,Fs);function ZI(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 QI(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 jp(e,t,n){return{y:e,m:t,d:n,H:0,M:0,S:0,L:0}}function KI(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=Vp(i),u=Yp(i),f=Vp(o),d=Yp(o),h=Vp(s),p=Yp(s),m=Vp(a),g=Yp(a),y=Vp(c),b=Yp(c),x={a:L,A:B,b:C,B:P,c:null,d:eC,e:eC,f:JX,g:lH,G:fH,H:ZX,I:QX,j:KX,L:sC,m:tH,M:eH,p:$,q:U,Q:iC,s:oC,S:nH,u:rH,U:iH,V:oH,w:sH,W:aH,x:null,X:null,y:cH,Y:uH,Z:dH,"%":rC},_={a:X,A:tt,b:nt,B:st,c:null,d:nC,e:nC,f:yH,g:EH,G:MH,H:hH,I:pH,j:mH,L:cC,m:gH,M:bH,p:Y,q:rt,Q:iC,s:oC,S:xH,u:_H,U:wH,V:vH,w:SH,W:IH,x:null,X:null,y:TH,Y:AH,Z:NH,"%":rC},v={a:I,A,b:O,B:F,c:S,d:JL,e:JL,f:GX,g:KL,G:QL,H:tC,I:tC,j:qX,L:YX,m:zX,M:jX,p:R,q:UX,Q:XX,s:HX,S:VX,u:LX,U:CX,V:BX,w:FX,W:PX,x:E,X:N,y:KL,Y:QL,Z:$X,"%":WX};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=ZL[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=jp(1900,void 0,1),Lt=M(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=QI(jp(z.y,0,1)),Wt=dt.getUTCDay(),dt=Wt>4||Wt===0?ja.ceil(dt):ja(dt),dt=pl.offset(dt,(z.V-1)*7),z.y=dt.getUTCFullYear(),z.m=dt.getUTCMonth(),z.d=dt.getUTCDate()+(z.w+6)%7):(dt=ZI(jp(z.y,0,1)),Wt=dt.getDay(),dt=Wt>4||Wt===0?qa.ceil(dt):qa(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?QI(jp(z.y,0,1)).getUTCDay():ZI(jp(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,QI(z)):ZI(z)}}function M(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 ZL?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 A(q,H,ot){var z=f.exec(H.slice(ot));return z?(q.w=d.get(z[0].toLowerCase()),ot+z[0].length):-1}function O(q,H,ot){var z=y.exec(H.slice(ot));return z?(q.m=b.get(z[0].toLowerCase()),ot+z[0].length):-1}function F(q,H,ot){var z=m.exec(H.slice(ot));return z?(q.m=g.get(z[0].toLowerCase()),ot+z[0].length):-1}function S(q,H,ot){return M(q,t,H,ot)}function E(q,H,ot){return M(q,n,H,ot)}function N(q,H,ot){return M(q,r,H,ot)}function L(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 $(q){return i[+(q.getHours()>=12)]}function U(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 ZL={"-":"",_:" ",0:"0"},un=/^\s*\d+/,OX=/^%/,DX=/[\\^$*+?|[\]().{}]/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 kX(e){return e.replace(DX,"\\$&")}function Vp(e){return new RegExp("^(?:"+e.map(kX).join("|")+")","i")}function Yp(e){return new Map(e.map((t,n)=>[t.toLowerCase(),n]))}function FX(e,t,n){var r=un.exec(t.slice(n,n+1));return r?(e.w=+r[0],n+r[0].length):-1}function LX(e,t,n){var r=un.exec(t.slice(n,n+1));return r?(e.u=+r[0],n+r[0].length):-1}function CX(e,t,n){var r=un.exec(t.slice(n,n+2));return r?(e.U=+r[0],n+r[0].length):-1}function BX(e,t,n){var r=un.exec(t.slice(n,n+2));return r?(e.V=+r[0],n+r[0].length):-1}function PX(e,t,n){var r=un.exec(t.slice(n,n+2));return r?(e.W=+r[0],n+r[0].length):-1}function QL(e,t,n){var r=un.exec(t.slice(n,n+4));return r?(e.y=+r[0],n+r[0].length):-1}function KL(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 $X(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 UX(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 zX(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 JL(e,t,n){var r=un.exec(t.slice(n,n+2));return r?(e.d=+r[0],n+r[0].length):-1}function qX(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 tC(e,t,n){var r=un.exec(t.slice(n,n+2));return r?(e.H=+r[0],n+r[0].length):-1}function jX(e,t,n){var r=un.exec(t.slice(n,n+2));return r?(e.M=+r[0],n+r[0].length):-1}function VX(e,t,n){var r=un.exec(t.slice(n,n+2));return r?(e.S=+r[0],n+r[0].length):-1}function YX(e,t,n){var r=un.exec(t.slice(n,n+3));return r?(e.L=+r[0],n+r[0].length):-1}function GX(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 WX(e,t,n){var r=OX.exec(t.slice(n,n+1));return r?n+r[0].length:-1}function XX(e,t,n){var r=un.exec(t.slice(n));return r?(e.Q=+r[0],n+r[0].length):-1}function HX(e,t,n){var r=un.exec(t.slice(n));return r?(e.s=+r[0],n+r[0].length):-1}function eC(e,t){return te(e.getDate(),t,2)}function ZX(e,t){return te(e.getHours(),t,2)}function QX(e,t){return te(e.getHours()%12||12,t,2)}function KX(e,t){return te(1+ui.count(Un(e),e),t,3)}function sC(e,t){return te(e.getMilliseconds(),t,3)}function JX(e,t){return sC(e,t)+"000"}function tH(e,t){return te(e.getMonth()+1,t,2)}function eH(e,t){return te(e.getMinutes(),t,2)}function nH(e,t){return te(e.getSeconds(),t,2)}function rH(e){var t=e.getDay();return t===0?7:t}function iH(e,t){return te(Pr.count(Un(e)-1,e),t,2)}function aC(e){var t=e.getDay();return t>=4||t===0?Eo(e):Eo.ceil(e)}function oH(e,t){return e=aC(e),te(Eo.count(Un(e),e)+(Un(e).getDay()===4),t,2)}function sH(e){return e.getDay()}function aH(e,t){return te(qa.count(Un(e)-1,e),t,2)}function cH(e,t){return te(e.getFullYear()%100,t,2)}function lH(e,t){return e=aC(e),te(e.getFullYear()%100,t,2)}function uH(e,t){return te(e.getFullYear()%1e4,t,4)}function fH(e,t){var n=e.getDay();return e=n>=4||n===0?Eo(e):Eo.ceil(e),te(e.getFullYear()%1e4,t,4)}function dH(e){var t=e.getTimezoneOffset();return(t>0?"-":(t*=-1,"+"))+te(t/60|0,"0",2)+te(t%60,"0",2)}function nC(e,t){return te(e.getUTCDate(),t,2)}function hH(e,t){return te(e.getUTCHours(),t,2)}function pH(e,t){return te(e.getUTCHours()%12||12,t,2)}function mH(e,t){return te(1+pl.count(zn(e),e),t,3)}function cC(e,t){return te(e.getUTCMilliseconds(),t,3)}function yH(e,t){return cC(e,t)+"000"}function gH(e,t){return te(e.getUTCMonth()+1,t,2)}function bH(e,t){return te(e.getUTCMinutes(),t,2)}function xH(e,t){return te(e.getUTCSeconds(),t,2)}function _H(e){var t=e.getUTCDay();return t===0?7:t}function wH(e,t){return te($r.count(zn(e)-1,e),t,2)}function lC(e){var t=e.getUTCDay();return t>=4||t===0?Ao(e):Ao.ceil(e)}function vH(e,t){return e=lC(e),te(Ao.count(zn(e),e)+(zn(e).getUTCDay()===4),t,2)}function SH(e){return e.getUTCDay()}function IH(e,t){return te(ja.count(zn(e)-1,e),t,2)}function TH(e,t){return te(e.getUTCFullYear()%100,t,2)}function EH(e,t){return e=lC(e),te(e.getUTCFullYear()%100,t,2)}function AH(e,t){return te(e.getUTCFullYear()%1e4,t,4)}function MH(e,t){var n=e.getUTCDay();return e=n>=4||n===0?Ao(e):Ao.ceil(e),te(e.getUTCFullYear()%1e4,t,4)}function NH(){return"+0000"}function rC(){return"%"}function iC(e){return+e}function oC(e){return Math.floor(+e/1e3)}var Ju,tf,uC,Mo,fC;JI({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 JI(e){return Ju=KI(e),tf=Ju.format,uC=Ju.parse,Mo=Ju.utcFormat,fC=Ju.utcParse,Ju}function RH(e){return new Date(e)}function OH(e){return e instanceof Date?+e:+new Date(+e)}function ix(e,t,n,r,i,o,s,a,c,l){var u=Dp(),f=u.invert,d=u.domain,h=l(".%L"),p=l(":%S"),m=l("%I:%M"),g=l("%I %p"),y=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?m:o(w)<w?g:r(w)<w?i(w)<w?y:b: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,OH)):d().map(RH)},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(Fp(T,w)):u},u.copy=function(){return Io(u,ix(e,t,n,r,i,o,s,a,c,l))},u}function ox(){return He.apply(ix(XI,HI,Un,Ps,Pr,ui,Cs,Fs,ln,tf).domain([new Date(2e3,0,1),new Date(2e3,0,2)]),arguments)}function sx(){return He.apply(ix(WI,qp,zn,$s,$r,pl,Bs,Ls,ln,Mo).domain([Date.UTC(2e3,0,1),Date.UTC(2e3,0,2)]),arguments)}function Gp(e,t){return t.domain(e.domain()).interpolator(e.interpolator()).clamp(e.clamp()).unknown(e.unknown())}function ax(){var e=0,t=.5,n=1,r=1,i,o,s,a,c,l=xr,u,f=!1,d;function h(m){return isNaN(m=+m)?d:(m=.5+((m=+u(m))-o)*(r*m<r*o?a:c),l(f?Math.max(0,Math.min(1,m)):m))}h.domain=function(m){return arguments.length?([e,t,n]=m,i=u(e=+e),o=u(t=+t),s=u(n=+n),a=i===o?0:.5/(o-i),c=o===s?0:.5/(s-o),r=o<i?-1:1,h):[e,t,n]},h.clamp=function(m){return arguments.length?(f=!!m,h):f},h.interpolator=function(m){return arguments.length?(l=m,h):l};function p(m){return function(g){var y,b,x;return arguments.length?([y,b,x]=g,l=mo(m,[y,b,x]),h):[l(0),l(.5),l(1)]}}return h.range=p(Cr),h.rangeRound=p(Kc),h.unknown=function(m){return arguments.length?(d=m,h):d},function(m){return u=m,i=m(e),o=m(t),s=m(n),a=i===o?0:.5/(o-i),c=o===s?0:.5/(s-o),r=o<i?-1:1,h}}function Wp(){var e=Ds(ax()(xr));return e.copy=function(){return Gp(e,Wp())},Rp.apply(e,arguments)}function cx(){var e=qI(ax()).domain([.1,1,10]);return e.copy=function(){return Gp(e,cx()).base(e.base())},Rp.apply(e,arguments)}function lx(){var e=jI(ax());return e.copy=function(){return Gp(e,lx()).constant(e.constant())},Rp.apply(e,arguments)}function ux(){var e=VI(ax());return e.copy=function(){return Gp(e,ux()).exponent(e.exponent())},Rp.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 tT=G("1f77b4ff7f0e2ca02cd627289467bd8c564be377c27f7f7fbcbd2217becf");var eT=G("7fc97fbeaed4fdc086ffff99386cb0f0027fbf5b17666666");var nT=G("1b9e77d95f027570b3e7298a66a61ee6ab02a6761d666666");var rT=G("a6cee31f78b4b2df8a33a02cfb9a99e31a1cfdbf6fff7f00cab2d66a3d9affff99b15928");var iT=G("fbb4aeb3cde3ccebc5decbe4fed9a6ffffcce5d8bdfddaecf2f2f2");var oT=G("b3e2cdfdcdaccbd5e8f4cae4e6f5c9fff2aef1e2cccccccc");var sT=G("e41a1c377eb84daf4a984ea3ff7f00ffff33a65628f781bf999999");var aT=G("66c2a5fc8d628da0cbe78ac3a6d854ffd92fe5c494b3b3b3");var cT=G("8dd3c7ffffb3bebadafb807280b1d3fdb462b3de69fccde5d9d9d9bc80bdccebc5ffed6f");var lT=G("4e79a7f28e2ce1575976b7b259a14fedc949af7aa1ff9da79c755fbab0ab");var ht=e=>oS(e[e.length-1]);var fx=new Array(3).concat("d8b365f5f5f55ab4ac","a6611adfc27d80cdc1018571","a6611adfc27df5f5f580cdc1018571","8c510ad8b365f6e8c3c7eae55ab4ac01665e","8c510ad8b365f6e8c3f5f5f5c7eae55ab4ac01665e","8c510abf812ddfc27df6e8c3c7eae580cdc135978f01665e","8c510abf812ddfc27df6e8c3f5f5f5c7eae580cdc135978f01665e","5430058c510abf812ddfc27df6e8c3c7eae580cdc135978f01665e003c30","5430058c510abf812ddfc27df6e8c3f5f5f5c7eae580cdc135978f01665e003c30").map(G),dx=ht(fx);var hx=new Array(3).concat("af8dc3f7f7f77fbf7b","7b3294c2a5cfa6dba0008837","7b3294c2a5cff7f7f7a6dba0008837","762a83af8dc3e7d4e8d9f0d37fbf7b1b7837","762a83af8dc3e7d4e8f7f7f7d9f0d37fbf7b1b7837","762a839970abc2a5cfe7d4e8d9f0d3a6dba05aae611b7837","762a839970abc2a5cfe7d4e8f7f7f7d9f0d3a6dba05aae611b7837","40004b762a839970abc2a5cfe7d4e8d9f0d3a6dba05aae611b783700441b","40004b762a839970abc2a5cfe7d4e8f7f7f7d9f0d3a6dba05aae611b783700441b").map(G),px=ht(hx);var mx=new Array(3).concat("e9a3c9f7f7f7a1d76a","d01c8bf1b6dab8e1864dac26","d01c8bf1b6daf7f7f7b8e1864dac26","c51b7de9a3c9fde0efe6f5d0a1d76a4d9221","c51b7de9a3c9fde0eff7f7f7e6f5d0a1d76a4d9221","c51b7dde77aef1b6dafde0efe6f5d0b8e1867fbc414d9221","c51b7dde77aef1b6dafde0eff7f7f7e6f5d0b8e1867fbc414d9221","8e0152c51b7dde77aef1b6dafde0efe6f5d0b8e1867fbc414d9221276419","8e0152c51b7dde77aef1b6dafde0eff7f7f7e6f5d0b8e1867fbc414d9221276419").map(G),yx=ht(mx);var gx=new Array(3).concat("998ec3f7f7f7f1a340","5e3c99b2abd2fdb863e66101","5e3c99b2abd2f7f7f7fdb863e66101","542788998ec3d8daebfee0b6f1a340b35806","542788998ec3d8daebf7f7f7fee0b6f1a340b35806","5427888073acb2abd2d8daebfee0b6fdb863e08214b35806","5427888073acb2abd2d8daebf7f7f7fee0b6fdb863e08214b35806","2d004b5427888073acb2abd2d8daebfee0b6fdb863e08214b358067f3b08","2d004b5427888073acb2abd2d8daebf7f7f7fee0b6fdb863e08214b358067f3b08").map(G),bx=ht(gx);var Xp=new Array(3).concat("ef8a62f7f7f767a9cf","ca0020f4a58292c5de0571b0","ca0020f4a582f7f7f792c5de0571b0","b2182bef8a62fddbc7d1e5f067a9cf2166ac","b2182bef8a62fddbc7f7f7f7d1e5f067a9cf2166ac","b2182bd6604df4a582fddbc7d1e5f092c5de4393c32166ac","b2182bd6604df4a582fddbc7f7f7f7d1e5f092c5de4393c32166ac","67001fb2182bd6604df4a582fddbc7d1e5f092c5de4393c32166ac053061","67001fb2182bd6604df4a582fddbc7f7f7f7d1e5f092c5de4393c32166ac053061").map(G),ef=ht(Xp);var xx=new Array(3).concat("ef8a62ffffff999999","ca0020f4a582bababa404040","ca0020f4a582ffffffbababa404040","b2182bef8a62fddbc7e0e0e09999994d4d4d","b2182bef8a62fddbc7ffffffe0e0e09999994d4d4d","b2182bd6604df4a582fddbc7e0e0e0bababa8787874d4d4d","b2182bd6604df4a582fddbc7ffffffe0e0e0bababa8787874d4d4d","67001fb2182bd6604df4a582fddbc7e0e0e0bababa8787874d4d4d1a1a1a","67001fb2182bd6604df4a582fddbc7ffffffe0e0e0bababa8787874d4d4d1a1a1a").map(G),_x=ht(xx);var Hp=new Array(3).concat("fc8d59ffffbf91bfdb","d7191cfdae61abd9e92c7bb6","d7191cfdae61ffffbfabd9e92c7bb6","d73027fc8d59fee090e0f3f891bfdb4575b4","d73027fc8d59fee090ffffbfe0f3f891bfdb4575b4","d73027f46d43fdae61fee090e0f3f8abd9e974add14575b4","d73027f46d43fdae61fee090ffffbfe0f3f8abd9e974add14575b4","a50026d73027f46d43fdae61fee090e0f3f8abd9e974add14575b4313695","a50026d73027f46d43fdae61fee090ffffbfe0f3f8abd9e974add14575b4313695").map(G),nf=ht(Hp);var wx=new Array(3).concat("fc8d59ffffbf91cf60","d7191cfdae61a6d96a1a9641","d7191cfdae61ffffbfa6d96a1a9641","d73027fc8d59fee08bd9ef8b91cf601a9850","d73027fc8d59fee08bffffbfd9ef8b91cf601a9850","d73027f46d43fdae61fee08bd9ef8ba6d96a66bd631a9850","d73027f46d43fdae61fee08bffffbfd9ef8ba6d96a66bd631a9850","a50026d73027f46d43fdae61fee08bd9ef8ba6d96a66bd631a9850006837","a50026d73027f46d43fdae61fee08bffffbfd9ef8ba6d96a66bd631a9850006837").map(G),vx=ht(wx);var Sx=new Array(3).concat("fc8d59ffffbf99d594","d7191cfdae61abdda42b83ba","d7191cfdae61ffffbfabdda42b83ba","d53e4ffc8d59fee08be6f59899d5943288bd","d53e4ffc8d59fee08bffffbfe6f59899d5943288bd","d53e4ff46d43fdae61fee08be6f598abdda466c2a53288bd","d53e4ff46d43fdae61fee08bffffbfe6f598abdda466c2a53288bd","9e0142d53e4ff46d43fdae61fee08be6f598abdda466c2a53288bd5e4fa2","9e0142d53e4ff46d43fdae61fee08bffffbfe6f598abdda466c2a53288bd5e4fa2").map(G),Ix=ht(Sx);var Tx=new Array(3).concat("e5f5f999d8c92ca25f","edf8fbb2e2e266c2a4238b45","edf8fbb2e2e266c2a42ca25f006d2c","edf8fbccece699d8c966c2a42ca25f006d2c","edf8fbccece699d8c966c2a441ae76238b45005824","f7fcfde5f5f9ccece699d8c966c2a441ae76238b45005824","f7fcfde5f5f9ccece699d8c966c2a441ae76238b45006d2c00441b").map(G),Ex=ht(Tx);var Ax=new Array(3).concat("e0ecf49ebcda8856a7","edf8fbb3cde38c96c688419d","edf8fbb3cde38c96c68856a7810f7c","edf8fbbfd3e69ebcda8c96c68856a7810f7c","edf8fbbfd3e69ebcda8c96c68c6bb188419d6e016b","f7fcfde0ecf4bfd3e69ebcda8c96c68c6bb188419d6e016b","f7fcfde0ecf4bfd3e69ebcda8c96c68c6bb188419d810f7c4d004b").map(G),Mx=ht(Ax);var Nx=new Array(3).concat("e0f3dba8ddb543a2ca","f0f9e8bae4bc7bccc42b8cbe","f0f9e8bae4bc7bccc443a2ca0868ac","f0f9e8ccebc5a8ddb57bccc443a2ca0868ac","f0f9e8ccebc5a8ddb57bccc44eb3d32b8cbe08589e","f7fcf0e0f3dbccebc5a8ddb57bccc44eb3d32b8cbe08589e","f7fcf0e0f3dbccebc5a8ddb57bccc44eb3d32b8cbe0868ac084081").map(G),Rx=ht(Nx);var Ox=new Array(3).concat("fee8c8fdbb84e34a33","fef0d9fdcc8afc8d59d7301f","fef0d9fdcc8afc8d59e34a33b30000","fef0d9fdd49efdbb84fc8d59e34a33b30000","fef0d9fdd49efdbb84fc8d59ef6548d7301f990000","fff7ecfee8c8fdd49efdbb84fc8d59ef6548d7301f990000","fff7ecfee8c8fdd49efdbb84fc8d59ef6548d7301fb300007f0000").map(G),Dx=ht(Ox);var kx=new Array(3).concat("ece2f0a6bddb1c9099","f6eff7bdc9e167a9cf02818a","f6eff7bdc9e167a9cf1c9099016c59","f6eff7d0d1e6a6bddb67a9cf1c9099016c59","f6eff7d0d1e6a6bddb67a9cf3690c002818a016450","fff7fbece2f0d0d1e6a6bddb67a9cf3690c002818a016450","fff7fbece2f0d0d1e6a6bddb67a9cf3690c002818a016c59014636").map(G),Fx=ht(kx);var Lx=new Array(3).concat("ece7f2a6bddb2b8cbe","f1eef6bdc9e174a9cf0570b0","f1eef6bdc9e174a9cf2b8cbe045a8d","f1eef6d0d1e6a6bddb74a9cf2b8cbe045a8d","f1eef6d0d1e6a6bddb74a9cf3690c00570b0034e7b","fff7fbece7f2d0d1e6a6bddb74a9cf3690c00570b0034e7b","fff7fbece7f2d0d1e6a6bddb74a9cf3690c00570b0045a8d023858").map(G),Cx=ht(Lx);var Bx=new Array(3).concat("e7e1efc994c7dd1c77","f1eef6d7b5d8df65b0ce1256","f1eef6d7b5d8df65b0dd1c77980043","f1eef6d4b9dac994c7df65b0dd1c77980043","f1eef6d4b9dac994c7df65b0e7298ace125691003f","f7f4f9e7e1efd4b9dac994c7df65b0e7298ace125691003f","f7f4f9e7e1efd4b9dac994c7df65b0e7298ace125698004367001f").map(G),Px=ht(Bx);var $x=new Array(3).concat("fde0ddfa9fb5c51b8a","feebe2fbb4b9f768a1ae017e","feebe2fbb4b9f768a1c51b8a7a0177","feebe2fcc5c0fa9fb5f768a1c51b8a7a0177","feebe2fcc5c0fa9fb5f768a1dd3497ae017e7a0177","fff7f3fde0ddfcc5c0fa9fb5f768a1dd3497ae017e7a0177","fff7f3fde0ddfcc5c0fa9fb5f768a1dd3497ae017e7a017749006a").map(G),Ux=ht($x);var zx=new Array(3).concat("edf8b17fcdbb2c7fb8","ffffcca1dab441b6c4225ea8","ffffcca1dab441b6c42c7fb8253494","ffffccc7e9b47fcdbb41b6c42c7fb8253494","ffffccc7e9b47fcdbb41b6c41d91c0225ea80c2c84","ffffd9edf8b1c7e9b47fcdbb41b6c41d91c0225ea80c2c84","ffffd9edf8b1c7e9b47fcdbb41b6c41d91c0225ea8253494081d58").map(G),qx=ht(zx);var jx=new Array(3).concat("f7fcb9addd8e31a354","ffffccc2e69978c679238443","ffffccc2e69978c67931a354006837","ffffccd9f0a3addd8e78c67931a354006837","ffffccd9f0a3addd8e78c67941ab5d238443005a32","ffffe5f7fcb9d9f0a3addd8e78c67941ab5d238443005a32","ffffe5f7fcb9d9f0a3addd8e78c67941ab5d238443006837004529").map(G),Vx=ht(jx);var Yx=new Array(3).concat("fff7bcfec44fd95f0e","ffffd4fed98efe9929cc4c02","ffffd4fed98efe9929d95f0e993404","ffffd4fee391fec44ffe9929d95f0e993404","ffffd4fee391fec44ffe9929ec7014cc4c028c2d04","ffffe5fff7bcfee391fec44ffe9929ec7014cc4c028c2d04","ffffe5fff7bcfee391fec44ffe9929ec7014cc4c02993404662506").map(G),Gx=ht(Yx);var Wx=new Array(3).concat("ffeda0feb24cf03b20","ffffb2fecc5cfd8d3ce31a1c","ffffb2fecc5cfd8d3cf03b20bd0026","ffffb2fed976feb24cfd8d3cf03b20bd0026","ffffb2fed976feb24cfd8d3cfc4e2ae31a1cb10026","ffffccffeda0fed976feb24cfd8d3cfc4e2ae31a1cb10026","ffffccffeda0fed976feb24cfd8d3cfc4e2ae31a1cbd0026800026").map(G),Xx=ht(Wx);var Hx=new Array(3).concat("deebf79ecae13182bd","eff3ffbdd7e76baed62171b5","eff3ffbdd7e76baed63182bd08519c","eff3ffc6dbef9ecae16baed63182bd08519c","eff3ffc6dbef9ecae16baed64292c62171b5084594","f7fbffdeebf7c6dbef9ecae16baed64292c62171b5084594","f7fbffdeebf7c6dbef9ecae16baed64292c62171b508519c08306b").map(G),Zx=ht(Hx);var Qx=new Array(3).concat("e5f5e0a1d99b31a354","edf8e9bae4b374c476238b45","edf8e9bae4b374c47631a354006d2c","edf8e9c7e9c0a1d99b74c47631a354006d2c","edf8e9c7e9c0a1d99b74c47641ab5d238b45005a32","f7fcf5e5f5e0c7e9c0a1d99b74c47641ab5d238b45005a32","f7fcf5e5f5e0c7e9c0a1d99b74c47641ab5d238b45006d2c00441b").map(G),Kx=ht(Qx);var Jx=new Array(3).concat("f0f0f0bdbdbd636363","f7f7f7cccccc969696525252","f7f7f7cccccc969696636363252525","f7f7f7d9d9d9bdbdbd969696636363252525","f7f7f7d9d9d9bdbdbd969696737373525252252525","fffffff0f0f0d9d9d9bdbdbd969696737373525252252525","fffffff0f0f0d9d9d9bdbdbd969696737373525252252525000000").map(G),t1=ht(Jx);var e1=new Array(3).concat("efedf5bcbddc756bb1","f2f0f7cbc9e29e9ac86a51a3","f2f0f7cbc9e29e9ac8756bb154278f","f2f0f7dadaebbcbddc9e9ac8756bb154278f","f2f0f7dadaebbcbddc9e9ac8807dba6a51a34a1486","fcfbfdefedf5dadaebbcbddc9e9ac8807dba6a51a34a1486","fcfbfdefedf5dadaebbcbddc9e9ac8807dba6a51a354278f3f007d").map(G),n1=ht(e1);var r1=new Array(3).concat("fee0d2fc9272de2d26","fee5d9fcae91fb6a4acb181d","fee5d9fcae91fb6a4ade2d26a50f15","fee5d9fcbba1fc9272fb6a4ade2d26a50f15","fee5d9fcbba1fc9272fb6a4aef3b2ccb181d99000d","fff5f0fee0d2fcbba1fc9272fb6a4aef3b2ccb181d99000d","fff5f0fee0d2fcbba1fc9272fb6a4aef3b2ccb181da50f1567000d").map(G),i1=ht(r1);var o1=new Array(3).concat("fee6cefdae6be6550d","feeddefdbe85fd8d3cd94701","feeddefdbe85fd8d3ce6550da63603","feeddefdd0a2fdae6bfd8d3ce6550da63603","feeddefdd0a2fdae6bfd8d3cf16913d948018c2d04","fff5ebfee6cefdd0a2fdae6bfd8d3cf16913d948018c2d04","fff5ebfee6cefdd0a2fdae6bfd8d3cf16913d94801a636037f2704").map(G),s1=ht(o1);function a1(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 c1=Ru(Jn(300,.5,0),Jn(-240,.5,1));var u1=Ru(Jn(-100,.75,.35),Jn(80,1.5,.8)),f1=Ru(Jn(260,.75,.35),Jn(80,1.5,.8)),l1=Jn();function d1(e){(e<0||e>1)&&(e-=Math.floor(e));var t=Math.abs(e-.5);return l1.h=360*e-100,l1.s=1.5-1.5*t,l1.l=.8-.9*t,l1+""}var h1=rn(),DH=Math.PI/3,kH=Math.PI*2/3;function p1(e){var t;return e=(.5-e)*Math.PI,h1.r=255*(t=Math.sin(e))*t,h1.g=255*(t=Math.sin(e+DH))*t,h1.b=255*(t=Math.sin(e+kH))*t,h1+""}function m1(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 y1(e){var t=e.length;return function(n){return e[Math.max(0,Math.min(t-1,Math.floor(n*t)))]}}var g1=y1(G("44015444025645045745055946075a46085c460a5d460b5e470d60470e6147106347116447136548146748166848176948186a481a6c481b6d481c6e481d6f481f70482071482173482374482475482576482677482878482979472a7a472c7a472d7b472e7c472f7d46307e46327e46337f463480453581453781453882443983443a83443b84433d84433e85423f854240864241864142874144874045884046883f47883f48893e49893e4a893e4c8a3d4d8a3d4e8a3c4f8a3c508b3b518b3b528b3a538b3a548c39558c39568c38588c38598c375a8c375b8d365c8d365d8d355e8d355f8d34608d34618d33628d33638d32648e32658e31668e31678e31688e30698e306a8e2f6b8e2f6c8e2e6d8e2e6e8e2e6f8e2d708e2d718e2c718e2c728e2c738e2b748e2b758e2a768e2a778e2a788e29798e297a8e297b8e287c8e287d8e277e8e277f8e27808e26818e26828e26828e25838e25848e25858e24868e24878e23888e23898e238a8d228b8d228c8d228d8d218e8d218f8d21908d21918c20928c20928c20938c1f948c1f958b1f968b1f978b1f988b1f998a1f9a8a1e9b8a1e9c891e9d891f9e891f9f881fa0881fa1881fa1871fa28720a38620a48621a58521a68522a78522a88423a98324aa8325ab8225ac8226ad8127ad8128ae8029af7f2ab07f2cb17e2db27d2eb37c2fb47c31b57b32b67a34b67935b77937b87838b9773aba763bbb753dbc743fbc7340bd7242be7144bf7046c06f48c16e4ac16d4cc26c4ec36b50c46a52c56954c56856c66758c7655ac8645cc8635ec96260ca6063cb5f65cb5e67cc5c69cd5b6ccd5a6ece5870cf5773d05675d05477d1537ad1517cd2507fd34e81d34d84d44b86d54989d5488bd6468ed64590d74393d74195d84098d83e9bd93c9dd93ba0da39a2da37a5db36a8db34aadc32addc30b0dd2fb2dd2db5de2bb8de29bade28bddf26c0df25c2df23c5e021c8e020cae11fcde11dd0e11cd2e21bd5e21ad8e219dae319dde318dfe318e2e418e5e419e7e419eae51aece51befe51cf1e51df4e61ef6e620f8e621fbe723fde725")),b1=y1(G("00000401000501010601010802010902020b02020d03030f03031204041405041606051806051a07061c08071e0907200a08220b09240c09260d0a290e0b2b100b2d110c2f120d31130d34140e36150e38160f3b180f3d19103f1a10421c10441d11471e114920114b21114e22115024125325125527125829115a2a115c2c115f2d11612f116331116533106734106936106b38106c390f6e3b0f703d0f713f0f72400f74420f75440f764510774710784910784a10794c117a4e117b4f127b51127c52137c54137d56147d57157e59157e5a167e5c167f5d177f5f187f601880621980641a80651a80671b80681c816a1c816b1d816d1d816e1e81701f81721f817320817521817621817822817922827b23827c23827e24828025828125818326818426818627818827818928818b29818c29818e2a81902a81912b81932b80942c80962c80982d80992d809b2e7f9c2e7f9e2f7fa02f7fa1307ea3307ea5317ea6317da8327daa337dab337cad347cae347bb0357bb2357bb3367ab5367ab73779b83779ba3878bc3978bd3977bf3a77c03a76c23b75c43c75c53c74c73d73c83e73ca3e72cc3f71cd4071cf4070d0416fd2426fd3436ed5446dd6456cd8456cd9466bdb476adc4869de4968df4a68e04c67e24d66e34e65e44f64e55064e75263e85362e95462ea5661eb5760ec5860ed5a5fee5b5eef5d5ef05f5ef1605df2625df2645cf3655cf4675cf4695cf56b5cf66c5cf66e5cf7705cf7725cf8745cf8765cf9785df9795df97b5dfa7d5efa7f5efa815ffb835ffb8560fb8761fc8961fc8a62fc8c63fc8e64fc9065fd9266fd9467fd9668fd9869fd9a6afd9b6bfe9d6cfe9f6dfea16efea36ffea571fea772fea973feaa74feac76feae77feb078feb27afeb47bfeb67cfeb77efeb97ffebb81febd82febf84fec185fec287fec488fec68afec88cfeca8dfecc8ffecd90fecf92fed194fed395fed597fed799fed89afdda9cfddc9efddea0fde0a1fde2a3fde3a5fde5a7fde7a9fde9aafdebacfcecaefceeb0fcf0b2fcf2b4fcf4b6fcf6b8fcf7b9fcf9bbfcfbbdfcfdbf")),x1=y1(G("00000401000501010601010802010a02020c02020e03021004031204031405041706041907051b08051d09061f0a07220b07240c08260d08290e092b10092d110a30120a32140b34150b37160b39180c3c190c3e1b0c411c0c431e0c451f0c48210c4a230c4c240c4f260c51280b53290b552b0b572d0b592f0a5b310a5c320a5e340a5f3609613809623909633b09643d09653e0966400a67420a68440a68450a69470b6a490b6a4a0c6b4c0c6b4d0d6c4f0d6c510e6c520e6d540f6d550f6d57106e59106e5a116e5c126e5d126e5f136e61136e62146e64156e65156e67166e69166e6a176e6c186e6d186e6f196e71196e721a6e741a6e751b6e771c6d781c6d7a1d6d7c1d6d7d1e6d7f1e6c801f6c82206c84206b85216b87216b88226a8a226a8c23698d23698f24699025689225689326679526679727669827669a28659b29649d29649f2a63a02a63a22b62a32c61a52c60a62d60a82e5fa92e5eab2f5ead305dae305cb0315bb1325ab3325ab43359b63458b73557b93556ba3655bc3754bd3853bf3952c03a51c13a50c33b4fc43c4ec63d4dc73e4cc83f4bca404acb4149cc4248ce4347cf4446d04545d24644d34743d44842d54a41d74b3fd84c3ed94d3dda4e3cdb503bdd513ade5238df5337e05536e15635e25734e35933e45a31e55c30e65d2fe75e2ee8602de9612bea632aeb6429eb6628ec6726ed6925ee6a24ef6c23ef6e21f06f20f1711ff1731df2741cf3761bf37819f47918f57b17f57d15f67e14f68013f78212f78410f8850ff8870ef8890cf98b0bf98c0af98e09fa9008fa9207fa9407fb9606fb9706fb9906fb9b06fb9d07fc9f07fca108fca309fca50afca60cfca80dfcaa0ffcac11fcae12fcb014fcb216fcb418fbb61afbb81dfbba1ffbbc21fbbe23fac026fac228fac42afac62df9c72ff9c932f9cb35f8cd37f8cf3af7d13df7d340f6d543f6d746f5d949f5db4cf4dd4ff4df53f4e156f3e35af3e55df2e661f2e865f2ea69f1ec6df1ed71f1ef75f1f179f2f27df2f482f3f586f3f68af4f88ef5f992f6fa96f8fb9af9fc9dfafda1fcffa4")),_1=y1(G("0d088710078813078916078a19068c1b068d1d068e20068f2206902406912605912805922a05932c05942e05952f059631059733059735049837049938049a3a049a3c049b3e049c3f049c41049d43039e44039e46039f48039f4903a04b03a14c02a14e02a25002a25102a35302a35502a45601a45801a45901a55b01a55c01a65e01a66001a66100a76300a76400a76600a76700a86900a86a00a86c00a86e00a86f00a87100a87201a87401a87501a87701a87801a87a02a87b02a87d03a87e03a88004a88104a78305a78405a78606a68707a68808a68a09a58b0aa58d0ba58e0ca48f0da4910ea3920fa39410a29511a19613a19814a099159f9a169f9c179e9d189d9e199da01a9ca11b9ba21d9aa31e9aa51f99a62098a72197a82296aa2395ab2494ac2694ad2793ae2892b02991b12a90b22b8fb32c8eb42e8db52f8cb6308bb7318ab83289ba3388bb3488bc3587bd3786be3885bf3984c03a83c13b82c23c81c33d80c43e7fc5407ec6417dc7427cc8437bc9447aca457acb4679cc4778cc4977cd4a76ce4b75cf4c74d04d73d14e72d24f71d35171d45270d5536fd5546ed6556dd7566cd8576bd9586ada5a6ada5b69db5c68dc5d67dd5e66de5f65de6164df6263e06363e16462e26561e26660e3685fe4695ee56a5de56b5de66c5ce76e5be76f5ae87059e97158e97257ea7457eb7556eb7655ec7754ed7953ed7a52ee7b51ef7c51ef7e50f07f4ff0804ef1814df1834cf2844bf3854bf3874af48849f48948f58b47f58c46f68d45f68f44f79044f79143f79342f89441f89540f9973ff9983ef99a3efa9b3dfa9c3cfa9e3bfb9f3afba139fba238fca338fca537fca636fca835fca934fdab33fdac33fdae32fdaf31fdb130fdb22ffdb42ffdb52efeb72dfeb82cfeba2cfebb2bfebd2afebe2afec029fdc229fdc328fdc527fdc627fdc827fdca26fdcb26fccd25fcce25fcd025fcd225fbd324fbd524fbd724fad824fada24f9dc24f9dd25f8df25f8e125f7e225f7e425f6e626f6e826f5e926f5eb27f4ed27f3ee27f3f027f2f227f1f426f1f525f0f724f0f921"));function Ze(e){return function(){return e}}var uT=Math.cos;var rf=Math.min,Zp=Math.sin,ee=Math.sqrt,fT=1e-12,bl=Math.PI,u4t=bl/2,of=2*bl;function w1(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 La(t)}var p4t=Array.prototype.slice;function v1(e){return typeof e=="object"&&"length"in e?e:Array.from(e)}function dC(e){this._context=e}dC.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 Us(e){return new dC(e)}function S1(e){return e[0]}function I1(e){return e[1]}function Qp(e,t){var n=Ze(!0),r=null,i=Us,o=null,s=w1(a);e=typeof e=="function"?e:e===void 0?S1:Ze(e),t=typeof t=="function"?t:t===void 0?I1:Ze(t);function a(c){var l,u=(c=v1(c)).length,f,d=!1,h;for(r==null&&(o=i(h=s())),l=0;l<=u;++l)!(l<u&&n(f=c[l],l,c))===d&&((d=!d)?o.lineStart():o.lineEnd()),d&&o.point(+e(f,l,c),+t(f,l,c));if(h)return o=null,h+""||null}return a.x=function(c){return arguments.length?(e=typeof c=="function"?c:Ze(+c),a):e},a.y=function(c){return arguments.length?(t=typeof c=="function"?c:Ze(+c),a):t},a.defined=function(c){return arguments.length?(n=typeof c=="function"?c:Ze(!!c),a):n},a.curve=function(c){return arguments.length?(i=c,r!=null&&(o=i(r)),a):i},a.context=function(c){return arguments.length?(c==null?r=o=null:o=i(r=c),a):r},a}function sf(e,t,n){var r=null,i=Ze(!0),o=null,s=Us,a=null,c=w1(l);e=typeof e=="function"?e:e===void 0?S1:Ze(+e),t=typeof t=="function"?t:t===void 0?Ze(0):Ze(+t),n=typeof n=="function"?n:n===void 0?I1:Ze(+n);function l(f){var d,h,p,m=(f=v1(f)).length,g,y=!1,b,x=new Array(m),_=new Array(m);for(o==null&&(a=s(b=c())),d=0;d<=m;++d){if(!(d<m&&i(g=f[d],d,f))===y)if(y=!y)h=d,a.areaStart(),a.lineStart();else{for(a.lineEnd(),a.lineStart(),p=d-1;p>=h;--p)a.point(x[p],_[p]);a.lineEnd(),a.areaEnd()}y&&(x[d]=+e(g,d,f),_[d]=+t(g,d,f),a.point(r?+r(g,d,f):x[d],n?+n(g,d,f):_[d]))}if(b)return a=null,b+""||null}function u(){return Qp().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 T1=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 dT(e){return new T1(e,!0)}function hT(e){return new T1(e,!1)}var FH=ee(3),Kp={draw(e,t){let n=ee(t+rf(t/28,.75))*.59436,r=n/2,i=r*FH;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/bl);e.moveTo(n,0),e.arc(0,0,n,0,of)}};var Jp={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 hC=ee(1/3),LH=hC*2,tm={draw(e,t){let n=ee(t/LH),r=n*hC;e.moveTo(0,-n),e.lineTo(r,0),e.lineTo(0,n),e.lineTo(-r,0),e.closePath()}};var em={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 nm={draw(e,t){let n=ee(t-rf(t/7,2))*.87559;e.moveTo(-n,0),e.lineTo(n,0),e.moveTo(0,n),e.lineTo(0,-n)}};var rm={draw(e,t){let n=ee(t),r=-n/2;e.rect(r,r,n,n)}};var im={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 CH=.8908130915292852,pC=Zp(bl/10)/Zp(7*bl/10),BH=Zp(of/10)*pC,PH=-uT(of/10)*pC,om={draw(e,t){let n=ee(t*CH),r=BH*n,i=PH*n;e.moveTo(0,-n),e.lineTo(r,i);for(let o=1;o<5;++o){let s=of*o/5,a=uT(s),c=Zp(s);e.lineTo(c*n,-a*n),e.lineTo(a*r-c*i,c*r+a*i)}e.closePath()}};var pT=ee(3),sm={draw(e,t){let n=-ee(t/(pT*3));e.moveTo(0,n*2),e.lineTo(-pT*n,-n),e.lineTo(pT*n,-n),e.closePath()}};var $H=ee(3),am={draw(e,t){let n=ee(t)*.6824,r=n/2,i=n*$H/2;e.moveTo(0,-n),e.lineTo(i,r),e.lineTo(-i,r),e.closePath()}};var fi=-.5,di=ee(3)/2,mT=1/ee(12),UH=(mT/2+1)*3,cm={draw(e,t){let n=ee(t/UH),r=n/2,i=n*mT,o=r,s=n*mT+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 af={draw(e,t){let n=ee(t-rf(t/6,1.7))*.6189;e.moveTo(-n,-n),e.lineTo(n,n),e.moveTo(-n,n),e.lineTo(n,-n)}};var E1=[zs,Jp,tm,rm,om,sm,cm],yT=[zs,nm,af,am,Kp,im,em];function hi(){}function cf(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 lm(e){this._context=e}lm.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:cf(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:cf(this,e,t);break}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t}};function gT(e){return new lm(e)}function mC(e){this._context=e}mC.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:cf(this,e,t);break}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t}};function bT(e){return new mC(e)}function yC(e){this._context=e}yC.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:cf(this,e,t);break}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t}};function xT(e){return new yC(e)}function gC(e,t){this._basis=new lm(e),this._beta=t}gC.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 _T=function e(t){function n(r){return t===1?new lm(r):new gC(r,t)}return n.beta=function(r){return e(+r)},n}(.85);function lf(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 A1(e,t){this._context=e,this._k=(1-t)/6}A1.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:lf(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:lf(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 wT=function e(t){function n(r){return new A1(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: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:lf(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 vT=function e(t){function n(r){return new M1(r,t)}return n.tension=function(r){return e(+r)},n}(0);function N1(e,t){this._context=e,this._k=(1-t)/6}N1.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:lf(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 ST=function e(t){function n(r){return new N1(r,t)}return n.tension=function(r){return e(+r)},n}(0);function um(e,t,n){var r=e._x1,i=e._y1,o=e._x2,s=e._y2;if(e._l01_a>fT){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>fT){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 bC(e,t){this._context=e,this._alpha=t}bC.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:um(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 IT=function e(t){function n(r){return t?new bC(r,t):new A1(r,0)}return n.alpha=function(r){return e(+r)},n}(.5);function xC(e,t){this._context=e,this._alpha=t}xC.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:um(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 TT=function e(t){function n(r){return t?new xC(r,t):new M1(r,0)}return n.alpha=function(r){return e(+r)},n}(.5);function _C(e,t){this._context=e,this._alpha=t}_C.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:um(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 ET=function e(t){function n(r){return t?new _C(r,t):new N1(r,0)}return n.alpha=function(r){return e(+r)},n}(.5);function wC(e){this._context=e}wC.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 AT(e){return new wC(e)}function vC(e){return e<0?-1:1}function SC(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(vC(o)+vC(s))*Math.min(Math.abs(o),Math.abs(s),.5*Math.abs(a))||0}function IC(e,t){var n=e._x1-e._x0;return n?(3*(e._y1-e._y0)/n-t)/2:t}function MT(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 R1(e){this._context=e}R1.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:MT(this,this._t0,IC(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,MT(this,IC(this,n=SC(this,e,t)),n);break;default:MT(this,this._t0,n=SC(this,e,t));break}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t,this._t0=n}}};function TC(e){this._context=new EC(e)}(TC.prototype=Object.create(R1.prototype)).point=function(e,t){R1.prototype.point.call(this,t,e)};function EC(e){this._context=e}EC.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 NT(e){return new R1(e)}function RT(e){return new TC(e)}function MC(e){this._context=e}MC.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=AC(e),i=AC(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 AC(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 OT(e){return new MC(e)}function O1(e,t){this._context=e,this._t=t}O1.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 DT(e){return new O1(e,.5)}function kT(e){return new O1(e,0)}function FT(e){return new O1(e,1)}var fm=e=>()=>e;function LT(e,{sourceEvent:t,target:n,transform:r,dispatch:i}){Object.defineProperties(this,{type:{value:e,enumerable:!0,configurable:!0},sourceEvent:{value:t,enumerable:!0,configurable:!0},target:{value:n,enumerable:!0,configurable:!0},transform:{value:r,enumerable:!0,configurable:!0},_:{value:i}})}function Ur(e,t,n){this.k=e,this.x=t,this.y=n}Ur.prototype={constructor:Ur,scale:function(e){return e===1?this:new Ur(this.k*e,this.x,this.y)},translate:function(e,t){return e===0&t===0?this:new Ur(this.k,this.x+this.k*e,this.y+this.k*t)},apply:function(e){return[e[0]*this.k+this.x,e[1]*this.k+this.y]},applyX:function(e){return e*this.k+this.x},applyY:function(e){return e*this.k+this.y},invert:function(e){return[(e[0]-this.x)/this.k,(e[1]-this.y)/this.k]},invertX:function(e){return(e-this.x)/this.k},invertY:function(e){return(e-this.y)/this.k},rescaleX:function(e){return e.copy().domain(e.range().map(this.invertX,this).map(e.invert,e))},rescaleY:function(e){return e.copy().domain(e.range().map(this.invertY,this).map(e.invert,e))},toString:function(){return"translate("+this.x+","+this.y+") scale("+this.k+")"}};var dm=new Ur(1,0,0);CT.prototype=Ur.prototype;function CT(e){for(;!e.__zoom;)if(!(e=e.parentNode))return dm;return e.__zoom}function D1(e){e.stopImmediatePropagation()}function uf(e){e.preventDefault(),e.stopImmediatePropagation()}function zH(e){return(!e.ctrlKey||e.type==="wheel")&&!e.button}function qH(){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 NC(){return this.__zoom||dm}function jH(e){return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*(e.ctrlKey?10:1)}function VH(){return navigator.maxTouchPoints||"ontouchstart"in this}function YH(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 BT(){var e=zH,t=qH,n=YH,r=jH,i=VH,o=[0,1/0],s=[[-1/0,-1/0],[1/0,1/0]],a=250,c=fS,l=Gc("start","zoom","end"),u,f,d,h=500,p=150,m=0,g=10;function y(S){S.property("__zoom",NC).on("wheel.zoom",M,{passive:!1}).on("mousedown.zoom",R).on("dblclick.zoom",I).filter(i).on("touchstart.zoom",A).on("touchmove.zoom",O).on("touchend.zoom touchcancel.zoom",F).style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}y.transform=function(S,E,N,L){var B=S.selection?S.selection():S;B.property("__zoom",NC),S!==B?v(S,E,N,L):B.interrupt().each(function(){w(this,arguments).event(L).start().zoom(null,typeof E=="function"?E.apply(this,arguments):E).end()})},y.scaleBy=function(S,E,N,L){y.scaleTo(S,function(){var B=this.__zoom.k,C=typeof E=="function"?E.apply(this,arguments):E;return B*C},N,L)},y.scaleTo=function(S,E,N,L){y.transform(S,function(){var B=t.apply(this,arguments),C=this.__zoom,P=N==null?_(B):typeof N=="function"?N.apply(this,arguments):N,$=C.invert(P),U=typeof E=="function"?E.apply(this,arguments):E;return n(x(b(C,U),P,$),B,s)},N,L)},y.translateBy=function(S,E,N,L){y.transform(S,function(){return n(this.__zoom.translate(typeof E=="function"?E.apply(this,arguments):E,typeof N=="function"?N.apply(this,arguments):N),t.apply(this,arguments),s)},null,L)},y.translateTo=function(S,E,N,L,B){y.transform(S,function(){var C=t.apply(this,arguments),P=this.__zoom,$=L==null?_(C):typeof L=="function"?L.apply(this,arguments):L;return n(dm.translate($[0],$[1]).scale(P.k).translate(typeof E=="function"?-E.apply(this,arguments):-E,typeof N=="function"?-N.apply(this,arguments):-N),C,s)},L,B)};function b(S,E){return E=Math.max(o[0],Math.min(o[1],E)),E===S.k?S:new Ur(E,S.x,S.y)}function x(S,E,N){var L=E[0]-N[0]*S.k,B=E[1]-N[1]*S.k;return L===S.x&&B===S.y?S:new Ur(S.k,L,B)}function _(S){return[(+S[0][0]+ +S[1][0])/2,(+S[0][1]+ +S[1][1])/2]}function v(S,E,N,L){S.on("start.zoom",function(){w(this,arguments).event(L).start()}).on("interrupt.zoom end.zoom",function(){w(this,arguments).event(L).end()}).tween("zoom",function(){var B=this,C=arguments,P=w(B,C).event(L),$=t.apply(B,C),U=N==null?_($):typeof N=="function"?N.apply(B,C):N,X=Math.max($[1][0]-$[0][0],$[1][1]-$[0][1]),tt=B.__zoom,nt=typeof E=="function"?E.apply(B,C):E,st=c(tt.invert(U).concat(X/tt.k),nt.invert(U).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,U[0]-rt[0]*q,U[1]-rt[1]*q)}P.zoom(null,Y)}})}function w(S,E,N){return!N&&S.__zooming||new T(S,E)}function T(S,E){this.that=S,this.args=E,this.active=0,this.sourceEvent=null,this.extent=t.apply(S,E),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,E){return this.mouse&&S!=="mouse"&&(this.mouse[1]=E.invert(this.mouse[0])),this.touch0&&S!=="touch"&&(this.touch0[1]=E.invert(this.touch0[0])),this.touch1&&S!=="touch"&&(this.touch1[1]=E.invert(this.touch1[0])),this.that.__zoom=E,this.emit("zoom"),this},end:function(){return--this.active===0&&(delete this.that.__zooming,this.emit("end")),this},emit:function(S){var E=qt(this.that).datum();l.call(S,this.that,new LT(S,{sourceEvent:this.sourceEvent,target:y,type:S,transform:this.that.__zoom,dispatch:l}),E)}};function M(S,...E){if(!e.apply(this,arguments))return;var N=w(this,E).event(S),L=this.__zoom,B=Math.max(o[0],Math.min(o[1],L.k*Math.pow(2,r.apply(this,arguments)))),C=Ln(S);if(N.wheel)(N.mouse[0][0]!==C[0]||N.mouse[0][1]!==C[1])&&(N.mouse[1]=L.invert(N.mouse[0]=C)),clearTimeout(N.wheel);else{if(L.k===B)return;N.mouse=[C,L.invert(C)],yo(this),N.start()}uf(S),N.wheel=setTimeout(P,p),N.zoom("mouse",n(x(b(L,B),N.mouse[0],N.mouse[1]),N.extent,s));function P(){N.wheel=null,N.end()}}function R(S,...E){if(d||!e.apply(this,arguments))return;var N=S.currentTarget,L=w(this,E,!0).event(S),B=qt(S.view).on("mousemove.zoom",U,!0).on("mouseup.zoom",X,!0),C=Ln(S,N),P=S.clientX,$=S.clientY;qh(S.view),D1(S),L.mouse=[C,this.__zoom.invert(C)],yo(this),L.start();function U(tt){if(uf(tt),!L.moved){var nt=tt.clientX-P,st=tt.clientY-$;L.moved=nt*nt+st*st>m}L.event(tt).zoom("mouse",n(x(L.that.__zoom,L.mouse[0]=Ln(tt,N),L.mouse[1]),L.extent,s))}function X(tt){B.on("mousemove.zoom mouseup.zoom",null),jh(tt.view,L.moved),uf(tt),L.event(tt).end()}}function I(S,...E){if(e.apply(this,arguments)){var N=this.__zoom,L=Ln(S.changedTouches?S.changedTouches[0]:S,this),B=N.invert(L),C=N.k*(S.shiftKey?.5:2),P=n(x(b(N,C),L,B),t.apply(this,E),s);uf(S),a>0?qt(this).transition().duration(a).call(v,P,L,S):qt(this).call(y.transform,P,L,S)}}function A(S,...E){if(e.apply(this,arguments)){var N=S.touches,L=N.length,B=w(this,E,S.changedTouches.length===L).event(S),C,P,$,U;for(D1(S),P=0;P<L;++P)$=N[P],U=Ln($,this),U=[U,this.__zoom.invert(U),$.identifier],B.touch0?!B.touch1&&B.touch0[2]!==U[2]&&(B.touch1=U,B.taps=0):(B.touch0=U,C=!0,B.taps=1+!!u);u&&(u=clearTimeout(u)),C&&(B.taps<2&&(f=U[0],u=setTimeout(function(){u=null},h)),yo(this),B.start())}}function O(S,...E){if(this.__zooming){var N=w(this,E).event(S),L=S.changedTouches,B=L.length,C,P,$,U;for(uf(S),C=0;C<B;++C)P=L[C],$=Ln(P,this),N.touch0&&N.touch0[2]===P.identifier?N.touch0[0]=$:N.touch1&&N.touch1[2]===P.identifier&&(N.touch1[0]=$);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=b(P,Math.sqrt(Y/rt)),$=[(X[0]+nt[0])/2,(X[1]+nt[1])/2],U=[(tt[0]+st[0])/2,(tt[1]+st[1])/2]}else if(N.touch0)$=N.touch0[0],U=N.touch0[1];else return;N.zoom("touch",n(x(P,$,U),N.extent,s))}}function F(S,...E){if(this.__zooming){var N=w(this,E).event(S),L=S.changedTouches,B=L.length,C,P;for(D1(S),d&&clearTimeout(d),d=setTimeout(function(){d=null},h),C=0;C<B;++C)P=L[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=Ln(P,this),Math.hypot(f[0]-P[0],f[1]-P[1])<g)){var $=qt(this).on("dblclick.zoom");$&&$.apply(this,arguments)}}}return y.wheelDelta=function(S){return arguments.length?(r=typeof S=="function"?S:fm(+S),y):r},y.filter=function(S){return arguments.length?(e=typeof S=="function"?S:fm(!!S),y):e},y.touchable=function(S){return arguments.length?(i=typeof S=="function"?S:fm(!!S),y):i},y.extent=function(S){return arguments.length?(t=typeof S=="function"?S:fm([[+S[0][0],+S[0][1]],[+S[1][0],+S[1][1]]]),y):t},y.scaleExtent=function(S){return arguments.length?(o[0]=+S[0],o[1]=+S[1],y):[o[0],o[1]]},y.translateExtent=function(S){return arguments.length?(s[0][0]=+S[0][0],s[1][0]=+S[1][0],s[0][1]=+S[0][1],s[1][1]=+S[1][1],y):[[s[0][0],s[0][1]],[s[1][0],s[1][1]]]},y.constrain=function(S){return arguments.length?(n=S,y):n},y.duration=function(S){return arguments.length?(a=+S,y):a},y.interpolate=function(S){return arguments.length?(c=S,y):c},y.on=function(){var S=l.on.apply(l,arguments);return S===l?y:S},y.clickDistance=function(S){return arguments.length?(m=(S=+S)*S,y):Math.sqrt(m)},y.tapDistance=function(S){return arguments.length?(g=+S,y):g},y}function Ue(e){return e!=null&&!Number.isNaN(e)}function fn(e,t){return+Ue(t)-+Ue(e)||Ut(e,t)}function xl(e,t){return+Ue(t)-+Ue(e)||Hn(e,t)}function hm(e){return e!=null&&`${e}`!=""}function ff(e){return isFinite(e)?e:NaN}function sr(e){return e>0&&isFinite(e)?e:NaN}function Va(e){return e<0&&isFinite(e)?e:NaN}function df(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`${GH(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 GH(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 WH=/^(?:[-+]\d{2})?\d{4}(?:-\d{2}(?:-\d{2})?)?(?:T\d{2}:\d{2}(?::\d{2}(?:\.\d{3})?)?(?:Z|[-+]\d{2}:?\d{2})?)?$/;function pm(e,t){return WH.test(e+="")?new Date(e):typeof t=="function"?t(e):t}var pf=1e3,Ga=pf*60,Wa=Ga*60,Ro=Wa*24,No=Ro*7,_l=Ro*30,Ya=Ro*365,PT=[["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",pf],["5 seconds",5*pf],["15 seconds",15*pf],["30 seconds",30*pf],["minute",Ga],["5 minutes",5*Ga],["15 minutes",15*Ga],["30 minutes",30*Ga],["hour",Wa],["3 hours",3*Wa],["6 hours",6*Wa],["12 hours",12*Wa],["day",Ro],["2 days",2*Ro],["week",No],["2 weeks",2*No],["month",_l],["3 months",3*_l],["6 months",6*_l],["year",Ya],["2 years",2*Ya],["5 years",5*Ya],["10 years",10*Ya],["20 years",20*Ya],["50 years",50*Ya],["100 years",100*Ya]],$T=new Map([["second",pf],["minute",Ga],["hour",Wa],["day",Ro],["monday",No],["tuesday",No],["wednesday",No],["thursday",No],["friday",No],["saturday",No],["sunday",No],["week",No],["month",_l],["year",Ya]]),OC=new Map([["second",ln],["minute",Fs],["hour",Cs],["day",ui],["monday",qa],["tuesday",Zb],["wednesday",Qb],["thursday",Eo],["friday",Kb],["saturday",Jb],["sunday",Pr],["week",Pr],["month",Ps],["year",Un]]),UT=new Map([["second",ln],["minute",Ls],["hour",Bs],["day",ml],["monday",ja],["tuesday",tx],["wednesday",ex],["thursday",Ao],["friday",nx],["saturday",rx],["sunday",$r],["week",$r],["month",$s],["year",zn]]),mf=Symbol("intervalDuration"),F1=Symbol("intervalType");for(let[e,t]of OC)t[mf]=$T.get(e),t[F1]="time";for(let[e,t]of UT)t[mf]=$T.get(e),t[F1]="utc";var mm=[["year",zn,"utc"],["month",$s,"utc"],["day",ml,"utc",6*_l],["hour",Bs,"utc",3*Ro],["minute",Ls,"utc",6*Wa],["second",ln,"utc",30*Ga]],k1=[["year",Un,"time"],["month",Ps,"time"],["day",ui,"time",6*_l],["hour",Cs,"time",3*Ro],["minute",Fs,"time",6*Wa],["second",ln,"time",30*Ga]],XH=[mm[0],k1[0],mm[1],k1[1],mm[2],k1[2],...mm.slice(3)];function L1(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=UT.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 zT(e){return DC(L1(e),"time")}function ym(e){return DC(L1(e),"utc")}function DC([e,t],n){let r=(n==="time"?OC:UT).get(e);return t>1&&(r=r.every(t),r[mf]=$T.get(e)*t,r[F1]=n),r}function qT(e,t){if(!(t>1))return;let n=e[mf];if(!PT.some(([,i])=>i===n)||n%Ro===0&&Ro<n&&n<_l)return;let[r]=PT[_s(([,i])=>Math.log(i)).center(PT,Math.log(n*t))];return(e[F1]==="time"?zT:ym)(r)}function RC(e,t,n){let r=t==="time"?tf: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=HH(n);switch(e){case"millisecond":return hf(r(".%L"),r(":%M:%S"),i);case"second":return hf(r(":%S"),r("%-I:%M"),i);case"minute":return hf(r("%-I:%M"),r("%p"),i);case"hour":return hf(r("%-I %p"),r("%b %-d"),i);case"day":return hf(r("%-d"),r("%b"),i);case"month":return hf(r("%b"),r("%Y"),i);case"year":return r("%Y")}throw new Error("unable to format time ticks")}function HH(e){return e==="left"||e==="right"?(t,n)=>`
12
12
  ${t}
13
13
  ${n}`:e==="top"?(t,n)=>`${n}
14
14
  ${t}`:(t,n)=>`${t}
15
- ${n}`}function 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) {
15
+ ${n}`}function ZH(e){return e==="time"?k1:e==="utc"?mm:XH}function kC(e,t,n){let r=Gt(N0(t,(i,o)=>Math.abs(o-i)));if(r<1e3)return RC("millisecond","utc",n);for(let[i,o,s,a]of ZH(e)){if(r>a||i==="hour"&&!r)break;if(t.every(c=>o.floor(c)>=c))return RC(i,s,n)}}function hf(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 wl=Object.getPrototypeOf(Uint8Array),QH=Object.prototype.toString,jT=Symbol("reindex");function mt(e,t,n){let r=typeof t;return r==="string"?FC(e,VT(t),n):r==="function"?FC(e,t,n):r==="number"||t instanceof Date||r==="boolean"?Yt(e,dn(t),n):typeof t?.transform=="function"?LC(t.transform(e),n):KH(LC(t,n),e?.[jT])}function KH(e,t){return t?bm(e,t):e}function FC(e,t,n){return Yt(e,n?.prototype instanceof wl?JH(t):t,n)}function LC(e,t){return t===void 0?qe(e):e instanceof t?e:t.prototype instanceof wl&&!(e instanceof wl)?t.from(e,YT):t.from(e)}function JH(e){return(t,n)=>YT(e(t,n))}var Xa=[null],VT=e=>t=>t[e],Ae={transform:ar},W={transform:e=>e};var gm=()=>1,CC=()=>!0,ze=e=>e==null?e:`${e}`,Nt=e=>e==null?e:+e;var Vs=e=>e?e[0]:void 0,Ha=e=>e?e[1]:void 0,BC=e=>e?e[2]:void 0,dn=e=>()=>e;function yf(e){let t=+`${e}`.slice(1)/100;return(n,r)=>Kn(n,t,r)}function Qe(e){return e instanceof wl?e:Yt(e,YT,Float64Array)}function YT(e){return e==null?NaN:Number(e)}function PC(e){return Yt(e,GT)}function GT(e){return e instanceof Date&&!isNaN(e)?e:typeof e=="string"?pm(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"]:Ka(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 WT(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 wl?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 Za(e,t=Array){return e instanceof t?e.slice():t.from(e)}function XT({x:e,x1:t,x2:n}){return e!==void 0||t!==void 0||n!==void 0}function HT({y:e,y1:t,y2:n}){return e!==void 0||t!==void 0||n!==void 0}function gf(e){return XT(e)||HT(e)||e.interval!==void 0}function hn(e){return e?.toString===QH}function Oo(e){return hn(e)&&(e.type!==void 0||e.domain!==void 0)}function zr(e){return hn(e)&&typeof e.transform!="function"}function Do(e){return zr(e)&&e.value===void 0&&e.channel===void 0}function ZT(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,Ha]:[e,t]}function qn({z:e,fill:t,stroke:n}={}){return e===void 0&&([e]=Re(t)),e===void 0&&([e]=Re(n)),e}function ar(e){let t=e.length,n=new Uint32Array(t);for(let r=0;r<t;++r)n[r]=r;return n}function bm(e,t){return Yt(t,n=>e[n],e.constructor)}function bf(e){return e.length===1?(t,n)=>e(bm(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 C1(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 xf(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 vl(e,t){let n=QT(t?.interval,t?.type);return n?Yt(e,n):e}function QT(e,t){let n=_f(e,t);return n&&(r=>Ue(r)?n.floor(r):r)}function _f(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)=>$e(Math.ceil(r*n),i*n).map(o=>o/n)}:{floor:r=>Math.floor(r/n)*n,offset:r=>r+n,range:(r,i)=>$e(Math.ceil(r/n),i/n).map(o=>o*n)}}if(typeof e=="string")return(t==="time"?zT:ym)(e);if(typeof e.floor!="function")throw new Error("invalid interval; missing floor method");if(typeof e.offset!="function")throw new Error("invalid interval; missing offset method");return e}}function ko(e,t){if(e=_f(e,t),e&&typeof e.range!="function")throw new Error("invalid interval: missing range method");return e}function $C(e,t){if(e=ko(e,t),e&&typeof e.ceil!="function")throw new Error("invalid interval: missing ceil method");return e}function UC(e){return Qa(e)&&typeof e?.floor=="function"&&e.floor()instanceof Date}function Qa(e){return typeof e?.range=="function"}function pi(e){return e===void 0||zr(e)?e:{value:e}}function zC(e){return e==null?null:{transform:t=>mt(t,e,Float64Array),label:On(e)}}function qC(e){if(!cr(e))return!1;for(let t of e)if(t!=null)return typeof t=="object"&&"0"in t&&"1"in t}function cr(e){return e&&typeof e[Symbol.iterator]=="function"}function B1(e){for(let t of e)if(t!=null)return typeof t!="object"||t instanceof Date}function Me(e){for(let t of e){if(t==null)continue;let n=typeof t;return n==="string"||n==="boolean"}}function Oe(e){for(let t of e)if(t!=null)return t instanceof Date}function jC(e){for(let t of e)if(t!=null)return typeof t=="string"&&isNaN(t)&&pm(t)}function VC(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 P1(e,t){let n;for(let r of e)if(r!=null){if(!t(r))return!1;n=!0}return n}var tZ=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 Ka(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)||tZ.has(e))}function YC(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 GC(e){return/^\s*round\s*$/i.test(e)}function $1(e,t){return WT(e,t,["middle","top-left","top","top-right","right","bottom-right","bottom","bottom-left","left"])}function Fo(e="middle"){return $1(e,"frameAnchor")}function js(e){if(e==null)return;let t=e[0],n=e[e.length-1];return Hn(t,n)}function WC(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 eZ(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 xm(e){return cr(e)?eZ(e):e}var mi=Symbol("position"),qr=Symbol("color"),Sl=Symbol("radius"),Il=Symbol("length"),Tl=Symbol("opacity"),wf=Symbol("symbol"),XC=Symbol("projection"),fe=new Map([["x",mi],["y",mi],["fx",mi],["fy",mi],["r",Sl],["color",qr],["opacity",Tl],["symbol",wf],["length",Il],["projection",XC]]);function HC(e){return e===mi||e===XC}function ZC(e){return e===mi||e===Sl||e===Il||e===Tl}var KT=Math.sqrt(3),JT=2/KT,nZ={draw(e,t){let n=Math.sqrt(t/Math.PI),r=n*JT,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()}},tE=new Map([["asterisk",Kp],["circle",zs],["cross",Jp],["diamond",tm],["diamond2",em],["hexagon",nZ],["plus",nm],["square",rm],["square2",im],["star",om],["times",af],["triangle",sm],["triangle2",am],["wye",cm]]);function eE(e){return e&&typeof e.draw=="function"}function QC(e){return eE(e)?!0:typeof e!="string"?!1:tE.has(e.toLowerCase())}function vf(e){if(e==null||eE(e))return e;let t=tE.get(`${e}`.toLowerCase());if(t)return t;throw new Error(`invalid symbol: ${e}`)}function KC(e){if(e==null||eE(e))return[void 0,e];if(typeof e=="string"){let t=tE.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=iE(e)),t!=null&&!Do(t)&&(r=nE(r,sE(t))),n&&(r=nE(r,oE))),s!=null&&i!=null)throw new Error("transforms cannot be applied after initializers");return{...o,...(t===null||Do(t))&&{sort:t},transform:nE(r,s)}}function Se({filter:e,sort:t,reverse:n,initializer:r,...i}={},o){return r===void 0&&(e!=null&&(r=iE(e)),t!=null&&!Do(t)&&(r=rE(r,sE(t))),n&&(r=rE(r,oE))),{...i,...(t===null||Do(t))&&{sort:t},initializer:rE(r,o)}}function nE(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 rE(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 U1(e,t){return(e.initializer!=null?Se:mn)(e,t)}function JC(e,t){return U1(t,iE(e))}function iE(e){return(t,n)=>{let r=mt(t,e);return{data:t,facets:n.map(i=>i.filter(o=>r[o]))}}}function t5({sort:e,...t}={}){return{...U1(t,oE),sort:Do(e)?e:null}}function oE(e,t){return{data:e,facets:t.map(n=>n.slice().reverse())}}function e5({seed:e,sort:t,...n}={}){return{...U1(n,n5(e==null?Math.random:ll(e))),sort:Do(t)?t:null}}function z1(e,{sort:t,...n}={}){return{...(zr(e)&&e.channel!==void 0?Se:U1)(n,sE(e)),sort:Do(t)?t:null}}function sE(e){return(typeof e=="function"&&e.length!==1?rZ:n5)(e)}function rZ(e){return(t,n)=>{let r=(i,o)=>e(t[i],t[o]);return{data:t,facets:n.map(i=>i.slice().sort(r))}}}function n5(e){let t,n;({channel:t,value:e,order:n}={...pi(e)});let r=t?.startsWith("-");if(r&&(t=t.slice(1)),n===void 0&&(n=r?xl:fn),typeof n!="function")switch(`${n}`.toLowerCase()){case"ascending":n=fn;break;case"descending":n=xl;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 wm(e,t){return q1(null,null,e,t)}function tc(e={y:"count"},t={}){let{x:n=W}=t;if(n==null)throw new Error("missing channel: x");return q1(n,null,e,t)}function ec(e={x:"count"},t={}){let{y:n=W}=t;if(n==null)throw new Error("missing channel: y");return q1(null,n,e,t)}function vm(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 q1(n,r,e,t)}function q1(e,t,{data:n=Y1,filter:r,sort:i,reverse:o,...s}={},a={}){s=cE(s,a),n=a5(n,W),i=i==null?void 0:o5("sort",i,a),r=r==null?void 0:s5("filter",r,a);let[c,l]=Rn(e),[u,f]=Rn(t),{z:d,fill:h,stroke:p,x1:m,x2:g,y1:y,y2:b,...x}=a,[_,v]=Rn(d),[w]=Re(h),[T]=Re(p),[M,R]=Rn(w),[I,A]=Rn(T);return{..."z"in a&&{z:_||d},..."fill"in a&&{fill:M||h},..."stroke"in a&&{stroke:I||p},...mn(x,(O,F,S)=>{let E=vl(mt(O,e),S?.x),N=vl(mt(O,t),S?.y),L=mt(O,d),B=mt(O,w),C=mt(O,T),P=Sm(s,{z:L,fill:B,stroke:C}),$=[],U=[],X=E&&l([]),tt=N&&f([]),nt=L&&v([]),st=B&&R([]),Y=C&&A([]),rt=0;for(let q of s)q.initialize(O);i&&i.initialize(O),r&&r.initialize(O);for(let q of F){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 Ja(q,P))for(let[Lt,dt]of Ja(z,N))for(let[Wt,Xt]of Ja(dt,E)){let et={data:O};if(E&&(et.x=Wt),N&&(et.y=Lt),!(r&&!r.reduce(Xt,et))){H.push(rt++),U.push(n.reduceIndex(Xt,O,et)),E&&X.push(Wt),N&&tt.push(Lt),L&&nt.push(P===L?ot:L[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)}}$.push(H)}return lE($,i,o),{data:U,facets:$}}),...!Lo(s,"x")&&(c?{x:c}:{x1:m,x2:g}),...!Lo(s,"y")&&(u?{y:u}:{y1:y,y2:b}),...Object.fromEntries(s.map(({name:O,output:F})=>[O,F]))}}function Lo(e,...t){for(let{name:n}of e)if(t.includes(n))return!0;return!1}function aE(e,t,n=j1){let r=Object.entries(e);return t.title!=null&&e.title===void 0&&r.push(["title",lZ]),t.href!=null&&e.href===void 0&&r.push(["href",G1]),r.filter(([,i])=>i!==void 0).map(([i,o])=>o===null?iZ(i):n(i,o,t))}function j1(e,t,n,r=V1){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 iZ(e){return{name:e,initialize(){},scope(){},reduce(){}}}function V1(e,t,n,r=Sf){let i=C1(e,n),o=r(t,i),s,a;return{label:On(o===_m?null:i,o.label),initialize(c){s=i===void 0?c:mt(c,i),o.scope==="data"&&(a=o.reduceIndex(ar(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 Ja(e,t){return t?uo(an(e,n=>t[n]),Vs):[[,e]]}function Sf(e,t,n=oZ){if(e==null)return n(e);if(typeof e.reduceIndex=="function")return e;if(typeof e.reduce=="function"&&hn(e))return aZ(e);if(typeof e=="function")return cZ(e);if(/^p\d{2}$/i.test(e))return Hs(yf(e));switch(`${e}`.toLowerCase()){case"first":return G1;case"last":return uZ;case"identity":return Y1;case"count":return _m;case"distinct":return fZ;case"sum":return t==null?_m:dZ;case"proportion":return i5(t,"data");case"proportion-facet":return i5(t,"facet");case"deviation":return Hs(ri);case"min":return Hs(ce);case"min-index":return Hs(E0);case"max":return Hs(Gt);case"max-index":return Hs(T0);case"mean":return r5(Ss);case"median":return r5(Bi);case"variance":return Hs(Ma);case"mode":return Hs(Iu)}return n(e)}function oZ(e){throw new Error(`invalid reduce: ${e}`)}function cE(e,t){return aE(e,t,o5)}function o5(e,t,n){return j1(e,t,n,s5)}function s5(e,t,n){return V1(e,t,n,a5)}function a5(e,t){return Sf(e,t,sZ)}function sZ(e){switch(`${e}`.toLowerCase()){case"x":return hZ;case"y":return pZ}throw new Error(`invalid group reduce: ${e}`)}function Sm(e,t){for(let n in t){let r=t[n];if(r!==void 0&&!e.some(i=>i.name===n))return r}}function lE(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 aZ(e){return console.warn("deprecated reduce interface; implement reduceIndex instead."),{...e,reduceIndex:e.reduce.bind(e)}}function cZ(e){return{reduceIndex(t,n,r){return e(bm(n,t),r)}}}function Hs(e){return{reduceIndex(t,n){return e(t,r=>n[r])}}}function r5(e){return{reduceIndex(t,n){let r=e(t,i=>n[i]);return Oe(n)?new Date(r):r}}}var Y1={reduceIndex(e,t){return bm(t,e)}},G1={reduceIndex(e,t){return t[e[0]]}},lZ={reduceIndex(e,t){let r=uo(Ci(e,o=>o.length,o=>t[o]),Ha),i=r.slice(-5).reverse();if(i.length<r.length){let o=r.slice(0,-4);i[4]=[`\u2026 ${o.length.toLocaleString("en-US")} more`,En(o,Ha)]}return i.map(([o,s])=>`${o} (${s.toLocaleString("en-US")})`).join(`
16
+ `)}},uZ={reduceIndex(e,t){return t[e[e.length-1]]}},_m={label:"Frequency",reduceIndex(e){return e.length}},fZ={label:"Distinct",reduceIndex(e,t){let n=new Qn;for(let r of e)n.add(t[r]);return n.size}},dZ=Hs(En);function i5(e,t){return e==null?{scope:t,label:"Frequency",reduceIndex:(n,r,i=1)=>n.length/i}:{scope:t,reduceIndex:(n,r,i=1)=>En(n,o=>r[o])/i}}var hZ={reduceIndex(e,t,{x:n}){return n}},pZ={reduceIndex(e,t,{y:n}){return n}};function c5(e){if(typeof e!="function")throw new Error(`invalid test function: ${e}`);return{reduceIndex(t,n,{data:r}){return n[t.find(i=>e(r[i],i,r))]}}}function If(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),fE(a,{scale:t,type:n,value:mt(e,r),label:s,filter:i,hint:o})}function W1(e,t){return Object.fromEntries(Object.entries(e).map(([n,r])=>[n,If(t,r,n)]))}function Tf(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 fE(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&&P1(r,Ka)?null:"color";break;case"fillOpacity":case"strokeOpacity":case"opacity":t.scale=n!==!0&&P1(r,YC)?null:"opacity";break;case"symbol":n!==!0&&P1(r,QC)?(t.scale=null,t.value=Yt(r,vf)):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 u5(e,t,n,r,i){let{order:o,reverse:s,reduce:a=!0,limit:c}=i;for(let l in i){if(!fe.has(l))continue;let{value:u,order:f=o,reverse:d=s,reduce:h=a,limit:p=c}=pi(i[l]),m=u?.startsWith("-");if(m&&(u=u.slice(1)),f=f===void 0?m!==(u==="width"||u==="height")?d5:f5:gZ(f),h==null||h===!1)continue;let g=l==="fx"||l==="fy"?yZ(t,r[l]):mZ(n,l);if(!g)throw new Error(`missing channel for scale: ${l}`);let y=g.value,[b=0,x=1/0]=cr(p)?p:p<0?[p]:[0,p];if(u==null)g.domain=()=>{let _=Array.from(new Qn(y));return d&&(_=_.reverse()),(b!==0||x!==1/0)&&(_=_.slice(b,x)),_};else{let _=u==="data"?e:u==="height"?l5(n,"y1","y2"):u==="width"?l5(n,"x1","x2"):uE(n,u,u==="y"?"y2":u==="x"?"x2":void 0),v=Sf(h===!0?"max":h,_);g.domain=()=>{let w=U2(ar(y),T=>v.reduceIndex(T,_),T=>y[T]);return f&&w.sort(f),d&&w.reverse(),(b!==0||x!==1/0)&&(w=w.slice(b,x)),w.map(Vs)}}}}function mZ(e,t){for(let n in e){let r=e[n];if(r.scale===t)return r}}function yZ(e,t){let n=e.original;if(n===e)return t;let r=t.value,i=t.value=[];for(let o=0;o<n.length;++o){let s=r[n[o][0]];for(let a of e[o])i[a]=s}return t}function l5(e,t,n){let r=uE(e,t),i=uE(e,n);return Yt(i,(o,s)=>Math.abs(o-r[s]),Float64Array)}function uE(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 gZ(e){if(e==null||typeof e=="function")return e;switch(`${e}`.toLowerCase()){case"ascending":return f5;case"descending":return d5}throw new Error(`invalid order: ${e}`)}function f5([e,t],[n,r]){return fn(t,r)||fn(e,n)}function d5([e,t],[n,r]){return xl(t,r)||fn(e,n)}function Im(e,t){let n=e[t];if(n){for(;n.source;)n=n.source;return n.source===null?null:n}}function X1(e){let t,n;return(...r)=>((n?.length!==r.length||n.some((i,o)=>i!==r[o]))&&(n=r,t=e(...r)),t)}var bZ=X1(e=>new Intl.NumberFormat(e)),xZ=X1((e,t)=>new Intl.DateTimeFormat(e,{timeZone:"UTC",...t&&{month:t}})),_Z=X1((e,t)=>new Intl.DateTimeFormat(e,{timeZone:"UTC",...t&&{weekday:t}}));function wZ(e="en-US"){let t=bZ(e);return n=>n!=null&&!isNaN(n)?t.format(n):void 0}function h5(e="en-US",t="short"){let n=xZ(e,t);return r=>r!=null&&!isNaN(r=+new Date(Date.UTC(2e3,+r)))?n.format(r):void 0}function p5(e="en-US",t="short"){let n=_Z(e,t);return r=>r!=null&&!isNaN(r=+new Date(Date.UTC(2001,0,+r)))?n.format(r):void 0}function dE(e){return df(e,"Invalid Date")}function vZ(e="en-US"){let t=wZ(e);return n=>(n instanceof Date?dE:typeof n=="number"?t:ze)(n)}var zi=vZ();var hE=0,pE;function m5(){let e=hE;return hE=0,pE=void 0,e}function jn(e){e!==pE&&(pE=e,console.warn(e),++hE)}var De=(typeof window<"u"?window.devicePixelRatio>1:typeof it>"u")?0:.5,SZ=0;function H1(){return`plot-clip-${++SZ}`}function Z1(e,{title:t,href:n,ariaLabel:r,ariaDescription:i,ariaHidden:o,target:s,fill:a,fillOpacity:c,stroke:l,strokeWidth:u,strokeOpacity:f,strokeLinejoin:d,strokeLinecap:h,strokeMiterlimit:p,strokeDasharray:m,strokeDashoffset:g,opacity:y,mixBlendMode:b,imageFilter:x,paintOrder:_,pointerEvents:v,shapeRendering:w,channels:T},{ariaLabel:M,fill:R="currentColor",fillOpacity:I,stroke:A="none",strokeOpacity:O,strokeWidth:F,strokeLinecap:S,strokeLinejoin:E,strokeMiterlimit:N,paintOrder:L}){R===null&&(a=null,c=null),A===null&&(l=null,f=null),ne(R)?!ne(A)&&(!ne(a)||T?.fill)&&(A="none"):ne(A)&&(!ne(l)||T?.stroke)&&(R="none");let[B,C]=Re(a,R),[P,$]=ie(c,I),[U,X]=Re(l,A),[tt,nt]=ie(f,O),[st,Y]=ie(y);Xs(X)||(u===void 0&&(u=F),h===void 0&&(h=S),d===void 0&&(d=E),p===void 0&&!GC(d)&&(p=N),!Xs(C)&&_===void 0&&(_=L));let[rt,q]=ie(u);return R!==null&&(e.fill=le(C,"currentColor"),e.fillOpacity=Tm($,1)),A!==null&&(e.stroke=le(X,"none"),e.strokeWidth=Tm(q,1),e.strokeOpacity=Tm(nt,1),e.strokeLinejoin=le(d,"miter"),e.strokeLinecap=le(h,"butt"),e.strokeMiterlimit=Tm(p,4),e.strokeDasharray=le(m,"none"),e.strokeDashoffset=le(g,"0")),e.target=ze(s),e.ariaLabel=ze(M),e.ariaDescription=ze(i),e.ariaHidden=ze(o),e.opacity=Tm(Y,1),e.mixBlendMode=le(b,"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:U,scale:"auto",optional:!0},strokeOpacity:{value:tt,scale:"auto",optional:!0},strokeWidth:{value:rt,optional:!0},opacity:{value:st,scale:"auto",optional:!0}}}function IZ(e,t){t&&e.filter(n=>hm(t[n])).append("title").call(EZ,t)}function TZ(e,t){t&&e.filter(([n])=>hm(t[n])).append("title").call(AZ,t)}function EZ(e,t){t&&e.text(n=>zi(t[n]))}function AZ(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&&y5(e,d=>f[d],t),n||IZ(e,i)}function El(e,{target:t,tip:n},{ariaLabel:r,title:i,fill:o,fillOpacity:s,stroke:a,strokeOpacity:c,strokeWidth:l,opacity:u,href:f}){r&&ft(e,"aria-label",([d])=>r[d]),o&&ft(e,"fill",([d])=>o[d]),s&&ft(e,"fill-opacity",([d])=>s[d]),a&&ft(e,"stroke",([d])=>a[d]),c&&ft(e,"stroke-opacity",([d])=>c[d]),l&&ft(e,"stroke-width",([d])=>l[d]),u&&ft(e,"opacity",([d])=>u[d]),f&&y5(e,([d])=>f[d],t),n||TZ(e,i)}function MZ({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 Em(e,t,n){let r=an(e,i=>t[i]);return n===void 0&&r.size>1+e.length>>1&&jn("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*Q1(e,t,n,r){let{z:i}=n,{z:o}=r,s=MZ(r,n),a=[...t,...s];for(let c of o?Em(e,o,i):[e]){let l,u;t:for(let f of c){for(let d of a)if(!Ue(d[f])){u&&u.push(-1);continue t}if(l===void 0){u&&(yield u),l=s.map(d=>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 K1(e){return e===!0?e="frame":e===!1?e=null:e!=null&&(e=Ke(e,"clip",["frame","sphere"])),e}function NZ(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=H1();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=H1();i=`url(#${a})`,e.append("clipPath").attr("id",a).append("path").attr("d",Mn(s)({type:"Sphere"}));break}}ft(e,"aria-label",t.ariaLabel),ft(e,"aria-description",t.ariaDescription),ft(e,"aria-hidden",t.ariaHidden),ft(e,"clip-path",i)}function Ft(e,t,n,r){NZ(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){RZ(e,"mix-blend-mode",t.mixBlendMode),ft(e,"opacity",t.opacity)}function y5(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 RZ(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 Tm(e,t){if((e=Nt(e))!==t)return e}var OZ=/^-?([_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 Ef(e){if(e===void 0)return"plot-d6a7b5";if(e=`${e}`,!OZ.test(e))throw new Error(`invalid class name: ${e}`);return e}function Af(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 nc(e={}){let{document:t=typeof window<"u"?window.document:void 0,clip:n}=e;return{document:t,clip:K1(n)}}function ct(e,{document:t}){return qt(Ts(e).call(t.documentElement))}var b5=Math.PI,Zs=2*b5,g5=.618;function x5({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}=_5(e));let{width:u,height:f,marginLeft:d,marginRight:h,marginTop:p,marginBottom:m}=s,g=u-d-h-o-r,y=f-p-m-n-i;if(e=e?.({width:g,height:y,clip:l,...a}),e==null)return;l=DZ(l,d,p,u-h,f-m);let b=d+o,x=p+n,_;if(c!=null){let[[v,w],[T,M]]=Mn(e).bounds(c),R=Math.min(g/(T-v),y/(M-w));R>0?(b-=(R*(v+T)-g)/2,x-=(R*(w+M)-y)/2,_=Object.assign(al({point(I,A){this.stream.point(I*R+b,A*R+x)}}),{invert:([I,A])=>[(I-b)/R,(A-x)/R]})):jn("Warning: the projection could not be fit to the specified domain; using the default scale.")}return _??=b===0&&x===0?w5():Object.assign(al({point(v,w){this.stream.point(v+b,w+x)}}),{invert:([v,w])=>[v-b,w-x]}),{stream:v=>e.stream(_.stream(l(v))),invert:v=>e.invert(_.invert(v))}}function _5(e){switch(`${e}`.toLowerCase()){case"albers-usa":return qi(dI,.7463,.4673);case"albers":return J1(Tp,.7463,.4673);case"azimuthal-equal-area":return qi(pI,4,4);case"azimuthal-equidistant":return qi(yI,Zs,Zs);case"conic-conformal":return J1(xI,Zs,Zs);case"conic-equal-area":return J1($a,6.1702,2.9781);case"conic-equidistant":return J1(wI,7.312,3.6282);case"equal-earth":return qi(SI,5.4133,2.6347);case"equirectangular":return qi(_I,Zs,b5);case"gnomonic":return qi(TI,3.4641,3.4641);case"identity":return{type:w5};case"reflect-y":return{type:kZ};case"mercator":return qi(gI,Zs,Zs);case"orthographic":return qi(AI,2,2);case"stereographic":return qi(NI,2,2);case"transverse-mercator":return qi(OI,Zs,Zs);default:throw new Error(`unknown projection type: ${e}`)}}function DZ(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 ju(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 J1(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 w5=dn({stream:e=>e,invert:e=>e}),kZ=dn(Object.assign(al({point(e,t){this.stream.point(e,-t)}}),{invert:([e,t])=>[e,-t]}));function mE(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 v5({projection:e}={}){return e==null?!1:typeof e.stream=="function"?!0:(hn(e)&&(e=e.type),e!=null)}function S5(e){if(typeof e?.stream=="function")return g5;if(hn(e)&&(e=e.type),e!=null){if(typeof e!="function"){let{aspectRatio:t}=_5(e);if(t)return t}return g5}}function rc(e,t,{projection:n}){let{x:r,y:i}=e,o={};return r&&(o.x=r),i&&(o.y=i),o=Tf(o,t),n&&r?.scale==="x"&&i?.scale==="y"&&mE("x","y",o,n),r&&(o.x=Qe(o.x)),i&&(o.y=Qe(o.y)),o}function I5(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)Br(s,o);return[r,i]}var FZ=["#4269d0","#efb118","#ff725c","#6cc5b0","#3ca951","#ff8ab7","#a463f2","#97bbf5","#9c6b4e","#9498a0"],N5=new Map([["accent",eT],["category10",tT],["dark2",nT],["observable10",FZ],["paired",rT],["pastel1",iT],["pastel2",oT],["set1",sT],["set2",aT],["set3",cT],["tableau10",lT]]);function R5(e){return e!=null&&N5.has(`${e}`.toLowerCase())}var T5=new Map([...N5,["brbg",Qs(fx,dx)],["prgn",Qs(hx,px)],["piyg",Qs(mx,yx)],["puor",Qs(gx,bx)],["rdbu",Qs(Xp,ef)],["rdgy",Qs(xx,_x)],["rdylbu",Qs(Hp,nf)],["rdylgn",Qs(wx,vx)],["spectral",Qs(Sx,Ix)],["burd",E5(Xp,ef)],["buylrd",E5(Hp,nf)],["blues",gn(Hx,Zx)],["greens",gn(Qx,Kx)],["greys",gn(Jx,t1)],["oranges",gn(o1,s1)],["purples",gn(e1,n1)],["reds",gn(r1,i1)],["turbo",Ks(m1)],["viridis",Ks(g1)],["magma",Ks(b1)],["inferno",Ks(x1)],["plasma",Ks(_1)],["cividis",Ks(a1)],["cubehelix",Ks(c1)],["warm",Ks(u1)],["cool",Ks(f1)],["bugn",gn(Tx,Ex)],["bupu",gn(Ax,Mx)],["gnbu",gn(Nx,Rx)],["orrd",gn(Ox,Dx)],["pubu",gn(Lx,Cx)],["pubugn",gn(kx,Fx)],["purd",gn(Bx,Px)],["rdpu",gn($x,Ux)],["ylgn",gn(jx,Vx)],["ylgnbu",gn(zx,qx)],["ylorbr",gn(Yx,Gx)],["ylorrd",gn(Wx,Xx)],["rainbow",A5(d1)],["sinebow",A5(p1)]]);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?Cn(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?Cn(t,n):e[n])}function E5(e,t){return({length:n})=>n===2?[e[3][2],e[3][0]]:(n=Math.max(3,Math.floor(n)),n>11?Cn(r=>t(1-r),n):e[n].slice().reverse())}function Ks(e){return({length:t})=>Cn(e,Math.max(2,Math.floor(t)))}function A5(e){return({length:t})=>Cn(e,Math.floor(t)+1).slice(0,-1)}function yE(e){let t=`${e}`.toLowerCase();if(!T5.has(t))throw new Error(`unknown ordinal scheme: ${t}`);return T5.get(t)}function Am(e,t){let n=yE(e),r=typeof n=="function"?n({length:t}):n;return r.length!==t?r.slice(0,t):r}function O5(e,t="greys"){let n=new Set,[r,i]=Am(t,2);for(let o of e)if(o!=null)if(o===!0)n.add(i);else if(o===!1)n.add(r);else return;return[...n]}var M5=new Map([["brbg",dx],["prgn",px],["piyg",yx],["puor",bx],["rdbu",ef],["rdgy",_x],["rdylbu",nf],["rdylgn",vx],["spectral",Ix],["burd",e=>ef(1-e)],["buylrd",e=>nf(1-e)],["blues",Zx],["greens",Kx],["greys",t1],["purples",n1],["reds",i1],["oranges",s1],["turbo",m1],["viridis",g1],["magma",b1],["inferno",x1],["plasma",_1],["cividis",a1],["cubehelix",c1],["warm",u1],["cool",f1],["bugn",Ex],["bupu",Mx],["gnbu",Rx],["orrd",Dx],["pubugn",Fx],["pubu",Cx],["purd",Px],["rdpu",Ux],["ylgnbu",qx],["ylgn",Vx],["ylorbr",Gx],["ylorrd",Xx],["rainbow",d1],["sinebow",p1]]);function Mf(e){let t=`${e}`.toLowerCase();if(!M5.has(t))throw new Error(`unknown quantitative scheme: ${t}`);return M5.get(t)}var LZ=new Set(["brbg","prgn","piyg","puor","rdbu","rdgy","rdylbu","rdylgn","spectral","burd","buylrd"]);function D5(e){return e!=null&&LZ.has(`${e}`.toLowerCase())}var bE=e=>t=>e(1-t),gE=[0,1],k5=new Map([["number",we],["rgb",oi],["hsl",dS],["hcl",hS],["lab",X0]]);function xE(e){let t=`${e}`.toLowerCase();if(!k5.has(t))throw new Error(`unknown interpolator: ${t}`);return k5.get(t)}function Rf(e,t,n,{type:r,nice:i,clamp:o,zero:s,domain:a=z5(e,n),unknown:c,round:l,scheme:u,interval:f,range:d=fe.get(e)===Sl?$Z(n,a):fe.get(e)===Il?UZ(n,a):fe.get(e)===Tl?gE:void 0,interpolate:h=fe.get(e)===qr?u==null&&d!==void 0?oi:Mf(u!==void 0?u:r==="cyclical"?"rainbow":"turbo"):l?Kc:we,reverse:p}){if(f=ko(f,r),(r==="cyclical"||r==="sequential")&&(r="linear"),typeof h!="function"&&(h=xE(h)),p=!!p,d!==void 0){let m=(a=qe(a)).length,g=(d=qe(d)).length;if(m!==g){if(h.length===1)throw new Error("invalid piecewise interpolator");h=mo(h,d),d=void 0}}if(h.length===1?(p&&(h=bE(h),p=!1),d===void 0&&(d=Float64Array.from(a,(m,g)=>g/(a.length-1)),d.length===2&&(d=gE)),t.interpolate((d===gE?dn:Mm)(h))):t.interpolate(h),s){let[m,g]=ae(a);(m>0||g<0)&&(a=Za(a),js(a)!==Math.sign(m)?a[a.length-1]=0:a[0]=0)}return p&&(a=Ra(a)),t.domain(a).unknown(c),i&&(t.nice(CZ(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 CZ(e,t){return e===!0?void 0:typeof e=="number"?e:$C(e,t)}function F5(e,t,n){return Rf(e,ks(),t,n)}function L5(e,t,n){return _E(e,t,{...n,exponent:.5})}function _E(e,t,{exponent:n=1,...r}){return Rf(e,Bp().exponent(n),t,{...r,type:"pow"})}function C5(e,t,{base:n=10,domain:r=zZ(t),...i}){return Rf(e,Lp().base(n),t,{...i,domain:r})}function B5(e,t,{constant:n=1,...r}){return Rf(e,Cp().constant(n),t,r)}function P5(e,t,{range:n,quantiles:r=n===void 0?5:(n=[...n]).length,n:i=r,scheme:o="rdylbu",domain:s=qZ(t),unknown:a,interpolate:c,reverse:l}){return n===void 0&&(n=c!==void 0?Cn(c,i):fe.get(e)===qr?Am(o,i):void 0),s.length>0&&(s=Pp(s,n===void 0?{length:i}:n).quantiles()),t_(e,t,{domain:s,range:n,reverse:l,unknown:a})}function $5(e,t,{range:n,n:r=n===void 0?5:(n=[...n]).length,scheme:i="rdylbu",domain:o=z5(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?Cn(a,r):fe.get(e)===qr?Am(i,r):void 0):(f=Cn(we(l,u),r+1).slice(1,-1),l instanceof Date&&(f=f.map(d=>new Date(d)))),js(qe(o))<0&&f.reverse(),t_(e,t,{domain:f,range:n,reverse:c,unknown:s})}function t_(e,t,{domain:n=[0],unknown:r,scheme:i="rdylbu",interpolate:o,range:s=o!==void 0?Cn(o,n.length+1):fe.get(e)===qr?Am(i,n.length+1):void 0,reverse:a}){n=qe(n);let c=js(n);if(!isNaN(c)&&!BZ(n,c))throw new Error(`the ${e} scale has a non-monotonic domain`);return a&&(s=Ra(s)),{type:"threshold",scale:$p(c<0?Ra(n):n,s===void 0?[]:s).unknown(r),domain:n,range:s}}function BZ(e,t){for(let n=1,r=e.length,i=e[0];n<r;++n){let o=Hn(i,i=e[n]);if(o!==0&&o!==t)return!1}return!0}function U5(e){return{type:"identity",scale:ZC(fe.get(e))?kp():t=>t}}function Nf(e,t=ff){return e.length?[ce(e,({value:n})=>n===void 0?n:ce(n,t)),Gt(e,({value:n})=>n===void 0?n:Gt(n,t))]:[0,1]}function z5(e,t){let n=fe.get(e);return(n===Sl||n===Tl||n===Il?PZ:Nf)(t)}function PZ(e){return[0,e.length?Gt(e,({value:t})=>t===void 0?t:Gt(t,ff)):1]}function $Z(e,t){let n=e.find(({radius:s})=>s!==void 0);if(n!==void 0)return[0,n.radius];let r=Kn(e,.5,({value:s})=>s===void 0?NaN:Kn(s,.25,sr)),i=t.map(s=>3*Math.sqrt(s/r)),o=30/Gt(i);return o<1?i.map(s=>s*o):i}function UZ(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/Gt(r);return i<1?r.map(o=>o*i):r}function zZ(e){for(let{value:t}of e)if(t!==void 0)for(let n of t){if(n>0)return Nf(e,sr);if(n<0)return Nf(e,Va)}return[1,10]}function qZ(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 e_(e,t,n,r,{type:i,nice:o,clamp:s,domain:a=Nf(r),unknown:c,pivot:l=0,scheme:u,range:f,symmetric:d=!0,interpolate:h=fe.get(e)===qr?u==null&&f!==void 0?oi:Mf(u!==void 0?u:"rdbu"):we,reverse:p}){l=+l,a=qe(a);let[m,g]=a;if(a.length>2&&jn(`Warning: the diverging ${e} scale domain contains extra elements.`),Hn(m,g)<0&&([m,g]=[g,m],p=!p),m=Math.min(m,l),g=Math.max(g,l),typeof h!="function"&&(h=xE(h)),f!==void 0&&(h=h.length===1?Mm(h)(...f):mo(h,f)),p&&(h=bE(h)),d){let y=n.apply(l),b=y-n.apply(m),x=n.apply(g)-y;b<x?m=n.invert(y-x):b>x&&(g=n.invert(y+b))}return t.domain([m,l,g]).unknown(c).interpolator(h),s&&t.clamp(s),o&&t.nice(o),{type:i,domain:[m,g],pivot:l,interpolate:h,scale:t}}function q5(e,t,n){return e_(e,Wp(),jZ,t,n)}function j5(e,t,n){return wE(e,t,{...n,exponent:.5})}function wE(e,t,{exponent:n=1,...r}){return e_(e,ux().exponent(n=+n),GZ(n),t,{...r,type:"diverging-pow"})}function V5(e,t,{base:n=10,pivot:r=1,domain:i=Nf(t,r<0?Va:sr),...o}){return e_(e,cx().base(n=+n),VZ,t,{domain:i,pivot:r,...o})}function Y5(e,t,{constant:n=1,...r}){return e_(e,lx().constant(n=+n),WZ(n),t,r)}var jZ={apply(e){return e},invert(e){return e}},VZ={apply:Math.log,invert:Math.exp},YZ={apply(e){return Math.sign(e)*Math.sqrt(Math.abs(e))},invert(e){return Math.sign(e)*(e*e)}};function GZ(e){return e===.5?YZ:{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 WZ(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 G5(e,t,n,r){return Rf(e,t,n,r)}function W5(e,t,n){return G5(e,ox(),t,n)}function X5(e,t,n){return G5(e,sx(),t,n)}var Of=Symbol("ordinal");function Z5(e,t,n,{type:r,interval:i,domain:o,range:s,reverse:a,hint:c}){return i=ko(i,r),o===void 0&&(o=eB(n,i,e)),(r==="categorical"||r===Of)&&(r="ordinal"),a&&(o=Ra(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 Q5(e,t,{type:n,interval:r,domain:i,range:o,scheme:s,unknown:a,...c}){r=ko(r,n),i===void 0&&(i=eB(t,r,e));let l;if(fe.get(e)===wf)l=XZ(t),o=o===void 0?HZ(l):Yt(o,vf);else if(fe.get(e)===qr&&(o===void 0&&(n==="ordinal"||n===Of)&&(o=O5(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})=>Cn(p=>u(f+d*p),h)}else o=yE(s);if(a===Op)throw new Error(`implicit unknown on ${e} scale is not supported`);return Z5(e,ul().unknown(a),t,{...c,type:n,domain:i,range:o,hint:l})}function K5(e,t,{align:n=.5,padding:r=.5,...i}){return tB(PI().align(n).padding(r),t,i,e)}function J5(e,t,{align:n=.5,padding:r=.1,paddingInner:i=r,paddingOuter:o=e==="fx"||e==="fy"?0:r,...s}){return tB(za().align(n).paddingInner(i).paddingOuter(o),t,s,e)}function tB(e,t,n,r){let{round:i}=n;return i!==void 0&&e.round(i=!!i),e=Z5(r,e,t,n),e.round=i,e}function eB(e,t,n){let r=new Qn;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 uo(r,fn)}function H5(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 XZ(e){return{fill:H5(e,"fill"),stroke:H5(e,"stroke")}}function HZ(e){return ne(e.fill)?yT:E1}function Nm(e,{label:t,inset:n=0,insetTop:r=n,insetRight:i=n,insetBottom:o=n,insetLeft:s=n,round:a,nice:c,clamp:l,zero:u,align:f,padding:d,projection:h,facet:{label:p=t}={},...m}={}){let g={};for(let[y,b]of e){let x=m[y],_=lB(y,b,{round:fe.get(y)===mi?a:void 0,nice:c,clamp:l,zero:u,align:f,padding:d,projection:h,...x});if(_){let{label:v=y==="fx"||y==="fy"?p:t,percent:w,transform:T,inset:M,insetTop:R=M!==void 0?M:y==="y"?r:0,insetRight:I=M!==void 0?M:y==="x"?i:0,insetBottom:A=M!==void 0?M:y==="y"?o:0,insetLeft:O=M!==void 0?M:y==="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?ZZ(b,_):v,_.transform=T,y==="x"||y==="fx"?(_.insetLeft=+O,_.insetRight=+I):(y==="y"||y==="fy")&&(_.insetTop=+R,_.insetBottom=+A),g[y]=_}}return g}function SE(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]=fB(i),n[r]=o,o.type=s,a!=null&&(o.interval=a),c!=null&&(o.label=c)}return n}function sB(e,t){let{x:n,y:r,fx:i,fy:o}=e,s=i||o?i_(t):t;i&&nB(i,s),o&&rB(o,s);let a=i||o?IE(e,t):t;n&&nB(n,a),r&&rB(r,a)}function ZZ(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!Co(t)&&t.percent&&(n=`${n} (%)`),{inferred:!0,toString:()=>n}}function r_(e){return Math.sign(js(e.domain()))*Math.sign(js(e.range()))}function i_(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 IE({fx:e,fy:t},n){let{marginTop:r,marginRight:i,marginBottom:o,marginLeft:s,width:a,height:c}=i_(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 nB(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)],Co(e)||(e.range=cB(e)),e.scale.range(e.range)}aB(e)}function rB(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],Co(e)?e.range.reverse():e.range=cB(e),e.scale.range(e.range)}aB(e)}function aB(e){e.round===void 0&&JZ(e)&&QZ(e)<=30&&e.scale.round(!0)}function QZ({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 cB(e){let t=e.scale.domain().length+TE(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 o_(e,t,n){return lB(e,n===void 0?void 0:[{hint:n}],{...t})}function lB(e,t=[],n={}){let r=KZ(e,t,n);if(n.type===void 0&&n.domain===void 0&&n.range===void 0&&n.interval==null&&e!=="fx"&&e!=="fy"&&Co({type:r})){let i=t.map(({value:o})=>o).filter(o=>o!==void 0);i.some(Oe)?jn(`Warning: some data associated with the ${e} scale are dates. Dates are typically associated with a "utc" or "time" scale rather than a "${Df(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 "${Df(r)}".`):i.some(jC)?jn(`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 "${Df(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 "${Df(r)}".`):i.some(VC)&&jn(`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 "${Df(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 "${Df(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=n_(t,n,Qe);break;case"identity":switch(fe.get(e)){case mi:n=n_(t,n,Qe);break;case wf:n=n_(t,n,tQ);break}break;case"utc":case"time":n=n_(t,n,PC);break}switch(r){case"diverging":return q5(e,t,n);case"diverging-sqrt":return j5(e,t,n);case"diverging-pow":return wE(e,t,n);case"diverging-log":return V5(e,t,n);case"diverging-symlog":return Y5(e,t,n);case"categorical":case"ordinal":case Of:return Q5(e,t,n);case"cyclical":case"sequential":case"linear":return F5(e,t,n);case"sqrt":return L5(e,t,n);case"threshold":return t_(e,t,n);case"quantile":return P5(e,t,n);case"quantize":return $5(e,t,n);case"pow":return _E(e,t,n);case"log":return C5(e,t,n);case"symlog":return B5(e,t,n);case"utc":return X5(e,t,n);case"time":return W5(e,t,n);case"point":return K5(e,t,n);case"band":return J5(e,t,n);case"identity":return U5(e);case void 0:return;default:throw new Error(`unknown scale type: ${r}`)}}function Df(e){return typeof e=="symbol"?e.description:e}function iB(e){return typeof e=="string"?`${e}`.toLowerCase():e}var oB={toString:()=>"projection"};function KZ(e,t,{type:n,domain:r,range:i,scheme:o,pivot:s,projection:a}){if(n=iB(n),e==="fx"||e==="fy")return"band";(e==="x"||e==="y")&&a!=null&&(n=oB);for(let l of t){let u=iB(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===oB)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===Sl)return"sqrt";if(c===Tl||c===Il)return"linear";if(c===wf)return"ordinal";if((r||i||[]).length>2)return vE(c);if(r!==void 0){if(Me(r))return vE(c);if(Oe(r))return"utc"}else{let l=t.map(({value:u})=>u).filter(u=>u!==void 0);if(l.some(Me))return vE(c);if(l.some(Oe))return"utc"}if(c===qr){if(s!=null||D5(o))return"diverging";if(R5(o))return"categorical"}return"linear"}function vE(e){switch(e){case mi:return"point";case qr:return Of;default:return"ordinal"}}function Co({type:e}){return e==="ordinal"||e==="point"||e==="band"||e===Of}function TE({type:e}){return e==="threshold"}function JZ({type:e}){return e==="point"||e==="band"}function lr(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 n_(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 tQ(e){return Yt(e,vf)}function kf(e={}){let t;for(let n in e)if(fe.has(n)&&Oo(e[n])){if(t!==void 0)throw new Error("ambiguous scale definition; multiple scales found");t=fB(o_(n,e[n]))}if(t===void 0)throw new Error("invalid scale definition; no scale found");return t}function uB(e){return t=>{if(!fe.has(t=`${t}`))throw new Error(`unknown scale: ${t}`);return e[t]}}function fB({scale:e,type:t,domain:n,range:r,interpolate:i,interval:o,transform:s,percent:a,pivot:c}){if(t==="identity")return{type:"identity",apply:u=>u,invert:u=>u};let l=e.unknown?e.unknown():void 0;return{type:t,domain:Za(n),...r!==void 0&&{range:Za(r)},...s!==void 0&&{transform:s},...a&&{percent:a},...l!==void 0&&{unknown:l},...o!==void 0&&{interval:o},...i!==void 0&&{interpolate:i},...e.clamp&&{clamp:e.clamp()},...c!==void 0&&{pivot:c,symmetric:!1},...e.base&&{base:e.base()},...e.exponent&&{exponent:e.exponent()},...e.constant&&{constant:e.constant()},...e.align&&{align:e.align(),round:e.round()},...e.padding&&(e.paddingInner?{paddingInner:e.paddingInner(),paddingOuter:e.paddingOuter()}:{padding:e.padding()}),...e.bandwidth&&{bandwidth:e.bandwidth(),step:e.step()},apply:u=>e(u),...e.invert&&{invert:u=>e.invert(u)}}}function hB(e,t,n={}){let r=.5-De,i=.5+De,o=.5+De,s=.5-De;for(let{marginTop:m,marginRight:g,marginBottom:y,marginLeft:b}of t)m>r&&(r=m),g>i&&(i=g),y>o&&(o=y),b>s&&(s=b);let{margin:a,marginTop:c=a!==void 0?a:r,marginRight:l=a!==void 0?a:i,marginBottom:u=a!==void 0?a:o,marginLeft:f=a!==void 0?a:s}=n;c=+c,l=+l,u=+u,f=+f;let{width:d=640,height:h=eQ(e,n,{width:d,marginTopDefault:r,marginRightDefault:i,marginBottomDefault:o,marginLeftDefault:s})+Math.max(0,c-r+u-o)}=n;d=+d,h=+h;let p={width:d,height:h,marginTop:c,marginRight:l,marginBottom:u,marginLeft:f};if(e.fx||e.fy){let{margin:m,marginTop:g=m!==void 0?m:c,marginRight:y=m!==void 0?m:l,marginBottom:b=m!==void 0?m:u,marginLeft:x=m!==void 0?m:f}=n.facet??{};g=+g,y=+y,b=+b,x=+x,p.facet={marginTop:g,marginRight:y,marginBottom:b,marginLeft:x}}return p}function eQ({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=S5(i);if(d){let p=r?r.scale.domain().length:1,m=(1.1*f-.1)/(1.1*p-.1)*d,g=Math.max(.1,Math.min(10,m));return Math.round((s-u-c)*g+a+l)}let h=t?Co(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=dB("y",t)/(dB("x",e)*o),m=r?r.scale.bandwidth():1,g=n?n.scale.bandwidth():1,y=m*(s-u-c)-e.insetLeft-e.insetRight;return(p*y+t.insetTop+t.insetBottom)/g+a+l}return!!(t||n)*Math.max(1,Math.min(60,h*f))*20+!!r*30+60}function dB(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 mB(e,t){let{fx:n,fy:r}=Nm(e,t),i=n?.scale.domain(),o=r?.scale.domain();return i&&o?v0(i,o).map(([s,a],c)=>({x:s,y:a,i:c})):i?i.map((s,a)=>({x:s,i:a})):o?o.map((s,a)=>({y:s,i:a})):void 0}function yB(e,{x:t,y:n}){return t&&=RE(t),n&&=RE(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 a_(e,{fx:t,fy:n}){let r=ar(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 gB(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 bB(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 nQ=new Map([["top",EE],["right",NE],["bottom",AE],["left",ME],["top-left",s_(EE,ME)],["top-right",s_(EE,NE)],["bottom-left",s_(AE,ME)],["bottom-right",s_(AE,NE)],["top-empty",iQ],["right-empty",aQ],["bottom-empty",oQ],["left-empty",sQ],["empty",cQ]]);function xB(e){if(e==null)return null;let t=nQ.get(`${e}`.toLowerCase());if(t)return t;throw new Error(`invalid facet anchor: ${e}`)}var pB=new WeakMap;function RE(e){let t=pB.get(e);return t||pB.set(e,t=new Zn(Yt(e,(n,r)=>[n,r]))),t}function ic(e,t){return RE(e).get(t)}function rQ(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 c_(e,t,n){return rQ(e,t,n)?.empty}function EE(e,{y:t},{y:n}){return t?ic(t,n)===0:!0}function AE(e,{y:t},{y:n}){return t?ic(t,n)===t.length-1:!0}function ME(e,{x:t},{x:n}){return t?ic(t,n)===0:!0}function NE(e,{x:t},{x:n}){return t?ic(t,n)===t.length-1:!0}function iQ(e,{y:t},{x:n,y:r,empty:i}){if(i)return!1;if(!t)return;let o=ic(t,r);if(o>0)return c_(e,n,t[o-1])}function oQ(e,{y:t},{x:n,y:r,empty:i}){if(i)return!1;if(!t)return;let o=ic(t,r);if(o<t.length-1)return c_(e,n,t[o+1])}function sQ(e,{x:t},{x:n,y:r,empty:i}){if(i)return!1;if(!t)return;let o=ic(t,n);if(o>0)return c_(e,t[o-1],r)}function aQ(e,{x:t},{x:n,y:r,empty:i}){if(i)return!1;if(!t)return;let o=ic(t,n);if(o<t.length-1)return c_(e,t[o+1],r)}function cQ(e,t,{empty:n}){return n}function s_(e,t){return function(){return e.apply(null,arguments)&&t.apply(null,arguments)}}function l_(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:m=d,marginLeft:g=d,clip:y=i?.clip,channels:b,tip:x,render:_}=r;if(this.data=t,this.sort=Do(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===Xa&&typeof a=="string"?[a]:a,this.fy=t===Xa&&typeof c=="string"?[c]:c),this.facetAnchor=xB(s),n=xm(n),b!==void 0&&(n={...lQ(b),...n}),i!==void 0&&(n={...Z1(this,r,i),...n}),this.channels=Object.fromEntries(Object.entries(n).map(([v,w])=>{if(zr(w.value)){let{value:T,label:M=w.label,scale:R=w.scale}=w.value;w={...w,label:M,scale:R,value:T}}if(t===Xa&&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=+m,this.marginLeft=+g,this.clip=K1(y),this.tip=uQ(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=Ff(_,this.render))}initialize(t,n,r){let i=qe(this.data);t===void 0&&i!=null&&(t=[ar(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=W1(this.channels,i);return this.sort!=null&&u5(i,t,s,n,this.sort),{data:i,facets:t,channels:s}}filter(t,n,r){for(let i in n){let{filter:o=Ue}=n[i];if(o!==null){let s=r[i];t=t.filter(a=>o(s[a]))}}return t}project(t,n,r){for(let i in t)if(t[i].scale==="x"&&/^x|x$/.test(i)){let o=i.replace(/^x|x$/,"y");o in t&&t[o].scale==="y"&&mE(i,o,n,r.projection)}}scale(t,n,r){let i=Tf(t,n);return r.projection&&this.project(t,i,r),i}};function Je(...e){return e.plot=wt.prototype.plot,e}function Ff(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 lQ(e){return Object.fromEntries(Object.entries(xm(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 uQ(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 _B=new WeakMap;function OE(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:Ff(function(u,f,d,h,p,m){p={...p,pointerSticky:!1};let g=p.ownerSVGElement,{data:y}=p.getMarkState(this),b=_B.get(g);b||_B.set(g,b={sticky:!1,roots:[],renders:[]});let x=b.renders.push(X)-1,{x:_,y:v,fx:w,fy:T}=f,M=w?w(u.fx)-h.marginLeft:0,R=T?T(u.fy)-h.marginTop:0;_?.bandwidth&&(M+=_.bandwidth()/2),v?.bandwidth&&(R+=v.bandwidth()/2);let I=u.fi!=null,A;if(I){let Y=b.facetStates;Y||(b.facetStates=Y=new Map),A=Y.get(this),A||Y.set(this,A=new Map)}let[O,F]=yn(this,h),{px:S,py:E}=d,N=S?Y=>S[Y]:DE(d,O),L=E?Y=>E[Y]:kE(d,F),B,C,P,$;function U(Y,rt){if(I)if($&&($=cancelAnimationFrame($)),Y==null)A.delete(u.fi);else{A.set(u.fi,rt),$=requestAnimationFrame(()=>{$=null;for(let[q,H]of A)if(H<rt||H===rt&&q<u.fi){Y=null;break}X(Y)});return}X(Y)}function X(Y){if(B===Y&&P===b.sticky)return;B=Y,P=p.pointerSticky=b.sticky;let rt=B==null?[]:[B];I&&(rt.fx=u.fx,rt.fy=u.fy,rt.fi=u.fi);let q=m(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 b.roots[x]=C=q,B==null&&A?.size>1||p.dispatchValue(B==null?null:y[B]),q}function tt(Y){if(b.sticky||Y.pointerType==="mouse"&&Y.buttons===1)return;let[rt,q]=Ln(Y);rt-=M,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*(L(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=L(z)-q;Lt=dt*dt+Wt*Wt}U(z,Lt)}function nt(Y){Y.pointerType==="mouse"&&B!=null&&(b.sticky&&b.roots.some(rt=>rt?.contains(Y.target))||(b.sticky?(b.sticky=!1,b.renders.forEach(rt=>rt(null))):(b.sticky=!0,X(B)),Y.stopImmediatePropagation()))}function st(Y){Y.pointerType==="mouse"&&(b.sticky||U(null))}return g.addEventListener("pointerenter",tt),g.addEventListener("pointermove",tt),g.addEventListener("pointerdown",nt),g.addEventListener("pointerleave",st),X(null)},c)}}function Lf(e){return OE(1,1,e)}function Cf(e){return OE(1,.01,e)}function Al(e){return OE(.01,1,e)}function DE({x1:e,x2:t,x:n=e},r){return e&&t?i=>(e[i]+t[i])/2:n?i=>n[i]:()=>r}function kE({y1:e,y2:t,y:n=e},r){return e&&t?i=>(e[i]+t[i])/2:n?i=>n[i]:()=>r}function u_(e){return Co(e)&&e.interval===void 0?void 0:"tabular-nums"}function wB(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=u_(e),round:p=!0,opacity:m,className:g}=t,y=nc(t);g=Ef(g),m=ie(m)[1],d===null&&(d=()=>null);let b=ct("svg",y).attr("class",`${g}-ramp`).attr("font-family","system-ui, sans-serif").attr("font-size",10).attr("width",i).attr("height",o).attr("viewBox",`0 0 ${i} ${o}`).call(O=>O.append("style").text(`:where(.${g}-ramp) {
17
17
  display: block;
18
18
  height: auto;
19
19
  height: intrinsic;
20
20
  max-width: 100%;
21
21
  overflow: visible;
22
22
  }
23
- :where(.${b}-ramp text) {
23
+ :where(.${g}-ramp text) {
24
24
  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]===`
25
+ }`)).call(Af,u),x=O=>O.selectAll(".tick line").attr("y1",s+c-o),_,v=p?(O,F)=>O.rangeRound(F):(O,F)=>O.range(F),{type:w,domain:T,range:M,interpolate:R,scale:I,pivot:A}=e;if(R){let O=M===void 0?R:mo(R.length===1?Mm(R):R,M);_=v(I.copy(),Cn(we(l,i-a),Math.min(T.length+(A!==void 0),M===void 0?1/0:M.length)));let F=256,S=y.document.createElement("canvas");S.width=F,S.height=1;let E=S.getContext("2d");for(let N=0,L=F-1;N<F;++N)E.fillStyle=O(N/L),E.fillRect(N,0,1,1);b.append("image").attr("opacity",m).attr("x",l).attr("y",s).attr("width",i-l-a).attr("height",o-s-c).attr("preserveAspectRatio","none").attr("xlink:href",S.toDataURL())}else if(w==="threshold"){let O=T,F=d===void 0?S=>S:typeof d=="string"?ci(d):d;_=v(ks().domain([-1,M.length-1]),[l,i-a]),b.append("g").attr("fill-opacity",m).selectAll().data(M).enter().append("rect").attr("x",(S,E)=>_(E-1)).attr("y",s).attr("width",(S,E)=>_(E)-_(E-1)).attr("height",o-s-c).attr("fill",S=>S),f=Yt(O,(S,E)=>E),d=S=>F(O[S],S)}else _=v(za().domain(T),[l,i-a]),b.append("g").attr("fill-opacity",m).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 b.append("g").attr("transform",`translate(0,${o-c})`).call(W2(_).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&&b.append("text").attr("x",l).attr("y",s-6).attr("fill","currentColor").attr("font-weight","bold").text(n),b.node()}var Bf=Math.PI/180;function Vi(e,{marker:t,markerStart:n=t,markerMid:r=t,markerEnd:i=t}={}){e.markerStart=FE(n),e.markerMid=FE(r),e.markerEnd=FE(i)}function FE(e){if(e==null||e===!1)return null;if(e===!0)return SB;if(typeof e=="function")return e;switch(`${e}`.toLowerCase()){case"none":return null;case"arrow":return vB("auto");case"arrow-reverse":return vB("auto-start-reverse");case"dot":return fQ;case"circle":case"circle-fill":return SB;case"circle-stroke":return dQ;case"tick":return LE("auto");case"tick-x":return LE(90);case"tick-y":return LE(0)}throw new Error(`invalid marker: ${e}`)}function vB(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 fQ(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 SB(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 dQ(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 LE(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 hQ=0;function Js(e,t,{stroke:n},r){return TB(e,t,n&&(i=>n[i]),r)}function IB(e,t,{stroke:n},r){return TB(e,t,n&&(([i])=>n[i]),r)}function TB(e,{markerStart:t,markerMid:n,markerEnd:r,stroke:i},o=()=>i,s){let a=new Map;function c(l){return function(u){let f=o(u),d=a.get(l);d||a.set(l,d=new Map);let h=d.get(f);if(!h){let p=this.parentNode.insertBefore(l(f,s),this),m=`plot-marker-${++hQ}`;p.setAttribute("id",m),d.set(f,h=`url(#${m})`)}return h}}t&&e.attr("marker-start",c(t)),n&&e.attr("marker-mid",c(n)),r&&e.attr("marker-end",c(r))}function Ml({inset:e,insetLeft:t,insetRight:n,...r}={}){return[t,n]=EB(e,t,n),{inset:e,insetLeft:t,insetRight:n,...r}}function Nl({inset:e,insetTop:t,insetBottom:n,...r}={}){return[t,n]=EB(e,t,n),{inset:e,insetTop:t,insetBottom:n,...r}}function EB(e,t,n){return e===void 0&&t===void 0&&n===void 0?De?[1,0]:[.5,.5]:[t,n]}function AB(e,{interval:t}){return e={...pi(e)},e.interval=_f(e.interval===void 0?t:e.interval),e}function f_(e,t,n,r){let{[e]:i,[`${e}1`]:o,[`${e}2`]:s}=n,{value:a,interval:c}=AB(i,n);if(a==null||c==null&&!r)return n;let l=On(i);if(c==null){let h,p={transform:m=>h||(h=mt(m,a)),label:l};return{...n,[e]:void 0,[`${e}1`]:o===void 0?p:o,[`${e}2`]:s===void 0&&!(o===s&&r)?p:s}}let u,f;function d(h){return f!==void 0&&h===u?f:f=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 MB(e,t,n){let{[e]:r}=n,{value:i,interval:o}=AB(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 CE(e={}){return f_("x",Ml,e,!0)}function BE(e={}){return f_("y",Nl,e,!0)}function d_(e={}){return f_("x",Ml,e)}function h_(e={}){return f_("y",Nl,e)}function p_(e={}){return MB("x",Ml,e)}function m_(e={}){return MB("y",Nl,e)}var NB={ariaLabel:"rule",fill:null,stroke:"currentColor"},Rm=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"),NB),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:m,marginBottom:g}=i,{insetTop:y,insetBottom:b}=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[_]:(m+f-p)/2).attr("x2",c?_=>c[_]:(m+f-p)/2).attr("y1",l&&!lr(a)?_=>l[_]+y:h+y).attr("y2",u&&!lr(a)?a.bandwidth?_=>u[_]+a.bandwidth()-b:_=>u[_]-b:d-g-b).call(Zt,this,r).call(Js,this,r,o)).node()}},Om=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"),NB),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:m,marginBottom:g}=i,{insetLeft:y,insetRight:b}=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&&!lr(s)?_=>l[_]+y:m+y).attr("x2",u&&!lr(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(Zt,this,r).call(Js,this,r,o)).node()}};function jr(e,t){let{x:n=W,y:r,y1:i,y2:o,...s}=h_(t);return[i,o]=RB(r,i,o),new Rm(e,{...s,x:n,y1:i,y2:o})}function Vr(e,t){let{y:n=W,x:r,x1:i,x2:o,...s}=d_(t);return[i,o]=RB(r,i,o),new Om(e,{...s,y:n,x1:i,x2:o})}function RB(e,t,n){if(e==null){if(t===void 0){if(n!==void 0)return[0,n]}else if(n===void 0)return[0,t]}else{if(t===void 0)return n===void 0?[0,e]:[e,n];if(n===void 0)return[e,t]}return[t,n]}function oc(e,...t){let n=t.length;for(let r=0,i=!0;r<n;++r)typeof t[r]!="function"&&(i&&(e=e.slice(),i=!1),e.splice(r,2,e[r]+t[r]+e[r+1]),t.splice(r,1),--r,--n);return r=>{let i=e[0];for(let o=0;o<n;++o)i+=t[o](r)+e[o+1];return i}}var pQ={ariaLabel:"text",strokeLinejoin:"round",strokeWidth:3,paintOrder:"stroke"},LB="\xAD",Ol=class extends wt{constructor(t,n={}){let{x:r,y:i,text:o=cr(t)&&B1(t)?W:Ae,frameAnchor:s,textAnchor:a=/right$/i.test(s)?"end":/left$/i.test(s)?"start":"middle",lineAnchor:c=/^top/i.test(s)?"top":/^bottom/i.test(s)?"bottom":"middle",lineHeight:l=1,lineWidth:u=1/0,textOverflow:f,monospace:d,fontFamily:h=d?"ui-monospace, monospace":void 0,fontSize:p,fontStyle:m,fontVariant:g,fontWeight:y,rotate:b}=n,[x,_]=ie(b,0),[v,w]=bQ(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:zC(x),optional:!0},text:{value:o,filter:hm,optional:!0}},n,pQ),this.rotate=_,this.textAnchor=le(a,"middle"),this.lineAnchor=Ke(c,"lineAnchor",["top","middle","bottom"]),this.lineHeight=+l,this.lineWidth=+u,this.textOverflow=$E(f),this.monospace=!!d,this.fontFamily=ze(h),this.fontSize=w,this.fontStyle=ze(m),this.fontVariant=ze(g),this.fontWeight=ze(y),this.frameAnchor=Fo(s),!(this.lineWidth>=0))throw new Error(`invalid lineWidth: ${u}`);this.splitLines=zE(this),this.clipLine=qE(this)}render(t,n,r,i,o){let{x:s,y:a}=n,{x:c,y:l,rotate:u,text:f,title:d,fontSize:h}=r,{rotate:p}=this,[m,g]=yn(this,i);return ct("svg:g",o).call(Ft,this,i,o).call(UE,this,f,i).call(It,this,{x:c&&s,y:l&&a}).call(y=>y.selectAll().data(t).enter().append("text").call(Rt,this).call(mQ,this,f,d).attr("transform",oc`translate(${c?b=>c[b]:m},${l?b=>l[b]:g})${u?b=>` rotate(${u[b]})`:p?` rotate(${p})`:""}`).call(ft,"font-size",h&&(b=>h[b])).call(Zt,this,r)).node()}};function $E(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 mQ(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 m=this.ownerDocument.createElementNS(ii.svg,"tspan");m.setAttribute("x",0),p===h-1?m.setAttribute("y",`${(d+p)*o}em`):m.setAttribute("dy",`${h*o}em`),m.textContent=u[p],this.appendChild(m),h=0}}else d&&this.setAttribute("y",`${d*o}em`),this.textContent=u[0];if(s&&!r&&u[0]!==n[l]){let h=this.ownerDocument.createElementNS(ii.svg,"title");h.textContent=n[l],this.appendChild(h)}})}function Bo(e,{x:t,y:n,...r}={}){return r.frameAnchor===void 0&&([t,n]=Be(t,n)),new Ol(e,{...r,x:t,y:n})}function y_(e,{x:t=W,...n}={}){return new Ol(e,m_({...n,x:t}))}function g_(e,{y:t=W,...n}={}){return new Ol(e,p_({...n,y:t}))}function UE(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?yQ(n):t.fontVariant),ft(e,"font-weight",t.fontWeight)}function yQ(e){return e&&(Ws(e)||Oe(e))?"tabular-nums":void 0}var gQ=new Set(["inherit","initial","revert","unset","xx-small","x-small","small","medium","large","x-large","xx-large","xxx-large","larger","smaller"]);function bQ(e){return e==null||typeof e=="number"?[void 0,e]:typeof e!="string"?[e,void 0]:(e=e.trim().toLowerCase(),gQ.has(e)||/^[+-]?\d*\.?\d+(e[+-]?\d+)?(\w*|%)$/.test(e)?[void 0,e]:[e,void 0])}function xQ(e,t,n){let r=[],i,o=0;for(let[s,a,c]of _Q(e)){if(i===void 0&&(i=s),o>i&&n(e,i,a)>t&&(r.push(e.slice(i,o)+(e[o-1]===LB?"-":"")),i=s),c){r.push(e.slice(i,a)),i=void 0;continue}o=a}return r}function*_Q(e){let t=0,n=0,r=e.length;for(;n<r;){let i=1;switch(e[n]){case LB:case"-":++n,yield[t,n,!1],t=n;break;case" ":for(yield[t,n,!1];e[++n]===" ";);t=n;break;case"\r":e[n+1]===`
26
26
  `&&++i;case`
27
- `:yield[t,n,!0],n+=i,t=n;break;default:++n;break}}yield[t,n,!0]}var 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) {
27
+ `:yield[t,n,!0],n+=i,t=n;break;default:++n;break}}yield[t,n,!0]}var OB={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 b_(e,t=0,n=e.length){let r=0;for(let i=t;i<n;i=Pf(e,i))r+=OB[e[i]]??(BB(e,i)?120:OB.e);return r}function x_(e,t=0,n=e.length){let r=0;for(let i=t;i<n;i=Pf(e,i))r+=BB(e,i)?126:63;return r}function zE({monospace:e,lineWidth:t,textOverflow:n}){if(n!=null||t==1/0)return o=>o.split(/\r\n?|\n/g);let r=e?x_:b_,i=t*100;return o=>xQ(o,i,r)}function qE({monospace:e,lineWidth:t,textOverflow:n}){if(n==null||t==1/0)return o=>o;let r=e?x_:b_,i=t*100;switch(n){case"clip-start":return o=>kB(o,i,r,"");case"clip-end":return o=>DB(o,i,r,"");case"ellipsis-start":return o=>kB(o,i,r,Rl);case"ellipsis-middle":return o=>wQ(o,i,r,Rl);case"ellipsis-end":return o=>DB(o,i,r,Rl)}}var Rl="\u2026";function Dl(e,t,n,r){let i=[],o=0;for(let s=0,a=0,c=e.length;s<c;s=a){a=Pf(e,s);let l=n(e,s,a);if(o+l>t){for(o+=r;o>t&&s>0;)a=s,s=i.pop(),o-=n(e,s,a);return[s,t-o]}o+=l,i.push(s)}return[-1,0]}function DB(e,t,n,r){e=e.trim();let i=n(r),[o]=Dl(e,t,n,i);return o<0?e:e.slice(0,o).trimEnd()+r}function wQ(e,t,n,r){e=e.trim();let i=n(e);if(i<=t)return e;let o=n(r)/2,[s,a]=Dl(e,t/2,n,o),[c]=Dl(e,i-t/2-a+o,n,-o);return c<0?r:e.slice(0,s).trimEnd()+r+e.slice(Pf(e,c)).trimStart()}function kB(e,t,n,r){e=e.trim();let i=n(e);if(i<=t)return e;let o=n(r),[s]=Dl(e,i-t+o,n,-o);return s<0?r:r+e.slice(Pf(e,s)).trimStart()}var PE=/[\p{Combining_Mark}\p{Emoji_Modifier}]+/uy,FB=/\p{Extended_Pictographic}/uy;function Pf(e,t){return t+=vQ(e,t)?2:1,IQ(e,t)&&(t=PE.lastIndex),SQ(e,t)?Pf(e,t+1):t}function CB(e,t){return e.charCodeAt(t)<128}function vQ(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 SQ(e,t){return e.charCodeAt(t)===8205}function IQ(e,t){return CB(e,t)?!1:(PE.lastIndex=t,PE.test(e))}function BB(e,t){return CB(e,t)?!1:(FB.lastIndex=t,FB.test(e))}var PB={ariaLabel:"vector",fill:"none",stroke:"currentColor",strokeWidth:1.5,strokeLinejoin:"round",strokeLinecap:"round"},$B=3.5,TQ=$B*5,UB={draw(e,t,n){let r=t*n/TQ;e.moveTo(0,0),e.lineTo(0,-t),e.moveTo(-r,r-t),e.lineTo(0,-t),e.lineTo(r,r-t)}},zB={draw(e,t,n){e.moveTo(-n,0),e.lineTo(0,-t),e.lineTo(n,0)}},EQ=new Map([["arrow",UB],["spike",zB]]);function AQ(e){return e&&typeof e.draw=="function"}function MQ(e){if(AQ(e))return e;let t=EQ.get(`${e}`.toLowerCase());if(t)return t;throw new Error(`invalid shape: ${e}`)}var kl=class extends wt{constructor(t,n={}){let{x:r,y:i,r:o=$B,length:s,rotate:a,shape:c=UB,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=MQ(c),this.anchor=Ke(l,"anchor",["start","middle","end"]),this.frameAnchor=Fo(u)}render(t,n,r,i,o){let{x:s,y:a}=n,{x:c,y:l,length:u,rotate:f}=r,{length:d,rotate:h,anchor:p,shape:m,r:g}=this,[y,b]=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",oc`translate(${c?_=>c[_]:y},${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=er();return m.draw(v,u[_],g),v}:(()=>{let _=er();return m.draw(_,d,g),_})()).call(Zt,this,r)).node()}};function jE(e,t={}){let{x:n,y:r,...i}=t;return t.frameAnchor===void 0&&([n,r]=Be(n,r)),new kl(e,{...i,x:n,y:r})}function __(e,t={}){let{x:n=W,...r}=t;return new kl(e,{...r,x:n})}function w_(e,t={}){let{y:n=W,...r}=t;return new kl(e,{...r,y:n})}function qB(e,t={}){let{shape:n=zB,stroke:r=PB.stroke,strokeWidth:i=1,fill:o=r,fillOpacity:s=.3,anchor:a="start",...c}=t;return jE(e,{...c,shape:n,stroke:r,strokeWidth:i,fill:o,fillOpacity:s,anchor:a})}function sc(e,t){return arguments.length<2&&!cr(e)&&(t=e,e=null),t===void 0&&(t={}),[e,t]}function v_({anchor:e}={},t){return e===void 0?t[0]:Ke(e,"anchor",t)}function jB(e){return v_(e,["left","right"])}function VB(e){return v_(e,["right","left"])}function YB(e){return v_(e,["bottom","top"])}function GB(e){return v_(e,["top","bottom"])}function Dm(){let[e,t]=sc(...arguments);return WB("y",jB(t),e,t)}function S_(){let[e,t]=sc(...arguments);return WB("fy",VB(t),e,t)}function km(){let[e,t]=sc(...arguments);return XB("x",YB(t),e,t)}function I_(){let[e,t]=sc(...arguments);return XB("fx",GB(t),e,t)}function WB(e,t,n,{color:r="currentColor",opacity:i=1,stroke:o=r,strokeOpacity:s=i,strokeWidth:a=1,fill:c=r,fillOpacity:l=i,textAnchor:u,textStroke:f,textStrokeOpacity:d,textStrokeWidth:h,tickSize:p=e==="y"?6:0,tickPadding:m,tickRotate:g,x:y,margin: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:T,labelAnchor:M,labelArrow:R,labelOffset:I,...A}){return p=Nt(p),m=Nt(m),g=Nt(g),M!==void 0&&(M=Ke(M,"labelAnchor",["center","top","bottom"])),R=n7(R),Je(p&&!ne(o)?NQ(e,t,n,{stroke:o,strokeOpacity:s,strokeWidth:a,tickSize:p,tickPadding:m,tickRotate:g,x:y,...A}):null,ne(c)?null:OQ(e,t,n,{fill:c,fillOpacity:l,stroke:f,strokeOpacity:d,strokeWidth:h,textAnchor:u,tickSize:p,tickPadding:m,tickRotate:g,x:y,marginTop:x,marginRight:_,marginBottom:v,marginLeft:w,...A}),!ne(c)&&T!==null?Bo([],KB({fill:c,fillOpacity:l,...A},function(O,F,S,E,N){let L=E[e],{marginTop:B,marginRight:C,marginBottom:P,marginLeft:$}=e==="y"&&N.inset||N,U=M??(L.bandwidth?"center":"top"),X=I??(t==="right"?C:$)-3;return U==="center"?(this.textAnchor=void 0,this.lineAnchor=t==="right"?"bottom":"top",this.frameAnchor=t,this.rotate=-90):(this.textAnchor=t==="right"?"end":"start",this.lineAnchor=U,this.frameAnchor=`${U}-${t}`,this.rotate=0),this.dy=U==="top"?3-B:U==="bottom"?P-3:0,this.dx=t==="right"?X:-X,this.ariaLabel=`${e}-axis label`,{facets:[[0]],channels:{text:{value:[e7(e,L,{anchor:t,label:T,labelAnchor:U,labelArrow:R})]}}}})):null)}function XB(e,t,n,{color:r="currentColor",opacity:i=1,stroke:o=r,strokeOpacity:s=i,strokeWidth:a=1,fill:c=r,fillOpacity:l=i,textAnchor:u,textStroke:f,textStrokeOpacity:d,textStrokeWidth:h,tickSize:p=e==="x"?6:0,tickPadding:m,tickRotate:g,y,margin: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:T,labelAnchor:M,labelArrow:R,labelOffset:I,...A}){return p=Nt(p),m=Nt(m),g=Nt(g),M!==void 0&&(M=Ke(M,"labelAnchor",["center","left","right"])),R=n7(R),Je(p&&!ne(o)?RQ(e,t,n,{stroke:o,strokeOpacity:s,strokeWidth:a,tickSize:p,tickPadding:m,tickRotate:g,y,...A}):null,ne(c)?null:DQ(e,t,n,{fill:c,fillOpacity:l,stroke:f,strokeOpacity:d,strokeWidth:h,textAnchor:u,tickSize:p,tickPadding:m,tickRotate:g,y,marginTop:x,marginRight:_,marginBottom:v,marginLeft:w,...A}),!ne(c)&&T!==null?Bo([],KB({fill:c,fillOpacity:l,...A},function(O,F,S,E,N){let L=E[e],{marginTop:B,marginRight:C,marginBottom:P,marginLeft:$}=e==="x"&&N.inset||N,U=M??(L.bandwidth?"center":"right"),X=I??(t==="top"?B:P)-3;return U==="center"?(this.frameAnchor=t,this.textAnchor=void 0):(this.frameAnchor=`${t}-${U}`,this.textAnchor=U==="right"?"end":"start"),this.lineAnchor=t,this.dy=t==="top"?-X:X,this.dx=U==="right"?C-3:U==="left"?3-$:0,this.ariaLabel=`${e}-axis label`,{facets:[[0]],channels:{text:{value:[e7(e,L,{anchor:t,label:T,labelAnchor:U,labelArrow:R})]}}}})):null)}function NQ(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 $f(w_,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"?CQ:BQ})}function RQ(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 $f(__,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"?FQ:LQ})}function OQ(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*Bf):0),text:c,textAnchor:l=Math.abs(s)>60?"middle":t==="left"?"end":"start",lineAnchor:u=s>60?"top":s<-60?"bottom":"middle",fontVariant:f,inset:d=0,insetLeft:h=d,insetRight:p=d,dx:m=0,y:g=e==="y"?void 0:null,...y}){return $f(g_,e,t,`${e}-axis tick label`,n,{facetAnchor:r,frameAnchor:i,text:c,textAnchor:l,lineAnchor:u,fontVariant:f,rotate:s,y:g,...y,dx:t==="left"?+m-o-a+ +h:+m+ +o+ +a-p},function(b,x,_,v,w){f===void 0&&(this.fontVariant=t7(b)),c===void 0&&(w.text=JB(b,x,_,v,t))})}function DQ(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*Bf):0),text:c,textAnchor:l=Math.abs(s)>=10?s<0^t==="bottom"?"start":"end":"middle",lineAnchor:u=Math.abs(s)>=10?"middle":t==="bottom"?"top":"bottom",fontVariant:f,inset:d=0,insetTop:h=d,insetBottom:p=d,dy:m=0,x:g=e==="x"?void 0:null,...y}){return $f(y_,e,t,`${e}-axis tick label`,n,{facetAnchor:r,frameAnchor:i,text:c===void 0?null:c,textAnchor:l,lineAnchor:u,fontVariant:f,rotate:s,x:g,...y,dy:t==="bottom"?+m+ +o+ +a-p:+m-o-a+ +h},function(b,x,_,v,w){f===void 0&&(this.fontVariant=t7(b)),c===void 0&&(w.text=JB(b,x,_,v,t))})}function T_(){let[e,t]=sc(...arguments);return HB("y",jB(t),e,t)}function E_(){let[e,t]=sc(...arguments);return HB("fy",VB(t),e,t)}function A_(){let[e,t]=sc(...arguments);return ZB("x",YB(t),e,t)}function M_(){let[e,t]=sc(...arguments);return ZB("fx",GB(t),e,t)}function HB(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 $f(Vr,e,t,`${e}-grid`,n,{y:r,x1:o,x2:s,...QB(a)})}function ZB(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 $f(jr,e,t,`${e}-grid`,n,{x:r,y1:o,y2:s,...QB(a)})}function QB({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 KB({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 $f(e,t,n,r,i,o,s){let a;function c(f,d,h,p,m,g){let y=f==null&&(t==="fx"||t==="fy"),{[t]:b}=p;if(!b)throw new Error(`missing scale: ${t}`);let x=b.domain(),{interval:_,ticks:v,tickFormat:w,tickSpacing:T=t==="x"?80:35}=o;if(typeof v=="string"&&r7(b)&&(_=v,v=void 0),v===void 0&&(v=ko(_,b.type)??kQ(b,T)),f==null){if(cr(v))f=qe(v);else if(Qa(v))f=VE(v,...ae(x));else if(b.interval){let R=b.interval;if(b.ticks){let[I,A]=ae(x),O=(A-I)/R[mf];R=qT(R,O/v)??R,f=VE(R,I,A)}else{f=x;let I=f.length;R=qT(R,I/v)??R,R!==b.interval&&(f=VE(R,...ae(f)))}if(R===b.interval){let I=Math.round(f.length/v);I>1&&(f=f.filter((A,O)=>O%I===0))}}else b.ticks?f=b.ticks(v):f=x;if(!b.ticks&&f.length&&f!==x){let R=new Qn(x);f=f.filter(I=>R.has(I)),f.length||jn(`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=[ar(f)]:a[t]={scale:t,value:W}}s?.call(this,b,f,v,w,a);let M=Object.fromEntries(Object.entries(a).map(([R,I])=>[R,{...I,value:mt(f,I.value)}]));return y&&(d=g.filterFacets(f,M)),{data:f,facets:d,channels:M}}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 kQ(e,t){let[n,r]=ae(e.range());return(r-n)/t}function JB(e,t,n,r,i){return{value:Fm(e,t,n,r,i)}}function Fm(e,t,n,r,i){return typeof r=="function"?r:r===void 0&&t&&Oe(t)?kC(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 VE(e,t,n){return e.range(t,e.offset(e.floor(n)))}var FQ={draw(e,t){e.moveTo(0,0),e.lineTo(0,t)}},LQ={draw(e,t){e.moveTo(0,0),e.lineTo(0,-t)}},CQ={draw(e,t){e.moveTo(0,0),e.lineTo(-t,0)}},BQ={draw(e,t){e.moveTo(0,0),e.lineTo(t,0)}};function t7(e){return e.bandwidth&&!e.interval?void 0:"tabular-nums"}function e7(e,t,{anchor:n,label:r=t.label,labelAnchor:i,labelArrow:o}={}){if(!(r==null||r.inferred&&r7(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=r_(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 n7(e="auto"){return ne(e)?!1:typeof e=="boolean"?e:Ke(e,"labelArrow",["auto","up","right","down","left"])}function r7(e){return Oe(e.domain())}function i7(e,t){if(t==null)return t;let n=e(t);if(!n)throw new Error(`scale not found: ${t}`);return n}function o7(e,{opacity:t,...n}={}){if(!Co(e)&&!TE(e))throw new Error(`swatches legend requires ordinal or threshold color scale (not ${e.type})`);return a7(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 s7(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=i7(c,l),p=i7(c,f),m=s*s*Math.PI;return n=ie(n)[1],i=ie(i)[1],o=ie(o)[1],a7(e,a,(g,y,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",n).attr("stroke",f==="color"?_=>p.scale(_):d).attr("stroke-opacity",i).attr("stroke-width",o).append("path").attr("d",_=>{let v=er();return e.scale(_).draw(v,m),v}))}function a7(e,t={},n){let{columns:r,tickFormat:i,fontVariant:o=u_(e),swatchSize:s=15,swatchWidth:a=s,swatchHeight:c=s,marginLeft:l=0,className:u,style:f,width:d}=t,h=nc(t);u=Ef(u),i=Fm(e.scale,e.domain,void 0,i);let p=ct("div",h).attr("class",`${u}-swatches ${u}-swatches-${r!=null?"columns":"wrap"}`),m;return r!=null?(m=`:where(.${u}-swatches-columns .${u}-swatch) {
28
28
  display: flex;
29
29
  align-items: center;
30
30
  break-inside: avoid;
@@ -37,7 +37,7 @@ ${n}`}function gH(e){return e==="time"?O1:e==="utc"?pm:mH}function l5(e,t,n){let
37
37
  white-space: nowrap;
38
38
  overflow: hidden;
39
39
  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) {
40
+ }`,p.style("columns",r).selectAll().data(e.domain).enter().append("div").attr("class",`${u}-swatch`).call(n,e,a,c).call(g=>g.append("div").attr("class",`${u}-swatch-label`).attr("title",i).text(i))):(m=`:where(.${u}-swatches-wrap) {
41
41
  display: flex;
42
42
  align-items: center;
43
43
  min-height: 33px;
@@ -47,7 +47,7 @@ ${n}`}function gH(e){return e==="time"?O1:e==="utc"?pm:mH}function l5(e,t,n){let
47
47
  display: inline-flex;
48
48
  align-items: center;
49
49
  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) {
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(g=>g.insert("style","*").text(`:where(.${u}-swatches) {
51
51
  font-family: system-ui, sans-serif;
52
52
  font-size: 10px;
53
53
  margin-bottom: 0.5em;
@@ -56,7 +56,7 @@ ${n}`}function gH(e){return e==="time"?O1:e==="utc"?pm:mH}function l5(e,t,n){let
56
56
  margin-right: 0.5em;
57
57
  overflow: visible;
58
58
  }
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}) {
59
+ ${m}`)).style("margin-left",l?`${+l}px`:null).style("width",d===void 0?null:`${+d}px`).style("font-variant",le(o,"normal")).call(Af,f).node()}var N_=new Map([["symbol",s7],["color",u7],["opacity",PQ]]);function c7(e={}){for(let[t,n]of N_){let r=e[t];if(Oo(r)){let i=nc(e),o;if(t==="symbol"){let{fill:s,stroke:a=s===void 0&&Oo(e.color)?"color":void 0}=e;o={fill:s,stroke:a}}return n(o_(t,r,o),YE(i,r,e),s=>Oo(e[s])?o_(s,e[s]):null)}}throw new Error("unknown legend type; no scale found")}function l7(e,t,n={}){return(r,i)=>{if(!N_.has(r))throw new Error(`unknown legend type: ${r}`);if(r in e)return N_.get(r)(e[r],YE(t,n[r],i),o=>e[o])}}function YE({className:e,...t},{label:n,ticks:r,tickFormat:i}={},o){return WC(o,{className:e,...t},{label:n,ticks:r,tickFormat:i})}function u7(e,{legend:t=!0,...n}){if(t===!0&&(t=e.type==="ordinal"?"swatches":"ramp"),e.domain!==void 0)switch(`${t}`.toLowerCase()){case"swatches":return o7(e,n);case"ramp":return wB(e,n);default:throw new Error(`unknown legend type: ${t}`)}}function PQ({type:e,interpolate:t,...n},{legend:r=!0,color:i=rn(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 u7({type:e,...n,interpolate:$Q(i)},{legend:r,...o})}function $Q(e){let{r:t,g:n,b:r}=rn(e)||rn(0,0,0);return i=>`rgba(${t},${n},${r},${i})`}function f7(e,t,n){let r=[];for(let[i,o]of N_){let s=n[i];if(s?.legend&&i in e){let a=o(e[i],YE(t,e[i],s),c=>e[c]);a!=null&&r.push(a)}}return r}var UQ={ariaLabel:"frame",fill:"none",stroke:"currentColor",clip:!1},zQ={ariaLabel:"frame",fill:null,stroke:"currentColor",strokeLinecap:"square",clip:!1},Lm=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(Xa,void 0,t,n==null?UQ:zQ),this.anchor=WT(n,"anchor",["top","right","bottom","left"]),this.insetTop=Nt(i),this.insetRight=Nt(o),this.insetBottom=Nt(s),this.insetLeft=Nt(a),this.rx=Nt(c),this.ry=Nt(l)}render(t,n,r,i,o){let{marginTop:s,marginRight:a,marginBottom:c,marginLeft:l,width:u,height:f}=i,{anchor:d,insetTop:h,insetRight:p,insetBottom:m,insetLeft:g,rx:y,ry:b}=this,x=l+g,_=u-a-p,v=s+h,w=f-c-m;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",y).attr("ry",b)).node()}};function Uf(e){return new Lm(e)}var GE={ariaLabel:"tip",fill:"var(--plot-background)",stroke:"currentColor"},qQ=new Set(["geometry","href","src","ariaLabel","scales"]),Cm=class extends wt{constructor(t,n={}){n.tip&&(n={...n,tip:!1}),n.title===void 0&&cr(t)&&B1(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:m,fontWeight:g,lineHeight:y=1,lineWidth:b=20,frameAnchor:x,format:_,textAnchor:v="start",textOverflow:w,textPadding:T=8,title:M,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:M,optional:!0}},n,GE),this.anchor=$1(l,"anchor"),this.preferredAnchor=$1(u,"preferredAnchor"),this.frameAnchor=Fo(x),this.textAnchor=le(v,"middle"),this.textPadding=+T,this.pointerSize=+R,this.pathFilter=ze(I),this.lineHeight=+y,this.lineWidth=+b,this.textOverflow=$E(w),this.monospace=!!f,this.fontFamily=ze(d),this.fontSize=Nt(h),this.fontStyle=ze(p),this.fontVariant=ze(m),this.fontWeight=ze(g);for(let A in GE)A in this.channels&&(this[A]=GE[A]);this.splitLines=zE(this),this.clipLine=qE(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:m,lineWidth:g}=this,{textPadding:y,pointerSize:b,pathFilter:x}=this,{marginTop:_,marginLeft:v}=i,{x1:w,y1:T,x2:M,y2:R,x:I=w??M,y:A=T??R}=r,O=l?l(t.fx)-v:0,F=u?u(t.fy)-_:0,[S,E]=yn(this,i),N=DE(r,S),L=kE(r,E),B=p?x_:b_,C=B(Rl),P,$;"title"in r?(P=r.channels,$=WQ):(P=GQ.call(this,r,n),$=XQ);let U=ct("svg:g",o).call(Ft,this,i,o).call(UE,this).call(It,this,{x:I&&a,y:A&&c}).call(nt=>nt.selectAll().data(t).enter().append("g").attr("transform",st=>`translate(${Math.round(N(st))},${Math.round(L(st))})`).call(Rt,this).call(st=>st.append("path").attr("filter",x)).call(st=>st.append("text").each(function(Y){let rt=qt(this);this.setAttribute("fill","currentColor"),this.setAttribute("fill-opacity",1),this.setAttribute("stroke","none");let q=$.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=g*100,[Lt]=Dl(st,z,B,C);if(Lt>=0)st=st.slice(0,Lt).trimEnd()+Rl,ot=Y.trim(),Y="";else{(st||!Y&&!H)&&(Y=" "+Y);let[Wt]=Dl(Y,z-B(st),B,C);Wt>=0&&(ot=Y.trim(),Y=Y.slice(0,Wt).trimEnd()+Rl)}let dt=nt.append("tspan").attr("x",0).attr("dy",`${m}em`).text("\u200B");st&&dt.append("tspan").attr("font-weight","bold").text(st),Y&&dt.append(()=>d.createTextNode(Y)),H&&dt.append("tspan").text(" \u25A0").attr("fill",rt).attr("fill-opacity",q).style("user-select","none"),ot&&dt.append("title").text(ot)}function tt(){let{width:nt,height:st}=i.facet??i;U.selectChildren().each(function(Y){let{x:rt,width:q,height:H}=this.getBBox();q=Math.round(q),H=Math.round(H);let ot=h;if(ot===void 0){let dt=N(Y)+O,Wt=L(Y)+F,Xt=dt+q+b+y*2<nt,et=dt-q-b-y*2>0,oe=Wt+H+b+y*2<st,wr=Wt-H-b-y*2>0;ot=Xt&&et?oe&&wr?s.preferredAnchor:wr?"bottom":"top":oe&&wr?Xt?"left":"right":(Xt||et)&&(oe||wr)?`${wr?"bottom":"top"}-${Xt?"left":"right"}`:s.preferredAnchor}let z=this.firstChild,Lt=this.lastChild;if(z.setAttribute("d",YQ(ot,b,y,q,H)),rt)for(let dt of Lt.childNodes)dt.setAttribute("x",-rt);Lt.setAttribute("y",`${+jQ(ot,Lt.childNodes.length,m).toFixed(6)}em`),Lt.setAttribute("transform",`translate(${VQ(ot,b,y,q,H)})`)}),U.attr("visibility",null)}return t.length&&(U.attr("visibility","hidden"),f.isConnected?Promise.resolve().then(tt):typeof requestAnimationFrame<"u"&&requestAnimationFrame(tt)),U.node()}};function O_(e,{x:t,y:n,...r}={}){return r.frameAnchor===void 0&&([t,n]=Be(t,n)),new Cm(e,{...r,x:t,y:n})}function jQ(e,t,n){return/^top(?:-|$)/.test(e)?.94-n:-.29-t*n}function VQ(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 YQ(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 GQ({channels:e},t){let n={},r=this.format;r=d7(r,e,"x"),r=d7(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=Im(e,i);s&&(n[i]=s)}}for(let i in e){if(i in n||i in r||qQ.has(i))continue;let o=Im(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?Fm(s,s.domain()):zi}}return n}function d7(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 WQ(e,t,{title:n}){return zi(n.value[e],e)}function*XQ(e,t,n,r,i){for(let o in n){if(o==="fx"||o==="fy"){yield{label:R_(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:p7(r,n,"x"),value:h7(this.format.x2,n.x1,s,e)};else if(o==="y2"&&"y1"in n)yield{label:p7(r,n,"y"),value:h7(this.format.y2,n.y1,s,e)};else{let a=s.value[e],c=s.scale;if(!Ue(a)&&c==null)continue;yield{label:R_(r,n,o),value:this.format[o](a,e),color:c==="color"?i[o][e]:null,opacity:c==="opacity"?i[o][e]:null}}}}function h7(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 p7(e,t,n){let r=R_(e,t,`${n}1`,n),i=R_(e,t,`${n}2`,n);return r===i?r:`${r}\u2013${i}`}function R_(e,t,n,r=n){let i=t[n],o=e[i?.scale??n];return String(o?.label??i?.label??r)}function Pm(e={}){let{facet:t,style:n,title:r,subtitle:i,caption:o,ariaLabel:s,ariaDescription:a}=e,c=Ef(e.className),l=e.marks===void 0?[]:y7(e.marks);l.push(...eK(l));let u=JQ(t,e),f=new Map;for(let C of l){let P=g7(C,u,e);P&&f.set(C,P)}let d=new Map;u&&Bm(d,[u],e),Bm(d,f,e);let h=y7(nK(l,d,e));for(let C of h){let P=g7(C,u,e);P&&f.set(C,P)}l.unshift(...h);let p=mB(d,e);if(p!==void 0){let C=u?l_(p,u):void 0;for(let $ of l){if($.facet===null||$.facet==="super")continue;let U=f.get($);U!==void 0&&(U.facetsIndex=$.fx!=null||$.fy!=null?l_(p,U):C)}let P=new Set;for(let{facetsIndex:$}of f.values())$?.forEach((U,X)=>{U?.length>0&&P.add(X)});p.forEach(0<P.size&&P.size<p.length?($,U)=>$.empty=!P.has(U):$=>$.empty=!1);for(let $ of l)if($.facet==="exclude"){let U=f.get($);U!==void 0&&(U.facetsIndex=bB(U.facetsIndex))}}for(let C of fe.keys())Oo(e[C])&&C!=="fx"&&C!=="fy"&&d.set(C,[]);let m=new Map;for(let C of l){if(m.has(C))throw new Error("duplicate mark; each mark must be unique");let{facetsIndex:P,channels:$}=f.get(C)??{},{data:U,facets:X,channels:tt}=C.initialize(P,$,e);HE(tt,e),m.set(C,{data:U,facets:X,channels:tt})}let g=Nm(Bm(d,m,e),e),y=hB(g,l,e);sB(g,y);let b=SE(g),{fx:x,fy:_}=b,v=x||_?IE(g,y):y,w=x||_?lK(b,y):y,T=nc(e),M=T.document,R=Ts("svg").call(M.documentElement),I=R;T.ownerSVGElement=R,T.className=c,T.projection=x5(e,v),T.filterFacets=(C,P)=>l_(p,{channels:P,groups:a_(C,P)}),T.getMarkState=C=>{let P=m.get(C),$=f.get(C);return{...P,channels:{...P.channels,...$?.channels}}},T.dispatchValue=C=>{I.value!==C&&(I.value=C,I.dispatchEvent(new Event("input",{bubbles:!0})))};let A=new Set;for(let[C,P]of m)if(C.initializer!=null){let $=C.facet==="super"?w:v,U=C.initializer(P.data,P.facets,P.channels,b,$,T);if(U.data!==void 0&&(P.data=U.data),U.facets!==void 0&&(P.facets=U.facets),U.channels!==void 0){let{fx:X,fy:tt,...nt}=U.channels;KQ(nt),Object.assign(P.channels,nt);for(let st of Object.values(nt)){let{scale:Y}=st;Y!=null&&!HC(fe.get(Y))&&(_7(st,e),A.add(Y))}(X!=null||tt!=null)&&f.set(C,!0)}}if(A.size){let C=new Map;Bm(C,m,e,X=>A.has(X)),Bm(d,m,e,X=>A.has(X));let P=cK(Nm(C,e),g),{scales:$,...U}=SE(P);Object.assign(g,P),Object.assign(b,U),Object.assign(b.scales,$)}let O,F;p!==void 0&&(O={x:x?.domain(),y:_?.domain()},p=yB(p,O),F=gB(x,_,y));for(let[C,P]of m)P.values=C.scale(P.channels,b,T);let{width:S,height:E}=y;qt(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",E).attr("viewBox",`0 0 ${S} ${E}`).attr("aria-label",s).attr("aria-description",a).call(C=>C.append("style").text(`:where(.${c}) {
60
60
  --plot-background: white;
61
61
  display: block;
62
62
  height: auto;
@@ -66,4 +66,4 @@ ${y}`)).style("margin-left",l?`${+l}px`:null).style("width",d===void 0?null:`${+
66
66
  :where(.${c} text),
67
67
  :where(.${c} tspan) {
68
68
  white-space: pre;
69
- }`)).call(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};
69
+ }`)).call(Af,n);for(let C of l){let{channels:P,values:$,facets:U}=m.get(C);if(p===void 0||C.facet==="super"){let X=null;if(U&&(X=U[0],X=C.filter(X,P,$),X.length===0))continue;let tt=C.render(X,b,$,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(U){let Y=f.has(C);if(nt=U[Y?tt.i:0],nt=C.filter(nt,P,$),nt.length===0)continue;!Y&&nt===U[0]&&(nt=Ys(nt)),nt.fx=tt.x,nt.fy=tt.y,nt.fi=tt.i}let st=C.render(nt,b,$,v,T);if(st!=null){(X??=qt(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",F)}}let N=f7(g,T,e),{figure:L=r!=null||i!=null||o!=null||N.length>0}=e;L&&(I=M.createElement("figure"),I.className=`${c}-figure`,I.style.maxWidth="initial",r!=null&&I.append(m7(M,r,"h2")),i!=null&&I.append(m7(M,i,"h3")),I.append(...N,R),o!=null&&I.append(HQ(M,o))),I.scale=uB(b.scales),I.legend=l7(g,T,e),I.projection=T.projection;let B=m5();return B>0&&qt(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 m7(e,t,n){if(t.ownerDocument)return t;let r=e.createElement(n);return r.append(t),r}function HQ(e,t){let n=e.createElement("figcaption");return n.append(t),n}function ZQ({marks:e=[],...t}={}){return Pm({...t,marks:[...e,this]})}wt.prototype.plot=ZQ;function y7(e){return e.flat(1/0).filter(t=>t!=null).map(QQ)}function QQ(e){return typeof e.render=="function"?e:new XE(e)}var XE=class extends wt{constructor(t){if(typeof t!="function")throw new TypeError("invalid mark; missing render function");super(),this.render=t}render(){}};function HE(e,t){for(let n in e)_7(e[n],t);return e}function _7(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:QT(s,i)}=t[n]??{};a!=null&&(e.value=Yt(e.value,a),e.transform=!1)}function KQ(e){for(let t in e)fE(t,e[t])}function Bm(e,t,n,r=CC){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(!v5(n)){let c=n.x?.domain===void 0,l=n.y?.domain===void 0;if(c||l){let[u,f]=I5(s);c&&WE(e,"x",u),l&&WE(e,"y",f)}}}else WE(e,a,s)}return e}function WE(e,t,n){let r=e.get(t);r!==void 0?r.push(n):e.set(t,[n])}function JQ(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=If(i,{value:n,scale:"fx"})),r!=null&&(o.fy=If(i,{value:r,scale:"fy"})),HE(o,t);let s=a_(i,o);return{channels:o,groups:s,data:e.data}}function g7(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=If(c,{value:r,scale:"fx"})),i!=null&&(l.fy=If(c,{value:i,scale:"fy"})),HE(l,n),{channels:l,groups:a_(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&&jn(`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 tK(e,t={}){return Se({...t,x:null,y:null},(n,r,i,o,s,a)=>a.getMarkState(e))}function eK(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)?Cf:/^y$/i.test(i)?Al:Lf,r=i(tK(n,r)),r.title=null,o===void 0&&(r.preferredAnchor=i===Al?"left":"bottom");let s=O_(n.data,r);s.facet=n.facet,s.facetAnchor=n.facetAnchor,t.push(s)}}return t}function nK(e,t,n){let{projection:r,x:i={},y:o={},fx:s={},fy:a={},axis:c,grid:l,facet:u={},facet:{axis:f=c,grid:d}=u,x:{axis:h=c,grid:p=h===null?null:l}=i,y:{axis:m=c,grid:g=m===null?null:l}=o,fx:{axis:y=f,grid:b=y===null?null:d}=s,fy:{axis:x=f,grid:_=x===null?null:d}=a}=n;(r||!Oo(i)&&!b7("x",e))&&(h=p=null),(r||!Oo(o)&&!b7("y",e))&&(m=g=null),t.has("fx")||(y=b=null),t.has("fy")||(x=_=null),h===void 0&&(h=!F_(e,"x")),m===void 0&&(m=!F_(e,"y")),y===void 0&&(y=!F_(e,"fx")),x===void 0&&(x=!F_(e,"fy")),h===!0&&(h="bottom"),m===!0&&(m="left"),y===!0&&(y=h==="top"||h===null?"bottom":"top"),x===!0&&(x=m==="right"||m===null?"left":"right");let v=[];return k_(v,_,E_,a),D_(v,x,S_,"right","left",u,a),k_(v,b,M_,s),D_(v,y,I_,"top","bottom",u,s),k_(v,g,T_,o),D_(v,m,Dm,"left","right",n,o),k_(v,p,A_,i),D_(v,h,km,"bottom","top",n,i),v}function D_(e,t,n,r,i,o,s){if(!t)return;let a=rK(t);s=iK(a?r:t,o,s);let{line:c}=s;(n===Dm||n===km)&&c&&!Xs(c)&&e.push(Uf(oK(s))),e.push(n(s)),a&&e.push(n({...s,anchor:i,label:null}))}function k_(e,t,n,r){!t||Xs(t)||e.push(n(sK(t,r)))}function rK(e){return/^\s*both\s*$/i.test(e)}function iK(e,t,{line:n=t.line,ticks:r,tickSize:i,tickSpacing:o,tickPadding:s,tickFormat:a,tickRotate:c,fontVariant:l,ariaLabel:u,ariaDescription:f,label:d=t.label,labelAnchor:h,labelArrow:p=t.labelArrow,labelOffset:m}){return{anchor:e,line:n,ticks:r,tickSize:i,tickSpacing:o,tickPadding:s,tickFormat:a,tickRotate:c,fontVariant:l,ariaLabel:u,ariaDescription:f,label:d,labelAnchor:h,labelArrow:p,labelOffset:m}}function oK(e){let{anchor:t,line:n}=e;return{anchor:t,facetAnchor:t+"-empty",stroke:n===!0?void 0:n}}function sK(e,{stroke:t=Ka(e)?e:void 0,ticks:n=aK(e)?e:void 0,tickSpacing:r,ariaLabel:i,ariaDescription:o}){return{stroke:t,ticks:n,tickSpacing:r,ariaLabel:i,ariaDescription:o}}function aK(e){switch(typeof e){case"number":return!0;case"string":return!Ka(e)}return cr(e)||typeof e?.range=="function"}function F_(e,t){let n=`${t}-axis `;return e.some(r=>r.ariaLabel?.startsWith(n))}function b7(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 cK(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 lK({fx:e,fy:t},n){let{marginTop:r,marginRight:i,marginBottom:o,marginLeft:s,width:a,height:c}=i_(n),l=e&&x7(e),u=t&&x7(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 x7(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 uK=new Map([["basis",gT],["basis-closed",bT],["basis-open",xT],["bundle",_T],["bump-x",dT],["bump-y",hT],["cardinal",wT],["cardinal-closed",vT],["cardinal-open",ST],["catmull-rom",IT],["catmull-rom-closed",TT],["catmull-rom-open",ET],["linear",Us],["linear-closed",AT],["monotone-x",NT],["monotone-y",RT],["natural",OT],["step",DT],["step-after",FT],["step-before",kT]]);function $m(e=Us,t){if(typeof e=="function")return e;let n=uK.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 L_(e=ac,t){return typeof e!="function"&&`${e}`.toLowerCase()==="auto"?ac:$m(e,t)}function ac(e){return Us(e)}function Po(e={y:"count"},t={}){[e,t]=QE(e,t);let{x:n,y:r}=t;return ZE(C_(n,t,W),null,null,r,e,Ml(t))}function $o(e={x:"count"},t={}){[e,t]=QE(e,t);let{x:n,y:r}=t;return ZE(null,C_(r,t,W),n,null,e,Nl(t))}function ta(e={fill:"count"},t={}){[e,t]=QE(e,t);let{x:n,y:r}=fK(t);return ZE(n,r,null,null,e,Ml(Nl(t)))}function S7(e,t,n={}){if(n?.interval==null)return n;let{reduce:r=G1}=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 zf(e={}){return S7(Po,"y",ji(e,"x"))}function qf(e={}){return S7($o,"x",ji(e,"y"))}function ZE(e,t,n,r,{data:i=Y1,filter:o=_m,sort:s,reverse:a,...c}={},l={}){e=w7(e),t=w7(t),c=dK(c,l),i=E7(i,W),s=s==null?void 0:I7("sort",s,l),o=o==null?void 0:T7("filter",o,l),n!=null&&Lo(c,"x","x1","x2")&&(n=null),r!=null&&Lo(c,"y","y1","y2")&&(r=null);let[u,f]=Rn(e),[d,h]=Rn(e),[p,m]=Rn(t),[g,y]=Rn(t),[b,x]=n!=null?[n,"x"]:r!=null?[r,"y"]:[],[_,v]=Rn(b),{x:w,y:T,z:M,fill:R,stroke:I,x1:A,x2:O,y1:F,y2:S,domain:E,cumulative:N,thresholds:L,interval:B,...C}=l,[P,$]=Rn(M),[U]=Re(R),[X]=Re(I),[tt,nt]=Rn(U),[st,Y]=Rn(X);return{..."z"in l&&{z:P||M},..."fill"in l&&{fill:tt||R},..."stroke"in l&&{stroke:st||I},...mn(C,(rt,q,H)=>{let ot=vl(mt(rt,b),H?.[x]),z=mt(rt,M),Lt=mt(rt,U),dt=mt(rt,X),Wt=Sm(c,{z,fill:Lt,stroke:dt}),Xt=[],et=[],oe=ot&&v([]),wr=z&&$([]),Gi=Lt&&nt([]),x$=dt&&Y([]),gR=e&&f([]),_$=e&&h([]),bR=t&&m([]),w$=t&&y([]),v$=mK(e,t,rt),S$=0;for(let jl of c)jl.initialize(rt);s&&s.initialize(rt),o&&o.initialize(rt);for(let jl of q){let xR=[];for(let xd of c)xd.scope("facet",jl);s&&s.scope("facet",jl),o&&o.scope("facet",jl);for(let[xd,I$]of Ja(jl,Wt))for(let[T$,ky]of Ja(I$,ot))for(let[Wi,bc]of v$(ky))if(!(o&&!o.reduce(Wi,bc))){xR.push(S$++),et.push(i.reduceIndex(Wi,rt,bc)),ot&&oe.push(T$),z&&wr.push(Wt===z?xd:z[(Wi.length>0?Wi:ky)[0]]),Lt&&Gi.push(Wt===Lt?xd:Lt[(Wi.length>0?Wi:ky)[0]]),dt&&x$.push(Wt===dt?xd:dt[(Wi.length>0?Wi:ky)[0]]),gR&&(gR.push(bc.x1),_$.push(bc.x2)),bR&&(bR.push(bc.y1),w$.push(bc.y2));for(let E$ of c)E$.reduce(Wi,bc);s&&s.reduce(Wi)}Xt.push(xR)}return lE(Xt,s,a),{data:et,facets:Xt}}),...!Lo(c,"x")&&(u?{x1:u,x2:d,x:xf(u,d)}:{x:w,x1:A,x2:O}),...!Lo(c,"y")&&(p?{y1:p,y2:g,y:xf(p,g)}:{y:T,y1:F,y2:S}),..._&&{[x]:_},...Object.fromEntries(c.map(({name:rt,output:q})=>[rt,q]))}}function QE({cumulative:e,domain:t,thresholds:n,interval:r,...i},o){return[i,{cumulative:e,domain:t,thresholds:n,interval:r,...o}]}function C_(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=KE(e.thresholds,e.interval),e}function fK(e){let{x:t,y:n}=e;return t=C_(t,e),n=C_(n,e),[t.value,n.value]=Be(t.value,n.value),{x:t,y:n}}function w7(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)||pK(i)){a=Yt(a,GT,Float64Array);let[u,f]=typeof r=="function"?r(a):r,d=typeof i=="function"&&!Qa(i)?i(a,u,f):i;typeof d=="number"&&(d=qp(u,f,d)),Qa(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"&&!Qa(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),m=Math.round(f/h);p*h<=u||--p,m*h>f||++m;let g=m-p+1;d=new Float64Array(g);for(let y=0;y<g;++y)d[y]=(p+y)*h}else if(h<0){h=-h;let p=Math.round(u*h),m=Math.round(f*h);p/h<=u||--p,m/h>f||++m;let g=m-p+1;d=new Float64Array(g);for(let y=0;y<g;++y)d[y]=(p+y)/h}else d=[u];else d=[u]}else d=Tn(u,f,d);else Qa(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?gK:n>0?yK:JE)(l,c,a),l};return o.label=On(t),o}function KE(e,t,n=v7){if(e===void 0)return t===void 0?n:ko(t);if(typeof e=="string"){switch(e.toLowerCase()){case"freedman-diaconis":return M0;case"scott":return Bh;case"sturges":return Na;case"auto":return v7}return ym(e)}return e}function dK(e,t){return aE(e,t,I7)}function I7(e,t,n){return j1(e,t,n,T7)}function T7(e,t,n){return V1(e,t,n,E7)}function E7(e,t){return Sf(e,t,hK)}function hK(e){switch(`${e}`.toLowerCase()){case"x":return bK;case"x1":return _K;case"x2":return wK;case"y":return xK;case"y1":return vK;case"y2":return SK}throw new Error(`invalid bin reduce: ${e}`)}function v7(e,t,n){return Math.min(200,Bh(e,t,n))}function pK(e){return UC(e)||cr(e)&&Oe(e)}function mK(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 JE(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 yK(e,t,n){let r=JE(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 gK(e,t,n){let r=JE(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 A7(e,t){let n=(+e+ +t)/2;return e instanceof Date?new Date(n):n}var bK={reduceIndex(e,t,{x1:n,x2:r}){return A7(n,r)}},xK={reduceIndex(e,t,{y1:n,y2:r}){return A7(n,r)}},_K={reduceIndex(e,t,{x1:n}){return n}},wK={reduceIndex(e,t,{x2:n}){return n}},vK={reduceIndex(e,t,{y1:n}){return n}},SK={reduceIndex(e,t,{y2:n}){return n}};function jf(e={}){return XT(e)?e:{...e,x:W}}function Vf(e={}){return HT(e)?e:{...e,y:W}}function M7(e,t){if(t.length===1)return{data:e,facets:t};let n=e.length,r=new Uint8Array(n),i=0;for(let a of t)for(let c of a)r[c]&&++i,r[c]=1;if(i===0)return{data:e,facets:t};e=Za(e);let o=e[jT]=new Uint32Array(n+i);t=t.map(a=>Za(a,Uint32Array));let s=n;r.fill(0);for(let a of t)for(let c=0,l=a.length;c<l;++c){let u=a[c];r[u]?(a[c]=s,e[s]=e[u],o[s]=u,++s):o[u]=u,r[u]=1}return{data:e,facets:t}}function tA(e={},t={}){arguments.length===1&&([e,t]=Wf(e));let{y1:n,y:r=n,x:i,...o}=t,[s,a,c,l]=Xf(r,i,"y","x",e,o);return{...s,y1:n,y:a,x1:c,x2:l,x:xf(c,l)}}function O7(e={},t={}){arguments.length===1&&([e,t]=Wf(e));let{y1:n,y:r=n,x:i}=t,[o,s,a]=Xf(r,i,"y","x",e,t);return{...o,y1:n,y:s,x:a}}function D7(e={},t={}){arguments.length===1&&([e,t]=Wf(e));let{y1:n,y:r=n,x:i}=t,[o,s,,a]=Xf(r,i,"y","x",e,t);return{...o,y1:n,y:s,x:a}}function eA(e={},t={}){arguments.length===1&&([e,t]=Wf(e));let{x1:n,x:r=n,y:i,...o}=t,[s,a,c,l]=Xf(r,i,"x","y",e,o);return{...s,x1:n,x:a,y1:c,y2:l,y:xf(c,l)}}function k7(e={},t={}){arguments.length===1&&([e,t]=Wf(e));let{x1:n,x:r=n,y:i}=t,[o,s,a]=Xf(r,i,"x","y",e,t);return{...o,x1:n,x:s,y:a}}function F7(e={},t={}){arguments.length===1&&([e,t]=Wf(e));let{x1:n,x:r=n,y:i}=t,[o,s,,a]=Xf(r,i,"x","y",e,t);return{...o,x1:n,x:s,y:a}}function Yf({x:e,x1:t,x2:n,...r}={}){return r=ji(r,"y"),t===void 0&&n===void 0?tA({x:e,...r}):([t,n]=ZT(e,t,n),{...r,x1:t,x2:n})}function Gf({y:e,y1:t,y2:n,...r}={}){return r=ji(r,"x"),t===void 0&&n===void 0?eA({y:e,...r}):([t,n]=ZT(e,t,n),{...r,y1:t,y2:n})}function Wf(e){let{offset:t,order:n,reverse:r,...i}=e;return[{offset:t,order:n,reverse:r},i]}var IK={length:!0};function Xf(e,t=gm,n,r,{offset:i,order:o,reverse:s},a){if(t===null)throw new Error(`stack requires ${r}`);let c=qn(a),[l,u]=Rn(e),[f,d]=pn(t),[h,p]=pn(t);return f.hint=h.hint=IK,i=TK(i),o=MK(o,i,r),[mn(a,(m,g,y)=>{({data:m,facets:g}=M7(m,g));let b=e==null?void 0:u(vl(mt(m,e),y?.[n])),x=mt(m,t,Float64Array),_=mt(m,c),v=o&&o(m,b,x,_),w=m.length,T=d(new Float64Array(w)),M=p(new Float64Array(w)),R=[];for(let I of g){let A=b?Array.from(an(I,O=>b[O]).values()):[I];if(v)for(let O of A)O.sort(v);for(let O of A){let F=0,S=0;s&&O.reverse();for(let E of O){let N=x[E];N<0?F=M[E]=(T[E]=F)+N:N>0?S=M[E]=(T[E]=S)+N:M[E]=T[E]=S}}R.push(A)}return i&&i(R,T,M,_),{data:m,facets:g}}),l,f,h]}function TK(e){if(e!=null){if(typeof e=="function")return e;switch(`${e}`.toLowerCase()){case"expand":case"normalize":return EK;case"center":case"silhouette":return AK;case"wiggle":return C7}throw new Error(`unknown offset: ${e}`)}}function L7(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 EK(e,t,n){for(let r of e)for(let i of r){let[o,s]=L7(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 AK(e,t,n){for(let r of e){for(let i of r){let[o,s]=L7(i,n);for(let a of i){let c=(s+o)/2;t[a]-=c,n[a]-=c}}B7(r,t,n)}P7(e,t,n)}function C7(e,t,n,r){for(let i of e){let o=new Zn,s=0;for(let a of i){let c=-1,l=a.map(h=>Math.abs(n[h]-t[h])),u=a.map(h=>{c=r?r[h]:++c;let p=n[h]-t[h],m=o.has(c)?p-o.get(c):0;return o.set(c,p),m}),f=[0,...S0(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)}B7(i,t,n)}P7(e,t,n)}function B7(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])+Gt(a,c=>n[c]))/2),s=ce(o);for(let a=0;a<r;a++){let c=s-o[a];for(let l of i[a])t[l]+=c,n[l]+=c}}function MK(e,t,n){if(e===void 0&&t===C7)return N7(fn);if(e!=null){if(typeof e=="string"){let r=e.startsWith("-"),i=r?xl:fn;switch((r?e.slice(1):e).toLowerCase()){case"value":case n:return NK(i);case"z":return RK(i);case"sum":return OK(i);case"appearance":return DK(i);case"inside-out":return N7(i)}return R7(VT(e))}if(typeof e=="function")return(e.length===1?R7:kK)(e);if(Array.isArray(e))return FK(e);throw new Error(`invalid order: ${e}`)}}function NK(e){return(t,n,r)=>(i,o)=>e(r[i],r[o])}function RK(e){return(t,n,r,i)=>(o,s)=>e(i[o],i[s])}function OK(e){return B_(e,(t,n,r,i)=>_u(ar(t),o=>En(o,s=>r[s]),o=>i[o]))}function DK(e){return B_(e,(t,n,r,i)=>_u(ar(t),o=>n[Yc(o,s=>r[s])],o=>i[o]))}function N7(e){return B_(e,(t,n,r,i)=>{let o=ar(t),s=_u(o,f=>n[Yc(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 R7(e){return t=>{let n=mt(t,e);return(r,i)=>fn(n[r],n[i])}}function kK(e){return t=>(n,r)=>e(t[n],t[r])}function FK(e){return B_(fn,()=>e)}function B_(e,t){return(n,r,i,o)=>{if(!o)throw new Error("missing channel: z");let s=new Zn(t(n,r,i,o).map((a,c)=>[a,c]));return(a,c)=>e(s.get(o[a]),s.get(o[c]))}}var LK={ariaLabel:"area",strokeWidth:1,strokeLinecap:"round",strokeLinejoin:"round",strokeMiterlimit:1},Fl=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:qn(n),optional:!0}},n,LK),this.z=a,this.curve=$m(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(Q1(t,[s,a,c,l],this,r)).enter().append("path").call(Rt,this).call(El,this,r).attr("d",sf().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:Ha}):new Fl(e,t)}function cc(e,t){let{y:n=Ae,...r}=qf(t);return new Fl(e,Yf(jf({...r,y1:n,y2:void 0})))}function ea(e,t){let{x:n=Ae,...r}=zf(t);return new Fl(e,Gf(Vf({...r,x1:n,x2:void 0})))}var CK={ariaLabel:"link",fill:"none",stroke:"currentColor",strokeMiterlimit:1},zm=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,CK),this.curve=L_(a,c),Vi(this,n)}project(t,n,r){this.curve!==ac&&super.project(t,n,r)}render(t,n,r,i,o){let{x1:s,y1:a,x2:c=s,y2:l=a}=r,{curve:u}=this;return ct("svg:g",o).call(Ft,this,i,o).call(It,this,n).call(f=>f.selectAll().data(t).enter().append("path").call(Rt,this).attr("d",u===ac&&o.projection?BK(o.projection,s,a,c,l):d=>{let h=er(),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 BK(e,t,n,r,i){let o=Mn(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 P_(e,{x:t,x1:n,x2:r,y:i,y1:o,y2:s,...a}={}){return[n,r]=qm(t,n,r),[o,s]=qm(i,o,s),new zm(e,{...a,x1:n,x2:r,y1:o,y2:s})}function qm(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 PK={ariaLabel:"arrow",fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeMiterlimit:1,strokeWidth:1.5},jm=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,PK),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=$K(h)}render(t,n,r,i,o){let{x1:s,y1:a,x2:c=s,y2:l=a,SW:u}=r,{strokeWidth:f,bend:d,headAngle:h,headLength:p,insetStart:m,insetEnd:g}=this,y=u?_=>u[_]:dn(f===void 0?1:f),b=h*Bf/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],M=c[v],R=l[v],I=Math.hypot(M-w,R-T);if(I<=m+g)return null;let A=Math.atan2(R-T,M-w),O=Math.min(x*y(v),I/3),F=this.sweep(w,T,M,R)*d*Bf,S=Math.hypot(I/Math.tan(F),I)/2;if(m||g)if(S<1e5){let tt=Math.sign(F),[nt,st]=UK([w,T],[M,R],S,tt);if(m&&([w,T]=$7([nt,st,S],[w,T,m],-tt*Math.sign(m))),g){let[Y,rt]=$7([nt,st,S],[M,R,g],tt*Math.sign(g));A+=Math.atan2(rt-st,Y-nt)-Math.atan2(R-st,M-nt),M=Y,R=rt}}else{let tt=M-w,nt=R-T,st=Math.hypot(tt,nt);m&&(w+=tt/st*m,T+=nt/st*m),g&&(M-=tt/st*g,R-=nt/st*g)}let E=A+F,N=E+b,L=E-b,B=M-O*Math.cos(N),C=R-O*Math.sin(N),P=M-O*Math.cos(L),$=R-O*Math.sin(L),U=S<1e5?`A${S},${S} 0,0,${F>0?1:0} `:"L",X=O?`M${B},${C}L${M},${R}L${P},${$}`:"";return`M${w},${T}${U}${M},${R}${X}`}).call(Zt,this,r)).node()}};function $K(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)=>Ut(t,r);case"-x":return(t,n,r)=>Hn(t,r);case"+y":return(t,n,r,i)=>Ut(n,i);case"-y":return(t,n,r,i)=>Hn(n,i)}}function UK([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 $7([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 U7(e,{x:t,x1:n,x2:r,y:i,y1:o,y2:s,...a}={}){return[n,r]=qm(t,n,r),[o,s]=qm(i,o,s),new jm(e,{...a,x1:n,x2:r,y1:o,y2:s})}var Hf=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)}},z7={ariaLabel:"bar"},Vm=class extends Hf{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,z7)}_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 lr(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 lr(t)?s-i-o-a-c:l=>Math.max(0,Math.abs(r[l]-n[l])-a-c)}},Ym=class extends Hf{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,z7)}_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 lr(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 lr(t)?s-i-o-a-c:l=>Math.max(0,Math.abs(r[l]-n[l])-a-c)}};function Uo(e,t={}){return gf(t)||(t={...t,y:Ae,x2:W}),new Vm(e,Yf(d_(jf(t))))}function zo(e,t={}){return gf(t)||(t={...t,x:Ae,y2:W}),new Ym(e,Gf(h_(Vf(t))))}var zK={ariaLabel:"cell"},Ll=class extends Hf{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,zK)}_transform(t,n){t.call(It,n,{},0,0)}};function lc(e,{x:t,y:n,...r}={}){return[t,n]=Be(t,n),new Ll(e,{...r,x:t,y:n})}function q7(e,{x:t=Ae,fill:n,stroke:r,...i}={}){return n===void 0&&Re(r)[0]===void 0&&(n=W),new Ll(e,{...i,x:t,fill:n,stroke:r})}function j7(e,{y:t=Ae,fill:n,stroke:r,...i}={}){return n===void 0&&Re(r)[0]===void 0&&(n=W),new Ll(e,{...i,y:t,fill:n,stroke:r})}var qK={ariaLabel:"dot",fill:"none",stroke:"currentColor",strokeWidth:1.5};function Gm(e){return e.sort===void 0&&e.reverse===void 0?z1({channel:"-r"},e):e}var Cl=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]=KC(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:sr,optional:!0},rotate:{value:l,optional:!0},symbol:{value:f,scale:"auto",optional:!0}},Gm(n),qK),this.r=p,this.rotate=u,this.symbol=d,this.frameAnchor=Fo(c);let{channels:m}=this,{symbol:g}=m;if(g){let{fill:y,stroke:b}=m;g.hint={fill:y?y.value===g.value?"color":"currentColor":this.fill??"currentColor",stroke:b?b.value===g.value?"color":"currentColor":this.stroke??"none"}}}render(t,n,r,i,o){let{x:s,y:a}=n,{x:c,y:l,r:u,rotate:f,symbol:d}=r,{r:h,rotate:p,symbol:m}=this,[g,y]=yn(this,i),b=m===zs,x=u?void 0:h*h*Math.PI;return Va(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(b?"circle":"path").call(Rt,this).call(b?v=>{v.attr("cx",c?w=>c[w]:g).attr("cy",l?w=>l[w]:y).attr("r",u?w=>u[w]:h)}:v=>{v.attr("transform",oc`translate(${c?w=>c[w]:g},${l?w=>l[w]:y})${f?w=>` rotate(${f[w]})`:p?` rotate(${p})`:""}`).attr("d",u&&d?w=>{let T=er();return d[w].draw(T,u[w]*u[w]*Math.PI),T}:u?w=>{let T=er();return m.draw(T,u[w]*u[w]*Math.PI),T}:d?w=>{let T=er();return d[w].draw(T,x),T}:(()=>{let w=er();return m.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 Cl(e,{...r,x:t,y:n})}function V7(e,{x:t=W,...n}={}){return new Cl(e,m_({...n,x:t}))}function Y7(e,{y:t=W,...n}={}){return new Cl(e,p_({...n,y:t}))}function G7(e,t){return yi(e,{...t,symbol:"circle"})}function W7(e,t){return yi(e,{...t,symbol:"hexagon"})}var jK={ariaLabel:"line",fill:"none",stroke:"currentColor",strokeWidth:1.5,strokeLinecap:"round",strokeLinejoin:"round",strokeMiterlimit:1},Bl=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:qn(n),optional:!0}},n,jK),this.z=o,this.curve=L_(s,a),Vi(this,n)}filter(t){return t}project(t,n,r){this.curve!==ac&&super.project(t,n,r)}render(t,n,r,i,o){let{x:s,y:a}=r,{curve:c}=this;return ct("svg:g",o).call(Ft,this,i,o).call(It,this,n).call(l=>l.selectAll().data(Q1(t,[s,a],this,r)).enter().append("path").call(Rt,this).call(El,this,r).call(IB,this,r,o).attr("d",c===ac&&o.projection?VK(o.projection,s,a):Qp().curve(c).defined(u=>u>=0).x(u=>s[u]).y(u=>a[u]))).node()}};function VK(e,t,n){let r=Mn(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 Pl(e,{x:t,y:n,...r}={}){return[t,n]=Be(t,n),new Bl(e,{...r,x:t,y:n})}function uc(e,{x:t=W,y:n=Ae,...r}={}){return new Bl(e,qf({...r,x:t,y:n}))}function fc(e,{x:t=Ae,y:n=W,...r}={}){return new Bl(e,zf({...r,x:t,y:n}))}var YK={ariaLabel:"rect"},$l=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,YK),this.insetTop=Nt(c),this.insetRight=Nt(l),this.insetBottom=Nt(u),this.insetLeft=Nt(f),this.rx=le(d,"auto"),this.ry=le(h,"auto")}render(t,n,r,i,o){let{x:s,y:a}=n,{x1:c,y1:l,x2:u,y2:f}=r,{marginTop:d,marginRight:h,marginBottom:p,marginLeft:m,width:g,height:y}=i,{projection:b}=o,{insetTop:x,insetRight:_,insetBottom:v,insetLeft:w,rx:T,ry:M}=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(A=>A.selectAll().data(t).enter().append("rect").call(Rt,this).attr("x",c&&(b||!lr(s))?u?O=>Math.min(c[O],u[O])+w:O=>c[O]+w:m+w).attr("y",l&&(b||!lr(a))?f?O=>Math.min(l[O],f[O])+x:O=>l[O]+x:d+x).attr("width",c&&(b||!lr(s))?u?O=>Math.max(0,Math.abs(u[O]-c[O])+R):R:g-h-m-_-w).attr("height",l&&(b||!lr(a))?f?O=>Math.max(0,Math.abs(l[O]-f[O])+I):I:y-d-p-x-v).call(ft,"rx",T).call(ft,"ry",M).call(Zt,this,r)).node()}};function Wm(e,t){return new $l(e,CE(BE(t)))}function Zf(e,t={}){return gf(t)||(t={...t,y:Ae,x2:W,interval:1}),new $l(e,Yf(BE(jf(t))))}function Qf(e,t={}){return gf(t)||(t={...t,x:Ae,y2:W,interval:1}),new $l(e,Gf(CE(Vf(t))))}function rA(e,t){t=GK(t);let{x:n,y:r,color:i,size:o}=t,s=$_(e,n),a=$_(e,r),c=$_(e,i),l=$_(e,o),{fx:u,fy:f,x:{value:d,reduce:h,zero:p,...m},y:{value:g,reduce:y,zero:b,...x},color:{value:_,color:v,reduce:w},size:{value:T,reduce:M},mark:R}=t;if(h===void 0&&(h=y==null&&d==null&&T==null&&g!=null?"count":null),y===void 0&&(y=h==null&&g==null&&T==null&&d!=null?"count":null),M===void 0&&T==null&&w==null&&h==null&&y==null&&(d==null||Me(s))&&(g==null||Me(a))&&(M="count"),p===void 0&&(p=U_(h)?!0:void 0),b===void 0&&(b=U_(y)?!0:void 0),d==null&&g==null)throw new Error("must specify x or y");if(h!=null&&g==null)throw new Error("reducing x requires y");if(y!=null&&d==null)throw new Error("reducing y requires x");R===void 0&&(R=T!=null||M!=null?"dot":U_(h)||U_(y)||w!=null?"bar":d!=null&&g!=null?Me(s)||Me(a)||h==null&&y==null&&!Xm(s)&&!Xm(a)?"dot":"line":d!=null||g!=null?"rule":null);let I,A,O;switch(R){case"dot":O=yi,A="stroke";break;case"line":O=s&&a||h!=null||y!=null?b||y!=null||s&&Xm(s)?fc:p||h!=null||a&&Xm(a)?uc:Pl:s?uc:fc,A="stroke",H7(c)&&(I=null);break;case"area":O=!(b||y!=null)&&(p||h!=null||a&&Xm(a))?cc:ea,A="fill",H7(c)&&(I=null);break;case"rule":O=s?jr:Vr,A="stroke";break;case"bar":O=h!=null?Me(a)?X7(h)&&s&&Me(s)?lc:Uo:Zf:y!=null?Me(s)?X7(y)&&a&&Me(a)?lc:zo:Qf:w!=null||M!=null?s&&Me(s)&&a&&Me(a)?lc:s&&Me(s)?zo:a&&Me(a)?Uo:Wm:s&&Ws(s)&&!(a&&Ws(a))?Uo:a&&Ws(a)&&!(s&&Ws(s))?zo:lc,A="fill";break;default:throw new Error(`invalid mark: ${R}`)}let F={fx:u,fy:f,x:s??void 0,y:a??void 0,[A]:c??v,z:I,r:l??void 0,tip:!0},S,E={[A]:w??void 0,r:M??void 0};if(h!=null&&y!=null)throw new Error("cannot reduce both x and y");return y!=null?(E.y=y,S=Me(s)?tc:Po):h!=null?(E.x=h,S=Me(a)?ec:$o):(w!=null||M!=null)&&(s&&a?S=Me(s)&&Me(a)?vm:Me(s)?$o:Me(a)?Po:ta:s?S=Me(s)?tc:Po:a&&(S=Me(a)?ec:$o)),(S===ta||S===Po)&&(F.x={value:s,...m}),(S===ta||S===$o)&&(F.y={value:a,...x}),p===void 0&&(p=s&&!(S===ta||S===Po)&&(O===Uo||O===cc||O===Zf||O===Vr)),b===void 0&&(b=a&&!(S===ta||S===$o)&&(O===zo||O===ea||O===Qf||O===jr)),{fx:u??null,fy:f??null,x:{value:d??null,reduce:h??null,zero:!!p,...m},y:{value:g??null,reduce:y??null,zero:!!b,...x},color:{value:_??null,reduce:w??null,...v!==void 0&&{color:v}},size:{value:T??null,reduce:M??null},mark:R,markImpl:Z7[O],markOptions:F,transformImpl:Z7[S],transformOptions:E,colorMode:A}}function Q7(e,t){let n=rA(e,t),{fx:r,fy:i,x:{zero:o},y:{zero:s},markOptions:a,transformOptions:c,colorMode:l}=n,u=nA[n.markImpl],f=nA[n.transformImpl],d=r!=null||i!=null?Uf({strokeOpacity:.1}):null,h=[o?jr([0]):null,s?Vr([0]):null],p=u(e,f?f(c,a):a);return l==="stroke"?Je(d,h,p):Je(d,p,h)}function Xm(e){let t,n;for(let r of e){if(r==null)continue;if(t===void 0){t=r;continue}let i=Math.sign(Ut(t,r));if(i){if(n!==void 0&&i!==n)return!1;t=r,n=i}}return!0}function GK({x:e,y:t,color:n,size:r,fx:i,fy:o,mark:s}={}){return zr(e)||(e=Kf(e)),zr(t)||(t=Kf(t)),zr(n)||(n=Ka(n)?{color:n}:Kf(n)),zr(r)||(r=Kf(r)),zr(i)&&({value:i}=Kf(i)),zr(o)&&({value:o}=Kf(o)),s!=null&&(s=`${s}`.toLowerCase()),{x:e,y:t,color:n,size:r,fx:i,fy:o,mark:s}}function $_(e,t){let n=mt(e,t.value);return n&&(n.label=On(t.value)),n}function Kf(e){return WK(e)?{reduce:e}:{value:e}}function U_(e){return/^(?:distinct|count|sum|proportion)$/i.test(e)}function X7(e){return/^(?:first|last|mode)$/i.test(e)}function WK(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 H7(e){return e?new Qn(e).size>e.length>>1:!1}var nA={dot:yi,line:Pl,lineX:uc,lineY:fc,areaX:cc,areaY:ea,ruleX:jr,ruleY:Vr,barX:Uo,barY:zo,rect:Wm,rectX:Zf,rectY:Qf,cell:lc,bin:ta,binX:Po,binY:$o,group:vm,groupX:tc,groupY:ec},Z7=Object.fromEntries(Object.entries(nA).map(([e,t])=>[t,e]));function Jf(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),_r(o,t)}function td(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),_r(o,t)}function _r(e={},t={}){let n=qn(t),r=Object.entries(e).map(([i,o])=>{let s=C1(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:XK(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?an(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 XK(e){if(e==null)throw new Error("missing map");if(typeof e.mapIndex=="function")return e;if(typeof e.map=="function"&&hn(e))return HK(e);if(typeof e=="function")return iA(bf(e));switch(`${e}`.toLowerCase()){case"cumsum":return QK;case"rank":return iA((t,n)=>Ph(t,r=>n[r]));case"quantile":return iA((t,n)=>ZK(t,r=>n[r]))}throw new Error(`invalid map: ${e}`)}function HK(e){return console.warn("deprecated map interface; implement mapIndex instead."),{mapIndex:e.map.bind(e)}}function ZK(e,t){let n=lo(e,t)-1;return Ph(e,t).map(r=>r/n)}function iA(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 QK={mapIndex(e,t,n){let r=0;for(let i of e)n[i]=r+=t[i]}};function K7(e={},t){return arguments.length===1&&(t=e),Jf(ed(e),t)}function J7(e={},t){return arguments.length===1&&(t=e),td(ed(e),t)}function ed(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=JK(r),jn(`Warning: the shift option is deprecated; please use anchor "${i}" instead.`)),!((t=Math.floor(t))>0))throw new Error(`invalid k: ${t}`);return tJ(n)(t,KK(i,t),o)}function KK(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 JK(e){switch(`${e}`.toLowerCase()){case"centered":return"middle";case"leading":return"start";case"trailing":return"end"}throw new Error(`invalid shift: ${e}`)}function tJ(e="mean"){if(typeof e=="string"){if(/^p\d{2}$/i.test(e))return z_(yf(e));switch(e.toLowerCase()){case"deviation":return z_(ri);case"max":return q_((t,n)=>Gt(t,r=>n[r]));case"mean":return eJ;case"median":return z_(Bi);case"min":return q_((t,n)=>ce(t,r=>n[r]));case"mode":return q_((t,n)=>Iu(t,r=>n[r]));case"sum":return tP;case"variance":return z_(Ma);case"difference":return iJ;case"ratio":return oJ;case"first":return sJ;case"last":return aJ}}if(typeof e!="function")throw new Error(`invalid reduce: ${e}`);return q_(bf(e))}function z_(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 q_(e){return(t,n,r)=>r?{mapIndex(i,o,s){let a=0;for(let c=0;c<t-1;++c)a+=Ue(o[i[c]]);for(let c=0,l=i.length-t+1;c<l;++c)a+=Ue(o[i[c+t-1]]),a===t&&(s[i[c+n]]=e(Ys(i,c,c+t),o)),a-=Ue(o[i[c]])}}:{mapIndex(i,o,s){for(let a=-n;a<0;++a)s[i[a+n]]=e(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 tP(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 eJ(e,t,n){if(n){let r=tP(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 nJ(e,t,n,r){for(let i=n+r;n<i;++n){let o=e[t[n]];if(Ue(o))return o}}function rJ(e,t,n,r){for(let i=n+r-1;i>=n;--i){let o=e[t[i]];if(Ue(o))return o}}function eP(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 nP(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 iJ(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]]=nP(i,r,s,e)-eP(i,r,s,e)}}}function oJ(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]]=nP(i,r,s,e)/eP(i,r,s,e)}}}function sJ(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]]=nJ(i,r,s,e)}}}function aJ(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]]=rJ(i,r,s,e)}}}var na={n:20,k:2,color:"currentColor",opacity:.2,strict:!0,anchor:"end"};function rP(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:cc(e,_r({x1:dc({k:-r,...f}),x2:dc({k:r,...f})},{x1:t,x2:t,y:n,fill:s,fillOpacity:a,...f})),ne(c)?null:uc(e,_r({x:dc(f)},{x:t,y:n,stroke:c,strokeOpacity:l,strokeWidth:u,...f})))}function iP(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,_r({y1:dc({k:-r,...f}),y2:dc({k:r,...f})},{x:t,y1:n,y2:n,fill:s,fillOpacity:a,...f})),ne(c)?null:fc(e,_r({y:dc(f)},{x:t,y:n,stroke:c,strokeOpacity:l,strokeWidth:u,...f})))}function dc({n:e=na.n,k:t=0,strict:n=na.strict,anchor:r=na.anchor}={}){return ed({k:e,reduce:i=>Ss(i)+t*(ri(i)||0),strict:n,anchor:r})}var cJ={ariaLabel:"tick",fill:null,stroke:"currentColor"},j_=class extends wt{constructor(t,n,r){super(t,n,r,cJ),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()}},Hm=class extends j_{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}},Zm=class extends j_{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 V_(e,{x:t=W,...n}={}){return new Hm(e,{...n,x:t})}function Y_(e,{y:t=W,...n}={}){return new Zm(e,{...n,y:t})}function oP(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?ec:wm;return Je(Vr(e,u({x1:oA,x2:sA},{x:t,y:n,stroke:o,strokeOpacity:s,...l})),Uo(e,u({x1:"p25",x2:"p75"},{x:t,y:n,fill:r,fillOpacity:i,...l})),V_(e,u({x:"p50"},{x:t,y:n,stroke:o,strokeOpacity:s,strokeWidth:a,sort:c,...l})),yi(e,_r({x:aP},{x:t,y:n,z:n,stroke:o,strokeOpacity:s,...l})))}function sP(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?tc:wm;return Je(jr(e,u({y1:oA,y2:sA},{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})),Y_(e,u({y:"p50"},{x:n,y:t,stroke:o,strokeOpacity:s,strokeWidth:a,sort:c,...l})),yi(e,_r({y:aP},{x:n,y:t,z:n,stroke:o,strokeOpacity:s,...l})))}function aP(e){let t=oA(e),n=sA(e);return e.map(r=>r<t||r>n?r:NaN)}function oA(e){let t=cP(e)*2.5-lP(e)*1.5;return ce(e,n=>n>=t?n:NaN)}function sA(e){let t=lP(e)*2.5-cP(e)*1.5;return Gt(e,n=>n<=t?n:NaN)}function cP(e){return Kn(e,.25)}function lP(e){return Kn(e,.75)}var lJ={ariaLabel:"raster",stroke:null,pixelSize:1};function nd(e,t){let n=+e;if(isNaN(n))throw new Error(`invalid ${t}: ${e}`);return n}function uP(e,t){let n=Math.floor(e);if(isNaN(n))throw new Error(`invalid ${t}: ${e}`);return n}var Km=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:m}=r;if(o!=null&&(o=uP(o,"width")),s!=null&&(s=uP(s,"height")),l!=null&&(l=nd(l,"x1")),u!=null&&(u=nd(u,"y1")),f!=null&&(f=nd(f,"x2")),d!=null&&(d=nd(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=gJ(l,f,o,s)),c===void 0&&u!=null&&d!=null&&(c=bJ(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=nd(h,"pixelSize"),this.blur=nd(p,"blur"),this.interpolate=a==null||c==null?null:uJ(m)}},Jm=class extends Km{constructor(t,n={}){let{imageRendering:r}=n;if(t==null){let{fill:i,fillOpacity:o}=n;ie(o)[0]!==void 0&&(n=G_("fillOpacity",n)),Re(i)[0]!==void 0&&(n=G_("fill",n))}super(t,void 0,n,lJ),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]??(E=>E),{x:a,y:c}=r,{document:l}=o,[u,f,d,h]=dP(r,i,o),p=d-u,m=h-f,{pixelSize:g,width:y=Math.round(Math.abs(p)/g),height:b=Math.round(Math.abs(m)/g)}=this,x=y*b,{fill:_,fillOpacity:v}=r,w=0;if(this.interpolate){let E=y/p,N=b/m,L=Yt(a,C=>(C-u)*E,Float64Array),B=Yt(c,C=>(C-f)*N,Float64Array);_&&(_=this.interpolate(t,y,b,L,B,_)),v&&(v=this.interpolate(t,y,b,L,B,v))}else this.data==null&&t&&(w=t.fi*x);let T=l.createElement("canvas");T.width=y,T.height=b;let M=T.getContext("2d"),R=M.createImageData(y,b),I=R.data,{r:A,g:O,b:F}=rn(this.fill)??{r:0,g:0,b:0},S=(this.fillOpacity??1)*255;for(let E=0;E<x;++E){let N=E<<2;if(_){let L=s(_[E+w]);if(L==null){I[N+3]=0;continue}({r:A,g:O,b:F}=rn(L))}v&&(S=v[E+w]*255),I[N+0]=A,I[N+1]=O,I[N+2]=F,I[N+3]=S}return this.blur>0&&P2(R,this.blur),M.putImageData(R,0,0),ct("svg:g",o).call(Ft,this,i,o).call(It,this,n).call(E=>E.append("image").attr("transform",`translate(${u},${f}) scale(${Math.sign(d-u)},${Math.sign(h-f)})`).attr("width",Math.abs(p)).attr("height",Math.abs(m)).attr("preserveAspectRatio","none").call(ft,"image-rendering",this.imageRendering).call(Rt,this).attr("xlink:href",T.toDataURL())).node()}};function aA(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&&qC(t)&&(r=Vs,i=Ha,o===void 0&&(o=BC)),[t,{...s,x:r,y:i,[e]:o}]}function fP(){let[e,t]=aA("fill",...arguments);return new Jm(e,e==null||t.fill!==void 0||t.fillOpacity!==void 0?t:{...t,fill:W})}function dP({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 cA({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),dP(Tf(a,i),o,s)}function G_(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]=cA(o,s,a,c),m=h-f,g=p-d,{pixelSize:y}=this,{width:b=Math.round(Math.abs(m)/y),height:x=Math.round(Math.abs(g)/y)}=t,_=new Array(b*x*(i?i.length:1)),v=m/b,w=g/x,T=0;for(let M of i??[void 0])for(let R=.5;R<x;++R)for(let I=.5;I<b;++I,++T)_[T]=n(l.invert(f+I*v),u.invert(d+R*w),M);return{data:_,facets:i,channels:{[e]:{value:_,scale:"auto"}}}})}function uJ(e){if(typeof e=="function")return e;if(e==null)return W_;switch(`${e}`.toLowerCase()){case"none":return W_;case"nearest":return uA;case"barycentric":return lA();case"random-walk":return fA()}throw new Error(`invalid interpolate: ${e}`)}function W_(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 lA({random:e=ll(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=yJ(s,e);for(let h=0;h<c.length;h+=3){let p=c[h],m=c[h+1],g=c[h+2],y=a[2*p],b=a[2*m],x=a[2*g],_=a[2*p+1],v=a[2*m+1],w=a[2*g+1],T=Math.min(y,b,x),M=Math.max(y,b,x),R=Math.min(_,v,w),I=Math.max(_,v,w),A=(v-w)*(y-x)+(_-w)*(x-b);if(!A)continue;let O=s[t[p]],F=s[t[m]],S=s[t[g]];for(let E=Math.floor(T);E<M;++E)for(let N=Math.floor(R);N<I;++N){if(E<0||E>=n||N<0||N>=r)continue;let L=E+.5,B=N+.5,C=((v-w)*(L-x)+(B-w)*(x-b))/A;if(C<0)continue;let P=((w-_)*(L-x)+(B-w)*(y-x))/A;if(P<0)continue;let $=1-C-P;if($<0)continue;let U=E+n*N;u[U]=d(O,C,F,P,S,$,E,N),f[U]=1}}return fJ(u,f,i,o,s,n,r,l,t,d),u}}function fJ(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)=>hJ(p,n,r)),d=0;for(let h=0;h<s;++h){let p=h+.5;for(let m=0;m<o;++m){let g=m+o*h;if(!t[g]){let y=m+.5;for(let b=0;b<u;++b){let x=(u+d+(b%2?(b+1)/2:-b/2))%u;if(f[x](y,p)){let _=dJ(n.at(x-1),r.at(x-1),n[x],r[x],y,p);e[g]=l(i.at(x-1),_,i[x],1-_,i[x],0,m,h),d=x;break}}}}}}function dJ(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 Qm(e,t,n,r){return e*r-n*t}function hJ(e,t,n){let r=t.length,i=t.at(e-2),o=n.at(e-2),s=t.at(e-1),a=n.at(e-1),c=t[e],l=n[e],u=t.at(e+1-r),f=n.at(e+1-r),d=s-c,h=a-l,p=i-s,m=o-a,g=c-u,y=l-f,b=Math.hypot(d,h),x=Math.hypot(p,m),_=Math.hypot(g,y);return(v,w)=>{let T=v-s,M=w-a,R=v-c,I=w-l;return Qm(T,M,R,I)>-1e-6&&Qm(T,M,d,h)*x-Qm(T,M,p,m)*b>-1e-6&&Qm(R,I,g,y)*b-Qm(R,I,d,h)*_<=0}}function uA(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 fA({random:e=ll(42),minDistance:t=.5,maxSteps:n=2}={}){return(r,i,o,s,a,c)=>{let l=new c.constructor(i*o),u=ai.from(r,p=>s[p],p=>a[p]),f,d,h;for(let p=.5,m=0;p<o;++p){d=f;for(let g=.5;g<i;++g,++m){let y=g,b=p;h=d=u.find(y,b,d),g===.5&&(f=d);let x,_=0;for(;(x=Math.hypot(s[r[h]]-y,a[r[h]]-b))>t&&_<n;){let v=e(g,p,_)*2*Math.PI;y+=Math.cos(v)*x,b+=Math.sin(v)*x,h=u.find(y,b,h),++_}l[m]=c[r[h]]}}return l}}function pJ(e,t,n,r,i,o){return t*e+r*n+o*i}function mJ(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 yJ(e,t){return Ws(e)||Oe(e)?pJ:mJ(t)}function gJ(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 bJ(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 hP={ariaLabel:"contour",fill:"none",stroke:"currentColor",strokeMiterlimit:1,pixelSize:2},ty=class extends Km{constructor(t,{smooth:n=!0,value:r,...i}={}){let o=Z1({},i,hP);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=G_("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}},xJ(i),hP);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=Mn();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 xJ({thresholds:e,interval:t,...n}){return e=KE(e,t,Na),Se(n,function(r,i,o,s,a,c){let[l,u,f,d]=cA(o,s,a,c),h=f-l,p=d-u,{pixelSize:m,width:g=Math.round(Math.abs(h)/m),height:y=Math.round(Math.abs(p)/m)}=this,b=g/h,x=y/p,_=o.value.value,v=[];if(this.interpolate){let{x:I,y:A}=rc(o,s,c),O=Yt(I,N=>(N-l)*b,Float64Array),F=Yt(A,N=>(N-u)*x,Float64Array),S=[o.x,o.y,o.value],E=[O,F,_];for(let N of i){let L=this.filter(N,S,E);v.push(this.interpolate(L,g,y,O,F,_))}}else if(i){let I=g*y,A=i.length;for(let O=0;O<A;++O)v.push(_.slice(O*I,O*I+I))}else v.push(_);if(this.blur>0)for(let I of v)kh({data:I,width:g,height:y},this.blur);let w=_J(e,_,...wJ(v));if(w===null)throw new Error(`unsupported thresholds: ${e}`);let{contour:T}=Ca().size([g,y]).smooth(this.smooth),M=[],R=[];for(let I of v)R.push($e(M.length,M.push(...Yt(w,A=>T(I,A)))));for(let{coordinates:I}of M)for(let A of I)for(let O of A)for(let F of O)F[0]=F[0]/b+l,F[1]=F[1]/x+u;return{data:M,facets:R,channels:W1(this.contourChannels,M)}})}function _J(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(...vu(n,r,e),e);for(;i[i.length-1]>=r;)i.pop();for(;i[1]<n;)i.shift();return i}function mP(){return new ty(...aA("value",...arguments))}function wJ(e){return[ce(e,t=>ce(t,pP)),Gt(e,t=>Gt(t,pP))]}function pP(e){return isFinite(e)?e:NaN}function bP(e,t){return dA(Lf,e,t)}function xP(e,t={}){return dA(Cf,e,t)}function _P(e,t={}){return dA(Al,e,t)}function dA(e,t,n={}){let{x:r,y:i,maxRadius:o}=n,s=e({px:r,py:i,maxRadius:o}),a=[];r!=null&&a.push(jr(t,yP("x",{...s,inset:-6},n))),i!=null&&a.push(Vr(t,yP("y",{...s,inset:-6},n))),r!=null&&a.push(Bo(t,gP("x",{...s,dy:9,frameAnchor:"bottom",lineAnchor:"top"},n))),i!=null&&a.push(Bo(t,gP("y",{...s,dx:-9,frameAnchor:"left",textAnchor:"end"},n)));for(let c of a)c.ariaLabel=`crosshair ${c.ariaLabel}`;return Je(...a)}function wP(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:vJ(e,u)}}function vJ(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 yP(e,t,n){let{color:r="currentColor",opacity:i=.2,ruleStroke:o=r,ruleStrokeOpacity:s=i,ruleStrokeWidth:a}=n;return{...wP(e,t,n),stroke:o,strokeOpacity:s,strokeWidth:a}}function gP(e,t,n){let{color:r="currentColor",textFill:i=r,textFillOpacity:o,textStroke:s="var(--plot-background)",textStrokeOpacity:a,textStrokeWidth:c=5}=n;return{...wP(e,t,SJ(e,n)),fill:i,fillOpacity:o,stroke:s,strokeOpacity:a,strokeWidth:c}}function SJ(e,t){return Se(t,(n,r,i)=>({channels:{text:{value:Im(i,e)?.value}}}))}var IJ={ariaLabel:"delaunay link",fill:"none",stroke:"currentColor",strokeMiterlimit:1},TJ={ariaLabel:"delaunay mesh",fill:null,stroke:"currentColor",strokeOpacity:.2},EJ={ariaLabel:"hull",fill:"none",stroke:"currentColor",strokeWidth:1.5,strokeMiterlimit:1},AJ={ariaLabel:"voronoi",fill:"none",stroke:"currentColor",strokeMiterlimit:1},MJ={ariaLabel:"voronoi mesh",fill:null,stroke:"currentColor",strokeOpacity:.2},hA=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,IJ),this.curve=$m(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?b=>c[b]:dn(d),m=l?b=>l[b]:dn(h),g=this;function y(b){let x=-1,_=[],v={};for(let S in r)v[S]=[];let w=[],T=[],M=[],R=[];function I(S,E){S=b[S],E=b[E],_.push(++x),w[x]=p(S),M[x]=m(S),T[x]=p(E),R[x]=m(E);for(let N in r)v[N].push(r[N][E])}let{halfedges:A,hull:O,triangles:F}=ai.from(b,p,m);for(let S=0;S<A.length;++S){let E=A[S];E>S&&I(F[S],F[E])}for(let S=0;S<O.length;++S)I(O[S],O[(S+1)%O.length]);qt(this).selectAll().data(_).enter().append("path").call(Rt,g).attr("d",S=>{let E=er(),N=f(E);return N.lineStart(),N.point(w[S],M[S]),N.point(T[S],R[S]),N.lineEnd(),E}).call(Zt,g,v).call(Js,g,v,o)}return ct("svg:g",o).call(Ft,this,i,o).call(It,this,{x:c&&s,y:l&&a}).call(u?b=>b.selectAll().data(an(t,x=>u[x]).values()).enter().append("g").each(y):b=>b.datum(t).each(y)).node()}},ey=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?y=>c[y]:dn(f),p=l?y=>l[y]:dn(d),m=this;function g(y){let b=ai.from(y,h,p);qt(this).append("path").datum(y[0]).call(Rt,m).attr("d",m._render(b,i)).call(Zt,m,r)}return ct("svg:g",o).call(Ft,this,i,o).call(It,this,{x:c&&s,y:l&&a}).call(u?y=>y.selectAll().data(an(t,b=>u[b]).values()).enter().append("g").each(g):y=>y.datum(t).each(g)).node()}},pA=class extends ey{constructor(t,n={}){super(t,n,TJ),this.fill="none"}_render(t){return t.render()}},mA=class extends ey{constructor(t,n={}){super(t,n,EJ,qn)}_render(t){return t.renderHull()}},yA=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,AJ)}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?y=>c[y]:dn(f),p=l?y=>l[y]:dn(d),m=this;function g(y){let b=ai.from(y,h,p),x=vP(b,i);qt(this).selectAll().data(y).enter().append("path").call(Rt,m).attr("d",(_,v)=>x.renderCell(v)).call(Zt,m,r)}return ct("svg:g",o).call(Ft,this,i,o).call(It,this,{x:c&&s,y:l&&a}).call(u?y=>y.selectAll().data(an(t,b=>u[b]).values()).enter().append("g").each(g):y=>y.datum(t).each(g)).node()}},gA=class extends ey{constructor(t,n){super(t,n,MJ),this.fill="none"}_render(t,n){return vP(t,n).render()}};function vP(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 ny(e,t,{x:n,y:r,...i}={}){return[n,r]=Be(n,r),new e(t,{...i,x:n,y:r})}function SP(e,t){return ny(hA,e,t)}function IP(e,t){return ny(pA,e,t)}function TP(e,t){return ny(mA,e,t)}function EP(e,t){return ny(yA,e,t)}function AP(e,t){return ny(gA,e,t)}var NJ={ariaLabel:"density",fill:"none",stroke:"currentColor",strokeMiterlimit:1},ry=class extends wt{constructor(t,{x:n,y:r,z:i,weight:o,fill:s,stroke:a,...c}={}){let l=MP(s)&&(s="currentColor",!0),u=MP(a)&&(a="currentColor",!0);super(t,{x:{value:n,scale:"x",optional:!0},y:{value:r,scale:"y",optional:!0},z:{value:qn({z:i,fill:s,stroke:a}),optional:!0},weight:{value:o,optional:!0}},OJ({...c,fill:s,stroke:a},l,u),NJ),l&&(this.fill=void 0),u&&(this.stroke=void 0),this.z=i}filter(t){return t}render(t,n,r,i,o){let{contours:s}=r,a=Mn();return ct("svg:g",o).call(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 NP(e,{x:t,y:n,...r}={}){return[t,n]=Be(t,n),new ry(e,{...r,x:t,y:n})}var RJ=new Set(["x","y","z","weight"]);function OJ(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,[m,g]=yn(this,u),{width:y,height:b}=u,{x,y:_}=rc(c,l,f),v=Object.fromEntries(Object.entries(c).filter(([F])=>!RJ.has(F)).map(([F,S])=>[F,{...S,value:[]}])),w=t&&[],T=n&&[],M=ES().x(x?F=>x[F]:m).y(_?F=>_[F]:g).weight(d?F=>d[F]:1).size([y,b]).bandwidth(i),R=[];for(let F of a){let S=[];R.push(S);for(let E of h?Em(F,h,p):[F]){let N=M.contours(E);S.push([E,N])}}let I=o;if(!(I instanceof wl)){let F=0;for(let S of R)for(let[,E]of S){let N=E.max;N>F&&(F=N)}I=Float64Array.from({length:o-1},(S,E)=>F*100*(E+1)/o)}let A=[],O=[];for(let F of R){let S=[];A.push(S);for(let[E,N]of F)for(let L of I){S.push(O.length),O.push(N(L/100)),w&&w.push(L),T&&T.push(L);for(let B in v)v[B].value.push(c[B].value[E[0]])}}return w&&w.push(0),T&&T.push(0),{data:s,facets:A,channels:{...v,...w&&{fill:{value:w,scale:"color"}},...T&&{stroke:{value:T,scale:"color"}},contours:{value:O}}}})}function MP(e){return/^density$/i.test(e)}function DP(e,{x1:t,x2:n,y1:r,y2:i,x:o=t===void 0&&n===void 0?Ae:void 0,y:s=r===void 0&&i===void 0?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:m=Re(h)[0],clip:g,tip:y,render:b,...x}={}){return[t,n]=RP(o,t,n),[r,i]=RP(s,r,i),t===n&&r===i&&(r=hc(0)),{tip:y}=ji({tip:y},"x"),Je(ne(c)?null:Object.assign(Um(e,{x1:t,x2:n,y1:r,y2:i,z:m,fill:c,fillOpacity:f,render:Ff(b,OP(!0)),clip:g,...x}),{ariaLabel:"positive difference"}),ne(l)?null:Object.assign(Um(e,{x1:t,x2:n,y1:r,y2:i,z:m,fill:l,fillOpacity:d,render:Ff(b,OP(!1)),clip:g,...x}),{ariaLabel:"negative difference"}),Pl(e,{x:n,y:i,z:m,stroke:h,strokeOpacity:p,tip:y,clip:!0,...x}))}function RP(e,t,n){return t===void 0&&n===void 0?t=n=hc(e):t===void 0?(n=hc(n),t=e===void 0?n:hc(e)):n===void 0?(t=hc(t),n=e===void 0?t:hc(e)):(t=hc(t),n=hc(n)),[t,n]}function hc(e){let t,{value:n,label:r=On(n)}=pi(e);return{transform:i=>t||(t=mt(i,n)),label:r}}function OP(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===r_(n.y)<0?u:f).fill(l);let d=s(t,n,{...r,x2:a,y2:f},i,o),h=s(t,n,{...r,x1:c,y1:u},i,o),p=d.querySelector("g")??d,m=h.querySelector("g")??h;for(let g=0;p.firstChild;g+=2){let y=H1(),b=ct("svg:clipPath",o).attr("id",y).node();b.appendChild(p.firstChild),m.childNodes[g].setAttribute("clip-path",`url(#${y})`),m.insertBefore(b,m.childNodes[g])}return h}}var DJ={ariaLabel:"geo",fill:"none",stroke:"currentColor",strokeWidth:1,strokeLinecap:"round",strokeLinejoin:"round",strokeMiterlimit:1},iy=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:sr,optional:!0}},Gm(n),DJ),this.r=i}render(t,n,r,i,o){let{geometry:s,r:a}=r,c=Mn(o.projection??kJ(n)),{r:l}=this;return Va(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 kJ({x:e,y:t}){if(e||t)return e??=n=>n,t??=n=>n,al({point(n,r){this.stream.point(e(n),t(r))}})}function X_(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 iy(e,{geometry:t,...n})}function kP({strokeWidth:e=1.5,...t}={}){return X_({type:"Sphere"},{strokeWidth:e,...t})}function FP({strokeOpacity:e=.1,...t}={}){return X_(XS(),{strokeOpacity:e,...t})}var rd=.5,id=0;function LP(e={fill:"count"},{binWidth:t,...n}={}){let{z:r}=n;return t=t===void 0?20:Nt(t),e=cE(e,n),Lo(e,"fill")&&(n.channels={...n.channels,fill:{value:[]}}),n.symbol===void 0&&(n.symbol="hexagon"),n.r===void 0&&!Lo(e,"r")&&(n.r=t/2),Se(n,(i,o,s,a,c,l)=>{let{x:u,y:f,z:d,fill:h,stroke:p,symbol:m}=s;if(u===void 0)throw new Error("missing channel: x");if(f===void 0)throw new Error("missing channel: y");({x:u,y:f}=rc(s,a,l)),d=d?d.value:mt(i,r),h=h?.value,p=p?.value,m=m?.value;let g=Sm(e,{z:d,fill:h,stroke:p,symbol:m}),y=d&&[],b=h&&[],x=p&&[],_=m&&[],v=[],w=[],T=[],M=-1;for(let O of e)O.initialize(i);for(let O of o){let F=[];for(let S of e)S.scope("facet",O);for(let[S,E]of Ja(O,g))for(let{index:N,extent:L}of FJ(i,E,u,f,t)){F.push(++M),w.push(L.x),T.push(L.y),d&&y.push(g===d?S:d[N[0]]),h&&b.push(g===h?S:h[N[0]]),p&&x.push(g===p?S:p[N[0]]),m&&_.push(g===m?S:m[N[0]]);for(let B of e)B.reduce(N,L)}v.push(F)}let R=s.x.scale,I=s.y.scale,A={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:y}},...h&&{fill:{value:b,scale:"auto"}},...p&&{stroke:{value:x,scale:"auto"}},...m&&{symbol:{value:_,scale:"auto"}},...Object.fromEntries(e.map(({name:O,output:F})=>[O,{scale:"auto",label:F.label,radius:O==="r"?t/2:void 0,value:F.transform()}]))};return{data:i,facets:v,channels:A}})}function FJ(e,t,n,r,i){let o=i*(1.5/KT),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-id)/o),f=Math.round(c=(c-rd)/i-(u&1)/2),d=l-u;if(Math.abs(d)*3>1){let m=c-f,g=f+(c<f?-1:1)/2,y=u+(l<u?-1:1),b=c-g,x=l-y;m*m+d*d>b*b+x*x&&(f=g+(u&1?1:-1)/2,u=y)}let h=`${f},${u}`,p=s.get(h);p===void 0&&(p={index:[],extent:{data:e,x:(f+(u&1)/2)*i+rd,y:u*o+id}},s.set(h,p)),p.index.push(a)}return s.values()}var LJ={ariaLabel:"hexgrid",fill:"none",stroke:"currentColor",strokeOpacity:.1};function CP(e){return new oy(e)}var oy=class extends wt{constructor({binWidth:t=20,clip:n=!0,...r}={}){super(Xa,void 0,{clip:n,...r},LJ),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-rd,p=f-c-rd,m=a-id,g=d-l-id,y=s/2,b=y*JT,x=b/2,_=y*2,v=b*1.5,w=Math.floor(h/_),T=Math.ceil(p/_),M=Math.floor((m+x)/v),R=Math.ceil((g-x)/v)+1,I=`m0,${pc(-b)}l${pc(y)},${pc(x)}v${pc(b)}l${pc(-y)},${pc(x)}`,A=I;for(let O=M;O<R;++O)for(let F=w;F<T;++F)A+=`M${pc(F*_+(O&1)*y)},${pc(O*v)}${I}`;return ct("svg:g",o).datum(0).call(Ft,this,i,o).call(It,this,{},De+rd,De+id).call(O=>O.append("path").call(Rt,this).call(Zt,this,r).attr("d",A)).node()}};function pc(e){return Math.round(e*1e3)/1e3}var CJ={ariaLabel:"image",fill:null,stroke:null};function BJ(e){return/^\.*\//.test(e)}function PJ(e){return/^(blob|data|file|http|https):/i.test(e)}function $J(e){return typeof e=="string"&&(BJ(e)||PJ(e))?[void 0,e]:[e,void 0]}var sy=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,m]=$J(l),[g,y]=ie(o),[b,x]=ie(s,y!==void 0?y*2:void 0),[_,v]=ie(a,y!==void 0?y*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:g,scale:"r",filter:sr,optional:!0},width:{value:b,filter:sr,optional:!0},height:{value:_,filter:sr,optional:!0},rotate:{value:w,optional:!0},src:{value:p,optional:!0}},Gm(n),CJ),this.src=m,this.width=x,this.rotate=T,this.height=v,this.r=y,this.preserveAspectRatio=le(u,"xMidYMid"),this.crossOrigin=ze(f),this.frameAnchor=Fo(d),this.imageRendering=le(h,"auto")}render(t,n,r,i,o){let{x:s,y:a}=n,{x:c,y:l,width:u,height:f,r:d,rotate:h,src:p}=r,{r:m,width:g,height:y,rotate:b}=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",BP(c,u,d,x,g,m)).attr("y",BP(l,f,d,_,y,m)).attr("width",u?w=>u[w]:g!==void 0?g:d?w=>d[w]*2:m*2).attr("height",f?w=>f[w]:y!==void 0?y:d?w=>d[w]*2:m*2).attr("transform",h?w=>`rotate(${h[w]})`:b?`rotate(${b})`:null).attr("transform-origin",h||b?oc`${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)`:m!==void 0?`circle(${m}px)`:null).call(Zt,this,r)).node()}};function BP(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 sy(e,{...r,x:t,y:n})}function UJ(e,t,n){var r=1e-8,i=t-1,o=n-1,s=0,a,c,l,u,f,d,h,p,m,g,y;if(e<=0)return 0;if(e>=1)return 1;for(t>=1&&n>=1?(l=e<.5?e:1-e,u=Math.sqrt(-2*Math.log(l)),h=(2.30753+u*.27061)/(1+u*(.99229+u*.04481))-u,e<.5&&(h=-h),p=(h*h-3)/6,m=2/(1/(2*t-1)+1/(2*n-1)),g=h*Math.sqrt(p+m)/m-(1/(2*n-1)-1/(2*t-1))*(p+5/6-2/(3*m)),h=t/(t+n*Math.exp(2*g))):(a=Math.log(t/(t+n)),c=Math.log(n/(t+n)),u=Math.exp(t*a)/t,f=Math.exp(n*c)/n,g=u+f,e<u/g?h=Math.pow(t*g*e,1/t):h=1-Math.pow(n*g*(1-e),1/n)),y=-od(t)-od(n)+od(t+n);s<10;s++){if(h===0||h===1)return h;if(d=zJ(h,t,n)-e,u=Math.exp(i*Math.log(h)+o*Math.log(1-h)+y),f=d/u,h-=u=f/(1-.5*Math.min(1,f*(i/h-o/(1-h)))),h<=0&&(h=.5*(h+u)),h>=1&&(h=.5*(h+u+1)),Math.abs(u)<r*h&&s>0)break}return h}function zJ(e,t,n){var r=e===0||e===1?0:Math.exp(od(t+n)-od(t)-od(n)+t*Math.log(e)+n*Math.log(1-e));return e<0||e>1?!1:e<(t+1)/(t+n+2)?r*$P(e,t,n)/t:1-r*$P(1-e,n,t)/n}function $P(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 od(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 UP(e,t){var n=UJ(2*Math.min(e,1-e),.5*t,.5);return n=Math.sqrt(t*(1-n)/n),e>.5?n:-n}var qJ={ariaLabel:"linear-regression",fill:"currentColor",fillOpacity:.1,stroke:"currentColor",strokeWidth:1.5,strokeLinecap:"round",strokeLinejoin:"round",strokeMiterlimit:1},H_=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:qn(n),optional:!0}},n,qJ),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?Em(t,c,this.z):[t]).enter().call(f=>f.append("path").attr("fill","none").call(Rt,this).call(El,this,{...r,fill:null,fillOpacity:null}).attr("d",d=>this._renderLine(d,s,a)).call(l&&!Xs(this.fill)?d=>d.select(jJ).attr("stroke","none").call(Rt,this).call(El,this,{...r,stroke:null,strokeOpacity:null,strokeWidth:null}).attr("d",h=>this._renderBand(h,s,a)):()=>{}))).node()}};function jJ(){return this.parentNode.insertBefore(this.ownerDocument.createElementNS(ii.svg,"path"),this)}var bA=class extends H_{constructor(t,n){super(t,n)}_renderBand(t,n,r){let{ci:i,precision:o}=this,[s,a]=ae(t,u=>r[u]),c=Z_(t,r,n),l=jP(t,r,n,(1-i)/2,c);return sf().y(u=>u).x0(u=>l(u,-1)).x1(u=>l(u,1))($e(s,a-o/2,o).concat(a))}_renderLine(t,n,r){let[i,o]=ae(t,a=>r[a]),s=Z_(t,r,n);return`M${s(i)},${i}L${s(o)},${o}`}},xA=class extends H_{constructor(t,n){super(t,n)}_renderBand(t,n,r){let{ci:i,precision:o}=this,[s,a]=ae(t,u=>n[u]),c=Z_(t,n,r),l=jP(t,n,r,(1-i)/2,c);return sf().x(u=>u).y0(u=>l(u,-1)).y1(u=>l(u,1))($e(s,a-o/2,o).concat(a))}_renderLine(t,n,r){let[i,o]=ae(t,a=>n[a]),s=Z_(t,n,r);return`M${i},${s(i)}L${o},${s(o)}`}};function zP(e,{y:t=Ae,x:n=W,stroke:r,fill:i=ne(r)?"currentColor":r,...o}={}){return new bA(e,qf({...o,x:n,y:t,fill:i,stroke:r}))}function qP(e,{x:t=Ae,y:n=W,stroke:r,fill:i=ne(r)?"currentColor":r,...o}={}){return new xA(e,zf({...o,x:t,y:n,fill:i,stroke:r}))}function Z_(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 jP(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=UP(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 ay({path:e=W,delimiter:t,frameAnchor:n,treeLayout:r=cl,treeSort:i,treeSeparation:o,treeAnchor:s,treeFilter:a,...c}={}){s=tw(s),i=GP(i),a!=null&&(a=wA(a)),n===void 0&&(n=s.frameAnchor);let l=WP(t),u=t9(c,wA),[f,d]=pn(),[h,p]=pn();return{x:f,y:h,frameAnchor:n,...mn(c,(m,g)=>{let y=l(mt(m,e)),b=d([]),x=p([]),_=-1,v=[],w=[],T=Xb().path(R=>y[R]),M=r();M.nodeSize&&M.nodeSize([1,1]),M.separation&&o!==void 0&&M.separation(o??gm);for(let R of u)R[K_]=R[KP]([]);for(let R of g){let I=[],A=T(R.filter(O=>y[O]!=null)).each(O=>O.data=m[O.data]);i!=null&&A.sort(i),M(A);for(let O of A.descendants())if(!(a!=null&&!a(O))){I.push(++_),v[_]=O.data,s.position(O,_,b,x);for(let F of u)F[K_][_]=F[JP](O)}w.push(I)}return{data:v,facets:w}}),...Object.fromEntries(u)}}function J_({path:e=W,delimiter:t,curve:n="bump-x",stroke:r="#555",strokeWidth:i=1.5,strokeOpacity:o=.5,treeLayout:s=cl,treeSort:a,treeSeparation:c,treeAnchor:l,treeFilter:u,...f}={}){l=tw(l),a=GP(a),u!=null&&(u=YP(u)),f={curve:n,stroke:r,strokeWidth:i,strokeOpacity:o,...f};let d=WP(t),h=t9(f,YP),[p,m]=pn(),[g,y]=pn(),[b,x]=pn(),[_,v]=pn();return{x1:p,x2:g,y1:b,y2:_,...mn(f,(w,T)=>{let M=d(mt(w,e)),R=m([]),I=y([]),A=x([]),O=v([]),F=-1,S=[],E=[],N=Xb().path(B=>M[B]),L=s();L.nodeSize&&L.nodeSize([1,1]),L.separation&&c!==void 0&&L.separation(c??gm);for(let B of h)B[K_]=B[KP]([]);for(let B of T){let C=[],P=N(B.filter($=>M[$]!=null)).each($=>$.data=w[$.data]);a!=null&&P.sort(a),L(P);for(let{source:$,target:U}of P.links())if(!(u!=null&&!u(U,$))){C.push(++F),S[F]=U.data,l.position($,F,R,A),l.position(U,F,I,O);for(let X of h)X[K_][F]=X[JP](U,$)}E.push(C)}return{data:S,facets:E}}),...Object.fromEntries(h)}}function tw(e="left"){switch(`${e}`.trim().toLowerCase()){case"left":return VJ;case"right":return YJ}throw new Error(`invalid tree anchor: ${e}`)}var VJ={frameAnchor:"left",dx:6,position({x:e,y:t},n,r,i){r[n]=t,i[n]=-e}},YJ={frameAnchor:"right",dx:-6,position({x:e,y:t},n,r,i){r[n]=-t,i[n]=-e}};function GP(e){return e==null||typeof e=="function"?e:`${e}`.trim().toLowerCase().startsWith("node:")?VP(wA(e)):VP(GJ(e))}function VP(e){return(t,n)=>fn(e(t),e(n))}function GJ(e){return t=>t.data?.[e]}function WP(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=>WJ(r,t))}var _A=92,XP=47;function WJ(e,t){if(t===_A)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 _A: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 XP: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 XJ(e){let t=!1;for(let n=0,r=e.length;n<r;++n){switch(e.charCodeAt(n)){case _A:if(!t){t=!0;continue}case XP:t&&(e=e.slice(0,n-1)+e.slice(n),--n,--r);break}t=!1}return e}function HP(e){return hn(e)&&typeof e.node=="function"}function HJ(e){return hn(e)&&typeof e.link=="function"}function wA(e){if(HP(e))return e.node;if(e=`${e}`.trim().toLowerCase(),!!e.startsWith("node:")){switch(e){case"node:name":return SA;case"node:path":return vA;case"node:internal":return ZP;case"node:external":return QP;case"node:depth":return IA;case"node:height":return TA}throw new Error(`invalid node value: ${e}`)}}function YP(e){if(HP(e))return e.node;if(HJ(e))return e.link;if(e=`${e}`.trim().toLowerCase(),!(!e.startsWith("node:")&&!e.startsWith("parent:"))){switch(e){case"parent:name":return Q_(SA);case"parent:path":return Q_(vA);case"parent:depth":return Q_(IA);case"parent:height":return Q_(TA);case"node:name":return SA;case"node:path":return vA;case"node:internal":return ZP;case"node:external":return QP;case"node:depth":return IA;case"node:height":return TA}throw new Error(`invalid link value: ${e}`)}}function vA(e){return e.id}function SA(e){return ZJ(e.id)}function IA(e){return e.depth}function TA(e){return e.height}function ZP(e){return!!e.children}function QP(e){return!e.children}function Q_(e){return(t,n)=>n==null?void 0:e(n)}function ZJ(e){let t=e.length;for(;--t>0&&!QJ(e,t););return XJ(e.slice(t+1))}function QJ(e,t){if(e[t]==="/"){let n=0;for(;t>0&&e[--t]==="\\";)++n;if(!(n&1))return!0}return!1}var KP=2,JP=3,K_=4;function t9(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 EA(e,{fill:t,stroke:n,strokeWidth:r,strokeOpacity:i,strokeLinejoin:o,strokeLinecap:s,strokeMiterlimit:a,strokeDasharray:c,strokeDashoffset:l,marker:u,markerStart:f=u,markerEnd:d=u,dot:h=ne(f)&&ne(d),text:p="node:name",textStroke:m="var(--plot-background)",title:g="node:path",dx:y,dy:b,textAnchor:x,treeLayout:_=cl,textLayout:v=_===cl||_===Gb?"mirrored":"normal",tip:w,...T}={}){if(y===void 0&&(y=tw(T.treeAnchor).dx),x!==void 0)throw new Error("textAnchor is not a configurable tree option");v=Ke(v,"textLayout",["mirrored","normal"]);function M(R){return Bo(e,ay({treeLayout:_,text:p,fill:t===void 0?"currentColor":t,stroke:m,dx:y,dy:b,title:g,...R,...T}))}return Je(P_(e,J_({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,ay({treeLayout:_,fill:t===void 0?"node:internal":t,title:g,tip:w,...T})):null,p!=null?v==="mirrored"?[M({textAnchor:"start",treeFilter:"node:external"}),M({textAnchor:"end",treeFilter:"node:internal",dx:-y})]:M():null)}function e9(e,t){return EA(e,{...t,treeLayout:Gb})}function n9({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=Mn(a);for(let h=0;h<l;++h)[u[h],f[h]]=d.centroid(c[h]);return{data:n,facets:r,channels:{x:{value:u,scale:a==null?"x":null,source:null},y:{value:f,scale:a==null?"y":null,source:null}}}})}function r9({geometry:e=W,...t}={}){let n;return{...t,x:{transform:r=>Float64Array.from(n=mt(mt(r,e),qS),([i])=>i)},y:{transform:()=>Float64Array.from(n,([,r])=>r)}}}var p9=k$(h9(),1);var ott=({marginLeft:e})=>[1,e],stt=({width:e,marginRight:t})=>[-1,e-t],att=({width:e,marginLeft:t,marginRight:n})=>[0,(t+e-n)/2],ctt=({marginTop:e})=>[1,e],ltt=({height:e,marginBottom:t})=>[-1,e-t],utt=({height:e,marginTop:t,marginBottom:n})=>[0,(t+e-n)/2];function m9(e){return typeof e=="string"?{anchor:e}:e}function y9(e={},t={}){arguments.length===1&&([e,t]=b9(e));let{anchor:n="left",padding:r=1,r:i=t.r}=m9(e);switch(`${n}`.toLowerCase()){case"left":n=ott;break;case"right":n=stt;break;case"middle":n=att;break;default:throw new Error(`unknown dodge anchor: ${n}`)}return x9("x","y",n,Nt(r),i,t)}function g9(e={},t={}){arguments.length===1&&([e,t]=b9(e));let{anchor:n="bottom",padding:r=1,r:i=t.r}=m9(e);switch(`${n}`.toLowerCase()){case"top":n=ctt;break;case"bottom":n=ltt;break;case"middle":n=utt;break;default:throw new Error(`unknown dodge anchor: ${n}`)}return x9("y","x",n,Nt(r),i,t)}function b9(e){let{anchor:t,padding:n,...r}=e,{r:i}=r;return[{anchor:t,padding:n,r:i},r]}function x9(e,t,n,r,i,o){if(i!=null&&typeof i!="number"){let{channels:s,sort:a,reverse:c}=o;s=xm(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}=rc(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[m,g]=n(u),y=m?dtt:ftt,b=new Float64Array(d.length),x=h?_=>h[_]:()=>p;for(let _ of a){let v=(0,p9.default)();_=_.filter(h?T=>ff(d[T])&&sr(h[T]):T=>ff(d[T]));let w=new Float64Array(2*_.length+2);for(let T of _){let M=x(T),R=m?M+r:0,I=d[T]-M,A=d[T]+M,O=2;v.queryInterval(I-r,A+r,([,,S])=>{let E=b[S]-R,N=d[T]-d[S],L=r+(h?h[T]+h[S]:2*p),B=Math.sqrt(L*L-N*N);w[O++]=E-B,w[O++]=E+B});let F=w.slice(0,O);m&&(F=F.filter(S=>S>=0));t:for(let S of F.sort(y)){for(let E=0;E<O;E+=2)if(w[E]+1e-6<S&&S<w[E+1]-1e-6)continue t;b[T]=S+R;break}v.insert([I,A,T])}}m||(m=1);for(let _ of a)for(let v of _)b[v]=b[v]*m+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 ftt(e,t){return Math.abs(e)-Math.abs(t)}function dtt(e,t){return e-t}function w9(e,t){return arguments.length===1&&({basis:e,...t}=e),Jf(rw(e),t)}function v9(e,t){return arguments.length===1&&({basis:e,...t}=e),td(rw(e),t)}function rw(e){if(e===void 0)return _9;if(typeof e=="function")return iw(bf(e));if(/^p\d{2}$/i.test(e))return ld(yf(e));switch(`${e}`.toLowerCase()){case"deviation":return mtt;case"first":return _9;case"last":return ptt;case"max":return ytt;case"mean":return gtt;case"median":return btt;case"min":return xtt;case"sum":return _tt;case"extent":return htt}throw new Error(`invalid basis: ${e}`)}function iw(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 ld(e){return iw((t,n)=>e(t,r=>n[r]))}var htt={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}},_9=iw((e,t)=>{for(let n=0;n<e.length;++n){let r=t[e[n]];if(Ue(r))return r}}),ptt=iw((e,t)=>{for(let n=e.length-1;n>=0;--n){let r=t[e[n]];if(Ue(r))return r}}),mtt={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}},ytt=ld(Gt),gtt=ld(Ss),btt=ld(Bi),xtt=ld(ce),_tt=ld(En);function S9(e,t){return wtt("x",e,t)}function wtt(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]=L1(t.replace(/^[+-]/,"")),i*=l}t=_f(t),r=(l,u)=>t.offset(l,u)}let o=`${e}1`,s=`${e}2`,a=_r({[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 I9(e,t={}){if(typeof e=="string")switch(e.toLowerCase()){case"first":return DA(t);case"last":return kA(t)}if(typeof e=="function")return mc(null,e,t);let n,r;for(n in e){if(r!==void 0)throw new Error("ambiguous selector; multiple inputs");r=vtt(e[n])}if(r===void 0)throw new Error(`invalid selector: ${e}`);return mc(n,r,t)}function vtt(e){if(typeof e=="function")return e;switch(`${e}`.toLowerCase()){case"min":return FA;case"max":return LA}throw new Error(`unknown selector: ${e}`)}function DA(e){return mc(null,Stt,e)}function kA(e){return mc(null,Itt,e)}function T9(e){return mc("x",FA,e)}function E9(e){return mc("y",FA,e)}function A9(e){return mc("x",LA,e)}function M9(e){return mc("y",LA,e)}function*Stt(e){yield e[0]}function*Itt(e){yield e[e.length-1]}function*FA(e,t){yield R0(e,n=>t[n])}function*LA(e,t){yield Yc(e,n=>t[n])}function mc(e,t,n){if(e!=null){if(n[e]==null)throw new Error(`missing channel: ${e}`);e=n[e]}let r=qn(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?an(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 Ttt=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 Ett(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 N9(e,t,n){for(let r in e){let i=Ttt.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&&Ett(t,i.split("."),o)}}var Att=new Set(["frame","hexgrid","sphere","graticule"]);async function O9(e){let t={marks:[]},n=[],{attributes:r,marks:i}=e;N9(r,t,n);let o=[];for(let a of i)for(let{type:c,data:l,options:u}of a.plotSpecs())Att.has(c)?t.marks.push(ow[c](u)):t.marks.push(ow[c](l,u)),o.push(a.index);Ntt(t,e);let s=Pm(t);Rtt(s,o),Mtt(e,s,r,n);for(let a of e.interactors)await a.init(s);return s}function Mtt(e,t,n,r){r.forEach(i=>{let o=n[i];if(o===co){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 Ntt(e,t){let{marks:n}=t;sw("x",e,n,["x","x1","x2"]),sw("y",e,n,["y","y1","y2"]),sw("fx",e,n),sw("fy",e,n)}function sw(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=Ott(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 Rtt(e,t){let n=e.querySelectorAll('g[aria-label="facet"]');if(n.length)for(let r of n)R9(r,t);else R9(e,t)}function R9(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 Ott(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 Dtt={width:640,marginLeft:40,marginRight:20,marginTop:20,marginBottom:30},uy=class{constructor(t){this.attributes={...Dtt},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=B2()}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 O9(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 Rh(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 aw(e){return typeof e!="string"?!1:(e=e.toLowerCase().trim(),e==="none"||e==="currentcolor"||e.startsWith("url(")&&e.endsWith(")")||e.startsWith("var(")&&e.endsWith(")")||Lr(e)!==null)}var ktt=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 D9(e){return ktt.has(e)}var Ftt=new Set(["asterisk","circle","cross","diamond","diamond2","hexagon","plus","square","square2","star","times","triangle","triangle2","wye"]);function k9(e){return Ftt.has(`${e}`.toLowerCase())}function ud(e){return typeof e?.getChild=="function"}function F9(e){let{typeId:t}=e;return t===10?n=>n==null?n:new Date(n):t===2&&e.bitWidth>=64?n=>n==null?n:Number(n):n=>n}function cw(e){return ud(e)?Ltt(e):e}function Ltt(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=F9(h);for(let m=i,g=0;g<c;++g,++m)r[m][d]=p(f.get(g))}i+=c}return r}var L9=e=>e==="stroke"||e==="fill",Ctt=e=>e==="symbol",Btt=(e,t)=>e!=="sort"&&e!=="tip"&&t!=null&&!Array.isArray(t),CA=(e,t)=>({channel:e,field:t,as:t instanceof gr?t.column:e}),BA=(e,t)=>({channel:e,value:t}),lw=e=>Array.isArray(e),Dn=class extends ur{constructor(t,n,r,i={}){super(n?.options?.filterBy),this.type=t,this.reqs=i,this.source=n,lw(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[Oh]){let d=u(this,l);for(let h in d)c(h,d[h])}else if(f==="string")D9(l)||L9(l)&&aw(u)||Ctt(l)&&k9(u)?o.push(BA(l,u)):o.push(CA(l,Sa(u)));else if(ps(u))if(Array.isArray(u.columns))o.push(CA(l,u)),a.add(u);else{let d=BA(l,u.value);o.push(d),u.addEventListener("value",h=>(d.value=h,this.update()))}else f==="object"&&Btt(l,u)?o.push(CA(l,u)):u!==void 0&&o.push(BA(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||lw(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 PA(n,r).where(t)}queryPending(){return this.plot.pending(this),this}queryResult(t){return this.data=cw(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:L9(e.channel)?{value:e.as,scale:"color"}:e.as}function PA(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 zl(e,t){let{plot:n}=e,r=n.getAttribute(`${t}Scale`);if(!r){let{field:o}=e.channelField(t,`${t}1`,`${t}2`),{type:s}=e.stats[o.column];r=s==="date"?"time":"linear"}let i={type:r};switch(r){case"log":i.base=n.getAttribute(`${t}Base`)??10;break;case"pow":i.exponent=n.getAttribute(`${t}Exponent`)??1;break;case"symlog":i.constant=n.getAttribute(`${t}Constant`)??1;break}return Mh(i)}function Yr(e,t,n,r,i=1,o){let{field:s}=e.channelField(t);o=o??s;let{type:a,apply:c,sqlApply:l}=zl(e,t),u=!!e.plot.getAttribute(`${t}Reverse`),[f,d]=r.map(b=>c(b)),h=l(o),p=a==="time"||a==="utc"?h:o,m=d===f?0:(n-i)/(d-f),g=m!==1?` * ${m}::DOUBLE`:"";return[u?j`(${d} - ${h}::DOUBLE)${g}`:j`(${h}::DOUBLE - ${f})${g}`,p]}var $A={x:["min","max"]},UA={y:["min","max"]},uw={...$A,...UA};function C9(e,t,n,r,i){let{plot:o,stats:s}=e,a=o.getAttribute(r),c=o.getAttribute(i);if(Array.isArray(a)&&!a[Sn])return a;{let{field:l}=e.channelField(n),{column:u}=l,{min:f,max:d}=s[u],h=zA(t,u)||(c?ks().domain([f,d]).nice().domain():[f,d]);return a!==co&&(h[Sn]=!0),o.setAttribute(r,h,{silent:!0}),h}}function qo(e,t){return C9(e,t,"x","xDomain","xNice")}function jo(e,t){return C9(e,t,"y","yDomain","yNice")}function zA(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 fy=class extends Dn{constructor(t,n,r){let i=t.endsWith("X")?"y":t.endsWith("Y")?"x":null,o={[i]:["min","max"]};super(t,n,r,o),this.dim=i}query(t=[]){let{plot:n,dim:r,source:i,stats:o}=this,{optimize:s=!0}=i.options||{},a=super.query(t);if(!r)return a;let c=r==="x"?"y":"x",l=this.channelField(c)?.as,{field:u,as:f}=this.channelField(r),{type:d}=o[u.column];if(s&&(d==="date"||d==="number")&&l){let{column:p}=u,{max:m,min:g}=o[p],y=r==="x"?n.innerWidth():n.innerHeight(),[b,x]=zA(t,p)||[g,m],[_]=Yr(this,r,y,[b,x],1,f),v=a.select().map(w=>w.as).filter(w=>w!==f&&w!==l);return Ptt(a,_,f,l,v)}else return a.orderby(u)}};function Ptt(e,t,n,r,i=[]){let o=j`FLOOR(${t})::INTEGER`,s=a=>yt.from(e).select(a).groupby(o,i);return yt.union(s([{[n]:ti(n),[r]:mu(r,n)},...i]),s([{[n]:Jr(n),[r]:yu(r,n)},...i]),s([{[n]:mu(n,r),[r]:ti(r)},...i]),s([{[n]:yu(n,r),[r]:Jr(r)},...i])).orderby(i,n)}function qA(e,t="density"){if(ud(e))switch(e.getChild(t).type.typeId){case 2:case 3:case 7:return Float64Array;default:return Array}else return typeof e[0][t]=="number"?Float64Array:Array}function B9(e,t){let n=qA(t);return $9(new n(e),t)}function P9(e,t,n,r,i=[]){if(i.length)return qtt(e*t,n,r,i);{let o={};return r.forEach(s=>{let a=qA(n,s);o[s]=$9(new a(e*t),n,s)}),[o]}}function $9(e,t,n="density"){if(ud(t)){let r=t.numRows;if(r===0)return e;let i=t.getChild("index").toArray(),o=t.getChild(n).toArray();for(let s=0;s<r;++s)e[i[s]]=o[s]}else for(let r of t)e[r.index]=r[n];return e}function qtt(e,t,n,r){let i=n.map(c=>qA(t,c)),o=n.length,s={},a=c=>{let l=s[c];return l||(l=s[c]={},r.forEach((u,f)=>l[u]=c[f]),n.forEach((u,f)=>l[u]=new i[f](e))),l};if(ud(t)){let c=t.numRows;if(c===0)return[];let l=t.getChild("index").toArray(),u=n.map(d=>t.getChild(d).toArray()),f=r.map(d=>t.getChild(d));for(let d=0;d<c;++d){let h=f.map(m=>m.get(d)),p=a(h);for(let m=0;m<o;++m)p[n[m]][l[d]]=u[m][d]}}else for(let c of t){let l=r.map(f=>c[f]),u=a(l);for(let f=0;f<o;++f)u[n[f]][c.index]=c[n[f]]}return Object.values(s)}function dy(e,t){let n=0,r=0;return e.forEach(i=>{let o=i[t],s=o.length;for(let a=0;a<s;++a){let c=o[a];c<n&&(n=c),c>r&&(r=c)}}),n===0&&r===0?[0,1]:[n,r]}function U9(e,t){let n=new Qn;return e.forEach(r=>{let i=r[t],o=i.length;for(let s=0;s<o;++s)n.add(i[s])}),Array.from(n).sort(Ut)}function kn(e,t,n,r){br(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);jtt(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 jtt(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 z9(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);fw(e,n.subarray(u),r,1,o,s,a,f)}for(let l=0;l<r;++l){let u=c.subarray(l);fw(t,u,i,r,o,s,a,u)}return c}function fw(e,t,n,r=1,i=new Float64Array(n),o=new Float64Array(n),s=new Float64Array(5),a=i,c=Vtt){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 Vtt(e,t,n,r,i,o,s,a,c,l){let u=Math.abs(r)*n,f=r<0?u+r:0,d,h,p;for(h=0;h<a;++h)for(l[h]=h<=o?i[h]:0,p=1;p<=a&&p<=h;++p)l[h]-=s[p]*l[h-p];for(p=0;p<a;++p)for(e[p]=0,h=1;h<=p;++h)d=f+r*h,d>=0&&d<u&&(e[p]+=l[p-h]*t[d]);let m=t[f];if(m>0)for(p=0;p<a;++p)e[p]+=l[p]*m}var ra="density",Yi=class extends Dn{constructor(t,n,r){let{bandwidth:i=0,interpolate:o="none",pixelSize:s=1,pad:a=1,width:c,height:l,...u}=r,f=Ytt(u);super(t,n,u,uw),this.densityMap=f,kn(this,"bandwidth",i,()=>this.grids?this.convolve().update():null),kn(this,"pixelSize",s),kn(this,"interpolate",o),kn(this,"pad",a),kn(this,"width",c),kn(this,"height",l)}setPlot(t,n){let r=()=>{this.stats&&this.requestUpdate()};return t.addAttributeListener("domainX",r),t.addAttributeListener("domainY",r),super.setPlot(t,n)}get filterIndexable(){let t=this.plot.getAttribute("xDomain"),n=this.plot.getAttribute("yDomain");return t&&n&&!t[Sn]&&!n[Sn]}query(t=[]){let{interpolate:n,pad:r,channels:i,densityMap:o,source:s}=this,[a,c]=this.extentX=qo(this,t),[l,u]=this.extentY=jo(this,t),[f,d]=this.bins=this.binDimensions(this),[h,p]=Yr(this,"x",f,[a,c],r),[m,g]=Yr(this,"y",d,[l,u],r),y=r?[Te(p,[+a,+c]),Te(g,[+l,+u])]:[bs(+a,p),gs(p,+c),bs(+l,g),gs(g,+u)],b=yt.from(s.table).where(t.concat(y)),x=this.groupby=[],_={};for(let w of i)if(Object.hasOwn(w,"field")){let{as:T,channel:M,field:R}=w;R.aggregate?(_[M]=R,o[M]=!0):M==="weight"?_[ra]=Fr(R):M!=="x"&&M!=="y"&&(b.select({[T]:R}),x.push(T))}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(ra),_.density=kr()),n==="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 Wtt(b,h,m,_[ra],f,x)}else return Gtt(b,h,m,_,f,x)}binDimensions(){let{plot:t,pixelSize:n,width:r,height:i}=this;return[r??Math.round(t.innerWidth()/n),i??Math.round(t.innerHeight()/n)]}queryResult(t){let[n,r]=this.bins;return this.grids=P9(n,r,t,this.aggr,this.groupby),this.convolve()}convolve(){let{aggr:t,bandwidth:n,bins:r,grids:i,plot:o}=this;if(this.kde=this.grids,n>0){let s=t.length===1?t[0]:t.includes(ra)?ra:null;if(!s)return console.warn("No compatible grid found for smoothing."),this;let a=o.innerWidth(),c=o.innerHeight(),[l,u]=r,f=i.some(p=>p[s].some(m=>m<0)),d=hy(n*(l-1)/a,f),h=hy(n*(u-1)/c,f);this.kde=this.grids.map(p=>{let m=z9(d,h,p[s],r);return{...p,[s]:m}})}return this}plotSpecs(){throw new Error("Unimplemented. Use a Grid2D mark subclass.")}};function Ytt(e){let t={};for(let n in e)e[n]==="density"&&(delete e[n],t[n]=!0);return t}function Gtt(e,t,n,r,i,o){return e.select({index:j`FLOOR(${t})::INTEGER + FLOOR(${n})::INTEGER * ${i}`,...r}).groupby("index",o)}function Wtt(e,t,n,r,i,o){let s=r?.column?`* ${r.column}`:"",a=(d,h)=>e.clone().select({xp:t,yp:n,i:d,w:h}),c=a(j`FLOOR(xp)::INTEGER + FLOOR(yp)::INTEGER * ${i}`,j`(FLOOR(xp)::INTEGER + 1 - xp) * (FLOOR(yp)::INTEGER + 1 - yp)${s}`),l=a(j`FLOOR(xp)::INTEGER + (FLOOR(yp)::INTEGER + 1) * ${i}`,j`(FLOOR(xp)::INTEGER + 1 - xp) * (yp - FLOOR(yp)::INTEGER)${s}`),u=a(j`FLOOR(xp)::INTEGER + 1 + FLOOR(yp)::INTEGER * ${i}`,j`(xp - FLOOR(xp)::INTEGER) * (FLOOR(yp)::INTEGER + 1 - yp)${s}`),f=a(j`FLOOR(xp)::INTEGER + 1 + (FLOOR(yp)::INTEGER + 1) * ${i}`,j`(xp - FLOOR(xp)::INTEGER) * (yp - FLOOR(yp)::INTEGER)${s}`);return yt.from(yt.unionAll(c,l,u,f)).select({index:"i",density:Fr("w")},o).groupby("index",o).having(Uc("density",0))}var py=class extends Yi{constructor(t,n){let{thresholds:r=10,...i}=n;super("geo",t,{bandwidth:20,interpolate:"linear",pixelSize:2,...i}),kn(this,"thresholds",r,()=>this.grids?this.contours().update():null)}convolve(){return super.convolve().contours()}contours(){let{bins:t,densityMap:n,kde:r,thresholds:i,plot:o}=this,s=i;if(!Array.isArray(s)){let[,_]=dy(r,"density");s=Array.from({length:s-1},(v,w)=>_*(w+1)/s)}(n.fill||n.stroke)&&this.plot.getAttribute("colorScale")!=="log"&&this.plot.setAttribute("colorZero",!0);let[a,c]=t,[l,u]=o.getAttribute("xDomain"),[f,d]=o.getAttribute("yDomain"),h=(u-l)/a,p=(d-f)/c,m=+l,g=+f,y=_=>m+_*h,b=_=>g+_*p,x=Ca().size(t);return this.data=r.flatMap(_=>s.map(v=>Object.assign(Xtt(x.contour(_.density,v),y,b),{..._,density:v}))),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 Xtt(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 dw(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 q9(e=1){let t=255*e|0;return(n,r,i)=>{for(let o=0,s=0;o<i;++o)for(let a=0;a<r;++a,s+=4)n[s+3]=t}}function j9(e){let{apply:t}=e;return(n,r,i,o)=>{for(let s=0,a=0;s<i;++s)for(let c=0,l=(i-s-1)*r;c<r;++c,a+=4)n[a+3]=255*t(o[c+l])|0}}function V9(e={}){let{r:t=0,g:n=0,b:r=0,opacity:i=1}=typeof e=="string"?rn(e):e,o=new Uint8ClampedArray([t,n,r,255*i|0]);return(s,a,c)=>{for(let l=0,u=0;l<c;++l)for(let f=0;f<a;++f,u+=4)s[u+0]=o[0],s[u+1]=o[1],s[u+2]=o[2],s[u+3]=o[3]}}function Y9(e){let{domain:t,range:n}=e,r=Object.create(null),i=new Uint8ClampedArray(4*t.length),o=t.length-1,s=n.length;for(let a=0;a<=o;++a){let c=n[a%s],{r:l,g:u,b:f,opacity:d=1}=typeof c=="string"?rn(c):c,h=a<<2;i[h+0]=l,i[h+1]=u,i[h+2]=f,i[h+3]=255*d|0,r[t[a]]=h}return(a,c,l,u)=>{if(u.map)for(let f=0,d=0;f<l;++f)for(let h=0,p=(l-f-1)*c;h<c;++h,d+=4){let m=r[u[h+p]];a[d+0]=i[m+0],a[d+1]=i[m+1],a[d+2]=i[m+2],a[d+3]=i[m+3]}else{let f=r[u];for(let d=0,h=0;d<l;++d)for(let p=0;p<c;++p,h+=4)a[h+0]=i[f+0],a[h+1]=i[f+1],a[h+2]=i[f+2],a[h+3]=i[f+3]}}}function G9(e,t,n){let{interpolate:r}=t,i=new Uint8ClampedArray(4*e),o=e-1;for(let s=0;s<=o;++s){let a=r(s/o),{r:c,g:l,b:u,opacity:f=1}=typeof a=="string"?rn(a):a,d=s<<2;i[d+0]=c,i[d+1]=l,i[d+2]=u,i[d+3]=255*f|0}return(s,a,c,l)=>{for(let u=0,f=0;u<c;++u)for(let d=0,h=(c-u-1)*a;d<a;++d,f+=4){let p=o*n(l[d+h])<<2;s[f+0]=i[p+0],s[f+1]=i[p+1],s[f+2]=i[p+2],s[f+3]=i[p+3]}}}var yc=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}=this,[r,i]=t,{canvas:o,ctx:s,img:a}=Ktt(this,r,i),{alpha:c,alphaProp:l,color:u,colorProp:f}=jA(this);return this.data=n.map(d=>(u?.(a.data,r,i,d[f]),c?.(a.data,r,i,d[l]),s.putImageData(a,0,0),{src:o.toDataURL()})),this}plotSpecs(){let{type:t,plot:n,data:r}=this,i={src:"src",width:n.innerWidth(),height:n.innerHeight(),preserveAspectRatio:"none",imageRendering:this.channel("imageRendering")?.value,frameAnchor:"middle"};return[{type:t,data:r,options:i}]}},my=class extends yc{constructor(t,n){super(t,{bandwidth:20,interpolate:"linear",pixelSize:2,...n})}};function jA(e){let{aggr:t,densityMap:n,groupby:r,plot:i}=e,o=t.includes(ra),s=t.includes("fillOpacity"),a=e.channel("fill"),c=e.channel("fillOpacity");if(t.length>2||o&&s)throw new Error("Invalid raster encodings. Try dropping an aggregate?");if(r.includes(c?.as))throw new Error("Raster fillOpacity must be an aggregate or constant.");let l=n.fill||t.includes("fill")?"grid":r.includes(a?.as)?"group":aw(a?.value)?a.value:o&&i.getAttribute("colorScheme")?"grid":void 0,u=n.fillOpacity||t.includes("fillOpacity")?"grid":typeof c?.value=="number"?c.value:o&&l!=="grid"?"grid":void 0;if(l!=="grid"&&u!=="grid")throw new Error("Raster mark missing density values.");let f=a?.as??(l==="grid"?ra:null),d=c?.as??(u==="grid"?ra:null),h=l!=="grid"&&l!=="group"?V9(l):Ztt(e,f),p=u!=="grid"?q9(u):Htt(e,d);return{alphaProp:d,colorProp:f,alpha:p,color:h}}function Htt(e,t){let{plot:n,kde:r}=e,i=n.getAttribute("opacityDomain"),o=i===co,s=i?.[Sn],a=!o&&!s&&i||dy(r,t);(o||s)&&(s&&(a[Sn]=!0),n.setAttribute("colorDomain",a));let c=kf({opacity:{type:n.getAttribute("opacityScale"),domain:a,clamp:n.getAttribute("opacityClamp"),nice:n.getAttribute("opacityNice"),reverse:n.getAttribute("opacityReverse"),zero:n.getAttribute("opacityZero"),base:n.getAttribute("opacityBase"),exponent:n.getAttribute("opacityExponent"),constant:n.getAttribute("opacityConstant")}});return j9(c)}function Ztt(e,t){let{plot:n,kde:r}=e,i=!r[0][t]?.map,o=i||Array.isArray(r[0][t]),s=n.getAttribute("colorDomain"),a=s===co,c=s?.[Sn],l=!a&&!c&&s||(i?r.map(f=>f[t]).sort(Ut):o?U9(r,t):dy(r,t));(a||c)&&(c&&(l[Sn]=!0),n.setAttribute("colorDomain",l));let u=kf({color:{type:n.getAttribute("colorScale"),domain:l,range:n.getAttribute("colorRange"),clamp:n.getAttribute("colorClamp"),n:n.getAttribute("colorN"),nice:n.getAttribute("colorNice"),reverse:n.getAttribute("colorReverse"),scheme:n.getAttribute("colorScheme"),interpolate:n.getAttribute("colorInterpolate"),pivot:n.getAttribute("colorPivot"),symmetric:n.getAttribute("colorSymmetric"),zero:n.getAttribute("colorZero"),base:n.getAttribute("colorBase"),exponent:n.getAttribute("colorExponent"),constant:n.getAttribute("colorConstant")}});if(o)return Y9(u);{let f=kf({x:{type:Qtt(u.type),domain:u.domain,reverse:u.reverse,range:[0,1],clamp:u.clamp,base:u.base,exponent:u.exponent,constant:u.constant}});return G9(1024,u,f.apply)}}function Qtt(e){return e.endsWith("symlog")?"symlog":e.endsWith("log")?"log":e.endsWith("pow")?"pow":e.endsWith("sqrt")?"sqrt":e==="diverging"?"linear":e}function Ktt(e,t,n){if(!e.image||e.image.w!==t||e.image.h!==n){let r=dw(t,n),i=r.getContext("2d",{willReadFrequently:!0}),o=i.getImageData(0,0,t,n);e.image={canvas:r,ctx:i,img:o,w:t,h:n}}return e.image}var yy=class extends yc{constructor(t,n){let{normalize:r=!0,...i}=n;super(t,i),kn(this,"normalize",r)}query(t=[]){let{channels:n,normalize:r,source:i,binPad:o}=this,[s,a]=this.bins=this.binDimensions(this),[c]=Yr(this,"x",s,qo(this,t),o),[l]=Yr(this,"y",a,jo(this,t),o),u=yt.from(i.table).where(Jtt(this,t));this.aggr=["density"];let f=this.groupby=[],d=[];for(let h of n)if(Object.hasOwn(h,"field")){let{channel:p,field:m}=h;p==="z"?(u.select({[p]:m}),d.push("z")):p!=="x"&&p!=="y"&&(u.select({[p]:m}),f.push(p))}return tet(u,c,l,d,s,a,f,r)}};function Jtt(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"?Xn(s.children.filter(a=>i(a))):s;return Array.isArray(t)?t.filter(s=>i(s)).map(s=>o(s)):o(t)}function tet(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(Xn(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($c("dx"))),p=["x"].concat(c).join(", "),m=yt.from("raster").select(c,"x","y",a?{w:j`1.0 / COUNT(*) OVER (PARTITION BY ${p})`}:null).where(Xn(Te("x",[0,i],!0),Te("y",[0,o],!0)));return yt.with({pairs:u,indices:d,raster:h,points:m}).from("points").select(s,{index:j`x + y * ${i}::INTEGER`,density:a?Fr("w"):kr()}).groupby("index",s)}var fd=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"?$A:UA),this.dim=a,kn(this,"bins",i),kn(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[Sn]}query(t=[]){if(this.hasOwnData())throw new Error("Density1DMark requires a data source");let{bins:n,channels:r,dim:i,source:{table:o}}=this,s=this.extent=(i==="x"?qo:jo)(this,t),[a,c]=Yr(this,i,n,s),l=PA(r,o,[i]).where(t.concat(Te(c,s))),u=this.channelField("weight")?"weight":null;return eet(l,a,u)}queryResult(t){return this.grid=B9(this.bins,t),this.convolve()}convolve(){let{bins:t,bandwidth:n,dim:r,grid:i,plot:o,extent:[s,a]}=this,c=i.some(b=>b<0),l=r==="x"?o.innerWidth():o.innerHeight(),u=hy(n*(t-1)/l,c),f=fw(u,i,t),d=this.data=[],h=r==="x"?"y":"x",p=this.channelField(r).as,m=+s,g=(a-m)/(t-1),y=1/g;for(let b=0;b<t;++b)d.push({[p]:m+b*g,[h]:f[b]*y});return this}plotSpecs(){let{type:t,data:n,channels:r,dim:i}=this,o=i==="x"?{y:"y"}:{x:"x"};for(let s of r)o[s.channel]=gi(s);return[{type:t,data:n,options:o}]}};function eet(e,t,n){let r=n?`* ${n}`:"",i=e.clone().select({p:t,i:j`FLOOR(p)::INTEGER`,w:j`(FLOOR(p) + 1 - p)${r}`}),o=e.clone().select({p:t,i:j`FLOOR(p)::INTEGER + 1`,w:j`(p - FLOOR(p))${r}`});return yt.from(yt.unionAll(i,o)).select({index:"i",density:Fr("w")}).groupby("index").having(vh("density",0))}var gy=class extends Yi{constructor(t,n){let{type:r="dot",...i}=n;super(r,t,{bandwidth:20,interpolate:"linear",pad:0,pixelSize:2,...i})}convolve(){super.convolve();let{bins:t,pad:n,extentX:r,extentY:i}=this,[o,s]=t,a=zl(this,"x"),c=zl(this,"y"),[l,u]=r.map(g=>a.apply(g)),[f,d]=i.map(g=>c.apply(g)),h=(u-l)/(o-n),p=(d-f)/(s-n),m=n?0:.5;return this.data=net(this.kde,t,l,f,h,p,a.invert,c.invert,m),this}plotSpecs(){let{type:t,channels:n,densityMap:r,data:i}=this,o={};for(let s of n){let{channel:a}=s;o[a]=a==="x"||a==="y"?a:gi(s)}for(let s in r)r[s]&&(o[s]="density");return[{type:t,data:i,options:o}]}};function net(e,t,n,r,i,o,s,a,c){let l=1/(i*o),[u,f]=t,d=[];for(let h of e){let p=h.density;for(let m=0,g=0;g<f;++g)for(let y=0;y<u;++y,++m)d.push({...h,x:s(n+(y+c)*i),y:a(r+(g+c)*o),density:p[m]*l})}return d}var ret="geom",by=class extends Dn{constructor(t,n={},r){!lw(t)&&!n?.geometry&&(n.geometry=Eh(ret)),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 xy=class extends Dn{constructor(t,n){let{type:r="hexagon",binWidth:i=20,...o}=n;super(r,t,{r:i/2,clip:!0,...o},uw),this.binWidth=i}get filterIndexable(){let t=this.plot.getAttribute("xDomain"),n=this.plot.getAttribute("yDomain");return t&&n&&!t[Sn]&&!n[Sn]}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`,m=`${n.innerHeight()/(l-c)}::DOUBLE`,g,y,b=new Set,x={};for(let M of i)M.channel==="orderby"?_.orderby(M.value):M.channel==="x"?g=M:M.channel==="y"?y=M:Object.hasOwn(M,"field")&&(x[M.as]=M.field,M.field.aggregate&&M.field.columns.forEach(R=>b.add(R)));let _=yt.select({[g.as]:j`${s}::DOUBLE + ((x + 0.5 * (y & 1)) * ${d} + ${u})::DOUBLE / ${p}`,[y.as]:j`${l}::DOUBLE - (y * ${h} + ${f})::DOUBLE / ${m}`,...x}).groupby("x","y"),v=`${p} * (${g.field} - ${s}::DOUBLE)`,w=`${m} * (${l}::DOUBLE - ${y.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(b)).from(o.table).where(ms(g.field),ms(y.field),t);return _.from(T)}};var _y=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{binType:n,binPad:r,channels:i,densityMap:o,source:s}=this,[[a,c],[l,u]]=t,[f,d]=this.bins,[h,p]=Yr(this,"x",f,[a,c],r),[m,g]=Yr(this,"y",d,[l,u],r),y=r?[Te(p,[+a,+c]),Te(g,[+l,+u])]:[bs(+a,p),gs(p,+c),bs(+l,g),gs(g,+u)],b=yt.from(s.table).where(y),x=this.groupby=[],_={};for(let w of i)if(Object.hasOwn(w,"field")){let{as:T,channel:M,field:R}=w;R.aggregate?(_[M]=R,o[M]=!0):M==="weight"?_.density=Fr(R):M!=="x"&&M!=="y"&&(b.select({[T]:R}),x.push(T))}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=kr()),n==="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 cet(b,h,m,_.density,f,x)}else return aet(b,h,m,_,f,x)}async requestTiles(){let t=ei();this.prefetch&&t.cancel(this.prefetch);let{binPad:n,tileX:r,tileY:i,origin:[o,s]}=this,[a,c]=this.bins=this.binDimensions(this),[l,u]=qo(this,this._filter),[f,d]=jo(this,this._filter),h=u-l,p=d-f,m=Math.floor((l-o)*(a-n)/h),g=Math.floor((f-s)*(c-n)/p),y=(I,A)=>[[o+I*h,o+(I+1)*h],[s+A*p,s+(A+1)*p]],b=Math.floor((l-o)/h),x=r?W9((u-o)/h):b,_=Math.floor((f-s)/p),v=i?W9((d-s)/p):_,w=[];for(let I=b;I<=x;++I)for(let A=_;A<=v;++A)w.push([I,A]);let T=w.map(([I,A])=>t.query(this.tileQuery(y(I,A)))),M=[];if(r)for(let I=_;I<=v;++I)M.push([x+1,I]),M.push([b-1,I]);if(i){let I=r?b-1:b,A=r?x+1:x;for(let O=I;O<=A;++O)M.push([O,v+1]),M.push([O,_-1])}this.prefetch=M.map(([I,A])=>t.prefetch(this.tileQuery(y(I,A))));let R=await Promise.all(T);this.grids=[{density:iet(a,c,m,g,w,R)}],this.convolve().update()}convolve(){return super.convolve().rasterize()}rasterize(){let{bins:t,kde:n}=this,[r,i]=t,{canvas:o,ctx:s,img:a}=set(this,r,i),{alpha:c,alphaProp:l,color:u,colorProp:f}=jA(this);return this.data=n.map(d=>(u?.(a.data,r,i,d[f]),c?.(a.data,r,i,d[l]),s.putImageData(a,0,0),{src:o.toDataURL()})),this}plotSpecs(){let{type:t,data:n,plot:r}=this,i={src:"src",width:r.innerWidth(),height:r.innerHeight(),preserveAspectRatio:"none",imageRendering:this.channel("imageRendering")?.value,frameAnchor:"middle"};return[{type:t,data:n,options:i}]}};function iet(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;oet(e,t,s,a,f,d)}),s}function oet(e,t,n,r,i,o){let s=r.numRows;if(s===0)return;let a=r.getChild("index").toArray(),c=r.getChild("density").toArray();for(let l=0;l<s;++l){let u=a[l],f=i+u%e,d=o+Math.floor(u/e);0<=f&&f<e&&0<=d&&d<t&&(n[f+d*e]=c[l])}}function set(e,t,n){if(!e.image||e.image.w!==t||e.image.h!==n){let r=dw(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 aet(e,t,n,r,i,o){return e.select({index:j`FLOOR(${t})::INTEGER + FLOOR(${n})::INTEGER * ${i}`,...r}).groupby("index",o)}function cet(e,t,n,r,i,o){let s=r.column?`* ${r.column}`:"",a=(d,h)=>e.clone().select({xp:t,yp:n,i:d,w:h}),c=a(j`FLOOR(xp)::INTEGER + FLOOR(yp)::INTEGER * ${i}`,j`(FLOOR(xp)::INTEGER + 1 - xp) * (FLOOR(yp)::INTEGER + 1 - yp)${s}`),l=a(j`FLOOR(xp)::INTEGER + (FLOOR(yp)::INTEGER + 1) * ${i}`,j`(FLOOR(xp)::INTEGER + 1 - xp) * (yp - FLOOR(yp)::INTEGER)${s}`),u=a(j`FLOOR(xp)::INTEGER + 1 + FLOOR(yp)::INTEGER * ${i}`,j`(xp - FLOOR(xp)::INTEGER) * (FLOOR(yp)::INTEGER + 1 - yp)${s}`),f=a(j`FLOOR(xp)::INTEGER + 1 + (FLOOR(yp)::INTEGER + 1) * ${i}`,j`(xp - FLOOR(xp)::INTEGER) * (yp - FLOOR(yp)::INTEGER)${s}`);return yt.from(yt.unionAll(c,l,u,f)).select({index:"i",density:Fr("w")},o).groupby("index",o).having(Uc("density",0))}function W9(e){let t=Math.floor(e);return t===e?t-1:t}function uet(e,t,n){var r=1e-8,i=t-1,o=n-1,s=0,a,c,l,u,f,d,h,p,m,g,y;if(e<=0)return 0;if(e>=1)return 1;for(t>=1&&n>=1?(l=e<.5?e:1-e,u=Math.sqrt(-2*Math.log(l)),h=(2.30753+u*.27061)/(1+u*(.99229+u*.04481))-u,e<.5&&(h=-h),p=(h*h-3)/6,m=2/(1/(2*t-1)+1/(2*n-1)),g=h*Math.sqrt(p+m)/m-(1/(2*n-1)-1/(2*t-1))*(p+5/6-2/(3*m)),h=t/(t+n*Math.exp(2*g))):(a=Math.log(t/(t+n)),c=Math.log(n/(t+n)),u=Math.exp(t*a)/t,f=Math.exp(n*c)/n,g=u+f,e<u/g?h=Math.pow(t*g*e,1/t):h=1-Math.pow(n*g*(1-e),1/n)),y=-dd(t)-dd(n)+dd(t+n);s<10;s++){if(h===0||h===1)return h;if(d=fet(h,t,n)-e,u=Math.exp(i*Math.log(h)+o*Math.log(1-h)+y),f=d/u,h-=u=f/(1-.5*Math.min(1,f*(i/h-o/(1-h)))),h<=0&&(h=.5*(h+u)),h>=1&&(h=.5*(h+u+1)),Math.abs(u)<r*h&&s>0)break}return h}function fet(e,t,n){var r=e===0||e===1?0:Math.exp(dd(t+n)-dd(t)-dd(n)+t*Math.log(e)+n*Math.log(1-e));return e<0||e>1?!1:e<(t+1)/(t+n+2)?r*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 dd(e){var t=0,n=[76.18009172947146,-86.5053203294167,24.01409824083091,-1.231739572450155,.001208650973866179,-5395239384953e-18],r=1.000000000190015,i,o,s;for(s=(o=i=e)+5.5,s-=(i+.5)*Math.log(s);t<6;t++)r+=n[t]/++o;return Math.log(2.506628274631*r/i)-s}function H9(e,t){var n=uet(2*Math.min(e,1-e),.5*t,.5);return n=Math.sqrt(t*(1-n)/n),e>.5?n:-n}var wy=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;kn(this,"ci",r,s),kn(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:r2(r,n),slope:i2(r,n),n:o2(r,n),ssy:s2(r,n),ssx:a2(r,n),xm:c2(r,n),x0:gu(ti(n).where(ms(r))),x1:gu(Jr(n).where(ms(r)))}).select(i).groupby(i)}queryResult(t){return this.modelFit=cw(t),this.lineData=this.modelFit.flatMap(n=>det(n)),this.confidenceBand()}confidenceBand(){let{ci:t,modelFit:n,precision:r,plot:i}=this,o=i.innerWidth();return this.areaData=t?n.flatMap(s=>het(t,r,s,o)):null,this}plotSpecs(){let{lineData:t,areaData:n,channels:r,ci:i}=this,o={x:"x",y:"y"},s={x:"x",y1:"y1",y2:"y2",fillOpacity:.1};for(let a of r)switch(a.channel){case"x":case"y":case"fill":break;case"stroke":o.stroke=s.fill=gi(a);break;case"strokeOpacity":o.strokeOpacity=gi(a);break;case"fillOpacity":s.fillOpacity=gi(a);break;default:o[a.channel]=s[a.channel]=gi(a);break}return[...i?[{type:"areaY",data:n,options:s}]:[],{type:"line",data:t,options:o}]}};function det(e){let{x0:t,x1:n,xm:r,intercept:i,slope:o,n:s,ssx:a,ssy:c,...l}=e;return[{x:t,y:i+t*o,...l},{x:n,y:i+n*o,...l}]}function het(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=H9((1-e)/2,l-2)*Math.sqrt(f/(l-2));return $e(i,o-h/2,h).concat(o).map(m=>{let g=a+m*c,y=p*Math.sqrt(1/l+(m-s)**2/u);return{x:m,y1:g-y,y2:g+y,...d}})}function Z9(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 hd(e){let t={};for(let n in e)t[Z9(n)]=e[n];return t}function pet(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 vy=class{constructor(t,{selection:n,channels:r={}}){this.mark=pet(t),this.selection=n;let i=Object.entries(hd(r));this.channels=i.length?i:[["opacity",.2]],this.selection.addEventListener("value",_d(()=>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 met(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 met(e,t){let n=t?.predicate(e);if(!n||n.length===0)return()=>!0;let r=e.filterBy?.predicate(e,!0),i={__:Xn(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 VA(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 Q9(){return VA(wS())}function K9(){return VA(xS())}function J9(){return VA(_S())}function Sy(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 Iy(e,t,n=1){return t.invert(n*Math.floor(e/n))}function hw(){let e=this,t=e.getScreenCTM,n;e.getScreenCTM=()=>e.isConnected?n=t.call(e):n}var pd=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&&hd(a),this.brush=n==="y"?J9():K9(),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=>Iy(r,this.scale,this.pixelSize)).sort((r,i)=>r-i)),Sy(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)],[Gt(o),Gt(s)]]);let a=qt(t).selectAll('g[aria-label="facet"]'),c=a.size()?a:qt(t);if(this.g=c.append("g").attr("class",`interval-${r}`).each(hw).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 pw=(e,t)=>e-t,Ty=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&&hd(a),this.brush=Q9(),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=>Iy(u,i,r)).sort(pw),a=[c[1],l[1]].map(u=>Iy(u,o,r)).sort(pw)}(!Sy(s,n?.[0])||!Sy(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?Xn(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)],[Gt(s),Gt(a)]]);let c=qt(t).selectAll('g[aria-label="facet"]'),l=c.size()?c:qt(t);if(this.g=l.append("g").attr("class","interval-xy").each(hw).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(pw),[d,h]=this.value[1].map(o.apply).sort(pw);this.g.call(n.moveSilent,[[u,d],[f,h]])}t.addEventListener("pointerenter",()=>this.activate())}};var md=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,Dr(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=qt(t).selectAll('g[aria-label="facet"]'),l=c.size()?c:qt(t),u=t.scale(i),f=!ni(o);l.on("pointerdown pointermove",function(d){let[h,p]=Ln(d,this),m=yet(s,a,u.invert(i==="x"?h:p));o.update(f?m:n.clause(m))}),!f&&t.addEventListener("pointerenter",()=>{this.selection.activate(this.clause(0))})}};function yet(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 t$=(e,t)=>e-t,Ey=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=YA(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=get(t,this.xscale);this.xsel.update(this.clause(n,this.xfield,this.xscale))}if(this.pany){let n=bet(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(t$),c=this.yscale.range.slice().sort(t$),l=YA(n,[-1/0,1/0],a),u=YA(r,[-1/0,1/0],c),f=BT().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(qt(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 YA(e,t,n){return e?Array.isArray(e)?e:t:n}function get(e,t){return t.range.map(e.invertX,e).map(t.invert,t)}function bet(e,t){return t.range.map(e.invertY,e).map(t.invert,t)}var ql=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)=>Sh(n[l].field,Dr(c)));return a.length>1?Xn(a):a[0]});i=o.length>1?Pc(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(xet(c,f)){let h=r(f);l.shiftKey&&u?.length?(d=u.filter(p=>GA(p,h)),d.length===u.length&&d.push(h)):u?.length===1&&!GA(u[0],h)?d=null:d=[h]}this.value=d,_et(u,d)&&s.update(this.clause(d))}),t.addEventListener("pointerenter",()=>{this.selection.activate(this.clause([this.channels.map(()=>0)]))})}};function xet(e,t){return e.has(t)||e.has(t.parentNode)||e.has(t.parentNode?.parentNode)}function _et(e,t){return e==null||t==null?e!=null||t!=null:e.length!==t.length||e.some((n,r)=>GA(n,t[r]))}function GA(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 yd=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=wet(t,n);this.selection&&i&&(this.handler=new ql(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 wet({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 vet=new Set(["rectY-x","rectX-y","rect-x","rect-y"]);function mw(e,t={steps:25}){let n=(r,i)=>vet.has(`${r.type}-${i}`)?{[`${i}1`]:WA(r,i,e,t),[`${i}2`]:WA(r,i,e,{...t,offset:1})}:{[i]:WA(r,i,e,t)};return n[Oh]=!0,n}function WA(e,t,n,r){return{column:n,label:n,get stats(){return["min","max"]},get columns(){return[n]},get basis(){return n},toString(){let{apply:i,sqlApply:o,sqlInvert:s}=zl(e,t),{min:a,max:c}=e.stats[n],l=Iet(i(a),i(c),r),u=o(n),f=l.min===0?u:`(${u} - ${l.min})`,d=`${(l.max-l.min)/l.steps}::DOUBLE`,h=r.offset?`${r.offset} + `:"",p=`${l.min} + ${d} * (${h}FLOOR(${f} / ${d}))`;return`${s(p)}`}}}function Iet(e,t,n){let{steps:r=25,minstep:i=0,nice:o=!0}=n;if(o!==!1){let s=t-e,a=r,c=Math.LN10,l=Math.ceil(Math.log(a)/c),u=Math.max(i,Math.pow(10,Math.round(Math.log(s)/c)-l));for(;Math.ceil(s/u)>a;)u*=10;let f=[5,2],d;for(let m=0,g=f.length;m<g;++m)d=u/f[m],d>=i&&s/d<=a&&(u=d);d=Math.log(u);let h=d>=0?0:~~(-d/c)+1,p=Math.pow(10,-h-1);d=Math.floor(e/u+p)*u,e=e<d?d-u:d,t=Math.ceil(t/u)*u,r=Math.round((t-e)/u)}return{min:e,max:t,steps:r}}var Tet=e=>e&&typeof e=="object"&&!Array.isArray(e);var Ay=class extends ur{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=>Tet(f)?f:{value:f}),this.update()),c=c??this.selection?.value??this.data?.[0]?.value,this.selection?.value===void 0&&this.publish(c),this.element.appendChild(this.select),this.selection&&(this.select.addEventListener("input",()=>{this.publish(this.selectedValue()??null)}),ni(this.selection)||this.selection.addEventListener("value",f=>{f!==this.select.value&&this.selectedValue(f)}))}selectedValue(t){if(arguments.length===0){let n=this.select.selectedIndex;return this.data[n].value}else{let n=this.data?.findIndex(r=>r.value===t);n>=0?this.select.selectedIndex=n:this.select.value=String(t)}}reset(){this.select.selectedIndex=this.from?0:-1}publish(t){let{selection:n,column:r}=this;ni(n)?n.update({source:this,schema:{type:"point"},value:t,predicate:t!==""&&t!==void 0?ys(r,Dr(t)):null}):br(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 Eet={contains:Ev,prefix:Av,suffix:Mv,regexp:Tv},Aet=0;var My=class extends ur{constructor({element:t,filterBy:n,from:r,column:i,label:o,type:s="contains",as:a}={}){if(super(n),this.id="search_"+ ++Aet,this.type=s,this.from=r,this.column=i,this.selection=a,this.element=t??document.createElement("div"),this.element.setAttribute("class","input"),this.element.value=this,o){let c=document.createElement("label");c.setAttribute("for",this.id),c.innerText=o,this.element.appendChild(c)}this.searchbox=document.createElement("input"),this.searchbox.setAttribute("id",this.id),this.searchbox.setAttribute("type","text"),this.searchbox.setAttribute("placeholder","Query"),this.element.appendChild(this.searchbox),this.selection&&(this.searchbox.addEventListener("input",()=>{this.publish(this.searchbox.value||null)}),ni(this.selection)||this.selection.addEventListener("value",c=>{c!==this.searchbox.value&&(this.searchbox.value=c)}))}reset(){this.searchbox.value=""}publish(t){let{selection:n,column:r,type:i}=this;ni(n)?n.update({source:this,schema:{type:i},value:t,predicate:t?Eet[i](r,Dr(t)):null}):br(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 Met=0;var Ny=class extends ur{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_"+ ++Met,this.from=a,this.column=c||"value",this.selection=r,this.min=i,this.max=o,this.step=s,this.element=t||document.createElement("div"),this.element.setAttribute("class","input"),this.element.value=this,l){let d=document.createElement("label");d.setAttribute("for",this.id),d.innerText=l,this.element.appendChild(d)}this.slider=document.createElement("input"),this.slider.setAttribute("id",this.id),this.slider.setAttribute("type","range"),f!=null&&(this.slider.style.width=`${+f}px`),i!=null&&this.slider.setAttribute("min",i),o!=null&&this.slider.setAttribute("max",o),s!=null&&this.slider.setAttribute("step",s),u!=null&&(this.slider.setAttribute("value",u),this.selection?.value===void 0&&this.publish(u)),this.element.appendChild(this.slider),this.selection&&(this.slider.addEventListener("input",()=>{this.publish(+this.slider.value)}),ni(this.selection)||this.selection.addEventListener("value",d=>{d!==+this.slider.value&&(this.slider.value=d)}))}query(t=[]){let{from:n,column:r}=this;return!n||this.min!=null&&this.max!=null?null:yt.select({min:ti(r),max:Jr(r)}).from(n).where(t)}queryResult(t){let{min:n,max:r}=Array.from(t)[0];return this.min==null&&this.slider.setAttribute("min",n),this.max==null&&this.slider.setAttribute("max",r),this.step==null&&this.slider.setAttribute("step",(r-n)/500),this}publish(t){let{selection:n,column:r}=this;ni(n)?n.update({source:this,schema:{type:"point"},value:t,predicate:ys(r,Dr(t))}):br(this.selection)&&n.update(t)}};var HA=QA(e=>{let t=yw(e);return n=>n==null?"":typeof n=="number"?t(n):n instanceof Date?ZA(n):`${n}`}),yw=QA(e=>t=>t===0?"0":t.toLocaleString(e)),pqt=HA(),mqt=yw();function ZA(e){return df(e,"Invalid Date")}function QA(e){let t=QA,n;return(r="en")=>r===t?n:n=e(t=r)}var Net=-1;var Ry=class extends ur{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-${++Net}`,this.from=r,this.columns=i,this.format=s,this.align=o,this.widths=typeof a=="object"?a:{},this.offset=0,this.limit=+u,this.pending=!1,this.sortHeader=null,this.sortColumn=null,this.sortDesc=!1,this.element=t||document.createElement("div"),this.element.setAttribute("id",this.id),this.element.value=this,typeof a=="number"&&(this.element.style.width=`${a}px`),c&&(this.element.style.maxWidth=`${c}px`),this.element.style.maxHeight=`${l}px`,this.element.style.overflow="auto";let f=-1;this.element.addEventListener("scroll",d=>{let{pending:h,loaded:p}=this,{scrollHeight:m,scrollTop:g,clientHeight:y}=d.target,b=g<f;f=g,!(b||h||p)&&m-g<2*y&&(this.pending=!0,this.requestData(this.offset+this.limit))}),this.tbl=document.createElement("table"),this.element.appendChild(this.tbl),this.head=document.createElement("thead"),this.tbl.appendChild(this.head),this.body=document.createElement("tbody"),this.tbl.appendChild(this.body),this.style=document.createElement("style"),this.element.appendChild(this.style)}requestData(t=0){this.offset=t;let n=this.query(this.filterBy?.predicate(this));this.requestQuery(n),ei().prefetch(n.clone().offset(t+this.limit))}fields(){return this.columns.map(t=>Sa(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=Ret(this.format,t),this.style.innerText=ket(this.id,Oet(this.align,t),Det(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?_v(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 Ret(e={},t,n){return t.map(({column:r,type:i})=>{if(r in e)return e[r];switch(i){case"number":return yw(n);case"date":return ZA;default:return HA(n)}})}function Oet(e={},t){return t.map(({column:n,type:r})=>n in e?e[n]:r==="number"?"right":"left")}function Det(e={},t){return t.map(({column:n})=>e[n])}function ket(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 Oy(e,...t){let n=e?.context?.coordinator??ei();for(let r of t)n.connect(r)}function gw(e,t,n){let r=new t(n);return Oy(e,r),r.element}function e$(e){return gw(this,Ay,e)}function n$(e){return gw(this,My,e)}function r$(e){return gw(this,Ny,e)}function i$(e){return gw(this,Ry,e)}function o$({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 s$(...e){return o$({direction:"vertical"},e.flat())}function a$(...e){return o$({direction:"horizontal"},e.flat())}function c$({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 l$(e){return c$({dim:"height",size:e})}function u$(e){return c$({dim:"width",size:e})}var h$={};vr(h$,{align:()=>dM,aspectRatio:()=>hM,axis:()=>pM,colorBase:()=>J6,colorClamp:()=>q6,colorConstant:()=>eN,colorDomain:()=>U6,colorExponent:()=>tN,colorInterpolate:()=>G6,colorLabel:()=>H6,colorN:()=>j6,colorNice:()=>V6,colorPivot:()=>W6,colorRange:()=>z6,colorReverse:()=>Z6,colorScale:()=>$6,colorScheme:()=>Y6,colorSymmetric:()=>X6,colorTickFormat:()=>K6,colorZero:()=>Q6,facetGrid:()=>B3,facetLabel:()=>P3,facetMargin:()=>D3,facetMarginBottom:()=>F3,facetMarginLeft:()=>L3,facetMarginRight:()=>C3,facetMarginTop:()=>k3,fxAlign:()=>G3,fxAriaDescription:()=>u6,fxAriaLabel:()=>l6,fxAxis:()=>Z3,fxDomain:()=>$3,fxFontVariant:()=>c6,fxGrid:()=>r6,fxInset:()=>q3,fxInsetLeft:()=>j3,fxInsetRight:()=>V3,fxLabel:()=>o6,fxLabelAnchor:()=>s6,fxLabelOffset:()=>a6,fxLine:()=>i6,fxNice:()=>z3,fxPadding:()=>W3,fxPaddingInner:()=>X3,fxPaddingOuter:()=>H3,fxRange:()=>U3,fxReverse:()=>f6,fxRound:()=>Y3,fxTickFormat:()=>e6,fxTickPadding:()=>t6,fxTickRotate:()=>n6,fxTickSize:()=>K3,fxTickSpacing:()=>J3,fxTicks:()=>Q3,fyAlign:()=>x6,fyAriaDescription:()=>B6,fyAriaLabel:()=>C6,fyAxis:()=>S6,fyDomain:()=>d6,fyFontVariant:()=>L6,fyGrid:()=>R6,fyInset:()=>m6,fyInsetBottom:()=>g6,fyInsetTop:()=>y6,fyLabel:()=>D6,fyLabelAnchor:()=>k6,fyLabelOffset:()=>F6,fyLine:()=>O6,fyNice:()=>p6,fyPadding:()=>_6,fyPaddingInner:()=>w6,fyPaddingOuter:()=>v6,fyRange:()=>h6,fyReverse:()=>P6,fyRound:()=>b6,fyTickFormat:()=>M6,fyTickPadding:()=>A6,fyTickRotate:()=>N6,fyTickSize:()=>T6,fyTickSpacing:()=>E6,fyTicks:()=>I6,grid:()=>yM,height:()=>aM,inset:()=>mM,label:()=>gM,lengthBase:()=>NN,lengthClamp:()=>EN,lengthConstant:()=>ON,lengthDomain:()=>IN,lengthExponent:()=>RN,lengthNice:()=>AN,lengthRange:()=>TN,lengthScale:()=>SN,lengthZero:()=>MN,margin:()=>rM,marginBottom:()=>fM,marginLeft:()=>cM,marginRight:()=>lM,marginTop:()=>uM,margins:()=>nM,name:()=>tM,opacityBase:()=>fN,opacityClamp:()=>oN,opacityConstant:()=>hN,opacityDomain:()=>rN,opacityExponent:()=>dN,opacityLabel:()=>aN,opacityNice:()=>sN,opacityRange:()=>iN,opacityReverse:()=>cN,opacityScale:()=>nN,opacityTickFormat:()=>uN,opacityZero:()=>lN,padding:()=>bM,projectionClip:()=>qN,projectionDomain:()=>CN,projectionInset:()=>BN,projectionInsetBottom:()=>zN,projectionInsetLeft:()=>PN,projectionInsetRight:()=>$N,projectionInsetTop:()=>UN,projectionParallels:()=>kN,projectionPrecision:()=>FN,projectionRotate:()=>LN,projectionType:()=>DN,rBase:()=>_N,rClamp:()=>gN,rConstant:()=>vN,rDomain:()=>mN,rExponent:()=>wN,rNice:()=>bN,rRange:()=>yN,rScale:()=>pN,rZero:()=>xN,round:()=>xM,style:()=>oM,width:()=>sM,xAlign:()=>NM,xAriaDescription:()=>WM,xAriaLabel:()=>GM,xAxis:()=>kM,xBase:()=>ZM,xClamp:()=>AM,xConstant:()=>KM,xDomain:()=>wM,xExponent:()=>QM,xFontVariant:()=>YM,xGrid:()=>UM,xInset:()=>IM,xInsetLeft:()=>TM,xInsetRight:()=>EM,xLabel:()=>qM,xLabelAnchor:()=>jM,xLabelOffset:()=>VM,xLine:()=>zM,xNice:()=>SM,xPadding:()=>RM,xPaddingInner:()=>OM,xPaddingOuter:()=>DM,xRange:()=>vM,xReverse:()=>XM,xRound:()=>MM,xScale:()=>_M,xTickFormat:()=>PM,xTickPadding:()=>BM,xTickRotate:()=>$M,xTickSize:()=>LM,xTickSpacing:()=>CM,xTicks:()=>FM,xZero:()=>HM,xyDomain:()=>iM,yAlign:()=>c3,yAriaDescription:()=>E3,yAriaLabel:()=>T3,yAxis:()=>d3,yBase:()=>N3,yClamp:()=>s3,yConstant:()=>O3,yDomain:()=>t3,yExponent:()=>R3,yFontVariant:()=>I3,yGrid:()=>x3,yInset:()=>r3,yInsetBottom:()=>o3,yInsetTop:()=>i3,yLabel:()=>w3,yLabelAnchor:()=>v3,yLabelOffset:()=>S3,yLine:()=>_3,yNice:()=>n3,yPadding:()=>l3,yPaddingInner:()=>u3,yPaddingOuter:()=>f3,yRange:()=>e3,yReverse:()=>A3,yRound:()=>a3,yScale:()=>JM,yTickFormat:()=>g3,yTickPadding:()=>y3,yTickRotate:()=>b3,yTickSize:()=>p3,yTickSpacing:()=>m3,yTicks:()=>h3,yZero:()=>M3});var Dy=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)}},KA=new Dy;function JA(e,t,n){(e?.context?.namedPlots??KA).request(t,n)}function f$(e,t,n){(e?.context?.namedPlots??KA).set(t,n)}function tM(e){return t=>f$(this,e,t)}function d$(e,t,n){br(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 Fet(e,t){return n=>{d$(n,e,t)}}function eM(e){return t=>{for(let[n,r]of Object.entries(e))d$(t,n,r)}}function nM(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),eM(o)}function rM(e){return eM({marginTop:e,marginBottom:e,marginLeft:e,marginRight:e})}function iM(e){return eM({xDomain:e,yDomain:e})}var k=e=>t=>Fet(e,t),oM=k("style"),sM=k("width"),aM=k("height"),cM=k("marginLeft"),lM=k("marginRight"),uM=k("marginTop"),fM=k("marginBottom"),dM=k("align"),hM=k("aspectRatio"),pM=k("axis"),mM=k("inset"),yM=k("grid"),gM=k("label"),bM=k("padding"),xM=k("round"),_M=k("xScale"),wM=k("xDomain"),vM=k("xRange"),SM=k("xNice"),IM=k("xInset"),TM=k("xInsetLeft"),EM=k("xInsetRight"),AM=k("xClamp"),MM=k("xRound"),NM=k("xAlign"),RM=k("xPadding"),OM=k("xPaddingInner"),DM=k("xPaddingOuter"),kM=k("xAxis"),FM=k("xTicks"),LM=k("xTickSize"),CM=k("xTickSpacing"),BM=k("xTickPadding"),PM=k("xTickFormat"),$M=k("xTickRotate"),UM=k("xGrid"),zM=k("xLine"),qM=k("xLabel"),jM=k("xLabelAnchor"),VM=k("xLabelOffset"),YM=k("xFontVariant"),GM=k("xAriaLabel"),WM=k("xAriaDescription"),XM=k("xReverse"),HM=k("xZero"),ZM=k("xBase"),QM=k("xExponent"),KM=k("xConstant"),JM=k("yScale"),t3=k("yDomain"),e3=k("yRange"),n3=k("yNice"),r3=k("yInset"),i3=k("yInsetTop"),o3=k("yInsetBottom"),s3=k("yClamp"),a3=k("yRound"),c3=k("yAlign"),l3=k("yPadding"),u3=k("yPaddingInner"),f3=k("yPaddingOuter"),d3=k("yAxis"),h3=k("yTicks"),p3=k("yTickSize"),m3=k("yTickSpacing"),y3=k("yTickPadding"),g3=k("yTickFormat"),b3=k("yTickRotate"),x3=k("yGrid"),_3=k("yLine"),w3=k("yLabel"),v3=k("yLabelAnchor"),S3=k("yLabelOffset"),I3=k("yFontVariant"),T3=k("yAriaLabel"),E3=k("yAriaDescription"),A3=k("yReverse"),M3=k("yZero"),N3=k("yBase"),R3=k("yExponent"),O3=k("yConstant"),D3=k("facetMargin"),k3=k("facetMarginTop"),F3=k("facetMarginBottom"),L3=k("facetMarginLeft"),C3=k("facetMarginRight"),B3=k("facetGrid"),P3=k("facetLabel"),$3=k("fxDomain"),U3=k("fxRange"),z3=k("fxNice"),q3=k("fxInset"),j3=k("fxInsetLeft"),V3=k("fxInsetRight"),Y3=k("fxRound"),G3=k("fxAlign"),W3=k("fxPadding"),X3=k("fxPaddingInner"),H3=k("fxPaddingOuter"),Z3=k("fxAxis"),Q3=k("fxTicks"),K3=k("fxTickSize"),J3=k("fxTickSpacing"),t6=k("fxTickPadding"),e6=k("fxTickFormat"),n6=k("fxTickRotate"),r6=k("fxGrid"),i6=k("fxLine"),o6=k("fxLabel"),s6=k("fxLabelAnchor"),a6=k("fxLabelOffset"),c6=k("fxFontVariant"),l6=k("fxAriaLabel"),u6=k("fxAriaDescription"),f6=k("fxReverse"),d6=k("fyDomain"),h6=k("fyRange"),p6=k("fyNice"),m6=k("fyInset"),y6=k("fyInsetTop"),g6=k("fyInsetBottom"),b6=k("fyRound"),x6=k("fyAlign"),_6=k("fyPadding"),w6=k("fyPaddingInner"),v6=k("fyPaddingOuter"),S6=k("fyAxis"),I6=k("fyTicks"),T6=k("fyTickSize"),E6=k("fyTickSpacing"),A6=k("fyTickPadding"),M6=k("fyTickFormat"),N6=k("fyTickRotate"),R6=k("fyGrid"),O6=k("fyLine"),D6=k("fyLabel"),k6=k("fyLabelAnchor"),F6=k("fyLabelOffset"),L6=k("fyFontVariant"),C6=k("fyAriaLabel"),B6=k("fyAriaDescription"),P6=k("fyReverse"),$6=k("colorScale"),U6=k("colorDomain"),z6=k("colorRange"),q6=k("colorClamp"),j6=k("colorN"),V6=k("colorNice"),Y6=k("colorScheme"),G6=k("colorInterpolate"),W6=k("colorPivot"),X6=k("colorSymmetric"),H6=k("colorLabel"),Z6=k("colorReverse"),Q6=k("colorZero"),K6=k("colorTickFormat"),J6=k("colorBase"),tN=k("colorExponent"),eN=k("colorConstant"),nN=k("opacityScale"),rN=k("opacityDomain"),iN=k("opacityRange"),oN=k("opacityClamp"),sN=k("opacityNice"),aN=k("opacityLabel"),cN=k("opacityReverse"),lN=k("opacityZero"),uN=k("opacityTickFormat"),fN=k("opacityBase"),dN=k("opacityExponent"),hN=k("opacityConstant"),pN=k("rScale"),mN=k("rDomain"),yN=k("rRange"),gN=k("rClamp"),bN=k("rNice"),xN=k("rZero"),_N=k("rBase"),wN=k("rExponent"),vN=k("rConstant"),SN=k("lengthScale"),IN=k("lengthDomain"),TN=k("lengthRange"),EN=k("lengthClamp"),AN=k("lengthNice"),MN=k("lengthZero"),NN=k("lengthBase"),RN=k("lengthExponent"),ON=k("lengthConstant"),DN=k("projectionType"),kN=k("projectionParallels"),FN=k("projectionPrecision"),LN=k("projectionRotate"),CN=k("projectionDomain"),BN=k("projectionInset"),PN=k("projectionInsetLeft"),$N=k("projectionInsetRight"),UN=k("projectionInsetTop"),zN=k("projectionInsetBottom"),qN=k("projectionClip");function p$(e,t){return{table:e,options:t}}var m$={};vr(m$,{area:()=>VN,areaX:()=>YN,areaY:()=>GN,arrow:()=>B4,axisFx:()=>q4,axisFy:()=>j4,axisX:()=>U4,axisY:()=>z4,barX:()=>ZN,barY:()=>QN,cell:()=>KN,cellX:()=>JN,cellY:()=>t4,circle:()=>a4,contour:()=>T4,delaunayLink:()=>F4,delaunayMesh:()=>L4,denseLine:()=>I4,density:()=>S4,densityX:()=>w4,densityY:()=>v4,dot:()=>i4,dotX:()=>o4,dotY:()=>s4,frame:()=>$4,geo:()=>X4,graticule:()=>Z4,gridFx:()=>G4,gridFy:()=>W4,gridX:()=>V4,gridY:()=>Y4,heatmap:()=>E4,hexagon:()=>c4,hexbin:()=>N4,hexgrid:()=>R4,hull:()=>C4,image:()=>_4,line:()=>WN,lineX:()=>XN,lineY:()=>HN,link:()=>P4,raster:()=>A4,rasterTile:()=>M4,rect:()=>e4,rectX:()=>n4,rectY:()=>r4,regressionY:()=>O4,ruleX:()=>d4,ruleY:()=>h4,sphere:()=>H4,spike:()=>x4,text:()=>l4,textX:()=>u4,textY:()=>f4,tickX:()=>p4,tickY:()=>m4,vector:()=>y4,vectorX:()=>g4,vectorY:()=>b4,voronoi:()=>D4,voronoiMesh:()=>k4});var Let=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=Let.has(e)?null:[{}]);let r=e.startsWith("area")||e.startsWith("line")?fy:Dn;return jN(r,e,t,n)}function jN(e,t,n,r){return i=>{i.addMark(new e(t,n,r))}}function ia(e,t,n){return r=>{r.addMark(new e(t,n))}}var VN=(...e)=>St("area",...e),YN=(...e)=>St("areaX",...e),GN=(...e)=>St("areaY",...e),WN=(...e)=>St("line",...e),XN=(...e)=>St("lineX",...e),HN=(...e)=>St("lineY",...e),ZN=(...e)=>St("barX",...e),QN=(...e)=>St("barY",...e),KN=(...e)=>St("cell",...e),JN=(...e)=>St("cellX",...e),t4=(...e)=>St("cellY",...e),e4=(...e)=>St("rect",...e),n4=(...e)=>St("rectX",...e),r4=(...e)=>St("rectY",...e),i4=(...e)=>St("dot",...e),o4=(...e)=>St("dotX",...e),s4=(...e)=>St("dotY",...e),a4=(...e)=>St("circle",...e),c4=(...e)=>St("hexagon",...e),l4=(...e)=>St("text",...e),u4=(...e)=>St("textX",...e),f4=(...e)=>St("textY",...e),d4=(...e)=>St("ruleX",...e),h4=(...e)=>St("ruleY",...e),p4=(...e)=>St("tickX",...e),m4=(...e)=>St("tickY",...e),y4=(...e)=>St("vector",...e),g4=(...e)=>St("vectoX",...e),b4=(...e)=>St("vectorY",...e),x4=(...e)=>St("spike",...e),_4=(...e)=>St("image",...e),w4=(...e)=>jN(fd,"areaX",...e),v4=(...e)=>jN(fd,"areaY",...e),S4=(...e)=>ia(gy,...e),I4=(...e)=>ia(yy,...e),T4=(...e)=>ia(py,...e),E4=(...e)=>ia(my,...e),A4=(...e)=>ia(yc,...e),M4=(...e)=>ia(_y,...e),N4=(...e)=>ia(xy,...e),R4=(...e)=>St("hexgrid",...e),O4=(...e)=>ia(wy,...e),D4=(...e)=>St("voronoi",...e),k4=(...e)=>St("voronoiMesh",...e),F4=(...e)=>St("delaunayLink",...e),L4=(...e)=>St("delaunayMesh",...e),C4=(...e)=>St("hull",...e),B4=(...e)=>St("arrow",...e),P4=(...e)=>St("link",...e),$4=(...e)=>St("frame",...e),U4=(...e)=>St("axisX",...e),z4=(...e)=>St("axisY",...e),q4=(...e)=>St("axisFx",...e),j4=(...e)=>St("axisFy",...e),V4=(...e)=>St("gridX",...e),Y4=(...e)=>St("gridY",...e),G4=(...e)=>St("gridFx",...e),W4=(...e)=>St("gridFy",...e),X4=(...e)=>ia(by,...e),H4=(...e)=>St("sphere",...e),Z4=(...e)=>St("graticule",...e);var y$={};vr(y$,{highlight:()=>Q4,intervalX:()=>rR,intervalXY:()=>oR,intervalY:()=>iR,nearestX:()=>eR,nearestY:()=>nR,pan:()=>sR,panX:()=>aR,panY:()=>cR,panZoom:()=>lR,panZoomX:()=>uR,panZoomY:()=>fR,toggle:()=>gd,toggleColor:()=>tR,toggleX:()=>K4,toggleY:()=>J4});function gc(e,t){return n=>{let r=n.marks[n.marks.length-1];n.addInteractor(new e(r,t))}}function Q4({by:e,...t}){return gc(vy,{selection:e,channels:t})}function gd({as:e,...t}){return gc(ql,{...t,selection:e})}function K4(e){return gd({...e,channels:["x"]})}function J4(e){return gd({...e,channels:["y"]})}function tR(e){return gd({...e,channels:["color"]})}function eR({as:e,...t}){return gc(md,{...t,selection:e,channel:"x"})}function nR({as:e,...t}){return gc(md,{...t,selection:e,channel:"y"})}function rR({as:e,...t}){return gc(pd,{...t,selection:e,channel:"x"})}function iR({as:e,...t}){return gc(pd,{...t,selection:e,channel:"y"})}function oR({as:e,...t}){return gc(Ty,{...t,selection:e})}function bd(e){return gc(Ey,e)}function sR(e={}){return bd({...e,zoom:!1})}function aR(e={}){return bd({...e,zoom:!1,pany:!1})}function cR(e={}){return bd({...e,zoom:!1,panx:!1})}function lR(e={}){return bd(e)}function uR(e={}){return bd({...e,pany:!1})}function fR(e={}){return bd({...e,panx:!1})}var g$={};vr(g$,{colorLegend:()=>hR,opacityLegend:()=>pR,symbolLegend:()=>mR});function dR(e,t={}){if(t.for){let{for:n,...r}=t,i=new yd(e,r),o=typeof n,s=a=>a.addLegend(i,!1);return o==="string"?JA(this,n,s):n.value&&s(n.value),i.element}else return n=>n.addLegend(new yd(e,t))}function hR(e){return dR.call(this,"color",e)}function pR(e){return dR.call(this,"opacity",e)}function mR(e){return dR.call(this,"symbol",e)}function b$(...e){let t=new uy;return e.flat().forEach(n=>n(t)),Oy(this,...t.marks),t.element}function Cet({coordinator:e=ei(),namedPlots:t=new Dy,extensions:n=null,...r}={}){return{...yR,...n,context:{coordinator:e,namedPlots:t,...r}}}export{Nh as Coordinator,co as Fixed,ur as MosaicClient,Aa as Param,yt as Query,xs as Selection,zv as agg,dM as align,Xn as and,VN as area,YN as areaX,GN as areaY,yu as argmax,mu as argmin,d2 as arrayAgg,B4 as arrow,hM as aspectRatio,h$ as attributeDirectives,qv as avg,pM as axis,q4 as axisFx,j4 as axisFy,U4 as axisX,z4 as axisY,ZN as barX,QN as barY,mw as bin,Th as cast,gu as castDouble,h2 as castInteger,KN as cell,JN as cellX,t4 as cellY,Ah as centroid,b2 as centroidX,x2 as centroidY,a4 as circle,J6 as colorBase,q6 as colorClamp,eN as colorConstant,U6 as colorDomain,tN as colorExponent,G6 as colorInterpolate,H6 as colorLabel,hR as colorLegend,j6 as colorN,V6 as colorNice,W6 as colorPivot,z6 as colorRange,Z6 as colorReverse,$6 as colorScale,Y6 as colorScheme,X6 as colorSymmetric,K6 as colorTickFormat,Q6 as colorZero,Sa as column,Oy as connect,T4 as contour,ei as coordinator,e2 as corr,kr as count,n2 as covarPop,Ea as create,Cet as createAPIContext,kv as cume_dist,g2 as dateDay,m2 as dateMonth,y2 as dateMonthDay,F4 as delaunayLink,L4 as delaunayMesh,I4 as denseLine,Ov as dense_rank,S4 as density,w4 as densityX,v4 as densityY,i4 as dot,o4 as dotX,s4 as dotY,Kv as entropy,ys as eq,B3 as facetGrid,P3 as facetLabel,D3 as facetMargin,F3 as facetMarginBottom,L3 as facetMarginLeft,C3 as facetMarginRight,k3 as facetMarginTop,l2 as first,Bv as first_value,$4 as frame,p$ as from,G3 as fxAlign,u6 as fxAriaDescription,l6 as fxAriaLabel,Z3 as fxAxis,$3 as fxDomain,c6 as fxFontVariant,r6 as fxGrid,q3 as fxInset,j3 as fxInsetLeft,V3 as fxInsetRight,o6 as fxLabel,s6 as fxLabelAnchor,a6 as fxLabelOffset,i6 as fxLine,z3 as fxNice,W3 as fxPadding,X3 as fxPaddingInner,H3 as fxPaddingOuter,U3 as fxRange,f6 as fxReverse,Y3 as fxRound,e6 as fxTickFormat,t6 as fxTickPadding,n6 as fxTickRotate,K3 as fxTickSize,J3 as fxTickSpacing,Q3 as fxTicks,x6 as fyAlign,B6 as fyAriaDescription,C6 as fyAriaLabel,S6 as fyAxis,d6 as fyDomain,L6 as fyFontVariant,R6 as fyGrid,m6 as fyInset,g6 as fyInsetBottom,y6 as fyInsetTop,D6 as fyLabel,k6 as fyLabelAnchor,F6 as fyLabelOffset,O6 as fyLine,p6 as fyNice,_6 as fyPadding,w6 as fyPaddingInner,v6 as fyPaddingOuter,h6 as fyRange,P6 as fyReverse,b6 as fyRound,M6 as fyTickFormat,A6 as fyTickPadding,N6 as fyTickRotate,T6 as fyTickSize,E6 as fyTickSpacing,I6 as fyTicks,X4 as geo,Eh as geojson,Z4 as graticule,yM as grid,G4 as gridFx,W4 as gridFy,V4 as gridX,Y4 as gridY,vh as gt,vv as gte,a$ as hconcat,E4 as heatmap,aM as height,c4 as hexagon,N4 as hexbin,R4 as hexgrid,Q4 as highlight,u$ as hspace,C4 as hull,_4 as image,mM as inset,y$ as interactorDirectives,rR as intervalX,oR as intervalXY,iR as intervalY,Te as isBetween,Sv as isDistinct,Iv as isNotBetween,Sh as isNotDistinct,ms as isNotNull,$c as isNull,Qv as kurtosis,gM as label,Lv as lag,u2 as last,Pv as last_value,Cv as lead,g$ as legendDirectives,NN as lengthBase,EN as lengthClamp,ON as lengthConstant,IN as lengthDomain,RN as lengthExponent,AN as lengthNice,TN as lengthRange,SN as lengthScale,MN as lengthZero,WN as line,XN as lineX,HN as lineY,P4 as link,Dr as literal,v2 as loadCSV,_2 as loadExtension,S2 as loadJSON,E2 as loadObjects,I2 as loadParquet,T2 as loadSpatial,gs as lt,bs as lte,jv as mad,rM as margin,fM as marginBottom,cM as marginLeft,lM as marginRight,uM as marginTop,nM as margins,m$ as markDirectives,Jr as max,Yv as median,e$ as menu,ti as min,Wv as mode,tM as name,KA as namedPlots,eR as nearestX,nR as nearestY,Uc as neq,wv as not,$v as nth_value,Fv as ntile,fN as opacityBase,oN as opacityClamp,hN as opacityConstant,rN as opacityDomain,dN as opacityExponent,aN as opacityLabel,pR as opacityLegend,sN as opacityNice,iN as opacityRange,cN as opacityReverse,nN as opacityScale,uN as opacityTickFormat,lN as opacityZero,Pc as or,bM as padding,sR as pan,aR as panX,cR as panY,lR as panZoom,uR as panZoomX,fR as panZoomY,Dv as percent_rank,b$ as plot,Vv as product,qN as projectionClip,CN as projectionDomain,BN as projectionInset,zN as projectionInsetBottom,PN as projectionInsetLeft,$N as projectionInsetRight,UN as projectionInsetTop,kN as projectionParallels,FN as projectionPrecision,LN as projectionRotate,DN as projectionType,Gv as quantile,_N as rBase,gN as rClamp,vN as rConstant,mN as rDomain,wN as rExponent,bN as rNice,yN as rRange,pN as rScale,xN as rZero,Rv as rank,A4 as raster,M4 as rasterTile,e4 as rect,n4 as rectX,r4 as rectY,O4 as regressionY,JA as requestNamedPlot,BD as restConnector,xM as round,Nv as row_number,d4 as ruleX,h4 as ruleY,n$ as search,Zv as skewness,r$ as slider,l0 as socketConnector,H4 as sphere,x4 as spike,j as sql,Hv as stddev,t2 as stddevPop,f2 as stringAgg,oM as style,Fr as sum,mR as symbolLegend,i$ as table,l4 as text,u4 as textX,f4 as textY,p4 as tickX,m4 as tickY,gd as toggle,tR as toggleColor,K4 as toggleX,J4 as toggleY,Jv as varPop,Xv as variance,s$ as vconcat,y4 as vector,g4 as vectorX,b4 as vectorY,D4 as voronoi,k4 as voronoiMesh,l$ as vspace,YD as wasmConnector,sM as width,NM as xAlign,WM as xAriaDescription,GM as xAriaLabel,kM as xAxis,ZM as xBase,AM as xClamp,KM as xConstant,wM as xDomain,QM as xExponent,YM as xFontVariant,UM as xGrid,IM as xInset,TM as xInsetLeft,EM as xInsetRight,qM as xLabel,jM as xLabelAnchor,VM as xLabelOffset,zM as xLine,SM as xNice,RM as xPadding,OM as xPaddingInner,DM as xPaddingOuter,vM as xRange,XM as xReverse,MM as xRound,_M as xScale,PM as xTickFormat,BM as xTickPadding,$M as xTickRotate,LM as xTickSize,CM as xTickSpacing,FM as xTicks,HM as xZero,iM as xyDomain,c3 as yAlign,E3 as yAriaDescription,T3 as yAriaLabel,d3 as yAxis,N3 as yBase,s3 as yClamp,O3 as yConstant,t3 as yDomain,R3 as yExponent,I3 as yFontVariant,x3 as yGrid,r3 as yInset,o3 as yInsetBottom,i3 as yInsetTop,w3 as yLabel,v3 as yLabelAnchor,S3 as yLabelOffset,_3 as yLine,n3 as yNice,l3 as yPadding,u3 as yPaddingInner,f3 as yPaddingOuter,e3 as yRange,A3 as yReverse,a3 as yRound,JM as yScale,g3 as yTickFormat,y3 as yTickPadding,b3 as yTickRotate,p3 as yTickSize,m3 as yTickSpacing,h3 as yTicks,M3 as yZero};